\section{KConfig Class Reference}
\label{classKConfig}\index{KConfig@{KConfig}}
Access {\bf KDE}{\rm (p.\,\pageref{namespaceKDE})} Configuration entries. {\bf KDE}{\rm (p.\,\pageref{namespaceKDE})} Configuration Management class.  


{\tt \#include $<$kconfig.h$>$}

Inheritance diagram for KConfig:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=108pt]{classKConfig__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KConfig:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=271pt]{classKConfig__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KConfig} (const  {\bf QString} \&file\-Name=QString::null, bool b\-Read\-Only=false, bool b\-Use\-KDEGlobals=true, const  char $\ast$res\-Type=\char`\"{}config\char`\"{})
\begin{CompactList}\small\item\em Constructs a KConfig object. \item\end{CompactList}\item 
virtual {\bf $\sim$KConfig} ()
\begin{CompactList}\small\item\em Destructs the KConfig object. \item\end{CompactList}\item 
virtual void {\bf rollback} (bool b\-Deep=true)
\begin{CompactList}\small\item\em Clears all entries out of the {\tt dirty\-Entry\-Map}, so the values will not be written to disk on a later call to {\bf sync}{\rm (p.\,\pageref{classKConfigBase_a96})}(). \item\end{CompactList}\item 
virtual {\bf QString\-List} {\bf group\-List} () const 
\begin{CompactList}\small\item\em Returns a list of groups that are known. \item\end{CompactList}\item 
virtual {\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ {\bf entry\-Map} (const  {\bf QString} \&p\-Group) const 
\begin{CompactList}\small\item\em Returns a map (tree) of entries for all entries in a particular group. \item\end{CompactList}\item 
virtual void {\bf reparse\-Configuration} ()
\begin{CompactList}\small\item\em Clears all internal data structures and then reread configuration information from disk. \item\end{CompactList}\item 
void {\bf set\-File\-Write\-Mode} (int mode)
\begin{CompactList}\small\item\em Set the file mode for newly created files. \item\end{CompactList}\item 
void {\bf set\-Force\-Global} (bool force)
\begin{CompactList}\small\item\em Forces all following write-operations being performed on kdeglobals, independent of the b\-Global flag in {\bf write\-Entry()}{\rm (p.\,\pageref{classKConfigBase_a50})}. \item\end{CompactList}\item 
bool {\bf force\-Global} () const 
\begin{CompactList}\small\item\em Returns true if all entries are being written into kdeglobals. \item\end{CompactList}\item 
void {\bf check\-Update} (const  {\bf QString} \&id, const  {\bf QString} \&update\-File)
\begin{CompactList}\small\item\em Checks whether the config file contains the update {\tt id} as contained in {\tt update\-File}. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual bool {\bf internal\-Has\-Group} (const  {\bf QCString} \&group) const 
\begin{CompactList}\small\item\em Returns true if the specified group is known. \item\end{CompactList}\item 
virtual {\bf KEntry\-Map} {\bf internal\-Entry\-Map} (const  {\bf QString} \&p\-Group) const 
\begin{CompactList}\small\item\em Returns a map (tree) of the entries in the specified group. \item\end{CompactList}\item 
virtual {\bf KEntry\-Map} {\bf internal\-Entry\-Map} () const 
\begin{CompactList}\small\item\em Returns a copy of the internal map used to hold all entries. \item\end{CompactList}\item 
virtual void {\bf put\-Data} (const  {\bf KEntry\-Key} \&\_\-key, const  {\bf KEntry} \&\_\-data, bool \_\-check\-Group=true)
\begin{CompactList}\small\item\em Inserts a (key, value) pair into the internal storage mechanism of the configuration object. \item\end{CompactList}\item 
virtual {\bf KEntry} {\bf lookup\-Data} (const  {\bf KEntry\-Key} \&\_\-key) const 
\begin{CompactList}\small\item\em Looks up an entry in the config object's internal structure. \item\end{CompactList}\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKConfig_b5}

\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
{\bf KEntry\-Map} {\bf a\-Entry\-Map}
\begin{CompactList}\small\item\em Contains all key,value entries, as well as some \char`\"{}special\char`\"{} keys which indicate the start of a group of entries. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Access {\bf KDE}{\rm (p.\,\pageref{namespaceKDE})} Configuration entries. {\bf KDE}{\rm (p.\,\pageref{namespaceKDE})} Configuration Management class. 

This class implements KDE's default configuration system.

\begin{Desc}
\item[Author:]Kalle Dalheimer $<${\tt kalle@kde.org}$>$, Preston Brown $<${\tt pbrown@kde.org}$>$ \end{Desc}
\begin{Desc}
\item[Version:]\begin{Desc}
\item[Id]{\bf kconfig.h}{\rm (p.\,\pageref{kconfig_8h})},v 1.51 2002/09/28 12:28:47 tjansen Exp \end{Desc}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf KGlobal::config()}{\rm (p.\,\pageref{classKGlobal_e2})}, {\bf KConfig\-Base}{\rm (p.\,\pageref{classKConfigBase})}, {\bf KSimple\-Config}{\rm (p.\,\pageref{classKSimpleConfig})} \end{Desc}




Definition at line 43 of file kconfig.h.

\subsection{Constructor \& Destructor Documentation}
\index{KConfig@{KConfig}!KConfig@{KConfig}}
\index{KConfig@{KConfig}!KConfig@{KConfig}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KConfig::KConfig (const {\bf QString} \& {\em file\-Name} = QString::null, bool {\em b\-Read\-Only} = false, bool {\em b\-Use\-KDEGlobals} = true, const char $\ast$ {\em res\-Type} = \char`\"{}config\char`\"{})}\label{classKConfig_a0}


Constructs a KConfig object. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em file\-Name}]A file to parse in addition to the system-wide file(s). If it is not provided, only global {\bf KDE}{\rm (p.\,\pageref{namespaceKDE})} configuration data will be read (depending on the value of {\tt b\-Use\-KDEGlobals}). \item[{\em b\-Read\-Only}]Set the config object's read-only status. Note that the object will automatically become read-only if either the user does not have write permission to {\tt file\-Name} or if no file was specified. \item[{\em b\-Use\-KDEGlobals}]Toggle reading the global {\bf KDE}{\rm (p.\,\pageref{namespaceKDE})} configuration file. \item[{\em res\-Type}]the place to look in (config, data, etc) See {\bf KStandard\-Dirs}{\rm (p.\,\pageref{classKStandardDirs})}. \end{description}
\end{Desc}


Definition at line 43 of file kconfig.cpp.

References KStandard\-Dirs::add\-Customized(), KConfig\-Base::back\-End, KGlobal::dirs(), reparse\-Configuration(), and KConfig\-Base::set\-Read\-Only().\index{KConfig@{KConfig}!~KConfig@{$\sim$KConfig}}
\index{~KConfig@{$\sim$KConfig}!KConfig@{KConfig}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KConfig::$\sim${\bf KConfig} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKConfig_a1}


Destructs the KConfig object. 

Writes back any dirty configuration entries, and destroys dynamically created objects. 

Definition at line 76 of file kconfig.cpp.

References KConfig\-Base::back\-End, and KConfig\-Base::sync().

\subsection{Member Function Documentation}
\index{KConfig@{KConfig}!rollback@{rollback}}
\index{rollback@{rollback}!KConfig@{KConfig}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig::rollback (bool {\em b\-Deep} = true)\hspace{0.3cm}{\tt  [virtual]}}\label{classKConfig_a2}


Clears all entries out of the {\tt dirty\-Entry\-Map}, so the values will not be written to disk on a later call to {\bf sync}{\rm (p.\,\pageref{classKConfigBase_a96})}(). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em b\-Deep}]If true, the dirty map is actually emptied. otherwise, the config object's global dirty flag is set to false, but the dirty entries remain in the dirty entry map.\end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf KConfig\-Base::rollback}{\rm (p.\,\pageref{classKConfigBase_a95})} \end{Desc}


Reimplemented from {\bf KConfig\-Base} {\rm (p.\,\pageref{classKConfigBase_a95})}.

Definition at line 83 of file kconfig.cpp.

References a\-Entry\-Map, QMap::begin(), QMap::end(), and KConfig\-Base::rollback().

Referenced by KSimple\-Config::sync().\index{KConfig@{KConfig}!groupList@{groupList}}
\index{groupList@{groupList}!KConfig@{KConfig}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KConfig::group\-List () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKConfig_a3}


Returns a list of groups that are known. 

\begin{Desc}
\item[Returns:]a list of of groups \end{Desc}


Implements {\bf KConfig\-Base} {\rm (p.\,\pageref{classKConfigBase_a6})}.

Definition at line 96 of file kconfig.cpp.

References a\-Entry\-Map, QMap::begin(), QMap::end(), QString::from\-Utf8(), KConfig\-Base::group(), and QMap::is\-Empty().\index{KConfig@{KConfig}!entryMap@{entryMap}}
\index{entryMap@{entryMap}!KConfig@{KConfig}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ KConfig::entry\-Map (const {\bf QString} \& {\em p\-Group}) const\hspace{0.3cm}{\tt  [virtual]}}\label{classKConfig_a4}


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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em p\-Group}]A group to get keys from. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A map of entries in the group specified, indexed by key. The returned map may be empty if the group is not found. \end{Desc}


Implements {\bf KConfig\-Base} {\rm (p.\,\pageref{classKConfigBase_a101})}.

Definition at line 130 of file kconfig.cpp.

References a\-Entry\-Map, QMap::end(), QMap::find(), QString::from\-Utf8(), QMap::insert(), and QString::utf8().

Referenced by KStandard\-Dirs::add\-Customized().\index{KConfig@{KConfig}!reparseConfiguration@{reparseConfiguration}}
\index{reparseConfiguration@{reparseConfiguration}!KConfig@{KConfig}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig::reparse\-Configuration ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKConfig_a5}


Clears all internal data structures and then reread configuration information from disk. 



Implements {\bf KConfig\-Base} {\rm (p.\,\pageref{classKConfigBase_a102})}.

Definition at line 150 of file kconfig.cpp.

References a\-Entry\-Map, QMap::clear(), QMap::insert(), and KConfig\-Base::parse\-Config\-Files().

Referenced by check\-Update(), KInstance::config(), KInstance::dirs(), KConfig(), KDesktop\-File::KDesktop\-File(), and KSimple\-Config::KSimple\-Config().\index{KConfig@{KConfig}!setFileWriteMode@{setFileWriteMode}}
\index{setFileWriteMode@{setFileWriteMode}!KConfig@{KConfig}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig::set\-File\-Write\-Mode (int {\em mode})}\label{classKConfig_a6}


Set the file mode for newly created files. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em mode}]the mode for new files as described in chmod(2) \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]man:chmod(2) for a description of {\tt mode} \end{Desc}


Definition at line 259 of file kconfig.cpp.

References KConfig\-Base::back\-End, and KConfig\-Back\-End::set\-File\-Write\-Mode().\index{KConfig@{KConfig}!setForceGlobal@{setForceGlobal}}
\index{setForceGlobal@{setForceGlobal}!KConfig@{KConfig}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig::set\-Force\-Global (bool {\em force})\hspace{0.3cm}{\tt  [inline]}}\label{classKConfig_a7}


Forces all following write-operations being performed on kdeglobals, independent of the b\-Global flag in {\bf write\-Entry()}{\rm (p.\,\pageref{classKConfigBase_a50})}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em force}]true to force writing in kdeglobals \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf force\-Global}{\rm (p.\,\pageref{classKConfig_a8})} \end{Desc}


Definition at line 126 of file kconfig.h.\index{KConfig@{KConfig}!forceGlobal@{forceGlobal}}
\index{forceGlobal@{forceGlobal}!KConfig@{KConfig}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KConfig::force\-Global () const\hspace{0.3cm}{\tt  [inline]}}\label{classKConfig_a8}


Returns true if all entries are being written into kdeglobals. 

\begin{Desc}
\item[Returns:]true if all entries are being written into kdeglobals \end{Desc}
\begin{Desc}
\item[See also:]{\bf set\-Force\-Global}{\rm (p.\,\pageref{classKConfig_a7})} \end{Desc}


Definition at line 133 of file kconfig.h.\index{KConfig@{KConfig}!checkUpdate@{checkUpdate}}
\index{checkUpdate@{checkUpdate}!KConfig@{KConfig}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig::check\-Update (const {\bf QString} \& {\em id}, const {\bf QString} \& {\em update\-File})}\label{classKConfig_a9}


Checks whether the config file contains the update {\tt id} as contained in {\tt update\-File}. 

If not, it runs kconf\_\-update to update the config file.

If you install config update files with critical fixes you may wish to use this method to verify that a critical update has indeed been performed to catch the case where a user restores an old config file from backup that has not been updated yet. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em id}]the update to check \item[{\em update\-File}]the file containing the update \end{description}
\end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 264 of file kconfig.cpp.

References KConfig\-Base::group(), KApplication::kdeinit\-Exec\-Wait(), KConfig\-Base::read\-List\-Entry(), reparse\-Configuration(), and KConfig\-Base::set\-Group().\index{KConfig@{KConfig}!internalHasGroup@{internalHasGroup}}
\index{internalHasGroup@{internalHasGroup}!KConfig@{KConfig}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KConfig::internal\-Has\-Group (const {\bf QCString} \& {\em group}) const\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKConfig_b0}


Returns true if the specified group is known. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em group}]The group to search for. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if the group exists. \end{Desc}


Implements {\bf KConfig\-Base} {\rm (p.\,\pageref{classKConfigBase})}.

Definition at line 238 of file kconfig.cpp.

References a\-Entry\-Map, QMap::end(), QMap::find(), and QMap::is\-Empty().\index{KConfig@{KConfig}!internalEntryMap@{internalEntryMap}}
\index{internalEntryMap@{internalEntryMap}!KConfig@{KConfig}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KEntry\-Map} KConfig::internal\-Entry\-Map (const {\bf QString} \& {\em p\-Group}) const\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKConfig_b1}


Returns a map (tree) of the entries in the specified group. 

Do not use this function, the implementation / return type are subject to change.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em p\-Group}]the group to provide a KEntry\-Map for. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The map of the entries in the group. \end{Desc}


Implements {\bf KConfig\-Base} {\rm (p.\,\pageref{classKConfigBase_b3})}.

Definition at line 163 of file kconfig.cpp.

References a\-Entry\-Map, QMap::end(), QMap::find(), QMap::insert(), and QString::utf8().\index{KConfig@{KConfig}!internalEntryMap@{internalEntryMap}}
\index{internalEntryMap@{internalEntryMap}!KConfig@{KConfig}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual {\bf KEntry\-Map} KConfig::internal\-Entry\-Map () const\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKConfig_b2}


Returns a copy of the internal map used to hold all entries. 

Do not use this function, the implementation / return type are subject to change.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em p\-Group}]the group to provide a KEntry\-Map for. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The map of the entries in the group. \end{Desc}


Implements {\bf KConfig\-Base} {\rm (p.\,\pageref{classKConfigBase_b4})}.

Definition at line 183 of file kconfig.h.

References a\-Entry\-Map.\index{KConfig@{KConfig}!putData@{putData}}
\index{putData@{putData}!KConfig@{KConfig}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig::put\-Data (const {\bf KEntry\-Key} \& {\em \_\-key}, const {\bf KEntry} \& {\em \_\-data}, bool {\em \_\-check\-Group} = true)\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKConfig_b3}


Inserts a (key, value) pair into the internal storage mechanism of the configuration object. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-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. \item[{\em \_\-data}]the {\bf KEntry}{\rm (p.\,\pageref{structKEntry})} that is to be stored. \item[{\em \_\-check\-Group}]When false, assume that the group already exists. \end{description}
\end{Desc}


Implements {\bf KConfig\-Base} {\rm (p.\,\pageref{classKConfigBase_b5})}.

Definition at line 187 of file kconfig.cpp.

References a\-Entry\-Map, KEntry\-Key::b\-Default, KEntry::b\-Global, KEntry::b\-Immutable, KStd\-Accel::key(), and KEntry\-Key::m\-Group.\index{KConfig@{KConfig}!lookupData@{lookupData}}
\index{lookupData@{lookupData}!KConfig@{KConfig}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KEntry} KConfig::lookup\-Data (const {\bf KEntry\-Key} \& {\em \_\-key}) const\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKConfig_b4}


Looks up an entry in the config object's internal structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-key}]The key to look up It contains information both on the group of the key and the entry's key itself. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the {\bf KEntry}{\rm (p.\,\pageref{structKEntry})} value (data) found for the key. KEntry.a\-Value will be the null string if nothing was located. \end{Desc}


Implements {\bf KConfig\-Base} {\rm (p.\,\pageref{classKConfigBase_b6})}.

Definition at line 222 of file kconfig.cpp.

References a\-Entry\-Map, KEntry::b\-Deleted, QMap::end(), and QMap::find().

\subsection{Member Data Documentation}
\index{KConfig@{KConfig}!aEntryMap@{aEntryMap}}
\index{aEntryMap@{aEntryMap}!KConfig@{KConfig}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KEntry\-Map} {\bf KConfig::a\-Entry\-Map}\hspace{0.3cm}{\tt  [protected]}}\label{classKConfig_p0}


Contains all key,value entries, as well as some \char`\"{}special\char`\"{} keys which indicate the start of a group of entries. 

These special keys will have the .key portion of their {\bf KEntry\-Key}{\rm (p.\,\pageref{structKEntryKey})} set to QString::null. 

Definition at line 214 of file kconfig.h.

Referenced by entry\-Map(), group\-List(), internal\-Entry\-Map(), internal\-Has\-Group(), lookup\-Data(), put\-Data(), reparse\-Configuration(), and rollback().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kconfig.h\item 
kconfig.cpp\end{CompactItemize}
