18 QNetworkRequest, |
18 QNetworkRequest, |
19 ) |
19 ) |
20 from PyQt6.QtWidgets import QDialog, QStyle |
20 from PyQt6.QtWidgets import QDialog, QStyle |
21 |
21 |
22 from eric7 import Preferences |
22 from eric7 import Preferences |
23 from eric7.EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired |
23 from eric7.EricNetwork.EricNetworkProxyFactory import ( |
|
24 EricNetworkProxyFactory, |
|
25 proxyAuthenticationRequired, |
|
26 ) |
24 from eric7.EricWidgets import EricMessageBox |
27 from eric7.EricWidgets import EricMessageBox |
25 from eric7.EricWidgets.EricApplication import ericApp |
28 from eric7.EricWidgets.EricApplication import ericApp |
|
29 from eric7.UI.AuthenticationDialog import AuthenticationDialog |
26 from eric7.Utilities.AutoSaver import AutoSaver |
30 from eric7.Utilities.AutoSaver import AutoSaver |
27 from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow |
31 from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow |
28 |
32 |
29 try: |
33 try: |
30 from eric7.EricNetwork.EricSslErrorHandler import EricSslErrorHandler |
34 from eric7.EricNetwork.EricSslErrorHandler import EricSslErrorHandler |
52 |
57 |
53 @param engine reference to the help engine (QHelpEngine) |
58 @param engine reference to the help engine (QHelpEngine) |
54 @param parent reference to the parent object (QObject) |
59 @param parent reference to the parent object (QObject) |
55 """ |
60 """ |
56 super().__init__(parent) |
61 super().__init__(parent) |
57 |
|
58 from eric7.EricNetwork.EricNetworkProxyFactory import EricNetworkProxyFactory |
|
59 |
62 |
60 self.__proxyFactory = EricNetworkProxyFactory() |
63 self.__proxyFactory = EricNetworkProxyFactory() |
61 if Preferences.getUI("UseSystemProxy"): |
64 if Preferences.getUI("UseSystemProxy"): |
62 QNetworkProxyFactory.setUseSystemConfiguration(True) |
65 QNetworkProxyFactory.setUseSystemConfiguration(True) |
63 else: |
66 else: |
83 self.proxyAuthenticationRequired.connect(proxyAuthenticationRequired) |
86 self.proxyAuthenticationRequired.connect(proxyAuthenticationRequired) |
84 self.authenticationRequired.connect( |
87 self.authenticationRequired.connect( |
85 lambda reply, auth: self.authentication(reply.url(), auth) |
88 lambda reply, auth: self.authentication(reply.url(), auth) |
86 ) |
89 ) |
87 |
90 |
88 from .EricSchemeHandler import EricSchemeHandler |
|
89 |
|
90 self.__ericSchemeHandler = EricSchemeHandler() |
91 self.__ericSchemeHandler = EricSchemeHandler() |
91 WebBrowserWindow.webProfile().installUrlSchemeHandler( |
92 WebBrowserWindow.webProfile().installUrlSchemeHandler( |
92 QByteArray(b"eric"), self.__ericSchemeHandler |
93 QByteArray(b"eric"), self.__ericSchemeHandler |
93 ) |
94 ) |
94 |
95 |
95 if engine: |
96 if engine: |
96 from .QtHelpSchemeHandler import QtHelpSchemeHandler |
97 from .QtHelpSchemeHandler import ( # __IGNORE_WARNING_I101__ |
|
98 QtHelpSchemeHandler, |
|
99 ) |
97 |
100 |
98 self.__qtHelpSchemeHandler = QtHelpSchemeHandler(engine) |
101 self.__qtHelpSchemeHandler = QtHelpSchemeHandler(engine) |
99 WebBrowserWindow.webProfile().installUrlSchemeHandler( |
102 WebBrowserWindow.webProfile().installUrlSchemeHandler( |
100 QByteArray(b"qthelp"), self.__qtHelpSchemeHandler |
103 QByteArray(b"qthelp"), self.__qtHelpSchemeHandler |
101 ) |
104 ) |
109 """ |
112 """ |
110 Private slot to save the permanent SSL error exceptions. |
113 Private slot to save the permanent SSL error exceptions. |
111 """ |
114 """ |
112 if not self.__loaded: |
115 if not self.__loaded: |
113 return |
116 return |
114 |
|
115 from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow |
|
116 |
117 |
117 if not WebBrowserWindow.isPrivate(): |
118 if not WebBrowserWindow.isPrivate(): |
118 dbString = json.dumps(self.__permanentlyIgnoredSslErrors) |
119 dbString = json.dumps(self.__permanentlyIgnoredSslErrors) |
119 Preferences.setWebBrowser("SslExceptionsDB", dbString) |
120 Preferences.setWebBrowser("SslExceptionsDB", dbString) |
120 |
121 |
143 self.__permanentlyIgnoredSslErrors = {} |
144 self.__permanentlyIgnoredSslErrors = {} |
144 |
145 |
145 # set proxy factory to None to avoid crashes |
146 # set proxy factory to None to avoid crashes |
146 QNetworkProxyFactory.setApplicationProxyFactory(None) |
147 QNetworkProxyFactory.setApplicationProxyFactory(None) |
147 |
148 |
148 def showSslErrorExceptionsDialog(self): |
149 def showSslErrorExceptionsDialog(self, parent=None): |
149 """ |
150 """ |
150 Public method to show the SSL error exceptions dialog. |
151 Public method to show the SSL error exceptions dialog. |
151 """ |
152 |
|
153 @param parent reference to the parent widget |
|
154 @type QWidget |
|
155 """ |
|
156 from .SslErrorExceptionsDialog import SslErrorExceptionsDialog |
|
157 |
152 self.__load() |
158 self.__load() |
153 |
159 |
154 from .SslErrorExceptionsDialog import SslErrorExceptionsDialog |
160 dlg = SslErrorExceptionsDialog( |
155 |
161 self.__permanentlyIgnoredSslErrors, |
156 dlg = SslErrorExceptionsDialog(self.__permanentlyIgnoredSslErrors) |
162 parent=parent, |
|
163 ) |
157 if dlg.exec() == QDialog.DialogCode.Accepted: |
164 if dlg.exec() == QDialog.DialogCode.Accepted: |
158 self.__permanentlyIgnoredSslErrors = dlg.getSslErrorExceptions() |
165 self.__permanentlyIgnoredSslErrors = dlg.getSslErrorExceptions() |
159 self.changed.emit() |
166 self.changed.emit() |
160 |
167 |
161 def clearSslExceptions(self): |
168 def clearSslExceptions(self): |