23 #ifndef _TDECONFIGSKELETON_H
24 #define _TDECONFIGSKELETON_H
27 #include <tqdatetime.h>
30 #include <tqptrlist.h>
34 #include <tqstringlist.h>
35 #include <tqvariant.h>
36 #include <tdeconfig.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;
280 if ( mReference != mLoadedValue )
283 if ((mDefault == mReference) && !config->
hasDefault( mKey))
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(
""),
384 void setProperty(
const TQVariant & p);
385 TQVariant property()
const;
397 ItemPassword(
const TQString & group,
const TQString & key,
398 TQString & reference,
399 const TQString & defaultValue = TQString::fromLatin1(
""));
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);
424 void setProperty(
const TQVariant & p);
425 TQVariant property()
const;
432 class TDECORE_EXPORT
ItemBool:
public TDEConfigSkeletonGenericItem < bool >
435 ItemBool(
const TQString & group,
const TQString & key,
bool & reference,
436 bool defaultValue =
true);
439 void setProperty(
const TQVariant & p);
440 TQVariant property()
const;
447 class TDECORE_EXPORT
ItemInt:
public TDEConfigSkeletonGenericItem < int >
450 ItemInt(
const TQString & group,
const TQString & key,
int &reference,
451 int defaultValue = 0);
454 void setProperty(
const TQVariant & p);
455 TQVariant property()
const;
456 TQVariant minValue()
const;
457 TQVariant maxValue()
const;
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);
479 void setProperty(
const TQVariant & p);
480 TQVariant property()
const;
482 TQVariant minValue()
const;
483 TQVariant maxValue()
const;
485 void setMinValue(TQ_INT64);
486 void setMaxValue(TQ_INT64);
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);
531 void setProperty(
const TQVariant & p);
532 TQVariant property()
const;
533 TQVariant minValue()
const;
534 TQVariant maxValue()
const;
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);
557 void setProperty(
const TQVariant & p);
558 TQVariant property()
const;
559 TQVariant minValue()
const;
560 TQVariant maxValue()
const;
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);
583 void setProperty(
const TQVariant & p);
584 TQVariant property()
const;
585 TQVariant minValue()
const;
586 TQVariant maxValue()
const;
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);
608 void setProperty(
const TQVariant & p);
609 TQVariant property()
const;
611 TQVariant minValue()
const;
612 TQVariant maxValue()
const;
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);
634 void setProperty(
const TQVariant & p);
635 TQVariant property()
const;
636 TQVariant minValue()
const;
637 TQVariant maxValue()
const;
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));
661 void setProperty(
const TQVariant & p);
662 TQVariant property()
const;
669 class TDECORE_EXPORT
ItemFont:
public TDEConfigSkeletonGenericItem < TQFont >
672 ItemFont(
const TQString & group,
const TQString & key, TQFont & reference,
676 void setProperty(
const TQVariant & p);
677 TQVariant property()
const;
684 class TDECORE_EXPORT
ItemRect:
public TDEConfigSkeletonGenericItem < TQRect >
687 ItemRect(
const TQString & group,
const TQString & key, TQRect & reference,
688 const TQRect & defaultValue = TQRect());
691 void setProperty(
const TQVariant & p);
692 TQVariant property()
const;
699 class TDECORE_EXPORT
ItemPoint:
public TDEConfigSkeletonGenericItem < TQPoint >
702 ItemPoint(
const TQString & group,
const TQString & key, TQPoint & reference,
703 const TQPoint & defaultValue = TQPoint());
706 void setProperty(
const TQVariant & p);
707 TQVariant property()
const;
714 class TDECORE_EXPORT
ItemSize:
public TDEConfigSkeletonGenericItem < TQSize >
717 ItemSize(
const TQString & group,
const TQString & key, TQSize & reference,
718 const TQSize & defaultValue = TQSize());
721 void setProperty(
const TQVariant & p);
722 TQVariant property()
const;
729 class TDECORE_EXPORT
ItemDateTime:
public TDEConfigSkeletonGenericItem < TQDateTime >
732 ItemDateTime(
const TQString & group,
const TQString & key,
733 TQDateTime & reference,
734 const TQDateTime & defaultValue = TQDateTime());
737 void setProperty(
const TQVariant & p);
738 TQVariant property()
const;
745 class TDECORE_EXPORT
ItemStringList:
public TDEConfigSkeletonGenericItem < TQStringList >
749 TQStringList & reference,
750 const TQStringList & defaultValue = TQStringList());
753 void setProperty(
const TQVariant & p);
754 TQVariant property()
const;
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 >());
784 void setProperty(
const TQVariant & p);
785 TQVariant property()
const;
832 void setCurrentGroup(
const TQString & group);
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;
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.
Class for handling a bool preferences item.
Class for handling a color preferences item.
Class for handling a TQDateTime preferences item.
Class for handling a floating point preference item.
Class for handling a font preferences item.
Class for handling an 64-bit integer preferences item.
Class for handling an integer list preferences item.
Class for handling an integer preferences item.
Class for hanlding a long integer preferences item.
Class for handling a password preferences item.
Class for handling a path list preferences item.
Class for handling a path preferences item.
Class for handling a TQPoint preferences item.
Class for handling a TQVariant preferences item.
Class for handling a TQRect preferences item.
Class for handling a TQSize preferences item.
Class for handling a string list preferences item.
Class for handling a string preferences item.
Class for handling unsigned 64-bit integer preferences item.
Class for handling an unsingend integer preferences item.
Class for handling an unsigned long integer preferences item.
Class for handling preferences settings for an application.
TQString currentGroup()
Returns the current group used for addItem() calls.
virtual void usrUseDefaults(bool)
Implemented by subclasses that use special defaults.
TDEConfigSkeletonItem::List items() const
Return list of items managed by this TDEConfigSkeleton object.
virtual void usrWriteConfig()
Implemented by subclasses that write special config values.
virtual void usrReadConfig()
Implemented by subclasses that read special config values.
virtual ~ TDEConfigSkeleton()
Destructor.
Access KDE Configuration entries.
static TQFont generalFont()
Returns the default general font.