Box/popups: ignore enter press on disabled buttons

This commit is contained in:
miruka 2020-08-21 05:08:12 -04:00
parent 8fbe59f6eb
commit 2ccb28fa49
8 changed files with 10 additions and 8 deletions

View File

@ -4,7 +4,6 @@
- server list sorting method / explain what the % number is (stability) - server list sorting method / explain what the % number is (stability)
- spam alt+shift+a/going to room when starting app on server browser → segfault - spam alt+shift+a/going to room when starting app on server browser → segfault
- login with account already added → infinite spinner in room list - login with account already added → infinite spinner in room list
- verify onKeyboardAccept/Cancel things respect button enabled state
- global presence control - global presence control

View File

@ -85,8 +85,8 @@ HFlickableColumnPage {
} }
} }
onKeyboardAccept: if (saveButton.enabled) saveButton.clicked()
onKeyboardCancel: cancel() onKeyboardCancel: cancel()
onKeyboardAccept: applyChanges()
HUserAvatar { HUserAvatar {
id: avatar id: avatar

View File

@ -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) onAccepted: window.saveState(this)
Timer { Timer {

View File

@ -64,7 +64,7 @@ HFlickableColumnPage {
} }
} }
onKeyboardAccept: create() onKeyboardAccept: if (applyButton.enabled) applyButton.clicked()
onKeyboardCancel: cancel() onKeyboardCancel: cancel()
HRoomAvatar { HRoomAvatar {

View File

@ -81,7 +81,7 @@ HFlickableColumnPage {
} }
} }
onKeyboardAccept: startChat() onKeyboardAccept: if (applyButton.enabled) applyButton.clicked()
onKeyboardCancel: cancel() onKeyboardCancel: cancel()
CurrentUserAvatar { CurrentUserAvatar {

View File

@ -70,7 +70,7 @@ HFlickableColumnPage {
} }
} }
onKeyboardAccept: join() onKeyboardAccept: if (joinButton.enabled) joinButton.clicked()
onKeyboardCancel: cancel() onKeyboardCancel: cancel()
CurrentUserAvatar { CurrentUserAvatar {

View File

@ -63,6 +63,7 @@ HFlickableColumnPage {
footer: AutoDirectionLayout { footer: AutoDirectionLayout {
ApplyButton { ApplyButton {
id: applyButton
enabled: anyChange enabled: anyChange
loading: saveFuture !== null loading: saveFuture !== null
disableWhileLoading: false disableWhileLoading: false
@ -76,7 +77,7 @@ HFlickableColumnPage {
} }
} }
onKeyboardAccept: save() onKeyboardAccept: if (applyButton.enabled) applyButton.clicked()
onKeyboardCancel: cancel() onKeyboardCancel: cancel()
HRoomAvatar { HRoomAvatar {

View File

@ -73,7 +73,7 @@ HFlickableColumnPopup {
} }
onOpened: passwordField.forceActiveFocus() onOpened: passwordField.forceActiveFocus()
onKeyboardAccept: popup.validate() onKeyboardAccept: if (validateButton.enabled) validateButton.clicked()
SummaryLabel { id: summary } SummaryLabel { id: summary }