2 import Sailfish.Silica 1.0
3 import net.cirulla.quandoparte 1.0
4 import "StationListPage.js" as Private
8 property variant stationView
9 property string searchPattern
11 target: stationListProxyModel
12 property: "searchPattern"
13 value: stationListPage.searchPattern
16 interactive: !stationListView.flicking
21 text: qsTr("About Quando Parte")
22 onClicked: pageStack.push(Qt.resolvedUrl("AboutPage.qml"))
25 text: qsTr("Stations by Name")
26 onClicked: stationListProxyModel.sortingMode = StationListProxyModel.AlphaSorting
29 text: qsTr("Stations by Distance")
30 onClicked: stationListProxyModel.sortingMode = StationListProxyModel.DistanceSorting
33 text: qsTr("Stations Recently Seen")
34 onClicked: stationListProxyModel.sortingMode = StationListProxyModel.RecentUsageSorting
41 placeholderText: qsTr("Search station...")
42 inputMethodHints: Qt.ImhNoAutoUppercase
43 onTextChanged: stationListPage.searchPattern = searchField.text
44 width: stationListPage.width
45 EnterKey.onClicked: searchField.focus = false
52 cacheBuffer: 4 * Theme.itemSizeExtraSmall
53 anchors.top: header.bottom
54 anchors.bottom: parent.bottom
55 model: stationListProxyModel
57 searchField.focus = false
60 contentHeight: Theme.itemSizeExtraSmall
66 margins: Theme.paddingMedium
69 textFormat: Text.StyledText
70 text: model.name ? Private.highlightSearch(model.name, Theme.highlightColor) : ""
71 verticalAlignment: Text.AlignVCenter
75 visible: model.favorite
76 source: "image://theme/icon-m-favorite-selected"
78 verticalCenter: parent.verticalCenter
83 Private.loadStation(model.name, model.code)
85 //onPressAndHold: contextMenu.show(listItem)
91 text: model.favorite ? qsTr("Remove from Favorites") : qsTr("Add to Favorites")
93 console.log("Favorite Stations (before):" + settings.favoriteStations)
94 model.favorite ^= true
96 var index = settings.favoriteStations.indexOf(model.name)
98 settings.favoriteStations.push(model.name)
99 else settings.favoriteStations.splice(index, 1)
101 console.log("Favorite Stations (after):" + settings.favoriteStations)
105 text: qsTr("Show on the map")
106 onClicked: Qt.openUrlExternally("geo:" + model.latitude + "," + model.longitude)
111 VerticalScrollDecorator {}