resources/harmattan/qml/StationPage.qml \
resources/harmattan/qml/SearchBar.qml \
resources/harmattan/qml/PageHeader.qml \
+ resources/harmattan/qml/PageHeader.js \
resources/harmattan/qml/uiconstants.js \
resources/harmattan/qml/StationListPage.js \
resources/harmattan/qml/AboutPage.qml \
id: header
anchors.top: parent.top
selectedIndex: settings.showArrivalsPreferred ? 1 : 0
- options: ListModel {
- id: dialogOptions
- ListElement {
- name: QT_TR_NOOP("About Quando Parte")
- }
- }
+ options: [
+ qsTr("About Quando Parte")
+ ]
}
Label {
anchors {
margins: UiConstants.DefaultMargin
}
text: qsTr("<h2><a href='http://quandoparte.garage.maemo.org'>" +
- "Quando Parte" + "</a></h2>" +"<p style='font-size:small;'>version " + settings.versionString +
- "</p>" +
+ "Quando Parte" + "</a></h2>" +"<p style='font-size:small;'>version ") +
+ settings.versionString +
+ qsTr("</p>" +
"<p>Copyright (c) 2010, 2011</p>" +
- "<p>Luciano Montanaro (<a href='mailto:mikelima@cirulla.net'>mikelima@cirulla.net</a>)</p>" +
+ "<p>Luciano Montanaro " +
+ "(<a href='mailto:mikelima@cirulla.net'>mikelima@cirulla.net</a>)</p>" +
"<p>Licensed under the GNU Public License v2 or above</p>" +
"<p/><p>Station geolocation data from " +
"<a href='http://www.openstreetmap.org'>OpenStreetMap</a></p>" +
--- /dev/null
+function setDisplayIndex(index) {
+ console.log("Selection changed to: " + index)
+ if (optionList === undefined || optionList.count === 0 ||
+ optionList.get(index) === undefined) {
+ header.text = " "
+ } else {
+ header.text = optionList.get(index).name
+ console.log("Selection text is: " + header.text)
+ }
+}
+
+function init()
+{
+ console.log("option length " + header.options.length)
+ for (var i = 0; i < header.options.length; ++i) {
+ console.log("option " + header.options[i])
+ optionList.append({name: header.options[i]})
+ Private.setDisplayIndex(selectedIndex)
+ }
+}
import com.nokia.meego 1.0
import com.nokia.extras 1.0
import "uiconstants.js" as UiConstants
+import "PageHeader.js" as Private
Rectangle {
+ id: header
property alias text: label.text
- property alias options: dialog.model
property alias selectedIndex: dialog.selectedIndex
+ property variant options: [
+ "Unnamed"
+ ]
- id: root
width: parent.width
height: screen.currentOrientation === Screen.Landscape ?
UiConstants.HeaderDefaultHeightLandscape :
MouseArea {
id: mouse
anchors.fill: parent
- onClicked: if (options.count > 1) dialog.open()
+ onClicked: if (optionList.count > 1) dialog.open()
}
Image {
horizontalCenter: (label.text != "") ? undefined : parent.horizontalCenter;
verticalCenter: parent.verticalCenter;
}
- visible: options.count > 1
+ visible: optionList.count > 1
height: label.height
source: "image://theme/meegotouch-combobox-indicator" +
(style.inverted ? "-inverted" : "") +
- (root.enabled ? "" : "-disabled") +
+ (header.enabled ? "" : "-disabled") +
(mouse.pressed ? "-pressed" : "")
}
SelectionDialog {
id: dialog
titleText: qsTr("Show")
- }
- onSelectedIndexChanged: {
- console.log("Selection changed to: " + selectedIndex)
- if (options === undefined || options.count === 0 ||
- options.get(selectedIndex) === undefined) {
- header.text = " "
- } else {
- header.text = options.get(selectedIndex).name
- console.log("Selection text is: " + header.text)
+ model: ListModel {
+ id: optionList
}
}
+ onSelectedIndexChanged: Private.setDisplayIndex(selectedIndex)
+ Component.onCompleted: Private.init()
}
id: header
anchors.top: parent.top
selectedIndex: stationListProxyModel.sortingMode
- options: ListModel {
- id: dialogOptions
- ListElement {
- name: QT_TR_NOOP("Stations by Name")
- }
- ListElement {
- name: QT_TR_NOOP("Stations by Distance")
- }
- ListElement {
- name: QT_TR_NOOP("Stations Recently Seen")
- }
- }
+ options: [
+ qsTr("Stations by Name"),
+ qsTr("Stations by Distance"),
+ qsTr("Stations Recently Seen")
+ ]
}
SearchBar {
id: searchField
id: header
anchors.top: parent.top
selectedIndex: schedule.type
- options: ListModel {
- id: dialogOptions
- ListElement {
- name: QT_TR_NOOP("Departures")
- }
- ListElement {
- name: QT_TR_NOOP("Arrivals")
- }
- }
+ options: [
+ qsTr("Departures"),
+ qsTr("Arrivals")
+ ]
}
InfoBar {
id: infoBar