summaryrefslogtreecommitdiffstats
path: root/src/loginform.cpp
diff options
context:
space:
mode:
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();
}