Commit 34c1ac3f authored by Sandro Knauß's avatar Sandro Knauß

[applets/lock_logout]: Remove confirmation dialog for suspend/hibernate.

When using the lock/logout applet it feels strange, to get only at two
options a confirmation dialog. Additionally it feels odd to answer for
confirmation when neither the option triggered by Shortcuts nor the
Plasma menu asks for confirmation. Suspend and hibernate are the two
options where no data is lost, there is no need to ask for confirmation.
parent b16ab4a1
......@@ -21,7 +21,6 @@ import QtQuick 2.0
import QtQuick.Layouts 1.0
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents // For QueryDialog
import org.kde.kquickcontrolsaddons 2.0
import "data.js" as Data
import org.kde.plasma.private.sessions 2.0
......@@ -116,56 +115,8 @@ Flow {
}
}
Component {
id: hibernateDialogComponent
PlasmaComponents.QueryDialog {
titleIcon: "system-suspend-hibernate"
titleText: i18n("Hibernate")
message: i18n("Do you want to suspend to disk (hibernate)?")
location: plasmoid.location
acceptButtonText: i18n("Yes")
rejectButtonText: i18n("No")
onAccepted: performOperation("hibernate")
}
}
property PlasmaComponents.QueryDialog hibernateDialog
Component {
id: sleepDialogComponent
PlasmaComponents.QueryDialog {
titleIcon: "system-suspend"
titleText: i18nc("Suspend to RAM", "Sleep")
message: i18n("Do you want to suspend to RAM (sleep)?")
location: plasmoid.location
acceptButtonText: i18n("Yes")
rejectButtonText: i18n("No")
onAccepted: performOperation("suspend")
}
}
property PlasmaComponents.QueryDialog sleepDialog
function clickHandler(what, button) {
if (what === "suspend") {
if (!hibernateDialog) {
hibernateDialog = hibernateDialogComponent.createObject(lockout);
}
hibernateDialog.visualParent = button
hibernateDialog.open();
} else if (what === "hibernate") {
if (!sleepDialog) {
sleepDialog = sleepDialogComponent.createObject(lockout);
}
sleepDialog.visualParent = button
sleepDialog.open();
} else {
performOperation(what);
}
performOperation(what);
}
function performOperation(operation) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment