98 @pyqtSlot() |
99 @pyqtSlot() |
99 def on_certificatesTree_itemSelectionChanged(self): |
100 def on_certificatesTree_itemSelectionChanged(self): |
100 """ |
101 """ |
101 Private slot to handle the selection of an item. |
102 Private slot to handle the selection of an item. |
102 """ |
103 """ |
103 enable = len(self.certificatesTree.selectedItems()) > 0 and \ |
104 enable = ( |
|
105 len(self.certificatesTree.selectedItems()) > 0 and |
104 self.certificatesTree.selectedItems()[0].parent() is not None |
106 self.certificatesTree.selectedItems()[0].parent() is not None |
|
107 ) |
105 self.buttonBox.button(QDialogButtonBox.OK).setEnabled(enable) |
108 self.buttonBox.button(QDialogButtonBox.OK).setEnabled(enable) |
106 self.viewButton.setEnabled(enable) |
109 self.viewButton.setEnabled(enable) |
107 |
110 |
108 @pyqtSlot() |
111 @pyqtSlot() |
109 def on_viewButton_clicked(self): |
112 def on_viewButton_clicked(self): |
110 """ |
113 """ |
111 Private slot to show data of the selected certificate. |
114 Private slot to show data of the selected certificate. |
112 """ |
115 """ |
113 try: |
116 try: |
114 from E5Network.E5SslCertificatesInfoDialog import \ |
117 from E5Network.E5SslCertificatesInfoDialog import ( |
115 E5SslCertificatesInfoDialog |
118 E5SslCertificatesInfoDialog |
|
119 ) |
116 cert = QSslCertificate.fromData( |
120 cert = QSslCertificate.fromData( |
117 self.certificatesTree.selectedItems()[0].data( |
121 self.certificatesTree.selectedItems()[0].data( |
118 0, self.CertRole)) |
122 0, self.CertRole)) |
119 dlg = E5SslCertificatesInfoDialog(cert, self) |
123 dlg = E5SslCertificatesInfoDialog(cert, self) |
120 dlg.exec_() |
124 dlg.exec_() |
126 Public method to get the selected certificate. |
130 Public method to get the selected certificate. |
127 |
131 |
128 @return selected certificate |
132 @return selected certificate |
129 @rtype QSslCertificate |
133 @rtype QSslCertificate |
130 """ |
134 """ |
131 valid = len(self.certificatesTree.selectedItems()) > 0 and \ |
135 valid = ( |
|
136 len(self.certificatesTree.selectedItems()) > 0 and |
132 self.certificatesTree.selectedItems()[0].parent() is not None |
137 self.certificatesTree.selectedItems()[0].parent() is not None |
|
138 ) |
133 |
139 |
134 if valid: |
140 if valid: |
135 certificate = QSslCertificate.fromData( |
141 certificate = QSslCertificate.fromData( |
136 self.certificatesTree.selectedItems()[0].data( |
142 self.certificatesTree.selectedItems()[0].data( |
137 0, self.CertRole)) |
143 0, self.CertRole)) |