\section{KConfig\-Dialog Class Reference}
\label{classKConfigDialog}\index{KConfigDialog@{KConfigDialog}}
Standard KDE configuration dialog class.  


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

Inheritance diagram for KConfig\-Dialog:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=58pt]{classKConfigDialog__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KConfig\-Dialog:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=135pt]{classKConfigDialog__coll__graph}
\end{center}
\end{figure}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf widget\-Modified} ()
\item 
void {\bf settings\-Changed} ()
\item 
void {\bf settings\-Changed} (const char $\ast$dialog\-Name)
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KConfig\-Dialog} ({\bf QWidget} $\ast$parent, const char $\ast$name, {\bf KConfig\-Skeleton} $\ast$config, {\bf Dialog\-Type} dialog\-Type=Icon\-List, int dialog\-Buttons=Default$|$Ok$|$Apply$|$Cancel$|$Help, {\bf Button\-Code} default\-Button=Ok, bool modal=false)
\item 
{\bf $\sim$KConfig\-Dialog} ()
\item 
void {\bf add\-Page} ({\bf QWidget} $\ast$page, const {\bf QString} \&item\-Name, const {\bf QString} \&pixmap\-Name, const {\bf QString} \&header=QString::null, bool manage=true)
\item 
void {\bf add\-Page} ({\bf QWidget} $\ast$page, {\bf KConfig\-Skeleton} $\ast$config, const {\bf QString} \&item\-Name, const {\bf QString} \&pixmap\-Name, const {\bf QString} \&header=QString::null)
\item 
virtual void {\bf show} ()
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf KConfig\-Dialog} $\ast$ {\bf exists} (const char $\ast$name)
\item 
static bool {\bf show\-Dialog} (const char $\ast$name)
\end{CompactItemize}
\subsection*{Protected Slots}
\begin{CompactItemize}
\item 
virtual void {\bf update\-Settings} ()
\item 
virtual void {\bf update\-Widgets} ()
\item 
virtual void {\bf update\-Widgets\-Default} ()
\item 
void {\bf update\-Buttons} ()
\item 
void {\bf settings\-Changed\-Slot} ()
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual bool {\bf has\-Changed} ()
\item 
virtual bool {\bf is\-Default} ()
\end{CompactItemize}


\subsection{Detailed Description}
Standard KDE configuration dialog class. 

The KConfig\-Dialog class provides an easy and uniform means of displaying a settings dialog using {\bf KDialog\-Base}{\rm (p.\,\pageref{classKDialogBase})}, {\bf KConfig\-Dialog\-Manager} and a {\bf KConfig\-Skeleton} derived settings class.

KConfig\-Dialog handles the enabling and disabling of buttons, creation of the dialog, and deletion of the widgets. Because of {\bf KConfig\-Dialog\-Manager}, this class also manages: restoring the settings, reseting them to the default values, and saving them. This requires that the names of the widgets corresponding to configuration entries have to have the same name plus an additional \char`\"{}kcfg\_\-\char`\"{} prefix. For example the widget named \char`\"{}kcfg\_\-My\-Option\char`\"{} would be associated with the configuration entry \char`\"{}My\-Option\char`\"{}.

Here is an example usage of KConfig\-Dialog:



\footnotesize\begin{verbatim} void KCoolApp::showSettings(){
   if(KConfigDialog::showDialog("settings"))
     return;
   KConfigDialog *dialog = new KConfigDialog(this, "settings", MySettings::self(), KDialogBase::IconList);
   dialog->addPage(new General(0, "General"), i18n("General") );
   dialog->addPage(new Appearance(0, "Style"), i18n("Appearance") );
   connect(dialog, SIGNAL(settingsChanged()), mainWidget, SLOT(loadSettings()));
   connect(dialog, SIGNAL(settingsChanged()), this, SLOT(loadSettings()));
   dialog->show();
 }
\end{verbatim}
\normalsize


Other than the above code, each class that has settings in the dialog should have a load\-Settings() type slot to read settings and perform any necessary changes.

Please note that using the set\-Main\-Widget method inherited from {\bf KDialog\-Base}{\rm (p.\,\pageref{classKDialogBase})} currently yields broken behaviour at runtime; use {\bf add\-Page()}{\rm (p.\,\pageref{classKConfigDialog_a2})} instead.

\begin{Desc}
\item[See also:]{\bf KConfig\-Skeleton} \end{Desc}
\begin{Desc}
\item[Author:]Waldo Bastian $<${\tt bastian@kde.org}$>$ \end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}




Definition at line 72 of file kconfigdialog.h.

\subsection{Constructor \& Destructor Documentation}
\index{KConfigDialog@{KConfig\-Dialog}!KConfigDialog@{KConfigDialog}}
\index{KConfigDialog@{KConfigDialog}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KConfig\-Dialog::KConfig\-Dialog ({\bf QWidget} $\ast$ {\em parent}, const char $\ast$ {\em name}, {\bf KConfig\-Skeleton} $\ast$ {\em config}, {\bf Dialog\-Type} {\em dialog\-Type} = {\tt IconList}, int {\em dialog\-Buttons} = {\tt Default$|$Ok$|$Apply$|$Cancel$|$Help}, {\bf Button\-Code} {\em default\-Button} = {\tt Ok}, bool {\em modal} = {\tt false})}\label{classKConfigDialog_a0}


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em parent}]- The parent of this object. Even though the class deletes itself the parent should be set so the dialog can be centered with the application on the screen.\item[{\em name}]- The name of this object. The name is used in determining if there can be more than one dialog at a time. Use names such as: \char`\"{}Font Settings\char`\"{} or \char`\"{}Color Settings\char`\"{} and not just \char`\"{}Settings\char`\"{} in applications where there is more than one dialog.\item[{\em dialog\-Type}]- Type used in creating the dialog. \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf KDialog\-Base}{\rm (p.\,\pageref{classKDialogBase})}\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em config}]- Config object containing settings.\item[{\em dialog\-Buttons}]- Buttons that should show up on the dialog.\item[{\em default\-Button}]default button that is choosen by hitting the enter key.\item[{\em modal}]- Whether the dialog should be modal. To prevent more than one non-modal settings dialog from showing the static function {\bf show\-Dialog()}{\rm (p.\,\pageref{classKConfigDialog_e1})} can be used in determining if the settings dialog already exists before creating a new KConfig\-Dialog object. \end{description}
\end{Desc}


Definition at line 49 of file kconfigdialog.cpp.

References KDialog\-Base::apply\-Clicked(), KDialog\-Base::default\-Clicked(), KDialog\-Base::enable\-Button(), QAscii\-Dict::insert(), KDialog\-Base::ok\-Clicked(), QCString::sprintf(), update\-Buttons(), update\-Settings(), and update\-Widgets\-Default().\index{KConfigDialog@{KConfig\-Dialog}!~KConfigDialog@{$\sim$KConfigDialog}}
\index{~KConfigDialog@{$\sim$KConfigDialog}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KConfig\-Dialog::$\sim${\bf KConfig\-Dialog} ()}\label{classKConfigDialog_a1}


Deconstructor, removes name from the list of open dialogs. 

Deletes private class. \begin{Desc}
\item[See also:]{\bf exists()}{\rm (p.\,\pageref{classKConfigDialog_e0})} \end{Desc}


Definition at line 80 of file kconfigdialog.cpp.

References QAscii\-Dict::remove().

\subsection{Member Function Documentation}
\index{KConfigDialog@{KConfig\-Dialog}!widgetModified@{widgetModified}}
\index{widgetModified@{widgetModified}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig\-Dialog::widget\-Modified ()\hspace{0.3cm}{\tt  [signal]}}\label{classKConfigDialog_l0}


A widget in the dialog was modified. 



Referenced by update\-Buttons().\index{KConfigDialog@{KConfig\-Dialog}!settingsChanged@{settingsChanged}}
\index{settingsChanged@{settingsChanged}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig\-Dialog::settings\-Changed ()\hspace{0.3cm}{\tt  [signal]}}\label{classKConfigDialog_l1}


One or more of the settings have been permanently changed such as if the user clicked on the Apply or Ok button. 



Referenced by settings\-Changed\-Slot().\index{KConfigDialog@{KConfig\-Dialog}!settingsChanged@{settingsChanged}}
\index{settingsChanged@{settingsChanged}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig\-Dialog::settings\-Changed (const char $\ast$ {\em dialog\-Name})\hspace{0.3cm}{\tt  [signal]}}\label{classKConfigDialog_l2}


One or more of the settings have been permanently changed such as if the user clicked on the Apply or Ok button. 

This signal is useful when using KConfig\-Dialog to configure items in a list. When emitted the main class would then know what item in the list was actually changed. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dialog\-Name}]the name of the dialog. \end{description}
\end{Desc}
\index{KConfigDialog@{KConfig\-Dialog}!addPage@{addPage}}
\index{addPage@{addPage}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig\-Dialog::add\-Page ({\bf QWidget} $\ast$ {\em page}, const {\bf QString} \& {\em item\-Name}, const {\bf QString} \& {\em pixmap\-Name}, const {\bf QString} \& {\em header} = {\tt QString::null}, bool {\em manage} = {\tt true})}\label{classKConfigDialog_a2}


Adds page to the dialog and to {\bf KConfig\-Dialog\-Manager}. 

When an application is done adding pages {\bf show()}{\rm (p.\,\pageref{classKConfigDialog_a4})} should be called to display the dialog. Note that after you call {\bf show()}{\rm (p.\,\pageref{classKConfigDialog_a4})} you can not add any more pages to the dialog. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em page}]- Pointer to the page that is to be added to the dialog. This object is reparented. \item[{\em item\-Name}]- Name of the page. \item[{\em pixmap\-Name}]- Name of the pixmap that should be used if needed. \item[{\em header}]- Header text use in the list modes. Ignored in Tabbed mode. If empty, the item\-Name text is used when needed. \item[{\em manage}]- Whether {\bf KConfig\-Dialog\-Manager} should manage the page or not. \end{description}
\end{Desc}


Definition at line 86 of file kconfigdialog.cpp.\index{KConfigDialog@{KConfig\-Dialog}!addPage@{addPage}}
\index{addPage@{addPage}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig\-Dialog::add\-Page ({\bf QWidget} $\ast$ {\em page}, {\bf KConfig\-Skeleton} $\ast$ {\em config}, const {\bf QString} \& {\em item\-Name}, const {\bf QString} \& {\em pixmap\-Name}, const {\bf QString} \& {\em header} = {\tt QString::null})}\label{classKConfigDialog_a3}


Adds page to the dialog that is managed by a custom {\bf KConfig\-Dialog\-Manager}. 

This is useful for dialogs that contain settings spread over more than one configuration file and thus have/need more than one {\bf KConfig\-Skeleton}. When an application is done adding pages {\bf show()}{\rm (p.\,\pageref{classKConfigDialog_a4})} should be called to display the dialog. Note that after you call {\bf show()}{\rm (p.\,\pageref{classKConfigDialog_a4})} you can not add any more pages to the dialog. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em page}]- Pointer to the page that is to be added to the dialog. This object is reparented. \item[{\em config}]- Config object containing corresponding settings. \item[{\em item\-Name}]- Name of the page. \item[{\em pixmap\-Name}]- Name of the pixmap that should be used if needed. \item[{\em header}]- Header text use in the list modes. Ignored in Tabbed mode. If empty, the item\-Name text is used when needed. \end{description}
\end{Desc}


Definition at line 97 of file kconfigdialog.cpp.\index{KConfigDialog@{KConfig\-Dialog}!exists@{exists}}
\index{exists@{exists}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KConfig\-Dialog} $\ast$ KConfig\-Dialog::exists (const char $\ast$ {\em name})\hspace{0.3cm}{\tt  [static]}}\label{classKConfigDialog_e0}


See if a dialog with the name 'name' already exists. 

\begin{Desc}
\item[See also:]{\bf show\-Dialog()}{\rm (p.\,\pageref{classKConfigDialog_e1})} \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]- Dialog name to look for. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to widget or NULL if it does not exist. \end{Desc}


Definition at line 161 of file kconfigdialog.cpp.

References QAscii\-Dict::find().

Referenced by show\-Dialog().\index{KConfigDialog@{KConfig\-Dialog}!showDialog@{showDialog}}
\index{showDialog@{showDialog}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KConfig\-Dialog::show\-Dialog (const char $\ast$ {\em name})\hspace{0.3cm}{\tt  [static]}}\label{classKConfigDialog_e1}


Attempts to show the dialog with the name 'name'. 

\begin{Desc}
\item[See also:]{\bf exists()}{\rm (p.\,\pageref{classKConfigDialog_e0})} \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]- The name of the dialog to show. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]True if the dialog 'name' exists and was shown. \end{Desc}


Definition at line 166 of file kconfigdialog.cpp.

References exists(), and show().\index{KConfigDialog@{KConfig\-Dialog}!show@{show}}
\index{show@{show}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig\-Dialog::show ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKConfigDialog_a4}


Show the dialog. 



Reimplemented from {\bf QDialog}.

Definition at line 214 of file kconfigdialog.cpp.

References QMap::begin(), KDialog\-Base::enable\-Button(), QMap::end(), has\-Changed(), is\-Default(), QDialog::show(), and update\-Widgets().

Referenced by show\-Dialog().\index{KConfigDialog@{KConfig\-Dialog}!updateSettings@{updateSettings}}
\index{updateSettings@{updateSettings}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig\-Dialog::update\-Settings ()\hspace{0.3cm}{\tt  [protected, virtual, slot]}}\label{classKConfigDialog_j0}


Update the settings from the dialog. 

Virtual function for custom additions.

Example use: User clicks Ok or Apply button in a configure dialog. 

Definition at line 246 of file kconfigdialog.cpp.

Referenced by KConfig\-Dialog().\index{KConfigDialog@{KConfig\-Dialog}!updateWidgets@{updateWidgets}}
\index{updateWidgets@{updateWidgets}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig\-Dialog::update\-Widgets ()\hspace{0.3cm}{\tt  [protected, virtual, slot]}}\label{classKConfigDialog_j1}


Update the dialog based on the settings. 

Virtual function for custom additions.

Example use: Initialisation of dialog. Example use: User clicks Reset button in a configure dialog. 

Definition at line 250 of file kconfigdialog.cpp.

Referenced by show().\index{KConfigDialog@{KConfig\-Dialog}!updateWidgetsDefault@{updateWidgetsDefault}}
\index{updateWidgetsDefault@{updateWidgetsDefault}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig\-Dialog::update\-Widgets\-Default ()\hspace{0.3cm}{\tt  [protected, virtual, slot]}}\label{classKConfigDialog_j2}


Update the dialog based on the default settings. 

Virtual function for custom additions.

Example use: User clicks Defaults button in a configure dialog. 

Definition at line 254 of file kconfigdialog.cpp.

Referenced by KConfig\-Dialog().\index{KConfigDialog@{KConfig\-Dialog}!hasChanged@{hasChanged}}
\index{hasChanged@{hasChanged}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool KConfig\-Dialog::has\-Changed ()\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKConfigDialog_b0}


Returns whether the current state of the dialog is different from the current configutation. 

Virtual function for custom additions. 

Definition at line 233 of file kconfigdialog.h.

Referenced by show(), and update\-Buttons().\index{KConfigDialog@{KConfig\-Dialog}!isDefault@{isDefault}}
\index{isDefault@{isDefault}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool KConfig\-Dialog::is\-Default ()\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKConfigDialog_b1}


Returns whether the current state of the dialog is the same as the default configuration. 



Definition at line 239 of file kconfigdialog.h.

Referenced by show(), and update\-Buttons().\index{KConfigDialog@{KConfig\-Dialog}!updateButtons@{updateButtons}}
\index{updateButtons@{updateButtons}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig\-Dialog::update\-Buttons ()\hspace{0.3cm}{\tt  [protected, slot]}}\label{classKConfigDialog_j3}


Updates the Apply and Default buttons. 



Definition at line 174 of file kconfigdialog.cpp.

References QMap::begin(), KDialog\-Base::enable\-Button(), QMap::end(), has\-Changed(), is\-Default(), and widget\-Modified().

Referenced by KConfig\-Dialog(), and settings\-Changed\-Slot().\index{KConfigDialog@{KConfig\-Dialog}!settingsChangedSlot@{settingsChangedSlot}}
\index{settingsChangedSlot@{settingsChangedSlot}!KConfigDialog@{KConfig\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KConfig\-Dialog::settings\-Changed\-Slot ()\hspace{0.3cm}{\tt  [protected, slot]}}\label{classKConfigDialog_j4}


Some setting was changed. 

Emit the signal with the dialogs name 

Definition at line 206 of file kconfigdialog.cpp.

References settings\-Changed(), and update\-Buttons().

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