From c43193f36b69620a5f88ec67c515975819c6b542 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Thu, 29 Aug 2013 17:19:02 -0300 Subject: Enable password change when soledad is ready. Closes #3610. --- src/leap/bitmask/gui/mainwindow.py | 21 +++++++++++++++++++-- src/leap/bitmask/gui/preferenceswindow.py | 20 ++++++++++++-------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 34451928..6d612d4e 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -284,6 +284,7 @@ class MainWindow(QtGui.QMainWindow): # Services signals/slots connection self.new_updates.connect(self._react_to_new_updates) self.soledad_ready.connect(self._start_imap_service) + self.soledad_ready.connect(self._set_soledad_ready) self.mail_client_logged_in.connect(self._fetch_incoming_mail) ################################# end Qt Signals connection ######## @@ -298,6 +299,7 @@ class MainWindow(QtGui.QMainWindow): self._bypass_checks = bypass_checks self._soledad = None + self._soledad_ready = False self._keymanager = None self._imap_service = None @@ -415,11 +417,26 @@ class MainWindow(QtGui.QMainWindow): Displays the preferences window. """ preferences_window = PreferencesWindow( - self, self._srp_auth, self._soledad, - self._settings, self._standalone) + self, self._srp_auth, self._settings, self._standalone) + + if self._soledad_ready: + preferences_window.set_soledad_ready(self._soledad) + else: + self.soledad_ready.connect( + lambda: preferences_window.set_soledad_ready(self._soledad)) preferences_window.show() + def _set_soledad_ready(self): + """ + SLOT + TRIGGERS: + self.soledad_ready + + It sets the soledad object as ready to use. + """ + self._soledad_ready = True + def _uncheck_logger_button(self): """ SLOT diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py index 05f616b0..17e12304 100644 --- a/src/leap/bitmask/gui/preferenceswindow.py +++ b/src/leap/bitmask/gui/preferenceswindow.py @@ -42,14 +42,12 @@ class PreferencesWindow(QtGui.QDialog): WEAK_PASSWORDS = ("123456", "qweasd", "qwerty", "password") - def __init__(self, parent, srp_auth, soledad, leap_settings, standalone): + def __init__(self, parent, srp_auth, leap_settings, standalone): """ :param parent: parent object of the PreferencesWindow. :parent type: QWidget :param srp_auth: SRPAuth object configured in the main app. :type srp_auth: SRPAuth - :param soledad: Soledad object configured in the main app. - :type soledad: Soledad :param standalone: If True, the application is running as standalone and the preferences dialog should display some messages according to this. @@ -58,9 +56,9 @@ class PreferencesWindow(QtGui.QDialog): QtGui.QDialog.__init__(self, parent) self._srp_auth = srp_auth - self._soledad = soledad self._settings = leap_settings self._standalone = standalone + self._soledad = None # Load UI self.ui = Ui_Preferences() @@ -76,21 +74,23 @@ class PreferencesWindow(QtGui.QDialog): self.ui.cbProvidersServices.currentIndexChanged[unicode].connect( self._populate_services) - parent.soledad_ready.connect(self._soledad_ready) - if not self._settings.get_configured_providers(): self.ui.gbEnabledServices.setEnabled(False) else: self._add_configured_providers() - def _soledad_ready(self): + def set_soledad_ready(self, soledad): """ SLOT TRIGGERS: parent.soledad_ready + It sets the soledad object as ready to use. + + :param soledad: Soledad object configured in the main app. + :type soledad: Soledad """ - self._soledad_ready = True + self._soledad = soledad self.ui.gbPasswordChange.setEnabled(True) def _set_password_change_status(self, status, error=False, success=False): @@ -128,6 +128,10 @@ class PreferencesWindow(QtGui.QDialog): def _change_password(self): """ + SLOT + TRIGGERS: + self.ui.pbChangePassword.clicked + Changes the user's password if the inputboxes are correctly filled. """ username = self._srp_auth.get_username() -- cgit v1.2.3