From e05d074d5458bc3cce5519227c9971d4ffa09280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Thu, 3 Oct 2013 15:36:05 -0300 Subject: Start Soledad only if Mail is enabled for the current provider Also update enabled_services in mainwindow right after login to have an updated list of services to launch from that point on. --- src/leap/bitmask/gui/mail_status.py | 11 ++++++++++- src/leap/bitmask/gui/mainwindow.py | 15 ++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'src/leap') diff --git a/src/leap/bitmask/gui/mail_status.py b/src/leap/bitmask/gui/mail_status.py index 770d991f..ab9052d7 100644 --- a/src/leap/bitmask/gui/mail_status.py +++ b/src/leap/bitmask/gui/mail_status.py @@ -199,7 +199,8 @@ class MailStatusWidget(QtGui.QWidget): :param status: the status text to display :type status: unicode - :param ready: 2 or >2 if mx is ready, 0 if stopped, 1 if it's starting. + :param ready: 2 or >2 if mx is ready, 0 if stopped, 1 if it's + starting, < 0 if disabled. :type ready: int """ self.ui.lblMailStatus.setText(status) @@ -219,6 +220,8 @@ class MailStatusWidget(QtGui.QWidget): icon = self.CONNECTED_ICON self._mx_status = self.tr('ON') tray_status = self.tr('Mail is ON') + elif ready < 0: + tray_status = self.tr("Mail is disabled") self.ui.lblMailStatusIcon.setPixmap(icon) self._action_mail_status.setText(tray_status) @@ -392,6 +395,12 @@ class MailStatusWidget(QtGui.QWidget): self._set_mail_status(self.tr("About to start, please wait..."), ready=1) + def set_disabled(self): + """ + Displays the correct UI for disabled mail. + """ + self._set_mail_status(self.tr("Disabled"), -1) + def stopped_mail(self): """ Displayes the correct UI for the stopped state. diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 7129b670..dd4a341e 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -950,17 +950,22 @@ class MainWindow(QtGui.QMainWindow): self._login_widget.logged_in() + self._enabled_services = self._settings.get_enabled_services( + self._provider_config.get_domain()) + # TODO separate UI from logic. # TODO soledad should check if we want to run only over EIP. if self._provider_config.provides_mx() and \ self._enabled_services.count(self.MX_SERVICE) > 0: self._mail_status.about_to_start() - self._soledad_bootstrapper.run_soledad_setup_checks( - self._provider_config, - self._login_widget.get_user(), - self._login_widget.get_password(), - download_if_needed=True) + self._soledad_bootstrapper.run_soledad_setup_checks( + self._provider_config, + self._login_widget.get_user(), + self._login_widget.get_password(), + download_if_needed=True) + else: + self._mail_status.set_disabled() self._download_eip_config() -- cgit v1.2.3