summaryrefslogtreecommitdiffstats
path: root/kmail/chiasmuskeyselector.cpp
blob: ea21ca0193574b440ad07a221776fe8b086b36cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "chiasmuskeyselector.h"

#include <klineedit.h>
#include <klistbox.h>
#include <klocale.h>

#include <tqlayout.h>
#include <tqlabel.h>

ChiasmusKeySelector::ChiasmusKeySelector( TQWidget* parent, const TQString& caption,
                                          const TQStringList& keys, const TQString& currentKey,
                                          const TQString& lastOptions )
  : KDialogBase( parent, "chiasmusKeySelector", true, caption, Ok|Cancel, Ok, true )
{
  TQWidget *page = makeMainWidget();

  TQVBoxLayout *layout = new TQVBoxLayout(page, KDialog::spacingHint());

  mLabel = new TQLabel( i18n( "Please select the Chiasmus key file to use:" ), page );
  layout->addWidget( mLabel );

  mListBox = new KListBox( page );
  mListBox->insertStringList( keys );
  const int current = keys.findIndex( currentKey );
  mListBox->setSelected( TQMAX( 0, current ), true );
  mListBox->ensureCurrentVisible();
  layout->addWidget( mListBox, 1 );

  TQLabel* optionLabel = new TQLabel( i18n( "Additional arguments for chiasmus:" ), page );
  layout->addWidget( optionLabel );

  mOptions = new KLineEdit( lastOptions, page );
  optionLabel->setBuddy( mOptions );
  layout->addWidget( mOptions );

  layout->addStretch();

  connect( mListBox, TQT_SIGNAL( doubleClicked( TQListBoxItem * ) ), this, TQT_SLOT( slotOk() ) );
  connect( mListBox, TQT_SIGNAL( returnPressed( TQListBoxItem * ) ), this, TQT_SLOT( slotOk() ) );

  mListBox->setFocus();
}

TQString ChiasmusKeySelector::key() const
{
  return mListBox->currentText();
}

TQString ChiasmusKeySelector::options() const
{
  return mOptions->text();
}


#include "chiasmuskeyselector.moc"