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.
This commit is contained in:
Kai Uwe Broulik
2024-12-29 09:46:50 +01:00
parent 1f26485208
commit a391df1e67

View File

@@ -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 {