Merge lp:~abreu-alexandre/cordova-ubuntu/expose-mainview into lp:cordova-ubuntu/2.8

Proposed by Alexandre Abreu
Status: Merged
Approved by: Alexandre Abreu
Approved revision: 254
Merged at revision: 252
Proposed branch: lp:~abreu-alexandre/cordova-ubuntu/expose-mainview
Merge into: lp:cordova-ubuntu/2.8
Diff against target: 64 lines (+14/-0)
3 files modified
Cordovaqt/CordovaViewInternal.qml (+5/-0)
qml/CordovaView.qml.in (+6/-0)
src/qmlplugin.h (+3/-0)
To merge this branch: bzr merge lp:~abreu-alexandre/cordova-ubuntu/expose-mainview
Reviewer Review Type Date Requested Status
Alexandre Abreu (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+203621@code.launchpad.net

Commit message

Expose the main webview to allow external elements to bind to possibly it.

Description of the change

Expose the main webview to allow external elements to bind to possibly it.

To post a comment you must log in.
Revision history for this message
Robert Bruce Park (robru) wrote :

How do I test this one? ;-)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alexandre Abreu (abreu-alexandre) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Cordovaqt/CordovaViewInternal.qml'
2--- Cordovaqt/CordovaViewInternal.qml 2013-08-23 17:14:42 +0000
3+++ Cordovaqt/CordovaViewInternal.qml 2014-01-28 19:21:13 +0000
4@@ -13,6 +13,9 @@
5 property string wwwDir
6 property string splashscreenPath
7 property string inappbrowserUrl
8+
9+ property var mainWebview
10+
11 function exec(plugin, func, args) {
12 CordovaWrapper.execMethod(plugin, func, args);
13 }
14@@ -101,6 +104,8 @@
15
16 Component.onCompleted: {
17 webView.url = cordova.mainUrl
18+
19+ root.mainWebview = webView;
20 }
21
22 onTitleChanged: {
23
24=== modified file 'qml/CordovaView.qml.in'
25--- qml/CordovaView.qml.in 2013-07-17 02:52:18 +0000
26+++ qml/CordovaView.qml.in 2014-01-28 19:21:13 +0000
27@@ -4,6 +4,7 @@
28 Item {
29 id: root
30 property string wwwDir
31+ property var mainWebview
32
33 Cordova {
34 id: cordova
35@@ -16,10 +17,15 @@
36 Loader {
37 id: loader
38 asynchronous: true
39+
40 visible: false
41 anchors.fill: parent
42+
43 onLoaded: {
44+ root.mainWebview = loader.item.mainWebview
45+
46 cordova.parent = loader.item
47+
48 loader.item.completed.connect(function(){
49 loader.item.visible = true
50 loader.visible = true
51
52=== modified file 'src/qmlplugin.h'
53--- src/qmlplugin.h 2013-07-17 02:52:18 +0000
54+++ src/qmlplugin.h 2014-01-28 19:21:13 +0000
55@@ -22,6 +22,9 @@
56 }
57
58 void setWwwDir(const QString &www) {
59+ if (www.trimmed().isEmpty()) {
60+ return;
61+ }
62 assert(!m_cordova.data());
63 m_cordova = QSharedPointer<Cordova>(new Cordova(QDir(www), this));
64 m_wwwDir = www;

Subscribers

People subscribed via source and target branches