add a default fallback to lnf packagestructure

remove lookandfeelaccess from the shell
wilder-5.14
Marco Martin 12 years ago
parent 1ad207a844
commit 3a018d496f
  1. 1
      shell/CMakeLists.txt
  2. 5
      shell/osd.cpp
  3. 15
      shell/packageplugins/lookandfeel/lookandfeel.cpp
  4. 1
      shell/packageplugins/lookandfeel/lookandfeel.h
  5. 15
      shell/shellcorona.cpp
  6. 4
      shell/shellcorona.h

@ -34,7 +34,6 @@ set(scripting_SRC
scripting/rect.cpp scripting/rect.cpp
scripting/scriptengine.cpp scripting/scriptengine.cpp
scripting/widget.cpp scripting/widget.cpp
../lookandfeelaccess/lookandfeelaccess.cpp
) )
set(plasmashell_dbusXML dbus/org.kde.PlasmaShell.xml) set(plasmashell_dbusXML dbus/org.kde.PlasmaShell.xml)

@ -29,13 +29,10 @@
#include <KDeclarative/QmlObject> #include <KDeclarative/QmlObject>
#include <klocalizedstring.h> #include <klocalizedstring.h>
#include "../lookandfeelaccess/lookandfeelaccess.h"
Osd::Osd(ShellCorona *corona) Osd::Osd(ShellCorona *corona)
: QObject(corona) : QObject(corona)
{ {
LookAndFeelAccess access; const QString osdPath = corona->lookAndFeelPackage().filePath("osdmainscript");
const QString osdPath = access.filePath("osdmainscript");
if (osdPath.isEmpty()) { if (osdPath.isEmpty()) {
qWarning() << "Failed to load the OSD script file from" << osdPath; qWarning() << "Failed to load the OSD script file from" << osdPath;
return; return;

@ -21,6 +21,10 @@
#include "lookandfeel.h" #include "lookandfeel.h"
#include <KLocalizedString> #include <KLocalizedString>
#include <KSharedConfig>
#include <Plasma/PluginLoader>
#define DEFAULT_LOOKANDFEEL "org.kde.breeze.desktop"
void LookAndFeelPackage::initPackage(Plasma::Package *package) 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") K_EXPORT_PLASMA_PACKAGE_WITH_JSON(LookAndFeelPackage, "plasma-packagestructure-lookandfeel.json")
#include "lookandfeel.moc" #include "lookandfeel.moc"

@ -29,6 +29,7 @@ class LookAndFeelPackage : public Plasma::PackageStructure
public: public:
LookAndFeelPackage(QObject*, const QVariantList &) {} LookAndFeelPackage(QObject*, const QVariantList &) {}
void initPackage(Plasma::Package *package); void initPackage(Plasma::Package *package);
void pathChanged(Plasma::Package *package);
}; };
#endif #endif

@ -59,8 +59,6 @@
#include "plasmashelladaptor.h" #include "plasmashelladaptor.h"
#include "../lookandfeelaccess/lookandfeelaccess.h"
#ifndef NDEBUG #ifndef NDEBUG
#define CHECK_SCREEN_INVARIANTS screenInvariants(); #define CHECK_SCREEN_INVARIANTS screenInvariants();
#else #else
@ -79,6 +77,11 @@ ShellCorona::ShellCorona(QObject *parent)
m_screenConfiguration(nullptr), m_screenConfiguration(nullptr),
m_loading(false) 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.setSingleShot(true);
m_appConfigSyncTimer.setInterval(s_configSyncDelay); m_appConfigSyncTimer.setInterval(s_configSyncDelay);
connect(&m_appConfigSyncTimer, &QTimer::timeout, this, &ShellCorona::syncAppConfig); connect(&m_appConfigSyncTimer, &QTimer::timeout, this, &ShellCorona::syncAppConfig);
@ -125,9 +128,8 @@ ShellCorona::ShellCorona(QObject *parent)
themeName = plasmarc.readEntry(themeNameKey, themeName); themeName = plasmarc.readEntry(themeNameKey, themeName);
if (themeName.isEmpty()) { if (themeName.isEmpty()) {
LookAndFeelAccess access;
KConfigGroup lnfCfg = KConfigGroup(KSharedConfig::openConfig( KConfigGroup lnfCfg = KConfigGroup(KSharedConfig::openConfig(
access.filePath("defaults")), m_lookAndFeelPackage.filePath("defaults")),
"plasmarc" "plasmarc"
); );
lnfCfg = KConfigGroup(&lnfCfg, themeGroupKey); lnfCfg = KConfigGroup(&lnfCfg, themeGroupKey);
@ -183,6 +185,11 @@ ShellCorona::~ShellCorona()
qDeleteAll(m_panelViews); qDeleteAll(m_panelViews);
} }
Plasma::Package ShellCorona::lookAndFeelPackage()
{
return m_lookAndFeelPackage;
}
void ShellCorona::setShell(const QString &shell) void ShellCorona::setShell(const QString &shell)
{ {
if (m_shell == shell) { if (m_shell == shell) {

@ -68,6 +68,8 @@ public:
explicit ShellCorona(QObject *parent = 0); explicit ShellCorona(QObject *parent = 0);
~ShellCorona(); ~ShellCorona();
Plasma::Package lookAndFeelPackage();
/** /**
* Where to save global configuration that doesn't have anything to do with the scene (e.g. views) * Where to save global configuration that doesn't have anything to do with the scene (e.g. views)
*/ */
@ -201,7 +203,7 @@ private:
QHash<QString, QHash<int, Plasma::Containment *> > m_desktopContainments; QHash<QString, QHash<int, Plasma::Containment *> > m_desktopContainments;
QAction *m_addPanelAction; QAction *m_addPanelAction;
QMenu *m_addPanelsMenu; QMenu *m_addPanelsMenu;
Plasma::Package m_lookNFeelPackage; Plasma::Package m_lookAndFeelPackage;
QSet<KScreen::Output *> m_redundantOutputs; QSet<KScreen::Output *> m_redundantOutputs;
QList<KDeclarative::QmlObject *> m_alternativesObjects; QList<KDeclarative::QmlObject *> m_alternativesObjects;
KDeclarative::QmlObject *m_interactiveConsole; KDeclarative::QmlObject *m_interactiveConsole;

Loading…
Cancel
Save