~ubuntu-branches/ubuntu/saucy/kopete/saucy-proposed

« back to all changes in this revision

Viewing changes to libkopete/kopeteidentity.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-06-21 02:22:39 UTC
  • Revision ID: package-import@ubuntu.com-20130621022239-63l3zc8p0nf26pt6
Tags: upstream-4.10.80
ImportĀ upstreamĀ versionĀ 4.10.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    kopeteidentity.h - Kopete Identity
 
3
 
 
4
    Copyright (c) 2007      by Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
 
5
              (c) 2007         Will Stephenson <wstephenson@kde.org>
 
6
 
 
7
    Kopete    (c) 2002-2007 by the Kopete developers  <kopete-devel@kde.org>
 
8
 
 
9
    *************************************************************************
 
10
    *                                                                       *
 
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.      *
 
15
    *                                                                       *
 
16
    *************************************************************************
 
17
*/
 
18
 
 
19
#ifndef KOPETEIDENTITY_H
 
20
#define KOPETEIDENTITY_H
 
21
 
 
22
#include <kdemacros.h>
 
23
#include "kopeteglobal.h"
 
24
#include "kopetepropertycontainer.h"
 
25
#include "kopeteonlinestatus.h"
 
26
#include "kopete_export.h"
 
27
 
 
28
class KConfigGroup;
 
29
 
 
30
namespace Kopete
 
31
{
 
32
 
 
33
class Account;
 
34
class StatusMessage;
 
35
 
 
36
/**
 
37
 * @author Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
 
38
 *
 
39
 * An identity that might contain one or more accounts associated to it 
 
40
 */
 
41
class KOPETE_EXPORT Identity : public PropertyContainer
 
42
{
 
43
        Q_OBJECT
 
44
public: 
 
45
        typedef QList<Identity*> List;
 
46
        /**
 
47
         * @brief The main constructor for Kopete Identities
 
48
         *
 
49
         * This will create an empty identity with a random id
 
50
         * @param label the label to use for this identity
 
51
         */
 
52
        Identity(const QString &label);
 
53
 
 
54
        /**
 
55
         * @brief Constructor for deserialising stored Identities
 
56
         * @param id the stored Identity's id
 
57
         * @param label the stored Identity's label
 
58
         */
 
59
        Identity(const QString &id, const QString &label);
 
60
 
 
61
        ~Identity();
 
62
 
 
63
        /**
 
64
         * @brief Duplicates an existing identity
 
65
         *
 
66
         * This will create a new identity name @param id, that clones all properties
 
67
         * @return duplicate Identity
 
68
         */
 
69
        Identity * clone() const;
 
70
        /**
 
71
         * The id is a unique internal handle and should not be exposed in the UI
 
72
         * @return the identity's id
 
73
         */
 
74
        QString id() const;
 
75
 
 
76
        /**
 
77
         * The label is used to identify the identity in the UI
 
78
         * @return the identity's label
 
79
         */
 
80
        QString label() const;
 
81
 
 
82
        /**
 
83
         * Sets the label
 
84
         * @param newLabel a new label for the identity
 
85
         */
 
86
        void setLabel( const QString & label );
 
87
 
 
88
        /**
 
89
         * This identity should be connected when connect all is called?
 
90
         */
 
91
        bool excludeConnect() const;
 
92
 
 
93
        /**
 
94
         * @brief Get the online status of the identity
 
95
         * @return the online status of the identity
 
96
         */
 
97
        OnlineStatus::StatusType onlineStatus() const;
 
98
 
 
99
        /**
 
100
         * @brief Get the current status message of the identity
 
101
         */
 
102
        Kopete::StatusMessage statusMessage() const;
 
103
        
 
104
        /**
 
105
         * \brief Get the tooltip for this identity
 
106
         * \return an RTF tooltip depending on Kopete::AppearanceSettings settings
 
107
         **/
 
108
        QString toolTip() const;
 
109
 
 
110
        /**
 
111
         * \brief Return the icon for this identity
 
112
         */
 
113
        QString customIcon() const;
 
114
 
 
115
        /**
 
116
         * Returns the accounts assigned to this identity
 
117
         */
 
118
        QList<Account*> accounts() const;
 
119
 
 
120
        /**
 
121
         * @brief Adds an account to the identity
 
122
         *
 
123
         * @param account the account to be added
 
124
         */
 
125
        void addAccount( Kopete::Account *account );
 
126
 
 
127
        /**
 
128
         * Returns the @ref KConfigGroup that should be used to read/write settings 
 
129
         * of this identity
 
130
         */
 
131
        KConfigGroup *configGroup() const;
 
132
 
 
133
        /**
 
134
         * Load the identity information
 
135
         */
 
136
        void load();
 
137
 
 
138
        /**
 
139
         * Save the identity information
 
140
         */
 
141
        void save();
 
142
 
 
143
public slots:
 
144
        /**
 
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
 
150
         */
 
151
        void setOnlineStatus( uint category, const Kopete::StatusMessage &statusMessage );
 
152
 
 
153
        /**
 
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
 
158
         */
 
159
        void setStatusMessage( const Kopete::StatusMessage &statusMessage );
 
160
        
 
161
        /**
 
162
         * @brief Removes an account from the identity
 
163
         *
 
164
         * @param account the account to be removed
 
165
         */
 
166
        void removeAccount( const Kopete::Account *account );
 
167
 
 
168
        void updateOnlineStatus();
 
169
 
 
170
protected slots:
 
171
        void slotSaveProperty( Kopete::PropertyContainer *container, const QString &key,
 
172
                                const QVariant &oldValue, const QVariant &newValue );
 
173
 
 
174
signals:
 
175
        void onlineStatusChanged( Kopete::Identity* );
 
176
        void toolTipChanged( Kopete::Identity* );
 
177
        void identityDestroyed( const Kopete::Identity *identity );
 
178
        void identityChanged(Kopete::Identity *identity);
 
179
 
 
180
private:
 
181
        class Private;
 
182
        Private * const d;
 
183
 
 
184
};
 
185
 
 
186
} //END namespace Kopete
 
187
 
 
188
#endif
 
189