diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/kernel/qcore_symbian_p.h | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 10 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication.h | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication_p.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 43 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_p.h | 5 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_symbian.cpp | 121 |
7 files changed, 17 insertions, 173 deletions
diff --git a/src/corelib/kernel/qcore_symbian_p.h b/src/corelib/kernel/qcore_symbian_p.h index 2ef48b5..f86bfd3 100644 --- a/src/corelib/kernel/qcore_symbian_p.h +++ b/src/corelib/kernel/qcore_symbian_p.h @@ -139,8 +139,7 @@ enum S60PluginFuncOrdinals S60Plugin_GetLongDateFormatSpec = 3, S60Plugin_GetShortDateFormatSpec = 4, S60Plugin_LocalizedDirectoryName = 5, - S60Plugin_GetSystemDrive = 6, - S60Plugin_RefreshLocaleInfo = 7 + S60Plugin_GetSystemDrive = 6 }; Q_CORE_EXPORT TLibraryFunction qt_resolveS60PluginFunc(int ordinal); diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 93df45d..8a55bad 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -69,7 +69,6 @@ # include <f32file.h> # include "qeventdispatcher_symbian_p.h" # include "private/qcore_symbian_p.h" -# include "private/qlocale_p.h" #elif defined(Q_OS_UNIX) # if !defined(QT_NO_GLIB) # include "qeventdispatcher_glib_p.h" @@ -2602,13 +2601,4 @@ int QCoreApplication::loopLevel() \sa Q_OBJECT, QObject::tr(), QObject::trUtf8() */ -#if defined(Q_OS_SYMBIAN) -void QCoreApplicationPrivate::_q_symbianRegisterLocaleNotifier() -{ - QLocalePrivate::symbianRegisterLocaleNotifier(); -} -#endif - QT_END_NAMESPACE - -#include "moc_qcoreapplication.cpp" diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index 152a775..097b8b4 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -196,10 +196,6 @@ private: static QCoreApplication *self; -#if defined(Q_OS_SYMBIAN) - Q_PRIVATE_SLOT(d_func(), void _q_symbianRegisterLocaleNotifier()) -#endif - Q_DISABLE_COPY(QCoreApplication) friend class QEventDispatcherUNIXPrivate; diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index 39e50c4..bf43f88 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -122,10 +122,6 @@ public: static uint attribs; static inline bool testAttribute(uint flag) { return attribs & (1 << flag); } - -#if defined(Q_OS_SYMBIAN) - void _q_symbianRegisterLocaleNotifier(); -#endif }; QT_END_NAMESPACE diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 22114c2..4a66b92 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -129,10 +129,6 @@ inline bool isascii(int c) } #endif -#if defined(Q_OS_SYMBIAN) -void symbianUpdateSystemPrivate(); -#endif - /****************************************************************************** ** Helpers for accessing Qt locale database */ @@ -1392,8 +1388,7 @@ QSystemLocale::QSystemLocale() /*! \internal */ QSystemLocale::QSystemLocale(bool) -{ -} +{ } /*! Deletes the object. @@ -1412,29 +1407,16 @@ static const QSystemLocale *systemLocale() { if (_systemLocale) return _systemLocale; -#if defined(Q_OS_SYMBIAN) - symbianInitSystemLocale(); -#endif return QSystemLocale_globalSystemLocale(); } -void QLocalePrivate::updateSystemPrivate(bool initialize) +void QLocalePrivate::updateSystemPrivate() { const QSystemLocale *sys_locale = systemLocale(); if (!system_lp) system_lp = globalLocalePrivate(); *system_lp = *sys_locale->fallbackLocale().d(); - system_lp->m_language_id = 0; -#if defined(Q_OS_SYMBIAN) - RDebug::Print(_L("updateSystemPrivate")); -#endif - if (!initialize) - return; - -#if defined(Q_OS_SYMBIAN) - symbianUpdateSystemPrivate(); -#endif QVariant res = sys_locale->query(QSystemLocale::LanguageId, QVariant()); if (!res.isNull()) system_lp->m_language_id = res.toInt(); @@ -1464,12 +1446,12 @@ void QLocalePrivate::updateSystemPrivate(bool initialize) } #endif -static const QLocalePrivate *systemPrivate(bool initialize = true) +static const QLocalePrivate *systemPrivate() { #ifndef QT_NO_SYSTEMLOCALE // copy over the information from the fallback locale and modify if (!system_lp || system_lp->m_language_id == 0) - QLocalePrivate::updateSystemPrivate(initialize); + QLocalePrivate::updateSystemPrivate(); return system_lp; #else @@ -1477,10 +1459,10 @@ static const QLocalePrivate *systemPrivate(bool initialize = true) #endif } -static const QLocalePrivate *defaultPrivate(bool initialize = true) +static const QLocalePrivate *defaultPrivate() { if (!default_lp) - default_lp = systemPrivate(initialize); + default_lp = systemPrivate(); return default_lp; } @@ -2187,7 +2169,7 @@ QLocale::QLocale() : v(0) { p.numberOptions = default_number_options; - p.index = localePrivateIndex(defaultPrivate(false)); + p.index = localePrivateIndex(defaultPrivate()); } /*! @@ -2217,7 +2199,7 @@ QLocale::QLocale(Language language, Country country) // If not found, should default to system if (d->languageId() == QLocale::C && language != QLocale::C) { p.numberOptions = default_number_options; - p.index = localePrivateIndex(defaultPrivate(false)); + p.index = localePrivateIndex(defaultPrivate()); } else { p.numberOptions = 0; p.index = localePrivateIndex(d); @@ -2301,7 +2283,6 @@ void QLocale::setDefault(const QLocale &locale) */ QLocale::Language QLocale::language() const { - systemPrivate(); // make sure inline data is initialized from the system. return Language(d()->languageId()); } @@ -2312,7 +2293,6 @@ QLocale::Language QLocale::language() const */ QLocale::Country QLocale::country() const { - systemPrivate(); // make sure inline data is initialized from the system. return Country(d()->countryId()); } @@ -3041,7 +3021,6 @@ QDateTime QLocale::toDateTime(const QString &string, const QString &format) cons */ QChar QLocale::decimalPoint() const { - systemPrivate(); // make sure inline data is initialized from the system. return d()->decimal(); } @@ -3052,7 +3031,6 @@ QChar QLocale::decimalPoint() const */ QChar QLocale::groupSeparator() const { - systemPrivate(); // make sure inline data is initialized from the system. return d()->group(); } @@ -3063,7 +3041,6 @@ QChar QLocale::groupSeparator() const */ QChar QLocale::percent() const { - systemPrivate(); // make sure inline data is initialized from the system. return d()->percent(); } @@ -3074,7 +3051,6 @@ QChar QLocale::percent() const */ QChar QLocale::zeroDigit() const { - systemPrivate(); // make sure inline data is initialized from the system. return d()->zero(); } @@ -3085,7 +3061,6 @@ QChar QLocale::zeroDigit() const */ QChar QLocale::negativeSign() const { - systemPrivate(); // make sure inline data is initialized from the system. return d()->minus(); } @@ -3096,7 +3071,6 @@ QChar QLocale::negativeSign() const */ QChar QLocale::positiveSign() const { - systemPrivate(); // make sure inline data is initialized from the system. return d()->plus(); } @@ -3107,7 +3081,6 @@ QChar QLocale::positiveSign() const */ QChar QLocale::exponential() const { - systemPrivate(); // make sure inline data is initialized from the system. return d()->exponential(); } diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index 63e9e0f..0123a6e 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -132,10 +132,7 @@ public: CharBuff *result) const; inline char digitToCLocale(const QChar &c) const; - static void updateSystemPrivate(bool initialize = true); -#if defined(Q_OS_SYMBIAN) - static void symbianRegisterLocaleNotifier(); -#endif + static void updateSystemPrivate(); enum NumberMode { IntegerMode, DoubleStandardMode, DoubleScientificMode }; bool validateChars(const QString &str, NumberMode numMode, QByteArray *buff, int decDigits = -1) const; diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index c4ad67c..1273d06 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -46,94 +46,10 @@ #include <QThread> #include <e32std.h> -#include <e32const.h> -#include <e32base.h> #include "private/qcore_symbian_p.h" -#include "private/qcoreapplication_p.h" -#include "qlocale_p.h" -#include "qdebug.h" - -QT_BEGIN_NAMESPACE - -class CLocaleChangeNotifier : public CActive -{ -public: - static CLocaleChangeNotifier *NewL(); - ~CLocaleChangeNotifier(); - -private: - CLocaleChangeNotifier(); - void ConstructL(); - void RunL(); - void DoCancel(); - -private: - RChangeNotifier changeNotifier; -}; - -static CLocaleChangeNotifier *qt_changeNotifier = NULL; - -CLocaleChangeNotifier *CLocaleChangeNotifier::NewL() -{ - CLocaleChangeNotifier *self = new (ELeave) CLocaleChangeNotifier(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; -} - -CLocaleChangeNotifier::CLocaleChangeNotifier() - : CActive(CActive::EPriorityStandard) -{ -} -CLocaleChangeNotifier::~CLocaleChangeNotifier() -{ - Cancel(); - changeNotifier.Close(); -} - -void CLocaleChangeNotifier::ConstructL() -{ - changeNotifier.Create(); - CActiveScheduler::Add(this); - SetActive(); -} - -void CLocaleChangeNotifier::DoCancel() -{ - changeNotifier.LogonCancel(); -} - -void CLocaleChangeNotifier::RunL() -{ - SetActive(); - if (changeNotifier.Logon(iStatus) == KErrNone) { - if (iStatus.Int() == EChangesLocale) { - RDebug::Print(_L("notifier:locale changed")); - QT_TRYCATCH_LEAVING(QLocalePrivate::updateSystemPrivate()); - } else { - RDebug::Print(_L("notifier:something else changed")); - } - } else { - RDebug::Print(_L("notifier:logon failed")); - } -} - -static void qt_cleanupLocaleNotifier() -{ - delete qt_changeNotifier; - qt_changeNotifier = NULL; -} - -void QLocalePrivate::symbianRegisterLocaleNotifier() -{ - if (!qt_changeNotifier) { - QT_TRAP_THROWING(qt_changeNotifier = CLocaleChangeNotifier::NewL()); - qAddPostRoutine(qt_cleanupLocaleNotifier); - } -} +QT_BEGIN_NAMESPACE // Located in qlocale.cpp extern void getLangAndCountry(const QString &name, QLocale::Language &lang, QLocale::Country &cntry); @@ -149,7 +65,6 @@ static FormatFunc ptrTimeFormatL = NULL; static FormatSpecFunc ptrGetTimeFormatSpec = NULL; static FormatSpecFunc ptrGetLongDateFormatSpec = NULL; static FormatSpecFunc ptrGetShortDateFormatSpec = NULL; -static FormatSpecFunc ptrRefreshLocaleInfo = NULL; // Default functions if functions cannot be resolved static void defaultTimeFormatL(TTime&, TDes& des, const TDesC&, const TLocale&) @@ -299,8 +214,6 @@ static const char *jp_locale_dep[] = { */ static QString s60ToQtFormat(const QString &sys_fmt) { - RDebug::Print(_L("Time Format \"%S\""), &timeFormat); - TLocale *locale = _s60Locale.GetLocale(); QString result; @@ -766,8 +679,6 @@ static QString symbianDateFormat(bool short_format) dateFormat.Set(ptrGetLongDateFormatSpec(_s60Locale)); } - RDebug::Print(_L("symDateFormat: \"%S\""), &dateFormat); - return s60ToQtFormat(qt_TDesC2QString(dateFormat)); } @@ -777,8 +688,6 @@ static QString symbianDateFormat(bool short_format) */ static QString symbianTimeFormat() { - TPtrC timeFormat = ptrGetTimeFormatSpec(_s60Locale); - RDebug::Print(_L("symTimeFormat: \"%S\""), &timeFormat); return s60ToQtFormat(qt_TDesC2QString(ptrGetTimeFormatSpec(_s60Locale))); } @@ -862,35 +771,22 @@ static QLocale::MeasurementSystem symbianMeasurementSystem() return QLocale::MetricSystem; } -void symbianUpdateSystemPrivate() +QLocale QSystemLocale::fallbackLocale() const { - RDebug::Print(_L("symbianUpdateSystemPrivate")); // load system data before query calls - _s60Locale.LoadSystemSettings(); - if (ptrRefreshLocaleInfo) - ptrRefreshLocaleInfo(); -} - -void symbianInitSystemLocale() -{ - RDebug::Print(_L("symbianInitSystemLocale")); static QBasicAtomicInt initDone = Q_BASIC_ATOMIC_INITIALIZER(0); if (initDone.testAndSetRelaxed(0, 1)) { - if (!qt_changeNotifier) { - QMetaObject::invokeMethod(qApp, SLOT(_q_symbianRegisterLocaleNotifier()), Qt::AutoConnection); - } + _s60Locale.LoadSystemSettings(); // Initialize platform version dependent function pointers ptrTimeFormatL = reinterpret_cast<FormatFunc> - (qt_resolveS60PluginFunc(S60Plugin_TimeFormatL)); + (qt_resolveS60PluginFunc(S60Plugin_TimeFormatL)); ptrGetTimeFormatSpec = reinterpret_cast<FormatSpecFunc> - (qt_resolveS60PluginFunc(S60Plugin_GetTimeFormatSpec)); + (qt_resolveS60PluginFunc(S60Plugin_GetTimeFormatSpec)); ptrGetLongDateFormatSpec = reinterpret_cast<FormatSpecFunc> - (qt_resolveS60PluginFunc(S60Plugin_GetLongDateFormatSpec)); + (qt_resolveS60PluginFunc(S60Plugin_GetLongDateFormatSpec)); ptrGetShortDateFormatSpec = reinterpret_cast<FormatSpecFunc> - (qt_resolveS60PluginFunc(S60Plugin_GetShortDateFormatSpec)); - ptrRefreshLocaleInfo = reinterpret_cast<FormatSpecFunc> - (qt_resolveS60PluginFunc(S60Plugin_RefreshLocaleInfo)); + (qt_resolveS60PluginFunc(S60Plugin_GetShortDateFormatSpec)); if (!ptrTimeFormatL) ptrTimeFormatL = &defaultTimeFormatL; if (!ptrGetTimeFormatSpec) @@ -905,10 +801,7 @@ void symbianInitSystemLocale() } while(initDone != 2) QThread::yieldCurrentThread(); -} -QLocale QSystemLocale::fallbackLocale() const -{ TLanguage lang = User::Language(); QString locale = QLatin1String(qt_symbianLocaleName(lang)); return QLocale(locale); |