00001 #include "chiasmuskeyselector.h"
00002
00003 #include <klineedit.h>
00004 #include <klistbox.h>
00005 #include <klocale.h>
00006
00007 #include <tqlayout.h>
00008 #include <tqlabel.h>
00009
00010 ChiasmusKeySelector::ChiasmusKeySelector( TQWidget* parent, const TQString& caption,
00011 const TQStringList& keys, const TQString& currentKey,
00012 const TQString& lastOptions )
00013 : KDialogBase( parent, "chiasmusKeySelector", true, caption, Ok|Cancel, Ok, true )
00014 {
00015 TQWidget *page = makeMainWidget();
00016
00017 TQVBoxLayout *layout = new TQVBoxLayout(page, KDialog::spacingHint());
00018
00019 mLabel = new TQLabel( i18n( "Please select the Chiasmus key file to use:" ), page );
00020 layout->addWidget( mLabel );
00021
00022 mListBox = new KListBox( page );
00023 mListBox->insertStringList( keys );
00024 const int current = keys.findIndex( currentKey );
00025 mListBox->setSelected( TQMAX( 0, current ), true );
00026 mListBox->ensureCurrentVisible();
00027 layout->addWidget( mListBox, 1 );
00028
00029 TQLabel* optionLabel = new TQLabel( i18n( "Additional arguments for chiasmus:" ), page );
00030 layout->addWidget( optionLabel );
00031
00032 mOptions = new KLineEdit( lastOptions, page );
00033 optionLabel->setBuddy( mOptions );
00034 layout->addWidget( mOptions );
00035
00036 layout->addStretch();
00037
00038 connect( mListBox, TQT_SIGNAL( doubleClicked( TQListBoxItem * ) ), this, TQT_SLOT( slotOk() ) );
00039 connect( mListBox, TQT_SIGNAL( returnPressed( TQListBoxItem * ) ), this, TQT_SLOT( slotOk() ) );
00040
00041 mListBox->setFocus();
00042 }
00043
00044 TQString ChiasmusKeySelector::key() const
00045 {
00046 return mListBox->currentText();
00047 }
00048
00049 TQString ChiasmusKeySelector::options() const
00050 {
00051 return mOptions->text();
00052 }
00053
00054
00055 #include "chiasmuskeyselector.moc"