diff --git a/src/lib/adblock/adblocksubscription.h b/src/lib/adblock/adblocksubscription.h index 0e54de717..762b65aa6 100644 --- a/src/lib/adblock/adblocksubscription.h +++ b/src/lib/adblock/adblocksubscription.h @@ -53,8 +53,6 @@ #include "adblockrule.h" #include "adblocksearchtree.h" -class QNetworkRequest; -class QNetworkReply; class QUrl; class FollowRedirectReply; diff --git a/src/lib/app/browserwindow.cpp b/src/lib/app/browserwindow.cpp index b04aa29b0..78df56b83 100644 --- a/src/lib/app/browserwindow.cpp +++ b/src/lib/app/browserwindow.cpp @@ -74,7 +74,6 @@ #include #include #include -#include #include #include #include @@ -225,10 +224,7 @@ void BrowserWindow::postLaunch() } if (addTab) { - QNetworkRequest request(startUrl); - request.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1")); - - m_tabWidget->addView(request, Qz::NT_CleanSelectedTabAtTheEnd); + m_tabWidget->addView(startUrl, Qz::NT_CleanSelectedTabAtTheEnd); if (startUrl.isEmpty() || startUrl.toString() == QLatin1String("qupzilla:speeddial")) { locationBar()->setFocus(); @@ -237,10 +233,7 @@ void BrowserWindow::postLaunch() // Something went really wrong .. add one tab if (m_tabWidget->tabBar()->normalTabsCount() <= 0) { - QNetworkRequest request(m_homepage); - request.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1")); - - m_tabWidget->addView(request, Qz::NT_SelectedTabAtTheEnd); + m_tabWidget->addView(m_homepage, Qz::NT_SelectedTabAtTheEnd); } mApp->plugins()->emitMainWindowCreated(this); diff --git a/src/lib/autofill/autofill.cpp b/src/lib/autofill/autofill.cpp index e877b2789..13393f6a1 100644 --- a/src/lib/autofill/autofill.cpp +++ b/src/lib/autofill/autofill.cpp @@ -30,7 +30,6 @@ #include #include -#include #include #include diff --git a/src/lib/autofill/autofill.h b/src/lib/autofill/autofill.h index 92e992823..53c35f7bc 100644 --- a/src/lib/autofill/autofill.h +++ b/src/lib/autofill/autofill.h @@ -24,7 +24,6 @@ class QUrl; class QWebEnginePage; -class QNetworkRequest; class WebPage; class BrowserWindow; diff --git a/src/lib/downloads/downloadmanager.cpp b/src/lib/downloads/downloadmanager.cpp index 7fb20843d..b9409b06d 100644 --- a/src/lib/downloads/downloadmanager.cpp +++ b/src/lib/downloads/downloadmanager.cpp @@ -55,8 +55,6 @@ DownloadManager::DownloadManager(QWidget* parent) ui->clearButton->setIcon(QIcon::fromTheme("edit-clear")); QzTools::centerWidgetOnScreen(this); - m_networkManager = mApp->networkManager(); - connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clearList())); QShortcut* clearShortcut = new QShortcut(QKeySequence("CTRL+L"), this); diff --git a/src/lib/downloads/downloadmanager.h b/src/lib/downloads/downloadmanager.h index a19ad9edf..fb226a985 100644 --- a/src/lib/downloads/downloadmanager.h +++ b/src/lib/downloads/downloadmanager.h @@ -29,8 +29,6 @@ class DownloadManager; } class QUrl; -class QNetworkReply; -class QNetworkRequest; class QNetworkAccessManager; class QListWidgetItem; class QWebEngineDownloadItem; @@ -101,7 +99,6 @@ private: void keyPressEvent(QKeyEvent* e); Ui::DownloadManager* ui; - QNetworkAccessManager* m_networkManager; QBasicTimer m_timer; QString m_lastDownloadPath; diff --git a/src/lib/opensearch/searchenginesmanager.cpp b/src/lib/opensearch/searchenginesmanager.cpp index 81577ef03..2a9ab6370 100644 --- a/src/lib/opensearch/searchenginesmanager.cpp +++ b/src/lib/opensearch/searchenginesmanager.cpp @@ -145,8 +145,7 @@ LoadRequest SearchEnginesManager::searchResult(const Engine &engine, const QStri QByteArray data = engine.postData; data.replace("%s", QUrl::toPercentEncoding(string)); - QNetworkRequest req(QUrl::fromEncoded(engine.url.toUtf8())); - return LoadRequest(req, LoadRequest::PostOperation, data); + return LoadRequest(QUrl::fromEncoded(engine.url.toUtf8()), LoadRequest::PostOperation, data); } LoadRequest SearchEnginesManager::searchResult(const QString &string) diff --git a/src/lib/opensearch/searchenginesmanager.h b/src/lib/opensearch/searchenginesmanager.h index 9feb41f81..123037d1a 100644 --- a/src/lib/opensearch/searchenginesmanager.h +++ b/src/lib/opensearch/searchenginesmanager.h @@ -22,7 +22,6 @@ #include #include #include -#include #include "qzcommon.h" #include "opensearchengine.h" diff --git a/src/lib/other/updater.cpp b/src/lib/other/updater.cpp index 9f72eb1b8..8dc199737 100644 --- a/src/lib/other/updater.cpp +++ b/src/lib/other/updater.cpp @@ -21,9 +21,9 @@ #include "mainapplication.h" #include "tabwidget.h" #include "desktopnotificationsfactory.h" +#include "networkmanager.h" #include -#include #include #include @@ -129,14 +129,17 @@ void Updater::start() void Updater::startDownloadingUpdateInfo(const QUrl &url) { - QNetworkAccessManager* manager = new QNetworkAccessManager(); - manager->get(QNetworkRequest(QUrl(url))); + QNetworkReply *reply = mApp->networkManager()->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(sender()); + if (!reply) + return; + QString html = reply->readAll(); if (html.startsWith(QLatin1String("Version:"))) { @@ -149,14 +152,10 @@ void Updater::downCompleted(QNetworkReply* reply) } } - reply->manager()->deleteLater(); + reply->deleteLater(); } void Updater::downloadNewVersion() { m_window->tabWidget()->addView(QUrl::fromEncoded(QByteArray(Qz::WWWADDRESS) + QByteArray("/download")), tr("Update"), Qz::NT_NotSelectedTab); } - -Updater::~Updater() -{ -} diff --git a/src/lib/other/updater.h b/src/lib/other/updater.h index 8aac9e91c..0a23b07e5 100644 --- a/src/lib/other/updater.h +++ b/src/lib/other/updater.h @@ -32,7 +32,6 @@ class QUPZILLA_EXPORT Updater : public QObject Q_OBJECT public: explicit Updater(BrowserWindow* window, QObject* parent = 0); - ~Updater(); struct QUPZILLA_EXPORT Version { bool isValid; @@ -53,7 +52,7 @@ public: }; private slots: - void downCompleted(QNetworkReply* reply); + void downCompleted(); void start(); void downloadNewVersion(); diff --git a/src/lib/tabwidget/tabwidget.cpp b/src/lib/tabwidget/tabwidget.cpp index 967792719..2b040e2ee 100644 --- a/src/lib/tabwidget/tabwidget.cpp +++ b/src/lib/tabwidget/tabwidget.cpp @@ -625,11 +625,7 @@ int TabWidget::duplicateTab(int index) const QString title = webTab->title(); const QByteArray history = webTab->historyData(); - QNetworkRequest req(url); - req.setRawHeader("Referer", url.toEncoded()); - req.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1")); - - int id = addView(req, title, Qz::NT_CleanNotSelectedTab); + int id = addView(url, title, Qz::NT_CleanNotSelectedTab); weTab(id)->setHistoryData(history); return id; diff --git a/src/lib/tabwidget/tabwidget.h b/src/lib/tabwidget/tabwidget.h index 28e44190e..28b074a1a 100644 --- a/src/lib/tabwidget/tabwidget.h +++ b/src/lib/tabwidget/tabwidget.h @@ -19,7 +19,6 @@ #define TABWIDGET_H #include -#include #include #include "tabstackedwidget.h" diff --git a/src/lib/webengine/loadrequest.cpp b/src/lib/webengine/loadrequest.cpp index 19c9336af..6065644a7 100644 --- a/src/lib/webengine/loadrequest.cpp +++ b/src/lib/webengine/loadrequest.cpp @@ -17,28 +17,20 @@ * ============================================================ */ #include "loadrequest.h" -#include - LoadRequest::LoadRequest() : m_operation(GetOperation) { } LoadRequest::LoadRequest(const LoadRequest &other) - : m_request(other.m_request) + : m_url(other.m_url) , m_operation(other.m_operation) , m_data(other.m_data) { } -LoadRequest::LoadRequest(const QUrl &url) - : m_operation(GetOperation) -{ - setUrl(url); -} - -LoadRequest::LoadRequest(const QNetworkRequest &req, LoadRequest::Operation op, const QByteArray &data) - : m_request(req) +LoadRequest::LoadRequest(const QUrl &url, LoadRequest::Operation op, const QByteArray &data) + : m_url(url) , m_operation(op) , m_data(data) { @@ -46,7 +38,7 @@ LoadRequest::LoadRequest(const QNetworkRequest &req, LoadRequest::Operation op, LoadRequest &LoadRequest::operator=(const LoadRequest &other) { - m_request = other.m_request; + m_url = other.m_url; m_operation = other.m_operation; m_data = other.m_data; return *this; @@ -54,32 +46,22 @@ LoadRequest &LoadRequest::operator=(const LoadRequest &other) bool LoadRequest::isEmpty() const { - return m_request.url().isEmpty(); + return m_url.isEmpty(); } QUrl LoadRequest::url() const { - return m_request.url(); + return m_url; } void LoadRequest::setUrl(const QUrl &url) { - m_request.setUrl(url); + m_url = url; } QString LoadRequest::urlString() const { - return QUrl::fromPercentEncoding(m_request.url().toEncoded()); -} - -QNetworkRequest LoadRequest::networkRequest() const -{ - return m_request; -} - -void LoadRequest::setNetworkRequest(const QNetworkRequest &req) -{ - m_request = req; + return QUrl::fromPercentEncoding(m_url.toEncoded()); } LoadRequest::Operation LoadRequest::operation() const diff --git a/src/lib/webengine/loadrequest.h b/src/lib/webengine/loadrequest.h index 289234193..59e87c323 100644 --- a/src/lib/webengine/loadrequest.h +++ b/src/lib/webengine/loadrequest.h @@ -18,12 +18,10 @@ #ifndef LOADREQUEST_H #define LOADREQUEST_H -#include +#include #include "qzcommon.h" -class QWebView; - class QUPZILLA_EXPORT LoadRequest { public: @@ -34,8 +32,7 @@ public: LoadRequest(); LoadRequest(const LoadRequest &other); - LoadRequest(const QUrl &url); - LoadRequest(const QNetworkRequest &req, Operation op = GetOperation, const QByteArray &data = QByteArray()); + LoadRequest(const QUrl &url, Operation op = GetOperation, const QByteArray &data = QByteArray()); LoadRequest &operator=(const LoadRequest &other); @@ -46,9 +43,6 @@ public: QString urlString() const; - QNetworkRequest networkRequest() const; - void setNetworkRequest(const QNetworkRequest &req); - Operation operation() const; void setOperation(Operation op); @@ -56,7 +50,7 @@ public: void setData(const QByteArray &data); private: - QNetworkRequest m_request; + QUrl m_url; Operation m_operation; QByteArray m_data; }; diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp index c72fca11f..d859a8d6b 100644 --- a/src/lib/webengine/webview.cpp +++ b/src/lib/webengine/webview.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -451,10 +450,7 @@ void WebView::downloadMediaToDisk() void WebView::openUrlInNewTab(const QUrl &url, Qz::NewTabPositionFlags position) { - QNetworkRequest request(url); - request.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1")); - - loadInNewTab(request, position); + loadInNewTab(url, position); } void WebView::openActionUrl() @@ -495,12 +491,7 @@ void WebView::searchSelectedText() } } - 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); - + const LoadRequest req = mApp->searchEnginesManager()->searchResult(engine, selectedText()); loadInNewTab(req, Qz::NT_SelectedTab); } @@ -513,12 +504,7 @@ void WebView::searchSelectedTextInBackgroundTab() } } - 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); - + const LoadRequest req = mApp->searchEnginesManager()->searchResult(engine, selectedText()); loadInNewTab(req, Qz::NT_NotSelectedTab); } diff --git a/src/lib/webtab/tabbedwebview.cpp b/src/lib/webtab/tabbedwebview.cpp index a9a81eeae..d206c0b6e 100644 --- a/src/lib/webtab/tabbedwebview.cpp +++ b/src/lib/webtab/tabbedwebview.cpp @@ -102,13 +102,7 @@ void TabbedWebView::slotLoadProgress(int prog) void TabbedWebView::userLoadAction(const LoadRequest &req) { - QNetworkRequest request(req.networkRequest()); - request.setRawHeader("X-QupZilla-UserLoadAction", QByteArray("1")); - - LoadRequest r = req; - r.setNetworkRequest(request); - - load(r); + load(req); } void TabbedWebView::slotLoadStarted() diff --git a/src/plugins/GreaseMonkey/gm_downloader.h b/src/plugins/GreaseMonkey/gm_downloader.h index 19eba794d..31f79eed6 100644 --- a/src/plugins/GreaseMonkey/gm_downloader.h +++ b/src/plugins/GreaseMonkey/gm_downloader.h @@ -22,8 +22,6 @@ #include #include -class QNetworkRequest; - class GM_Manager; class FollowRedirectReply; diff --git a/src/plugins/GreaseMonkey/gm_manager.h b/src/plugins/GreaseMonkey/gm_manager.h index 87e2ca0f8..71c70e239 100644 --- a/src/plugins/GreaseMonkey/gm_manager.h +++ b/src/plugins/GreaseMonkey/gm_manager.h @@ -25,7 +25,6 @@ class QUrl; class QWebFrame; -class QNetworkRequest; class BrowserWindow; class GM_Script; diff --git a/src/plugins/GreaseMonkey/gm_plugin.cpp b/src/plugins/GreaseMonkey/gm_plugin.cpp index 0875186ab..88be9379c 100644 --- a/src/plugins/GreaseMonkey/gm_plugin.cpp +++ b/src/plugins/GreaseMonkey/gm_plugin.cpp @@ -27,7 +27,6 @@ #include "tabbedwebview.h" #include -#include GM_Plugin::GM_Plugin() : QObject()