allow the main script to be overriden

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=827477
This commit is contained in:
Aaron J. Seigo 2008-07-03 05:45:07 +00:00
parent 40dc671844
commit 8e9e1e1478
3 changed files with 18 additions and 2 deletions

View File

@ -19,6 +19,8 @@
#include "packages_p.h"
#include <KConfigGroup>
#include <KDesktopFile>
#include <KLocale>
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"))
{

View File

@ -30,6 +30,9 @@ class PlasmoidPackage : public PackageStructure
Q_OBJECT
public:
explicit PlasmoidPackage(QObject *parent = 0);
protected:
void pathChanged();
};
class ThemePackage : public PackageStructure

View File

@ -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<QByteArray, ContentStructure>::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;
}