Merge lp:~ken-vandine/content-hub/fallback_to_legacy_apps into lp:content-hub

Proposed by Ken VanDine
Status: Merged
Approved by: Ken VanDine
Approved revision: 147
Merged at revision: 79
Proposed branch: lp:~ken-vandine/content-hub/fallback_to_legacy_apps
Merge into: lp:content-hub
Prerequisite: lp:~ken-vandine/content-hub/quiet_logging
Diff against target: 181 lines (+56/-27)
4 files modified
src/com/ubuntu/content/detail/service.cpp (+19/-11)
src/com/ubuntu/content/service/com.ubuntu.content.hub.gschema.xml (+1/-1)
src/com/ubuntu/content/service/registry.cpp (+12/-2)
src/com/ubuntu/content/utils.cpp (+24/-13)
To merge this branch: bzr merge lp:~ken-vandine/content-hub/fallback_to_legacy_apps
Reviewer Review Type Date Requested Status
Michael Sheldon (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+211558@code.launchpad.net

Commit message

If the default source is set to anything other than a click appId triplet,
fallback to the legacy APP_ID.

Changed default source for contacts to the legacy APP_ID for address-book-app

Description of the change

If the default source is set to anything other than a click appId triplet,
fallback to the legacy APP_ID.

Changed default source for contacts to the legacy APP_ID for address-book-app

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
Ken VanDine (ken-vandine) wrote :

Are there any related MPs required for this MP to build/function as expected?
 * No (besides the prerequisite branch included)
Is your branch in sync with latest trunk
 * Yes
Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
 * Yes
Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/content-hub) on device or emulator?
 * Yes
If you changed the UI, was the change specified/approved by design?
 * No UI changes
If you changed the packaging (debian), did you subscribe a core-dev to this MP?
 * No packaging changes

146. By Ken VanDine

merged fix_pending_check branch

147. By Ken VanDine

merged trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?

 * Yes, based on https://wiki.ubuntu.com/Process/Merges/TestPlan/content-hub (with updated gallery-app, address-book-app and ubuntu-system-settings branches for new API compatibility, with address-book-app installed as a debian package)

Did CI run pass? If not, please explain why.

 * Yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?

 * Yes

review: Approve
148. By Ken VanDine

merged

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/com/ubuntu/content/detail/service.cpp'
2--- src/com/ubuntu/content/detail/service.cpp 2014-03-20 23:45:32 +0000
3+++ src/com/ubuntu/content/detail/service.cpp 2014-03-20 23:45:33 +0000
4@@ -304,19 +304,23 @@
5 {
6 if (t->Id() != transfer->Id())
7 {
8- if ((t->source() == transfer->source()) || (t->destination() == transfer->destination()))
9+ if ((t->source() == transfer->source()) && (t->State() == cuc::Transfer::in_progress))
10 {
11- TRACE() << Q_FUNC_INFO << "Peer has pending transfers:" << t->Id();
12+ TRACE() << Q_FUNC_INFO << "Source has pending transfers:" << t->Id();
13 shouldStop = false;
14 }
15+ if (t->destination() == transfer->destination())
16+ {
17+ qDebug() << Q_FUNC_INFO << "Destination has pending transfers:" << t->Id();
18+ if (should_cancel(t->State()))
19+ shouldStop = false;
20+ }
21 }
22 }
23 if (shouldStop)
24- {
25- d->app_manager->stop_application(transfer->source().toStdString());
26- d->app_manager->invoke_application(transfer->destination().toStdString());
27- }
28+ d->app_manager->stop_application(transfer->source().toStdString());
29 }
30+ d->app_manager->invoke_application(transfer->destination().toStdString());
31 }
32 }
33
34@@ -377,19 +381,23 @@
35 {
36 if (t->Id() != transfer->Id())
37 {
38- if ((t->source() == transfer->source()) || (t->destination() == transfer->destination()))
39+ if ((t->source() == transfer->source()) && (t->State() == cuc::Transfer::in_progress))
40 {
41- TRACE() << Q_FUNC_INFO << "Peer has pending transfers:" << t->Id();
42+ TRACE() << Q_FUNC_INFO << "Source has pending transfers:" << t->Id();
43 shouldStop = false;
44 }
45+ if (t->destination() == transfer->destination())
46+ {
47+ qDebug() << Q_FUNC_INFO << "Destination has pending transfers:" << t->Id();
48+ if (should_cancel(t->State()))
49+ shouldStop = false;
50+ }
51 }
52 }
53 if (shouldStop)
54- {
55 d->app_manager->stop_application(transfer->destination().toStdString());
56- d->app_manager->invoke_application(transfer->source().toStdString());
57- }
58 }
59+ d->app_manager->invoke_application(transfer->source().toStdString());
60 }
61 }
62
63
64=== modified file 'src/com/ubuntu/content/service/com.ubuntu.content.hub.gschema.xml'
65--- src/com/ubuntu/content/service/com.ubuntu.content.hub.gschema.xml 2014-03-20 23:45:32 +0000
66+++ src/com/ubuntu/content/service/com.ubuntu.content.hub.gschema.xml 2014-03-20 23:45:33 +0000
67@@ -11,7 +11,7 @@
68 <default>[]</default>
69 </key>
70 <key name="contacts" type="as">
71- <default>["com.ubuntu.address-book", "address-book", "current-user-version"]</default>
72+ <default>["address-book-app", "", ""]</default>
73 </key>
74 </schema>
75 <schema id="com.ubuntu.content.hub.source" path="/com/ubuntu/content/hub/source/">
76
77=== modified file 'src/com/ubuntu/content/service/registry.cpp'
78--- src/com/ubuntu/content/service/registry.cpp 2014-03-20 23:45:32 +0000
79+++ src/com/ubuntu/content/service/registry.cpp 2014-03-20 23:45:33 +0000
80@@ -44,7 +44,11 @@
81 std::string pkg = as[0].toStdString();
82 std::string app = as[1].toStdString();
83 std::string ver = as[2].toStdString();
84- cuc::Peer peer(QString::fromLocal8Bit(upstart_app_launch_triplet_to_app_id(pkg.c_str(), app.c_str(), ver.c_str())));
85+ cuc::Peer peer;
86+ if (app.empty() || ver.empty())
87+ peer = QString::fromStdString(pkg);
88+ else
89+ peer = QString::fromLocal8Bit(upstart_app_launch_triplet_to_app_id(pkg.c_str(), app.c_str(), ver.c_str()));
90 install_source_for_type(type, cuc::Peer{peer.id(), true});
91 }
92 }
93@@ -64,6 +68,9 @@
94 std::string pkg = as[0].toStdString();
95 std::string app = as[1].toStdString();
96 std::string ver = as[2].toStdString();
97+ cuc::Peer peer;
98+ if (app.empty() || ver.empty())
99+ return cuc::Peer(QString::fromStdString(pkg));
100 return cuc::Peer(QString::fromLocal8Bit(upstart_app_launch_triplet_to_app_id(pkg.c_str(), app.c_str(), ver.c_str())), true);
101 }
102 }
103@@ -121,7 +128,10 @@
104 std::string pkg = as[0].toStdString();
105 std::string app = as[1].toStdString();
106 std::string ver = as[2].toStdString();
107- defaultPeer = QString::fromLocal8Bit(upstart_app_launch_triplet_to_app_id(pkg.c_str(), app.c_str(), ver.c_str())) == k;
108+ if (app.empty() || ver.empty())
109+ defaultPeer = QString::fromStdString(pkg) == k;
110+ else
111+ defaultPeer = QString::fromLocal8Bit(upstart_app_launch_triplet_to_app_id(pkg.c_str(), app.c_str(), ver.c_str())) == k;
112 }
113 for_each(cuc::Peer{k, defaultPeer});
114 }
115
116=== modified file 'src/com/ubuntu/content/utils.cpp'
117--- src/com/ubuntu/content/utils.cpp 2014-03-20 23:45:32 +0000
118+++ src/com/ubuntu/content/utils.cpp 2014-03-20 23:45:33 +0000
119@@ -29,6 +29,7 @@
120 #include "common.h"
121 #include "debug.h"
122 #include "com/ubuntu/content/type.h"
123+#include <unistd.h>
124
125 namespace cuc = com::ubuntu::content;
126
127@@ -108,6 +109,15 @@
128 return aaProfile;
129 }
130
131+bool is_persistent(QString store)
132+{
133+ TRACE() << Q_FUNC_INFO << store;
134+ QRegExp rx("*.cache/*/HubIncoming/*");
135+ rx.setPatternSyntax(QRegExp::Wildcard);
136+ rx.setCaseSensitivity(Qt::CaseSensitive);
137+ return not rx.exactMatch(store);
138+}
139+
140 QString copy_to_store(const QString& src, const QString& store)
141 {
142 TRACE() << Q_FUNC_INFO;
143@@ -122,24 +132,25 @@
144 st.mkpath(st.absolutePath());
145 QString destFilePath = store + QDir::separator() + fi.fileName();
146 TRACE() << Q_FUNC_INFO << destFilePath;
147- bool result = QFile::copy(fi.filePath(), destFilePath);
148- if (not result)
149- {
150- qWarning() << "Failed to copy to Store:" << store;
151+ bool copy_failed = true;
152+ if (not is_persistent(store))
153+ {
154+ if (link( fi.absoluteFilePath().toStdString().c_str(),
155+ destFilePath.toStdString().c_str() ) < 0)
156+ {
157+ qWarning() << "Can't create hard link to Store:" << store;
158+ } else
159+ copy_failed = false;
160+ }
161+ if (copy_failed)
162+ {
163+ if (not QFile::copy(fi.filePath(), destFilePath))
164+ qWarning() << "Failed to copy to Store:" << store;
165 }
166
167 return QUrl::fromLocalFile(destFilePath).toString();
168 }
169
170-bool is_persistent(QString store)
171-{
172- TRACE() << Q_FUNC_INFO << store;
173- QRegExp rx("*.cache/*/HubIncoming/*");
174- rx.setPatternSyntax(QRegExp::Wildcard);
175- rx.setCaseSensitivity(Qt::CaseSensitive);
176- return not rx.exactMatch(store);
177-}
178-
179 bool purge_store_cache(QString store)
180 {
181 TRACE() << Q_FUNC_INFO << "Store:" << store;

Subscribers

People subscribed via source and target branches