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 <tqobject.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, TQWidget *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 TQObject, virtual public KXMLGUIClient
00069 {
00070 Q_OBJECT
00071 TQ_OBJECT
00072
00073 public:
00074 XXPort( KABC::AddressBook *ab, TQWidget *parent, const char *name = 0 );
00075 ~XXPort();
00076
00081 virtual TQString identifier() const = 0;
00082
00087 virtual bool requiresSorting() const { return false; }
00088
00093 void setKApplication( KApplication *app );
00094
00101 void processEvents() const;
00102
00103 public slots:
00107 virtual bool exportContacts( const KABC::AddresseeList &list, const TQString& identifier );
00108
00112 virtual KABC::AddresseeList importContacts( const TQString& identifier ) const;
00113
00114 signals:
00120 void exportActivated( const TQString&, const TQString& );
00121
00127 void importActivated( const TQString&, const TQString& );
00128
00129 protected:
00133 void createImportAction( const TQString &label, const TQString &identifier = TQString() );
00134
00138 void createExportAction( const TQString &label, const TQString &identifier = TQString() );
00139
00143 KABC::AddressBook *addressBook() const;
00144
00149 TQWidget *parentWidget() const;
00150
00151 private slots:
00152 void slotImportActivated( const TQString& );
00153 void slotExportActivated( const TQString& );
00154
00155 private:
00156 KABC::AddressBook *mAddressBook;
00157 TQWidget *mParentWidget;
00158
00159 class XXPortPrivate;
00160 XXPortPrivate *d;
00161 };
00162
00163 class XXPortFactory : public KLibFactory
00164 {
00165 public:
00166 virtual XXPort *xxportObject( KABC::AddressBook *ab, TQWidget *parent,
00167 const char *name = 0 ) = 0;
00168
00169 protected:
00170 virtual TQObject* createObject( TQObject*, const char*, const char*,
00171 const TQStringList & )
00172 {
00173 return 0;
00174 }
00175 };
00176
00177
00178 }
00179
00180 #endif
|