accounts-qt 1.17

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
33 namespace Accounts
34{
35 class Manager;
36 class Service;
37
38 class AccountServicePrivate;
39 class ACCOUNTS_EXPORT AccountService: public QObject
40{
41 Q_OBJECT
42
43 public:
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
89 private:
90 // Don't include private data in docs: \cond
91 AccountServicePrivate *d_ptr;
92 Q_DECLARE_PRIVATE(AccountService)
93 // \endcond
94};
95
96 typedef QList<AccountService*> AccountServiceList;
97
98} //namespace
99
100#endif // ACCOUNTS_ACCOUNT_SERVICE_H
Accounts::AccountService::service
Service service() const
Return the Service.
Definition account-service.cpp:212
Accounts::AccountService::allKeys
QStringList allKeys() const
Return all the keys in the current group.
Definition account-service.cpp:242
Accounts::AccountService::changed
void changed()
Emitted when some setting has changed on the account service.
Accounts::AccountService::childGroups
QStringList childGroups() const
Return all the groups which are direct children of the current group.
Definition account-service.cpp:274
Accounts::AccountService::account
Account * account() const
Return the Account.
Definition account-service.cpp:203
Accounts::AccountService::contains
bool contains(const QString &key) const
Check whether the given key is in the current group.
Definition account-service.cpp:325
Accounts::AccountService::value
QVariant value(const QString &key, const QVariant &defaultValue, SettingSource *source=nullptr) const
Retrieves the value of an account setting, as a QVariant.
Definition account-service.cpp:417
Accounts::AccountService::authData
AuthData authData() const
Read the authentication data stored in the account (merging the service-specific settings with the gl...
Definition account-service.cpp:495
Accounts::AccountService::remove
void remove(const QString &key)
Remove the given key.
Definition account-service.cpp:357
Accounts::AccountService::childKeys
QStringList childKeys() const
Return all the keys which are direct children of the current group.
Definition account-service.cpp:293
Accounts::AccountService::beginGroup
void beginGroup(const QString &prefix)
Enter a group.
Definition account-service.cpp:265
Accounts::AccountService::isEnabled
bool isEnabled() const
Check whether the account service is enabled.
Definition account-service.cpp:233
Accounts::AccountService::changedFields
QStringList changedFields() const
This method should be called only in the context of a handler of the AccountService::changed() signal...
Definition account-service.cpp:465
Accounts::AccountService::clear
void clear()
Remove all the keys.
Definition account-service.cpp:310
Accounts::AccountService::enabled
void enabled(bool isEnabled)
Emitted when the enabledness state of the account service has changed.
Accounts::AccountService::group
QString group() const
Return the name of the current group.
Definition account-service.cpp:344
Accounts::AccountService::AccountService
AccountService(Account *account, const Service &service)
Constructor.
Definition account-service.cpp:173
Accounts::AccountService::enabled
bool enabled() const
Check whether the account service is enabled.
Definition account-service.cpp:225
Accounts::AccountService::endGroup
void endGroup()
Exit a group.
Definition account-service.cpp:333
Accounts::AuthData
Information for account authentication.
Definition auth-data.h:50
Accounts::Manager
Manager of accounts, services and providers.
Definition manager.h:52
Accounts::Service
Representation of an account service.
Definition service.h:49