Changeset View
Changeset View
Standalone View
Standalone View
sddmauthhelper.cpp
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | 54 | { | |||
---|---|---|---|---|---|
62 | const char* destinationConverted = destination.toLocal8Bit().data(); | 62 | const char* destinationConverted = destination.toLocal8Bit().data(); | ||
63 | if (chown(destinationConverted, sddmUser.userId().nativeId(), sddmUser.groupId().nativeId())) { | 63 | if (chown(destinationConverted, sddmUser.userId().nativeId(), sddmUser.groupId().nativeId())) { | ||
64 | return; | 64 | return; | ||
65 | } | 65 | } | ||
66 | } | 66 | } | ||
67 | 67 | | |||
68 | ActionReply SddmAuthHelper::sync(const QVariantMap &args) | 68 | ActionReply SddmAuthHelper::sync(const QVariantMap &args) | ||
69 | { | 69 | { | ||
70 | // initial check for sddm user; abort if user not present | ||||
71 | // we have to check with QString and isEmpty() instead of QDir and exists() because | ||||
72 | // QDir returns "." and true for exists() in the case of a non-existent user; | ||||
73 | QString sddmHomeDirPath = KUser("sddm").homeDir(); | ||||
74 | if (sddmHomeDirPath.isEmpty()) { | ||||
75 | qDebug() << "Cannot proceed, user 'sddm' does not exist. Please check your SDDM install."; | ||||
76 | return ActionReply::HelperErrorReply(); | ||||
77 | } | ||||
78 | | ||||
70 | // create SDDM config directory if it does not exist | 79 | // create SDDM config directory if it does not exist | ||
71 | QDir sddmConfigLocation(args[QStringLiteral("sddmUserConfig")].toString()); | 80 | QDir sddmConfigLocation(sddmHomeDirPath + QStringLiteral("/.config")); | ||
davidedmundson: can we use sddmHomeDirPath + "whatever"
instead now
and get rid of this sddmUserConfig map… | |||||
72 | if (!sddmConfigLocation.exists()) { | 81 | if (!sddmConfigLocation.exists()) { | ||
73 | QDir().mkpath(sddmConfigLocation.path()); | 82 | QDir().mkpath(sddmConfigLocation.path()); | ||
74 | } | 83 | } | ||
75 | 84 | | |||
76 | // copy fontconfig (font, font rendering) | 85 | // copy fontconfig (font, font rendering) | ||
77 | if (!args[QStringLiteral("fontconfig")].isNull()) { | 86 | if (!args[QStringLiteral("fontconfig")].isNull()) { | ||
78 | QDir fontconfigSource(args[QStringLiteral("fontconfig")].toString()); | 87 | QDir fontconfigSource(args[QStringLiteral("fontconfig")].toString()); | ||
79 | QStringList sourceFileEntries = fontconfigSource.entryList (QDir::Files); | 88 | QStringList sourceFileEntries = fontconfigSource.entryList (QDir::Files); | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | |||||
146 | sddmOldConfig->sync(); | 155 | sddmOldConfig->sync(); | ||
147 | sddmConfig->sync(); | 156 | sddmConfig->sync(); | ||
148 | 157 | | |||
149 | return ActionReply::SuccessReply(); | 158 | return ActionReply::SuccessReply(); | ||
150 | } | 159 | } | ||
151 | 160 | | |||
152 | ActionReply SddmAuthHelper::reset(const QVariantMap &args) | 161 | ActionReply SddmAuthHelper::reset(const QVariantMap &args) | ||
153 | { | 162 | { | ||
154 | QDir sddmConfigLocation(args[QStringLiteral("sddmUserConfig")].toString()); | 163 | // initial check for sddm user; abort if user not present | ||
164 | // we have to check with QString and isEmpty() instead of QDir and exists() because | ||||
165 | // QDir returns "." and true for exists() in the case of a non-existent user; | ||||
166 | QString sddmHomeDirPath = KUser("sddm").homeDir(); | ||||
167 | if (sddmHomeDirPath.isEmpty()) { | ||||
168 | qDebug() << "Cannot proceed, user 'sddm' does not exist. Please check your SDDM install."; | ||||
169 | return ActionReply::HelperErrorReply(); | ||||
170 | } | ||||
171 | | ||||
172 | QDir sddmConfigLocation(sddmHomeDirPath + QStringLiteral("/.config")); | ||||
davidedmundson: and here | |||||
155 | QDir fontconfigDir(args[QStringLiteral("sddmUserConfig")].toString() + QStringLiteral("/fontconfig")); | 173 | QDir fontconfigDir(args[QStringLiteral("sddmUserConfig")].toString() + QStringLiteral("/fontconfig")); | ||
156 | 174 | | |||
157 | fontconfigDir.removeRecursively(); | 175 | fontconfigDir.removeRecursively(); | ||
158 | QFile::remove(sddmConfigLocation.path() + QStringLiteral("/kdeglobals")); | 176 | QFile::remove(sddmConfigLocation.path() + QStringLiteral("/kdeglobals")); | ||
159 | QFile::remove(sddmConfigLocation.path() + QStringLiteral("/plasmarc")); | 177 | QFile::remove(sddmConfigLocation.path() + QStringLiteral("/plasmarc")); | ||
160 | 178 | | |||
161 | // remove cursor theme, NumLock preference, and scaling DPI from config file | 179 | // remove cursor theme, NumLock preference, and scaling DPI from config file | ||
162 | ActionReply reply = ActionReply::HelperErrorReply(); | 180 | ActionReply reply = ActionReply::HelperErrorReply(); | ||
▲ Show 20 Lines • Show All 218 Lines • Show Last 20 Lines |
can we use sddmHomeDirPath + "whatever"
instead now
and get rid of this sddmUserConfig map entry