From 80016db7817bc15485bf25289843c29bea71a27d Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sat, 4 Apr 2020 11:59:25 +0800 Subject: [PATCH] Fix wrong logic that disables "prevent sleeping" timer Also update power management state early so we don't need to wait for the timer timeout to have the effect. --- src/gui/mainwindow.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 659d374f5..a12ede08a 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -1454,8 +1454,11 @@ void MainWindow::loadPreferences(const bool configureSession) showStatusBar(pref->isStatusbarDisplayed()); - if ((pref->preventFromSuspendWhenDownloading() || pref->preventFromSuspendWhenSeeding()) && !m_preventTimer->isActive()) { - m_preventTimer->start(PREVENT_SUSPEND_INTERVAL); + if (pref->preventFromSuspendWhenDownloading() || pref->preventFromSuspendWhenSeeding()) { + if (!m_preventTimer->isActive()) { + updatePowerManagementState(); + m_preventTimer->start(PREVENT_SUSPEND_INTERVAL); + } } else { m_preventTimer->stop();