From 8314e19cb1f6ceb5b64d6f4bdad0f461f40eb0ce Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Fri, 7 May 2021 03:03:09 +0200 Subject: [PATCH] Fix bugs in multi account setups --- imports/NeoChat/Page/RoomListPage.qml | 42 +++++++++++++++++---------- qml/main.qml | 1 - 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/imports/NeoChat/Page/RoomListPage.qml b/imports/NeoChat/Page/RoomListPage.qml index 50b2d1de6..f127c638b 100644 --- a/imports/NeoChat/Page/RoomListPage.qml +++ b/imports/NeoChat/Page/RoomListPage.qml @@ -18,7 +18,6 @@ Kirigami.ScrollablePage { id: page property var enteredRoom - required property var activeConnection function goToNextRoom() { do { @@ -58,7 +57,10 @@ Kirigami.ScrollablePage { helpfulAction: Kirigami.Action { icon.name: sortFilterRoomListModel.filterText.length > 0 ? "search" : "list-add" text: sortFilterRoomListModel.filterText.length > 0 ? i18n("Search in room directory") : i18n("Explore rooms") - onTriggered: pageStack.layers.push("qrc:/imports/NeoChat/Page/JoinRoomPage.qml", {"connection": activeConnection, "keyword": sortFilterRoomListModel.filterText}) + onTriggered: pageStack.layers.push("qrc:/imports/NeoChat/Page/JoinRoomPage.qml", { + connection: Controller.activeConnection, + keyword: sortFilterRoomListModel.filterText + }) } } @@ -74,7 +76,7 @@ Kirigami.ScrollablePage { id: sortFilterRoomListModel sourceModel: RoomListModel { id: roomListModel - connection: page.activeConnection + connection: Controller.activeConnection } roomSortOrder: Config.mergeRoomList ? SortFilterRoomListModel.LastActivity : SortFilterRoomListModel.Categories onLayoutChanged: { @@ -184,18 +186,28 @@ Kirigami.ScrollablePage { } } - footer: RowLayout { - visible: accountListTab.count > 1 - height: visible ? accountListTab.implicitHeight : 0 - Repeater { - id: accountListTab - model: AccountListModel { } - delegate: QQC2.TabButton { - checkable: true - checked: Controller.activeConnection.user.id === model.connection.user.id - onClicked: Controller.activeConnection = model.connection - Layout.fillWidth: true - text: model.user.id + footer: QQC2.ToolBar { + visible: accountList.count > 1 + height: visible ? implicitHeight : 0 + leftPadding: 0 + rightPadding: 0 + topPadding: 0 + bottomPadding: 0 + contentItem: RowLayout { + spacing: 0 + Repeater { + id: accountList + model: AccountListModel { + id: accountListModel + } + delegate: Kirigami.BasicListItem { + checkable: true + checked: Controller.activeConnection.localUser.id === model.user.id + onClicked: Controller.activeConnection = model.connection + Layout.fillWidth: true + Layout.fillHeight: true + text: model.user.id + } } } } diff --git a/qml/main.qml b/qml/main.qml index 2f1796a51..a139007d8 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -234,7 +234,6 @@ Kirigami.ApplicationWindow { id: roomListComponent RoomListPage { id: roomList - activeConnection: Controller.activeConnection } } Connections {