5 |
5 |
6 """ |
6 """ |
7 Module implementing the URL bar widget. |
7 Module implementing the URL bar widget. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt4.QtCore import pyqtSlot, Qt, QPointF, QUrl, QDateTime |
10 from PyQt4.QtCore import pyqtSlot, Qt, QPointF, QUrl, QDateTime, qVersion |
11 from PyQt4.QtGui import QColor, QPalette, QLinearGradient, QIcon, QDialog |
11 from PyQt4.QtGui import QColor, QPalette, QLinearGradient, QIcon, QDialog |
12 try: |
12 try: |
13 from PyQt4.QtNetwork import QSslCertificate # __IGNORE_EXCEPTION__ |
13 from PyQt4.QtNetwork import QSslCertificate # __IGNORE_EXCEPTION__ |
14 except ImportError: |
14 except ImportError: |
15 QSslCertificate = None # __IGNORE_WARNING__ |
15 QSslCertificate = None # __IGNORE_WARNING__ |
178 if ok and \ |
178 if ok and \ |
179 self.__browser.url().scheme() == "https" and \ |
179 self.__browser.url().scheme() == "https" and \ |
180 QSslCertificate is not None: |
180 QSslCertificate is not None: |
181 sslInfo = self.__browser.page().getSslInfo() |
181 sslInfo = self.__browser.page().getSslInfo() |
182 if sslInfo is not None: |
182 if sslInfo is not None: |
183 org = Qt.escape(Utilities.decodeString( |
183 if qVersion() >= "5.0.0": |
184 sslInfo.subjectInfo(QSslCertificate.Organization))) |
184 org = Qt.escape(Utilities.decodeString( |
|
185 ", ".join(sslInfo.subjectInfo(QSslCertificate.Organization)))) |
|
186 else: |
|
187 org = Qt.escape(Utilities.decodeString( |
|
188 sslInfo.subjectInfo(QSslCertificate.Organization))) |
185 if org == "": |
189 if org == "": |
186 cn = Qt.escape(Utilities.decodeString( |
190 if qVersion() >= "5.0.0": |
187 sslInfo.subjectInfo(QSslCertificate.CommonName))) |
191 cn = Qt.escape(Utilities.decodeString( |
|
192 ", ".join( |
|
193 sslInfo.subjectInfo(QSslCertificate.CommonName)))) |
|
194 else: |
|
195 cn = Qt.escape(Utilities.decodeString( |
|
196 sslInfo.subjectInfo(QSslCertificate.CommonName))) |
188 if cn != "": |
197 if cn != "": |
189 org = cn.split(".", 1)[1] |
198 org = cn.split(".", 1)[1] |
190 if org == "": |
199 if org == "": |
191 org = self.trUtf8("Unknown") |
200 org = self.trUtf8("Unknown") |
192 self.__sslLabel.setText(" {0} ".format(org)) |
201 self.__sslLabel.setText(" {0} ".format(org)) |
193 self.__sslLabel.setVisible(True) |
202 self.__sslLabel.setVisible(True) |
194 self.__sslLabel.setValidity(sslInfo.isValid()) |
203 if qVersion() >= "5.0.0": |
|
204 valid = not sslInfo.isBlacklisted() |
|
205 else: |
|
206 valid = sslInfo.isValid() |
|
207 self.__sslLabel.setValidity(valid) |
195 return |
208 return |
196 |
209 |
197 self.__sslLabel.setVisible(False) |
210 self.__sslLabel.setVisible(False) |
198 except RuntimeError: |
211 except RuntimeError: |
199 pass |
212 pass |