2 addressbooklink.h - Manages operations involving the KDE Address Book
4 Copyright (c) 2005 Will Stephenson <wstephenson@kde.org>
6 Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
8 *************************************************************************
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. *
15 *************************************************************************
18 #ifndef KABCPERSISTENCE_H
19 #define KABCPERSISTENCE_H
21 #include "kopete_export.h"
23 // Goal is to have all the address book modifying code in one place
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
42 class KOPETE_EXPORT KABCPersistence
: public QObject
47 * \brief Retrieve the instance of AccountManager.
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
53 * \return the instance of the AccountManager
55 static KABCPersistence
* self();
57 explicit KABCPersistence( QObject
* parent
= 0, const char * name
= 0 );
60 * @brief Access Kopete's KDE address book instance
62 static KABC::AddressBook
* addressBook();
64 * @brief Change the KABC data associated with this metacontact
66 * The KABC exposed data changed, so change it in KABC.
67 * Replaces Kopete::MetaContact::updateKABC()
69 void write( MetaContact
* mc
);
72 * @brief Remove any KABC data for this meta contact
74 void removeKABC( MetaContact
* mc
);
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.
81 bool syncWithKABC( MetaContact
* mc
);
84 * Request an address book write, will be delayed to bundle any others happening around the same time
86 void writeAddressBook( KABC::Resource
* res
);
89 static void splitField( const QString
&str
, QString
&app
, QString
&name
, QString
&value
);
92 * Perform a delayed address book write
94 void slotWriteAddressBook();
100 } // end namespace Kopete
102 #endif // KABCPERSISTENCE_H