summaryrefslogtreecommitdiffstats
path: root/src/loginform.cpp
diff options
context:
space:
mode:
authorJonathan Bauer2019-06-04 11:57:24 +0200
committerJonathan Bauer2019-06-04 11:57:24 +0200
commitf6b59f899f3b2b79d7fe57639e8d7aff73d943a4 (patch)
treed7fa8af991c2838ace9d32cc6a1d36b8e61b2627 /src/loginform.cpp
parentreset to "chooser" page on inactivity (diff)
downloadslxgreeter-f6b59f899f3b2b79d7fe57639e8d7aff73d943a4.tar.gz
slxgreeter-f6b59f899f3b2b79d7fe57639e8d7aff73d943a4.tar.xz
slxgreeter-f6b59f899f3b2b79d7fe57639e8d7aff73d943a4.zip
always reset input form when user idles
still defaults to 30 or configurable with 'reset-timeout'.
Diffstat (limited to 'src/loginform.cpp')
-rw-r--r--src/loginform.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/loginform.cpp b/src/loginform.cpp
index f41d99e..d4f8abd 100644
--- a/src/loginform.cpp
+++ b/src/loginform.cpp
@@ -91,13 +91,13 @@ void LoginForm::initialize()
this->checkCaps();
});
- resetFormTimer.setInterval(Settings::sessionChooserResetTimer() != 0 ?
- Settings::sessionChooserResetTimer() * 1000 : 30000); // default to 30s
+ // timer to reset the form to its original state
+ resetFormTimer.setInterval(Settings::resetForm() != 0 ?
+ Settings::resetForm() * 1000 : 30000); // default to 30s
connect(&resetFormTimer, &QTimer::timeout, this, [this]() {
long idleTime = static_cast<long>(getIdleTime(QX11Info::display()));
- std::cerr << "User idle time: " << idleTime << std::endl;
- if (idleTime > Settings::sessionChooserResetTimer() * 1000l)
- resetLoginChooser();
+ if (idleTime > Settings::resetForm() * 1000l)
+ resetForm();
});
resetFormTimer.start();
@@ -136,7 +136,7 @@ void LoginForm::initialize()
ui->loginChooser->setCurrentWidget(ui->guestPage);
});
connect(ui->backButton, &QAbstractButton::released, this, [this]() {
- resetLoginChooser();
+ resetForm();
});
connect(ui->loginChooser, &QStackedWidget::currentChanged, this, [this]() {
if (ui->loginChooser->currentWidget() == ui->welcomePage) {
@@ -320,15 +320,16 @@ void LoginForm::keyPressEvent(QKeyEvent *event)
}
}
if (Settings::guestSessionEnabled() && event->key() == Qt::Key_Escape) {
- resetLoginChooser();
+ resetForm();
}
// Fallback: Passthrough
QWidget::keyPressEvent(event);
}
-void LoginForm::resetLoginChooser()
+void LoginForm::resetForm()
{
- ui->loginChooser->setCurrentWidget(ui->welcomePage);
+ if (Settings::guestSessionEnabled())
+ ui->loginChooser->setCurrentWidget(ui->welcomePage);
ui->userInput->clear();
ui->passwordInput->clear();
}