diff --git a/src/devtools/RoomData.qml b/src/devtools/RoomData.qml index a947200f6..b64bae40a 100644 --- a/src/devtools/RoomData.qml +++ b/src/devtools/RoomData.qml @@ -21,19 +21,22 @@ ColumnLayout { title: i18nc("@title", "Choose Room") } FormCard.FormCard { - FormCard.FormComboBoxDelegate { - id: roomComboBox - text: i18n("Room") - textRole: "escapedDisplayName" - valueRole: "roomId" - displayText: RoomManager.roomListModel.data(RoomManager.roomListModel.index(currentIndex, 0), RoomListModel.EscapedDisplayNameRole) - model: RoomManager.roomListModel - currentIndex: 0 - displayMode: FormCard.FormComboBoxDelegate.Page - Component.onCompleted: currentIndex = RoomManager.roomListModel.rowForRoom(root.room) - onCurrentValueChanged: root.room = RoomManager.roomListModel.roomByAliasOrId(roomComboBox.currentValue) + FormCard.FormButtonDelegate { + text: root.room?.displayNameForHtml ?? i18nc("@info", "No room selected") + description: i18nc("@info", "Click to choose a room"); + + onClicked: { + let dialog = root.Window.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ChooseRoomDialog'), { + connection: root.connection, + }, { + title: i18nc("@title:dialog", "Choose Room"), + width: Kirigami.Units.gridUnit * 24 + }); + dialog.chosen.connect(id => root.room = root.connection.room(id)) + } } FormCard.FormTextDelegate { + visible: root.room text: i18n("Room Id: %1", root.room.id) } } diff --git a/src/qml/ChooseRoomDialog.qml b/src/qml/ChooseRoomDialog.qml index fff4a6fdf..564a4412a 100644 --- a/src/qml/ChooseRoomDialog.qml +++ b/src/qml/ChooseRoomDialog.qml @@ -23,7 +23,11 @@ SearchPage { model: RoomManager.sortFilterRoomListModel modelDelegate: RoomDelegate { - onClicked: root.chosen(currentRoom.id) + onClicked: { + root.chosen(currentRoom.id); + root.closeDialog(); + } connection: root.connection + openOnClick: false } } diff --git a/src/qml/RoomDelegate.qml b/src/qml/RoomDelegate.qml index 850eb0fed..1d75eca0c 100644 --- a/src/qml/RoomDelegate.qml +++ b/src/qml/RoomDelegate.qml @@ -25,6 +25,7 @@ Delegates.RoundedItemDelegate { required property string subtitleText required property string displayName + property bool openOnClick: true property bool showConfigure: true property bool collapsed: false @@ -35,8 +36,10 @@ Delegates.RoundedItemDelegate { Accessible.onPressAction: clicked() onClicked: { - RoomManager.resolveResource(currentRoom.id); - pageStack.currentIndex = 1; + if (root.openOnClick) { + RoomManager.resolveResource(currentRoom.id); + pageStack.currentIndex = 1; + } } onPressAndHold: createRoomListContextMenu()