summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlocale_unix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qlocale_unix.cpp')
-rw-r--r--src/corelib/tools/qlocale_unix.cpp101
1 files changed, 0 insertions, 101 deletions
diff --git a/src/corelib/tools/qlocale_unix.cpp b/src/corelib/tools/qlocale_unix.cpp
index fb9e3f1a8b..4e443cd79b 100644
--- a/src/corelib/tools/qlocale_unix.cpp
+++ b/src/corelib/tools/qlocale_unix.cpp
@@ -47,99 +47,8 @@
#include "qvariant.h"
#include "qreadwritelock.h"
-#if defined(Q_OS_BLACKBERRY)
-#include <QtCore/private/qcore_unix_p.h>
-#include <QCoreApplication>
-
-#include <unistd.h>
-#include <errno.h>
-#include <sys/pps.h>
-#endif
-
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_BLACKBERRY)
-static const char ppsServicePath[] = "/pps/services/locale/uom";
-static const size_t ppsBufferSize = 256;
-
-QQNXLocaleData::QQNXLocaleData()
- :ppsNotifier(0)
- ,ppsFd(-1)
-{
- initialize();
-
- // 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, "installSocketNotifier", Qt::QueuedConnection);
-}
-
-QQNXLocaleData::~QQNXLocaleData()
-{
- if (ppsFd != -1)
- qt_safe_close(ppsFd);
-}
-
-void QQNXLocaleData::updateMeasurementSystem()
-{
- char buffer[ppsBufferSize];
-
- errno = 0;
- int bytes = qt_safe_read(ppsFd, buffer, ppsBufferSize - 1);
- if (bytes == -1) {
- qWarning("Failed to read Locale pps, errno=%d", errno);
- return;
- }
- // 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) == PPS_DECODER_OK) {
- pps_decoder_push(&ppsDecoder, 0);
- const char *measurementBuff;
- if (pps_decoder_get_string(&ppsDecoder, "uom", &measurementBuff) == PPS_DECODER_OK) {
- if (qstrcmp(measurementBuff, "imperial") == 0) {
- pps_decoder_cleanup(&ppsDecoder);
- ppsMeasurement = QLocale::ImperialSystem;
- return;
- }
- }
- }
-
- pps_decoder_cleanup(&ppsDecoder);
- ppsMeasurement = QLocale::MetricSystem;
-}
-
-void QQNXLocaleData::initialize()
-{
- errno = 0;
- ppsFd = qt_safe_open(ppsServicePath, O_RDONLY);
- if (ppsFd == -1) {
- qWarning("Failed to open Locale pps, errno=%d", errno);
- return;
- }
-
- updateMeasurementSystem();
-}
-
-void QQNXLocaleData::installSocketNotifier()
-{
- if (!QCoreApplication::instance() || ppsFd == -1) {
- qWarning("QQNXLocaleData: Failed to create socket notifier, locale updates may not work.");
- return;
- }
-
- if (ppsNotifier) {
- qWarning("QQNXLocaleData: socket notifier already created.");
- return;
- }
-
- ppsNotifier = new QSocketNotifier(ppsFd, QSocketNotifier::Read, this);
- QObject::connect(ppsNotifier, SIGNAL(activated(int)), this, SLOT(updateMeasurementSystem()));
-}
-#endif
-
#ifndef QT_NO_SYSTEMLOCALE
struct QSystemLocaleData
{
@@ -194,11 +103,7 @@ void QSystemLocaleData::readEnvironment()
lc_messages = QLocale(QString::fromLatin1(lc_messages_var));
}
-
Q_GLOBAL_STATIC(QSystemLocaleData, qSystemLocaleData)
-#if defined(Q_OS_BLACKBERRY)
- Q_GLOBAL_STATIC(QQNXLocaleData, qqnxLocaleData)
-#endif
#endif
@@ -230,9 +135,6 @@ QLocale QSystemLocale::fallbackUiLocale() const
QVariant QSystemLocale::query(QueryType type, QVariant in) const
{
QSystemLocaleData *d = qSystemLocaleData();
-#if defined(Q_OS_BLACKBERRY)
- QQNXLocaleData *qnxd = qqnxLocaleData();
-#endif
if (type == LocaleChanged) {
d->readEnvironment();
@@ -320,9 +222,6 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const
return QLocale::MetricSystem;
if (meas_locale.compare(QLatin1String("Other"), Qt::CaseInsensitive) == 0)
return QLocale::MetricSystem;
-#if defined(Q_OS_BLACKBERRY)
- return qnxd->ppsMeasurement;
-#endif
return QVariant((int)QLocale(meas_locale).measurementSystem());
}
case UILanguages: {