17 from PyQt4.QtCore import * |
17 from PyQt4.QtCore import * |
18 from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply |
18 from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply |
19 |
19 |
20 from .Ui_PluginRepositoryDialog import Ui_PluginRepositoryDialog |
20 from .Ui_PluginRepositoryDialog import Ui_PluginRepositoryDialog |
21 |
21 |
22 from UI.AuthenticationDialog import AuthenticationDialog |
|
23 |
|
24 from E5XML.XMLUtilities import make_parser |
22 from E5XML.XMLUtilities import make_parser |
25 from E5XML.XMLErrorHandler import XMLErrorHandler, XMLFatalParseError |
23 from E5XML.XMLErrorHandler import XMLErrorHandler, XMLFatalParseError |
26 from E5XML.XMLEntityResolver import XMLEntityResolver |
24 from E5XML.XMLEntityResolver import XMLEntityResolver |
27 from E5XML.PluginRepositoryHandler import PluginRepositoryHandler |
25 from E5XML.PluginRepositoryHandler import PluginRepositoryHandler |
|
26 |
|
27 from E5Network.E5NetworkProxyFactory import proxyAuthenticationRequired |
28 |
28 |
29 import Utilities |
29 import Utilities |
30 import Preferences |
30 import Preferences |
31 |
31 |
32 import UI.PixmapCache |
32 import UI.PixmapCache |
74 |
74 |
75 # attributes for the network objects |
75 # attributes for the network objects |
76 self.__networkManager = QNetworkAccessManager(self) |
76 self.__networkManager = QNetworkAccessManager(self) |
77 self.connect(self.__networkManager, |
77 self.connect(self.__networkManager, |
78 SIGNAL('proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)'), |
78 SIGNAL('proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)'), |
79 self.__proxyAuthenticationRequired) |
79 proxyAuthenticationRequired) |
80 self.connect(self.__networkManager, |
80 self.connect(self.__networkManager, |
81 SIGNAL('sslErrors(QNetworkReply *, const QList<QSslError> &)'), |
81 SIGNAL('sslErrors(QNetworkReply *, const QList<QSslError> &)'), |
82 self.__sslErrors) |
82 self.__sslErrors) |
83 self.__replies = [] |
83 self.__replies = [] |
84 |
84 |
486 aversion = "" |
486 aversion = "" |
487 zip.close() |
487 zip.close() |
488 |
488 |
489 return aversion == version |
489 return aversion == version |
490 |
490 |
491 def __proxyAuthenticationRequired(self, proxy, auth): |
|
492 """ |
|
493 Private slot to handle a proxy authentication request. |
|
494 |
|
495 @param proxy reference to the proxy object (QNetworkProxy) |
|
496 @param auth reference to the authenticator object (QAuthenticator) |
|
497 """ |
|
498 info = self.trUtf8("<b>Connect to proxy '{0}' using:</b>")\ |
|
499 .format(Qt.escape(proxy.hostName())) |
|
500 |
|
501 dlg = AuthenticationDialog(info, proxy.user(), True) |
|
502 if dlg.exec_() == QDialog.Accepted: |
|
503 username, password = dlg.getData() |
|
504 auth.setUser(username) |
|
505 auth.setPassword(password) |
|
506 if dlg.shallSave(): |
|
507 Preferences.setUI("ProxyUser", username) |
|
508 Preferences.setUI("ProxyPassword", password) |
|
509 |
|
510 def __sslErrors(self, reply, errors): |
491 def __sslErrors(self, reply, errors): |
511 """ |
492 """ |
512 Private slot to handle SSL errors. |
493 Private slot to handle SSL errors. |
513 |
494 |
514 @param reply reference to the reply object (QNetworkReply) |
495 @param reply reference to the reply object (QNetworkReply) |