summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-03-11 18:43:02 -0300
committerTomás Touceda <chiiph@leap.se>2013-03-11 18:43:02 -0300
commit461721850ee668d1a5e612de6af4cf1d2eeeca74 (patch)
tree6b6f877a4717cef6761194e787f41997ff53119d
parent0a295be5fb396e67d7ce6800a647adbc69acee8b (diff)
Disable remember checkbox if no keyring is available
Also set properly the enabledness of chkAutoLogin
-rw-r--r--src/leap/gui/mainwindow.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/leap/gui/mainwindow.py b/src/leap/gui/mainwindow.py
index cf795a8e..7b03eabb 100644
--- a/src/leap/gui/mainwindow.py
+++ b/src/leap/gui/mainwindow.py
@@ -139,6 +139,10 @@ class MainWindow(QtGui.QMainWindow):
QtCore.SIGNAL("aboutToQuit()"),
self._checker_thread.set_should_quit)
+ self.ui.chkRemember.stateChanged.connect(
+ self._remember_state_changed)
+ self.ui.chkRemember.setEnabled(keyring.get_keyring() is not None)
+
self.ui.action_sign_out.setEnabled(False)
self.ui.action_sign_out.triggered.connect(self._logout)
self.ui.action_about_leap.triggered.connect(self._about)
@@ -196,6 +200,9 @@ class MainWindow(QtGui.QMainWindow):
self._wizard.exec_()
self._wizard = None
+ def _remember_state_changed(self, state):
+ self.ui.chkAutoLogin.setEnabled(state == QtCore.Qt.Checked)
+
def _finish_init(self):
settings = QtCore.QSettings()
self.ui.cmbProviders.addItems(self._configured_providers())
@@ -221,7 +228,8 @@ class MainWindow(QtGui.QMainWindow):
if saved_user is not None:
self.ui.lnUser.setText(saved_user)
self.ui.chkRemember.setChecked(True)
- self.ui.chkAutoLogin.setEnabled(True)
+ self.ui.chkAutoLogin.setEnabled(self.ui.chkRemember
+ .isEnabled())
saved_password = keyring.get_password(self.KEYRING_KEY,
saved_user
.encode("utf8"))
@@ -405,7 +413,8 @@ class MainWindow(QtGui.QMainWindow):
self.ui.lnPassword.setEnabled(enabled)
self.ui.btnLogin.setEnabled(enabled)
self.ui.chkRemember.setEnabled(enabled)
- self.ui.chkAutoLogin.setEnabled(enabled)
+ if not enabled:
+ self.ui.chkAutoLogin.setEnabled(False)
self.ui.cmbProviders.setEnabled(enabled)
def _download_provider_config(self):