kaddressbook

kabcore.h

00001 /*
00002     This file is part of KAddressbook.
00003     Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018 
00019     As a special exception, permission is given to link this program
00020     with any edition of Qt, and distribute the resulting executable,
00021     without including the source code for Qt in the source distribution.
00022 */
00023 
00024 #ifndef KABCORE_H
00025 #define KABCORE_H
00026 
00027 #include <config.h> // FOR KDEPIM_NEW_DISTRLISTS
00028 
00029 #include <kabc/field.h>
00030 
00031 #include <qdict.h>
00032 #include <qlabel.h>
00033 #include <qwidget.h>
00034 
00035 #include "core.h"
00036 #include <kdepimmacros.h>
00037 
00038 namespace KABC {
00039 class AddressBook;
00040 class Ticket;
00041 }
00042 
00043 namespace KPIM {
00044 class AddresseeView;
00045 class CategoryEditDialog;
00046 class CategorySelectDialog;
00047 }
00048 
00049 class KAboutData;
00050 class KAction;
00051 class KActionCollection;
00052 class KConfig;
00053 class KStatusBar;
00054 class KToggleAction;
00055 class KXMLGUIClient;
00056 
00057 class QSplitter;
00058 class QHBoxLayout;
00059 class QWidgetStack;
00060 
00061 class AddresseeEditorDialog;
00062 class ExtensionManager;
00063 class FilterSelectionWidget;
00064 class IncSearchWidget;
00065 class JumpButtonBar;
00066 class KAddressBookIface;
00067 class KAddressBookService;
00068 class KIMProxy;
00069 class LDAPSearchDialog;
00070 class ViewManager;
00071 class XXPortManager;
00072 
00073 namespace KAB {
00074     class DistributionListEntryView;
00075 }
00076 
00077 typedef struct {
00078   KABC::Ticket *ticket;
00079   int counter;
00080 } ResourceMapEntry;
00081 
00082 class KDE_EXPORT KABCore : public KAB::Core
00083 {
00084   Q_OBJECT
00085 
00086   public:
00087     KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent,
00088              const QString &file = QString::null, const char *name = 0 );
00089     ~KABCore();
00090 
00094     void restoreSettings();
00095 
00099     void saveSettings();
00100 
00104     KABC::AddressBook *addressBook() const;
00105 
00109     KConfig *config() const;
00110 
00115     KActionCollection *actionCollection() const;
00116 
00120     KABC::Field *currentSortField() const;
00121 
00125     QStringList selectedUIDs() const;
00126 
00132     KABC::Resource *requestResource( QWidget *parent );
00133 
00137     QWidget *widget() const;
00138 
00139     static KAboutData *createAboutData();
00140 
00141     void setStatusBar( KStatusBar *statusBar );
00142 
00143     KStatusBar *statusBar() const;
00144 
00145     KAB::SearchManager *searchManager() const { return mSearchManager; }
00146 
00147     KCommandHistory *commandHistory() const { return mCommandHistory; }
00148 
00149 #ifdef KDEPIM_NEW_DISTRLISTS
00150 
00153     virtual KPIM::DistributionList::List distributionLists() const;
00154 
00158     virtual QStringList distributionListNames() const;
00159 
00164     virtual void setSelectedDistributionList( const QString &name );
00165 #endif
00166 
00167   public slots:
00171     void setContactSelected( const QString &uid );
00172 
00177     void sendMail();
00178 
00183     void sendMail( const QString& email );
00184 
00185 
00186     void mailVCard();
00187     void mailVCard(const QStringList& uids);
00188 
00192     void startChat();
00193 
00197     void browse( const QString& url );
00198 
00202     void selectAllContacts();
00203 
00207     void deleteContacts();
00208 
00214     void deleteContacts( const QStringList &uids );
00215 
00221     void deleteDistributionLists( const QStringList &names );
00222 
00223 
00227     void copyContacts();
00228 
00232     void cutContacts();
00233 
00237     void pasteContacts();
00238 
00244     void pasteContacts( KABC::Addressee::List &list );
00245 
00246 
00250     void mergeContacts();
00251 
00256     void setWhoAmI();
00257 
00262     void setCategories();
00263 
00268     void incrementalTextSearch( const QString& text );
00269 
00270     void incrementalJumpButtonSearch( const QString& characters );
00271 
00275     void setModified();
00276 
00280     void setModified( bool modified );
00281 
00285     bool modified() const;
00286 
00291     void contactModified( const KABC::Addressee &addr );
00292 
00296     virtual void addEmail( const QString& addr );
00297 
00301     virtual void importVCard( const KURL& url );
00302 
00306     virtual void importVCardFromData( const QString& vCard );
00307 
00311     virtual void newContact();
00312 
00316     virtual void newDistributionList();
00317 
00322     virtual QString getNameByPhone( const QString& phone );
00323 
00328     bool handleCommandLine( KAddressBookIface* iface );
00329 
00330 
00334     void save();
00335 
00340     void editContact( const QString &uid = QString::null );
00341 
00346     void storeContactIn( const QString &uid = QString::null, bool copy = false );
00347     
00352     void copySelectedContactToResource();
00353 
00358     void moveSelectedContactToResource();
00359 
00363     void openLDAPDialog();
00364 
00368     void configure();
00369 
00374     void print();
00375 
00376     void detailsHighlighted( const QString& );
00377 
00378     void showContactsAddress( const QString &uid );
00379 
00380     void configurationChanged();
00381 
00382     bool queryClose();
00383 
00387     void reinitXMLGUI();
00388 
00389   private:
00390 
00391 #ifdef KDEPIM_NEW_DISTRLISTS
00392     void editDistributionList( const KPIM::DistributionList &list );
00393     void showDistributionListEntry( const QString &uid );
00394 #endif
00395 
00396   private slots:
00397     void setJumpButtonBarVisible( bool visible );
00398     void setDetailsVisible( bool visible );
00399 
00400     void extensionModified( const KABC::Addressee::List &list );
00401     void extensionDeleted( const QStringList &uidList );
00402     void clipboardDataChanged();
00403     void updateIncSearchWidget();
00404 
00405     void slotEditorDestroyed( const QString &uid );
00406     void delayedAddressBookChanged();
00407     void addressBookChanged();
00408 
00409     void categoriesSelected( const QStringList& );
00410     void editCategories();
00411     void slotClearSearchBar();
00412     void slotContactsUpdated();
00413 
00414     void activateDetailsWidget( QWidget *widget );
00415     void deactivateDetailsWidget( QWidget *widget );
00416 
00417     void editDistributionList( const QString &name );
00418 
00419     void removeSelectedContactsFromDistList();
00420     void editSelectedDistributionList();
00421     void sendMailToDistributionList( const QString &id ); 
00422 
00423   private:
00424     void initGUI();
00425     void createJumpButtonBar();
00426     void initActions();
00427 
00428     void updateCategories();
00429     QStringList allCategories() const;
00430 
00431     AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
00432                                                         const char *name = 0 );
00433 
00434     QWidget *mWidget;
00435     KABC::AddressBook *mAddressBook;
00436     KStatusBar *mStatusBar;
00437 
00438     ViewManager *mViewManager;
00439     QLabel *mViewHeaderLabel;
00440 
00441 #ifdef KDEPIM_NEW_DISTRLISTS
00442     QString mSelectedDistributionList;
00443     QWidget *mDistListButtonWidget;
00444 #endif
00445 
00446     ExtensionManager *mExtensionManager;
00447     XXPortManager *mXXPortManager;
00448 
00449     JumpButtonBar *mJumpButtonBar;
00450     FilterSelectionWidget *mFilterSelectionWidget;
00451     IncSearchWidget *mIncSearchWidget;
00452     KAB::DistributionListEntryView* mDistListEntryView;
00453     KPIM::AddresseeView *mDetailsViewer;
00454     KPIM::CategorySelectDialog *mCategorySelectDialog;
00455     KPIM::CategoryEditDialog *mCategoryEditDialog;
00456     QWidget *mDetailsPage;
00457     QWidget *mDetailsWidget;
00458     QHBoxLayout *mDetailsLayout;
00459     QSplitter *mDetailsSplitter;
00460     QSplitter *mLeftSplitter;
00461     QWidgetStack *mDetailsStack;
00462     LDAPSearchDialog *mLdapSearchDialog;
00463     QDict<AddresseeEditorDialog> mEditorDict;
00464 
00465     bool mReadWrite;
00466     bool mModified;
00467     bool mIsPart;
00468 
00469     QTimer *mAddressBookChangedTimer;
00470 
00471     KAction *mActionPaste;
00472     KAction *mActionCut;
00473     KAction *mActionDelete;
00474     KAction *mActionCopy;
00475     KAction *mActionEditAddressee;
00476     KAction *mActionMoveAddresseeTo;
00477     KAction *mActionCopyAddresseeTo;
00478     KAction *mActionMerge;
00479     KAction *mActionMail;
00480     KAction *mActionMailVCard;
00481     KAction *mActionChat;
00482     KAction *mActionSave;
00483     KAction *mActionDeleteView;
00484     KAction *mActionWhoAmI;
00485     KAction *mActionCategories;
00486     KToggleAction *mActionJumpBar;
00487     KToggleAction *mActionDetails;
00488     KCommandHistory *mCommandHistory;
00489 
00490     KAddressBookService *mAddressBookService;
00491 
00492     KAB::SearchManager *mSearchManager;
00493     // KIMProxy provides access to up to date instant messaging presence data
00494     ::KIMProxy *mKIMProxy;
00495     class KABCorePrivate;
00496     KABCorePrivate *d;
00497 };
00498 
00499 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys