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