summaryrefslogtreecommitdiffabout
path: root/pluginqtopiakabc
Unidiff
Diffstat (limited to 'pluginqtopiakabc') (more/less context) (ignore whitespace changes)
-rw-r--r--pluginqtopiakabc/pluginqtopiakabcE.pro23
-rw-r--r--pluginqtopiakabc/qtopiaaddressbookplugin.cpp57
-rw-r--r--pluginqtopiakabc/qtopiaaddressbookplugin.h24
-rw-r--r--pluginqtopiakabc/qtopiaaddressee.cpp20
-rw-r--r--pluginqtopiakabc/qtopiaaddressee.h21
5 files changed, 145 insertions, 0 deletions
diff --git a/pluginqtopiakabc/pluginqtopiakabcE.pro b/pluginqtopiakabc/pluginqtopiakabcE.pro
new file mode 100644
index 0000000..3f40f9f
--- a/dev/null
+++ b/pluginqtopiakabc/pluginqtopiakabcE.pro
@@ -0,0 +1,23 @@
1 TEMPLATE= lib
2 #TEMPLATE= app
3 CONFIG += qt warn_on release
4
5 TARGET = qtopiakabc
6OBJECTS_DIR = obj/$(PLATFORM)
7MOC_DIR = moc
8DESTDIR=$(QPEDIR)/plugins/korganizer
9#DESTDIR=.
10INCLUDEPATH += ../libkabcwrap $(QPEDIR)/include
11DEFINES +=
12LIBS += -lmicrokabc
13LIBS += $(QTOPIALIB)
14LIBS += -lqpepim
15LIBS += -lqpe
16
17HEADERS = \
18 qtopiaaddressbookplugin.h \
19 qtopiaaddressee.h
20
21SOURCES = \
22 qtopiaaddressbookplugin.cpp \
23 qtopiaaddressee.cpp
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
diff --git a/pluginqtopiakabc/qtopiaaddressbookplugin.h b/pluginqtopiakabc/qtopiaaddressbookplugin.h
new file mode 100644
index 0000000..d197840
--- a/dev/null
+++ b/pluginqtopiakabc/qtopiaaddressbookplugin.h
@@ -0,0 +1,24 @@
1#ifndef QTOPIA_ADDRESS_BOOK_PLUGIN_H
2#define QTOPIA_ADDRESS_BOOK_PLUGIN_H
3#include <qpe/pim/addressbookaccess.h>
4#include <kabc/koaddressbookinterface.h>
5#include <kabc/addressee.h>
6
7
8class QtopiaAddressBookPlugin : public KOAddressBookInterface {
9
10 public:
11 QtopiaAddressBookPlugin();
12 virtual ~QtopiaAddressBookPlugin();
13 QString name();
14 KABC::Addressee::List getAddressees();
15 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
16 Q_REFCOUNT
17
18 protected:
19 ulong ref;
20 private:
21 AddressBookAccess *access;
22};
23#endif
24
diff --git a/pluginqtopiakabc/qtopiaaddressee.cpp b/pluginqtopiakabc/qtopiaaddressee.cpp
new file mode 100644
index 0000000..3fe85e5
--- a/dev/null
+++ b/pluginqtopiakabc/qtopiaaddressee.cpp
@@ -0,0 +1,20 @@
1#include "qtopiaaddressee.h"
2
3QtopiaAddressee::QtopiaAddressee(const PimContact & pimContact) {
4 setPimContact(pimContact);
5}
6
7QtopiaAddressee::QtopiaAddressee() {
8 empty = true;
9}
10
11void QtopiaAddressee::setPimContact(const PimContact &pimContact) {
12 id = pimContact.defaultEmail();
13 fName = pimContact.lastName() + ", " + pimContact.firstName();
14 rName = pimContact.fullName();
15 pEmail = pimContact.defaultEmail();
16 empty = false;
17 mails.clear();
18 mails = pimContact.emailList();
19}
20
diff --git a/pluginqtopiakabc/qtopiaaddressee.h b/pluginqtopiakabc/qtopiaaddressee.h
new file mode 100644
index 0000000..c86d6c0
--- a/dev/null
+++ b/pluginqtopiakabc/qtopiaaddressee.h
@@ -0,0 +1,21 @@
1#include <qpe/pim/contact.h>
2#include <kabc/addressee.h>
3
4#ifndef QTOPIA_ADDRESSE_H
5#define QTOPIA_ADDRESSE_H
6
7class QtopiaAddressee : public KABC::Addressee {
8
9 public:
10
11 QtopiaAddressee(const PimContact & pimContact);
12 QtopiaAddressee();
13 void setPimContact(const PimContact & pimContact);
14
15 private:
16 QString id;
17 bool empty;
18};
19
20#endif
21