1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
/*
SPDX-FileCopyrightText: 2007-2009 Aaron Seigo <aseigo@kde.org>
SPDX-FileCopyrightText: 2013 Sebastian Kügler <sebas@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "wallpaper.h"
#include <KLocalizedString>
#include <KRuntimePlatform>
void QmlWallpaperPackage::initPackage(KPackage::Package *package)
{
package->addFileDefinition("mainscript", QStringLiteral("ui/main.qml"), i18n("Main Script File"));
package->setRequired("mainscript", true);
QStringList platform = KRuntimePlatform::runtimePlatform();
if (!platform.isEmpty()) {
QMutableStringListIterator it(platform);
while (it.hasNext()) {
it.next();
it.setValue("platformcontents/" + it.value());
}
platform.append(QStringLiteral("contents"));
package->setContentsPrefixPaths(platform);
}
package->setDefaultPackageRoot(QStringLiteral("plasma/wallpapers/"));
package->addDirectoryDefinition("images", QStringLiteral("images"), i18n("Images"));
package->addDirectoryDefinition("theme", QStringLiteral("theme"), i18n("Themed Images"));
QStringList mimetypes;
mimetypes << QStringLiteral("image/svg+xml") << QStringLiteral("image/png") << QStringLiteral("image/jpeg");
package->setMimeTypes("images", mimetypes);
package->setMimeTypes("theme", mimetypes);
package->addDirectoryDefinition("config", QStringLiteral("config"), i18n("Configuration Definitions"));
mimetypes.clear();
mimetypes << QStringLiteral("text/xml");
package->setMimeTypes("config", mimetypes);
package->addDirectoryDefinition("ui", QStringLiteral("ui"), i18n("User Interface"));
package->addDirectoryDefinition("data", QStringLiteral("data"), i18n("Data Files"));
package->addDirectoryDefinition("scripts", QStringLiteral("code"), i18n("Executable Scripts"));
mimetypes.clear();
mimetypes << QStringLiteral("text/plain");
package->setMimeTypes("scripts", mimetypes);
package->addDirectoryDefinition("translations", QStringLiteral("locale"), i18n("Translations"));
}
K_PLUGIN_CLASS_WITH_JSON(QmlWallpaperPackage, "plasma-packagestructure-wallpaper.json")
#include "wallpaper.moc"
|