Fixed an issue in the web browser related to selecting the correct proxy type.

Wed, 25 May 2011 08:33:57 +0200

author
detlev@die-offenbachs.de
date
Wed, 25 May 2011 08:33:57 +0200
changeset 1058
fa1c0fa31041
parent 1055
885c8d93e6f9
child 1059
700df567f70b

Fixed an issue in the web browser related to selecting the correct proxy type.

Documentation/Help/source.qch file | annotate | diff | comparison | revisions
E5Network/E5NetworkProxyFactory.py file | annotate | diff | comparison | revisions
Binary file Documentation/Help/source.qch has changed
--- a/E5Network/E5NetworkProxyFactory.py	Sun May 22 18:00:52 2011 +0200
+++ b/E5Network/E5NetworkProxyFactory.py	Wed May 25 08:33:57 2011 +0200
@@ -125,10 +125,10 @@
                     return [QNetworkProxy(QNetworkProxy.NoProxy)]
             else:
                 if Preferences.getUI("UseHttpProxyForAll"):
-                    protocol = "Http"
+                    protocolKey = "Http"
                 else:
-                    protocol = query.protocolTag().capitalize()
-                host = Preferences.getUI("ProxyHost/{0}".format(protocol))
+                    protocolKey = query.protocolTag().capitalize()
+                host = Preferences.getUI("ProxyHost/{0}".format(protocolKey))
                 if not host:
                     E5MessageBox.critical(None,
                         QCoreApplication.translate("E5NetworkProxyFactory",
@@ -136,24 +136,20 @@
                         QCoreApplication.translate("E5NetworkProxyFactory",
                             """Proxy usage was activated"""
                             """ but no proxy host for protocol"""
-                            """ '{0}' configured.""").format(protocol))
+                            """ '{0}' configured.""").format(protocolKey))
                     return [QNetworkProxy(QNetworkProxy.DefaultProxy)]
                 else:
-                    if protocol == "Http":
-                        proxy = QNetworkProxy(QNetworkProxy.HttpProxy, host,
-                            Preferences.getUI("ProxyPort/Http"),
-                            Preferences.getUI("ProxyUser/Http"),
-                            Preferences.getUI("ProxyPassword/Http"))
-                    elif protocol == "Https":
-                        proxy = QNetworkProxy(QNetworkProxy.HttpCachingProxy, host,
-                            Preferences.getUI("ProxyPort/Https"),
-                            Preferences.getUI("ProxyUser/Https"),
-                            Preferences.getUI("ProxyPassword/Https"))
-                    elif protocol == "Ftp":
-                        proxy = QNetworkProxy(QNetworkProxy.FtpCachingProxy, host,
-                            Preferences.getUI("ProxyPort/Ftp"),
-                            Preferences.getUI("ProxyUser/Ftp"),
-                            Preferences.getUI("ProxyPassword/Ftp"))
+                    if protocolKey in ["Http", "Https", "Ftp"]:
+                        if query.protocolTag() == "ftp":
+                            proxyType = QNetworkProxy.FtpCachingProxy
+                        elif query.protocolTag() == "https":
+                            proxyType = QNetworkProxy.HttpCachingProxy
+                        else:
+                            proxyType = QNetworkProxy.HttpProxy
+                        proxy = QNetworkProxy(proxyType, host,
+                            Preferences.getUI("ProxyPort/" + protocolKey),
+                            Preferences.getUI("ProxyUser/" + protocolKey),
+                            Preferences.getUI("ProxyPassword/" + protocolKey))
                     else:
                         proxy = QNetworkProxy(QNetworkProxy.DefaultProxy)
                     return [proxy, QNetworkProxy(QNetworkProxy.DefaultProxy)]

eric ide

mercurial