summaryrefslogtreecommitdiffstats
path: root/kmail/chiasmuskeyselector.cpp
blob: 475ddd44f27cb9d6b0b52df376421da99d18063a (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 *tqlayout = new TQVBoxLayout(page, KDialog::spacingHint());

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

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

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

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

  tqlayout->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"