diff --git a/app/src/handlers/systemhandler.cpp b/app/src/handlers/systemhandler.cpp index 461cbce430c7a462b49dc837e9c42ea1c327eef7..2c8d77da1e59cd1930a11557c675c7cdb6574a3e 100644 --- a/app/src/handlers/systemhandler.cpp +++ b/app/src/handlers/systemhandler.cpp @@ -96,7 +96,8 @@ bool SystemHandler::isApplicableType(const QString &installType) const QStringList applicableTypes; if (desktop == "kde") { - applicableTypes << "wallpapers"; + applicableTypes << "wallpapers" + << "icons"; } else if (desktop == "gnome") { applicableTypes << "wallpapers" @@ -122,6 +123,9 @@ bool SystemHandler::applyFile(const QString &path, const QString &installType) c if (installType == "wallpapers") { return applyKdeWallpaper(path); } + else if (installType == "icons") { + return applyKdeIcon(path); + } } else if (desktop == "gnome") { if (installType == "wallpapers") { @@ -179,6 +183,31 @@ bool SystemHandler::applyKdeWallpaper(const QString &path) const return true; } +bool SystemHandler::applyKdeIcon(const QString &path) const +{ + auto themeName = QFileInfo(path).fileName(); + auto message = QDBusMessage::createMethodCall("org.kde.plasmashell", "/PlasmaShell", "org.kde.PlasmaShell", "evaluateScript"); + + QString script; + QTextStream out(&script); + out << "var c = ConfigFile('kdeglobals');" + << "c.group = 'Icons';" + << "c.writeEntry('Theme', '" + themeName + "');"; + + QVariantList arguments; + arguments << QVariant(script); + message.setArguments(arguments); + + auto reply = QDBusConnection::sessionBus().call(message); + + if (reply.type() == QDBusMessage::ErrorMessage) { + qWarning() << reply.errorMessage(); + return false; + } + + return true; +} + bool SystemHandler::applyGnomeWallpaper(const QString &path) const { QStringList arguments{"set", "org.gnome.desktop.background", "picture-uri", "file://" + path}; diff --git a/app/src/handlers/systemhandler.h b/app/src/handlers/systemhandler.h index 3ea555e5983718de0a9fae0b17ddc8983d7e39c8..34fa485df22062bc5976933af87811ef8f1726a1 100644 --- a/app/src/handlers/systemhandler.h +++ b/app/src/handlers/systemhandler.h @@ -24,6 +24,7 @@ public slots: private: #ifdef QTLIB_UNIX bool applyKdeWallpaper(const QString &path) const; + bool applyKdeIcon(const QString &path) const; bool applyGnomeWallpaper(const QString &path) const; bool applyGnomeIcon(const QString &path) const;