10#ifndef KCORECONFIGSKELETON_H
11#define KCORECONFIGSKELETON_H
13#include <kconfigcore_export.h>
15#include <kconfiggroup.h>
16#include <ksharedconfig.h>
25class KCoreConfigSkeletonPrivate;
27class KConfigSkeletonItemPrivate;
45 typedef QList<KConfigSkeletonItem *> List;
46 typedef QHash<QString, KConfigSkeletonItem *> Dict;
47 typedef QHash<QString, KConfigSkeletonItem *>::Iterator DictIterator;
188 virtual bool isEqual(
const QVariant &p)
const = 0;
243 KCONFIGCORE_NO_EXPORT
explicit KConfigSkeletonItem(KConfigSkeletonItemPrivate &dd,
const QString &_group,
const QString &_key);
257 void setIsDefaultImpl(
const std::function<
bool()> &impl);
258 void setIsSaveNeededImpl(
const std::function<
bool()> &impl);
259 void setGetDefaultImpl(
const std::function<QVariant()> &impl);
261 KConfigSkeletonItemPrivate *
const d_ptr;
264class KPropertySkeletonItemPrivate;
298 bool isEqual(
const QVariant &p)
const override;
337 , mLoadedValue(defaultValue)
339 setIsDefaultImpl([
this] {
342 setIsSaveNeededImpl([
this] {
345 setGetDefaultImpl([
this] {
346 return QVariant::fromValue(
mDefault);
443 typedef void (QObject::*NotifyFunction)(quint64 arg);
459 bool isEqual(
const QVariant &p)
const override;
477 inline void invokeNotifyFunction()
480 (mObject->*mTargetFunction)(mUserData);
484 QScopedPointer<KConfigSkeletonItem> mItem;
485 NotifyFunction mTargetFunction;
574 const QString &defaultValue = QLatin1String(
""),
587 bool isEqual(
const QVariant &p)
const override;
603 ItemPassword(
const QString &_group,
const QString &_key, QString &reference,
604 const QString &defaultValue = QLatin1String(
""));
614 ItemPath(
const QString &_group,
const QString &_key, QString &reference,
const QString &defaultValue = QString());
624 ItemUrl(
const QString &_group,
const QString &_key, QUrl &reference,
const QUrl &defaultValue = QUrl());
636 bool isEqual(
const QVariant &p)
const override;
649 ItemProperty(
const QString &_group,
const QString &_key, QVariant &reference,
const QVariant &defaultValue = QVariant());
655 bool isEqual(
const QVariant &p)
const override;
668 ItemBool(
const QString &_group,
const QString &_key,
bool &reference,
bool defaultValue =
true);
677 bool isEqual(
const QVariant &p)
const override;
690 ItemInt(
const QString &_group,
const QString &_key, qint32 &reference, qint32 defaultValue = 0);
699 bool isEqual(
const QVariant &p)
const override;
736 ItemLongLong(
const QString &_group,
const QString &_key, qint64 &reference, qint64 defaultValue = 0);
745 bool isEqual(
const QVariant &p)
const override;
768#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0)
789 ItemEnum(
const QString &_group,
const QString &_key, qint32 &reference,
const QList<Choice> &choices, qint32 defaultValue = 0);
791 QList<Choice> choices()
const;
799#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 103)
801 typedef KCONFIGCORE_DEPRECATED_VERSION_BELATED(5, 103, 5, 0,
"Use Choice") Choice Choice2;
805 KCONFIGCORE_DEPRECATED_VERSION_BELATED(5, 103, 5, 0, "Use choices().")
806 QList<Choice> choices2() const;
820 QList<Choice> mChoices;
830 ItemUInt(
const QString &_group,
const QString &_key, quint32 &reference, quint32 defaultValue = 0);
839 bool isEqual(
const QVariant &p)
const override;
870 ItemULongLong(
const QString &_group,
const QString &_key, quint64 &reference, quint64 defaultValue = 0);
879 bool isEqual(
const QVariant &p)
const override;
902#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0)
913 ItemDouble(
const QString &_group,
const QString &_key,
double &reference,
double defaultValue = 0);
922 bool isEqual(
const QVariant &p)
const override;
953 ItemRect(
const QString &_group,
const QString &_key, QRect &reference,
const QRect &defaultValue = QRect());
962 bool isEqual(
const QVariant &p)
const override;
975 ItemPoint(
const QString &_group,
const QString &_key, QPoint &reference,
const QPoint &defaultValue = QPoint());
984 bool isEqual(
const QVariant &p)
const override;
997 ItemSize(
const QString &_group,
const QString &_key, QSize &reference,
const QSize &defaultValue = QSize());
1019 ItemDateTime(
const QString &_group,
const QString &_key, QDateTime &reference,
const QDateTime &defaultValue = QDateTime());
1041 ItemStringList(
const QString &_group,
const QString &_key, QStringList &reference,
const QStringList &defaultValue = QStringList());
1063 ItemPathList(
const QString &_group,
const QString &_key, QStringList &reference,
const QStringList &defaultValue = QStringList());
1078 ItemUrlList(
const QString &_group,
const QString &_key, QList<QUrl> &reference,
const QList<QUrl> &defaultValue = QList<QUrl>());
1103 ItemIntList(
const QString &_group,
const QString &_key, QList<int> &reference,
const QList<int> &defaultValue = QList<int>());
1160#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0)
1165 KCONFIGCORE_DEPRECATED_VERSION(5, 0,
"Use KCoreConfigSkeleton::load() or KCoreConfigSkeleton::read()")
1236 const QString &defaultValue = QLatin1String(
""),
1237 const QString &key = QString());
1253 ItemPassword *
addItemPassword(
const QString &name, QString &reference,
const QString &defaultValue = QLatin1String(
""),
const QString &key = QString());
1268 ItemPath *
addItemPath(
const QString &name, QString &reference,
const QString &defaultValue = QLatin1String(
""),
const QString &key = QString());
1297 ItemBool *
addItemBool(
const QString &name,
bool &reference,
bool defaultValue =
false,
const QString &key = QString());
1310 ItemInt *
addItemInt(
const QString &name, qint32 &reference, qint32 defaultValue = 0,
const QString &key = QString());
1323 ItemUInt *
addItemUInt(
const QString &name, quint32 &reference, quint32 defaultValue = 0,
const QString &key = QString());
1338#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0)
1342 KCONFIGCORE_DEPRECATED_VERSION(5, 0,
"Use KCoreConfigSkeleton::addItemLongLong(...)")
1343 ItemLongLong *addItemInt64(const QString &name, qint64 &reference, qint64 defaultValue = 0, const QString &key = QString());
1359#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0)
1363 KCONFIGCORE_DEPRECATED_VERSION(5, 0,
"Use KCoreConfigSkeleton::addItemULongLong(...)")
1364 ItemULongLong *addItemUInt64(const QString &name, quint64 &reference, quint64 defaultValue = 0, const QString &key = QString());
1391 ItemRect *
addItemRect(
const QString &name, QRect &reference,
const QRect &defaultValue = QRect(),
const QString &key = QString());
1404 ItemPoint *
addItemPoint(
const QString &name, QPoint &reference,
const QPoint &defaultValue = QPoint(),
const QString &key = QString());
1417 ItemSize *
addItemSize(
const QString &name, QSize &reference,
const QSize &defaultValue = QSize(),
const QString &key = QString());
1430 ItemDateTime *
addItemDateTime(
const QString &name, QDateTime &reference,
const QDateTime &defaultValue = QDateTime(),
const QString &key = QString());
1444 addItemStringList(
const QString &name, QStringList &reference,
const QStringList &defaultValue = QStringList(),
const QString &key = QString());
1457 ItemIntList *
addItemIntList(
const QString &name, QList<int> &reference,
const QList<int> &defaultValue = QList<int>(),
const QString &key = QString());
1483 KConfigSkeletonItem::List
items()
const;
1532#if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0)
1536 KCONFIGCORE_DEPRECATED_VERSION(5, 0,
"Use KCoreConfigSkeleton::save()")
1581#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0)
1586 KCONFIGCORE_DEPRECATED_VERSION(5, 0,
"Override KCoreConfigSkeleton::usrRead()")
1587 virtual
void usrReadConfig();
1590#if KCONFIGCORE_BUILD_DEPRECATED_SINCE(5, 0)
1595 KCONFIGCORE_DEPRECATED_VERSION(5, 0,
"Override KCoreConfigSkeleton::usrSave()")
1596 virtual
bool usrWriteConfig();
1600 KCoreConfigSkeletonPrivate *
const d;
QFlags< WriteConfigFlag > WriteConfigFlags
Stores a combination of #WriteConfigFlag values.
Definition kconfigbase.h:67
Definition kcoreconfigskeleton.h:441
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
void readConfig(KConfig *) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
void readDefault(KConfig *) override
Read global default value.
QVariant maxValue() const override
Return maximum value of item or invalid if not specified.
QVariant minValue() const override
Return minimum value of item or invalid if not specified.
void setDefault() override
Sets the current value to the default value.
void setProperty(const QVariant &p) override
Set item to p.
void swapDefault() override
Exchanges the current value with the default value Used by KCoreConfigSkeleton::useDefaults(bool);.
KConfigCompilerSignallingItem(KConfigSkeletonItem *item, QObject *object, NotifyFunction targetFunction, quint64 userData)
Constructor.
QVariant property() const override
Return item as property.
void writeConfig(KConfig *) override
This function is called by KCoreConfigSkeleton to write the value of this setting to a config file.
A class for one specific group in a KConfig object.
Definition kconfiggroup.h:39
bool hasDefault(const QString &key) const
Whether a default is specified for an entry in either the system wide configuration file or the globa...
void writeEntry(const QString &key, const QVariant &value, WriteConfigFlags pFlags=Normal)
Writes a value to the configuration object.
void revertToDefault(const QString &key)
Reverts an entry to the default settings.
Base class for storing a preferences setting of type T.
Definition kcoreconfigskeleton.h:326
void readDefault(KConfig *config) override
Read global default value.
Definition kcoreconfigskeleton.h:405
KConfigSkeletonGenericItem(const QString &_group, const QString &_key, T &reference, T defaultValue)
Constructor.
Definition kcoreconfigskeleton.h:333
T mDefault
The default value for this item.
Definition kcoreconfigskeleton.h:423
T & value()
Return value of this KConfigSkeletonItem.
Definition kcoreconfigskeleton.h:361
const T & value() const
Return const value of this KConfigSkeletonItem.
Definition kcoreconfigskeleton.h:369
T & mReference
Stores the value for this item.
Definition kcoreconfigskeleton.h:422
virtual void setDefaultValue(const T &v)
Set default value for this item.
Definition kcoreconfigskeleton.h:377
void writeConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to write the value of this setting to a config file.
Definition kcoreconfigskeleton.h:391
void setDefault() override
Set the value for this item to the default value.
Definition kcoreconfigskeleton.h:385
void swapDefault() override
Exchanges the current value with the default value Used by KCoreConfigSkeleton::useDefaults(bool);.
Definition kcoreconfigskeleton.h:414
void setValue(const T &v)
Set value of this KConfigSkeletonItem.
Definition kcoreconfigskeleton.h:353
Class for storing a preferences setting.
Definition kcoreconfigskeleton.h:42
KConfigSkeletonItem(const QString &_group, const QString &_key)
Constructor.
KConfigGroup configGroup(KConfig *config) const
Return a KConfigGroup, the one provided by setGroup(const KConfigGroup&) if it's valid,...
virtual bool isEqual(const QVariant &p) const =0
Check whether the item is equal to p.
bool isImmutable() const
Return if the entry can be modified.
virtual void writeConfig(KConfig *)=0
This function is called by KCoreConfigSkeleton to write the value of this setting to a config file.
QString name() const
Return internal name of entry.
virtual QVariant minValue() const
Return minimum value of item or invalid if not specified.
void readImmutability(const KConfigGroup &group)
Sets mIsImmutable to true if mKey in config is immutable.
void setToolTip(const QString &t)
Set ToolTip description of item.
void setWriteFlags(KConfigBase::WriteConfigFlags flags)
The write flags to be used when writing configuration.
virtual void swapDefault()=0
Exchanges the current value with the default value Used by KCoreConfigSkeleton::useDefaults(bool);.
QString mKey
The config key for this item.
Definition kcoreconfigskeleton.h:252
virtual void readDefault(KConfig *)=0
Read global default value.
QString key() const
Return config file key.
void setGroup(const QString &_group)
Set config file group.
QVariant getDefault() const
Returns the default value.
virtual void setDefault()=0
Sets the current value to the default value.
void setName(const QString &_name)
Set internal name of entry.
void setLabel(const QString &l)
Set label providing a translated one-line description of the item.
QString whatsThis() const
Return WhatsThis description of item.
virtual QVariant maxValue() const
Return maximum value of item or invalid if not specified.
void setGroup(const KConfigGroup &cg)
Set config file group but giving the KConfigGroup.
QString mGroup
The group name for this item.
Definition kcoreconfigskeleton.h:251
QString toolTip() const
Return ToolTip description of item.
QString group() const
Return name of config file group.
KConfigBase::WriteConfigFlags writeFlags() const
Return write flags to be used when writing configuration.
virtual void setProperty(const QVariant &p)=0
Set item to p.
void setKey(const QString &_key)
Set config file key.
virtual void readConfig(KConfig *)=0
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
QString label() const
Return the label of the item.
bool isSaveNeeded() const
Indicates if the item has a different value than the previously loaded value.
void setWhatsThis(const QString &w)
Set WhatsThis description of item.
virtual QVariant property() const =0
Return item as property.
QString mName
The name of this item.
Definition kcoreconfigskeleton.h:253
virtual ~KConfigSkeletonItem()
Destructor.
bool isDefault() const
Indicates if the item is set to its default value.
Class for handling preferences settings for an application.
Definition kconfigskeleton.h:28
The central class of the KDE configuration data system.
Definition kconfig.h:57
void setReadDefaults(bool b)
defaults
Class for handling a bool preferences item.
Definition kcoreconfigskeleton.h:665
QVariant property() const override
Return item as property.
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
ItemBool(const QString &_group, const QString &_key, bool &reference, bool defaultValue=true)
Constructor.
void setProperty(const QVariant &p) override
Set item to p.
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
Class for handling a QDateTime preferences item.
Definition kcoreconfigskeleton.h:1016
void setProperty(const QVariant &p) override
Set item to p.
ItemDateTime(const QString &_group, const QString &_key, QDateTime &reference, const QDateTime &defaultValue=QDateTime())
Constructor.
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
QVariant property() const override
Return item as property.
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
Class for handling a floating point preference item.
Definition kcoreconfigskeleton.h:910
QVariant property() const override
Return item as property.
ItemDouble(const QString &_group, const QString &_key, double &reference, double defaultValue=0)
Constructor.
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
QVariant minValue() const override
Get the minimum value that is allowed to be stored in this item.
void setMinValue(double)
Set the minimum value for the item.
void setProperty(const QVariant &p) override
Set item to p.
void setMaxValue(double)
Set the maximum value for the item.
QVariant maxValue() const override
Get the maximum value this is allowed to be stored in this item.
Class for handling an integer list preferences item.
Definition kcoreconfigskeleton.h:1100
QVariant property() const override
Return item as property.
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
ItemIntList(const QString &_group, const QString &_key, QList< int > &reference, const QList< int > &defaultValue=QList< int >())
Constructor.
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
void setProperty(const QVariant &p) override
Set item to p.
Class for handling a 32-bit integer preferences item.
Definition kcoreconfigskeleton.h:687
void setMaxValue(qint32)
Set the maximum value for the item.
QVariant maxValue() const override
Get the maximum value this is allowed to be stored in this item.
QVariant minValue() const override
Get the minimum value that is allowed to be stored in this item.
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
void setMinValue(qint32)
Set the minimum value for the item.
void setProperty(const QVariant &p) override
Set item to p.
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
ItemInt(const QString &_group, const QString &_key, qint32 &reference, qint32 defaultValue=0)
Constructor.
QVariant property() const override
Return item as property.
Class for handling a 64-bit integer preferences item.
Definition kcoreconfigskeleton.h:733
QVariant maxValue() const override
Get the maximum value this is allowed to be stored in this item.
QVariant property() const override
Return item as property.
void setMaxValue(qint64)
Set the maximum value for the item.
void setProperty(const QVariant &p) override
Set item to p.
ItemLongLong(const QString &_group, const QString &_key, qint64 &reference, qint64 defaultValue=0)
Constructor.
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
void setMinValue(qint64)
Set the minimum value for the item.
QVariant minValue() const override
Get the minimum value that is allowed to be stored in this item.
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
Class for handling a password preferences item.
Definition kcoreconfigskeleton.h:600
ItemPassword(const QString &_group, const QString &_key, QString &reference, const QString &defaultValue=QLatin1String(""))
Constructor.
Class for handling a path list preferences item.
Definition kcoreconfigskeleton.h:1060
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
void writeConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to write the value of this setting to a config file.
ItemPathList(const QString &_group, const QString &_key, QStringList &reference, const QStringList &defaultValue=QStringList())
Constructor.
Class for handling a path preferences item.
Definition kcoreconfigskeleton.h:611
ItemPath(const QString &_group, const QString &_key, QString &reference, const QString &defaultValue=QString())
Constructor.
Class for handling a QPoint preferences item.
Definition kcoreconfigskeleton.h:972
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
ItemPoint(const QString &_group, const QString &_key, QPoint &reference, const QPoint &defaultValue=QPoint())
Constructor.
QVariant property() const override
Return item as property.
void setProperty(const QVariant &p) override
Set item to p.
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
Class for handling a QVariant preferences item.
Definition kcoreconfigskeleton.h:646
QVariant property() const override
Return item as property.
void setProperty(const QVariant &p) override
Set item to p.
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
ItemProperty(const QString &_group, const QString &_key, QVariant &reference, const QVariant &defaultValue=QVariant())
Constructor.
Class for handling a QRect preferences item.
Definition kcoreconfigskeleton.h:950
void setProperty(const QVariant &p) override
Set item to p.
ItemRect(const QString &_group, const QString &_key, QRect &reference, const QRect &defaultValue=QRect())
Constructor.
QVariant property() const override
Return item as property.
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
Class for handling a QSize preferences item.
Definition kcoreconfigskeleton.h:994
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
QVariant property() const override
Return item as property.
void setProperty(const QVariant &p) override
Set item to p.
ItemSize(const QString &_group, const QString &_key, QSize &reference, const QSize &defaultValue=QSize())
Constructor.
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
Class for handling a string list preferences item.
Definition kcoreconfigskeleton.h:1038
ItemStringList(const QString &_group, const QString &_key, QStringList &reference, const QStringList &defaultValue=QStringList())
Constructor.
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
QVariant property() const override
Return item as property.
void setProperty(const QVariant &p) override
Set item to p.
Class for handling a string preferences item.
Definition kcoreconfigskeleton.h:558
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
Type
The type of string that is held in this item.
Definition kcoreconfigskeleton.h:561
@ Path
A path to a file or directory.
Definition kcoreconfigskeleton.h:564
@ Normal
A normal string.
Definition kcoreconfigskeleton.h:562
@ Password
A password string.
Definition kcoreconfigskeleton.h:563
QVariant property() const override
Return item as property.
ItemString(const QString &_group, const QString &_key, QString &reference, const QString &defaultValue=QLatin1String(""), Type type=Normal)
Constructor.
void setProperty(const QVariant &p) override
Set item to p.
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
void writeConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to write the value of this setting to a config file.
Class for handling an unsigned 32-bit integer preferences item.
Definition kcoreconfigskeleton.h:827
ItemUInt(const QString &_group, const QString &_key, quint32 &reference, quint32 defaultValue=0)
Constructor.
QVariant property() const override
Return item as property.
void setMinValue(quint32)
Set the minimum value for the item.
QVariant minValue() const override
Get the minimum value that is allowed to be stored in this item.
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
void setMaxValue(quint32)
Set the maximum value for the item.
void setProperty(const QVariant &p) override
Set item to p.
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
QVariant maxValue() const override
Get the maximum value this is allowed to be stored in this item.
Class for handling unsigned 64-bit integer preferences item.
Definition kcoreconfigskeleton.h:867
QVariant maxValue() const override
Get the maximum value this is allowed to be stored in this item.
ItemULongLong(const QString &_group, const QString &_key, quint64 &reference, quint64 defaultValue=0)
Constructor.
void setMaxValue(quint64)
Set the maximum value for the item.
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
void setProperty(const QVariant &p) override
Set item to p.
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
void setMinValue(quint64)
Set the minimum value for the item.
QVariant property() const override
Return item as property.
QVariant minValue() const override
Get the minimum value that is allowed to be stored in this item.
Class for handling a url list preferences item.
Definition kcoreconfigskeleton.h:1075
void setProperty(const QVariant &p) override
Set item to p.
void writeConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to write the value of this setting to a config file.
QVariant property() const override
Return item as property.
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
ItemUrlList(const QString &_group, const QString &_key, QList< QUrl > &reference, const QList< QUrl > &defaultValue=QList< QUrl >())
Constructor.
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
Class for handling a url preferences item.
Definition kcoreconfigskeleton.h:621
void setProperty(const QVariant &p) override
Set item to p.
void readConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
QVariant property() const override
Return item as property.
void writeConfig(KConfig *config) override
This function is called by KCoreConfigSkeleton to write the value of this setting to a config file.
ItemUrl(const QString &_group, const QString &_key, QUrl &reference, const QUrl &defaultValue=QUrl())
Constructor.
bool isEqual(const QVariant &p) const override
Check whether the item is equal to p.
Class for handling preferences settings for an application.
Definition kcoreconfigskeleton.h:551
virtual bool usrUseDefaults(bool b)
Implemented by subclasses that use special defaults.
ItemDouble * addItemDouble(const QString &name, double &reference, double defaultValue=0.0, const QString &key=QString())
Register an item of type double.
virtual void setDefaults()
Set all registered items to their default values.
virtual bool usrSave()
Perform the actual writing of the configuration file.
void load()
Read preferences from config file.
QString currentGroup() const
Returns the current group used for addItem() calls.
void setSharedConfig(KSharedConfig::Ptr pConfig)
Set the KSharedConfig object used for reading and writing the settings.
ItemProperty * addItemProperty(const QString &name, QVariant &reference, const QVariant &defaultValue=QVariant(), const QString &key=QString())
Register a property item of type QVariant.
ItemLongLong * addItemLongLong(const QString &name, qint64 &reference, qint64 defaultValue=0, const QString &key=QString())
Register an item of type qint64.
KSharedConfig::Ptr sharedConfig() const
Return the KConfig object used for reading and writing the settings.
ItemStringList * addItemStringList(const QString &name, QStringList &reference, const QStringList &defaultValue=QStringList(), const QString &key=QString())
Register an item of type QStringList.
ItemInt * addItemInt(const QString &name, qint32 &reference, qint32 defaultValue=0, const QString &key=QString())
Register an item of type qint32.
void configChanged()
This signal is emitted when the configuration change.
bool isSaveNeeded() const
Indicates if any registered item has a different value than the previously loaded value.
ItemIntList * addItemIntList(const QString &name, QList< int > &reference, const QList< int > &defaultValue=QList< int >(), const QString &key=QString())
Register an item of type QList<int>.
ItemPoint * addItemPoint(const QString &name, QPoint &reference, const QPoint &defaultValue=QPoint(), const QString &key=QString())
Register an item of type QPoint.
ItemULongLong * addItemULongLong(const QString &name, quint64 &reference, quint64 defaultValue=0, const QString &key=QString())
Register an item of type quint64.
KConfigSkeletonItem * findItem(const QString &name) const
Lookup item by name.
ItemUInt * addItemUInt(const QString &name, quint32 &reference, quint32 defaultValue=0, const QString &key=QString())
Register an item of type quint32.
ItemSize * addItemSize(const QString &name, QSize &reference, const QSize &defaultValue=QSize(), const QString &key=QString())
Register an item of type QSize.
void removeItem(const QString &name)
Removes and deletes an item by name.
ItemRect * addItemRect(const QString &name, QRect &reference, const QRect &defaultValue=QRect(), const QString &key=QString())
Register an item of type QRect.
KConfig * config()
Return the KConfig object used for reading and writing the settings.
ItemDateTime * addItemDateTime(const QString &name, QDateTime &reference, const QDateTime &defaultValue=QDateTime(), const QString &key=QString())
Register an item of type QDateTime.
KCoreConfigSkeleton(const QString &configname=QString(), QObject *parent=nullptr)
Constructor.
KConfigSkeletonItem::List items() const
Return list of items managed by this KCoreConfigSkeleton object.
ItemPassword * addItemPassword(const QString &name, QString &reference, const QString &defaultValue=QLatin1String(""), const QString &key=QString())
Register a password item of type QString.
void clearItems()
Removes and deletes all items.
bool isImmutable(const QString &name) const
Return whether a certain item is immutable.
~KCoreConfigSkeleton() override
Destructor.
bool save()
Write preferences to config file.
virtual void usrRead()
Perform the actual reading of the configuration file.
const KConfig * config() const
Return the KConfig object used for reading and writing the settings.
ItemPath * addItemPath(const QString &name, QString &reference, const QString &defaultValue=QLatin1String(""), const QString &key=QString())
Register a path item of type QString.
void read()
Read preferences from the KConfig object.
KCoreConfigSkeleton(KSharedConfig::Ptr config, QObject *parent=nullptr)
Constructor.
void addItem(KConfigSkeletonItem *item, const QString &name=QString())
Register a custom KConfigSkeletonItem item with a given name.
ItemString * addItemString(const QString &name, QString &reference, const QString &defaultValue=QLatin1String(""), const QString &key=QString())
Register an item of type QString.
virtual bool useDefaults(bool b)
Specify whether this object should reflect the actual values or the default values.
bool isDefaults() const
Indicates if all the registered items are set to their default value.
ItemBool * addItemBool(const QString &name, bool &reference, bool defaultValue=false, const QString &key=QString())
Register an item of type bool.
virtual void usrSetDefaults()
Perform the actual setting of default values.
void setCurrentGroup(const QString &group)
Set the config file group for subsequent addItem() calls.
Class for proxying a QObject property as a preferences setting.
Definition kcoreconfigskeleton.h:281
bool isEqual(const QVariant &p) const override
void setDefault() override
Sets the current value to the default value.
QVariant property() const override
Return item as property.
KPropertySkeletonItem(QObject *object, const QByteArray &propertyName, const QVariant &defaultValue)
Constructor.
void setNotifyFunction(const std::function< void()> &impl)
Set a notify function, it will be invoked when the value of the property changes.
void swapDefault() override
Exchanges the current value with the default value Used by KCoreConfigSkeleton::useDefaults(bool);.
void readConfig(KConfig *) override
This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.
void writeConfig(KConfig *) override
This function is called by KCoreConfigSkeleton to write the value of this setting to a config file.
void setProperty(const QVariant &p) override
Set item to p.
void readDefault(KConfig *) override
Read global default value.