kaddressbook
xxport.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef KAB_XXPORT_H
00025 #define KAB_XXPORT_H
00026
00027 #include <qobject.h>
00028
00029 #include <kabc/addressbook.h>
00030 #include <kabc/addresseelist.h>
00031 #include <klibloader.h>
00032 #include <kxmlguiclient.h>
00033 #include <kdepimmacros.h>
00034
00035 #define KAB_XXPORT_PLUGIN_VERSION 1
00036
00037 class KApplication;
00038
00046 #define K_EXPORT_KADDRESSBOOK_XXFILTER_CATALOG( libname, XXPortClass, catalog ) \
00047 class KDE_NO_EXPORT localXXPortFactory : public KAB::XXPortFactory { \
00048 KAB::XXPort *xxportObject( KABC::AddressBook *ab, QWidget *parent, const char *name ) \
00049 { const char *cat = catalog; \
00050 if (cat) KGlobal::locale()->insertCatalogue(cat); \
00051 return new XXPortClass( ab, parent, name ); \
00052 } \
00053 }; \
00054 K_EXPORT_COMPONENT_FACTORY( libname, localXXPortFactory )
00055
00062 #define K_EXPORT_KADDRESSBOOK_XXFILTER( libname, XXPortClass ) \
00063 K_EXPORT_KADDRESSBOOK_XXFILTER_CATALOG( libname, XXPortClass, NULL )
00064
00065
00066 namespace KAB {
00067
00068 class KDE_EXPORT XXPort : public QObject, virtual public KXMLGUIClient
00069 {
00070 Q_OBJECT
00071
00072 public:
00073 XXPort( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 );
00074 ~XXPort();
00075
00080 virtual QString identifier() const = 0;
00081
00086 virtual bool requiresSorting() const { return false; }
00087
00092 void setKApplication( KApplication *app );
00093
00100 void processEvents() const;
00101
00102 public slots:
00106 virtual bool exportContacts( const KABC::AddresseeList &list, const QString& identifier );
00107
00111 virtual KABC::AddresseeList importContacts( const QString& identifier ) const;
00112
00113 signals:
00119 void exportActivated( const QString&, const QString& );
00120
00126 void importActivated( const QString&, const QString& );
00127
00128 protected:
00132 void createImportAction( const QString &label, const QString &identifier = QString::null );
00133
00137 void createExportAction( const QString &label, const QString &identifier = QString::null );
00138
00142 KABC::AddressBook *addressBook() const;
00143
00148 QWidget *parentWidget() const;
00149
00150 private slots:
00151 void slotImportActivated( const QString& );
00152 void slotExportActivated( const QString& );
00153
00154 private:
00155 KABC::AddressBook *mAddressBook;
00156 QWidget *mParentWidget;
00157
00158 class XXPortPrivate;
00159 XXPortPrivate *d;
00160 };
00161
00162 class XXPortFactory : public KLibFactory
00163 {
00164 public:
00165 virtual XXPort *xxportObject( KABC::AddressBook *ab, QWidget *parent,
00166 const char *name = 0 ) = 0;
00167
00168 protected:
00169 virtual QObject* createObject( QObject*, const char*, const char*,
00170 const QStringList & )
00171 {
00172 return 0;
00173 }
00174 };
00175
00176
00177 }
00178
00179 #endif
|