Merge lp:~unity-api-team/kubuntu-packaging/qt-purchasing-packaging into lp:~kubuntu-packagers/kubuntu-packaging/qtpurchasing-opensource-src

Proposed by Antti Kaijanmäki on 2015-10-08
Status: Merged
Merged at revision: 9
Proposed branch: lp:~unity-api-team/kubuntu-packaging/qt-purchasing-packaging
Merge into: lp:~kubuntu-packagers/kubuntu-packaging/qtpurchasing-opensource-src
Diff against target: 65 lines (+12/-11)
1 file modified
debian/patches/ubuntu_libpay_backend.diff (+12/-11)
To merge this branch: bzr merge lp:~unity-api-team/kubuntu-packaging/qt-purchasing-packaging
Reviewer Review Type Date Requested Status
Kubuntu Packagers 2015-10-08 Pending
Review via email: mp+273815@code.launchpad.net

Commit message

Update backend.

Description of the change

.

To post a comment you must log in.
9. By Timo Jyrinki on 2015-10-08

Update the Ubuntu backend patch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/patches/ubuntu_libpay_backend.diff'
2--- debian/patches/ubuntu_libpay_backend.diff 2015-10-02 12:57:35 +0000
3+++ debian/patches/ubuntu_libpay_backend.diff 2015-10-08 10:55:33 +0000
4@@ -194,10 +194,10 @@
5 +#endif // QUBUNTUINAPPPRODUCT_P_H
6 diff --git a/src/purchasing/inapppurchase/ubuntu/qubuntuinapppurchasebackend.cpp b/src/purchasing/inapppurchase/ubuntu/qubuntuinapppurchasebackend.cpp
7 new file mode 100644
8-index 0000000..6499124
9+index 0000000..89b75b2
10 --- /dev/null
11 +++ b/src/purchasing/inapppurchase/ubuntu/qubuntuinapppurchasebackend.cpp
12-@@ -0,0 +1,261 @@
13+@@ -0,0 +1,262 @@
14 +/****************************************************************************
15 +**
16 +** Copyright (C) 2015 The Qt Company Ltd.
17@@ -251,24 +251,25 @@
18 +
19 +namespace {
20 +
21-+QString get_appname()
22++QString getPackageName()
23 +{
24-+ QString appname;
25++ QString pkgname;
26 +
27 + const auto appid = QString::fromUtf8(qgetenv("APP_ID"));
28 + if (appid.isEmpty()) {
29 + qWarning("$APP_ID environment variable not set.");
30-+ return appname;
31++ return pkgname;
32 + }
33 +
34++ // $APP_ID has the form of <package name>_<application name>_<package version>
35 + const auto tokens = appid.split(QStringLiteral("_"));
36 + if (tokens.size() != 3) {
37 + qWarning() << QString(QStringLiteral("Invalid $APP_ID (%1).")).arg(appid);
38-+ return appname;
39++ return pkgname;
40 + }
41 +
42-+ appname = tokens.at(1);
43-+ return appname;
44++ pkgname = tokens.at(0);
45++ return pkgname;
46 +}
47 +
48 +bool types_equal(QInAppProduct::ProductType qtype, PayItemType utype)
49@@ -307,13 +308,13 @@
50 +
51 +void QUbuntuInAppPurchaseBackend::initialize()
52 +{
53-+ const auto appname = get_appname();
54-+ if (appname.isEmpty()) {
55++ const auto pkgname = getPackageName();
56++ if (pkgname.isEmpty()) {
57 + qWarning("Unable to initialize QUbuntuInAppPurchaseBackend -- appname cannot be found");
58 + return;
59 + }
60 +
61-+ auto package = pay_package_new(appname.toLocal8Bit().constData());
62++ auto package = pay_package_new(qUtf8Printable(pkgname));
63 + pay_package_item_observer_install(package, itemObserverStatic, this);
64 +
65 + auto package_deleter = [this](PayPackage *p) {

Subscribers

People subscribed via source and target branches