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/scriptengine.cpp
scripting/widget.cpp
../lookandfeelaccess/lookandfeelaccess.cpp
)
set(plasmashell_dbusXML dbus/org.kde.PlasmaShell.xml)

@ -29,13 +29,10 @@
#include <KDeclarative/QmlObject>
#include <klocalizedstring.h>
#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;

@ -21,6 +21,10 @@
#include "lookandfeel.h"
#include <KLocalizedString>
#include <KSharedConfig>
#include <Plasma/PluginLoader>
#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"

@ -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

@ -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) {

@ -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<QString, QHash<int, Plasma::Containment *> > m_desktopContainments;
QAction *m_addPanelAction;
QMenu *m_addPanelsMenu;
Plasma::Package m_lookNFeelPackage;
Plasma::Package m_lookAndFeelPackage;
QSet<KScreen::Output *> m_redundantOutputs;
QList<KDeclarative::QmlObject *> m_alternativesObjects;
KDeclarative::QmlObject *m_interactiveConsole;

Loading…
Cancel
Save