summaryrefslogtreecommitdiff
path: root/src/webtab
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-04-07 12:45:15 +0200
committerAndrea Diamantini <adjam7@gmail.com>2013-04-07 12:45:15 +0200
commit38387fcc68f8b645bf1591ffde3e986e4c82d787 (patch)
tree750b6051cba4df4ecb0197267ccb7bc2df8dea96 /src/webtab
parentUse kurifilter instead of custom rekonq code. (diff)
downloadrekonq-38387fcc68f8b645bf1591ffde3e986e4c82d787.tar.xz
Workaround about private browsing
Use a unique QNAM for private browsing. This lets private windows share navigation info. I guess the "optimus workaround" should be creating this "per window". But I think this way it's easier and enough (to be a workaround...) BUG: 317565
Diffstat (limited to 'src/webtab')
-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