1/*
2 This file is part of KOrganizer.
3 SPDX-FileCopyrightText: 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
4 SPDX-FileCopyrightText: 2003 Waldo Bastian <bastian@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#ifndef KCORECONFIGSKELETON_P_H
10#define KCORECONFIGSKELETON_P_H
11
12#include "kcoreconfigskeleton.h"
13
14class KCoreConfigSkeletonPrivate
15{
16public:
17 KCoreConfigSkeletonPrivate()
18 : mCurrentGroup(QStringLiteral("No Group"))
19 , mUseDefaults(false)
20 {
21 }
22 ~KCoreConfigSkeletonPrivate()
23 {
24 qDeleteAll(c: mItems);
25 }
26 QString mCurrentGroup;
27
28 // store the backend config only one should be set
29 KSharedConfig::Ptr mSharedConfig;
30 std::unique_ptr<KConfig> config;
31
32 KConfigSkeletonItem::List mItems;
33 KConfigSkeletonItem::Dict mItemDict;
34
35 bool mUseDefaults;
36};
37
38class KConfigSkeletonItemPrivate
39{
40public:
41 KConfigSkeletonItemPrivate()
42 : mIsImmutable(true)
43 , mWriteFlags(KConfigBase::Normal)
44 {
45 }
46 virtual ~KConfigSkeletonItemPrivate();
47 bool mIsImmutable; ///< Indicates this item is immutable
48 KConfigBase::WriteConfigFlags mWriteFlags; ///< The flags to pass to calls of writeEntry() and revertToDefault()
49
50 QString mLabel; ///< The label for this item
51 QString mToolTip; ///< The ToolTip text for this item
52 QString mWhatsThis; ///< The What's This text for this item
53 KConfigGroup mConfigGroup; ///< KConfigGroup, allow to read/write item in nested groups
54
55 // HACK: Necessary to avoid introducing new virtuals in KConfigSkeletonItem
56 std::function<bool()> mIsDefaultImpl;
57 std::function<bool()> mIsSaveNeededImpl;
58 std::function<QVariant()> mGetDefaultImpl;
59};
60
61class KPropertySkeletonItemPrivate : public KConfigSkeletonItemPrivate
62{
63public:
64 KPropertySkeletonItemPrivate(QObject *object, const QByteArray &propertyName, const QVariant &defaultValue)
65 : KConfigSkeletonItemPrivate()
66 , mObject(object)
67 , mPropertyName(propertyName)
68 , mDefaultValue(defaultValue)
69 , mConstDefaultValue(defaultValue)
70 {
71 mIsImmutable = false;
72 }
73
74 QObject *mObject;
75 const QByteArray mPropertyName;
76 QVariant mDefaultValue;
77 const QVariant mConstDefaultValue;
78 QVariant mReference;
79 QVariant mLoadedValue;
80 std::function<void()> mNotifyFunction;
81};
82
83#endif
84

source code of kconfig/src/core/kcoreconfigskeleton_p.h