Changeset View
Changeset View
Standalone View
Standalone View
daemon/actions/bundled/handlebuttonevents.cpp
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | 49 | { | |||
---|---|---|---|---|---|
68 | accel->setGlobalShortcut(globalAction, Qt::Key_Hibernate); | 68 | accel->setGlobalShortcut(globalAction, Qt::Key_Hibernate); | ||
69 | connect(globalAction, SIGNAL(triggered(bool)), SLOT(suspendToDisk())); | 69 | connect(globalAction, SIGNAL(triggered(bool)), SLOT(suspendToDisk())); | ||
70 | 70 | | |||
71 | globalAction = actionCollection->addAction("PowerOff"); | 71 | globalAction = actionCollection->addAction("PowerOff"); | ||
72 | globalAction->setText(i18nc("@action:inmenu Global shortcut", "Power Off")); | 72 | globalAction->setText(i18nc("@action:inmenu Global shortcut", "Power Off")); | ||
73 | accel->setGlobalShortcut(globalAction, Qt::Key_PowerOff); | 73 | accel->setGlobalShortcut(globalAction, Qt::Key_PowerOff); | ||
74 | connect(globalAction, SIGNAL(triggered(bool)), SLOT(powerOffButtonTriggered())); | 74 | connect(globalAction, SIGNAL(triggered(bool)), SLOT(powerOffButtonTriggered())); | ||
75 | 75 | | |||
76 | globalAction = actionCollection->addAction("PowerDown"); | ||||
77 | globalAction->setText(i18nc("@action:inmenu Global shortcut", "Power Down")); | ||||
78 | accel->setGlobalShortcut(globalAction, Qt::Key_PowerDown); | ||||
79 | connect(globalAction, &QAction::triggered, this, &HandleButtonEvents::powerDownButtonTriggered); | ||||
broulik: Use new connect syntax in new code please | |||||
80 | | ||||
76 | connect(new KScreen::GetConfigOperation(KScreen::GetConfigOperation::NoEDID), &KScreen::ConfigOperation::finished, | 81 | connect(new KScreen::GetConfigOperation(KScreen::GetConfigOperation::NoEDID), &KScreen::ConfigOperation::finished, | ||
77 | this, [this](KScreen::ConfigOperation *op) { | 82 | this, [this](KScreen::ConfigOperation *op) { | ||
78 | m_screenConfiguration = qobject_cast<KScreen::GetConfigOperation *>(op)->config(); | 83 | m_screenConfiguration = qobject_cast<KScreen::GetConfigOperation *>(op)->config(); | ||
79 | checkOutputs(); | 84 | checkOutputs(); | ||
80 | 85 | | |||
81 | KScreen::ConfigMonitor::instance()->addConfig(m_screenConfiguration); | 86 | KScreen::ConfigMonitor::instance()->addConfig(m_screenConfiguration); | ||
82 | connect(KScreen::ConfigMonitor::instance(), &KScreen::ConfigMonitor::configurationChanged, this, &HandleButtonEvents::checkOutputs); | 87 | connect(KScreen::ConfigMonitor::instance(), &KScreen::ConfigMonitor::configurationChanged, this, &HandleButtonEvents::checkOutputs); | ||
83 | }); | 88 | }); | ||
▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Line(s) | 209 | { | |||
205 | return m_triggerLidActionWhenExternalMonitorPresent || !m_externalMonitorPresent; | 210 | return m_triggerLidActionWhenExternalMonitorPresent || !m_externalMonitorPresent; | ||
206 | } | 211 | } | ||
207 | 212 | | |||
208 | void HandleButtonEvents::powerOffButtonTriggered() | 213 | void HandleButtonEvents::powerOffButtonTriggered() | ||
209 | { | 214 | { | ||
210 | onButtonPressed(BackendInterface::PowerButton); | 215 | onButtonPressed(BackendInterface::PowerButton); | ||
211 | } | 216 | } | ||
212 | 217 | | |||
218 | void HandleButtonEvents::powerDownButtonTriggered() | ||||
219 | { | ||||
220 | onButtonPressed(BackendInterface::PowerDownButton); | ||||
221 | } | ||||
222 | | ||||
213 | void HandleButtonEvents::suspendToDisk() | 223 | void HandleButtonEvents::suspendToDisk() | ||
214 | { | 224 | { | ||
215 | onButtonPressed(BackendInterface::HibernateButton); | 225 | onButtonPressed(BackendInterface::HibernateButton); | ||
216 | } | 226 | } | ||
217 | 227 | | |||
218 | void HandleButtonEvents::suspendToRam() | 228 | void HandleButtonEvents::suspendToRam() | ||
219 | { | 229 | { | ||
220 | onButtonPressed(BackendInterface::SleepButton); | 230 | onButtonPressed(BackendInterface::SleepButton); | ||
Show All 36 Lines |
Use new connect syntax in new code please