summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/gui/advanced_key_management.py
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-04-22 14:31:45 -0300
committerTomás Touceda <chiiph@leap.se>2014-04-22 14:31:45 -0300
commit9095efc3c98d043cd32a783b0bebba6baf259e55 (patch)
treeefccbc98c6facbe7c980ea0b18f1f1b629e4801b /src/leap/bitmask/gui/advanced_key_management.py
parent26a6200054c923773ca665159c1c7186f1f1c0a6 (diff)
parentd0b5734262a59e1ac86e9a9ed74f0744624e3554 (diff)
Merge remote-tracking branch 'refs/remotes/ivan/feature/5513_update-note-in-akm' into develop
Diffstat (limited to 'src/leap/bitmask/gui/advanced_key_management.py')
-rw-r--r--src/leap/bitmask/gui/advanced_key_management.py38
1 files changed, 30 insertions, 8 deletions
diff --git a/src/leap/bitmask/gui/advanced_key_management.py b/src/leap/bitmask/gui/advanced_key_management.py
index cbc8c3e3..be6b4410 100644
--- a/src/leap/bitmask/gui/advanced_key_management.py
+++ b/src/leap/bitmask/gui/advanced_key_management.py
@@ -30,12 +30,17 @@ from ui_advanced_key_management import Ui_AdvancedKeyManagement
logger = logging.getLogger(__name__)
-class AdvancedKeyManagement(QtGui.QWidget):
+class AdvancedKeyManagement(QtGui.QDialog):
"""
Advanced Key Management
"""
- def __init__(self, user, keymanager, soledad):
+ def __init__(self, parent, has_mx, user, keymanager, soledad):
"""
+ :param parent: parent object of AdvancedKeyManagement.
+ :parent type: QWidget
+ :param has_mx: defines whether the current provider provides email or
+ not.
+ :type has_mx: bool
:param user: the current logged in user.
:type user: unicode
:param keymanager: the existing keymanager instance
@@ -43,7 +48,7 @@ class AdvancedKeyManagement(QtGui.QWidget):
:param soledad: a loaded instance of Soledad
:type soledad: Soledad
"""
- QtGui.QWidget.__init__(self)
+ QtGui.QDialog.__init__(self, parent)
self.ui = Ui_AdvancedKeyManagement()
self.ui.setupUi(self)
@@ -52,13 +57,18 @@ class AdvancedKeyManagement(QtGui.QWidget):
self.ui.pbImportKeys.setVisible(False)
# if Soledad is not started yet
+ if not has_mx:
+ msg = self.tr("The provider that you are using "
+ "does not support {0}.")
+ msg = msg.format(get_service_display_name(MX_SERVICE))
+ self._disable_ui(msg)
+ return
+
+ # if Soledad is not started yet
if sameProxiedObjects(soledad, None):
- 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 = self.tr("To use this, you need to enable/start {0}.")
msg = msg.format(get_service_display_name(MX_SERVICE))
- self.ui.lblStatus.setText(msg)
+ self._disable_ui(msg)
return
# XXX: since import is disabled this is no longer a dangerous feature.
# else:
@@ -90,6 +100,18 @@ class AdvancedKeyManagement(QtGui.QWidget):
self._list_keys()
+ def _disable_ui(self, msg):
+ """
+ Disable the UI and set a note in the status bar.
+
+ :param msg: note to display in the status bar.
+ :type msg: unicode
+ """
+ self.ui.gbMyKeyPair.setEnabled(False)
+ self.ui.gbStoredPublicKeys.setEnabled(False)
+ msg = self.tr("<span style='color:#0000FF;'>NOTE</span>: ") + msg
+ self.ui.lblStatus.setText(msg)
+
def _import_keys(self):
"""
Imports the user's key pair.