eric6/E5Network/E5SslCertificateSelectionDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
25 class E5SslCertificateSelectionDialog(QDialog, 25 class E5SslCertificateSelectionDialog(QDialog,
26 Ui_E5SslCertificateSelectionDialog): 26 Ui_E5SslCertificateSelectionDialog):
27 """ 27 """
28 Class implementing a dialog to select a SSL certificate. 28 Class implementing a dialog to select a SSL certificate.
29 """ 29 """
30 CertRole = Qt.UserRole + 1 30 CertRole = Qt.ItemDataRole.UserRole + 1
31 31
32 def __init__(self, certificates, parent=None): 32 def __init__(self, certificates, parent=None):
33 """ 33 """
34 Constructor 34 Constructor
35 35
60 self.__createCertificateEntry(cert) 60 self.__createCertificateEntry(cert)
61 61
62 self.certificatesTree.expandAll() 62 self.certificatesTree.expandAll()
63 for i in range(self.certificatesTree.columnCount()): 63 for i in range(self.certificatesTree.columnCount()):
64 self.certificatesTree.resizeColumnToContents(i) 64 self.certificatesTree.resizeColumnToContents(i)
65 self.certificatesTree.sortItems(0, Qt.AscendingOrder) 65 self.certificatesTree.sortItems(0, Qt.SortOrder.AscendingOrder)
66 66
67 def __createCaCertificateEntry(self, cert): 67 def __createCaCertificateEntry(self, cert):
68 """ 68 """
69 Private method to create a certificate entry. 69 Private method to create a certificate entry.
70 70
71 @param cert certificate to insert 71 @param cert certificate to insert
72 @type QSslCertificate 72 @type QSslCertificate
73 """ 73 """
74 # step 1: extract the info to be shown 74 # step 1: extract the info to be shown
75 organisation = Utilities.decodeString( 75 organisation = Utilities.decodeString(
76 ", ".join(cert.subjectInfo(QSslCertificate.Organization))) 76 ", ".join(cert.subjectInfo(
77 QSslCertificate.SubjectInfo.Organization)))
77 commonName = Utilities.decodeString( 78 commonName = Utilities.decodeString(
78 ", ".join(cert.subjectInfo(QSslCertificate.CommonName))) 79 ", ".join(cert.subjectInfo(
80 QSslCertificate.SubjectInfo.CommonName)))
79 if organisation is None or organisation == "": 81 if organisation is None or organisation == "":
80 organisation = self.tr("(Unknown)") 82 organisation = self.tr("(Unknown)")
81 if commonName is None or commonName == "": 83 if commonName is None or commonName == "":
82 commonName = self.tr("(Unknown common name)") 84 commonName = self.tr("(Unknown common name)")
83 expiryDate = cert.expiryDate().toString("yyyy-MM-dd") 85 expiryDate = cert.expiryDate().toString("yyyy-MM-dd")
84 86
85 # step 2: create the entry 87 # step 2: create the entry
86 items = self.certificatesTree.findItems( 88 items = self.certificatesTree.findItems(
87 organisation, 89 organisation,
88 Qt.MatchFixedString | Qt.MatchCaseSensitive) 90 Qt.MatchFlag.MatchFixedString | Qt.MatchFlag.MatchCaseSensitive)
89 if len(items) == 0: 91 if len(items) == 0:
90 parent = QTreeWidgetItem(self.certificatesTree, [organisation]) 92 parent = QTreeWidgetItem(self.certificatesTree, [organisation])
91 parent.setFirstColumnSpanned(True) 93 parent.setFirstColumnSpanned(True)
92 else: 94 else:
93 parent = items[0] 95 parent = items[0]

eric ide

mercurial