author | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
commit | b9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff) | |
tree | 2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /kaddressbook/xxportobject.h | |
download | kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2 |
Initial revision
-rw-r--r-- | kaddressbook/xxportobject.h | 157 |
1 files changed, 157 insertions, 0 deletions
diff --git a/kaddressbook/xxportobject.h b/kaddressbook/xxportobject.h new file mode 100644 index 0000000..d697700 --- a/dev/null +++ b/kaddressbook/xxportobject.h | |||
@@ -0,0 +1,157 @@ | |||
1 | /* | ||
2 | This file is part of KAddressbook. | ||
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the Free Software | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | Enhanced Version of the file for platform independent KDE tools. | ||
26 | Copyright (c) 2004 Ulf Schenk | ||
27 | |||
28 | $Id$ | ||
29 | */ | ||
30 | |||
31 | #ifndef XXPORTOBJECT_H | ||
32 | #define XXPORTOBJECT_H | ||
33 | |||
34 | #include <qobject.h> | ||
35 | |||
36 | #include <kabc/addressbook.h> | ||
37 | #include <kabc/addresseelist.h> | ||
38 | #include <kxmlguiclient.h> | ||
39 | #ifndef KAB_EMBEDDED | ||
40 | #include <klibloader.h> | ||
41 | #endif //KAB_EMBEDDED | ||
42 | |||
43 | |||
44 | class XXPortObject : public QObject, virtual public KXMLGUIClient | ||
45 | { | ||
46 | Q_OBJECT | ||
47 | |||
48 | public: | ||
49 | XXPortObject( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 ); | ||
50 | ~XXPortObject(); | ||
51 | |||
52 | /** | ||
53 | Returns the unique identifier of this xxport modul, it should | ||
54 | be the lowercase name of the import/export format e.g. 'vcard' | ||
55 | */ | ||
56 | virtual QString identifier() const = 0; | ||
57 | |||
58 | /** | ||
59 | Reimplement this method if the XXPortManager shall | ||
60 | pass a sorted list to @ref exportContacts(). | ||
61 | */ | ||
62 | virtual bool requiresSorting() const { return false; } | ||
63 | |||
64 | public slots: | ||
65 | /** | ||
66 | Reimplement this method for exporting the contacts. | ||
67 | */ | ||
68 | virtual bool exportContacts( const KABC::AddresseeList &list, const QString& identifier ); | ||
69 | |||
70 | /** | ||
71 | Reimplement this method for importing the contacts. | ||
72 | */ | ||
73 | virtual KABC::AddresseeList importContacts( const QString& identifier ) const; | ||
74 | |||
75 | signals: | ||
76 | /** | ||
77 | Emitted whenever the export action is activated. | ||
78 | The parameter contains the @ref identifier() for | ||
79 | unique identification. | ||
80 | */ | ||
81 | void exportActivated( const QString&, const QString& ); | ||
82 | |||
83 | /** | ||
84 | Emitted whenever the import action is activated. | ||
85 | The parameter contains the @ref identifier() for | ||
86 | unique identification. | ||
87 | */ | ||
88 | void importActivated( const QString&, const QString& ); | ||
89 | |||
90 | protected: | ||
91 | /** | ||
92 | Create the import action. The identifier is passed in the import slot. | ||
93 | */ | ||
94 | void createImportAction( const QString &label, const QString &identifier = QString::null ); | ||
95 | |||
96 | /** | ||
97 | Create the export action. The identifier is passed in the export slot. | ||
98 | */ | ||
99 | void createExportAction( const QString &label, const QString &identifier = QString::null ); | ||
100 | |||
101 | /** | ||
102 | Returns a pointer to the address book object. | ||
103 | */ | ||
104 | KABC::AddressBook *addressBook() const; | ||
105 | |||
106 | /** | ||
107 | Returns a pointer to the parent widget. It can be used as parent for | ||
108 | message boxes. | ||
109 | */ | ||
110 | QWidget *parentWidget() const; | ||
111 | |||
112 | |||
113 | private slots: | ||
114 | void slotImportActivated( const QString& ); | ||
115 | void slotExportActivated( const QString& ); | ||
116 | |||
117 | private: | ||
118 | KABC::AddressBook *mAddressBook; | ||
119 | QWidget *mParentWidget; | ||
120 | |||
121 | class XXPortObjectPrivate; | ||
122 | XXPortObjectPrivate *d; | ||
123 | }; | ||
124 | |||
125 | #ifndef KAB_EMBEDDED | ||
126 | class XXPortFactory : public KLibFactory | ||
127 | { | ||
128 | public: | ||
129 | virtual XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent, | ||
130 | const char *name = 0 ) = 0; | ||
131 | |||
132 | protected: | ||
133 | virtual QObject* createObject( QObject*, const char*, const char*, | ||
134 | const QStringList & ) | ||
135 | { | ||
136 | return 0; | ||
137 | } | ||
138 | }; | ||
139 | |||
140 | #else //KAB_EMBEDDED | ||
141 | class XXPortFactory | ||
142 | { | ||
143 | public: | ||
144 | virtual XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent, | ||
145 | const char *name = 0 ) = 0; | ||
146 | |||
147 | protected: | ||
148 | virtual QObject* createObject( QObject*, const char*, const char*, | ||
149 | const QStringList & ) | ||
150 | { | ||
151 | return 0; | ||
152 | } | ||
153 | }; | ||
154 | #endif //KAB_EMBEDDED | ||
155 | |||
156 | |||
157 | #endif | ||