Emit Room Selected from JoinRoomPage

Change the `JoinRoomPage` so that it emits a `roomSelected` signal with the selected delegate's info instead of calling the functions to join or enter the room itself. This is so that the `JoinRoomPage` can be used for other purposes like selecting an existing child to add to a space.
This commit is contained in:
James Graham
2023-09-11 17:16:12 +00:00
parent 8285961c42
commit ff0990bb7c
5 changed files with 73 additions and 13 deletions

View File

@@ -19,7 +19,14 @@ RowLayout {
text: i18n("Explore rooms")
icon.name: "compass"
onTriggered: {
pageStack.pushDialogLayer("qrc:/JoinRoomPage.qml", {connection: Controller.activeConnection}, {title: i18nc("@title", "Explore Rooms")})
let dialog = pageStack.pushDialogLayer("qrc:/JoinRoomPage.qml", {connection: Controller.activeConnection}, {title: i18nc("@title", "Explore Rooms")})
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
if (isJoined) {
RoomManager.enterRoom(Controller.activeConnection.room(roomId))
} else {
Controller.joinRoom(roomId)
}
})
}
}
property Kirigami.Action chatAction: Kirigami.Action {