org.kde.koala
Class KConfigBackEnd

java.lang.Object
  extended by org.kde.koala.KConfigBackEnd
All Implemented Interfaces:
org.kde.qt.QtSupport
Direct Known Subclasses:
KConfigINIBackEnd

public class KConfigBackEnd
extends java.lang.Object
implements org.kde.qt.QtSupport

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 , Matthias Kalle Dalheimer

Constructor Summary
protected KConfigBackEnd(java.lang.Class dummy)
           
 
Method Summary
 void changeFileName(java.lang.String _fileName, java.lang.String _resType, boolean _useKDEGlobals)
          Changes the filenames associated with this back end.
 boolean checkConfigFilesWritable(boolean warnUser)
          Check whether the config files are writable.
 java.lang.String fileName()
          Returns the filename as passed to the constructor.
 int getConfigState()
          Returns the state of the app-config object.
 boolean parseConfigFiles()
          Parses all configuration files for a configuration object.
 java.lang.String resource()
          Returns the resource type as passed to the constructor.
 void setFileWriteMode(int mode)
          Set the file mode for newly created files.
 void setLocaleString(java.lang.String _localeString)
          Set the locale string that defines the current language.
 void sync()
           
 void sync(boolean bMerge)
          Writes configuration data to file(s).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KConfigBackEnd

protected KConfigBackEnd(java.lang.Class dummy)
Method Detail

parseConfigFiles

public boolean parseConfigFiles()
Parses all configuration files for a configuration object. This method must be reimplemented by the derived classes.

Returns:
Whether or not parsing was successful.

sync

public void sync(boolean bMerge)
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.

sync

public void sync()

changeFileName

public void changeFileName(java.lang.String _fileName,
                           java.lang.String _resType,
                           boolean _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.

getConfigState

public int getConfigState()
Returns the state of the app-config object.

See Also:
KConfigBase.getConfigState()

fileName

public java.lang.String fileName()
Returns the filename as passed to the constructor.

Returns:
the filename as passed to the constructor.

resource

public java.lang.String resource()
Returns the resource type as passed to the constructor.

Returns:
the resource type as passed to the constructor.

setLocaleString

public void setLocaleString(java.lang.String _localeString)
Set the locale string that defines the current language.

Parameters:
_localeString - the identifier of the language
See Also:
KLocale

setFileWriteMode

public void setFileWriteMode(int mode)
Set the file mode for newly created files.

Parameters:
mode - the filemode (as in chmod)

checkConfigFilesWritable

public boolean checkConfigFilesWritable(boolean 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.