23#ifndef _TDECONFIGSKELETON_H
24#define _TDECONFIGSKELETON_H
27#include <tqdatetime.h>
34#include <tqstringlist.h>
37#include <tdeglobalsettings.h>
53 typedef TQValueList < TDEConfigSkeletonItem * >List;
54 typedef TQDict < TDEConfigSkeletonItem > Dict;
55 typedef TQDictIterator < TDEConfigSkeletonItem > DictIterator;
64 :mGroup(
group),mKey(
key), mIsImmutable(true)
186 virtual TQVariant
minValue()
const {
return TQVariant(); }
191 virtual TQVariant
maxValue()
const {
return TQVariant(); }
217 void readImmutability(
TDEConfig *config);
234 TDEConfigSkeletonGenericItem(
const TQString &
group,
const TQString &
key, T & reference,
237 mDefault(defaultValue), mLoadedValue(defaultValue)
244 void setValue(
const T & v)
260 const T & value()
const
268 virtual void setDefaultValue(
const T &v )
275 mReference = mDefault;
278 virtual void writeConfig(TDEConfig * config)
280 if ( mReference != mLoadedValue )
283 if ((mDefault == mReference) && !config->
hasDefault( mKey))
290 void readDefault(TDEConfig * config)
295 mDefault = mReference;
301 mReference = mDefault;
372 class TDECORE_EXPORT ItemString:
public TDEConfigSkeletonGenericItem < TQString >
375 enum Type { Normal, Password, Path };
377 ItemString(
const TQString &
group,
const TQString &
key,
378 TQString & reference,
379 const TQString & defaultValue = TQString::fromLatin1(
""),
394 class TDECORE_EXPORT ItemPassword:
public ItemString
397 ItemPassword(
const TQString &
group,
const TQString &
key,
398 TQString & reference,
399 const TQString & defaultValue = TQString::fromLatin1(
""));
405 class TDECORE_EXPORT ItemPath:
public ItemString
408 ItemPath(
const TQString &
group,
const TQString &
key,
409 TQString & reference,
410 const TQString & defaultValue = TQString::null);
417 class TDECORE_EXPORT ItemProperty:
public TDEConfigSkeletonGenericItem < TQVariant >
420 ItemProperty(
const TQString &
group,
const TQString &
key,
421 TQVariant & reference, TQVariant defaultValue = 0);
432 class TDECORE_EXPORT ItemBool:
public TDEConfigSkeletonGenericItem < bool >
435 ItemBool(
const TQString &
group,
const TQString &
key,
bool & reference,
436 bool defaultValue =
true);
447 class TDECORE_EXPORT ItemInt:
public TDEConfigSkeletonGenericItem < int >
450 ItemInt(
const TQString &
group,
const TQString &
key,
int &reference,
451 int defaultValue = 0);
459 void setMinValue(
int);
460 void setMaxValue(
int);
472 class TDECORE_EXPORT ItemInt64:
public TDEConfigSkeletonGenericItem < TQ_INT64 >
475 ItemInt64(
const TQString &
group,
const TQString &
key, TQ_INT64 &reference,
476 TQ_INT64 defaultValue = 0);
485 void setMinValue(TQ_INT64);
486 void setMaxValue(TQ_INT64);
498 class TDECORE_EXPORT ItemEnum:
public ItemInt
508 ItemEnum(
const TQString &
group,
const TQString &
key,
int &reference,
509 const TQValueList<Choice> &choices,
int defaultValue = 0);
511 TQValueList<Choice> choices()
const;
517 TQValueList<Choice> mChoices;
524 class TDECORE_EXPORT ItemUInt:
public TDEConfigSkeletonGenericItem < unsigned int >
527 ItemUInt(
const TQString &
group,
const TQString &
key,
528 unsigned int &reference,
unsigned int defaultValue = 0);
536 void setMinValue(
unsigned int);
537 void setMaxValue(
unsigned int);
550 class TDECORE_EXPORT ItemLong:
public TDEConfigSkeletonGenericItem < long >
553 ItemLong(
const TQString &
group,
const TQString &
key,
long &reference,
554 long defaultValue = 0);
562 void setMinValue(
long);
563 void setMaxValue(
long);
576 class TDECORE_EXPORT ItemULong:
public TDEConfigSkeletonGenericItem < unsigned long >
579 ItemULong(
const TQString &
group,
const TQString &
key,
580 unsigned long &reference,
unsigned long defaultValue = 0);
588 void setMinValue(
unsigned long);
589 void setMaxValue(
unsigned long);
601 class TDECORE_EXPORT ItemUInt64:
public TDEConfigSkeletonGenericItem < TQ_UINT64 >
604 ItemUInt64(
const TQString &
group,
const TQString &
key, TQ_UINT64 &reference,
605 TQ_UINT64 defaultValue = 0);
614 void setMinValue(TQ_UINT64);
615 void setMaxValue(TQ_UINT64);
627 class TDECORE_EXPORT ItemDouble:
public TDEConfigSkeletonGenericItem < double >
630 ItemDouble(
const TQString &
group,
const TQString &
key,
631 double &reference,
double defaultValue = 0);
639 void setMinValue(
double);
640 void setMaxValue(
double);
653 class TDECORE_EXPORT ItemColor:
public TDEConfigSkeletonGenericItem < TQColor >
656 ItemColor(
const TQString &
group,
const TQString &
key,
658 const TQColor & defaultValue = TQColor(128, 128, 128));
669 class TDECORE_EXPORT ItemFont:
public TDEConfigSkeletonGenericItem < TQFont >
672 ItemFont(
const TQString &
group,
const TQString &
key, TQFont & reference,
684 class TDECORE_EXPORT ItemRect:
public TDEConfigSkeletonGenericItem < TQRect >
687 ItemRect(
const TQString &
group,
const TQString &
key, TQRect & reference,
688 const TQRect & defaultValue = TQRect());
699 class TDECORE_EXPORT ItemPoint:
public TDEConfigSkeletonGenericItem < TQPoint >
702 ItemPoint(
const TQString &
group,
const TQString &
key, TQPoint & reference,
703 const TQPoint & defaultValue = TQPoint());
714 class TDECORE_EXPORT ItemSize:
public TDEConfigSkeletonGenericItem < TQSize >
717 ItemSize(
const TQString &
group,
const TQString &
key, TQSize & reference,
718 const TQSize & defaultValue = TQSize());
729 class TDECORE_EXPORT ItemDateTime:
public TDEConfigSkeletonGenericItem < TQDateTime >
732 ItemDateTime(
const TQString &
group,
const TQString &
key,
733 TQDateTime & reference,
734 const TQDateTime & defaultValue = TQDateTime());
745 class TDECORE_EXPORT ItemStringList:
public TDEConfigSkeletonGenericItem < TQStringList >
748 ItemStringList(
const TQString &
group,
const TQString &
key,
749 TQStringList & reference,
750 const TQStringList & defaultValue = TQStringList());
761 class TDECORE_EXPORT ItemPathList:
public ItemStringList
764 ItemPathList(
const TQString &
group,
const TQString &
key,
765 TQStringList & reference,
766 const TQStringList & defaultValue = TQStringList());
776 class TDECORE_EXPORT ItemIntList:
public TDEConfigSkeletonGenericItem < TQValueList < int > >
779 ItemIntList(
const TQString &
group,
const TQString &
key,
780 TQValueList < int >&reference,
781 const TQValueList < int >&defaultValue = TQValueList < int >());
808 virtual ~ TDEConfigSkeleton();
839 return mCurrentGroup;
861 ItemString *addItemString(
const TQString & name, TQString & reference,
862 const TQString & defaultValue = TQString::fromLatin1(
""),
863 const TQString & key = TQString::null);
878 ItemPassword *addItemPassword(
const TQString & name, TQString & reference,
879 const TQString & defaultValue = TQString::fromLatin1(
""),
880 const TQString & key = TQString::null);
895 ItemPath *addItemPath(
const TQString & name, TQString & reference,
896 const TQString & defaultValue = TQString::fromLatin1(
""),
897 const TQString & key = TQString::null);
912 ItemProperty *addItemProperty(
const TQString & name, TQVariant & reference,
913 const TQVariant & defaultValue = TQVariant(),
914 const TQString & key = TQString::null);
926 ItemBool *addItemBool(
const TQString & name,
bool & reference,
927 bool defaultValue =
false,
928 const TQString & key = TQString::null);
941 ItemInt *addItemInt(
const TQString & name,
int &reference,
int defaultValue = 0,
942 const TQString & key = TQString::null);
955 ItemUInt *addItemUInt(
const TQString & name,
unsigned int &reference,
956 unsigned int defaultValue = 0,
957 const TQString & key = TQString::null);
970 ItemLong *addItemLong(
const TQString & name,
long &reference,
971 long defaultValue = 0,
972 const TQString & key = TQString::null);
985 ItemULong *addItemULong(
const TQString & name,
unsigned long &reference,
986 unsigned long defaultValue = 0,
987 const TQString & key = TQString::null);
1000 ItemInt64 *addItemInt64(
const TQString & name, TQ_INT64 &reference,
1001 TQ_INT64 defaultValue = 0,
1002 const TQString & key = TQString::null);
1015 ItemUInt64 *addItemUInt64(
const TQString & name, TQ_UINT64 &reference,
1016 TQ_UINT64 defaultValue = 0,
1017 const TQString & key = TQString::null);
1030 ItemDouble *addItemDouble(
const TQString & name,
double &reference,
1031 double defaultValue = 0.0,
1032 const TQString & key = TQString::null);
1045 ItemColor *addItemColor(
const TQString & name, TQColor & reference,
1046 const TQColor & defaultValue = TQColor(128, 128, 128),
1047 const TQString & key = TQString::null);
1060 ItemFont *addItemFont(
const TQString & name, TQFont & reference,
1061 const TQFont & defaultValue =
1063 const TQString & key = TQString::null);
1076 ItemRect *addItemRect(
const TQString & name, TQRect & reference,
1077 const TQRect & defaultValue = TQRect(),
1078 const TQString & key = TQString::null);
1091 ItemPoint *addItemPoint(
const TQString & name, TQPoint & reference,
1092 const TQPoint & defaultValue = TQPoint(),
1093 const TQString & key = TQString::null);
1106 ItemSize *addItemSize(
const TQString & name, TQSize & reference,
1107 const TQSize & defaultValue = TQSize(),
1108 const TQString & key = TQString::null);
1121 ItemDateTime *addItemDateTime(
const TQString & name, TQDateTime & reference,
1122 const TQDateTime & defaultValue = TQDateTime(),
1123 const TQString & key = TQString::null);
1136 ItemStringList *addItemStringList(
const TQString & name, TQStringList & reference,
1137 const TQStringList & defaultValue = TQStringList(),
1138 const TQString & key = TQString::null);
1151 ItemIntList *addItemIntList(
const TQString & name, TQValueList < int >&reference,
1152 const TQValueList < int >&defaultValue =
1153 TQValueList < int >(),
1154 const TQString & key = TQString::null);
1164 TDEConfigSkeletonItem::List
items()
const
1172 bool isImmutable(
const TQString & name);
1185 bool useDefaults(
bool b);
1197 virtual void usrSetDefaults()
1216 TQString mCurrentGroup;
1218 TDESharedConfig::Ptr mConfig;
1220 TDEConfigSkeletonItem::List mItems;
1221 TDEConfigSkeletonItem::Dict mItemDict;
bool hasDefault(const TQString &key) const
Returns whether a default is specified for an entry in either the system wide configuration file or t...
void setReadDefaults(bool b)
When set, all readEntry and readXXXEntry calls return the system wide (default) values instead of the...
void revertToDefault(const TQString &key)
Reverts the entry with key key in the current group in the application specific config file to either...
void writeEntry(const TQString &pKey, const TQString &pValue, bool bPersistent=true, bool bGlobal=false, bool bNLS=false)
Writes a key/value pair.
void setGroup(const TQString &group)
Specifies the group in which keys will be read and written.
Class for storing a preferences setting.
virtual ~TDEConfigSkeletonItem()
Destructor.
virtual void readConfig(TDEConfig *)=0
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
virtual void setProperty(const TQVariant &p)=0
Set item to p.
void setKey(const TQString &key)
Set config file key.
virtual TQVariant maxValue() const
Return maximum value of item or invalid if not specified.
TQString label() const
Return label of item.
virtual void setDefault()=0
Sets the current value to the default value.
void setGroup(const TQString &group)
Set config file group.
void setName(const TQString &name)
Set internal name of entry.
virtual TQVariant property() const =0
Return item as property.
virtual void writeConfig(TDEConfig *)=0
This function is called by TDEConfigSkeleton to write the value of this setting to a config file.
TQString whatsThis() const
Return WhatsThis description of item.
TQString group() const
Return config file group.
bool isImmutable() const
Return if the entry can be modified.
void setWhatsThis(const TQString &w)
Set WhatsThis description og item.
virtual void readDefault(TDEConfig *)=0
Read global default value.
virtual void swapDefault()=0
Exchanges the current value with the default value Used by TDEConfigSkeleton::useDefaults(bool);.
TQString name() const
Return internal name of entry.
TDEConfigSkeletonItem(const TQString &group, const TQString &key)
Constructor.
TQString key() const
Return config file key.
virtual TQVariant minValue() const
Return minimum value of item or invalid if not specified.
void setLabel(const TQString &l)
Set label providing a translated one-line description of the item.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
TQVariant property() const
Return item as property.
void setProperty(const TQVariant &p)
Set item to p.
TQVariant property() const
Return item as property.
void setProperty(const TQVariant &p)
Set item to p.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
TQVariant property() const
Return item as property.
void setProperty(const TQVariant &p)
Set item to p.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
TQVariant property() const
Return item as property.
TQVariant minValue() const
Return minimum value of item or invalid if not specified.
TQVariant maxValue() const
Return maximum value of item or invalid if not specified.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
void setProperty(const TQVariant &p)
Set item to p.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
TQVariant property() const
Return item as property.
void setProperty(const TQVariant &p)
Set item to p.
TQVariant maxValue() const
Return maximum value of item or invalid if not specified.
TQVariant minValue() const
Return minimum value of item or invalid if not specified.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
TQVariant property() const
Return item as property.
void setProperty(const TQVariant &p)
Set item to p.
TQVariant property() const
Return item as property.
void setProperty(const TQVariant &p)
Set item to p.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
TQVariant minValue() const
Return minimum value of item or invalid if not specified.
TQVariant property() const
Return item as property.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
TQVariant maxValue() const
Return maximum value of item or invalid if not specified.
void setProperty(const TQVariant &p)
Set item to p.
void setProperty(const TQVariant &p)
Set item to p.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
TQVariant maxValue() const
Return maximum value of item or invalid if not specified.
TQVariant minValue() const
Return minimum value of item or invalid if not specified.
TQVariant property() const
Return item as property.
void writeConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to write the value of this setting to a config file.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
void setProperty(const TQVariant &p)
Set item to p.
TQVariant property() const
Return item as property.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
TQVariant property() const
Return item as property.
void setProperty(const TQVariant &p)
Set item to p.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
void setProperty(const TQVariant &p)
Set item to p.
TQVariant property() const
Return item as property.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
void setProperty(const TQVariant &p)
Set item to p.
TQVariant property() const
Return item as property.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
void setProperty(const TQVariant &p)
Set item to p.
TQVariant property() const
Return item as property.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
void writeConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to write the value of this setting to a config file.
TQVariant property() const
Return item as property.
void setProperty(const TQVariant &p)
Set item to p.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
TQVariant maxValue() const
Return maximum value of item or invalid if not specified.
TQVariant minValue() const
Return minimum value of item or invalid if not specified.
void setProperty(const TQVariant &p)
Set item to p.
TQVariant property() const
Return item as property.
void setProperty(const TQVariant &p)
Set item to p.
TQVariant maxValue() const
Return maximum value of item or invalid if not specified.
TQVariant minValue() const
Return minimum value of item or invalid if not specified.
TQVariant property() const
Return item as property.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
TQVariant maxValue() const
Return maximum value of item or invalid if not specified.
void setProperty(const TQVariant &p)
Set item to p.
TQVariant minValue() const
Return minimum value of item or invalid if not specified.
TQVariant property() const
Return item as property.
void readConfig(TDEConfig *config)
This function is called by TDEConfigSkeleton to read the value for this setting from a config file.
TQString currentGroup()
Returns the current group used for addItem() calls.
void readConfig()
Read preferences from config file.
virtual void usrUseDefaults(bool)
Implemented by subclasses that use special defaults.
TDEConfigSkeletonItem::List items() const
Return list of items managed by this TDEConfigSkeleton object.
void setDefaults()
Set all registered items to their default values.
virtual void usrWriteConfig()
Implemented by subclasses that write special config values.
void writeConfig()
Write preferences to config file.
void setCurrentGroup(const TQString &group)
Set the config file group for subsequent addItem() calls.
TDEConfig * config() const
Return the TDEConfig object used for reading and writing the settings.
virtual void usrReadConfig()
Implemented by subclasses that read special config values.
TDEConfigSkeleton(const TQString &configname=TQString::null)
Constructor.
Access KDE Configuration entries.
static TQFont generalFont()
Returns the default general font.