From 8e9e1e1478a8c78481043f917ba08a0c1d30d9f2 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Thu, 3 Jul 2008 05:45:07 +0000 Subject: [PATCH] allow the main script to be overriden svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=827477 --- packages.cpp | 13 +++++++++++++ packages_p.h | 3 +++ packagestructure.cpp | 4 ++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/packages.cpp b/packages.cpp index 25869e4c3..129ddd83a 100644 --- a/packages.cpp +++ b/packages.cpp @@ -19,6 +19,8 @@ #include "packages_p.h" +#include +#include #include namespace Plasma @@ -52,6 +54,17 @@ PlasmoidPackage::PlasmoidPackage(QObject *parent) setRequired("mainscript", true); } +void PlasmoidPackage::pathChanged() +{ + KDesktopFile config(path() + "/metadata.desktop"); + KConfigGroup cg = config.desktopGroup(); + QString mainScript = cg.readEntry("X-Plasma-MainScript", QString()); + if (!mainScript.isEmpty()) { + addFileDefinition("mainscript", mainScript, i18n("Main Script File")); + setRequired("mainscript", true); + } +} + ThemePackage::ThemePackage(QObject *parent) : Plasma::PackageStructure(parent, QString("Plasma Theme")) { diff --git a/packages_p.h b/packages_p.h index b3d78d5d1..99695743c 100644 --- a/packages_p.h +++ b/packages_p.h @@ -30,6 +30,9 @@ class PlasmoidPackage : public PackageStructure Q_OBJECT public: explicit PlasmoidPackage(QObject *parent = 0); + +protected: + void pathChanged(); }; class ThemePackage : public PackageStructure diff --git a/packagestructure.cpp b/packagestructure.cpp index 217082a37..3d0a3f61d 100644 --- a/packagestructure.cpp +++ b/packagestructure.cpp @@ -214,13 +214,13 @@ void PackageStructure::addFileDefinition(const char* key, const QString& path, c QString PackageStructure::path(const char* key) const { - kDebug() << "looking for" << key; + //kDebug() << "looking for" << key; QMap::const_iterator it = d->contents.find(key); if (it == d->contents.constEnd()) { return QString(); } - kDebug() << "found" << key << "and the value is" << it.value().path; + //kDebug() << "found" << key << "and the value is" << it.value().path; return it.value().path; }