mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
Use QWebEngineHttpRequest with Qt 5.9
This commit is contained in:
parent
fcc3cf1809
commit
f0b8ac2daa
@ -1,6 +1,6 @@
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* QupZilla - Qt web browser
|
||||||
* Copyright (C) 2014 David Rosca <nowrep@gmail.com>
|
* Copyright (C) 2014-2017 David Rosca <nowrep@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -83,3 +83,12 @@ void LoadRequest::setData(const QByteArray &data)
|
|||||||
{
|
{
|
||||||
m_data = data;
|
m_data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
|
||||||
|
QWebEngineHttpRequest LoadRequest::webRequest() const
|
||||||
|
{
|
||||||
|
QWebEngineHttpRequest req(m_url, m_operation == GetOperation ? QWebEngineHttpRequest::Get : QWebEngineHttpRequest::Post);
|
||||||
|
req.setPostData(m_data);
|
||||||
|
return req;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* QupZilla - Qt web browser
|
||||||
* Copyright (C) 2014 David Rosca <nowrep@gmail.com>
|
* Copyright (C) 2014-2017 David Rosca <nowrep@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,6 +20,10 @@
|
|||||||
|
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
|
||||||
|
#include <QWebEngineHttpRequest>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "qzcommon.h"
|
#include "qzcommon.h"
|
||||||
|
|
||||||
class QUPZILLA_EXPORT LoadRequest
|
class QUPZILLA_EXPORT LoadRequest
|
||||||
@ -49,6 +53,10 @@ public:
|
|||||||
QByteArray data() const;
|
QByteArray data() const;
|
||||||
void setData(const QByteArray &data);
|
void setData(const QByteArray &data);
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
|
||||||
|
QWebEngineHttpRequest webRequest() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QUrl m_url;
|
QUrl m_url;
|
||||||
Operation m_operation;
|
Operation m_operation;
|
||||||
|
@ -1254,10 +1254,14 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
|
|
||||||
void WebView::loadRequest(const LoadRequest &req)
|
void WebView::loadRequest(const LoadRequest &req)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
|
||||||
|
QWebEngineView::load(req.webRequest());
|
||||||
|
#else
|
||||||
if (req.operation() == LoadRequest::GetOperation)
|
if (req.operation() == LoadRequest::GetOperation)
|
||||||
load(req.url());
|
load(req.url());
|
||||||
else
|
else
|
||||||
page()->runJavaScript(Scripts::sendPostData(req.url(), req.data()), WebPage::SafeJsWorld);
|
page()->runJavaScript(Scripts::sendPostData(req.url(), req.data()), WebPage::SafeJsWorld);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebView::eventFilter(QObject *obj, QEvent *event)
|
bool WebView::eventFilter(QObject *obj, QEvent *event)
|
||||||
|
Loading…
Reference in New Issue
Block a user