Libplasma

plasma_theme_packagestructure.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 "config-plasma.h"
8#include <KConfigGroup>
9#include <KDesktopFile>
10#include <KPackage/Package>
11#include <KPackage/PackageStructure>
12#include <KPackage/packagestructure_compat_p>
13
14class ThemePackage : public KPackage::PackageStructure
15{
17public:
18 using KPackage::PackageStructure::PackageStructure;
19
20 void initPackage(KPackage::Package *package) override
21 {
22 // by default the packages have "contents/" as contentsPrefixPaths
23 // but for the themes we don't want that, so unset it.
25 package->setDefaultPackageRoot(QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/"));
26
27 package->addDirectoryDefinition("dialogs", QStringLiteral("dialogs/"));
28 package->addFileDefinition("dialogs/background", QStringLiteral("dialogs/background.svg"));
29 package->addFileDefinition("dialogs/background", QStringLiteral("dialogs/background.svgz"));
30 package->addFileDefinition("dialogs/shutdowndialog", QStringLiteral("dialogs/shutdowndialog.svg"));
31 package->addFileDefinition("dialogs/shutdowndialog", QStringLiteral("dialogs/shutdowndialog.svgz"));
32
33 package->addDirectoryDefinition("wallpapers", QStringLiteral("wallpapers/"));
34
35 package->addDirectoryDefinition("widgets", QStringLiteral("widgets/"));
36 package->addFileDefinition("widgets/background", QStringLiteral("widgets/background.svg"));
37 package->addFileDefinition("widgets/background", QStringLiteral("widgets/background.svgz"));
38 package->addFileDefinition("widgets/clock", QStringLiteral("widgets/clock.svg"));
39 package->addFileDefinition("widgets/clock", QStringLiteral("widgets/clock.svgz"));
40 package->addFileDefinition("widgets/panel-background", QStringLiteral("widgets/panel-background.svg"));
41 package->addFileDefinition("widgets/panel-background", QStringLiteral("widgets/panel-background.svgz"));
42 package->addFileDefinition("widgets/plot-background", QStringLiteral("widgets/plot-background.svg"));
43 package->addFileDefinition("widgets/plot-background", QStringLiteral("widgets/plot-background.svgz"));
44 package->addFileDefinition("widgets/tooltip", QStringLiteral("widgets/tooltip.svg"));
45 package->addFileDefinition("widgets/tooltip", QStringLiteral("widgets/tooltip.svgz"));
46
47 package->addDirectoryDefinition("opaque/dialogs", QStringLiteral("opaque/dialogs/"));
48 package->addFileDefinition("opaque/dialogs/background", QStringLiteral("opaque/dialogs/background.svg"));
49 package->addFileDefinition("opaque/dialogs/background", QStringLiteral("opaque/dialogs/background.svgz"));
50 package->addFileDefinition("opaque/dialogs/shutdowndialog", QStringLiteral("opaque/dialogs/shutdowndialog.svg"));
51 package->addFileDefinition("opaque/dialogs/shutdowndialog", QStringLiteral("opaque/dialogs/shutdowndialog.svgz"));
52
53 package->addDirectoryDefinition("opaque/widgets", QStringLiteral("opaque/widgets/"));
54 package->addFileDefinition("opaque/widgets/panel-background", QStringLiteral("opaque/widgets/panel-background.svg"));
55 package->addFileDefinition("opaque/widgets/panel-background", QStringLiteral("opaque/widgets/panel-background.svgz"));
56 package->addFileDefinition("opaque/widgets/tooltip", QStringLiteral("opaque/widgets/tooltip.svg"));
57 package->addFileDefinition("opaque/widgets/tooltip", QStringLiteral("opaque/widgets/tooltip.svgz"));
58
59 package->addFileDefinition("colors", QStringLiteral("colors"));
60
61 package->setDefaultMimeTypes({QStringLiteral("image/svg+xml")});
62
63 package->addFileDefinition("metadata", QStringLiteral("metadata.desktop"));
64 package->setRequired("metadata", true);
65 }
66 void pathChanged(KPackage::Package *package) override
67 {
68 // The KCM uses KPackage to list available themes
69 KPackagePrivate::convertCompatMetaDataDesktopFile(package);
70 }
71};
72
73K_PLUGIN_CLASS_WITH_JSON(ThemePackage, "plasma_theme_packagestructure.json")
74
75#include "plasma_theme_packagestructure.moc"
void setContentsPrefixPaths(const QStringList &prefixPaths)
void setRequired(const QByteArray &key, bool required)
void addDirectoryDefinition(const QByteArray &key, const QString &path)
void addFileDefinition(const QByteArray &key, const QString &path)
void setDefaultPackageRoot(const QString &packageRoot)
void setDefaultMimeTypes(const QStringList &mimeTypes)
#define K_PLUGIN_CLASS_WITH_JSON(classname, jsonFile)
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.