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

Proposed by Alexandre Abreu
Status: Merged
Approved by: Ken VanDine
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
Ken VanDine Approve
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.
Revision history for this message
Ken VanDine (ken-vandine) wrote :
review: Approve
Revision history for this message
Ken VanDine (ken-vandine) wrote :

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

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
156. By Alexandre Abreu

nits

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

updated

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 :

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

review: Needs Fixing
157. By Alexandre Abreu

nit

Revision history for this message
Ken VanDine (ken-vandine) wrote :

Great!

review: Approve
Revision history for this message
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
=== modified file 'src/Ubuntu/UnityWebApps/bindings/content-hub/backend/content-hub.js'
--- src/Ubuntu/UnityWebApps/bindings/content-hub/backend/content-hub.js 2015-04-15 13:03:40 +0000
+++ src/Ubuntu/UnityWebApps/bindings/content-hub/backend/content-hub.js 2015-05-07 13:43:00 +0000
@@ -55,6 +55,8 @@
55 "Contacts": ContentHubBridge.ContentType.Contacts,55 "Contacts": ContentHubBridge.ContentType.Contacts,
56 "Videos": ContentHubBridge.ContentType.Videos,56 "Videos": ContentHubBridge.ContentType.Videos,
57 "Links": ContentHubBridge.ContentType.Links,57 "Links": ContentHubBridge.ContentType.Links,
58 "Text": ContentHubBridge.ContentType.Text,
59 "EBooks": ContentHubBridge.ContentType.EBooks,
58 };60 };
59 return name in contentTypePerName ?61 return name in contentTypePerName ?
60 contentTypePerName[name]62 contentTypePerName[name]
@@ -77,6 +79,10 @@
77 return "Videos";79 return "Videos";
78 else if (state === ContentHubBridge.ContentType.Links)80 else if (state === ContentHubBridge.ContentType.Links)
79 return "Links";81 return "Links";
82 else if (state === ContentHubBridge.ContentType.Text)
83 return "Text";
84 else if (state === ContentHubBridge.ContentType.EBooks)
85 return "EBooks";
80 return "Unknown";86 return "Unknown";
81 };87 };
8288
@@ -338,6 +344,9 @@
338344
339 item.object.name = items[i].name;345 item.object.name = items[i].name;
340 item.object.url = items[i].url;346 item.object.url = items[i].url;
347 if (items[i].text) {
348 item.object.text = items[i].text;
349 }
341350
342 contentItems.push(item.object);351 contentItems.push(item.object);
343 }352 }
@@ -374,8 +383,11 @@
374 serializeItems: function(self) {383 serializeItems: function(self) {
375 var items = [];384 var items = [];
376 for (var i = 0; i < self.items.length; ++i) {385 for (var i = 0; i < self.items.length; ++i) {
377 items.push({name: self.items[i].name.toString(),386 items.push({
378 url: self.items[i].url.toString()});387 name: self.items[i].name.toString(),
388 url: self.items[i].url.toString(),
389 text: self.items[i].text.toString()
390 });
379 }391 }
380 return items;392 return items;
381 }393 }
382394
=== modified file 'src/Ubuntu/UnityWebApps/bindings/content-hub/client/content-hub.js'
--- src/Ubuntu/UnityWebApps/bindings/content-hub/client/content-hub.js 2015-04-15 13:03:40 +0000
+++ src/Ubuntu/UnityWebApps/bindings/content-hub/client/content-hub.js 2015-05-07 13:43:00 +0000
@@ -617,6 +617,10 @@
617617
618 Links618 Links
619619
620 EBooks
621
622 Text
623
620 @static624 @static
621 @property ContentType {String}625 @property ContentType {String}
622 626
@@ -636,6 +640,8 @@
636 Contacts: "Contacts",640 Contacts: "Contacts",
637 Videos: "Videos",641 Videos: "Videos",
638 Links: "Links",642 Links: "Links",
643 Text: "Text",
644 EBooks: "EBooks",
639 },645 },
640646
641 /**647 /**
642648
=== modified file 'tests/unit/test_qml/tst_api_contenthub.html'
--- tests/unit/test_qml/tst_api_contenthub.html 2015-04-17 18:24:46 +0000
+++ tests/unit/test_qml/tst_api_contenthub.html 2015-05-07 13:43:00 +0000
@@ -13,7 +13,12 @@
1313
14 activeTransfer.contentType(function(type) {14 activeTransfer.contentType(function(type) {
15 var e = new CustomEvent("received-object-value",15 var e = new CustomEvent("received-object-value",
16 { bubbles: true, detail: { value: type } });16 { bubbles: true, detail: { name: "type", value: type } });
17 document.documentElement.dispatchEvent(e);
18 })
19 activeTransfer.items(function(items) {
20 var e = new CustomEvent("received-object-value",
21 { bubbles: true, detail: { name: "text", value: items[0].text } });
17 document.documentElement.dispatchEvent(e);22 document.documentElement.dispatchEvent(e);
18 })23 })
19}24}
2025
=== modified file 'tests/unit/test_qml/tst_api_contenthub.qml'
--- tests/unit/test_qml/tst_api_contenthub.qml 2015-04-17 18:24:46 +0000
+++ tests/unit/test_qml/tst_api_contenthub.qml 2015-05-07 13:43:00 +0000
@@ -57,6 +57,7 @@
57 objects[id] = {57 objects[id] = {
58 content: content,58 content: content,
59 selection: selection,59 selection: selection,
60 items: {text: "blabla"},
60 handlerFuncs: handlerFuncs61 handlerFuncs: handlerFuncs
61 };62 };
62 return {63 return {
@@ -123,7 +124,7 @@
123 function test_invoke_shareRequestedCallback() {124 function test_invoke_shareRequestedCallback() {
124 setup();125 setup();
125126
126 var transferObject = { contentType: function() { return "Pictures"; } }127 var transferObject = { contentType: function() { return "Pictures"; }, items: function() { return [{ text: "blabla" }] } }
127128
128 webview.url = "tst_api_contenthub.html"129 webview.url = "tst_api_contenthub.html"
129130
@@ -145,7 +146,7 @@
145 "1", "", "", transferObject))146 "1", "", "", transferObject))
146147
147 spyMessageReceived.wait()148 spyMessageReceived.wait()
148 compare(spyMessageReceived.count, 2, "Should have had 1 messageReceived signal");149 compare(spyMessageReceived.count, 3, "Should have had 1 messageReceived signal");
149 }150 }
150151
151 UnityWebApps {152 UnityWebApps {

Subscribers

People subscribed via source and target branches

to all changes: