diff options
author | Dario Freddi <drf@kde.org> | 2009-10-13 00:40:44 +0200 |
---|---|---|
committer | Dario Freddi <drf@kde.org> | 2009-10-13 00:40:44 +0200 |
commit | 62e0a9d46eb4cbabe9fad31903a63d31df9e8432 (patch) | |
tree | a8b11e766849562592f46017071335d9c82876d4 /src/networkaccessmanager.cpp | |
parent | Merge commit 'refs/merge-requests/1757' of git://gitorious.org/rekonq/mainline (diff) | |
download | rekonq-62e0a9d46eb4cbabe9fad31903a63d31df9e8432.tar.xz |
Remove rekonq's custom proxy implementation to use KDE's proxy settings through KProtocolManager. This makes rekonq much more integrated withing KDE, as the user expects that changes in System Settings would take place everywhere. And it also leaves less code to maintain
Signed-off-by: Dario Freddi <drf@kde.org>
Diffstat (limited to 'src/networkaccessmanager.cpp')
-rw-r--r-- | src/networkaccessmanager.cpp | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp index fd975062..1cdc6700 100644 --- a/src/networkaccessmanager.cpp +++ b/src/networkaccessmanager.cpp @@ -42,6 +42,7 @@ // KDE Includes #include <KMessageBox> #include <KStandardDirs> +#include <KProtocolManager> // Qt Includes #include <QtCore/QPointer> @@ -69,7 +70,7 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent) // load AccessManager Settings loadSettings(); - + // resetting disk cache resetDiskCache(); } @@ -77,23 +78,31 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent) void NetworkAccessManager::loadSettings() { - if (ReKonfig::isProxyEnabled()) + // Grab proxy settings from KDE settings + if (KProtocolManager::useProxy()) { - QNetworkProxy proxy; - if (ReKonfig::proxyType() == 0) - { - proxy.setType(QNetworkProxy::Socks5Proxy); - } - else + QString proxyAddress = KProtocolManager::proxyFor("http"); + + if(!proxyAddress.isEmpty()) { - proxy.setType(QNetworkProxy::HttpProxy); + KUrl proxyUrl(proxyAddress); + QNetworkProxy::ProxyType proxyType = QNetworkProxy::NoProxy; + + // See what kind of proxy we have here + if(proxyUrl.protocol() == "socks") + { + proxyType = QNetworkProxy::Socks5Proxy; + } + else + { + proxyType = QNetworkProxy::HttpProxy; + } + + QNetworkProxy proxy(proxyType, proxyUrl.host(), (quint16)proxyUrl.port(), + proxyUrl.user(), proxyUrl.pass()); + + setProxy(proxy); } - proxy.setHostName(ReKonfig::proxyHostName()); - proxy.setPort(ReKonfig::proxyPort()); - proxy.setUser(ReKonfig::proxyUserName()); - proxy.setPassword(ReKonfig::proxyPassword()); - - setProxy(proxy); } } |