summaryrefslogtreecommitdiffabout
path: root/pluginqtopiakabc
Side-by-side diff
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 @@
+TEMPLATE = lib
+#TEMPLATE = app
+CONFIG += qt warn_on release
+
+TARGET = qtopiakabc
+OBJECTS_DIR = obj/$(PLATFORM)
+MOC_DIR = moc
+DESTDIR=$(QPEDIR)/plugins/korganizer
+#DESTDIR=.
+INCLUDEPATH += ../libkabcwrap $(QPEDIR)/include
+DEFINES +=
+LIBS += -lmicrokabc
+LIBS += $(QTOPIALIB)
+LIBS += -lqpepim
+LIBS += -lqpe
+
+HEADERS = \
+ qtopiaaddressbookplugin.h \
+ qtopiaaddressee.h
+
+SOURCES = \
+ qtopiaaddressbookplugin.cpp \
+ 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 @@
+#include <qwidget.h>
+#include <qlayout.h>
+#include <qlistbox.h>
+#include <qpe/pim/contact.h>
+#include <select_addressee_base.h>
+#include "qtopiaaddressbookplugin.h"
+#include "qtopiaaddressee.h"
+
+QtopiaAddressBookPlugin::QtopiaAddressBookPlugin() : ref(0) {
+ qDebug("QtopiaAddressBookPlugin::QtopiaAddressBookPlugin");
+ access = new AddressBookAccess();
+}
+
+QtopiaAddressBookPlugin::~QtopiaAddressBookPlugin() {
+ qDebug("QtopiaAddressBookPlugin::~QtopiaAddressBookPlugin");
+ delete &access;
+}
+
+KABC::Addressee::List QtopiaAddressBookPlugin::getAddressees() {
+
+ qDebug("Start: QtopiaAddressBookPlugin::getAddressees");
+
+ AddressBookIterator it(*access);
+ const PimContact *contact;
+ KABC::Addressee::List result;
+
+ for (contact=it.toFirst(); it.current(); ++it) {
+ contact = it.current();
+ result.append(QtopiaAddressee(*contact));
+ }
+
+ qDebug("End: QtopiaAddressBookPlugin::getAddressees");
+
+ return result;
+}
+
+QString QtopiaAddressBookPlugin::name() {
+ return "Qtopia addressbook plugin";
+}
+
+QRESULT QtopiaAddressBookPlugin::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
+{
+ *iface = 0;
+ if ( uuid == IID_QUnknown )
+ *iface = this;
+ else if ( uuid == IID_KOAddressBookInterface )
+ *iface = this;
+ if ( *iface )
+ (*iface)->addRef();
+ return QS_OK;
+}
+
+Q_EXPORT_INTERFACE()
+{
+ Q_CREATE_INSTANCE( QtopiaAddressBookPlugin )
+}
+
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 @@
+#ifndef QTOPIA_ADDRESS_BOOK_PLUGIN_H
+#define QTOPIA_ADDRESS_BOOK_PLUGIN_H
+#include <qpe/pim/addressbookaccess.h>
+#include <kabc/koaddressbookinterface.h>
+#include <kabc/addressee.h>
+
+
+class QtopiaAddressBookPlugin : public KOAddressBookInterface {
+
+ public:
+ QtopiaAddressBookPlugin();
+ virtual ~QtopiaAddressBookPlugin();
+ QString name();
+ KABC::Addressee::List getAddressees();
+ QRESULT queryInterface( const QUuid&, QUnknownInterface** );
+ Q_REFCOUNT
+
+ protected:
+ ulong ref;
+ private:
+ AddressBookAccess *access;
+};
+#endif
+
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 @@
+#include "qtopiaaddressee.h"
+
+QtopiaAddressee::QtopiaAddressee(const PimContact & pimContact) {
+ setPimContact(pimContact);
+}
+
+QtopiaAddressee::QtopiaAddressee() {
+ empty = true;
+}
+
+void QtopiaAddressee::setPimContact(const PimContact &pimContact) {
+ id = pimContact.defaultEmail();
+ fName = pimContact.lastName() + ", " + pimContact.firstName();
+ rName = pimContact.fullName();
+ pEmail = pimContact.defaultEmail();
+ empty = false;
+ mails.clear();
+ mails = pimContact.emailList();
+}
+
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 @@
+#include <qpe/pim/contact.h>
+#include <kabc/addressee.h>
+
+#ifndef QTOPIA_ADDRESSE_H
+#define QTOPIA_ADDRESSE_H
+
+class QtopiaAddressee : public KABC::Addressee {
+
+ public:
+
+ QtopiaAddressee(const PimContact & pimContact);
+ QtopiaAddressee();
+ void setPimContact(const PimContact & pimContact);
+
+ private:
+ QString id;
+ bool empty;
+};
+
+#endif
+