Merge lp:~mardy/ubuntu-system-settings-online-accounts/scope-desktop-1541717 into lp:ubuntu-system-settings-online-accounts

Proposed by Alberto Mardegan
Status: Merged
Approved by: Alberto Mardegan
Approved revision: 367
Merged at revision: 377
Proposed branch: lp:~mardy/ubuntu-system-settings-online-accounts/scope-desktop-1541717
Merge into: lp:ubuntu-system-settings-online-accounts
Diff against target: 83 lines (+40/-1)
2 files modified
click-hooks/accounts.cpp (+4/-1)
tests/click-hooks/tst_online_accounts_hooks2.cpp (+36/-0)
To merge this branch: bzr merge lp:~mardy/ubuntu-system-settings-online-accounts/scope-desktop-1541717
Reviewer Review Type Date Requested Status
Alberto Mardegan (community) Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+297885@code.launchpad.net

Commit message

Fix desktop file name for scopes: they use their short app ID

Description of the change

Scopes use their short app ID as desktop file name

Click for testing: mardy.it/archivos/com.canonical.scopes.weibo_0.9.5_armhf.click

To post a comment you must log in.
367. By Alberto Mardegan

update from trunk

Read time from symlink file, not target (LP: #1596478)

Revision history for this message
Alberto Mardegan (mardy) :
review: Approve
Revision history for this message
Alberto Mardegan (mardy) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'click-hooks/accounts.cpp'
2--- click-hooks/accounts.cpp 2016-06-28 09:04:28 +0000
3+++ click-hooks/accounts.cpp 2016-06-29 09:04:39 +0000
4@@ -125,6 +125,7 @@
5 QString m_appId;
6 QString m_shortAppId;
7 QString m_trDomain;
8+ bool m_isScope;
9 bool m_isValid;
10 };
11
12@@ -134,6 +135,7 @@
13 m_hookFileInfo(hookFileInfo),
14 m_appId(appId),
15 m_shortAppId(shortAppId),
16+ m_isScope(false),
17 m_isValid(false)
18 {
19 QFile file(hookFileInfo.filePath());
20@@ -145,6 +147,7 @@
21 m_services = mainObject.value("services").toArray();
22 m_trDomain = mainObject.value("translations").toString();
23 m_plugin = mainObject.value("plugin").toObject();
24+ m_isScope = mainObject.value("scope").toBool();
25 m_isValid = !m_services.isEmpty() || !m_plugin.isEmpty();
26
27 m_packageDir = findPackageDir(appId);
28@@ -467,7 +470,7 @@
29 {
30 QDomElement root = doc.documentElement();
31 QDomElement elem = doc.createElement(QStringLiteral("desktop-entry"));
32- elem.appendChild(doc.createTextNode(m_appId));
33+ elem.appendChild(doc.createTextNode(m_isScope ? m_shortAppId : m_appId));
34 root.appendChild(elem);
35 }
36
37
38=== modified file 'tests/click-hooks/tst_online_accounts_hooks2.cpp'
39--- tests/click-hooks/tst_online_accounts_hooks2.cpp 2015-11-30 09:54:01 +0000
40+++ tests/click-hooks/tst_online_accounts_hooks2.cpp 2016-06-29 09:04:39 +0000
41@@ -581,6 +581,42 @@
42 "}" <<
43 package <<
44 files;
45+
46+ files.clear();
47+ files["applications/com.ubuntu.test_MyScope.application"] =
48+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
49+ "<!--this file is auto-generated by online-accounts-hooks2; do not modify-->\n"
50+ "<application id=\"com.ubuntu.test_MyScope\">\n"
51+ " <profile>com.ubuntu.test_MyScope_0.3</profile>\n"
52+ " <package-dir>/tmp/hooks-test2/package</package-dir>\n"
53+ " <desktop-entry>com.ubuntu.test_MyScope</desktop-entry>\n"
54+ " <services>\n"
55+ " <service id=\"com.ubuntu.test_MyScope_google\">\n"
56+ " <description>.</description>\n"
57+ " </service>\n"
58+ " </services>\n"
59+ "</application>\n";
60+ files["services/com.ubuntu.test_MyScope_google.service"] =
61+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
62+ "<!--this file is auto-generated by online-accounts-hooks2; do not modify-->\n"
63+ "<service id=\"com.ubuntu.test_MyScope_google\">\n"
64+ " <type>com.ubuntu.test_MyScope</type>\n"
65+ " <provider>google</provider>\n"
66+ " <name>.</name>\n"
67+ " <profile>com.ubuntu.test_MyScope_0.3</profile>\n"
68+ "</service>\n";
69+ QTest::newRow("minimal") <<
70+ "com.ubuntu.test_MyScope_0.3.accounts" <<
71+ "{"
72+ " \"scope\": true,"
73+ " \"services\": ["
74+ " {"
75+ " \"provider\": \"google\""
76+ " }"
77+ " ]"
78+ "}" <<
79+ package <<
80+ files;
81 }
82
83 void OnlineAccountsHooksTest::testValidHooks()

Subscribers

People subscribed via source and target branches