summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/gui/advanced_key_management.py
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-05-16 16:18:59 -0300
committerTomás Touceda <chiiph@leap.se>2014-05-16 16:18:59 -0300
commit4c550c558dcb554b3ea1bc0246492e39e8532886 (patch)
tree3a18999e62eb18091d002e6c1c7222846a92947b /src/leap/bitmask/gui/advanced_key_management.py
parent81715dc47d77934c4f67d2527a56c28f58f0345d (diff)
parentd52daa106a97562e1cc67c5a2f242f2ef9884508 (diff)
Merge branch 'release-0.5.1'
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.