~ci-train-bot/online-accounts-api/online-accounts-api-ubuntu-xenial-landing-033

« back to all changes in this revision

Viewing changes to src/daemon/manager.h

  • Committer: Alberto Mardegan
  • Date: 2015-02-18 08:09:05 UTC
  • mfrom: (4.2.4 style)
  • Revision ID: alberto.mardegan@canonical.com-20150218080905-bqo9e9xdaizagxpv
style

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
1
#ifndef MANAGER_H
3
2
#define MANAGER_H
4
3
 
5
 
#include <memory>
 
4
#include <QDBusArgument>
 
5
#include <QDBusContext>
6
6
#include <QList>
7
7
#include <QObject>
8
8
#include <QVariantMap>
9
 
#include <QDBusArgument>
10
 
#include <QDBusContext>
11
9
 
12
10
struct AccountInfo {
13
 
    uint account_id = 0;
 
11
    uint accountId;
14
12
    QVariantMap details;
15
13
 
16
 
    AccountInfo() {}
17
 
    AccountInfo(uint account_id, const QVariantMap &details)
18
 
        : account_id(account_id), details(details) {}
19
 
 
 
14
    AccountInfo(): accountId(0) {}
 
15
    AccountInfo(uint accountId, const QVariantMap &details):
 
16
        accountId(accountId), details(details) {}
20
17
};
21
18
Q_DECLARE_METATYPE(AccountInfo)
22
19
 
23
20
QDBusArgument &operator<<(QDBusArgument &argument, const AccountInfo &info);
24
 
const QDBusArgument &operator>>(const QDBusArgument &argument, AccountInfo &info);
 
21
const QDBusArgument &operator>>(const QDBusArgument &argument,
 
22
                                AccountInfo &info);
25
23
 
26
 
class Manager : public QObject, protected QDBusContext {
 
24
class ManagerPrivate;
 
25
class Manager: public QObject, protected QDBusContext
 
26
{
27
27
    Q_OBJECT
28
 
    struct Private;
 
28
 
29
29
public:
30
 
    explicit Manager(QObject *parent=nullptr);
 
30
    explicit Manager(QObject *parent = 0);
31
31
    ~Manager();
32
32
 
33
33
public Q_SLOTS:
34
 
    QList<AccountInfo> GetAccounts(const QStringList &service_ids);
35
 
    AccountInfo GetAccountInfo(const QString &service_id, uint account_id);
36
 
    QVariantMap Authenticate(const QString &service_id, uint account_id, bool interactive, bool invalidate);
37
 
    AccountInfo Register(const QString &service_id, QVariantMap &credentials);
 
34
    QList<AccountInfo> GetAccounts(const QStringList &serviceIds);
 
35
    AccountInfo GetAccountInfo(const QString &serviceId, uint accountId);
 
36
    QVariantMap Authenticate(const QString &serviceId, uint accountId,
 
37
                             bool interactive, bool invalidate);
 
38
    AccountInfo Register(const QString &serviceId, QVariantMap &credentials);
38
39
 
39
40
Q_SIGNALS:
40
 
    void AccountChanged(const QString &service_id, uint account_id, bool enabled);
41
 
    void CredentialsChanged(const QString &service_id, uint account_id);
 
41
    void AccountChanged(const QString &serviceId, uint accountId, bool enabled);
 
42
    void CredentialsChanged(const QString &serviceId, uint accountId);
42
43
 
43
44
private:
44
 
    bool canAccess(const QString &service_id);
45
 
    bool checkAccess(const QString &service_id);
 
45
    bool canAccess(const QString &serviceId);
 
46
    bool checkAccess(const QString &serviceId);
46
47
    QString getPeerSecurityContext();
47
 
    std::unique_ptr<Private> p;
 
48
 
 
49
    Q_DECLARE_PRIVATE(Manager)
 
50
    ManagerPrivate *d_ptr;
48
51
};
49
52
 
50
53
#endif