You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by za...@apache.org on 2014/12/15 14:33:21 UTC
[32/37] cordova-ubuntu git commit: misc
misc
Project: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/commit/6c1f2014
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/tree/6c1f2014
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/diff/6c1f2014
Branch: refs/heads/master
Commit: 6c1f2014f7bd821bbe8f070fa671c5fedee2bff2
Parents: 7e279a6
Author: Maxim Ermilov <ma...@canonical.com>
Authored: Fri Dec 5 09:55:22 2014 +0300
Committer: Maxim Ermilov <ma...@canonical.com>
Committed: Fri Dec 5 09:55:22 2014 +0300
----------------------------------------------------------------------
CMakeLists.txt | 4 +-
CordovaUbuntu/CordovaViewInternal.qml | 185 +++++++++++++++++++++++++++++
CordovaUbuntu/cordova_wrapper.js | 51 ++++++++
CordovaUbuntu/escape.js | 1 +
CordovaUbuntu/qmldir | 5 +
Cordovaqt/CordovaViewInternal.qml | 185 -----------------------------
Cordovaqt/cordova_wrapper.js | 51 --------
Cordovaqt/escape.js | 1 -
Cordovaqt/qmldir | 5 -
9 files changed, 244 insertions(+), 244 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/6c1f2014/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e544495..edc4188 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,10 +59,10 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/qml
DEPENDS ${PROJECT_BINARY_DIR}/main.qml
)
-file(GLOB tmp Cordovaqt/*)
+file(GLOB tmp CordovaUbuntu/*)
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/CordovaUbuntu.${VERSION}
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Cordovaqt ${PROJECT_BINARY_DIR}/CordovaUbuntu.${VERSION}
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/CordovaUbuntu ${PROJECT_BINARY_DIR}/CordovaUbuntu.${VERSION}
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/libcordovaubuntuplugin.so ${PROJECT_BINARY_DIR}/CordovaUbuntu.${VERSION}
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/CordovaView.qml ${PROJECT_BINARY_DIR}/CordovaUbuntu.${VERSION}
DEPENDS ${tmp} cordovaubuntuplugin ${PROJECT_BINARY_DIR}/CordovaView.qml
http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/6c1f2014/CordovaUbuntu/CordovaViewInternal.qml
----------------------------------------------------------------------
diff --git a/CordovaUbuntu/CordovaViewInternal.qml b/CordovaUbuntu/CordovaViewInternal.qml
new file mode 100644
index 0000000..4c7009a
--- /dev/null
+++ b/CordovaUbuntu/CordovaViewInternal.qml
@@ -0,0 +1,185 @@
+/*
+ *
+ * Copyright 2013 Canonical Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+import QtQuick 2.0
+import com.canonical.Oxide 1.0
+import "cordova_wrapper.js" as CordovaWrapper
+import Ubuntu.Components 0.1
+import Ubuntu.Components.Popups 0.1
+
+Item {
+ id: root
+
+ anchors.fill: parent
+
+ state: "main"
+ signal completed
+
+ property string splashscreenPath
+ property bool disallowOverscroll
+ property var mainWebview
+
+ function exec(plugin, func, args) {
+ CordovaWrapper.execMethod(plugin, func, args);
+ }
+ function plugin(plugin) {
+ return CordovaWrapper.pluginObjects[plugin];
+ }
+ property string usContext: "oxide://main-world"
+
+ Rectangle {
+ id: webViewContainer
+ anchors.fill: parent
+ WebView {
+ id: webView
+ anchors.fill: parent
+ objectName: "webView"
+
+ onNavigationRequested: {
+ if (cordova.isUrlWhiteListed(request.url))
+ request.action = NavigationRequest.ActionAccept;
+ else
+ request.action = NavigationRequest.ActionReject;
+ }
+
+ preferences.remoteFontsEnabled: true
+ preferences.javascriptCanAccessClipboard: true
+ preferences.canDisplayInsecureContent: true
+ preferences.canRunInsecureContent: true
+
+ preferences.allowUniversalAccessFromFileUrls: true
+ preferences.allowFileAccessFromFileUrls: true
+
+ preferences.localStorageEnabled: true
+ preferences.appCacheEnabled: true
+
+// boundsBehavior: disallowOverscroll ? Flickable.StopAtBounds : Flickable.DragAndOvershootBounds
+ property string scheme: "file"
+
+ property var currentDialog: null
+
+ // FIXME: remove code from geolocation plugin
+ onGeolocationPermissionRequested: {
+ request.accept();
+ }
+
+ context: WebContext {
+ id: webcontext
+
+ devtoolsEnabled: true
+ devtoolsPort: 9222
+
+ userScripts: [
+ UserScript {
+ context: usContext
+ emulateGreasemonkey: true
+ url: "escape.js"
+ }
+ ]
+ sessionCookieMode: {
+ if (typeof webContextSessionCookieMode !== 'undefined') {
+ if (webContextSessionCookieMode === "persistent") {
+ return WebContext.SessionCookieModePersistent
+ } else if (webContextSessionCookieMode === "restored") {
+ return WebContext.SessionCookieModeRestored
+ }
+ }
+ return WebContext.SessionCookieModeEphemeral
+ }
+ dataPath: cordova.getDataLocation()
+ }
+
+ messageHandlers: [
+ ScriptMessageHandler {
+ msgId: "from-cordova"
+ contexts: [usContext]
+ callback: function(msg, frame) {
+ CordovaWrapper.messageHandler(msg.args)
+ console.log(JSON.stringify(msg.args))
+ }
+ }
+ ]
+
+ Component.onCompleted: {
+ root.mainWebview = webView;
+ cordova.appLoaded();
+ webView.url = cordova.mainUrl;
+ }
+
+ onTitleChanged: {
+ cordova.setTitle(webView.title)
+ }
+
+ onLoadingChanged: {
+ if (!webView.loading) {
+ root.completed()
+ cordova.loadFinished(true)
+ }
+ }
+ Connections {
+ target: cordova
+ onJavaScriptExecNeeded: {
+ webView.rootFrame.sendMessage(usContext, "EXECUTE", {code: js});
+ }
+ onQmlExecNeeded: {
+ eval(src);
+ }
+ onPluginWantsToBeAdded: {
+ CordovaWrapper.addPlugin(pluginName, pluginObject)
+ }
+ }
+ }
+ }
+
+ Image {
+ id: splashscreen
+ anchors.fill: parent
+ source: splashscreenPath
+ visible: false
+ smooth: true
+ fillMode: Image.PreserveAspectFit
+ }
+
+ states: [
+ State {
+ name: "main"
+ PropertyChanges {
+ target: webViewContainer
+ visible: true
+ }
+ PropertyChanges {
+ target: splashscreen
+ visible: false
+ }
+ },
+ State {
+ name: "splashscreen"
+ PropertyChanges {
+ target: webViewContainer
+ visible: false
+ }
+ PropertyChanges {
+ target: splashscreen
+ visible: true
+ }
+ }
+ ]
+ transitions: Transition {
+ RotationAnimation { duration: 500; direction: RotationAnimation.Shortest }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/6c1f2014/CordovaUbuntu/cordova_wrapper.js
----------------------------------------------------------------------
diff --git a/CordovaUbuntu/cordova_wrapper.js b/CordovaUbuntu/cordova_wrapper.js
new file mode 100644
index 0000000..006614c
--- /dev/null
+++ b/CordovaUbuntu/cordova_wrapper.js
@@ -0,0 +1,51 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var pluginObjects = {}
+
+// qt 5.2 forbids assigning new properties to JS module
+// global variable used by plugins to store temporary data
+var global = {};
+
+function addPlugin(pluginName, pluginObject) {
+ pluginObjects[pluginName] = pluginObject
+}
+
+function messageHandler(received) {
+ if (typeof received === 'undefined')
+ return false;
+ if (typeof received.messageType === 'undefined')
+ return false;
+ if (received.messageType === "callPluginFunction") {
+ if (typeof received.plugin === 'undefined' || typeof received.func == 'undefined')
+ return false;
+ execMethod(received.plugin, received.func, received.params);
+ }
+ return true;
+}
+
+function execMethod(pluginName, functionName, params) {
+ if (typeof pluginObjects[pluginName][functionName] != "function")
+ return false;
+
+ pluginObjects[pluginName][functionName].apply(this, params);
+ return true;
+}
http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/6c1f2014/CordovaUbuntu/escape.js
----------------------------------------------------------------------
diff --git a/CordovaUbuntu/escape.js b/CordovaUbuntu/escape.js
new file mode 100644
index 0000000..48243ad
--- /dev/null
+++ b/CordovaUbuntu/escape.js
@@ -0,0 +1 @@
+window.oxide = oxide;
http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/6c1f2014/CordovaUbuntu/qmldir
----------------------------------------------------------------------
diff --git a/CordovaUbuntu/qmldir b/CordovaUbuntu/qmldir
new file mode 100644
index 0000000..f1a4d22
--- /dev/null
+++ b/CordovaUbuntu/qmldir
@@ -0,0 +1,5 @@
+module CordovaUbuntu
+plugin cordovaubuntuplugin
+CordovaView 3.0 CordovaView.qml
+CordovaViewInternal 3.0 CordovaViewInternal.qml
+
http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/6c1f2014/Cordovaqt/CordovaViewInternal.qml
----------------------------------------------------------------------
diff --git a/Cordovaqt/CordovaViewInternal.qml b/Cordovaqt/CordovaViewInternal.qml
deleted file mode 100644
index 4c7009a..0000000
--- a/Cordovaqt/CordovaViewInternal.qml
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- *
- * Copyright 2013 Canonical Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-import QtQuick 2.0
-import com.canonical.Oxide 1.0
-import "cordova_wrapper.js" as CordovaWrapper
-import Ubuntu.Components 0.1
-import Ubuntu.Components.Popups 0.1
-
-Item {
- id: root
-
- anchors.fill: parent
-
- state: "main"
- signal completed
-
- property string splashscreenPath
- property bool disallowOverscroll
- property var mainWebview
-
- function exec(plugin, func, args) {
- CordovaWrapper.execMethod(plugin, func, args);
- }
- function plugin(plugin) {
- return CordovaWrapper.pluginObjects[plugin];
- }
- property string usContext: "oxide://main-world"
-
- Rectangle {
- id: webViewContainer
- anchors.fill: parent
- WebView {
- id: webView
- anchors.fill: parent
- objectName: "webView"
-
- onNavigationRequested: {
- if (cordova.isUrlWhiteListed(request.url))
- request.action = NavigationRequest.ActionAccept;
- else
- request.action = NavigationRequest.ActionReject;
- }
-
- preferences.remoteFontsEnabled: true
- preferences.javascriptCanAccessClipboard: true
- preferences.canDisplayInsecureContent: true
- preferences.canRunInsecureContent: true
-
- preferences.allowUniversalAccessFromFileUrls: true
- preferences.allowFileAccessFromFileUrls: true
-
- preferences.localStorageEnabled: true
- preferences.appCacheEnabled: true
-
-// boundsBehavior: disallowOverscroll ? Flickable.StopAtBounds : Flickable.DragAndOvershootBounds
- property string scheme: "file"
-
- property var currentDialog: null
-
- // FIXME: remove code from geolocation plugin
- onGeolocationPermissionRequested: {
- request.accept();
- }
-
- context: WebContext {
- id: webcontext
-
- devtoolsEnabled: true
- devtoolsPort: 9222
-
- userScripts: [
- UserScript {
- context: usContext
- emulateGreasemonkey: true
- url: "escape.js"
- }
- ]
- sessionCookieMode: {
- if (typeof webContextSessionCookieMode !== 'undefined') {
- if (webContextSessionCookieMode === "persistent") {
- return WebContext.SessionCookieModePersistent
- } else if (webContextSessionCookieMode === "restored") {
- return WebContext.SessionCookieModeRestored
- }
- }
- return WebContext.SessionCookieModeEphemeral
- }
- dataPath: cordova.getDataLocation()
- }
-
- messageHandlers: [
- ScriptMessageHandler {
- msgId: "from-cordova"
- contexts: [usContext]
- callback: function(msg, frame) {
- CordovaWrapper.messageHandler(msg.args)
- console.log(JSON.stringify(msg.args))
- }
- }
- ]
-
- Component.onCompleted: {
- root.mainWebview = webView;
- cordova.appLoaded();
- webView.url = cordova.mainUrl;
- }
-
- onTitleChanged: {
- cordova.setTitle(webView.title)
- }
-
- onLoadingChanged: {
- if (!webView.loading) {
- root.completed()
- cordova.loadFinished(true)
- }
- }
- Connections {
- target: cordova
- onJavaScriptExecNeeded: {
- webView.rootFrame.sendMessage(usContext, "EXECUTE", {code: js});
- }
- onQmlExecNeeded: {
- eval(src);
- }
- onPluginWantsToBeAdded: {
- CordovaWrapper.addPlugin(pluginName, pluginObject)
- }
- }
- }
- }
-
- Image {
- id: splashscreen
- anchors.fill: parent
- source: splashscreenPath
- visible: false
- smooth: true
- fillMode: Image.PreserveAspectFit
- }
-
- states: [
- State {
- name: "main"
- PropertyChanges {
- target: webViewContainer
- visible: true
- }
- PropertyChanges {
- target: splashscreen
- visible: false
- }
- },
- State {
- name: "splashscreen"
- PropertyChanges {
- target: webViewContainer
- visible: false
- }
- PropertyChanges {
- target: splashscreen
- visible: true
- }
- }
- ]
- transitions: Transition {
- RotationAnimation { duration: 500; direction: RotationAnimation.Shortest }
- }
-}
http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/6c1f2014/Cordovaqt/cordova_wrapper.js
----------------------------------------------------------------------
diff --git a/Cordovaqt/cordova_wrapper.js b/Cordovaqt/cordova_wrapper.js
deleted file mode 100644
index 006614c..0000000
--- a/Cordovaqt/cordova_wrapper.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var pluginObjects = {}
-
-// qt 5.2 forbids assigning new properties to JS module
-// global variable used by plugins to store temporary data
-var global = {};
-
-function addPlugin(pluginName, pluginObject) {
- pluginObjects[pluginName] = pluginObject
-}
-
-function messageHandler(received) {
- if (typeof received === 'undefined')
- return false;
- if (typeof received.messageType === 'undefined')
- return false;
- if (received.messageType === "callPluginFunction") {
- if (typeof received.plugin === 'undefined' || typeof received.func == 'undefined')
- return false;
- execMethod(received.plugin, received.func, received.params);
- }
- return true;
-}
-
-function execMethod(pluginName, functionName, params) {
- if (typeof pluginObjects[pluginName][functionName] != "function")
- return false;
-
- pluginObjects[pluginName][functionName].apply(this, params);
- return true;
-}
http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/6c1f2014/Cordovaqt/escape.js
----------------------------------------------------------------------
diff --git a/Cordovaqt/escape.js b/Cordovaqt/escape.js
deleted file mode 100644
index 48243ad..0000000
--- a/Cordovaqt/escape.js
+++ /dev/null
@@ -1 +0,0 @@
-window.oxide = oxide;
http://git-wip-us.apache.org/repos/asf/cordova-ubuntu/blob/6c1f2014/Cordovaqt/qmldir
----------------------------------------------------------------------
diff --git a/Cordovaqt/qmldir b/Cordovaqt/qmldir
deleted file mode 100644
index f1a4d22..0000000
--- a/Cordovaqt/qmldir
+++ /dev/null
@@ -1,5 +0,0 @@
-module CordovaUbuntu
-plugin cordovaubuntuplugin
-CordovaView 3.0 CordovaView.qml
-CordovaViewInternal 3.0 CordovaViewInternal.qml
-
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org