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 );
00345 
00349     void openLDAPDialog();
00350 
00354     void configure();
00355 
00360     void print();
00361 
00362     void detailsHighlighted( const QString& );
00363 
00364     void showContactsAddress( const QString &uid );
00365 
00366     void configurationChanged();
00367 
00368     bool queryClose();
00369 
00373     void reinitXMLGUI();
00374 
00375   private:
00376 
00377 #ifdef KDEPIM_NEW_DISTRLISTS
00378     void editDistributionList( const KPIM::DistributionList &list );
00379     void showDistributionListEntry( const QString &uid );
00380 #endif
00381 
00382   private slots:
00383     void setJumpButtonBarVisible( bool visible );
00384     void setDetailsVisible( bool visible );
00385 
00386     void extensionModified( const KABC::Addressee::List &list );
00387     void extensionDeleted( const QStringList &uidList );
00388     void clipboardDataChanged();
00389     void updateIncSearchWidget();
00390 
00391     void slotEditorDestroyed( const QString &uid );
00392     void delayedAddressBookChanged();
00393     void addressBookChanged();
00394 
00395     void categoriesSelected( const QStringList& );
00396     void editCategories();
00397     void slotClearSearchBar();
00398     void slotContactsUpdated();
00399 
00400     void activateDetailsWidget( QWidget *widget );
00401     void deactivateDetailsWidget( QWidget *widget );
00402 
00403     void editDistributionList( const QString &name );
00404 
00405     void removeSelectedContactsFromDistList();
00406     void editSelectedDistributionList();
00407     void sendMailToDistributionList( const QString &id ); 
00408 
00409   private:
00410     void initGUI();
00411     void createJumpButtonBar();
00412     void initActions();
00413 
00414     void updateCategories();
00415     QStringList allCategories() const;
00416 
00417     AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
00418                                                         const char *name = 0 );
00419 
00420     QWidget *mWidget;
00421     KABC::AddressBook *mAddressBook;
00422     KStatusBar *mStatusBar;
00423 
00424     ViewManager *mViewManager;
00425     QLabel *mViewHeaderLabel;
00426 
00427 #ifdef KDEPIM_NEW_DISTRLISTS
00428     QString mSelectedDistributionList;
00429     QWidget *mDistListButtonWidget;
00430 #endif
00431 
00432     ExtensionManager *mExtensionManager;
00433     XXPortManager *mXXPortManager;
00434 
00435     JumpButtonBar *mJumpButtonBar;
00436     FilterSelectionWidget *mFilterSelectionWidget;
00437     IncSearchWidget *mIncSearchWidget;
00438     KAB::DistributionListEntryView* mDistListEntryView;
00439     KPIM::AddresseeView *mDetailsViewer;
00440     KPIM::CategorySelectDialog *mCategorySelectDialog;
00441     KPIM::CategoryEditDialog *mCategoryEditDialog;
00442     QWidget *mDetailsPage;
00443     QWidget *mDetailsWidget;
00444     QHBoxLayout *mDetailsLayout;
00445     QSplitter *mDetailsSplitter;
00446     QWidgetStack *mDetailsStack;
00447     LDAPSearchDialog *mLdapSearchDialog;
00448     QDict<AddresseeEditorDialog> mEditorDict;
00449 
00450     bool mReadWrite;
00451     bool mModified;
00452     bool mIsPart;
00453 
00454     QTimer *mAddressBookChangedTimer;
00455 
00456     KAction *mActionPaste;
00457     KAction *mActionCut;
00458     KAction *mActionDelete;
00459     KAction *mActionCopy;
00460     KAction *mActionEditAddressee;
00461     KAction *mActionStoreAddresseeIn;
00462     KAction *mActionMerge;
00463     KAction *mActionMail;
00464     KAction *mActionMailVCard;
00465     KAction *mActionChat;
00466     KAction *mActionSave;
00467     KAction *mActionDeleteView;
00468     KAction *mActionWhoAmI;
00469     KAction *mActionCategories;
00470     KToggleAction *mActionJumpBar;
00471     KToggleAction *mActionDetails;
00472     KCommandHistory *mCommandHistory;
00473 
00474     KAddressBookService *mAddressBookService;
00475 
00476     KAB::SearchManager *mSearchManager;
00477     // KIMProxy provides access to up to date instant messaging presence data
00478     ::KIMProxy *mKIMProxy;
00479     class KABCorePrivate;
00480     KABCorePrivate *d;
00481 };
00482 
00483 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys