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/kabcore.h | |
download | kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2 |
Initial revision
-rw-r--r-- | kaddressbook/kabcore.h | 421 |
1 files changed, 421 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h new file mode 100644 index 0000000..edf98c2 --- a/dev/null +++ b/kaddressbook/kabcore.h | |||
@@ -0,0 +1,421 @@ | |||
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 | #ifndef KABCORE_H | ||
25 | #define KABCORE_H | ||
26 | |||
27 | #include <kabc/field.h> | ||
28 | |||
29 | #ifndef KAB_EMBEDDED | ||
30 | #endif //KAB_EMBEDDED | ||
31 | #include <qdict.h> | ||
32 | |||
33 | #include <qwidget.h> | ||
34 | #include <qpopupmenu.h> | ||
35 | |||
36 | namespace KABC { | ||
37 | class AddressBook; | ||
38 | } | ||
39 | |||
40 | #ifndef KAB_EMBEDDED | ||
41 | class KAboutData; | ||
42 | class KConfig; | ||
43 | |||
44 | class KAddressBookService; | ||
45 | class LDAPSearchDialog; | ||
46 | #else //KAB_EMBEDDED | ||
47 | class KAddressBookMain; | ||
48 | //US class QAction; | ||
49 | #endif //KAB_EMBEDDED | ||
50 | class KCMultiDialog; | ||
51 | class KXMLGUIClient; | ||
52 | class ExtensionManager; | ||
53 | class XXPortManager; | ||
54 | class JumpButtonBar; | ||
55 | class IncSearchWidget; | ||
56 | class KDGanttMinimizeSplitter; | ||
57 | class KAction; | ||
58 | class KActionCollection; | ||
59 | class KToggleAction; | ||
60 | |||
61 | class QAction; | ||
62 | class QMenuBar; | ||
63 | class QSplitter; | ||
64 | class ViewContainer; | ||
65 | class ViewManager; | ||
66 | class AddresseeEditorDialog; | ||
67 | |||
68 | class KABCore : public QWidget | ||
69 | { | ||
70 | Q_OBJECT | ||
71 | |||
72 | public: | ||
73 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); | ||
74 | |||
75 | |||
76 | ~KABCore(); | ||
77 | |||
78 | |||
79 | #ifdef KAB_EMBEDDED | ||
80 | //US added functionality | ||
81 | QPopupMenu* getViewMenu() {return viewMenu;} | ||
82 | QPopupMenu* getFilterMenu() {return filterMenu;} | ||
83 | QPopupMenu* getSettingsMenu() {return settingsMenu;} | ||
84 | void addActionsManually(); | ||
85 | #endif //KAB_EMBEDDED | ||
86 | /** | ||
87 | Restores the global settings. | ||
88 | */ | ||
89 | void restoreSettings(); | ||
90 | |||
91 | /** | ||
92 | Saves the global settings. | ||
93 | */ | ||
94 | void saveSettings(); | ||
95 | |||
96 | /** | ||
97 | Returns a pointer to the StdAddressBook of the application. | ||
98 | */ | ||
99 | KABC::AddressBook *addressBook() const; | ||
100 | |||
101 | /** | ||
102 | Returns a pointer to the KConfig object of the application. | ||
103 | */ | ||
104 | static KConfig *config(); | ||
105 | |||
106 | /** | ||
107 | Returns a pointer to the global KActionCollection object. So | ||
108 | other classes can register their actions easily. | ||
109 | */ | ||
110 | KActionCollection *actionCollection() const; | ||
111 | |||
112 | /** | ||
113 | Returns the current search field of the Incremental Search Widget. | ||
114 | */ | ||
115 | KABC::Field *currentSearchField() const; | ||
116 | |||
117 | /** | ||
118 | Returns the uid list of the currently selected contacts. | ||
119 | */ | ||
120 | QStringList selectedUIDs() const; | ||
121 | |||
122 | /** | ||
123 | Displays the ResourceSelectDialog and returns the selected | ||
124 | resource or a null pointer if no resource was selected by | ||
125 | the user. | ||
126 | */ | ||
127 | KABC::Resource *requestResource( QWidget *parent ); | ||
128 | |||
129 | #ifndef KAB_EMBEDDED | ||
130 | static KAboutData *createAboutData(); | ||
131 | #endif //KAB_EMBEDDED | ||
132 | |||
133 | #ifdef KAB_EMBEDDED | ||
134 | inline QPopupMenu* getImportMenu() { return ImportMenu;} | ||
135 | inline QPopupMenu* getExportMenu() { return ExportMenu;} | ||
136 | #endif //KAB_EMBEDDED | ||
137 | |||
138 | public slots: | ||
139 | #ifdef KAB_EMBEDDED | ||
140 | void createAboutData(); | ||
141 | #endif //KAB_EMBEDDED | ||
142 | |||
143 | void statusMessage(QString, int time = 0 ); | ||
144 | /** | ||
145 | Is called whenever a contact is selected in the view. | ||
146 | */ | ||
147 | void setContactSelected( const QString &uid ); | ||
148 | |||
149 | /** | ||
150 | Opens the preferred mail composer with all selected contacts as | ||
151 | arguments. | ||
152 | */ | ||
153 | void sendMail(); | ||
154 | |||
155 | /** | ||
156 | Opens the preferred mail composer with the given contacts as | ||
157 | arguments. | ||
158 | */ | ||
159 | void sendMail( const QString& email ); | ||
160 | |||
161 | |||
162 | void mailVCard(); | ||
163 | void mailVCard(const QStringList& uids); | ||
164 | |||
165 | /** | ||
166 | Starts the preferred web browser with the given URL as argument. | ||
167 | */ | ||
168 | void browse( const QString& url ); | ||
169 | |||
170 | /** | ||
171 | Select all contacts in the view. | ||
172 | */ | ||
173 | void selectAllContacts(); | ||
174 | |||
175 | /** | ||
176 | Deletes all selected contacts from the address book. | ||
177 | */ | ||
178 | void deleteContacts(); | ||
179 | |||
180 | /** | ||
181 | Deletes given contacts from the address book. | ||
182 | |||
183 | @param uids The uids of the contacts, which shall be deleted. | ||
184 | */ | ||
185 | void deleteContacts( const QStringList &uids ); | ||
186 | |||
187 | /** | ||
188 | Copys the selected contacts into clipboard for later pasting. | ||
189 | */ | ||
190 | void copyContacts(); | ||
191 | |||
192 | /** | ||
193 | Cuts the selected contacts and stores them for later pasting. | ||
194 | */ | ||
195 | void cutContacts(); | ||
196 | |||
197 | /** | ||
198 | Paste contacts from clipboard into the address book. | ||
199 | */ | ||
200 | void pasteContacts(); | ||
201 | |||
202 | /** | ||
203 | Paste given contacts into the address book. | ||
204 | |||
205 | @param list The list of addressee, which shall be pasted. | ||
206 | */ | ||
207 | void pasteContacts( KABC::Addressee::List &list ); | ||
208 | |||
209 | /** | ||
210 | Sets the whoAmI contact, that is used by many other programs to | ||
211 | get personal information about the current user. | ||
212 | */ | ||
213 | void setWhoAmI(); | ||
214 | |||
215 | /** | ||
216 | Displays the category dialog and applies the result to all | ||
217 | selected contacts. | ||
218 | */ | ||
219 | void setCategories(); | ||
220 | |||
221 | /** | ||
222 | Sets the field list of the Incremental Search Widget. | ||
223 | */ | ||
224 | void setSearchFields( const KABC::Field::List &fields ); | ||
225 | |||
226 | /** | ||
227 | Search with the current search field for a contact, that matches | ||
228 | the given text, and selects it in the view. | ||
229 | */ | ||
230 | void incrementalSearch( const QString& text ); | ||
231 | |||
232 | /** | ||
233 | Marks the address book as modified. | ||
234 | */ | ||
235 | void setModified(); | ||
236 | /** | ||
237 | Marks the address book as modified without refreshing the view. | ||
238 | */ | ||
239 | void setModifiedWOrefresh(); | ||
240 | |||
241 | /** | ||
242 | Marks the address book as modified concerning the argument. | ||
243 | */ | ||
244 | void setModified( bool modified ); | ||
245 | |||
246 | /** | ||
247 | Returns whether the address book is modified. | ||
248 | */ | ||
249 | bool modified() const; | ||
250 | |||
251 | /** | ||
252 | Called whenever an contact is modified in the contact editor | ||
253 | dialog or the quick edit. | ||
254 | */ | ||
255 | void contactModified( const KABC::Addressee &addr ); | ||
256 | |||
257 | /** | ||
258 | DCOP METHODS. | ||
259 | */ | ||
260 | void addEmail( QString addr ); | ||
261 | void importVCard( const KURL& url, bool showPreview ); | ||
262 | void importVCard( const QString& vCard, bool showPreview ); | ||
263 | void newContact(); | ||
264 | QString getNameByPhone( const QString& phone ); | ||
265 | /** | ||
266 | END DCOP METHODS | ||
267 | */ | ||
268 | |||
269 | /** | ||
270 | Saves the contents of the AddressBook back to disk. | ||
271 | */ | ||
272 | void save(); | ||
273 | |||
274 | /** | ||
275 | Undos the last command using the undo stack. | ||
276 | */ | ||
277 | void undo(); | ||
278 | |||
279 | /** | ||
280 | Redos the last command that was undone, using the redo stack. | ||
281 | */ | ||
282 | void redo(); | ||
283 | |||
284 | /** | ||
285 | Shows the edit dialog for the given uid. If the uid is QString::null, | ||
286 | the method will try to find a selected addressee in the view. | ||
287 | */ | ||
288 | void editContact( const QString &uid /*US = QString::null*/ ); | ||
289 | //US added a second method without defaultparameter | ||
290 | void editContact2(); | ||
291 | |||
292 | /** | ||
293 | Launches the configuration dialog. | ||
294 | */ | ||
295 | void openConfigDialog(); | ||
296 | |||
297 | /** | ||
298 | Launches the ldap search dialog. | ||
299 | */ | ||
300 | void openLDAPDialog(); | ||
301 | |||
302 | /** | ||
303 | Creates a KAddressBookPrinter, which will display the print | ||
304 | dialog and do the printing. | ||
305 | */ | ||
306 | void print(); | ||
307 | |||
308 | /** | ||
309 | Registers a new GUI client, so plugins can register its actions. | ||
310 | */ | ||
311 | void addGUIClient( KXMLGUIClient *client ); | ||
312 | |||
313 | signals: | ||
314 | void contactSelected( const QString &name ); | ||
315 | void contactSelected( const QPixmap &pixmap ); | ||
316 | public slots: | ||
317 | void setDetailsVisible( bool visible ); | ||
318 | void setDetailsToState(); | ||
319 | private slots: | ||
320 | void setJumpButtonBarVisible( bool visible ); | ||
321 | |||
322 | void extensionModified( const KABC::Addressee::List &list ); | ||
323 | void clipboardDataChanged(); | ||
324 | void updateActionMenu(); | ||
325 | void configureKeyBindings(); | ||
326 | #ifdef KAB_EMBEDDED | ||
327 | void configureResources(); | ||
328 | #endif //KAB_EMBEDDED | ||
329 | |||
330 | void slotEditorDestroyed( const QString &uid ); | ||
331 | void configurationChanged(); | ||
332 | void addressBookChanged(); | ||
333 | |||
334 | private: | ||
335 | void initGUI(); | ||
336 | void initActions(); | ||
337 | |||
338 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | ||
339 | const char *name = 0 ); | ||
340 | |||
341 | KXMLGUIClient *mGUIClient; | ||
342 | |||
343 | KABC::AddressBook *mAddressBook; | ||
344 | |||
345 | ViewManager *mViewManager; | ||
346 | // QSplitter *mDetailsSplitter; | ||
347 | //QSplitter *mExtensionBarSplitter; | ||
348 | ViewContainer *mDetails; | ||
349 | KDGanttMinimizeSplitter* mMiniSplitter; | ||
350 | XXPortManager *mXXPortManager; | ||
351 | JumpButtonBar *mJumpButtonBar; | ||
352 | IncSearchWidget *mIncSearchWidget; | ||
353 | ExtensionManager *mExtensionManager; | ||
354 | |||
355 | KCMultiDialog *mConfigureDialog; | ||
356 | |||
357 | #ifndef KAB_EMBEDDED | ||
358 | |||
359 | KCMultiDialog *mConfigureDialog; | ||
360 | LDAPSearchDialog *mLdapSearchDialog; | ||
361 | #endif //KAB_EMBEDDED | ||
362 | QDict<AddresseeEditorDialog> mEditorDict; | ||
363 | |||
364 | bool mReadWrite; | ||
365 | bool mModified; | ||
366 | bool mIsPart; | ||
367 | |||
368 | //US file menu | ||
369 | KAction *mActionMail; | ||
370 | KAction* mActionPrint; | ||
371 | KAction* mActionNewContact; | ||
372 | KAction *mActionSave; | ||
373 | KAction *mActionEditAddressee; | ||
374 | KAction *mActionMailVCard; | ||
375 | KAction *mActionQuit; | ||
376 | |||
377 | //US edit menu | ||
378 | KAction *mActionCopy; | ||
379 | KAction *mActionCut; | ||
380 | KAction *mActionPaste; | ||
381 | KAction *mActionSelectAll; | ||
382 | KAction *mActionUndo; | ||
383 | KAction *mActionRedo; | ||
384 | KAction *mActionDelete; | ||
385 | |||
386 | //US settings menu | ||
387 | KAction *mActionConfigResources; | ||
388 | KAction *mActionConfigKAddressbook; | ||
389 | KAction *mActionConfigShortcuts; | ||
390 | KAction *mActionConfigureToolbars; | ||
391 | KAction *mActionKeyBindings; | ||
392 | KToggleAction *mActionJumpBar; | ||
393 | KToggleAction *mActionDetails; | ||
394 | KAction *mActionWhoAmI; | ||
395 | KAction *mActionCategories; | ||
396 | KAction *mActionAboutKAddressbook; | ||
397 | |||
398 | KAction *mActionDeleteView; | ||
399 | |||
400 | QPopupMenu *viewMenu; | ||
401 | QPopupMenu *filterMenu; | ||
402 | QPopupMenu *settingsMenu; | ||
403 | |||
404 | //US QAction *mActionSave; | ||
405 | QPopupMenu *ImportMenu; | ||
406 | QPopupMenu *ExportMenu; | ||
407 | |||
408 | #ifndef KAB_EMBEDDED | ||
409 | KAddressBookService *mAddressBookService; | ||
410 | #endif //KAB_EMBEDDED | ||
411 | |||
412 | class KABCorePrivate; | ||
413 | KABCorePrivate *d; | ||
414 | |||
415 | #ifdef KAB_EMBEDDED | ||
416 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | ||
417 | #endif //KAB_EMBEDDED | ||
418 | |||
419 | }; | ||
420 | |||
421 | #endif | ||