Unity 8
 All Classes Functions Properties
PreviewPayments.qml
1 /*
2  * Copyright (C) 2014 Canonical, Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 import QtQuick 2.1
18 import Ubuntu.Components 0.1
19 import Ubuntu.Payments 0.1
20 
28 PreviewWidget {
29  id: root
30 
31  implicitHeight: paymentButton.implicitHeight
32  implicitWidth: paymentButton.implicitWidth
33 
34  Button {
35  id: paymentButton
36  objectName: "paymentButton"
37 
38  color: Theme.palette.selected.foreground
39  text: paymentClient.formattedPrice
40  onClicked: paymentClient.start()
41  anchors.right: parent.right
42  width: (root.width - units.gu(1)) / 2
43 
44  Payments {
45  id: paymentClient
46 
47  property var source: widgetData["source"]
48 
49  price: source["price"]
50  currency: source["currency"]
51  storeItemId: source["store_item_id"]
52  onPurchaseCompleted: root.triggered(widgetId, "purchaseCompleted", source)
53  onPurchaseError: root.triggered(widgetId, "purchaseError", source)
54  }
55  }
56 }