14 from PyQt6.QtWidgets import QDialog, QTreeWidgetItem |
14 from PyQt6.QtWidgets import QDialog, QTreeWidgetItem |
15 |
15 |
16 with contextlib.suppress(ImportError): |
16 with contextlib.suppress(ImportError): |
17 from PyQt6.QtNetwork import QSslCertificate, QSslConfiguration, QSsl |
17 from PyQt6.QtNetwork import QSslCertificate, QSslConfiguration, QSsl |
18 |
18 |
19 from EricWidgets import EricMessageBox, EricFileDialog |
19 from eric7.EricWidgets import EricMessageBox, EricFileDialog |
20 |
20 |
21 from .Ui_EricSslCertificatesDialog import Ui_EricSslCertificatesDialog |
21 from .Ui_EricSslCertificatesDialog import Ui_EricSslCertificatesDialog |
22 |
22 |
23 import Preferences |
23 from eric7 import Globals, Preferences, Utilities |
24 import Utilities |
24 from eric7.EricGui import EricPixmapCache |
25 import UI.PixmapCache |
|
26 import Globals |
|
27 |
25 |
28 |
26 |
29 class EricSslCertificatesDialog(QDialog, Ui_EricSslCertificatesDialog): |
27 class EricSslCertificatesDialog(QDialog, Ui_EricSslCertificatesDialog): |
30 """ |
28 """ |
31 Class implementing a dialog to show and edit all certificates. |
29 Class implementing a dialog to show and edit all certificates. |
40 @param parent reference to the parent widget (QWidget) |
38 @param parent reference to the parent widget (QWidget) |
41 """ |
39 """ |
42 super().__init__(parent) |
40 super().__init__(parent) |
43 self.setupUi(self) |
41 self.setupUi(self) |
44 |
42 |
45 self.serversViewButton.setIcon(UI.PixmapCache.getIcon("certificates")) |
43 self.serversViewButton.setIcon(EricPixmapCache.getIcon("certificates")) |
46 self.serversDeleteButton.setIcon(UI.PixmapCache.getIcon("certificateDelete")) |
44 self.serversDeleteButton.setIcon(EricPixmapCache.getIcon("certificateDelete")) |
47 self.serversExportButton.setIcon(UI.PixmapCache.getIcon("certificateExport")) |
45 self.serversExportButton.setIcon(EricPixmapCache.getIcon("certificateExport")) |
48 self.serversImportButton.setIcon(UI.PixmapCache.getIcon("certificateImport")) |
46 self.serversImportButton.setIcon(EricPixmapCache.getIcon("certificateImport")) |
49 |
47 |
50 self.caViewButton.setIcon(UI.PixmapCache.getIcon("certificates")) |
48 self.caViewButton.setIcon(EricPixmapCache.getIcon("certificates")) |
51 self.caDeleteButton.setIcon(UI.PixmapCache.getIcon("certificateDelete")) |
49 self.caDeleteButton.setIcon(EricPixmapCache.getIcon("certificateDelete")) |
52 self.caExportButton.setIcon(UI.PixmapCache.getIcon("certificateExport")) |
50 self.caExportButton.setIcon(EricPixmapCache.getIcon("certificateExport")) |
53 self.caImportButton.setIcon(UI.PixmapCache.getIcon("certificateImport")) |
51 self.caImportButton.setIcon(EricPixmapCache.getIcon("certificateImport")) |
54 |
52 |
55 self.__populateServerCertificatesTree() |
53 self.__populateServerCertificatesTree() |
56 self.__populateCaCertificatesTree() |
54 self.__populateCaCertificatesTree() |
57 |
55 |
58 def __populateServerCertificatesTree(self): |
56 def __populateServerCertificatesTree(self): |
122 def on_serversViewButton_clicked(self): |
120 def on_serversViewButton_clicked(self): |
123 """ |
121 """ |
124 Private slot to show data of the selected server certificate. |
122 Private slot to show data of the selected server certificate. |
125 """ |
123 """ |
126 with contextlib.suppress(ImportError): |
124 with contextlib.suppress(ImportError): |
127 from EricNetwork.EricSslCertificatesInfoDialog import ( |
125 from eric7.EricNetwork.EricSslCertificatesInfoDialog import ( |
128 EricSslCertificatesInfoDialog, |
126 EricSslCertificatesInfoDialog, |
129 ) |
127 ) |
130 |
128 |
131 cert = QSslCertificate.fromData( |
129 cert = QSslCertificate.fromData( |
132 self.serversCertificatesTree.currentItem().data(0, self.CertRole) |
130 self.serversCertificatesTree.currentItem().data(0, self.CertRole) |
341 def on_caViewButton_clicked(self): |
339 def on_caViewButton_clicked(self): |
342 """ |
340 """ |
343 Private slot to show data of the selected CA certificate. |
341 Private slot to show data of the selected CA certificate. |
344 """ |
342 """ |
345 with contextlib.suppress(ImportError): |
343 with contextlib.suppress(ImportError): |
346 from EricNetwork.EricSslCertificatesInfoDialog import ( |
344 from eric7.EricNetwork.EricSslCertificatesInfoDialog import ( |
347 EricSslCertificatesInfoDialog, |
345 EricSslCertificatesInfoDialog, |
348 ) |
346 ) |
349 |
347 |
350 cert = QSslCertificate.fromData( |
348 cert = QSslCertificate.fromData( |
351 self.caCertificatesTree.currentItem().data(0, self.CertRole) |
349 self.caCertificatesTree.currentItem().data(0, self.CertRole) |