Merge lp:~dobey/unity-scope-click/search-show-price into lp:unity-scope-click/devel

Proposed by dobey
Status: Merged
Approved by: Paweł Stołowski
Approved revision: 334
Merged at revision: 346
Proposed branch: lp:~dobey/unity-scope-click/search-show-price
Merge into: lp:unity-scope-click/devel
Prerequisite: lp:~dobey/unity-scope-click/check-purchased
Diff against target: 25 lines (+8/-1)
1 file modified
scope/clickstore/store-query.cpp (+8/-1)
To merge this branch: bzr merge lp:~dobey/unity-scope-click/search-show-price
Reviewer Review Type Date Requested Status
Paweł Stołowski (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+227261@code.launchpad.net

Commit message

Show the price in search results for apps that have prices.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Paweł Stołowski (stolowski) wrote :

This assumes the currency is always USD $? Is this the right assumption?

review: Needs Information
Revision history for this message
dobey (dobey) wrote :

On Fri, 2014-07-18 at 14:35 +0000, Pawel Stolowski wrote:
> Review: Needs Information
>
> This assumes the currency is always USD $? Is this the right assumption?

It is currently correct, and we are always sending the "$" in the
preview for the payment button as well.

This is because the QtLocale.toCurrencyString is actually quite dumb,
and doesn't know how to convert "USD" to "$" for example, or when not to
(when showing USD to users in .ar for example). I think we'll have to
write some code to do all that work in the future, so we can show the
correct symbol or currency acronym depending on the user's location,
language, and related settings.

Revision history for this message
Paweł Stołowski (stolowski) wrote :

Ok then. +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scope/clickstore/store-query.cpp'
2--- scope/clickstore/store-query.cpp 2014-07-17 21:42:24 +0000
3+++ scope/clickstore/store-query.cpp 2014-07-17 21:42:24 +0000
4@@ -49,6 +49,8 @@
5 #include<sstream>
6 #include <cassert>
7
8+#include <QLocale>
9+
10 #include <click/click-i18n.h>
11
12 using namespace click;
13@@ -289,7 +291,12 @@
14 } else {
15 res[click::Query::ResultKeys::INSTALLED] = false;
16 res[click::Query::ResultKeys::PURCHASED] = false;
17- res["subtitle"] = _("FREE");
18+ if (pkg.price > 0.00f) {
19+ QLocale locale;
20+ res["subtitle"] = locale.toCurrencyString(pkg.price, "$").toUtf8().data();
21+ } else {
22+ res["subtitle"] = _("FREE");
23+ }
24 // TODO: get the real price from the webservice (upcoming branch)
25 }
26

Subscribers

People subscribed via source and target branches

to all changes: