~abreu-alexandre/unity-webapps-qml/location-specific-homepage

« back to all changes in this revision

Viewing changes to examples/basic-webview/main.qml

  • Committer: CI bot
  • Author(s): Alexandre Abreu
  • Date: 2014-11-22 00:47:15 UTC
  • mfrom: (135.1.1 latest)
  • Revision ID: ps-jenkins@lists.canonical.com-20141122004715-r8ae4r6ih5ktx280
Port qml bindings to oxide Fixes: #1374100

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import QtQuick 2.0
2
2
import QtQuick.Window 2.0
3
 
import QtWebKit 3.0
4
 
import QtWebKit.experimental 1.0
 
3
import com.canonical.Oxide 1.0
5
4
import Ubuntu.UnityWebApps 0.1
6
5
 
7
6
Window {
15
14
        url: "file:///usr/share/unity-webapps-qml/examples/data/html/big-test.html"
16
15
        anchors.fill: parent
17
16
 
18
 
        experimental.userScripts: []
19
 
        experimental.preferences.navigatorQtObjectEnabled: true
20
 
        experimental.preferences.developerExtrasEnabled: true
21
 
 
22
 
        experimental.userAgent: {
23
 
            return "Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3"
24
 
        }
25
 
        experimental.onMessageReceived: {
26
 
            var msg = null
27
 
            try {
28
 
                msg = JSON.parse(message.data)
29
 
            } catch (error) {
30
 
                console.debug('DEBUG:', message.data)
31
 
                return
32
 
            }
33
 
        }
 
17
        context: WebContext { }
34
18
 
35
19
        function getUnityWebappsProxies() {
36
 
            var proxies = UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webView);
 
20
            var proxies = UnityWebAppsUtils.makeProxiesForWebViewBindee(webView);
37
21
 
38
22
            // override the default navigate to request
39
23
            proxies.navigateTo = function(url) {};
40
24
            return proxies;
41
25
        }
 
26
    }
42
27
 
43
 
        UnityWebApps {
44
 
            id: webapps
45
 
            name: "BBCNews"
46
 
            bindee: webView
47
 
            model: UnityWebappsAppModel { }
48
 
        }
 
28
    UnityWebApps {
 
29
        id: webapps
 
30
        name: "BBCNews"
 
31
        bindee: webView
 
32
        model: UnityWebappsAppModel { }
49
33
    }
50
34
}