diff --git a/shell/CMakeLists.txt b/shell/CMakeLists.txt index 4e6615395..e835bf858 100644 --- a/shell/CMakeLists.txt +++ b/shell/CMakeLists.txt @@ -34,7 +34,6 @@ set(scripting_SRC scripting/rect.cpp scripting/scriptengine.cpp scripting/widget.cpp - ../lookandfeelaccess/lookandfeelaccess.cpp ) set(plasmashell_dbusXML dbus/org.kde.PlasmaShell.xml) diff --git a/shell/osd.cpp b/shell/osd.cpp index c204f5c71..39b482dcf 100644 --- a/shell/osd.cpp +++ b/shell/osd.cpp @@ -29,13 +29,10 @@ #include #include -#include "../lookandfeelaccess/lookandfeelaccess.h" - Osd::Osd(ShellCorona *corona) : QObject(corona) { - LookAndFeelAccess access; - const QString osdPath = access.filePath("osdmainscript"); + const QString osdPath = corona->lookAndFeelPackage().filePath("osdmainscript"); if (osdPath.isEmpty()) { qWarning() << "Failed to load the OSD script file from" << osdPath; return; diff --git a/shell/packageplugins/lookandfeel/lookandfeel.cpp b/shell/packageplugins/lookandfeel/lookandfeel.cpp index df05f3ca9..2c3366f45 100644 --- a/shell/packageplugins/lookandfeel/lookandfeel.cpp +++ b/shell/packageplugins/lookandfeel/lookandfeel.cpp @@ -21,6 +21,10 @@ #include "lookandfeel.h" #include +#include +#include + +#define DEFAULT_LOOKANDFEEL "org.kde.breeze.desktop" void LookAndFeelPackage::initPackage(Plasma::Package *package) { @@ -75,6 +79,17 @@ void LookAndFeelPackage::initPackage(Plasma::Package *package) } +void LookAndFeelPackage::pathChanged(Plasma::Package *package) +{ + const QString pluginName = package->metadata().pluginName(); + + if (!pluginName.isEmpty() && pluginName != DEFAULT_LOOKANDFEEL) { + Plasma::Package pkg = Plasma::PluginLoader::self()->loadPackage("Plasma/LookAndFeel"); + pkg.setPath(DEFAULT_LOOKANDFEEL); + package->setFallbackPackage(pkg); + } +} + K_EXPORT_PLASMA_PACKAGE_WITH_JSON(LookAndFeelPackage, "plasma-packagestructure-lookandfeel.json") #include "lookandfeel.moc" diff --git a/shell/packageplugins/lookandfeel/lookandfeel.h b/shell/packageplugins/lookandfeel/lookandfeel.h index 9d178de0c..e1c560529 100644 --- a/shell/packageplugins/lookandfeel/lookandfeel.h +++ b/shell/packageplugins/lookandfeel/lookandfeel.h @@ -29,6 +29,7 @@ class LookAndFeelPackage : public Plasma::PackageStructure public: LookAndFeelPackage(QObject*, const QVariantList &) {} void initPackage(Plasma::Package *package); + void pathChanged(Plasma::Package *package); }; #endif diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp index 04d4b29ff..81e10b801 100644 --- a/shell/shellcorona.cpp +++ b/shell/shellcorona.cpp @@ -59,8 +59,6 @@ #include "plasmashelladaptor.h" -#include "../lookandfeelaccess/lookandfeelaccess.h" - #ifndef NDEBUG #define CHECK_SCREEN_INVARIANTS screenInvariants(); #else @@ -79,6 +77,11 @@ ShellCorona::ShellCorona(QObject *parent) m_screenConfiguration(nullptr), m_loading(false) { + m_lookAndFeelPackage = Plasma::PluginLoader::self()->loadPackage("Plasma/LookAndFeel"); + KConfigGroup cg(KSharedConfig::openConfig("kdeglobals"), "KDE"); + const QString packageName = cg.readEntry("LookAndFeelPackage", QString()); + m_lookAndFeelPackage.setPath(packageName); + m_appConfigSyncTimer.setSingleShot(true); m_appConfigSyncTimer.setInterval(s_configSyncDelay); connect(&m_appConfigSyncTimer, &QTimer::timeout, this, &ShellCorona::syncAppConfig); @@ -125,9 +128,8 @@ ShellCorona::ShellCorona(QObject *parent) themeName = plasmarc.readEntry(themeNameKey, themeName); if (themeName.isEmpty()) { - LookAndFeelAccess access; KConfigGroup lnfCfg = KConfigGroup(KSharedConfig::openConfig( - access.filePath("defaults")), + m_lookAndFeelPackage.filePath("defaults")), "plasmarc" ); lnfCfg = KConfigGroup(&lnfCfg, themeGroupKey); @@ -183,6 +185,11 @@ ShellCorona::~ShellCorona() qDeleteAll(m_panelViews); } +Plasma::Package ShellCorona::lookAndFeelPackage() +{ + return m_lookAndFeelPackage; +} + void ShellCorona::setShell(const QString &shell) { if (m_shell == shell) { diff --git a/shell/shellcorona.h b/shell/shellcorona.h index 029ac72a1..84919ff4c 100644 --- a/shell/shellcorona.h +++ b/shell/shellcorona.h @@ -68,6 +68,8 @@ public: explicit ShellCorona(QObject *parent = 0); ~ShellCorona(); + Plasma::Package lookAndFeelPackage(); + /** * Where to save global configuration that doesn't have anything to do with the scene (e.g. views) */ @@ -201,7 +203,7 @@ private: QHash > m_desktopContainments; QAction *m_addPanelAction; QMenu *m_addPanelsMenu; - Plasma::Package m_lookNFeelPackage; + Plasma::Package m_lookAndFeelPackage; QSet m_redundantOutputs; QList m_alternativesObjects; KDeclarative::QmlObject *m_interactiveConsole;