kaddressbook
xxport.h
Go to the documentation of this file.00001
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 <QtCore/QObject>
00028
00029 #include "kaddressbook_export.h"
00030 #include <kabc/addressbook.h>
00031 #include <kabc/addresseelist.h>
00032 #include <kpluginfactory.h>
00033 #include <kxmlguiclient.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 public: LocalXXPortFactory() : KAB::XXPortFactory(#libname, catalog) {} \
00049 KAB::XXPort *xxportObject( KABC::AddressBook *ab, QWidget *parent, const char *name ) \
00050 { return new XXPortClass( ab, parent, name ); } \
00051 }; \
00052 K_EXPORT_PLUGIN( LocalXXPortFactory )
00053
00060 #define K_EXPORT_KADDRESSBOOK_XXFILTER( libname, XXPortClass ) \
00061 K_EXPORT_KADDRESSBOOK_XXFILTER_CATALOG( libname, XXPortClass, NULL )
00062
00063
00064 namespace KAB {
00065
00066 class KABINTERFACES_EXPORT XXPort : public QObject, virtual public KXMLGUIClient
00067 {
00068 Q_OBJECT
00069
00070 public:
00071 explicit XXPort( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 );
00072 ~XXPort();
00073
00078 virtual QString identifier() const = 0;
00079
00084 virtual bool requiresSorting() const { return false; }
00085
00090 void setKApplication( KApplication *app );
00091
00098 void processEvents() const;
00099
00100 public Q_SLOTS:
00104 virtual bool exportContacts( const KABC::AddresseeList &list, const QString& identifier );
00105
00109 virtual KABC::Addressee::List importContacts( const QString& identifier ) const;
00110
00111 Q_SIGNALS:
00117 void exportActivated( const QString&, const QString& );
00118
00124 void importActivated( const QString&, const QString& );
00125
00126 protected:
00130 void createImportAction( const QString &label, const QString &identifier = QString() );
00131
00135 void createExportAction( const QString &label, const QString &identifier = QString() );
00136
00140 KABC::AddressBook *addressBook() const;
00141
00146 QWidget *parentWidget() const;
00147
00148 private Q_SLOTS:
00149 void slotImportActivated( const QString& );
00150 void slotExportActivated( const QString& );
00151
00152 private:
00153 KABC::AddressBook *mAddressBook;
00154 QWidget *mParentWidget;
00155
00156 class XXPortPrivate;
00157 XXPortPrivate *d;
00158 };
00159
00160 class KABINTERFACES_EXPORT XXPortFactory : public KPluginFactory
00161 {
00162 Q_OBJECT
00163
00164 public:
00165 explicit XXPortFactory(const char *componentName = 0, const char *catalogName = 0)
00166 : KPluginFactory(componentName, catalogName) {}
00167
00168 virtual XXPort *xxportObject( KABC::AddressBook *ab, QWidget *parent,
00169 const char *name = 0 ) = 0;
00170 };
00171
00172
00173 }
00174
00175 #endif