\section{KCModule Class Reference}
\label{classKCModule}\index{KCModule@{KCModule}}
The base class for control center modules.  


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

Inheritance diagram for KCModule:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=137pt]{classKCModule__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KCModule:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=49pt]{classKCModule__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Button} \{ \par
{\bf Help} = 1, 
{\bf Default} = 2, 
{\bf Apply} = 16, 
{\bf Reset} = 4, 
\par
{\bf Cancel} = 8, 
{\bf Ok} = 32, 
{\bf Sys\-Default} = 64
 \}
\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf changed} (bool state)
\item 
void {\bf quick\-Help\-Changed} ()
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KCModule} ({\bf QWidget} $\ast$parent=0, const char $\ast$name=0, const {\bf QString\-List} \&args={\bf QString\-List}())\label{classKCModule_a0}

\item 
{\bf KCModule} ({\bf KInstance} $\ast$instance, {\bf QWidget} $\ast$parent=0, const {\bf QString\-List} \&args={\bf QString\-List}())\label{classKCModule_a1}

\item 
virtual void {\bf load} ()
\item 
virtual void {\bf save} ()
\item 
virtual void {\bf defaults} ()
\item 
virtual void {\bf sysdefaults} ()
\item 
virtual {\bf QString} {\bf quick\-Help} () const 
\item 
virtual const {\bf KAbout\-Data} $\ast$ {\bf about\-Data} () const 
\item 
void {\bf set\-About\-Data} ({\bf KAbout\-Data} $\ast$about)
\item 
int {\bf buttons} () const 
\item 
{\bf QString} {\bf root\-Only\-Msg} () const 
\item 
bool {\bf use\-Root\-Only\-Msg} () const 
\item 
{\bf KInstance} $\ast$ {\bf instance} () const \label{classKCModule_a13}

\item 
const {\bf QPtr\-List}$<$ {\bf KConfig\-Dialog\-Manager} $>$ \& {\bf configs} () const 
\end{CompactItemize}
\subsection*{Protected Slots}
\begin{CompactItemize}
\item 
void {\bf changed} ()
\item 
void {\bf widget\-Changed} ()
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf KConfig\-Dialog\-Manager} $\ast$ {\bf add\-Config} ({\bf KConfig\-Skeleton} $\ast$config, {\bf QWidget} $\ast$widget)
\item 
void {\bf set\-Quick\-Help} (const {\bf QString} \&help)
\item 
void {\bf set\-Buttons} (int btn)
\item 
void {\bf set\-Root\-Only\-Msg} (const {\bf QString} \&msg)
\item 
void {\bf set\-Use\-Root\-Only\-Msg} (bool on)
\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKCModule_b5}

\end{CompactItemize}


\subsection{Detailed Description}
The base class for control center modules. 

Starting from {\bf KDE} 2.0, control center modules are realized as shared libraries that are loaded into the control center at runtime.

The module in principle is a simple widget displaying the item to be changed. The module has a very small interface.

All the necessary glue logic and the GUI bells and whistles are provided by the control center and must not concern the module author.

To write a config module, you have to create a library that contains at one factory function like this:



\footnotesize\begin{verbatim} #include <kgenericfactory.h>

 typedef KGenericFactory<YourKCModule, QWidget> YourKCModuleFactory;
 K_EXPORT_COMPONENT_FACTORY( yourLibName, YourKCModuleFactory("name_of_the_po_file") );
\end{verbatim}
\normalsize


The parameter \char`\"{}name\_\-of\_\-the\_\-po\_\-file\char`\"{} has to correspond with the messages target that you created in your Makefile.am.

See {\tt http://developer.kde.org/documentation/other/kcm\_\-howto.html} for more detailed documentation.

\begin{Desc}
\item[Author:]Matthias Hoelzer-Kluepfel $<${\tt hoelzer@kde.org}$>$ \end{Desc}




Definition at line 69 of file kcmodule.h.

\subsection{Member Enumeration Documentation}
\index{KCModule@{KCModule}!Button@{Button}}
\index{Button@{Button}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KCModule::Button}}\label{classKCModule_w7}


An enumeration type for the buttons used by this module. 

You should only use Help, Default and Apply. The rest is obsolete.

\begin{Desc}
\item[See also:]{\bf KCModule::buttons}{\rm (p.\,\pageref{classKCModule_a10})} 

{\bf KCModule::set\-Buttons}{\rm (p.\,\pageref{classKCModule_b2})} \end{Desc}


Definition at line 81 of file kcmodule.h.

\subsection{Member Function Documentation}
\index{KCModule@{KCModule}!load@{load}}
\index{load@{load}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCModule::load ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKCModule_a3}


Load the configuration data into the module. 

The load method sets the user interface elements of the module to reflect the current settings stored in the configuration files.

This method is invoked whenever the module should read its configuration (most of the times from a config file) and update the user interface. This happens when the user clicks the \char`\"{}Reset\char`\"{} button in the control center, to undo all of his changes and restore the currently valid settings.

If you use KConfig\-XT, loading is taken care of automatically and you do not need to do it manually. However, if you for some reason reimplement it and also are using KConfig\-XT, you must call this function otherwise the loading of KConfig\-XT options will not work. 

Reimplemented in {\bf KCModule\-Container}, and {\bf KSettings::Plugin\-Page}.

Definition at line 103 of file kcmodule.cpp.

References KConfig\-Dialog\-Manager::update\-Widgets().\index{KCModule@{KCModule}!save@{save}}
\index{save@{save}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCModule::save ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKCModule_a4}


Save the configuration data. 

The save method stores the config information as shown in the user interface in the config files.

If necessary, this method also updates the running system, e.g. by restarting applications. This normally does not apply for {\bf KSettings::Dialog} modules where the updating is taken care of by {\bf KSettings::Dispatcher}.

save is called when the user clicks \char`\"{}Apply\char`\"{} or \char`\"{}Ok\char`\"{}.

If you use KConfig\-XT, saving is taken care off automatically and you do not need to load manually. However, if you for some reason reimplement it and also are using KConfig\-XT, you must call this function, otherwise the saving of KConfig\-XT options will not work. Call it at the very end of your reimplementation, to avoid {\bf changed()}{\rm (p.\,\pageref{classKCModule_j0})} signals getting emitted when you modify widgets. 

Reimplemented in {\bf KCModule\-Container}, and {\bf KSettings::Plugin\-Page}.

Definition at line 110 of file kcmodule.cpp.

References changed(), and KConfig\-Dialog\-Manager::update\-Settings().\index{KCModule@{KCModule}!defaults@{defaults}}
\index{defaults@{defaults}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCModule::defaults ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKCModule_a5}


Sets the configuration to sensible default values. 

This method is called when the user clicks the \char`\"{}Default\char`\"{} button. It should set the display to useful values.

If you use KConfig\-XT, you do not have to reimplement this function since the fetching and settings of default values is done automatically. However, if you reimplement and also are using KConfig\-XT, remember to call the base function at the very end of your reimplementation. 

Reimplemented in {\bf KCModule\-Container}, and {\bf KSettings::Plugin\-Page}.

Definition at line 118 of file kcmodule.cpp.

References KConfig\-Dialog\-Manager::update\-Widgets\-Default().\index{KCModule@{KCModule}!sysdefaults@{sysdefaults}}
\index{sysdefaults@{sysdefaults}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KCModule::sysdefaults ()\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKCModule_a6}


Set the configuration to system default values. 

This method is called when the user clicks the \char`\"{}System-Default\char`\"{} button. It should set the display to the system default values.

\begin{Desc}
\item[Note:]The default behavior is to call {\bf defaults()}{\rm (p.\,\pageref{classKCModule_a5})}. \end{Desc}


Definition at line 166 of file kcmodule.h.\index{KCModule@{KCModule}!quickHelp@{quickHelp}}
\index{quickHelp@{quickHelp}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KCModule::quick\-Help () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKCModule_a7}


Return a quick-help text. 

This method is called when the module is docked. The quick-help text should contain a short description of the module and links to the module's help files. You can use QML formatting tags in the text.

\begin{Desc}
\item[Note:]make sure the quick help text gets translated (use i18n()). \end{Desc}


Definition at line 181 of file kcmodule.cpp.\index{KCModule@{KCModule}!aboutData@{aboutData}}
\index{aboutData@{aboutData}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf KAbout\-Data} $\ast$ KCModule::about\-Data () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKCModule_a8}


This is generally only called for the {\bf KBug\-Report}{\rm (p.\,\pageref{classKBugReport})}. 

If you override you should have it return a pointer to a constant.

\begin{Desc}
\item[Returns:]the {\bf KAbout\-Data} for this module \end{Desc}


Definition at line 134 of file kcmodule.cpp.\index{KCModule@{KCModule}!setAboutData@{setAboutData}}
\index{setAboutData@{setAboutData}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCModule::set\-About\-Data ({\bf KAbout\-Data} $\ast$ {\em about})}\label{classKCModule_a9}


This sets the {\bf KAbout\-Data} returned by {\bf about\-Data()}{\rm (p.\,\pageref{classKCModule_a8})} \begin{Desc}
\item[Since:]3.3. \end{Desc}




Definition at line 139 of file kcmodule.cpp.\index{KCModule@{KCModule}!buttons@{buttons}}
\index{buttons@{buttons}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KCModule::buttons () const\hspace{0.3cm}{\tt  [inline]}}\label{classKCModule_a10}


Indicate which buttons will be used. 

The return value is a value or'ed together from the Button enumeration type.

\begin{Desc}
\item[See also:]{\bf KCModule::set\-Buttons}{\rm (p.\,\pageref{classKCModule_b2})} \end{Desc}


Definition at line 203 of file kcmodule.h.\index{KCModule@{KCModule}!rootOnlyMsg@{rootOnlyMsg}}
\index{rootOnlyMsg@{rootOnlyMsg}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KCModule::root\-Only\-Msg () const}\label{classKCModule_a11}


Get the Root\-Only message for this module. 

When the module must be run as root, or acts differently for root and a normal user, it is sometimes useful to customize the message that appears at the top of the module when used as a normal user. This function returns this customized message. If none has been set, a default message will be used.

\begin{Desc}
\item[See also:]{\bf KCModule::set\-Root\-Only\-Msg}{\rm (p.\,\pageref{classKCModule_b3})} \end{Desc}


Definition at line 150 of file kcmodule.cpp.\index{KCModule@{KCModule}!useRootOnlyMsg@{useRootOnlyMsg}}
\index{useRootOnlyMsg@{useRootOnlyMsg}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KCModule::use\-Root\-Only\-Msg () const}\label{classKCModule_a12}


Tell if KControl should show a Root\-Only message when run as a normal user. 

In some cases, the module don't want a Root\-Only message to appear (for example if it has already one). This function tells KControl if a Root\-Only message should be shown

\begin{Desc}
\item[See also:]{\bf KCModule::set\-Use\-Root\-Only\-Msg}{\rm (p.\,\pageref{classKCModule_b4})} \end{Desc}


Definition at line 160 of file kcmodule.cpp.\index{KCModule@{KCModule}!configs@{configs}}
\index{configs@{configs}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const {\bf QPtr\-List}$<$ {\bf KConfig\-Dialog\-Manager} $>$ \& KCModule::configs () const}\label{classKCModule_a14}


\begin{Desc}
\item[Returns:]a list of {\bf KConfig\-Dialog\-Manager}'s in use, if any. \end{Desc}
\begin{Desc}
\item[Since:]3.4 \end{Desc}


Definition at line 187 of file kcmodule.cpp.\index{KCModule@{KCModule}!addConfig@{addConfig}}
\index{addConfig@{addConfig}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KConfig\-Dialog\-Manager} $\ast$ KCModule::add\-Config ({\bf KConfig\-Skeleton} $\ast$ {\em config}, {\bf QWidget} $\ast$ {\em widget})\hspace{0.3cm}{\tt  [protected]}}\label{classKCModule_b0}


Adds a KConfigskeleton {\tt config} to watch the widget {\tt widget}. 

This function is useful if you need to handle multiple configuration files.

\begin{Desc}
\item[Since:]3.3 \end{Desc}
\begin{Desc}
\item[Returns:]a pointer to the {\bf KConfig\-Dialog\-Manager} in use \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em config}]the {\bf KConfig\-Skeleton} to use \item[{\em widget}]the widget to watch \end{description}
\end{Desc}


Definition at line 87 of file kcmodule.cpp.

References widget\-Changed().\index{KCModule@{KCModule}!setQuickHelp@{setQuickHelp}}
\index{setQuickHelp@{setQuickHelp}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCModule::set\-Quick\-Help (const {\bf QString} \& {\em help})\hspace{0.3cm}{\tt  [protected]}}\label{classKCModule_b1}


Sets the quick help. 

\begin{Desc}
\item[Since:]3.3 \end{Desc}


Definition at line 175 of file kcmodule.cpp.

References quick\-Help\-Changed().\index{KCModule@{KCModule}!changed@{changed}}
\index{changed@{changed}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCModule::changed (bool {\em state})\hspace{0.3cm}{\tt  [signal]}}\label{classKCModule_l0}


Indicate that the state of the modules contents has changed. 

This signal is emitted whenever the state of the configuration shown in the module changes. It allows the control center to keep track of unsaved changes. \index{KCModule@{KCModule}!quickHelpChanged@{quickHelpChanged}}
\index{quickHelpChanged@{quickHelpChanged}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCModule::quick\-Help\-Changed ()\hspace{0.3cm}{\tt  [signal]}}\label{classKCModule_l1}


Indicate that the module's quickhelp has changed. 

Emit this signal whenever the module's quickhelp changes. Modules implemented as tabbed dialogs might want to implement per-tab quickhelp for example. 

Referenced by set\-Quick\-Help().\index{KCModule@{KCModule}!changed@{changed}}
\index{changed@{changed}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCModule::changed ()\hspace{0.3cm}{\tt  [protected, slot]}}\label{classKCModule_j0}


Calling this slot is equivalent to emitting changed(true). 

\begin{Desc}
\item[Since:]3.3 \end{Desc}


Definition at line 165 of file kcmodule.cpp.

Referenced by save(), and widget\-Changed().\index{KCModule@{KCModule}!widgetChanged@{widgetChanged}}
\index{widgetChanged@{widgetChanged}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCModule::widget\-Changed ()\hspace{0.3cm}{\tt  [protected, slot]}}\label{classKCModule_j1}


A managed widget was changed, the widget settings and the current settings are compared and a corresponding {\bf changed()}{\rm (p.\,\pageref{classKCModule_j0})} signal is emitted \begin{Desc}
\item[Since:]3.4. \end{Desc}




Definition at line 125 of file kcmodule.cpp.

References changed(), and KConfig\-Dialog\-Manager::has\-Changed().

Referenced by add\-Config().\index{KCModule@{KCModule}!setButtons@{setButtons}}
\index{setButtons@{setButtons}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCModule::set\-Buttons (int {\em btn})\hspace{0.3cm}{\tt  [inline, protected]}}\label{classKCModule_b2}


Sets the buttons to display. 

Help: shows a \char`\"{}Help\char`\"{} button. Default: shows a \char`\"{}Use Defaults\char`\"{} button Apply: in kcontrol this will show an \char`\"{}Apply\char`\"{} and \char`\"{}Reset\char`\"{} button in kcmshell this will show an \char`\"{}Ok\char`\"{}, \char`\"{}Apply\char`\"{} and \char`\"{}Cancel\char`\"{} button

If Apply is not specified, kcmshell will show a \char`\"{}Close\char`\"{} button.

\begin{Desc}
\item[See also:]{\bf KCModule::buttons}{\rm (p.\,\pageref{classKCModule_a10})} \end{Desc}


Definition at line 309 of file kcmodule.h.\index{KCModule@{KCModule}!setRootOnlyMsg@{setRootOnlyMsg}}
\index{setRootOnlyMsg@{setRootOnlyMsg}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCModule::set\-Root\-Only\-Msg (const {\bf QString} \& {\em msg})\hspace{0.3cm}{\tt  [protected]}}\label{classKCModule_b3}


Sets the Root\-Only message. 

This message will be shown at the top of the module of the corresponding desktop file contains the line X-KDE-Root\-Only=true. If no message is set, a default one will be used.

\begin{Desc}
\item[See also:]{\bf KCModule::root\-Only\-Msg}{\rm (p.\,\pageref{classKCModule_a11})} \end{Desc}


Definition at line 145 of file kcmodule.cpp.\index{KCModule@{KCModule}!setUseRootOnlyMsg@{setUseRootOnlyMsg}}
\index{setUseRootOnlyMsg@{setUseRootOnlyMsg}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCModule::set\-Use\-Root\-Only\-Msg (bool {\em on})\hspace{0.3cm}{\tt  [protected]}}\label{classKCModule_b4}


Change wether or not the Root\-Only message should be shown. 

Following the value of {\tt on}, the Root\-Only message will be shown or not.

\begin{Desc}
\item[See also:]{\bf KCModule::use\-Root\-Only\-Msg}{\rm (p.\,\pageref{classKCModule_a12})} \end{Desc}


Definition at line 155 of file kcmodule.cpp.

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