Diffstat (limited to 'pluginqtopiakabc/qtopiaaddressbookplugin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | pluginqtopiakabc/qtopiaaddressbookplugin.cpp | 57 |
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 | |||
9 | QtopiaAddressBookPlugin::QtopiaAddressBookPlugin() : ref(0) { | ||
10 | qDebug("QtopiaAddressBookPlugin::QtopiaAddressBookPlugin"); | ||
11 | access = new AddressBookAccess(); | ||
12 | } | ||
13 | |||
14 | QtopiaAddressBookPlugin::~QtopiaAddressBookPlugin() { | ||
15 | qDebug("QtopiaAddressBookPlugin::~QtopiaAddressBookPlugin"); | ||
16 | delete &access; | ||
17 | } | ||
18 | |||
19 | KABC::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 | |||
37 | QString QtopiaAddressBookPlugin::name() { | ||
38 | return "Qtopia addressbook plugin"; | ||
39 | } | ||
40 | |||
41 | QRESULT 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 | |||
53 | Q_EXPORT_INTERFACE() | ||
54 | { | ||
55 | Q_CREATE_INSTANCE( QtopiaAddressBookPlugin ) | ||
56 | } | ||
57 | |||