KCMUtils

kcmoduledata.h
1 /*
2  This file is part of the KDE project
3  SPDX-FileCopyrightText: 2020 Benjamin Port <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-only
6 */
7 
8 #ifndef KCMODULEDATA_H
9 #define KCMODULEDATA_H
10 
11 #include <QObject>
12 #include <QVariantList>
13 #include <kcmutils_export.h>
14 
15 class KCModuleDataPrivate;
17 
18 /**
19  * @short A base class that offers information about a KCModule state
20  *
21  * @author Benjamin Port <[email protected]>
22  *
23  * @since 5.74
24  */
25 class KCMUTILS_EXPORT KCModuleData : public QObject
26 {
27  Q_OBJECT
28 public:
29  explicit KCModuleData(QObject *parent = nullptr, const QVariantList &args = QVariantList());
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 
51 Q_SIGNALS:
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 
65 protected Q_SLOTS:
66  /**
67  * Allow to register manually skeleton class.
68  * Used by derived class when automatic discovery is not possible.
69  */
70  void registerSkeleton(KCoreConfigSkeleton *skeleton);
71 
72  /**
73  * Automatically register child skeletons
74  * Call it in your subclass constructor after skeleton creation
75  */
76  void autoRegisterSkeletons();
77 
78 protected:
79  virtual void virtual_hook(int id, void *data);
80 
81 private:
82  KCModuleDataPrivate *const d;
83  friend class KCModuleDataPrivate;
84 };
85 
86 #endif
Q_SLOTSQ_SLOTS
A base class that offers information about a KCModule state.
Definition: kcmoduledata.h:25
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 04:05:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.