summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEl Mehdi Fekari <mfekari@rim.com>2013-05-02 10:30:49 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-21 13:23:31 (GMT)
commit9a62d6f2f89ea4c5e6d392d758bb9d7954c644d1 (patch)
treef7f5e5048984f18b36daf2657f5a99bbab9ab3a1 /src
parent36501694357ade4e35a48ac5bfadcd7dbd881336 (diff)
downloadQt-9a62d6f2f89ea4c5e6d392d758bb9d7954c644d1.zip
Qt-9a62d6f2f89ea4c5e6d392d758bb9d7954c644d1.tar.gz
Qt-9a62d6f2f89ea4c5e6d392d758bb9d7954c644d1.tar.bz2
Fix QLocale::standaloneMonthName when d->m_data == systemData()
At the moment if d->m_data == systemData() it calls systemLocale()->query but forgets about the standalone part so you get the wrong data This patch introduces the new enums so that backends can implement properly the standaloneMonthName feature properly. At the moment the Windows and Mac ones still return the monthName, the Unix and Blackberry ones return the data we store in months_data. cherry picked from qtbase/b1de018e9a1efcd0f9e298ae4c865197feb47895 Change-Id: I1054420dc696ed2be0d52bdc6567ebaf202faf12 Reviewed-by: Albert Astals Cid <albert.astals@canonical.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qlocale.cpp2
-rw-r--r--src/corelib/tools/qlocale.h4
-rw-r--r--src/corelib/tools/qlocale_blackberry.cpp4
-rw-r--r--src/corelib/tools/qlocale_mac.mm4
-rw-r--r--src/corelib/tools/qlocale_unix.cpp4
-rw-r--r--src/corelib/tools/qlocale_win.cpp2
6 files changed, 17 insertions, 3 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index bf959d7..807c187 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -1965,7 +1965,7 @@ QString QLocale::standaloneMonthName(int month, FormatType type) const
#ifndef QT_NO_SYSTEMLOCALE
if (d() == systemPrivate()) {
QVariant res = systemLocale()->query(type == LongFormat
- ? QSystemLocale::MonthNameLong : QSystemLocale::MonthNameShort,
+ ? QSystemLocale::StandaloneMonthNameLong : QSystemLocale::StandaloneMonthNameShort,
month);
if (!res.isNull())
return res.toString();
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index 72d2aa0..2746cab 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -116,7 +116,9 @@ public:
ListToSeparatedString, // QString
LocaleChanged, // system locale changed
NativeLanguageName, // QString
- NativeCountryName // QString
+ NativeCountryName, // QString
+ StandaloneMonthNameLong, // QString, in: int
+ StandaloneMonthNameShort // QString, in: int
};
virtual QVariant query(QueryType type, QVariant in) const;
virtual QLocale fallbackLocale() const;
diff --git a/src/corelib/tools/qlocale_blackberry.cpp b/src/corelib/tools/qlocale_blackberry.cpp
index 13d2863..14f1a52 100644
--- a/src/corelib/tools/qlocale_blackberry.cpp
+++ b/src/corelib/tools/qlocale_blackberry.cpp
@@ -280,6 +280,10 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const
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:
diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm
index feb8b6c..90d79fc 100644
--- a/src/corelib/tools/qlocale_mac.mm
+++ b/src/corelib/tools/qlocale_mac.mm
@@ -403,7 +403,9 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
return macDayName(in.toInt(), (type == DayNameShort));
case MonthNameLong:
case MonthNameShort:
- return macMonthName(in.toInt(), (type == MonthNameShort));
+ case StandaloneMonthNameLong:
+ case StandaloneMonthNameShort:
+ return macMonthName(in.toInt(), (type == MonthNameShort || type == StandaloneMonthNameShort));
case DateToStringShort:
case DateToStringLong:
return macDateToString(in.toDate(), (type == DateToStringShort));
diff --git a/src/corelib/tools/qlocale_unix.cpp b/src/corelib/tools/qlocale_unix.cpp
index f2649fc..934f66e 100644
--- a/src/corelib/tools/qlocale_unix.cpp
+++ b/src/corelib/tools/qlocale_unix.cpp
@@ -160,6 +160,10 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const
return lc_time.monthName(in.toInt(), QLocale::LongFormat);
case MonthNameShort:
return lc_time.monthName(in.toInt(), QLocale::ShortFormat);
+ case StandaloneMonthNameLong:
+ return lc_time.standaloneMonthName(in.toInt(), QLocale::LongFormat);
+ case StandaloneMonthNameShort:
+ return lc_time.standaloneMonthName(in.toInt(), QLocale::ShortFormat);
case DateToStringLong:
return lc_time.toString(in.toDate(), QLocale::LongFormat);
case DateToStringShort:
diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp
index 193e5f2..2b3ba65 100644
--- a/src/corelib/tools/qlocale_win.cpp
+++ b/src/corelib/tools/qlocale_win.cpp
@@ -687,8 +687,10 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
case DayNameShort:
return d->dayName(in.toInt(), QLocale::ShortFormat);
case MonthNameLong:
+ case StandaloneMonthNameLong:
return d->monthName(in.toInt(), QLocale::LongFormat);
case MonthNameShort:
+ case StandaloneMonthNameShort:
return d->monthName(in.toInt(), QLocale::ShortFormat);
case DateToStringShort:
return d->toString(in.toDate(), QLocale::ShortFormat);