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 <qlabel.h>
00031 #include <qwidget.h>
00032 
00033 #include "core.h"
00034 #include <kdepimmacros.h>
00035 
00036 namespace KABC {
00037 class AddressBook;
00038 class Ticket;
00039 }
00040 
00041 namespace KPIM {
00042 class AddresseeView;
00043 class CategoryEditDialog;
00044 class CategorySelectDialog;
00045 }
00046 
00047 class KAboutData;
00048 class KAction;
00049 class KActionCollection;
00050 class KConfig;
00051 class KStatusBar;
00052 class KToggleAction;
00053 class KXMLGUIClient;
00054 
00055 class QSplitter;
00056 class QHBoxLayout;
00057 class QWidgetStack;
00058 
00059 class AddresseeEditorDialog;
00060 class ExtensionManager;
00061 class FilterSelectionWidget;
00062 class IncSearchWidget;
00063 class JumpButtonBar;
00064 class KAddressBookIface;
00065 class KAddressBookService;
00066 class KIMProxy;
00067 class LDAPSearchDialog;
00068 class ViewManager;
00069 class XXPortManager;
00070 
00071 namespace KAB {
00072     class DistributionListEntryView;
00073 }
00074 
00075 typedef struct {
00076   KABC::Ticket *ticket;
00077   int counter;
00078 } ResourceMapEntry;
00079 
00080 class KDE_EXPORT KABCore : public KAB::Core
00081 {
00082   Q_OBJECT
00083 
00084   public:
00085     KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent,
00086              const QString &file = QString::null, const char *name = 0 );
00087     ~KABCore();
00088 
00092     void restoreSettings();
00093 
00097     void saveSettings();
00098 
00102     KABC::AddressBook *addressBook() const;
00103 
00107     KConfig *config() const;
00108 
00113     KActionCollection *actionCollection() const;
00114 
00118     KABC::Field *currentSortField() const;
00119 
00123     QStringList selectedUIDs() const;
00124 
00130     KABC::Resource *requestResource( QWidget *parent );
00131 
00135     QWidget *widget() const;
00136 
00137     static KAboutData *createAboutData();
00138 
00139     void setStatusBar( KStatusBar *statusBar );
00140 
00141     KStatusBar *statusBar() const;
00142 
00143     KAB::SearchManager *searchManager() const { return mSearchManager; }
00144 
00145     KCommandHistory *commandHistory() const { return mCommandHistory; }
00146 
00147 #ifdef KDEPIM_NEW_DISTRLISTS
00148 
00151     virtual KPIM::DistributionList::List distributionLists() const;
00152 
00156     virtual QStringList distributionListNames() const;
00157 
00162     virtual void setSelectedDistributionList( const QString &name );
00163 #endif
00164 
00165   public slots:
00169     void setContactSelected( const QString &uid );
00170 
00175     void sendMail();
00176 
00181     void sendMail( const QString& email );
00182 
00183 
00184     void mailVCard();
00185     void mailVCard(const QStringList& uids);
00186 
00190     void startChat();
00191 
00195     void browse( const QString& url );
00196 
00200     void selectAllContacts();
00201 
00205     void deleteContacts();
00206 
00212     void deleteContacts( const QStringList &uids );
00213 
00219     void deleteDistributionLists( const QStringList &names );
00220 
00221 
00225     void copyContacts();
00226 
00230     void cutContacts();
00231 
00235     void pasteContacts();
00236 
00242     void pasteContacts( KABC::Addressee::List &list );
00243 
00244 
00248     void mergeContacts();
00249 
00254     void setWhoAmI();
00255 
00260     void setCategories();
00261 
00266     void incrementalTextSearch( const QString& text );
00267 
00268     void incrementalJumpButtonSearch( const QString& characters );
00269 
00273     void setModified();
00274 
00278     void setModified( bool modified );
00279 
00283     bool modified() const;
00284 
00289     void contactModified( const KABC::Addressee &addr );
00290 
00294     virtual void addEmail( const QString& addr );
00295 
00299     virtual void importVCard( const KURL& url );
00300 
00304     virtual void importVCardFromData( const QString& vCard );
00305 
00309     virtual void newContact();
00310 
00314     virtual void newDistributionList();
00315 
00320     virtual QString getNameByPhone( const QString& phone );
00321 
00326     bool handleCommandLine( KAddressBookIface* iface );
00327 
00328 
00332     void save();
00333 
00338     void editContact( const QString &uid = QString::null );
00339 
00344     void storeContactIn( const QString &uid = QString::null, bool copy = false );
00345     
00350     void copySelectedContactToResource();
00351 
00356     void moveSelectedContactToResource();
00357 
00361     void openLDAPDialog();
00362 
00366     void configure();
00367 
00372     void print();
00373 
00374     void detailsHighlighted( const QString& );
00375 
00376     void showContactsAddress( const QString &uid );
00377 
00378     void configurationChanged();
00379 
00380     bool queryClose();
00381 
00385     void reinitXMLGUI();
00386 
00387   private:
00388 
00389 #ifdef KDEPIM_NEW_DISTRLISTS
00390     void editDistributionList( const KPIM::DistributionList &list );
00391     void showDistributionListEntry( const QString &uid );
00392 #endif
00393 
00394   private slots:
00395     void setJumpButtonBarVisible( bool visible );
00396     void setDetailsVisible( bool visible );
00397 
00398     void extensionModified( const KABC::Addressee::List &list );
00399     void extensionDeleted( const QStringList &uidList );
00400     void clipboardDataChanged();
00401     void updateIncSearchWidget();
00402 
00403     void slotEditorDestroyed( const QString &uid );
00404     void delayedAddressBookChanged();
00405     void addressBookChanged();
00406 
00407     void categoriesSelected( const QStringList& );
00408     void editCategories();
00409     void slotClearSearchBar();
00410     void slotContactsUpdated();
00411 
00412     void activateDetailsWidget( QWidget *widget );
00413     void deactivateDetailsWidget( QWidget *widget );
00414 
00415     void editDistributionList( const QString &name );
00416 
00417     void removeSelectedContactsFromDistList();
00418     void editSelectedDistributionList();
00419     void sendMailToDistributionList( const QString &id ); 
00420 
00421   private:
00422     void initGUI();
00423     void createJumpButtonBar();
00424     void initActions();
00425 
00426     void updateCategories();
00427     QStringList allCategories() const;
00428 
00429     AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
00430                                                         const char *name = 0 );
00431 
00432     QWidget *mWidget;
00433     KABC::AddressBook *mAddressBook;
00434     KStatusBar *mStatusBar;
00435 
00436     ViewManager *mViewManager;
00437     QLabel *mViewHeaderLabel;
00438 
00439 #ifdef KDEPIM_NEW_DISTRLISTS
00440     QString mSelectedDistributionList;
00441     QWidget *mDistListButtonWidget;
00442 #endif
00443 
00444     ExtensionManager *mExtensionManager;
00445     XXPortManager *mXXPortManager;
00446 
00447     JumpButtonBar *mJumpButtonBar;
00448     FilterSelectionWidget *mFilterSelectionWidget;
00449     IncSearchWidget *mIncSearchWidget;
00450     KAB::DistributionListEntryView* mDistListEntryView;
00451     KPIM::AddresseeView *mDetailsViewer;
00452     KPIM::CategorySelectDialog *mCategorySelectDialog;
00453     KPIM::CategoryEditDialog *mCategoryEditDialog;
00454     QWidget *mDetailsPage;
00455     QWidget *mDetailsWidget;
00456     QHBoxLayout *mDetailsLayout;
00457     QSplitter *mDetailsSplitter;
00458     QSplitter *mLeftSplitter;
00459     QWidgetStack *mDetailsStack;
00460     LDAPSearchDialog *mLdapSearchDialog;
00461     QDict<AddresseeEditorDialog> mEditorDict;
00462 
00463     bool mReadWrite;
00464     bool mModified;
00465     bool mIsPart;
00466 
00467     QTimer *mAddressBookChangedTimer;
00468 
00469     KAction *mActionPaste;
00470     KAction *mActionCut;
00471     KAction *mActionDelete;
00472     KAction *mActionCopy;
00473     KAction *mActionEditAddressee;
00474     KAction *mActionMoveAddresseeTo;
00475     KAction *mActionCopyAddresseeTo;
00476     KAction *mActionMerge;
00477     KAction *mActionMail;
00478     KAction *mActionMailVCard;
00479     KAction *mActionChat;
00480     KAction *mActionSave;
00481     KAction *mActionDeleteView;
00482     KAction *mActionWhoAmI;
00483     KAction *mActionCategories;
00484     KToggleAction *mActionJumpBar;
00485     KToggleAction *mActionDetails;
00486     KCommandHistory *mCommandHistory;
00487 
00488     KAddressBookService *mAddressBookService;
00489 
00490     KAB::SearchManager *mSearchManager;
00491     // KIMProxy provides access to up to date instant messaging presence data
00492     ::KIMProxy *mKIMProxy;
00493     class KABCorePrivate;
00494     KABCorePrivate *d;
00495 };
00496 
00497 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys