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 <kabc/field.h>
00028 
00029 #include <qdict.h>
00030 #include <qwidget.h>
00031 
00032 #include "core.h"
00033 #include <kdepimmacros.h>
00034 
00035 namespace KABC {
00036 class AddressBook;
00037 class Ticket;
00038 }
00039 
00040 namespace KPIM {
00041 class AddresseeView;
00042 class CategoryEditDialog;
00043 class CategorySelectDialog;
00044 }
00045 
00046 class KAboutData;
00047 class KAction;
00048 class KActionCollection;
00049 class KConfig;
00050 class KStatusBar;
00051 class KToggleAction;
00052 class KXMLGUIClient;
00053 
00054 class QSplitter;
00055 class QHBoxLayout;
00056 
00057 class AddresseeEditorDialog;
00058 class ExtensionManager;
00059 class FilterSelectionWidget;
00060 class IncSearchWidget;
00061 class JumpButtonBar;
00062 class KAddressBookIface;
00063 class KAddressBookService;
00064 class KIMProxy;
00065 class LDAPSearchDialog;
00066 class ViewManager;
00067 class XXPortManager;
00068 
00069 typedef struct {
00070   KABC::Ticket *ticket;
00071   int counter;
00072 } ResourceMapEntry;
00073 
00074 class KDE_EXPORT KABCore : public KAB::Core
00075 {
00076   Q_OBJECT
00077 
00078   public:
00079     KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent,
00080              const QString &file = QString::null, const char *name = 0 );
00081     ~KABCore();
00082 
00086     void restoreSettings();
00087 
00091     void saveSettings();
00092 
00096     KABC::AddressBook *addressBook() const;
00097 
00101     KConfig *config() const;
00102 
00107     KActionCollection *actionCollection() const;
00108 
00112     KABC::Field *currentSortField() const;
00113 
00117     QStringList selectedUIDs() const;
00118 
00124     KABC::Resource *requestResource( QWidget *parent );
00125 
00129     QWidget *widget() const;
00130 
00131     static KAboutData *createAboutData();
00132 
00133     void setStatusBar( KStatusBar *statusBar );
00134 
00135     KStatusBar *statusBar() const;
00136 
00137     KAB::SearchManager *searchManager() const { return mSearchManager; }
00138 
00139     KCommandHistory *commandHistory() const { return mCommandHistory; }
00140 
00141 #ifdef KDEPIM_NEW_DISTRLISTS
00142 
00145     virtual KPIM::DistributionList::List distributionLists() const;
00146 
00150     virtual QStringList distributionListNames() const;
00151 #endif
00152 
00153   public slots:
00157     void setContactSelected( const QString &uid );
00158 
00163     void sendMail();
00164 
00169     void sendMail( const QString& email );
00170 
00171 
00172     void mailVCard();
00173     void mailVCard(const QStringList& uids);
00174 
00178     void startChat();
00179 
00183     void browse( const QString& url );
00184 
00188     void selectAllContacts();
00189 
00193     void deleteContacts();
00194 
00200     void deleteContacts( const QStringList &uids );
00201 
00205     void copyContacts();
00206 
00210     void cutContacts();
00211 
00215     void pasteContacts();
00216 
00222     void pasteContacts( KABC::Addressee::List &list );
00223 
00224 
00228     void mergeContacts();
00229 
00234     void setWhoAmI();
00235 
00240     void setCategories();
00241 
00246     void incrementalTextSearch( const QString& text );
00247 
00248     void incrementalJumpButtonSearch( const QString& characters );
00249 
00253     void setModified();
00254 
00258     void setModified( bool modified );
00259 
00263     bool modified() const;
00264 
00269     void contactModified( const KABC::Addressee &addr );
00270 
00274     virtual void addEmail( const QString& addr );
00275 
00279     virtual void importVCard( const KURL& url );
00280 
00284     virtual void importVCard( const QString& vCardURL );
00285 
00289     virtual void newContact();
00290 
00295     virtual QString getNameByPhone( const QString& phone );
00296 
00301     bool handleCommandLine( KAddressBookIface* iface );
00302 
00303 
00307     void save();
00308 
00313     void editContact( const QString &uid = QString::null );
00314 
00319     void storeContactIn( const QString &uid = QString::null );
00320 
00324     void openLDAPDialog();
00325 
00329     void configure();
00330 
00335     void print();
00336 
00337     void detailsHighlighted( const QString& );
00338 
00339     void showContactsAddress( const QString &uid );
00340 
00341     void configurationChanged();
00342 
00343     bool queryClose();
00344 
00348     void reinitXMLGUI();
00349 
00350   private slots:
00351     void setJumpButtonBarVisible( bool visible );
00352     void setDetailsVisible( bool visible );
00353 
00354     void extensionModified( const KABC::Addressee::List &list );
00355     void extensionDeleted( const QStringList &uidList );
00356     void clipboardDataChanged();
00357     void updateIncSearchWidget();
00358 
00359     void slotEditorDestroyed( const QString &uid );
00360     void delayedAddressBookChanged();
00361     void addressBookChanged();
00362 
00363     void categoriesSelected( const QStringList& );
00364     void editCategories();
00365     void slotClearSearchBar();
00366     void slotContactsUpdated();
00367 
00368   private:
00369     void initGUI();
00370     void createJumpButtonBar();
00371     void initActions();
00372 
00373     void updateCategories();
00374     QStringList allCategories() const;
00375 
00376     AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
00377                                                         const char *name = 0 );
00378 
00379     QWidget *mWidget;
00380     KABC::AddressBook *mAddressBook;
00381     KStatusBar *mStatusBar;
00382 
00383     ViewManager *mViewManager;
00384     ExtensionManager *mExtensionManager;
00385     XXPortManager *mXXPortManager;
00386 
00387     JumpButtonBar *mJumpButtonBar;
00388     FilterSelectionWidget *mFilterSelectionWidget;
00389     IncSearchWidget *mIncSearchWidget;
00390     KPIM::AddresseeView *mDetails;
00391     KPIM::CategorySelectDialog *mCategorySelectDialog;
00392     KPIM::CategoryEditDialog *mCategoryEditDialog;
00393     QWidget *mDetailsPage;
00394     QWidget *mDetailsWidget;
00395     QHBoxLayout *mDetailsLayout;
00396     QSplitter *mDetailsSplitter;
00397     QSplitter *mExtensionBarSplitter;
00398 
00399     LDAPSearchDialog *mLdapSearchDialog;
00400     QDict<AddresseeEditorDialog> mEditorDict;
00401 
00402     bool mReadWrite;
00403     bool mModified;
00404     bool mIsPart;
00405 
00406     QTimer *mAddressBookChangedTimer;
00407 
00408     KAction *mActionPaste;
00409     KAction *mActionCut;
00410     KAction *mActionDelete;
00411     KAction *mActionCopy;
00412     KAction *mActionEditAddressee;
00413     KAction *mActionStoreAddresseeIn;
00414     KAction *mActionMerge;
00415     KAction *mActionMail;
00416     KAction *mActionMailVCard;
00417     KAction *mActionChat;
00418     KAction *mActionSave;
00419     KAction *mActionDeleteView;
00420     KAction *mActionWhoAmI;
00421     KAction *mActionCategories;
00422     KToggleAction *mActionJumpBar;
00423     KToggleAction *mActionDetails;
00424 
00425     KCommandHistory *mCommandHistory;
00426 
00427     KAddressBookService *mAddressBookService;
00428 
00429     KAB::SearchManager *mSearchManager;
00430     // KIMProxy provides access to up to date instant messaging presence data
00431     ::KIMProxy *mKIMProxy;
00432 
00433     class KABCorePrivate;
00434     KABCorePrivate *d;
00435 };
00436 
00437 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys