kwin/plugins/kpackage/effect/effect.cpp
Vlad Zahorodnii 1fb9f6f13a Switch to SPDX license markers
The main advantage of SPDX license identifiers over the traditional
license headers is that it's more difficult to overlook inappropriate
licenses for kwin, for example GPL 3. We also don't have to copy a
lot of boilerplate text.

In order to create this change, I ran licensedigger -r -c from the
toplevel source directory.
2020-08-07 19:57:56 +00:00

50 lines
1.9 KiB
C++

/******************************************************************************
* SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org> *
* *
* SPDX-License-Identifier: LGPL-2.0-or-later
*******************************************************************************/
#include "effect.h"
#include <KLocalizedString>
EffectPackageStructure::EffectPackageStructure(QObject *parent, const QVariantList &args)
: KPackage::PackageStructure(parent, args)
{
}
void EffectPackageStructure::initPackage(KPackage::Package *package)
{
package->setDefaultPackageRoot(QStringLiteral("kwin/effects/"));
package->addDirectoryDefinition("code", QStringLiteral("code"), i18n("Executable Scripts"));
package->setMimeTypes("code", {QStringLiteral("text/plain")});
package->addFileDefinition("mainscript", QStringLiteral("code/main.js"), i18n("Main Script File"));
package->setRequired("mainscript", true);
package->addFileDefinition("config", QStringLiteral("config/main.xml"), i18n("Configuration Definition File"));
package->setMimeTypes("config", {QStringLiteral("text/xml")});
package->addFileDefinition("configui", QStringLiteral("ui/config.ui"), i18n("KCM User Interface File"));
package->setMimeTypes("configui", {QStringLiteral("text/xml")});
}
void EffectPackageStructure::pathChanged(KPackage::Package *package)
{
if (package->path().isEmpty()) {
return;
}
const KPluginMetaData md(package->metadata().metaDataFileName());
const QString mainScript = md.value("X-Plasma-MainScript");
if (mainScript.isEmpty()) {
return;
}
package->addFileDefinition("mainscript", mainScript, i18n("Main Script File"));
}
K_EXPORT_KPACKAGE_PACKAGE_WITH_JSON(EffectPackageStructure, "kwin-packagestructure-effect.json")
#include "effect.moc"