From 1bd39f282ef8f4f4717036db194c0f99b1be0d51 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Thu, 21 Aug 2025 14:51:45 +0200 Subject: [PATCH] UserSearchPage: Move "Enter User ID" action into placeholder --- src/app/qml/UserSearchPage.qml | 19 +++++++++---------- src/libneochat/qml/SearchPage.qml | 12 ++++++++++++ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/app/qml/UserSearchPage.qml b/src/app/qml/UserSearchPage.qml index 98ce38d21..68193db8a 100644 --- a/src/app/qml/UserSearchPage.qml +++ b/src/app/qml/UserSearchPage.qml @@ -39,16 +39,6 @@ SearchPage { connection: root.connection } - listHeaderDelegate: Delegates.RoundedItemDelegate { - onClicked: _private.openManualUserDialog() - - activeFocusOnTab: false // We handle moving to this item via up/down arrows, otherwise the tab order is wacky - text: i18n("Enter a user ID") - icon.name: "list-add-user" - icon.width: Kirigami.Units.gridUnit * 2 - icon.height: Kirigami.Units.gridUnit * 2 - } - modelDelegate: Delegates.RoundedItemDelegate { id: userDelegate required property string userId @@ -92,6 +82,15 @@ SearchPage { noSearchPlaceholderMessage: i18n("Enter text to start searching for your friends") noResultPlaceholderMessage: i18nc("@info:label", "No matches found") + noSearchHelpfulAction: noResultHelpfulAction + + noResultHelpfulAction: Kirigami.Action { + icon.name: "list-add-user" + text: i18nc("@action:button", "Enter a user ID") + onTriggered: _private.openManualUserDialog() + tooltip: text + } + Component { id: manualUserDialog ManualUserDialog {} diff --git a/src/libneochat/qml/SearchPage.qml b/src/libneochat/qml/SearchPage.qml index 0a986eb3c..51e49cf97 100644 --- a/src/libneochat/qml/SearchPage.qml +++ b/src/libneochat/qml/SearchPage.qml @@ -91,6 +91,16 @@ Kirigami.ScrollablePage { */ property string customPlaceholderIcon: "" + /** + * @brief Action to be shown in the "no search" placeholder + */ + property Kirigami.Action noSearchHelpfulAction + + /** + * @brief Action to be shown in the "no result" placeholder + */ + property Kirigami.Action noResultHelpfulAction + /** * @brief Force the search field to be focussed. */ @@ -179,12 +189,14 @@ Kirigami.ScrollablePage { id: noSearchMessage anchors.centerIn: parent visible: searchField.text.length === 0 && listView.count === 0 && customPlaceholder.text.length === 0 + helpfulAction: root.noSearchHelpfulAction } Kirigami.PlaceholderMessage { id: noResultMessage anchors.centerIn: parent visible: searchField.text.length > 0 && listView.count === 0 && !root.model.searching && customPlaceholder.text.length === 0 + helpfulAction: root.noResultHelpfulAction } Kirigami.PlaceholderMessage {