on xenial help sign in
Cleanups from review.
b9dd4e2Rodney Dawes
plugins/Ubuntu/Payments/Payments.cpp+5−9
@@ -16,9 +16,7 @@
16 * License along with this program. If not, see <http://www.gnu.org/licenses/>
16 * License along with this program. If not, see <http://www.gnu.org/licenses/>
17 */
17 */
18
18
19−#include <QDebug>
20#include <QLocale>
19#include <QLocale>
21−#include <QTimer>
22
20
23#include <libpay/pay-package.h>
21#include <libpay/pay-package.h>
24
22
@@ -86,7 +84,7 @@ QString Payments::formattedPrice() const
86
84
87void Payments::setCurrency(const QString &currency)
85void Payments::setCurrency(const QString &currency)
88{
86{
89− if(m_currency != currency){
87+ if(m_currency != currency) {
90 m_currency = currency;
88 m_currency = currency;
91 Q_EMIT currencyChanged(currency);
89 Q_EMIT currencyChanged(currency);
92 Q_EMIT formattedPriceChanged(formattedPrice());
90 Q_EMIT formattedPriceChanged(formattedPrice());
@@ -95,7 +93,7 @@ void Payments::setCurrency(const QString &currency)
95
93
96void Payments::setPrice(const double price)
94void Payments::setPrice(const double price)
97{
95{
98− if(m_price != price){
96+ if(m_price != price) {
99 m_price = price;
97 m_price = price;
100 Q_EMIT priceChanged(price);
98 Q_EMIT priceChanged(price);
101 Q_EMIT formattedPriceChanged(formattedPrice());
99 Q_EMIT formattedPriceChanged(formattedPrice());
@@ -104,7 +102,7 @@ void Payments::setPrice(const double price)
104
102
105void Payments::setStoreItemId(const QString &store_item_id)
103void Payments::setStoreItemId(const QString &store_item_id)
106{
104{
107− if (m_store_item_id != store_item_id){
105+ if (m_store_item_id != store_item_id) {
108 m_store_item_id = store_item_id;
106 m_store_item_id = store_item_id;
109 Q_EMIT storeItemIdChanged(m_store_item_id);
107 Q_EMIT storeItemIdChanged(m_store_item_id);
110 }
108 }
@@ -113,12 +111,10 @@ void Payments::setStoreItemId(const QString &store_item_id)
113 return;
111 return;
114 }
112 }
115
113
116− pay_package_item_start_verification(m_package,
114+ pay_package_item_start_verification(m_package, m_store_item_id.toLocal8Bit().data());
117− m_store_item_id.toLocal8Bit().data());
118}
115}
119
116
120void Payments::start()
117void Payments::start()
121{
118{
122− pay_package_item_start_purchase(m_package,
119+ pay_package_item_start_purchase(m_package, m_store_item_id.toLocal8Bit().data());
123− m_store_item_id.toLocal8Bit().data());
124}
120}
plugins/Ubuntu/Payments/Payments.h−3
@@ -21,7 +21,6 @@
21#define PAYMENTS_H
21#define PAYMENTS_H
22
22
23#include <QObject>
23#include <QObject>
24−#include <QDBusObjectPath>
25
24
26#include <libpay/pay-package.h>
25#include <libpay/pay-package.h>
27
26
@@ -65,8 +64,6 @@ private:
65 QString m_store_item_id;
64 QString m_store_item_id;
66
65
67 PayPackage *m_package;
66 PayPackage *m_package;
68−
69− void startService();
70};
67};
71
68
72#endif // PAYMENTS_H
69#endif // PAYMENTS_H
plugins/Ubuntu/Payments/plugin.cpp+1−8
@@ -16,13 +16,11 @@
16 * License along with this program. If not, see <http://www.gnu.org/licenses/>
16 * License along with this program. If not, see <http://www.gnu.org/licenses/>
17 */
17 */
18
18
19+#include <QtQml>
19
20
20#include "plugin.h"
21#include "plugin.h"
21#include "Payments.h"
22#include "Payments.h"
22
23
23−#include <QtQml/qqml.h>
24−#include <QtQml/QQmlContext>
25−
26
24
27void BackendPlugin::registerTypes(const char *uri)
25void BackendPlugin::registerTypes(const char *uri)
28{
26{
@@ -30,8 +28,3 @@ void BackendPlugin::registerTypes(const char *uri)
30
28
31 qmlRegisterType<Payments>(uri, 0, 1, "Payments");
29 qmlRegisterType<Payments>(uri, 0, 1, "Payments");
32}
30}
33−
34−void BackendPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
35−{
36− QQmlExtensionPlugin::initializeEngine(engine, uri);
37−}
plugins/Ubuntu/Payments/plugin.h+4−6
@@ -16,11 +16,9 @@
16 * License along with this program. If not, see <http://www.gnu.org/licenses/>
16 * License along with this program. If not, see <http://www.gnu.org/licenses/>
17 */
17 */
18
18
19+#ifndef PAYMENTS_PLUGIN_H
20+#define PAYMENTS_PLUGIN_H
19
21
20−#ifndef BACKEND_PLUGIN_H
21−#define BACKEND_PLUGIN_H
22−
23−#include <QQmlEngine>
24#include <QQmlExtensionPlugin>
22#include <QQmlExtensionPlugin>
25
23
26class BackendPlugin : public QQmlExtensionPlugin
24class BackendPlugin : public QQmlExtensionPlugin
@@ -30,6 +28,6 @@ class BackendPlugin : public QQmlExtensionPlugin
30
28
31public:
29public:
32 void registerTypes(const char *uri);
30 void registerTypes(const char *uri);
33− void initializeEngine(QQmlEngine *engine, const char *uri);
34};
31};
35−#endif // BACKEND_PLUGIN_H
32+
33+#endif // PAYMENTS_PLUGIN_H