accounts-qt 1.16
account-service.h
1/* vi: set et sw=4 ts=4 cino=t0,(0: */
2/*
3* This file is part of libaccounts-qt
4*
5* Copyright (C) 2012-2016 Canonical Ltd.
6*
7* Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
8*
9* This library is free software; you can redistribute it and/or
10* modify it under the terms of the GNU Lesser General Public License
11* version 2.1 as published by the Free Software Foundation.
12*
13* This library is distributed in the hope that it will be useful, but
14* WITHOUT ANY WARRANTY; without even the implied warranty of
15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16* Lesser General Public License for more details.
17*
18* You should have received a copy of the GNU Lesser General Public
19* License along with this library; if not, write to the Free Software
20* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21* 02110-1301 USA
22*/
23
24#ifndef ACCOUNTS_ACCOUNT_SERVICE_H
25#define ACCOUNTS_ACCOUNT_SERVICE_H
26
27#include <QObject>
28#include <QStringList>
29
30#include "Accounts/account.h"
31#include "Accounts/auth-data.h"
32
33namespace Accounts
34{
35class Manager;
36class Service;
37
38class AccountServicePrivate;
39class ACCOUNTS_EXPORT AccountService: public QObject
40{
41 Q_OBJECT
42
43public:
44 explicit AccountService(Account *account, const Service &service);
45 explicit AccountService(Account *account, const Service &service,
46 QObject *parent);
47 virtual ~AccountService();
48
49 Account *account() const;
50 Service service() const;
51
52 bool enabled() const;
53 bool isEnabled() const;
54
55 QStringList allKeys() const;
56
57 void beginGroup(const QString &prefix);
58
59 QStringList childGroups() const;
60 QStringList childKeys() const;
61
62 void clear();
63
64 bool contains(const QString &key) const;
65
66 void endGroup();
67
68 QString group() const;
69
70 void remove(const QString &key);
71
72 void setValue(const char *key, const QVariant &value);
73 void setValue(const QString &key, const QVariant &value);
74
75 QVariant value(const QString &key,
76 const QVariant &defaultValue,
77 SettingSource *source = nullptr) const;
78 QVariant value(const QString &key, SettingSource *source = nullptr) const;
79 QVariant value(const char *key, SettingSource *source = nullptr) const;
80
81 QStringList changedFields() const;
82
83 AuthData authData() const;
84
85Q_SIGNALS:
86 void enabled(bool isEnabled);
87 void changed();
88
89private:
90 // Don't include private data in docs: \cond
91 AccountServicePrivate *d_ptr;
92 Q_DECLARE_PRIVATE(AccountService)
93 // \endcond
94};
95
96typedef QList<AccountService*> AccountServiceList;
97
98} //namespace
99
100#endif // ACCOUNTS_ACCOUNT_SERVICE_H
Account settings for a specific service.
void changed()
Emitted when some setting has changed on the account service.
void enabled(bool isEnabled)
Emitted when the enabledness state of the account service has changed.
Information for account authentication.
Definition: auth-data.h:50
Representation of an account service.
Definition: service.h:49