kmail

chiasmuskeyselector.cpp
1 #include "chiasmuskeyselector.h"
2 
3 #include <klineedit.h>
4 #include <tdelistbox.h>
5 #include <tdelocale.h>
6 
7 #include <tqlayout.h>
8 #include <tqlabel.h>
9 
10 ChiasmusKeySelector::ChiasmusKeySelector( TQWidget* parent, const TQString& caption,
11  const TQStringList& keys, const TQString& currentKey,
12  const TQString& lastOptions )
13  : KDialogBase( parent, "chiasmusKeySelector", true, caption, Ok|Cancel, Ok, true )
14 {
15  TQWidget *page = makeMainWidget();
16 
17  TQVBoxLayout *layout = new TQVBoxLayout(page, KDialog::spacingHint());
18 
19  mLabel = new TQLabel( i18n( "Please select the Chiasmus key file to use:" ), page );
20  layout->addWidget( mLabel );
21 
22  mListBox = new TDEListBox( page );
23  mListBox->insertStringList( keys );
24  const int current = keys.findIndex( currentKey );
25  mListBox->setSelected( TQMAX( 0, current ), true );
26  mListBox->ensureCurrentVisible();
27  layout->addWidget( mListBox, 1 );
28 
29  TQLabel* optionLabel = new TQLabel( i18n( "Additional arguments for chiasmus:" ), page );
30  layout->addWidget( optionLabel );
31 
32  mOptions = new KLineEdit( lastOptions, page );
33  optionLabel->setBuddy( mOptions );
34  layout->addWidget( mOptions );
35 
36  layout->addStretch();
37 
38  connect( mListBox, TQ_SIGNAL( doubleClicked( TQListBoxItem * ) ), this, TQ_SLOT( slotOk() ) );
39  connect( mListBox, TQ_SIGNAL( returnPressed( TQListBoxItem * ) ), this, TQ_SLOT( slotOk() ) );
40 
41  mListBox->setFocus();
42 }
43 
44 TQString ChiasmusKeySelector::key() const
45 {
46  return mListBox->currentText();
47 }
48 
49 TQString ChiasmusKeySelector::options() const
50 {
51  return mOptions->text();
52 }
53 
54 
55 #include "chiasmuskeyselector.moc"
@ Ok
The user rights/ACL have been fetched from the server sucessfully.
Definition: acljobs.h:66