From 110b09efba663e72d8b2fae12d961d105db02d8c Mon Sep 17 00:00:00 2001 From: xiphon Date: Tue, 1 Dec 2020 16:25:35 +0000 Subject: [PATCH] TxConfirmationDialog: fix keys handling --- components/TxConfirmationDialog.qml | 44 ++--------------------------- 1 file changed, 2 insertions(+), 42 deletions(-) diff --git a/components/TxConfirmationDialog.qml b/components/TxConfirmationDialog.qml index 1d0a21e9..67a865eb 100644 --- a/components/TxConfirmationDialog.qml +++ b/components/TxConfirmationDialog.qml @@ -45,33 +45,12 @@ Rectangle { radius: 10 border.color: MoneroComponents.Style.blackTheme ? Qt.rgba(255, 255, 255, 0.25) : Qt.rgba(0, 0, 0, 0.25) border.width: 1 - focus: true Keys.enabled: true Keys.onEscapePressed: { root.close() root.clearFields() root.rejected() } - Keys.onEnterPressed: { - if (root.state == "default") { - root.close() - root.accepted() - } else if (root.state == "error") { - root.close() - root.clearFields() - root.rejected() - } - } - Keys.onReturnPressed: { - if (root.state == "default") { - root.close() - root.accepted() - } else if (root.state == "error") { - root.close() - root.clearFields() - root.rejected() - } - } KeyNavigation.tab: confirmButton property var transactionAmount: "" @@ -101,7 +80,7 @@ Rectangle { PropertyChanges { target: bottomMessage; visible: false } PropertyChanges { target: buttons; visible: true } PropertyChanges { target: backButton; visible: true; primary: false } - PropertyChanges { target: confirmButton; visible: true } + PropertyChanges { target: confirmButton; visible: true; focus: true } }, State { // error message being displayed, show only back button name: "error"; @@ -115,7 +94,7 @@ Rectangle { PropertyChanges { target: bottom; visible: true } PropertyChanges { target: bottomMessage; visible: false } PropertyChanges { target: buttons; visible: true } - PropertyChanges { target: backButton; visible: true; primary: true } + PropertyChanges { target: backButton; visible: true; primary: true; focus: true } PropertyChanges { target: confirmButton; visible: false } }, State { // creating or sending transaction, show tx details and don't show any button @@ -141,7 +120,6 @@ Rectangle { //clean previous error message errorText.text = ""; - root.forceActiveFocus() } function close() { @@ -422,17 +400,8 @@ Rectangle { id: backButton text: qsTr("Back") + translationManager.emptyString; width: 200 - focus: false primary: false KeyNavigation.tab: confirmButton - Keys.enabled: backButton.visible - Keys.onReturnPressed: backButton.onClicked - Keys.onEnterPressed: backButton.onClicked - Keys.onEscapePressed: { - root.close() - root.clearFields() - root.rejected() - } onClicked: { root.close() root.clearFields() @@ -445,16 +414,7 @@ Rectangle { text: qsTr("Confirm") + translationManager.emptyString; rightIcon: "qrc:///images/rightArrow.png" width: 200 - focus: false KeyNavigation.tab: backButton - Keys.enabled: confirmButton.visible - Keys.onReturnPressed: confirmButton.onClicked - Keys.onEnterPressed: confirmButton.onClicked - Keys.onEscapePressed: { - root.close() - root.clearFields() - root.rejected() - } onClicked: { root.close() root.accepted()