Libplasma

packages.cpp
1/*
2 SPDX-FileCopyrightText: 2007-2009 Aaron Seigo <aseigo@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include <QCoreApplication>
8#include <QDebug>
9#include <QFileInfo>
10
11#include <KConfigGroup>
12#include <KDesktopFile>
13#include <KPackage/Package>
14#include <KRuntimePlatform>
15
16#include "config-plasma.h"
17#include "packages_p.h"
18
19namespace Plasma
20{
21void GenericPackage::initPackage(KPackage::Package *package)
22{
23 package->addFileDefinition("mainscript", QStringLiteral("ui/main.qml"));
24 package->setRequired("mainscript", true);
25 package->addFileDefinition("test", QStringLiteral("tests/test.qml"));
26
27 if (QStringList platform = KRuntimePlatform::runtimePlatform(); !platform.isEmpty()) {
28 for (QString &platformEntry : platform) {
29 platformEntry.prepend(QLatin1String("platformcontents/"));
30 }
31 platform.append(QStringLiteral("contents"));
32 package->setContentsPrefixPaths(platform);
33 }
34
35 package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/packages/"));
36
37 package->addDirectoryDefinition("images", QStringLiteral("images"));
38 package->addDirectoryDefinition("theme", QStringLiteral("theme"));
39 const QStringList imageMimeTypes{QStringLiteral("image/svg+xml"), QStringLiteral("image/png"), QStringLiteral("image/jpeg")};
40 package->setMimeTypes("images", imageMimeTypes);
41 package->setMimeTypes("theme", imageMimeTypes);
42
43 package->addDirectoryDefinition("config", QStringLiteral("config"));
44 package->setMimeTypes("config", QStringList{QStringLiteral("text/xml")});
45
46 package->addDirectoryDefinition("ui", QStringLiteral("ui"));
47
48 package->addDirectoryDefinition("data", QStringLiteral("data"));
49
50 package->addDirectoryDefinition("scripts", QStringLiteral("code"));
51 package->setMimeTypes("scripts", QStringList{QStringLiteral("text/plain")});
52 package->addFileDefinition("screenshot", QStringLiteral("screenshot.png"));
53
54 package->addDirectoryDefinition("translations", QStringLiteral("locale"));
55}
56
57} // namespace Plasma
58
59#include "moc_packages_p.cpp"
void setContentsPrefixPaths(const QStringList &prefixPaths)
void setRequired(const QByteArray &key, bool required)
void setMimeTypes(const QByteArray &key, const QStringList &mimeTypes)
void addDirectoryDefinition(const QByteArray &key, const QString &path)
void addFileDefinition(const QByteArray &key, const QString &path)
void setDefaultPackageRoot(const QString &packageRoot)
KCOREADDONS_EXPORT QStringList runtimePlatform()
Namespace for everything in libplasma.
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:06:24 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.