From 2ccb28fa49012aae48ff1517c0a107e08bd31b97 Mon Sep 17 00:00:00 2001 From: miruka Date: Fri, 21 Aug 2020 05:08:12 -0400 Subject: [PATCH] Box/popups: ignore enter press on disabled buttons --- TODO.md | 1 - src/gui/Pages/AccountSettings/Account.qml | 2 +- src/gui/Pages/AddAccount/ServerBrowser.qml | 4 +++- src/gui/Pages/AddChat/CreateRoom.qml | 2 +- src/gui/Pages/AddChat/DirectChat.qml | 2 +- src/gui/Pages/AddChat/JoinRoom.qml | 2 +- src/gui/Pages/Chat/RoomPane/SettingsView.qml | 3 ++- src/gui/Popups/PasswordPopup.qml | 2 +- 8 files changed, 10 insertions(+), 8 deletions(-) diff --git a/TODO.md b/TODO.md index 706e4c89..538a8156 100644 --- a/TODO.md +++ b/TODO.md @@ -4,7 +4,6 @@ - server list sorting method / explain what the % number is (stability) - spam alt+shift+a/going to room when starting app on server browser → segfault - login with account already added → infinite spinner in room list -- verify onKeyboardAccept/Cancel things respect button enabled state - global presence control diff --git a/src/gui/Pages/AccountSettings/Account.qml b/src/gui/Pages/AccountSettings/Account.qml index cb571e59..b6e60bfa 100644 --- a/src/gui/Pages/AccountSettings/Account.qml +++ b/src/gui/Pages/AccountSettings/Account.qml @@ -85,8 +85,8 @@ HFlickableColumnPage { } } + onKeyboardAccept: if (saveButton.enabled) saveButton.clicked() onKeyboardCancel: cancel() - onKeyboardAccept: applyChanges() HUserAvatar { id: avatar diff --git a/src/gui/Pages/AddAccount/ServerBrowser.qml b/src/gui/Pages/AddAccount/ServerBrowser.qml index 71cc180c..81a83e85 100644 --- a/src/gui/Pages/AddAccount/ServerBrowser.qml +++ b/src/gui/Pages/AddAccount/ServerBrowser.qml @@ -168,7 +168,9 @@ HBox { } } - onKeyboardAccept: if (serverField.item.apply.enabled) box.connect() + onKeyboardAccept: + if (serverField.item.apply.enabled) serverField.item.apply.clicked() + onAccepted: window.saveState(this) Timer { diff --git a/src/gui/Pages/AddChat/CreateRoom.qml b/src/gui/Pages/AddChat/CreateRoom.qml index a733f31c..083b4d8d 100644 --- a/src/gui/Pages/AddChat/CreateRoom.qml +++ b/src/gui/Pages/AddChat/CreateRoom.qml @@ -64,7 +64,7 @@ HFlickableColumnPage { } } - onKeyboardAccept: create() + onKeyboardAccept: if (applyButton.enabled) applyButton.clicked() onKeyboardCancel: cancel() HRoomAvatar { diff --git a/src/gui/Pages/AddChat/DirectChat.qml b/src/gui/Pages/AddChat/DirectChat.qml index 6c426ca5..ef539c9b 100644 --- a/src/gui/Pages/AddChat/DirectChat.qml +++ b/src/gui/Pages/AddChat/DirectChat.qml @@ -81,7 +81,7 @@ HFlickableColumnPage { } } - onKeyboardAccept: startChat() + onKeyboardAccept: if (applyButton.enabled) applyButton.clicked() onKeyboardCancel: cancel() CurrentUserAvatar { diff --git a/src/gui/Pages/AddChat/JoinRoom.qml b/src/gui/Pages/AddChat/JoinRoom.qml index 6d048d56..93eaf63b 100644 --- a/src/gui/Pages/AddChat/JoinRoom.qml +++ b/src/gui/Pages/AddChat/JoinRoom.qml @@ -70,7 +70,7 @@ HFlickableColumnPage { } } - onKeyboardAccept: join() + onKeyboardAccept: if (joinButton.enabled) joinButton.clicked() onKeyboardCancel: cancel() CurrentUserAvatar { diff --git a/src/gui/Pages/Chat/RoomPane/SettingsView.qml b/src/gui/Pages/Chat/RoomPane/SettingsView.qml index 817a0521..3b0a9851 100644 --- a/src/gui/Pages/Chat/RoomPane/SettingsView.qml +++ b/src/gui/Pages/Chat/RoomPane/SettingsView.qml @@ -63,6 +63,7 @@ HFlickableColumnPage { footer: AutoDirectionLayout { ApplyButton { + id: applyButton enabled: anyChange loading: saveFuture !== null disableWhileLoading: false @@ -76,7 +77,7 @@ HFlickableColumnPage { } } - onKeyboardAccept: save() + onKeyboardAccept: if (applyButton.enabled) applyButton.clicked() onKeyboardCancel: cancel() HRoomAvatar { diff --git a/src/gui/Popups/PasswordPopup.qml b/src/gui/Popups/PasswordPopup.qml index 713b2d04..495cc2e8 100644 --- a/src/gui/Popups/PasswordPopup.qml +++ b/src/gui/Popups/PasswordPopup.qml @@ -73,7 +73,7 @@ HFlickableColumnPopup { } onOpened: passwordField.forceActiveFocus() - onKeyboardAccept: popup.validate() + onKeyboardAccept: if (validateButton.enabled) validateButton.clicked() SummaryLabel { id: summary }