[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [dragon] src/app: only inhibit powersaving iff not done already
From: Harald Sitter <sitter () kde ! org>
Date: 2012-06-01 0:11:14
Message-ID: 20120601001114.7193FA60A9 () git ! kde ! org
[Download RAW message or body]
Git commit 8731c4c568a41cc8e83d407a3f597d019b00c683 by Harald Sitter.
Committed on 01/06/2012 at 02:06.
Pushed by sitter into branch 'master'.
only inhibit powersaving iff not done already
also make sure the cookies are reset accordingly
M +13 -7 src/app/mainWindow.cpp
http://commits.kde.org/dragon/8731c4c568a41cc8e83d407a3f597d019b00c683
diff --git a/src/app/mainWindow.cpp b/src/app/mainWindow.cpp
index 90d9667..3b79c73 100644
--- a/src/app/mainWindow.cpp
+++ b/src/app/mainWindow.cpp
@@ -798,8 +798,10 @@ MainWindow::keyPressEvent( QKeyEvent *e )
void
MainWindow::inhibitPowerSave()
{
- m_stopSleepCookie = Solid::PowerManagement::beginSuppressingSleep(QLatin1String( \
"watching a film" ));
- m_stopScreenPowerMgmtCookie = \
Solid::PowerManagement::beginSuppressingScreenPowerManagement(QLatin1String( \
"watching a film" )); + if (m_stopSleepCookie == -1)
+ m_stopSleepCookie = \
Solid::PowerManagement::beginSuppressingSleep(QLatin1String( "watching a film" )); + \
if (m_stopScreenPowerMgmtCookie == -1) + m_stopScreenPowerMgmtCookie = \
Solid::PowerManagement::beginSuppressingScreenPowerManagement(QLatin1String( \
"watching a film" )); if (!m_stopScreenSaver)
m_stopScreenSaver = new \
KNotificationRestrictions(KNotificationRestrictions::ScreenSaver); }
@@ -808,14 +810,18 @@ void
MainWindow::releasePowerSave()
{
//stop supressing sleep
- if (m_stopSleepCookie != -1)
- Solid::PowerManagement::stopSuppressingSleep(m_stopSleepCookie);
+ if (m_stopSleepCookie != -1) {
+ Solid::PowerManagement::stopSuppressingSleep(m_stopSleepCookie);
+ m_stopSleepCookie = -1;
+ }
//stop supressing screen power management
- if (m_stopScreenPowerMgmtCookie != -1)
- Solid::PowerManagement::stopSuppressingScreenPowerManagement(m_stopScreenPowerMgmtCookie);
+ if (m_stopScreenPowerMgmtCookie != -1) {
+ Solid::PowerManagement::stopSuppressingScreenPowerManagement(m_stopScreenPowerMgmtCookie);
+ m_stopScreenPowerMgmtCookie = -1;
+ }
- //stop disabling screensaver
+ //stop disabling screensaver
delete m_stopScreenSaver; // It is always 0, I have been careful.
m_stopScreenSaver = 0;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic