Fix layoutTimer

Only change the room when a space is change rather than on all layout refreshes
This commit is contained in:
James Graham
2024-02-05 17:48:04 +00:00
parent 2895b7bc21
commit 367131d64c
2 changed files with 10 additions and 3 deletions

View File

@@ -32,6 +32,7 @@ Kirigami.Page {
readonly property RoomListModel roomListModel: RoomListModel {
connection: root.connection
}
property bool spaceChanging: false
readonly property bool collapsed: Config.collapsed
@@ -106,6 +107,7 @@ Kirigami.Page {
connection: root.connection
onSelectionChanged: root.spaceChanging = true;
onSpacesUpdated: sortFilterRoomListModel.invalidate()
}
@@ -218,9 +220,10 @@ Kirigami.Page {
// in this case activeSpaceId followed by mode.
Timer {
id: layoutTimer
interval: 100
onTriggered: if (spaceDrawer.showDirectChats || spaceDrawer.selectedSpaceId.length < 1) {
RoomManager.resolveResource(listView.itemAtIndex(0).currentRoom.id)
interval: 300
onTriggered: if ((spaceDrawer.showDirectChats || spaceDrawer.selectedSpaceId.length < 1) && root.spaceChanging) {
RoomManager.resolveResource(listView.itemAtIndex(0).currentRoom.id);
root.spaceChanging = false;
}
}

View File

@@ -25,6 +25,7 @@ QQC2.Control {
property bool showDirectChats: false
signal selectionChanged()
signal spacesUpdated()
contentItem: Loader {
@@ -94,6 +95,7 @@ QQC2.Control {
onClicked: {
root.showDirectChats = false
root.selectedSpaceId = ""
root.selectionChanged()
}
}
AvatarTabButton {
@@ -113,6 +115,7 @@ QQC2.Control {
onClicked: {
root.showDirectChats = true
root.selectedSpaceId = ""
root.selectionChanged()
}
QQC2.Label {
@@ -176,6 +179,7 @@ QQC2.Control {
RoomManager.resolveResource(currentRoom.id)
}
root.selectedSpaceId = roomId
root.selectionChanged()
}
checked: root.selectedSpaceId === roomId
onContextMenuRequested: root.createContextMenu(currentRoom)