Cleanup connection handling in QML

Consistently pass connection objects to files that need them instead of randomly using Controller.activeConnection in some of them
This commit is contained in:
Tobias Fella
2023-09-12 17:10:16 +02:00
committed by Carl Schwan
parent 6439fa48f9
commit 5e80715898
37 changed files with 203 additions and 72 deletions

View File

@@ -17,6 +17,8 @@ QQC2.Control {
readonly property real pinnedWidth: Kirigami.Units.gridUnit * 6
property bool drawerEnabled: true
required property NeoChatConnection connection
leftPadding: 0
rightPadding: 0
topPadding: 0
@@ -73,12 +75,12 @@ QQC2.Control {
Repeater {
model: SortFilterSpaceListModel {
sourceModel: RoomListModel {
connection: Controller.activeConnection
connection: root.connection
}
}
onCountChanged: {
root.enabled = count > 0
if (!Controller.activeConnection.room(root.selectedSpaceId)) {
if (!root.connection.room(root.selectedSpaceId)) {
root.selectedSpaceId = ""
}
}
@@ -111,7 +113,8 @@ QQC2.Control {
function createContextMenu(room) {
let context = spaceListContextMenu.createObject(root, {
room: room
room: room,
connection: root.connection
});
context.open()
}