KCMUtils

kcmoduledata.h
1/*
2 SPDX-FileCopyrightText: 2020 Benjamin Port <benjamin.port@enioka.com>
3
4 SPDX-License-Identifier: LGPL-2.0-only
5*/
6
7#ifndef KCMODULEDATA_H
8#define KCMODULEDATA_H
9
10#include <QObject>
11#include <QVariantList>
12#include <kcmutilscore_export.h>
13#include <memory>
14
15class KCModuleDataPrivate;
17
18/**
19 * @short A base class that offers information about a KCModule state
20 *
21 * @author Benjamin Port <benjamin.port@enioka.com>
22 *
23 * @since 5.74
24 */
25class KCMUTILSCORE_EXPORT KCModuleData : public QObject
26{
28public:
29 explicit KCModuleData(QObject *parent = nullptr);
30 ~KCModuleData() override;
31
32 /**
33 * Checks if the configuration is identical to the default one.
34 *
35 * @return @c true if the module configuration is in the default state, @c false otherwise
36 */
37 virtual bool isDefaults() const;
38
39 /**
40 * Revert module to default values and save them.
41 */
42 virtual void revertToDefaults();
43
44 /**
45 * Checks if this module matches a given query.
46 * @param query the text user search for, it is not expected to be a regex pattern but a full text search.
47 * @return @c true if this module matches a given query, @c false otherwise
48 */
49 virtual bool matchesQuery(const QString &query) const;
50
52 /**
53 * This signal is emitted when KCModuleData is loaded.
54 */
55 void loaded();
56
57 /**
58 * Internal use
59 *
60 * Triggers the emit of @see loaded() signal. This is the default behavior.
61 * To handle when loaded() is emitted in subclass, disconnect this signal in derived constructor.
62 */
63 void aboutToLoad(QPrivateSignal);
64
65protected Q_SLOTS:
66 /**
67 * Allow to register manually skeleton class.
68 * Used by derived class when automatic discovery is not possible.
69 */
71
72 /**
73 * Automatically register child skeletons
74 * Call it in your subclass constructor after skeleton creation
75 */
77
78private:
79 const std::unique_ptr<KCModuleDataPrivate> d;
80 friend class KCModuleDataPrivate;
81};
82
83#endif
virtual bool matchesQuery(const QString &query) const
Checks if this module matches a given query.
void registerSkeleton(KCoreConfigSkeleton *skeleton)
Allow to register manually skeleton class.
void autoRegisterSkeletons()
Automatically register child skeletons Call it in your subclass constructor after skeleton creation.
void aboutToLoad(QPrivateSignal)
Internal use.
virtual bool isDefaults() const
Checks if the configuration is identical to the default one.
void loaded()
This signal is emitted when KCModuleData is loaded.
virtual void revertToDefaults()
Revert module to default values and save them.
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:51:31 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.