Commit 0f779598 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Run clang-format

If you want git blame to ignore formatting revisions run:
git config blame.ignoreRevsFile .git-blame-ignore-revs
parent 7841f0c6
...@@ -46,7 +46,7 @@ static QSharedPointer<KConfig> openConfig(const QString &filePath) ...@@ -46,7 +46,7 @@ static QSharedPointer<KConfig> openConfig(const QString &filePath)
QDir().mkpath(dir.path()); QDir().mkpath(dir.path());
} }
QFile file(filePath); QFile file(filePath);
if(!file.exists()) { if (!file.exists()) {
// If we are creating the config file, ensure it is world-readable: if // If we are creating the config file, ensure it is world-readable: if
// we don't do that, KConfig will create a file which is only readable // we don't do that, KConfig will create a file which is only readable
// by root // by root
...@@ -71,7 +71,7 @@ void SddmAuthHelper::copyFile(const QString &source, const QString &destination) ...@@ -71,7 +71,7 @@ void SddmAuthHelper::copyFile(const QString &source, const QString &destination)
} }
QFile::copy(source, destination); QFile::copy(source, destination);
const char* destinationConverted = destination.toLocal8Bit().data(); const char *destinationConverted = destination.toLocal8Bit().data();
if (chown(destinationConverted, sddmUser.userId().nativeId(), sddmUser.groupId().nativeId())) { if (chown(destinationConverted, sddmUser.userId().nativeId(), sddmUser.groupId().nativeId())) {
return; return;
} }
...@@ -97,8 +97,8 @@ ActionReply SddmAuthHelper::sync(const QVariantMap &args) ...@@ -97,8 +97,8 @@ ActionReply SddmAuthHelper::sync(const QVariantMap &args)
// copy fontconfig (font, font rendering) // copy fontconfig (font, font rendering)
if (!args[QStringLiteral("fontconfig")].isNull()) { if (!args[QStringLiteral("fontconfig")].isNull()) {
QDir fontconfigSource(args[QStringLiteral("fontconfig")].toString()); QDir fontconfigSource(args[QStringLiteral("fontconfig")].toString());
QStringList sourceFileEntries = fontconfigSource.entryList (QDir::Files); QStringList sourceFileEntries = fontconfigSource.entryList(QDir::Files);
QStringList sourceDirEntries = fontconfigSource.entryList (QDir::AllDirs); QStringList sourceDirEntries = fontconfigSource.entryList(QDir::AllDirs);
QDir fontconfigDestination(sddmConfigLocation.path() + QStringLiteral("/fontconfig")); QDir fontconfigDestination(sddmConfigLocation.path() + QStringLiteral("/fontconfig"));
if (!fontconfigDestination.exists()) { if (!fontconfigDestination.exists()) {
...@@ -106,7 +106,7 @@ ActionReply SddmAuthHelper::sync(const QVariantMap &args) ...@@ -106,7 +106,7 @@ ActionReply SddmAuthHelper::sync(const QVariantMap &args)
} }
if (sourceDirEntries.count() != 0) { if (sourceDirEntries.count() != 0) {
for (int i = 0; i<sourceDirEntries.count(); i++) { for (int i = 0; i < sourceDirEntries.count(); i++) {
QString directoriesSource = fontconfigSource.path() + QDir::separator() + sourceDirEntries[i]; QString directoriesSource = fontconfigSource.path() + QDir::separator() + sourceDirEntries[i];
QString directoriesDestination = fontconfigDestination.path() + QDir::separator() + sourceDirEntries[i]; QString directoriesDestination = fontconfigDestination.path() + QDir::separator() + sourceDirEntries[i];
fontconfigSource.mkpath(directoriesDestination); fontconfigSource.mkpath(directoriesDestination);
...@@ -115,7 +115,7 @@ ActionReply SddmAuthHelper::sync(const QVariantMap &args) ...@@ -115,7 +115,7 @@ ActionReply SddmAuthHelper::sync(const QVariantMap &args)
} }
if (sourceFileEntries.count() != 0) { if (sourceFileEntries.count() != 0) {
for (int i = 0; i<sourceFileEntries.count(); i++) { for (int i = 0; i < sourceFileEntries.count(); i++) {
QString filesSource = fontconfigSource.path() + QDir::separator() + sourceFileEntries[i]; QString filesSource = fontconfigSource.path() + QDir::separator() + sourceFileEntries[i];
QString filesDestination = fontconfigDestination.path() + QDir::separator() + sourceFileEntries[i]; QString filesDestination = fontconfigDestination.path() + QDir::separator() + sourceFileEntries[i];
copyFile(filesSource, filesDestination); copyFile(filesSource, filesDestination);
...@@ -144,7 +144,7 @@ ActionReply SddmAuthHelper::sync(const QVariantMap &args) ...@@ -144,7 +144,7 @@ ActionReply SddmAuthHelper::sync(const QVariantMap &args)
QMap<QString, QVariant>::const_iterator iterator; QMap<QString, QVariant>::const_iterator iterator;
for (iterator = args.constBegin() ; iterator != args.constEnd() ; ++iterator) { for (iterator = args.constBegin(); iterator != args.constEnd(); ++iterator) {
if (iterator.key() == QLatin1String("kde_settings.conf")) if (iterator.key() == QLatin1String("kde_settings.conf"))
continue; continue;
...@@ -195,7 +195,7 @@ ActionReply SddmAuthHelper::reset(const QVariantMap &args) ...@@ -195,7 +195,7 @@ ActionReply SddmAuthHelper::reset(const QVariantMap &args)
QMap<QString, QVariant>::const_iterator iterator; QMap<QString, QVariant>::const_iterator iterator;
for (iterator = args.constBegin() ; iterator != args.constEnd() ; ++iterator) { for (iterator = args.constBegin(); iterator != args.constEnd(); ++iterator) {
if (iterator.key() == QLatin1String("kde_settings.conf")) if (iterator.key() == QLatin1String("kde_settings.conf"))
continue; continue;
...@@ -224,7 +224,7 @@ ActionReply SddmAuthHelper::reset(const QVariantMap &args) ...@@ -224,7 +224,7 @@ ActionReply SddmAuthHelper::reset(const QVariantMap &args)
ActionReply SddmAuthHelper::save(const QVariantMap &args) ActionReply SddmAuthHelper::save(const QVariantMap &args)
{ {
ActionReply reply = ActionReply::HelperErrorReply(); ActionReply reply = ActionReply::HelperErrorReply();
QSharedPointer<KConfig> sddmConfig = openConfig(QString {QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")}); QSharedPointer<KConfig> sddmConfig = openConfig(QString{QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")});
QSharedPointer<KConfig> sddmOldConfig = openConfig(QStringLiteral(SDDM_CONFIG_FILE)); QSharedPointer<KConfig> sddmOldConfig = openConfig(QStringLiteral(SDDM_CONFIG_FILE));
QSharedPointer<KConfig> themeConfig; QSharedPointer<KConfig> themeConfig;
QString themeConfigFile = args[QStringLiteral("theme.conf.user")].toString(); QString themeConfigFile = args[QStringLiteral("theme.conf.user")].toString();
...@@ -235,7 +235,7 @@ ActionReply SddmAuthHelper::save(const QVariantMap &args) ...@@ -235,7 +235,7 @@ ActionReply SddmAuthHelper::save(const QVariantMap &args)
QMap<QString, QVariant>::const_iterator iterator; QMap<QString, QVariant>::const_iterator iterator;
for (iterator = args.constBegin() ; iterator != args.constEnd() ; ++iterator) { for (iterator = args.constBegin(); iterator != args.constEnd(); ++iterator) {
if (iterator.key() == QLatin1String("kde_settings.conf") || iterator.key() == QLatin1String("theme.conf.user")) if (iterator.key() == QLatin1String("kde_settings.conf") || iterator.key() == QLatin1String("theme.conf.user"))
continue; continue;
...@@ -274,7 +274,7 @@ ActionReply SddmAuthHelper::save(const QVariantMap &args) ...@@ -274,7 +274,7 @@ ActionReply SddmAuthHelper::save(const QVariantMap &args)
if (newBackgroundFileInfo.exists()) { if (newBackgroundFileInfo.exists()) {
QString newBackgroundPath = configRootDirectory.filePath(newBackgroundFileInfo.fileName()); QString newBackgroundPath = configRootDirectory.filePath(newBackgroundFileInfo.fileName());
qDebug() << "Copying background from " << newBackgroundFileInfo.absoluteFilePath() << " to " << newBackgroundPath; qDebug() << "Copying background from " << newBackgroundFileInfo.absoluteFilePath() << " to " << newBackgroundPath;
if (QFile::copy(newBackgroundFileInfo.absoluteFilePath(), newBackgroundPath)) { if (QFile::copy(newBackgroundFileInfo.absoluteFilePath(), newBackgroundPath)) {
QFile::setPermissions(newBackgroundPath, QFile::ReadOwner | QFile::WriteOwner | QFile::ReadGroup | QFile::ReadOther); QFile::setPermissions(newBackgroundPath, QFile::ReadOwner | QFile::WriteOwner | QFile::ReadGroup | QFile::ReadOther);
themeConfig->group(groupName).writeEntry(keyName, newBackgroundFileInfo.fileName()); themeConfig->group(groupName).writeEntry(keyName, newBackgroundFileInfo.fileName());
...@@ -323,23 +323,21 @@ ActionReply SddmAuthHelper::installtheme(const QVariantMap &args) ...@@ -323,23 +323,21 @@ ActionReply SddmAuthHelper::installtheme(const QVariantMap &args)
QScopedPointer<KArchive> archive; QScopedPointer<KArchive> archive;
//there must be a better way to do this? If not, make a static bool KZip::supportsMimeType(const QMimeType &type); ? // there must be a better way to do this? If not, make a static bool KZip::supportsMimeType(const QMimeType &type); ?
//or even a factory class in KArchive // or even a factory class in KArchive
if (mimeType.inherits(QStringLiteral("application/zip"))) { if (mimeType.inherits(QStringLiteral("application/zip"))) {
archive.reset(new KZip(filePath)); archive.reset(new KZip(filePath));
} else if (mimeType.inherits(QStringLiteral("application/tar")) } else if (mimeType.inherits(QStringLiteral("application/tar")) || mimeType.inherits(QStringLiteral("application/x-gzip"))
|| mimeType.inherits(QStringLiteral("application/x-gzip")) || mimeType.inherits(QStringLiteral("application/x-bzip")) || mimeType.inherits(QStringLiteral("application/x-lzma"))
|| mimeType.inherits(QStringLiteral("application/x-bzip")) || mimeType.inherits(QStringLiteral("application/x-xz")) || mimeType.inherits(QStringLiteral("application/x-bzip-compressed-tar"))
|| mimeType.inherits(QStringLiteral("application/x-lzma")) || mimeType.inherits(QStringLiteral("application/x-compressed-tar"))) {
|| mimeType.inherits(QStringLiteral("application/x-xz"))
|| mimeType.inherits(QStringLiteral("application/x-bzip-compressed-tar"))
|| mimeType.inherits(QStringLiteral("application/x-compressed-tar"))) {
archive.reset(new KTar(filePath)); archive.reset(new KTar(filePath));
} else { } else {
auto e = ActionReply::HelperErrorReply(); auto e = ActionReply::HelperErrorReply();
e.setErrorDescription(i18n("Invalid theme package")); e.setErrorDescription(i18n("Invalid theme package"));
return e; } return e;
}
if (!archive->open(QIODevice::ReadOnly)) { if (!archive->open(QIODevice::ReadOnly)) {
auto e = ActionReply::HelperErrorReply(); auto e = ActionReply::HelperErrorReply();
...@@ -351,20 +349,20 @@ ActionReply SddmAuthHelper::installtheme(const QVariantMap &args) ...@@ -351,20 +349,20 @@ ActionReply SddmAuthHelper::installtheme(const QVariantMap &args)
QStringList installedPaths; QStringList installedPaths;
//some basic validation // some basic validation
//the top level should only have folders, and those folders should contain a valid metadata.desktop file // the top level should only have folders, and those folders should contain a valid metadata.desktop file
//if we get anything else, abort everything before copying // if we get anything else, abort everything before copying
const auto entries = directory->entries(); const auto entries = directory->entries();
for (const QString &name: entries) { for (const QString &name : entries) {
auto entry = directory->entry(name); auto entry = directory->entry(name);
if (!entry->isDirectory()) { if (!entry->isDirectory()) {
auto e = ActionReply::HelperErrorReply(); auto e = ActionReply::HelperErrorReply();
e.setErrorDescription(i18n("Invalid theme package")); e.setErrorDescription(i18n("Invalid theme package"));
return e; return e;
} }
auto subDirectory = static_cast<const KArchiveDirectory*>(entry); auto subDirectory = static_cast<const KArchiveDirectory *>(entry);
auto metadataFile = subDirectory->file(QStringLiteral("metadata.desktop")); auto metadataFile = subDirectory->file(QStringLiteral("metadata.desktop"));
if(!metadataFile || !metadataFile->data().contains("[SddmGreeterTheme]")) { if (!metadataFile || !metadataFile->data().contains("[SddmGreeterTheme]")) {
auto e = ActionReply::HelperErrorReply(); auto e = ActionReply::HelperErrorReply();
e.setErrorDescription(i18n("Invalid theme package")); e.setErrorDescription(i18n("Invalid theme package"));
return e; return e;
...@@ -393,9 +391,9 @@ ActionReply SddmAuthHelper::uninstalltheme(const QVariantMap &args) ...@@ -393,9 +391,9 @@ ActionReply SddmAuthHelper::uninstalltheme(const QVariantMap &args)
return ActionReply::HelperErrorReply(); return ActionReply::HelperErrorReply();
} }
//validate the themePath is directly inside the themesBaseDir // validate the themePath is directly inside the themesBaseDir
QDir baseDir(themesBaseDir); QDir baseDir(themesBaseDir);
if(baseDir.absoluteFilePath(dir.dirName()) != dir.absolutePath()) { if (baseDir.absoluteFilePath(dir.dirName()) != dir.absolutePath()) {
return ActionReply::HelperErrorReply(); return ActionReply::HelperErrorReply();
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
using namespace KAuth; using namespace KAuth;
class SddmAuthHelper: public QObject class SddmAuthHelper : public QObject
{ {
Q_OBJECT Q_OBJECT
...@@ -34,7 +34,7 @@ public Q_SLOTS: ...@@ -34,7 +34,7 @@ public Q_SLOTS:
ActionReply uninstalltheme(const QVariantMap &args); ActionReply uninstalltheme(const QVariantMap &args);
public: public:
void copyFile (const QString &source, const QString &destination); void copyFile(const QString &source, const QString &destination);
}; };
#endif //SDDMAUTHHELPER_H #endif // SDDMAUTHHELPER_H
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
#include <QApplication> #include <QApplication>
#include <QCommandLineOption> #include <QCommandLineOption>
#include <QCommandLineParser> #include <QCommandLineParser>
#include <QDir>
#include <QDebug> #include <QDebug>
#include <QDir>
#include <QFile> #include <QFile>
#include <QProcess> #include <QProcess>
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
QCommandLineParser parser; QCommandLineParser parser;
QApplication app(argc, argv); //because GHNS doesn't do it's own error reporting on installation failing.. QApplication app(argc, argv); // because GHNS doesn't do it's own error reporting on installation failing..
const QString description = i18n("SDDM theme installer"); const QString description = i18n("SDDM theme installer");
const char version[] = "1.0"; const char version[] = "1.0";
...@@ -85,7 +85,7 @@ int main(int argc, char **argv) ...@@ -85,7 +85,7 @@ int main(int argc, char **argv)
if (parser.isSet(QStringLiteral("uninstall"))) { if (parser.isSet(QStringLiteral("uninstall"))) {
KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("sddmthemeinstallerrc"), KConfig::SimpleConfig), "DownloadedThemes"); KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("sddmthemeinstallerrc"), KConfig::SimpleConfig), "DownloadedThemes");
const QStringList installed = cg.readEntry(args.first(), QStringList()); const QStringList installed = cg.readEntry(args.first(), QStringList());
for (const QString &installedTheme: installed) { for (const QString &installedTheme : installed) {
KAuth::Action action(QStringLiteral("org.kde.kcontrol.kcmsddm.uninstalltheme")); KAuth::Action action(QStringLiteral("org.kde.kcontrol.kcmsddm.uninstalltheme"));
action.setHelperId(QStringLiteral("org.kde.kcontrol.kcmsddm")); action.setHelperId(QStringLiteral("org.kde.kcontrol.kcmsddm"));
action.addArgument(QStringLiteral("filePath"), installedTheme); action.addArgument(QStringLiteral("filePath"), installedTheme);
......
...@@ -28,7 +28,7 @@ SddmData::SddmData(QObject *parent, const QVariantList &args) ...@@ -28,7 +28,7 @@ SddmData::SddmData(QObject *parent, const QVariantList &args)
{ {
auto config = KSharedConfig::openConfig(QStringLiteral(SDDM_CONFIG_FILE), KConfig::CascadeConfig); auto config = KSharedConfig::openConfig(QStringLiteral(SDDM_CONFIG_FILE), KConfig::CascadeConfig);
QStringList configFiles = QDir(QStringLiteral(SDDM_CONFIG_DIR)).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::LocaleAware); QStringList configFiles = QDir(QStringLiteral(SDDM_CONFIG_DIR)).entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::LocaleAware);
std::transform(configFiles.begin(), configFiles.end(), configFiles.begin(), [] (const QString &filename) -> QString { std::transform(configFiles.begin(), configFiles.end(), configFiles.begin(), [](const QString &filename) -> QString {
return QStringLiteral(SDDM_CONFIG_DIR "/") + filename; return QStringLiteral(SDDM_CONFIG_DIR "/") + filename;
}); });
config->addConfigSources(configFiles); config->addConfigSources(configFiles);
......
...@@ -26,6 +26,7 @@ class SddmData : public KCModuleData ...@@ -26,6 +26,7 @@ class SddmData : public KCModuleData
public: public:
SddmData(QObject *parent = nullptr, const QVariantList &args = QVariantList()); SddmData(QObject *parent = nullptr, const QVariantList &args = QVariantList());
SddmSettings *sddmSettings() const; SddmSettings *sddmSettings() const;
private: private:
SddmSettings *m_settings; SddmSettings *m_settings;
}; };
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "sddmkcm.h" #include "sddmkcm.h"
#include "config.h" #include "config.h"
...@@ -42,7 +41,7 @@ SddmKcm::SddmKcm(QObject *parent, const QVariantList &args) ...@@ -42,7 +41,7 @@ SddmKcm::SddmKcm(QObject *parent, const QVariantList &args)
, m_data(new SddmData(this)) , m_data(new SddmData(this))
, m_themesModel(new ThemesModel(this)) , m_themesModel(new ThemesModel(this))
{ {
KAboutData* aboutData = new KAboutData(QStringLiteral("kcm_sddm"), i18n("Login Screen (SDDM)"), QStringLiteral(PROJECT_VERSION)); KAboutData *aboutData = new KAboutData(QStringLiteral("kcm_sddm"), i18n("Login Screen (SDDM)"), QStringLiteral(PROJECT_VERSION));
aboutData->setShortDescription(i18n("Login screen using the SDDM")); aboutData->setShortDescription(i18n("Login screen using the SDDM"));
aboutData->setLicense(KAboutLicense::GPL_V2); aboutData->setLicense(KAboutLicense::GPL_V2);
...@@ -69,17 +68,17 @@ SddmKcm::~SddmKcm() ...@@ -69,17 +68,17 @@ SddmKcm::~SddmKcm()
{ {
} }
SddmSettings* SddmKcm::sddmSettings() const SddmSettings *SddmKcm::sddmSettings() const
{ {
return m_data->sddmSettings(); return m_data->sddmSettings();
} }
ThemesModel* SddmKcm::themesModel() const ThemesModel *SddmKcm::themesModel() const
{ {
return m_themesModel; return m_themesModel;
} }
QString SddmKcm::toLocalFile(const QUrl& url) QString SddmKcm::toLocalFile(const QUrl &url)
{ {
return url.toLocalFile(); return url.toLocalFile();
} }
...@@ -131,7 +130,7 @@ void SddmKcm::save() ...@@ -131,7 +130,7 @@ void SddmKcm::save()
args[QStringLiteral("theme.conf.user/General/background")] = backgroundPath; args[QStringLiteral("theme.conf.user/General/background")] = backgroundPath;
args[QStringLiteral("theme.conf.user/General/type")] = QStringLiteral("image"); args[QStringLiteral("theme.conf.user/General/type")] = QStringLiteral("image");
} else { } else {
args[QStringLiteral("theme.conf.user/General/type")] = QStringLiteral("color"); args[QStringLiteral("theme.conf.user/General/type")] = QStringLiteral("color");
} }
} }
args[QStringLiteral("kde_settings.conf/Theme/Current")] = currentThemeIndex.data(ThemesModel::IdRole); args[QStringLiteral("kde_settings.conf/Theme/Current")] = currentThemeIndex.data(ThemesModel::IdRole);
...@@ -141,7 +140,7 @@ void SddmKcm::save() ...@@ -141,7 +140,7 @@ void SddmKcm::save()
args[QStringLiteral("kde_settings.conf/Users/MinimumUid")] = m_data->sddmSettings()->minimumUid(); args[QStringLiteral("kde_settings.conf/Users/MinimumUid")] = m_data->sddmSettings()->minimumUid();
args[QStringLiteral("kde_settings.conf/Users/MaximumUid")] = m_data->sddmSettings()->maximumUid(); args[QStringLiteral("kde_settings.conf/Users/MaximumUid")] = m_data->sddmSettings()->maximumUid();
args[QStringLiteral("kde_settings.conf/General/HaltCommand")] = m_data->sddmSettings()->haltCommand(); args[QStringLiteral("kde_settings.conf/General/HaltCommand")] = m_data->sddmSettings()->haltCommand();
args[QStringLiteral("kde_settings.conf/General/RebootCommand")] = m_data->sddmSettings()->rebootCommand(); args[QStringLiteral("kde_settings.conf/General/RebootCommand")] = m_data->sddmSettings()->rebootCommand();
KAuth::Action saveAction(authActionName()); KAuth::Action saveAction(authActionName());
saveAction.setHelperId(QStringLiteral("org.kde.kcontrol.kcmsddm")); saveAction.setHelperId(QStringLiteral("org.kde.kcontrol.kcmsddm"));
...@@ -160,7 +159,7 @@ void SddmKcm::save() ...@@ -160,7 +159,7 @@ void SddmKcm::save()
void SddmKcm::synchronizeSettings() void SddmKcm::synchronizeSettings()
{ {
// initial check for sddm user; abort if user not present // initial check for sddm user; abort if user not present
// we have to check with QString and isEmpty() instead of QDir and exists() because // 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; // QDir returns "." and true for exists() in the case of a non-existent user;
QString sddmHomeDirPath = KUser("sddm").homeDir(); QString sddmHomeDirPath = KUser("sddm").homeDir();
...@@ -191,57 +190,49 @@ void SddmKcm::synchronizeSettings() ...@@ -191,57 +190,49 @@ void SddmKcm::synchronizeSettings()
// send values and paths to helper, debug if it fails // send values and paths to helper, debug if it fails
QVariantMap args; QVariantMap args;
args[QStringLiteral("kde_settings.conf")] = QString {QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")}; args[QStringLiteral("kde_settings.conf")] = QString{QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")};
args[QStringLiteral("sddm.conf")] = QLatin1String(SDDM_CONFIG_FILE); args[QStringLiteral("sddm.conf")] = QLatin1String(SDDM_CONFIG_FILE);
if (!cursorTheme.isNull()) { if (!cursorTheme.isNull()) {
args[QStringLiteral("kde_settings.conf/Theme/CursorTheme")] = cursorTheme; args[QStringLiteral("kde_settings.conf/Theme/CursorTheme")] = cursorTheme;
} } else {
else {
qDebug() << "Cannot find cursor theme value."; qDebug() << "Cannot find cursor theme value.";
} }
if (!dpiValue.isEmpty()) { if (!dpiValue.isEmpty()) {
args[QStringLiteral("kde_settings.conf/X11/ServerArguments")] = dpiArgument; args[QStringLiteral("kde_settings.conf/X11/ServerArguments")] = dpiArgument;
} } else {
else {
qDebug() << "Cannot find scaling DPI value."; qDebug() << "Cannot find scaling DPI value.";
} }
if (!numLock.isEmpty()) { if (!numLock.isEmpty()) {
if (numLock == QStringLiteral("0")) { if (numLock == QStringLiteral("0")) {
args[QStringLiteral("kde_settings.conf/General/Numlock")] = QStringLiteral("on"); args[QStringLiteral("kde_settings.conf/General/Numlock")] = QStringLiteral("on");
} } else if (numLock == QStringLiteral("1")) {
else if (numLock == QStringLiteral("1")) {
args[QStringLiteral("kde_settings.conf/General/Numlock")] = QStringLiteral("off"); args[QStringLiteral("kde_settings.conf/General/Numlock")] = QStringLiteral("off");
} } else if (numLock == QStringLiteral("2")) {
else if (numLock == QStringLiteral("2")) {
args[QStringLiteral("kde_settings.conf/General/Numlock")] = QStringLiteral("none"); args[QStringLiteral("kde_settings.conf/General/Numlock")] = QStringLiteral("none");
} }
} } else {
else {
qDebug() << "Cannot find NumLock value."; qDebug() << "Cannot find NumLock value.";
} }
if (!fontconfigPath.isEmpty()) { if (!fontconfigPath.isEmpty()) {
args[QStringLiteral("fontconfig")] = fontconfigPath; args[QStringLiteral("fontconfig")] = fontconfigPath;
} } else {
else {
qDebug() << "Cannot find fontconfig folder."; qDebug() << "Cannot find fontconfig folder.";
} }
if (!kdeglobalsPath.isEmpty()) { if (!kdeglobalsPath.isEmpty()) {
args[QStringLiteral("kdeglobals")] = kdeglobalsPath; args[QStringLiteral("kdeglobals")] = kdeglobalsPath;
} } else {
else {
qDebug() << "Cannot find kdeglobals file."; qDebug() << "Cannot find kdeglobals file.";
} }
if (!plasmarcPath.isEmpty()) { if (!plasmarcPath.isEmpty()) {
args[QStringLiteral("plasmarc")] = plasmarcPath; args[QStringLiteral("plasmarc")] = plasmarcPath;
} } else {
else {
qDebug() << "Cannot find plasmarc file."; qDebug() << "Cannot find plasmarc file.";
} }
...@@ -251,7 +242,7 @@ void SddmKcm::synchronizeSettings() ...@@ -251,7 +242,7 @@ void SddmKcm::synchronizeSettings()
auto job = syncAction.execute(); auto job = syncAction.execute();
connect(job, &KJob::result, this, [this, job] { connect(job, &KJob::result, this, [this, job] {
if (job->error()){ if (job->error()) {
qDebug() << "Synchronization failed"; qDebug() << "Synchronization failed";
qDebug() << job->errorString(); qDebug() << job->errorString();
qDebug() << job->errorText(); qDebug() << job->errorText();
...@@ -279,7 +270,7 @@ void SddmKcm::resetSyncronizedSettings() ...@@ -279,7 +270,7 @@ void SddmKcm::resetSyncronizedSettings()
// send paths to helper // send paths to helper
QVariantMap args; QVariantMap args;
args[QStringLiteral("kde_settings.conf")] = QString {QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")}; args[QStringLiteral("kde_settings.conf")] = QString{QLatin1String(SDDM_CONFIG_DIR "/") + QStringLiteral("kde_settings.conf")};
args[QStringLiteral("sddm.conf")] = QLatin1String(SDDM_CONFIG_FILE); args[QStringLiteral("sddm.conf")] = QLatin1String(SDDM_CONFIG_FILE);
...@@ -296,7 +287,7 @@ void SddmKcm::resetSyncronizedSettings() ...@@ -296,7 +287,7 @@ void SddmKcm::resetSyncronizedSettings()
auto job = resetAction.execute(); auto job = resetAction.execute();
connect(job, &KJob::result, this, [this, job] { connect(job, &KJob::result, this, [this, job] {
if (job->error()){ if (job->error()) {
qDebug() << "Reset failed"; qDebug() << "Reset failed";
qDebug() << job->errorString(); qDebug() << job->errorString();
qDebug() << job->errorText(); qDebug() << job->errorText();
...@@ -310,5 +301,4 @@ void SddmKcm::resetSyncronizedSettings() ...@@ -310,5 +301,4 @@ void SddmKcm::resetSyncronizedSettings()
job->start(); job->start();
} }
#include "sddmkcm.moc" #include "sddmkcm.moc"
...@@ -40,8 +40,8 @@ public: ...@@ -40,8 +40,8 @@ public:
Q_INVOKABLE void synchronizeSettings(); Q_INVOKABLE void synchronizeSettings();
Q_INVOKABLE void resetSyncronizedSettings(); Q_INVOKABLE void resetSyncronizedSettings();
SddmSettings* sddmSettings() const; SddmSettings *sddmSettings() const;
ThemesModel* themesModel() const; ThemesModel *themesModel() const;
public Q_SLOTS: public Q_SLOTS:
void save() override; void save() override;
Q_SIGNALS: Q_SIGNALS:
......
...@@ -19,16 +19,16 @@ ...@@ -19,16 +19,16 @@
#include "config.h" #include "config.h"
#include <QDir>
#include <QDebug> #include <QDebug>
#include <QDir>
#include <algorithm> #include <algorithm>
SddmSettingsBase::SddmSettingsBase(KSharedConfigPtr config, QObject* parent) SddmSettingsBase::SddmSettingsBase(KSharedConfigPtr config, QObject *parent)
: KConfigSkeleton(config, parent)