summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/gui/advanced_key_management.py
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2013-12-12 16:53:35 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2013-12-13 11:50:10 -0300
commit97700c4278fdd67123317584dd66c946ee9340a8 (patch)
tree147b0f1ffdb527f61a2f4a59670d746000711b21 /src/leap/bitmask/gui/advanced_key_management.py
parent4164cdc488ba0c41f4e19ad7344a6428e4169fd0 (diff)
Add view for stored public keys. Closes #4734.
Diffstat (limited to 'src/leap/bitmask/gui/advanced_key_management.py')
-rw-r--r--src/leap/bitmask/gui/advanced_key_management.py22
1 files changed, 21 insertions, 1 deletions
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("<span style='color:#0000FF;'>NOTE</span>: "
"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))