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)
28QString MockPayments::currency() const
33double MockPayments::price() const
38QString MockPayments::storeItemId() const
40 return m_store_item_id;
43QString MockPayments::formattedPrice() const
46 return locale.toCurrencyString(m_price, m_currency);
49void MockPayments::setCurrency(const QString ¤cy)
51 if(m_currency != currency) {
52 m_currency = currency;
53 Q_EMIT currencyChanged(currency);
54 Q_EMIT formattedPriceChanged(formattedPrice());
58void MockPayments::setPrice(const double price)
60 if(m_price != price) {
62 Q_EMIT priceChanged(price);
63 Q_EMIT formattedPriceChanged(formattedPrice());
67void MockPayments::setStoreItemId(const QString &store_item_id)
69 if (m_store_item_id != store_item_id) {
70 m_store_item_id = store_item_id;
71 Q_EMIT storeItemIdChanged(m_store_item_id);
74 if (m_store_item_id.isEmpty()) {
79void MockPayments::start()
81 if (m_store_item_id.isEmpty()) {
82 Q_EMIT purchaseError("No item ID supplied.");
86void MockPayments::process()
88 if (m_store_item_id == "com.example.cancel") {
89 Q_EMIT purchaseCancelled();
90 } else if (m_store_item_id == "com.example.invalid") {
91 Q_EMIT purchaseError("Purchase failed.");
93 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