# class KConfigBackEnd

### abstract class

Table of contents
Modules
kdecore Classes
All Classes

Module | kdecore
Namespace | global
Class | KConfigBackEnd
Inherits |

Abstract base class for KDE configuration file loading/saving.

This class forms the base for all classes that implement some manner of loading/saving to configuration files. It is an abstract base class, meaning that you cannot directly instantiate objects of this class. As of right now, the only back end available is one to read/write to INI-style files, but in the future, other formats may be available, such as XML or a database.

Author Preston Brown <pbrown@kde.org>, Matthias Kalle Dalheimer <kalle@kde.org> KDE Configuration file loading/saving abstract base class

### methods

- KConfigBackEnd (_config, _fileName, _resType, _useKDEGlobals)

  returns a KConfigBackEnd object

  Argument | Type | Default
  --- | --- | ---
  _config | KConfigBase |
  _fileName | QString |
  _resType | char |
  _useKDEGlobals | bool |

  Constructs a configuration back end.

  _config - Specifies the configuration object which values will be passed to as they are read, or from where values to be written to will be obtained from.

  _fileName - The name of the file in which config data is stored. All registered configuration directories will be looked in in order of decreasing relevance.

  _resType - the resource type of the fileName specified, _if_ it is not an absolute path (otherwise this parameter is ignored).

  _useKDEGlobals - If true, the user's system-wide kdeglobals file will be imported into the config object. If false, only the filename specified will be dealt with.

- changeFileName (_fileName, _resType, _useKDEGlobals)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  _fileName | QString |
  _resType | char |
  _useKDEGlobals | bool |

  Changes the filenames associated with this back end. You should probably reparse your config info after doing this.

  _fileName - the new filename to use

  _resType - the resource type of the fileName specified, _if_ it is not an absolute path (otherwise this parameter is ignored).

  _useKDEGlobals - specifies whether or not to also parse the global KDE configuration files.

- checkConfigFilesWritable (warnUser)

  returns (bool)

  Argument | Type | Default
  --- | --- | ---
  warnUser | bool |

  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.

- extraConfigFiles ()

  returns (QStringList)

  Gets the extraConfigFiles in the merge stack.

- fileName ()

  returns (QString)

  Returns the filename as passed to the constructor. Returns the filename as passed to the constructor.

- getConfigState ()

  returns (KConfigBase.ConfigState)

  Returns the state of the app-config object.

  See also KConfig.getConfigState

- lockFile (bGlobal)

  returns (KLockFile.Ptr)

  Argument | Type | Default
  --- | --- | ---
  bGlobal | bool | False

  Returns a lock file object for the configuration file

  bGlobal - If true, returns a lock file object for kdeglobals

- parseConfigFiles ()

  returns (bool)
  pure virtual

  Parses all configuration files for a configuration object. This method must be reimplemented by the derived classes.

  Returns Whether or not parsing was successful.

- removeAllExtraConfigFiles ()

  returns nothing

  Remove all files from merge stack. This does not include the local file that was specified in the constructor.

- resource ()

  returns (char)

  Returns the resource type as passed to the constructor. Returns the resource type as passed to the constructor.

- setExtraConfigFiles (files)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  files | QStringList |

  Sets the merge stack to the list of files. The stack is last in first out with the top of the stack being the most specific config file.

  files - A list of extra config files containing the full path of the local config file to remove from the stack.

- setFileWriteMode (mode)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  mode | int |

  Set the file mode for newly created files.

  mode - the filemode (as in chmod)

- setLocaleString (_localeString)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  _localeString | QByteArray |

  Set the locale string that defines the current language.

  _localeString - the identifier of the language

  See also KLocale

- sync (bMerge)

  returns nothing
  pure virtual

  Argument | Type | Default
  --- | --- | ---
  bMerge | bool | True

  Writes configuration data to file(s). This method must be reimplemented by the derived classes.

  bMerge - Specifies whether the old config file already on disk should be merged in with the data in memory. If true, data is read off the disk and merged. If false, the on-disk file is removed and only in-memory data is written out.