accounts-qt  1.2
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 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  virtual ~AccountService();
46 
47  Account *account() const;
48  Service service() const;
49 
50  bool enabled() const;
51 
52  QStringList allKeys() const;
53 
54  void beginGroup(const QString &prefix);
55 
56  QStringList childGroups() const;
57  QStringList childKeys() const;
58 
59  void clear();
60 
61  bool contains(const QString &key) const;
62 
63  void endGroup();
64 
65  QString group() const;
66 
67  void remove(const QString &key);
68 
69  void setValue(const char *key, const QVariant &value);
70  void setValue(const QString &key, const QVariant &value);
71 
72  QVariant value(const QString &key, SettingSource *source = 0) const;
73  QVariant value(const char *key, SettingSource *source = 0) const;
74 
75  QStringList changedFields() const;
76 
77  AuthData authData() const;
78 
79 signals:
80  void enabled(bool isEnabled);
81  void changed();
82 
83 private:
84  // Don't include private data in docs: \cond
85  AccountServicePrivate *d_ptr;
86  Q_DECLARE_PRIVATE(AccountService)
87  // \endcond
88 };
89 
90 typedef QList<AccountService*> AccountServiceList;
91 
92 } //namespace
93 
94 #endif // ACCOUNTS_ACCOUNT_SERVICE_H