From 9fc347ac103074daa4f919f4f6528bb49d4ca263 Mon Sep 17 00:00:00 2001 From: miruka Date: Sat, 7 Mar 2020 11:28:51 -0400 Subject: [PATCH] Fix selecting a room in a collapsed account --- src/gui/MainPane/Account.qml | 8 ++++++-- src/gui/MainPane/AccountRoomsList.qml | 17 +++++++++++++---- src/gui/MainPane/MainPaneToolBar.qml | 6 +++++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/gui/MainPane/Account.qml b/src/gui/MainPane/Account.qml index 1053735c..7d5578d0 100644 --- a/src/gui/MainPane/Account.qml +++ b/src/gui/MainPane/Account.qml @@ -67,11 +67,15 @@ HTileDelegate { mainPaneList.currentIndex = index } - function toggleCollapse() { - window.uiState.collapseAccounts[model.id] = ! collapsed + function setCollapse(collapse) { + window.uiState.collapseAccounts[model.id] = collapse window.uiStateChanged() } + function toggleCollapse() { + setCollapse(! collapsed) + } + Behavior on opacity { HNumberAnimation {} } diff --git a/src/gui/MainPane/AccountRoomsList.qml b/src/gui/MainPane/AccountRoomsList.qml index 2b5f1b83..5136a274 100644 --- a/src/gui/MainPane/AccountRoomsList.qml +++ b/src/gui/MainPane/AccountRoomsList.qml @@ -157,27 +157,36 @@ HListView { } function activate() { - if (! currentItem) incrementCurrentIndex() + if (! currentItem) next() + selectedRoom ? currentItem.roomList.currentItem.activated() : currentItem.account.activated() } function accountSettings() { - if (! currentItem) incrementCurrentIndex() + if (! currentItem) next() + currentItem.roomList.currentIndex = -1 currentItem.account.activated() } function addNewChat() { - if (! currentItem) incrementCurrentIndex() + if (! currentItem) next() + currentItem.roomList.currentIndex = -1 currentItem.account.addChat.clicked() } + function setCollapseAccount(collapse) { + if (! currentItem) return + currentItem.account.setCollapse(collapse) + } + function toggleCollapseAccount() { if (mainPane.filter) return - if (! currentItem) incrementCurrentIndex() + if (! currentItem) next() + currentItem.account.toggleCollapse() } diff --git a/src/gui/MainPane/MainPaneToolBar.qml b/src/gui/MainPane/MainPaneToolBar.qml index 5651f0fe..0795facb 100644 --- a/src/gui/MainPane/MainPaneToolBar.qml +++ b/src/gui/MainPane/MainPaneToolBar.qml @@ -49,7 +49,11 @@ HRowLayout { return } - if (window.settings.clearRoomFilterOnEnter) text = "" + if (window.settings.clearRoomFilterOnEnter) { + mainPaneList.setCollapseAccount(false) + text = "" + } + mainPaneList.requestActivate() }