diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2013-08-05 00:53:18 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2013-08-05 00:53:18 +0200 |
commit | 13ab976001d2e579ad302c95afc6ea65a61cb4ad (patch) | |
tree | 39d2d5ee19db074b611275d1e5f604a5cbc2dbfc | |
parent | Force bookmarks saving on bookmarking all tabs (diff) | |
download | rekonq-13ab976001d2e579ad302c95afc6ea65a61cb4ad.tar.xz |
Fix support for http proxy in private mode
this patch is a tiny modification of the one provided by
Pali Rohàr (thanks!!!).
I just misunderstood it before and then forgot in my mail.
Sorry for that, Pali. And thank you again :)
CCMAIL: pali.rohar@gmail.com
-rw-r--r-- | src/webtab/knetworkaccessmanager.cpp | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/src/webtab/knetworkaccessmanager.cpp b/src/webtab/knetworkaccessmanager.cpp index f02ec2d8..40b53933 100644 --- a/src/webtab/knetworkaccessmanager.cpp +++ b/src/webtab/knetworkaccessmanager.cpp @@ -51,21 +51,45 @@ KNetworkAccessManager::KNetworkAccessManager(QObject *parent) kDebug() << "PROXY TYPE: " << proxyType; if (proxyType == 0) - proxy.setType(QNetworkProxy::NoProxy); - else - proxy.setType(QNetworkProxy::Socks5Proxy); + return; + + QStringList httpProxy = proxyGroup.readEntry( QL1S("httpProxy"), QString("") ).split(QL1C(' ')); + QStringList socksProxy = proxyGroup.readEntry( QL1S("socksProxy"), QString("") ).split(QL1C(' ')); + + QStringList proxyInfoList; - QString proxyHost = proxyGroup.readEntry( QL1S("socksProxy"), QString("") ); - QStringList proxyInfoList = proxyHost.split(QL1C(' ')); - kDebug() << proxyInfoList; + if (!httpProxy.isEmpty()) + { + proxy.setType(QNetworkProxy::HttpProxy); + proxyInfoList = httpProxy; + } + else + { + if (!socksProxy.isEmpty()) + { + proxy.setType(QNetworkProxy::Socks5Proxy); + proxyInfoList = socksProxy; + } + } + if (proxyInfoList.isEmpty()) return; - proxy.setHostName(proxyInfoList.at(0)); + // else + proxyInfoList.first().remove("http://"); + + // set host + QString proxyHost = proxyInfoList.at(0); + kDebug() << "PROXY HOST: " << proxyHost; + proxy.setHostName(proxyHost); + // set port if (proxyInfoList.count() == 2) - proxy.setPort(proxyInfoList.at(1).toInt()); - + { + int proxyPort = proxyInfoList.at(1).toInt(); + kDebug() << "PROXY PORT: " << proxyPort; + proxy.setPort(proxyPort); + } // proxy.setUser("username"); // proxy.setPassword("password"); // |