summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Krause <[email protected]>2016-04-01 16:07:03 +0200
committerVolker Krause <[email protected]>2016-04-01 16:07:03 +0200
commit500ead12d638c2f1315ad7f673d75c6b28cd41ff (patch)
treeabfaaa76a9cd08f886aad3bf4f972de9e23cad16
parentebf5d2d338f4e0f57517192356e2498093cf13b1 (diff)
Port away from KLocale.
Much easier if you have John Layt next to you.
-rw-r--r--src/autocorrection/autocorrection.cpp7
-rw-r--r--src/autocorrection/autocorrectionlanguage.cpp18
2 files changed, 14 insertions, 11 deletions
diff --git a/src/autocorrection/autocorrection.cpp b/src/autocorrection/autocorrection.cpp
index 53984dd..625793d 100644
--- a/src/autocorrection/autocorrection.cpp
+++ b/src/autocorrection/autocorrection.cpp
@@ -20,7 +20,7 @@
#include "settings/pimcommonsettings.h"
#include "import/importkmailautocorrection.h"
#include <KColorScheme>
-#include <KLocale>
+#include <QLocale>
#include "pimcommon_debug.h"
#include <QTextBlock>
#include <QTextDocument>
@@ -925,8 +925,9 @@ void AutoCorrection::replaceTypographicQuotes()
void AutoCorrection::readAutoCorrectionXmlFile(bool forceGlobal)
{
- KLocale *locale = KLocale::global();
- QString kdelang = locale->languageList().at(0);
+ auto kdelang = QLocale::system().uiLanguages().at(0);
+ if (kdelang == QLatin1String("C"))
+ kdelang = QStringLiteral("en_US");
kdelang.remove(QRegularExpression(QStringLiteral("@.*")));
mUpperCaseExceptions.clear();
diff --git a/src/autocorrection/autocorrectionlanguage.cpp b/src/autocorrection/autocorrectionlanguage.cpp
index a0a93a4..94a00f5 100644
--- a/src/autocorrection/autocorrectionlanguage.cpp
+++ b/src/autocorrection/autocorrectionlanguage.cpp
@@ -16,20 +16,22 @@
*/
#include "autocorrectionlanguage.h"
-#include <KLocale>
+#include <QLocale>
using namespace PimCommon;
AutoCorrectionLanguage::AutoCorrectionLanguage(QWidget *parent)
: KComboBox(parent)
{
- KLocale *locale = KLocale::global();
- const QStringList lstLang = locale->allLanguagesList();
- Q_FOREACH (const QString &lang, lstLang) {
- if (lang != QLatin1String("x-test")) {
- addItem(locale->languageCodeToName(lang), lang);
- }
+ for (int i = QLocale::Abkhazian; i <= QLocale::LastLanguage; ++i) {
+ const auto lang = static_cast<QLocale::Language>(i);
+ QLocale locale(lang);
+ if (locale.name() == QLatin1String("C"))
+ continue;
+ addItem(QLocale::system().languageToString(lang), locale.name());
}
- const QString defaultLang = locale->languageList().at(0);
+ auto defaultLang = QLocale::system().uiLanguages().at(0);
+ if (defaultLang == QLatin1String("C"))
+ defaultLang = QStringLiteral("en_US");
const int index = findData(defaultLang);
setCurrentIndex(index);
model()->sort(0);