@@ -25,6 +25,7 @@ import "../"
25 * The mascot fall back image comes in widgetData["fallback"]
25 * The mascot fall back image comes in widgetData["fallback"]
26 * The subtitle comes in widgetData["subtitle"]
26 * The subtitle comes in widgetData["subtitle"]
27 * The attributes comes in widgetData["attributes"]
27 * The attributes comes in widgetData["attributes"]
28+ * The emblem comes in widgetData["emblem"]
30PreviewWidget {
31PreviewWidget {
@@ -40,6 +41,7 @@ PreviewWidget {
40 readonly property string title: root.widgetData["title"] || ""
41 readonly property string title: root.widgetData["title"] || ""
41 readonly property string subtitle: root.widgetData["subtitle"] || ""
42 readonly property string subtitle: root.widgetData["subtitle"] || ""
42 readonly property var attributes: root.widgetData["attributes"] || null
43 readonly property var attributes: root.widgetData["attributes"] || null
44+ readonly property url emblem: root.widgetData["emblem"] || ""
43 readonly property color fontColor: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText
45 readonly property color fontColor: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText
45 // Rewire the source since we may have unwired it on onStatusChanged
47 // Rewire the source since we may have unwired it on onStatusChanged
@@ -98,16 +100,42 @@ PreviewWidget {
98 spacing: units.dp(2)
100 spacing: units.dp(2)
99 anchors.verticalCenter: parent.verticalCenter
101 anchors.verticalCenter: parent.verticalCenter
103− objectName: "titleLabel"
104 anchors { left: parent.left; right: parent.right }
104 anchors { left: parent.left; right: parent.right }
105+ height: titleLabel.height
109+ objectName: "titleLabel"
112+ right: iconLoader.right
113+ rightMargin: iconLoader.width > 0 ? units.gu(0.5) : 0
105− elide: Text.ElideRight
115+ elide: Text.ElideRight
106− font.weight: Font.Normal
116+ font.weight: Font.Normal
107− fontSize: "large"
117+ fontSize: "large"
108− wrapMode: Text.Wrap
118+ wrapMode: Text.Wrap
109− color: headerRoot.fontColor
119+ color: headerRoot.fontColor
110− text: headerRoot.title
120+ text: headerRoot.title
125+ active: headerRoot.emblem != ""
127+ bottom: titleLabel.baseline
130+ sourceComponent: Icon {
131+ objectName: "emblemIcon"
132+ source: headerRoot.emblem
133+ color: headerRoot.fontColor
134+ height: source != "" ? titleLabel.font.pixelSize : 0
135+ // FIXME Workaround for bug https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1421293
136+ width: implicitWidth > 0 && implicitHeight > 0 ? (implicitWidth / implicitHeight * height) : implicitWidth