14 from PyQt6.QtWidgets import QStyle, QDialog |
14 from PyQt6.QtWidgets import QStyle, QDialog |
15 from PyQt6.QtNetwork import ( |
15 from PyQt6.QtNetwork import ( |
16 QNetworkAccessManager, QNetworkProxy, QNetworkProxyFactory, QNetworkRequest |
16 QNetworkAccessManager, QNetworkProxy, QNetworkProxyFactory, QNetworkRequest |
17 ) |
17 ) |
18 |
18 |
19 from E5Gui import E5MessageBox |
19 from E5Gui import EricMessageBox |
20 from E5Gui.E5Application import e5App |
20 from E5Gui.EricApplication import ericApp |
21 |
21 |
22 from EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired |
22 from EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired |
23 try: |
23 try: |
24 from EricNetwork.EricSslErrorHandler import EricSslErrorHandler |
24 from EricNetwork.EricSslErrorHandler import EricSslErrorHandler |
25 SSL_AVAILABLE = True |
25 SSL_AVAILABLE = True |
195 error.error() in self.__permanentlyIgnoredSslErrors[host] |
195 error.error() in self.__permanentlyIgnoredSslErrors[host] |
196 ): |
196 ): |
197 return True |
197 return True |
198 |
198 |
199 title = self.tr("SSL Certificate Error") |
199 title = self.tr("SSL Certificate Error") |
200 msgBox = E5MessageBox.E5MessageBox( |
200 msgBox = EricMessageBox.EricMessageBox( |
201 E5MessageBox.Warning, |
201 EricMessageBox.Warning, |
202 title, |
202 title, |
203 self.tr("""<b>{0}</b>""" |
203 self.tr("""<b>{0}</b>""" |
204 """<p>The host <b>{1}</b> you are trying to access has""" |
204 """<p>The host <b>{1}</b> you are trying to access has""" |
205 """ errors in the SSL certificate.</p>""" |
205 """ errors in the SSL certificate.</p>""" |
206 """<ul><li>{2}</li></ul>""" |
206 """<ul><li>{2}</li></ul>""" |
207 """<p>Would you like to make an exception?</p>""") |
207 """<p>Would you like to make an exception?</p>""") |
208 .format(title, host, error.errorDescription()), |
208 .format(title, host, error.errorDescription()), |
209 modal=True, parent=view) |
209 modal=True, parent=view) |
210 permButton = msgBox.addButton(self.tr("&Permanent accept"), |
210 permButton = msgBox.addButton(self.tr("&Permanent accept"), |
211 E5MessageBox.AcceptRole) |
211 EricMessageBox.AcceptRole) |
212 tempButton = msgBox.addButton(self.tr("&Temporary accept"), |
212 tempButton = msgBox.addButton(self.tr("&Temporary accept"), |
213 E5MessageBox.AcceptRole) |
213 EricMessageBox.AcceptRole) |
214 msgBox.addButton(self.tr("&Reject"), E5MessageBox.RejectRole) |
214 msgBox.addButton(self.tr("&Reject"), EricMessageBox.RejectRole) |
215 msgBox.exec() |
215 msgBox.exec() |
216 if msgBox.clickedButton() == permButton: |
216 if msgBox.clickedButton() == permButton: |
217 if host not in self.__permanentlyIgnoredSslErrors: |
217 if host not in self.__permanentlyIgnoredSslErrors: |
218 self.__permanentlyIgnoredSslErrors[host] = [] |
218 self.__permanentlyIgnoredSslErrors[host] = [] |
219 self.__permanentlyIgnoredSslErrors[host].append(error.error()) |
219 self.__permanentlyIgnoredSslErrors[host].append(error.error()) |
322 @param url reference to the URL requesting authentication |
322 @param url reference to the URL requesting authentication |
323 @type QUrl |
323 @type QUrl |
324 """ |
324 """ |
325 html = getHtmlPage("authenticationErrorPage.html") |
325 html = getHtmlPage("authenticationErrorPage.html") |
326 html = html.replace("@IMAGE@", pixmapToDataUrl( |
326 html = html.replace("@IMAGE@", pixmapToDataUrl( |
327 e5App().style().standardIcon( |
327 ericApp().style().standardIcon( |
328 QStyle.StandardPixmap.SP_MessageBoxCritical).pixmap(48, 48) |
328 QStyle.StandardPixmap.SP_MessageBoxCritical).pixmap(48, 48) |
329 ).toString()) |
329 ).toString()) |
330 html = html.replace("@FAVICON@", pixmapToDataUrl( |
330 html = html.replace("@FAVICON@", pixmapToDataUrl( |
331 e5App().style() .standardIcon( |
331 ericApp().style() .standardIcon( |
332 QStyle.StandardPixmap.SP_MessageBoxCritical).pixmap(16, 16) |
332 QStyle.StandardPixmap.SP_MessageBoxCritical).pixmap(16, 16) |
333 ).toString()) |
333 ).toString()) |
334 html = html.replace("@TITLE@", self.tr("Authentication required")) |
334 html = html.replace("@TITLE@", self.tr("Authentication required")) |
335 html = html.replace("@H1@", self.tr("Authentication required")) |
335 html = html.replace("@H1@", self.tr("Authentication required")) |
336 html = html.replace( |
336 html = html.replace( |