UserSearchPage: Move "Enter User ID" action into placeholder
This commit is contained in:
@@ -39,16 +39,6 @@ SearchPage {
|
|||||||
connection: root.connection
|
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 {
|
modelDelegate: Delegates.RoundedItemDelegate {
|
||||||
id: userDelegate
|
id: userDelegate
|
||||||
required property string userId
|
required property string userId
|
||||||
@@ -92,6 +82,15 @@ SearchPage {
|
|||||||
noSearchPlaceholderMessage: i18n("Enter text to start searching for your friends")
|
noSearchPlaceholderMessage: i18n("Enter text to start searching for your friends")
|
||||||
noResultPlaceholderMessage: i18nc("@info:label", "No matches found")
|
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 {
|
Component {
|
||||||
id: manualUserDialog
|
id: manualUserDialog
|
||||||
ManualUserDialog {}
|
ManualUserDialog {}
|
||||||
|
|||||||
@@ -91,6 +91,16 @@ Kirigami.ScrollablePage {
|
|||||||
*/
|
*/
|
||||||
property string customPlaceholderIcon: ""
|
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.
|
* @brief Force the search field to be focussed.
|
||||||
*/
|
*/
|
||||||
@@ -179,12 +189,14 @@ Kirigami.ScrollablePage {
|
|||||||
id: noSearchMessage
|
id: noSearchMessage
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
visible: searchField.text.length === 0 && listView.count === 0 && customPlaceholder.text.length === 0
|
visible: searchField.text.length === 0 && listView.count === 0 && customPlaceholder.text.length === 0
|
||||||
|
helpfulAction: root.noSearchHelpfulAction
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.PlaceholderMessage {
|
Kirigami.PlaceholderMessage {
|
||||||
id: noResultMessage
|
id: noResultMessage
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
visible: searchField.text.length > 0 && listView.count === 0 && !root.model.searching && customPlaceholder.text.length === 0
|
visible: searchField.text.length > 0 && listView.count === 0 && !root.model.searching && customPlaceholder.text.length === 0
|
||||||
|
helpfulAction: root.noResultHelpfulAction
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.PlaceholderMessage {
|
Kirigami.PlaceholderMessage {
|
||||||
|
|||||||
Reference in New Issue
Block a user