Added a WebView to the qml files
[quandoparte] / application / resources / harmattan / qml / StationListPage.qml
1 import QtQuick 1.0
2 import com.nokia.meego 1.0
3 import "/usr/lib/qt4/imports/com/nokia/meego/UIConstants.js" as UiConstants
4
5 Page {
6     id: stationListPage
7     anchors.margins: UiConstants.DEFAULT_MARGIN
8     tools: ToolBarLayout {
9         id: toolBar
10         ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
11         ToolIcon { iconId: "icon-m-toolbar-settings"; onClicked: settingsSheet.open(); }
12         ToolIcon { iconId: "icon-m-toolbar-view-menu"; }
13     }
14
15     function loadStation()
16     {
17         var component = Qt.createComponent("StationPage.qml");
18         if (component.status == Component.Ready) {
19             pageStack.push(component)
20             component.html = "<p>Hello World</p>"
21         }
22         else
23             console.log("Cannot load component: " + component.errorString());
24     }
25
26     Column {
27         width: parent.width
28         height: parent.height
29         TextField {
30             width: parent.width
31             placeholderText: "Search..."
32         }
33         ListView {
34             id: stationListView
35             width: parent.width
36             height: parent.height
37             model: ListModel {
38                 ListElement {
39                     name: "Genova Sestri Ponente"
40                 }
41                 ListElement {
42                     name: "Genova Cornigliano"
43                 }
44                 ListElement {
45                     name: "Genova Sampierdarena"
46                 }
47                 ListElement {
48                     name: "Genova Piazza Principe"
49                 }
50                 ListElement {
51                     name: "Genova Brignole"
52                 }
53                 ListElement {
54                     name: "Genova Sturla"
55                 }
56                 ListElement {
57                     name: "Genova Quinto"
58                 }
59                 ListElement {
60                     name: "Genova Nervi"
61                 }
62             }
63             delegate: Item {
64                 id: listItem
65                 height: 88
66                 width: parent.width
67                 BorderImage {
68                     id: background
69                     anchors.fill: parent
70                     // Fill page borders
71                     visible: mouseArea.pressed
72                     source: "image://theme/meegotouch-list-background-pressed-center"
73                 }
74                 Row {
75                     anchors.fill: parent
76
77                     Column {
78                         anchors.verticalCenter: parent.verticalCenter
79
80                         Label {
81                             id: mainText
82                             text: model.name
83                             font.bold: true
84                             //font.family: UiConstants.FONT_FAMILY
85                             //font.pixelSize: UiConstants.FONT_DEFAULT
86                         }
87                     }
88                 }
89                 MouseArea {
90                     id: mouseArea
91                     anchors.fill: background
92                     onClicked: {
93                         stationListPage.loadStation(name)
94                     }
95                 }
96             }
97         }
98     }
99
100     Sheet {
101         id: settingsSheet
102         acceptButtonText: "Save"
103         rejectButtonText: "Cancel"
104         content: Item {
105             x: 16
106             y: 16
107             width: parent.width - 32
108             height: parent.height - 32
109             Column {
110                 spacing: 16
111                 anchors.fill: parent
112                 Row {
113                     height: 40
114                     spacing: 16
115                     anchors.left: parent.left
116                     anchors.right: parent.right
117                     Label {
118                         font.bold: true
119                         text: "Show Last Station on Startup"
120                         anchors.verticalCenter: parent.verticalCenter
121                     }
122                     Switch {
123                         anchors.verticalCenter: parent.verticalCenter
124                         id: showLastStationSwitch
125                         anchors.right: parent.right
126                     }
127                 }
128                 Row {
129                     height: 40
130                     spacing: 16
131                     anchors.left: parent.left
132                     anchors.right: parent.right
133                     Label {
134                         font.bold: true
135                         text: "Update Display Periodically"
136                         anchors.verticalCenter: parent.verticalCenter
137                     }
138                     Switch {
139                         anchors.verticalCenter: parent.verticalCenter
140                         anchors.right: parent.right
141                         id: periodicCheckSwitch
142                     }
143                 }
144             }
145         }
146     }
147 }
148