| 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_PENDING_CALL_H |
| 22 | #define ONLINE_ACCOUNTS_PENDING_CALL_H |
| 23 | |
| 24 | #include <QExplicitlySharedDataPointer> |
| 25 | #include <QObject> |
| 26 | #include <QScopedPointer> |
| 27 | |
| 28 | #include "global.h" |
| 29 | |
| 30 | namespace OnlineAccounts { |
| 31 | |
| 32 | class AuthenticationReplyPrivate; |
| 33 | class ManagerPrivate; |
| 34 | |
| 35 | class PendingCallPrivate; |
| 36 | class ONLINE_ACCOUNTS_EXPORT PendingCall |
| 37 | { |
| 38 | public: |
| 39 | PendingCall(const PendingCall &other); |
| 40 | ~PendingCall(); |
| 41 | PendingCall &operator=(const PendingCall &other); |
| 42 | |
| 43 | bool isFinished() const; |
| 44 | void waitForFinished(); |
| 45 | |
| 46 | protected: |
| 47 | friend class PendingCallPrivate; |
| 48 | friend class PendingCallWatcher; |
| 49 | friend class AuthenticationReplyPrivate; |
| 50 | friend class RequestAccessReplyPrivate; |
| 51 | friend class ManagerPrivate; |
| 52 | QExplicitlySharedDataPointer<PendingCallPrivate> d; |
| 53 | |
| 54 | private: |
| 55 | PendingCall(PendingCallPrivate *priv); |
| 56 | }; |
| 57 | |
| 58 | class PendingCallWatcherPrivate; |
| 59 | class ONLINE_ACCOUNTS_EXPORT PendingCallWatcher: |
| 60 | public QObject, public PendingCall |
| 61 | { |
| 62 | Q_OBJECT |
| 63 | |
| 64 | public: |
| 65 | PendingCallWatcher(const PendingCall &call, QObject *parent = 0); |
| 66 | ~PendingCallWatcher(); |
| 67 | |
| 68 | Q_SIGNALS: |
| 69 | void finished(); |
| 70 | |
| 71 | private: |
| 72 | Q_DECLARE_PRIVATE(PendingCallWatcher) |
| 73 | QScopedPointer<PendingCallWatcherPrivate> d_ptr; |
| 74 | }; |
| 75 | |
| 76 | } // namespace |
| 77 | |
| 78 | #endif // ONLINE_ACCOUNTS_PENDING_CALL_H |