incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [16/26] qt commit: Qt4 version moved to qml webview. Harmattan support added
Date Fri, 24 Feb 2012 20:52:11 GMT
Qt4 version moved to qml webview. Harmattan support added


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/commit/938fe5c4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/tree/938fe5c4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/diff/938fe5c4

Branch: refs/heads/master
Commit: 938fe5c415ced73afbcf7758a112a9a6766bc86a
Parents: ff477a0
Author: Denis Kormalev <dkormalev@ics.com>
Authored: Fri Feb 17 20:01:39 2012 +0400
Committer: Denis Kormalev <dkormalev@ics.com>
Committed: Fri Feb 17 20:01:39 2012 +0400

----------------------------------------------------------------------
 cordovaqt.pro          |   19 ++++--
 main.cpp               |   23 +++++--
 mainwindow.cpp         |  134 -------------------------------------------
 mainwindow.h           |   55 ------------------
 mainwindow.ui          |   43 --------------
 qml/cordova_wrapper.js |   13 ++++
 qml/main.qml           |   40 +++++++-------
 qml/main_harmattan.qml |   53 +++++++++++++++++
 qml/main_qt5.qml       |   39 +++++++++++++
 src/cordova.cpp        |   16 +++++-
 src/cordova.h          |    1 +
 www/basic.js           |   10 ++--
 www/index.html         |    2 +-
 www/js/cordova.qt.js   |   13 +----
 www/js/file.js         |    2 +-
 15 files changed, 176 insertions(+), 287 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/938fe5c4/cordovaqt.pro
----------------------------------------------------------------------
diff --git a/cordovaqt.pro b/cordovaqt.pro
index 3d11740..19d4e62 100644
--- a/cordovaqt.pro
+++ b/cordovaqt.pro
@@ -16,21 +16,27 @@ greaterThan(QT_MAJOR_VERSION, 4) {
     QT += systeminfo
     QT += sensors
     QT += quick declarative
-    OTHER_FILES += \
-        qml/main.qml \
+    OTHER_FILES += qml/main_qt5.qml \
         qml/cordova_wrapper.js
+} else:!isEmpty(MEEGO_VERSION_MAJOR) {
+    OTHER_FILES += qml/main_harmattan.qml \
+        qml/cordova_wrapper.js
+
+    QT += declarative
+    CONFIG += mobility
+    MOBILITY += feedback location systeminfo sensors
 } else {
-    SOURCES += mainwindow.cpp
-    HEADERS += mainwindow.h
-    FORMS += mainwindow.ui
+    OTHER_FILES += qml/main.qml \
+        qml/cordova_wrapper.js
 
     symbian:TARGET.UID3 = 0xE3522943
     #symbian:DEPLOYMENT.installer_header = 0x2002CCCF
     symbian:TARGET.CAPABILITY += NetworkServices
 
+    QT += declarative
+
     CONFIG += mobility
     MOBILITY += feedback location systeminfo sensors
-
 }
 
 QT += webkit
@@ -59,7 +65,6 @@ HEADERS += \
     src/cordova.h \
     src/cplugin.h \
     src/cwebpage.h
-FORMS += mainwindow.ui
 
 # Please do not modify the following two lines. Required for deployment.
 include(deployment.pri)

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/938fe5c4/main.cpp
----------------------------------------------------------------------
diff --git a/main.cpp b/main.cpp
index ed495dc..3e5c9eb 100644
--- a/main.cpp
+++ b/main.cpp
@@ -20,25 +20,34 @@
 #include "src/cordova.h"
 
 #if QT_VERSION < 0x050000
-# include "mainwindow.h"
+# include <QDeclarativeView>
 #else
 # include <QQuickView>
-# include <QDeclarativeContext>
-# include <QDeclarativeEngine>
 #endif
 
+#include <QDeclarativeContext>
+#include <QDeclarativeEngine>
+#include <qplatformdefs.h>
+
 int main(int argc, char *argv[])
 {
     QApplication app(argc, argv);
 
 #if QT_VERSION < 0x050000
-    MainWindow mainWindow;
-    mainWindow.setOrientation(MainWindow::ScreenOrientationAuto);
-    mainWindow.showExpanded();
+    QDeclarativeView view;
+    view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
+    view.rootContext()->setContextProperty("cordova", Cordova::instance());
+#ifdef MEEGO_EDITION_HARMATTAN
+    view.setSource(QUrl(QString("%1/qml/main_harmattan.qml").arg(Cordova::instance()->workingDir())));
+#else
+    view.setSource(QUrl(QString("%1/qml/main.qml").arg(Cordova::instance()->workingDir())));
+#endif
+    view.show();
 #else
     QQuickView view;
+    view.setResizeMode(QQuickView::SizeRootObjectToView);
     view.rootContext()->setContextProperty("cordova", Cordova::instance());
-    view.setSource(QUrl(QString("%1/qml/main.qml").arg(QApplication::applicationDirPath())));
+    view.setSource(QUrl(QString("%1/qml/main_qt5.qml").arg(Cordova::instance()->workingDir())));
     view.show();
 #endif
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/938fe5c4/mainwindow.cpp
----------------------------------------------------------------------
diff --git a/mainwindow.cpp b/mainwindow.cpp
deleted file mode 100644
index 7fa51d8..0000000
--- a/mainwindow.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- *  Copyright 2011 Wolfgang Koller - http://www.gofg.at/
- *
- *  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.
- */
-
-#include "mainwindow.h"
-#include "ui_mainwindow.h"
-#include "src/cwebpage.h"
-
-#include <QtCore/QCoreApplication>
-
-MainWindow::MainWindow(QWidget *parent)
-    : QMainWindow(parent), ui(new Ui::MainWindow)
-{
-    ui->setupUi(this);
-
-    // Configure web view
-    ui->webView->settings()->enablePersistentStorage();
-    ui->webView->settings()->setAttribute( QWebSettings::LocalStorageEnabled, true
);
-    ui->webView->settings()->setAttribute( QWebSettings::OfflineStorageDatabaseEnabled,
true );
-    ui->webView->settings()->setAttribute( QWebSettings::LocalContentCanAccessRemoteUrls,
true );
-    ui->webView->setPage( new CWebPage() );
-
-    // Listen to load finished signal
-    connect(ui->webView, SIGNAL(loadFinished(bool)),
-            Cordova::instance(), SLOT(loadFinished(bool)));
-    connect(Cordova::instance(), SIGNAL(javaScriptExecNeeded(QString)),
-            this, SLOT(onJavaScriptExecNeeded(QString)));
-    connect(Cordova::instance(), SIGNAL(pluginWantsToBeAdded(QString,QObject*,QString)),
-            this, SLOT(onPluginWantsToBeAdded(QString,QObject*,QString)));
-    connect(Cordova::instance(), SIGNAL(webViewAttributeChanged(QWebSettings::WebAttribute,bool)),
-            this, SLOT(onWebViewAttributeChanged(QWebSettings::WebAttribute,bool)));
-    ui->webView->load( Cordova::instance()->mainUrl() );
-}
-
-MainWindow::~MainWindow()
-{
-    delete ui;
-}
-
-void MainWindow::setOrientation(ScreenOrientation orientation)
-{
-#if defined(Q_OS_SYMBIAN)
-    // If the version of Qt on the device is < 4.7.2, that attribute won't work
-    if (orientation != ScreenOrientationAuto) {
-        const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.'));
-        if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() <<
8 | v.at(2).toInt()) < 0x040702) {
-            qWarning("Screen orientation locking only supported with Qt 4.7.2 and above");
-            return;
-        }
-    }
-#endif // Q_OS_SYMBIAN
-
-#if QT_VERSION < 0x050000
-    Qt::WidgetAttribute attribute;
-#endif
-    switch (orientation) {
-#if QT_VERSION < 0x040702
-    // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
-    case ScreenOrientationLockPortrait:
-        attribute = static_cast<Qt::WidgetAttribute>(128);
-        break;
-    case ScreenOrientationLockLandscape:
-        attribute = static_cast<Qt::WidgetAttribute>(129);
-        break;
-    default:
-    case ScreenOrientationAuto:
-        attribute = static_cast<Qt::WidgetAttribute>(130);
-        break;
-#elif QT_VERSION < 0x050000
-    case ScreenOrientationLockPortrait:
-        attribute = Qt::WA_LockPortraitOrientation;
-        break;
-    case ScreenOrientationLockLandscape:
-        attribute = Qt::WA_LockLandscapeOrientation;
-        break;
-    default:
-    case ScreenOrientationAuto:
-        attribute = Qt::WA_AutoOrientation;
-        break;
-#else // Qt 5
-    // TODO: Implement for Qt 5
-    case ScreenOrientationLockPortrait:
-        break;
-    case ScreenOrientationLockLandscape:
-        break;
-    default:
-    case ScreenOrientationAuto:
-        break;
-#endif // QT_VERSION < 0x040702
-    };
-#if QT_VERSION < 0x050000
-    setAttribute(attribute, true);
-#endif
-}
-
-void MainWindow::showExpanded()
-{
-#if defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR)
-    showFullScreen();
-#elif defined(Q_WS_MAEMO_5)
-    showMaximized();
-#else
-    show();
-#endif
-}
-
-void MainWindow::onJavaScriptExecNeeded(const QString &js)
-{
-    ui->webView->page()->mainFrame()->evaluateJavaScript(js);
-}
-
-void MainWindow::onPluginWantsToBeAdded(const QString &pluginName, QObject *pluginObject,
const QString &pluginShortName)
-{
-    QString objectName = pluginShortName + "_native";
-    ui->webView->page()->mainFrame()->addToJavaScriptWindowObject( objectName,
pluginObject );
-    ui->webView->page()->mainFrame()->evaluateJavaScript( "Cordova.Qt.registerObject(
'" + pluginName + "', " + objectName + " )" );
-}
-
-void MainWindow::onWebViewAttributeChanged(QWebSettings::WebAttribute attribute, bool on)
-{
-    ui->webView->settings()->setAttribute(attribute, on);
-}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/938fe5c4/mainwindow.h
----------------------------------------------------------------------
diff --git a/mainwindow.h b/mainwindow.h
deleted file mode 100644
index f5428db..0000000
--- a/mainwindow.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  Copyright 2011 Wolfgang Koller - http://www.gofg.at/
- *
- *  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.
- */
-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include "src/cordova.h"
-#include <QWebSettings>
-#include <QMainWindow>
-
-namespace Ui {
-    class MainWindow;
-}
-
-class MainWindow : public QMainWindow
-{
-    Q_OBJECT
-public:
-    enum ScreenOrientation {
-        ScreenOrientationLockPortrait,
-        ScreenOrientationLockLandscape,
-        ScreenOrientationAuto
-    };
-
-    explicit MainWindow(QWidget *parent = 0);
-    virtual ~MainWindow();
-
-    // Note that this will only have an effect on Symbian and Fremantle.
-    void setOrientation(ScreenOrientation orientation);
-
-    void showExpanded();
-
-public slots:
-    void onJavaScriptExecNeeded(const QString &js);
-    void onPluginWantsToBeAdded(const QString &pluginName, QObject *pluginObject, const
QString &pluginShortName);
-    void onWebViewAttributeChanged(QWebSettings::WebAttribute attribute, bool on);
-
-private:
-    Ui::MainWindow *ui;
-};
-
-#endif // MAINWINDOW_H

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/938fe5c4/mainwindow.ui
----------------------------------------------------------------------
diff --git a/mainwindow.ui b/mainwindow.ui
deleted file mode 100644
index 27ae243..0000000
--- a/mainwindow.ui
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>600</width>
-    <height>562</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Cordova</string>
-  </property>
-  <widget class="QWidget" name="centralWidget">
-   <layout class="QGridLayout" name="mainLayout">
-    <property name="margin">
-     <number>0</number>
-    </property>
-    <item row="0" column="0">
-     <widget class="QWebView" name="webView">
-      <property name="url">
-       <url>
-        <string>about:blank</string>
-       </url>
-      </property>
-     </widget>
-    </item>
-   </layout>
-  </widget>
- </widget>
- <layoutdefault spacing="6" margin="11"/>
- <customwidgets>
-  <customwidget>
-   <class>QWebView</class>
-   <extends>QWidget</extends>
-   <header>QtWebKit/QWebView</header>
-  </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/938fe5c4/qml/cordova_wrapper.js
----------------------------------------------------------------------
diff --git a/qml/cordova_wrapper.js b/qml/cordova_wrapper.js
index ba164c4..ba73b90 100644
--- a/qml/cordova_wrapper.js
+++ b/qml/cordova_wrapper.js
@@ -1,5 +1,6 @@
 var pluginObjects = {}
 
+
 function addPlugin(pluginName, pluginObject) {
     pluginObjects[pluginName] = pluginObject
 }
@@ -27,3 +28,15 @@ function execMethod(pluginName, functionName, params) {
     return true
 }
 
+
+function execMethodOld(pluginName, functionName, params) {
+    if( typeof pluginObjects[pluginName][functionName] != "function" )
+        return false
+
+    var paramsString = JSON.stringify(params)
+    if (paramsString.charAt(0) == "[")
+        paramsString = paramsString.substring(1, paramsString.length-1)
+
+    eval("pluginObjects[pluginName][functionName]("+paramsString+")")
+    return true
+}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/938fe5c4/qml/main.qml
----------------------------------------------------------------------
diff --git a/qml/main.qml b/qml/main.qml
index c9e805f..b3ed538 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -1,38 +1,38 @@
-import QtQuick 2.0
-import QtWebKit 3.0
-import QtWebKit.experimental 3.0
+import QtQuick 1.1
+import QtWebKit 1.0
 import "cordova_wrapper.js" as CordovaWrapper
 
 WebView {
+
     id: webView
     width: 854
     height: 480
+    url: cordova.mainUrl
+    settings.javascriptEnabled: true
+    settings.localStorageDatabaseEnabled: true
+    settings.offlineStorageDatabaseEnabled: true
+    settings.localContentCanAccessRemoteUrls: true
+    javaScriptWindowObjects: [QtObject{
+        WebView.windowObjectName: "qmlWrapper"
+
+        function callPluginFunction(pluginName, functionName, parameters) {
+            parameters = eval("("+parameters+")")
+            CordovaWrapper.execMethodOld(pluginName, functionName, parameters)
+        }
+    }]
 
-
-    experimental.preferences.navigatorQtObjectEnabled: true
-    experimental.onMessageReceived: {
-        console.log("WebView received Message: " + message.data)
-        CordovaWrapper.messageHandler(message)
-    }
-    //Uncomment when it will be available
-    //experimental.setFlickableViewportEnabled: false
-    experimental.useTraditionalDesktopBehaviour: true
-
-
-    Component.onCompleted: {
-        webView.load(cordova.mainUrl)
-    }
-
-    onLoadSucceeded: cordova.loadFinished(true)
+    onLoadFinished: cordova.loadFinished(true)
     onLoadFailed: cordova.loadFinished(false)
 
     Connections {
         target: cordova
         onJavaScriptExecNeeded: {
-            webView.experimental.postMessage(JSON.stringify({messageType: "evalJS", jsData:
js}))
+            console.log("onJavaScriptExecNeeded: " + js)
+            webView.evaluateJavaScript(js)
         }
 
         onPluginWantsToBeAdded: {
+            console.log("onPluginWantsToBeAdded: " + pluginName)
             CordovaWrapper.addPlugin(pluginName, pluginObject)
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/938fe5c4/qml/main_harmattan.qml
----------------------------------------------------------------------
diff --git a/qml/main_harmattan.qml b/qml/main_harmattan.qml
new file mode 100644
index 0000000..1f6060d
--- /dev/null
+++ b/qml/main_harmattan.qml
@@ -0,0 +1,53 @@
+import QtQuick 1.1
+import com.nokia.meego 1.0
+import QtWebKit 1.0
+import "cordova_wrapper.js" as CordovaWrapper
+
+PageStackWindow {
+    id: appWindow
+    initialPage: mainPage
+    showToolBar: false
+
+    Page {
+        id: mainPage
+
+        WebView {
+
+            id: webView
+            anchors.fill: parent
+            //TODO: remove it later when toolbar problem will be fixed
+            anchors.topMargin: 16
+            url: cordova.mainUrl
+            settings.javascriptEnabled: true
+            settings.localStorageDatabaseEnabled: true
+            settings.offlineStorageDatabaseEnabled: true
+            settings.localContentCanAccessRemoteUrls: true
+            javaScriptWindowObjects: [QtObject{
+                WebView.windowObjectName: "qmlWrapper"
+
+                function callPluginFunction(pluginName, functionName, parameters) {
+                    parameters = eval("("+parameters+")")
+                    CordovaWrapper.execMethodOld(pluginName, functionName, parameters)
+                }
+            }]
+
+            onLoadFinished: cordova.loadFinished(true)
+            onLoadFailed: cordova.loadFinished(false)
+
+            Connections {
+                target: cordova
+                onJavaScriptExecNeeded: {
+                    console.log("onJavaScriptExecNeeded: " + js)
+                    webView.evaluateJavaScript(js)
+                }
+
+                onPluginWantsToBeAdded: {
+                    console.log("onPluginWantsToBeAdded: " + pluginName)
+                    CordovaWrapper.addPlugin(pluginName, pluginObject)
+                }
+            }
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/938fe5c4/qml/main_qt5.qml
----------------------------------------------------------------------
diff --git a/qml/main_qt5.qml b/qml/main_qt5.qml
new file mode 100644
index 0000000..c9e805f
--- /dev/null
+++ b/qml/main_qt5.qml
@@ -0,0 +1,39 @@
+import QtQuick 2.0
+import QtWebKit 3.0
+import QtWebKit.experimental 3.0
+import "cordova_wrapper.js" as CordovaWrapper
+
+WebView {
+    id: webView
+    width: 854
+    height: 480
+
+
+    experimental.preferences.navigatorQtObjectEnabled: true
+    experimental.onMessageReceived: {
+        console.log("WebView received Message: " + message.data)
+        CordovaWrapper.messageHandler(message)
+    }
+    //Uncomment when it will be available
+    //experimental.setFlickableViewportEnabled: false
+    experimental.useTraditionalDesktopBehaviour: true
+
+
+    Component.onCompleted: {
+        webView.load(cordova.mainUrl)
+    }
+
+    onLoadSucceeded: cordova.loadFinished(true)
+    onLoadFailed: cordova.loadFinished(false)
+
+    Connections {
+        target: cordova
+        onJavaScriptExecNeeded: {
+            webView.experimental.postMessage(JSON.stringify({messageType: "evalJS", jsData:
js}))
+        }
+
+        onPluginWantsToBeAdded: {
+            CordovaWrapper.addPlugin(pluginName, pluginObject)
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/938fe5c4/src/cordova.cpp
----------------------------------------------------------------------
diff --git a/src/cordova.cpp b/src/cordova.cpp
index b33e5cf..747caa4 100644
--- a/src/cordova.cpp
+++ b/src/cordova.cpp
@@ -18,8 +18,11 @@
 #include "pluginregistry.h"
 #include "cwebpage.h"
 
+#include <qplatformdefs.h>
+
 #include <QDebug>
 #include <QXmlStreamReader>
+#include <QApplication>
 
 Cordova *Cordova::m_instance = 0;
 
@@ -27,7 +30,11 @@ Cordova::Cordova(QObject *parent) : QObject(parent) {
 
 
     // Determine index file path
-    m_workingDir = QDir::current();
+    m_workingDir = QApplication::applicationDirPath();
+#ifdef MEEGO_EDITION_HARMATTAN
+    m_workingDir.cdUp();
+#endif
+    qDebug() << "Using" << m_workingDir.absolutePath() << "as working dir";
     QDir wwwDir( m_workingDir );
     wwwDir.cd( "www" );
 
@@ -98,12 +105,17 @@ void Cordova::loadFinished( bool ok ) {
     execJS( "Cordova.deviceready();" );
 }
 
+
+QString Cordova::workingDir() const
+{
+    return m_workingDir.absolutePath();
+}
+
 void Cordova::execJS(const QString &js)
 {
     emit javaScriptExecNeeded(js);
 }
 
-
 QString Cordova::mainUrl() const
 {
     return m_mainUrl;

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/938fe5c4/src/cordova.h
----------------------------------------------------------------------
diff --git a/src/cordova.h b/src/cordova.h
index 3a060aa..073d391 100644
--- a/src/cordova.h
+++ b/src/cordova.h
@@ -35,6 +35,7 @@ class Cordova : public QObject
 public:
     static Cordova *instance();
 
+    QString workingDir() const;
     QString mainUrl() const;
 
 signals:

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/938fe5c4/www/basic.js
----------------------------------------------------------------------
diff --git a/www/basic.js b/www/basic.js
index 58b0671..70258e2 100644
--- a/www/basic.js
+++ b/www/basic.js
@@ -6,17 +6,17 @@ var vibration_length = 1000;
 
 function get(id)
 {
-	return document.getElementById(id);
+    return document.getElementById(id);
 }
 
-function init() 
+function init()
 {
     navigator.accelerometer.watchAcceleration(function (v) {
         get("accel_val").innerHTML = v.x + '   ' + v.y + '    ' + v.z;
     }, null, {});
 }
 
-function ping_google() 
+function ping_google()
 {
     navigator.network.isReachable('http://www.google.com', function (state) {
         if (state == NetworkStatus.NOT_REACHABLE) {
@@ -29,7 +29,7 @@ function ping_google()
 
 function test_vibra()
 {
-	navigator.notification.vibrate(vibration_length);
+    navigator.notification.vibrate(vibration_length);
     navigator.notification.beep(5);
 }
 
@@ -123,6 +123,6 @@ function fileError( p_fileError ) {
  * Register for the device ready event
  */
 document.addEventListener( "deviceready", function() {
-                              get( "debug_output" ).innerHTML = "Device Ready!";
+                              get( "debug_output" ).innerHTML += "Device Ready!<br/>";
                           }, false );
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/938fe5c4/www/index.html
----------------------------------------------------------------------
diff --git a/www/index.html b/www/index.html
index 3910318..f975909 100644
--- a/www/index.html
+++ b/www/index.html
@@ -28,7 +28,7 @@
         <br />
         <input type="button" value="RequestFileSystem" onclick="test_requestFileSystem();">
         <br />
-        <div id="debug_output"> Unknown </div>
+        <div id="debug_output"> </div>
         <br />
         <input type="button" value="getCurrentPosition" onclick="getCurrentPosition();">
         <br />

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/938fe5c4/www/js/cordova.qt.js
----------------------------------------------------------------------
diff --git a/www/js/cordova.qt.js b/www/js/cordova.qt.js
index 9069995..7cafa0c 100644
--- a/www/js/cordova.qt.js
+++ b/www/js/cordova.qt.js
@@ -26,11 +26,6 @@ Cordova.Qt.exec = function( successCallback, errorCallback, pluginName,
function
         return false;
     }
 
-    // Check if we can find the function
-    if( typeof Cordova.Qt.objects[pluginName][functionName] != "function" ) {
-        return false;
-    }
-
     // Store a reference to the callback functions
     var scId = Cordova.callbacks.length;
     var ecId = scId + 1;
@@ -40,13 +35,7 @@ Cordova.Qt.exec = function( successCallback, errorCallback, pluginName,
function
     parameters.unshift( ecId );
     parameters.unshift( scId );
 
-    // Call the function
-    /*debug.log( "Call: " + pluginName + " / " + functionName );
-    debug.log( "P-Obj: " + (typeof Cordova.plugins[pluginName]) );
-    debug.log( "P-Func: " + (typeof Cordova.plugins[pluginName][functionName]) );*/
-    //Cordova.plugins[pluginName][functionName](scId, ecId, parameters);
-    Cordova.Qt.objects[pluginName][functionName].apply(this, parameters);
-
+    window.qmlWrapper.callPluginFunction(pluginName, functionName, JSON.stringify(parameters))
     return true;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-qt/blob/938fe5c4/www/js/file.js
----------------------------------------------------------------------
diff --git a/www/js/file.js b/www/js/file.js
index 068e7cc..30b43cc 100644
--- a/www/js/file.js
+++ b/www/js/file.js
@@ -497,7 +497,7 @@ LocalFileSystem.TEMPORARY = 0;
 LocalFileSystem.PERSISTENT = 1;
 
 LocalFileSystem.prototype.requestFileSystem = function( type, size, successCallback, errorCallback
) {
-        Cordova.exec(successCallback, errorCallback, "com.cordova.File", "requestFileSystem",
[type, size]);
+        Cordova.exec(successCallback, errorCallback, "com.cordova.File", "requestFileSystem",
[type]);
 }
 LocalFileSystem.prototype.resolveLocalFileSystemURL = function( url, successCallback, errorCallback
) {
         Cordova.exec(successCallback, errorCallback, "com.cordova.File", "resolveLocalFileSystemURL",
[url]);


Mime
View raw message