on xenial help sign in
Adding processing signal
commit8a798c08ed830dc4ba0471c10834ed1431afd60e authorDiego Sarmentero <diego.sarmentero@gmail.com> dateThu 7 Aug 2014, 14:13 (12 years ago) parent558d014
4 files changed+27−4
qml/Dash/Previews/Preview.qml+4 qml/Dash/Previews/PreviewPayments.qml+18−4 qml/Dash/Previews/PreviewWidget.qml+2 qml/Dash/Previews/PreviewWidgetFactory.qml+3
qml/Dash/Previews/Preview.qml+4
@@ -92,6 +92,10 @@ Item {
9292 previewModel.triggered(widgetId, actionId, data);
9393 }
9494
95+ onProcessing: {
96+ previewModel.processingAction = active;
97+ }
98+
9599 onFocusChanged: if (focus) column.positionViewAtIndex(index, ListView.Contain)
96100
97101 onHeightChanged: if (focus) column.positionViewAtIndex(index, ListView.Contain)
qml/Dash/Previews/PreviewPayments.qml+18−4
@@ -31,13 +31,19 @@ PreviewWidget {
3131 implicitHeight: paymentButton.implicitHeight
3232 implicitWidth: paymentButton.implicitWidth
3333
34+ property bool active: false
35+
3436 Button {
3537 id: paymentButton
3638 objectName: "paymentButton"
3739
3840 color: Theme.palette.selected.foreground
39− text: paymentClient.formattedPrice
40− onClicked: paymentClient.start()
41+ text: root.active ? i18n.tr("Purchasing…") : paymentClient.formattedPrice
42+ onClicked: {
43+ root.active = true;
44+ root.processing(root.active);
45+ paymentClient.start();
46+ }
4147 anchors.right: parent.right
4248 width: (root.width - units.gu(1)) / 2
4349
@@ -49,8 +55,16 @@ PreviewWidget {
4955 price: source["price"]
5056 currency: source["currency"]
5157 storeItemId: source["store_item_id"]
52− onPurchaseCompleted: root.triggered(widgetId, "purchaseCompleted", source)
53− onPurchaseError: root.triggered(widgetId, "purchaseError", source)
58+ onPurchaseCompleted: {
59+ root.active = false;
60+ root.processing(root.active);
61+ root.triggered(widgetId, "purchaseCompleted", source);
62+ }
63+ onPurchaseError: {
64+ root.active = false;
65+ root.processing(root.active);
66+ root.triggered(widgetId, "purchaseError", source);
67+ }
5468 }
5569 }
5670}
qml/Dash/Previews/PreviewWidget.qml+2
@@ -38,5 +38,7 @@ Item {
3838 */
3939 signal triggered(string widgetId, string actionId, var data)
4040
41+ signal processing(bool active)
42+
4143 objectName: widgetId
4244}
qml/Dash/Previews/PreviewWidgetFactory.qml+3
@@ -40,6 +40,8 @@ Loader {
4040 //! Triggered signal forwarded from the widgets.
4141 signal triggered(string widgetId, string actionId, var data)
4242
43+ signal processing(bool active)
44+
4345 source: widgetSource
4446
4547 //! \cond private
@@ -71,5 +73,6 @@ Loader {
7173 Connections {
7274 target: root.item
7375 onTriggered: root.triggered(widgetId, actionId, data)
76+ onProcessing: root.processing(active)
7477 }
7578}