Skip to content

Commit

Permalink
QML: Improve Search:
Browse files Browse the repository at this point in the history
 - Delay entering search terms
 - Make Enter key more useful

Contributes-To: sailfishos-chum#88
  • Loading branch information
nephros committed Apr 30, 2024
1 parent 9c3ad4b commit 6fa70f7
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion qml/pages/PackagesListPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,25 @@ Page {
width: parent.width
//% "Search"
placeholderText: qsTrId("chum-search")
onTextChanged: page.search = text
label: (view.count > 0)
//% "%n package(s) found"
? qsTrId("chum-search-results", view.count)
//% "No packages found"
: qsTrId("chum-search-no-results")
labelVisible: visible && text.length > 0
onTextChanged: searchSubmitTimer.restart()
EnterKey.iconSource: "image://theme/icon-m-enter-close"
EnterKey.onClicked: {
if (chumModel.rowCount() > 0) {
page.removeSearchFocus();
}
}
Timer { id: searchSubmitTimer
running: false
interval: 240
onTriggered: page.search = searchField.text
}

}

Connections {
Expand Down

0 comments on commit 6fa70f7

Please sign in to comment.