| 1 | /* |
| 2 | * Copyright (C) 2014 Canonical Ltd. |
| 3 | * |
| 4 | * Contact: Alberto Mardegan <[email protected]> |
| 5 | * |
| 6 | * This file is part of liblomiri-online-accounts-plugin |
| 7 | * |
| 8 | * This program is free software: you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License version 3, as published |
| 10 | * 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 General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along |
| 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #ifndef SIGNON_UI_REQUEST_HANDLER_H |
| 22 | #define SIGNON_UI_REQUEST_HANDLER_H |
| 23 | |
| 24 | #include "global.h" |
| 25 | |
| 26 | #include <QObject> |
| 27 | #include <QVariantMap> |
| 28 | |
| 29 | namespace SignOnUi { |
| 30 | |
| 31 | class RequestHandlerPrivate; |
| 32 | |
| 33 | class OAP_EXPORT RequestHandler: public QObject |
| 34 | { |
| 35 | Q_OBJECT |
| 36 | Q_PROPERTY(QObject *request READ request NOTIFY requestChanged) |
| 37 | Q_PROPERTY(QString matchKey READ matchKey CONSTANT) |
| 38 | Q_PROPERTY(QString matchId READ matchId CONSTANT) |
| 39 | |
| 40 | public: |
| 41 | explicit RequestHandler(QObject *parent = 0); |
| 42 | ~RequestHandler(); |
| 43 | |
| 44 | void setRequest(QObject *request); |
| 45 | QObject *request() const; |
| 46 | |
| 47 | static QString matchKey() { return QStringLiteral("X-RequestHandler"); } |
| 48 | QString matchId() const; |
| 49 | |
| 50 | Q_SIGNALS: |
| 51 | void requestChanged(); |
| 52 | |
| 53 | private: |
| 54 | RequestHandlerPrivate *d_ptr; |
| 55 | Q_DECLARE_PRIVATE(RequestHandler) |
| 56 | }; |
| 57 | |
| 58 | class RequestHandlerWatcherPrivate; |
| 59 | |
| 60 | class OAP_EXPORT RequestHandlerWatcher: public QObject |
| 61 | { |
| 62 | Q_OBJECT |
| 63 | |
| 64 | public: |
| 65 | explicit RequestHandlerWatcher(QObject *parent = 0); |
| 66 | ~RequestHandlerWatcher(); |
| 67 | |
| 68 | RequestHandler *findMatching(const QVariantMap ¶meters); |
| 69 | |
| 70 | Q_SIGNALS: |
| 71 | void newHandler(SignOnUi::RequestHandler *handler); |
| 72 | |
| 73 | private: |
| 74 | RequestHandlerWatcherPrivate *d_ptr; |
| 75 | Q_DECLARE_PRIVATE(RequestHandlerWatcher) |
| 76 | }; |
| 77 | |
| 78 | } // namespace |
| 79 | |
| 80 | #endif // SIGNON_UI_REQUEST_HANDLER_H |
| 81 |