akonadi
23 #include "imitemdialog.h"
26 #include "improtocols.h"
28 #include <QFormLayout>
30 #include <kcombobox.h>
31 #include <klineedit.h>
32 #include <klocalizedstring.h>
35 IMItemDialog::IMItemDialog( QWidget *parent )
38 setButtons( Ok | Cancel );
39 setDefaultButton( Ok );
41 QWidget *widget =
new QWidget(
this );
42 setMainWidget( widget );
44 QFormLayout *layout =
new QFormLayout( widget );
46 mProtocolCombo =
new KComboBox;
47 mProtocolCombo->addItem( i18nc(
"@item:inlistbox select from a list of IM protocols",
49 layout->addRow( i18nc(
"@label:listbox",
"Protocol:" ), mProtocolCombo );
51 const QStringList protocols = IMProtocols::self()->protocols();
52 foreach (
const QString &protocol, protocols ) {
53 mProtocolCombo->addItem( KIcon( IMProtocols::self()->icon( protocol ) ),
54 IMProtocols::self()->name( protocol ),
58 mNameEdit =
new KLineEdit;
59 layout->addRow( i18nc(
"@label:textbox IM address",
"Address:" ), mNameEdit );
61 connect( mProtocolCombo, SIGNAL(currentIndexChanged(
int)), SLOT(slotUpdateButtons()) );
62 connect( mNameEdit, SIGNAL(textChanged(QString)), SLOT(slotUpdateButtons()) );
67 void IMItemDialog::setAddress(
const IMAddress &address )
69 mProtocolCombo->setCurrentIndex(
70 IMProtocols::self()->protocols().indexOf( address.protocol() ) + 1 );
72 mNameEdit->setText( address.name() );
76 IMAddress IMItemDialog::address()
const
78 return IMAddress( mProtocolCombo->itemData( mProtocolCombo->currentIndex() ).toString(),
79 mNameEdit->text(), false );
82 void IMItemDialog::slotUpdateButtons()
84 enableButtonOk( mProtocolCombo->currentIndex()>0 && !mNameEdit->text().isEmpty() );
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:27 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.