on xenial help sign in
Adding processing signal
8a798c0Diego Sarmentero
qml/Dash/Previews/Preview.qml+4
@@ -92,6 +92,10 @@ Item {
92 previewModel.triggered(widgetId, actionId, data);
92 previewModel.triggered(widgetId, actionId, data);
93 }
93 }
94
94
95+ onProcessing: {
96+ previewModel.processingAction = active;
97+ }
98+
95 onFocusChanged: if (focus) column.positionViewAtIndex(index, ListView.Contain)
99 onFocusChanged: if (focus) column.positionViewAtIndex(index, ListView.Contain)
96
100
97 onHeightChanged: if (focus) column.positionViewAtIndex(index, ListView.Contain)
101 onHeightChanged: if (focus) column.positionViewAtIndex(index, ListView.Contain)
qml/Dash/Previews/PreviewPayments.qml+18−4
@@ -31,13 +31,19 @@ PreviewWidget {
31 implicitHeight: paymentButton.implicitHeight
31 implicitHeight: paymentButton.implicitHeight
32 implicitWidth: paymentButton.implicitWidth
32 implicitWidth: paymentButton.implicitWidth
33
33
34+ property bool active: false
35+
34 Button {
36 Button {
35 id: paymentButton
37 id: paymentButton
36 objectName: "paymentButton"
38 objectName: "paymentButton"
37
39
38 color: Theme.palette.selected.foreground
40 color: Theme.palette.selected.foreground
39− text: paymentClient.formattedPrice
41+ text: root.active ? i18n.tr("Purchasing…") : paymentClient.formattedPrice
42+ onClicked: {
43+ root.active = true;
44+ root.processing(root.active);
40− onClicked: paymentClient.start()
45+ paymentClient.start();
46+ }
41 anchors.right: parent.right
47 anchors.right: parent.right
42 width: (root.width - units.gu(1)) / 2
48 width: (root.width - units.gu(1)) / 2
43
49
@@ -49,8 +55,16 @@ PreviewWidget {
49 price: source["price"]
55 price: source["price"]
50 currency: source["currency"]
56 currency: source["currency"]
51 storeItemId: source["store_item_id"]
57 storeItemId: source["store_item_id"]
58+ onPurchaseCompleted: {
59+ root.active = false;
60+ root.processing(root.active);
52− onPurchaseCompleted: root.triggered(widgetId, "purchaseCompleted", source)
61+ root.triggered(widgetId, "purchaseCompleted", source);
62+ }
63+ onPurchaseError: {
64+ root.active = false;
65+ root.processing(root.active);
53− onPurchaseError: root.triggered(widgetId, "purchaseError", source)
66+ root.triggered(widgetId, "purchaseError", source);
67+ }
54 }
68 }
55 }
69 }
56}
70}
qml/Dash/Previews/PreviewWidget.qml+2
@@ -38,5 +38,7 @@ Item {
38 */
38 */
39 signal triggered(string widgetId, string actionId, var data)
39 signal triggered(string widgetId, string actionId, var data)
40
40
41+ signal processing(bool active)
42+
41 objectName: widgetId
43 objectName: widgetId
42}
44}
qml/Dash/Previews/PreviewWidgetFactory.qml+3
@@ -40,6 +40,8 @@ Loader {
40 //! Triggered signal forwarded from the widgets.
40 //! Triggered signal forwarded from the widgets.
41 signal triggered(string widgetId, string actionId, var data)
41 signal triggered(string widgetId, string actionId, var data)
42
42
43+ signal processing(bool active)
44+
43 source: widgetSource
45 source: widgetSource
44
46
45 //! \cond private
47 //! \cond private
@@ -71,5 +73,6 @@ Loader {
71 Connections {
73 Connections {
72 target: root.item
74 target: root.item
73 onTriggered: root.triggered(widgetId, actionId, data)
75 onTriggered: root.triggered(widgetId, actionId, data)
76+ onProcessing: root.processing(active)
74 }
77 }
75}
78}