Add keybind to toggle collapsing account

This commit is contained in:
miruka 2019-08-19 14:28:12 -04:00
parent e713eb7e24
commit c841a7a841
5 changed files with 39 additions and 4 deletions

View File

@ -122,6 +122,12 @@ class UISettings(JSONConfigFile):
"clearRoomFilter": ["Alt+Shift+S", "Ctrl+Shift+S"], "clearRoomFilter": ["Alt+Shift+S", "Ctrl+Shift+S"],
"goToPreviousRoom": ["Alt+Shift+Up", "Alt+Shift+K"], "goToPreviousRoom": ["Alt+Shift+Up", "Alt+Shift+K"],
"goToNextRoom": ["Alt+Shift+Down", "Alt+Shift+J"], "goToNextRoom": ["Alt+Shift+Down", "Alt+Shift+J"],
"toggleCollapseAccount": [
"Alt+Shift+Left", "Alt+Shift+Right",
"Alt+Shift+H", "Alt+Shift+R",
],
"startDebugger": ["Alt+Shift+D"], "startDebugger": ["Alt+Shift+D"],
}, },
} }

View File

@ -56,6 +56,11 @@ Item {
onActivated: mainUI.sidePane.accountRoomList.next() onActivated: mainUI.sidePane.accountRoomList.next()
} }
Shortcut {
sequences: settings.keys ? settings.keys.toggleCollapseAccount : []
onActivated: mainUI.sidePane.accountRoomList.toggleCollapseAccount()
}
/* /*
Shortcut { Shortcut {
sequence: "Ctrl+-" sequence: "Ctrl+-"

View File

@ -51,13 +51,33 @@ HListView {
} }
function previous() { function previous() {
accountRoomList.decrementCurrentIndex() decrementCurrentIndex()
accountRoomList.currentItem.item.activate() currentItem.item.activate()
} }
function next() { function next() {
accountRoomList.incrementCurrentIndex() incrementCurrentIndex()
accountRoomList.currentItem.item.activate() currentItem.item.activate()
}
function toggleCollapseAccount() {
if (! currentItem) return
if (currentItem.item.delegateModel.type == "Account") {
currentItem.item.toggleCollapse()
return
}
for (let i = 0; i < model.source.length; i++) {
let item = model.source[i]
if (item.type == "Account" && item.user_id ==
currentItem.item.delegateModel.user_id)
{
currentIndex = i
currentItem.item.toggleCollapse()
}
}
} }

View File

@ -9,6 +9,8 @@ HInteractiveRectangle {
height: row.height height: row.height
readonly property var delegateModel: model
readonly property bool isCurrent: readonly property bool isCurrent:
window.uiState.page == "Pages/EditAccount/EditAccount.qml" && window.uiState.page == "Pages/EditAccount/EditAccount.qml" &&
window.uiState.pageProperties.userId == model.data.user_id window.uiState.pageProperties.userId == model.data.user_id

View File

@ -14,6 +14,8 @@ HInteractiveRectangle {
Behavior on opacity { HNumberAnimation {} } Behavior on opacity { HNumberAnimation {} }
readonly property var delegateModel: model
readonly property bool forceExpand: readonly property bool forceExpand:
Boolean(accountRoomList.filter) Boolean(accountRoomList.filter)