@@ -14,50 +14,73 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17−import QtQuick 2.0
17+import QtQuick 2.2
18+import Ubuntu.Components 1.1
18−import Ubuntu.Components 0.1
19+import Ubuntu.Components.Themes 0.1
19import "../Components"
20import "../Components"
21−Rectangle {
22+StyledItem {
25− property string name: ""
25+ property string title: ""
26− property url image: ""
26+ property string image: ""
27+ property bool showHeader: true
28+ // mimic API of toolkit's MainView component required by MainViewStyle
29+ property color backgroundColor: theme.palette.normal.background
30+ property color headerColor: backgroundColor
31+ property color footerColor: backgroundColor
28− UbuntuShape {
33+ // FIXME: fake a Theme object as to expose the Palette corresponding to the backgroundColor (see MainViewStyle.qml)
29− id: iconShape
34+ property var theme: QtObject {
30− anchors.horizontalCenter: parent.horizontalCenter
35+ property string name: "Ambiance"
31− anchors.verticalCenter: parent.verticalCenter
36+ property Palette palette: Qt.createQmlObject("import QtQuick 2.2; import Ubuntu.Components.Themes.%1 1.1; Palette {}".arg(theme.name), root, "dynamicPalette");
32− anchors.verticalCenterOffset: -units.gu(4)
37+ }
33− width: units.gu(8)
38+
34− height: units.gu(7.5)
39+ // FIXME: should instead use future toolkit API:
40+ // style: theme.createStyleComponent("MainViewStyle.qml", root)
41+ style: Component { MainViewStyle {theme: root.theme} }
36− radius: "medium"
50+ visible: root.showHeader
39− image: Image {
52+ // mimic API of toolkit's AppHeader component required by PageHeadStyle
40− id: iconImage
53+ property Item pageStack
41− sourceSize.width: iconShape.width
54+ property Item contents
42− sourceSize.height: iconShape.height
55+ property string title: root.title
43− source: root.image
56+ property var tabsModel
44− fillMode: Image.PreserveAspectCrop
57+ property var config: QtObject {
58+ property color foregroundColor: theme.palette.selected.backgroundText
59+ property var sections
62+ // FIXME: should instead use future toolkit API:
63+ // style: theme.createStyleComponent("PageHeadStyle.qml", header)
64+ style: Component { PageHeadStyle {theme: root.theme} }
49− text: root.name
68+ id: overlaidImage
50− anchors.horizontalCenter: parent.horizontalCenter
69+ anchors.centerIn: parent
51− anchors.top: iconShape.bottom
70+ anchors.verticalCenterOffset: root.showHeader ? header.height / 2 : 0
52− anchors.topMargin: units.gu(2)
71+ sourceSize {
53− fontSize: "large"
72+ width: root.width
56− WaitingDots {
80+ ActivityIndicator {
57− visible: parent.visible
81+ anchors.centerIn: parent
58− anchors.horizontalCenter: parent.horizontalCenter
82+ anchors.verticalCenterOffset: root.showHeader ? header.height / 2 : 0
59− anchors.bottom: parent.bottom
83+ running: overlaidImage.status == Image.Error || overlaidImage.status == Image.Null
60− anchors.bottomMargin: units.gu(12)
63 MouseArea {
86 MouseArea {