diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2009-11-02 10:01:08 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2009-11-02 10:01:08 (GMT) |
commit | 5e0bdffd92cbff2a9eb551f77850a24bf2a2116a (patch) | |
tree | fcf764b8326d8282e7f194a4fe1b2a88a7082319 /src/plugins | |
parent | b68cd1df21935fc032a93c7d7bc33fcb77c7b8cd (diff) | |
parent | 5d7e254583551659df42e59fab4756994d4211ed (diff) | |
download | Qt-5e0bdffd92cbff2a9eb551f77850a24bf2a2116a.zip Qt-5e0bdffd92cbff2a9eb551f77850a24bf2a2116a.tar.gz Qt-5e0bdffd92cbff2a9eb551f77850a24bf2a2116a.tar.bz2 |
Merge commit 'origin/4.6' into feature
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/graphicssystems/graphicssystems.pro | 2 | ||||
-rw-r--r-- | src/plugins/s60/src/qlocale_3_1.cpp | 96 |
2 files changed, 92 insertions, 6 deletions
diff --git a/src/plugins/graphicssystems/graphicssystems.pro b/src/plugins/graphicssystems/graphicssystems.pro index 14e3cfc..0788933 100644 --- a/src/plugins/graphicssystems/graphicssystems.pro +++ b/src/plugins/graphicssystems/graphicssystems.pro @@ -1,6 +1,6 @@ TEMPLATE = subdirs SUBDIRS += trace -contains(QT_CONFIG, opengl):SUBDIRS += opengl +!wince*:contains(QT_CONFIG, opengl):SUBDIRS += opengl contains(QT_CONFIG, openvg):contains(QT_CONFIG, egl):SUBDIRS += openvg contains(QT_CONFIG, shivavg) { diff --git a/src/plugins/s60/src/qlocale_3_1.cpp b/src/plugins/s60/src/qlocale_3_1.cpp index 0afd10a..beeee7f 100644 --- a/src/plugins/s60/src/qlocale_3_1.cpp +++ b/src/plugins/s60/src/qlocale_3_1.cpp @@ -40,23 +40,109 @@ ****************************************************************************/ #include <e32std.h> +#include <e32const.h> +#include <e32debug.h> -EXPORT_C void defaultFormatL(TTime&, TDes& des, const TDesC&, const TLocale&) +_LIT(KYear, "%Y"); +_LIT(KMonth, "%M"); +_LIT(KDay, "%D"); +_LIT(KLocaleIndependent, "%F"); +static TBuf<10> dateFormat; +static TBuf<10> timeFormat; + +static void initialiseDateFormat() +{ + if(dateFormat.Length()) + return; + + TLocale locale; + + //Separator 1 is used between 1st and 2nd components of the date + //Separator 2 is used between 2nd and 3rd components of the date + //Usually they are the same, but they are allowed to be different + TChar s1 = locale.DateSeparator(1); + TChar s2 = locale.DateSeparator(2); + dateFormat=KLocaleIndependent; + switch(locale.DateFormat()) { + case EDateAmerican: + dateFormat.Append(KMonth); + dateFormat.Append(s1); + dateFormat.Append(KDay); + dateFormat.Append(s2); + dateFormat.Append(KYear); + break; + case EDateEuropean: + dateFormat.Append(KDay); + dateFormat.Append(s1); + dateFormat.Append(KMonth); + dateFormat.Append(s2); + dateFormat.Append(KYear); + break; + case EDateJapanese: + default: //it's closest to ISO format + dateFormat.Append(KYear); + dateFormat.Append(s1); + dateFormat.Append(KMonth); + dateFormat.Append(s2); + dateFormat.Append(KDay); + break; + } +#ifdef _DEBUG + RDebug::Print(_L("Date Format \"%S\""), &dateFormat); +#endif +} + +static void initialiseTimeFormat() +{ + if(timeFormat.Length()) + return; + + TLocale locale; + //Separator 1 is used between 1st and 2nd components of the time + //Separator 2 is used between 2nd and 3rd components of the time + //Usually they are the same, but they are allowed to be different + TChar s1 = locale.TimeSeparator(1); + TChar s2 = locale.TimeSeparator(2); + switch(locale.TimeFormat()) { + case ETime12: + timeFormat.Append(_L("%I")); + break; + case ETime24: + default: + timeFormat.Append(_L("%H")); + break; + } + timeFormat.Append(s1); + timeFormat.Append(_L("%T")); + timeFormat.Append(s2); + timeFormat.Append(_L("%S")); + +#ifdef _DEBUG + RDebug::Print(_L("Time Format \"%S\""), &timeFormat); +#endif +} + +EXPORT_C void defaultFormatL(TTime& time, TDes& des, const TDesC& fmt, const TLocale&) { - des.Zero(); + //S60 3.1 does not support format for a specific locale, so use default locale + time.FormatL(des, fmt); } +//S60 3.1 doesn't support extended locale date&time formats, so use default locale EXPORT_C TPtrC defaultGetTimeFormatSpec(TExtendedLocale&) { - return TPtrC(KNullDesC); + initialiseTimeFormat(); + return TPtrC(timeFormat); } EXPORT_C TPtrC defaultGetLongDateFormatSpec(TExtendedLocale&) { - return TPtrC(KNullDesC); + initialiseDateFormat(); + return TPtrC(dateFormat); } EXPORT_C TPtrC defaultGetShortDateFormatSpec(TExtendedLocale&) { - return TPtrC(KNullDesC); + initialiseDateFormat(); + return TPtrC(dateFormat); } |