summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/gui
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-04-02 17:24:45 -0300
committerTomás Touceda <chiiph@leap.se>2014-04-02 17:24:45 -0300
commit5ba94ca43aefc618cbbdbb27f077ce346ac0ef35 (patch)
tree22459b1b82c02617bf20d82c6cee055e037b47bd /src/leap/bitmask/gui
parent2468b0eda7db1169d44a95f4c71c8cee323dfcf3 (diff)
parent469a056387fa1d69dd14f0680fa0026e0a3ff80c (diff)
Merge remote-tracking branch 'refs/remotes/ivan/bug/5411_mail-is-not-disabled-at-first-start' into develop
Diffstat (limited to 'src/leap/bitmask/gui')
-rw-r--r--src/leap/bitmask/gui/mainwindow.py42
1 files changed, 30 insertions, 12 deletions
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py
index 6d3a05fa..04a98fac 100644
--- a/src/leap/bitmask/gui/mainwindow.py
+++ b/src/leap/bitmask/gui/mainwindow.py
@@ -1193,14 +1193,35 @@ class MainWindow(QtGui.QMainWindow):
self._provider_config.get_domain())
# TODO separate UI from logic.
- if self._provider_config.provides_mx() and \
- self._enabled_services.count(MX_SERVICE) > 0:
+ if self._provides_mx_and_enabled():
self._mail_status.about_to_start()
else:
self._mail_status.set_disabled()
self._maybe_start_eip()
+ def _provides_mx_and_enabled(self):
+ """
+ Defines if the current provider provides mx and if we have it enabled.
+
+ :returns: True if provides and is enabled, False otherwise
+ :rtype: bool
+ """
+ provider_config = self._get_best_provider_config()
+ return (provider_config.provides_mx() and
+ MX_SERVICE in self._enabled_services)
+
+ def _provides_eip_and_enabled(self):
+ """
+ Defines if the current provider provides eip and if we have it enabled.
+
+ :returns: True if provides and is enabled, False otherwise
+ :rtype: bool
+ """
+ provider_config = self._get_best_provider_config()
+ return (provider_config.provides_eip() and
+ EIP_SERVICE in self._enabled_services)
+
def _maybe_run_soledad_setup_checks(self):
"""
Conditionally start Soledad.
@@ -1209,6 +1230,9 @@ class MainWindow(QtGui.QMainWindow):
if self._already_started_soledad is True:
return
+ if not self._provides_mx_and_enabled():
+ return
+
username = self._login_widget.get_user()
password = unicode(self._login_widget.get_password())
provider_domain = self._login_widget.get_selected_provider()
@@ -1332,8 +1356,7 @@ class MainWindow(QtGui.QMainWindow):
# TODO for simmetry, this should be called start_smtp_service
# (and delegate all the checks to the conductor)
- if self._provider_config.provides_mx() and \
- self._enabled_services.count(MX_SERVICE) > 0:
+ if self._provides_mx_and_enabled():
self._mail_conductor.smtp_bootstrapper.run_smtp_setup_checks(
self._provider_config,
self._mail_conductor.smtp_config,
@@ -1375,9 +1398,7 @@ class MainWindow(QtGui.QMainWindow):
start_fun()
return
- enabled_services = self._enabled_services
- if self._provider_config.provides_mx() and \
- enabled_services.count(MX_SERVICE) > 0:
+ if self._provides_mx_and_enabled():
start_fun()
def _on_mail_client_logged_in(self, req):
@@ -1770,10 +1791,7 @@ class MainWindow(QtGui.QMainWindow):
provider_config = self._get_best_provider_config()
- if provider_config.provides_eip() and \
- self._enabled_services.count(EIP_SERVICE) > 0 and \
- not self._already_started_eip:
-
+ if self._provides_eip_and_enabled() and not self._already_started_eip:
# XXX this should be handled by the state machine.
self._eip_status.set_eip_status(
self.tr("Starting..."))
@@ -1788,7 +1806,7 @@ class MainWindow(QtGui.QMainWindow):
self._maybe_run_soledad_setup_checks)
else:
if not self._already_started_eip:
- if self._enabled_services.count(EIP_SERVICE) > 0:
+ if EIP_SERVICE in self._enabled_services:
self._eip_status.set_eip_status(
self.tr("Not supported"),
error=True)