diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bcb704366cb5e333a626c18c308c7e0448a8e69f (patch) | |
tree | f0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kopete/libkopete/kabcpersistence.h | |
download | tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/libkopete/kabcpersistence.h')
-rw-r--r-- | kopete/libkopete/kabcpersistence.h | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/kopete/libkopete/kabcpersistence.h b/kopete/libkopete/kabcpersistence.h new file mode 100644 index 00000000..fa02fb64 --- /dev/null +++ b/kopete/libkopete/kabcpersistence.h @@ -0,0 +1,107 @@ +/* + addressbooklink.h - Manages operations involving the KDE Address Book + + Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> + + Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org> + + ************************************************************************* + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + ************************************************************************* +*/ + +#ifndef KOPETEADDRESSBOOKLINK_H +#define KOPETEADDRESSBOOKLINK_H + +#include "kopete_export.h" + +// Goal is to have all the address book modifying code in one place +// Currently in +// *) Add Contact Wizard +// *) KopeteMetaContact +// *) KopeteAddrBookExport +// *) 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 +// *) Select addressbook entry + +namespace KABC +{ + class AddressBook; + class Resource; +} + +namespace Kopete +{ + + class MetaContact; + +class KOPETE_EXPORT KABCPersistence : public QObject +{ + Q_OBJECT + public: + /** + * \brief Retrieve the instance of AccountManager. + * + * The account manager is a singleton class of which only a single + * instance will exist. If no manager exists yet this function will + * create one for you. + * + * \return the instance of the AccountManager + */ + static KABCPersistence* self(); + + KABCPersistence( QObject * parent = 0, const char * name = 0 ); + ~KABCPersistence(); + /** + * @brief Access Kopete's KDE address book instance + */ + static KABC::AddressBook* addressBook(); + /** + * @brief Change the KABC data associated with this metacontact + * + * The KABC exposed data changed, so change it in KABC. + * Replaces Kopete::MetaContact::updateKABC() + */ + void write( MetaContact * mc ); + + /** + * @brief Remove any KABC data for this meta contact + */ + void removeKABC( MetaContact * mc ); + + /** + * Check for any new addresses added to this contact's KABC entry + * and prompt if they should be added in Kopete too. + * @return whether any contacts were added from KABC. + */ + bool syncWithKABC( MetaContact * mc ); + + /** + * Request an address book write, will be delayed to bundle any others happening around the same time + */ + void writeAddressBook( const KABC::Resource * res ); + protected: + + static void splitField( const QString &str, QString &app, QString &name, QString &value ); + + void dumpAB(); + protected slots: + /** + * Perform a delayed address book write + */ + void slotWriteAddressBook(); + private: + static KABCPersistence * s_self; + static KABC::AddressBook* s_addressBook; + static bool s_addrBookWritePending; + static QPtrList<KABC::Resource> s_pendingResources; +}; + +} // end namespace Kopete + +#endif + |