summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlocale.cpp
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-06-17 11:54:16 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2011-06-17 11:54:16 (GMT)
commit2b39081bf101e53a70ff056d527dc3dfb8208bf0 (patch)
treea8e57489e18dbdd620b8880eda5c8e2d77049a07 /src/corelib/tools/qlocale.cpp
parent5e1112ec04dcef671700e326186ca56b790f7e08 (diff)
parentc390312f8fbea14ac4df0c5185ca814054f448d8 (diff)
downloadQt-2b39081bf101e53a70ff056d527dc3dfb8208bf0.zip
Qt-2b39081bf101e53a70ff056d527dc3dfb8208bf0.tar.gz
Qt-2b39081bf101e53a70ff056d527dc3dfb8208bf0.tar.bz2
Merge branch '4.8' of scm.dev.nokia.troll.no:qt/qt
Conflicts: doc/src/declarative/righttoleft.qdoc examples/draganddrop/fridgemagnets/main.cpp examples/script/context2d/main.cpp
Diffstat (limited to 'src/corelib/tools/qlocale.cpp')
-rw-r--r--src/corelib/tools/qlocale.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 4648ca1..ca8cc8a 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -76,7 +76,6 @@ QT_BEGIN_NAMESPACE
#if defined(Q_OS_SYMBIAN)
void qt_symbianUpdateSystemPrivate();
-void qt_symbianInitSystemLocale();
#endif
#ifndef QT_NO_SYSTEMLOCALE
@@ -470,9 +469,6 @@ static const QSystemLocale *systemLocale()
{
if (_systemLocale)
return _systemLocale;
-#if defined(Q_OS_SYMBIAN)
- qt_symbianInitSystemLocale();
-#endif
return QSystemLocale_globalSystemLocale();
}
@@ -942,19 +938,32 @@ QLocale::Country QLocale::country() const
QString QLocale::name() const
{
- Language l = language();
+ const QLocalePrivate *dd = d();
- QString result = d()->languageCode();
+ if (dd->m_language_id == QLocale::AnyLanguage)
+ return QString();
+ if (dd->m_language_id == QLocale::C)
+ return QLatin1String("C");
- if (l == C)
- return result;
+ const unsigned char *c = language_code_list + 3*(uint(dd->m_language_id));
- Country c = country();
- if (c == AnyCountry)
- return result;
+ QString result(7, Qt::Uninitialized);
+ ushort *data = (ushort *)result.unicode();
+ const ushort *begin = data;
- result.append(QLatin1Char('_'));
- result.append(d()->countryCode());
+ *data++ = ushort(c[0]);
+ *data++ = ushort(c[1]);
+ if (c[2] != 0)
+ *data++ = ushort(c[2]);
+ if (dd->m_country_id != AnyCountry) {
+ *data++ = '_';
+ const unsigned char *c = country_code_list + 3*(uint(dd->m_country_id));
+ *data++ = ushort(c[0]);
+ *data++ = ushort(c[1]);
+ if (c[2] != 0)
+ *data++ = ushort(c[2]);
+ }
+ result.resize(data - begin);
return result;
}