1fb9f6f13a
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.
49 lines
1.7 KiB
C++
49 lines
1.7 KiB
C++
/******************************************************************************
|
|
* SPDX-FileCopyrightText: 2017 Marco Martin <mart@kde.org> *
|
|
* *
|
|
* SPDX-License-Identifier: LGPL-2.0-or-later
|
|
*******************************************************************************/
|
|
|
|
#include "scripts.h"
|
|
|
|
#include <KLocalizedString>
|
|
|
|
void ScriptsPackage::initPackage(KPackage::Package *package)
|
|
{
|
|
package->setDefaultPackageRoot(QStringLiteral("kwin/scripts/"));
|
|
|
|
package->addDirectoryDefinition("config", QStringLiteral("config"), i18n("Configuration Definitions"));
|
|
QStringList mimetypes;
|
|
mimetypes << QStringLiteral("text/xml");
|
|
package->setMimeTypes("config", mimetypes);
|
|
|
|
package->addDirectoryDefinition("ui", QStringLiteral("ui"), i18n("User Interface"));
|
|
|
|
package->addDirectoryDefinition("code", QStringLiteral("code"), i18n("Executable Scripts"));
|
|
|
|
package->addFileDefinition("mainscript", QStringLiteral("code/main.js"), i18n("Main Script File"));
|
|
package->setRequired("mainscript", true);
|
|
|
|
mimetypes.clear();
|
|
mimetypes << QStringLiteral("text/plain");
|
|
package->setMimeTypes("scripts", mimetypes);
|
|
}
|
|
|
|
void ScriptsPackage::pathChanged(KPackage::Package *package)
|
|
{
|
|
if (package->path().isEmpty()) {
|
|
return;
|
|
}
|
|
|
|
KPluginMetaData md(package->metadata().metaDataFileName());
|
|
QString mainScript = md.value("X-Plasma-MainScript");
|
|
|
|
if (!mainScript.isEmpty()) {
|
|
package->addFileDefinition("mainscript", mainScript, i18n("Main Script File"));
|
|
}
|
|
}
|
|
|
|
K_EXPORT_KPACKAGE_PACKAGE_WITH_JSON(ScriptsPackage, "kwin-packagestructure-scripts.json")
|
|
|
|
#include "scripts.moc"
|
|
|