\section{KPassword\-Dialog Class Reference}
\label{classKPasswordDialog}\index{KPasswordDialog@{KPasswordDialog}}
This dialog asks the user to enter a password. A password input dialog.  


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

Inheritance diagram for KPassword\-Dialog:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=67pt]{classKPasswordDialog__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KPassword\-Dialog:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=250pt]{classKPasswordDialog__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Types} \{ {\bf Password}, 
{\bf New\-Password}
 \}
\begin{CompactList}\small\item\em This enum distinguishes the two operation modes of this dialog:. \item\end{CompactList}\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KPassword\-Dialog} ({\bf Types} type, bool enable\-Keep, int extra\-Bttn, {\bf QWidget} $\ast$parent=0, const  char $\ast$name=0)
\begin{CompactList}\small\item\em Constructs a password dialog. \item\end{CompactList}\item 
{\bf KPassword\-Dialog} (int type, {\bf QString} prompt, bool enable\-Keep=false, int extra\-Bttn=0)
\begin{CompactList}\small\item\em {\bf This class or method is obsolete, it is provided for compatibility only.} Variant of the previous constructor without the possibility to specify a parent. \item\end{CompactList}\item 
virtual {\bf $\sim$KPassword\-Dialog} ()
\begin{CompactList}\small\item\em Destructs the password dialog. \item\end{CompactList}\item 
void {\bf set\-Prompt} ({\bf QString} prompt)
\begin{CompactList}\small\item\em Sets the password prompt. \item\end{CompactList}\item 
{\bf QString} {\bf prompt} () const 
\begin{CompactList}\small\item\em Returns the password prompt. \item\end{CompactList}\item 
void {\bf add\-Line} ({\bf QString} key, {\bf QString} value)
\begin{CompactList}\small\item\em Adds a line of information to the dialog. \item\end{CompactList}\item 
const  char $\ast$ {\bf password} () const 
\begin{CompactList}\small\item\em Returns the password entered. \item\end{CompactList}\item 
bool {\bf keep} () const 
\begin{CompactList}\small\item\em Returns true if the user wants to keep the password. \item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
int {\bf get\-Password} ({\bf QCString} \&password, {\bf QString} prompt, int $\ast$keep=0L)
\begin{CompactList}\small\item\em Pops up the dialog, asks the user for a password, and returns it. \item\end{CompactList}\item 
int {\bf get\-New\-Password} ({\bf QCString} \&password, {\bf QString} prompt)
\begin{CompactList}\small\item\em Pops up the dialog, asks the user for a password and returns it. \item\end{CompactList}\item 
void {\bf disable\-Core\-Dumps} ()
\begin{CompactList}\small\item\em Static helper funtion that disables core dumps. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Slots}
\begin{CompactItemize}
\item 
void {\bf slot\-Ok} ()
\begin{CompactList}\small\item\em Activated when the Ok button has been clicked. \item\end{CompactList}\item 
void {\bf slot\-Cancel} ()
\begin{CompactList}\small\item\em Activated when the Cancel button has been clicked. \item\end{CompactList}\item 
void {\bf slot\-Keep} (bool)\label{classKPasswordDialog_j2}

\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual bool {\bf check\-Password} (const  char $\ast$)
\begin{CompactList}\small\item\em Virtual function that can be overridden to provide password checking in derived classes. \item\end{CompactList}\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKPasswordDialog_b1}

\end{CompactItemize}


\subsection{Detailed Description}
This dialog asks the user to enter a password. A password input dialog. 

The functions you're probably interested in are the static methods, {\bf get\-Password}{\rm (p.\,\pageref{classKPasswordDialog_e0})}() and {\bf get\-New\-Password}{\rm (p.\,\pageref{classKPasswordDialog_e1})}().

{\bf  Usage example}

{\bf  \small\begin{alltt}
 {\bf QCString} password;
 int result = {\bf KPasswordDialog::getPassword}{\rm (p.\,\pageref{classKPasswordDialog_e0})}(password, i18n("Password"));
 if (result == KPasswordDialog::Accepted)
     use(password);
 \end{alltt}\normalsize 
}

{\bf  }

{\bf {\bf  Security notes}}

{\bf {\bf  Keeping passwords in memory can be a potential security hole. You should handle this situation with care.}}

{\bf {\bf  \begin{itemize}
\item You may want to use disable\-Core\-Dump() to disable core dumps. Core dumps are dangerous because they are an image of the process memory, and thus include any passwords that were in memory.\end{itemize}
\begin{itemize}
\item You should delete passwords as soon as they are not needed anymore. The functions {\bf get\-Password}{\rm (p.\,\pageref{classKPasswordDialog_e0})}() and {\bf get\-New\-Password}{\rm (p.\,\pageref{classKPasswordDialog_e1})}() return the password as a {\bf QCString}. I believe this is safer than a {\bf QString}. A {\bf QString} stores its characters internally as 16-bit wide values, so conversions are needed, both for creating the {\bf QString} and by using it. The temporary memory used for these conversion is probably not erased. This could lead to stray passwords in memory, even if you think you erased all of them.\end{itemize}
}}

{\bf {\bf \begin{Desc}
\item[Author:]Geert Jansen $<${\tt jansen@kde.org}$>$ \end{Desc}
}}



Definition at line 133 of file kpassdlg.h.

\subsection{Member Enumeration Documentation}
\index{KPasswordDialog@{KPassword\-Dialog}!Types@{Types}}
\index{Types@{Types}!KPasswordDialog@{KPassword\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KPassword\-Dialog::Types}}\label{classKPasswordDialog_w2}


This enum distinguishes the two operation modes of this dialog:. 

\begin{Desc}
\item[Enumeration values: ]\par
\begin{description}
\index{Password@{Password}!KPasswordDialog@{KPasswordDialog}}\index{KPasswordDialog@{KPasswordDialog}!Password@{Password}}\item[{\em 
Password\label{classKPasswordDialog_w2w0}
}]The user is asked to enter a password. \index{NewPassword@{NewPassword}!KPasswordDialog@{KPasswordDialog}}\index{KPasswordDialog@{KPasswordDialog}!NewPassword@{NewPassword}}\item[{\em 
New\-Password\label{classKPasswordDialog_w2w1}
}]The user is asked to enter a password and to confirm it a second time. 

This is usually used when the user changes his password. \end{description}
\end{Desc}



Definition at line 142 of file kpassdlg.h.

\subsection{Constructor \& Destructor Documentation}
\index{KPasswordDialog@{KPassword\-Dialog}!KPasswordDialog@{KPasswordDialog}}
\index{KPasswordDialog@{KPasswordDialog}!KPasswordDialog@{KPassword\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KPassword\-Dialog::KPassword\-Dialog ({\bf Types} {\em type}, bool {\em enable\-Keep}, int {\em extra\-Bttn}, {\bf QWidget} $\ast$ {\em parent} = 0, const char $\ast$ {\em name} = 0)}\label{classKPasswordDialog_a0}


Constructs a password dialog. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em type:}]if New\-Password is given here, the dialog contains two input fields, so that the user must confirm his password and possible typos are detected immediately. \item[{\em enable\-Keep:}]if true, a check box is shown in the dialog which allows the user to keep his password input for later. \item[{\em extra\-Bttn:}]allows to show additional buttons, {\bf KDialog\-Base}{\rm (p.\,\pageref{classKDialogBase})}.\end{description}
\end{Desc}
\begin{Desc}
\item[Version:]New in 3.0 \end{Desc}


Definition at line 219 of file kpassdlg.cpp.

References KStd\-Accel::name().

Referenced by get\-New\-Password(), and get\-Password().\index{KPasswordDialog@{KPassword\-Dialog}!KPasswordDialog@{KPasswordDialog}}
\index{KPasswordDialog@{KPasswordDialog}!KPasswordDialog@{KPassword\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KPassword\-Dialog::KPassword\-Dialog (int {\em type}, {\bf QString} {\em prompt}, bool {\em enable\-Keep} = false, int {\em extra\-Bttn} = 0)}\label{classKPasswordDialog_a1}


{\bf This class or method is obsolete, it is provided for compatibility only.} Variant of the previous constructor without the possibility to specify a parent. 

May be removed in {\bf KDE} 4.0 

Definition at line 228 of file kpassdlg.cpp.

References set\-Prompt().\index{KPasswordDialog@{KPassword\-Dialog}!~KPasswordDialog@{$\sim$KPasswordDialog}}
\index{~KPasswordDialog@{$\sim$KPasswordDialog}!KPasswordDialog@{KPassword\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KPassword\-Dialog::$\sim${\bf KPassword\-Dialog} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKPasswordDialog_a2}


Destructs the password dialog. 



Definition at line 326 of file kpassdlg.cpp.

\subsection{Member Function Documentation}
\index{KPasswordDialog@{KPassword\-Dialog}!setPrompt@{setPrompt}}
\index{setPrompt@{setPrompt}!KPasswordDialog@{KPassword\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPassword\-Dialog::set\-Prompt ({\bf QString} {\em prompt})}\label{classKPasswordDialog_a3}


Sets the password prompt. 



Definition at line 331 of file kpassdlg.cpp.

References QLabel::set\-Text().

Referenced by KPassword\-Dialog().\index{KPasswordDialog@{KPassword\-Dialog}!prompt@{prompt}}
\index{prompt@{prompt}!KPasswordDialog@{KPassword\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KPassword\-Dialog::prompt () const}\label{classKPasswordDialog_a4}


Returns the password prompt. 



Definition at line 338 of file kpassdlg.cpp.

References QLabel::text().\index{KPasswordDialog@{KPassword\-Dialog}!addLine@{addLine}}
\index{addLine@{addLine}!KPasswordDialog@{KPassword\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPassword\-Dialog::add\-Line ({\bf QString} {\em key}, {\bf QString} {\em value})}\label{classKPasswordDialog_a5}


Adds a line of information to the dialog. 



Definition at line 345 of file kpassdlg.cpp.

References QGrid\-Layout::add\-Widget(), KStd\-Accel::key(), QLabel::set\-Alignment(), and QLabel::set\-Indent().\index{KPasswordDialog@{KPassword\-Dialog}!password@{password}}
\index{password@{password}!KPasswordDialog@{KPassword\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ KPassword\-Dialog::password () const\hspace{0.3cm}{\tt  [inline]}}\label{classKPasswordDialog_a6}


Returns the password entered. 

The memory is freed in the destructor, so you should make a copy. 

Definition at line 197 of file kpassdlg.h.

References KPassword\-Edit::password().

Referenced by get\-New\-Password(), and get\-Password().\index{KPasswordDialog@{KPassword\-Dialog}!keep@{keep}}
\index{keep@{keep}!KPasswordDialog@{KPassword\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KPassword\-Dialog::keep () const\hspace{0.3cm}{\tt  [inline]}}\label{classKPasswordDialog_a7}


Returns true if the user wants to keep the password. 



Definition at line 202 of file kpassdlg.h.

Referenced by get\-Password().\index{KPasswordDialog@{KPassword\-Dialog}!getPassword@{getPassword}}
\index{getPassword@{getPassword}!KPasswordDialog@{KPassword\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KPassword\-Dialog::get\-Password ({\bf QCString} \& {\em password}, {\bf QString} {\em prompt}, int $\ast$ {\em keep} = 0L)\hspace{0.3cm}{\tt  [static]}}\label{classKPasswordDialog_e0}


Pops up the dialog, asks the user for a password, and returns it. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em password}]The password is returned in this reference parameter. \item[{\em prompt}]A prompt for the password. This can be a few lines of information. The text is word broken to fit nicely in the dialog. \item[{\em keep}]Enable/disable a checkbox controlling password keeping. If you pass a null pointer, or a pointer to the value 0, the checkbox is not shown. If you pass a pointer to a nonzero value, the checkbox is shown and the result is stored in $\ast$keep. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Result code: Accepted or Rejected. \end{Desc}


Definition at line 405 of file kpassdlg.cpp.

References QDialog::exec(), keep(), KPassword\-Dialog(), password(), and Password.\index{KPasswordDialog@{KPassword\-Dialog}!getNewPassword@{getNewPassword}}
\index{getNewPassword@{getNewPassword}!KPasswordDialog@{KPassword\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KPassword\-Dialog::get\-New\-Password ({\bf QCString} \& {\em password}, {\bf QString} {\em prompt})\hspace{0.3cm}{\tt  [static]}}\label{classKPasswordDialog_e1}


Pops up the dialog, asks the user for a password and returns it. 

The user has to enter the password twice to make sure it was entered correctly.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em password}]The password is returned in this reference parameter. \item[{\em prompt}]A prompt for the password. This can be a few lines of information. The text is word broken to fit nicely in the dialog. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Result code: Accepted or Rejected. \end{Desc}


Definition at line 422 of file kpassdlg.cpp.

References QDialog::exec(), KPassword\-Dialog(), New\-Password, and password().\index{KPasswordDialog@{KPassword\-Dialog}!disableCoreDumps@{disableCoreDumps}}
\index{disableCoreDumps@{disableCoreDumps}!KPasswordDialog@{KPassword\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPassword\-Dialog::disable\-Core\-Dumps ()\hspace{0.3cm}{\tt  [static]}}\label{classKPasswordDialog_e2}


Static helper funtion that disables core dumps. 



Definition at line 434 of file kpassdlg.cpp.\index{KPasswordDialog@{KPassword\-Dialog}!slotOk@{slotOk}}
\index{slotOk@{slotOk}!KPasswordDialog@{KPassword\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPassword\-Dialog::slot\-Ok ()\hspace{0.3cm}{\tt  [protected, virtual, slot]}}\label{classKPasswordDialog_j0}


Activated when the Ok button has been clicked. 

The {\bf QDialog::accept}() is activated. 

Reimplemented from {\bf KDialog\-Base} {\rm (p.\,\pageref{classKDialogBase_j6})}.

Definition at line 374 of file kpassdlg.cpp.

References QDialog::accept(), check\-Password(), New\-Password, KPassword\-Edit::password(), and KMessage\-Box::sorry().\index{KPasswordDialog@{KPassword\-Dialog}!slotCancel@{slotCancel}}
\index{slotCancel@{slotCancel}!KPasswordDialog@{KPassword\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KPassword\-Dialog::slot\-Cancel ()\hspace{0.3cm}{\tt  [protected, virtual, slot]}}\label{classKPasswordDialog_j1}


Activated when the Cancel button has been clicked. 

The {\bf QDialog::reject}() is activated in regular mode and {\bf QDialog::done}( Cancel ) when in message box mode. 

Reimplemented from {\bf KDialog\-Base} {\rm (p.\,\pageref{classKDialogBase_j11})}.

Definition at line 392 of file kpassdlg.cpp.

References QDialog::reject().\index{KPasswordDialog@{KPassword\-Dialog}!checkPassword@{checkPassword}}
\index{checkPassword@{checkPassword}!KPasswordDialog@{KPassword\-Dialog}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool KPassword\-Dialog::check\-Password (const char $\ast$)\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKPasswordDialog_b0}


Virtual function that can be overridden to provide password checking in derived classes. 

It should return {\tt true} if the password is valid, {\tt false} otherwise. 

Definition at line 247 of file kpassdlg.h.

Referenced by slot\-Ok().

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