File indexing completed on 2024-05-12 03:54:27
0001 /* 0002 This file is part of KOrganizer. 0003 SPDX-FileCopyrightText: 2000, 2001 Cornelius Schumacher <schumacher@kde.org> 0004 SPDX-FileCopyrightText: 2003 Waldo Bastian <bastian@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef KCORECONFIGSKELETON_P_H 0010 #define KCORECONFIGSKELETON_P_H 0011 0012 #include "kcoreconfigskeleton.h" 0013 0014 class KCoreConfigSkeletonPrivate 0015 { 0016 public: 0017 KCoreConfigSkeletonPrivate() 0018 : mCurrentGroup(QStringLiteral("No Group")) 0019 , mUseDefaults(false) 0020 { 0021 } 0022 ~KCoreConfigSkeletonPrivate() 0023 { 0024 qDeleteAll(mItems); 0025 } 0026 QString mCurrentGroup; 0027 0028 KSharedConfig::Ptr mConfig; // pointer to KConfig object 0029 0030 KConfigSkeletonItem::List mItems; 0031 KConfigSkeletonItem::Dict mItemDict; 0032 0033 bool mUseDefaults; 0034 }; 0035 0036 class KConfigSkeletonItemPrivate 0037 { 0038 public: 0039 KConfigSkeletonItemPrivate() 0040 : mIsImmutable(true) 0041 , mWriteFlags(KConfigBase::Normal) 0042 { 0043 } 0044 virtual ~KConfigSkeletonItemPrivate(); 0045 bool mIsImmutable; ///< Indicates this item is immutable 0046 KConfigBase::WriteConfigFlags mWriteFlags; ///< The flags to pass to calls of writeEntry() and revertToDefault() 0047 0048 QString mLabel; ///< The label for this item 0049 QString mToolTip; ///< The ToolTip text for this item 0050 QString mWhatsThis; ///< The What's This text for this item 0051 KConfigGroup mConfigGroup; ///< KConfigGroup, allow to read/write item in nested groups 0052 0053 // HACK: Necessary to avoid introducing new virtuals in KConfigSkeletonItem 0054 std::function<bool()> mIsDefaultImpl; 0055 std::function<bool()> mIsSaveNeededImpl; 0056 std::function<QVariant()> mGetDefaultImpl; 0057 }; 0058 0059 class KPropertySkeletonItemPrivate : public KConfigSkeletonItemPrivate 0060 { 0061 public: 0062 KPropertySkeletonItemPrivate(QObject *object, const QByteArray &propertyName, const QVariant &defaultValue) 0063 : KConfigSkeletonItemPrivate() 0064 , mObject(object) 0065 , mPropertyName(propertyName) 0066 , mDefaultValue(defaultValue) 0067 , mConstDefaultValue(defaultValue) 0068 { 0069 mIsImmutable = false; 0070 } 0071 0072 QObject *mObject; 0073 const QByteArray mPropertyName; 0074 QVariant mDefaultValue; 0075 const QVariant mConstDefaultValue; 0076 QVariant mReference; 0077 QVariant mLoadedValue; 0078 std::function<void()> mNotifyFunction; 0079 }; 0080 0081 #endif