Add keyboard controls for members list & profile

This commit is contained in:
miruka 2020-07-09 14:53:01 -04:00
parent dc2a7b8ee1
commit 92cbc4b006
4 changed files with 31 additions and 7 deletions

View File

@ -2,7 +2,6 @@
- fix highlight when logging in to new account
- warn about no E2E room shared if no devices
- keyboard controls
- Make HTile enter key trigger leftClicked()
## Refactoring

View File

@ -16,9 +16,17 @@ HFlickableColumnPage {
property string ed25519Key
property HStackView stackView
property Item previouslyFocused: null
signal trustSet(bool trust)
function close() {
if (previouslyFocused) previouslyFocused.forceActiveFocus()
stackView.pop()
}
footer: ButtonLayout {
ApplyButton {
text: qsTr("They're the same")
@ -32,7 +40,7 @@ HFlickableColumnPage {
() => {
loading = false
page.trustSet(true)
stackView.pop()
page.close()
}
)
}
@ -50,7 +58,7 @@ HFlickableColumnPage {
() => {
loading = false
page.trustSet(false)
stackView.pop()
page.close()
}
)
}
@ -58,12 +66,15 @@ HFlickableColumnPage {
CancelButton {
id: cancelButton
onClicked: stackView.pop()
Component.onCompleted: forceActiveFocus()
onClicked: page.close()
Component.onCompleted: {
page.previouslyFocused = window.activeFocusItem
forceActiveFocus()
}
}
}
onKeyboardCancel: stackView.pop()
onKeyboardCancel: page.close()
HRowLayout {
@ -72,7 +83,7 @@ HFlickableColumnPage {
circle: true
icon.name: "close-view"
iconItem.small: true
onClicked: page.stackView.pop()
onClicked: page.close()
Layout.rightMargin: theme.spacing
}

View File

@ -133,6 +133,11 @@ HListView {
Component.onCompleted: loadDevices()
Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: {
currentItem.leftClicked()
currentItem.clicked()
}
Keys.onEscapePressed: stackView.pop()

View File

@ -37,6 +37,12 @@ HColumnLayout {
},
)
}
Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: {
currentItem.leftClicked()
currentItem.clicked()
}
}
Layout.fillWidth: true
@ -75,6 +81,9 @@ HColumnLayout {
py.callCoro("set_substring_filter", [modelSyncId, text])
}
Keys.forwardTo: [stackView.currentItem]
Keys.priority: Keys.AfterItem
Keys.onEscapePressed: {
roomPane.toggleFocus()
if (window.settings.clearMemberFilterOnEscape) text = ""