Fix AccountBar goToAccount errors

This commit is contained in:
miruka 2020-05-14 03:49:52 -04:00
parent 9b5b3a9f06
commit 5b05e56b2a
2 changed files with 11 additions and 4 deletions

View File

@ -38,7 +38,7 @@ Rectangle {
model: ModelStore.get("matching_accounts") model: ModelStore.get("matching_accounts")
delegate: HTileDelegate { delegate: HTile {
id: tile id: tile
width: accountList.cellWidth width: accountList.cellWidth
height: accountList.cellHeight height: accountList.cellHeight
@ -100,7 +100,13 @@ Rectangle {
contextMenu: AccountContextMenu { userId: model.id } contextMenu: AccountContextMenu { userId: model.id }
onLeftClicked: roomList.goToAccount(model.id) onLeftClicked: {
accountList.highlightRangeMode = GridView.NoHighlightRange
accountList.highlightMoveDuration = 0
roomList.goToAccount(model.id)
accountList.highlightRangeMode = GridView.ApplyRange
accountList.highlightMoveDuration = theme.animationDuration
}
readonly property bool collapsed: readonly property bool collapsed:
(window.uiState.collapseAccounts[model.id] || false) && (window.uiState.collapseAccounts[model.id] || false) &&
@ -131,7 +137,7 @@ Rectangle {
HShortcut { HShortcut {
sequences: window.settings.keys.goToPreviousAccount sequences: window.settings.keys.goToPreviousAccount
onActivated: { onActivated: {
accountList.decrementCurrentIndex() accountList.moveCurrentIndexLeft()
accountList.currentItem.leftClicked() accountList.currentItem.leftClicked()
} }
} }
@ -139,7 +145,7 @@ Rectangle {
HShortcut { HShortcut {
sequences: window.settings.keys.goToNextAccount sequences: window.settings.keys.goToNextAccount
onActivated: { onActivated: {
accountList.incrementCurrentIndex() accountList.moveCurrentIndexRight()
accountList.currentItem.leftClicked() accountList.currentItem.leftClicked()
} }
} }

View File

@ -61,6 +61,7 @@ HListView {
function goToAccount(userId) { function goToAccount(userId) {
accountIndice[userId] + 1 <= model.count -1 &&
model.get(accountIndice[userId] + 1).type === "Room" ? model.get(accountIndice[userId] + 1).type === "Room" ?
currentIndex = accountIndice[userId] + 1 : currentIndex = accountIndice[userId] + 1 :
currentIndex = accountIndice[userId] currentIndex = accountIndice[userId]