summaryrefslogtreecommitdiffstats
path: root/kopete/libkopete/ui/addressbookselectordialog.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kopete/libkopete/ui/addressbookselectordialog.cpp
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/libkopete/ui/addressbookselectordialog.cpp')
-rw-r--r--kopete/libkopete/ui/addressbookselectordialog.cpp89
1 files changed, 89 insertions, 0 deletions
diff --git a/kopete/libkopete/ui/addressbookselectordialog.cpp b/kopete/libkopete/ui/addressbookselectordialog.cpp
new file mode 100644
index 00000000..7d2e17ff
--- /dev/null
+++ b/kopete/libkopete/ui/addressbookselectordialog.cpp
@@ -0,0 +1,89 @@
+/*
+ AddressBookSelectorDialog
+ Nice Dialog to select a KDE AddressBook contact
+
+ Copyright (c) 2005 by Duncan Mac-Vicar Prett <[email protected]>
+
+ Kopete (c) 2002-2005 by the Kopete developers <[email protected]>
+
+ *************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ *************************************************************************
+*/
+
+#include "addressbookselectordialog.h"
+#include "addressbookselectorwidget.h"
+#include <kdialogbase.h>
+#include <qdialog.h>
+#include <qlistview.h>
+#include <qvbox.h>
+#include <klocale.h>
+#include <kdialog.h>
+
+namespace Kopete
+{
+namespace UI
+{
+
+AddressBookSelectorDialog::AddressBookSelectorDialog(const QString &title, const QString &message, const QString &preSelectUid, QWidget *parent, const char *name, bool modal ) : KDialogBase(parent, name, modal, title, Help|Ok|Cancel, Ok, true )
+{
+ QVBox *vbox=new QVBox(this);
+ m_addressBookSelectorWidget= new AddressBookSelectorWidget(vbox);
+ m_addressBookSelectorWidget->setLabelMessage(message);
+
+ vbox->setSpacing( KDialog::spacingHint() );
+
+ setMainWidget(vbox);
+ enableButtonOK(false);
+ //setHelp("linkaddressbook");
+
+ connect(m_addressBookSelectorWidget, SIGNAL(addresseeListClicked( QListViewItem * )), SLOT(slotWidgetAddresseeListClicked( QListViewItem * )));
+
+ if ( !preSelectUid.isEmpty() )
+ m_addressBookSelectorWidget->selectAddressee(preSelectUid);
+}
+
+AddressBookSelectorDialog::~AddressBookSelectorDialog()
+{
+}
+
+KABC::Addressee AddressBookSelectorDialog::getAddressee( const QString &title, const QString &message, const QString &preSelectUid, QWidget *parent)
+{
+ AddressBookSelectorDialog dialog(title, message, preSelectUid, parent);
+ int result = dialog.exec();
+
+ KABC::Addressee adr;
+ if ( result == QDialog::Accepted )
+ adr = dialog.addressBookSelectorWidget()->addressee();
+
+ return adr;
+}
+
+void AddressBookSelectorDialog::slotWidgetAddresseeListClicked( QListViewItem *addressee )
+{
+ // enable ok if a valid addressee is selected
+ enableButtonOK( addressee ? addressee->isSelected() : false);
+}
+
+void AddressBookSelectorDialog::accept()
+{
+ QDialog::accept();
+}
+
+void AddressBookSelectorDialog::reject()
+{
+ QDialog::reject();
+}
+
+} // namespace UI
+} // namespace Kopete
+
+#include "addressbookselectordialog.moc"
+
+// vim: set noet ts=4 sts=4 sw=4:
+