class KConfigBaseabstract class |
|
|
KDE Configuration Management abstract base class This class forms the base for all %KDE configuration. It is an abstract base class, meaning that you cannot directly instantiate objects of this class. Either use KConfig (for usual %KDE configuration) or even KSharedConfig (stores values in shared memory). All configuration entries are key, value pairs. Each entry also belongs to a specific group of related entries. All configuration entries that do not explicitly specify which group they are in are in a special group called the default group. If there is a $ character in an entry, KConfigBase tries to expand environment variable and uses its value instead of its name. You can avoid this feature by having two consecutive $ characters in your config file which get expanded to one. the '=' char is not allowed in keys and the ']' char is not allowed in a group name.
Author Kalle Dalheimer See also KConfig See also KSharedConfig |
|
Construct a KConfigBase object. |
|
Construct a KConfigBase object. |
|
Returns the backend associated with this config object |
|
Check whether the config files are writable. warnUser - Warn the user if the configuration files are not writable. Returns Indicates that all of the configuration files used are writable. |
|
|
Deletes the entry specified by pKey in the current group.
pKey - The key to delete. pFlags - The flags to use when deleting this entry. |
|
Deletes the entry specified by pKey in the current group.
pKey - The key to delete. pFlags - The flags to use when deleting this entry. |
|
Deletes a configuration entry group If the group is not empty and Recursive is not set, nothing gets deleted If this group is the current group and it is deleted, the current group is undefined and should be set with setGroup() before the next operation on the configuration object.
group - The name of the group pFlags - The flags to use when writing this entry. |
|
Checks whether it is possible to change the given entry. key - the key to check Returns whether the entry key may be changed in the current group in this configuration file. |
|
Returns a map (tree) of entries for all entries in a particular group. Only the actual entry string is returned, none of the other internal data should be included.
group - A group to get keys from. Returns A map of entries in the group specified, indexed by key. The returned map may be empty if the group is not found. See also QMap |
|
Returns the state of the app-config object. Possible return values are NoAccess (the application-specific config file could not be opened neither read-write nor read-only), ReadOnly (the application-specific config file is opened read-only, but not read-write) and ReadWrite (the application-specific config file is opened read-write). See also ConfigState() Returns the state of the app-config object |
|
Returns the name of the group in which we are searching for keys and from which we are retrieving entries. Returns The current group. |
|
Checks whether it is possible to change the given group. group - the group to check Returns whether changes may be made to group in this configuration file. |
|
Returns a list of groups that are known about. Returns The list of groups.
|
|
Returns whether a default is specified for an entry in either the system wide configuration file or the global KDE config file. If an application computes a default value at runtime for a certain entry, e.g. like: QColor computedDefault = qApp->palette().color(QPalette.Active, QPalette.Text) QColor color = config->readEntry(key, computedDefault); Then it may wish to make the following check before writing back changes: if ( (value == computedDefault) && !config->hasDefault(key) ) config->revertToDefault(key) else config->writeEntry(key, value) This ensures that as long as the entry is not modified to differ from the computed default, the application will keep using the computed default and will follow changes the computed default makes over time. key - The key of the entry to check. |
|
Returns true if the specified group is known about.
group - The group to search for. Returns true if the group exists. |
|
|
|
Checks whether the key has an entry in the currently active group. Use this to determine whether a key is not specified for the current group (hasKey() returns false). Keys with null data are considered nonexistent.
key - The key to search for. Returns If true, the key is available. |
|
|
Returns a map (tree) of the entries in the specified group. This may or may not return all entries that belong to the config object. The only guarantee that you are given is that any entries that are dirty (i.e. modified and not yet written back to the disk) will be contained in the map. Some derivative classes may choose to return everything. Do not use this function, the implementation / return type are subject to change.
pGroup - The group to provide a KEntryMap for. Returns The map of the entries in the group. Internal |
|
Returns a map (tree) of the entries in the tree. Do not use this function, the implementation / return type are subject to change. Returns A map of the entries in the tree. Internal
|
|
|
Internal |
|
Checks whether the config file has any dirty (modified) entries. Returns true if the config file has any dirty (modified) entries. |
|
Returns whether dollar expansion is on or off. It is initially OFF. Returns true if dollar expansion is on. |
|
Checks whether this configuration file can be modified. Returns whether changes may be made to this configuration file. |
|
Returns a the current locale. Returns A string representing the current locale. |
|
Returns whether the locale has been set. Returns true if the locale has been initialized |
|
Looks up an entry in the config object's internal structure. Classes that derive from KConfigBase will need to implement this method in a storage-specific manner. Do not use this function, the implementation and return type are subject to change.
_key - The key to look up It contains information both on the group of the key and the entry's key itself. Returns The KEntry value (data) found for the key. KEntry.aValue will be the null string if nothing was located. Internal |
|
Parses all configuration files for a configuration object. The actual parsing is done by the associated KConfigBackEnd. |
|
Inserts a (key/value) pair into the internal storage mechanism of the configuration object. Classes that derive from KConfigBase will need to implement this method in a storage-specific manner. Do not use this function, the implementation / return type are subject to change.
_key - The key to insert. It contains information both on the group of the key and the key itself. If the key already exists, the old value will be replaced. _data - the KEntry that is to be stored. _checkGroup - When false, assume that the group already exists. Internal |
|
Reads a boolean entry. Read the value of an entry specified by pKey in the current group and interpret it as a boolean value. Currently "on", "yes", "1" and "true" are accepted as true, everything else if false.
pKey - The key to search for bDefault - A default value returned if the key was not found. Returns The value for this key. Deprecated |
|
Reads a boolean entry. Read the value of an entry specified by pKey in the current group and interpret it as a boolean value. Currently "on", "yes", "1" and "true" are accepted as true, everything else if false.
pKey - The key to search for bDefault - A default value returned if the key was not found. Returns The value for this key. Deprecated |
|
Reads a QDateTime entry. Read the value of an entry specified by pKey in the current group and interpret it as a date and time.
pKey - The key to search for. pDefault - A default value ( currentDateTime() by default) returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reads a QDateTime entry. Read the value of an entry specified by pKey in the current group and interpret it as a date and time.
pKey - The key to search for. pDefault - A default value ( currentDateTime() by default) returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Returns true if all readEntry and readXXXEntry calls return the system wide (default) values instead of the user's preference. |
|
Reads a floating point value. Read the value of an entry specified by pKey in the current group and interpret it numerically.
pKey - The key to search for. nDefault - A default value returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reads a floating point value. Read the value of an entry specified by pKey in the current group and interpret it numerically.
pKey - The key to search for. nDefault - A default value returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reads the value of an entry specified by pKey in the current group.
pKey - The key to search for. aDefault - A default value returned if the key was not found. Returns The value for this key. Can be QString() if aDefault is null. |
|
Reads a list of strings from the config object. pKey - The key to search for. aDefault - The default value to use if the key does not exist. sep - The list separator. Returns The list. Contains aDefault if pKey does not exist. |
|
Reads a list of strings, but returns a default if the key did not exist. readEntry(const char*, const QStringList&, char) const |
|
Reads the value of an entry specified by pKey in the current group. The untranslated entry is returned, you normally do not need this.
pKey - The key to search for. aDefault - A default value returned if the key was not found. Returns The value for this key. |
|
Reads the value of an entry specified by pKey in the current group. The untranslated entry is returned, you normally do not need this.
pKey - The key to search for. aDefault - A default value returned if the key was not found. Returns The value for this key. |
|
Reads a list of Integers.
pKey - The key to search for.
Returns The list. Empty if the entry does not exist.
Deprecated use readEntry(const QString&, const QList |
|
Reads a list of Integers.
pKey - The key to search for.
Returns The list. Empty if the entry does not exist.
Deprecated use readEntry(const char*, const QList |
|
Reads a list of strings.
pKey - The key to search for. sep - The list separator (default is ","). Returns The list. Empty if the entry does not exist. Deprecated use readEntry( const QString&, const QStringList&, char) const instead. |
|
Reads a list of strings.
pKey - The key to search for. sep - The list separator (default is ","). Returns The list. Empty if the entry does not exist. Deprecated use readEntry(const char*, const QStringList&, char) const instead. |
|
Reads a list of strings, but returns a default if the key did not exist. pKey - The key to search for. aDefault - The default value to use if the key does not exist. sep - The list separator (default is ","). Returns The list. Contains aDefault if the Key does not exist. Deprecated use readEntry(const char*, const QStringList&, char) const instead. |
|
Reads a numerical value. Read the value of an entry specified by pKey in the current group and interpret it numerically.
pKey - The key to search for. nDefault - A default value returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reads a numerical value. Read the value of an entry specified by pKey in the current group and interpret it numerically.
pKey - The key to search for. nDefault - A default value returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reads a 64-bit numerical value. Read the value of an entry specified by pKey in the current group and interpret it numerically.
pKey - The key to search for. nDefault - A default value returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reads a 64-bit numerical value. Read the value of an entry specified by pKey in the current group and interpret it numerically.
pKey - The key to search for. nDefault - A default value returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reads a numerical value. Read the value of an entry specified by pKey in the current group and interpret it numerically.
pKey - The key to search for. nDefault - A default value returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reads a numerical value. Read the value of an entry specified by pKey in the current group and interpret it numerically.
pKey - The key to search for. nDefault - A default value returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reads a path. Read the value of an entry specified by pKey in the current group and interpret it as a path. This means, dollar expansion is activated for this value, so that e.g. $HOME gets expanded.
pKey - The key to search for. aDefault - A default value returned if the key was not found. Returns The value for this key. Can be QString() if aDefault is null. |
|
Reads a path. Read the value of an entry specified by pKey in the current group and interpret it as a path. This means, dollar expansion is activated for this value, so that e.g. $HOME gets expanded.
pKey - The key to search for. aDefault - A default value returned if the key was not found. Returns The value for this key. Can be QString() if aDefault is null. |
|
Reads a list of string paths. Read the value of an entry specified by pKey in the current group and interpret it as a list of paths. This means, dollar expansion is activated for this value, so that e.g. $HOME gets expanded.
pKey - The key to search for. sep - The list separator (default is ","). Returns The list. Empty if the entry does not exist. |
|
Reads a list of string paths. Read the value of an entry specified by pKey in the current group and interpret it as a list of paths. This means, dollar expansion is activated for this value, so that e.g. $HOME gets expanded.
pKey - The key to search for. sep - The list separator (default is ","). Returns The list. Empty if the entry does not exist. |
|
Reads a QPoint entry. Read the value of an entry specified by pKey in the current group and interpret it as a QPoint object.
pKey - The key to search for pDefault - A default value (null QPoint by default) returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reads a QPoint entry. Read the value of an entry specified by pKey in the current group and interpret it as a QPoint object.
pKey - The key to search for pDefault - A default value (null QPoint by default) returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reads the value of an entry specified by pKey in the current group.
pKey - The key to search for. aDefault - A default value returned if the key was not found. Returns The value for this key, or aDefault. Reads the value of an entry specified by pKey in the current group. readEntry(const char*, const T&) const |
|
|
Reads a QRect entry. Read the value of an entry specified by pKey in the current group and interpret it as a QRect object.
pKey - The key to search for pDefault - A default value (null QRect by default) returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reads a QRect entry. Read the value of an entry specified by pKey in the current group and interpret it as a QRect object.
pKey - The key to search for pDefault - A default value (null QRect by default) returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reads a QSize entry. Read the value of an entry specified by pKey in the current group and interpret it as a QSize object.
pKey - The key to search for pDefault - A default value (null QSize by default) returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reads a QSize entry. Read the value of an entry specified by pKey in the current group and interpret it as a QSize object.
pKey - The key to search for pDefault - A default value (null QSize by default) returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Read an unsigned numerical value. Read the value of an entry specified by pKey in the current group and interpret it numerically.
pKey - The key to search for. nDefault - A default value returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Read an unsigned numerical value. Read the value of an entry specified by pKey in the current group and interpret it numerically.
pKey - The key to search for. nDefault - A default value returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Read an 64-bit unsigned numerical value. Read the value of an entry specified by pKey in the current group and interpret it numerically.
pKey - The key to search for. nDefault - A default value returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Read an 64-bit unsigned numerical value. Read the value of an entry specified by pKey in the current group and interpret it numerically.
pKey - The key to search for. nDefault - A default value returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reads an unsigned numerical value. Read the value of an entry specified by pKey in the current group and interpret it numerically.
pKey - The key to search for. nDefault - A default value returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reads an unsigned numerical value. Read the value of an entry specified by pKey in the current group and interpret it numerically.
pKey - The key to search for. nDefault - A default value returned if the key was not found or if the read value cannot be interpreted. Returns The value for this key. Deprecated |
|
Reparses all configuration files. This is useful for programs that use stand alone graphical configuration tools. The base method implemented here only clears the group list and then appends the default group. Derivative classes should clear any internal data structures and then simply call parseConfigFiles() when implementing this method. See also parseConfigFiles() |
|
Reverts the entry with key key in the current group in the application specific config file to either the system wide (default) value or the value specified in the global KDE config file. To revert entries in the global KDE config file, the global KDE config file should be opened explicitly in a separate config object.
key - The key of the entry to revert. |
|
Mark the config object as "clean," i.e. don't write dirty entries at destruction time. If bDeep is false, only the global dirty flag of the KConfig object gets cleared. If you then call writeEntry() again, the global dirty flag is set again and all dirty entries will be written at a subsequent sync() call. Classes that derive from KConfigBase should override this method and implement storage-specific behavior, as well as calling the KConfigBase.rollback() explicitly in the initializer.
bDeep - If true, the dirty flags of all entries are cleared, as well as the global dirty flag. |
|
Sets the backend to use with this config object. Ownership of the backend is taken over by the config object. |
|
Sets the global dirty flag of the config object
_bDirty - How to mark the object's dirty status |
|
Turns on or off "dollar expansion" (see KConfigBase introduction) when reading config entries. Dollar sign expansion is initially OFF.
_bExpand - Tf true, dollar expansion is turned on. |
|
Specifies the group in which keys will be read and written. Subsequent calls to readEntry() and writeEntry() will be applied only in the activated group. Switch back to the default group by passing a null string. group - The name of the new group. |
|
Overloaded public methods: |
|
|
Reads the locale and put in the configuration data struct. Note that this should be done in the constructor, but this is not possible due to some mutual dependencies in KApplication.init() |
|
When set, all readEntry and readXXXEntry calls return the system wide (default) values instead of the user's preference. This is off by default. |
|
Flushes all changes that currently reside only in memory back to disk / permanent storage. Dirty configuration entries are written to the most specific file available. Asks the back end to flush out all pending writes, and then calls rollback(). No changes are made if the object has readOnly status. You should call this from your destructor in derivative classes. See also rollback() |
|
writeEntry( const char*, const QString&, WriteConfigFlags ) writeEntry( const char*, const QString&, WriteConfigFlags ) writeEntry() overridden to accept a list of strings.
pKey - The key to write value - The list to write sep - The list separator (default is ","). pFlags - The flags to use when writing this entry. See also writeEntry() |
|
writeEntry() overridden to accept a list of strings.
pKey - The key to write value - The list to write sep - The list separator (default is ","). pFlags - The flags to use when writing this entry. See also writeEntry() |
|
Writes a file path. It is checked whether the path is located under $HOME. If so the path is written out with the user's home-directory replaced with $HOME. The path should be read back with readPathEntry()
pKey - The key to write. path - The path to write. pFlags - The flags to use when writing this entry. |
|
Writes a file path. It is checked whether the path is located under $HOME. If so the path is written out with the user's home-directory replaced with $HOME. The path should be read back with readPathEntry()
pKey - The key to write. path - The path to write. pFlags - The flags to use when writing this entry. |
|
writePathEntry() overridden to accept a list of paths (strings). It is checked whether the paths are located under $HOME. If so each of the paths are written out with the user's home-directory replaced with $HOME. The paths should be read back with readPathListEntry()
pKey - The key to write value - The list to write sep - The list separator (default is ","). pFlags - The flags to use when writing this entry. See also writePathEntry() See also readPathListEntry() |
|
writePathEntry() overridden to accept a list of paths (strings). It is checked whether the paths are located under $HOME. If so each of the paths are written out with the user's home-directory replaced with $HOME. The paths should be read back with readPathListEntry()
pKey - The key to write value - The list to write sep - The list separator (default is ","). pFlags - The flags to use when writing this entry. See also writePathEntry() See also readPathListEntry() |
NoAccess | - | ||
ReadOnly | - | ||
ReadWrite | - |