From 86f81eae93aa32e87081fa4691ea127cf3616fa2 Mon Sep 17 00:00:00 2001 From: Guo Yunhe <guoyunhebrave@gmail.com> Date: Wed, 28 Sep 2016 08:41:53 +0300 Subject: [PATCH 08/21] Support Non-Latin characters in theme settings (#708) By default, QSettings doesn't support non-lating characters in config file. However, KCM will write background path into theme config file without escape. That means, we need to read UTF-8 strings. [ChangeLog][Themes] Support UTF-8 in theme configuration --- src/common/ThemeConfig.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/common/ThemeConfig.cpp b/src/common/ThemeConfig.cpp index e98ab10..1cd4750 100644 --- a/src/common/ThemeConfig.cpp +++ b/src/common/ThemeConfig.cpp @@ -35,6 +35,12 @@ namespace SDDM { QSettings settings(path, QSettings::IniFormat); QSettings userSettings(path + QStringLiteral(".user"), QSettings::IniFormat); + // Support non-latin strings in background picture path + // Warning: The codec must be set immediately after creating the QSettings object, + // before accessing any data. + settings.setIniCodec("UTF-8"); + userSettings.setIniCodec("UTF-8"); + // read default keys for (const QString &key: settings.allKeys()) { insert(key, settings.value(key)); -- 2.10.2