Falkon Develop
Cross-platform Qt-based web browser
qmlwebengineurlrequestjob.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2018 Anmol Gautam <tarptaeya@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#pragma once
19
20#include <QWebEngineUrlRequestJob>
21
25class QmlWebEngineUrlRequestJob : public QObject
26{
27 Q_OBJECT
31 Q_PROPERTY(QString initiator READ initiator CONSTANT)
35 Q_PROPERTY(QString requestUrl READ requestUrl CONSTANT)
39 Q_PROPERTY(QString requestMethod READ requestMethod CONSTANT)
40public:
44 enum Error {
45 NoError = QWebEngineUrlRequestJob::NoError,
46 UrlNotFound = QWebEngineUrlRequestJob::UrlNotFound,
47 UrlInvaild = QWebEngineUrlRequestJob::UrlInvalid,
48 RequestAborted = QWebEngineUrlRequestJob::RequestAborted,
49 RequestDenied = QWebEngineUrlRequestJob::RequestDenied,
50 RequestFailed = QWebEngineUrlRequestJob::RequestFailed
51 };
52 Q_ENUM(Error)
53 explicit QmlWebEngineUrlRequestJob(QWebEngineUrlRequestJob *job = nullptr, QObject *parent = nullptr);
58 Q_INVOKABLE void fail(QmlWebEngineUrlRequestJob::Error error);
63 Q_INVOKABLE void redirect(const QString &urlString);
70 Q_INVOKABLE void reply(const QVariantMap &map);
71private:
72 QWebEngineUrlRequestJob *m_job = nullptr;
73 QString initiator() const;
74 QString requestUrl() const;
75 QString requestMethod() const;
76};
The QmlWebEngineUrlRequestJob class.
QString requestUrl
request url of the QWebEngineUrlRequestJob
Q_INVOKABLE void redirect(const QString &urlString)
Redirects the request to the url.
QmlWebEngineUrlRequestJob(QWebEngineUrlRequestJob *job=nullptr, QObject *parent=nullptr)
QString requestMethod
request method of the QWebEngineUrlRequestJob
Q_INVOKABLE void fail(QmlWebEngineUrlRequestJob::Error error)
Fails the request with the error.
Q_INVOKABLE void reply(const QVariantMap &map)
Replies to the request.
Error
The Error enum, exposes QWebEngineUrlRequestJob::Error to QML.
QString initiator
initiator of the QWebEngineUrlRequestJob