mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
Bring back NetworkManager class
This commit is contained in:
parent
f3fda02820
commit
b0da5ba755
@ -34,7 +34,6 @@
|
|||||||
#include "clearprivatedata.h"
|
#include "clearprivatedata.h"
|
||||||
#include "sourceviewer.h"
|
#include "sourceviewer.h"
|
||||||
#include "autofill.h"
|
#include "autofill.h"
|
||||||
#include "networkmanagerproxy.h"
|
|
||||||
#include "mainapplication.h"
|
#include "mainapplication.h"
|
||||||
#include "checkboxdialog.h"
|
#include "checkboxdialog.h"
|
||||||
#include "adblockmanager.h"
|
#include "adblockmanager.h"
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "iconprovider.h"
|
#include "iconprovider.h"
|
||||||
#include "browserwindow.h"
|
#include "browserwindow.h"
|
||||||
#include "checkboxdialog.h"
|
#include "checkboxdialog.h"
|
||||||
|
#include "networkmanager.h"
|
||||||
#include "profilemanager.h"
|
#include "profilemanager.h"
|
||||||
#include "adblockmanager.h"
|
#include "adblockmanager.h"
|
||||||
#include "restoremanager.h"
|
#include "restoremanager.h"
|
||||||
@ -537,10 +538,10 @@ BrowsingLibrary* MainApplication::browsingLibrary()
|
|||||||
return m_browsingLibrary;
|
return m_browsingLibrary;
|
||||||
}
|
}
|
||||||
|
|
||||||
QNetworkAccessManager* MainApplication::networkManager()
|
NetworkManager *MainApplication::networkManager()
|
||||||
{
|
{
|
||||||
if (!m_networkManager) {
|
if (!m_networkManager) {
|
||||||
m_networkManager = new QNetworkAccessManager(this);
|
m_networkManager = new NetworkManager(this);
|
||||||
}
|
}
|
||||||
return m_networkManager;
|
return m_networkManager;
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ class AutoSaver;
|
|||||||
class ProxyStyle;
|
class ProxyStyle;
|
||||||
class PluginProxy;
|
class PluginProxy;
|
||||||
class BrowserWindow;
|
class BrowserWindow;
|
||||||
|
class NetworkManager;
|
||||||
class BrowsingLibrary;
|
class BrowsingLibrary;
|
||||||
class DownloadManager;
|
class DownloadManager;
|
||||||
class UserAgentManager;
|
class UserAgentManager;
|
||||||
@ -99,7 +100,7 @@ public:
|
|||||||
PluginProxy* plugins();
|
PluginProxy* plugins();
|
||||||
BrowsingLibrary* browsingLibrary();
|
BrowsingLibrary* browsingLibrary();
|
||||||
|
|
||||||
QNetworkAccessManager* networkManager();
|
NetworkManager* networkManager();
|
||||||
RestoreManager* restoreManager();
|
RestoreManager* restoreManager();
|
||||||
DownloadManager* downloadManager();
|
DownloadManager* downloadManager();
|
||||||
UserAgentManager* userAgentManager();
|
UserAgentManager* userAgentManager();
|
||||||
@ -165,7 +166,7 @@ private:
|
|||||||
PluginProxy* m_plugins;
|
PluginProxy* m_plugins;
|
||||||
BrowsingLibrary* m_browsingLibrary;
|
BrowsingLibrary* m_browsingLibrary;
|
||||||
|
|
||||||
QNetworkAccessManager* m_networkManager;
|
NetworkManager* m_networkManager;
|
||||||
RestoreManager* m_restoreManager;
|
RestoreManager* m_restoreManager;
|
||||||
DownloadManager* m_downloadManager;
|
DownloadManager* m_downloadManager;
|
||||||
UserAgentManager* m_userAgentManager;
|
UserAgentManager* m_userAgentManager;
|
||||||
|
@ -130,8 +130,7 @@ SOURCES += \
|
|||||||
navigation/siteicon.cpp \
|
navigation/siteicon.cpp \
|
||||||
navigation/websearchbar.cpp \
|
navigation/websearchbar.cpp \
|
||||||
#network/cabundleupdater.cpp \
|
#network/cabundleupdater.cpp \
|
||||||
#network/networkmanager.cpp \
|
network/networkmanager.cpp \
|
||||||
network/networkmanagerproxy.cpp \
|
|
||||||
network/networkproxyfactory.cpp \
|
network/networkproxyfactory.cpp \
|
||||||
network/pac/pacmanager.cpp \
|
network/pac/pacmanager.cpp \
|
||||||
network/pac/proxyautoconfig.cpp \
|
network/pac/proxyautoconfig.cpp \
|
||||||
@ -325,8 +324,7 @@ HEADERS += \
|
|||||||
navigation/siteicon.h \
|
navigation/siteicon.h \
|
||||||
navigation/websearchbar.h \
|
navigation/websearchbar.h \
|
||||||
#network/cabundleupdater.h \
|
#network/cabundleupdater.h \
|
||||||
#network/networkmanager.h \
|
network/networkmanager.h \
|
||||||
network/networkmanagerproxy.h \
|
|
||||||
network/networkproxyfactory.h \
|
network/networkproxyfactory.h \
|
||||||
network/pac/pacdatetime.h \
|
network/pac/pacdatetime.h \
|
||||||
network/pac/pacmanager.h \
|
network/pac/pacmanager.h \
|
||||||
|
@ -15,6 +15,15 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
|
#include "networkmanager.h"
|
||||||
|
|
||||||
|
NetworkManager::NetworkManager(QObject *parent)
|
||||||
|
: QNetworkAccessManager(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#if QTWEBENGINE_DISABLED
|
||||||
|
|
||||||
#include "browserwindow.h"
|
#include "browserwindow.h"
|
||||||
#include "autofill.h"
|
#include "autofill.h"
|
||||||
#include "networkmanagerproxy.h"
|
#include "networkmanagerproxy.h"
|
||||||
@ -51,8 +60,6 @@
|
|||||||
#include <QAuthenticator>
|
#include <QAuthenticator>
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
|
|
||||||
#if QTWEBENGINE_DISABLED
|
|
||||||
|
|
||||||
static QString fileNameForCert(const QSslCertificate &cert)
|
static QString fileNameForCert(const QSslCertificate &cert)
|
||||||
{
|
{
|
||||||
QString certFileName = CertificateInfoWidget::certificateItemText(cert);
|
QString certFileName = CertificateInfoWidget::certificateItemText(cert);
|
||||||
|
@ -18,6 +18,18 @@
|
|||||||
#ifndef NETWORKMANAGER_H
|
#ifndef NETWORKMANAGER_H
|
||||||
#define NETWORKMANAGER_H
|
#define NETWORKMANAGER_H
|
||||||
|
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
|
#include "qzcommon.h"
|
||||||
|
|
||||||
|
class QUPZILLA_EXPORT NetworkManager : public QNetworkAccessManager
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit NetworkManager(QObject *parent = Q_NULLPTR);
|
||||||
|
};
|
||||||
|
|
||||||
#if QTWEBENGINE_DISABLED
|
#if QTWEBENGINE_DISABLED
|
||||||
|
|
||||||
#include <QSslError>
|
#include <QSslError>
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
/* ============================================================
|
|
||||||
* QupZilla - WebKit based browser
|
|
||||||
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
* ============================================================ */
|
|
||||||
#include "networkmanagerproxy.h"
|
|
||||||
#include "networkmanager.h"
|
|
||||||
#include "webpage.h"
|
|
||||||
#include "cookiejar.h"
|
|
||||||
#include "mainapplication.h"
|
|
||||||
|
|
||||||
#include <QNetworkRequest>
|
|
||||||
|
|
||||||
#if QTWEBENGINE_DISABLED
|
|
||||||
|
|
||||||
NetworkManagerProxy::NetworkManagerProxy(QObject* parent)
|
|
||||||
: QNetworkAccessManager(parent)
|
|
||||||
, m_page(0)
|
|
||||||
, m_manager(0)
|
|
||||||
{
|
|
||||||
setCookieJar(mApp->cookieJar());
|
|
||||||
|
|
||||||
// CookieJar is shared between NetworkManagers
|
|
||||||
mApp->cookieJar()->setParent(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void NetworkManagerProxy::setPrimaryNetworkAccessManager(NetworkManager* manager)
|
|
||||||
{
|
|
||||||
Q_ASSERT(manager);
|
|
||||||
m_manager = manager;
|
|
||||||
|
|
||||||
connect(this, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), m_manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)));
|
|
||||||
connect(this, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), m_manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
|
|
||||||
connect(this, SIGNAL(finished(QNetworkReply*)), m_manager, SIGNAL(finished(QNetworkReply*)));
|
|
||||||
connect(this, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), m_manager, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)));
|
|
||||||
}
|
|
||||||
|
|
||||||
QNetworkReply* NetworkManagerProxy::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice* outgoingData)
|
|
||||||
{
|
|
||||||
if (m_manager) {
|
|
||||||
QNetworkRequest pageRequest = request;
|
|
||||||
if (m_page) {
|
|
||||||
m_page->populateNetworkRequest(pageRequest);
|
|
||||||
}
|
|
||||||
return m_manager->createRequest(op, pageRequest, outgoingData);
|
|
||||||
}
|
|
||||||
|
|
||||||
return QNetworkAccessManager::createRequest(op, request, outgoingData);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,47 +0,0 @@
|
|||||||
/* ============================================================
|
|
||||||
* QupZilla - WebKit based browser
|
|
||||||
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
* ============================================================ */
|
|
||||||
#ifndef NETWORKMANAGERPROXY_H
|
|
||||||
#define NETWORKMANAGERPROXY_H
|
|
||||||
|
|
||||||
#if QTWEBENGINE_DISABLED
|
|
||||||
|
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
|
|
||||||
#include "qzcommon.h"
|
|
||||||
|
|
||||||
class WebPage;
|
|
||||||
class NetworkManager;
|
|
||||||
|
|
||||||
class QUPZILLA_EXPORT NetworkManagerProxy : public QNetworkAccessManager
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit NetworkManagerProxy(QObject* parent = 0);
|
|
||||||
|
|
||||||
void setPage(WebPage* page) { m_page = page; }
|
|
||||||
void setPrimaryNetworkAccessManager(NetworkManager* manager);
|
|
||||||
|
|
||||||
QNetworkReply* createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice* outgoingData);
|
|
||||||
|
|
||||||
private:
|
|
||||||
WebPage* m_page;
|
|
||||||
NetworkManager* m_manager;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // NETWORKMANAGERPROXY_H
|
|
@ -18,6 +18,7 @@
|
|||||||
#include "searchenginesmanager.h"
|
#include "searchenginesmanager.h"
|
||||||
#include "searchenginesdialog.h"
|
#include "searchenginesdialog.h"
|
||||||
#include "editsearchengine.h"
|
#include "editsearchengine.h"
|
||||||
|
#include "networkmanager.h"
|
||||||
#include "iconprovider.h"
|
#include "iconprovider.h"
|
||||||
#include "mainapplication.h"
|
#include "mainapplication.h"
|
||||||
#include "opensearchreader.h"
|
#include "opensearchreader.h"
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
#include "iconprovider.h"
|
#include "iconprovider.h"
|
||||||
#include "mainapplication.h"
|
#include "mainapplication.h"
|
||||||
|
#include "networkmanager.h"
|
||||||
#include "followredirectreply.h"
|
#include "followredirectreply.h"
|
||||||
#include "sqldatabase.h"
|
#include "sqldatabase.h"
|
||||||
#include "autosaver.h"
|
#include "autosaver.h"
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
#include "webinspector.h"
|
#include "webinspector.h"
|
||||||
#include "mainapplication.h"
|
#include "mainapplication.h"
|
||||||
|
#include "networkmanager.h"
|
||||||
|
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include "autofill.h"
|
#include "autofill.h"
|
||||||
#include "popupwebview.h"
|
#include "popupwebview.h"
|
||||||
#include "popupwindow.h"
|
#include "popupwindow.h"
|
||||||
#include "networkmanagerproxy.h"
|
|
||||||
#include "adblockicon.h"
|
#include "adblockicon.h"
|
||||||
#include "adblockmanager.h"
|
#include "adblockmanager.h"
|
||||||
#include "iconprovider.h"
|
#include "iconprovider.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user