From 734f815a9325ad472517cd5ef869d6081eb89661 Mon Sep 17 00:00:00 2001 From: con Date: Fri, 18 Sep 2009 14:20:00 +0200 Subject: System locale on Mac may not return AnyCountry for any language != C Because of QLocale limitations this broke other places. Reviewed-by: Denis Dzyubenko --- src/corelib/tools/qlocale.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index a1f0712..136bafa 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -1216,9 +1216,12 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const QString preferredLanguage; QString preferredCountry; getMacPreferredLanguageAndCountry(&preferredLanguage, &preferredCountry); + QLocale::Language languageCode = (preferredLanguage.isEmpty() ? QLocale::C : codeToLanguage(preferredLanguage.data())); + QLocale::Country countryCode = (preferredCountry.isEmpty() ? QLocale::AnyCountry : codeToCountry(preferredCountry.data())); + const QLocalePrivate *d = findLocale(languageCode, countryCode); if (type == LanguageId) - return codeToLanguage(preferredLanguage.data()); - return codeToCountry(preferredCountry.data()); + return (QLocale::Language)d->languageId(); + return (QLocale::Country)d->countryId(); } case MeasurementSystem: -- cgit v0.12