From: Luciano Montanaro Date: Sun, 15 Jan 2012 22:15:36 +0000 (+0100) Subject: Use the new code field to fetch the station schedule X-Git-Tag: tags/0.5.0~16 X-Git-Url: http://git.maemo.org/git/?p=quandoparte;a=commitdiff_plain;h=117e252b94e2d7fff6f755f7cdc7afa4f3edb37d Use the new code field to fetch the station schedule This completes the fix for bug #7003 --- diff --git a/application/resources/harmattan/qml/StationListPage.js b/application/resources/harmattan/qml/StationListPage.js index b5c4046..ac4a1c6 100644 --- a/application/resources/harmattan/qml/StationListPage.js +++ b/application/resources/harmattan/qml/StationListPage.js @@ -11,13 +11,20 @@ function showAboutPage() console.log('Cannot load component: ' + component.errorString()); } -function loadStation(name) +function loadStation(name, code) { var component = Qt.createComponent("StationPage.qml"); if (component.status === Component.Ready) { view = component.createObject(stationListPage) stationListPage.stationView = view pageStack.push(view) + + /* + XXX Ugliness ahead! Changing the name triggers the station + to schedule to be fetched. So any extra data (the code specifically) + must be set before changing the name. + */ + if (code !== undefined) view.code = code view.name = name } else diff --git a/application/resources/harmattan/qml/StationListPage.qml b/application/resources/harmattan/qml/StationListPage.qml index 1904340..21fda92 100644 --- a/application/resources/harmattan/qml/StationListPage.qml +++ b/application/resources/harmattan/qml/StationListPage.qml @@ -103,9 +103,15 @@ Page { Label { id: mainText - text: Private.highlightSearch(model.display, UiConstants.AccentColor) + text: Private.highlightSearch(model.name, UiConstants.AccentColor) font.bold: true } + Label { + id: subText + text: (model.code !== undefined) ? model.code : "none" + font.bold: UiConstants.SubtitleFontBoldness + font.pixelSize: UiConstants.SubtitleFontPixelSize + } } } Image { @@ -119,7 +125,7 @@ Page { id: mouseArea anchors.fill: background onClicked: { - Private.loadStation(model.display) + Private.loadStation(model.name, model.code) } } } diff --git a/application/resources/harmattan/qml/StationPage.qml b/application/resources/harmattan/qml/StationPage.qml index d8d502a..0ed556b 100644 --- a/application/resources/harmattan/qml/StationPage.qml +++ b/application/resources/harmattan/qml/StationPage.qml @@ -5,6 +5,7 @@ import "uiconstants.js" as UiConstants Page { property alias name: schedule.name + property alias code: schedule.code tools: ToolBarLayout { id: toolBar @@ -99,13 +100,14 @@ Page { } StationScheduleModel { id: schedule - onNameChanged: schedule.fetch(name) + onNameChanged: updateStation() onLayoutChanged: view.state = "ready" } Component.onCompleted: { updateTimer.timeout.connect(updateStation) } function updateStation() { - schedule.fetch(schedule.name) + console.log("Updating station with " + schedule.name + ", " + schedule.code) + schedule.fetch(schedule.name, schedule.code) } }