From a391df1e67c0a1c4d31c898ae9c0c42c95ab6014 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Sun, 29 Dec 2024 09:46:50 +0100 Subject: [PATCH] QuickSwitcher: Suggest to explore rooms when there are no search results My go to place for doing anything with rooms, is the search button. However, I cannot join/find new rooms from there. Therefore this adds an "Expore rooms" button as helpful action when there are no matching rooms. --- src/qml/QuickSwitcher.qml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/qml/QuickSwitcher.qml b/src/qml/QuickSwitcher.qml index 9888940bd..a60efb26f 100644 --- a/src/qml/QuickSwitcher.qml +++ b/src/qml/QuickSwitcher.qml @@ -27,6 +27,22 @@ Kirigami.SearchDialog { onTextChanged: RoomManager.sortFilterRoomListModel.filterText = text model: RoomManager.sortFilterRoomListModel emptyText: i18nc("Placeholder message", "No room found") + emptyHelpfulAction: Kirigami.Action { + text: i18nc("@action:button", "Explore rooms") + icon.name: "compass" + onTriggered: { + root.close() + let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ExploreRoomsPage'), { + connection: root.connection + }, { + title: i18nc("@title", "Explore Rooms") + }); + dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { + RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join"); + }); + } + } + parent: QQC2.Overlay.overlay delegate: RoomDelegate {