1 | // Copyright (C) 2024 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QOAUTHURISCHEMEREPLYHANDLER_H |
5 | #define QOAUTHURISCHEMEREPLYHANDLER_H |
6 | |
7 | #include <QtNetworkAuth/qoauthglobal.h> |
8 | #include <QtNetworkAuth/qoauthoobreplyhandler.h> |
9 | |
10 | #include <QtCore/qurl.h> |
11 | |
12 | QT_BEGIN_NAMESPACE |
13 | |
14 | class QOAuthUriSchemeReplyHandlerPrivate; |
15 | class Q_OAUTH_EXPORT QOAuthUriSchemeReplyHandler : public QOAuthOobReplyHandler |
16 | { |
17 | Q_OBJECT |
18 | Q_PROPERTY(QUrl redirectUrl READ redirectUrl WRITE setRedirectUrl NOTIFY redirectUrlChanged FINAL) |
19 | public: |
20 | Q_IMPLICIT QOAuthUriSchemeReplyHandler() : QOAuthUriSchemeReplyHandler(nullptr) {} |
21 | explicit QOAuthUriSchemeReplyHandler(QObject *parent); |
22 | explicit QOAuthUriSchemeReplyHandler(const QUrl &redirectUrl, QObject *parent = nullptr); |
23 | ~QOAuthUriSchemeReplyHandler() override; |
24 | |
25 | QString callback() const override; |
26 | |
27 | void setRedirectUrl(const QUrl &url); |
28 | QUrl redirectUrl() const; |
29 | |
30 | bool listen(); |
31 | void close(); |
32 | bool isListening() const noexcept; |
33 | |
34 | Q_SIGNALS: |
35 | void redirectUrlChanged(); |
36 | |
37 | private: |
38 | Q_DISABLE_COPY(QOAuthUriSchemeReplyHandler) |
39 | Q_DECLARE_PRIVATE(QOAuthUriSchemeReplyHandler) |
40 | // Private slot for providing a callback slot for QDesktopServices::setUrlHandler |
41 | Q_PRIVATE_SLOT(d_func(), void _q_handleRedirectUrl(const QUrl &url)) |
42 | }; |
43 | |
44 | QT_END_NAMESPACE |
45 | |
46 | #endif // QOAUTHURISCHEMEREPLYHANDLER_H |
47 |