From f1b9cbbf6cfc326076bc005fa2b6822612768c21 Mon Sep 17 00:00:00 2001 From: James Graham Date: Sun, 16 Oct 2022 09:46:32 +0000 Subject: [PATCH] Fix RoomDrawer not respecting user choice after other menus are opened Ensure that user choice is given precedent for opening/closing the room drawer. This makes it so that the previous state is restored after one of the menu pages is closed or if the window is dragged thin then wide again. Fixes network/neochat#196 --- qml/main.qml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/qml/main.qml b/qml/main.qml index 2a302dbc9..3f34e31e7 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -142,11 +142,24 @@ Kirigami.ApplicationWindow { contextDrawer: RoomDrawer { id: contextDrawer + + // This is a memory for all user initiated actions on the drawer, i.e. clicking the button + // It is used to ensure that user choice is remembered when changing pages and expanding and contracting the window width + property bool drawerUserState: Config.autoRoomInfoDrawer + + // Connect to the onClicked function of the RoomDrawer handle button + Connections { + target: contextDrawer.handle.children[0] + function onClicked() { + contextDrawer.drawerUserState = contextDrawer.drawerOpen + } + } + modal: !root.wideScreen || !enabled onEnabledChanged: drawerOpen = enabled && !modal onModalChanged: { if (Config.autoRoomInfoDrawer) { - drawerOpen = !modal + drawerOpen = !modal && drawerUserState dim = false } }