Changeset View
Changeset View
Standalone View
Standalone View
daemon/actions/bundled/handlebuttoneventsconfig.cpp
Context not available. | |||||
23 | #include "suspendsession.h" | 23 | #include "suspendsession.h" | ||
---|---|---|---|---|---|
24 | #include "upower_interface.h" | 24 | #include "upower_interface.h" | ||
25 | 25 | | |||
26 | #include <Solid/Device> | 26 | #include "powerdevilpowermanagement.h" | ||
27 | #include <Solid/PowerManagement> | | |||
28 | 27 | | |||
29 | #include <KLocalizedString> | 28 | #include <KLocalizedString> | ||
30 | #include <KPluginFactory> | 29 | #include <KPluginFactory> | ||
Context not available. | |||||
94 | QList<QComboBox *> boxes; | 93 | QList<QComboBox *> boxes; | ||
95 | boxes << m_lidCloseCombo << m_powerButtonCombo; | 94 | boxes << m_lidCloseCombo << m_powerButtonCombo; | ||
96 | 95 | | |||
97 | QSet< Solid::PowerManagement::SleepState > methods = Solid::PowerManagement::supportedSleepStates(); | | |||
98 | | ||||
99 | Q_FOREACH (QComboBox *box, boxes) { | 96 | Q_FOREACH (QComboBox *box, boxes) { | ||
100 | box->addItem(QIcon::fromTheme("dialog-cancel"), i18n("Do nothing"), (uint)SuspendSession::None); | 97 | box->addItem(QIcon::fromTheme("dialog-cancel"), i18n("Do nothing"), (uint)SuspendSession::None); | ||
101 | if (methods.contains(Solid::PowerManagement::SuspendState)) { | 98 | if (PowerManagement::instance()->canSuspend()) { | ||
102 | box->addItem(QIcon::fromTheme("system-suspend"), i18n("Suspend"), (uint)SuspendSession::ToRamMode); | 99 | box->addItem(QIcon::fromTheme("system-suspend"), i18n("Suspend"), (uint)SuspendSession::ToRamMode); | ||
103 | } | 100 | } | ||
104 | if (methods.contains(Solid::PowerManagement::HibernateState)) { | 101 | if (PowerManagement::instance()->canHibernate()) { | ||
105 | box->addItem(QIcon::fromTheme("system-suspend-hibernate"), i18n("Hibernate"), (uint)SuspendSession::ToDiskMode); | 102 | box->addItem(QIcon::fromTheme("system-suspend-hibernate"), i18n("Hibernate"), (uint)SuspendSession::ToDiskMode); | ||
106 | } | 103 | } | ||
107 | if (methods.contains(Solid::PowerManagement::HybridSuspendState)) { | 104 | // if (methods.contains(Solid::PowerManagement::HybridSuspendState)) { | ||
108 | box->addItem(QIcon::fromTheme("system-suspend-hybrid"), i18n("Hybrid suspend"), (uint)SuspendSession::SuspendHybridMode); | 105 | // box->addItem(QIcon::fromTheme("system-suspend-hybrid"), i18n("Hybrid suspend"), (uint)SuspendSession::SuspendHybridMode); | ||
109 | } | 106 | // } | ||
110 | box->addItem(QIcon::fromTheme("system-shutdown"), i18n("Shut down"), (uint)SuspendSession::ShutdownMode); | 107 | box->addItem(QIcon::fromTheme("system-shutdown"), i18n("Shut down"), (uint)SuspendSession::ShutdownMode); | ||
111 | box->addItem(QIcon::fromTheme("system-lock-screen"), i18n("Lock screen"), (uint)SuspendSession::LockScreenMode); | 108 | box->addItem(QIcon::fromTheme("system-lock-screen"), i18n("Lock screen"), (uint)SuspendSession::LockScreenMode); | ||
112 | if (box != m_lidCloseCombo) { | 109 | if (box != m_lidCloseCombo) { | ||
Context not available. |