• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

messageviewer

  • sources
  • kde-4.14
  • kdepim
  • messageviewer
  • viewer
chiasmuskeyselector.cpp
Go to the documentation of this file.
1 
2 #include "chiasmuskeyselector.h"
3 
4 #include <KLineEdit>
5 #include <KListWidget>
6 #include <KLocalizedString>
7 
8 #include <QLabel>
9 #include <QVBoxLayout>
10 #include <KPushButton>
11 
12 using namespace MessageViewer;
13 
14 ChiasmusKeySelector::ChiasmusKeySelector( QWidget* parent, const QString& caption,
15  const QStringList& keys, const QString& currentKey,
16  const QString& lastOptions )
17  : KDialog( parent )
18 {
19  setCaption( caption );
20  setButtons( Ok | Cancel );
21  QWidget *page = new QWidget( this );
22  setMainWidget(page);
23 
24  QVBoxLayout *layout = new QVBoxLayout(page);
25  layout->setSpacing(KDialog::spacingHint());
26 
27  mLabel = new QLabel( i18n( "Please select the Chiasmus key file to use:" ), page );
28  layout->addWidget( mLabel );
29 
30  mListBox = new KListWidget( page );
31  mListBox->addItems( keys );
32  const int current = keys.indexOf( currentKey );
33  mListBox->setCurrentRow( qMax( 0, current ) );
34  mListBox->scrollToItem( mListBox->item( qMax( 0, current ) ) );
35  layout->addWidget( mListBox, 1 );
36 
37  QLabel* optionLabel = new QLabel( i18n( "Additional arguments for chiasmus:" ), page );
38  layout->addWidget( optionLabel );
39 
40  mOptions = new KLineEdit( lastOptions, page );
41  optionLabel->setBuddy( mOptions );
42  layout->addWidget( mOptions );
43 
44  layout->addStretch();
45 
46  connect( mListBox, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(accept()) );
47  connect( mListBox, SIGNAL(itemSelectionChanged()), this, SLOT(slotItemSelectionChanged()) );
48 
49  slotItemSelectionChanged();
50  mListBox->setFocus();
51 }
52 
53 void ChiasmusKeySelector::slotItemSelectionChanged()
54 {
55  button( Ok )->setEnabled( !mListBox->selectedItems().isEmpty() );
56 }
57 
58 QString ChiasmusKeySelector::key() const
59 {
60  if (mListBox->selectedItems().isEmpty()) {
61  return QString();
62  } else {
63  return mListBox->currentItem()->text();
64  }
65 }
66 
67 QString ChiasmusKeySelector::options() const
68 {
69  return mOptions->text();
70 }
QWidget
QListWidgetItem
KDialog
QLabel::setBuddy
void setBuddy(QWidget *buddy)
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
MessageViewer::ChiasmusKeySelector::options
QString options() const
Definition: chiasmuskeyselector.cpp:67
QVBoxLayout
chiasmuskeyselector.h
QString
QStringList
QBoxLayout::addStretch
void addStretch(int stretch)
MessageViewer::ChiasmusKeySelector::ChiasmusKeySelector
ChiasmusKeySelector(QWidget *parent, const QString &caption, const QStringList &keys, const QString &currentKey, const QString &lastOptions)
Definition: chiasmuskeyselector.cpp:14
QStringList::indexOf
int indexOf(const QRegExp &rx, int from) const
MessageViewer::ChiasmusKeySelector::key
QString key() const
Definition: chiasmuskeyselector.cpp:58
QLabel
QBoxLayout::setSpacing
void setSpacing(int spacing)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:45 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

messageviewer

Skip menu "messageviewer"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal