diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-08-01 16:10:29 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-08-01 18:08:14 -0300 |
commit | 571fdf3908bc34d063e6a316abed448efbe1bfdb (patch) | |
tree | 28d28a16b9d010e4d914970798fdf93581153328 /src/leap/gui/login.py | |
parent | d1d9005201ea772c7599aa279650e49e1d91c27a (diff) |
Add cancel button to login. Closes #3318.
Diffstat (limited to 'src/leap/gui/login.py')
-rw-r--r-- | src/leap/gui/login.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/leap/gui/login.py b/src/leap/gui/login.py index 36934ace..3eb1fe39 100644 --- a/src/leap/gui/login.py +++ b/src/leap/gui/login.py @@ -36,6 +36,8 @@ class LoginWidget(QtGui.QWidget): # Emitted when the login button is clicked login = QtCore.Signal() + cancel_login = QtCore.Signal() + # Emitted when the user selects "Other..." in the provider # combobox or click "Create Account" show_wizard = QtCore.Signal() @@ -193,6 +195,26 @@ class LoginWidget(QtGui.QWidget): self.ui.chkRemember.setEnabled(enabled) self.ui.cmbProviders.setEnabled(enabled) + def set_cancel(self, enabled=False): + """ + Enables or disables the cancel action in the "log in" process. + + :param enabled: wether it should be enabled or not + :type enabled: bool + """ + self.ui.btnLogin.setEnabled(enabled) + text = self.tr("Cancel") + login_or_cancel = self.cancel_login + + if not enabled: + text = self.tr("Log In") + login_or_cancel = self.login + + self.ui.btnLogin.setText(text) + + self.ui.btnLogin.clicked.disconnect() + self.ui.btnLogin.clicked.connect(login_or_cancel) + def _focus_password(self): """ Focuses in the password lineedit |