Changeset View
Changeset View
Standalone View
Standalone View
daemon/powerdevilcore.cpp
Show First 20 Lines • Show All 335 Lines • ▼ Show 20 Line(s) | 243 | { | |||
---|---|---|---|---|---|
336 | if (m_currentProfile == profileId && !force) { | 336 | if (m_currentProfile == profileId && !force) { | ||
337 | // No, let's leave things as they are | 337 | // No, let's leave things as they are | ||
338 | qCDebug(POWERDEVIL) << "Skipping action reload routine as profile has not changed"; | 338 | qCDebug(POWERDEVIL) << "Skipping action reload routine as profile has not changed"; | ||
339 | 339 | | |||
340 | // Do we need to force a wakeup? | 340 | // Do we need to force a wakeup? | ||
341 | if (m_pendingWakeupEvent) { | 341 | if (m_pendingWakeupEvent) { | ||
342 | // Fake activity at this stage, when no timeouts are registered | 342 | // Fake activity at this stage, when no timeouts are registered | ||
343 | onResumingFromIdle(); | 343 | onResumingFromIdle(); | ||
344 | KIdleTime::instance()->simulateUserActivity(); | | |||
345 | m_pendingWakeupEvent = false; | 344 | m_pendingWakeupEvent = false; | ||
346 | } | 345 | } | ||
347 | } else { | 346 | } else { | ||
348 | // First of all, let's clean the old actions. This will also call the onProfileUnload callback | 347 | // First of all, let's clean the old actions. This will also call the onProfileUnload callback | ||
349 | ActionPool::instance()->unloadAllActiveActions(); | 348 | ActionPool::instance()->unloadAllActiveActions(); | ||
350 | 349 | | |||
351 | // Do we need to force a wakeup? | 350 | // Do we need to force a wakeup? | ||
352 | if (m_pendingWakeupEvent) { | 351 | if (m_pendingWakeupEvent) { | ||
353 | // Fake activity at this stage, when no timeouts are registered | 352 | // Fake activity at this stage, when no timeouts are registered | ||
354 | onResumingFromIdle(); | 353 | onResumingFromIdle(); | ||
355 | KIdleTime::instance()->simulateUserActivity(); | | |||
356 | m_pendingWakeupEvent = false; | 354 | m_pendingWakeupEvent = false; | ||
357 | } | 355 | } | ||
358 | 356 | | |||
359 | // Cool, now let's load the needed actions | 357 | // Cool, now let's load the needed actions | ||
360 | Q_FOREACH (const QString &actionName, config.groupList()) { | 358 | Q_FOREACH (const QString &actionName, config.groupList()) { | ||
361 | Action *action = ActionPool::instance()->loadAction(actionName, config.group(actionName), this); | 359 | Action *action = ActionPool::instance()->loadAction(actionName, config.group(actionName), this); | ||
362 | if (action) { | 360 | if (action) { | ||
363 | action->onProfileLoad(); | 361 | action->onProfileLoad(); | ||
▲ Show 20 Lines • Show All 464 Lines • ▼ Show 20 Line(s) | 824 | { | |||
828 | for (auto it = m_batteriesPercent.constBegin(); it != m_batteriesPercent.constEnd(); ++it) { | 826 | for (auto it = m_batteriesPercent.constBegin(); it != m_batteriesPercent.constEnd(); ++it) { | ||
829 | chargePercent += it.value(); | 827 | chargePercent += it.value(); | ||
830 | } | 828 | } | ||
831 | return chargePercent; | 829 | return chargePercent; | ||
832 | } | 830 | } | ||
833 | 831 | | |||
834 | void Core::onResumingFromIdle() | 832 | void Core::onResumingFromIdle() | ||
835 | { | 833 | { | ||
834 | KIdleTime::instance()->simulateUserActivity(); | ||||
836 | // Wake up the actions in which an idle action was triggered | 835 | // Wake up the actions in which an idle action was triggered | ||
837 | std::for_each(m_pendingResumeFromIdleActions.cbegin(), m_pendingResumeFromIdleActions.cend(), | 836 | std::for_each(m_pendingResumeFromIdleActions.cbegin(), m_pendingResumeFromIdleActions.cend(), | ||
838 | std::mem_fn(&PowerDevil::Action::onWakeupFromIdle)); | 837 | std::mem_fn(&PowerDevil::Action::onWakeupFromIdle)); | ||
839 | 838 | | |||
840 | m_pendingResumeFromIdleActions.clear(); | 839 | m_pendingResumeFromIdleActions.clear(); | ||
841 | } | 840 | } | ||
842 | 841 | | |||
843 | void Core::onNotificationTimeout() | 842 | void Core::onNotificationTimeout() | ||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |