CaptureInterfacesDialog::CaptureInterfacesDialog(QWidget *parent) : QDialog(parent), ui(new Ui::CaptureInterfacesDialog) { ui->setupUi(this); stat_timer_ = NULL; stat_cache_ = NULL; // XXX - Enable / disable as needed start_bt_ = ui->buttonBox->addButton(tr("Start"), QDialogButtonBox::YesRole); start_bt_->setEnabled((global_capture_opts.num_selected > 0)? true: false); connect(start_bt_, SIGNAL(clicked(bool)), this, SLOT(start_button_clicked())); connect(ui->tbInterfaces,SIGNAL(itemClicked(QTableWidgetItem *)),this,SLOT(tableItemClicked(QTableWidgetItem *))); connect(ui->tbInterfaces, SIGNAL(itemSelectionChanged()), this, SLOT(tableSelected())); connect(ui->allFilterComboBox, SIGNAL(captureFilterSyntaxChanged(bool)), this, SLOT(allFilterChanged())); connect(this, SIGNAL(interfacesChanged()), ui->allFilterComboBox, SIGNAL(interfacesChanged())); connect(this, SIGNAL(ifsChanged()), this, SLOT(refreshInterfaceList())); connect(wsApp, SIGNAL(localInterfaceListChanged()), this, SLOT(updateLocalInterfaces())); }
/** This is a generic class for importing line-oriented data from text files. It provides a dialog for file selection, preview, separator selection and column assignment as well as generic conversion routines. For conversion to special data objects, this class has to be inherited by a special class, which reimplements the convertRow() function. */ KImportDialog::KImportDialog(QWidget *parent) : KDialogBase(parent, "importdialog", true, i18n("Import Text File"), Ok | Cancel), mSeparator(","), mCurrentRow(0) { mData.setAutoDelete(true); QVBox *topBox = new QVBox(this); setMainWidget(topBox); topBox->setSpacing(spacingHint()); QHBox *fileBox = new QHBox(topBox); fileBox->setSpacing(spacingHint()); new QLabel(i18n("File to import:"), fileBox); KURLRequester *urlRequester = new KURLRequester(fileBox); urlRequester->setFilter("*.csv"); connect(urlRequester, SIGNAL(returnPressed(const QString &)), SLOT(setFile(const QString &))); connect(urlRequester, SIGNAL(urlSelected(const QString &)), SLOT(setFile(const QString &))); connect(urlRequester->lineEdit(), SIGNAL(textChanged(const QString &)), SLOT(slotUrlChanged(const QString &))); mTable = new QTable(5, 5, topBox); mTable->setMinimumHeight(150); connect(mTable, SIGNAL(selectionChanged()), SLOT(tableSelected())); QHBox *separatorBox = new QHBox(topBox); separatorBox->setSpacing(spacingHint()); new QLabel(i18n("Separator:"), separatorBox); mSeparatorCombo = new KComboBox(separatorBox); mSeparatorCombo->insertItem(","); mSeparatorCombo->insertItem(i18n("Tab")); mSeparatorCombo->insertItem(i18n("Space")); mSeparatorCombo->insertItem("="); mSeparatorCombo->insertItem(";"); connect(mSeparatorCombo, SIGNAL(activated(int)), this, SLOT(separatorClicked(int))); mSeparatorCombo->setCurrentItem(0); QHBox *rowsBox = new QHBox(topBox); rowsBox->setSpacing(spacingHint()); new QLabel(i18n("Import starts at row:"), rowsBox); mStartRow = new QSpinBox(rowsBox); mStartRow->setMinValue(1); /* new QLabel( i18n( "And ends at row:" ), rowsBox ); mEndRow = new QSpinBox( rowsBox ); mEndRow->setMinValue( 1 ); */ QVBox *assignBox = new QVBox(topBox); assignBox->setSpacing(spacingHint()); QHBox *listsBox = new QHBox(assignBox); listsBox->setSpacing(spacingHint()); mHeaderList = new QListView(listsBox); mHeaderList->addColumn(i18n("Header")); connect(mHeaderList, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(headerSelected(QListViewItem *))); connect(mHeaderList, SIGNAL(doubleClicked(QListViewItem *)), SLOT(assignColumn(QListViewItem *))); mFormatCombo = new KComboBox(listsBox); mFormatCombo->setDuplicatesEnabled(false); QPushButton *assignButton = new QPushButton(i18n("Assign to Selected Column"), assignBox); connect(assignButton, SIGNAL(clicked()), SLOT(assignColumn())); QPushButton *removeButton = new QPushButton(i18n("Remove Assignment From Selected Column"), assignBox); connect(removeButton, SIGNAL(clicked()), SLOT(removeColumn())); QPushButton *assignTemplateButton = new QPushButton(i18n("Assign with Template..."), assignBox); connect(assignTemplateButton, SIGNAL(clicked()), SLOT(assignTemplate())); QPushButton *saveTemplateButton = new QPushButton(i18n("Save Current Template"), assignBox); connect(saveTemplateButton, SIGNAL(clicked()), SLOT(saveTemplate())); resize(500, 300); connect(this, SIGNAL(okClicked()), SLOT(applyConverter())); connect(this, SIGNAL(applyClicked()), SLOT(applyConverter())); enableButtonOK(!urlRequester->lineEdit()->text().isEmpty()); }