19 from PyQt5.QtCore import pyqtSignal, pyqtSlot, PYQT_VERSION, Qt, QUrl, \ |
19 from PyQt5.QtCore import pyqtSignal, pyqtSlot, PYQT_VERSION, Qt, QUrl, \ |
20 QFileInfo, QTimer, QEvent, QPoint, QPointF, QDateTime, QStandardPaths, \ |
20 QFileInfo, QTimer, QEvent, QPoint, QPointF, QDateTime, QStandardPaths, \ |
21 QByteArray, QIODevice, QDataStream |
21 QByteArray, QIODevice, QDataStream |
22 from PyQt5.QtGui import QDesktopServices, QClipboard, QIcon, \ |
22 from PyQt5.QtGui import QDesktopServices, QClipboard, QIcon, \ |
23 QContextMenuEvent, QPixmap |
23 QContextMenuEvent, QPixmap |
24 from PyQt5.QtWidgets import qApp, QStyle, QMenu, QApplication |
24 from PyQt5.QtWidgets import qApp, QStyle, QMenu, QApplication, QDialog |
25 from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage, \ |
25 from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage, \ |
26 QWebEngineDownloadItem |
26 QWebEngineDownloadItem |
27 |
27 |
28 from E5Gui import E5MessageBox, E5FileDialog |
28 from E5Gui import E5MessageBox, E5FileDialog |
29 |
29 |
159 self.__page.quotaRequested.connect(self.__quotaRequested) |
159 self.__page.quotaRequested.connect(self.__quotaRequested) |
160 self.__page.registerProtocolHandlerRequested.connect( |
160 self.__page.registerProtocolHandlerRequested.connect( |
161 self.__registerProtocolHandlerRequested) |
161 self.__registerProtocolHandlerRequested) |
162 except AttributeError: |
162 except AttributeError: |
163 # pre Qt 5.11 |
163 # pre Qt 5.11 |
|
164 pass |
|
165 try: |
|
166 self.__page.selectClientCertificate.connect( |
|
167 self.__selectClientCertificate) |
|
168 except AttributeError: |
|
169 # pre Qt 5.12 |
164 pass |
170 pass |
165 |
171 |
166 def __setRwhvqt(self): |
172 def __setRwhvqt(self): |
167 """ |
173 """ |
168 Private slot to set widget that receives input events. |
174 Private slot to set widget that receives input events. |
2287 |
2293 |
2288 if ok: |
2294 if ok: |
2289 request.accept() |
2295 request.accept() |
2290 else: |
2296 else: |
2291 request.reject() |
2297 request.reject() |
|
2298 |
|
2299 ########################################################################### |
|
2300 ## Methods below implement slots for Qt 5.12+ |
|
2301 ########################################################################### |
|
2302 |
|
2303 if qVersionTuple() >= (5, 12, 0): |
|
2304 @pyqtSlot("QWebEngineClientCertificateSelection") |
|
2305 def __selectClientCertificate(self, clientCertificateSelection): |
|
2306 """ |
|
2307 Private slot to handle the client certificate selection request. |
|
2308 |
|
2309 @param clientCertificateSelection list of client SSL certificates |
|
2310 found in system's client certificate store |
|
2311 @type QWebEngineClientCertificateSelection |
|
2312 """ |
|
2313 certificates = clientCertificateSelection.certificates() |
|
2314 if len(certificates) == 0: |
|
2315 clientCertificateSelection.selectNone() |
|
2316 elif len(certificates) == 1: |
|
2317 clientCertificateSelection.select(certificates[0]) |
|
2318 else: |
|
2319 certificate = None |
|
2320 from E5Network.E5SslCertificateSelectionDialog import \ |
|
2321 E5SslCertificateSelectionDialog |
|
2322 dlg = E5SslCertificateSelectionDialog(certificates, self) |
|
2323 if dlg.exec_() == QDialog.Accepted: |
|
2324 certificate = dlg.getSelectedCertificate() |
|
2325 |
|
2326 if certificate is None: |
|
2327 clientCertificateSelection.selectNone() |
|
2328 else: |
|
2329 clientCertificateSelection.select(certificate) |