diff --git a/src/gui/PageLoader.qml b/src/gui/PageLoader.qml index 0b42a7a3..9f9fc9e3 100644 --- a/src/gui/PageLoader.qml +++ b/src/gui/PageLoader.qml @@ -15,6 +15,7 @@ HLoader { property var history: [] property int historyLength: 20 + signal aboutToRecycle() signal recycled() signal previousShown(string componentUrl, var properties) @@ -28,6 +29,8 @@ HLoader { item if (recycle) { + aboutToRecycle() + for (const [prop, value] of Object.entries(properties)) item[prop] = value @@ -55,20 +58,16 @@ HLoader { return true } - function closeMainPane() { - if (mainPane.collapse) mainPane.close() - } - function takeFocus() { pageLoader.item.forceActiveFocus() - closeMainPane() + if (mainPane.collapse) mainPane.close() } clip: appearAnimation.running onLoaded: { takeFocus(); appearAnimation.restart() } - onRecycled: { closeMainPane(); appearAnimation.restart() } + onRecycled: { takeFocus(); appearAnimation.restart() } Component.onCompleted: { if (! py.startupAnyAccountsSaved) { diff --git a/src/gui/Pages/Chat/Chat.qml b/src/gui/Pages/Chat/Chat.qml index a9381906..625e7ab0 100644 --- a/src/gui/Pages/Chat/Chat.qml +++ b/src/gui/Pages/Chat/Chat.qml @@ -22,8 +22,6 @@ Item { property string replyToUserId: "" property string replyToDisplayName: "" - readonly property string pageIdentity: userId + "/" + roomId - readonly property alias loader: loader readonly property alias roomPane: roomPaneLoader.item @@ -39,7 +37,6 @@ Item { } - onPageIdentityChanged: if (roomPane) roomPane.appearAnimation.restart() onFocusChanged: if (focus && loader.item) loader.item.composer.takeFocus() onReadyChanged: longLoading = false @@ -127,6 +124,11 @@ Item { factor: 2 running: true } + + Connections { + target: pageLoader + function onRecycled() { roomPane.appearAnimation.restart() } + } } } } diff --git a/src/gui/Pages/Chat/RoomPane/MemberView/MemberView.qml b/src/gui/Pages/Chat/RoomPane/MemberView/MemberView.qml index 93a8d402..095de7cc 100644 --- a/src/gui/Pages/Chat/RoomPane/MemberView/MemberView.qml +++ b/src/gui/Pages/Chat/RoomPane/MemberView/MemberView.qml @@ -14,6 +14,15 @@ HColumnLayout { readonly property alias filterField: filterField + Connections { + target: pageLoader + + function onAboutToRecycle() { + stackView.pop(stackView.initialItem) + filterField.reset() + } + } + HStackView { id: stackView @@ -79,8 +88,6 @@ HColumnLayout { HTextField { id: filterField - saveName: "memberFilterField" - saveId: chat.roomId backgroundColor: theme.chat.roomPane.bottomBar.filterMembers.background diff --git a/src/gui/Pages/Chat/RoomPane/RoomPane.qml b/src/gui/Pages/Chat/RoomPane/RoomPane.qml index c15d81c6..fafc52cc 100644 --- a/src/gui/Pages/Chat/RoomPane/RoomPane.qml +++ b/src/gui/Pages/Chat/RoomPane/RoomPane.qml @@ -90,11 +90,20 @@ MultiviewPane { target: swipeView function onCurrentItemChanged() { - swipeView.currentItem.keybindFocusItem.forceActiveFocus() + roomPane.swipeView.currentItem.keybindFocusItem.forceActiveFocus() + } + } + + Connections { + target: pageLoader + + function onAboutToRecycle() { + roomPane.swipeView.currentIndex = 0 } } MemberView {} + SettingsView { enabled: accountModel.presence !== "offline" } diff --git a/src/gui/Pages/Chat/RoomPane/SettingsView.qml b/src/gui/Pages/Chat/RoomPane/SettingsView.qml index f3ffdceb..693223a4 100644 --- a/src/gui/Pages/Chat/RoomPane/SettingsView.qml +++ b/src/gui/Pages/Chat/RoomPane/SettingsView.qml @@ -80,6 +80,11 @@ HFlickableColumnPage { onKeyboardAccept: if (applyButton.enabled) applyButton.clicked() onKeyboardCancel: cancel() + Connections { + target: pageLoader + function onAboutToRecycle() { cancel() } + } + HRoomAvatar { id: avatar clientUserId: chat.userId diff --git a/src/gui/Pages/Chat/Timeline/EventList.qml b/src/gui/Pages/Chat/Timeline/EventList.qml index 4f29da02..4f1165dc 100644 --- a/src/gui/Pages/Chat/Timeline/EventList.qml +++ b/src/gui/Pages/Chat/Timeline/EventList.qml @@ -576,8 +576,8 @@ Rectangle { } Connections { - target: chat - function onPageIdentityChanged() { eventList.moreToLoad = true } + target: pageLoader + function onRecycled() { eventList.moreToLoad = true } } }