accounts-qt  1.16
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-2016 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 = nullptr);
66  Manager(const QString &serviceType, QObject *parent = nullptr);
67  Manager(Options options, QObject *parent = nullptr);
68  ~Manager();
69 
70  Account *account(const AccountId &id) const;
71 
72  AccountIdList accountList(const QString &serviceType = QString()) const;
73  AccountIdList accountListEnabled(const QString &serviceType = QString()) const;
74 
75  Account *createAccount(const QString &providerName);
76 
77  Service service(const QString &serviceName) const;
78  ServiceList serviceList(const QString &serviceType = QString()) const;
79  ServiceList serviceList(const Application &application) const;
80 
81  Provider provider(const QString &providerName) const;
82  ProviderList providerList() const;
83 
84  ServiceType serviceType(const QString &name) const;
85 
86  Application application(const QString &applicationName) const;
87  ApplicationList applicationList(const Service &service) const;
88 
89  QString serviceType() const;
90 
91  void setTimeout(quint32 timeout);
92  quint32 timeout();
93 
94  void setAbortOnTimeout(bool abort);
95  bool abortOnTimeout() const;
96 
97  Options options() const;
98 
99  Error lastError() const;
100 
101 Q_SIGNALS:
102  void accountCreated(Accounts::AccountId id);
103  void accountRemoved(Accounts::AccountId id);
104  void accountUpdated(Accounts::AccountId id);
105  void enabledEvent(Accounts::AccountId id);
106 
107 private:
108 
109  // \cond
110  class Private;
111  friend class Private;
112  Private *d; // Owned.
113 
114  friend class Account;
115  friend class AccountService;
116  // \endcond
117 }; // Manager
118 
119 } //namespace Accounts
120 
121 Q_DECLARE_OPERATORS_FOR_FLAGS(Accounts::Manager::Options)
122 
123 #endif // ACCOUNTS_MANAGER_H
Accounts::Manager::accountRemoved
void accountRemoved(Accounts::AccountId id)
The signal is emitted when existing account is removed.
Accounts::ServiceType
Representation of an account service type.
Definition: service-type.h:50
Accounts::Manager
Manager of accounts, services and providers.
Definition: manager.h:52
Accounts::Error
Base object definition for accounts error handling.
Definition: error.h:44
Accounts::Manager::accountUpdated
void accountUpdated(Accounts::AccountId id)
The signal is emitted when any account property for a particular service is updated.
Accounts::Application
Information on the client applications of libaccounts.
Definition: application.h:42
Accounts::Service
Representation of an account service.
Definition: service.h:49
Accounts::Manager::enabledEvent
void enabledEvent(Accounts::AccountId id)
If the manager has been created with serviceType, this signal will be emitted when an account (identi...
Accounts::AccountService
Account settings for a specific service.
Definition: account-service.h:40
Accounts::Manager::Option
Option
Specifies options for the object.
Definition: manager.h:60
Accounts::Provider
Representation of an account provider.
Definition: provider.h:49
Accounts::Manager::accountCreated
void accountCreated(Accounts::AccountId id)
The signal is emitted when new account is created.