diff --git a/sddmauthhelper.cpp b/sddmauthhelper.cpp --- a/sddmauthhelper.cpp +++ b/sddmauthhelper.cpp @@ -82,7 +82,8 @@ // initial check for sddm user; abort if user not present // we have to check with QString and isEmpty() instead of QDir and exists() because // QDir returns "." and true for exists() in the case of a non-existent user; - QString sddmHomeDirPath = KUser("sddm").homeDir(); + KUser sddmUser(QStringLiteral("sddm")); + QString sddmHomeDirPath = sddmUser.homeDir(); if (sddmHomeDirPath.isEmpty()) { qDebug() << "Cannot proceed, user 'sddm' does not exist. Please check your SDDM install."; return ActionReply::HelperErrorReply(); @@ -130,11 +131,13 @@ copyFile(kdeglobalsSource.path(), kdeglobalsDestination.path()); } - // copy plasmarc (icons, UI style) - if (!args[QStringLiteral("plasmarc")].isNull()) { - QDir plasmarcSource(args[QStringLiteral("plasmarc")].toString()); - QDir plasmarcDestination(sddmConfigLocation.path() + QStringLiteral("/plasmarc")); - copyFile(plasmarcSource.path(), plasmarcDestination.path()); + // sync Plasma theme + if (!args[QStringLiteral("plasmaTheme")].isNull()) { + QString themeConfigLocation = sddmConfigLocation.path() + QStringLiteral("/plasmarc"); + QSharedPointer themeConfig = openConfig(themeConfigLocation); + themeConfig->group(QStringLiteral("Theme")).writeEntry(QStringLiteral("name"), args[QStringLiteral("plasmaTheme")].toString()); + const char* themeConfigLocationConverted = themeConfigLocation.toLocal8Bit().data(); + chown(themeConfigLocationConverted, sddmUser.userId().nativeId(), sddmUser.groupId().nativeId()); } // write cursor theme, NumLock preference, and scaling DPI to config file diff --git a/src/advancedconfig.cpp b/src/advancedconfig.cpp --- a/src/advancedconfig.cpp +++ b/src/advancedconfig.cpp @@ -171,10 +171,13 @@ KConfigGroup numLockConfigGroup(&numLockConfig, "Keyboard"); QString numLock = numLockConfigGroup.readEntry("NumLock"); + KConfig themeConfig(QStringLiteral("plasmarc")); + KConfigGroup themeConfigGroup(&themeConfig, "Theme"); + QString theme = themeConfigGroup.readEntry("name"); + // define paths const QString fontconfigPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("fontconfig"), QStandardPaths::LocateDirectory); const QString kdeglobalsPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("kdeglobals")); - const QString plasmarcPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("plasmarc")); // send values and paths to helper, debug if it fails QVariantMap args; @@ -212,6 +215,13 @@ qDebug() << "Cannot find NumLock value."; } + if (!theme.isEmpty()) { + args[QStringLiteral("plasmaTheme")] = theme; + } + else { + qDebug() << "Cannot find Plasma theme name."; + } + if (!fontconfigPath.isEmpty()) { args[QStringLiteral("fontconfig")] = fontconfigPath; } @@ -226,13 +236,6 @@ qDebug() << "Cannot find kdeglobals file."; } - if (!plasmarcPath.isEmpty()) { - args[QStringLiteral("plasmarc")] = plasmarcPath; - } - else { - qDebug() << "Cannot find plasmarc file."; - } - KAuth::Action syncAction(QStringLiteral("org.kde.kcontrol.kcmsddm.sync")); syncAction.setHelperId(QStringLiteral("org.kde.kcontrol.kcmsddm")); syncAction.setArguments(args);