home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kopete / kabcpersistence.h next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  3.1 KB  |  108 lines

  1. /*
  2.     addressbooklink.h - Manages operations involving the KDE Address Book
  3.  
  4.     Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk>
  5.  
  6.     Kopete    (c) 2002-2004 by the Kopete developers  <kopete-devel@kde.org>
  7.  
  8.     *************************************************************************
  9.     *                                                                       *
  10.     * This library is free software; you can redistribute it and/or         *
  11.     * modify it under the terms of the GNU Lesser General Public            *
  12.     * License as published by the Free Software Foundation; either          *
  13.     * version 2 of the License, or (at your option) any later version.      *
  14.     *                                                                       *
  15.     *************************************************************************
  16. */
  17.  
  18. #ifndef KOPETEADDRESSBOOKLINK_H
  19. #define KOPETEADDRESSBOOKLINK_H
  20.  
  21. #include "kopete_export.h"
  22.  
  23. // Goal is to have all the address book modifying code in one place
  24. // Currently in 
  25. // *) Add Contact Wizard
  26. // *) KopeteMetaContact
  27. // *) KopeteAddrBookExport
  28. // *) KABC Export Wizard - TODO - think about sequence of events when adding addressees AND writing their IM data. - Extra save should be unnecessary because we are sharing a kabc instance
  29. // *) Select addressbook entry
  30.  
  31. namespace KABC
  32. {
  33.     class AddressBook;
  34.     class Resource;
  35. }
  36.  
  37. namespace Kopete
  38. {
  39.  
  40.     class MetaContact;
  41.     
  42. class KOPETE_EXPORT KABCPersistence : public QObject
  43. {
  44.     Q_OBJECT
  45.     public:
  46.         /**
  47.          * \brief Retrieve the instance of AccountManager.
  48.          *
  49.          * The account manager is a singleton class of which only a single
  50.          * instance will exist. If no manager exists yet this function will
  51.          * create one for you.
  52.          *
  53.          * \return the instance of the AccountManager
  54.          */
  55.         static KABCPersistence* self();
  56.         
  57.         KABCPersistence( QObject * parent = 0, const char * name = 0 );
  58.         ~KABCPersistence();
  59.         /**
  60.          * @brief Access Kopete's KDE address book instance
  61.          */
  62.         static KABC::AddressBook* addressBook();
  63.         /**
  64.          * @brief Change the KABC data associated with this metacontact
  65.          *
  66.          * The KABC exposed data changed, so change it in KABC.
  67.          * Replaces Kopete::MetaContact::updateKABC()
  68.          */
  69.         void write( MetaContact * mc );
  70.  
  71.         /**
  72.          * @brief Remove any KABC data for this meta contact
  73.          */
  74.         void removeKABC( MetaContact * mc );
  75.     
  76.         /**
  77.          * Check for any new addresses added to this contact's KABC entry
  78.          * and prompt if they should be added in Kopete too.
  79.          * @return whether any contacts were added from KABC.
  80.          */
  81.         bool syncWithKABC( MetaContact * mc );
  82.         
  83.         /**
  84.          * Request an address book write, will be delayed to bundle any others happening around the same time
  85.          */
  86.         void writeAddressBook( const KABC::Resource * res );
  87.     protected:
  88.  
  89.         static void splitField( const QString &str, QString &app, QString &name, QString &value );
  90.     
  91.         void dumpAB();
  92.     protected slots:
  93.         /**
  94.          * Perform a delayed address book write
  95.          */
  96.         void slotWriteAddressBook();
  97.     private:
  98.         static KABCPersistence * s_self;
  99.         static KABC::AddressBook* s_addressBook;
  100.         static bool s_addrBookWritePending;
  101.         static QPtrList<KABC::Resource> s_pendingResources;
  102. };
  103.  
  104. } // end namespace Kopete
  105.  
  106. #endif
  107.  
  108.