Changeset View
Changeset View
Standalone View
Standalone View
src/file/powerstatemonitor.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 33 | { | |||
---|---|---|---|---|---|
49 | connect(watcher, &QDBusPendingCallWatcher::finished, [&](QDBusPendingCallWatcher* watch) { | 49 | connect(watcher, &QDBusPendingCallWatcher::finished, [&](QDBusPendingCallWatcher* watch) { | ||
50 | QDBusPendingReply<bool> reply = *watch; | 50 | QDBusPendingReply<bool> reply = *watch; | ||
51 | if (!reply.isError()) { | 51 | if (!reply.isError()) { | ||
52 | bool onBattery = reply.argumentAt<0>(); | 52 | bool onBattery = reply.argumentAt<0>(); | ||
53 | slotPowerManagementStatusChanged(onBattery); | 53 | slotPowerManagementStatusChanged(onBattery); | ||
54 | } | 54 | } | ||
55 | watch->deleteLater(); | 55 | watch->deleteLater(); | ||
56 | }); | 56 | }); | ||
57 | | ||||
58 | } | 57 | } | ||
59 | 58 | | |||
60 | void PowerStateMonitor::slotPowerManagementStatusChanged(bool conserveResources) | 59 | void PowerStateMonitor::slotPowerManagementStatusChanged(bool conserveResources) | ||
61 | { | 60 | { | ||
61 | if (m_isOnBattery != conserveResources) { | ||||
62 | m_isOnBattery = conserveResources; | 62 | m_isOnBattery = conserveResources; | ||
63 | Q_EMIT powerManagementStatusChanged(conserveResources); | 63 | Q_EMIT powerManagementStatusChanged(conserveResources); | ||
64 | } | 64 | } | ||
65 | } |