Statistics
| Branch: | Tag: | Revision:

root / kadu-core / accounts / account-manager.h @ f0c9e254

History | View | Annotate | Download (2.1 kB)

1
/***************************************************************************
2
 *                                                                         *
3
 *   This program is free software; you can redistribute it and/or modify  *
4
 *   it under the terms of the GNU General Public License as published by  *
5
 *   the Free Software Foundation; either version 2 of the License, or     *
6
 *   (at your option) any later version.                                   *
7
 *                                                                         *
8
 ***************************************************************************/
9
10
#ifndef ACCOUNT_MANAGER_H
11
#define ACCOUNT_MANAGER_H
12
13
#include <QtCore/QMap>
14
#include <QtCore/QObject>
15
#include <QtCore/QUuid>
16
17
#include "accounts/account.h"
18
#include "exports.h"
19
20
class AccountData;
21
class Status;
22
class XmlConfigFile;
23
24
class KADUAPI AccountManager : public QObject
25
{
26
        Q_OBJECT
27
        Q_DISABLE_COPY(AccountManager)
28
29
        static AccountManager *Instance;
30
31
        AccountManager();
32
        virtual ~AccountManager();
33
34
        QList<Account *> Accounts;
35
36
private slots:
37
        void connectionError(Account *account, const QString &server, const QString &message);
38
39
public:
40
        static AccountManager * instance();
41
42
        //TODO: 0.6.6
43
        void loadConfiguration(XmlConfigFile *configurationStorage, const QString &name = QString::null);
44
        //TODO: 0.6.6
45
        void storeConfiguration(XmlConfigFile *configurationStorage, const QString &name = QString::null);
46
47
        Account * defaultAccount() const;
48
49
        Account * byIndex(unsigned int index) const;
50
        Account * byUuid(const QUuid &uuid) const;
51
52
        unsigned int indexOf(Account *account) const { return Accounts.indexOf(account); }
53
        unsigned int count() const { return Accounts.count(); }
54
55
        const QList<Account *> accounts() const { return Accounts; }
56
        const QList<Account *> byProtocolName(const QString &name) const;
57
58
        void registerAccount(Account *account);
59
        void unregisterAccount(Account *account);
60
61
        Status status() const;
62
63
signals:
64
        void accountAboutToBeRegistered(Account *);
65
        void accountRegistered(Account *);
66
        void accountAboutToBeUnregistered(Account *);
67
        void accountUnregistered(Account *);
68
69
};
70
71
#endif // ACCOUNT_MANAGER_H