diff options
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 |