From 8d905d7489f50210afde611138245ae2ee180f8f Mon Sep 17 00:00:00 2001 From: ulf69 Date: Fri, 06 Aug 2004 18:30:46 +0000 Subject: functionality now implemented in kabc resource plugins --- (limited to 'libkabcwrap') 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 @@ -KAddressbook-Wrapper für Opie/Qtopia - -Bietet eine transparente Möglichkeit, auf die bekannten -Klassen StdAddressBook und AddresseeDialog zuzugreifen, -während im Hintergrund entsprechende Plugins durch Ansprechen -der Qtopia- bzw. Opie-PIM-API die Adressedaten aufbereiten -und laden. - -Einbinden in KO/Pi: - -In korganizerE.pro: - -- Die Definition KORG_NOKABC entfernen. -- In die INCLUDEPATH den Pfad zum Quellverzeichnis des Wrapper eintragen. -- -lkabc zu den LIBS hinzufügen - -In den Quelldateien incomingdialog.cpp, koeventviewer.cpp und publishdialog.cpp: -- Alle Aufrufe von addressList.size() durch addressList.count() ersetzen. - Beispielsweise durch - perl -i -p -e 's/addressList\.size/addressList.count/g' - -Der Pluginlader erwartet bislang zwei Plugins -libopiekabc.so und libqtopiakabc.so -im Verzeichnis /opt/Qtopia/plugins/korganizer. -Erst wird versucht, libopiekabc.so, dann libqtopiakabc.so zu laden. - -TODOs: -- Fixen Pfad "/opt/Qtopia" rausnehmen. -- AddresseeDialog::getAddressees wird momentan durch ::getAddressee - 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 @@ -#include -#include -#include -#include "addresseedialog.h" -#include "select_addressee_base.h" - -using namespace KABC; - -Addressee AddresseeDialog::getAddressee( QWidget *parent ) { - - Addressee result; - if (!getInterface()) { - 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 ); - } else { - - // qDebug("Start: AddresseeDialog::getAddressee"); - - Addressee::List list = getAddresseesFromPlugin(); - - SelectAddressee *selAddressee = new SelectAddressee(parent,"SelectAddressee", true); - QListView *contactList = selAddressee->contactList; - contactList->setSelectionMode(QListView::Single); - if (!contactList) { - Addressee emptyAddressee; - return emptyAddressee; - } - - for (uint i=0; i < list.count(); i++) { - Addressee a = list[i]; - QString fullName = a.formattedName(); - QString defaultEmail = a.preferredEmail(); - //qDebug("Adding " + fullName); - QListViewItem *item = new QListViewItem(contactList, fullName, defaultEmail); - } - if ( QApplication::desktop()->width() < 480 ) { - selAddressee->setMinimumWidth( 220 ); - } else { - selAddressee->setMinimumWidth( 440 ); - } - if (selAddressee->exec()) { - QListViewItem *selectedItem = contactList->selectedItem(); - if (selectedItem) { - uint i=0; - for (i=0; i < list.count() && (list[i].formattedName() != selectedItem->text(0)); i++); - if (i -#include -#include -#include -#include -#include "opieaddressee.h" -*/ -#include -#include "kabcaddressbookplugin.h" - -KABCAddressBookPlugin::KABCAddressBookPlugin() : ref(0) { - -//US access = new OContactAccess("OpieAddressBookPlugin"); - -} - -KABC::Addressee::List KABCAddressBookPlugin::getAddressees() { - KABC::Addressee::List results; - - -/*US - OContactAccess access("OpieAddressBookPlugin"); - OContactAccess::List::Iterator it; - ORecordList accessList = access.sorted(true,0,0,0); - for(it = accessList.begin(); it != accessList.end(); ++it ) { - OpieAddressee addressee( *it ); - results.append(addressee); - } -*/ - qDebug("KABCAddressBookPlugin::getAddressees has to be implemented"); - - return results; -} - -QString KABCAddressBookPlugin::name() { - return QString::QString("KABCAddressBookPlugin"); -} - - -KABC::Addressee::List KABCAddressBookPlugin::findByEmail(const QString &email) { - -printf("KABCAddressBookPlugin::findByEmail: email=%s\n", email.ascii()); - KABC::Addressee::List results; -/*US - - ORecordList accessList = access->sorted(true,0,0,0); - OContactAccess::List::Iterator it; - for(it = accessList.begin(); it != accessList.end(); ++it ) { - OContact contact = *it; - QStringList emailList = contact.emailList(); - QStringList foundEmails = emailList.grep(email,false); - if (foundEmails.count() >= 1) { - OpieAddressee a(contact); - printf("Found Contact %s\n", a.formattedName().ascii()); - results.append(a); - } - } -*/ - qDebug("KABCAddressBookPlugin::findByEmail has to be implemented"); - - return results; - -} - -QRESULT KABCAddressBookPlugin::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) -{ -printf("Start: KABCAddressBookPlugin::queryInterface\n"); - *iface = 0; - if ( uuid == IID_QUnknown ) - *iface = this; - else if ( uuid == IID_KOAddressBookInterface ) - *iface = this; - if ( *iface ) - (*iface)->addRef(); - return QS_OK; -printf("End: KABCAddressBookPlugin::queryInterface\n"); -} - -Q_EXPORT_INTERFACE() -{ - Q_CREATE_INSTANCE( KABCAddressBookPlugin ) -} - 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 @@ -#include -#include -#include - -struct KABCAddressBookPlugin : public KOAddressBookInterface { - - public: - - KABCAddressBookPlugin::KABCAddressBookPlugin(); - QString name(); - KABC::Addressee::List getAddressees(); - KABC::Addressee::List findByEmail(const QString &email); - QRESULT queryInterface( const QUuid&, QUnknownInterface** ); - Q_REFCOUNT - protected: -// OContactAccess *access; - ulong ref; -}; 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 @@ -#ifndef KO_ADDRESS_BOOK_INTERFACE_H -#define KO_ADDRESS_BOOK_INTERFACE_H - -#include -#include -#include "addressee.h" - -#ifndef QT_NO_COMPONENT -#ifndef IID_KOAddressBookInterface -#define IID_KOAddressBookInterface QUuid( 0x7505e192, 0x4977, 0x465a, 0xb7, 0x2f, 0x0a, 0x8d, 0xd4, 0x91, 0xcf, 0x43) -#endif -#endif - -struct KOAddressBookInterface : public QUnknownInterface { - - virtual QString name() = 0; - virtual KABC::Addressee::List getAddressees() = 0; - -}; -#endif - 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 @@ -#ifndef KO_ADDRESS_BOOK_PLUGIN_LOADER_H -#define KO_ADDRESS_BOOK_PLUGIN_LOADER_H - -#include "addressee.h" -#include "koaddressbookinterface.h" - -class KOAddressBookPluginLoader { - - public: - static KOAddressBookInterface *getInterface(); - static KABC::Addressee::List getAddresseesFromPlugin(); - - private: - static KOAddressBookInterface *iface; - static KABC::Addressee::List addresseeList; -}; - -#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 @@ -#include -#include -#include -#include "koaddressbookpluginloader.h" -#include "kabcaddressbookplugin.h" - -KOAddressBookInterface *KOAddressBookPluginLoader::iface = 0; -KABC::Addressee::List KOAddressBookPluginLoader::addresseeList; - -KOAddressBookInterface *KOAddressBookPluginLoader::getInterface() { - - qDebug("Start: KOAddressBookPluginLoader::getInterface"); - - if (!iface) { - - const QString & qpeDir = QPEApplication::qpeDir(); - QLibrary *lib = new QLibrary( qpeDir + "/plugins/korganizer/libopiekabc.so", QLibrary::Immediately ); - QRESULT q = lib->queryInterface( IID_QUnknown, (QUnknownInterface**)&iface ); - if ( q != QS_OK ) { - lib = new QLibrary( qpeDir + "/plugins/korganizer/libqtopiakabc.so", QLibrary::Immediately ); - QRESULT q = lib->queryInterface( IID_QUnknown, (QUnknownInterface**)&iface ); - // we checked now for all known external interfaces. If no were found, use the default KABC interface - if ( q != QS_OK ) { - iface = new KABCAddressBookPlugin(); - } - } - } - - qDebug("End: KOAddressBookPluginLoader::getInterface"); - return iface; - -} - -KABC::Addressee::List KOAddressBookPluginLoader::getAddresseesFromPlugin() { - - qDebug("Start: KOAddressBookPluginLoader::getAddresseesFromPlugin"); - addresseeList.clear(); - if (!(addresseeList.count() > 0)) { - qDebug("KOAddressBookPluginLoader::getAddresseesFromPlugin: no addresses loaded. Loading..."); - if (!iface) { - qDebug("KOAddressBookPluginLoader::getAddresseesFromPlugin: no interface loaded. Loading..."); - iface = getInterface(); - } - if (iface) { - qDebug("KOAddressBookPluginLoader::getAddresseesFromPlugin: interface is " + iface->name()); - addresseeList = iface->getAddressees(); - } else { - qDebug("KOAddressBookPluginLoader::getAddresseesFromPlugin: No interface found!"); - } - } - - - qDebug("End: KOAddressBookPluginLoader::getAddresseesFromPlugin"); - return addresseeList; - -} 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 @@ -TEMPLATE = lib -CONFIG += qt warn_on release - -TARGET = microkabcwrap -OBJECTS_DIR = obj/$(PLATFORM) -MOC_DIR = moc -DESTDIR=$(QPEDIR)/lib -INCLUDEPATH += . $(QPEDIR)/include ../kabc ../microkde ../microkde/kdecore -DEFINES += -LIBS += -lmicrokabc -LIBS += -L$(QPEDIR)/lib -#US LIBS += -lqpe -#US LIBS += -lqte - -INTERFACES += select_addressee_base.ui - -HEADERS = \ - addresseedialog.h \ - koaddressbookinterface.h \ - kabcaddressbookplugin.h - -# kabc/addressee.h \ -# kabc/addressbook.h \ -# kabc/stdaddressbook.h \ - -SOURCES = \ - addresseedialog.cpp \ - koaddresspluginloader.cpp \ - kabcaddressbookplugin.cpp -# addressee.cpp \ -# 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 @@ -/**************************************************************************** -** Form implementation generated from reading ui file 'select_addressee_base.ui' -** -** Created: Fri Feb 6 04:58:15 2004 -** by: The User Interface Compiler (uic) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ -#include "select_addressee_base.h" - -#include -#include -#include -#include -#include -#include -#include - -/* - * Constructs a SelectAddressee which is a child of 'parent', with the - * name 'name' and widget flags set to 'f' - * - * The dialog will by default be modeless, unless you set 'modal' to - * TRUE to construct a modal dialog. - */ -SelectAddressee::SelectAddressee( QWidget* parent, const char* name, bool modal, WFlags fl ) - : QDialog( parent, name, modal, fl ) -{ - if ( !name ) - setName( "SelectAddressee" ); - resize( 208, 267 ); - setCaption( tr( "Select adressee" ) ); - SelectAddresseeLayout = new QVBoxLayout( this ); - SelectAddresseeLayout->setSpacing( 6 ); - SelectAddresseeLayout->setMargin( 11 ); - - contactList = new QListView( this, "contactList" ); - contactList->addColumn( tr( "Name" ) ); - contactList->addColumn( tr( "Email" ) ); - SelectAddresseeLayout->addWidget( contactList ); -} - -/* - * Destroys the object and frees any allocated resources - */ -SelectAddressee::~SelectAddressee() -{ - // no need to delete child widgets, Qt does it all for us -} - 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 @@ -/**************************************************************************** -** Form interface generated from reading ui file 'select_addressee_base.ui' -** -** Created: Fri Feb 6 04:58:14 2004 -** by: The User Interface Compiler (uic) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ -#ifndef SELECTADDRESSEE_H -#define SELECTADDRESSEE_H - -#include -#include -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QListView; -class QListViewItem; - -class SelectAddressee : public QDialog -{ - Q_OBJECT - -public: - SelectAddressee( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); - ~SelectAddressee(); - - QListView* contactList; - -protected: - QVBoxLayout* SelectAddresseeLayout; -}; - -#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 @@ - -SelectAddressee - - QDialog - - name - SelectAddressee - - - geometry - - 0 - 0 - 208 - 267 - - - - caption - Select adressee - - - - margin - 11 - - - spacing - 6 - - - QListView - - - text - Name - - - clickable - true - - - resizeable - true - - - - - text - Email - - - clickable - true - - - resizeable - true - - - - name - contactList - - - - - -- cgit v0.9.0.2