Helpviewer/UrlBar/UrlBar.py

changeset 5736
000ea446ff4b
parent 5624
cdd346d8858b
child 6048
82ad8ec9548c
equal deleted inserted replaced
5735:f606dbe20be6 5736:000ea446ff4b
11 try: 11 try:
12 str = unicode 12 str = unicode
13 except NameError: 13 except NameError:
14 pass 14 pass
15 15
16 from PyQt5.QtCore import pyqtSlot, Qt, QPointF, QUrl, QDateTime, qVersion 16 from PyQt5.QtCore import pyqtSlot, Qt, QPointF, QUrl, QDateTime
17 from PyQt5.QtGui import QColor, QPalette, QLinearGradient, QIcon 17 from PyQt5.QtGui import QColor, QPalette, QLinearGradient, QIcon
18 from PyQt5.QtWidgets import QDialog, QApplication 18 from PyQt5.QtWidgets import QDialog, QApplication
19 try: 19 try:
20 from PyQt5.QtNetwork import QSslCertificate # __IGNORE_EXCEPTION__ 20 from PyQt5.QtNetwork import QSslCertificate # __IGNORE_EXCEPTION__
21 except ImportError: 21 except ImportError:
32 from .SslLabel import SslLabel 32 from .SslLabel import SslLabel
33 33
34 import UI.PixmapCache 34 import UI.PixmapCache
35 import Preferences 35 import Preferences
36 import Utilities 36 import Utilities
37 from Globals import qVersionTuple
37 38
38 39
39 class UrlBar(E5LineEdit): 40 class UrlBar(E5LineEdit):
40 """ 41 """
41 Class implementing a line edit for entering URLs. 42 Class implementing a line edit for entering URLs.
185 if ok and \ 186 if ok and \
186 self.__browser.url().scheme() == "https" and \ 187 self.__browser.url().scheme() == "https" and \
187 QSslCertificate is not None: 188 QSslCertificate is not None:
188 sslInfo = self.__browser.page().getSslCertificate() 189 sslInfo = self.__browser.page().getSslCertificate()
189 if sslInfo is not None: 190 if sslInfo is not None:
190 if qVersion() >= "5.0.0": 191 if qVersionTuple() >= (5, 0, 0):
191 org = Utilities.decodeString(", ".join( 192 org = Utilities.decodeString(", ".join(
192 sslInfo.subjectInfo(QSslCertificate.Organization))) 193 sslInfo.subjectInfo(QSslCertificate.Organization)))
193 else: 194 else:
194 org = Utilities.decodeString( 195 org = Utilities.decodeString(
195 sslInfo.subjectInfo(QSslCertificate.Organization)) 196 sslInfo.subjectInfo(QSslCertificate.Organization))
196 if org == "": 197 if org == "":
197 if qVersion() >= "5.0.0": 198 if qVersionTuple() >= (5, 0, 0):
198 cn = Utilities.decodeString(", ".join( 199 cn = Utilities.decodeString(", ".join(
199 sslInfo.subjectInfo( 200 sslInfo.subjectInfo(
200 QSslCertificate.CommonName))) 201 QSslCertificate.CommonName)))
201 else: 202 else:
202 cn = Utilities.decodeString( 203 cn = Utilities.decodeString(
206 org = cn.split(".", 1)[1] 207 org = cn.split(".", 1)[1]
207 if org == "": 208 if org == "":
208 org = self.tr("Unknown") 209 org = self.tr("Unknown")
209 self.__sslLabel.setText(" {0} ".format(org)) 210 self.__sslLabel.setText(" {0} ".format(org))
210 self.__sslLabel.setVisible(True) 211 self.__sslLabel.setVisible(True)
211 if qVersion() >= "5.0.0": 212 if qVersionTuple() >= (5, 0, 0):
212 valid = not sslInfo.isBlacklisted() 213 valid = not sslInfo.isBlacklisted()
213 else: 214 else:
214 valid = sslInfo.isValid() 215 valid = sslInfo.isValid()
215 if valid: 216 if valid:
216 config = self.__browser.page().getSslConfiguration() 217 config = self.__browser.page().getSslConfiguration()

eric ide

mercurial