From 97700c4278fdd67123317584dd66c946ee9340a8 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Thu, 12 Dec 2013 16:53:35 -0300 Subject: Add view for stored public keys. Closes #4734. --- src/leap/bitmask/gui/advanced_key_management.py | 22 +++++- src/leap/bitmask/gui/ui/advanced_key_management.ui | 79 ++++++++++++++++------ 2 files changed, 79 insertions(+), 22 deletions(-) (limited to 'src/leap/bitmask') diff --git a/src/leap/bitmask/gui/advanced_key_management.py b/src/leap/bitmask/gui/advanced_key_management.py index 2c0fa034..8f15719d 100644 --- a/src/leap/bitmask/gui/advanced_key_management.py +++ b/src/leap/bitmask/gui/advanced_key_management.py @@ -50,7 +50,8 @@ class AdvancedKeyManagement(QtGui.QWidget): # if Soledad is not started yet if sameProxiedObjects(soledad, None): - self.ui.container.setEnabled(False) + self.ui.gbMyKeyPair.setEnabled(False) + self.ui.gbStoredPublicKeys.setEnabled(False) msg = self.tr("NOTE: " "To use this, you need to enable/start {0}.") msg = msg.format(get_service_display_name(MX_SERVICE)) @@ -79,6 +80,12 @@ class AdvancedKeyManagement(QtGui.QWidget): self.ui.pbImportKeys.clicked.connect(self._import_keys) self.ui.pbExportKeys.clicked.connect(self._export_keys) + # Stretch columns to content + self.ui.twPublicKeys.horizontalHeader().setResizeMode( + 0, QtGui.QHeaderView.Stretch) + + self._list_keys() + def _import_keys(self): """ Imports the user's key pair. @@ -183,3 +190,16 @@ class AdvancedKeyManagement(QtGui.QWidget): return else: logger.debug('Export canceled by the user.') + + def _list_keys(self): + """ + Loads all the public keys stored in the local db to the keys table. + """ + keys = self._keymanager.get_all_keys_in_local_db() + + keys_table = self.ui.twPublicKeys + for key in keys: + row = keys_table.rowCount() + keys_table.insertRow(row) + keys_table.setItem(row, 0, QtGui.QTableWidgetItem(key.address)) + keys_table.setItem(row, 1, QtGui.QTableWidgetItem(key.key_id)) diff --git a/src/leap/bitmask/gui/ui/advanced_key_management.ui b/src/leap/bitmask/gui/ui/advanced_key_management.ui index d61aa87e..1112670f 100644 --- a/src/leap/bitmask/gui/ui/advanced_key_management.ui +++ b/src/leap/bitmask/gui/ui/advanced_key_management.ui @@ -6,8 +6,8 @@ 0 0 - 431 - 188 + 504 + 546 @@ -17,10 +17,13 @@ :/images/mask-icon.png:/images/mask-icon.png - - - - + + + + + My key pair + + @@ -90,20 +93,7 @@ - - - - Qt::Vertical - - - - 20 - 40 - - - - - + @@ -135,9 +125,56 @@ + leKeyID + leUser + leFingerprint + label_3 + label_5 + label + + + + + + Stored public keys + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + Qt::ElideRight + + + true + + + + Email + + + + + Key ID + + + + + - + -- cgit v1.2.3