void KBlocksScene::pauseGame(bool flag, bool fromUI) { if (!mGameStarted) { return; } QString resuming(i18n("Game Resumed!")); QString pausing(i18n("Game Paused!")); for (int i = 0; i < mGroupCount; i++) { maGroupList[i]->pauseGame(flag); } if (!mSnapshotMode) { if (flag) { mUpdateTimer.stop(); if (!fromUI) { showMessage(pausing, 2000); } } else { mUpdateTimer.start(); if (!fromUI) { showMessage(resuming, 2000); } } } }
PowerManagement::PowerManagement() : inhibitSuspendWhilstPlaying(false) , cookie(-1) { policy = new OrgKdeSolidPowerManagementPolicyAgentInterface(OrgKdeSolidPowerManagementPolicyAgentInterface::staticInterfaceName(), QLatin1String("/org/kde/Solid/PowerManagement/PolicyAgent"), QDBusConnection::sessionBus(), this); inhibit = new OrgFreedesktopPowerManagementInhibitInterface(OrgFreedesktopPowerManagementInhibitInterface::staticInterfaceName(), QLatin1String("/org/freedesktop/PowerManagement/Inhibit"), QDBusConnection::sessionBus(), this); upower = new OrgFreedesktopUPowerInterface(OrgFreedesktopUPowerInterface::staticInterfaceName(), QLatin1String("/org/freedesktop/UPower"), QDBusConnection::systemBus(), this); login1 = new OrgFreedesktopLogin1ManagerInterface("org.freedesktop.login1", QLatin1String("/org/freedesktop/login1"), QDBusConnection::systemBus(), this); connect(upower, SIGNAL(Resuming()), this, SIGNAL(resuming())); connect(login1, SIGNAL(PrepareForSleep(bool)), this, SLOT(prepareForSleep(bool))); }
void PowerManagement::prepareForSleep(bool s) { if (!s) { emit resuming(); } }