accounts-qt  1.13
manager.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) 2009-2011 Nokia Corporation.
6  * Copyright (C) 2012 Canonical Ltd.
7  *
8  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public License
12  * version 2.1 as published by the Free Software Foundation.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22  * 02110-1301 USA
23  */
24 
25 #ifndef ACCOUNTS_MANAGER_H
26 #define ACCOUNTS_MANAGER_H
27 
28 #include <QObject>
29 #include <QSettings>
30 #include <QString>
31 #include <QStringList>
32 
33 #include "Accounts/accountscommon.h"
34 #include "Accounts/account.h"
35 #include "Accounts/error.h"
36 #include "Accounts/provider.h"
37 #include "Accounts/service.h"
38 #include "Accounts/service-type.h"
39 
43 namespace Accounts
44 {
45 
46 class AccountService;
47 class Application;
48 
49 typedef QList<Application> ApplicationList;
50 
51 class ACCOUNTS_EXPORT Manager: public QObject
52 {
53  Q_OBJECT
54 
55 public:
60  enum Option {
61  DisableNotifications = 0x1,
62  };
63  Q_DECLARE_FLAGS(Options, Option)
64 
65  Manager(QObject *parent = 0);
66  Manager(const QString &serviceType, QObject *parent = 0);
67  Manager(Options options, QObject *parent = 0);
68  ~Manager();
69 
70  Account *account(const AccountId &id) const;
71 
72  AccountIdList accountList(const QString &serviceType = QString::null) const;
73  AccountIdList accountListEnabled(const QString &serviceType = QString::null) const;
74 
75  Account *createAccount(const QString &providerName);
76 
77  Service service(const QString &serviceName) const;
78  ServiceList serviceList(const QString &serviceType = QString::null) const;
79 
80  Provider provider(const QString &providerName) const;
81  ProviderList providerList() const;
82 
83  ServiceType serviceType(const QString &name) const;
84 
85  Application application(const QString &applicationName) const;
86  ApplicationList applicationList(const Service &service) const;
87 
88  QString serviceType() const;
89 
90  void setTimeout(quint32 timeout);
91  quint32 timeout();
92 
93  void setAbortOnTimeout(bool abort);
94  bool abortOnTimeout() const;
95 
96  Options options() const;
97 
98  Error lastError() const;
99 
100 Q_SIGNALS:
101  void accountCreated(Accounts::AccountId id);
102  void accountRemoved(Accounts::AccountId id);
103  void accountUpdated(Accounts::AccountId id);
104  void enabledEvent(Accounts::AccountId id);
105 
106 private:
107 
108  // \cond
109  class Private;
110  friend class Private;
111  Private *d; // Owned.
112 
113  friend class Account;
114  friend class AccountService;
115  // \endcond
116 }; // Manager
117 
118 } //namespace Accounts
119 
120 Q_DECLARE_OPERATORS_FOR_FLAGS(Accounts::Manager::Options)
121 
122 #endif // ACCOUNTS_MANAGER_H
Manager of accounts, services and providers.
Definition: manager.h:51
Account settings for a specific service.
Option
Specifies options for the object.
Definition: manager.h:60
Representation of an account provider.
Definition: provider.h:48
Representation of an account service type.
Definition: service-type.h:49
Representation of an account service.
Definition: service.h:48
Base object definition for accounts error handling.
Definition: error.h:42
Information on the client applications of libaccounts.
Definition: application.h:40