Reset room pane state when recycling chat page
Side effect: the members filter field's text is no longer saved to disk
This commit is contained in:
parent
601b42a503
commit
2545ba6c00
|
@ -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) {
|
||||
|
|
|
@ -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() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -576,8 +576,8 @@ Rectangle {
|
|||
}
|
||||
|
||||
Connections {
|
||||
target: chat
|
||||
function onPageIdentityChanged() { eventList.moreToLoad = true }
|
||||
target: pageLoader
|
||||
function onRecycled() { eventList.moreToLoad = true }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user