Merge lp:~diegosarmentero/unity-scope-click/fix-progress into lp:unity-scope-click

Proposed by Diego Sarmentero
Status: Merged
Approved by: Alejandro J. Cura
Approved revision: 161
Merged at revision: 161
Proposed branch: lp:~diegosarmentero/unity-scope-click/fix-progress
Merge into: lp:unity-scope-click
Diff against target: 64 lines (+14/-8)
2 files modified
scope/click/preview.cpp (+6/-7)
scope/click/scope.cpp (+8/-1)
To merge this branch: bzr merge lp:~diegosarmentero/unity-scope-click/fix-progress
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
Review via email: mp+207242@code.launchpad.net

Commit message

- Fix to send to unity the real Dbus Name to show progress in the preview.

To post a comment you must log in.
Revision history for this message
Alejandro J. Cura (alecu) wrote :

Code looks good, and it works as expected.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scope/click/preview.cpp'
2--- scope/click/preview.cpp 2014-02-18 23:28:12 +0000
3+++ scope/click/preview.cpp 2014-02-19 18:11:52 +0000
4@@ -227,7 +227,7 @@
5 {
6 scopes::PreviewWidget progress("download", "progress");
7 scopes::VariantMap tuple;
8- tuple["dbus-name"] = "com.canonical.DownloadManager";
9+ tuple["dbus-name"] = "com.canonical.applications.Downloader";
10 tuple["dbus-object"] = object_path;
11 progress.add_attribute("source", scopes::Variant(tuple));
12 widgets.push_back(progress);
13@@ -265,6 +265,11 @@
14 type(Type::UNINSTALLED)
15 {
16 qDebug() << "Preview::Preview()";
17+ if (result["installed"].get_bool()) {
18+ setPreview(Type::INSTALLED);
19+ } else {
20+ setPreview(Type::UNINSTALLED);
21+ }
22 }
23
24 Preview::~Preview()
25@@ -279,12 +284,6 @@
26 {
27 qDebug() << "Preview::run()";
28
29- if (result["installed"].get_bool()) {
30- setPreview(Type::INSTALLED);
31- } else {
32- setPreview(Type::UNINSTALLED);
33- }
34-
35 if (result["name"].get_string().empty()) {
36 click::PackageDetails details;
37 details.title = result.title();
38
39=== modified file 'scope/click/scope.cpp'
40--- scope/click/scope.cpp 2014-02-18 12:44:49 +0000
41+++ scope/click/scope.cpp 2014-02-19 18:11:52 +0000
42@@ -101,7 +101,11 @@
43
44 if (metadata.scope_data().which() != scopes::Variant::Type::Null) {
45 auto metadict = metadata.scope_data().get_dict();
46- if (metadict.count("action_id") != 0 &&
47+ if (metadict.count("download_completed") != 0) {
48+ Preview* prev = new Preview(result.uri(), index, result);
49+ prev->setPreview(click::Preview::Type::INSTALLED);
50+ return scopes::QueryBase::UPtr{prev};
51+ } else if (metadict.count("action_id") != 0 &&
52 metadict.count("download_url") != 0) {
53 action_id = metadict["action_id"].get_string();
54 download_url = metadict["download_url"].get_string();
55@@ -128,6 +132,9 @@
56 activation->setHint("action_id", unity::scopes::Variant(action_id));
57 qDebug() << "returning ShowPreview";
58 activation->setStatus(unity::scopes::ActivationResponse::Status::ShowPreview);
59+ } else if (action_id == click::Preview::Actions::DOWNLOAD_COMPLETED) {
60+ activation->setHint("download_completed", unity::scopes::Variant(true));
61+ activation->setStatus(unity::scopes::ActivationResponse::Status::ShowPreview);
62 }
63 return scopes::ActivationBase::UPtr(activation);
64 }

Subscribers

People subscribed via source and target branches