Changeset View
Changeset View
Standalone View
Standalone View
startkde/startplasma.cpp
Show First 20 Lines • Show All 111 Lines • ▼ Show 20 Line(s) | |||||
112 | { | 112 | { | ||
113 | const QString configDir = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); | 113 | const QString configDir = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); | ||
114 | if (!QDir().mkpath(configDir)) | 114 | if (!QDir().mkpath(configDir)) | ||
115 | out << "Could not create config directory XDG_CONFIG_HOME: " << configDir << '\n'; | 115 | out << "Could not create config directory XDG_CONFIG_HOME: " << configDir << '\n'; | ||
116 | } | 116 | } | ||
117 | 117 | | |||
118 | void runStartupConfig() | 118 | void runStartupConfig() | ||
119 | { | 119 | { | ||
120 | const QString configDir = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); | 120 | //export LC_* variables set by kcmshell5 formats into environment | ||
121 | //so it can be picked up by QLocale and friends. | ||||
122 | KConfig config(QStringLiteral("plasma-localerc")); | ||||
123 | KConfigGroup formatsConfig = KConfigGroup(&config, "Formats"); | ||||
121 | 124 | | |||
122 | const QString localerc(configDir + QLatin1String("/plasma-localerc")); | 125 | const auto lcValues = { | ||
123 | if (!QFile::exists(localerc)) { | 126 | "LANG", "LC_NUMERIC", "LC_MONETARY", "LC_MEASUREMENT", "LC_COLLATE", "LC_CTYPE" | ||
124 | QFile f(localerc); | 127 | }; | ||
125 | f.open(QFile::WriteOnly); | 128 | for (auto lc : lcValues) { | ||
126 | f.write("[Formats]\n" | 129 | const QString value = formatsConfig.readEntry(lc, QString()); | ||
127 | "LANG=" + qgetenv("LANG") + '\n'); | 130 | if (!value.isEmpty()) { | ||
131 | qputenv(lc, value.toUtf8()); | ||||
132 | } | ||||
128 | } | 133 | } | ||
129 | 134 | | |||
130 | //export LC_* variables set by kcmshell5 formats into environment | 135 | KConfigGroup languageConfig = KConfigGroup(&config, "Translations"); | ||
davidedmundson: This may as well be merged if we're going to open the config next anyway | |||||
131 | //so it can be picked up by QLocale and friends. | 136 | const QString value = formatsConfig.readEntry("LANGUAGE", QString()); | ||
132 | sourceFiles({configDir + QStringLiteral("/plasma-locale-settings.sh")}); | 137 | if (!value.isEmpty()) { | ||
138 | qputenv("LANGUAGE", value.toUtf8()); | ||||
139 | } | ||||
140 | | ||||
141 | if (!formatsConfig.hasKey("LANG") && !qEnvironmentVariableIsEmpty("LANG")) { | ||||
142 | formatsConfig.writeEntry("LANG", qgetenv("LANG")); | ||||
143 | formatsConfig.sync(); | ||||
144 | } | ||||
133 | } | 145 | } | ||
134 | 146 | | |||
135 | void setupCursor(bool wayland) | 147 | void setupCursor(bool wayland) | ||
136 | { | 148 | { | ||
137 | const KConfig cfg(QStringLiteral("kcminputrc")); | 149 | const KConfig cfg(QStringLiteral("kcminputrc")); | ||
138 | const KConfigGroup inputCfg = cfg.group("Mouse"); | 150 | const KConfigGroup inputCfg = cfg.group("Mouse"); | ||
139 | 151 | | |||
140 | const auto kcminputrc_mouse_cursorsize = inputCfg.readEntry("cursorSize", QString()); | 152 | const auto kcminputrc_mouse_cursorsize = inputCfg.readEntry("cursorSize", QString()); | ||
▲ Show 20 Lines • Show All 265 Lines • Show Last 20 Lines |
This may as well be merged if we're going to open the config next anyway