From 2d45a0e1cb0791c7e94b5d2a33c498954055a38e Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Thu, 13 Feb 2014 11:02:31 -0300 Subject: Improve logout action and fix typo. Related to #5131. [Closes #4815] --- changes/better-logout-handle | 2 ++ src/leap/bitmask/gui/login.py | 11 ++++++++++- src/leap/bitmask/gui/mainwindow.py | 11 ++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 changes/better-logout-handle diff --git a/changes/better-logout-handle b/changes/better-logout-handle new file mode 100644 index 00000000..11797a81 --- /dev/null +++ b/changes/better-logout-handle @@ -0,0 +1,2 @@ +- Fix logging out typo, closes #4815. +- Improve logout action, related to #5131. diff --git a/src/leap/bitmask/gui/login.py b/src/leap/bitmask/gui/login.py index 8a7c6996..4a483c32 100644 --- a/src/leap/bitmask/gui/login.py +++ b/src/leap/bitmask/gui/login.py @@ -222,6 +222,15 @@ class LoginWidget(QtGui.QWidget): self._set_cancel(not enabled) + def set_logout_btn_enabled(self, enabled): + """ + Enables or disables the logout button. + + :param enabled: wether they should be enabled or not + :type enabled: bool + """ + self.ui.btnLogout.setEnabled(enabled) + def _set_cancel(self, enabled=False): """ Enables or disables the cancel action in the "log in" process. @@ -349,7 +358,7 @@ class LoginWidget(QtGui.QWidget): """ Sets the widgets to the logging out state """ - self.ui.btnLogout.setText(self.tr("Loggin out...")) + self.ui.btnLogout.setText(self.tr("Logging out...")) self.ui.btnLogout.setEnabled(False) def done_logout(self): diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 6512ffce..b14ca19e 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -1112,7 +1112,6 @@ class MainWindow(QtGui.QMainWindow): self._srp_auth.logout_finished.connect( self._done_logging_out) - # TODO Add errback! self._login_defer = self._srp_auth.authenticate(username, password) self._login_defer.addErrback(self._login_errback) else: @@ -1143,6 +1142,13 @@ class MainWindow(QtGui.QMainWindow): self._mail_conductor.userid = full_user_id self._login_defer = None self._start_eip_bootstrap() + + # if soledad/mail is enabled: + if MX_SERVICE in self._enabled_services: + btn_enabled = self._login_widget.set_logout_btn_enabled + btn_enabled(False) + self.soledad_ready.connect(lambda: btn_enabled(True)) + self.soledad_failed.connect(lambda: btn_enabled(True)) else: self._login_widget.set_enabled(True) @@ -1804,6 +1810,9 @@ class MainWindow(QtGui.QMainWindow): """ self._soledad_bootstrapper.cancel_bootstrap() setProxiedObject(self._soledad, None) + if self._soledad_defer is not None: + logger.debug("Cancelling soledad defer.") + self._soledad_defer.cancel() # reset soledad status flag self._already_started_soledad = False -- cgit v1.2.3