summaryrefslogtreecommitdiffabout
path: root/libkabcwrap
authorulf69 <ulf69>2004-08-06 18:30:46 (UTC)
committer ulf69 <ulf69>2004-08-06 18:30:46 (UTC)
commit8d905d7489f50210afde611138245ae2ee180f8f (patch) (unidiff)
tree27ef58359afe49e2e4e35734cf8fbe679cd6ed9c /libkabcwrap
parent555e6179368fb2446c802041a01db4c9dad7db8f (diff)
downloadkdepimpi-8d905d7489f50210afde611138245ae2ee180f8f.zip
kdepimpi-8d905d7489f50210afde611138245ae2ee180f8f.tar.gz
kdepimpi-8d905d7489f50210afde611138245ae2ee180f8f.tar.bz2
functionality now implemented in kabc resource plugins
Diffstat (limited to 'libkabcwrap') (more/less context) (show whitespace changes)
-rw-r--r--libkabcwrap/README30
-rw-r--r--libkabcwrap/addresseedialog.cpp69
-rw-r--r--libkabcwrap/addresseedialog.h17
-rw-r--r--libkabcwrap/kabcaddressbookplugin.cpp84
-rw-r--r--libkabcwrap/kabcaddressbookplugin.h18
-rw-r--r--libkabcwrap/koaddressbookinterface.h21
-rw-r--r--libkabcwrap/koaddressbookpluginloader.h18
-rw-r--r--libkabcwrap/koaddresspluginloader.cpp56
-rw-r--r--libkabcwrap/libkabcwrapE.pro31
-rw-r--r--libkabcwrap/select_addressee_base.cpp50
-rw-r--r--libkabcwrap/select_addressee_base.h34
-rw-r--r--libkabcwrap/select_addressee_base.ui68
12 files changed, 0 insertions, 496 deletions
diff --git a/libkabcwrap/README b/libkabcwrap/README
deleted file mode 100644
index 366d58c..0000000
--- a/libkabcwrap/README
+++ b/dev/null
@@ -1,30 +0,0 @@
1KAddressbook-Wrapper für Opie/Qtopia
2
3Bietet eine transparente Möglichkeit, auf die bekannten
4Klassen StdAddressBook und AddresseeDialog zuzugreifen,
5während im Hintergrund entsprechende Plugins durch Ansprechen
6der Qtopia- bzw. Opie-PIM-API die Adressedaten aufbereiten
7und laden.
8
9Einbinden in KO/Pi:
10
11In korganizerE.pro:
12
13- Die Definition KORG_NOKABC entfernen.
14- In die INCLUDEPATH den Pfad zum Quellverzeichnis des Wrapper eintragen.
15- -lkabc zu den LIBS hinzufügen
16
17In den Quelldateien incomingdialog.cpp, koeventviewer.cpp und publishdialog.cpp:
18- Alle Aufrufe von addressList.size() durch addressList.count() ersetzen.
19 Beispielsweise durch
20 perl -i -p -e 's/addressList\.size/addressList.count/g'
21
22Der Pluginlader erwartet bislang zwei Plugins
23libopiekabc.so und libqtopiakabc.so
24im Verzeichnis /opt/Qtopia/plugins/korganizer.
25Erst wird versucht, libopiekabc.so, dann libqtopiakabc.so zu laden.
26
27TODOs:
28- Fixen Pfad "/opt/Qtopia" rausnehmen.
29- AddresseeDialog::getAddressees wird momentan durch <plugin>::getAddressee
30 ersetzt, weshalb nur ein Adressat auswählbar ist.
diff --git a/libkabcwrap/addresseedialog.cpp b/libkabcwrap/addresseedialog.cpp
deleted file mode 100644
index e0fe354..0000000
--- a/libkabcwrap/addresseedialog.cpp
+++ b/dev/null
@@ -1,69 +0,0 @@
1#include <qlistview.h>
2#include <qmessagebox.h>
3#include <qapplication.h>
4#include "addresseedialog.h"
5#include "select_addressee_base.h"
6
7using namespace KABC;
8
9Addressee AddresseeDialog::getAddressee( QWidget *parent ) {
10
11 Addressee result;
12 if (!getInterface()) {
13 QMessageBox::warning(parent,"Plugin missing", "Plugins for Qtopia/Opie\naddressbook missing.\nPlease install\nlibqtopiakabc.so/libopiekabc.so\nunder $QPEDIR/plugins/korganizer.\nQtopia-plugin needs libqpepim.", 0L );
14 } else {
15
16 // qDebug("Start: AddresseeDialog::getAddressee");
17
18 Addressee::List list = getAddresseesFromPlugin();
19
20 SelectAddressee *selAddressee = new SelectAddressee(parent,"SelectAddressee", true);
21 QListView *contactList = selAddressee->contactList;
22 contactList->setSelectionMode(QListView::Single);
23 if (!contactList) {
24 Addressee emptyAddressee;
25 return emptyAddressee;
26 }
27
28 for (uint i=0; i < list.count(); i++) {
29 Addressee a = list[i];
30 QString fullName = a.formattedName();
31 QString defaultEmail = a.preferredEmail();
32 //qDebug("Adding " + fullName);
33 QListViewItem *item = new QListViewItem(contactList, fullName, defaultEmail);
34 }
35 if ( QApplication::desktop()->width() < 480 ) {
36 selAddressee->setMinimumWidth( 220 );
37 } else {
38 selAddressee->setMinimumWidth( 440 );
39 }
40 if (selAddressee->exec()) {
41 QListViewItem *selectedItem = contactList->selectedItem();
42 if (selectedItem) {
43 uint i=0;
44 for (i=0; i < list.count() && (list[i].formattedName() != selectedItem->text(0)); i++);
45 if (i<list.count()) {
46 result = list[i];
47 }
48 }
49 }
50 delete selAddressee;
51 //qDebug("End: AddresseeDialog::getAddressee");
52}
53 return result;
54
55}
56
57Addressee::List AddresseeDialog::getAddressees( QWidget *parent ) {
58 //qDebug("Start: AddresseeDialog::getAddressees");
59
60 KOAddressBookInterface *iface = getInterface();
61
62 Addressee::List results;
63 if (iface) {
64 Addressee a = getAddressee(parent);
65 results.append(a);
66 }
67 //qDebug("End: AddresseeDialog::getAddressees");
68 return results;
69}
diff --git a/libkabcwrap/addresseedialog.h b/libkabcwrap/addresseedialog.h
deleted file mode 100644
index 400214e..0000000
--- a/libkabcwrap/addresseedialog.h
+++ b/dev/null
@@ -1,17 +0,0 @@
1#ifndef ADDRESSEE_DIALOG
2#define ADDRESSEE_DIALOG
3
4#include "addressee.h"
5#include "koaddressbookpluginloader.h"
6
7namespace KABC {
8
9class AddresseeDialog : public KOAddressBookPluginLoader {
10
11 public:
12 static Addressee getAddressee( QWidget *parent );
13 static Addressee::List getAddressees( QWidget *parent );
14
15};
16}
17#endif
diff --git a/libkabcwrap/kabcaddressbookplugin.cpp b/libkabcwrap/kabcaddressbookplugin.cpp
deleted file mode 100644
index 25f51d3..0000000
--- a/libkabcwrap/kabcaddressbookplugin.cpp
+++ b/dev/null
@@ -1,84 +0,0 @@
1/*US
2#include <qwidget.h>
3#include <qlayout.h>
4#include <qlistbox.h>
5#include <opie/ocontact.h>
6#include <opie/orecordlist.h>
7#include "opieaddressee.h"
8*/
9#include <stdio.h>
10#include "kabcaddressbookplugin.h"
11
12KABCAddressBookPlugin::KABCAddressBookPlugin() : ref(0) {
13
14//US access = new OContactAccess("OpieAddressBookPlugin");
15
16}
17
18KABC::Addressee::List KABCAddressBookPlugin::getAddressees() {
19 KABC::Addressee::List results;
20
21
22/*US
23 OContactAccess access("OpieAddressBookPlugin");
24 OContactAccess::List::Iterator it;
25 ORecordList<OContact> accessList = access.sorted(true,0,0,0);
26 for(it = accessList.begin(); it != accessList.end(); ++it ) {
27 OpieAddressee addressee( *it );
28 results.append(addressee);
29 }
30*/
31 qDebug("KABCAddressBookPlugin::getAddressees has to be implemented");
32
33 return results;
34}
35
36QString KABCAddressBookPlugin::name() {
37 return QString::QString("KABCAddressBookPlugin");
38}
39
40
41KABC::Addressee::List KABCAddressBookPlugin::findByEmail(const QString &email) {
42
43printf("KABCAddressBookPlugin::findByEmail: email=%s\n", email.ascii());
44 KABC::Addressee::List results;
45/*US
46
47 ORecordList<OContact> accessList = access->sorted(true,0,0,0);
48 OContactAccess::List::Iterator it;
49 for(it = accessList.begin(); it != accessList.end(); ++it ) {
50 OContact contact = *it;
51 QStringList emailList = contact.emailList();
52 QStringList foundEmails = emailList.grep(email,false);
53 if (foundEmails.count() >= 1) {
54 OpieAddressee a(contact);
55 printf("Found Contact %s\n", a.formattedName().ascii());
56 results.append(a);
57 }
58 }
59*/
60 qDebug("KABCAddressBookPlugin::findByEmail has to be implemented");
61
62 return results;
63
64}
65
66QRESULT KABCAddressBookPlugin::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
67{
68printf("Start: KABCAddressBookPlugin::queryInterface\n");
69 *iface = 0;
70 if ( uuid == IID_QUnknown )
71 *iface = this;
72 else if ( uuid == IID_KOAddressBookInterface )
73 *iface = this;
74 if ( *iface )
75 (*iface)->addRef();
76 return QS_OK;
77printf("End: KABCAddressBookPlugin::queryInterface\n");
78}
79
80Q_EXPORT_INTERFACE()
81{
82 Q_CREATE_INSTANCE( KABCAddressBookPlugin )
83}
84
diff --git a/libkabcwrap/kabcaddressbookplugin.h b/libkabcwrap/kabcaddressbookplugin.h
deleted file mode 100644
index 0f82744..0000000
--- a/libkabcwrap/kabcaddressbookplugin.h
+++ b/dev/null
@@ -1,18 +0,0 @@
1#include <qwidget.h>
2#include <koaddressbookinterface.h>
3#include <addressee.h>
4
5struct KABCAddressBookPlugin : public KOAddressBookInterface {
6
7 public:
8
9 KABCAddressBookPlugin::KABCAddressBookPlugin();
10 QString name();
11 KABC::Addressee::List getAddressees();
12 KABC::Addressee::List findByEmail(const QString &email);
13 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
14 Q_REFCOUNT
15 protected:
16// OContactAccess *access;
17 ulong ref;
18};
diff --git a/libkabcwrap/koaddressbookinterface.h b/libkabcwrap/koaddressbookinterface.h
deleted file mode 100644
index 3889d2a..0000000
--- a/libkabcwrap/koaddressbookinterface.h
+++ b/dev/null
@@ -1,21 +0,0 @@
1#ifndef KO_ADDRESS_BOOK_INTERFACE_H
2#define KO_ADDRESS_BOOK_INTERFACE_H
3
4#include <qwidget.h>
5#include <qpe/qcom.h>
6#include "addressee.h"
7
8#ifndef QT_NO_COMPONENT
9#ifndef IID_KOAddressBookInterface
10#define IID_KOAddressBookInterface QUuid( 0x7505e192, 0x4977, 0x465a, 0xb7, 0x2f, 0x0a, 0x8d, 0xd4, 0x91, 0xcf, 0x43)
11#endif
12#endif
13
14struct KOAddressBookInterface : public QUnknownInterface {
15
16 virtual QString name() = 0;
17 virtual KABC::Addressee::List getAddressees() = 0;
18
19};
20#endif
21
diff --git a/libkabcwrap/koaddressbookpluginloader.h b/libkabcwrap/koaddressbookpluginloader.h
deleted file mode 100644
index 0182b29..0000000
--- a/libkabcwrap/koaddressbookpluginloader.h
+++ b/dev/null
@@ -1,18 +0,0 @@
1#ifndef KO_ADDRESS_BOOK_PLUGIN_LOADER_H
2#define KO_ADDRESS_BOOK_PLUGIN_LOADER_H
3
4#include "addressee.h"
5#include "koaddressbookinterface.h"
6
7class KOAddressBookPluginLoader {
8
9 public:
10 static KOAddressBookInterface *getInterface();
11 static KABC::Addressee::List getAddresseesFromPlugin();
12
13 private:
14 static KOAddressBookInterface *iface;
15 static KABC::Addressee::List addresseeList;
16};
17
18#endif
diff --git a/libkabcwrap/koaddresspluginloader.cpp b/libkabcwrap/koaddresspluginloader.cpp
deleted file mode 100644
index d329262..0000000
--- a/libkabcwrap/koaddresspluginloader.cpp
+++ b/dev/null
@@ -1,56 +0,0 @@
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}
diff --git a/libkabcwrap/libkabcwrapE.pro b/libkabcwrap/libkabcwrapE.pro
deleted file mode 100644
index c0f1fe5..0000000
--- a/libkabcwrap/libkabcwrapE.pro
+++ b/dev/null
@@ -1,31 +0,0 @@
1 TEMPLATE= lib
2 CONFIG += qt warn_on release
3
4 TARGET = microkabcwrap
5OBJECTS_DIR = obj/$(PLATFORM)
6MOC_DIR = moc
7DESTDIR=$(QPEDIR)/lib
8INCLUDEPATH += . $(QPEDIR)/include ../kabc ../microkde ../microkde/kdecore
9DEFINES +=
10LIBS += -lmicrokabc
11LIBS += -L$(QPEDIR)/lib
12#US LIBS += -lqpe
13#US LIBS += -lqte
14
15INTERFACES += select_addressee_base.ui
16
17HEADERS = \
18 addresseedialog.h \
19 koaddressbookinterface.h \
20 kabcaddressbookplugin.h
21
22# kabc/addressee.h \
23# kabc/addressbook.h \
24# kabc/stdaddressbook.h \
25
26SOURCES = \
27 addresseedialog.cpp \
28 koaddresspluginloader.cpp \
29 kabcaddressbookplugin.cpp
30# addressee.cpp \
31# stdaddressbook.cpp \
diff --git a/libkabcwrap/select_addressee_base.cpp b/libkabcwrap/select_addressee_base.cpp
deleted file mode 100644
index 1b846e2..0000000
--- a/libkabcwrap/select_addressee_base.cpp
+++ b/dev/null
@@ -1,50 +0,0 @@
1/****************************************************************************
2** Form implementation generated from reading ui file 'select_addressee_base.ui'
3**
4** Created: Fri Feb 6 04:58:15 2004
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#include "select_addressee_base.h"
10
11#include <qheader.h>
12#include <qlistview.h>
13#include <qpushbutton.h>
14#include <qlayout.h>
15#include <qvariant.h>
16#include <qtooltip.h>
17#include <qwhatsthis.h>
18
19/*
20 * Constructs a SelectAddressee which is a child of 'parent', with the
21 * name 'name' and widget flags set to 'f'
22 *
23 * The dialog will by default be modeless, unless you set 'modal' to
24 * TRUE to construct a modal dialog.
25 */
26SelectAddressee::SelectAddressee( QWidget* parent, const char* name, bool modal, WFlags fl )
27 : QDialog( parent, name, modal, fl )
28{
29 if ( !name )
30 setName( "SelectAddressee" );
31 resize( 208, 267 );
32 setCaption( tr( "Select adressee" ) );
33 SelectAddresseeLayout = new QVBoxLayout( this );
34 SelectAddresseeLayout->setSpacing( 6 );
35 SelectAddresseeLayout->setMargin( 11 );
36
37 contactList = new QListView( this, "contactList" );
38 contactList->addColumn( tr( "Name" ) );
39 contactList->addColumn( tr( "Email" ) );
40 SelectAddresseeLayout->addWidget( contactList );
41}
42
43/*
44 * Destroys the object and frees any allocated resources
45 */
46SelectAddressee::~SelectAddressee()
47{
48 // no need to delete child widgets, Qt does it all for us
49}
50
diff --git a/libkabcwrap/select_addressee_base.h b/libkabcwrap/select_addressee_base.h
deleted file mode 100644
index d77b44e..0000000
--- a/libkabcwrap/select_addressee_base.h
+++ b/dev/null
@@ -1,34 +0,0 @@
1/****************************************************************************
2** Form interface generated from reading ui file 'select_addressee_base.ui'
3**
4** Created: Fri Feb 6 04:58:14 2004
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#ifndef SELECTADDRESSEE_H
10#define SELECTADDRESSEE_H
11
12#include <qvariant.h>
13#include <qdialog.h>
14class QVBoxLayout;
15class QHBoxLayout;
16class QGridLayout;
17class QListView;
18class QListViewItem;
19
20class SelectAddressee : public QDialog
21{
22 Q_OBJECT
23
24public:
25 SelectAddressee( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
26 ~SelectAddressee();
27
28 QListView* contactList;
29
30protected:
31 QVBoxLayout* SelectAddresseeLayout;
32};
33
34#endif // SELECTADDRESSEE_H
diff --git a/libkabcwrap/select_addressee_base.ui b/libkabcwrap/select_addressee_base.ui
deleted file mode 100644
index d145b0d..0000000
--- a/libkabcwrap/select_addressee_base.ui
+++ b/dev/null
@@ -1,68 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>SelectAddressee</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>SelectAddressee</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>208</width>
15 <height>267</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Select adressee</string>
21 </property>
22 <vbox>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget>
32 <class>QListView</class>
33 <column>
34 <property>
35 <name>text</name>
36 <string>Name</string>
37 </property>
38 <property>
39 <name>clickable</name>
40 <bool>true</bool>
41 </property>
42 <property>
43 <name>resizeable</name>
44 <bool>true</bool>
45 </property>
46 </column>
47 <column>
48 <property>
49 <name>text</name>
50 <string>Email</string>
51 </property>
52 <property>
53 <name>clickable</name>
54 <bool>true</bool>
55 </property>
56 <property>
57 <name>resizeable</name>
58 <bool>true</bool>
59 </property>
60 </column>
61 <property stdset="1">
62 <name>name</name>
63 <cstring>contactList</cstring>
64 </property>
65 </widget>
66 </vbox>
67</widget>
68</UI>