8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
11 |
11 |
12 from PyQt4.QtCore import * |
12 from PyQt4.QtCore import * |
13 from PyQt4.QtGui import QDialog, QMessageBox |
13 from PyQt4.QtGui import QDialog |
14 from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply |
14 from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply |
15 try: |
15 try: |
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: |
201 if not errorStrings: |
201 if not errorStrings: |
202 reply.ignoreSslErrors() |
202 reply.ignoreSslErrors() |
203 return |
203 return |
204 |
204 |
205 errorString = '.</li><li>'.join(errorStrings) |
205 errorString = '.</li><li>'.join(errorStrings) |
206 ret = E5MessageBox.warning(None, |
206 ret = E5MessageBox.yesNo(None, |
207 self.trUtf8("SSL Errors"), |
207 self.trUtf8("SSL Errors"), |
208 self.trUtf8("""<p>SSL Errors for <br /><b>{0}</b>""" |
208 self.trUtf8("""<p>SSL Errors for <br /><b>{0}</b>""" |
209 """<ul><li>{1}</li></ul></p>""" |
209 """<ul><li>{1}</li></ul></p>""" |
210 """<p>Do you want to ignore these errors?</p>""")\ |
210 """<p>Do you want to ignore these errors?</p>""")\ |
211 .format(reply.url().toString(), errorString), |
211 .format(reply.url().toString(), errorString), |
212 QMessageBox.StandardButtons( |
212 type_ = E5MessageBox.Warning) |
213 QMessageBox.No | \ |
213 |
214 QMessageBox.Yes), |
214 if ret: |
215 QMessageBox.No) |
|
216 |
|
217 if ret == QMessageBox.Yes: |
|
218 if len(caNew) > 0: |
215 if len(caNew) > 0: |
219 certinfos = [] |
216 certinfos = [] |
220 for cert in caNew: |
217 for cert in caNew: |
221 certinfos.append(self.__certToString(cert)) |
218 certinfos.append(self.__certToString(cert)) |
222 ret = E5MessageBox.question(None, |
219 ret = E5MessageBox.yesNo(None, |
223 self.trUtf8("Certificates"), |
220 self.trUtf8("Certificates"), |
224 self.trUtf8("""<p>Certificates:<br/>{0}<br/>""" |
221 self.trUtf8("""<p>Certificates:<br/>{0}<br/>""" |
225 """Do you want to accept all these certificates?</p>""")\ |
222 """Do you want to accept all these certificates?</p>""")\ |
226 .format("".join(certinfos)), |
223 .format("".join(certinfos))) |
227 QMessageBox.StandardButtons(\ |
224 if ret: |
228 QMessageBox.No | \ |
|
229 QMessageBox.Yes), |
|
230 QMessageBox.No) |
|
231 if ret == QMessageBox.Yes: |
|
232 for cert in caNew: |
225 for cert in caNew: |
233 caMerge.append(cert) |
226 caMerge.append(cert) |
234 |
227 |
235 sslCfg = QSslConfiguration.defaultConfiguration() |
228 sslCfg = QSslConfiguration.defaultConfiguration() |
236 caList = sslCfg.caCertificates() |
229 caList = sslCfg.caCertificates() |