Added a WebView to the qml files
authorLuciano Montanaro <mikelima@cirulla.net>
Fri, 15 Jul 2011 14:42:42 +0000 (16:42 +0200)
committerLuciano Montanaro <mikelima@cirulla.net>
Fri, 15 Jul 2011 14:42:42 +0000 (16:42 +0200)
application/application.pro
application/resources/harmattan/qml/StationListPage.qml
application/resources/harmattan/qml/StationPage.qml [new file with mode: 0644]

index b1c571c..c04525d 100644 (file)
@@ -105,7 +105,8 @@ OTHER_FILES += \
     resources/stations/generatelist.xq \
     resources/stations/generateunclassifiedlist.xq \
     resources/harmattan/qml/main.qml \
-    resources/harmattan/qml/StationListPage.qml
+    resources/harmattan/qml/StationListPage.qml \
+    resources/harmattan/qml/StationPage.qml
 
 unix {
     isEmpty(PREFIX) {
index a5c8be1..8270bb2 100644 (file)
@@ -4,15 +4,36 @@ import "/usr/lib/qt4/imports/com/nokia/meego/UIConstants.js" as UiConstants
 
 Page {
     id: stationListPage
-    tools: toolBar
     anchors.margins: UiConstants.DEFAULT_MARGIN
+    tools: ToolBarLayout {
+        id: toolBar
+        ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
+        ToolIcon { iconId: "icon-m-toolbar-settings"; onClicked: settingsSheet.open(); }
+        ToolIcon { iconId: "icon-m-toolbar-view-menu"; }
+    }
+
+    function loadStation()
+    {
+        var component = Qt.createComponent("StationPage.qml");
+        if (component.status == Component.Ready) {
+            pageStack.push(component)
+            component.html = "<p>Hello World</p>"
+        }
+        else
+            console.log("Cannot load component: " + component.errorString());
+    }
+
     Column {
+        width: parent.width
+        height: parent.height
         TextField {
+            width: parent.width
             placeholderText: "Search..."
         }
         ListView {
             id: stationListView
-            anchors.fill: parent
+            width: parent.width
+            height: parent.height
             model: ListModel {
                 ListElement {
                     name: "Genova Sestri Ponente"
@@ -59,6 +80,7 @@ Page {
                         Label {
                             id: mainText
                             text: model.name
+                            font.bold: true
                             //font.family: UiConstants.FONT_FAMILY
                             //font.pixelSize: UiConstants.FONT_DEFAULT
                         }
@@ -68,7 +90,7 @@ Page {
                     id: mouseArea
                     anchors.fill: background
                     onClicked: {
-                        stationListPage.openFile(page)
+                        stationListPage.loadStation(name)
                     }
                 }
             }
@@ -122,12 +144,5 @@ Page {
             }
         }
     }
-
-    ToolBarLayout {
-        id: toolBar
-        ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
-        ToolIcon { iconId: "icon-m-toolbar-settings"; onClicked: settingsSheet.open(); }
-        ToolIcon { iconId: "icon-m-toolbar-view-menu"; }
-    }
 }
 
diff --git a/application/resources/harmattan/qml/StationPage.qml b/application/resources/harmattan/qml/StationPage.qml
new file mode 100644 (file)
index 0000000..51f1fcf
--- /dev/null
@@ -0,0 +1,18 @@
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import QtWebKit 1.0
+
+Page {
+    property string html: "<p>Hello</p>"
+    anchors.fill: parent
+
+    tools: ToolBarLayout {
+        id: toolBar
+        ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
+        ToolIcon { iconId: "icon-m-toolbar-view-menu"; }
+    }
+    WebView {
+        id: view
+        anchors.fill: parent
+    }
+}