Merge lp:~abreu-alexandre/unity-webapps-qml/backport-14-10 into lp:unity-webapps-qml/14.10

Proposed by Alexandre Abreu
Status: Needs review
Proposed branch: lp:~abreu-alexandre/unity-webapps-qml/backport-14-10
Merge into: lp:unity-webapps-qml/14.10
Diff against target: 191 lines (+44/-26)
6 files modified
debian/control (+1/-2)
src/Ubuntu/UnityWebApps/UnityWebApps.js (+1/-2)
src/Ubuntu/UnityWebApps/UnityWebApps.qml (+11/-1)
src/Ubuntu/UnityWebApps/UnityWebAppsUtils.js (+5/-3)
src/Ubuntu/UnityWebApps/bindings/content-hub/backend/content-hub.js (+25/-17)
src/Ubuntu/UnityWebApps/common/js/unity-backend-messaging-proxy.js (+1/-1)
To merge this branch: bzr merge lp:~abreu-alexandre/unity-webapps-qml/backport-14-10
Reviewer Review Type Date Requested Status
WebApps Pending
Review via email: mp+243416@code.launchpad.net

This proposal supersedes a proposal from 2014-12-02.

Description of the change

backport getpeers content hub fix
backport content hub issue on desktop webapp startup,
backport oxide integration fixes,

To post a comment you must log in.

Unmerged revisions

135. By Alexandre Abreu

backport oxide integration

134. By Alexandre Abreu

backport desktop fix for content hub; backport getpeers fix

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-10-14 10:02:49 +0000
3+++ debian/control 2014-12-02 16:11:02 +0000
4@@ -8,7 +8,6 @@
5 libnotify-dev,
6 # depend on oxide so that we don't build for archs that we can't install on
7 liboxideqtcore0,
8- libqt5webkit5-dev,
9 libunity-action-qt1-dev,
10 libunity-dev,
11 pkg-config,
12@@ -29,7 +28,7 @@
13 Package: unity-webapps-qml
14 Architecture: any
15 Depends: qml-module-qtwebkit,
16- liboxideqt-qmlplugin (>= 1.0),
17+ liboxideqt-qmlplugin (>= 1.3.4),
18 qtdeclarative5-qtquick2-plugin,
19 qtdeclarative5-unity-action-plugin,
20 qtdeclarative5-ubuntu-ui-toolkit-plugin | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles,
21
22=== modified file 'src/Ubuntu/UnityWebApps/UnityWebApps.js'
23--- src/Ubuntu/UnityWebApps/UnityWebApps.js 2014-07-18 13:43:55 +0000
24+++ src/Ubuntu/UnityWebApps/UnityWebApps.js 2014-12-02 16:11:02 +0000
25@@ -75,8 +75,7 @@
26 var cb = this._onMessageReceivedCallback.bind(self);
27 self._bindeeProxies.messageReceivedConnect(cb);
28
29- cb = this._onLoadingStartedCallback.bind(self);
30- self._bindeeProxies.loadingStartedConnect(cb);
31+ this._onLoadingStartedCallback();
32 },
33
34 /**
35
36=== modified file 'src/Ubuntu/UnityWebApps/UnityWebApps.qml'
37--- src/Ubuntu/UnityWebApps/UnityWebApps.qml 2014-07-18 21:46:57 +0000
38+++ src/Ubuntu/UnityWebApps/UnityWebApps.qml 2014-12-02 16:11:02 +0000
39@@ -112,6 +112,13 @@
40 */
41 property var model: null
42
43+ /*!
44+ \qmlsignal UnityWebApps::userScriptsInjected()
45+
46+ This signal is emitted when the component has completed its initialization and
47+ the userscripts have been injected into the binded webview.
48+ */
49+ signal userScriptsInjected()
50
51 /*!
52 \qmlproperty bool UnityWebApps::injectExtraUbuntuApis
53@@ -237,6 +244,8 @@
54
55 if (internal.backends)
56 internal.instance.setBackends(internal.backends)
57+
58+ userScriptsInjected();
59 }
60
61 /*!
62@@ -775,7 +784,8 @@
63 return AlarmApiBackend.createAlarmApi(UnityBackends.backendDelegate)
64 }),
65
66- ContentHub: ContentHubApiBackend.createContentHubApi(UnityBackends.backendDelegate),
67+ ContentHub: ContentHubApiBackend.createContentHubApi(
68+ UnityBackends.backendDelegate, webapps),
69
70 RuntimeApi: __injectResourceIfExtraApisAreEnabled(function() {
71 return RuntimeApiBackend.createRuntimeApi(UnityBackends.backendDelegate)
72
73=== modified file 'src/Ubuntu/UnityWebApps/UnityWebAppsUtils.js'
74--- src/Ubuntu/UnityWebApps/UnityWebAppsUtils.js 2014-07-18 13:43:55 +0000
75+++ src/Ubuntu/UnityWebApps/UnityWebAppsUtils.js 2014-12-02 16:11:02 +0000
76@@ -64,7 +64,7 @@
77 this.disposer = disposer;
78 this.makeSignalDisconnecter = makeSignalDisconnecter;
79 this._userScriptInjected = false;
80- this._WEBAPPS_USER_SCRIPT_CONTEXT = "oxide://UnityWebappsApi";
81+ this._WEBAPPS_USER_SCRIPT_CONTEXT = "oxide://main-world";
82 }
83 OxideWebviewAdapter.prototype = {
84 injectUserScripts: function(userScriptUrls) {
85@@ -81,8 +81,10 @@
86 var scriptStart = "import com.canonical.Oxide 1.0 as Oxide; Oxide.UserScript { context:";
87 var scriptEnd = "}";
88 var statement = scriptStart +
89- '"' + this._WEBAPPS_USER_SCRIPT_CONTEXT + '"' +
90- '; matchAllFrames: false; url: "' + userScriptUrls[i] + '";' + scriptEnd;
91+ '"' + this._WEBAPPS_USER_SCRIPT_CONTEXT
92+ + '"'
93+ + '; matchAllFrames: false; emulateGreasemonkey: true; url: "'
94+ + userScriptUrls[i] + '";' + scriptEnd;
95 context.addUserScript(Qt.createQmlObject(statement, this.webview));
96 }
97 this._userScriptInjected = true;
98
99=== modified file 'src/Ubuntu/UnityWebApps/bindings/content-hub/backend/content-hub.js'
100--- src/Ubuntu/UnityWebApps/bindings/content-hub/backend/content-hub.js 2014-06-17 13:53:49 +0000
101+++ src/Ubuntu/UnityWebApps/bindings/content-hub/backend/content-hub.js 2014-12-02 16:11:02 +0000
102@@ -16,15 +16,29 @@
103 * along with this program. If not, see <http://www.gnu.org/licenses/>.
104 */
105
106-.import Ubuntu.Content 0.1 as ContentHubBridge
107-
108 /**
109 *
110 * ContentHub API backend binding
111 *
112 */
113
114-function createContentHubApi(backendDelegate, accessPolicy) {
115+function createContentHubApi(backendDelegate, parent) {
116+
117+ var bridge = null
118+ try {
119+ bridge = Qt.createQmlObject(
120+ 'import QtQuick 2.0; import Ubuntu.Content 0.1 as ContentHubBridge; \
121+ QtObject { property var hub: ContentHubBridge }', parent)
122+ }
123+ catch(e) { }
124+
125+ if (!bridge) {
126+ console.log('Could not create ContentHub backend (does not appear to be installed)')
127+ return {};
128+ }
129+
130+ var ContentHubBridge = bridge.hub;
131+
132 var PLUGIN_URI = 'Ubuntu.Content';
133 var VERSION = 0.1;
134
135@@ -643,8 +657,7 @@
136 return;
137 }
138
139- var statement = "import QtQuick 2.0; import Ubuntu.Content 0.1; ContentPeerModel {";
140- var filterParams = {};
141+ var statement = "import QtQuick 2.0; import Ubuntu.Content 0.1; ContentPeerModel { ";
142 if (filters.contentType) {
143 statement += " contentType: ContentType." + filters.contentType + ";";
144 }
145@@ -654,18 +667,14 @@
146 statement += " }";
147
148 var peerModel = Qt.createQmlObject(statement, backendDelegate.parent());
149- var onPeersFound = function() {
150- var peers = peerModel.peers;
151+ var peers = peerModel.peers;
152
153- var wrappedPeers = [];
154- for (var i = 0; i < peers.length; ++i) {
155- var wrappedPeer = new ContentPeer(peers[i]);
156- wrappedPeers.push(wrappedPeer.serialize());
157- }
158- peerModel.onFindPeersCompleted.disconnect(onPeersFound);
159- callback(wrappedPeers);
160- };
161- peerModel.onFindPeersCompleted.connect(onPeersFound);
162+ var wrappedPeers = [];
163+ for (var i = 0; i < peers.length; ++i) {
164+ var wrappedPeer = new ContentPeer(peers[i]);
165+ wrappedPeers.push(wrappedPeer.serialize());
166+ }
167+ callback(wrappedPeers);
168 },
169
170 getStore: function(scope, callback) {
171@@ -692,7 +701,6 @@
172 }
173
174 var statement = "import QtQuick 2.0; import Ubuntu.Content 0.1; ContentPeerPicker {";
175- var filterParams = {};
176 if (filters.contentType) {
177 statement += " contentType: ContentType." + filters.contentType + "";
178 }
179
180=== modified file 'src/Ubuntu/UnityWebApps/common/js/unity-backend-messaging-proxy.js'
181--- src/Ubuntu/UnityWebApps/common/js/unity-backend-messaging-proxy.js 2014-03-28 13:21:47 +0000
182+++ src/Ubuntu/UnityWebApps/common/js/unity-backend-messaging-proxy.js 2014-12-02 16:11:02 +0000
183@@ -4,7 +4,7 @@
184 navigator.qt.postMessage) {
185 return new UnityQtWebkitBackendMessagingProxy();
186 }
187- else if (window.oxide) {
188+ else if (oxide) {
189 return new UnityOxideBackendMessagingProxy();
190 }
191 return null;

Subscribers

People subscribed via source and target branches

to all changes: