@@ -0,0 +1,186 @@
2+ * Copyright (C) 2013 Canonical, Ltd.
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18+import Ubuntu.Components 0.1
22+ property string title: ""
24+ property real previewWidthRatio: 0.5
26+ property Component header
27+ property Component buttons
28+ property Component body
30+ readonly property bool narrowMode: width <= height
31+ readonly property int contentSpacing: units.gu(3)
34+ signal previewImageClicked()
36+ color: Qt.rgba(0, 0, 0, .3)
40+ target: shell.applicationManager
41+ onMainStageFocusedApplicationChanged: {
44+ onSideStageFocusedApplicationChanged: {
60+ margins: root.contentSpacing
66+ leftMargin: -root.contentSpacing
67+ rightMargin: -root.contentSpacing
68+ topMargin: -root.contentSpacing
71+ onClicked: root.close();
78+ rightMargin: closePreviewImage.width + spacing
81+ property int spacing: units.gu(2)
85+ objectName: "titleLabel"
91+ elide: Text.ElideRight
93+ font.weight: Font.Light
101+ id: closePreviewImage
102+ source: "graphics/tablet/icon_close_preview.png"
104+ height: units.gu(1.5)
106+ bottom: title.bottom
107+ bottomMargin: units.dp(7)
109+ leftMargin: title.paintedWidth + labelItem.spacing
120+ top: headerRow.bottom
121+ bottom: parent.bottom
122+ margins: root.contentSpacing
125+ spacing: units.gu(2)
129+ anchors.top: parent.top
130+ anchors.bottom: parent.bottom
131+ width: root.narrowMode ? contentRow.width : contentRow.width * root.previewWidthRatio
132+ contentHeight: leftColumn.height
137+ objectName: "leftColumn"
142+ height: childrenRect.height
143+ spacing: units.gu(1)
147+ anchors.left: parent.left
148+ anchors.right: parent.right
149+ sourceComponent: root.header
153+ anchors.left: parent.left
154+ anchors.right: parent.right
155+ sourceComponent: root.buttons
162+ anchors.top: parent.top
163+ anchors.bottom: parent.bottom
164+ width: narrowMode ? 0 : (contentRow.width - leftColumn.width - contentRow.spacing)
165+ contentHeight: rightColumn.height
170+ objectName: "rightColumn"
171+ height: childrenRect.height
181+ parent: root.narrowMode ? leftColumn : rightColumn
182+ anchors.left: parent.left
183+ anchors.right: parent.right
184+ sourceComponent: root.body