summaryrefslogtreecommitdiffabout
path: root/pluginqtopiakabc/qtopiaaddressbookplugin.cpp
authorzautrix <zautrix>2004-06-26 19:01:18 (UTC)
committer zautrix <zautrix>2004-06-26 19:01:18 (UTC)
commitb9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff)
tree2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /pluginqtopiakabc/qtopiaaddressbookplugin.cpp
downloadkdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2
Initial revision
Diffstat (limited to 'pluginqtopiakabc/qtopiaaddressbookplugin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--pluginqtopiakabc/qtopiaaddressbookplugin.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/pluginqtopiakabc/qtopiaaddressbookplugin.cpp b/pluginqtopiakabc/qtopiaaddressbookplugin.cpp
new file mode 100644
index 0000000..59d7881
--- a/dev/null
+++ b/pluginqtopiakabc/qtopiaaddressbookplugin.cpp
@@ -0,0 +1,57 @@
1#include <qwidget.h>
2#include <qlayout.h>
3#include <qlistbox.h>
4#include <qpe/pim/contact.h>
5#include <select_addressee_base.h>
6#include "qtopiaaddressbookplugin.h"
7#include "qtopiaaddressee.h"
8
9QtopiaAddressBookPlugin::QtopiaAddressBookPlugin() : ref(0) {
10 qDebug("QtopiaAddressBookPlugin::QtopiaAddressBookPlugin");
11 access = new AddressBookAccess();
12}
13
14QtopiaAddressBookPlugin::~QtopiaAddressBookPlugin() {
15 qDebug("QtopiaAddressBookPlugin::~QtopiaAddressBookPlugin");
16 delete &access;
17}
18
19KABC::Addressee::List QtopiaAddressBookPlugin::getAddressees() {
20
21 qDebug("Start: QtopiaAddressBookPlugin::getAddressees");
22
23 AddressBookIterator it(*access);
24 const PimContact *contact;
25 KABC::Addressee::List result;
26
27 for (contact=it.toFirst(); it.current(); ++it) {
28 contact = it.current();
29 result.append(QtopiaAddressee(*contact));
30 }
31
32 qDebug("End: QtopiaAddressBookPlugin::getAddressees");
33
34 return result;
35}
36
37QString QtopiaAddressBookPlugin::name() {
38 return "Qtopia addressbook plugin";
39}
40
41QRESULT QtopiaAddressBookPlugin::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
42{
43 *iface = 0;
44 if ( uuid == IID_QUnknown )
45 *iface = this;
46 else if ( uuid == IID_KOAddressBookInterface )
47 *iface = this;
48 if ( *iface )
49 (*iface)->addRef();
50 return QS_OK;
51}
52
53Q_EXPORT_INTERFACE()
54{
55 Q_CREATE_INSTANCE( QtopiaAddressBookPlugin )
56}
57