@@ -25,6 +25,7 @@ import "../"
2525 * The mascot fall back image comes in widgetData["fallback"]
2626 * The subtitle comes in widgetData["subtitle"]
2727 * The attributes comes in widgetData["attributes"]
28+ * The emblem comes in widgetData["emblem"]
2829 */
2930
3031PreviewWidget {
@@ -40,6 +41,7 @@ PreviewWidget {
4041 readonly property string title: root.widgetData["title"] || ""
4142 readonly property string subtitle: root.widgetData["subtitle"] || ""
4243 readonly property var attributes: root.widgetData["attributes"] || null
44+ readonly property url emblem: root.widgetData["emblem"] || ""
4345 readonly property color fontColor: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText
4446
4547 // Rewire the source since we may have unwired it on onStatusChanged
@@ -98,16 +100,42 @@ PreviewWidget {
98100 spacing: units.dp(2)
99101 anchors.verticalCenter: parent.verticalCenter
100102
101− Label {
102− id: titleLabel
103− objectName: "titleLabel"
103+ Item {
104104 anchors { left: parent.left; right: parent.right }
105− elide: Text.ElideRight
106− font.weight: Font.Normal
107− fontSize: "large"
108− wrapMode: Text.Wrap
109− color: headerRoot.fontColor
110− text: headerRoot.title
105+ height: titleLabel.height
106+
107+ Label {
108+ id: titleLabel
109+ objectName: "titleLabel"
110+ anchors {
111+ left: parent.left;
112+ right: iconLoader.right
113+ rightMargin: iconLoader.width > 0 ? units.gu(0.5) : 0
114+ }
115+ elide: Text.ElideRight
116+ font.weight: Font.Normal
117+ fontSize: "large"
118+ wrapMode: Text.Wrap
119+ color: headerRoot.fontColor
120+ text: headerRoot.title
121+ }
122+
123+ Loader {
124+ id: iconLoader
125+ active: headerRoot.emblem != ""
126+ anchors {
127+ bottom: titleLabel.baseline
128+ right: parent.right
129+ }
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
137+ }
138+ }
111139 }
112140
113141 Loader {