\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=50pt]{classKCModule__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KCModule:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=50pt]{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
 \}
\begin{CompactList}\small\item\em An enumeration type for the buttons used by this module. \item\end{CompactList}\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf changed} (bool state)
\begin{CompactList}\small\item\em Indicate that the state of the modules contents has changed. \item\end{CompactList}\item 
void {\bf quick\-Help\-Changed} ()
\begin{CompactList}\small\item\em Indicate that the module's quickhelp has changed. \item\end{CompactList}\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} ()
\begin{CompactList}\small\item\em Load the configuration data into the module. \item\end{CompactList}\item 
virtual void {\bf save} ()
\begin{CompactList}\small\item\em Save the configuration data. \item\end{CompactList}\item 
virtual void {\bf defaults} ()
\begin{CompactList}\small\item\em Sets the configuration to sensible default values. \item\end{CompactList}\item 
virtual void {\bf sysdefaults} ()
\begin{CompactList}\small\item\em Set the configuration to system default values. \item\end{CompactList}\item 
virtual {\bf QString} {\bf quick\-Help} () const 
\begin{CompactList}\small\item\em Return a quick-help text. \item\end{CompactList}\item 
virtual const  {\bf KAbout\-Data} $\ast$ {\bf about\-Data} () const 
\begin{CompactList}\small\item\em Returns a the {\bf KAbout\-Data} for this module This is generally only called for the {\bf KBug\-Report}{\rm (p.\,\pageref{classKBugReport})}. \item\end{CompactList}\item 
int {\bf buttons} () const 
\begin{CompactList}\small\item\em Indicate which buttons will be used. \item\end{CompactList}\item 
{\bf QString} {\bf root\-Only\-Msg} () const 
\begin{CompactList}\small\item\em Get the Root\-Only message for this module. \item\end{CompactList}\item 
bool {\bf use\-Root\-Only\-Msg} () const 
\begin{CompactList}\small\item\em Tell if KControl should show a Root\-Only message when run as a normal user. \item\end{CompactList}\item 
{\bf KInstance} $\ast$ {\bf instance} () const \label{classKCModule_a12}

\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
void {\bf set\-Buttons} (int btn)
\begin{CompactList}\small\item\em Sets the buttons to display. \item\end{CompactList}\item 
void {\bf set\-Root\-Only\-Msg} (const  {\bf QString} \&msg)
\begin{CompactList}\small\item\em Sets the Root\-Only message. \item\end{CompactList}\item 
void {\bf set\-Use\-Root\-Only\-Msg} (bool on)
\begin{CompactList}\small\item\em Change wether or not the Root\-Only message should be shown. \item\end{CompactList}\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKCModule_b3}

\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:

\small\begin{alltt}
 #include $<$kgenericfactory.h$>$\end{alltt}\normalsize 


\small\begin{alltt} typedef KGenericFactory<YourKCModule, QWidget> YourKCModuleFactory;
 K\_EXPORT\_COMPONENT\_FACTORY( yourLibName, YourKCModuleFactory("name\_of\_the\_po\_file") );
 \end{alltt}\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 kdebase/kcontrol/HOWTO for more detailed documentation.

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




Definition at line 62 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_a9})} 

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


Definition at line 74 of file kcmodule.h.

\subsection{Member Function Documentation}
\index{KCModule@{KCModule}!load@{load}}
\index{load@{load}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KCModule::load ()\hspace{0.3cm}{\tt  [inline, 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. NOTE that this is not called after the modules is loaded, so you probably want to call this method in the constructor. 

Definition at line 108 of file kcmodule.h.\index{KCModule@{KCModule}!save@{save}}
\index{save@{save}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KCModule::save ()\hspace{0.3cm}{\tt  [inline, 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.

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

Definition at line 121 of file kcmodule.h.\index{KCModule@{KCModule}!defaults@{defaults}}
\index{defaults@{defaults}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KCModule::defaults ()\hspace{0.3cm}{\tt  [inline, 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. 

Definition at line 129 of file kcmodule.h.

Referenced by sysdefaults().\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.

NOTE: The default behaviour is to call {\bf defaults()}{\rm (p.\,\pageref{classKCModule_a5})}. 

Definition at line 139 of file kcmodule.h.

References defaults().\index{KCModule@{KCModule}!quickHelp@{quickHelp}}
\index{quickHelp@{quickHelp}!KCModule@{KCModule}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual {\bf QString} KCModule::quick\-Help () const\hspace{0.3cm}{\tt  [inline, 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 formating tags in the text.

NOTE: Please make sure the quick help text gets translated (use i18n()). 

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


Returns a the {\bf KAbout\-Data} for this module This is generally only called for the {\bf KBug\-Report}{\rm (p.\,\pageref{classKBugReport})}. 

Override and have it return a pointer to a constant 

Definition at line 157 of file kcmodule.h.\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_a9}


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_b0})} \end{Desc}


Definition at line 167 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_a10}


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_b1})} \end{Desc}


Definition at line 78 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_a11}


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_b2})} \end{Desc}


Definition at line 88 of file kcmodule.cpp.\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. \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_b0}


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_a9})} \end{Desc}


Definition at line 234 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_b1}


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:]KCModule::root\-Only\-Message \end{Desc}


Definition at line 73 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_b2}


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_a11})} \end{Desc}


Definition at line 83 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}
