KCMUtils

dispatcher.h
1 /*
2  This file is part of the KDE project
3  SPDX-FileCopyrightText: 2003 Matthias Kretz <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-only
6 */
7 
8 #ifndef KSETTINGS_DISPATCHER_H
9 #define KSETTINGS_DISPATCHER_H
10 
11 #include <KSharedConfig>
12 #include <QObject>
13 #include <kcmutils_export.h>
14 
15 #if KCMUTILS_ENABLE_DEPRECATED_SINCE(5, 85)
16 namespace KSettings
17 {
18 /**
19  * @short Dispatch change notifications from the KCMs to the program.
20  *
21  * Since your program does not have direct control over the KCMs that get loaded
22  * into KSettings::Dialog you need a way to get notified. This is what you do:
23  * \code
24  * Dispatcher::registerComponent(componentData(), this, "loadSettings");
25  * \endcode
26  *
27  * @author Matthias Kretz <[email protected]>
28  */
29 namespace Dispatcher
30 {
31 /**
32  * Register a slot to be called when the configuration for the componentData
33  * has changed. @p componentName is the string that is passed to KPluginFactory (if it is used).
34  * You can query it with MyPluginFactory::componentName(), or from a KAboutData.
35  * componentName is also the same name that is put into the
36  * .desktop file of the KCMs for the X-KDE-ParentComponents.
37  *
38  * @param componentName The name of the component
39  * @param recv The object that should receive the signal
40  * @param slot The slot to be called: "slotName"
41  * @deprecated Since 5.85, connect to the @ref KCMultiDialog::configCommitted() signal of the dialog instead and check the componentName
42  */
43 
44 KCMUTILS_DEPRECATED_VERSION(5, 85, "Connect to the KCMultiDialog::configCommitted() signal of the dialog instead and check the componentName")
45 KCMUTILS_EXPORT void registerComponent(const QString &componentName, QObject *recv, const char *slot);
46 
47 /**
48  * @return the KConfig object that belongs to the componentName
49  * @deprecated Since 5.85, use KSharedConfig::openConfig(componentName + QStringLiteral("rc")) instaed
50  */
51 KCMUTILS_DEPRECATED_VERSION(5, 85, "Use KSharedConfig::openConfig(componentName + QStringLiteral(\"rc\")) instaed")
52 KCMUTILS_EXPORT KSharedConfig::Ptr configForComponentName(const QString &componentName);
53 
54 /**
55  * @return a list of all the componentData names that are currently
56  * registered
57  * @deprecated Since 5.85, this method is obsolete, see @p registerComponent API docs.
58  */
59 KCMUTILS_DEPRECATED_VERSION(5, 85, "method is obsolete, see KSettings::registerComponent API docs")
60 KCMUTILS_EXPORT QList<QString> componentNames();
61 
62 /**
63  * Call this function when the configuration belonging to the associated
64  * componentData name has changed. The registered slot will be called.
65  *
66  * @param componentName The value of X-KDE-ParentComponents.
67  * @deprecated Since 5.85, manually reparse the config instead
68  */
69 KCMUTILS_DEPRECATED_VERSION(5, 85, "Manually reparse the config instead")
70 KCMUTILS_EXPORT void reparseConfiguration(const QString &componentName);
71 
72 /**
73  * When this function is called the KConfig objects of all the registered
74  * instances are sync()ed. This is useful when some other KConfig
75  * objects will read/write from/to the same config file, so that you
76  * can first write out the current state of the KConfig objects.
77  * @deprecated Since 5.85, manually sync the config instead
78  */
79 KCMUTILS_DEPRECATED_VERSION(5, 85, "Manually sync the config instead")
80 KCMUTILS_EXPORT void syncConfiguration();
81 } // namespace Dispatcher
82 
83 }
84 #endif // KSETTINGS_DISPATCHER_H
85 #endif
QList< QString > componentNames()
Definition: dispatcher.cpp:38
void syncConfiguration()
When this function is called the KConfig objects of all the registered instances are sync()ed.
Definition: dispatcher.cpp:67
Definition: dialog.h:19
void reparseConfiguration(const QString &componentName)
Call this function when the configuration belonging to the associated componentData name has changed.
Definition: dispatcher.cpp:50
void registerComponent(const QString &componentName, QObject *recv, const char *slot)
Register a slot to be called when the configuration for the componentData has changed.
Definition: dispatcher.cpp:21
A collection of classes to create configuration dialogs that work over component boundaries.
Definition: dialog.cpp:35
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jun 25 2022 06:17:34 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.