| 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_DBUS_INTERFACE_H |
| 22 | #define ONLINE_ACCOUNTS_DBUS_INTERFACE_H |
| 23 | |
| 24 | #include <QDBusAbstractInterface> |
| 25 | #include <QDBusPendingCall> |
| 26 | #include <QDBusPendingReply> |
| 27 | #include <QList> |
| 28 | |
| 29 | #include "account_info.h" |
| 30 | |
| 31 | namespace OnlineAccounts { |
| 32 | |
| 33 | /* Avoid using QDBusInterface which does a blocking introspection call. |
| 34 | */ |
| 35 | class DBusInterface: public QDBusAbstractInterface |
| 36 | { |
| 37 | Q_OBJECT |
| 38 | |
| 39 | public: |
| 40 | DBusInterface(const QString &service, |
| 41 | const QString &path, |
| 42 | const char *interface, |
| 43 | const QDBusConnection &connection, |
| 44 | QObject *parent = 0); |
| 45 | virtual ~DBusInterface(); |
| 46 | |
| 47 | QDBusPendingCall getAccounts(const QVariantMap &filters); |
| 48 | |
| 49 | QDBusPendingCall authenticate(AccountId accountId, const QString &service, |
| 50 | bool interactive, bool invalidate, |
| 51 | const QVariantMap ¶meters); |
| 52 | |
| 53 | QDBusPendingCall requestAccess(const QString &service, |
| 54 | const QVariantMap ¶meters); |
| 55 | |
| 56 | Q_SIGNALS: |
| 57 | void accountChanged(const QString &service, |
| 58 | const OnlineAccounts::AccountInfo &info); |
| 59 | |
| 60 | private Q_SLOTS: |
| 61 | void onAccountChanged(const QString &service, |
| 62 | const OnlineAccounts::AccountInfo &info); |
| 63 | |
| 64 | private: |
| 65 | bool connect(const char *signal, const char *signature, |
| 66 | QObject *receiver, const char *slot); |
| 67 | }; |
| 68 | |
| 69 | } |
| 70 | |
| 71 | #endif // ONLINE_ACCOUNTS_DBUS_INTERFACE_H |