-rw-r--r-- | kaddressbook/xxportobject.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/kaddressbook/xxportobject.h b/kaddressbook/xxportobject.h index fddc219..d547855 100644 --- a/kaddressbook/xxportobject.h +++ b/kaddressbook/xxportobject.h | |||
@@ -32,16 +32,20 @@ $Id$ | |||
32 | #define XXPORTOBJECT_H | 32 | #define XXPORTOBJECT_H |
33 | 33 | ||
34 | #include <qobject.h> | 34 | #include <qobject.h> |
35 | 35 | ||
36 | #include <kabc/addressbook.h> | 36 | #include <kabc/addressbook.h> |
37 | #include <kabc/addresseelist.h> | 37 | #include <kabc/addresseelist.h> |
38 | #include <kabc/resource.h> | ||
38 | #include <kxmlguiclient.h> | 39 | #include <kxmlguiclient.h> |
39 | #include <klibloader.h> | 40 | #include <klibloader.h> |
40 | 41 | ||
41 | 42 | ||
43 | |||
44 | |||
45 | |||
42 | class XXPortObject : public QObject, virtual public KXMLGUIClient | 46 | class XXPortObject : public QObject, virtual public KXMLGUIClient |
43 | { | 47 | { |
44 | Q_OBJECT | 48 | Q_OBJECT |
45 | 49 | ||
46 | public: | 50 | public: |
47 | XXPortObject( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); | 51 | XXPortObject( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); |
@@ -56,12 +60,19 @@ class XXPortObject : public QObject, virtual public KXMLGUIClient | |||
56 | /** | 60 | /** |
57 | Reimplement this method if the XXPortManager shall | 61 | Reimplement this method if the XXPortManager shall |
58 | pass a sorted list to @ref exportContacts(). | 62 | pass a sorted list to @ref exportContacts(). |
59 | */ | 63 | */ |
60 | virtual bool requiresSorting() const { return false; } | 64 | virtual bool requiresSorting() const { return false; } |
61 | 65 | ||
66 | /** | ||
67 | Returns true if the XXPortObject can be used. | ||
68 | One case it can not be used is for example if a needed lib could not be loaded. | ||
69 | */ | ||
70 | virtual bool isAvailable() const { return true; }; | ||
71 | |||
72 | |||
62 | public slots: | 73 | public slots: |
63 | /** | 74 | /** |
64 | Reimplement this method for exporting the contacts. | 75 | Reimplement this method for exporting the contacts. |
65 | */ | 76 | */ |
66 | virtual bool exportContacts( const KABC::AddresseeList &list, const QString& identifier ); | 77 | virtual bool exportContacts( const KABC::AddresseeList &list, const QString& identifier ); |
67 | 78 | ||
@@ -104,25 +115,47 @@ class XXPortObject : public QObject, virtual public KXMLGUIClient | |||
104 | /** | 115 | /** |
105 | Returns a pointer to the parent widget. It can be used as parent for | 116 | Returns a pointer to the parent widget. It can be used as parent for |
106 | message boxes. | 117 | message boxes. |
107 | */ | 118 | */ |
108 | QWidget *parentWidget() const; | 119 | QWidget *parentWidget() const; |
109 | 120 | ||
110 | 121 | ||
111 | private slots: | 122 | private slots: |
112 | void slotImportActivated( const QString& ); | 123 | void slotImportActivated( const QString& ); |
113 | void slotExportActivated( const QString& ); | 124 | void slotExportActivated( const QString& ); |
114 | 125 | ||
115 | private: | 126 | private: |
116 | KABC::AddressBook *mAddressBook; | 127 | KABC::AddressBook *mAddressBook; |
117 | QWidget *mParentWidget; | 128 | QWidget *mParentWidget; |
118 | 129 | ||
119 | class XXPortObjectPrivate; | 130 | class XXPortObjectPrivate; |
120 | XXPortObjectPrivate *d; | 131 | XXPortObjectPrivate *d; |
121 | }; | 132 | }; |
122 | 133 | ||
134 | |||
135 | |||
136 | class XXPortResourceObject : public XXPortObject | ||
137 | { | ||
138 | Q_OBJECT | ||
139 | |||
140 | public: | ||
141 | XXPortResourceObject( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); | ||
142 | ~XXPortResourceObject(); | ||
143 | |||
144 | /** | ||
145 | Returns true if the XXPortObject can be used. | ||
146 | One case it can not be used is for example if a needed lib could not be loaded. | ||
147 | */ | ||
148 | virtual bool isAvailable(); | ||
149 | protected: | ||
150 | KABC::Resource* mResource; | ||
151 | }; | ||
152 | |||
153 | |||
154 | |||
155 | |||
123 | class XXPortFactory : public KLibFactory | 156 | class XXPortFactory : public KLibFactory |
124 | { | 157 | { |
125 | public: | 158 | public: |
126 | virtual XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent, | 159 | virtual XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent, |
127 | const char *name = 0 ) = 0; | 160 | const char *name = 0 ) = 0; |
128 | 161 | ||