File: manager.h

package info (click to toggle)
libaccounts-qt 1.17-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 636 kB
  • sloc: cpp: 3,286; makefile: 23; sh: 8
file content (123 lines) | stat: -rw-r--r-- 3,361 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/* vi: set et sw=4 ts=4 cino=t0,(0: */
/*
 * This file is part of libaccounts-qt
 *
 * Copyright (C) 2009-2011 Nokia Corporation.
 * Copyright (C) 2012-2016 Canonical Ltd.
 *
 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * version 2.1 as published by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef ACCOUNTS_MANAGER_H
#define ACCOUNTS_MANAGER_H

#include <QObject>
#include <QSettings>
#include <QString>
#include <QStringList>

#include "Accounts/accountscommon.h"
#include "Accounts/account.h"
#include "Accounts/error.h"
#include "Accounts/provider.h"
#include "Accounts/service.h"
#include "Accounts/service-type.h"

/*!
 * @namespace Accounts
 */
namespace Accounts
{

class AccountService;
class Application;

typedef QList<Application> ApplicationList;

class ACCOUNTS_EXPORT Manager: public QObject
{
    Q_OBJECT

public:
    /*!
     * @enum Option
     * @brief Specifies options for the object.
     */
    enum Option {
        DisableNotifications = 0x1, /**< Disable all inter-process notifications */
    };
    Q_DECLARE_FLAGS(Options, Option)

    Manager(QObject *parent = nullptr);
    Manager(const QString &serviceType, QObject *parent = nullptr);
    Manager(Options options, QObject *parent = nullptr);
    ~Manager();

    Account *account(const AccountId &id) const;

    AccountIdList accountList(const QString &serviceType = QString()) const;
    AccountIdList accountListEnabled(const QString &serviceType = QString()) const;

    Account *createAccount(const QString &providerName);

    Service service(const QString &serviceName) const;
    ServiceList serviceList(const QString &serviceType = QString()) const;
    ServiceList serviceList(const Application &application) const;

    Provider provider(const QString &providerName) const;
    ProviderList providerList() const;

    ServiceType serviceType(const QString &name) const;

    Application application(const QString &applicationName) const;
    ApplicationList applicationList(const Service &service) const;

    QString serviceType() const;

    void setTimeout(quint32 timeout);
    quint32 timeout();

    void setAbortOnTimeout(bool abort);
    bool abortOnTimeout() const;

    Options options() const;

    Error lastError() const;

Q_SIGNALS:
    void accountCreated(Accounts::AccountId id);
    void accountRemoved(Accounts::AccountId id);
    void accountUpdated(Accounts::AccountId id);
    void enabledEvent(Accounts::AccountId id);

private:

    // \cond
    class Private;
    friend class Private;
    Private *d; // Owned.

    friend class Account;
    friend class AccountService;
    // \endcond
}; // Manager

} //namespace Accounts

Q_DECLARE_OPERATORS_FOR_FLAGS(Accounts::Manager::Options)

#endif // ACCOUNTS_MANAGER_H