author | ulf69 <ulf69> | 2004-08-02 18:28:27 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-02 18:28:27 (UTC) |
commit | 983127ce46c9ff6663d08dedd450da3fe7dd549b (patch) (side-by-side diff) | |
tree | b6c5bf6bffbddb80ef405a6fc322bfa8bfe13d98 | |
parent | 09fe5a5325105b5051d22feb8dae6bb1f9875ff3 (diff) | |
download | kdepimpi-983127ce46c9ff6663d08dedd450da3fe7dd549b.zip kdepimpi-983127ce46c9ff6663d08dedd450da3fe7dd549b.tar.gz kdepimpi-983127ce46c9ff6663d08dedd450da3fe7dd549b.tar.bz2 |
implemented the exportclasses for opie, qtopia and sharp as part of kaddressbook and not as additional libraries.
-rw-r--r-- | kaddressbook/kaddressbook.pro | 8 | ||||
-rw-r--r-- | kaddressbook/kaddressbookE.pro | 8 | ||||
-rw-r--r-- | kaddressbook/xxportmanager.cpp | 15 | ||||
-rw-r--r-- | kaddressbook/xxportobject.cpp | 21 | ||||
-rw-r--r-- | kaddressbook/xxportobject.h | 35 |
5 files changed, 78 insertions, 9 deletions
diff --git a/kaddressbook/kaddressbook.pro b/kaddressbook/kaddressbook.pro index 77fce1b..0da5842 100644 --- a/kaddressbook/kaddressbook.pro +++ b/kaddressbook/kaddressbook.pro @@ -1,17 +1,17 @@ TEMPLATE = app CONFIG = qt warn_on TARGET = kapi DESTDIR= ../bin include( ../variables.pri ) -INCLUDEPATH += . ./details ./features ./kcmconfigs ./xxport ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../kabc ../ interfaces +INCLUDEPATH += . ./details ./features ./kcmconfigs ./xxport ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../ interfaces DEFINES += KAB_EMBEDDED KAB_NOSPLITTER DESKTOP_VERSION unix : { LIBS += ../bin/libmicrokdepim.so LIBS += ../bin/libmicrokde.so LIBS += ../bin/libmicrokabc.so LIBS += ../bin/libmicrokcal.so LIBS += -lldap @@ -92,16 +92,19 @@ views/configuretableviewdialog.h \ views/configurecardviewdialog.h \ views/cardview.h \ views/colorlistbox.h \ views/contactlistview.h \ xxport/vcard_xxport.h \ xxport/kde2_xxport.h \ xxport/csv_xxport.h \ xxport/csvimportdialog.h \ +xxport/opie_xxport.h \ +xxport/qtopia_xxport.h \ +xxport/sharpdtm_xxport.h \ #details/look_details.h \ #mainwindoiw.h \ # alarmclient.h \ # calendarview.h \ # customlistviewitem.h \ # datenavigator.h SOURCES = \ @@ -155,16 +158,19 @@ views/configuretableviewdialog.cpp \ views/configurecardviewdialog.cpp \ views/cardview.cpp \ views/contactlistview.cpp \ views/colorlistbox.cpp \ xxport/vcard_xxport.cpp \ xxport/kde2_xxport.cpp \ xxport/csv_xxport.cpp \ xxport/csvimportdialog.cpp \ +xxport/opie_xxport.cpp \ +xxport/qtopia_xxport.cpp \ +xxport/sharpdtm_xxport.cpp \ #details/look_details.cpp \ #mainwindow.cpp \ # calendarview.cpp \ # timespanview.cpp win32: { diff --git a/kaddressbook/kaddressbookE.pro b/kaddressbook/kaddressbookE.pro index dc4a2f2..95e6641 100644 --- a/kaddressbook/kaddressbookE.pro +++ b/kaddressbook/kaddressbookE.pro @@ -5,17 +5,17 @@ CONFIG += qt warn_on TARGET = kapi OBJECTS_DIR = obj/$(PLATFORM) MOC_DIR = moc/$(PLATFORM) DESTDIR=$(QPEDIR)/bin #LFLAGS += -Wl,-export-dynamic -INCLUDEPATH += . ./details ./features ./kcmconfigs ./xxport ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include +INCLUDEPATH += . ./details ./features ./kcmconfigs ./xxport ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include DEFINES += KAB_EMBEDDED KAB_NOSPLITTER #DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL #DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER #DEFINES += KORG_NOLVALTERNATION LIBS += -lmicrokdepim #LIBS += -lmicrokcal LIBS += -lmicrokde LIBS += -lmicrokcal @@ -82,16 +82,19 @@ views/configuretableviewdialog.h \ views/configurecardviewdialog.h \ views/cardview.h \ views/colorlistbox.h \ views/contactlistview.h \ xxport/vcard_xxport.h \ xxport/kde2_xxport.h \ xxport/csv_xxport.h \ xxport/csvimportdialog.h \ +xxport/opie_xxport.h \ +xxport/qtopia_xxport.h \ +xxport/sharpdtm_xxport.h \ #details/look_details.h \ #mainwindoiw.h \ # alarmclient.h \ # calendarview.h \ # customlistviewitem.h \ # datenavigator.h SOURCES = \ @@ -145,13 +148,16 @@ views/configuretableviewdialog.cpp \ views/configurecardviewdialog.cpp \ views/cardview.cpp \ views/contactlistview.cpp \ views/colorlistbox.cpp \ xxport/vcard_xxport.cpp \ xxport/kde2_xxport.cpp \ xxport/csv_xxport.cpp \ xxport/csvimportdialog.cpp \ +xxport/opie_xxport.cpp \ +xxport/qtopia_xxport.cpp \ +xxport/sharpdtm_xxport.cpp \ #details/look_details.cpp \ #mainwindow.cpp \ # calendarview.cpp \ # timespanview.cpp diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp index 2962951..a6797c9 100644 --- a/kaddressbook/xxportmanager.cpp +++ b/kaddressbook/xxportmanager.cpp @@ -38,19 +38,22 @@ $Id$ #include <klocale.h> #include <kmessagebox.h> #ifndef KAB_EMBEDDED #include <ktrader.h> #else //KAB_EMBEDDED extern "C" { - void* init_kaddrbk_csv_xxport(); - void* init_kaddrbk_kde2_xxport(); - void* init_kaddrbk_vcard_xxport(); + void* init_microkaddrbk_csv_xxport(); + void* init_microkaddrbk_kde2_xxport(); + void* init_microkaddrbk_vcard_xxport(); + void* init_microkaddrbk_opie_xxport(); + void* init_microkaddrbk_qtopia_xxport(); + void* init_microkaddrbk_sharpdtm_xxport(); } #endif //KAB_EMBEDDED #include <libkdepim/addresseeview.h> #include "kabcore.h" #include "undocmds.h" #include "xxportselectdialog.h" @@ -187,19 +190,19 @@ void XXPortManager::loadPlugins() if ( !xxportFactory ) { kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl; continue; } #else //KAB_EMBEDDED QList<XXPortFactory> factorylist; - factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_csv_xxport())); - factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_kde2_xxport())); - factorylist.append(static_cast<XXPortFactory*>(init_kaddrbk_vcard_xxport())); + factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_csv_xxport())); + factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_kde2_xxport())); + factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_vcard_xxport())); //add the opie import library dynamically KLibFactory *factory = KLibLoader::self()->factory( "microkaddrbk_opie_xxport" ); if ( factory ) { XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); factorylist.append(xxportFactory); } diff --git a/kaddressbook/xxportobject.cpp b/kaddressbook/xxportobject.cpp index 42ab0fb..bb985a6 100644 --- a/kaddressbook/xxportobject.cpp +++ b/kaddressbook/xxportobject.cpp @@ -142,11 +142,32 @@ void XXPortObject::slotExportActivated( const QString &data ) emit exportActivated( identifier(), ( data == "<empty>" ? QString::null : data ) ); } void XXPortObject::slotImportActivated( const QString &data ) { emit importActivated( identifier(), ( data == "<empty>" ? QString::null : data ) ); } +/******************************************************************** + * + *******************************************************************/ + + +XXPortResourceObject::XXPortResourceObject( KABC::AddressBook *ab, QWidget *parent, + const char *name ) + : XXPortObject( ab, parent, name ), mResource(0) +{ +} + +XXPortResourceObject::~XXPortResourceObject() +{ +} + +bool XXPortResourceObject::isAvailable() +{ + return (mResource != 0); +} + + #ifndef KAB_EMBEDDED #include "xxportobject.moc" #endif //KAB_EMBEDDED diff --git a/kaddressbook/xxportobject.h b/kaddressbook/xxportobject.h index fddc219..d547855 100644 --- a/kaddressbook/xxportobject.h +++ b/kaddressbook/xxportobject.h @@ -30,20 +30,24 @@ $Id$ #ifndef XXPORTOBJECT_H #define XXPORTOBJECT_H #include <qobject.h> #include <kabc/addressbook.h> #include <kabc/addresseelist.h> +#include <kabc/resource.h> #include <kxmlguiclient.h> #include <klibloader.h> + + + class XXPortObject : public QObject, virtual public KXMLGUIClient { Q_OBJECT public: XXPortObject( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); ~XXPortObject(); @@ -54,16 +58,23 @@ class XXPortObject : public QObject, virtual public KXMLGUIClient virtual QString identifier() const = 0; /** Reimplement this method if the XXPortManager shall pass a sorted list to @ref exportContacts(). */ virtual bool requiresSorting() const { return false; } + /** + Returns true if the XXPortObject can be used. + One case it can not be used is for example if a needed lib could not be loaded. + */ + virtual bool isAvailable() const { return true; }; + + public slots: /** Reimplement this method for exporting the contacts. */ virtual bool exportContacts( const KABC::AddresseeList &list, const QString& identifier ); /** Reimplement this method for importing the contacts. @@ -102,29 +113,51 @@ class XXPortObject : public QObject, virtual public KXMLGUIClient KABC::AddressBook *addressBook() const; /** Returns a pointer to the parent widget. It can be used as parent for message boxes. */ QWidget *parentWidget() const; - + private slots: void slotImportActivated( const QString& ); void slotExportActivated( const QString& ); private: KABC::AddressBook *mAddressBook; QWidget *mParentWidget; class XXPortObjectPrivate; XXPortObjectPrivate *d; }; + + +class XXPortResourceObject : public XXPortObject +{ + Q_OBJECT + + public: + XXPortResourceObject( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); + ~XXPortResourceObject(); + + /** + Returns true if the XXPortObject can be used. + One case it can not be used is for example if a needed lib could not be loaded. + */ + virtual bool isAvailable(); + protected: + KABC::Resource* mResource; +}; + + + + class XXPortFactory : public KLibFactory { public: virtual XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ) = 0; protected: virtual QObject* createObject( QObject*, const char*, const char*, |