Commit 1cfd9e88 authored by Nate Graham's avatar Nate Graham 💤
Browse files

Revert "Fix broken ENV variables for detailed settings"

This reverts commit edc64d04.

This commit unfortunately caused a serious regression. Another approach
will be needed to solve 176650 and 417070.

BUG: 423995
FIXED-IN: 5.19.4
CCMAIL: alexander.lohnau@gmx.de
parent bbed524a
......@@ -128,27 +128,11 @@ void runStartupConfig()
KConfig config(QStringLiteral("plasma-localerc"));
KConfigGroup formatsConfig = KConfigGroup(&config, "Formats");
// In case we don't have a value in the config file, but in the ENV variables, write it
if (!formatsConfig.hasKey("LANG") && !qEnvironmentVariableIsEmpty("LANG")) {
formatsConfig.writeEntry("LANG", qgetenv("LANG"));
formatsConfig.sync();
}
const auto explicitLCValues = { "LANG", "LC_COLLATE", "LC_CTYPE" };
const auto detailedLCValues = { "LC_NUMERIC", "LC_TIME", "LC_MONETARY", "LC_MEASUREMENT" };
const QString lcLang = formatsConfig.readEntry("LANG");
const bool useDetailed = formatsConfig.readEntry("useDetailed", false);
// These values have to explicitly set
for (auto lc : explicitLCValues) {
const QString value = formatsConfig.readEntry(lc);
if (!value.isEmpty()) {
qputenv(lc, value.toUtf8());
}
}
// If we have the "Detailed Settings" checkbox unchecked we want to use the value from the LANG entry
for (auto lc : detailedLCValues) {
const QString value = useDetailed ? formatsConfig.readEntry(lc) : lcLang;
const auto lcValues = {
"LANG", "LC_NUMERIC", "LC_TIME", "LC_MONETARY", "LC_MEASUREMENT", "LC_COLLATE", "LC_CTYPE"
};
for (auto lc : lcValues) {
const QString value = formatsConfig.readEntry(lc, QString());
if (!value.isEmpty()) {
qputenv(lc, value.toUtf8());
}
......@@ -159,6 +143,11 @@ void runStartupConfig()
if (!value.isEmpty()) {
qputenv("LANGUAGE", value.toUtf8());
}
if (!formatsConfig.hasKey("LANG") && !qEnvironmentVariableIsEmpty("LANG")) {
formatsConfig.writeEntry("LANG", qgetenv("LANG"));
formatsConfig.sync();
}
}
void setupCursor(bool wayland)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment