summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/webtab/networkaccessmanager.cpp19
-rw-r--r--src/webtab/networkaccessmanager.h4
-rw-r--r--src/webtab/webpage.cpp2
3 files changed, 24 insertions, 1 deletions
diff --git a/src/webtab/networkaccessmanager.cpp b/src/webtab/networkaccessmanager.cpp
index 8e1394ca..ae3c44f7 100644
--- a/src/webtab/networkaccessmanager.cpp
+++ b/src/webtab/networkaccessmanager.cpp
@@ -106,6 +106,23 @@ static void hideBlockedElements(const QUrl& url, QWebElementCollection& collecti
// ----------------------------------------------------------------------------------------------
+QNetworkAccessManager *NetworkAccessManager::s_privateAccessManager = 0;
+
+
+QNetworkAccessManager *NetworkAccessManager::privateAccessManager()
+{
+ if (s_privateAccessManager == 0)
+ {
+ s_privateAccessManager = new QNetworkAccessManager();
+ }
+
+ return s_privateAccessManager;
+}
+
+
+// ----------------------------------------------------------------------------------------------
+
+
NetworkAccessManager::NetworkAccessManager(QObject *parent)
: AccessManager(parent)
{
@@ -183,3 +200,5 @@ void NetworkAccessManager::applyHidingBlockedElements(bool ok)
Q_FOREACH(const QUrl & url, urls)
hideBlockedElements(url, collection);
}
+
+
diff --git a/src/webtab/networkaccessmanager.h b/src/webtab/networkaccessmanager.h
index 3bf45e18..809d69f7 100644
--- a/src/webtab/networkaccessmanager.h
+++ b/src/webtab/networkaccessmanager.h
@@ -49,6 +49,8 @@ class REKONQ_TESTS_EXPORT NetworkAccessManager : public KIO::Integration::Access
public:
explicit NetworkAccessManager(QObject *parent);
+ static QNetworkAccessManager *privateAccessManager();
+
protected:
virtual QNetworkReply *createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData = 0);
@@ -58,6 +60,8 @@ private Q_SLOTS:
private:
QMultiHash<QWebFrame*, QUrl> m_blockedRequests;
QByteArray _acceptLanguage;
+
+ static QNetworkAccessManager *s_privateAccessManager;
};
#endif // NETWORKACCESSMANAGER_H
diff --git a/src/webtab/webpage.cpp b/src/webtab/webpage.cpp
index 6274b882..479997e4 100644
--- a/src/webtab/webpage.cpp
+++ b/src/webtab/webpage.cpp
@@ -141,7 +141,7 @@ WebPage::WebPage(QWidget *parent, bool isPrivateBrowsing)
// The problem is basically cookie related. This way we lose some features in private
// browsing mode, but we ensure PRIVACY! This change cannot be reverted until a proper
// fix for KIO (or the right workaround for rekonq) will be found.
- QNetworkAccessManager *manager = new QNetworkAccessManager(this);
+ QNetworkAccessManager *manager = NetworkAccessManager::privateAccessManager();
setNetworkAccessManager(manager);
// ----- last stuffs