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