Debian Codegraph @

online-accounts/lib/qt/LomiriOnlineAccounts/manager.h

raw symbols SCIP
1 /*
2 * This file is part of libOnlineAccounts
3 *
4 * Copyright (C) 2015 Canonical Ltd.
5 *
6 * Contact: Alberto Mardegan <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License version 3, as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranties of
14 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef ONLINE_ACCOUNTS_MANAGER_H
22 #define ONLINE_ACCOUNTS_MANAGER_H
23
24 #include <QList>
25 #include <QObject>
26
27 #include "error.h"
28 #include "global.h"
29 #include "pending_call.h"
30 #include "service.h"
31
32 class QDBusConnection;
33
34 namespace OnlineAccounts {
35
36 class Account;
37 class AccountPrivate;
38 class AuthenticationData;
39 class RequestAccessReplyPrivate;
40
41 class ManagerPrivate;
42 class ONLINE_ACCOUNTS_EXPORT Manager: public QObject
43 {
44 Q_OBJECT
45
46 public:
47 explicit Manager(const QString &applicationId, QObject *parent = 0);
48 Manager(const QString &applicationId, const QDBusConnection &bus,
49 QObject *parent = 0);
50 ~Manager();
51
52 bool isReady() const;
53 void waitForReady();
54
55 QList<Service> availableServices() const;
56
57 QList<Account*> availableAccounts(const QString &service = QString());
58 Account *account(AccountId accountId);
59 Account *account(AccountId accountId, const QString &service);
60
61 PendingCall requestAccess(const QString &service,
62 const AuthenticationData &authData);
63
64 Q_SIGNALS:
65 void ready();
66 void accountAvailable(OnlineAccounts::Account *account);
67
68 private:
69 friend class Account;
70 friend class AccountPrivate;
71 friend class RequestAccessReplyPrivate;
72 Q_DECLARE_PRIVATE(Manager)
73 Q_DISABLE_COPY(Manager)
74 ManagerPrivate *d_ptr;
75 };
76
77 class ONLINE_ACCOUNTS_EXPORT RequestAccessReply
78 {
79 public:
80 RequestAccessReply(const PendingCall &call);
81 virtual ~RequestAccessReply();
82
83 bool hasError() const { return error().isValid(); }
84 Error error() const;
85
86 Account *account();
87
88 private:
89 Q_DECLARE_PRIVATE(RequestAccessReply)
90 Q_DISABLE_COPY(RequestAccessReply)
91 RequestAccessReplyPrivate *d_ptr;
92 };
93
94 } // namespace
95
96 #endif // ONLINE_ACCOUNTS_MANAGER_H