filter: introduce people- and tags-filtering in the mobile UI

Add a combo-box where the user can switch between "fulltext",
"people" and "tags" filtering. Connect the combobox to the
already existing filter-code.

Dirk: make combo-box smaller by using a smaller font and restricting
the width. Setting both maximum and preferred widths gives more
consistent results.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Berthold Stoeger 2020-02-19 21:39:23 +01:00 committed by Dirk Hohndel
parent c1e33aac21
commit e0766aa4bd
5 changed files with 36 additions and 10 deletions

View file

@ -444,6 +444,21 @@ Kirigami.ScrollablePage {
anchors.right: parent.right
anchors.leftMargin: Kirigami.Units.gridUnit / 2
anchors.rightMargin: Kirigami.Units.gridUnit / 2
TemplateComboBox {
id: sitefilterMode
editable: false
model: ListModel {
ListElement {text: qsTr("Fulltext")}
ListElement {text: qsTr("People")}
ListElement {text: qsTr("Tags")}
}
font.pointSize: subsurfaceTheme.smallPointSize
Layout.preferredWidth: parent.width * 0.2
Layout.maximumWidth: parent.width * 0.3
onActivated: {
manager.setFilter(sitefilter.text, currentIndex)
}
}
Controls.TextField {
id: sitefilter
z: 10
@ -452,7 +467,7 @@ Kirigami.ScrollablePage {
text: ""
placeholderText: "Full text search"
onAccepted: {
manager.setFilter(text)
manager.setFilter(text, sitefilterMode.currentIndex)
}
onEnabledChanged: {
// reset the filter when it gets toggled
@ -539,7 +554,7 @@ Kirigami.ScrollablePage {
text: qsTr("Filter dives")
onTriggered: {
rootItem.filterToggle = !rootItem.filterToggle
manager.setFilter("")
manager.setFilter("", 0)
numShownText = diveModel.shown()
}
}