summaryrefslogtreecommitdiffstats
path: root/src/dialog.cpp
diff options
context:
space:
mode:
authorSteffen Ritter2017-08-24 16:42:36 +0200
committerSteffen Ritter2017-08-24 16:42:36 +0200
commitd029ce3e3d3ab1acafdc78f2fd4dfde03419c3fd (patch)
tree5d776133bf6154e15daa3d9f47662216fde5db94 /src/dialog.cpp
parentFix admin mode checkbox handling (diff)
downloadvmchooser2-d029ce3e3d3ab1acafdc78f2fd4dfde03419c3fd.tar.gz
vmchooser2-d029ce3e3d3ab1acafdc78f2fd4dfde03419c3fd.tar.xz
vmchooser2-d029ce3e3d3ab1acafdc78f2fd4dfde03419c3fd.zip
Reset 'autoquit' on user interaction
Diffstat (limited to 'src/dialog.cpp')
-rw-r--r--src/dialog.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
index f93a8bd..efe659d 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -31,6 +31,7 @@ Dialog::Dialog(int defaultTab, bool examMode, QWidget *parent)
userInteracted_ = false;
genericExpandedOnce_ = false;
examMode_ = examMode;
+ autoQuit_ = g_autoQuitSeconds;
ui->setupUi(this);
@@ -183,7 +184,7 @@ void Dialog::on_treeView_doubleClicked(const QModelIndex& index)
}
ChooserSettings::setSetting("last-session", (s->shortDescription()));
ChooserSettings::setSetting("last-tab", QString::number(activeTab_));
- g_autoQuitSeconds = 0; // So we don't kill the session :>
+ autoQuit_ = 0; // So we don't kill the session :>
setVisible(false);
} else {
QMessageBox::warning(
@@ -398,13 +399,15 @@ void Dialog::onCenterTimer() {
}
}
// Handle auto-quit timeout
- if (g_autoQuitSeconds > 0) {
- g_autoQuitSeconds--;
- if (g_autoQuitSeconds == 0) {
+ if (autoQuit_ > 0) {
+ autoQuit_--;
+ if (autoQuit_ == 0) {
qApp->exit(0);
- } else if (g_autoQuitSeconds < 60) {
- ui->lblAutoQuit->setText(this->trUtf8("Auto logout in %1").arg(g_autoQuitSeconds));
+ } else if (autoQuit_ < 60) {
+ ui->lblAutoQuit->setText(this->trUtf8("Auto logout in %1").arg(autoQuit_));
ui->lblAutoQuit->show();
+ } else if (ui->lblAutoQuit->isVisible()) {
+ ui->lblAutoQuit->hide();
}
}
}
@@ -822,6 +825,7 @@ void Dialog::selectFirstElement() {
/* install this filter to the filterEdit to listen for arrow keys */
bool Dialog::eventFilter(QObject*, QEvent *event) {
if (event->type() == QEvent::KeyPress) {
+ autoQuit_ = g_autoQuitSeconds;
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
bool fortv = false;
if (keyEvent->key() == Qt::Key_Right) {
@@ -844,6 +848,8 @@ bool Dialog::eventFilter(QObject*, QEvent *event) {
ui->treeView->setFocus();
return true;
}
+ } else if (event->type() == QEvent::MouseMove) {
+ autoQuit_ = g_autoQuitSeconds;
}
return false;
}