WebBrowser/UrlBar/UrlBar.py

branch
QtWebEngine
changeset 4905
09f38f85a3af
parent 4868
985d275502c8
child 4913
e16573640cb8
--- a/WebBrowser/UrlBar/UrlBar.py	Mon Mar 28 16:34:22 2016 +0200
+++ b/WebBrowser/UrlBar/UrlBar.py	Mon Mar 28 17:04:18 2016 +0200
@@ -13,14 +13,9 @@
 except NameError:
     pass
 
-from PyQt5.QtCore import pyqtSlot, Qt, QPointF, QUrl, QDateTime, QTimer, \
-    qVersion
+from PyQt5.QtCore import pyqtSlot, Qt, QPointF, QUrl, QDateTime, QTimer
 from PyQt5.QtGui import QColor, QPalette, QLinearGradient, QIcon
 from PyQt5.QtWidgets import QDialog, QApplication
-try:
-    from PyQt5.QtNetwork import QSslCertificate     # __IGNORE_EXCEPTION__
-except ImportError:
-    QSslCertificate = None      # __IGNORE_WARNING__
 from PyQt5.QtWebEngineWidgets import QWebEnginePage
 
 from E5Gui.E5LineEdit import E5LineEdit
@@ -29,11 +24,8 @@
 from WebBrowser.WebBrowserWindow import WebBrowserWindow
 
 from .FavIconLabel import FavIconLabel
-##from .SslLabel import SslLabel
-##
 import UI.PixmapCache
 import Preferences
-import Utilities
 
 
 class UrlBar(E5LineEdit):
@@ -62,11 +54,6 @@
         self.__favicon = FavIconLabel(self)
         self.addWidget(self.__favicon, E5LineEdit.LeftSide)
         
-        # TODO: SSL
-##        self.__sslLabel = SslLabel(self)
-##        self.addWidget(self.__sslLabel, E5LineEdit.LeftSide)
-##        self.__sslLabel.setVisible(False)
-        
         self.__rssButton = E5LineEditButton(self)
         self.__rssButton.setIcon(UI.PixmapCache.getIcon("rss16.png"))
         self.addWidget(self.__rssButton, E5LineEdit.RightSide)
@@ -108,9 +95,6 @@
         self.__browser.loadProgress.connect(self.update)
         self.__browser.loadFinished.connect(self.__loadFinished)
         self.__browser.loadStarted.connect(self.__loadStarted)
-        
-        # TODO: SSL
-##        self.__sslLabel.clicked.connect(self.__browser.page().showSslInfo)
     
     def browser(self):
         """
@@ -139,9 +123,6 @@
         """
         Private slot to perform actions before the page is loaded.
         """
-        pass
-        # TODO: SSL
-##        self.__sslLabel.setVisible(False)
         self.__bookmarkButton.setVisible(False)
         self.__rssButton.setVisible(False)
     
@@ -178,36 +159,6 @@
         
         if ok:
             QTimer.singleShot(0, self.__setRssButton)
-        
-        # TODO: SSL certificate stuff (if possible)
-##        if ok and \
-##           self.__browser.url().scheme() == "https" and \
-##           QSslCertificate is not None:
-##            sslInfo = self.__browser.page().getSslCertificate()
-##            if sslInfo is not None:
-##                org = Utilities.decodeString(", ".join(
-##                    sslInfo.subjectInfo(QSslCertificate.Organization)))
-##                if org == "":
-##                    cn = Utilities.decodeString(", ".join(
-##                        sslInfo.subjectInfo(
-##                            QSslCertificate.CommonName)))
-##                    if cn != "":
-##                        org = cn.split(".", 1)[1]
-##                    if org == "":
-##                        org = self.tr("Unknown")
-##                self.__sslLabel.setText(" {0} ".format(org))
-##                self.__sslLabel.setVisible(True)
-##                valid = not sslInfo.isBlacklisted()
-##                if valid:
-##                    config = self.__browser.page().getSslConfiguration()
-##                    if config is None or config.sessionCipher().isNull():
-##                        valid = False
-##                self.__sslLabel.setValidity(valid)
-##                return
-##        
-##        self.__sslLabel.setVisible(False)
-##        except RuntimeError:
-##            pass
     
     def __textChanged(self, txt):
         """
@@ -272,22 +223,12 @@
             progress = self.__browser.progress()
             if progress == 0 or progress == 100:
                 if self.__browser.url().scheme() == "https":
-##                    if QSslCertificate is not None:
-##                        if self.__browser.page().hasValidSslInfo():
-##                            backgroundColor = Preferences.getWebBrowser(
-##                                "SaveUrlColor")
-##                    else:
                     backgroundColor = Preferences.getWebBrowser(
                         "SaveUrlColor")
                 p.setBrush(QPalette.Base, backgroundColor)
                 p.setBrush(QPalette.Text, foregroundColor)
             else:
                 if self.__browser.url().scheme() == "https":
-##                    if QSslCertificate is not None:
-##                        if self.__browser.page().hasValidSslInfo():
-##                            backgroundColor = Preferences.getWebBrowser(
-##                                "SaveUrlColor")
-##                    else:
                     backgroundColor = Preferences.getWebBrowser(
                         "SaveUrlColor")
                 highlight = QApplication.palette().color(QPalette.Highlight)

eric ide

mercurial