summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/platforms/qnx/qnx.pro80
-rw-r--r--src/plugins/platforms/qnx/qqnxabstractnavigator.cpp74
-rw-r--r--src/plugins/platforms/qnx/qqnxabstractnavigator.h66
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.cpp87
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.h33
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatorbps.cpp74
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatorbps.h62
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatorpps.cpp192
-rw-r--r--src/plugins/platforms/qnx/qqnxnavigatorpps.h73
-rw-r--r--src/plugins/platforms/qnx/qqnxservices.cpp17
-rw-r--r--src/plugins/platforms/qnx/qqnxservices.h7
11 files changed, 665 insertions, 100 deletions
diff --git a/src/plugins/platforms/qnx/qnx.pro b/src/plugins/platforms/qnx/qnx.pro
index 940c4639db..9c7819a503 100644
--- a/src/plugins/platforms/qnx/qnx.pro
+++ b/src/plugins/platforms/qnx/qnx.pro
@@ -11,6 +11,13 @@ contains(QT_CONFIG, opengles2) {
# Uncomment this to build with support for IMF once it becomes available in the BBNDK
#CONFIG += qqnx_imf
+# Uncomment this to build with support for PPS based platform integration
+#CONFIG += qqnx_pps
+
+CONFIG(blackberry) {
+ CONFIG += qqnx_pps
+}
+
# Uncomment these to enable debugging output for various aspects of the plugin
#DEFINES += QQNXBUFFER_DEBUG
#DEFINES += QQNXCLIPBOARD_DEBUG
@@ -28,6 +35,7 @@ contains(QT_CONFIG, opengles2) {
#DEFINES += QQNXSCREENEVENT_DEBUG
#DEFINES += QQNXVIRTUALKEYBOARD_DEBUG
#DEFINES += QQNXWINDOW_DEBUG
+#DEFINES += QQNXNAVIGATOR_DEBUG
SOURCES = main.cpp \
qqnxbuffer.cpp \
@@ -38,20 +46,11 @@ SOURCES = main.cpp \
qqnxrasterbackingstore.cpp \
qqnxrootwindow.cpp \
qqnxscreeneventhandler.cpp \
- qqnxnativeinterface.cpp
-
-CONFIG(blackberry) {
- SOURCES += qqnxnavigatoreventhandler.cpp \
- qqnxnavigatoreventnotifier.cpp \
- qqnxvirtualkeyboard.cpp \
- qqnxclipboard.cpp \
- qqnxabstractvirtualkeyboard.cpp
-}
-
-contains(QT_CONFIG, opengles2) {
- SOURCES += qqnxglcontext.cpp \
- qqnxglbackingstore.cpp
-}
+ qqnxnativeinterface.cpp \
+ qqnxnavigatoreventhandler.cpp \
+ qqnxabstractnavigator.cpp \
+ qqnxabstractvirtualkeyboard.cpp \
+ qqnxservices.cpp
HEADERS = main.h \
qqnxbuffer.h \
@@ -63,25 +62,46 @@ HEADERS = main.h \
qqnxrasterbackingstore.h \
qqnxrootwindow.h \
qqnxscreeneventhandler.h \
- qqnxnativeinterface.h
+ qqnxnativeinterface.h \
+ qqnxnavigatoreventhandler.h \
+ qqnxabstractnavigator.h \
+ qqnxabstractvirtualkeyboard.h \
+ qqnxservices.h
-CONFIG(blackberry) {
- HEADERS += qqnxnavigatoreventhandler.h \
- qqnxnavigatoreventnotifier.h \
- qqnxvirtualkeyboard.h \
- qqnxclipboard.h \
- qqnxabstractvirtualkeyboard.h
-}
+LIBS += -lscreen
contains(QT_CONFIG, opengles2) {
+ SOURCES += qqnxglcontext.cpp \
+ qqnxglbackingstore.cpp
+
HEADERS += qqnxglcontext.h \
qqnxglbackingstore.h
-}
+ LIBS += -lEGL
+}
CONFIG(blackberry) {
- SOURCES += qqnxservices.cpp
- HEADERS += qqnxservices.h
+ SOURCES += qqnxnavigatorbps.cpp
+
+ HEADERS += qqnxnavigatorbps.h
+
+ LIBS += -lbps
+}
+
+CONFIG(qqnx_pps) {
+ DEFINES += QQNX_PPS
+
+ SOURCES += qqnxnavigatorpps.cpp \
+ qqnxnavigatoreventnotifier.cpp \
+ qqnxvirtualkeyboard.cpp \
+ qqnxclipboard.cpp
+
+ HEADERS += qqnxnavigatorpps.h \
+ qqnxnavigatoreventnotifier.h \
+ qqnxvirtualkeyboard.h \
+ qqnxclipboard.h
+
+ LIBS += -lpps -lclipboard
CONFIG(qqnx_imf) {
DEFINES += QQNX_IMF
@@ -97,16 +117,6 @@ OTHER_FILES += qnx.json
QMAKE_CXXFLAGS += -I./private
-LIBS += -lscreen
-
-contains(QT_CONFIG, opengles2) {
- LIBS += -lEGL
-}
-
-CONFIG(blackberry) {
- LIBS += -lbps -lpps -lclipboard
-}
-
include (../../../platformsupport/eglconvenience/eglconvenience.pri)
include (../../../platformsupport/fontdatabases/fontdatabases.pri)
diff --git a/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp b/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp
new file mode 100644
index 0000000000..f57f49df9c
--- /dev/null
+++ b/src/plugins/platforms/qnx/qqnxabstractnavigator.cpp
@@ -0,0 +1,74 @@
+/***************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqnxabstractnavigator.h"
+
+#include <QDebug>
+#include <QUrl>
+
+QT_BEGIN_NAMESPACE
+
+QQnxAbstractNavigator::QQnxAbstractNavigator(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QQnxAbstractNavigator::~QQnxAbstractNavigator()
+{
+}
+
+bool QQnxAbstractNavigator::invokeUrl(const QUrl &url)
+{
+ if (!url.isValid() || url.isRelative())
+ return false;
+
+ // not using QUrl::toEncoded() because for e.g. camera:// it creates camera:
+ // which is not recognized by the navigator anymore
+ const bool result = requestInvokeUrl(url.toString().toUtf8());
+
+#if defined(QQNXNAVIGATOR_DEBUG)
+ qDebug() << Q_FUNC_INFO << "url=" << url << "result=" << result;
+#endif
+
+ return result;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxabstractnavigator.h b/src/plugins/platforms/qnx/qqnxabstractnavigator.h
new file mode 100644
index 0000000000..969366c925
--- /dev/null
+++ b/src/plugins/platforms/qnx/qqnxabstractnavigator.h
@@ -0,0 +1,66 @@
+/***************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQNXABSTRACTNAVIGATOR_H
+#define QQNXABSTRACTNAVIGATOR_H
+
+#include <QObject>
+
+QT_BEGIN_NAMESPACE
+
+class QUrl;
+
+class QQnxAbstractNavigator : public QObject
+{
+ Q_OBJECT
+public:
+ explicit QQnxAbstractNavigator(QObject *parent = 0);
+ ~QQnxAbstractNavigator();
+
+ bool invokeUrl(const QUrl &url);
+
+protected:
+ virtual bool requestInvokeUrl(const QByteArray &encodedUrl) = 0;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQNXABSTRACTNAVIGATOR_H
diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp
index 8a99155f1b..e75b3ef7a9 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.cpp
+++ b/src/plugins/platforms/qnx/qqnxintegration.cpp
@@ -46,20 +46,28 @@
#include "qqnxscreen.h"
#include "qqnxscreeneventhandler.h"
#include "qqnxwindow.h"
-
-#ifdef Q_OS_BLACKBERRY
#include "qqnxnavigatoreventhandler.h"
-#include "qqnxnavigatoreventnotifier.h"
-#include "qqnxvirtualkeyboard.h"
-#include "qqnxclipboard.h"
+#include "qqnxabstractnavigator.h"
+#include "qqnxabstractvirtualkeyboard.h"
#include "qqnxservices.h"
-#if defined(QQnx_IMF)
-#include "qqnxinputcontext_imf.h"
-#else
-#include "qqnxinputcontext_noimf.h"
+#if defined(Q_OS_BLACKBERRY)
+#include "qqnxnavigatorbps.h"
+#elif defined(QQNX_PPS)
+#include "qqnxnavigatorpps.h"
+#endif
+
+#if defined(QQNX_PPS)
+# include "qqnxnavigatoreventnotifier.h"
+# include "qqnxvirtualkeyboard.h"
+# include "qqnxclipboard.h"
+
+# if defined(QQNX_IMF)
+# include "qqnxinputcontext_imf.h"
+# else
+# include "qqnxinputcontext_noimf.h"
+# endif
#endif
-#endif // Q_OS_BLACKBERRY
#include "private/qgenericunixfontdatabase_p.h"
#include "private/qgenericunixeventdispatcher_p.h"
@@ -67,7 +75,7 @@
#include <QtGui/QPlatformWindow>
#include <QtGui/QWindowSystemInterface>
-#ifndef QT_NO_OPENGL
+#if !defined(QT_NO_OPENGL)
#include "qqnxglbackingstore.h"
#include "qqnxglcontext.h"
@@ -87,21 +95,21 @@ QMutex QQnxIntegration::ms_windowMapperMutex;
QQnxIntegration::QQnxIntegration()
: QPlatformIntegration()
, m_eventThread(0)
-#ifdef Q_OS_BLACKBERRY
, m_navigatorEventHandler(new QQnxNavigatorEventHandler())
- , m_navigatorEventNotifier(0)
, m_virtualKeyboard(0)
+#if defined(QQNX_PPS)
+ , m_navigatorEventNotifier(0)
, m_inputContext(0)
- , m_services(0)
#endif
+ , m_services(0)
, m_fontDatabase(new QGenericUnixFontDatabase())
-#ifndef QT_NO_OPENGL
+#if !defined(QT_NO_OPENGL)
, m_paintUsingOpenGL(false)
#endif
, m_eventDispatcher(createUnixEventDispatcher())
, m_nativeInterface(new QQnxNativeInterface())
, m_screenEventHandler(new QQnxScreenEventHandler())
-#ifndef QT_NO_CLIPBOARD
+#if !defined(QT_NO_CLIPBOARD)
, m_clipboard(0)
#endif
{
@@ -115,7 +123,7 @@ QQnxIntegration::QQnxIntegration()
qFatal("QQnx: failed to connect to composition manager, errno=%d", errno);
}
-#ifdef Q_OS_BLACKBERRY
+#if defined(QQNX_PPS)
// Create/start navigator event notifier
m_navigatorEventNotifier = new QQnxNavigatorEventNotifier(m_navigatorEventHandler);
@@ -127,7 +135,7 @@ QQnxIntegration::QQnxIntegration()
// Create displays for all possible screens (which may not be attached)
createDisplays();
-#ifndef QT_NO_OPENGL
+#if !defined(QT_NO_OPENGL)
// Initialize global OpenGL resources
QQnxGLContext::initialize();
#endif
@@ -136,7 +144,7 @@ QQnxIntegration::QQnxIntegration()
m_eventThread = new QQnxEventThread(m_screenContext, m_screenEventHandler);
m_eventThread->start();
-#ifdef Q_OS_BLACKBERRY
+#if defined(QQNX_PPS)
// Create/start the keyboard class.
m_virtualKeyboard = new QQnxVirtualKeyboard();
@@ -150,10 +158,17 @@ QQnxIntegration::QQnxIntegration()
// Set up the input context
m_inputContext = new QQnxInputContext(*m_virtualKeyboard);
+#endif
- // Create services handling class
- m_services = new QQnxServices;
+#if defined(Q_OS_BLACKBERRY)
+ m_navigator = new QQnxNavigatorBps();
+#elif defined(QQNX_PPS)
+ m_navigator = new QQnxNavigatorPps();
#endif
+
+ // Create services handling class
+ if (m_navigator)
+ m_services = new QQnxServices(m_navigator);
}
QQnxIntegration::~QQnxIntegration()
@@ -165,22 +180,24 @@ QQnxIntegration::~QQnxIntegration()
delete m_nativeInterface;
-#ifdef Q_OS_BLACKBERRY
+#if defined(QQNX_PPS)
// Destroy input context
delete m_inputContext;
+#endif
// Destroy the keyboard class.
delete m_virtualKeyboard;
-#ifndef QT_NO_CLIPBOARD
+#if !defined(QT_NO_CLIPBOARD)
// Delete the clipboard
delete m_clipboard;
#endif
// Stop/destroy navigator event notifier
+#if defined(QQNX_PPS)
delete m_navigatorEventNotifier;
- delete m_navigatorEventHandler;
#endif
+ delete m_navigatorEventHandler;
// Stop/destroy event thread
delete m_eventThread;
@@ -192,15 +209,16 @@ QQnxIntegration::~QQnxIntegration()
// Close connection to QNX composition manager
screen_destroy_context(m_screenContext);
-#ifndef QT_NO_OPENGL
+#if !defined(QT_NO_OPENGL)
// Cleanup global OpenGL resources
QQnxGLContext::shutdown();
#endif
// Destroy services class
-#ifdef Q_OS_BLACKBERRY
delete m_services;
-#endif
+
+ // Destroy navigator interface
+ delete m_navigator;
#if defined(QQNXINTEGRATION_DEBUG)
qDebug() << "QQnx: platform plugin shutdown end";
@@ -235,7 +253,7 @@ QPlatformBackingStore *QQnxIntegration::createPlatformBackingStore(QWindow *wind
#if defined(QQNXINTEGRATION_DEBUG)
qDebug() << Q_FUNC_INFO;
#endif
-#ifndef QT_NO_OPENGL
+#if !defined(QT_NO_OPENGL)
if (paintUsingOpenGL())
return new QQnxGLBackingStore(window);
else
@@ -243,7 +261,7 @@ QPlatformBackingStore *QQnxIntegration::createPlatformBackingStore(QWindow *wind
return new QQnxRasterBackingStore(window);
}
-#ifndef QT_NO_OPENGL
+#if !defined(QT_NO_OPENGL)
QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
{
#if defined(QQNXINTEGRATION_DEBUG)
@@ -253,7 +271,7 @@ QPlatformOpenGLContext *QQnxIntegration::createPlatformOpenGLContext(QOpenGLCont
}
#endif
-#ifdef Q_OS_BLACKBERRY
+#if defined(QQNX_PPS)
QPlatformInputContext *QQnxIntegration::inputContext() const
{
#if defined(QQNXINTEGRATION_DEBUG)
@@ -292,15 +310,18 @@ QPlatformNativeInterface *QQnxIntegration::nativeInterface() const
return m_nativeInterface;
}
-#ifndef QT_NO_CLIPBOARD
+#if !defined(QT_NO_CLIPBOARD)
QPlatformClipboard *QQnxIntegration::clipboard() const
{
#if defined(QQNXINTEGRATION_DEBUG)
qDebug() << Q_FUNC_INFO;
#endif
+
+#if defined(QQNX_PPS)
if (!m_clipboard) {
m_clipboard = new QQnxClipboard;
}
+#endif
return m_clipboard;
}
#endif
@@ -316,12 +337,10 @@ QVariant QQnxIntegration::styleHint(QPlatformIntegration::StyleHint hint) const
return QPlatformIntegration::styleHint(hint);
}
-#ifdef Q_OS_BLACKBERRY
QPlatformServices * QQnxIntegration::services() const
{
return m_services;
}
-#endif
QWindow *QQnxIntegration::window(screen_window_t qnxWindow)
{
@@ -387,9 +406,7 @@ void QQnxIntegration::createDisplays()
QObject::connect(m_screenEventHandler, SIGNAL(windowClosed(void *)),
screen, SLOT(windowClosed(void *)));
-#ifdef Q_OS_BLACKBERRY
QObject::connect(m_navigatorEventHandler, SIGNAL(rotationChanged(int)), screen, SLOT(setRotation(int)));
-#endif
}
}
diff --git a/src/plugins/platforms/qnx/qqnxintegration.h b/src/plugins/platforms/qnx/qqnxintegration.h
index b46c40680e..c578938db2 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.h
+++ b/src/plugins/platforms/qnx/qqnxintegration.h
@@ -55,16 +55,17 @@ class QQnxNativeInterface;
class QQnxWindow;
class QQnxScreen;
class QQnxScreenEventHandler;
-
-#ifdef Q_OS_BLACKBERRY
-class QQnxInputContext;
class QQnxNavigatorEventHandler;
-class QQnxNavigatorEventNotifier;
+class QQnxAbstractNavigator;
class QQnxAbstractVirtualKeyboard;
class QQnxServices;
+
+#if defined(QQNX_PPS)
+class QQnxInputContext;
+class QQnxNavigatorEventNotifier;
#endif
-#ifndef QT_NO_CLIPBOARD
+#if !defined(QT_NO_CLIPBOARD)
class QQnxClipboard;
#endif
@@ -82,11 +83,11 @@ public:
QPlatformWindow *createPlatformWindow(QWindow *window) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
-#ifndef QT_NO_OPENGL
+#if !defined(QT_NO_OPENGL)
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
#endif
-#ifdef Q_OS_BLACKBERRY
+#if defined(QQNX_PPS)
QPlatformInputContext *inputContext() const;
#endif
@@ -98,19 +99,17 @@ public:
QPlatformNativeInterface *nativeInterface() const;
-#ifndef QT_NO_CLIPBOARD
+#if !defined(QT_NO_CLIPBOARD)
QPlatformClipboard *clipboard() const;
#endif
QVariant styleHint(StyleHint hint) const;
-#ifndef QT_NO_OPENGL
+#if !defined(QT_NO_OPENGL)
bool paintUsingOpenGL() const { return m_paintUsingOpenGL; }
#endif
-#ifdef Q_OS_BLACKBERRY
QPlatformServices *services() const;
-#endif
static QWindow *window(screen_window_t qnxWindow);
@@ -124,25 +123,27 @@ private:
screen_context_t m_screenContext;
QQnxEventThread *m_eventThread;
-#ifdef Q_OS_BLACKBERRY
QQnxNavigatorEventHandler *m_navigatorEventHandler;
- QQnxNavigatorEventNotifier *m_navigatorEventNotifier;
QQnxAbstractVirtualKeyboard *m_virtualKeyboard;
+#if defined(QQNX_PPS)
+ QQnxNavigatorEventNotifier *m_navigatorEventNotifier;
QQnxInputContext *m_inputContext;
- QQnxServices *m_services;
#endif
+ QQnxServices *m_services;
QPlatformFontDatabase *m_fontDatabase;
-#ifndef QT_NO_OPENGL
+#if !defined(QT_NO_OPENGL)
bool m_paintUsingOpenGL;
#endif
QAbstractEventDispatcher *m_eventDispatcher;
QQnxNativeInterface *m_nativeInterface;
QList<QQnxScreen*> m_screens;
QQnxScreenEventHandler *m_screenEventHandler;
-#ifndef QT_NO_CLIPBOARD
+#if !defined(QT_NO_CLIPBOARD)
mutable QQnxClipboard* m_clipboard;
#endif
+ QQnxAbstractNavigator *m_navigator;
+
static QQnxWindowMapper ms_windowMapper;
static QMutex ms_windowMapperMutex;
diff --git a/src/plugins/platforms/qnx/qqnxnavigatorbps.cpp b/src/plugins/platforms/qnx/qqnxnavigatorbps.cpp
new file mode 100644
index 0000000000..78ef3e890c
--- /dev/null
+++ b/src/plugins/platforms/qnx/qqnxnavigatorbps.cpp
@@ -0,0 +1,74 @@
+/***************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqnxnavigatorbps.h"
+
+#include <QDebug>
+
+#include <bps/navigator.h>
+
+QT_BEGIN_NAMESPACE
+
+QQnxNavigatorBps::QQnxNavigatorBps(QObject *parent)
+ : QQnxAbstractNavigator(parent)
+{
+ bps_initialize();
+}
+
+QQnxNavigatorBps::~QQnxNavigatorBps()
+{
+ bps_shutdown();
+}
+
+bool QQnxNavigatorBps::requestInvokeUrl(const QByteArray &encodedUrl)
+{
+ char *error = 0;
+
+ int ret = navigator_invoke(encodedUrl, &error);
+ if (error) {
+ qWarning() << Q_FUNC_INFO << "error=" << error;
+ bps_free(error);
+ }
+
+ return (ret == BPS_SUCCESS);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxnavigatorbps.h b/src/plugins/platforms/qnx/qqnxnavigatorbps.h
new file mode 100644
index 0000000000..db5c291a96
--- /dev/null
+++ b/src/plugins/platforms/qnx/qqnxnavigatorbps.h
@@ -0,0 +1,62 @@
+/***************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQNXNAVIGATORBPS_H
+#define QQNXNAVIGATORBPS_H
+
+#include "qqnxabstractnavigator.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQnxNavigatorBps : public QQnxAbstractNavigator
+{
+ Q_OBJECT
+public:
+ explicit QQnxNavigatorBps(QObject *parent = 0);
+ ~QQnxNavigatorBps();
+
+protected:
+ bool requestInvokeUrl(const QByteArray &encodedUrl);
+};
+
+QT_END_NAMESPACE
+
+#endif // QQNXNAVIGATORBPS_H
diff --git a/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp
new file mode 100644
index 0000000000..cce817d1ed
--- /dev/null
+++ b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp
@@ -0,0 +1,192 @@
+/***************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqnxnavigatorpps.h"
+
+#include <QDebug>
+#include <private/qcore_unix_p.h>
+
+static const char *navigatorControlPath = "/pps/services/navigator/control";
+static const int ppsBufferSize = 4096;
+
+QT_BEGIN_NAMESPACE
+
+QQnxNavigatorPps::QQnxNavigatorPps(QObject *parent)
+ : QQnxAbstractNavigator(parent)
+ , m_fd(-1)
+{
+}
+
+QQnxNavigatorPps::~QQnxNavigatorPps()
+{
+ // close connection to navigator
+ if (m_fd != -1)
+ qt_safe_close(m_fd);
+}
+
+bool QQnxNavigatorPps::openPpsConnection()
+{
+ if (m_fd != -1)
+ return true;
+
+ // open connection to navigator
+ errno = 0;
+ m_fd = qt_safe_open(navigatorControlPath, O_RDWR);
+ if (m_fd == -1) {
+ qWarning("QQNX: failed to open navigator pps, errno=%d", errno);
+ return false;
+ }
+
+#if defined(QQNXNAVIGATOR_DEBUG)
+ qDebug() << Q_FUNC_INFO << "successfully connected to Navigator. fd=" << m_fd;
+#endif
+
+ return true;
+}
+
+bool QQnxNavigatorPps::requestInvokeUrl(const QByteArray &encodedUrl)
+{
+ if (!openPpsConnection())
+ return false;
+
+ return sendPpsMessage("invoke", encodedUrl);
+}
+
+bool QQnxNavigatorPps::sendPpsMessage(const QByteArray &message, const QByteArray &data)
+{
+ QByteArray ppsMessage = "msg::" + message;
+
+ if (!data.isEmpty())
+ ppsMessage += "\ndat::" + data;
+
+ ppsMessage += "\n";
+
+#if defined(QQNXNAVIGATOR_DEBUG)
+ qDebug() << Q_FUNC_INFO << "sending PPS message:\n" << ppsMessage;
+#endif
+
+ // send pps message to navigator
+ errno = 0;
+ int bytes = qt_safe_write(m_fd, ppsMessage.constData(), ppsMessage.size());
+ if (bytes == -1)
+ qFatal("QQNX: failed to write navigator pps, errno=%d", errno);
+
+ // allocate buffer for pps data
+ char buffer[ppsBufferSize];
+
+ // attempt to read pps data
+ do {
+ errno = 0;
+ bytes = qt_safe_read(m_fd, buffer, ppsBufferSize - 1);
+ if (bytes == -1)
+ qFatal("QQNX: failed to read navigator pps, errno=%d", errno);
+ } while (bytes == 0);
+
+ // ensure data is null terminated
+ buffer[bytes] = '\0';
+
+#if defined(QQNXNAVIGATOR_DEBUG)
+ qDebug() << Q_FUNC_INFO << "received PPS message:\n" << buffer;
+#endif
+
+ // process received message
+ QByteArray ppsData(buffer);
+ QHash<QByteArray, QByteArray> responseFields;
+ parsePPS(ppsData, responseFields);
+
+ if (responseFields.contains("res") && responseFields.value("res") == message) {
+ if (responseFields.contains("err")) {
+ qCritical() << "navigator responded with error: " << responseFields.value("err");
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void QQnxNavigatorPps::parsePPS(const QByteArray &ppsData, QHash<QByteArray, QByteArray> &messageFields)
+{
+#if defined(QQNXNAVIGATOR_DEBUG)
+ qDebug() << "PPS: data=" << ppsData;
+#endif
+
+ // tokenize pps data into lines
+ QList<QByteArray> lines = ppsData.split('\n');
+
+ // validate pps object
+ if (lines.size() == 0 || lines.at(0) != "@control") {
+ qFatal("QQNX: unrecognized pps object, data=%s", ppsData.constData());
+ }
+
+ // parse pps object attributes and extract values
+ for (int i = 1; i < lines.size(); i++) {
+
+ // tokenize current attribute
+ const QByteArray &attr = lines.at(i);
+
+#if defined(QQNXNAVIGATOR_DEBUG)
+ qDebug() << "PPS: attr=" << attr;
+#endif
+
+ int firstColon = attr.indexOf(':');
+ if (firstColon == -1) {
+ // abort - malformed attribute
+ continue;
+ }
+
+ int secondColon = attr.indexOf(':', firstColon + 1);
+ if (secondColon == -1) {
+ // abort - malformed attribute
+ continue;
+ }
+
+ QByteArray key = attr.left(firstColon);
+ QByteArray value = attr.mid(secondColon + 1);
+
+#if defined(QQNXNAVIGATOR_DEBUG)
+ qDebug() << "PPS: key=" << key;
+ qDebug() << "PPS: val=" << value;
+#endif
+ messageFields[key] = value;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxnavigatorpps.h b/src/plugins/platforms/qnx/qqnxnavigatorpps.h
new file mode 100644
index 0000000000..02ad0cc18d
--- /dev/null
+++ b/src/plugins/platforms/qnx/qqnxnavigatorpps.h
@@ -0,0 +1,73 @@
+/***************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQNXNAVIGATORPPS_H
+#define QQNXNAVIGATORPPS_H
+
+#include "qqnxabstractnavigator.h"
+
+QT_BEGIN_NAMESPACE
+
+template <typename K, typename V> class QHash;
+
+class QQnxNavigatorPps : public QQnxAbstractNavigator
+{
+ Q_OBJECT
+public:
+ explicit QQnxNavigatorPps(QObject *parent = 0);
+ ~QQnxNavigatorPps();
+
+protected:
+ bool requestInvokeUrl(const QByteArray &encodedUrl);
+
+private:
+ bool openPpsConnection();
+
+ bool sendPpsMessage(const QByteArray &message, const QByteArray &data);
+ void parsePPS(const QByteArray &ppsData, QHash<QByteArray, QByteArray> &messageFields);
+
+private:
+ int m_fd;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQNXNAVIGATORPPS_H
diff --git a/src/plugins/platforms/qnx/qqnxservices.cpp b/src/plugins/platforms/qnx/qqnxservices.cpp
index a1a27906ae..b02dd25527 100644
--- a/src/plugins/platforms/qnx/qqnxservices.cpp
+++ b/src/plugins/platforms/qnx/qqnxservices.cpp
@@ -41,21 +41,17 @@
#include "qqnxservices.h"
-#include <bps/navigator.h>
-#include <stdbool.h>
-#include <sys/platform.h>
-#include <QUrl>
+#include "qqnxabstractnavigator.h"
QT_BEGIN_NAMESPACE
-QQnxServices::QQnxServices()
+QQnxServices::QQnxServices(QQnxAbstractNavigator *navigator)
+ : m_navigator(navigator)
{
- bps_initialize();
}
QQnxServices::~QQnxServices()
{
- bps_shutdown();
}
bool QQnxServices::openUrl(const QUrl &url)
@@ -70,12 +66,7 @@ bool QQnxServices::openDocument(const QUrl &url)
bool QQnxServices::navigatorInvoke(const QUrl &url)
{
- if (!url.isValid() || url.isRelative())
- return false;
-
- int ret = navigator_invoke(url.toString().toUtf8(), 0);
-
- return (ret == BPS_SUCCESS);
+ return m_navigator->invokeUrl(url);
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxservices.h b/src/plugins/platforms/qnx/qqnxservices.h
index 36eb8edf65..fe7c014047 100644
--- a/src/plugins/platforms/qnx/qqnxservices.h
+++ b/src/plugins/platforms/qnx/qqnxservices.h
@@ -46,10 +46,12 @@
QT_BEGIN_NAMESPACE
+class QQnxAbstractNavigator;
+
class QQnxServices : public QPlatformServices
{
public:
- QQnxServices();
+ explicit QQnxServices(QQnxAbstractNavigator *navigator);
~QQnxServices();
bool openUrl(const QUrl &url);
@@ -57,6 +59,9 @@ public:
private:
bool navigatorInvoke(const QUrl &url);
+
+private:
+ QQnxAbstractNavigator *m_navigator;
};
QT_END_NAMESPACE