Added Menu item to open the about page
[quandoparte] / application / resources / harmattan / qml / StationListPage.js
1 var view = undefined
2 var about = undefined
3
4 function showAboutPage()
5 {
6     var component = Qt.createComponent("AboutPage.qml")
7     if (component.status == Component.Ready) {
8         about = component.createObject(stationListPage)
9         pageStack.push(about)
10     } else
11         console.log('Cannot load component: ' + component.errorString());
12 }
13
14 function loadStation(name)
15 {
16     var component = Qt.createComponent("StationPage.qml");
17     if (component.status == Component.Ready) {
18         view = component.createObject(stationListPage)
19         stationListPage.stationView = view
20         pageStack.push(view)
21         view.html = "<h1>Loading station " + name + "</h1><p>Lorem ipsum</p>"
22         provider.stationSchedule(name)
23     }
24     else
25         console.log('Cannot load component: ' + component.errorString());
26 }
27
28 function highlightSearch(s, color)
29 {
30     // TODO compile RegExp on change, or find a way to cleanly use
31     // stationListProxyModel.filterRegExp
32     if (searchField.text.length) {
33         var r = new RegExp(searchField.text, 'i')
34         var match = r.exec(s)
35         return s.replace(r, '<span style="text-decoration:underline;color:' + color + ';">' +
36                          match + '</span>')
37     } else {
38         return s
39     }
40 }
41