/** Loads the settings for this page */ void ShareManager::load() { if(isLoading) return ; isLoading = true; // std::cerr << "ShareManager:: In load !!!!!" << std::endl ; std::list<SharedDirInfo>::const_iterator it; std::list<SharedDirInfo> dirs; rsFiles->getSharedDirectories(dirs); /* get a link to the table */ QTableWidget *listWidget = ui.shareddirList; /* set new row count */ listWidget->setRowCount(dirs.size()); int row=0 ; for(it = dirs.begin(); it != dirs.end(); ++it,++row) { listWidget->setItem(row, COLUMN_PATH, new QTableWidgetItem(QString::fromUtf8((*it).filename.c_str()))); listWidget->setItem(row, COLUMN_VIRTUALNAME, new QTableWidgetItem(QString::fromUtf8((*it).virtualname.c_str()))); GroupFlagsWidget *widget = new GroupFlagsWidget(NULL,(*it).shareflags); listWidget->setRowHeight(row, 32); listWidget->setCellWidget(row, COLUMN_SHARE_FLAGS, widget); listWidget->setItem(row, COLUMN_GROUPS, new QTableWidgetItem()) ; listWidget->item(row,COLUMN_GROUPS)->setBackgroundColor(QColor(183,236,181)) ; //connect(widget,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateFlags())) ; } listWidget->setColumnWidth(COLUMN_SHARE_FLAGS,132) ; //ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory())); listWidget->update(); /* update display */ update(); isLoading = false ; updateGroups(); }
void QuickStartWizard::loadShare() { std::cerr << "ShareManager:: In load !!!!!" << std::endl ; std::list<SharedDirInfo>::const_iterator it; std::list<SharedDirInfo> dirs; rsFiles->getSharedDirectories(dirs); ui.shareIncomingDirectory->setChecked(rsFiles->getShareDownloadDirectory()); /* get a link to the table */ QTableWidget *listWidget = ui.shareddirList; /* remove old items ??? */ listWidget->clearContents() ; listWidget->setRowCount(0) ; connect(this,SIGNAL(itemClicked(QTableWidgetItem*)),this,SLOT(updateFlags(QTableWidgetItem*))) ; int row=0 ; for(it = dirs.begin(); it != dirs.end(); ++it,++row) { listWidget->insertRow(row) ; listWidget->setItem(row,0,new QTableWidgetItem(QString::fromStdString((*it).filename))); #ifdef USE_COMBOBOX QComboBox *cb = new QComboBox ; cb->addItem(tr("Network Wide")) ; cb->addItem(tr("Browsable")) ; cb->addItem(tr("Universal")) ; cb->setToolTip(tr("Please decide whether this directory is\n* Network Wide: \tanonymously shared over the network (including your friends)\n* Browsable: \tbrowsable by your friends\n* Universal: \t\tboth")) ; // TODO // - set combobox current value depending on what rsFiles reports. // - use a signal mapper to get the correct row that contains the combo box sending the signal: // mapper = new SignalMapper(this) ; // // for(all cb) // { // signalMapper->setMapping(cb,...) // } // int index = 0 ; index += ((*it).shareflags & RS_FILE_HINTS_NETWORK_WIDE) > 0 ; index += (((*it).shareflags & RS_FILE_HINTS_BROWSABLE) > 0) * 2 ; listWidget->setCellWidget(row,1,cb); if(index < 1 || index > 3) std::cerr << "******* ERROR IN FILE SHARING FLAGS. Flags = " << (*it).shareflags << " ***********" << std::endl ; else index-- ; cb->setCurrentIndex(index) ; #else QCheckBox *cb1 = new QCheckBox ; QCheckBox *cb2 = new QCheckBox ; cb1->setChecked( (*it).shareflags & DIR_FLAGS_NETWORK_WIDE_OTHERS ) ; cb2->setChecked( (*it).shareflags & DIR_FLAGS_BROWSABLE_OTHERS ) ; cb1->setToolTip(tr("If checked, the share is anonymously shared to anybody.")) ; cb2->setToolTip(tr("If checked, the share is browsable by your friends.")) ; listWidget->setCellWidget(row,1,cb1); listWidget->setCellWidget(row,2,cb2); QObject::connect(cb1,SIGNAL(toggled(bool)),this,SLOT(updateFlags(bool))) ; QObject::connect(cb2,SIGNAL(toggled(bool)),this,SLOT(updateFlags(bool))) ; #endif } //ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory())); listWidget->update(); /* update display */ update(); }