Remove remaining support for Blackberry
The platform is no longer supported or actively maintained, and is in the way for improvements to the Unix event dispatcher and QProcess implementations. Change-Id: I3935488ca12e2139ea5f46068d7665a453e20526 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
4
configure
vendored
@ -2756,7 +2756,7 @@ Additional options:
|
||||
-warnings-are-errors Make warnings be treated as errors
|
||||
(enabled if -developer-build is active)
|
||||
|
||||
QNX/Blackberry options:
|
||||
QNX options:
|
||||
|
||||
-no-slog2 .......... Do not compile with slog2 support.
|
||||
-slog2 ............. Compile with slog2 support.
|
||||
@ -2999,7 +2999,7 @@ case "$XPLATFORM" in
|
||||
*win32-g++*)
|
||||
XPLATFORM_MINGW=yes
|
||||
;;
|
||||
*qnx-*|*blackberry-*)
|
||||
*qnx-*)
|
||||
XPLATFORM_QNX=yes
|
||||
;;
|
||||
*haiku-*)
|
||||
|
@ -106,10 +106,6 @@
|
||||
\title external: Translating Qt Into Other Languages
|
||||
*/
|
||||
|
||||
/*!
|
||||
\externalpage http://wiki.qt.io/BlackBerry
|
||||
\title Qt for BlackBerry
|
||||
*/
|
||||
/*!
|
||||
\externalpage http://wiki.qt.io/Qt_Multimedia_Backends
|
||||
\title Qt Multimedia Backends
|
||||
|
@ -1,22 +0,0 @@
|
||||
#
|
||||
# qmake configuration for blackberry armle-v7 systems
|
||||
#
|
||||
|
||||
load(qt_config)
|
||||
|
||||
DEFINES += Q_OS_BLACKBERRY
|
||||
QMAKE_PLATFORM += blackberry
|
||||
LIBS += -lbps
|
||||
|
||||
# Blackberry also has support for stack smashing protection in its libc
|
||||
contains(QT_CONFIG, stack-protector-strong) {
|
||||
QMAKE_CFLAGS += -fstack-protector-strong
|
||||
} else {
|
||||
QMAKE_CFLAGS += -fstack-protector -fstack-protector-all
|
||||
}
|
||||
|
||||
QMAKE_CFLAGS += -mcpu=cortex-a9 -mtune=cortex-a9 -mthumb -D_FORTIFY_SOURCE=2
|
||||
|
||||
QMAKE_LFLAGS_SHLIB += -Wl,-z,relro -Wl,-z,now
|
||||
|
||||
include(../common/qcc-base-qnx-armle-v7.conf)
|
@ -1,34 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "../qnx-armle-v7-qcc/qplatformdefs.h"
|
@ -1,20 +0,0 @@
|
||||
#
|
||||
# qmake configuration for blackberry x86 systems
|
||||
#
|
||||
|
||||
load(qt_config)
|
||||
|
||||
DEFINES += Q_OS_BLACKBERRY
|
||||
QMAKE_PLATFORM += blackberry
|
||||
LIBS += -lbps
|
||||
|
||||
# Blackberry also has support for stack smashing protection in its libc
|
||||
contains(QT_CONFIG, stack-protector-strong) {
|
||||
QMAKE_CFLAGS += -fstack-protector-strong
|
||||
} else {
|
||||
QMAKE_CFLAGS += -fstack-protector -fstack-protector-all
|
||||
}
|
||||
|
||||
QMAKE_LFLAGS_SHLIB += -Wl,-z,relro -Wl,-z,now
|
||||
|
||||
include(../common/qcc-base-qnx-x86.conf)
|
@ -1,34 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion Limited. <blackberry-qt@qnx.com>
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "../qnx-x86-qcc/qplatformdefs.h"
|
@ -21,7 +21,7 @@ QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions
|
||||
QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list,
|
||||
QMAKE_LFLAGS_VERSION_SCRIPT = -Wl,--version-script,
|
||||
|
||||
# Generic options for all BlackBerry/QNX qcc mkspecs
|
||||
# Generic options for all QNX qcc mkspecs
|
||||
QMAKE_CFLAGS_THREAD = -D_REENTRANT
|
||||
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
|
||||
QMAKE_COMPILER_DEFINES += __QNXNTO__
|
||||
|
@ -87,10 +87,6 @@ using namespace ABI::Windows::Networking::Sockets;
|
||||
#include <private/qjni_p.h>
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
# include <bps/deviceinfo.h>
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_SOLARIS)
|
||||
# include <sys/systeminfo.h>
|
||||
#endif
|
||||
@ -2517,7 +2513,7 @@ static QString unknownText()
|
||||
|
||||
Note that this function may return surprising values: it returns "linux"
|
||||
for all operating systems running Linux (including Android), "qnx" for all
|
||||
operating systems running QNX (including BlackBerry 10), "freebsd" for
|
||||
operating systems running QNX, "freebsd" for
|
||||
Debian/kFreeBSD, and "darwin" for OS X and iOS. For information on the type
|
||||
of product the application is running on, see productType().
|
||||
|
||||
@ -2542,7 +2538,7 @@ QString QSysInfo::kernelType()
|
||||
|
||||
Returns the release version of the operating system kernel. On Windows, it
|
||||
returns the version of the NT or CE kernel. On Unix systems, including
|
||||
Android, BlackBerry and OS X, it returns the same as the \c{uname -r}
|
||||
Android and OS X, it returns the same as the \c{uname -r}
|
||||
command would return.
|
||||
|
||||
If the version could not be determined, this function may return an empty
|
||||
@ -2583,10 +2579,6 @@ QString QSysInfo::kernelVersion()
|
||||
to determine the distribution name and returns that. If determining the
|
||||
distribution name failed, it returns "unknown".
|
||||
|
||||
\b{BlackBerry note}: this function returns "blackberry" for QNX systems
|
||||
running the BlackBerry userspace, but "qnx" for all other QNX-based
|
||||
systems.
|
||||
|
||||
\b{Darwin, OS X and iOS note}: this function returns "osx" for OS X
|
||||
systems, "ios" for iOS systems and "darwin" in case the system could not be
|
||||
determined.
|
||||
@ -2614,8 +2606,6 @@ QString QSysInfo::productType()
|
||||
#elif defined(Q_OS_WIN)
|
||||
return QStringLiteral("windows");
|
||||
|
||||
#elif defined(Q_OS_BLACKBERRY)
|
||||
return QStringLiteral("blackberry");
|
||||
#elif defined(Q_OS_QNX)
|
||||
return QStringLiteral("qnx");
|
||||
|
||||
@ -2644,7 +2634,7 @@ QString QSysInfo::productType()
|
||||
Returns the product version of the operating system in string form. If the
|
||||
version could not be determined, this function returns "unknown".
|
||||
|
||||
It will return the Android, BlackBerry, iOS, OS X, Windows full-product
|
||||
It will return the Android, iOS, OS X, Windows full-product
|
||||
versions on those systems. In particular, on OS X, iOS and Windows, the
|
||||
returned string is similar to the macVersion() or windowsVersion() enums.
|
||||
|
||||
@ -2655,7 +2645,7 @@ QString QSysInfo::productType()
|
||||
In all other Unix-type systems, this function always returns "unknown".
|
||||
|
||||
\note The version string returned from this function is only guaranteed to
|
||||
be orderable on Android, BlackBerry, OS X and iOS. On Windows, some Windows
|
||||
be orderable on Android, OS X and iOS. On Windows, some Windows
|
||||
versions are text ("XP" and "Vista", for example). On Linux, the version of
|
||||
the distribution may jump unexpectedly, please refer to the distribution's
|
||||
documentation for versioning practices.
|
||||
@ -2673,18 +2663,11 @@ QString QSysInfo::productVersion()
|
||||
return QString::fromLatin1(version).toLower();
|
||||
// fall through
|
||||
|
||||
// Android and Blackberry should not fall through to the Unix code
|
||||
// Android should not fall through to the Unix code
|
||||
#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
|
||||
return QJNIObjectPrivate::getStaticObjectField("android/os/Build$VERSION", "RELEASE", "Ljava/lang/String;").toString();
|
||||
#elif defined(Q_OS_ANDROID) // Q_OS_ANDROID_NO_SDK
|
||||
// TBD
|
||||
#elif defined(Q_OS_BLACKBERRY)
|
||||
deviceinfo_details_t *deviceInfo;
|
||||
if (deviceinfo_get_details(&deviceInfo) == BPS_SUCCESS) {
|
||||
QString bbVersion = QString::fromLatin1(deviceinfo_details_get_device_os_version(deviceInfo));
|
||||
deviceinfo_free_details(&deviceInfo);
|
||||
return bbVersion;
|
||||
}
|
||||
#elif defined(USE_ETC_OS_RELEASE) // Q_OS_UNIX
|
||||
QUnixOSVersion unixOsVersion;
|
||||
findUnixOsVersion(unixOsVersion);
|
||||
@ -2760,8 +2743,6 @@ QString QSysInfo::prettyProductName()
|
||||
return QLatin1String("Windows ") + QLatin1String(winVer_helper());
|
||||
#elif defined(Q_OS_ANDROID)
|
||||
return QLatin1String("Android ") + productVersion();
|
||||
#elif defined(Q_OS_BLACKBERRY)
|
||||
return QLatin1String("BlackBerry ") + productVersion();
|
||||
#elif defined(Q_OS_HAIKU)
|
||||
return QLatin1String("Haiku ") + productVersion();
|
||||
#elif defined(Q_OS_UNIX)
|
||||
@ -4257,7 +4238,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
|
||||
Calls the message handler with the debug message \a message. If no
|
||||
message handler has been installed, the message is printed to
|
||||
stderr. Under Windows the message is sent to the console, if it is a
|
||||
console application; otherwise, it is sent to the debugger. On Blackberry, the
|
||||
console application; otherwise, it is sent to the debugger. On QNX, the
|
||||
message is sent to slogger2. This function does nothing if \c QT_NO_DEBUG_OUTPUT
|
||||
was defined during compilation.
|
||||
|
||||
@ -4294,7 +4275,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
|
||||
Calls the message handler with the informational message \a message. If no
|
||||
message handler has been installed, the message is printed to
|
||||
stderr. Under Windows, the message is sent to the console, if it is a
|
||||
console application; otherwise, it is sent to the debugger. On Blackberry the
|
||||
console application; otherwise, it is sent to the debugger. On QNX the
|
||||
message is sent to slogger2. This function does nothing if \c QT_NO_INFO_OUTPUT
|
||||
was defined during compilation.
|
||||
|
||||
@ -4330,7 +4311,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
|
||||
Calls the message handler with the warning message \a message. If no
|
||||
message handler has been installed, the message is printed to
|
||||
stderr. Under Windows, the message is sent to the debugger.
|
||||
On Blackberry the message is sent to slogger2. This
|
||||
On QNX the message is sent to slogger2. This
|
||||
function does nothing if \c QT_NO_WARNING_OUTPUT was defined
|
||||
during compilation; it exits if the environment variable \c
|
||||
QT_FATAL_WARNINGS is not empty.
|
||||
@ -4364,7 +4345,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
|
||||
Calls the message handler with the critical message \a message. If no
|
||||
message handler has been installed, the message is printed to
|
||||
stderr. Under Windows, the message is sent to the debugger.
|
||||
On Blackberry the message is sent to slogger2.
|
||||
On QNX the message is sent to slogger2
|
||||
|
||||
It exits if the environment variable QT_FATAL_CRITICALS is not empty.
|
||||
|
||||
@ -4397,7 +4378,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
|
||||
Calls the message handler with the fatal message \a message. If no
|
||||
message handler has been installed, the message is printed to
|
||||
stderr. Under Windows, the message is sent to the debugger.
|
||||
On Blackberry the message is sent to slogger2.
|
||||
On QNX the message is sent to slogger2
|
||||
|
||||
If you are using the \b{default message handler} this function will
|
||||
abort on Unix systems to create a core dump. On Windows, for debug builds,
|
||||
|
@ -2111,8 +2111,8 @@
|
||||
another process or by manually using native code.
|
||||
|
||||
\value CoverWindow Indicates that the window represents a cover window,
|
||||
which is shown when the application is minimized
|
||||
on the BlackBerry platform for instance.
|
||||
which is shown when the application is minimized on
|
||||
some platforms.
|
||||
|
||||
There are also a number of flags which you can use to customize
|
||||
the appearance of top-level windows. These have no effect on other
|
||||
|
@ -81,8 +81,6 @@
|
||||
The following operating systems have variants:
|
||||
LINUX - both Q_OS_LINUX and Q_OS_ANDROID are defined when building for Android
|
||||
- only Q_OS_LINUX is defined if building for other Linux systems
|
||||
QNX - both Q_OS_QNX and Q_OS_BLACKBERRY are defined when building for Blackberry 10
|
||||
- only Q_OS_QNX is defined if building for other QNX targets
|
||||
FREEBSD - Q_OS_FREEBSD is defined only when building for FreeBSD with a BSD userland
|
||||
- Q_OS_FREEBSD_KERNEL is always defined on FreeBSD, even if the userland is from GNU
|
||||
*/
|
||||
|
@ -158,10 +158,6 @@ win32 {
|
||||
} else:ios {
|
||||
LIBS += -framework MobileCoreServices
|
||||
}
|
||||
} else:blackberry {
|
||||
SOURCES += \
|
||||
io/qstandardpaths_blackberry.cpp \
|
||||
io/qstorageinfo_unix.cpp
|
||||
} else:android:!android-no-sdk {
|
||||
SOURCES += \
|
||||
io/qstandardpaths_android.cpp \
|
||||
|
@ -92,8 +92,6 @@ QFileSelectorPrivate::QFileSelectorPrivate()
|
||||
QString defaultsPath = "data/defaults.conf";
|
||||
#if defined(Q_OS_ANDROID)
|
||||
defaultsPath = "data/android/defaults.conf";
|
||||
#elif defined(Q_OS_BLACKBERRY)
|
||||
defaultsPath = "data/blackberry/defaults.conf";
|
||||
#elif defined(Q_OS_IOS)
|
||||
defaultsPath = "data/ios/defaults.conf";
|
||||
#endif
|
||||
@ -116,7 +114,6 @@ QFileSelectorPrivate::QFileSelectorPrivate()
|
||||
\code
|
||||
data/defaults.conf
|
||||
data/+android/defaults.conf
|
||||
data/+blackberry/defaults.conf
|
||||
data/+ios/+en_GB/defaults.conf
|
||||
\endcode
|
||||
|
||||
@ -127,9 +124,8 @@ QFileSelectorPrivate::QFileSelectorPrivate()
|
||||
\code
|
||||
images/background.png
|
||||
images/+android/+en_GB/background.png
|
||||
images/+blackberry/+en_GB/background.png
|
||||
\endcode
|
||||
With those files available, you would select a different file on android and blackberry platforms,
|
||||
With those files available, you would select a different file on the android platform,
|
||||
but only if the locale was en_GB.
|
||||
|
||||
QFileSelector will not attempt to select if the base file does not exist. For error handling in
|
||||
@ -145,8 +141,8 @@ QFileSelectorPrivate::QFileSelectorPrivate()
|
||||
Selectors normally available are
|
||||
\list
|
||||
\li platform, any of the following strings which match the platform the application is running
|
||||
on (list not exhaustive): android, blackberry, ios, osx, darwin, mac, linux, wince, unix,
|
||||
windows. On Linux, if it can be determined, the name of the distribution too, like debian,
|
||||
on (list not exhaustive): android, ios, osx, darwin, mac, linux, wince, unix, windows.
|
||||
On Linux, if it can be determined, the name of the distribution too, like debian,
|
||||
fedora or opensuse.
|
||||
\li locale, same as QLocale().name().
|
||||
\endlist
|
||||
@ -368,8 +364,8 @@ QStringList QFileSelectorPrivate::platformSelectors()
|
||||
# endif
|
||||
#elif defined(Q_OS_UNIX)
|
||||
ret << QStringLiteral("unix");
|
||||
# if !defined(Q_OS_ANDROID) && !defined(Q_OS_BLACKBERRY)
|
||||
// we don't want "linux" for Android or "qnx" for Blackberry here
|
||||
# if !defined(Q_OS_ANDROID)
|
||||
// we don't want "linux" for Android
|
||||
ret << QSysInfo::kernelType();
|
||||
# ifdef Q_OS_MAC
|
||||
ret << QStringLiteral("mac"); // compatibility, since kernelType() is "darwin"
|
||||
@ -377,7 +373,7 @@ QStringList QFileSelectorPrivate::platformSelectors()
|
||||
# endif
|
||||
QString productName = QSysInfo::productType();
|
||||
if (productName != QLatin1String("unknown"))
|
||||
ret << productName; // "opensuse", "fedora", "osx", "ios", "blackberry", "android"
|
||||
ret << productName; // "opensuse", "fedora", "osx", "ios", "android"
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
@ -694,16 +694,6 @@ QString QFileSystemEngine::tempPath()
|
||||
{
|
||||
#ifdef QT_UNIX_TEMP_PATH_OVERRIDE
|
||||
return QLatin1String(QT_UNIX_TEMP_PATH_OVERRIDE);
|
||||
#elif defined(Q_OS_BLACKBERRY)
|
||||
QString temp = QFile::decodeName(qgetenv("TEMP"));
|
||||
if (temp.isEmpty())
|
||||
temp = QFile::decodeName(qgetenv("TMPDIR"));
|
||||
|
||||
if (temp.isEmpty()) {
|
||||
qWarning("Neither the TEMP nor the TMPDIR environment variable is set, falling back to /var/tmp.");
|
||||
temp = QLatin1String("/var/tmp");
|
||||
}
|
||||
return QDir::cleanPath(temp);
|
||||
#else
|
||||
QString temp = QFile::decodeName(qgetenv("TMPDIR"));
|
||||
if (temp.isEmpty())
|
||||
|
@ -385,11 +385,6 @@ public:
|
||||
void cleanup();
|
||||
void setError(QProcess::ProcessError error, const QString &description = QString());
|
||||
void setErrorAndEmit(QProcess::ProcessError error, const QString &description = QString());
|
||||
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
QList<QSocketNotifier *> defaultNotifiers() const;
|
||||
#endif // Q_OS_BLACKBERRY
|
||||
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -839,17 +839,6 @@ bool QProcessPrivate::waitForStarted(int msecs)
|
||||
return startedEmitted;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
QList<QSocketNotifier *> QProcessPrivate::defaultNotifiers() const
|
||||
{
|
||||
QList<QSocketNotifier *> notifiers;
|
||||
notifiers << stdoutChannel.notifier
|
||||
<< stderrChannel.notifier
|
||||
<< stdinChannel.notifier;
|
||||
return notifiers;
|
||||
}
|
||||
#endif // Q_OS_BLACKBERRY
|
||||
|
||||
bool QProcessPrivate::waitForReadyRead(int msecs)
|
||||
{
|
||||
#if defined (QPROCESS_DEBUG)
|
||||
@ -859,10 +848,6 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
|
||||
QElapsedTimer stopWatch;
|
||||
stopWatch.start();
|
||||
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
QList<QSocketNotifier *> notifiers = defaultNotifiers();
|
||||
#endif
|
||||
|
||||
forever {
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
@ -885,11 +870,8 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
|
||||
add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
|
||||
|
||||
int timeout = qt_subtract_from_timeout(msecs, stopWatch.elapsed());
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
int ret = bb_select(notifiers, nfds + 1, &fdread, &fdwrite, timeout);
|
||||
#else
|
||||
int ret = qt_select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
|
||||
#endif
|
||||
|
||||
if (ret < 0) {
|
||||
break;
|
||||
}
|
||||
@ -937,10 +919,6 @@ bool QProcessPrivate::waitForBytesWritten(int msecs)
|
||||
QElapsedTimer stopWatch;
|
||||
stopWatch.start();
|
||||
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
QList<QSocketNotifier *> notifiers = defaultNotifiers();
|
||||
#endif
|
||||
|
||||
while (!stdinChannel.buffer.isEmpty()) {
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
@ -964,11 +942,8 @@ bool QProcessPrivate::waitForBytesWritten(int msecs)
|
||||
add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
|
||||
|
||||
int timeout = qt_subtract_from_timeout(msecs, stopWatch.elapsed());
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
int ret = bb_select(notifiers, nfds + 1, &fdread, &fdwrite, timeout);
|
||||
#else
|
||||
int ret = qt_select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
|
||||
#endif
|
||||
|
||||
if (ret < 0) {
|
||||
break;
|
||||
}
|
||||
@ -1010,10 +985,6 @@ bool QProcessPrivate::waitForFinished(int msecs)
|
||||
QElapsedTimer stopWatch;
|
||||
stopWatch.start();
|
||||
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
QList<QSocketNotifier *> notifiers = defaultNotifiers();
|
||||
#endif
|
||||
|
||||
forever {
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
@ -1037,11 +1008,8 @@ bool QProcessPrivate::waitForFinished(int msecs)
|
||||
add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
|
||||
|
||||
int timeout = qt_subtract_from_timeout(msecs, stopWatch.elapsed());
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
int ret = bb_select(notifiers, nfds + 1, &fdread, &fdwrite, timeout);
|
||||
#else
|
||||
int ret = qt_select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
|
||||
#endif
|
||||
|
||||
if (ret < 0) {
|
||||
break;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ using namespace ABI::Windows::Storage;
|
||||
#define CSIDL_APPDATA 0x001a // <username>\Application Data
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_ANDROID)
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_ANDROID)
|
||||
#define Q_XDG_PLATFORM
|
||||
#endif
|
||||
|
||||
@ -1073,7 +1073,7 @@ static void initDefaultPaths(QMutexLocker *locker)
|
||||
#else
|
||||
|
||||
#ifndef QSETTINGS_USE_QSTANDARDPATHS
|
||||
// Non XDG platforms (OS X, iOS, Blackberry, Android...) have used this code path erroneously
|
||||
// Non XDG platforms (OS X, iOS, Android...) have used this code path erroneously
|
||||
// for some time now. Moving away from that would require migrating existing settings.
|
||||
QString userPath;
|
||||
QByteArray env = qgetenv("XDG_CONFIG_HOME");
|
||||
@ -1140,7 +1140,6 @@ QConfFileSettingsPrivate::QConfFileSettingsPrivate(QSettings::Format format,
|
||||
org = QLatin1String("Unknown Organization");
|
||||
}
|
||||
|
||||
#if !defined(Q_OS_BLACKBERRY)
|
||||
QString appFile = org + QDir::separator() + application + extension;
|
||||
QString orgFile = org + extension;
|
||||
|
||||
@ -1155,13 +1154,6 @@ QConfFileSettingsPrivate::QConfFileSettingsPrivate(QSettings::Format format,
|
||||
if (!application.isEmpty())
|
||||
confFiles[F_System | F_Application].reset(QConfFile::fromName(systemPath + appFile, false));
|
||||
confFiles[F_System | F_Organization].reset(QConfFile::fromName(systemPath + orgFile, false));
|
||||
#else
|
||||
QString confName = getPath(format, QSettings::UserScope) + org;
|
||||
if (!application.isEmpty())
|
||||
confName += QDir::separator() + application;
|
||||
confName += extension;
|
||||
confFiles[SandboxConfFile].reset(QConfFile::fromName(confName, true));
|
||||
#endif
|
||||
|
||||
for (i = 0; i < NumConfFiles; ++i) {
|
||||
if (confFiles[i]) {
|
||||
@ -2249,7 +2241,6 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
|
||||
stored in the following registry path:
|
||||
\c{HKEY_LOCAL_MACHINE\Software\WOW6432node}.
|
||||
|
||||
On BlackBerry only a single file is used (see \l{Platform Limitations}).
|
||||
If the file format is NativeFormat, this is "Settings/MySoft/Star Runner.conf"
|
||||
in the application's home directory.
|
||||
|
||||
@ -2277,7 +2268,6 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
|
||||
%COMMON_APPDATA% path is usually \tt{C:\\Documents and
|
||||
Settings\\All Users\\Application Data}.
|
||||
|
||||
On BlackBerry only a single file is used (see \l{Platform Limitations}).
|
||||
If the file format is IniFormat, this is "Settings/MySoft/Star Runner.ini"
|
||||
in the application's home directory.
|
||||
|
||||
@ -2382,15 +2372,6 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
|
||||
10.8 (Mountain Lion), only root can. However, 10.9 (Mavericks) changes
|
||||
that rule again but only for the native format (plist files).
|
||||
|
||||
\li On the BlackBerry platform, applications run in a sandbox. They are not
|
||||
allowed to read or write outside of this sandbox. This involves the
|
||||
following limitations:
|
||||
\list
|
||||
\li As there is only a single scope the scope is simply ignored,
|
||||
i.e. there is no difference between SystemScope and UserScope.
|
||||
\li The \l{Fallback Mechanism} is not applied, i.e. only a single
|
||||
location is considered.
|
||||
\li It is advised against setting and using custom file paths.
|
||||
\endlist
|
||||
|
||||
\endlist
|
||||
|
@ -236,16 +236,11 @@ public:
|
||||
because their values are respectively 1 and 2.
|
||||
*/
|
||||
enum {
|
||||
#if !defined(Q_OS_BLACKBERRY)
|
||||
F_Application = 0x0,
|
||||
F_Organization = 0x1,
|
||||
F_User = 0x0,
|
||||
F_System = 0x2,
|
||||
NumConfFiles = 4
|
||||
#else
|
||||
SandboxConfFile = 0,
|
||||
NumConfFiles = 1
|
||||
#endif
|
||||
};
|
||||
|
||||
QSettings::Format format;
|
||||
|
@ -210,66 +210,46 @@ QT_BEGIN_NAMESPACE
|
||||
\endtable
|
||||
|
||||
\table
|
||||
\header \li Path type \li Blackberry \li Linux
|
||||
\header \li Path type \li Linux
|
||||
\row \li DesktopLocation
|
||||
\li "<APPROOT>/data"
|
||||
\li "~/Desktop"
|
||||
\row \li DocumentsLocation
|
||||
\li "<APPROOT>/shared/documents"
|
||||
\li "~/Documents"
|
||||
\row \li FontsLocation
|
||||
\li "/base/usr/fonts" (not writable)
|
||||
\li "~/.fonts"
|
||||
\row \li ApplicationsLocation
|
||||
\li not supported (directory not readable)
|
||||
\li "~/.local/share/applications", "/usr/local/share/applications", "/usr/share/applications"
|
||||
\row \li MusicLocation
|
||||
\li "<APPROOT>/shared/music"
|
||||
\li "~/Music"
|
||||
\row \li MoviesLocation
|
||||
\li "<APPROOT>/shared/videos"
|
||||
\li "~/Videos"
|
||||
\row \li PicturesLocation
|
||||
\li "<APPROOT>/shared/photos"
|
||||
\li "~/Pictures"
|
||||
\row \li TempLocation
|
||||
\li "/var/tmp"
|
||||
\li "/tmp"
|
||||
\row \li HomeLocation
|
||||
\li "<APPROOT>/data"
|
||||
\li "~"
|
||||
\row \li DataLocation
|
||||
\li "<APPROOT>/data", "<APPROOT>/app/native/assets"
|
||||
\li "~/.local/share/<APPNAME>", "/usr/local/share/<APPNAME>", "/usr/share/<APPNAME>"
|
||||
\row \li CacheLocation
|
||||
\li "<APPROOT>/data/Cache"
|
||||
\li "~/.cache/<APPNAME>"
|
||||
\row \li GenericDataLocation
|
||||
\li "<APPROOT>/shared/misc"
|
||||
\li "~/.local/share", "/usr/local/share", "/usr/share"
|
||||
\row \li RuntimeLocation
|
||||
\li "/var/tmp"
|
||||
\li "/run/user/<USER>"
|
||||
\row \li ConfigLocation
|
||||
\li "<APPROOT>/data/Settings"
|
||||
\li "~/.config", "/etc/xdg"
|
||||
\row \li GenericConfigLocation
|
||||
\li "<APPROOT>/data/Settings"
|
||||
\li "~/.config", "/etc/xdg"
|
||||
\row \li DownloadLocation
|
||||
\li "<APPROOT>/shared/downloads"
|
||||
\li "~/Downloads"
|
||||
\row \li GenericCacheLocation
|
||||
\li "<APPROOT>/data/Cache" (there is no shared cache)
|
||||
\li "~/.cache"
|
||||
\row \li AppDataLocation
|
||||
\li "<APPROOT>/data", "<APPROOT>/app/native/assets"
|
||||
\li "~/.local/share/<APPNAME>", "/usr/local/share/<APPNAME>", "/usr/share/<APPNAME>"
|
||||
\row \li AppLocalDataLocation
|
||||
\li "<APPROOT>/data", "<APPROOT>/app/native/assets"
|
||||
\li "~/.local/share/<APPNAME>", "/usr/local/share/<APPNAME>", "/usr/share/<APPNAME>"
|
||||
\row \li AppConfigLocation
|
||||
\li "<APPROOT>/data/Settings"
|
||||
\li "~/.config/<APPNAME>", "/etc/xdg/<APPNAME>"
|
||||
\endtable
|
||||
|
||||
|
@ -1,115 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qstandardpaths.h"
|
||||
#include <qdir.h>
|
||||
|
||||
#ifndef QT_NO_STANDARDPATHS
|
||||
|
||||
#include <qstring.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static QString testModeInsert() {
|
||||
if (QStandardPaths::isTestModeEnabled())
|
||||
return QStringLiteral("/.qttest");
|
||||
else
|
||||
return QStringLiteral("");
|
||||
}
|
||||
|
||||
QString QStandardPaths::writableLocation(StandardLocation type)
|
||||
{
|
||||
QDir sharedDir = QDir::home();
|
||||
sharedDir.cd(QLatin1String("../shared"));
|
||||
|
||||
const QString sharedRoot = sharedDir.absolutePath();
|
||||
|
||||
switch (type) {
|
||||
case AppDataLocation:
|
||||
case AppLocalDataLocation:
|
||||
return QDir::homePath() + testModeInsert();
|
||||
case DesktopLocation:
|
||||
case HomeLocation:
|
||||
return QDir::homePath();
|
||||
case RuntimeLocation:
|
||||
case TempLocation:
|
||||
return QDir::tempPath();
|
||||
case CacheLocation:
|
||||
case GenericCacheLocation:
|
||||
return QDir::homePath() + testModeInsert() + QLatin1String("/Cache");
|
||||
case ConfigLocation:
|
||||
case GenericConfigLocation:
|
||||
case AppConfigLocation:
|
||||
return QDir::homePath() + testModeInsert() + QLatin1String("/Settings");
|
||||
case GenericDataLocation:
|
||||
return sharedRoot + testModeInsert() + QLatin1String("/misc");
|
||||
case DocumentsLocation:
|
||||
return sharedRoot + QLatin1String("/documents");
|
||||
case PicturesLocation:
|
||||
return sharedRoot + QLatin1String("/photos");
|
||||
case FontsLocation:
|
||||
// this is not a writable location
|
||||
return QString();
|
||||
case MusicLocation:
|
||||
return sharedRoot + QLatin1String("/music");
|
||||
case MoviesLocation:
|
||||
return sharedRoot + QLatin1String("/videos");
|
||||
case DownloadLocation:
|
||||
return sharedRoot + QLatin1String("/downloads");
|
||||
case ApplicationsLocation:
|
||||
return QString();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
QStringList QStandardPaths::standardLocations(StandardLocation type)
|
||||
{
|
||||
QStringList dirs;
|
||||
|
||||
if (type == FontsLocation)
|
||||
return QStringList(QLatin1String("/base/usr/fonts"));
|
||||
|
||||
if (type == AppDataLocation || type == AppLocalDataLocation)
|
||||
dirs.append(QDir::homePath() + testModeInsert() + QLatin1String("native/assets"));
|
||||
|
||||
const QString localDir = writableLocation(type);
|
||||
dirs.prepend(localDir);
|
||||
return dirs;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_STANDARDPATHS
|
@ -174,13 +174,6 @@ vxworks {
|
||||
kernel/qfunctions_vxworks.h
|
||||
}
|
||||
|
||||
blackberry {
|
||||
SOURCES += \
|
||||
kernel/qeventdispatcher_blackberry.cpp
|
||||
HEADERS += \
|
||||
kernel/qeventdispatcher_blackberry_p.h
|
||||
}
|
||||
|
||||
qqnx_pps {
|
||||
LIBS_PRIVATE += -lpps
|
||||
SOURCES += \
|
||||
|
@ -92,9 +92,6 @@ QAbstractNativeEventFilter::~QAbstractNativeEventFilter()
|
||||
|
||||
On Mac, \a eventType is set to "mac_generic_NSEvent", and the \a message can be casted to an EventRef.
|
||||
|
||||
On Blackberry (not plain QNX) \a eventType is set to "bps_event_t", and the \a message can be casted
|
||||
to a bps_event_t pointer.
|
||||
|
||||
In your reimplementation of this function, if you want to filter
|
||||
the \a message out, i.e. stop it being handled further, return
|
||||
true; otherwise return false.
|
||||
|
@ -50,10 +50,6 @@
|
||||
#include <mach/mach_time.h>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
#include <qsocketnotifier.h>
|
||||
#endif // Q_OS_BLACKBERRY
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static inline bool time_update(struct timespec *tv, const struct timespec &start,
|
||||
@ -113,32 +109,4 @@ int qt_select_msecs(int nfds, fd_set *fdread, fd_set *fdwrite, int timeout)
|
||||
return qt_safe_select(nfds, fdread, fdwrite, 0, &tv);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
// The BlackBerry event dispatcher uses bps_get_event. Unfortunately, already registered
|
||||
// socket notifiers are disabled by a call to select. This is to rearm the standard streams.
|
||||
int bb_select(QList<QSocketNotifier *> socketNotifiers, int nfds, fd_set *fdread, fd_set *fdwrite,
|
||||
int timeout)
|
||||
{
|
||||
QList<bool> socketNotifiersEnabled;
|
||||
socketNotifiersEnabled.reserve(socketNotifiers.count());
|
||||
for (int a = 0; a < socketNotifiers.count(); ++a) {
|
||||
if (socketNotifiers.at(a) && socketNotifiers.at(a)->isEnabled()) {
|
||||
socketNotifiersEnabled.append(true);
|
||||
socketNotifiers.at(a)->setEnabled(false);
|
||||
} else {
|
||||
socketNotifiersEnabled.append(false);
|
||||
}
|
||||
}
|
||||
|
||||
const int ret = qt_select_msecs(nfds, fdread, fdwrite, timeout);
|
||||
|
||||
for (int a = 0; a < socketNotifiers.count(); ++a) {
|
||||
if (socketNotifiersEnabled.at(a) == true)
|
||||
socketNotifiers.at(a)->setEnabled(true);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif // Q_OS_BLACKBERRY
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -308,12 +308,6 @@ Q_CORE_EXPORT int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_s
|
||||
|
||||
int qt_select_msecs(int nfds, fd_set *fdread, fd_set *fdwrite, int timeout);
|
||||
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
class QSocketNotifier;
|
||||
Q_CORE_EXPORT int bb_select(QList<QSocketNotifier *> socketNotifiers, int nfds, fd_set *fdread,
|
||||
fd_set *fdwrite, int timeout);
|
||||
#endif // Q_OS_BLACKBERRY
|
||||
|
||||
// according to X/OPEN we have to define semun ourselves
|
||||
// we use prefix as on some systems sem.h will have it
|
||||
struct semid_ds;
|
||||
|
@ -66,16 +66,10 @@
|
||||
|
||||
#ifndef QT_NO_QOBJECT
|
||||
#if defined(Q_OS_UNIX)
|
||||
# if defined(Q_OS_BLACKBERRY)
|
||||
# include "qeventdispatcher_blackberry_p.h"
|
||||
# include <process.h>
|
||||
# include <unistd.h>
|
||||
# else
|
||||
# if !defined(QT_NO_GLIB)
|
||||
# include "qeventdispatcher_glib_p.h"
|
||||
# endif
|
||||
# include "qeventdispatcher_unix_p.h"
|
||||
# endif
|
||||
# if !defined(QT_NO_GLIB)
|
||||
# include "qeventdispatcher_glib_p.h"
|
||||
# endif
|
||||
# include "qeventdispatcher_unix_p.h"
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
# ifdef Q_OS_WINRT
|
||||
@ -335,34 +329,6 @@ struct QCoreApplicationData {
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
//The QCoreApplicationData struct is only populated on demand, because it is rarely needed and would
|
||||
//affect startup time
|
||||
void loadManifest() {
|
||||
static bool manifestLoadAttempt = false;
|
||||
if (manifestLoadAttempt)
|
||||
return;
|
||||
|
||||
manifestLoadAttempt = true;
|
||||
|
||||
QFile metafile(QStringLiteral("app/META-INF/MANIFEST.MF"));
|
||||
if (!metafile.open(QIODevice::ReadOnly)) {
|
||||
qWarning() << Q_FUNC_INFO << "Could not open application metafile for reading";
|
||||
} else {
|
||||
while (!metafile.atEnd() && (application.isEmpty() || applicationVersion.isEmpty() || orgName.isEmpty())) {
|
||||
QByteArray line = metafile.readLine();
|
||||
if (line.startsWith("Application-Name:"))
|
||||
application = QString::fromUtf8(line.mid(18).trimmed());
|
||||
else if (line.startsWith("Application-Version:"))
|
||||
applicationVersion = QString::fromUtf8(line.mid(21).trimmed());
|
||||
else if (line.startsWith("Package-Author:"))
|
||||
orgName = QString::fromUtf8(line.mid(16).trimmed());
|
||||
}
|
||||
metafile.close();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
QString orgName, orgDomain;
|
||||
QString application; // application name, initially from argv[0], can then be modified.
|
||||
QString applicationVersion;
|
||||
@ -503,16 +469,12 @@ void QCoreApplicationPrivate::createEventDispatcher()
|
||||
{
|
||||
Q_Q(QCoreApplication);
|
||||
#if defined(Q_OS_UNIX)
|
||||
# if defined(Q_OS_BLACKBERRY)
|
||||
eventDispatcher = new QEventDispatcherBlackberry(q);
|
||||
# else
|
||||
# if !defined(QT_NO_GLIB)
|
||||
if (qEnvironmentVariableIsEmpty("QT_NO_GLIB") && QEventDispatcherGlib::versionSupported())
|
||||
eventDispatcher = new QEventDispatcherGlib(q);
|
||||
else
|
||||
# endif
|
||||
eventDispatcher = new QEventDispatcherUNIX(q);
|
||||
# endif
|
||||
#elif defined(Q_OS_WINRT)
|
||||
eventDispatcher = new QEventDispatcherWinRT(q);
|
||||
#elif defined(Q_OS_WIN)
|
||||
@ -2123,33 +2085,6 @@ QString QCoreApplication::applicationFilePath()
|
||||
#if defined(Q_OS_WIN)
|
||||
QCoreApplicationPrivate::setApplicationFilePath(QFileInfo(qAppFileName()).filePath());
|
||||
return *QCoreApplicationPrivate::cachedApplicationFilePath;
|
||||
#elif defined(Q_OS_BLACKBERRY)
|
||||
if (!arguments().isEmpty()) { // args is never empty, but the navigator can change behaviour some day
|
||||
QFileInfo fileInfo(arguments().at(0));
|
||||
const bool zygotized = fileInfo.exists();
|
||||
if (zygotized) {
|
||||
// Handle the zygotized case:
|
||||
QCoreApplicationPrivate::setApplicationFilePath(QDir::cleanPath(fileInfo.absoluteFilePath()));
|
||||
return *QCoreApplicationPrivate::cachedApplicationFilePath;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle the non-zygotized case:
|
||||
const size_t maximum_path = static_cast<size_t>(pathconf("/",_PC_PATH_MAX));
|
||||
char buff[maximum_path+1];
|
||||
if (_cmdname(buff)) {
|
||||
QCoreApplicationPrivate::setApplicationFilePath(QDir::cleanPath(QString::fromLocal8Bit(buff)));
|
||||
} else {
|
||||
qWarning("QCoreApplication::applicationFilePath: _cmdname() failed");
|
||||
// _cmdname() won't fail, but just in case, fallback to the old method
|
||||
QDir dir(QStringLiteral("./app/native/"));
|
||||
QStringList executables = dir.entryList(QDir::Executable | QDir::Files);
|
||||
if (!executables.empty()) {
|
||||
//We assume that there is only one executable in the folder
|
||||
QCoreApplicationPrivate::setApplicationFilePath(dir.absoluteFilePath(executables.first()));
|
||||
}
|
||||
}
|
||||
return *QCoreApplicationPrivate::cachedApplicationFilePath;
|
||||
#elif defined(Q_OS_MAC)
|
||||
QString qAppFileName_str = qAppFileName();
|
||||
if(!qAppFileName_str.isEmpty()) {
|
||||
@ -2315,9 +2250,6 @@ QStringList QCoreApplication::arguments()
|
||||
organizationName(). On all other platforms, QSettings uses
|
||||
organizationName() as the organization.
|
||||
|
||||
On BlackBerry this property is read-only. It is obtained from the
|
||||
BAR application descriptor file.
|
||||
|
||||
\sa organizationDomain, applicationName
|
||||
*/
|
||||
|
||||
@ -2342,9 +2274,6 @@ void QCoreApplication::setOrganizationName(const QString &orgName)
|
||||
|
||||
QString QCoreApplication::organizationName()
|
||||
{
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
coreappdata()->loadManifest();
|
||||
#endif
|
||||
return coreappdata()->orgName;
|
||||
}
|
||||
|
||||
@ -2395,9 +2324,6 @@ QString QCoreApplication::organizationDomain()
|
||||
|
||||
If not set, the application name defaults to the executable name (since 5.0).
|
||||
|
||||
On BlackBerry this property is read-only. It is obtained from the
|
||||
BAR application descriptor file.
|
||||
|
||||
\sa organizationName, organizationDomain, applicationVersion, applicationFilePath()
|
||||
*/
|
||||
/*!
|
||||
@ -2423,9 +2349,6 @@ void QCoreApplication::setApplicationName(const QString &application)
|
||||
|
||||
QString QCoreApplication::applicationName()
|
||||
{
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
coreappdata()->loadManifest();
|
||||
#endif
|
||||
return coreappdata() ? coreappdata()->application : QString();
|
||||
}
|
||||
|
||||
@ -2440,9 +2363,6 @@ Q_CORE_EXPORT QString qt_applicationName_noFallback()
|
||||
\since 4.4
|
||||
\brief the version of this application
|
||||
|
||||
On BlackBerry this property is read-only. It is obtained from the
|
||||
BAR application descriptor file.
|
||||
|
||||
\sa applicationName, organizationName, organizationDomain
|
||||
*/
|
||||
/*!
|
||||
@ -2464,9 +2384,6 @@ void QCoreApplication::setApplicationVersion(const QString &version)
|
||||
|
||||
QString QCoreApplication::applicationVersion()
|
||||
{
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
coreappdata()->loadManifest();
|
||||
#endif
|
||||
return coreappdata()->applicationVersion;
|
||||
}
|
||||
|
||||
|
@ -1,502 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qeventdispatcher_blackberry_p.h"
|
||||
#include "qsocketnotifier.h"
|
||||
#include "qdebug.h"
|
||||
#include "qelapsedtimer.h"
|
||||
#include "private/qthread_p.h"
|
||||
|
||||
#include <bps/bps.h>
|
||||
#include <bps/event.h>
|
||||
|
||||
//#define QEVENTDISPATCHERBLACKBERRY_DEBUG
|
||||
|
||||
#ifdef QEVENTDISPATCHERBLACKBERRY_DEBUG
|
||||
#include <QThread>
|
||||
#define qEventDispatcherDebug qDebug() << QThread::currentThread()
|
||||
#else
|
||||
#define qEventDispatcherDebug QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class BpsChannelScopeSwitcher
|
||||
{
|
||||
public:
|
||||
BpsChannelScopeSwitcher(int scopeChannel) : innerChannel(scopeChannel)
|
||||
{
|
||||
outerChannel = bps_channel_get_active();
|
||||
if (outerChannel != innerChannel)
|
||||
bps_channel_set_active(innerChannel);
|
||||
}
|
||||
|
||||
~BpsChannelScopeSwitcher()
|
||||
{
|
||||
if (outerChannel != innerChannel)
|
||||
bps_channel_set_active(outerChannel);
|
||||
}
|
||||
|
||||
private:
|
||||
int innerChannel;
|
||||
int outerChannel;
|
||||
};
|
||||
|
||||
class BBScopedLoopLevelCounter
|
||||
{
|
||||
QEventDispatcherBlackberryPrivate *d;
|
||||
|
||||
public:
|
||||
inline BBScopedLoopLevelCounter(QEventDispatcherBlackberryPrivate *p)
|
||||
: d(p)
|
||||
{ ++d->loop_level; }
|
||||
|
||||
inline ~BBScopedLoopLevelCounter()
|
||||
{ --d->loop_level; }
|
||||
};
|
||||
|
||||
struct bpsIOHandlerData
|
||||
{
|
||||
bpsIOHandlerData()
|
||||
: count(0), readfds(0), writefds(0), exceptfds(0)
|
||||
{
|
||||
}
|
||||
|
||||
int count;
|
||||
fd_set *readfds;
|
||||
fd_set *writefds;
|
||||
fd_set *exceptfds;
|
||||
};
|
||||
|
||||
static int bpsUnblockDomain = -1;
|
||||
|
||||
static int bpsIOHandler(int fd, int io_events, void *data)
|
||||
{
|
||||
qEventDispatcherDebug << Q_FUNC_INFO;
|
||||
// decode callback payload
|
||||
bpsIOHandlerData *ioData = static_cast<bpsIOHandlerData*>(data);
|
||||
|
||||
// check if first file is ready
|
||||
bool firstReady = (ioData->count == 0);
|
||||
|
||||
// update ready state of file
|
||||
if (io_events & BPS_IO_INPUT) {
|
||||
qEventDispatcherDebug << fd << "ready for Read";
|
||||
FD_SET(fd, ioData->readfds);
|
||||
ioData->count++;
|
||||
}
|
||||
|
||||
if (io_events & BPS_IO_OUTPUT) {
|
||||
qEventDispatcherDebug << fd << "ready for Write";
|
||||
FD_SET(fd, ioData->writefds);
|
||||
ioData->count++;
|
||||
}
|
||||
|
||||
if (io_events & BPS_IO_EXCEPT) {
|
||||
qEventDispatcherDebug << fd << "ready for Exception";
|
||||
FD_SET(fd, ioData->exceptfds);
|
||||
ioData->count++;
|
||||
}
|
||||
|
||||
// force bps_get_event() to return immediately by posting an event to ourselves;
|
||||
// but this only needs to happen once if multiple files become ready at the same time
|
||||
if (firstReady) {
|
||||
qEventDispatcherDebug << "Sending bpsIOReadyDomain event";
|
||||
// create unblock event
|
||||
bps_event_t *event;
|
||||
int result = bps_event_create(&event, bpsUnblockDomain, 0, NULL, NULL);
|
||||
if (Q_UNLIKELY(result != BPS_SUCCESS)) {
|
||||
qWarning("QEventDispatcherBlackberry: bps_event_create failed");
|
||||
return BPS_FAILURE;
|
||||
}
|
||||
|
||||
// post unblock event to our thread; in this callback the bps channel is
|
||||
// guaranteed to be the same that was active when bps_add_fd was called
|
||||
result = bps_push_event(event);
|
||||
if (Q_UNLIKELY(result != BPS_SUCCESS)) {
|
||||
qWarning("QEventDispatcherBlackberry: bps_push_event failed");
|
||||
bps_event_destroy(event);
|
||||
return BPS_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return BPS_SUCCESS;
|
||||
}
|
||||
|
||||
QEventDispatcherBlackberryPrivate::QEventDispatcherBlackberryPrivate()
|
||||
: loop_level(0)
|
||||
, ioData(new bpsIOHandlerData)
|
||||
{
|
||||
// prepare to use BPS
|
||||
int result = bps_initialize();
|
||||
if (Q_UNLIKELY(result != BPS_SUCCESS))
|
||||
qFatal("QEventDispatcherBlackberry: bps_initialize failed");
|
||||
|
||||
bps_channel = bps_channel_get_active();
|
||||
|
||||
if (bps_channel_create(&holding_channel, 0) != BPS_SUCCESS) {
|
||||
qWarning("QEventDispatcherBlackberry: bps_channel_create failed");
|
||||
holding_channel = -1;
|
||||
}
|
||||
|
||||
// get domain for IO ready and wake up events - ignoring race condition here for now
|
||||
if (bpsUnblockDomain == -1) {
|
||||
bpsUnblockDomain = bps_register_domain();
|
||||
if (Q_UNLIKELY(bpsUnblockDomain == -1))
|
||||
qWarning("QEventDispatcherBlackberry: bps_register_domain failed");
|
||||
}
|
||||
}
|
||||
|
||||
QEventDispatcherBlackberryPrivate::~QEventDispatcherBlackberryPrivate()
|
||||
{
|
||||
if ((holding_channel != -1) &&
|
||||
(bps_channel_destroy(holding_channel) != BPS_SUCCESS)) {
|
||||
qWarning("QEventDispatcherBlackberry: bps_channel_destroy failed");
|
||||
}
|
||||
|
||||
// we're done using BPS
|
||||
bps_shutdown();
|
||||
}
|
||||
|
||||
int QEventDispatcherBlackberryPrivate::initThreadWakeUp()
|
||||
{
|
||||
return -1; // no fd's used
|
||||
}
|
||||
|
||||
int QEventDispatcherBlackberryPrivate::processThreadWakeUp(int nsel)
|
||||
{
|
||||
Q_UNUSED(nsel);
|
||||
return wakeUps.fetchAndStoreRelaxed(0);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
QEventDispatcherBlackberry::QEventDispatcherBlackberry(QObject *parent)
|
||||
: QEventDispatcherUNIX(*new QEventDispatcherBlackberryPrivate, parent)
|
||||
{
|
||||
}
|
||||
|
||||
QEventDispatcherBlackberry::QEventDispatcherBlackberry(QEventDispatcherBlackberryPrivate &dd, QObject *parent)
|
||||
: QEventDispatcherUNIX(dd, parent)
|
||||
{
|
||||
}
|
||||
|
||||
QEventDispatcherBlackberry::~QEventDispatcherBlackberry()
|
||||
{
|
||||
}
|
||||
|
||||
void QEventDispatcherBlackberry::registerSocketNotifier(QSocketNotifier *notifier)
|
||||
{
|
||||
Q_ASSERT(notifier);
|
||||
Q_D(QEventDispatcherBlackberry);
|
||||
|
||||
int sockfd = notifier->socket();
|
||||
int type = notifier->type();
|
||||
|
||||
qEventDispatcherDebug << Q_FUNC_INFO << "fd =" << sockfd;
|
||||
|
||||
if (Q_UNLIKELY(sockfd >= FD_SETSIZE)) {
|
||||
qWarning() << "QEventDispatcherBlackberry: cannot register QSocketNotifier (fd too high)"
|
||||
<< sockfd;
|
||||
return;
|
||||
}
|
||||
|
||||
// Register the fd with bps
|
||||
BpsChannelScopeSwitcher channelSwitcher(d->bps_channel);
|
||||
int io_events = ioEvents(sockfd);
|
||||
if (io_events)
|
||||
bps_remove_fd(sockfd);
|
||||
|
||||
switch (type) {
|
||||
case QSocketNotifier::Read:
|
||||
qEventDispatcherDebug << "Registering" << sockfd << "for Reads";
|
||||
io_events |= BPS_IO_INPUT;
|
||||
break;
|
||||
case QSocketNotifier::Write:
|
||||
qEventDispatcherDebug << "Registering" << sockfd << "for Writes";
|
||||
io_events |= BPS_IO_OUTPUT;
|
||||
break;
|
||||
case QSocketNotifier::Exception:
|
||||
default:
|
||||
qEventDispatcherDebug << "Registering" << sockfd << "for Exceptions";
|
||||
io_events |= BPS_IO_EXCEPT;
|
||||
break;
|
||||
}
|
||||
|
||||
const int result = bps_add_fd(sockfd, io_events, &bpsIOHandler, d->ioData.data());
|
||||
if (Q_UNLIKELY(result != BPS_SUCCESS))
|
||||
qWarning() << "QEventDispatcherBlackberry: bps_add_fd failed";
|
||||
|
||||
// Call the base Unix implementation. Needed to allow select() to be called correctly
|
||||
QEventDispatcherUNIX::registerSocketNotifier(notifier);
|
||||
}
|
||||
|
||||
void QEventDispatcherBlackberry::unregisterSocketNotifier(QSocketNotifier *notifier)
|
||||
{
|
||||
Q_D(QEventDispatcherBlackberry);
|
||||
|
||||
int sockfd = notifier->socket();
|
||||
|
||||
qEventDispatcherDebug << Q_FUNC_INFO << "fd =" << sockfd;
|
||||
|
||||
if (Q_UNLIKELY(sockfd >= FD_SETSIZE)) {
|
||||
qWarning() << "QEventDispatcherBlackberry: cannot unregister QSocketNotifier" << sockfd;
|
||||
return;
|
||||
}
|
||||
|
||||
// Allow the base Unix implementation to unregister the fd too (before call to ioEvents()!)
|
||||
QEventDispatcherUNIX::unregisterSocketNotifier(notifier);
|
||||
|
||||
// Unregister the fd with bps
|
||||
BpsChannelScopeSwitcher channelSwitcher(d->bps_channel);
|
||||
int result = bps_remove_fd(sockfd);
|
||||
if (Q_UNLIKELY(result != BPS_SUCCESS))
|
||||
qWarning() << "QEventDispatcherBlackberry: bps_remove_fd failed" << sockfd;
|
||||
|
||||
const int io_events = ioEvents(sockfd);
|
||||
// if other socket notifier is watching sockfd, readd it
|
||||
if (io_events) {
|
||||
result = bps_add_fd(sockfd, io_events, &bpsIOHandler, d->ioData.data());
|
||||
if (Q_UNLIKELY(result != BPS_SUCCESS))
|
||||
qWarning("QEventDispatcherBlackberry: bps_add_fd error");
|
||||
}
|
||||
}
|
||||
|
||||
static inline int timespecToMillisecs(const timespec &tv)
|
||||
{
|
||||
return (tv.tv_sec * 1000) + (tv.tv_nsec / 1000000);
|
||||
}
|
||||
|
||||
static inline void destroyHeldBpsEvent(int holding_channel)
|
||||
{
|
||||
// Switch to the holding channel and use bps_get_event() to trigger its destruction. We
|
||||
// don't care about the return value from this call to bps_get_event().
|
||||
BpsChannelScopeSwitcher holdingChannelSwitcher(holding_channel);
|
||||
bps_event_t *held_event = 0;
|
||||
(void)bps_get_event(&held_event, 0);
|
||||
}
|
||||
|
||||
int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
|
||||
timespec *timeout)
|
||||
{
|
||||
Q_UNUSED(nfds);
|
||||
Q_D(QEventDispatcherBlackberry);
|
||||
const BBScopedLoopLevelCounter bbLoopCounter(d);
|
||||
|
||||
BpsChannelScopeSwitcher channelSwitcher(d->bps_channel);
|
||||
|
||||
// prepare file sets for bps callback
|
||||
d->ioData->count = 0;
|
||||
d->ioData->readfds = readfds;
|
||||
d->ioData->writefds = writefds;
|
||||
d->ioData->exceptfds = exceptfds;
|
||||
|
||||
// reset all file sets
|
||||
if (readfds)
|
||||
FD_ZERO(readfds);
|
||||
|
||||
if (writefds)
|
||||
FD_ZERO(writefds);
|
||||
|
||||
if (exceptfds)
|
||||
FD_ZERO(exceptfds);
|
||||
|
||||
bps_event_t *event = 0;
|
||||
unsigned int eventCount = 0;
|
||||
|
||||
// If an event handler called through filterEvent() starts a nested event loop by creating a
|
||||
// new QEventLoop, we will recursively enter this function again. However, each time
|
||||
// bps_get_event() is called, it destroys the last event it handed out before returning the
|
||||
// next event. We don't want it to destroy the event that triggered the nested event loop,
|
||||
// since there may still be more handlers that need to get that event, once the nested event
|
||||
// loop is done and control returns to the outer event loop.
|
||||
//
|
||||
// So we move an event to a holding channel, which takes ownership of the event. Putting
|
||||
// the event on our own channel allows us to manage when it is destroyed, keeping it alive
|
||||
// until we know we are done with it. Each recursive call of this function needs to have
|
||||
// it's own holding channel, since a channel is a queue, not a stack.
|
||||
//
|
||||
// However, a recursive call into this function happens very rarely compared to the many
|
||||
// times this function is called. We don't want to create a holding channel for each time
|
||||
// this function is called, only when it is called recursively. Thus we have the instance
|
||||
// variable d->holding_channel to use in the common case. We keep track of recursive calls
|
||||
// with d->loop_level. If we are in a recursive call, then we create a new holding channel
|
||||
// for this run.
|
||||
int holding_channel = d->holding_channel;
|
||||
if ((d->loop_level > 1) &&
|
||||
Q_UNLIKELY(bps_channel_create(&holding_channel, 0) != BPS_SUCCESS)) {
|
||||
qWarning("QEventDispatcherBlackberry: bps_channel_create failed");
|
||||
holding_channel = -1;
|
||||
}
|
||||
|
||||
// Convert timeout to milliseconds
|
||||
int timeoutTotal = -1;
|
||||
if (timeout)
|
||||
timeoutTotal = timespecToMillisecs(*timeout);
|
||||
int timeoutLeft = timeoutTotal;
|
||||
timespec startTime = qt_gettime();
|
||||
|
||||
// This loop exists such that we can drain the bps event queue of all native events
|
||||
// more efficiently than if we were to return control to Qt after each event. This
|
||||
// is important for handling touch events which can come in rapidly.
|
||||
forever {
|
||||
// Only emit the awake() and aboutToBlock() signals in the second iteration. For the
|
||||
// first iteration, the UNIX event dispatcher will have taken care of that already.
|
||||
// Also native events are actually processed one loop iteration after they were
|
||||
// retrieved with bps_get_event().
|
||||
|
||||
// Filtering the native event should happen between the awake() and aboutToBlock()
|
||||
// signal emissions. The calls awake() - filterNativeEvent() - aboutToBlock() -
|
||||
// bps_get_event() need not to be interrupted by a break or return statement.
|
||||
if (eventCount > 0) {
|
||||
if (event) {
|
||||
emit awake();
|
||||
filterNativeEvent(QByteArrayLiteral("bps_event_t"), static_cast<void*>(event), 0);
|
||||
emit aboutToBlock();
|
||||
|
||||
if (Q_LIKELY(holding_channel != -1)) {
|
||||
// We are now done with this BPS event. Destroy it.
|
||||
destroyHeldBpsEvent(holding_channel);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the timeout
|
||||
// Clock source is monotonic, so we can recalculate how much timeout is left
|
||||
if (timeoutTotal != -1) {
|
||||
timespec t2 = qt_gettime();
|
||||
timeoutLeft = timeoutTotal
|
||||
- (timespecToMillisecs(t2) - timespecToMillisecs(startTime));
|
||||
if (timeoutLeft < 0)
|
||||
timeoutLeft = 0;
|
||||
}
|
||||
|
||||
timespec tnext;
|
||||
if (d->timerList.timerWait(tnext)) {
|
||||
int timeoutNext = timespecToMillisecs(tnext);
|
||||
if (timeoutNext < timeoutLeft || timeoutTotal == -1) {
|
||||
timeoutTotal = timeoutLeft = timeoutNext;
|
||||
startTime = qt_gettime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event = 0;
|
||||
{ // We need to increase loop level in this scope,
|
||||
// because bps_get_event can also invoke callbacks
|
||||
QScopedLoopLevelCounter loopLevelCounter(d->threadData);
|
||||
|
||||
// Wait for event or file to be ready
|
||||
const int result = bps_get_event(&event, timeoutLeft);
|
||||
if (Q_UNLIKELY(result != BPS_SUCCESS))
|
||||
qWarning("QEventDispatcherBlackberry: bps_get_event failed");
|
||||
}
|
||||
|
||||
if (!event) // In case of !event, we break out of the loop to let Qt process the timers
|
||||
break; // (since timeout has expired) and socket notifiers that are now ready.
|
||||
|
||||
if (bps_event_get_domain(event) == bpsUnblockDomain) {
|
||||
timeoutTotal = 0; // in order to immediately drain the event queue of native events
|
||||
event = 0; // (especially touch move events) we don't break out here
|
||||
} else {
|
||||
// Move the event to our holding channel so we can manage when it is destroyed.
|
||||
if (Q_LIKELY(holding_channel != 1) &&
|
||||
Q_UNLIKELY(bps_channel_push_event(holding_channel, event) != BPS_SUCCESS)) {
|
||||
qWarning("QEventDispatcherBlackberry: bps_channel_push_event failed");
|
||||
}
|
||||
}
|
||||
|
||||
++eventCount;
|
||||
|
||||
// Make sure we are not trapped in this loop due to continuous native events
|
||||
// also we cannot recalculate the timeout without a monotonic clock as the time may have changed
|
||||
const unsigned int maximumEventCount = 12;
|
||||
if (Q_UNLIKELY((eventCount > maximumEventCount && timeoutLeft == 0)
|
||||
|| !QElapsedTimer::isMonotonic())) {
|
||||
if (event) {
|
||||
filterNativeEvent(QByteArrayLiteral("bps_event_t"), static_cast<void*>(event), 0);
|
||||
|
||||
if (Q_LIKELY(holding_channel != -1)) {
|
||||
// We are now done with this BPS event. Destroy it.
|
||||
destroyHeldBpsEvent(holding_channel);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If this was a recursive call into this function, a new holding channel was created for
|
||||
// this run, so destroy it now.
|
||||
if ((holding_channel != d->holding_channel) &&
|
||||
Q_LIKELY(holding_channel != -1) &&
|
||||
Q_UNLIKELY(bps_channel_destroy(holding_channel) != BPS_SUCCESS)) {
|
||||
qWarning("QEventDispatcherBlackberry: bps_channel_destroy failed");
|
||||
}
|
||||
|
||||
// the number of bits set in the file sets
|
||||
return d->ioData->count;
|
||||
}
|
||||
|
||||
void QEventDispatcherBlackberry::wakeUp()
|
||||
{
|
||||
Q_D(QEventDispatcherBlackberry);
|
||||
if (d->wakeUps.testAndSetAcquire(0, 1)) {
|
||||
bps_event_t *event;
|
||||
if (Q_LIKELY(bps_event_create(&event, bpsUnblockDomain, 0, 0, 0) == BPS_SUCCESS)) {
|
||||
if (Q_LIKELY(bps_channel_push_event(d->bps_channel, event) == BPS_SUCCESS))
|
||||
return;
|
||||
else
|
||||
bps_event_destroy(event);
|
||||
}
|
||||
qWarning("QEventDispatcherBlackberry: wakeUp failed");
|
||||
}
|
||||
}
|
||||
|
||||
int QEventDispatcherBlackberry::ioEvents(int fd)
|
||||
{
|
||||
int io_events = 0;
|
||||
|
||||
Q_D(QEventDispatcherBlackberry);
|
||||
|
||||
if (FD_ISSET(fd, &d->sn_vec[0].enabled_fds))
|
||||
io_events |= BPS_IO_INPUT;
|
||||
|
||||
if (FD_ISSET(fd, &d->sn_vec[1].enabled_fds))
|
||||
io_events |= BPS_IO_OUTPUT;
|
||||
|
||||
if (FD_ISSET(fd, &d->sn_vec[2].enabled_fds))
|
||||
io_events |= BPS_IO_EXCEPT;
|
||||
|
||||
return io_events;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -1,97 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QEVENTDISPATCHER_BLACKBERRY_P_H
|
||||
#define QEVENTDISPATCHER_BLACKBERRY_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include "private/qeventdispatcher_unix_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QEventDispatcherBlackberryPrivate;
|
||||
|
||||
class Q_CORE_EXPORT QEventDispatcherBlackberry : public QEventDispatcherUNIX
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DECLARE_PRIVATE(QEventDispatcherBlackberry)
|
||||
|
||||
public:
|
||||
explicit QEventDispatcherBlackberry(QObject *parent = 0);
|
||||
~QEventDispatcherBlackberry();
|
||||
|
||||
void registerSocketNotifier(QSocketNotifier *notifier);
|
||||
void unregisterSocketNotifier(QSocketNotifier *notifier);
|
||||
|
||||
void wakeUp();
|
||||
|
||||
protected:
|
||||
QEventDispatcherBlackberry(QEventDispatcherBlackberryPrivate &dd, QObject *parent = 0);
|
||||
|
||||
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
|
||||
timespec *timeout);
|
||||
int ioEvents(int fd);
|
||||
};
|
||||
|
||||
struct bpsIOHandlerData;
|
||||
|
||||
class Q_CORE_EXPORT QEventDispatcherBlackberryPrivate : public QEventDispatcherUNIXPrivate
|
||||
{
|
||||
Q_DECLARE_PUBLIC(QEventDispatcherBlackberry)
|
||||
|
||||
public:
|
||||
QEventDispatcherBlackberryPrivate();
|
||||
~QEventDispatcherBlackberryPrivate();
|
||||
|
||||
int initThreadWakeUp();
|
||||
int processThreadWakeUp(int nsel);
|
||||
|
||||
int bps_channel;
|
||||
int holding_channel;
|
||||
int loop_level;
|
||||
QScopedPointer<bpsIOHandlerData> ioData;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QEVENTDISPATCHER_BLACKBERRY_P_H
|
@ -92,7 +92,7 @@ QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate()
|
||||
bool pipefail = false;
|
||||
|
||||
// initialize the common parts of the event loop
|
||||
#if defined(Q_OS_NACL) || defined (Q_OS_BLACKBERRY)
|
||||
#if defined(Q_OS_NACL)
|
||||
// do nothing.
|
||||
#elif defined(Q_OS_INTEGRITY)
|
||||
// INTEGRITY doesn't like a "select" on pipes, so use socketpair instead
|
||||
@ -143,7 +143,7 @@ QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate()
|
||||
|
||||
QEventDispatcherUNIXPrivate::~QEventDispatcherUNIXPrivate()
|
||||
{
|
||||
#if defined(Q_OS_NACL) || defined (Q_OS_BLACKBERRY)
|
||||
#if defined(Q_OS_NACL)
|
||||
// do nothing.
|
||||
#elif defined(Q_OS_VXWORKS)
|
||||
close(thread_pipe[0]);
|
||||
|
@ -86,12 +86,6 @@ public:
|
||||
|
||||
class QEventDispatcherUNIXPrivate;
|
||||
|
||||
#ifdef Q_OS_QNX
|
||||
# define FINAL_EXCEPT_BLACKBERRY
|
||||
#else
|
||||
# define FINAL_EXCEPT_BLACKBERRY Q_DECL_FINAL
|
||||
#endif
|
||||
|
||||
class Q_CORE_EXPORT QEventDispatcherUNIX : public QAbstractEventDispatcher
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -104,8 +98,8 @@ public:
|
||||
bool processEvents(QEventLoop::ProcessEventsFlags flags) Q_DECL_OVERRIDE;
|
||||
bool hasPendingEvents() Q_DECL_OVERRIDE;
|
||||
|
||||
void registerSocketNotifier(QSocketNotifier *notifier) FINAL_EXCEPT_BLACKBERRY;
|
||||
void unregisterSocketNotifier(QSocketNotifier *notifier) FINAL_EXCEPT_BLACKBERRY;
|
||||
void registerSocketNotifier(QSocketNotifier *notifier) Q_DECL_FINAL;
|
||||
void unregisterSocketNotifier(QSocketNotifier *notifier) Q_DECL_FINAL;
|
||||
|
||||
void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object) Q_DECL_FINAL;
|
||||
bool unregisterTimer(int timerId) Q_DECL_FINAL;
|
||||
@ -114,7 +108,7 @@ public:
|
||||
|
||||
int remainingTime(int timerId) Q_DECL_FINAL;
|
||||
|
||||
void wakeUp() FINAL_EXCEPT_BLACKBERRY;
|
||||
void wakeUp() Q_DECL_FINAL;
|
||||
void interrupt() Q_DECL_FINAL;
|
||||
void flush() Q_DECL_OVERRIDE;
|
||||
|
||||
@ -140,8 +134,8 @@ public:
|
||||
~QEventDispatcherUNIXPrivate();
|
||||
|
||||
int doSelect(QEventLoop::ProcessEventsFlags flags, timespec *timeout);
|
||||
virtual int initThreadWakeUp() FINAL_EXCEPT_BLACKBERRY;
|
||||
virtual int processThreadWakeUp(int nsel) FINAL_EXCEPT_BLACKBERRY;
|
||||
virtual int initThreadWakeUp() Q_DECL_FINAL;
|
||||
virtual int processThreadWakeUp(int nsel) Q_DECL_FINAL;
|
||||
|
||||
bool mainThread;
|
||||
|
||||
@ -163,8 +157,6 @@ public:
|
||||
QAtomicInt interrupt; // bool
|
||||
};
|
||||
|
||||
#undef FINAL_EXCEPT_BLACKBERRY
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QEVENTDISPATCHER_UNIX_P_H
|
||||
|
@ -37,15 +37,12 @@
|
||||
|
||||
#include <private/qcoreapplication_p.h>
|
||||
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
# include <private/qeventdispatcher_blackberry_p.h>
|
||||
#else
|
||||
# if !defined(QT_NO_GLIB)
|
||||
# include "../kernel/qeventdispatcher_glib_p.h"
|
||||
# endif
|
||||
# include <private/qeventdispatcher_unix_p.h>
|
||||
#if !defined(QT_NO_GLIB)
|
||||
# include "../kernel/qeventdispatcher_glib_p.h"
|
||||
#endif
|
||||
|
||||
#include <private/qeventdispatcher_unix_p.h>
|
||||
|
||||
#include "qthreadstorage.h"
|
||||
|
||||
#include "qthread_p.h"
|
||||
@ -246,9 +243,6 @@ typedef void*(*QtThreadCallback)(void*);
|
||||
|
||||
void QThreadPrivate::createEventDispatcher(QThreadData *data)
|
||||
{
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
data->eventDispatcher.storeRelease(new QEventDispatcherBlackberry);
|
||||
#else
|
||||
#if !defined(QT_NO_GLIB)
|
||||
if (qEnvironmentVariableIsEmpty("QT_NO_GLIB")
|
||||
&& qEnvironmentVariableIsEmpty("QT_NO_THREADED_GLIB")
|
||||
@ -257,7 +251,6 @@ void QThreadPrivate::createEventDispatcher(QThreadData *data)
|
||||
else
|
||||
#endif
|
||||
data->eventDispatcher.storeRelease(new QEventDispatcherUNIX);
|
||||
#endif
|
||||
|
||||
data->eventDispatcher.load()->startingUp();
|
||||
}
|
||||
|
@ -1,333 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qlocale_blackberry.h"
|
||||
#include "qlocale_p.h"
|
||||
|
||||
#include "qdatetime.h"
|
||||
|
||||
#include "qcoreapplication.h"
|
||||
#include "private/qcore_unix_p.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/pps.h>
|
||||
#include <unistd.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_SYSTEMLOCALE
|
||||
|
||||
static const char ppsUomPath[] = "/pps/services/locale/uom";
|
||||
static const char ppsRegionLocalePath[] = "/pps/services/locale/settings";
|
||||
static const char ppsLanguageLocalePath[] = "/pps/services/confstr/_CS_LOCALE";
|
||||
static const char ppsHourFormatPath[] = "/pps/system/settings";
|
||||
|
||||
static const int MAX_PPS_SIZE = 16000;
|
||||
|
||||
QBBSystemLocaleData::QBBSystemLocaleData()
|
||||
: languageNotifier(0)
|
||||
, regionNotifier(0)
|
||||
, measurementNotifier(0)
|
||||
, hourNotifier(0)
|
||||
{
|
||||
// Do not use qWarning to log warnings if qt_safe_open fails to open the pps file
|
||||
// since the user code may install a message handler that invokes QLocale API again
|
||||
// (i.e QDate, QDateTime, ...) which will cause a deadlock.
|
||||
if ((measurementFd = qt_safe_open(ppsUomPath, O_RDONLY)) == -1)
|
||||
fprintf(stderr, "Failed to open uom pps, errno=%d\n", errno);
|
||||
|
||||
if ((regionFd = qt_safe_open(ppsRegionLocalePath, O_RDONLY)) == -1)
|
||||
fprintf(stderr, "Failed to open region pps, errno=%d\n", errno);
|
||||
|
||||
if ((languageFd = qt_safe_open(ppsLanguageLocalePath, O_RDONLY)) == -1)
|
||||
fprintf(stderr, "Failed to open language pps, errno=%d\n", errno);
|
||||
|
||||
if ((hourFd = qt_safe_open(ppsHourFormatPath, O_RDONLY)) == -1)
|
||||
fprintf(stderr, "Failed to open hour format pps, errno=%d\n", errno);
|
||||
|
||||
// we cannot call this directly, because by the time this constructor is
|
||||
// called, the event dispatcher has not yet been created, causing the
|
||||
// subsequent call to QSocketNotifier constructor to fail.
|
||||
QMetaObject::invokeMethod(this, "installSocketNotifiers", Qt::QueuedConnection);
|
||||
|
||||
readLanguageLocale();
|
||||
readRegionLocale();
|
||||
readMeasurementSystem();
|
||||
readHourFormat();
|
||||
}
|
||||
|
||||
QBBSystemLocaleData::~QBBSystemLocaleData()
|
||||
{
|
||||
if (measurementFd != -1)
|
||||
qt_safe_close(measurementFd);
|
||||
|
||||
if (languageFd != -1)
|
||||
qt_safe_close(languageFd);
|
||||
|
||||
if (regionFd != -1)
|
||||
qt_safe_close(regionFd);
|
||||
|
||||
if (hourFd != -1)
|
||||
qt_safe_close(hourFd);
|
||||
}
|
||||
|
||||
uint QBBSystemLocaleData::measurementSystem()
|
||||
{
|
||||
return m_measurementSystem;
|
||||
}
|
||||
|
||||
QVariant QBBSystemLocaleData::timeFormat(QLocale::FormatType formatType)
|
||||
{
|
||||
return getCorrectFormat(regionLocale().timeFormat(formatType), formatType);
|
||||
}
|
||||
|
||||
QVariant QBBSystemLocaleData::dateTimeFormat(QLocale::FormatType formatType)
|
||||
{
|
||||
return getCorrectFormat(regionLocale().dateTimeFormat(formatType), formatType);
|
||||
}
|
||||
|
||||
QLocale QBBSystemLocaleData::languageLocale()
|
||||
{
|
||||
if (!lc_language.isEmpty())
|
||||
return QLocale(QLatin1String(lc_language));
|
||||
|
||||
return QLocale::c();
|
||||
}
|
||||
|
||||
QLocale QBBSystemLocaleData::regionLocale()
|
||||
{
|
||||
if (!lc_region.isEmpty())
|
||||
return QLocale(QLatin1String(lc_region));
|
||||
|
||||
return QLocale::c();
|
||||
}
|
||||
|
||||
void QBBSystemLocaleData::installSocketNotifiers()
|
||||
{
|
||||
Q_ASSERT(!languageNotifier || !regionNotifier || !measurementNotifier || !hourNotifier);
|
||||
Q_ASSERT(QCoreApplication::instance());
|
||||
|
||||
languageNotifier = new QSocketNotifier(languageFd, QSocketNotifier::Read, this);
|
||||
QObject::connect(languageNotifier, SIGNAL(activated(int)), this, SLOT(readLanguageLocale()));
|
||||
|
||||
regionNotifier = new QSocketNotifier(regionFd, QSocketNotifier::Read, this);
|
||||
QObject::connect(regionNotifier, SIGNAL(activated(int)), this, SLOT(readRegionLocale()));
|
||||
|
||||
measurementNotifier = new QSocketNotifier(measurementFd, QSocketNotifier::Read, this);
|
||||
QObject::connect(measurementNotifier, SIGNAL(activated(int)), this, SLOT(readMeasurementSystem()));
|
||||
|
||||
hourNotifier = new QSocketNotifier(hourFd, QSocketNotifier::Read, this);
|
||||
QObject::connect(hourNotifier, SIGNAL(activated(int)), this, SLOT(readHourFormat()));
|
||||
}
|
||||
|
||||
void QBBSystemLocaleData::readLanguageLocale()
|
||||
{
|
||||
lc_language = readPpsValue("_CS_LOCALE", languageFd);
|
||||
}
|
||||
|
||||
void QBBSystemLocaleData::readRegionLocale()
|
||||
{
|
||||
lc_region = readPpsValue("region", regionFd);
|
||||
}
|
||||
|
||||
void QBBSystemLocaleData::readMeasurementSystem()
|
||||
{
|
||||
QByteArray measurement = readPpsValue("uom", measurementFd);
|
||||
m_measurementSystem = (qstrcmp(measurement, "imperial") == 0) ? QLocale::ImperialSystem : QLocale::MetricSystem;
|
||||
}
|
||||
|
||||
void QBBSystemLocaleData::readHourFormat()
|
||||
{
|
||||
QByteArray hourFormat = readPpsValue("hourFormat", hourFd);
|
||||
is24HourFormat = (qstrcmp(hourFormat, "24") == 0);
|
||||
}
|
||||
|
||||
QByteArray QBBSystemLocaleData::readPpsValue(const char *ppsObject, int ppsFd)
|
||||
{
|
||||
QByteArray result;
|
||||
if (!ppsObject || ppsFd == -1)
|
||||
return result;
|
||||
|
||||
// PPS objects are of unknown size, but must be read all at once.
|
||||
// Relying on the file size may not be a good idea since the size may change before reading.
|
||||
// Let's try with an initial size (512), and if the buffer is too small try with bigger one,
|
||||
// until we succeed or until other non buffer-size-related error occurs.
|
||||
// Using QVarLengthArray means the first try (of size == 512) uses a buffer on the stack - no allocation necessary.
|
||||
// Hopefully that covers most use cases.
|
||||
int bytes;
|
||||
QVarLengthArray<char, 512> buffer(512);
|
||||
for (;;) {
|
||||
errno = 0;
|
||||
bytes = qt_safe_read(ppsFd, buffer.data(), buffer.size() - 1);
|
||||
const bool bufferIsTooSmall = (bytes == -1 && errno == EMSGSIZE && buffer.size() < MAX_PPS_SIZE);
|
||||
if (!bufferIsTooSmall)
|
||||
break;
|
||||
|
||||
buffer.resize(qMin(buffer.size()*2, MAX_PPS_SIZE));
|
||||
}
|
||||
|
||||
// This method is called in the ctor(), so do not use qWarning to log warnings
|
||||
// if qt_safe_read fails to read the pps file
|
||||
// since the user code may install a message handler that invokes QLocale API again
|
||||
// (i.e QDate, QDateTime, ...) which will cause a deadlock.
|
||||
if (bytes == -1) {
|
||||
fprintf(stderr, "Failed to read pps object:%s, errno=%d\n", ppsObject, errno);
|
||||
return result;
|
||||
}
|
||||
// ensure data is null terminated
|
||||
buffer[bytes] = '\0';
|
||||
|
||||
pps_decoder_t ppsDecoder;
|
||||
pps_decoder_initialize(&ppsDecoder, 0);
|
||||
if (pps_decoder_parse_pps_str(&ppsDecoder, buffer.data()) == PPS_DECODER_OK) {
|
||||
pps_decoder_push(&ppsDecoder, 0);
|
||||
const char *ppsBuff;
|
||||
if (pps_decoder_get_string(&ppsDecoder, ppsObject, &ppsBuff) == PPS_DECODER_OK) {
|
||||
result = ppsBuff;
|
||||
} else {
|
||||
int val;
|
||||
if (pps_decoder_get_int(&ppsDecoder, ppsObject, &val) == PPS_DECODER_OK)
|
||||
result = QByteArray::number(val);
|
||||
}
|
||||
}
|
||||
|
||||
pps_decoder_cleanup(&ppsDecoder);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QString QBBSystemLocaleData::getCorrectFormat(const QString &baseFormat, QLocale::FormatType formatType)
|
||||
{
|
||||
QString format = baseFormat;
|
||||
if (is24HourFormat) {
|
||||
if (format.contains(QStringLiteral("AP"), Qt::CaseInsensitive)) {
|
||||
format.replace(QStringLiteral("AP"), QStringLiteral(""), Qt::CaseInsensitive);
|
||||
format.replace(QStringLiteral("h"), QStringLiteral("H"), Qt::CaseSensitive);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (!format.contains(QStringLiteral("AP"), Qt::CaseInsensitive)) {
|
||||
format.contains(QStringLiteral("HH"), Qt::CaseSensitive) ?
|
||||
format.replace(QStringLiteral("HH"), QStringLiteral("hh"), Qt::CaseSensitive) :
|
||||
format.replace(QStringLiteral("H"), QStringLiteral("h"), Qt::CaseSensitive);
|
||||
|
||||
formatType == QLocale::LongFormat ? format.append(QStringLiteral(" AP t")) : format.append(QStringLiteral(" AP"));
|
||||
}
|
||||
}
|
||||
|
||||
return format;
|
||||
}
|
||||
|
||||
Q_GLOBAL_STATIC(QBBSystemLocaleData, bbSysLocaleData)
|
||||
|
||||
QLocale QSystemLocale::fallbackUiLocale() const
|
||||
{
|
||||
return bbSysLocaleData()->languageLocale();
|
||||
}
|
||||
|
||||
QVariant QSystemLocale::query(QueryType type, QVariant in) const
|
||||
{
|
||||
QBBSystemLocaleData *d = bbSysLocaleData();
|
||||
|
||||
QReadLocker locker(&d->lock);
|
||||
|
||||
const QLocale &lc_language = d->languageLocale();
|
||||
const QLocale &lc_region = d->regionLocale();
|
||||
|
||||
switch (type) {
|
||||
case DecimalPoint:
|
||||
return lc_region.decimalPoint();
|
||||
case GroupSeparator:
|
||||
return lc_region.groupSeparator();
|
||||
case NegativeSign:
|
||||
return lc_region.negativeSign();
|
||||
case PositiveSign:
|
||||
return lc_region.positiveSign();
|
||||
case DateFormatLong:
|
||||
return lc_region.dateFormat(QLocale::LongFormat);
|
||||
case DateFormatShort:
|
||||
return lc_region.dateFormat(QLocale::ShortFormat);
|
||||
case TimeFormatLong:
|
||||
return d->timeFormat(QLocale::LongFormat);
|
||||
case TimeFormatShort:
|
||||
return d->timeFormat(QLocale::ShortFormat);
|
||||
case DateTimeFormatLong:
|
||||
return d->dateTimeFormat(QLocale::LongFormat);
|
||||
case DateTimeFormatShort:
|
||||
return d->dateTimeFormat(QLocale::ShortFormat);
|
||||
case DayNameLong:
|
||||
return lc_language.dayName(in.toInt(), QLocale::LongFormat);
|
||||
case DayNameShort:
|
||||
return lc_language.dayName(in.toInt(), QLocale::ShortFormat);
|
||||
case MonthNameLong:
|
||||
return lc_language.monthName(in.toInt(), QLocale::LongFormat);
|
||||
case MonthNameShort:
|
||||
return lc_language.monthName(in.toInt(), QLocale::ShortFormat);
|
||||
case StandaloneMonthNameLong:
|
||||
return lc_language.standaloneMonthName(in.toInt(), QLocale::LongFormat);
|
||||
case StandaloneMonthNameShort:
|
||||
return lc_language.standaloneMonthName(in.toInt(), QLocale::ShortFormat);
|
||||
case DateToStringLong:
|
||||
return lc_region.toString(in.toDate(), QLocale::LongFormat);
|
||||
case DateToStringShort:
|
||||
return lc_region.toString(in.toDate(), QLocale::ShortFormat);
|
||||
case TimeToStringLong:
|
||||
return lc_region.toString(in.toTime(), d->timeFormat(QLocale::LongFormat).toString());
|
||||
case TimeToStringShort:
|
||||
return lc_region.toString(in.toTime(), d->timeFormat(QLocale::ShortFormat).toString());
|
||||
case DateTimeToStringShort:
|
||||
return lc_region.toString(in.toDateTime(), d->dateTimeFormat(QLocale::ShortFormat).toString());
|
||||
case DateTimeToStringLong:
|
||||
return lc_region.toString(in.toDateTime(), d->dateTimeFormat(QLocale::LongFormat).toString());
|
||||
case MeasurementSystem:
|
||||
return d->measurementSystem();
|
||||
case ZeroDigit:
|
||||
return lc_region.zeroDigit();
|
||||
case CountryId:
|
||||
return lc_region.country();
|
||||
case LanguageId:
|
||||
return lc_language.language();
|
||||
case AMText:
|
||||
return lc_language.amText();
|
||||
case PMText:
|
||||
return lc_language.pmText();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
@ -1,91 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QLOCALE_BLACKBERRY_H
|
||||
#define QLOCALE_BLACKBERRY_H
|
||||
|
||||
#include <QtCore/qsocketnotifier.h>
|
||||
#include <QtCore/qreadwritelock.h>
|
||||
#include <QtCore/qlocale.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_SYSTEMLOCALE
|
||||
|
||||
class QBBSystemLocaleData : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QBBSystemLocaleData();
|
||||
virtual ~QBBSystemLocaleData();
|
||||
uint measurementSystem();
|
||||
QVariant timeFormat(QLocale::FormatType);
|
||||
QVariant dateTimeFormat(QLocale::FormatType);
|
||||
QLocale languageLocale();
|
||||
QLocale regionLocale();
|
||||
|
||||
QReadWriteLock lock;
|
||||
|
||||
public Q_SLOTS:
|
||||
void installSocketNotifiers();
|
||||
void readLanguageLocale();
|
||||
void readRegionLocale();
|
||||
void readMeasurementSystem();
|
||||
void readHourFormat();
|
||||
|
||||
private:
|
||||
QByteArray readPpsValue(const char *ppsObject, int ppsFd);
|
||||
QString getCorrectFormat(const QString &baseFormat, QLocale::FormatType typeFormat);
|
||||
|
||||
QByteArray lc_language;
|
||||
QByteArray lc_region;
|
||||
uint m_measurementSystem;
|
||||
bool is24HourFormat;
|
||||
|
||||
QSocketNotifier *languageNotifier;
|
||||
QSocketNotifier *regionNotifier;
|
||||
QSocketNotifier *measurementNotifier;
|
||||
QSocketNotifier *hourNotifier;
|
||||
|
||||
int languageFd;
|
||||
int regionFd;
|
||||
int measurementFd;
|
||||
int hourFd;
|
||||
};
|
||||
#endif // QT_NO_SYSTEMLOCALE
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QLOCALE_BLACKBERRY_H
|
||||
|
@ -137,10 +137,6 @@ false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator
|
||||
tools/qbytearray_mac.mm \
|
||||
tools/qdatetime_mac.mm
|
||||
}
|
||||
else:blackberry {
|
||||
SOURCES += tools/qelapsedtimer_unix.cpp tools/qlocale_blackberry.cpp tools/qtimezoneprivate_tz.cpp
|
||||
HEADERS += tools/qlocale_blackberry.h
|
||||
}
|
||||
else:android {
|
||||
SOURCES += tools/qelapsedtimer_unix.cpp tools/qlocale_unix.cpp tools/qtimezoneprivate_android.cpp
|
||||
}
|
||||
|
@ -35,11 +35,6 @@
|
||||
#include "qnetworkconfiguration_p.h"
|
||||
#include <QDebug>
|
||||
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
#include "private/qcore_unix_p.h" // qt_safe_open
|
||||
#include <sys/pps.h>
|
||||
#endif // Q_OS_BLACKBERRY
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
@ -202,77 +197,6 @@ QT_BEGIN_NAMESPACE
|
||||
\value BearerLTE The configuration is for a LTE (4G) interface.
|
||||
*/
|
||||
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
static const char cellularStatusFile[] = "/pps/services/radioctrl/modem0/status_public";
|
||||
|
||||
static QNetworkConfiguration::BearerType cellularStatus()
|
||||
{
|
||||
QNetworkConfiguration::BearerType ret = QNetworkConfiguration::BearerUnknown;
|
||||
|
||||
int cellularStatusFD;
|
||||
if ((cellularStatusFD = qt_safe_open(cellularStatusFile, O_RDONLY)) == -1) {
|
||||
qWarning() << Q_FUNC_INFO << "failed to open" << cellularStatusFile;
|
||||
return ret;
|
||||
}
|
||||
char buf[2048];
|
||||
if (qt_safe_read(cellularStatusFD, &buf, sizeof(buf)) == -1) {
|
||||
qWarning() << Q_FUNC_INFO << "read from PPS file failed:" << strerror(errno);
|
||||
qt_safe_close(cellularStatusFD);
|
||||
return ret;
|
||||
}
|
||||
pps_decoder_t ppsDecoder;
|
||||
if (pps_decoder_initialize(&ppsDecoder, buf) != PPS_DECODER_OK) {
|
||||
qWarning() << Q_FUNC_INFO << "failed to initialize PPS decoder";
|
||||
qt_safe_close(cellularStatusFD);
|
||||
return ret;
|
||||
}
|
||||
pps_decoder_error_t err;
|
||||
if ((err = pps_decoder_push(&ppsDecoder, 0)) != PPS_DECODER_OK) {
|
||||
qWarning() << Q_FUNC_INFO << "pps_decoder_push failed" << err;
|
||||
pps_decoder_cleanup(&ppsDecoder);
|
||||
qt_safe_close(cellularStatusFD);
|
||||
return ret;
|
||||
}
|
||||
if (!pps_decoder_is_integer(&ppsDecoder, "network_technology")) {
|
||||
qWarning() << Q_FUNC_INFO << "field has not the expected data type";
|
||||
pps_decoder_cleanup(&ppsDecoder);
|
||||
qt_safe_close(cellularStatusFD);
|
||||
return ret;
|
||||
}
|
||||
int type;
|
||||
if (!pps_decoder_get_int(&ppsDecoder, "network_technology", &type)
|
||||
== PPS_DECODER_OK) {
|
||||
qWarning() << Q_FUNC_INFO << "could not read bearer type from PPS";
|
||||
pps_decoder_cleanup(&ppsDecoder);
|
||||
qt_safe_close(cellularStatusFD);
|
||||
return ret;
|
||||
}
|
||||
switch (type) {
|
||||
case 0: // 0 == NONE
|
||||
break; // unhandled
|
||||
case 1: // fallthrough, 1 == GSM
|
||||
case 4: // 4 == CDMA_1X
|
||||
ret = QNetworkConfiguration::Bearer2G;
|
||||
break;
|
||||
case 2: // 2 == UMTS
|
||||
ret = QNetworkConfiguration::BearerWCDMA;
|
||||
break;
|
||||
case 8: // 8 == EVDO
|
||||
ret = QNetworkConfiguration::BearerEVDO;
|
||||
break;
|
||||
case 16: // 16 == LTE
|
||||
ret = QNetworkConfiguration::BearerLTE;
|
||||
break;
|
||||
default:
|
||||
qWarning() << Q_FUNC_INFO << "unhandled bearer type" << type;
|
||||
break;
|
||||
}
|
||||
pps_decoder_cleanup(&ppsDecoder);
|
||||
qt_safe_close(cellularStatusFD);
|
||||
return ret;
|
||||
}
|
||||
#endif // Q_OS_BLACKBERRY
|
||||
|
||||
/*!
|
||||
Constructs an invalid configuration object.
|
||||
|
||||
@ -494,19 +418,6 @@ QNetworkConfiguration::BearerType QNetworkConfiguration::bearerType() const
|
||||
return BearerUnknown;
|
||||
|
||||
QMutexLocker locker(&d->mutex);
|
||||
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
// for cellular configurations, we need to determine the exact
|
||||
// type right now, because it might have changed after the last scan
|
||||
if (d->bearerType == QNetworkConfiguration::Bearer2G) {
|
||||
QNetworkConfiguration::BearerType type = cellularStatus();
|
||||
// if reading the status failed for some reason, just
|
||||
// fall back to 2G
|
||||
return (type == QNetworkConfiguration::BearerUnknown)
|
||||
? QNetworkConfiguration::Bearer2G : type;
|
||||
}
|
||||
#endif // Q_OS_BLACKBERRY
|
||||
|
||||
return d->bearerType;
|
||||
}
|
||||
|
||||
@ -639,20 +550,6 @@ QString QNetworkConfiguration::bearerTypeName() const
|
||||
case BearerWLAN:
|
||||
return QStringLiteral("WLAN");
|
||||
case Bearer2G:
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
{
|
||||
// for cellular configurations, we need to determine the exact
|
||||
// type right now, because it might have changed after the last scan
|
||||
QNetworkConfiguration::BearerType type = cellularStatus();
|
||||
if (type == QNetworkConfiguration::BearerWCDMA) {
|
||||
return QStringLiteral("WCDMA");
|
||||
} else if (type == QNetworkConfiguration::BearerEVDO) {
|
||||
return QStringLiteral("EVDO");
|
||||
}else if (type == QNetworkConfiguration::BearerLTE) {
|
||||
return QStringLiteral("LTE");
|
||||
}
|
||||
}
|
||||
#endif // Q_OS_BLACKBERRY
|
||||
return QStringLiteral("2G");
|
||||
case Bearer3G:
|
||||
return QStringLiteral("3G");
|
||||
|
@ -51,10 +51,6 @@
|
||||
#include <QtCore/qmutex.h>
|
||||
#include <QtCore/qmap.h>
|
||||
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
#include <bps/netstatus.h>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
typedef QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> QNetworkConfigurationPrivatePointer;
|
||||
@ -66,9 +62,6 @@ public:
|
||||
type(QNetworkConfiguration::Invalid),
|
||||
purpose(QNetworkConfiguration::UnknownPurpose),
|
||||
bearerType(QNetworkConfiguration::BearerUnknown),
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
oldIpStatus(NETSTATUS_IP_STATUS_ERROR_UNKNOWN),
|
||||
#endif
|
||||
isValid(false), roamingSupported(false)
|
||||
{}
|
||||
virtual ~QNetworkConfigurationPrivate()
|
||||
@ -89,10 +82,6 @@ public:
|
||||
QNetworkConfiguration::Purpose purpose;
|
||||
QNetworkConfiguration::BearerType bearerType;
|
||||
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
netstatus_ip_status_t oldIpStatus;
|
||||
#endif
|
||||
|
||||
bool isValid;
|
||||
bool roamingSupported;
|
||||
|
||||
|
@ -55,10 +55,6 @@ mac {
|
||||
|
||||
mac:!ios:SOURCES += kernel/qnetworkproxy_mac.cpp
|
||||
else:win32:SOURCES += kernel/qnetworkproxy_win.cpp
|
||||
else:blackberry {
|
||||
SOURCES += kernel/qnetworkproxy_blackberry.cpp
|
||||
LIBS_PRIVATE += -lbps
|
||||
}
|
||||
else:contains(QT_CONFIG, libproxy) {
|
||||
SOURCES += kernel/qnetworkproxy_libproxy.cpp
|
||||
LIBS_PRIVATE += -lproxy
|
||||
|
@ -1530,12 +1530,6 @@ void QNetworkProxyFactory::setApplicationProxyFactory(QNetworkProxyFactory *fact
|
||||
SOCKS server for all queries. If SOCKS isn't enabled, it will use
|
||||
the HTTPS proxy for all TcpSocket and UrlRequest queries.
|
||||
|
||||
On BlackBerry, this function obtains proxy settings for the default
|
||||
configuration using system configuration. The type will be set based on
|
||||
protocol tag "http", "https", "ftp", respectively. By default, it
|
||||
assumes http type. Proxy username and password are also set during
|
||||
the query using system configuration.
|
||||
|
||||
On other systems, this function will pick up proxy settings from
|
||||
the "http_proxy" environment variable. This variable must be a URL
|
||||
using one of the following schemes: "http", "socks5" or "socks5h".
|
||||
@ -1552,10 +1546,6 @@ void QNetworkProxyFactory::setApplicationProxyFactory(QNetworkProxyFactory *fact
|
||||
|
||||
\li On Windows platforms, this function may take several seconds to
|
||||
execute depending on the configuration of the user's system.
|
||||
|
||||
\li On BlackBerry, only UrlRequest and TcpSocket queries are supported. SOCKS is
|
||||
not supported. The proxy credentials are only retrieved for the
|
||||
default configuration.
|
||||
\endlist
|
||||
*/
|
||||
|
||||
|
@ -1,165 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtNetwork module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* Some notes about the code:
|
||||
*
|
||||
* ** It is assumed that the system proxies are for url based requests
|
||||
* ie. HTTP/HTTPS based.
|
||||
*/
|
||||
|
||||
#include <QtNetwork/qnetworkproxy.h>
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
|
||||
|
||||
#include <QtCore/qflags.h>
|
||||
#include <QtCore/qurl.h>
|
||||
#include <QtNetwork/qnetworkconfiguration.h>
|
||||
|
||||
#include <bps/netstatus.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &query)
|
||||
{
|
||||
if (query.url().scheme() == QLatin1String("file")
|
||||
|| query.url().scheme() == QLatin1String("qrc"))
|
||||
return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
|
||||
|
||||
if (query.queryType() != QNetworkProxyQuery::UrlRequest
|
||||
&& query.queryType() != QNetworkProxyQuery::TcpSocket) {
|
||||
qWarning("Unsupported query type: %d", query.queryType());
|
||||
return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
|
||||
}
|
||||
|
||||
QUrl url;
|
||||
if (query.queryType() == QNetworkProxyQuery::UrlRequest) {
|
||||
url = query.url();
|
||||
} else if (query.queryType() == QNetworkProxyQuery::TcpSocket
|
||||
&& !query.peerHostName().isEmpty()) {
|
||||
url.setHost(query.peerHostName());
|
||||
switch (query.peerPort()) {
|
||||
case 443:
|
||||
url.setScheme(QStringLiteral("https"));
|
||||
break;
|
||||
case 21:
|
||||
url.setScheme(QStringLiteral("ftp"));
|
||||
break;
|
||||
default:
|
||||
// for unknown ports, we just pretend we are dealing
|
||||
// with a HTTP URL, otherwise we will not get a proxy
|
||||
// from the netstatus API
|
||||
url.setScheme(QStringLiteral("http"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!url.isValid()) {
|
||||
qWarning("Invalid URL: %s", qPrintable(url.toString()));
|
||||
return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
|
||||
}
|
||||
|
||||
netstatus_proxy_details_t details;
|
||||
memset(&details, 0, sizeof(netstatus_proxy_details_t));
|
||||
|
||||
#if BPS_VERSION >= 3001001
|
||||
|
||||
QByteArray bUrl(url.toEncoded());
|
||||
QString sInterface(query.networkConfiguration().name());
|
||||
QByteArray bInterface;
|
||||
if (!sInterface.isEmpty()) {
|
||||
if (query.networkConfiguration().type() != QNetworkConfiguration::InternetAccessPoint) {
|
||||
qWarning("Unsupported configuration type: %d", query.networkConfiguration().type());
|
||||
return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
|
||||
}
|
||||
bInterface = sInterface.toUtf8();
|
||||
}
|
||||
|
||||
if (netstatus_get_proxy_details_for_url(bUrl.constData(), (bInterface.isEmpty() ? NULL : bInterface.constData()), &details) != BPS_SUCCESS) {
|
||||
qWarning("netstatus_get_proxy_details_for_url failed! errno: %d", errno);
|
||||
return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if (netstatus_get_proxy_details(&details) != BPS_SUCCESS) {
|
||||
qWarning("netstatus_get_proxy_details failed! errno: %d", errno);
|
||||
return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (details.http_proxy_host == NULL) { // No proxy
|
||||
netstatus_free_proxy_details(&details);
|
||||
return QList<QNetworkProxy>() << QNetworkProxy(QNetworkProxy::NoProxy);
|
||||
}
|
||||
|
||||
QNetworkProxy proxy;
|
||||
|
||||
QString protocol = query.protocolTag();
|
||||
if (protocol.startsWith(QLatin1String("http"), Qt::CaseInsensitive)) { // http, https
|
||||
proxy.setType((QNetworkProxy::HttpProxy));
|
||||
} else if (protocol == QLatin1String("ftp")) {
|
||||
proxy.setType(QNetworkProxy::FtpCachingProxy);
|
||||
} else { // assume http proxy
|
||||
qDebug("Proxy type: %s assumed to be http proxy", qPrintable(protocol));
|
||||
proxy.setType((QNetworkProxy::HttpProxy));
|
||||
}
|
||||
|
||||
// Set host
|
||||
// Note: ftp and https proxy type fields *are* obsolete.
|
||||
// The user interface allows only one host/port which gets duplicated
|
||||
// to all proxy type fields.
|
||||
proxy.setHostName(QString::fromUtf8(details.http_proxy_host));
|
||||
|
||||
// Set port
|
||||
proxy.setPort(details.http_proxy_port);
|
||||
|
||||
// Set username
|
||||
if (details.http_proxy_login_user)
|
||||
proxy.setUser(QString::fromUtf8(details.http_proxy_login_user));
|
||||
|
||||
// Set password
|
||||
if (details.http_proxy_login_password)
|
||||
proxy.setPassword(QString::fromUtf8(details.http_proxy_login_password));
|
||||
|
||||
netstatus_free_proxy_details(&details);
|
||||
|
||||
return QList<QNetworkProxy>() << proxy;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
@ -1185,53 +1185,6 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize)
|
||||
return qint64(r);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) const
|
||||
{
|
||||
fd_set fds;
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(socketDescriptor, &fds);
|
||||
|
||||
int retval;
|
||||
QList<QSocketNotifier *> notifiers;
|
||||
if (selectForRead) {
|
||||
notifiers << readNotifier;
|
||||
retval = bb_select(notifiers, socketDescriptor + 1, &fds, 0, timeout);
|
||||
} else {
|
||||
notifiers << writeNotifier;
|
||||
retval = bb_select(notifiers, socketDescriptor + 1, 0, &fds, timeout);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool checkWrite,
|
||||
bool *selectForRead, bool *selectForWrite) const
|
||||
{
|
||||
fd_set fdread;
|
||||
FD_ZERO(&fdread);
|
||||
if (checkRead)
|
||||
FD_SET(socketDescriptor, &fdread);
|
||||
|
||||
fd_set fdwrite;
|
||||
FD_ZERO(&fdwrite);
|
||||
if (checkWrite)
|
||||
FD_SET(socketDescriptor, &fdwrite);
|
||||
|
||||
QList<QSocketNotifier *> notifiers;
|
||||
notifiers << readNotifier << writeNotifier;
|
||||
int ret = bb_select(notifiers, socketDescriptor + 1, &fdread, &fdwrite, timeout);
|
||||
|
||||
if (ret <= 0)
|
||||
return ret;
|
||||
*selectForRead = FD_ISSET(socketDescriptor, &fdread);
|
||||
*selectForWrite = FD_ISSET(socketDescriptor, &fdwrite);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else // not Q_OS_BLACKBERRY:
|
||||
|
||||
int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) const
|
||||
{
|
||||
fd_set fds;
|
||||
@ -1278,6 +1231,5 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif // Q_OS_BLACKBERRY
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -7,7 +7,6 @@ TEMPLATE = subdirs
|
||||
|
||||
#win32:SUBDIRS += nla
|
||||
win32:SUBDIRS += generic
|
||||
blackberry:SUBDIRS += blackberry
|
||||
win32:!wince:!winrt: SUBDIRS += nativewifi
|
||||
mac:contains(QT_CONFIG, corewlan):SUBDIRS += corewlan
|
||||
mac:SUBDIRS += generic
|
||||
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"Keys": [ "blackberry" ]
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
TARGET = qbbbearer
|
||||
|
||||
PLUGIN_TYPE = bearer
|
||||
PLUGIN_CLASS_NAME = QBBEnginePlugin
|
||||
load(qt_plugin)
|
||||
|
||||
QT = core-private network-private
|
||||
|
||||
# Uncomment this to enable debugging output for the plugin
|
||||
#DEFINES += QBBENGINE_DEBUG
|
||||
|
||||
HEADERS += qbbengine.h \
|
||||
../qnetworksession_impl.h \
|
||||
../qbearerengine_impl.h
|
||||
|
||||
SOURCES += qbbengine.cpp \
|
||||
../qnetworksession_impl.cpp \
|
||||
main.cpp
|
||||
|
||||
OTHER_FILES += blackberry.json
|
@ -1,63 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qbbengine.h"
|
||||
|
||||
#include <QtNetwork/private/qbearerplugin_p.h>
|
||||
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBBEnginePlugin : public QBearerEnginePlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QBearerEngineFactoryInterface" FILE "blackberry.json")
|
||||
|
||||
public:
|
||||
QBearerEngine *create(const QString &key) const;
|
||||
};
|
||||
|
||||
QBearerEngine *QBBEnginePlugin::create(const QString &key) const
|
||||
{
|
||||
if (key == QLatin1String("blackberry"))
|
||||
return new QBBEngine;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "main.moc"
|
||||
|
||||
#endif // QT_NO_BEARERMANAGEMENT
|
@ -1,413 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qbbengine.h"
|
||||
#include "../qnetworksession_impl.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QThreadStorage>
|
||||
#include <QStringList>
|
||||
#include <QTimer>
|
||||
|
||||
#include <bps/netstatus.h>
|
||||
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
|
||||
#ifdef QBBENGINE_DEBUG
|
||||
#define qBearerDebug qDebug
|
||||
#else
|
||||
#define qBearerDebug QT_NO_QDEBUG_MACRO
|
||||
#endif
|
||||
|
||||
struct NetstatusInterfaceListCleanupHelper
|
||||
{
|
||||
static inline void cleanup(netstatus_interface_list_t *list)
|
||||
{
|
||||
netstatus_free_interfaces(list);
|
||||
}
|
||||
};
|
||||
|
||||
struct NetstatusInterfaceCleanupHelper
|
||||
{
|
||||
static inline void cleanup(char *interface)
|
||||
{
|
||||
bps_free(interface);
|
||||
}
|
||||
};
|
||||
|
||||
struct EngineInstanceHolder
|
||||
{
|
||||
EngineInstanceHolder(QBBEngine *engine) :
|
||||
instance(engine) {}
|
||||
|
||||
QBBEngine *instance;
|
||||
};
|
||||
|
||||
Q_GLOBAL_STATIC(QThreadStorage<EngineInstanceHolder *>, instanceStorage);
|
||||
|
||||
static QNetworkConfiguration::BearerType
|
||||
interfaceType(netstatus_interface_type_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case NETSTATUS_INTERFACE_TYPE_USB:
|
||||
case NETSTATUS_INTERFACE_TYPE_WIRED:
|
||||
return QNetworkConfiguration::BearerEthernet;
|
||||
|
||||
case NETSTATUS_INTERFACE_TYPE_WIFI:
|
||||
return QNetworkConfiguration::BearerWLAN;
|
||||
|
||||
case NETSTATUS_INTERFACE_TYPE_BLUETOOTH_DUN:
|
||||
return QNetworkConfiguration::BearerBluetooth;
|
||||
|
||||
case NETSTATUS_INTERFACE_TYPE_CELLULAR:
|
||||
// The exact bearer type is determined in QNetworkConfiguration
|
||||
// at the time this info is queried, because opposed to the
|
||||
// information here the type might change quickly.
|
||||
return QNetworkConfiguration::Bearer2G;
|
||||
|
||||
case NETSTATUS_INTERFACE_TYPE_VPN:
|
||||
case NETSTATUS_INTERFACE_TYPE_BB:
|
||||
case NETSTATUS_INTERFACE_TYPE_UNKNOWN:
|
||||
break;
|
||||
}
|
||||
|
||||
return QNetworkConfiguration::BearerUnknown;
|
||||
}
|
||||
|
||||
static QString idForName(const QString &name)
|
||||
{
|
||||
return QStringLiteral("bps:") + name;
|
||||
}
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
QBBEngine::QBBEngine(QObject *parent) :
|
||||
QBearerEngineImpl(parent),
|
||||
pollingRequired(false),
|
||||
initialized(false)
|
||||
{
|
||||
}
|
||||
|
||||
QBBEngine::~QBBEngine()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QString QBBEngine::getInterfaceFromId(const QString &id)
|
||||
{
|
||||
const QMutexLocker locker(&mutex);
|
||||
|
||||
return configurationInterface.value(id);
|
||||
}
|
||||
|
||||
bool QBBEngine::hasIdentifier(const QString &id)
|
||||
{
|
||||
const QMutexLocker locker(&mutex);
|
||||
|
||||
return configurationInterface.contains(id);
|
||||
}
|
||||
|
||||
void QBBEngine::connectToId(const QString &id)
|
||||
{
|
||||
Q_EMIT connectionError(id, OperationNotSupported);
|
||||
}
|
||||
|
||||
void QBBEngine::disconnectFromId(const QString &id)
|
||||
{
|
||||
Q_EMIT connectionError(id, OperationNotSupported);
|
||||
}
|
||||
|
||||
void QBBEngine::initialize()
|
||||
{
|
||||
if (initialized) {
|
||||
qWarning() << Q_FUNC_INFO << "called, but instance already initialized.";
|
||||
return;
|
||||
}
|
||||
|
||||
instanceStorage()->setLocalData(new EngineInstanceHolder(this));
|
||||
|
||||
if (netstatus_request_events(0) != BPS_SUCCESS) {
|
||||
qWarning() << Q_FUNC_INFO << "cannot register for network events. Polling enabled.";
|
||||
|
||||
const QMutexLocker locker(&pollingMutex);
|
||||
pollingRequired = true;
|
||||
} else {
|
||||
QAbstractEventDispatcher::instance()->installEventFilter(this);
|
||||
}
|
||||
|
||||
doRequestUpdate();
|
||||
}
|
||||
|
||||
void QBBEngine::requestUpdate()
|
||||
{
|
||||
doRequestUpdate();
|
||||
}
|
||||
|
||||
void QBBEngine::doRequestUpdate()
|
||||
{
|
||||
qBearerDebug() << Q_FUNC_INFO << "entered method";
|
||||
|
||||
netstatus_interface_list_t interfaceList;
|
||||
|
||||
if ((netstatus_get_interfaces(&interfaceList)) != BPS_SUCCESS) {
|
||||
qBearerDebug() << Q_FUNC_INFO << "cannot retrieve interface list";
|
||||
return;
|
||||
}
|
||||
|
||||
const QScopedPointer<netstatus_interface_list_t,
|
||||
NetstatusInterfaceListCleanupHelper> holder(&interfaceList);
|
||||
|
||||
QSet<QString> currentConfigurations;
|
||||
|
||||
for (int i = 0; i < interfaceList.num_interfaces; i++) {
|
||||
const char *interface = interfaceList.interfaces[i];
|
||||
|
||||
qBearerDebug() << Q_FUNC_INFO << "discovered interface" << interface;
|
||||
|
||||
updateConfiguration(interface);
|
||||
|
||||
currentConfigurations << idForName(QString::fromLatin1(interface));
|
||||
}
|
||||
|
||||
QMutexLocker locker(&mutex);
|
||||
|
||||
const QStringList keys = accessPointConfigurations.uniqueKeys();
|
||||
|
||||
locker.unlock();
|
||||
|
||||
Q_FOREACH (const QString &id, keys) {
|
||||
if (!currentConfigurations.contains(id))
|
||||
removeConfiguration(id);
|
||||
}
|
||||
|
||||
Q_EMIT updateCompleted();
|
||||
}
|
||||
|
||||
QNetworkSession::State QBBEngine::sessionStateForId(const QString &id)
|
||||
{
|
||||
const QMutexLocker locker(&mutex);
|
||||
|
||||
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
|
||||
|
||||
if (!ptr || !ptr->isValid)
|
||||
return QNetworkSession::Invalid;
|
||||
|
||||
if ((ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active)
|
||||
return QNetworkSession::Connected;
|
||||
else if ((ptr->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered)
|
||||
return QNetworkSession::Disconnected;
|
||||
else if ((ptr->state & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined)
|
||||
return QNetworkSession::NotAvailable;
|
||||
else if ((ptr->state & QNetworkConfiguration::Undefined) == QNetworkConfiguration::Undefined)
|
||||
return QNetworkSession::NotAvailable;
|
||||
|
||||
return QNetworkSession::Invalid;
|
||||
}
|
||||
|
||||
QNetworkConfigurationManager::Capabilities QBBEngine::capabilities() const
|
||||
{
|
||||
return QNetworkConfigurationManager::ForcedRoaming;
|
||||
}
|
||||
|
||||
QNetworkSessionPrivate *QBBEngine::createSessionBackend()
|
||||
{
|
||||
return new QNetworkSessionPrivateImpl;
|
||||
}
|
||||
|
||||
QNetworkConfigurationPrivatePointer QBBEngine::defaultConfiguration()
|
||||
{
|
||||
char *interface = 0;
|
||||
|
||||
if (netstatus_get_default_interface(&interface) != BPS_SUCCESS)
|
||||
return QNetworkConfigurationPrivatePointer();
|
||||
|
||||
if (!interface)
|
||||
return QNetworkConfigurationPrivatePointer();
|
||||
|
||||
const QScopedPointer<char, NetstatusInterfaceCleanupHelper> holder(interface);
|
||||
|
||||
const QString id = idForName(QString::fromLatin1(interface));
|
||||
|
||||
const QMutexLocker locker(&mutex);
|
||||
|
||||
if (accessPointConfigurations.contains(id)) {
|
||||
qBearerDebug() << Q_FUNC_INFO << "found default interface:" << id;
|
||||
|
||||
return accessPointConfigurations.value(id);
|
||||
}
|
||||
|
||||
return QNetworkConfigurationPrivatePointer();
|
||||
}
|
||||
|
||||
bool QBBEngine::requiresPolling() const
|
||||
{
|
||||
const QMutexLocker locker(&pollingMutex);
|
||||
|
||||
return pollingRequired;
|
||||
}
|
||||
|
||||
bool QBBEngine::nativeEventFilter(const QByteArray &eventType, void *message, long *result)
|
||||
{
|
||||
Q_UNUSED(eventType);
|
||||
Q_UNUSED(result);
|
||||
|
||||
bps_event_t * const event = static_cast<bps_event_t *>(message);
|
||||
|
||||
Q_ASSERT(event);
|
||||
|
||||
if (bps_event_get_domain(event) == netstatus_get_domain()) {
|
||||
qBearerDebug() << Q_FUNC_INFO << "got update request.";
|
||||
doRequestUpdate();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void QBBEngine::updateConfiguration(const char *interface)
|
||||
{
|
||||
netstatus_interface_details_t *details = 0;
|
||||
|
||||
if (netstatus_get_interface_details(interface, &details) != BPS_SUCCESS) {
|
||||
qBearerDebug() << Q_FUNC_INFO << "cannot retrieve details for interface" << interface;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const QString name = QString::fromLatin1(netstatus_interface_get_name(details));
|
||||
const QString id = idForName(name);
|
||||
|
||||
|
||||
const netstatus_interface_type_t type = netstatus_interface_get_type(details);
|
||||
const netstatus_ip_status_t ipStatus = netstatus_interface_get_ip_status(details);
|
||||
|
||||
netstatus_free_interface_details(&details);
|
||||
|
||||
QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Defined;
|
||||
|
||||
if (ipStatus == NETSTATUS_IP_STATUS_OK)
|
||||
state |= QNetworkConfiguration::Active;
|
||||
|
||||
QMutexLocker locker(&mutex);
|
||||
|
||||
if (accessPointConfigurations.contains(id)) {
|
||||
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
|
||||
|
||||
bool changed = false;
|
||||
|
||||
QMutexLocker ptrLocker(&ptr->mutex);
|
||||
|
||||
if (!ptr->isValid) {
|
||||
ptr->isValid = true;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (ptr->name != name) {
|
||||
ptr->name = name;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (ptr->id != id) {
|
||||
ptr->id = id;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (ptr->state != state) {
|
||||
ptr->state = state;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
const netstatus_ip_status_t oldIpStatus = ptr->oldIpStatus;
|
||||
ptr->oldIpStatus = ipStatus;
|
||||
|
||||
ptrLocker.unlock();
|
||||
|
||||
locker.unlock();
|
||||
|
||||
if (changed) {
|
||||
qBearerDebug() << Q_FUNC_INFO << "configuration changed:" << interface;
|
||||
|
||||
Q_EMIT configurationChanged(ptr);
|
||||
} else {
|
||||
// maybe Wifi has changed but gateway not yet ready etc.
|
||||
qBearerDebug() << Q_FUNC_INFO << "configuration has not changed.";
|
||||
if (oldIpStatus != ipStatus) { // if IP status changed
|
||||
if (ipStatus != NETSTATUS_IP_STATUS_OK
|
||||
&& ipStatus != NETSTATUS_IP_STATUS_ERROR_NOT_UP
|
||||
&& ipStatus != NETSTATUS_IP_STATUS_ERROR_NOT_CONFIGURED) {
|
||||
// work around race condition in netstatus API by just checking
|
||||
// again in 300 ms
|
||||
QTimer::singleShot(300, this, SLOT(doRequestUpdate()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
QNetworkConfigurationPrivatePointer ptr(new QNetworkConfigurationPrivate);
|
||||
|
||||
ptr->name = name;
|
||||
ptr->isValid = true;
|
||||
ptr->id = id;
|
||||
ptr->state = state;
|
||||
ptr->type = QNetworkConfiguration::InternetAccessPoint;
|
||||
ptr->bearerType = interfaceType(type);
|
||||
|
||||
accessPointConfigurations.insert(id, ptr);
|
||||
configurationInterface.insert(id, name);
|
||||
|
||||
locker.unlock();
|
||||
|
||||
qBearerDebug() << Q_FUNC_INFO << "configuration added:" << interface;
|
||||
|
||||
Q_EMIT configurationAdded(ptr);
|
||||
}
|
||||
|
||||
void QBBEngine::removeConfiguration(const QString &id)
|
||||
{
|
||||
QMutexLocker locker(&mutex);
|
||||
|
||||
QNetworkConfigurationPrivatePointer ptr =
|
||||
accessPointConfigurations.take(id);
|
||||
|
||||
configurationInterface.remove(ptr->id);
|
||||
|
||||
locker.unlock();
|
||||
|
||||
Q_EMIT configurationRemoved(ptr);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_BEARERMANAGEMENT
|
@ -1,101 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBBENGINE_H
|
||||
#define QBBENGINE_H
|
||||
|
||||
#include "../qbearerengine_impl.h"
|
||||
|
||||
#include <QAbstractEventDispatcher>
|
||||
#include <QAbstractNativeEventFilter>
|
||||
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
|
||||
struct bps_event_t;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QNetworkConfigurationPrivate;
|
||||
class QNetworkSessionPrivate;
|
||||
|
||||
class QBBEngine : public QBearerEngineImpl, public QAbstractNativeEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QBBEngine(QObject *parent = 0);
|
||||
~QBBEngine();
|
||||
|
||||
QString getInterfaceFromId(const QString &id) Q_DECL_OVERRIDE;
|
||||
bool hasIdentifier(const QString &id) Q_DECL_OVERRIDE;
|
||||
|
||||
void connectToId(const QString &id) Q_DECL_OVERRIDE;
|
||||
void disconnectFromId(const QString &id) Q_DECL_OVERRIDE;
|
||||
|
||||
Q_INVOKABLE void initialize() Q_DECL_OVERRIDE;
|
||||
Q_INVOKABLE void requestUpdate() Q_DECL_OVERRIDE;
|
||||
|
||||
QNetworkSession::State sessionStateForId(const QString &id) Q_DECL_OVERRIDE;
|
||||
|
||||
QNetworkConfigurationManager::Capabilities capabilities() const Q_DECL_OVERRIDE;
|
||||
|
||||
QNetworkSessionPrivate *createSessionBackend() Q_DECL_OVERRIDE;
|
||||
|
||||
QNetworkConfigurationPrivatePointer defaultConfiguration() Q_DECL_OVERRIDE;
|
||||
|
||||
bool requiresPolling() const Q_DECL_OVERRIDE;
|
||||
|
||||
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
|
||||
|
||||
protected:
|
||||
void updateConfiguration(const char *interface);
|
||||
void removeConfiguration(const QString &id);
|
||||
|
||||
private Q_SLOTS:
|
||||
void doRequestUpdate();
|
||||
|
||||
private:
|
||||
QHash<QString, QString> configurationInterface;
|
||||
|
||||
mutable QMutex pollingMutex;
|
||||
|
||||
bool pollingRequired;
|
||||
bool initialized;
|
||||
};
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_BEARERMANAGEMENT
|
||||
|
||||
#endif // QBBENGINE_H
|
@ -1,119 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qblackberrytheme.h"
|
||||
|
||||
#include "qqnxfiledialoghelper.h"
|
||||
#include "qqnxsystemsettings.h"
|
||||
#include "qqnxintegration.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QBlackberryTheme::QBlackberryTheme(const QQnxIntegration *integration) : m_integration(integration)
|
||||
{
|
||||
// Set the dark theme as default palette
|
||||
QColor color = QColor(211, 211, 211);
|
||||
m_defaultPalette.setBrush(QPalette::ButtonText, color);
|
||||
m_defaultPalette.setBrush(QPalette::WindowText, color);
|
||||
m_defaultPalette.setBrush(QPalette::Text, color);
|
||||
|
||||
color.setAlpha(179);
|
||||
m_defaultPalette.setBrush(QPalette::Disabled, QPalette::ButtonText, color);
|
||||
m_defaultPalette.setBrush(QPalette::Disabled, QPalette::WindowText, color);
|
||||
m_defaultPalette.setBrush(QPalette::Disabled, QPalette::Text, color);
|
||||
|
||||
color.setRgb(18, 18, 18);
|
||||
m_defaultPalette.setColor(QPalette::Window, color);
|
||||
m_defaultPalette.setColor(QPalette::Base, color);
|
||||
m_defaultPalette.setColor(QPalette::AlternateBase, QColor(50, 50, 50));
|
||||
m_defaultPalette.setColor(QPalette::Button, color);
|
||||
|
||||
m_defaultPalette.setBrush(QPalette::Highlight, QColor(0, 168, 223));
|
||||
m_defaultPalette.setBrush(QPalette::HighlightedText, QColor(250, 250,250));
|
||||
}
|
||||
|
||||
QBlackberryTheme::~QBlackberryTheme()
|
||||
{
|
||||
qDeleteAll(m_fonts);
|
||||
}
|
||||
|
||||
bool QBlackberryTheme::usePlatformNativeDialog(DialogType type) const
|
||||
{
|
||||
if (type == QPlatformTheme::FileDialog)
|
||||
return true;
|
||||
#if !defined(QT_NO_COLORDIALOG)
|
||||
if (type == QPlatformTheme::ColorDialog)
|
||||
return false;
|
||||
#endif
|
||||
#if !defined(QT_NO_FONTDIALOG)
|
||||
if (type == QPlatformTheme::FontDialog)
|
||||
return false;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
QPlatformDialogHelper *QBlackberryTheme::createPlatformDialogHelper(DialogType type) const
|
||||
{
|
||||
switch (type) {
|
||||
case QPlatformTheme::FileDialog:
|
||||
return new QQnxFileDialogHelper(m_integration);
|
||||
#if !defined(QT_NO_COLORDIALOG)
|
||||
case QPlatformTheme::ColorDialog:
|
||||
#endif
|
||||
#if !defined(QT_NO_FONTDIALOG)
|
||||
case QPlatformTheme::FontDialog:
|
||||
#endif
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
const QFont *QBlackberryTheme::font(Font type) const
|
||||
{
|
||||
QPlatformFontDatabase *fontDatabase = m_integration->fontDatabase();
|
||||
|
||||
if (fontDatabase && m_fonts.isEmpty())
|
||||
m_fonts = qt_qnx_createRoleFonts(fontDatabase);
|
||||
return m_fonts.value(type, 0);
|
||||
}
|
||||
|
||||
const QPalette *QBlackberryTheme::palette(Palette type) const
|
||||
{
|
||||
// Return the default palette
|
||||
if (type == SystemPalette)
|
||||
return &m_defaultPalette;
|
||||
|
||||
return QPlatformTheme::palette(type);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -1,73 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QBLACKBERRYTHEME_H
|
||||
#define QBLACKBERRYTHEME_H
|
||||
|
||||
#include <qpa/qplatformtheme.h>
|
||||
|
||||
#include <QtGui/qfont.h>
|
||||
|
||||
#include <QtCore/qhash.h>
|
||||
#include <QtCore/qstring.h>
|
||||
|
||||
#include <QtGui/QPalette>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QQnxIntegration;
|
||||
|
||||
class QBlackberryTheme : public QPlatformTheme
|
||||
{
|
||||
public:
|
||||
explicit QBlackberryTheme(const QQnxIntegration *);
|
||||
~QBlackberryTheme();
|
||||
|
||||
static QString name() { return QStringLiteral("blackberry"); }
|
||||
|
||||
bool usePlatformNativeDialog(DialogType type) const;
|
||||
QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const;
|
||||
|
||||
const QFont *font(Font type = SystemFont) const;
|
||||
|
||||
const QPalette *palette(Palette type = SystemPalette) const;
|
||||
|
||||
private:
|
||||
mutable QHash<QPlatformTheme::Font, QFont*> m_fonts;
|
||||
const QQnxIntegration *m_integration;
|
||||
QPalette m_defaultPalette;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QBLACKBERRYTHEME_H
|
@ -5,10 +5,9 @@ QT += platformsupport-private core-private gui-private
|
||||
# Uncomment this to build with support for IMF once it becomes available in the BBNDK
|
||||
#CONFIG += qqnx_imf
|
||||
|
||||
!blackberry:CONFIG += qqnx_screeneventthread
|
||||
CONFIG += qqnx_screeneventthread
|
||||
|
||||
# Uncomment these to enable debugging output for various aspects of the plugin
|
||||
#DEFINES += QQNXBPSEVENTFILTER_DEBUG
|
||||
#DEFINES += QQNXBUFFER_DEBUG
|
||||
#DEFINES += QQNXBUTTON_DEBUG
|
||||
#DEFINES += QQNXCLIPBOARD_DEBUG
|
||||
@ -86,52 +85,20 @@ contains(QT_CONFIG, opengles2) {
|
||||
LIBS += -lEGL
|
||||
}
|
||||
|
||||
CONFIG(blackberry) {
|
||||
SOURCES += qqnxnavigatorbps.cpp \
|
||||
qqnxeventdispatcher_blackberry.cpp \
|
||||
qqnxbpseventfilter.cpp \
|
||||
qqnxvirtualkeyboardbps.cpp \
|
||||
qblackberrytheme.cpp \
|
||||
qqnxsystemsettings.cpp
|
||||
|
||||
HEADERS += qqnxnavigatorbps.h \
|
||||
qqnxeventdispatcher_blackberry.h \
|
||||
qqnxbpseventfilter.h \
|
||||
qqnxvirtualkeyboardbps.h \
|
||||
qblackberrytheme.h \
|
||||
qqnxsystemsettings.h \
|
||||
qqnxfiledialoghelper.h
|
||||
|
||||
LIBS += -lbps
|
||||
}
|
||||
|
||||
CONFIG(blackberry) {
|
||||
SOURCES += qqnxfiledialoghelper_bb10.cpp \
|
||||
qqnxfilepicker.cpp \
|
||||
qqnxnavigatorcover.cpp
|
||||
|
||||
HEADERS += qqnxfilepicker.h \
|
||||
qqnxnavigatorcover.h
|
||||
}
|
||||
|
||||
CONFIG(qqnx_pps) {
|
||||
DEFINES += QQNX_PPS
|
||||
|
||||
SOURCES += qqnxclipboard.cpp \
|
||||
qqnxbuttoneventnotifier.cpp
|
||||
qqnxbuttoneventnotifier.cpp \
|
||||
qqnxnavigatorpps.cpp \
|
||||
qqnxnavigatoreventnotifier.cpp \
|
||||
qqnxvirtualkeyboardpps.cpp
|
||||
|
||||
HEADERS += qqnxclipboard.h \
|
||||
qqnxbuttoneventnotifier.h
|
||||
|
||||
!blackberry {
|
||||
SOURCES += qqnxnavigatorpps.cpp \
|
||||
qqnxnavigatoreventnotifier.cpp \
|
||||
qqnxvirtualkeyboardpps.cpp
|
||||
|
||||
HEADERS += qqnxnavigatorpps.h \
|
||||
qqnxnavigatoreventnotifier.h \
|
||||
qqnxvirtualkeyboardpps.h
|
||||
}
|
||||
qqnxbuttoneventnotifier.h \
|
||||
qqnxnavigatorpps.h \
|
||||
qqnxnavigatoreventnotifier.h \
|
||||
qqnxvirtualkeyboardpps.h
|
||||
|
||||
LIBS += -lpps
|
||||
!contains(DEFINES, QT_NO_CLIPBOARD): LIBS += -lclipboard
|
||||
|
@ -1,229 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qqnxbpseventfilter.h"
|
||||
#include "qqnxnavigatoreventhandler.h"
|
||||
#include "qqnxscreen.h"
|
||||
#include "qqnxscreeneventhandler.h"
|
||||
#include "qqnxvirtualkeyboardbps.h"
|
||||
#include "qqnxfiledialoghelper.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QAbstractEventDispatcher>
|
||||
#include <QDebug>
|
||||
|
||||
#include <bps/event.h>
|
||||
#include <bps/navigator.h>
|
||||
#include <bps/screen.h>
|
||||
|
||||
#if defined(QQNXBPSEVENTFILTER_DEBUG)
|
||||
#define qBpsEventFilterDebug qDebug
|
||||
#else
|
||||
#define qBpsEventFilterDebug QT_NO_QDEBUG_MACRO
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static QQnxBpsEventFilter *s_instance = 0;
|
||||
|
||||
QQnxBpsEventFilter::QQnxBpsEventFilter(QQnxNavigatorEventHandler *navigatorEventHandler,
|
||||
QQnxScreenEventHandler *screenEventHandler,
|
||||
QQnxVirtualKeyboardBps *virtualKeyboard, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_navigatorEventHandler(navigatorEventHandler)
|
||||
, m_screenEventHandler(screenEventHandler)
|
||||
, m_virtualKeyboard(virtualKeyboard)
|
||||
{
|
||||
Q_ASSERT(s_instance == 0);
|
||||
|
||||
s_instance = this;
|
||||
}
|
||||
|
||||
QQnxBpsEventFilter::~QQnxBpsEventFilter()
|
||||
{
|
||||
Q_ASSERT(s_instance == this);
|
||||
|
||||
s_instance = 0;
|
||||
}
|
||||
|
||||
void QQnxBpsEventFilter::installOnEventDispatcher(QAbstractEventDispatcher *dispatcher)
|
||||
{
|
||||
qBpsEventFilterDebug() << Q_FUNC_INFO << "dispatcher=" << dispatcher;
|
||||
|
||||
if (navigator_request_events(NAVIGATOR_EXTENDED_DATA) != BPS_SUCCESS)
|
||||
qWarning("QQNX: failed to register for navigator events");
|
||||
|
||||
dispatcher->installNativeEventFilter(this);
|
||||
}
|
||||
|
||||
void QQnxBpsEventFilter::registerForScreenEvents(QQnxScreen *screen)
|
||||
{
|
||||
if (!m_screenEventHandler) {
|
||||
qWarning("QQNX: trying to register for screen events, but no handler provided.");
|
||||
return;
|
||||
}
|
||||
|
||||
int attached;
|
||||
if (screen_get_display_property_iv(screen->nativeDisplay(), SCREEN_PROPERTY_ATTACHED, &attached) != BPS_SUCCESS) {
|
||||
qWarning() << "QQNX: unable to query display attachment";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!attached) {
|
||||
qBpsEventFilterDebug() << "skipping event registration for non-attached screen";
|
||||
return;
|
||||
}
|
||||
|
||||
if (screen_request_events(screen->nativeContext()) != BPS_SUCCESS)
|
||||
qWarning("QQNX: failed to register for screen events on screen %p", screen->nativeContext());
|
||||
}
|
||||
|
||||
void QQnxBpsEventFilter::unregisterForScreenEvents(QQnxScreen *screen)
|
||||
{
|
||||
if (!m_screenEventHandler) {
|
||||
qWarning("QQNX: trying to unregister for screen events, but no handler provided.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (screen_stop_events(screen->nativeContext()) != BPS_SUCCESS)
|
||||
qWarning("QQNX: failed to unregister for screen events on screen %p", screen->nativeContext());
|
||||
}
|
||||
|
||||
bool QQnxBpsEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *result)
|
||||
{
|
||||
Q_UNUSED(eventType);
|
||||
Q_UNUSED(result);
|
||||
bps_event_t *event = static_cast<bps_event_t *>(message);
|
||||
const int eventDomain = bps_event_get_domain(event);
|
||||
qBpsEventFilterDebug() << Q_FUNC_INFO << "event=" << event << "domain=" << eventDomain;
|
||||
|
||||
if (eventDomain == screen_get_domain()) {
|
||||
if (!m_screenEventHandler) {
|
||||
qWarning("QQNX: registered for screen events, but no handler provided.");
|
||||
return false;
|
||||
}
|
||||
|
||||
screen_event_t screenEvent = screen_event_get_event(event);
|
||||
return m_screenEventHandler->handleEvent(screenEvent);
|
||||
}
|
||||
|
||||
if (eventDomain == navigator_get_domain())
|
||||
return handleNavigatorEvent(event);
|
||||
|
||||
if (m_virtualKeyboard->handleEvent(event))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QQnxBpsEventFilter::handleNavigatorEvent(bps_event_t *event)
|
||||
{
|
||||
switch (bps_event_get_code(event)) {
|
||||
case NAVIGATOR_ORIENTATION_CHECK: {
|
||||
const int angle = navigator_event_get_orientation_angle(event);
|
||||
qBpsEventFilterDebug() << Q_FUNC_INFO << "ORIENTATION CHECK event. angle=" << angle;
|
||||
|
||||
const bool result = m_navigatorEventHandler->handleOrientationCheck(angle);
|
||||
qBpsEventFilterDebug() << Q_FUNC_INFO << "ORIENTATION CHECK event. result=" << result;
|
||||
|
||||
// reply to navigator whether orientation is acceptable
|
||||
navigator_orientation_check_response(event, result);
|
||||
break;
|
||||
}
|
||||
|
||||
case NAVIGATOR_ORIENTATION: {
|
||||
const int angle = navigator_event_get_orientation_angle(event);
|
||||
qBpsEventFilterDebug() << Q_FUNC_INFO << "ORIENTATION event. angle=" << angle;
|
||||
m_navigatorEventHandler->handleOrientationChange(angle);
|
||||
|
||||
navigator_done_orientation(event);
|
||||
break;
|
||||
}
|
||||
|
||||
case NAVIGATOR_SWIPE_DOWN:
|
||||
qBpsEventFilterDebug() << Q_FUNC_INFO << "SWIPE DOWN event";
|
||||
m_navigatorEventHandler->handleSwipeDown();
|
||||
break;
|
||||
|
||||
case NAVIGATOR_EXIT:
|
||||
qBpsEventFilterDebug() << Q_FUNC_INFO << "EXIT event";
|
||||
m_navigatorEventHandler->handleExit();
|
||||
break;
|
||||
|
||||
case NAVIGATOR_WINDOW_STATE: {
|
||||
qBpsEventFilterDebug() << Q_FUNC_INFO << "WINDOW STATE event";
|
||||
const navigator_window_state_t state = navigator_event_get_window_state(event);
|
||||
const QByteArray id(navigator_event_get_groupid(event));
|
||||
|
||||
switch (state) {
|
||||
case NAVIGATOR_WINDOW_FULLSCREEN:
|
||||
m_navigatorEventHandler->handleWindowGroupStateChanged(id, Qt::WindowFullScreen);
|
||||
break;
|
||||
case NAVIGATOR_WINDOW_THUMBNAIL:
|
||||
m_navigatorEventHandler->handleWindowGroupStateChanged(id, Qt::WindowMinimized);
|
||||
break;
|
||||
case NAVIGATOR_WINDOW_INVISIBLE:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case NAVIGATOR_WINDOW_ACTIVE: {
|
||||
qBpsEventFilterDebug() << Q_FUNC_INFO << "WINDOW ACTIVE event";
|
||||
const QByteArray id(navigator_event_get_groupid(event));
|
||||
m_navigatorEventHandler->handleWindowGroupActivated(id);
|
||||
break;
|
||||
}
|
||||
|
||||
case NAVIGATOR_WINDOW_INACTIVE: {
|
||||
qBpsEventFilterDebug() << Q_FUNC_INFO << "WINDOW INACTIVE event";
|
||||
const QByteArray id(navigator_event_get_groupid(event));
|
||||
m_navigatorEventHandler->handleWindowGroupDeactivated(id);
|
||||
break;
|
||||
}
|
||||
|
||||
case NAVIGATOR_LOW_MEMORY:
|
||||
qWarning() << "QGuiApplication based process" << QCoreApplication::applicationPid()
|
||||
<< "received \"NAVIGATOR_LOW_MEMORY\" event";
|
||||
return false;
|
||||
|
||||
default:
|
||||
qBpsEventFilterDebug() << Q_FUNC_INFO << "Unhandled navigator event. code=" << bps_event_get_code(event);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -1,82 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QQNXBPSEVENTFILTER_H
|
||||
#define QQNXBPSEVENTFILTER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QHash>
|
||||
#include <QAbstractNativeEventFilter>
|
||||
|
||||
#include <bps/dialog.h>
|
||||
|
||||
struct bps_event_t;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QAbstractEventDispatcher;
|
||||
class QQnxNavigatorEventHandler;
|
||||
class QQnxFileDialogHelper;
|
||||
class QQnxScreen;
|
||||
class QQnxScreenEventHandler;
|
||||
class QQnxVirtualKeyboardBps;
|
||||
|
||||
class QQnxBpsEventFilter : public QObject, public QAbstractNativeEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QQnxBpsEventFilter(QQnxNavigatorEventHandler *navigatorEventHandler,
|
||||
QQnxScreenEventHandler *screenEventHandler,
|
||||
QQnxVirtualKeyboardBps *virtualKeyboard, QObject *parent = 0);
|
||||
~QQnxBpsEventFilter();
|
||||
|
||||
void installOnEventDispatcher(QAbstractEventDispatcher *dispatcher);
|
||||
|
||||
void registerForScreenEvents(QQnxScreen *screen);
|
||||
void unregisterForScreenEvents(QQnxScreen *screen);
|
||||
|
||||
private:
|
||||
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
|
||||
|
||||
bool handleNavigatorEvent(bps_event_t *event);
|
||||
|
||||
private:
|
||||
QQnxNavigatorEventHandler *m_navigatorEventHandler;
|
||||
QQnxScreenEventHandler *m_screenEventHandler;
|
||||
QQnxVirtualKeyboardBps *m_virtualKeyboard;
|
||||
QHash<dialog_instance_t, QQnxFileDialogHelper*> m_dialogMapper;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QQNXBPSEVENTFILTER_H
|
@ -82,7 +82,7 @@ void QQnxButtonEventNotifier::start()
|
||||
errno = 0;
|
||||
m_fd = qt_safe_open(ppsPath, O_RDONLY);
|
||||
if (m_fd == -1) {
|
||||
#if defined(Q_OS_BLACKBERRY) || defined (QQNXBUTTON_DEBUG)
|
||||
#if defined (QQNXBUTTON_DEBUG)
|
||||
qWarning("QQNX: failed to open buttons pps, errno=%d", errno);
|
||||
#endif
|
||||
return;
|
||||
|
@ -1,68 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qqnxeventdispatcher_blackberry.h"
|
||||
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
#include <private/qguiapplication_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
QQnxEventDispatcherBlackberry::QQnxEventDispatcherBlackberry(QObject *parent)
|
||||
: QEventDispatcherBlackberry(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QQnxEventDispatcherBlackberry::~QQnxEventDispatcherBlackberry()
|
||||
{
|
||||
}
|
||||
|
||||
bool QQnxEventDispatcherBlackberry::processEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
{
|
||||
const bool didSendEvents = QEventDispatcherBlackberry::processEvents(flags);
|
||||
return QWindowSystemInterface::sendWindowSystemEvents(flags) || didSendEvents;
|
||||
}
|
||||
|
||||
bool QQnxEventDispatcherBlackberry::hasPendingEvents()
|
||||
{
|
||||
return QEventDispatcherBlackberry::hasPendingEvents() || QWindowSystemInterface::windowSystemEventsQueued();
|
||||
}
|
||||
|
||||
void QQnxEventDispatcherBlackberry::flush()
|
||||
{
|
||||
if (qApp)
|
||||
qApp->sendPostedEvents();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -1,58 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QQNXEVENTDISPATCHER_BLACKBERRY_H
|
||||
#define QQNXEVENTDISPATCHER_BLACKBERRY_H
|
||||
|
||||
#include <qglobal.h>
|
||||
#include <private/qeventdispatcher_blackberry_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QQnxEventDispatcherBlackberry : public QEventDispatcherBlackberry
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QQnxEventDispatcherBlackberry(QObject *parent = 0);
|
||||
~QQnxEventDispatcherBlackberry();
|
||||
|
||||
bool processEvents(QEventLoop::ProcessEventsFlags flags);
|
||||
bool hasPendingEvents();
|
||||
|
||||
void flush();
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QQNXEVENTDISPATCHER_BLACKBERRY_H
|
@ -1,87 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QQNXFILEDIALOGHELPER_H
|
||||
#define QQNXFILEDIALOGHELPER_H
|
||||
|
||||
#include <qpa/qplatformdialoghelper.h>
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QQnxIntegration;
|
||||
|
||||
class QQnxFilePicker;
|
||||
|
||||
class QQnxFileDialogHelper : public QPlatformFileDialogHelper
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQnxFileDialogHelper(const QQnxIntegration *);
|
||||
~QQnxFileDialogHelper();
|
||||
|
||||
void exec();
|
||||
|
||||
bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent);
|
||||
void hide();
|
||||
|
||||
bool defaultNameFilterDisables() const;
|
||||
void setDirectory(const QUrl &directory) Q_DECL_OVERRIDE;
|
||||
QUrl directory() const Q_DECL_OVERRIDE;
|
||||
void selectFile(const QUrl &fileName) Q_DECL_OVERRIDE;
|
||||
QList<QUrl> selectedFiles() const Q_DECL_OVERRIDE;
|
||||
void setFilter();
|
||||
void selectNameFilter(const QString &filter);
|
||||
QString selectedNameFilter() const;
|
||||
|
||||
QQnxFilePicker *nativeDialog() const { return m_dialog; }
|
||||
|
||||
Q_SIGNALS:
|
||||
void dialogClosed();
|
||||
|
||||
private Q_SLOTS:
|
||||
void emitSignals();
|
||||
|
||||
private:
|
||||
void setNameFilter(const QString &filter);
|
||||
void setNameFilters(const QStringList &filters);
|
||||
|
||||
const QQnxIntegration *m_integration;
|
||||
QQnxFilePicker *m_dialog;
|
||||
QFileDialogOptions::AcceptMode m_acceptMode;
|
||||
QString m_selectedFilter;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QQNXFILEDIALOGHELPER_H
|
@ -1,212 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qqnxfiledialoghelper.h"
|
||||
|
||||
#include "qqnxfilepicker.h"
|
||||
#include "qqnxbpseventfilter.h"
|
||||
#include "qqnxscreen.h"
|
||||
#include "qqnxintegration.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QEventLoop>
|
||||
#include <QScreen>
|
||||
#include <QTimer>
|
||||
#include <QWindow>
|
||||
|
||||
#ifdef QQNXFILEDIALOGHELPER_DEBUG
|
||||
#define qFileDialogHelperDebug qDebug
|
||||
#else
|
||||
#define qFileDialogHelperDebug QT_NO_QDEBUG_MACRO
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QQnxFileDialogHelper::QQnxFileDialogHelper(const QQnxIntegration *integration)
|
||||
: QPlatformFileDialogHelper(),
|
||||
m_integration(integration),
|
||||
m_dialog(new QQnxFilePicker),
|
||||
m_acceptMode(QFileDialogOptions::AcceptOpen),
|
||||
m_selectedFilter()
|
||||
{
|
||||
connect(m_dialog, &QQnxFilePicker::closed, this, &QQnxFileDialogHelper::emitSignals);
|
||||
}
|
||||
|
||||
QQnxFileDialogHelper::~QQnxFileDialogHelper()
|
||||
{
|
||||
delete m_dialog;
|
||||
}
|
||||
|
||||
void QQnxFileDialogHelper::exec()
|
||||
{
|
||||
qFileDialogHelperDebug() << Q_FUNC_INFO;
|
||||
|
||||
// Clear any previous results
|
||||
m_dialog->setDirectories(QStringList());
|
||||
|
||||
QEventLoop loop;
|
||||
connect(m_dialog, SIGNAL(closed()), &loop, SLOT(quit()));
|
||||
loop.exec();
|
||||
}
|
||||
|
||||
bool QQnxFileDialogHelper::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent)
|
||||
{
|
||||
Q_UNUSED(flags);
|
||||
Q_UNUSED(parent);
|
||||
Q_UNUSED(modality);
|
||||
|
||||
qFileDialogHelperDebug() << Q_FUNC_INFO;
|
||||
|
||||
// Create dialog
|
||||
const QSharedPointer<QFileDialogOptions> &opts = options();
|
||||
if (opts->acceptMode() == QFileDialogOptions::AcceptOpen) {
|
||||
// Select one or many files?
|
||||
const QQnxFilePicker::Mode mode = (opts->fileMode() == QFileDialogOptions::ExistingFiles)
|
||||
? QQnxFilePicker::PickerMultiple : QQnxFilePicker::Picker;
|
||||
|
||||
m_dialog->setMode(mode);
|
||||
|
||||
// Set the actual list of extensions
|
||||
if (!opts->nameFilters().isEmpty())
|
||||
setNameFilters(opts->nameFilters());
|
||||
else
|
||||
setNameFilter(tr("All files (*.*)"));
|
||||
} else {
|
||||
const QQnxFilePicker::Mode mode = (opts->initiallySelectedFiles().count() >= 2)
|
||||
? QQnxFilePicker::SaverMultiple : QQnxFilePicker::Saver;
|
||||
|
||||
m_dialog->setMode(mode);
|
||||
|
||||
if (!opts->initiallySelectedFiles().isEmpty()) {
|
||||
QStringList files;
|
||||
Q_FOREACH ( const QUrl &url, opts->initiallySelectedFiles() )
|
||||
files.append(url.toLocalFile());
|
||||
m_dialog->setDefaultSaveFileNames(files);
|
||||
}
|
||||
}
|
||||
|
||||
// Cache the accept mode so we know which functions to use to get the results back
|
||||
m_acceptMode = opts->acceptMode();
|
||||
m_dialog->setTitle(opts->windowTitle());
|
||||
m_dialog->open();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void QQnxFileDialogHelper::hide()
|
||||
{
|
||||
qFileDialogHelperDebug() << Q_FUNC_INFO;
|
||||
m_dialog->close();
|
||||
}
|
||||
|
||||
bool QQnxFileDialogHelper::defaultNameFilterDisables() const
|
||||
{
|
||||
qFileDialogHelperDebug() << Q_FUNC_INFO;
|
||||
return false;
|
||||
}
|
||||
|
||||
void QQnxFileDialogHelper::setDirectory(const QUrl &directory)
|
||||
{
|
||||
m_dialog->addDirectory(directory.toLocalFile());
|
||||
}
|
||||
|
||||
QUrl QQnxFileDialogHelper::directory() const
|
||||
{
|
||||
qFileDialogHelperDebug() << Q_FUNC_INFO;
|
||||
if (!m_dialog->directories().isEmpty())
|
||||
return QUrl::fromLocalFile(m_dialog->directories().first());
|
||||
|
||||
return QUrl();
|
||||
}
|
||||
|
||||
void QQnxFileDialogHelper::selectFile(const QUrl &fileName)
|
||||
{
|
||||
m_dialog->addDefaultSaveFileName(fileName.toLocalFile());
|
||||
}
|
||||
|
||||
QList<QUrl> QQnxFileDialogHelper::selectedFiles() const
|
||||
{
|
||||
qFileDialogHelperDebug() << Q_FUNC_INFO;
|
||||
QList<QUrl> urls;
|
||||
QStringList files = m_dialog->selectedFiles();
|
||||
Q_FOREACH (const QString &file, files)
|
||||
urls.append(QUrl::fromLocalFile(file));
|
||||
return urls;
|
||||
}
|
||||
|
||||
void QQnxFileDialogHelper::setFilter()
|
||||
{
|
||||
// No native api to support setting a filter from QDir::Filters
|
||||
qFileDialogHelperDebug() << Q_FUNC_INFO;
|
||||
}
|
||||
|
||||
void QQnxFileDialogHelper::selectNameFilter(const QString &filter)
|
||||
{
|
||||
qFileDialogHelperDebug() << Q_FUNC_INFO << "filter =" << filter;
|
||||
setNameFilter(filter);
|
||||
}
|
||||
|
||||
QString QQnxFileDialogHelper::selectedNameFilter() const
|
||||
{
|
||||
// For now there is no way for the user to change the selected filter
|
||||
// so this just reflects what the developer has set programmatically.
|
||||
qFileDialogHelperDebug() << Q_FUNC_INFO;
|
||||
return m_selectedFilter;
|
||||
}
|
||||
|
||||
void QQnxFileDialogHelper::emitSignals()
|
||||
{
|
||||
if (m_dialog->selectedFiles().isEmpty())
|
||||
Q_EMIT reject();
|
||||
else
|
||||
Q_EMIT accept();
|
||||
}
|
||||
|
||||
void QQnxFileDialogHelper::setNameFilter(const QString &filter)
|
||||
{
|
||||
qFileDialogHelperDebug() << Q_FUNC_INFO << "filter =" << filter;
|
||||
|
||||
setNameFilters(QPlatformFileDialogHelper::cleanFilterList(filter));
|
||||
}
|
||||
|
||||
void QQnxFileDialogHelper::setNameFilters(const QStringList &filters)
|
||||
{
|
||||
qFileDialogHelperDebug() << Q_FUNC_INFO << "filters =" << filters;
|
||||
|
||||
Q_ASSERT(!filters.isEmpty());
|
||||
|
||||
m_dialog->setFilters(filters);
|
||||
m_selectedFilter = filters.first();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -1,322 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qqnxfilepicker.h"
|
||||
|
||||
#include <QAbstractEventDispatcher>
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonParseError>
|
||||
#include <QMimeDatabase>
|
||||
#include <QUrl>
|
||||
#include <private/qppsobject_p.h>
|
||||
|
||||
#include <bps/navigator.h>
|
||||
#include <bps/navigator_invoke.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef QQNXFILEPICKER_DEBUG
|
||||
#define qFilePickerDebug qDebug
|
||||
#else
|
||||
#define qFilePickerDebug QT_NO_QDEBUG_MACRO
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static const char s_filePickerTarget[] = "sys.filepicker.target";
|
||||
|
||||
QQnxFilePicker::QQnxFilePicker(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_invocationHandle(0)
|
||||
, m_mode(QQnxFilePicker::Picker)
|
||||
, m_title(tr("Pick a file"))
|
||||
{
|
||||
QCoreApplication::eventDispatcher()->installNativeEventFilter(this);
|
||||
}
|
||||
|
||||
QQnxFilePicker::~QQnxFilePicker()
|
||||
{
|
||||
cleanup();
|
||||
|
||||
QCoreApplication::eventDispatcher()->removeNativeEventFilter(this);
|
||||
}
|
||||
|
||||
void QQnxFilePicker::open()
|
||||
{
|
||||
if (m_invocationHandle)
|
||||
return;
|
||||
|
||||
// Clear any previous results
|
||||
m_selectedFiles.clear();
|
||||
|
||||
int errorCode = BPS_SUCCESS;
|
||||
|
||||
errorCode = navigator_invoke_invocation_create(&m_invocationHandle);
|
||||
if (errorCode != BPS_SUCCESS) {
|
||||
qWarning() << "QQnxFilePicker: unable to create invocation:" << strerror(errno);
|
||||
return;
|
||||
}
|
||||
|
||||
errorCode = navigator_invoke_invocation_set_target(m_invocationHandle, s_filePickerTarget);
|
||||
|
||||
if (errorCode != BPS_SUCCESS) {
|
||||
cleanup();
|
||||
qWarning() << "QQnxFilePicker: unable to set target:" << strerror(errno);
|
||||
return;
|
||||
}
|
||||
|
||||
errorCode = navigator_invoke_invocation_set_action(m_invocationHandle, "bb.action.OPEN");
|
||||
if (errorCode != BPS_SUCCESS) {
|
||||
cleanup();
|
||||
qWarning() << "QQnxFilePicker: unable to set action:" << strerror(errno);
|
||||
return;
|
||||
}
|
||||
|
||||
errorCode = navigator_invoke_invocation_set_type(m_invocationHandle, "application/vnd.blackberry.file_picker");
|
||||
if (errorCode != BPS_SUCCESS) {
|
||||
cleanup();
|
||||
qWarning() << "QQnxFilePicker: unable to set mime type:" << strerror(errno);
|
||||
return;
|
||||
}
|
||||
|
||||
QVariantMap map;
|
||||
map[QStringLiteral("Type")] = filePickerType();
|
||||
map[QStringLiteral("Mode")] = modeToString(m_mode);
|
||||
map[QStringLiteral("Title")] = m_title;
|
||||
map[QStringLiteral("ViewMode")] = QStringLiteral("Default");
|
||||
map[QStringLiteral("SortBy")] = QStringLiteral("Default");
|
||||
map[QStringLiteral("SortOrder")] = QStringLiteral("Default");
|
||||
map[QStringLiteral("ImageCrop")] = false;
|
||||
map[QStringLiteral("AllowOverwrite")] = false;
|
||||
|
||||
if (!m_defaultSaveFileNames.isEmpty())
|
||||
map[QStringLiteral("DefaultFileNames")] = m_defaultSaveFileNames.join(QLatin1Char(','));
|
||||
if (!m_filters.isEmpty())
|
||||
map[QStringLiteral("Filter")] = m_filters.join(QLatin1Char(';'));
|
||||
|
||||
QByteArray ppsData;
|
||||
ppsData = QPpsObject::encode(map);
|
||||
|
||||
errorCode = navigator_invoke_invocation_set_data(m_invocationHandle, ppsData.constData(), ppsData.size());
|
||||
if (errorCode != BPS_SUCCESS) {
|
||||
cleanup();
|
||||
qWarning() << "QQnxFilePicker: unable to set data:" << strerror(errno);
|
||||
return;
|
||||
}
|
||||
|
||||
navigator_invoke_invocation_send(m_invocationHandle);
|
||||
}
|
||||
|
||||
void QQnxFilePicker::close()
|
||||
{
|
||||
navigator_card_close_child();
|
||||
cleanup();
|
||||
}
|
||||
|
||||
bool QQnxFilePicker::nativeEventFilter(const QByteArray&, void *message, long*)
|
||||
{
|
||||
bps_event_t * const event = static_cast<bps_event_t*>(message);
|
||||
if (!event)
|
||||
return false;
|
||||
|
||||
if (bps_event_get_code(event) == NAVIGATOR_INVOKE_TARGET_RESULT) {
|
||||
const char *id = navigator_event_get_id(event);
|
||||
const char *err = navigator_event_get_err(event);
|
||||
qFilePickerDebug("received invocation response: id=%s err=%s", id, err);
|
||||
} else if (bps_event_get_code(event) == NAVIGATOR_CHILD_CARD_CLOSED) {
|
||||
const char *data = navigator_event_get_card_closed_data(event);
|
||||
qFilePickerDebug("received data: data='%s'", data);
|
||||
handleFilePickerResponse(data);
|
||||
}
|
||||
|
||||
return false; // do not drop the event
|
||||
}
|
||||
|
||||
void QQnxFilePicker::setMode(QQnxFilePicker::Mode mode)
|
||||
{
|
||||
m_mode = mode;
|
||||
}
|
||||
|
||||
void QQnxFilePicker::setDefaultSaveFileNames(const QStringList &fileNames)
|
||||
{
|
||||
m_defaultSaveFileNames = fileNames;
|
||||
}
|
||||
|
||||
void QQnxFilePicker::addDefaultSaveFileName(const QString &fileName)
|
||||
{
|
||||
m_defaultSaveFileNames.append(fileName);
|
||||
}
|
||||
|
||||
void QQnxFilePicker::setDirectories(const QStringList &directories)
|
||||
{
|
||||
m_directories = directories;
|
||||
}
|
||||
|
||||
void QQnxFilePicker::addDirectory(const QString &directory)
|
||||
{
|
||||
m_directories.append(directory);
|
||||
}
|
||||
|
||||
void QQnxFilePicker::setFilters(const QStringList &filters)
|
||||
{
|
||||
m_filters = filters;
|
||||
}
|
||||
|
||||
void QQnxFilePicker::setTitle(const QString &title)
|
||||
{
|
||||
m_title = title;
|
||||
}
|
||||
|
||||
QQnxFilePicker::Mode QQnxFilePicker::mode() const
|
||||
{
|
||||
return m_mode;
|
||||
}
|
||||
|
||||
QStringList QQnxFilePicker::defaultSaveFileNames() const
|
||||
{
|
||||
return m_defaultSaveFileNames;
|
||||
}
|
||||
|
||||
QStringList QQnxFilePicker::directories() const
|
||||
{
|
||||
return m_directories;
|
||||
}
|
||||
|
||||
QStringList QQnxFilePicker::filters() const
|
||||
{
|
||||
return m_filters;
|
||||
}
|
||||
|
||||
QStringList QQnxFilePicker::selectedFiles() const
|
||||
{
|
||||
return m_selectedFiles;
|
||||
}
|
||||
|
||||
QString QQnxFilePicker::title() const
|
||||
{
|
||||
return m_title;
|
||||
}
|
||||
|
||||
void QQnxFilePicker::cleanup()
|
||||
{
|
||||
if (m_invocationHandle) {
|
||||
navigator_invoke_invocation_destroy(m_invocationHandle);
|
||||
m_invocationHandle = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void QQnxFilePicker::handleFilePickerResponse(const char *data)
|
||||
{
|
||||
QJsonParseError jsonError;
|
||||
QJsonDocument document = QJsonDocument::fromJson(data, &jsonError);
|
||||
|
||||
if (jsonError.error != QJsonParseError::NoError) {
|
||||
qFilePickerDebug() << "Error parsing FilePicker response: "
|
||||
<< jsonError.errorString();
|
||||
Q_EMIT closed();
|
||||
cleanup();
|
||||
return;
|
||||
}
|
||||
|
||||
// The response is a list of Json objects.
|
||||
const QVariantList array = document.array().toVariantList();
|
||||
|
||||
foreach (const QVariant &variant, array) {
|
||||
const QJsonObject object = QJsonObject::fromVariantMap(variant.toMap());
|
||||
const QUrl url(object.value(QStringLiteral("uri")).toString());
|
||||
const QString localFile = url.toLocalFile(); // strip "file://"
|
||||
|
||||
if (!localFile.isEmpty())
|
||||
m_selectedFiles << localFile;
|
||||
|
||||
qFilePickerDebug() << "FilePicker uri response:" << localFile;
|
||||
}
|
||||
|
||||
Q_EMIT closed();
|
||||
cleanup();
|
||||
}
|
||||
|
||||
QString QQnxFilePicker::filePickerType() const
|
||||
{
|
||||
bool images = false;
|
||||
bool video = false;
|
||||
bool music = false;
|
||||
QMimeDatabase mimeDb;
|
||||
for (int i = 0; i < m_filters.count(); i++) {
|
||||
QList<QMimeType> mimeTypes = mimeDb.mimeTypesForFileName(m_filters.at(i));
|
||||
if (mimeTypes.isEmpty())
|
||||
return QStringLiteral("Other");
|
||||
|
||||
if (mimeTypes.first().name().startsWith(QLatin1String("image")))
|
||||
images = true;
|
||||
else if (mimeTypes.first().name().startsWith(QLatin1String("audio")))
|
||||
music = true;
|
||||
else if (mimeTypes.first().name().startsWith(QLatin1String("video")))
|
||||
video = true;
|
||||
else
|
||||
return QStringLiteral("Other");
|
||||
}
|
||||
|
||||
if (!video && !music)
|
||||
return QStringLiteral("Picture");
|
||||
|
||||
if (!images && !music)
|
||||
return QStringLiteral("Video");
|
||||
|
||||
if (!images && !video)
|
||||
return QStringLiteral("Music");
|
||||
|
||||
return QStringLiteral("Other");
|
||||
}
|
||||
|
||||
QString QQnxFilePicker::modeToString(QQnxFilePicker::Mode mode) const
|
||||
{
|
||||
switch (mode) {
|
||||
case Picker:
|
||||
return QStringLiteral("Picker");
|
||||
case Saver:
|
||||
return QStringLiteral("Saver");
|
||||
case PickerMultiple:
|
||||
return QStringLiteral("PickerMultiple");
|
||||
case SaverMultiple:
|
||||
return QStringLiteral("SaverMultiple");
|
||||
}
|
||||
|
||||
return QStringLiteral("Picker");
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -1,107 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QQNXFILEPICKER_H
|
||||
#define QQNXFILEPICKER_H
|
||||
|
||||
#include <QAbstractNativeEventFilter>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
struct navigator_invoke_invocation_t;
|
||||
|
||||
class QQnxFilePicker : public QObject, public QAbstractNativeEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QQnxFilePicker(QObject *parent = 0);
|
||||
~QQnxFilePicker();
|
||||
|
||||
enum Mode {
|
||||
Picker,
|
||||
Saver,
|
||||
PickerMultiple,
|
||||
SaverMultiple
|
||||
};
|
||||
|
||||
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
|
||||
|
||||
void setMode(Mode mode);
|
||||
void setDefaultSaveFileNames(const QStringList &fileNames);
|
||||
void addDefaultSaveFileName(const QString &fileName);
|
||||
void setDirectories(const QStringList &directories);
|
||||
void addDirectory(const QString &directory);
|
||||
void setFilters(const QStringList &filters);
|
||||
void setTitle(const QString &title);
|
||||
|
||||
Mode mode() const;
|
||||
|
||||
QStringList defaultSaveFileNames() const;
|
||||
QStringList directories() const;
|
||||
QStringList filters() const;
|
||||
QStringList selectedFiles() const;
|
||||
|
||||
QString title() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void closed();
|
||||
|
||||
public Q_SLOTS:
|
||||
void open();
|
||||
void close();
|
||||
|
||||
private:
|
||||
void cleanup();
|
||||
void handleFilePickerResponse(const char *data);
|
||||
QString filePickerType() const;
|
||||
|
||||
QString modeToString(Mode mode) const;
|
||||
|
||||
navigator_invoke_invocation_t *m_invocationHandle;
|
||||
|
||||
Mode m_mode;
|
||||
|
||||
QStringList m_defaultSaveFileNames;
|
||||
QStringList m_directories;
|
||||
QStringList m_filters;
|
||||
QStringList m_selectedFiles;
|
||||
|
||||
QString m_title;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QQNXFILEPICKER_H
|
@ -52,12 +52,7 @@
|
||||
#include "qqnxeglwindow.h"
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
#include "qqnxbpseventfilter.h"
|
||||
#include "qqnxnavigatorbps.h"
|
||||
#include "qblackberrytheme.h"
|
||||
#include "qqnxvirtualkeyboardbps.h"
|
||||
#elif defined(QQNX_PPS)
|
||||
#if defined(QQNX_PPS)
|
||||
#include "qqnxnavigatorpps.h"
|
||||
#include "qqnxnavigatoreventnotifier.h"
|
||||
#include "qqnxvirtualkeyboardpps.h"
|
||||
@ -75,12 +70,7 @@
|
||||
#endif
|
||||
|
||||
#include "private/qgenericunixfontdatabase_p.h"
|
||||
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
#include "qqnxeventdispatcher_blackberry.h"
|
||||
#else
|
||||
#include "private/qgenericunixeventdispatcher_p.h"
|
||||
#endif
|
||||
|
||||
#include <qpa/qplatformwindow.h>
|
||||
#include <qpa/qwindowsysteminterface.h>
|
||||
@ -120,16 +110,10 @@ static inline QQnxIntegration::Options parseOptions(const QStringList ¶mList
|
||||
options |= QQnxIntegration::AlwaysFlushScreenContext;
|
||||
}
|
||||
|
||||
// On Blackberry the first window is treated as a root window
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
if (!paramList.contains(QLatin1String("no-rootwindow"))) {
|
||||
options |= QQnxIntegration::RootWindow;
|
||||
}
|
||||
#else
|
||||
if (paramList.contains(QLatin1String("rootwindow"))) {
|
||||
options |= QQnxIntegration::RootWindow;
|
||||
}
|
||||
#endif
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
@ -147,12 +131,7 @@ QQnxIntegration::QQnxIntegration(const QStringList ¶mList)
|
||||
#endif
|
||||
, m_services(0)
|
||||
, m_fontDatabase(new QGenericUnixFontDatabase())
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
, m_eventDispatcher(new QQnxEventDispatcherBlackberry())
|
||||
, m_bpsEventFilter(0)
|
||||
#else
|
||||
, m_eventDispatcher(createUnixEventDispatcher())
|
||||
#endif
|
||||
, m_nativeInterface(new QQnxNativeInterface(this))
|
||||
, m_screenEventHandler(new QQnxScreenEventHandler(this))
|
||||
#if !defined(QT_NO_CLIPBOARD)
|
||||
@ -169,8 +148,7 @@ QQnxIntegration::QQnxIntegration(const QStringList ¶mList)
|
||||
Q_SCREEN_CRITICALERROR(screen_create_context(&ms_screenContext, SCREEN_APPLICATION_CONTEXT),
|
||||
"Failed to create screen context");
|
||||
|
||||
// Not on BlackBerry, it has specialized event dispatcher which also handles navigator events
|
||||
#if !defined(Q_OS_BLACKBERRY) && defined(QQNX_PPS)
|
||||
#if defined(QQNX_PPS)
|
||||
// Create/start navigator event notifier
|
||||
m_navigatorEventNotifier = new QQnxNavigatorEventNotifier(m_navigatorEventHandler);
|
||||
|
||||
@ -190,8 +168,7 @@ QQnxIntegration::QQnxIntegration(const QStringList ¶mList)
|
||||
m_screenEventThread->start();
|
||||
#endif
|
||||
|
||||
// Not on BlackBerry, it has specialized event dispatcher which also handles virtual keyboard events
|
||||
#if !defined(Q_OS_BLACKBERRY) && defined(QQNX_PPS)
|
||||
#if defined(QQNX_PPS)
|
||||
// Create/start the keyboard class.
|
||||
m_virtualKeyboard = new QQnxVirtualKeyboardPps();
|
||||
|
||||
@ -200,9 +177,7 @@ QQnxIntegration::QQnxIntegration(const QStringList ¶mList)
|
||||
QMetaObject::invokeMethod(m_virtualKeyboard, "start", Qt::QueuedConnection);
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
m_navigator = new QQnxNavigatorBps();
|
||||
#elif defined(QQNX_PPS)
|
||||
#if defined(QQNX_PPS)
|
||||
m_navigator = new QQnxNavigatorPps();
|
||||
#endif
|
||||
|
||||
@ -210,34 +185,8 @@ QQnxIntegration::QQnxIntegration(const QStringList ¶mList)
|
||||
if (m_navigator)
|
||||
m_services = new QQnxServices(m_navigator);
|
||||
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
QQnxVirtualKeyboardBps* virtualKeyboardBps = new QQnxVirtualKeyboardBps;
|
||||
|
||||
#if defined(QQNX_SCREENEVENTTHREAD)
|
||||
m_bpsEventFilter = new QQnxBpsEventFilter(m_navigatorEventHandler, 0, virtualKeyboardBps);
|
||||
#else
|
||||
m_bpsEventFilter = new QQnxBpsEventFilter(m_navigatorEventHandler, m_screenEventHandler, virtualKeyboardBps);
|
||||
#endif
|
||||
|
||||
m_bpsEventFilter->installOnEventDispatcher(m_eventDispatcher);
|
||||
|
||||
m_virtualKeyboard = virtualKeyboardBps;
|
||||
#endif
|
||||
|
||||
// Create displays for all possible screens (which may not be attached). We have to do this
|
||||
// *after* the call to m_bpsEventFilter->installOnEventDispatcher(m_eventDispatcher). The
|
||||
// reason for this is that we have to be registered for NAVIGATOR events before we create the
|
||||
// QQnxScreen objects, and hence the QQnxRootWindow's. It is when the NAVIGATOR service sees
|
||||
// the window creation that it starts sending us messages which results in a race if we
|
||||
// create the displays first.
|
||||
createDisplays();
|
||||
|
||||
#if !defined(QQNX_SCREENEVENTTHREAD) && defined(Q_OS_BLACKBERRY)
|
||||
// Register for screen domain events with bps
|
||||
Q_FOREACH (QQnxScreen *screen, m_screens)
|
||||
m_bpsEventFilter->registerForScreenEvents(screen);
|
||||
#endif
|
||||
|
||||
if (m_virtualKeyboard) {
|
||||
// TODO check if we need to do this for all screens or only the primary one
|
||||
QObject::connect(m_virtualKeyboard, SIGNAL(heightChanged(int)),
|
||||
@ -275,7 +224,7 @@ QQnxIntegration::~QQnxIntegration()
|
||||
#endif
|
||||
|
||||
// Stop/destroy navigator event notifier
|
||||
#if !defined(Q_OS_BLACKBERRY) && defined(QQNX_PPS)
|
||||
#if defined(QQNX_PPS)
|
||||
delete m_navigatorEventNotifier;
|
||||
#endif
|
||||
delete m_navigatorEventHandler;
|
||||
@ -283,13 +232,6 @@ QQnxIntegration::~QQnxIntegration()
|
||||
#if defined(QQNX_SCREENEVENTTHREAD)
|
||||
// Stop/destroy screen event thread
|
||||
delete m_screenEventThread;
|
||||
#elif defined(Q_OS_BLACKBERRY)
|
||||
Q_FOREACH (QQnxScreen *screen, m_screens)
|
||||
m_bpsEventFilter->unregisterForScreenEvents(screen);
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
delete m_bpsEventFilter;
|
||||
#endif
|
||||
|
||||
// In case the event-dispatcher was never transferred to QCoreApplication
|
||||
@ -450,21 +392,6 @@ QPlatformServices * QQnxIntegration::services() const
|
||||
return m_services;
|
||||
}
|
||||
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
QStringList QQnxIntegration::themeNames() const
|
||||
{
|
||||
return QStringList(QBlackberryTheme::name());
|
||||
}
|
||||
|
||||
QPlatformTheme *QQnxIntegration::createPlatformTheme(const QString &name) const
|
||||
{
|
||||
qIntegrationDebug() << Q_FUNC_INFO << "name =" << name;
|
||||
if (name == QBlackberryTheme::name())
|
||||
return new QBlackberryTheme(this);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
QWindow *QQnxIntegration::window(screen_window_t qnxWindow)
|
||||
{
|
||||
qIntegrationDebug() << Q_FUNC_INFO;
|
||||
@ -601,7 +528,7 @@ QQnxIntegration::Options QQnxIntegration::ms_options = 0;
|
||||
|
||||
bool QQnxIntegration::supportsNavigatorEvents() const
|
||||
{
|
||||
// If QQNX_PPS or Q_OS_BLACKBERRY is defined then we have navigator
|
||||
// If QQNX_PPS is defined then we have navigator
|
||||
return m_navigator != 0;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QQnxBpsEventFilter;
|
||||
#if defined(QQNX_SCREENEVENTTHREAD)
|
||||
class QQnxScreenEventThread;
|
||||
#endif
|
||||
@ -117,12 +116,6 @@ public:
|
||||
|
||||
QPlatformServices *services() const;
|
||||
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
QStringList themeNames() const;
|
||||
QPlatformTheme *createPlatformTheme(const QString &name) const;
|
||||
QQnxBpsEventFilter *bpsEventFilter() const { return m_bpsEventFilter; }
|
||||
#endif
|
||||
|
||||
static QWindow *window(screen_window_t qnxWindow);
|
||||
|
||||
QQnxScreen *screenForNative(screen_display_t qnxScreen) const;
|
||||
@ -156,9 +149,6 @@ private:
|
||||
QQnxServices *m_services;
|
||||
QPlatformFontDatabase *m_fontDatabase;
|
||||
mutable QAbstractEventDispatcher *m_eventDispatcher;
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
QQnxBpsEventFilter *m_bpsEventFilter;
|
||||
#endif
|
||||
QQnxNativeInterface *m_nativeInterface;
|
||||
QList<QQnxScreen*> m_screens;
|
||||
QQnxScreenEventHandler *m_screenEventHandler;
|
||||
|
@ -85,11 +85,6 @@ void *QQnxNativeInterface::nativeResourceForScreen(const QByteArray &resource, Q
|
||||
|
||||
void *QQnxNativeInterface::nativeResourceForIntegration(const QByteArray &resource)
|
||||
{
|
||||
#ifdef Q_OS_BLACKBERRY
|
||||
if (resource == "navigatorEventHandler")
|
||||
return m_integration->navigatorEventHandler();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,66 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $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
|
@ -1,54 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $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
|
@ -1,57 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qqnxnavigatorcover.h"
|
||||
|
||||
QQnxNavigatorCover::QQnxNavigatorCover()
|
||||
{
|
||||
navigator_window_cover_attribute_create(&m_coverAttribute);
|
||||
}
|
||||
|
||||
QQnxNavigatorCover::~QQnxNavigatorCover()
|
||||
{
|
||||
if (m_coverAttribute)
|
||||
navigator_window_cover_attribute_destroy(m_coverAttribute);
|
||||
|
||||
navigator_window_cover_reset();
|
||||
}
|
||||
|
||||
void QQnxNavigatorCover::updateCover()
|
||||
{
|
||||
if (m_coverAttribute) {
|
||||
navigator_window_cover_attribute_set_transition(m_coverAttribute,
|
||||
NAVIGATOR_WINDOW_COVER_TRANSITION_NONE);
|
||||
navigator_window_cover_attribute_set_alternate_window(m_coverAttribute);
|
||||
navigator_window_cover_update(m_coverAttribute);
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QQNXNAVIGATORCOVER_H
|
||||
#define QQNXNAVIGATORCOVER_H
|
||||
|
||||
#include "qqnxabstractcover.h"
|
||||
#include <bps/navigator.h>
|
||||
|
||||
class QQnxNavigatorCover : public QQnxAbstractCover
|
||||
{
|
||||
public:
|
||||
QQnxNavigatorCover();
|
||||
~QQnxNavigatorCover();
|
||||
|
||||
void updateCover();
|
||||
|
||||
private:
|
||||
navigator_window_cover_attribute_t *m_coverAttribute;
|
||||
};
|
||||
|
||||
#endif // QQNXNAVIGATORCOVER_H
|
@ -584,10 +584,6 @@ void QQnxScreen::addWindow(QQnxWindow *window)
|
||||
else
|
||||
m_childWindows.push_back(window);
|
||||
updateHierarchy();
|
||||
} else {
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
m_coverWindow = window;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,13 +254,8 @@ void QQnxScreenEventHandler::handleKeyboardEvent(screen_event_t event)
|
||||
"Failed to query event cap");
|
||||
|
||||
int sequenceId = 0;
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
Q_SCREEN_CHECKERROR(
|
||||
screen_get_event_property_iv(event, SCREEN_PROPERTY_SEQUENCE_ID, &sequenceId),
|
||||
"Failed to query event seqId");
|
||||
#endif
|
||||
|
||||
bool inject = true;
|
||||
|
||||
Q_FOREACH (QQnxScreenEventFilter *filter, m_eventFilters) {
|
||||
if (filter->handleKeyboardEvent(flags, sym, modifiers, scan, cap, sequenceId)) {
|
||||
inject = false;
|
||||
|
@ -1,74 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qqnxsystemsettings.h"
|
||||
|
||||
#include <QFont>
|
||||
#include <qpa/qplatformfontdatabase.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QHash<QPlatformTheme::Font, QFont *> qt_qnx_createRoleFonts(QPlatformFontDatabase *fontDatabase)
|
||||
{
|
||||
// See http://docs.blackberry.com/en/developers/deliverables/41577/typography.jsp
|
||||
// which recommends using
|
||||
// - small font size of 6 points
|
||||
// - normal font size of 8 points
|
||||
// - 11 points for titles (not covered by the theme system).
|
||||
QFont baseFont = fontDatabase->defaultFont();
|
||||
baseFont.setPointSize(8);
|
||||
|
||||
QHash<QPlatformTheme::Font, QFont *> fonts;
|
||||
fonts.insert(QPlatformTheme::SystemFont, new QFont(baseFont));
|
||||
fonts.insert(QPlatformTheme::PushButtonFont, new QFont(baseFont));
|
||||
fonts.insert(QPlatformTheme::ListViewFont, new QFont(baseFont));
|
||||
fonts.insert(QPlatformTheme::ListBoxFont, new QFont(baseFont));
|
||||
fonts.insert(QPlatformTheme::TitleBarFont, new QFont(baseFont));
|
||||
fonts.insert(QPlatformTheme::MenuFont, new QFont(baseFont));
|
||||
fonts.insert(QPlatformTheme::ComboMenuItemFont, new QFont(baseFont));
|
||||
fonts.insert(QPlatformTheme::HeaderViewFont, new QFont(baseFont));
|
||||
fonts.insert(QPlatformTheme::TipLabelFont, new QFont(baseFont));
|
||||
fonts.insert(QPlatformTheme::LabelFont, new QFont(baseFont));
|
||||
fonts.insert(QPlatformTheme::ToolButtonFont, new QFont(baseFont));
|
||||
fonts.insert(QPlatformTheme::MenuItemFont, new QFont(baseFont));
|
||||
fonts.insert(QPlatformTheme::ComboLineEditFont, new QFont(baseFont));
|
||||
|
||||
QFont smallFont(baseFont);
|
||||
smallFont.setPointSize(6);
|
||||
fonts.insert(QPlatformTheme::SmallFont, new QFont(smallFont));
|
||||
fonts.insert(QPlatformTheme::MiniFont, new QFont(smallFont));
|
||||
|
||||
return fonts;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -1,48 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QQNXSYSTEMSETTINGS_H
|
||||
#define QQNXSYSTEMSETTINGS_H
|
||||
|
||||
#include <QtCore/qhash.h>
|
||||
#include <qpa/qplatformtheme.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QPlatformFontDatabase;
|
||||
|
||||
QHash<QPlatformTheme::Font, QFont *> qt_qnx_createRoleFonts(QPlatformFontDatabase *fontDatabase);
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QQNXSYSTEMSETTINGS_H
|
@ -1,217 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qqnxvirtualkeyboardbps.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <bps/event.h>
|
||||
#include <bps/locale.h>
|
||||
#include <bps/virtualkeyboard.h>
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
#include <bbndk.h>
|
||||
#endif
|
||||
|
||||
#if defined(QQNXVIRTUALKEYBOARD_DEBUG)
|
||||
#define qVirtualKeyboardDebug qDebug
|
||||
#else
|
||||
#define qVirtualKeyboardDebug QT_NO_QDEBUG_MACRO
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QQnxVirtualKeyboardBps::QQnxVirtualKeyboardBps(QObject *parent)
|
||||
: QQnxAbstractVirtualKeyboard(parent)
|
||||
{
|
||||
if (locale_request_events(0) != BPS_SUCCESS)
|
||||
qWarning("QQNX: Failed to register for locale events");
|
||||
|
||||
if (virtualkeyboard_request_events(0) != BPS_SUCCESS)
|
||||
qWarning("QQNX: Failed to register for virtual keyboard events");
|
||||
|
||||
int height = 0;
|
||||
if (virtualkeyboard_get_height(&height) != BPS_SUCCESS)
|
||||
qWarning("QQNX: Failed to get virtual keyboard height");
|
||||
|
||||
setHeight(height);
|
||||
}
|
||||
|
||||
bool QQnxVirtualKeyboardBps::handleEvent(bps_event_t *event)
|
||||
{
|
||||
const int eventDomain = bps_event_get_domain(event);
|
||||
if (eventDomain == locale_get_domain())
|
||||
return handleLocaleEvent(event);
|
||||
|
||||
if (eventDomain == virtualkeyboard_get_domain())
|
||||
return handleVirtualKeyboardEvent(event);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QQnxVirtualKeyboardBps::showKeyboard()
|
||||
{
|
||||
qVirtualKeyboardDebug() << Q_FUNC_INFO << "current visibility=" << isVisible();
|
||||
|
||||
// They keyboard's mode is global between applications, we have to set it each time
|
||||
if ( !isVisible() )
|
||||
applyKeyboardOptions();
|
||||
|
||||
virtualkeyboard_show();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QQnxVirtualKeyboardBps::hideKeyboard()
|
||||
{
|
||||
qVirtualKeyboardDebug() << Q_FUNC_INFO << "current visibility=" << isVisible();
|
||||
virtualkeyboard_hide();
|
||||
return true;
|
||||
}
|
||||
|
||||
void QQnxVirtualKeyboardBps::applyKeyboardOptions()
|
||||
{
|
||||
virtualkeyboard_layout_t layout = keyboardLayout();
|
||||
virtualkeyboard_enter_t enter = enterKey();
|
||||
|
||||
qVirtualKeyboardDebug() << Q_FUNC_INFO << "mode=" << keyboardMode() << "enterKey=" << enterKeyType();
|
||||
|
||||
virtualkeyboard_change_options(layout, enter);
|
||||
}
|
||||
|
||||
virtualkeyboard_layout_t QQnxVirtualKeyboardBps::keyboardLayout() const
|
||||
{
|
||||
switch (keyboardMode()) {
|
||||
case Url:
|
||||
return VIRTUALKEYBOARD_LAYOUT_URL;
|
||||
case Email:
|
||||
return VIRTUALKEYBOARD_LAYOUT_EMAIL;
|
||||
case Web:
|
||||
return VIRTUALKEYBOARD_LAYOUT_WEB;
|
||||
case NumPunc:
|
||||
return VIRTUALKEYBOARD_LAYOUT_NUM_PUNC;
|
||||
case Number:
|
||||
return VIRTUALKEYBOARD_LAYOUT_NUMBER;
|
||||
case Symbol:
|
||||
return VIRTUALKEYBOARD_LAYOUT_SYMBOL;
|
||||
case Phone:
|
||||
return VIRTUALKEYBOARD_LAYOUT_PHONE;
|
||||
case Pin:
|
||||
return VIRTUALKEYBOARD_LAYOUT_PIN;
|
||||
case Password:
|
||||
return VIRTUALKEYBOARD_LAYOUT_PASSWORD;
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
#if BBNDK_VERSION_AT_LEAST(10, 2, 1)
|
||||
case Alphanumeric:
|
||||
return VIRTUALKEYBOARD_LAYOUT_ALPHANUMERIC;
|
||||
#endif
|
||||
#endif
|
||||
case Default: // fall through
|
||||
default:
|
||||
return VIRTUALKEYBOARD_LAYOUT_DEFAULT;
|
||||
}
|
||||
|
||||
return VIRTUALKEYBOARD_LAYOUT_DEFAULT;
|
||||
}
|
||||
|
||||
virtualkeyboard_enter_t QQnxVirtualKeyboardBps::enterKey() const
|
||||
{
|
||||
switch (enterKeyType()) {
|
||||
case Connect:
|
||||
return VIRTUALKEYBOARD_ENTER_CONNECT;
|
||||
case Done:
|
||||
return VIRTUALKEYBOARD_ENTER_DONE;
|
||||
case Go:
|
||||
return VIRTUALKEYBOARD_ENTER_GO;
|
||||
case Join:
|
||||
return VIRTUALKEYBOARD_ENTER_JOIN;
|
||||
case Next:
|
||||
return VIRTUALKEYBOARD_ENTER_NEXT;
|
||||
case Search:
|
||||
return VIRTUALKEYBOARD_ENTER_SEARCH;
|
||||
case Send:
|
||||
return VIRTUALKEYBOARD_ENTER_SEND;
|
||||
case Submit:
|
||||
return VIRTUALKEYBOARD_ENTER_SUBMIT;
|
||||
case Default: // fall through
|
||||
default:
|
||||
return VIRTUALKEYBOARD_ENTER_DEFAULT;
|
||||
}
|
||||
|
||||
return VIRTUALKEYBOARD_ENTER_DEFAULT;
|
||||
}
|
||||
|
||||
bool QQnxVirtualKeyboardBps::handleLocaleEvent(bps_event_t *event)
|
||||
{
|
||||
if (bps_event_get_code(event) == LOCALE_INFO) {
|
||||
const QString language = QString::fromLatin1(locale_event_get_language(event));
|
||||
const QString country = QString::fromLatin1(locale_event_get_country(event));
|
||||
const QLocale newLocale(language + QLatin1Char('_') + country);
|
||||
|
||||
qVirtualKeyboardDebug() << Q_FUNC_INFO << "current locale" << locale() << "new locale=" << newLocale;
|
||||
setLocale(newLocale);
|
||||
return true;
|
||||
}
|
||||
|
||||
qVirtualKeyboardDebug() << Q_FUNC_INFO << "Unhandled locale event. code=" << bps_event_get_code(event);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QQnxVirtualKeyboardBps::handleVirtualKeyboardEvent(bps_event_t *event)
|
||||
{
|
||||
switch (bps_event_get_code(event)) {
|
||||
case VIRTUALKEYBOARD_EVENT_VISIBLE:
|
||||
qVirtualKeyboardDebug() << Q_FUNC_INFO << "EVENT VISIBLE: current visibility=" << isVisible();
|
||||
setVisible(true);
|
||||
break;
|
||||
|
||||
case VIRTUALKEYBOARD_EVENT_HIDDEN:
|
||||
qVirtualKeyboardDebug() << Q_FUNC_INFO << "EVENT HIDDEN: current visibility=" << isVisible();
|
||||
setVisible(false);
|
||||
break;
|
||||
|
||||
case VIRTUALKEYBOARD_EVENT_INFO: {
|
||||
const int newHeight = virtualkeyboard_event_get_height(event);
|
||||
qVirtualKeyboardDebug() << Q_FUNC_INFO << "EVENT INFO: current height=" << height() << "new height=" << newHeight;
|
||||
setHeight(newHeight);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
qVirtualKeyboardDebug() << Q_FUNC_INFO << "Unhandled virtual keyboard event. code=" << bps_event_get_code(event);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -1,68 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Research In Motion
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QQNXVIRTUALKEYBOARDBPS_H
|
||||
#define QQNXVIRTUALKEYBOARDBPS_H
|
||||
|
||||
#include "qqnxabstractvirtualkeyboard.h"
|
||||
#include <bps/virtualkeyboard.h>
|
||||
|
||||
struct bps_event_t;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QQnxVirtualKeyboardBps : public QQnxAbstractVirtualKeyboard
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQnxVirtualKeyboardBps(QObject *parent = 0);
|
||||
|
||||
bool handleEvent(bps_event_t *event);
|
||||
|
||||
bool showKeyboard();
|
||||
bool hideKeyboard();
|
||||
|
||||
protected:
|
||||
void applyKeyboardOptions();
|
||||
|
||||
private:
|
||||
bool handleLocaleEvent(bps_event_t *event);
|
||||
bool handleVirtualKeyboardEvent(bps_event_t *event);
|
||||
|
||||
virtualkeyboard_layout_t keyboardLayout() const;
|
||||
virtualkeyboard_enter_t enterKey() const;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QQNXVIRTUALKEYBOARDBPS_H
|
@ -47,12 +47,6 @@
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
#include "qqnxnavigatorcover.h"
|
||||
#include <sys/pps.h>
|
||||
#include <bps/navigator.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(QQNXWINDOW_DEBUG)
|
||||
@ -633,23 +627,7 @@ QQnxWindow *QQnxWindow::findWindow(screen_window_t windowHandle)
|
||||
|
||||
void QQnxWindow::minimize()
|
||||
{
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
qWindowDebug() << Q_FUNC_INFO;
|
||||
|
||||
pps_encoder_t encoder;
|
||||
|
||||
pps_encoder_initialize(&encoder, false);
|
||||
pps_encoder_add_string(&encoder, "msg", "minimizeWindow");
|
||||
|
||||
if (navigator_raw_write(pps_encoder_buffer(&encoder),
|
||||
pps_encoder_length(&encoder)) != BPS_SUCCESS) {
|
||||
qWindowDebug() << Q_FUNC_INFO << "navigator_raw_write failed:" << strerror(errno);
|
||||
}
|
||||
|
||||
pps_encoder_cleanup(&encoder);
|
||||
#else
|
||||
qWarning("Qt::WindowMinimized is not supported by this OS version");
|
||||
#endif
|
||||
}
|
||||
|
||||
void QQnxWindow::setRotation(int rotation)
|
||||
@ -686,18 +664,8 @@ void QQnxWindow::initWindow()
|
||||
QQnxScreen *platformScreen = static_cast<QQnxScreen *>(window()->screen()->handle());
|
||||
setScreen(platformScreen);
|
||||
|
||||
if (window()->type() == Qt::CoverWindow) {
|
||||
#if defined(Q_OS_BLACKBERRY)
|
||||
if (platformScreen->rootWindow()) {
|
||||
screen_set_window_property_pv(m_screen->rootWindow()->nativeHandle(),
|
||||
SCREEN_PROPERTY_ALTERNATE_WINDOW, (void**)&m_window);
|
||||
m_cover.reset(new QQnxNavigatorCover);
|
||||
} else {
|
||||
qWarning("No root window for cover window");
|
||||
}
|
||||
#endif
|
||||
if (window()->type() == Qt::CoverWindow)
|
||||
m_exposed = false;
|
||||
}
|
||||
|
||||
// Add window to plugin's window mapper
|
||||
QQnxIntegration::addWindow(m_window, window());
|
||||
|
@ -8,7 +8,6 @@ qtHaveModule(gui) {
|
||||
!contains(QT_DISABLED_FEATURES, imageformatplugin): SUBDIRS *= imageformats
|
||||
!contains(QT_DISABLED_FEATURES, library): SUBDIRS *= generic
|
||||
}
|
||||
qtHaveModule(widgets): SUBDIRS *= styles
|
||||
|
||||
!winrt:!wince*:qtHaveModule(widgets):!contains(QT_DISABLED_FEATURES, printer) {
|
||||
SUBDIRS += printsupport
|
||||
|
@ -1,54 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>light/button/core_button_disabled.png</file>
|
||||
<file>light/button/core_button_inactive.png</file>
|
||||
<file>light/button/core_button_pressed.png</file>
|
||||
<file>light/checkbox/core_checkbox_checked.png</file>
|
||||
<file>light/checkbox/core_checkbox_disabled.png</file>
|
||||
<file>light/checkbox/core_checkbox_disabledchecked.png</file>
|
||||
<file>light/checkbox/core_checkbox_enabled.png</file>
|
||||
<file>light/checkbox/core_checkbox_pressed.png</file>
|
||||
<file>light/checkbox/core_checkbox_pressedchecked.png</file>
|
||||
<file>light/radiobutton/core_radiobutton_checked.png</file>
|
||||
<file>light/radiobutton/core_radiobutton_disabled.png</file>
|
||||
<file>light/radiobutton/core_radiobutton_disabledchecked.png</file>
|
||||
<file>light/radiobutton/core_radiobutton_enabled.png</file>
|
||||
<file>light/radiobutton/core_radiobutton_pressed.png</file>
|
||||
<file>light/slider/core_slider_active.png</file>
|
||||
<file>light/slider/core_slider_disabled.png</file>
|
||||
<file>light/slider/core_slider_handle.png</file>
|
||||
<file>light/slider/core_slider_handle_disabled.png</file>
|
||||
<file>light/slider/core_slider_handle_pressed.png</file>
|
||||
<file>light/slider/core_slider_inactive.png</file>
|
||||
<file>light/slider/core_slider_vactive.png</file>
|
||||
<file>light/slider/core_slider_vdisabled.png</file>
|
||||
<file>light/slider/core_slider_vinactive.png</file>
|
||||
<file>light/slider/core_slider_black.png</file>
|
||||
<file>light/slider/core_slider_enabled.png</file>
|
||||
<file>light/slider/core_slider_vblack.png</file>
|
||||
<file>light/slider/core_slider_venabled.png</file>
|
||||
<file>light/button/core_button_active.png</file>
|
||||
<file>light/lineedit/core_textinput_bg.png</file>
|
||||
<file>light/lineedit/core_textinput_bg_disabled.png</file>
|
||||
<file>light/lineedit/core_textinput_bg_focused.png</file>
|
||||
<file>light/progressbar/core_progressindicator_bg.png</file>
|
||||
<file>light/progressbar/core_progressindicator_complete.png</file>
|
||||
<file>light/progressbar/core_progressindicator_fill.png</file>
|
||||
<file>light/progressbar/core_progressindicator_vbg.png</file>
|
||||
<file>light/progressbar/core_progressindicator_vcomplete.png</file>
|
||||
<file>light/progressbar/core_progressindicator_vfill.png</file>
|
||||
<file>light/combobox/core_dropdown_button.png</file>
|
||||
<file>light/combobox/core_dropdown_button_arrowdown.png</file>
|
||||
<file>light/combobox/core_dropdown_button_arrowdown_pressed.png</file>
|
||||
<file>light/combobox/core_dropdown_button_arrowup.png</file>
|
||||
<file>light/combobox/core_dropdown_button_disabled.png</file>
|
||||
<file>light/combobox/core_dropdown_button_pressed.png</file>
|
||||
<file>light/combobox/core_dropdown_checkmark.png</file>
|
||||
<file>light/combobox/core_dropdown_divider.png</file>
|
||||
<file>light/combobox/core_dropdown_menu.png</file>
|
||||
<file>light/combobox/core_dropdown_menuup.png</file>
|
||||
<file>light/combobox/core_listitem_active.png</file>
|
||||
<file>light/listitem/core_listitem_active.png</file>
|
||||
<file>light/listitem/core_listitem_divider.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,26 +0,0 @@
|
||||
TARGET = bb10styleplugin
|
||||
|
||||
PLUGIN_TYPE = styles
|
||||
PLUGIN_CLASS_NAME = BlackBerry10StylePlugin
|
||||
load(qt_plugin)
|
||||
|
||||
INCLUDEPATH += $$PWD
|
||||
|
||||
QT += widgets
|
||||
|
||||
HEADERS += \
|
||||
qbb10brightstyle.h \
|
||||
qbb10darkstyle.h \
|
||||
qbb10styleplugin.h
|
||||
|
||||
SOURCES += \
|
||||
qbb10brightstyle.cpp \
|
||||
qbb10darkstyle.cpp \
|
||||
qbb10styleplugin.cpp
|
||||
|
||||
RESOURCES += \
|
||||
qbb10brightstyle.qrc \
|
||||
qbb10darkstyle.qrc
|
||||
|
||||
OTHER_FILES += qbb10styleplugin.json
|
||||
|
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 935 B |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 134 B |
Before Width: | Height: | Size: 874 B |
Before Width: | Height: | Size: 996 B |
Before Width: | Height: | Size: 182 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 454 B |
Before Width: | Height: | Size: 394 B |
Before Width: | Height: | Size: 164 B |
Before Width: | Height: | Size: 135 B |