Fix higlighted room not updating after ctrl+tab

This commit is contained in:
miruka 2020-05-13 22:47:04 -04:00
parent 922f12e9f9
commit 200f0c33a8
2 changed files with 15 additions and 2 deletions

View File

@ -106,7 +106,7 @@ HListView {
function setCorrectCurrentItem() { function setCorrectCurrentItem() {
if (! currentShouldBeRoom && ! currentShouldBeAccount) { if (! currentShouldBeRoom && ! currentShouldBeAccount) {
currentIndex = -1 currentIndex = -1
return return null
} }
for (let i = 0; i < model.count; i++) { for (let i = 0; i < model.count; i++) {
@ -124,12 +124,21 @@ HListView {
item.for_account === wantedUserId item.for_account === wantedUserId
)) { )) {
currentIndex = i currentIndex = i
return return true
} }
} }
return false
} }
Connections {
target: pageLoader
onPreviousShown:
// Will trigger the timer above if item isn't found
if (setCorrectCurrentItem() === false) currentIndex = -1
}
Timer { Timer {
// On startup, the account/room takes an unknown amount of time to // On startup, the account/room takes an unknown amount of time to
// arrive in the model, try to find it until then. // arrive in the model, try to find it until then.

View File

@ -33,6 +33,9 @@ HLoader {
} }
signal previousShown(string componentUrl, var properties)
property bool isWide: width > theme.contentIsWideAbove property bool isWide: width > theme.contentIsWideAbove
// List of previously loaded [componentUrl, {properties}] // List of previously loaded [componentUrl, {properties}]
@ -79,6 +82,7 @@ HLoader {
window.uiState.page = componentUrl window.uiState.page = componentUrl
window.uiState.pageProperties = properties window.uiState.pageProperties = properties
window.uiStateChanged() window.uiStateChanged()
previousShown(componentUrl, properties)
return true return true
} }