kaddressbook

kabcore.h
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of TQt, and distribute the resulting executable,
21 without including the source code for TQt in the source distribution.
22*/
23
24#ifndef KABCORE_H
25#define KABCORE_H
26
27#include <config.h> // FOR TDEPIM_NEW_DISTRLISTS
28
29#include <tdeabc/field.h>
30
31#include <tqdict.h>
32#include <tqlabel.h>
33#include <tqwidget.h>
34
35#include "core.h"
36#include <tdemacros.h>
37
38namespace TDEABC {
39class AddressBook;
40class Ticket;
41}
42
43namespace KPIM {
44class AddresseeView;
45class CategoryEditDialog;
46class CategorySelectDialog;
47}
48
49class TDEAboutData;
50class TDEAction;
51class TDEActionCollection;
52class TDEConfig;
53class KPushButton;
54class KStatusBar;
55class TDEToggleAction;
56class KXMLGUIClient;
57
58class TQSplitter;
59class TQHBoxLayout;
60class TQWidgetStack;
61
62class AddresseeEditorDialog;
63class ExtensionManager;
65class IncSearchWidget;
66class JumpButtonBar;
67class KAddressBookIface;
68class KAddressBookService;
69class KIMProxy;
70class LDAPSearchDialog;
71class ViewManager;
72class XXPortManager;
73
74namespace KAB {
75 class DistributionListEntryView;
76}
77
78typedef struct {
79 TDEABC::Ticket *ticket;
80 int counter;
81} ResourceMapEntry;
82
83class TDE_EXPORT KABCore : public KAB::Core
84{
85 TQ_OBJECT
86
87
88 public:
89 KABCore( KXMLGUIClient *client, bool readWrite, TQWidget *parent,
90 const TQString &file = TQString(), const char *name = 0 );
91 ~KABCore();
92
96 void restoreSettings();
97
101 void saveSettings();
102
106 TDEABC::AddressBook *addressBook() const;
107
111 TDEConfig *config() const;
112
117 TDEActionCollection *actionCollection() const;
118
122 TDEABC::Field *currentSortField() const;
123
127 TQStringList selectedUIDs() const;
128
134 TDEABC::Resource *requestResource( TQWidget *parent );
135
139 TQWidget *widget() const;
140
141 static TDEAboutData *createAboutData();
142
143 void setStatusBar( KStatusBar *statusBar );
144
145 KStatusBar *statusBar() const;
146
147 KAB::SearchManager *searchManager() const { return mSearchManager; }
148
149 KCommandHistory *commandHistory() const { return mCommandHistory; }
150
151#ifdef TDEPIM_NEW_DISTRLISTS
155 virtual KPIM::DistributionList::List distributionLists() const;
156
160 virtual TQStringList distributionListNames() const;
161
166 virtual void setSelectedDistributionList( const TQString &name );
167#endif
168
169 public slots:
173 void setContactSelected( const TQString &uid );
174
179 void sendMail();
180
185 void sendMail( const TQString& email );
186
187
188 void mailVCard();
189 void mailVCard(const TQStringList& uids);
190
194 void startChat();
195
199 void browse( const TQString& url );
200
204 void selectAllContacts();
205
209 void deleteContacts();
210
216 void deleteContacts( const TQStringList &uids );
217
223 void deleteDistributionLists( const TQStringList &names );
224
225
229 void copyContacts();
230
234 void cutContacts();
235
239 void pasteContacts();
240
246 void pasteContacts( TDEABC::Addressee::List &list );
247
248
252 void mergeContacts();
253
258 void setWhoAmI();
259
264 void setCategories();
265
270 void incrementalTextSearch( const TQString& text );
271
272 void incrementalJumpButtonSearch( const TQString& characters );
273
277 void setModified();
278
282 void setModified( bool modified );
283
287 bool modified() const;
288
293 void contactModified( const TDEABC::Addressee &addr );
294
298 virtual void addEmail( const TQString& addr );
299
303 virtual void importVCard( const KURL& url );
304
308 virtual void importVCardFromData( const TQString& vCard );
309
313 virtual void newContact();
314
318 virtual void newDistributionList();
319
324 virtual TQString getNameByPhone( const TQString& phone );
325
330 bool handleCommandLine( KAddressBookIface* iface );
331
332
336 void save();
337
341 void load();
342
347 void editContact( const TQString &uid = TQString() );
348
353 void storeContactIn( const TQString &uid = TQString(), bool copy = false );
354
359 void copySelectedContactToResource();
360
365 void moveSelectedContactToResource();
366
370 void openLDAPDialog();
371
375 void configure();
376
381 void print();
382
383 void detailsHighlighted( const TQString& );
384
385 void showContactsAddress( const TQString &uid );
386
387 void configurationChanged();
388
389 bool queryClose();
390
394 void reinitXMLGUI();
395
396 private:
397
398#ifdef TDEPIM_NEW_DISTRLISTS
399 void editDistributionList( const KPIM::DistributionList &list );
400 void showDistributionListEntry( const TQString &uid );
401#endif
402
403 private slots:
404 void setJumpButtonBarVisible( bool visible );
405 void setDetailsVisible( bool visible );
406
407 void extensionModified( const TDEABC::Addressee::List &list );
408 void extensionDeleted( const TQStringList &uidList );
409 void clipboardDataChanged();
410 void updateIncSearchWidget();
411
412 void slotEditorDestroyed( const TQString &uid );
413 void delayedAddressBookChanged();
414 void addressBookChanged();
415
416 void categoriesSelected( const TQStringList& );
417 void editCategories();
418 void slotClearSearchBar();
419 void slotContactsUpdated();
420
421 void activateDetailsWidget( TQWidget *widget );
422 void deactivateDetailsWidget( TQWidget *widget );
423
424 void editDistributionList( const TQString &name );
425
426 void removeSelectedContactsFromDistList();
427 void editSelectedDistributionList();
428 void sendMailToDistributionList( const TQString &id );
429
430 private:
431 void initGUI();
432 void createJumpButtonBar();
433 void initActions();
434
435 void updateCategories();
436 TQStringList allCategories() const;
437
438 AddresseeEditorDialog *createAddresseeEditorDialog( TQWidget *parent,
439 const char *name = 0 );
440
441 TQWidget *mWidget;
442 TDEABC::AddressBook *mAddressBook;
443 KStatusBar *mStatusBar;
444
445 ViewManager *mViewManager;
446 TQLabel *mViewHeaderLabel;
447
448#ifdef TDEPIM_NEW_DISTRLISTS
449 TQString mSelectedDistributionList;
450 KPushButton *mAddDistListButton;
451 KPushButton *mRemoveDistListButton;
452 TQWidget *mDistListButtonWidget;
453#endif
454
455 ExtensionManager *mExtensionManager;
456 XXPortManager *mXXPortManager;
457
458 JumpButtonBar *mJumpButtonBar;
459 FilterSelectionWidget *mFilterSelectionWidget;
460 IncSearchWidget *mIncSearchWidget;
461 KAB::DistributionListEntryView* mDistListEntryView;
462 KPIM::AddresseeView *mDetailsViewer;
463 KPIM::CategorySelectDialog *mCategorySelectDialog;
464 KPIM::CategoryEditDialog *mCategoryEditDialog;
465 TQWidget *mDetailsPage;
466 TQWidget *mDetailsWidget;
467 TQHBoxLayout *mDetailsLayout;
468 TQSplitter *mDetailsSplitter;
469 TQSplitter *mLeftSplitter;
470 TQWidgetStack *mDetailsStack;
471 LDAPSearchDialog *mLdapSearchDialog;
472 TQDict<AddresseeEditorDialog> mEditorDict;
473
474 bool mReadWrite;
475 bool mModified;
476 bool mIsPart;
477
478 TQTimer *mAddressBookChangedTimer;
479
480 TDEAction *mActionPaste;
481 TDEAction *mActionCut;
482 TDEAction *mActionDelete;
483 TDEAction *mActionCopy;
484 TDEAction *mActionEditAddressee;
485 TDEAction *mActionMoveAddresseeTo;
486 TDEAction *mActionCopyAddresseeTo;
487 TDEAction *mActionMerge;
488 TDEAction *mActionMail;
489 TDEAction *mActionMailVCard;
490 TDEAction *mActionChat;
491 TDEAction *mActionSave;
492 TDEAction *mActionDeleteView;
493 TDEAction *mActionWhoAmI;
494 TDEAction *mActionCategories;
495 TDEToggleAction *mActionJumpBar;
496 TDEToggleAction *mActionDetails;
497 KCommandHistory *mCommandHistory;
498
499 KAddressBookService *mAddressBookService;
500
501 KAB::SearchManager *mSearchManager;
502 // KIMProxy provides access to up to date instant messaging presence data
503 ::KIMProxy *mKIMProxy;
504 class KABCorePrivate;
505 KABCorePrivate *d;
506};
507
508#endif
A simple widget which consists of a label and a combo box in a horizontal line.
Used to draw the jump button bar on the right of the view.
Definition: jumpbuttonbar.h:48
The view manager manages the views and everything related to them.
Definition: viewmanager.h:51