Changeset View
Changeset View
Standalone View
Standalone View
src/advanceconfig.cpp
Show First 20 Lines • Show All 145 Lines • ▼ Show 20 Line(s) | |||||
146 | } | 146 | } | ||
147 | 147 | | |||
148 | void AdvanceConfig::syncSettingsChanged() | 148 | void AdvanceConfig::syncSettingsChanged() | ||
149 | { | 149 | { | ||
150 | KConfig cursorConfig(QStringLiteral("kcminputrc")); | 150 | KConfig cursorConfig(QStringLiteral("kcminputrc")); | ||
151 | KConfigGroup cursorConfigGroup(&cursorConfig, "Mouse"); | 151 | KConfigGroup cursorConfigGroup(&cursorConfig, "Mouse"); | ||
152 | QVariant cursorTheme = cursorConfigGroup.readEntry("cursorTheme", QString()); | 152 | QVariant cursorTheme = cursorConfigGroup.readEntry("cursorTheme", QString()); | ||
153 | 153 | | |||
154 | KConfig dpiConfig(QStringLiteral("kcmfonts")); | ||||
155 | KConfigGroup dpiConfigGroup(&dpiConfig, "General"); | ||||
156 | QString dpiValue = QStringLiteral("-dpi ") + dpiConfigGroup.readEntry("forceFontDPI"); | ||||
davidedmundson: What are you going to write if this entry is missing?
I suspect you'll write just
"-dpi "… | |||||
157 | | ||||
As a coding note it's useful to make sure the data in the variables matches their name. In this case "dpiValue" isn't just the DPI value, it's a string formatted as X server arguments "-dpi" here. So I would suggest either renaming or (probably easier with the other fix) adding the "-dpi "prefix when you insert it into the map. davidedmundson: As a coding note it's useful to make sure the data in the variables matches their name.
In… | |||||
154 | KConfig numLockConfig(QStringLiteral("kcminputrc")); | 158 | KConfig numLockConfig(QStringLiteral("kcminputrc")); | ||
155 | KConfigGroup numLockConfigGroup(&numLockConfig, "Keyboard"); | 159 | KConfigGroup numLockConfigGroup(&numLockConfig, "Keyboard"); | ||
156 | QString numLock = numLockConfigGroup.readEntry("NumLock"); | 160 | QString numLock = numLockConfigGroup.readEntry("NumLock"); | ||
157 | 161 | | |||
158 | const QString fontconfigPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("fontconfig"), QStandardPaths::LocateDirectory); | 162 | const QString fontconfigPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("fontconfig"), QStandardPaths::LocateDirectory); | ||
159 | const QString kdeglobalsPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("kdeglobals")); | 163 | const QString kdeglobalsPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("kdeglobals")); | ||
160 | const QString plasmarcPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("plasmarc")); | 164 | const QString plasmarcPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("plasmarc")); | ||
161 | const QString sddmUserConfigPath = KUser("sddm").homeDir() + QStringLiteral("/.config"); | 165 | const QString sddmUserConfigPath = KUser("sddm").homeDir() + QStringLiteral("/.config"); | ||
162 | 166 | | |||
163 | if (fontconfigPath.isEmpty()) { | 167 | if (fontconfigPath.isEmpty()) { | ||
164 | qDebug() << "fontconfig folder not found"; | 168 | qDebug() << "fontconfig folder not found"; | ||
165 | } | 169 | } | ||
166 | if (kdeglobalsPath.isEmpty()) { | 170 | if (kdeglobalsPath.isEmpty()) { | ||
167 | qDebug() << "kdeglobals file not found"; | 171 | qDebug() << "kdeglobals file not found"; | ||
168 | } | 172 | } | ||
169 | if (plasmarcPath.isEmpty()) { | 173 | if (plasmarcPath.isEmpty()) { | ||
170 | qDebug() << "plasmarc file not found"; | 174 | qDebug() << "plasmarc file not found"; | ||
171 | } | 175 | } | ||
172 | 176 | | |||
173 | QVariantMap args; | 177 | QVariantMap args; | ||
174 | args[QStringLiteral("kde_settings.conf")] = QString {QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")}; | 178 | args[QStringLiteral("kde_settings.conf")] = QString {QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")}; | ||
175 | args[QStringLiteral("sddm.conf")] = QLatin1String(SDDM_CONFIG_FILE); | 179 | args[QStringLiteral("sddm.conf")] = QLatin1String(SDDM_CONFIG_FILE); | ||
176 | args[QStringLiteral("kde_settings.conf/Theme/CursorTheme")] = cursorTheme; | 180 | args[QStringLiteral("kde_settings.conf/Theme/CursorTheme")] = cursorTheme; | ||
181 | args[QStringLiteral("kde_settings.conf/X11/ServerArguments")] = dpiValue; | ||||
177 | if (!numLock.isEmpty()) { | 182 | if (!numLock.isEmpty()) { | ||
178 | if (numLock == QStringLiteral("0")) { | 183 | if (numLock == QStringLiteral("0")) { | ||
179 | args[QStringLiteral("kde_settings.conf/General/Numlock")] = QStringLiteral("on"); | 184 | args[QStringLiteral("kde_settings.conf/General/Numlock")] = QStringLiteral("on"); | ||
180 | } | 185 | } | ||
181 | else if (numLock == QStringLiteral("1")) { | 186 | else if (numLock == QStringLiteral("1")) { | ||
182 | args[QStringLiteral("kde_settings.conf/General/Numlock")] = QStringLiteral("off"); | 187 | args[QStringLiteral("kde_settings.conf/General/Numlock")] = QStringLiteral("off"); | ||
183 | } | 188 | } | ||
184 | else { | 189 | else { | ||
Show All 28 Lines | 217 | { | |||
213 | const QString sddmUserConfigPath = KUser("sddm").homeDir() + QStringLiteral("/.config"); | 218 | const QString sddmUserConfigPath = KUser("sddm").homeDir() + QStringLiteral("/.config"); | ||
214 | 219 | | |||
215 | QVariantMap args; | 220 | QVariantMap args; | ||
216 | args[QStringLiteral("sddmUserConfig")] = sddmUserConfigPath; | 221 | args[QStringLiteral("sddmUserConfig")] = sddmUserConfigPath; | ||
217 | args[QStringLiteral("kde_settings.conf")] = QString {QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")}; | 222 | args[QStringLiteral("kde_settings.conf")] = QString {QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")}; | ||
218 | args[QStringLiteral("sddm.conf")] = QLatin1String(SDDM_CONFIG_FILE); | 223 | args[QStringLiteral("sddm.conf")] = QLatin1String(SDDM_CONFIG_FILE); | ||
219 | args[QStringLiteral("sddmUserConfig")] = sddmUserConfigPath; | 224 | args[QStringLiteral("sddmUserConfig")] = sddmUserConfigPath; | ||
220 | args[QStringLiteral("kde_settings.conf/Theme/CursorTheme")] = QVariant(); | 225 | args[QStringLiteral("kde_settings.conf/Theme/CursorTheme")] = QVariant(); | ||
226 | args[QStringLiteral("kde_settings.conf/X11/ServerArguments")] = QVariant(); | ||||
221 | args[QStringLiteral("kde_settings.conf/General/Numlock")] = QVariant(); | 227 | args[QStringLiteral("kde_settings.conf/General/Numlock")] = QVariant(); | ||
222 | 228 | | |||
223 | KAuth::Action resetAction(QStringLiteral("org.kde.kcontrol.kcmsddm.reset")); | 229 | KAuth::Action resetAction(QStringLiteral("org.kde.kcontrol.kcmsddm.reset")); | ||
224 | resetAction.setHelperId(QStringLiteral("org.kde.kcontrol.kcmsddm")); | 230 | resetAction.setHelperId(QStringLiteral("org.kde.kcontrol.kcmsddm")); | ||
225 | resetAction.setArguments(args); | 231 | resetAction.setArguments(args); | ||
226 | 232 | | |||
227 | auto job = resetAction.execute(); | 233 | auto job = resetAction.execute(); | ||
228 | job->exec(); | 234 | job->exec(); | ||
Show All 11 Lines |
What are you going to write if this entry is missing?
I suspect you'll write just
"-dpi " into ServerArguments
and then X11 will run with "X11 -dpi" expect another argument and simply fail to load?