diff --git a/imports/Spectral/Page/SettingForm.ui.qml b/imports/Spectral/Page/SettingForm.ui.qml index dfa0f06..a5d1e12 100644 --- a/imports/Spectral/Page/SettingForm.ui.qml +++ b/imports/Spectral/Page/SettingForm.ui.qml @@ -66,6 +66,13 @@ Page { onCheckedChanged: MSettings.pressAndHold = checked } + + Switch { + text: "Confirm on Exit" + checked: MSettings.confirmOnExit + + onCheckedChanged: MSettings.confirmOnExit = checked + } } } diff --git a/imports/Spectral/Setting/Setting.qml b/imports/Spectral/Setting/Setting.qml index edd9554..84fce5e 100644 --- a/imports/Spectral/Setting/Setting.qml +++ b/imports/Spectral/Setting/Setting.qml @@ -4,6 +4,7 @@ import Qt.labs.settings 1.0 Settings { property bool pressAndHold + property bool confirmOnExit: true property bool darkTheme property bool miniMode diff --git a/qml/main.qml b/qml/main.qml index ddb3d2b..1d738d5 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -336,7 +336,33 @@ ApplicationWindow { color: "white" } - onClicked: Qt.quit() + onClicked: MSettings.confirmOnExit ? confirmExitDialog.open() : Qt.quit() + + Dialog { + x: (window.width - width) / 2 + y: (window.height - height) / 2 + width: 360 + + id: confirmExitDialog + + parent: ApplicationWindow.overlay + + title: "Exit" + modal: true + standardButtons: Dialog.Ok | Dialog.Cancel + + contentItem: Column { + Label { text: "Exit?" } + CheckBox { + text: "Do not ask next time" + checked: !MSettings.confirmOnExit + + onCheckedChanged: MSettings.confirmOnExit = !checked + } + } + + onAccepted: Qt.quit() + } } } }