mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
Remove use of QNetworkRequest in LoadRequest
This commit is contained in:
parent
1a87d443c0
commit
db058ff194
|
@ -53,8 +53,6 @@
|
||||||
#include "adblockrule.h"
|
#include "adblockrule.h"
|
||||||
#include "adblocksearchtree.h"
|
#include "adblocksearchtree.h"
|
||||||
|
|
||||||
class QNetworkRequest;
|
|
||||||
class QNetworkReply;
|
|
||||||
class QUrl;
|
class QUrl;
|
||||||
|
|
||||||
class FollowRedirectReply;
|
class FollowRedirectReply;
|
||||||
|
|
|
@ -74,7 +74,6 @@
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QNetworkRequest>
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QWebEngineHistory>
|
#include <QWebEngineHistory>
|
||||||
#include <QWebEngineSettings>
|
#include <QWebEngineSettings>
|
||||||
|
@ -225,10 +224,7 @@ void BrowserWindow::postLaunch()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addTab) {
|
if (addTab) {
|
||||||
QNetworkRequest request(startUrl);
|
m_tabWidget->addView(startUrl, Qz::NT_CleanSelectedTabAtTheEnd);
|
||||||
request.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1"));
|
|
||||||
|
|
||||||
m_tabWidget->addView(request, Qz::NT_CleanSelectedTabAtTheEnd);
|
|
||||||
|
|
||||||
if (startUrl.isEmpty() || startUrl.toString() == QLatin1String("qupzilla:speeddial")) {
|
if (startUrl.isEmpty() || startUrl.toString() == QLatin1String("qupzilla:speeddial")) {
|
||||||
locationBar()->setFocus();
|
locationBar()->setFocus();
|
||||||
|
@ -237,10 +233,7 @@ void BrowserWindow::postLaunch()
|
||||||
|
|
||||||
// Something went really wrong .. add one tab
|
// Something went really wrong .. add one tab
|
||||||
if (m_tabWidget->tabBar()->normalTabsCount() <= 0) {
|
if (m_tabWidget->tabBar()->normalTabsCount() <= 0) {
|
||||||
QNetworkRequest request(m_homepage);
|
m_tabWidget->addView(m_homepage, Qz::NT_SelectedTabAtTheEnd);
|
||||||
request.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1"));
|
|
||||||
|
|
||||||
m_tabWidget->addView(request, Qz::NT_SelectedTabAtTheEnd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mApp->plugins()->emitMainWindowCreated(this);
|
mApp->plugins()->emitMainWindowCreated(this);
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
#include <QXmlStreamWriter>
|
#include <QXmlStreamWriter>
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
#include <QNetworkRequest>
|
|
||||||
#include <QWebEngineProfile>
|
#include <QWebEngineProfile>
|
||||||
#include <QWebEngineScriptCollection>
|
#include <QWebEngineScriptCollection>
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
class QUrl;
|
class QUrl;
|
||||||
class QWebEnginePage;
|
class QWebEnginePage;
|
||||||
class QNetworkRequest;
|
|
||||||
|
|
||||||
class WebPage;
|
class WebPage;
|
||||||
class BrowserWindow;
|
class BrowserWindow;
|
||||||
|
|
|
@ -55,8 +55,6 @@ DownloadManager::DownloadManager(QWidget* parent)
|
||||||
ui->clearButton->setIcon(QIcon::fromTheme("edit-clear"));
|
ui->clearButton->setIcon(QIcon::fromTheme("edit-clear"));
|
||||||
QzTools::centerWidgetOnScreen(this);
|
QzTools::centerWidgetOnScreen(this);
|
||||||
|
|
||||||
m_networkManager = mApp->networkManager();
|
|
||||||
|
|
||||||
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clearList()));
|
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clearList()));
|
||||||
|
|
||||||
QShortcut* clearShortcut = new QShortcut(QKeySequence("CTRL+L"), this);
|
QShortcut* clearShortcut = new QShortcut(QKeySequence("CTRL+L"), this);
|
||||||
|
|
|
@ -29,8 +29,6 @@ class DownloadManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
class QUrl;
|
class QUrl;
|
||||||
class QNetworkReply;
|
|
||||||
class QNetworkRequest;
|
|
||||||
class QNetworkAccessManager;
|
class QNetworkAccessManager;
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
class QWebEngineDownloadItem;
|
class QWebEngineDownloadItem;
|
||||||
|
@ -101,7 +99,6 @@ private:
|
||||||
void keyPressEvent(QKeyEvent* e);
|
void keyPressEvent(QKeyEvent* e);
|
||||||
|
|
||||||
Ui::DownloadManager* ui;
|
Ui::DownloadManager* ui;
|
||||||
QNetworkAccessManager* m_networkManager;
|
|
||||||
QBasicTimer m_timer;
|
QBasicTimer m_timer;
|
||||||
|
|
||||||
QString m_lastDownloadPath;
|
QString m_lastDownloadPath;
|
||||||
|
|
|
@ -145,8 +145,7 @@ LoadRequest SearchEnginesManager::searchResult(const Engine &engine, const QStri
|
||||||
QByteArray data = engine.postData;
|
QByteArray data = engine.postData;
|
||||||
data.replace("%s", QUrl::toPercentEncoding(string));
|
data.replace("%s", QUrl::toPercentEncoding(string));
|
||||||
|
|
||||||
QNetworkRequest req(QUrl::fromEncoded(engine.url.toUtf8()));
|
return LoadRequest(QUrl::fromEncoded(engine.url.toUtf8()), LoadRequest::PostOperation, data);
|
||||||
return LoadRequest(req, LoadRequest::PostOperation, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadRequest SearchEnginesManager::searchResult(const QString &string)
|
LoadRequest SearchEnginesManager::searchResult(const QString &string)
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QNetworkRequest>
|
|
||||||
|
|
||||||
#include "qzcommon.h"
|
#include "qzcommon.h"
|
||||||
#include "opensearchengine.h"
|
#include "opensearchengine.h"
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
#include "mainapplication.h"
|
#include "mainapplication.h"
|
||||||
#include "tabwidget.h"
|
#include "tabwidget.h"
|
||||||
#include "desktopnotificationsfactory.h"
|
#include "desktopnotificationsfactory.h"
|
||||||
|
#include "networkmanager.h"
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
|
||||||
|
@ -129,14 +129,17 @@ void Updater::start()
|
||||||
|
|
||||||
void Updater::startDownloadingUpdateInfo(const QUrl &url)
|
void Updater::startDownloadingUpdateInfo(const QUrl &url)
|
||||||
{
|
{
|
||||||
QNetworkAccessManager* manager = new QNetworkAccessManager();
|
QNetworkReply *reply = mApp->networkManager()->get(QNetworkRequest(QUrl(url)));
|
||||||
manager->get(QNetworkRequest(QUrl(url)));
|
|
||||||
|
|
||||||
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(downCompleted(QNetworkReply*)));
|
connect(reply, SIGNAL(finished()), this, SLOT(downCompleted()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Updater::downCompleted(QNetworkReply* reply)
|
void Updater::downCompleted()
|
||||||
{
|
{
|
||||||
|
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
|
||||||
|
if (!reply)
|
||||||
|
return;
|
||||||
|
|
||||||
QString html = reply->readAll();
|
QString html = reply->readAll();
|
||||||
|
|
||||||
if (html.startsWith(QLatin1String("Version:"))) {
|
if (html.startsWith(QLatin1String("Version:"))) {
|
||||||
|
@ -149,14 +152,10 @@ void Updater::downCompleted(QNetworkReply* reply)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reply->manager()->deleteLater();
|
reply->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Updater::downloadNewVersion()
|
void Updater::downloadNewVersion()
|
||||||
{
|
{
|
||||||
m_window->tabWidget()->addView(QUrl::fromEncoded(QByteArray(Qz::WWWADDRESS) + QByteArray("/download")), tr("Update"), Qz::NT_NotSelectedTab);
|
m_window->tabWidget()->addView(QUrl::fromEncoded(QByteArray(Qz::WWWADDRESS) + QByteArray("/download")), tr("Update"), Qz::NT_NotSelectedTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
Updater::~Updater()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ class QUPZILLA_EXPORT Updater : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit Updater(BrowserWindow* window, QObject* parent = 0);
|
explicit Updater(BrowserWindow* window, QObject* parent = 0);
|
||||||
~Updater();
|
|
||||||
|
|
||||||
struct QUPZILLA_EXPORT Version {
|
struct QUPZILLA_EXPORT Version {
|
||||||
bool isValid;
|
bool isValid;
|
||||||
|
@ -53,7 +52,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void downCompleted(QNetworkReply* reply);
|
void downCompleted();
|
||||||
void start();
|
void start();
|
||||||
void downloadNewVersion();
|
void downloadNewVersion();
|
||||||
|
|
||||||
|
|
|
@ -625,11 +625,7 @@ int TabWidget::duplicateTab(int index)
|
||||||
const QString title = webTab->title();
|
const QString title = webTab->title();
|
||||||
const QByteArray history = webTab->historyData();
|
const QByteArray history = webTab->historyData();
|
||||||
|
|
||||||
QNetworkRequest req(url);
|
int id = addView(url, title, Qz::NT_CleanNotSelectedTab);
|
||||||
req.setRawHeader("Referer", url.toEncoded());
|
|
||||||
req.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1"));
|
|
||||||
|
|
||||||
int id = addView(req, title, Qz::NT_CleanNotSelectedTab);
|
|
||||||
weTab(id)->setHistoryData(history);
|
weTab(id)->setHistoryData(history);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#define TABWIDGET_H
|
#define TABWIDGET_H
|
||||||
|
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QNetworkRequest>
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
#include "tabstackedwidget.h"
|
#include "tabstackedwidget.h"
|
||||||
|
|
|
@ -17,28 +17,20 @@
|
||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
#include "loadrequest.h"
|
#include "loadrequest.h"
|
||||||
|
|
||||||
#include <QWebEngineView>
|
|
||||||
|
|
||||||
LoadRequest::LoadRequest()
|
LoadRequest::LoadRequest()
|
||||||
: m_operation(GetOperation)
|
: m_operation(GetOperation)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadRequest::LoadRequest(const LoadRequest &other)
|
LoadRequest::LoadRequest(const LoadRequest &other)
|
||||||
: m_request(other.m_request)
|
: m_url(other.m_url)
|
||||||
, m_operation(other.m_operation)
|
, m_operation(other.m_operation)
|
||||||
, m_data(other.m_data)
|
, m_data(other.m_data)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadRequest::LoadRequest(const QUrl &url)
|
LoadRequest::LoadRequest(const QUrl &url, LoadRequest::Operation op, const QByteArray &data)
|
||||||
: m_operation(GetOperation)
|
: m_url(url)
|
||||||
{
|
|
||||||
setUrl(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadRequest::LoadRequest(const QNetworkRequest &req, LoadRequest::Operation op, const QByteArray &data)
|
|
||||||
: m_request(req)
|
|
||||||
, m_operation(op)
|
, m_operation(op)
|
||||||
, m_data(data)
|
, m_data(data)
|
||||||
{
|
{
|
||||||
|
@ -46,7 +38,7 @@ LoadRequest::LoadRequest(const QNetworkRequest &req, LoadRequest::Operation op,
|
||||||
|
|
||||||
LoadRequest &LoadRequest::operator=(const LoadRequest &other)
|
LoadRequest &LoadRequest::operator=(const LoadRequest &other)
|
||||||
{
|
{
|
||||||
m_request = other.m_request;
|
m_url = other.m_url;
|
||||||
m_operation = other.m_operation;
|
m_operation = other.m_operation;
|
||||||
m_data = other.m_data;
|
m_data = other.m_data;
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -54,32 +46,22 @@ LoadRequest &LoadRequest::operator=(const LoadRequest &other)
|
||||||
|
|
||||||
bool LoadRequest::isEmpty() const
|
bool LoadRequest::isEmpty() const
|
||||||
{
|
{
|
||||||
return m_request.url().isEmpty();
|
return m_url.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl LoadRequest::url() const
|
QUrl LoadRequest::url() const
|
||||||
{
|
{
|
||||||
return m_request.url();
|
return m_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadRequest::setUrl(const QUrl &url)
|
void LoadRequest::setUrl(const QUrl &url)
|
||||||
{
|
{
|
||||||
m_request.setUrl(url);
|
m_url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LoadRequest::urlString() const
|
QString LoadRequest::urlString() const
|
||||||
{
|
{
|
||||||
return QUrl::fromPercentEncoding(m_request.url().toEncoded());
|
return QUrl::fromPercentEncoding(m_url.toEncoded());
|
||||||
}
|
|
||||||
|
|
||||||
QNetworkRequest LoadRequest::networkRequest() const
|
|
||||||
{
|
|
||||||
return m_request;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoadRequest::setNetworkRequest(const QNetworkRequest &req)
|
|
||||||
{
|
|
||||||
m_request = req;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadRequest::Operation LoadRequest::operation() const
|
LoadRequest::Operation LoadRequest::operation() const
|
||||||
|
|
|
@ -18,12 +18,10 @@
|
||||||
#ifndef LOADREQUEST_H
|
#ifndef LOADREQUEST_H
|
||||||
#define LOADREQUEST_H
|
#define LOADREQUEST_H
|
||||||
|
|
||||||
#include <QNetworkRequest>
|
#include <QUrl>
|
||||||
|
|
||||||
#include "qzcommon.h"
|
#include "qzcommon.h"
|
||||||
|
|
||||||
class QWebView;
|
|
||||||
|
|
||||||
class QUPZILLA_EXPORT LoadRequest
|
class QUPZILLA_EXPORT LoadRequest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -34,8 +32,7 @@ public:
|
||||||
|
|
||||||
LoadRequest();
|
LoadRequest();
|
||||||
LoadRequest(const LoadRequest &other);
|
LoadRequest(const LoadRequest &other);
|
||||||
LoadRequest(const QUrl &url);
|
LoadRequest(const QUrl &url, Operation op = GetOperation, const QByteArray &data = QByteArray());
|
||||||
LoadRequest(const QNetworkRequest &req, Operation op = GetOperation, const QByteArray &data = QByteArray());
|
|
||||||
|
|
||||||
LoadRequest &operator=(const LoadRequest &other);
|
LoadRequest &operator=(const LoadRequest &other);
|
||||||
|
|
||||||
|
@ -46,9 +43,6 @@ public:
|
||||||
|
|
||||||
QString urlString() const;
|
QString urlString() const;
|
||||||
|
|
||||||
QNetworkRequest networkRequest() const;
|
|
||||||
void setNetworkRequest(const QNetworkRequest &req);
|
|
||||||
|
|
||||||
Operation operation() const;
|
Operation operation() const;
|
||||||
void setOperation(Operation op);
|
void setOperation(Operation op);
|
||||||
|
|
||||||
|
@ -56,7 +50,7 @@ public:
|
||||||
void setData(const QByteArray &data);
|
void setData(const QByteArray &data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QNetworkRequest m_request;
|
QUrl m_url;
|
||||||
Operation m_operation;
|
Operation m_operation;
|
||||||
QByteArray m_data;
|
QByteArray m_data;
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QNetworkRequest>
|
|
||||||
#include <QWebEngineHistory>
|
#include <QWebEngineHistory>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QHostInfo>
|
#include <QHostInfo>
|
||||||
|
@ -451,10 +450,7 @@ void WebView::downloadMediaToDisk()
|
||||||
|
|
||||||
void WebView::openUrlInNewTab(const QUrl &url, Qz::NewTabPositionFlags position)
|
void WebView::openUrlInNewTab(const QUrl &url, Qz::NewTabPositionFlags position)
|
||||||
{
|
{
|
||||||
QNetworkRequest request(url);
|
loadInNewTab(url, position);
|
||||||
request.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1"));
|
|
||||||
|
|
||||||
loadInNewTab(request, position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebView::openActionUrl()
|
void WebView::openActionUrl()
|
||||||
|
@ -495,12 +491,7 @@ void WebView::searchSelectedText()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadRequest req = mApp->searchEnginesManager()->searchResult(engine, selectedText());
|
const LoadRequest req = mApp->searchEnginesManager()->searchResult(engine, selectedText());
|
||||||
QNetworkRequest r = req.networkRequest();
|
|
||||||
r.setRawHeader("Referer", req.url().toEncoded());
|
|
||||||
r.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1"));
|
|
||||||
req.setNetworkRequest(r);
|
|
||||||
|
|
||||||
loadInNewTab(req, Qz::NT_SelectedTab);
|
loadInNewTab(req, Qz::NT_SelectedTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,12 +504,7 @@ void WebView::searchSelectedTextInBackgroundTab()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadRequest req = mApp->searchEnginesManager()->searchResult(engine, selectedText());
|
const LoadRequest req = mApp->searchEnginesManager()->searchResult(engine, selectedText());
|
||||||
QNetworkRequest r = req.networkRequest();
|
|
||||||
r.setRawHeader("Referer", req.url().toEncoded());
|
|
||||||
r.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1"));
|
|
||||||
req.setNetworkRequest(r);
|
|
||||||
|
|
||||||
loadInNewTab(req, Qz::NT_NotSelectedTab);
|
loadInNewTab(req, Qz::NT_NotSelectedTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,13 +102,7 @@ void TabbedWebView::slotLoadProgress(int prog)
|
||||||
|
|
||||||
void TabbedWebView::userLoadAction(const LoadRequest &req)
|
void TabbedWebView::userLoadAction(const LoadRequest &req)
|
||||||
{
|
{
|
||||||
QNetworkRequest request(req.networkRequest());
|
load(req);
|
||||||
request.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1"));
|
|
||||||
|
|
||||||
LoadRequest r = req;
|
|
||||||
r.setNetworkRequest(request);
|
|
||||||
|
|
||||||
load(r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabbedWebView::slotLoadStarted()
|
void TabbedWebView::slotLoadStarted()
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
class QNetworkRequest;
|
|
||||||
|
|
||||||
class GM_Manager;
|
class GM_Manager;
|
||||||
|
|
||||||
class FollowRedirectReply;
|
class FollowRedirectReply;
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
class QUrl;
|
class QUrl;
|
||||||
class QWebFrame;
|
class QWebFrame;
|
||||||
class QNetworkRequest;
|
|
||||||
|
|
||||||
class BrowserWindow;
|
class BrowserWindow;
|
||||||
class GM_Script;
|
class GM_Script;
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include "tabbedwebview.h"
|
#include "tabbedwebview.h"
|
||||||
|
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QNetworkRequest>
|
|
||||||
|
|
||||||
GM_Plugin::GM_Plugin()
|
GM_Plugin::GM_Plugin()
|
||||||
: QObject()
|
: QObject()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user