Add keyboard navigation for account device list

Enter/Return/Menu: open device menu
Space: toggle check device
Escape: uncheck all
Alt+R/F5: refresh device list
Alt+S/Delete: sign out checked or all sessions
This commit is contained in:
miruka 2020-07-10 03:11:26 -04:00
parent 612ded755a
commit 099c20c138
3 changed files with 25 additions and 2 deletions

View File

@ -1,6 +1,5 @@
# TODO
- composer menu?
- fix members not synced bug
- fix local unread counters order
- fix highlight when logging in to new account
@ -57,7 +56,6 @@
- Show scrollbars for a few seconds if there's content to scroll on when
opening a page or popup
- Device list keyboard navigation
- Device IP geolocation
- Can rooms but left with a reason?

View File

@ -337,6 +337,9 @@ class UISettings(JSONDataFile):
"forgetRoom": ["Alt+Shift+Escape"],
"toggleFocusRoomPane": ["Alt+R"],
"refreshDevices": ["Alt+R", "F5"],
"signOutCheckedOrAllDevices": ["Alt+S", "Delete"],
},
}

View File

@ -39,6 +39,8 @@ HColumnPage {
loadFuture = null
deviceList.sectionItemCounts = getSectionItemCounts()
if (! deviceList.currentItem) deviceList.currentIndex = 0
})
}
@ -97,12 +99,14 @@ HColumnPage {
footer: ButtonLayout {
OtherButton {
id: refreshButton
text: qsTr("Refresh")
icon.name: "device-refresh-list"
onClicked: page.loadDevices()
}
OtherButton {
id: signOutCheckedButton
enabled: deviceList.model.count > 0
text:
deviceList.selectedCount === 0 ?
@ -118,6 +122,8 @@ HColumnPage {
}
}
Keys.forwardTo: [deviceList]
HListView {
id: deviceList
@ -149,6 +155,22 @@ HColumnPage {
Layout.fillWidth: true
Layout.fillHeight: true
Keys.onEscapePressed: uncheckAll()
Keys.onSpacePressed: if (currentItem) toggleCheck(currentIndex)
Keys.onEnterPressed: if (currentItem) currentItem.openMenu(false)
Keys.onReturnPressed: Keys.onEnterPressed(event)
Keys.onMenuPressed: Keys.onEnterPressed(event)
HShortcut {
sequences: window.settings.keys.refreshDevices
onActivated: refreshButton.clicked()
}
HShortcut {
sequences: window.settings.keys.signOutCheckedOrAllDevices
onActivated: signOutCheckedButton.clicked()
}
FlickShortcuts {
flickable: deviceList
active: