Mercurial > trustbridge
comparison ui/downloader.cpp @ 1062:515345358b71
(issue41) Add and use a UseProxy checkbox
Using proxy no longer depends on the proxyUrl beeing empty
but rather on the value of the checkbox.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 10 Sep 2014 11:06:49 +0200 |
parents | 2949f1842955 |
children | 508c96e72f62 |
comparison
equal
deleted
inserted
replaced
1061:db831a204a6b | 1062:515345358b71 |
---|---|
72 #ifdef USE_CURL | 72 #ifdef USE_CURL |
73 mSSLConnection = new SSLConnectionCurl(url, certificate); | 73 mSSLConnection = new SSLConnectionCurl(url, certificate); |
74 /* Set up Proxy support. */ | 74 /* Set up Proxy support. */ |
75 QSettings settings; | 75 QSettings settings; |
76 QString settingsProxy = settings.value("ProxyURL").toString(); | 76 QString settingsProxy = settings.value("ProxyURL").toString(); |
77 if (settingsProxy.isEmpty()) { | 77 bool useProxy = settings.value("UseProxy", false).toBool(); |
78 if (useProxy && settingsProxy.isEmpty()) { | |
78 QByteArray envProxy = qgetenv("http_proxy"); | 79 QByteArray envProxy = qgetenv("http_proxy"); |
79 if (envProxy.size()) { | 80 if (envProxy.size()) { |
80 settingsProxy = QString::fromLocal8Bit(envProxy); | 81 settingsProxy = QString::fromLocal8Bit(envProxy); |
81 } | 82 } |
82 } | 83 } |
83 if (!settingsProxy.isEmpty()) { | 84 if (useProxy && !settingsProxy.isEmpty()) { |
84 mSSLConnection->setProxy(QUrl(settingsProxy)); | 85 mSSLConnection->setProxy(QUrl(settingsProxy)); |
85 } | 86 } |
86 #else | 87 #else |
87 mSSLConnection = new SSLConnectionBare(url, certificate); | 88 mSSLConnection = new SSLConnectionBare(url, certificate); |
88 #endif | 89 #endif |