--- a/eric6/E5Network/E5SslCertificatesDialog.py Mon Mar 01 17:48:43 2021 +0100 +++ b/eric6/E5Network/E5SslCertificatesDialog.py Tue Mar 02 17:17:09 2021 +0100 @@ -32,7 +32,7 @@ """ Class implementing a dialog to show and edit all certificates. """ - CertRole = Qt.UserRole + 1 + CertRole = Qt.ItemDataRole.UserRole + 1 def __init__(self, parent=None): """ @@ -87,9 +87,11 @@ """ # step 1: extract the info to be shown organisation = Utilities.decodeString( - ", ".join(cert.subjectInfo(QSslCertificate.Organization))) + ", ".join(cert.subjectInfo( + QSslCertificate.SubjectInfo.Organization))) commonName = Utilities.decodeString( - ", ".join(cert.subjectInfo(QSslCertificate.CommonName))) + ", ".join(cert.subjectInfo( + QSslCertificate.SubjectInfo.CommonName))) if organisation is None or organisation == "": organisation = self.tr("(Unknown)") if commonName is None or commonName == "": @@ -99,7 +101,7 @@ # step 2: create the entry items = self.serversCertificatesTree.findItems( organisation, - Qt.MatchFixedString | Qt.MatchCaseSensitive) + Qt.MatchFlag.MatchFixedString | Qt.MatchFlag.MatchCaseSensitive) if len(items) == 0: parent = QTreeWidgetItem( self.serversCertificatesTree, [organisation]) @@ -211,7 +213,8 @@ for cert in certs: if cert in sCerts: commonStr = ", ".join( - cert.subjectInfo(QSslCertificate.CommonName)) + cert.subjectInfo( + QSslCertificate.SubjectInfo.CommonName)) E5MessageBox.warning( self, self.tr("Import Certificate"), @@ -283,7 +286,7 @@ self.caCertificatesTree.expandAll() for i in range(self.caCertificatesTree.columnCount()): self.caCertificatesTree.resizeColumnToContents(i) - self.caCertificatesTree.sortItems(0, Qt.AscendingOrder) + self.caCertificatesTree.sortItems(0, Qt.SortOrder.AscendingOrder) def __createCaCertificateEntry(self, cert): """ @@ -293,9 +296,11 @@ """ # step 1: extract the info to be shown organisation = Utilities.decodeString( - ", ".join(cert.subjectInfo(QSslCertificate.Organization))) + ", ".join(cert.subjectInfo( + QSslCertificate.SubjectInfo.Organization))) commonName = Utilities.decodeString( - ", ".join(cert.subjectInfo(QSslCertificate.CommonName))) + ", ".join(cert.subjectInfo( + QSslCertificate.SubjectInfo.CommonName))) if organisation is None or organisation == "": organisation = self.tr("(Unknown)") if commonName is None or commonName == "": @@ -305,7 +310,7 @@ # step 2: create the entry items = self.caCertificatesTree.findItems( organisation, - Qt.MatchFixedString | Qt.MatchCaseSensitive) + Qt.MatchFlag.MatchFixedString | Qt.MatchFlag.MatchCaseSensitive) if len(items) == 0: parent = QTreeWidgetItem(self.caCertificatesTree, [organisation]) parent.setFirstColumnSpanned(True) @@ -395,7 +400,8 @@ for cert in certs: if cert in caCerts: commonStr = ", ".join( - cert.subjectInfo(QSslCertificate.CommonName)) + cert.subjectInfo( + QSslCertificate.SubjectInfo.CommonName)) E5MessageBox.warning( self, self.tr("Import Certificate"), @@ -463,7 +469,7 @@ return f = QFile(fname) - if not f.open(QIODevice.WriteOnly): + if not f.open(QIODevice.OpenModeFlag.WriteOnly): E5MessageBox.critical( self, self.tr("Export Certificate"), @@ -495,7 +501,7 @@ if fname: f = QFile(fname) - if not f.open(QIODevice.ReadOnly): + if not f.open(QIODevice.OpenModeFlag.ReadOnly): E5MessageBox.critical( self, self.tr("Export Certificate"), @@ -507,9 +513,9 @@ crt = f.readAll() f.close() - cert = QSslCertificate.fromData(crt, QSsl.Pem) + cert = QSslCertificate.fromData(crt, QSsl.EncodingFormat.Pem) if not cert: - cert = QSslCertificate.fromData(crt, QSsl.Der) + cert = QSslCertificate.fromData(crt, QSsl.EncodingFormat.Der) return cert