give datanegines their own package description; gets rid of various bits of cruft inherited unduly from PlasmoidPackage as well as adds a services/ dir for .operation files.

svn path=/trunk/KDE/kdelibs/; revision=1159709
This commit is contained in:
Aaron J. Seigo 2010-08-06 01:28:09 +00:00
parent ae26e2a87c
commit 35e376b0b8
3 changed files with 48 additions and 1 deletions

View File

@ -103,6 +103,40 @@ void PlasmoidPackage::createNewWidgetBrowser(QWidget *parent)
#endif
}
DataEnginePackage::DataEnginePackage(QObject *parent)
: Plasma::PackageStructure(parent, QString("DataEngine"))
{
addDirectoryDefinition("data", "data", i18n("Data Files"));
addDirectoryDefinition("scripts", "code", i18n("Executable Scripts"));
QStringList mimetypes;
mimetypes << "text/plain";
setMimetypes("scripts", mimetypes);
addDirectoryDefinition("services", "services/", i18n("Service Descriptions"));
setMimetypes("services", mimetypes);
addDirectoryDefinition("translations", "locale", i18n("Translations"));
addFileDefinition("mainscript", "code/main", i18n("Main Script File"));
setRequired("mainscript", true);
}
DataEnginePackage::~DataEnginePackage()
{
}
void DataEnginePackage::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

@ -53,6 +53,17 @@ private:
#endif
};
class DataEnginePackage : public PackageStructure
{
Q_OBJECT
public:
explicit DataEnginePackage(QObject *parent = 0);
~DataEnginePackage();
protected:
void pathChanged();
};
class ThemePackage : public PackageStructure
{
Q_OBJECT

View File

@ -251,11 +251,13 @@ PackageStructure::Ptr defaultPackageStructure(ComponentType type)
{
switch (type) {
case AppletComponent:
case DataEngineComponent:
case WallpaperComponent:
case RunnerComponent:
return PackageStructure::Ptr(new PlasmoidPackage());
break;
case DataEngineComponent:
return PackageStructure::Ptr(new DataEnginePackage());
break;
default:
// TODO: we don't have any special structures for other components yet
break;