kdecore Library API Documentation

KConfigBackEnd Class Reference

Abstract base class for KDE configuration file loading/saving. KDE Configuration file loading/saving abstract base class. More...

#include <kconfigbackend.h>

Inheritance diagram for KConfigBackEnd:

KConfigINIBackEnd List of all members.

Public Member Functions

 KConfigBackEnd (KConfigBase *_config, const QString &_fileName, const char *_resType, bool _useKDEGlobals)
virtual ~KConfigBackEnd ()
virtual bool parseConfigFiles ()=0
virtual void sync (bool bMerge=true)=0
void changeFileName (const QString &_fileName, const char *_resType, bool _useKDEGlobals)
virtual KConfigBase::ConfigState getConfigState () const
QString fileName () const
const char * resource () const
void setLocaleString (const QCString &_localeString)
void setFileWriteMode (int mode)
bool checkConfigFilesWritable (bool warnUser)
KDE_DEPRECATED QString filename () const

Protected Member Functions

virtual void virtual_hook (int id, void *data)

Protected Attributes

KConfigBasepConfig
QString mfileName
QCString resType
bool useKDEGlobals: 1
bool bFileImmutable: 1
QCString localeString
QString mLocalFileName
QString mGlobalFileName
KConfigBase::ConfigState mConfigState
int mFileMode
KConfigBackEndPrivate * d

Detailed Description

Abstract base class for KDE configuration file loading/saving. KDE Configuration file loading/saving abstract base class.

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>
Version:
Id
kconfigbackend.h,v 1.32 2003/11/26 23:28:41 ossi Exp

Definition at line 47 of file kconfigbackend.h.


Constructor & Destructor Documentation

KConfigBackEnd::KConfigBackEnd KConfigBase _config,
const QString _fileName,
const char *  _resType,
bool  _useKDEGlobals
 

Constructs a configuration back end.

Parameters:
_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.

Definition at line 244 of file kconfigbackend.cpp.

References changeFileName(), and KConfigBackEnd().

Referenced by KConfigBackEnd().

KConfigBackEnd::~KConfigBackEnd  )  [virtual]
 

Destructs the configuration backend.

Definition at line 254 of file kconfigbackend.cpp.


Member Function Documentation

virtual bool KConfigBackEnd::parseConfigFiles  )  [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.

Implemented in KConfigINIBackEnd.

Referenced by KConfigBase::parseConfigFiles().

virtual void KConfigBackEnd::sync bool  bMerge = true  )  [pure virtual]
 

Writes configuration data to file(s).

This method must be reimplemented by the derived classes.

Parameters:
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.

Implemented in KConfigINIBackEnd.

Referenced by KConfig::reparseConfiguration(), KSimpleConfig::sync(), and KConfigBase::sync().

void KConfigBackEnd::changeFileName const QString _fileName,
const char *  _resType,
bool  _useKDEGlobals
 

Changes the filenames associated with this back end.

You should probably reparse your config info after doing this.

Parameters:
_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.

Definition at line 220 of file kconfigbackend.cpp.

References changeFileName(), KGlobal::dirs(), QString::isEmpty(), and KStandardDirs::saveLocation().

Referenced by changeFileName(), KConfig::copyTo(), KConfigBackEnd(), KDesktopFile::KDesktopFile(), and KSimpleConfig::KSimpleConfig().

virtual KConfigBase::ConfigState KConfigBackEnd::getConfigState  )  const [inline, virtual]
 

Returns the state of the app-config object.

See also:
KConfig::getConfigState

Definition at line 111 of file kconfigbackend.h.

Referenced by KConfigBase::getConfigState(), and KConfigBase::parseConfigFiles().

QString KConfigBackEnd::fileName  )  const [inline]
 

Returns the filename as passed to the constructor.

Returns:
the filename as passed to the constructor.

Definition at line 118 of file kconfigbackend.h.

Referenced by KDesktopFile::fileName().

const char* KConfigBackEnd::resource  )  const [inline]
 

Returns the resource type as passed to the constructor.

Returns:
the resource type as passed to the constructor.

Definition at line 124 of file kconfigbackend.h.

Referenced by KDesktopFile::resource().

void KConfigBackEnd::setLocaleString const QCString _localeString  )  [inline]
 

Set the locale string that defines the current language.

Parameters:
_localeString the identifier of the language
See also:
KLocale

Definition at line 131 of file kconfigbackend.h.

References setLocaleString().

Referenced by KConfigBase::setLocale(), and setLocaleString().

void KConfigBackEnd::setFileWriteMode int  mode  ) 
 

Set the file mode for newly created files.

Parameters:
mode the filemode (as in chmod)

Definition at line 259 of file kconfigbackend.cpp.

References setFileWriteMode().

Referenced by setFileWriteMode(), and KConfig::setFileWriteMode().

bool KConfigBackEnd::checkConfigFilesWritable bool  warnUser  ) 
 

Check whether the config files are writable.

Parameters:
warnUser Warn the user if the configuration files are not writable.
Returns:
Indicates that all of the configuration files used are writable.
Since:
3.2

Definition at line 1025 of file kconfigbackend.cpp.

References QString::arg(), checkConfigFilesWritable(), KInstance::instanceName(), QString::isEmpty(), QString::local8Bit(), and KProcess::start().

Referenced by KConfigBase::checkConfigFilesWritable(), and checkConfigFilesWritable().

KDE_DEPRECATED QString KConfigBackEnd::filename  )  const [inline]
 

Deprecated:
Use
See also:
fileName() instead

Definition at line 153 of file kconfigbackend.h.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdecore Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 12 15:08:02 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003