Merge lp:~abreu-alexandre/unity-webapps-qml/content-hub-text into lp:unity-webapps-qml

Proposed by Alexandre Abreu on 2015-04-29
Status: Merged
Approved by: Ken VanDine on 2015-05-07
Approved revision: 157
Merged at revision: 153
Proposed branch: lp:~abreu-alexandre/unity-webapps-qml/content-hub-text
Merge into: lp:unity-webapps-qml
Diff against target: 119 lines (+29/-5)
4 files modified
src/Ubuntu/UnityWebApps/bindings/content-hub/backend/content-hub.js (+14/-2)
src/Ubuntu/UnityWebApps/bindings/content-hub/client/content-hub.js (+6/-0)
tests/unit/test_qml/tst_api_contenthub.html (+6/-1)
tests/unit/test_qml/tst_api_contenthub.qml (+3/-2)
To merge this branch: bzr merge lp:~abreu-alexandre/unity-webapps-qml/content-hub-text
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve on 2015-05-07
Ken VanDine 2015-04-29 Approve on 2015-05-07
Review via email: mp+257767@code.launchpad.net

Commit message

Add contentitem.text support & ebooks content hub type

Description of the change

Add contentitem.text support & ebooks content hub type

To post a comment you must log in.
Ken VanDine (ken-vandine) wrote :
review: Approve
Ken VanDine (ken-vandine) wrote :

It works great, but I did have a couple nits inline

review: Needs Fixing
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
156. By Alexandre Abreu on 2015-05-06

nits

Alexandre Abreu (abreu-alexandre) wrote :

updated

PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Ken VanDine (ken-vandine) wrote :

One more white space issue, commented inline. Otherwise good to go!

review: Needs Fixing
157. By Alexandre Abreu on 2015-05-07

nit

Ken VanDine (ken-vandine) wrote :

Great!

review: Approve
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/UnityWebApps/bindings/content-hub/backend/content-hub.js'
2--- src/Ubuntu/UnityWebApps/bindings/content-hub/backend/content-hub.js 2015-04-15 13:03:40 +0000
3+++ src/Ubuntu/UnityWebApps/bindings/content-hub/backend/content-hub.js 2015-05-07 13:43:00 +0000
4@@ -55,6 +55,8 @@
5 "Contacts": ContentHubBridge.ContentType.Contacts,
6 "Videos": ContentHubBridge.ContentType.Videos,
7 "Links": ContentHubBridge.ContentType.Links,
8+ "Text": ContentHubBridge.ContentType.Text,
9+ "EBooks": ContentHubBridge.ContentType.EBooks,
10 };
11 return name in contentTypePerName ?
12 contentTypePerName[name]
13@@ -77,6 +79,10 @@
14 return "Videos";
15 else if (state === ContentHubBridge.ContentType.Links)
16 return "Links";
17+ else if (state === ContentHubBridge.ContentType.Text)
18+ return "Text";
19+ else if (state === ContentHubBridge.ContentType.EBooks)
20+ return "EBooks";
21 return "Unknown";
22 };
23
24@@ -338,6 +344,9 @@
25
26 item.object.name = items[i].name;
27 item.object.url = items[i].url;
28+ if (items[i].text) {
29+ item.object.text = items[i].text;
30+ }
31
32 contentItems.push(item.object);
33 }
34@@ -374,8 +383,11 @@
35 serializeItems: function(self) {
36 var items = [];
37 for (var i = 0; i < self.items.length; ++i) {
38- items.push({name: self.items[i].name.toString(),
39- url: self.items[i].url.toString()});
40+ items.push({
41+ name: self.items[i].name.toString(),
42+ url: self.items[i].url.toString(),
43+ text: self.items[i].text.toString()
44+ });
45 }
46 return items;
47 }
48
49=== modified file 'src/Ubuntu/UnityWebApps/bindings/content-hub/client/content-hub.js'
50--- src/Ubuntu/UnityWebApps/bindings/content-hub/client/content-hub.js 2015-04-15 13:03:40 +0000
51+++ src/Ubuntu/UnityWebApps/bindings/content-hub/client/content-hub.js 2015-05-07 13:43:00 +0000
52@@ -617,6 +617,10 @@
53
54 Links
55
56+ EBooks
57+
58+ Text
59+
60 @static
61 @property ContentType {String}
62
63@@ -636,6 +640,8 @@
64 Contacts: "Contacts",
65 Videos: "Videos",
66 Links: "Links",
67+ Text: "Text",
68+ EBooks: "EBooks",
69 },
70
71 /**
72
73=== modified file 'tests/unit/test_qml/tst_api_contenthub.html'
74--- tests/unit/test_qml/tst_api_contenthub.html 2015-04-17 18:24:46 +0000
75+++ tests/unit/test_qml/tst_api_contenthub.html 2015-05-07 13:43:00 +0000
76@@ -13,7 +13,12 @@
77
78 activeTransfer.contentType(function(type) {
79 var e = new CustomEvent("received-object-value",
80- { bubbles: true, detail: { value: type } });
81+ { bubbles: true, detail: { name: "type", value: type } });
82+ document.documentElement.dispatchEvent(e);
83+ })
84+ activeTransfer.items(function(items) {
85+ var e = new CustomEvent("received-object-value",
86+ { bubbles: true, detail: { name: "text", value: items[0].text } });
87 document.documentElement.dispatchEvent(e);
88 })
89 }
90
91=== modified file 'tests/unit/test_qml/tst_api_contenthub.qml'
92--- tests/unit/test_qml/tst_api_contenthub.qml 2015-04-17 18:24:46 +0000
93+++ tests/unit/test_qml/tst_api_contenthub.qml 2015-05-07 13:43:00 +0000
94@@ -57,6 +57,7 @@
95 objects[id] = {
96 content: content,
97 selection: selection,
98+ items: {text: "blabla"},
99 handlerFuncs: handlerFuncs
100 };
101 return {
102@@ -123,7 +124,7 @@
103 function test_invoke_shareRequestedCallback() {
104 setup();
105
106- var transferObject = { contentType: function() { return "Pictures"; } }
107+ var transferObject = { contentType: function() { return "Pictures"; }, items: function() { return [{ text: "blabla" }] } }
108
109 webview.url = "tst_api_contenthub.html"
110
111@@ -145,7 +146,7 @@
112 "1", "", "", transferObject))
113
114 spyMessageReceived.wait()
115- compare(spyMessageReceived.count, 2, "Should have had 1 messageReceived signal");
116+ compare(spyMessageReceived.count, 3, "Should have had 1 messageReceived signal");
117 }
118
119 UnityWebApps {

Subscribers

People subscribed via source and target branches

to all changes: