Changeset View
Changeset View
Standalone View
Standalone View
src/advanceconfig.cpp
Show First 20 Lines • Show All 141 Lines • ▼ Show 20 Line(s) | 141 | { | |||
---|---|---|---|---|---|
142 | if (minUid < 0 || minUid > maxUid) | 142 | if (minUid < 0 || minUid > maxUid) | ||
143 | return false; | 143 | return false; | ||
144 | 144 | | |||
145 | return true; | 145 | return true; | ||
146 | } | 146 | } | ||
147 | 147 | | |||
148 | void AdvanceConfig::syncSettingsChanged() | 148 | void AdvanceConfig::syncSettingsChanged() | ||
149 | { | 149 | { | ||
150 | // initial check for sddm user; abort if user not present | ||||
151 | // we have to check with QString and isEmpty() instead of QDir and exists() because | ||||
152 | // QDir returns "." and true for exists() in the case of a non-existent user; | ||||
153 | QString sddmHomeDirPath = KUser("sddm").homeDir(); | ||||
154 | if (sddmHomeDirPath.isEmpty()) { | ||||
155 | KMessageBox::error(this, QStringLiteral("Cannot proceed, user 'sddm' does not exist. Please check your SDDM install.")); | ||||
156 | return; | ||||
157 | } | ||||
158 | | ||||
150 | // read Plasma values | 159 | // read Plasma values | ||
151 | KConfig cursorConfig(QStringLiteral("kcminputrc")); | 160 | KConfig cursorConfig(QStringLiteral("kcminputrc")); | ||
152 | KConfigGroup cursorConfigGroup(&cursorConfig, "Mouse"); | 161 | KConfigGroup cursorConfigGroup(&cursorConfig, "Mouse"); | ||
153 | QVariant cursorTheme = cursorConfigGroup.readEntry("cursorTheme", QString()); | 162 | QVariant cursorTheme = cursorConfigGroup.readEntry("cursorTheme", QString()); | ||
154 | 163 | | |||
155 | KConfig dpiConfig(QStringLiteral("kcmfonts")); | 164 | KConfig dpiConfig(QStringLiteral("kcmfonts")); | ||
156 | KConfigGroup dpiConfigGroup(&dpiConfig, "General"); | 165 | KConfigGroup dpiConfigGroup(&dpiConfig, "General"); | ||
157 | QString dpiValue = dpiConfigGroup.readEntry("forceFontDPI"); | 166 | QString dpiValue = dpiConfigGroup.readEntry("forceFontDPI"); | ||
158 | QString dpiArgument = QStringLiteral("-dpi ") + dpiValue; | 167 | QString dpiArgument = QStringLiteral("-dpi ") + dpiValue; | ||
159 | 168 | | |||
160 | KConfig numLockConfig(QStringLiteral("kcminputrc")); | 169 | KConfig numLockConfig(QStringLiteral("kcminputrc")); | ||
161 | KConfigGroup numLockConfigGroup(&numLockConfig, "Keyboard"); | 170 | KConfigGroup numLockConfigGroup(&numLockConfig, "Keyboard"); | ||
162 | QString numLock = numLockConfigGroup.readEntry("NumLock"); | 171 | QString numLock = numLockConfigGroup.readEntry("NumLock"); | ||
163 | 172 | | |||
164 | // define paths | 173 | // define paths | ||
174 | const QString sddmUserConfigPath = sddmHomeDirPath + QStringLiteral("/.config"); | ||||
165 | const QString fontconfigPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("fontconfig"), QStandardPaths::LocateDirectory); | 175 | const QString fontconfigPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("fontconfig"), QStandardPaths::LocateDirectory); | ||
166 | const QString kdeglobalsPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("kdeglobals")); | 176 | const QString kdeglobalsPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("kdeglobals")); | ||
167 | const QString plasmarcPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("plasmarc")); | 177 | const QString plasmarcPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("plasmarc")); | ||
168 | const QString sddmUserConfigPath = KUser("sddm").homeDir() + QStringLiteral("/.config"); | | |||
169 | 178 | | |||
170 | // send values and paths to helper, debug if it fails | 179 | // send values and paths to helper, debug if it fails | ||
171 | QVariantMap args; | 180 | QVariantMap args; | ||
172 | 181 | | |||
173 | args[QStringLiteral("kde_settings.conf")] = QString {QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")}; | 182 | args[QStringLiteral("kde_settings.conf")] = QString {QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")}; | ||
174 | 183 | | |||
175 | args[QStringLiteral("sddm.conf")] = QLatin1String(SDDM_CONFIG_FILE); | 184 | args[QStringLiteral("sddm.conf")] = QLatin1String(SDDM_CONFIG_FILE); | ||
176 | 185 | | |||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | |||||
246 | } else { | 255 | } else { | ||
247 | changed(false); | 256 | changed(false); | ||
248 | qDebug() << "Synchronization successful"; | 257 | qDebug() << "Synchronization successful"; | ||
249 | } | 258 | } | ||
250 | } | 259 | } | ||
251 | 260 | | |||
252 | void AdvanceConfig::resetSettingsChanged() | 261 | void AdvanceConfig::resetSettingsChanged() | ||
253 | { | 262 | { | ||
263 | // initial check for sddm user; abort if user not present | ||||
264 | // we have to check with QString and isEmpty() instead of QDir and exists() because | ||||
265 | // QDir returns "." and true for exists() in the case of a non-existent user | ||||
266 | QString sddmHomeDirPath = KUser("sddm").homeDir(); | ||||
267 | if (sddmHomeDirPath.isEmpty()) { | ||||
268 | KMessageBox::error(this, QStringLiteral("Cannot proceed, user 'sddm' does not exist. Please check your SDDM install.")); | ||||
269 | return; | ||||
270 | } | ||||
271 | | ||||
254 | // define paths | 272 | // define paths | ||
255 | const QString sddmUserConfigPath = KUser("sddm").homeDir() + QStringLiteral("/.config"); | 273 | const QString sddmUserConfigPath = sddmHomeDirPath + QStringLiteral("/.config"); | ||
256 | 274 | | |||
257 | // send paths to helper | 275 | // send paths to helper | ||
258 | QVariantMap args; | 276 | QVariantMap args; | ||
259 | 277 | | |||
260 | args[QStringLiteral("sddmUserConfig")] = sddmUserConfigPath; | 278 | args[QStringLiteral("sddmUserConfig")] = sddmUserConfigPath; | ||
261 | 279 | | |||
262 | args[QStringLiteral("kde_settings.conf")] = QString {QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")}; | 280 | args[QStringLiteral("kde_settings.conf")] = QString {QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")}; | ||
263 | 281 | | |||
Show All 27 Lines |