2 * Copyright (C) 2014 Canonical, Ltd.
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.
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.
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/>.
17#include "MockPayments.h"
22MockPayments::MockPayments(QObject *parent)
27QString MockPayments::currency() const
32double MockPayments::price() const
37QString MockPayments::storeItemId() const
39 return m_store_item_id;
42QString MockPayments::formattedPrice() const
45 return locale.toCurrencyString(m_price, m_currency);
48void MockPayments::setCurrency(const QString ¤cy)
50 if(m_currency != currency) {
51 m_currency = currency;
52 Q_EMIT currencyChanged(currency);
53 Q_EMIT formattedPriceChanged(formattedPrice());
57void MockPayments::setPrice(const double price)
59 if(m_price != price) {
61 Q_EMIT priceChanged(price);
62 Q_EMIT formattedPriceChanged(formattedPrice());
66void MockPayments::setStoreItemId(const QString &store_item_id)
68 if (m_store_item_id != store_item_id) {
69 m_store_item_id = store_item_id;
70 Q_EMIT storeItemIdChanged(m_store_item_id);
73 if (m_store_item_id.isEmpty()) {
78void MockPayments::start()
80 if (m_store_item_id.isEmpty()) {
81 Q_EMIT purchaseError("No item ID supplied.");
85void MockPayments::process()
87 if (m_store_item_id == "com.example.cancel") {
88 Q_EMIT purchaseCancelled();
89 } else if (m_store_item_id == "com.example.invalid") {
90 Q_EMIT purchaseError("Purchase failed.");
92 Q_EMIT purchaseCompleted();
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list