diff --git a/src/gui/MainPane/RoomList.qml b/src/gui/MainPane/RoomList.qml index 9565cc7b..1fcb6030 100644 --- a/src/gui/MainPane/RoomList.qml +++ b/src/gui/MainPane/RoomList.qml @@ -106,7 +106,7 @@ HListView { function setCorrectCurrentItem() { if (! currentShouldBeRoom && ! currentShouldBeAccount) { currentIndex = -1 - return + return null } for (let i = 0; i < model.count; i++) { @@ -124,12 +124,21 @@ HListView { item.for_account === wantedUserId )) { 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 { // On startup, the account/room takes an unknown amount of time to // arrive in the model, try to find it until then. diff --git a/src/gui/PageLoader.qml b/src/gui/PageLoader.qml index 1d87962d..deb89c38 100644 --- a/src/gui/PageLoader.qml +++ b/src/gui/PageLoader.qml @@ -33,6 +33,9 @@ HLoader { } + signal previousShown(string componentUrl, var properties) + + property bool isWide: width > theme.contentIsWideAbove // List of previously loaded [componentUrl, {properties}] @@ -79,6 +82,7 @@ HLoader { window.uiState.page = componentUrl window.uiState.pageProperties = properties window.uiStateChanged() + previousShown(componentUrl, properties) return true }