summaryrefslogtreecommitdiffstats
path: root/src/network/kernel/qnetworkproxy.cpp
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2009-08-05 16:05:53 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-08-31 16:33:33 (GMT)
commitaecf60446a0b7f02c3728b0f653ab04f1f45d11c (patch)
treea4eea5534b249d2118c2b66c64c3a144033b5772 /src/network/kernel/qnetworkproxy.cpp
parent25ae1b6fc4d277f337639bc90c3f7df893b867f3 (diff)
downloadQt-aecf60446a0b7f02c3728b0f653ab04f1f45d11c.zip
Qt-aecf60446a0b7f02c3728b0f653ab04f1f45d11c.tar.gz
Qt-aecf60446a0b7f02c3728b0f653ab04f1f45d11c.tar.bz2
Add QNetworkProxyFactory::setUseSystemConfigurationEnabled(true)
Simply following the system configuration for the proxy used to require writing a QNetworkProxyFactory subclass. The static setter makes this easier, so apps can in one line say "I want to use the system proxy settings". Solution and method name suggested by Thiago.
Diffstat (limited to 'src/network/kernel/qnetworkproxy.cpp')
-rw-r--r--src/network/kernel/qnetworkproxy.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index af8d6fb..908f01f 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -220,6 +220,7 @@
#ifndef QT_NO_NETWORKPROXY
+#include "private/qnetworkproxy_p.h"
#include "private/qsocks5socketengine_p.h"
#include "private/qhttpsocketengine_p.h"
#include "qauthenticator.h"
@@ -1156,6 +1157,29 @@ QNetworkProxyFactory::~QNetworkProxyFactory()
{
}
+
+/*!
+ Enables the use of the platform-specific proxy settings, and only those.
+ See systemProxyForQuery() for more information.
+
+ Internally, this method (when called with \a enable set to true)
+ sets an application-wide proxy factory. For this reason, this method
+ is mutually exclusive with setApplicationProxyFactory: calling
+ setApplicationProxyFactory overrides the use of the system-wide proxy,
+ and calling setUseSystemConfigurationEnabled overrides any
+ application proxy or proxy factory that was previously set.
+
+ \since 4.6
+*/
+void QNetworkProxyFactory::setUseSystemConfigurationEnabled(bool enable)
+{
+ if (enable) {
+ setApplicationProxyFactory(new QSystemConfigurationProxyFactory);
+ } else {
+ setApplicationProxyFactory(0);
+ }
+}
+
/*!
Sets the application-wide proxy factory to be \a factory. This
function will take ownership of that object and will delete it