From a667b99dee26eb3cfd195ec09dbc04502ecb8cff Mon Sep 17 00:00:00 2001 From: Aleix Pol Gonzalez Date: Mon, 28 Feb 2022 17:28:42 +0000 Subject: [PATCH] SystemDialog: Allow accepting the dialogs with the keyboard If there's an enabled Ok button, it will accept the dialog when Enter is pressed as it reaches the dialog. BUG: 450223 FIXED-IN: 5.24.3 --- components/dialogs/SystemDialog.qml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/dialogs/SystemDialog.qml b/components/dialogs/SystemDialog.qml index 412566a49..cc3e8d249 100644 --- a/components/dialogs/SystemDialog.qml +++ b/components/dialogs/SystemDialog.qml @@ -123,7 +123,16 @@ Kirigami.AbstractApplicationWindow { }) } - Keys.onEscapePressed: root.reject() focus: true + + function accept() { + const button = dialogButtonBox.standardButton(DialogButtonBox.Ok); + if (button && button.enabled) { + root.accept() + } + } + Keys.onEnterPressed: accept() + Keys.onReturnPressed: accept() + Keys.onEscapePressed: root.reject() } }