mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 10:52:51 +00:00
ksmserver: handle all currently supported power sleep methods
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
47486b2a88
commit
83cb186aec
3 changed files with 15 additions and 2 deletions
|
@ -235,12 +235,17 @@ void KSMShutdownDlg::slotSuspend(int spdMethod)
|
||||||
{
|
{
|
||||||
switch (spdMethod) {
|
switch (spdMethod) {
|
||||||
case Solid::PowerManagement::StandbyState:
|
case Solid::PowerManagement::StandbyState:
|
||||||
|
Solid::PowerManagement::requestSleep(Solid::PowerManagement::StandbyState, 0, 0);
|
||||||
|
break;
|
||||||
case Solid::PowerManagement::SuspendState:
|
case Solid::PowerManagement::SuspendState:
|
||||||
Solid::PowerManagement::requestSleep(Solid::PowerManagement::SuspendState, 0, 0);
|
Solid::PowerManagement::requestSleep(Solid::PowerManagement::SuspendState, 0, 0);
|
||||||
break;
|
break;
|
||||||
case Solid::PowerManagement::HibernateState:
|
case Solid::PowerManagement::HibernateState:
|
||||||
Solid::PowerManagement::requestSleep(Solid::PowerManagement::HibernateState, 0, 0);
|
Solid::PowerManagement::requestSleep(Solid::PowerManagement::HibernateState, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
case Solid::PowerManagement::HybridSuspendState:
|
||||||
|
Solid::PowerManagement::requestSleep(Solid::PowerManagement::HybridSuspendState, 0, 0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,11 @@ PlasmaCore.FrameSvgItem {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
//console.log("contour.qml: sleep requested")
|
//console.log("contour.qml: sleep requested")
|
||||||
timer.running = false
|
timer.running = false
|
||||||
if (spdMethods.SuspendState) {
|
if (spdMethods.HybridSuspendState) {
|
||||||
|
suspendRequested(8); // Solid::PowerManagement::HybridSuspendState
|
||||||
|
} else if (spdMethods.HibernateState) {
|
||||||
|
suspendRequested(4); // Solid::PowerManagement::HibernateState
|
||||||
|
} else if (spdMethods.SuspendState) {
|
||||||
suspendRequested(2); // Solid::PowerManagement::SuspendState
|
suspendRequested(2); // Solid::PowerManagement::SuspendState
|
||||||
} else if (spdMethods.StandbyState) {
|
} else if (spdMethods.StandbyState) {
|
||||||
suspendRequested(1); // Solid::PowerManagement::StandbyState
|
suspendRequested(1); // Solid::PowerManagement::StandbyState
|
||||||
|
|
|
@ -264,7 +264,7 @@ PlasmaCore.FrameSvgItem {
|
||||||
iconSource: "system-shutdown"
|
iconSource: "system-shutdown"
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
visible: (choose || sdtype == ShutdownType.ShutdownTypeHalt)
|
visible: (choose || sdtype == ShutdownType.ShutdownTypeHalt)
|
||||||
menu: spdMethods.StandbyState | spdMethods.SuspendState | spdMethods.HibernateState
|
menu: spdMethods.StandbyState | spdMethods.SuspendState | spdMethods.HibernateState | spdMethods.HybridSuspendState
|
||||||
tabStopNext: rebootButton
|
tabStopNext: rebootButton
|
||||||
tabStopBack: logoutButton
|
tabStopBack: logoutButton
|
||||||
|
|
||||||
|
@ -291,6 +291,10 @@ PlasmaCore.FrameSvgItem {
|
||||||
// 4 == Solid::PowerManagement::HibernateState
|
// 4 == Solid::PowerManagement::HibernateState
|
||||||
contextMenu.append({itemIndex: 4, itemText: i18n("Suspend to &Disk"), itemSubMenu: null, itemAllowAmpersand: false})
|
contextMenu.append({itemIndex: 4, itemText: i18n("Suspend to &Disk"), itemSubMenu: null, itemAllowAmpersand: false})
|
||||||
}
|
}
|
||||||
|
if (spdMethods.HybridSuspendState) {
|
||||||
|
// 8 == Solid::PowerManagement::HybridSuspendState
|
||||||
|
contextMenu.append({itemIndex: 8, itemText: i18n("&Hybrid Suspend"), itemSubMenu: null, itemAllowAmpersand: false})
|
||||||
|
}
|
||||||
contextMenu.clicked.connect(shutdownUi.suspendRequested)
|
contextMenu.clicked.connect(shutdownUi.suspendRequested)
|
||||||
}
|
}
|
||||||
contextMenu.open()
|
contextMenu.open()
|
||||||
|
|
Loading…
Add table
Reference in a new issue