@@ -17,6 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19import Ubuntu.Components.ListItems 0.1 as ListItems
19import Ubuntu.Components.ListItems 0.1 as ListItems
20+import Ubuntu.DownloadDaemonListener 0.1
20import "../../Components"
21import "../../Components"
21import ".."
22import ".."
22import "../Previews"
23import "../Previews"
@@ -27,7 +28,7 @@ DashPreview {
28 previewImages: previewImagesComponent
29 previewImages: previewImagesComponent
29 header: headerComponent
30 header: headerComponent
30− actions: actionsComponent
31+ actions: root.previewData.infoMap["show_progressbar"] ? progressComponent : actionsComponent
31 description: descriptionComponent
32 description: descriptionComponent
33 Component {
34 Component {
@@ -61,34 +62,57 @@ DashPreview {
62 Component {
63 Component {
63 id: actionsComponent
64 id: actionsComponent
65− id: buttons
66+ Column {
66− model: genericPreview.previewData.actions
67+ id: buttonList
67−
68+ objectName: "buttonList"
68− property int buttonMaxWidth: units.gu(34)
69− property int numOfColumns: Math.ceil((width + spacing) / (buttonMaxWidth + spacing))
70− property int numOfRows: Math.ceil(count / numOfColumns)
71− property int spacing: units.gu(1)
69+ spacing: units.gu(1)
72− height: Math.max(units.gu(4), units.gu(4)*numOfRows + spacing*(numOfRows - 1))
70+ Repeater {
73−
71+ model: root.previewData.actions
74− cellWidth: width / numOfColumns
72+
75− cellHeight: buttonHeight + spacing
76− property int buttonWidth: cellWidth - spacing / 2
77− property int buttonHeight: units.gu(4)
79− delegate: Button {
73+ delegate: Button {
80− width: Math.max(units.gu(4), buttons.buttonWidth)
74+ width: parent.width
81− height: buttons.buttonHeight
75+ height: buttonList.buttonHeight
82− color: "#dd4814"
76+ color: Theme.palette.selected.foreground
83− text: modelData.displayName
77+ text: modelData.displayName
84− iconSource: modelData.iconHint
78+ iconSource: modelData.iconHint
85− iconPosition: "right"
79+ iconPosition: "right"
86− visible: true
80+ onClicked: root.previewData.execute(modelData.id, { })
87+ id: progressComponent
91+ objectName: "progressBar"
96+ property var model: root.previewData.actions
99+ service: "com.canonical.applications.Downloader"
100+ dbusPath: root.previewData.infoMap["progressbar_source"] ? root.previewData.infoMap["progressbar_source"].value : ""
103+ var percentage = parseInt(received * 100 / total);
104+ progressBar.value = percentage;
108+ root.previewData.execute(progressBar.model[0].id, { })
88− genericPreview.previewData.execute(modelData.id, { })
112+ root.previewData.execute(progressBar.model[1].id, { "error": error });