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 KPushButton;
00054 class KStatusBar;
00055 class KToggleAction;
00056 class KXMLGUIClient;
00057 
00058 class QSplitter;
00059 class QHBoxLayout;
00060 class QWidgetStack;
00061 
00062 class AddresseeEditorDialog;
00063 class ExtensionManager;
00064 class FilterSelectionWidget;
00065 class IncSearchWidget;
00066 class JumpButtonBar;
00067 class KAddressBookIface;
00068 class KAddressBookService;
00069 class KIMProxy;
00070 class LDAPSearchDialog;
00071 class ViewManager;
00072 class XXPortManager;
00073 
00074 namespace KAB {
00075     class DistributionListEntryView;
00076 }
00077 
00078 typedef struct {
00079   KABC::Ticket *ticket;
00080   int counter;
00081 } ResourceMapEntry;
00082 
00083 class KDE_EXPORT KABCore : public KAB::Core
00084 {
00085   Q_OBJECT
00086 
00087   public:
00088     KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent,
00089              const QString &file = QString::null, const char *name = 0 );
00090     ~KABCore();
00091 
00095     void restoreSettings();
00096 
00100     void saveSettings();
00101 
00105     KABC::AddressBook *addressBook() const;
00106 
00110     KConfig *config() const;
00111 
00116     KActionCollection *actionCollection() const;
00117 
00121     KABC::Field *currentSortField() const;
00122 
00126     QStringList selectedUIDs() const;
00127 
00133     KABC::Resource *requestResource( QWidget *parent );
00134 
00138     QWidget *widget() const;
00139 
00140     static KAboutData *createAboutData();
00141 
00142     void setStatusBar( KStatusBar *statusBar );
00143 
00144     KStatusBar *statusBar() const;
00145 
00146     KAB::SearchManager *searchManager() const { return mSearchManager; }
00147 
00148     KCommandHistory *commandHistory() const { return mCommandHistory; }
00149 
00150 #ifdef KDEPIM_NEW_DISTRLISTS
00151 
00154     virtual KPIM::DistributionList::List distributionLists() const;
00155 
00159     virtual QStringList distributionListNames() const;
00160 
00165     virtual void setSelectedDistributionList( const QString &name );
00166 #endif
00167 
00168   public slots:
00172     void setContactSelected( const QString &uid );
00173 
00178     void sendMail();
00179 
00184     void sendMail( const QString& email );
00185 
00186 
00187     void mailVCard();
00188     void mailVCard(const QStringList& uids);
00189 
00193     void startChat();
00194 
00198     void browse( const QString& url );
00199 
00203     void selectAllContacts();
00204 
00208     void deleteContacts();
00209 
00215     void deleteContacts( const QStringList &uids );
00216 
00222     void deleteDistributionLists( const QStringList &names );
00223 
00224 
00228     void copyContacts();
00229 
00233     void cutContacts();
00234 
00238     void pasteContacts();
00239 
00245     void pasteContacts( KABC::Addressee::List &list );
00246 
00247 
00251     void mergeContacts();
00252 
00257     void setWhoAmI();
00258 
00263     void setCategories();
00264 
00269     void incrementalTextSearch( const QString& text );
00270 
00271     void incrementalJumpButtonSearch( const QString& characters );
00272 
00276     void setModified();
00277 
00281     void setModified( bool modified );
00282 
00286     bool modified() const;
00287 
00292     void contactModified( const KABC::Addressee &addr );
00293 
00297     virtual void addEmail( const QString& addr );
00298 
00302     virtual void importVCard( const KURL& url );
00303 
00307     virtual void importVCardFromData( const QString& vCard );
00308 
00312     virtual void newContact();
00313 
00317     virtual void newDistributionList();
00318 
00323     virtual QString getNameByPhone( const QString& phone );
00324 
00329     bool handleCommandLine( KAddressBookIface* iface );
00330 
00331 
00335     void save();
00336 
00341     void editContact( const QString &uid = QString::null );
00342 
00347     void storeContactIn( const QString &uid = QString::null, bool copy = false );
00348 
00353     void copySelectedContactToResource();
00354 
00359     void moveSelectedContactToResource();
00360 
00364     void openLDAPDialog();
00365 
00369     void configure();
00370 
00375     void print();
00376 
00377     void detailsHighlighted( const QString& );
00378 
00379     void showContactsAddress( const QString &uid );
00380 
00381     void configurationChanged();
00382 
00383     bool queryClose();
00384 
00388     void reinitXMLGUI();
00389 
00390   private:
00391 
00392 #ifdef KDEPIM_NEW_DISTRLISTS
00393     void editDistributionList( const KPIM::DistributionList &list );
00394     void showDistributionListEntry( const QString &uid );
00395 #endif
00396 
00397   private slots:
00398     void setJumpButtonBarVisible( bool visible );
00399     void setDetailsVisible( bool visible );
00400 
00401     void extensionModified( const KABC::Addressee::List &list );
00402     void extensionDeleted( const QStringList &uidList );
00403     void clipboardDataChanged();
00404     void updateIncSearchWidget();
00405 
00406     void slotEditorDestroyed( const QString &uid );
00407     void delayedAddressBookChanged();
00408     void addressBookChanged();
00409 
00410     void categoriesSelected( const QStringList& );
00411     void editCategories();
00412     void slotClearSearchBar();
00413     void slotContactsUpdated();
00414 
00415     void activateDetailsWidget( QWidget *widget );
00416     void deactivateDetailsWidget( QWidget *widget );
00417 
00418     void editDistributionList( const QString &name );
00419 
00420     void removeSelectedContactsFromDistList();
00421     void editSelectedDistributionList();
00422     void sendMailToDistributionList( const QString &id );
00423 
00424   private:
00425     void initGUI();
00426     void createJumpButtonBar();
00427     void initActions();
00428 
00429     void updateCategories();
00430     QStringList allCategories() const;
00431 
00432     AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
00433                                                         const char *name = 0 );
00434 
00435     QWidget *mWidget;
00436     KABC::AddressBook *mAddressBook;
00437     KStatusBar *mStatusBar;
00438 
00439     ViewManager *mViewManager;
00440     QLabel *mViewHeaderLabel;
00441 
00442 #ifdef KDEPIM_NEW_DISTRLISTS
00443     QString mSelectedDistributionList;
00444     KPushButton *mAddDistListButton;
00445     KPushButton *mRemoveDistListButton;
00446     QWidget *mDistListButtonWidget;
00447 #endif
00448 
00449     ExtensionManager *mExtensionManager;
00450     XXPortManager *mXXPortManager;
00451 
00452     JumpButtonBar *mJumpButtonBar;
00453     FilterSelectionWidget *mFilterSelectionWidget;
00454     IncSearchWidget *mIncSearchWidget;
00455     KAB::DistributionListEntryView* mDistListEntryView;
00456     KPIM::AddresseeView *mDetailsViewer;
00457     KPIM::CategorySelectDialog *mCategorySelectDialog;
00458     KPIM::CategoryEditDialog *mCategoryEditDialog;
00459     QWidget *mDetailsPage;
00460     QWidget *mDetailsWidget;
00461     QHBoxLayout *mDetailsLayout;
00462     QSplitter *mDetailsSplitter;
00463     QSplitter *mLeftSplitter;
00464     QWidgetStack *mDetailsStack;
00465     LDAPSearchDialog *mLdapSearchDialog;
00466     QDict<AddresseeEditorDialog> mEditorDict;
00467 
00468     bool mReadWrite;
00469     bool mModified;
00470     bool mIsPart;
00471 
00472     QTimer *mAddressBookChangedTimer;
00473 
00474     KAction *mActionPaste;
00475     KAction *mActionCut;
00476     KAction *mActionDelete;
00477     KAction *mActionCopy;
00478     KAction *mActionEditAddressee;
00479     KAction *mActionMoveAddresseeTo;
00480     KAction *mActionCopyAddresseeTo;
00481     KAction *mActionMerge;
00482     KAction *mActionMail;
00483     KAction *mActionMailVCard;
00484     KAction *mActionChat;
00485     KAction *mActionSave;
00486     KAction *mActionDeleteView;
00487     KAction *mActionWhoAmI;
00488     KAction *mActionCategories;
00489     KToggleAction *mActionJumpBar;
00490     KToggleAction *mActionDetails;
00491     KCommandHistory *mCommandHistory;
00492 
00493     KAddressBookService *mAddressBookService;
00494 
00495     KAB::SearchManager *mSearchManager;
00496     // KIMProxy provides access to up to date instant messaging presence data
00497     ::KIMProxy *mKIMProxy;
00498     class KABCorePrivate;
00499     KABCorePrivate *d;
00500 };
00501 
00502 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys