diff options
Diffstat (limited to 'src/leap/gui/login.py')
-rw-r--r-- | src/leap/gui/login.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/leap/gui/login.py b/src/leap/gui/login.py index 80f2f3db..3eb1fe39 100644 --- a/src/leap/gui/login.py +++ b/src/leap/gui/login.py @@ -19,7 +19,6 @@ Login widget implementation """ import logging -import keyring from PySide import QtCore, QtGui from ui_login import Ui_LoginWidget @@ -37,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() @@ -97,7 +98,7 @@ class LoginWidget(QtGui.QWidget): """ self.ui.cmbProviders.blockSignals(True) self.ui.cmbProviders.clear() - self.ui.cmbProviders.addItems(provider_list + ["Other..."]) + self.ui.cmbProviders.addItems(provider_list + [self.tr("Other...")]) self.ui.cmbProviders.blockSignals(False) def select_provider_by_name(self, name): @@ -194,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 |