KConfig

kconfigwatcher.h
1/*
2 SPDX-FileCopyrightText: 2018 David Edmundson <davidedmundson@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KCONFIGWATCHER_H
8#define KCONFIGWATCHER_H
9
10#include <QObject>
11#include <QSharedPointer>
12
13#include <KConfigGroup>
14#include <KSharedConfig>
15
16#include <kconfigcore_export.h>
17
18class KConfigWatcherPrivate;
19
20/**
21 * \class KConfigWatcher kconfigwatcher.h <KConfigWatcher>
22 *
23 * Notifies when another client has updated this config file with the Notify flag set.
24 * @since 5.51
25 */
26class KCONFIGCORE_EXPORT KConfigWatcher : public QObject
27{
28 Q_OBJECT
29public:
31
32 /**
33 * Instantiate a ConfigWatcher for a given config
34 *
35 * @note any additional config sources should be set before this point.
36 */
37 static Ptr create(const KSharedConfig::Ptr &config);
38
39 ~KConfigWatcher() override;
40
41 /**
42 * Returns the config being watched
43 * @since 5.66
44 */
45 KSharedConfig::Ptr config() const;
46
48 /**
49 * Emitted when a config group has changed
50 * The config will be reloaded before this signal is emitted
51 *
52 * @arg group the config group that has changed
53 * @arg names a list of entries that have changed within that group (UTF-8 encoded)
54 */
55 void configChanged(const KConfigGroup &group, const QByteArrayList &names);
56
57private Q_SLOTS:
58 KCONFIGCORE_NO_EXPORT void onConfigChangeNotification(const QHash<QString, QByteArrayList> &changes);
59
60private:
61 KCONFIGCORE_NO_EXPORT explicit KConfigWatcher(const KSharedConfig::Ptr &config);
62 Q_DISABLE_COPY(KConfigWatcher)
64};
65
66#endif
A class for one specific group in a KConfig object.
Notifies when another client has updated this config file with the Notify flag set.
void configChanged(const KConfigGroup &group, const QByteArrayList &names)
Emitted when a config group has changed The config will be reloaded before this signal is emitted.
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 11:54:02 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.