summaryrefslogtreecommitdiffabout
path: root/libkabcwrap/koaddresspluginloader.cpp
authorzautrix <zautrix>2004-06-26 19:01:18 (UTC)
committer zautrix <zautrix>2004-06-26 19:01:18 (UTC)
commitb9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff)
tree2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /libkabcwrap/koaddresspluginloader.cpp
downloadkdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2
Initial revision
Diffstat (limited to 'libkabcwrap/koaddresspluginloader.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkabcwrap/koaddresspluginloader.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/libkabcwrap/koaddresspluginloader.cpp b/libkabcwrap/koaddresspluginloader.cpp
new file mode 100644
index 0000000..d329262
--- a/dev/null
+++ b/libkabcwrap/koaddresspluginloader.cpp
@@ -0,0 +1,56 @@
1#include <stdio.h>
2#include <qtopia/qlibrary.h>
3#include <qpe/qpeapplication.h>
4#include "koaddressbookpluginloader.h"
5#include "kabcaddressbookplugin.h"
6
7KOAddressBookInterface *KOAddressBookPluginLoader::iface = 0;
8KABC::Addressee::List KOAddressBookPluginLoader::addresseeList;
9
10KOAddressBookInterface *KOAddressBookPluginLoader::getInterface() {
11
12 qDebug("Start: KOAddressBookPluginLoader::getInterface");
13
14 if (!iface) {
15
16 const QString & qpeDir = QPEApplication::qpeDir();
17 QLibrary *lib = new QLibrary( qpeDir + "/plugins/korganizer/libopiekabc.so", QLibrary::Immediately );
18 QRESULT q = lib->queryInterface( IID_QUnknown, (QUnknownInterface**)&iface );
19 if ( q != QS_OK ) {
20 lib = new QLibrary( qpeDir + "/plugins/korganizer/libqtopiakabc.so", QLibrary::Immediately );
21 QRESULT q = lib->queryInterface( IID_QUnknown, (QUnknownInterface**)&iface );
22 // we checked now for all known external interfaces. If no were found, use the default KABC interface
23 if ( q != QS_OK ) {
24 iface = new KABCAddressBookPlugin();
25 }
26 }
27 }
28
29 qDebug("End: KOAddressBookPluginLoader::getInterface");
30 return iface;
31
32}
33
34KABC::Addressee::List KOAddressBookPluginLoader::getAddresseesFromPlugin() {
35
36 qDebug("Start: KOAddressBookPluginLoader::getAddresseesFromPlugin");
37 addresseeList.clear();
38 if (!(addresseeList.count() > 0)) {
39 qDebug("KOAddressBookPluginLoader::getAddresseesFromPlugin: no addresses loaded. Loading...");
40 if (!iface) {
41 qDebug("KOAddressBookPluginLoader::getAddresseesFromPlugin: no interface loaded. Loading...");
42 iface = getInterface();
43 }
44 if (iface) {
45 qDebug("KOAddressBookPluginLoader::getAddresseesFromPlugin: interface is " + iface->name());
46 addresseeList = iface->getAddressees();
47 } else {
48 qDebug("KOAddressBookPluginLoader::getAddresseesFromPlugin: No interface found!");
49 }
50 }
51
52
53 qDebug("End: KOAddressBookPluginLoader::getAddresseesFromPlugin");
54 return addresseeList;
55
56}