Helpviewer/Network/NetworkAccessManager.py

changeset 286
652f5159f1c3
parent 280
e477e5660014
child 381
64ae9e09d8bc
equal deleted inserted replaced
284:06d3067f8a63 286:652f5159f1c3
16 from PyQt4.QtNetwork import QSsl, QSslCertificate, QSslConfiguration, QSslSocket 16 from PyQt4.QtNetwork import QSsl, QSslCertificate, QSslConfiguration, QSslSocket
17 SSL_AVAILABLE = True 17 SSL_AVAILABLE = True
18 except ImportError: 18 except ImportError:
19 SSL_AVAILABLE = False 19 SSL_AVAILABLE = False
20 20
21 from E5Network.E5NetworkProxyFactory import E5NetworkProxyFactory 21 from E5Network.E5NetworkProxyFactory import E5NetworkProxyFactory, proxyAuthenticationRequired
22 22
23 from UI.AuthenticationDialog import AuthenticationDialog 23 from UI.AuthenticationDialog import AuthenticationDialog
24 24
25 from Helpviewer.HelpLanguagesDialog import HelpLanguagesDialog 25 from Helpviewer.HelpLanguagesDialog import HelpLanguagesDialog
26 import Helpviewer.HelpWindow 26 import Helpviewer.HelpWindow
78 SIGNAL('sslErrors(QNetworkReply *, const QList<QSslError> &)'), 78 SIGNAL('sslErrors(QNetworkReply *, const QList<QSslError> &)'),
79 self.__sslErrors) 79 self.__sslErrors)
80 80
81 self.connect(self, 81 self.connect(self,
82 SIGNAL('proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)'), 82 SIGNAL('proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)'),
83 self.__proxyAuthenticationRequired) 83 proxyAuthenticationRequired)
84 self.connect(self, 84 self.connect(self,
85 SIGNAL('authenticationRequired(QNetworkReply *, QAuthenticator *)'), 85 SIGNAL('authenticationRequired(QNetworkReply *, QAuthenticator *)'),
86 self.__authenticationRequired) 86 self.__authenticationRequired)
87 87
88 # register scheme handlers 88 # register scheme handlers
178 auth.setUser(username) 178 auth.setUser(username)
179 auth.setPassword(password) 179 auth.setPassword(password)
180 if Preferences.getHelp("SavePasswords"): 180 if Preferences.getHelp("SavePasswords"):
181 Helpviewer.HelpWindow.HelpWindow.passwordManager().setLogin( 181 Helpviewer.HelpWindow.HelpWindow.passwordManager().setLogin(
182 reply.url(), auth.realm(), username, password) 182 reply.url(), auth.realm(), username, password)
183
184 def __proxyAuthenticationRequired(self, proxy, auth):
185 """
186 Private slot to handle a proxy authentication request.
187
188 @param proxy reference to the proxy object (QNetworkProxy)
189 @param auth reference to the authenticator object (QAuthenticator)
190 """
191 info = self.trUtf8("<b>Connect to proxy '{0}' using:</b>")\
192 .format(Qt.escape(proxy.hostName()))
193
194 dlg = AuthenticationDialog(info, proxy.user(), True)
195 if dlg.exec_() == QDialog.Accepted:
196 username, password = dlg.getData()
197 auth.setUser(username)
198 auth.setPassword(password)
199 if dlg.shallSave():
200 Preferences.setUI("ProxyUser", username)
201 Preferences.setUI("ProxyPassword", password)
202 proxy.setUser(username)
203 proxy.setPassword(password)
204 183
205 def __sslErrors(self, reply, errors): 184 def __sslErrors(self, reply, errors):
206 """ 185 """
207 Private slot to handle SSL errors. 186 Private slot to handle SSL errors.
208 187

eric ide

mercurial