author | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
commit | b9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (side-by-side diff) | |
tree | 2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /libkabcwrap/addresseedialog.cpp | |
download | kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2 |
Initial revision
Diffstat (limited to 'libkabcwrap/addresseedialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libkabcwrap/addresseedialog.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/libkabcwrap/addresseedialog.cpp b/libkabcwrap/addresseedialog.cpp new file mode 100644 index 0000000..e0fe354 --- a/dev/null +++ b/libkabcwrap/addresseedialog.cpp @@ -0,0 +1,69 @@ +#include <qlistview.h> +#include <qmessagebox.h> +#include <qapplication.h> +#include "addresseedialog.h" +#include "select_addressee_base.h" + +using namespace KABC; + +Addressee AddresseeDialog::getAddressee( QWidget *parent ) { + + Addressee result; + if (!getInterface()) { + QMessageBox::warning(parent,"Plugin missing", "Plugins for Qtopia/Opie\naddressbook missing.\nPlease install\nlibqtopiakabc.so/libopiekabc.so\nunder $QPEDIR/plugins/korganizer.\nQtopia-plugin needs libqpepim.", 0L ); + } else { + + // qDebug("Start: AddresseeDialog::getAddressee"); + + Addressee::List list = getAddresseesFromPlugin(); + + SelectAddressee *selAddressee = new SelectAddressee(parent,"SelectAddressee", true); + QListView *contactList = selAddressee->contactList; + contactList->setSelectionMode(QListView::Single); + if (!contactList) { + Addressee emptyAddressee; + return emptyAddressee; + } + + for (uint i=0; i < list.count(); i++) { + Addressee a = list[i]; + QString fullName = a.formattedName(); + QString defaultEmail = a.preferredEmail(); + //qDebug("Adding " + fullName); + QListViewItem *item = new QListViewItem(contactList, fullName, defaultEmail); + } + if ( QApplication::desktop()->width() < 480 ) { + selAddressee->setMinimumWidth( 220 ); + } else { + selAddressee->setMinimumWidth( 440 ); + } + if (selAddressee->exec()) { + QListViewItem *selectedItem = contactList->selectedItem(); + if (selectedItem) { + uint i=0; + for (i=0; i < list.count() && (list[i].formattedName() != selectedItem->text(0)); i++); + if (i<list.count()) { + result = list[i]; + } + } + } + delete selAddressee; + //qDebug("End: AddresseeDialog::getAddressee"); +} + return result; + +} + +Addressee::List AddresseeDialog::getAddressees( QWidget *parent ) { + //qDebug("Start: AddresseeDialog::getAddressees"); + + KOAddressBookInterface *iface = getInterface(); + + Addressee::List results; + if (iface) { + Addressee a = getAddressee(parent); + results.append(a); + } + //qDebug("End: AddresseeDialog::getAddressees"); + return results; +} |