Changeset View
Changeset View
Standalone View
Standalone View
kcmodule/global/GeneralPage.cpp
Show All 18 Lines | |||||
19 | 19 | | |||
20 | #include "GeneralPage.h" | 20 | #include "GeneralPage.h" | ||
21 | 21 | | |||
22 | #include "ErrorOverlay.h" | 22 | #include "ErrorOverlay.h" | ||
23 | #include "PowerDevilSettings.h" | 23 | #include "PowerDevilSettings.h" | ||
24 | 24 | | |||
25 | #include "actions/bundled/suspendsession.h" | 25 | #include "actions/bundled/suspendsession.h" | ||
26 | 26 | | |||
27 | #include "powerdevilpowermanagement.h" | ||||
28 | | ||||
27 | #include <Solid/Device> | 29 | #include <Solid/Device> | ||
28 | #include <Solid/DeviceInterface> | 30 | #include <Solid/DeviceInterface> | ||
29 | #include <Solid/Battery> | 31 | #include <Solid/Battery> | ||
30 | #include <Solid/PowerManagement> | | |||
31 | 32 | | |||
32 | #include <QtDBus/QDBusMessage> | 33 | #include <QtDBus/QDBusMessage> | ||
33 | #include <QtDBus/QDBusReply> | 34 | #include <QtDBus/QDBusReply> | ||
34 | #include <QtDBus/QDBusConnection> | 35 | #include <QtDBus/QDBusConnection> | ||
35 | #include <QtDBus/QDBusConnectionInterface> | 36 | #include <QtDBus/QDBusConnectionInterface> | ||
36 | #include <QtDBus/QDBusMetaType> | 37 | #include <QtDBus/QDBusMetaType> | ||
37 | #include <QtDBus/QDBusServiceWatcher> | 38 | #include <QtDBus/QDBusServiceWatcher> | ||
38 | 39 | | |||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 96 | Q_FOREACH (const Solid::Device &device, Solid::Device::listFromType(Solid::DeviceInterface::Battery, QString())) { | |||
96 | const Solid::Battery *b = qobject_cast<const Solid::Battery*> (device.asDeviceInterface(Solid::DeviceInterface::Battery)); | 97 | const Solid::Battery *b = qobject_cast<const Solid::Battery*> (device.asDeviceInterface(Solid::DeviceInterface::Battery)); | ||
97 | if (b->isPowerSupply()) { | 98 | if (b->isPowerSupply()) { | ||
98 | hasPowerSupplyBattery = true; | 99 | hasPowerSupplyBattery = true; | ||
99 | } else { | 100 | } else { | ||
100 | hasPeripheralBattery = true; | 101 | hasPeripheralBattery = true; | ||
101 | } | 102 | } | ||
102 | } | 103 | } | ||
103 | 104 | | |||
104 | QSet< Solid::PowerManagement::SleepState > methods = Solid::PowerManagement::supportedSleepStates(); | | |||
105 | | ||||
106 | BatteryCriticalCombo->addItem(QIcon::fromTheme("dialog-cancel"), i18n("Do nothing"), PowerDevil::BundledActions::SuspendSession::None); | 105 | BatteryCriticalCombo->addItem(QIcon::fromTheme("dialog-cancel"), i18n("Do nothing"), PowerDevil::BundledActions::SuspendSession::None); | ||
107 | if (methods.contains(Solid::PowerManagement::SuspendState)) { | 106 | if (PowerDevil::PowerManagement::instance()->canSuspend()) { | ||
108 | BatteryCriticalCombo->addItem(QIcon::fromTheme("system-suspend"), i18n("Suspend"), PowerDevil::BundledActions::SuspendSession::ToRamMode); | 107 | BatteryCriticalCombo->addItem(QIcon::fromTheme("system-suspend"), i18n("Suspend"), PowerDevil::BundledActions::SuspendSession::ToRamMode); | ||
109 | } | 108 | } | ||
110 | if (methods.contains(Solid::PowerManagement::HibernateState)) { | 109 | if (PowerDevil::PowerManagement::instance()->canHibernate()) { | ||
111 | BatteryCriticalCombo->addItem(QIcon::fromTheme("system-suspend-hibernate"), i18n("Hibernate"), PowerDevil::BundledActions::SuspendSession::ToDiskMode); | 110 | BatteryCriticalCombo->addItem(QIcon::fromTheme("system-suspend-hibernate"), i18n("Hibernate"), PowerDevil::BundledActions::SuspendSession::ToDiskMode); | ||
112 | } | 111 | } | ||
113 | BatteryCriticalCombo->addItem(QIcon::fromTheme("system-shutdown"), i18n("Shut down"), PowerDevil::BundledActions::SuspendSession::ShutdownMode); | 112 | BatteryCriticalCombo->addItem(QIcon::fromTheme("system-shutdown"), i18n("Shut down"), PowerDevil::BundledActions::SuspendSession::ShutdownMode); | ||
114 | 113 | | |||
115 | notificationsButton->setIcon(QIcon::fromTheme("preferences-desktop-notification")); | 114 | notificationsButton->setIcon(QIcon::fromTheme("preferences-desktop-notification")); | ||
116 | 115 | | |||
117 | // modified fields... | 116 | // modified fields... | ||
118 | 117 | | |||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |