From 238f38c9f07cb2e1748a708cf151e461db3318e3 Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 21 Jul 2019 09:35:52 -0400 Subject: [PATCH] Save/load which room categories are collapsed --- src/qml/SidePane/AccountDelegate.qml | 3 +-- src/qml/SidePane/RoomCategoryDelegate.qml | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/qml/SidePane/AccountDelegate.qml b/src/qml/SidePane/AccountDelegate.qml index d081b40f..fd9b3fe3 100644 --- a/src/qml/SidePane/AccountDelegate.qml +++ b/src/qml/SidePane/AccountDelegate.qml @@ -12,9 +12,8 @@ Column { property var userInfo: users.find(model.userId) property bool expanded: true - Component.onCompleted: { + Component.onCompleted: expanded = ! window.uiState.collapseAccounts[model.userId] - } onExpandedChanged: { window.uiState.collapseAccounts[model.userId] = ! expanded diff --git a/src/qml/SidePane/RoomCategoryDelegate.qml b/src/qml/SidePane/RoomCategoryDelegate.qml index f2bcfdfc..b3360eb4 100644 --- a/src/qml/SidePane/RoomCategoryDelegate.qml +++ b/src/qml/SidePane/RoomCategoryDelegate.qml @@ -20,12 +20,26 @@ Column { property string roomListUserId: userId property bool expanded: true + Component.onCompleted: { + if (! window.uiState.collapseCategories[model.userId]) { + window.uiState.collapseCategories[model.userId] = {} + window.uiStateChanged() + } + + expanded = !window.uiState.collapseCategories[model.userId][model.name] + } + + onExpandedChanged: { + window.uiState.collapseCategories[model.userId][model.name] = !expanded + window.uiStateChanged() + } + HRowLayout { width: parent.width HLabel { id: roomCategoryLabel - text: name + text: model.name font.weight: Font.DemiBold elide: Text.ElideRight