2 kopeteidentity.h - Kopete Identity
4 Copyright (c) 2007 by Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
5 (c) 2007 Will Stephenson <wstephenson@kde.org>
7 Kopete (c) 2002-2007 by the Kopete developers <kopete-devel@kde.org>
9 *************************************************************************
11 * This library is free software; you can redistribute it and/or *
12 * modify it under the terms of the GNU Lesser General Public *
13 * License as published by the Free Software Foundation; either *
14 * version 2 of the License, or (at your option) any later version. *
16 *************************************************************************
19 #ifndef KOPETEIDENTITY_H
20 #define KOPETEIDENTITY_H
22 #include <kdemacros.h>
23 #include "kopeteglobal.h"
24 #include "kopetepropertycontainer.h"
25 #include "kopeteonlinestatus.h"
26 #include "kopete_export.h"
37 * @author Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
39 * An identity that might contain one or more accounts associated to it
41 class KOPETE_EXPORT Identity
: public PropertyContainer
45 typedef QList
<Identity
*> List
;
47 * @brief The main constructor for Kopete Identities
49 * This will create an empty identity with a random id
50 * @param label the label to use for this identity
52 Identity(const QString
&label
);
55 * @brief Constructor for deserialising stored Identities
56 * @param id the stored Identity's id
57 * @param label the stored Identity's label
59 Identity(const QString
&id
, const QString
&label
);
64 * @brief Duplicates an existing identity
66 * This will create a new identity name @param id, that clones all properties
67 * @return duplicate Identity
69 Identity
* clone() const;
71 * The id is a unique internal handle and should not be exposed in the UI
72 * @return the identity's id
77 * The label is used to identify the identity in the UI
78 * @return the identity's label
80 QString
label() const;
84 * @param newLabel a new label for the identity
86 void setLabel( const QString
& label
);
89 * This identity should be connected when connect all is called?
91 bool excludeConnect() const;
94 * @brief Get the online status of the identity
95 * @return the online status of the identity
97 OnlineStatus::StatusType
onlineStatus() const;
100 * @brief Get the current status message of the identity
102 Kopete::StatusMessage
statusMessage() const;
105 * \brief Get the tooltip for this identity
106 * \return an RTF tooltip depending on Kopete::AppearanceSettings settings
108 QString
toolTip() const;
111 * \brief Return the icon for this identity
113 QString
customIcon() const;
116 * Returns the accounts assigned to this identity
118 QList
<Account
*> accounts() const;
121 * @brief Adds an account to the identity
123 * @param account the account to be added
125 void addAccount( Kopete::Account
*account
);
128 * Returns the @ref KConfigGroup that should be used to read/write settings
131 KConfigGroup
*configGroup() const;
134 * Load the identity information
139 * Save the identity information
145 * @brief Sets the online status for this identity
146 * Sets the online status for each account in this identity, except those which are set to
147 * 'Exclude from connect all' (Kopete::Account::excludeConnect()).
148 * @param category generic OnlineStatusManager::Categories identifying status to set
149 * @param statusMessage is the new status message to use in this onlinestatus
151 void setOnlineStatus( uint category
, const Kopete::StatusMessage
&statusMessage
);
154 * @brief Sets the status message for this identity
155 * Sets the status message for each account in this identity, except those which are set to
156 * 'Exclude from connect all' (Kopete::Account::excludeConnect()).
157 * @param statusMessage is the new status message to use
159 void setStatusMessage( const Kopete::StatusMessage
&statusMessage
);
162 * @brief Removes an account from the identity
164 * @param account the account to be removed
166 void removeAccount( const Kopete::Account
*account
);
168 void updateOnlineStatus();
171 void slotSaveProperty( Kopete::PropertyContainer
*container
, const QString
&key
,
172 const QVariant
&oldValue
, const QVariant
&newValue
);
175 void onlineStatusChanged( Kopete::Identity
* );
176 void toolTipChanged( Kopete::Identity
* );
177 void identityDestroyed( const Kopete::Identity
*identity
);
178 void identityChanged(Kopete::Identity
*identity
);
186 } //END namespace Kopete