15 ) |
15 ) |
16 from PyQt5.QtWidgets import QWidget, QToolButton, QLabel, QTabWidget |
16 from PyQt5.QtWidgets import QWidget, QToolButton, QLabel, QTabWidget |
17 from PyQt5.QtNetwork import QTcpSocket, QAbstractSocket |
17 from PyQt5.QtNetwork import QTcpSocket, QAbstractSocket |
18 try: |
18 try: |
19 from PyQt5.QtNetwork import QSslSocket, QSslConfiguration |
19 from PyQt5.QtNetwork import QSslSocket, QSslConfiguration |
20 from E5Network.E5SslErrorHandler import E5SslErrorHandler |
20 from E5Network.E5SslErrorHandler import E5SslErrorHandler, E5SslErrorState |
21 SSL_AVAILABLE = True |
21 SSL_AVAILABLE = True |
22 except ImportError: |
22 except ImportError: |
23 SSL_AVAILABLE = False |
23 SSL_AVAILABLE = False |
24 |
24 |
25 from E5Gui import E5MessageBox |
25 from E5Gui import E5MessageBox |
916 |
916 |
917 @param errors list of SSL errors (list of QSslError) |
917 @param errors list of SSL errors (list of QSslError) |
918 """ |
918 """ |
919 ignored, defaultChanged = self.__sslErrorHandler.sslErrors( |
919 ignored, defaultChanged = self.__sslErrorHandler.sslErrors( |
920 errors, self.__server.getName(), self.__server.getPort()) |
920 errors, self.__server.getName(), self.__server.getPort()) |
921 if ignored == E5SslErrorHandler.NotIgnored: |
921 if ignored == E5SslErrorState.NOT_IGNORED: |
922 self.networkWidget.addErrorMessage( |
922 self.networkWidget.addErrorMessage( |
923 self.tr("SSL Error"), |
923 self.tr("SSL Error"), |
924 self.tr( |
924 self.tr( |
925 """Could not connect to {0} (port {1}) using an SSL""" |
925 """Could not connect to {0} (port {1}) using an SSL""" |
926 """ encrypted connection. Either the server does not""" |
926 """ encrypted connection. Either the server does not""" |
930 self.__socket.close() |
930 self.__socket.close() |
931 else: |
931 else: |
932 if defaultChanged: |
932 if defaultChanged: |
933 self.__socket.setSslConfiguration( |
933 self.__socket.setSslConfiguration( |
934 QSslConfiguration.defaultConfiguration()) |
934 QSslConfiguration.defaultConfiguration()) |
935 if ignored == E5SslErrorHandler.UserIgnored: |
935 if ignored == E5SslErrorState.USER_IGNORED: |
936 self.networkWidget.addErrorMessage( |
936 self.networkWidget.addErrorMessage( |
937 self.tr("SSL Error"), |
937 self.tr("SSL Error"), |
938 self.tr( |
938 self.tr( |
939 """The SSL certificate for the server {0} (port {1})""" |
939 """The SSL certificate for the server {0} (port {1})""" |
940 """ failed the authenticity check. SSL errors""" |
940 """ failed the authenticity check. SSL errors""" |