KPackage

packagestructure.h
1/*
2 SPDX-FileCopyrightText: 2011 Aaron Seigo <aseigo@kde.org>
3 SPDX-FileCopyrightText: 2023 Alexander Lohnau <alexander.lohnau@gmx.de>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KPACKAGE_PACKAGESTRUCTURE_H
9#define KPACKAGE_PACKAGESTRUCTURE_H
10
11#include <QStringList>
12
13#include <KPluginFactory>
14
15#include <kpackage/package.h>
16#include <kpackage/package_export.h>
17
18namespace KPackage
19{
20/**
21 * @class PackageStructure kpackage/packagestructure.h <KPackage/PackageStructure>
22 *
23 * This class is used to define the filesystem structure of a package type.
24 * A PackageStructure is implemented as a dynamically loaded plugin, in the reimplementation
25 * of initPackage the allowed fines and directories in the package are set into the package,
26 * for instance:
27 *
28 * @code
29 * package->addFileDefinition("mainscript", QStringLiteral("ui/main.qml"));
30 * package->setDefaultPackageRoot(QStringLiteral("plasma/wallpapers/"));
31 * package->addDirectoryDefinition("images", QStringLiteral("images"));
32 * package->addDirectoryDefinition("theme", QStringLiteral("theme"));
33 * QStringList mimetypes{QStringLiteral("image/svg+xml"), QStringLiteral("image/png"), QStringLiteral("image/jpeg")};
34 * package->setMimeTypes("images", mimetypes);
35 * @endcode
36 */
37class KPACKAGE_EXPORT PackageStructure : public QObject
38{
39 Q_OBJECT
40
41public:
42 explicit PackageStructure(QObject *parent = nullptr, const QVariantList &args = QVariantList());
43
44 ~PackageStructure() override;
45
46 /**
47 * Called when a the PackageStructure should initialize a Package with the initial
48 * structure. This allows setting paths before setPath is called.
49 *
50 * Note: one special value is "metadata" which can be set to the location of KPluginMetaData
51 * compatible .json file within the package. If not defined, it is assumed that this file
52 * exists under the top level directory of the package.
53 *
54 * @param package the Package to set up. The object is empty of all definition when
55 * first passed in.
56 */
57 virtual void initPackage(Package *package);
58
59 /**
60 * Called whenever the path changes so that subclasses may take
61 * package specific actions.
62 */
63 virtual void pathChanged(Package *package);
64
65private:
66 void *d;
67};
68
69} // KPackage namespace
70
71#endif
This class is used to define the filesystem structure of a package type.
object representing an installed package
Definition package.h:63
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:36:09 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.