From 9e8e5a9be9e0b2403a8da25fa1bbd77a0079426d Mon Sep 17 00:00:00 2001 From: Luciano Montanaro Date: Fri, 15 Jul 2011 16:42:42 +0200 Subject: [PATCH] Added a WebView to the qml files --- application/application.pro | 3 +- .../resources/harmattan/qml/StationListPage.qml | 35 ++++++++++++++------ .../resources/harmattan/qml/StationPage.qml | 18 ++++++++++ 3 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 application/resources/harmattan/qml/StationPage.qml diff --git a/application/application.pro b/application/application.pro index b1c571c..c04525d 100644 --- a/application/application.pro +++ b/application/application.pro @@ -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) { diff --git a/application/resources/harmattan/qml/StationListPage.qml b/application/resources/harmattan/qml/StationListPage.qml index a5c8be1..8270bb2 100644 --- a/application/resources/harmattan/qml/StationListPage.qml +++ b/application/resources/harmattan/qml/StationListPage.qml @@ -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 = "

Hello World

" + } + 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 index 0000000..51f1fcf --- /dev/null +++ b/application/resources/harmattan/qml/StationPage.qml @@ -0,0 +1,18 @@ +import QtQuick 1.1 +import com.nokia.meego 1.0 +import QtWebKit 1.0 + +Page { + property string html: "

Hello

" + 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 + } +} -- 1.7.9.5