-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 | 33 |
5 files changed, 77 insertions, 8 deletions
diff --git a/kaddressbook/kaddressbook.pro b/kaddressbook/kaddressbook.pro index 77fce1b..0da5842 100644 --- a/kaddressbook/kaddressbook.pro +++ b/kaddressbook/kaddressbook.pro @@ -1,33 +1,33 @@ 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 OBJECTS_DIR = obj/unix MOC_DIR = moc/unix } win32: { DEFINES += _WIN32_ LIBS += ../bin/microkdepim.lib LIBS += ../bin/microkcal.lib LIBS += ../bin/microkde.lib LIBS += ../bin/microkabc.lib QMAKE_LINK += /NODEFAULTLIB:LIBC OBJECTS_DIR = obj/win MOC_DIR = moc/win LIBS += mfc71u.lib } @@ -76,48 +76,51 @@ configurewidget.h \ viewconfigurewidget.h \ viewconfigurefieldspage.h \ viewconfigurefilterpage.h \ typecombo.h \ undo.h \ undocmds.h \ xxportmanager.h \ xxportobject.h \ xxportselectdialog.h \ details/detailsviewcontainer.h \ details/look_basic.h \ details/look_html.h \ views/kaddressbookiconview.h \ views/kaddressbooktableview.h \ views/kaddressbookcardview.h \ 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 = \ addresseeeditordialog.cpp \ addresseeeditorwidget.cpp \ addresseditwidget.cpp \ addresseeconfig.cpp \ addresseeutil.cpp \ extensionmanager.cpp \ features/mergewidget.cpp \ features/distributionlistwidget.cpp \ kcmconfigs/addresseewidget.cpp \ kcmconfigs/extensionconfigdialog.cpp \ kcmconfigs/kcmkabconfig.cpp \ kcmconfigs/kabconfigwidget.cpp \ emaileditwidget.cpp \ filtereditdialog.cpp \ mainembedded.cpp \ kaddressbookmain.cpp \ @@ -139,39 +142,42 @@ addviewdialog.cpp \ configurewidget.cpp \ viewconfigurewidget.cpp \ viewconfigurefieldspage.cpp \ viewconfigurefilterpage.cpp \ undo.cpp \ undocmds.cpp \ xxportmanager.cpp \ xxportobject.cpp \ xxportselectdialog.cpp \ details/detailsviewcontainer.cpp \ details/look_basic.cpp \ details/look_html.cpp \ views/kaddressbookiconview.cpp \ views/kaddressbooktableview.cpp \ views/kaddressbookcardview.cpp \ 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: { HEADERS += ../outport/msoutl9.h \ kaimportoldialog.h SOURCES += ../outport/msoutl9.cpp \ kaimportoldialog.cpp } diff --git a/kaddressbook/kaddressbookE.pro b/kaddressbook/kaddressbookE.pro index dc4a2f2..95e6641 100644 --- a/kaddressbook/kaddressbookE.pro +++ b/kaddressbook/kaddressbookE.pro @@ -1,37 +1,37 @@ TEMPLATE = app 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 LIBS += -lmicroqtcompat LIBS += -lmicrokabc LIBS += -lqpe LIBS += -ljpeg LIBS += $(QTOPIALIB) LIBS += -L$(QPEDIR)/lib LIBS += -Wl,-export-dynamic INTERFACES = \ # filteredit_base.ui \ # kofilterview_base.ui \ HEADERS = \ features/mergewidget.h \ features/distributionlistwidget.h \ kcmconfigs/addresseewidget.h \ @@ -66,48 +66,51 @@ configurewidget.h \ viewconfigurewidget.h \ viewconfigurefieldspage.h \ viewconfigurefilterpage.h \ typecombo.h \ undo.h \ undocmds.h \ xxportmanager.h \ xxportobject.h \ xxportselectdialog.h \ details/detailsviewcontainer.h \ details/look_basic.h \ details/look_html.h \ views/kaddressbookiconview.h \ views/kaddressbooktableview.h \ views/kaddressbookcardview.h \ 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 = \ addresseeeditordialog.cpp \ addresseeeditorwidget.cpp \ addresseditwidget.cpp \ addresseeconfig.cpp \ addresseeutil.cpp \ extensionmanager.cpp \ features/mergewidget.cpp \ features/distributionlistwidget.cpp \ kcmconfigs/addresseewidget.cpp \ kcmconfigs/extensionconfigdialog.cpp \ kcmconfigs/kcmkabconfig.cpp \ kcmconfigs/kabconfigwidget.cpp \ emaileditwidget.cpp \ filtereditdialog.cpp \ mainembedded.cpp \ kaddressbookmain.cpp \ @@ -129,29 +132,32 @@ addviewdialog.cpp \ configurewidget.cpp \ viewconfigurewidget.cpp \ viewconfigurefieldspage.cpp \ viewconfigurefilterpage.cpp \ undo.cpp \ undocmds.cpp \ xxportmanager.cpp \ xxportobject.cpp \ xxportselectdialog.cpp \ details/detailsviewcontainer.cpp \ details/look_basic.cpp \ details/look_html.cpp \ views/kaddressbookiconview.cpp \ views/kaddressbooktableview.cpp \ views/kaddressbookcardview.cpp \ 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 @@ -22,51 +22,54 @@ */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <qlayout.h> #include <qlist.h> #include <kabc/addressbook.h> #include <kabc/resource.h> #include <kdebug.h> #include <kdialogbase.h> #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" #include "xxportmanager.h" KURL XXPortManager::importURL = KURL(); QString XXPortManager::importData = QString::null; class PreviewDialog : public KDialogBase { public: PreviewDialog( const KABC::Addressee &addr, QWidget *parent, const char *name = 0 ); }; XXPortManager::XXPortManager( KABCore *core, QObject *parent, const char *name ) : QObject( parent, name ), mCore( core ), mShowPreview( false ) { @@ -171,51 +174,51 @@ void XXPortManager::loadPlugins() mXXPortObjects.clear(); #ifndef KAB_EMBEDDED KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/XXPort" ); KTrader::OfferList::ConstIterator it; for ( it = plugins.begin(); it != plugins.end(); ++it ) { if ( !(*it)->hasServiceType( "KAddressBook/XXPort" ) ) continue; KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); if ( !factory ) { kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl; continue; } XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); 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); } //add the qtopia import library dynamically factory = KLibLoader::self()->factory( "microkaddrbk_qtopia_xxport" ); if ( factory ) { XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); factorylist.append(xxportFactory); } //add the sharp import library dynamically factory = KLibLoader::self()->factory( "microkaddrbk_sharpdtm_xxport" ); if ( factory ) { XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); factorylist.append(xxportFactory); } QListIterator<XXPortFactory> it(factorylist); for ( ; it.current(); ++it ) diff --git a/kaddressbook/xxportobject.cpp b/kaddressbook/xxportobject.cpp index 42ab0fb..bb985a6 100644 --- a/kaddressbook/xxportobject.cpp +++ b/kaddressbook/xxportobject.cpp @@ -126,27 +126,48 @@ void XXPortObject::createExportAction( const QString &label, const QString &data #endif //KAB_EMBEDDED } KABC::AddressBook *XXPortObject::addressBook() const { return mAddressBook; } QWidget *XXPortObject::parentWidget() const { return mParentWidget; } 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 @@ -14,72 +14,83 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $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(); /** Returns the unique identifier of this xxport modul, it should be the lowercase name of the import/export format e.g. 'vcard' */ 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. */ virtual KABC::AddresseeList importContacts( const QString& identifier ) const; signals: /** Emitted whenever the export action is activated. The parameter contains the @ref identifier() for unique identification. */ void exportActivated( const QString&, const QString& ); /** Emitted whenever the import action is activated. The parameter contains the @ref identifier() for unique identification. */ @@ -99,39 +110,61 @@ class XXPortObject : public QObject, virtual public KXMLGUIClient /** Returns a pointer to the address book object. */ 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*, const QStringList & ) { return 0; } }; #endif |