39 |
39 |
40 def __init__(self, parent=None): |
40 def __init__(self, parent=None): |
41 """ |
41 """ |
42 Constructor |
42 Constructor |
43 |
43 |
44 @param parent reference to the parent object (QObject) |
44 @param parent reference to the parent object |
|
45 @type QObject |
45 """ |
46 """ |
46 super().__init__(parent) |
47 super().__init__(parent) |
47 |
48 |
48 caList = self.__getSystemCaCertificates() |
49 caList = self.__getSystemCaCertificates() |
49 if Preferences.getSettings().contains("Help/CaCertificatesDict"): |
50 if Preferences.getSettings().contains("Help/CaCertificatesDict"): |
78 |
79 |
79 def sslErrorsReplySlot(self, reply, errors): |
80 def sslErrorsReplySlot(self, reply, errors): |
80 """ |
81 """ |
81 Public slot to handle SSL errors for a network reply. |
82 Public slot to handle SSL errors for a network reply. |
82 |
83 |
83 @param reply reference to the reply object (QNetworkReply) |
84 @param reply reference to the reply object |
84 @param errors list of SSL errors (list of QSslError) |
85 @type QNetworkReply |
|
86 @param errors list of SSL errors |
|
87 @type list of QSslError |
85 """ |
88 """ |
86 self.sslErrorsReply(reply, errors) |
89 self.sslErrorsReply(reply, errors) |
87 |
90 |
88 def sslErrorsReply(self, reply, errors): |
91 def sslErrorsReply(self, reply, errors): |
89 """ |
92 """ |
90 Public slot to handle SSL errors for a network reply. |
93 Public slot to handle SSL errors for a network reply. |
91 |
94 |
92 @param reply reference to the reply object (QNetworkReply) |
95 @param reply reference to the reply object |
93 @param errors list of SSL errors (list of QSslError) |
96 @type QNetworkReply |
94 @return tuple indicating to ignore the SSL errors (one of NotIgnored, |
97 @param errors list of SSL errors |
95 SystemIgnored or UserIgnored) and indicating a change of the |
98 @type list of QSslError |
96 default SSL configuration (boolean) |
99 @return tuple indicating to ignore the SSL errors and indicating a change |
|
100 of the default SSL configuration |
|
101 @rtype tuple of (EricSslErrorState, bool) |
97 """ |
102 """ |
98 url = reply.url() |
103 url = reply.url() |
99 ignore, defaultChanged = self.sslErrors(errors, url.host(), url.port()) |
104 ignore, defaultChanged = self.sslErrors(errors, url.host(), url.port()) |
100 if ignore: |
105 if ignore: |
101 if defaultChanged: |
106 if defaultChanged: |
210 |
215 |
211 def __certToString(self, cert): |
216 def __certToString(self, cert): |
212 """ |
217 """ |
213 Private method to convert a certificate to a formatted string. |
218 Private method to convert a certificate to a formatted string. |
214 |
219 |
215 @param cert certificate to convert (QSslCertificate) |
220 @param cert certificate to convert |
216 @return formatted string (string) |
221 @type QSslCertificate |
|
222 @return formatted string |
|
223 @rtype str |
217 """ |
224 """ |
218 result = "<p>" |
225 result = "<p>" |
219 |
226 |
220 result += self.tr("Name: {0}").format( |
227 result += self.tr("Name: {0}").format( |
221 Utilities.html_encode( |
228 Utilities.html_encode( |
253 |
260 |
254 def __getSystemCaCertificates(self): |
261 def __getSystemCaCertificates(self): |
255 """ |
262 """ |
256 Private method to get the list of system certificates. |
263 Private method to get the list of system certificates. |
257 |
264 |
258 @return list of system certificates (list of QSslCertificate) |
265 @return list of system certificates |
|
266 @rtype list of QSslCertificate |
259 """ |
267 """ |
260 caList = QSslCertificate.fromData( |
268 caList = QSslCertificate.fromData( |
261 Globals.toByteArray( |
269 Globals.toByteArray( |
262 Preferences.getSettings().value("Ssl/SystemCertificates") |
270 Preferences.getSettings().value("Ssl/SystemCertificates") |
263 ) |
271 ) |