.TH "KPasswordDialog" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdeui Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KPasswordDialog \- A password input dialog.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kpassdlg.h>\fP
.PP
Inherits \fBKDialogBase\fP.
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "enum \fBTypes\fP { \fBPassword\fP, \fBNewPassword\fP }"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKPasswordDialog\fP (\fBTypes\fP type, bool enableKeep, int extraBttn, \fBQWidget\fP *parent=0, const char *name=0)"
.br
.ti -1c
.RI "\fBKPasswordDialog\fP (int type, \fBQString\fP prompt, bool enableKeep=false, int extraBttn=0) KDE_DEPRECATED"
.br
.ti -1c
.RI "\fBKPasswordDialog\fP (\fBTypes\fP type, bool enableKeep, int extraBttn, const \fBQString\fP &iconName, \fBQWidget\fP *parent=0, const char *name=0)"
.br
.ti -1c
.RI "virtual \fB~KPasswordDialog\fP ()"
.br
.ti -1c
.RI "void \fBsetPrompt\fP (\fBQString\fP prompt)"
.br
.ti -1c
.RI "\fBQString\fP \fBprompt\fP () const "
.br
.ti -1c
.RI "void \fBaddLine\fP (\fBQString\fP key, \fBQString\fP value)"
.br
.ti -1c
.RI "void \fBsetAllowEmptyPasswords\fP (bool allowed)"
.br
.ti -1c
.RI "bool \fBallowEmptyPasswords\fP () const "
.br
.ti -1c
.RI "void \fBsetMinimumPasswordLength\fP (int minLength)"
.br
.ti -1c
.RI "int \fBminimumPasswordLength\fP () const "
.br
.ti -1c
.RI "void \fBsetMaximumPasswordLength\fP (int maxLength)"
.br
.ti -1c
.RI "int \fBmaximumPasswordLength\fP () const "
.br
.ti -1c
.RI "void \fBsetReasonablePasswordLength\fP (int reasonableLength)"
.br
.ti -1c
.RI "int \fBreasonablePasswordLength\fP () const "
.br
.ti -1c
.RI "void \fBsetPasswordStrengthWarningLevel\fP (int warningLevel)"
.br
.ti -1c
.RI "int \fBpasswordStrengthWarningLevel\fP () const "
.br
.ti -1c
.RI "const char * \fBpassword\fP () const "
.br
.ti -1c
.RI "void \fBclearPassword\fP ()"
.br
.ti -1c
.RI "bool \fBkeep\fP () const "
.br
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "static int \fBgetPassword\fP (\fBQCString\fP &password, \fBQString\fP prompt, int *keep=0L)"
.br
.ti -1c
.RI "static int \fBgetNewPassword\fP (\fBQCString\fP &password, \fBQString\fP prompt)"
.br
.ti -1c
.RI "static void \fBdisableCoreDumps\fP ()"
.br
.in -1c
.SS "Protected Slots"

.in +1c
.ti -1c
.RI "void \fBslotOk\fP ()"
.br
.ti -1c
.RI "void \fBslotCancel\fP ()"
.br
.ti -1c
.RI "void \fBslotKeep\fP (bool)"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "virtual bool \fBcheckPassword\fP (const char *)"
.br
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SH "Detailed Description"
.PP 
A password input dialog. 

This dialog asks the user to enter a password. The functions you're probably interested in are the static methods, \fBgetPassword()\fP and \fBgetNewPassword()\fP.
.PP
\fBUsage example\fP
.br
.PP
.PP
.nf
 QCString password;
 int result = KPasswordDialog::getPassword(password, i18n('Prompt message'));
 if (result == KPasswordDialog::Accepted)
     use(password);
.fi
.PP
.PP
KDE Password Dialog \fBSecurity notes:\fP
.br
.PP
Keeping passwords in memory can be a potential security hole. You should handle this situation with care.
.PP
.PD 0
.IP "\(bu" 2
You may want to use disableCoreDump() 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.
.PP
.PD 0
.IP "\(bu" 2
You should delete passwords as soon as they are not needed anymore. The functions \fBgetPassword()\fP and \fBgetNewPassword()\fP return the password as a \fBQCString\fP. I believe this is safer than a \fBQString\fP. A \fBQString\fP stores its characters internally as 16-bit wide values, so conversions are needed, both for creating the \fBQString\fP 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.
.PP
\fBAuthor:\fP
.RS 4
Geert Jansen <jansen@kde.org> 
.RE
.PP

.PP
Definition at line 166 of file kpassdlg.h.
.SH "Member Enumeration Documentation"
.PP 
.SS "\fBenum\fP \fBKPasswordDialog::Types\fP"
.PP
This enum distinguishes the two operation modes of this dialog:. 
.PP
\fBEnumeration values: \fP
.in +1c
.TP
\fB\fIPassword \fP\fP
The user is asked to enter a password. 
.TP
\fB\fINewPassword \fP\fP
The user is asked to enter a password and to confirm it a second time. 
.PP
This is usually used when the user changes his password. 
.PP
Definition at line 175 of file kpassdlg.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KPasswordDialog::KPasswordDialog (\fBTypes\fP type, bool enableKeep, int extraBttn, \fBQWidget\fP * parent = \fC0\fP, const char * name = \fC0\fP)"
.PP
Constructs a password dialog. 
.PP
\fBParameters:\fP
.RS 4
\fItype:\fP if NewPassword is given here, the dialog contains two input fields, so that the user must confirm his password and possible typos are detected immediately. 
.br
\fIenableKeep:\fP if true, a check box is shown in the dialog which allows the user to keep his password input for later. 
.br
\fIextraBttn:\fP allows to show additional buttons, \fBKDialogBase\fP. 
.br
\fIparent\fP Passed to lower level constructor. 
.br
\fIname\fP Passed to lower level constructor
.RE
.PP
\fBSince:\fP
.RS 4
3.0 
.RE
.PP

.PP
Definition at line 301 of file kpassdlg.cpp.
.PP
Referenced by getNewPassword(), and getPassword().
.SS "KPasswordDialog::KPasswordDialog (int type, \fBQString\fP prompt, bool enableKeep = \fCfalse\fP, int extraBttn = \fC0\fP)"
.PP
\fBDeprecated\fP
.RS 4
Variant of the previous constructor without the possibility to specify a parent. Will be removed in \fBKDE\fP 4.0 
.RE
.PP

.PP
Definition at line 322 of file kpassdlg.cpp.
.PP
References setPrompt().
.SS "KPasswordDialog::KPasswordDialog (\fBTypes\fP type, bool enableKeep, int extraBttn, const \fBQString\fP & iconName, \fBQWidget\fP * parent = \fC0\fP, const char * name = \fC0\fP)"
.PP
Construct a password dialog. 
.PP
Essentially the same as above but allows the icon in the password dialog to be set via \fCiconName\fP. 
.PP
\fBParameters:\fP
.RS 4
\fItype\fP if NewPassword is given here, the dialog contains two input fields, so that the user must confirm his password and possible typos are detected immediately 
.br
\fIenableKeep:\fP if true, a check box is shown in the dialog which allows the user to keep his password input for later. 
.br
\fIextraBttn:\fP allows to show additional buttons. 
.br
\fIiconName\fP the name of the icon to be shown in the dialog. If empty, a default icon is used 
.br
\fIparent\fP Passed to lower level constructor. 
.br
\fIname\fP Passed to lower level constructor 
.RE
.PP
\fBSince:\fP
.RS 4
3.3 
.RE
.PP

.PP
Definition at line 310 of file kpassdlg.cpp.
.SS "KPasswordDialog::~\fBKPasswordDialog\fP ()\fC [virtual]\fP"
.PP
Destructs the password dialog. 
.PP
Definition at line 455 of file kpassdlg.cpp.
.SH "Member Function Documentation"
.PP 
.SS "void KPasswordDialog::setPrompt (\fBQString\fP prompt)"
.PP
Sets the password prompt. 
.PP
Definition at line 467 of file kpassdlg.cpp.
.PP
References QLabel::setText().
.PP
Referenced by KPasswordDialog().
.SS "\fBQString\fP KPasswordDialog::prompt () const"
.PP
Returns the password prompt. 
.PP
Definition at line 474 of file kpassdlg.cpp.
.PP
References QLabel::text().
.SS "void KPasswordDialog::addLine (\fBQString\fP key, \fBQString\fP value)"
.PP
Adds a line of information to the dialog. 
.PP
Definition at line 482 of file kpassdlg.cpp.
.PP
References QGridLayout::addWidget(), and QLabel::setAlignment().
.SS "void KPasswordDialog::setAllowEmptyPasswords (bool allowed)"
.PP
Allow empty passwords? - Default: false 
.PP
\fBSince:\fP
.RS 4
3.4. 
.RE
.PP

.PP
Definition at line 658 of file kpassdlg.cpp.
.PP
References allowEmptyPasswords().
.SS "bool KPasswordDialog::allowEmptyPasswords () const"
.PP
Allow empty passwords? 
.PP
\fBSince:\fP
.RS 4
3.4. 
.RE
.PP

.PP
Definition at line 664 of file kpassdlg.cpp.
.PP
Referenced by setAllowEmptyPasswords().
.SS "void KPasswordDialog::setMinimumPasswordLength (int minLength)"
.PP
Minimum acceptable password length. 
.PP
Default: If empty passwords are forbidden, 1; Otherwise, 0.
.PP
\fBParameters:\fP
.RS 4
\fIminLength:\fP The new minimum password length 
.RE
.PP
\fBSince:\fP
.RS 4
3.4 
.RE
.PP

.PP
Definition at line 668 of file kpassdlg.cpp.
.PP
References minimumPasswordLength().
.SS "int KPasswordDialog::minimumPasswordLength () const"
.PP
Minimum acceptable password length. 
.PP
\fBSince:\fP
.RS 4
3.4 
.RE
.PP

.PP
Definition at line 673 of file kpassdlg.cpp.
.PP
Referenced by setMinimumPasswordLength().
.SS "void KPasswordDialog::setMaximumPasswordLength (int maxLength)"
.PP
Maximum acceptable password length. 
.PP
Limited to 199. Default: No limit, i.e. -1
.PP
\fBParameters:\fP
.RS 4
\fImaxLength:\fP The new maximum password length. 
.RE
.PP
\fBSince:\fP
.RS 4
3.4 
.RE
.PP

.PP
Definition at line 677 of file kpassdlg.cpp.
.PP
References maximumPasswordLength(), and KPasswordEdit::setMaxPasswordLength().
.SS "int KPasswordDialog::maximumPasswordLength () const"
.PP
Maximum acceptable password length. 
.PP
\fBSince:\fP
.RS 4
3.4 
.RE
.PP

.PP
Definition at line 689 of file kpassdlg.cpp.
.PP
Referenced by setMaximumPasswordLength(), and setReasonablePasswordLength().
.SS "void KPasswordDialog::setReasonablePasswordLength (int reasonableLength)"
.PP
Password length that is expected to be reasonably safe. 
.PP
Default: 8 - the standard UNIX password length
.PP
\fBParameters:\fP
.RS 4
\fIreasonableLength:\fP The new reasonable password length. 
.RE
.PP
\fBSince:\fP
.RS 4
3.4 
.RE
.PP

.PP
Definition at line 695 of file kpassdlg.cpp.
.PP
References maximumPasswordLength().
.SS "int KPasswordDialog::reasonablePasswordLength () const"
.PP
Password length that is expected to be reasonably safe. 
.PP
\fBSince:\fP
.RS 4
3.4 
.RE
.PP

.PP
Definition at line 704 of file kpassdlg.cpp.
.SS "void KPasswordDialog::setPasswordStrengthWarningLevel (int warningLevel)"
.PP
Set the password strength level below which a warning is given Value is in the range 0 to 99. 
.PP
Empty passwords score 0; non-empty passwords score up to 100, depending on their length and whether they contain numbers, mixed case letters and punctuation.
.PP
Default: 1 - warn if the password has no discernable strength whatsoever 
.PP
\fBParameters:\fP
.RS 4
\fIwarningLevel:\fP The level below which a warning should be given. 
.RE
.PP
\fBSince:\fP
.RS 4
3.4 
.RE
.PP

.PP
Definition at line 709 of file kpassdlg.cpp.
.SS "int KPasswordDialog::passwordStrengthWarningLevel () const"
.PP
Password strength level below which a warning is given 
.PP
\fBSince:\fP
.RS 4
3.4. 
.RE
.PP

.PP
Definition at line 715 of file kpassdlg.cpp.
.SS "const char* KPasswordDialog::password () const\fC [inline]\fP"
.PP
Returns the password entered. 
.PP
The memory is freed in the destructor, so you should make a copy. 
.PP
Definition at line 334 of file kpassdlg.h.
.PP
Referenced by getNewPassword(), and getPassword().
.SS "void KPasswordDialog::clearPassword ()"
.PP
Clears the password input field. 
.PP
You might want to use this after the user failed to enter the correct password. 
.PP
\fBSince:\fP
.RS 4
3.3 
.RE
.PP

.PP
Definition at line 461 of file kpassdlg.cpp.
.PP
References KPasswordEdit::erase().
.SS "bool KPasswordDialog::keep () const\fC [inline]\fP"
.PP
Returns true if the user wants to keep the password. 
.PP
Definition at line 346 of file kpassdlg.h.
.PP
Referenced by getPassword().
.SS "int KPasswordDialog::getPassword (\fBQCString\fP & password, \fBQString\fP prompt, int * keep = \fC0L\fP)\fC [static]\fP"
.PP
Pops up the dialog, asks the user for a password, and returns it. 
.PP
\fBParameters:\fP
.RS 4
\fIpassword\fP The password is returned in this reference parameter. 
.br
\fIprompt\fP A prompt for the password. This can be a few lines of information. The text is word broken to fit nicely in the dialog. 
.br
\fIkeep\fP 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 *keep. 
.RE
.PP
\fBReturns:\fP
.RS 4
Result code: Accepted or Rejected. 
.RE
.PP

.PP
Definition at line 553 of file kpassdlg.cpp.
.PP
References QDialog::exec(), keep(), KPasswordDialog(), password(), and Password.
.SS "int KPasswordDialog::getNewPassword (\fBQCString\fP & password, \fBQString\fP prompt)\fC [static]\fP"
.PP
Pops up the dialog, asks the user for a password and returns it. 
.PP
The user has to enter the password twice to make sure it was entered correctly.
.PP
\fBParameters:\fP
.RS 4
\fIpassword\fP The password is returned in this reference parameter. 
.br
\fIprompt\fP A prompt for the password. This can be a few lines of information. The text is word broken to fit nicely in the dialog. 
.RE
.PP
\fBReturns:\fP
.RS 4
Result code: Accepted or Rejected. 
.RE
.PP

.PP
Definition at line 570 of file kpassdlg.cpp.
.PP
References QDialog::exec(), KPasswordDialog(), and password().
.SS "void KPasswordDialog::disableCoreDumps ()\fC [static]\fP"
.PP
Static helper function that disables core dumps. 
.PP
Definition at line 582 of file kpassdlg.cpp.
.SS "void KPasswordDialog::slotOk ()\fC [protected, virtual, slot]\fP"
.PP
Activated when the Ok button has been clicked. 
.PP
The \fBQDialog::accept()\fP is activated. 
.PP
Reimplemented from \fBKDialogBase\fP.
.PP
Definition at line 509 of file kpassdlg.cpp.
.PP
References QDialog::accept(), checkPassword(), KPasswordEdit::password(), KMessageBox::sorry(), and KMessageBox::warningYesNo().
.SS "void KPasswordDialog::slotCancel ()\fC [protected, virtual, slot]\fP"
.PP
Activated when the Cancel button has been clicked. 
.PP
The \fBQDialog::reject()\fP is activated in regular mode and QDialog::done( Cancel ) when in message box mode. 
.PP
Reimplemented from \fBKDialogBase\fP.
.PP
Definition at line 540 of file kpassdlg.cpp.
.PP
References QDialog::reject().
.SS "virtual bool KPasswordDialog::checkPassword (const char *)\fC [inline, protected, virtual]\fP"
.PP
Virtual function that can be overridden to provide password checking in derived classes. 
.PP
It should return \fCtrue\fP if the password is valid, \fCfalse\fP otherwise. 
.PP
Definition at line 391 of file kpassdlg.h.
.PP
Referenced by slotOk().

.SH "Author"
.PP 
Generated automatically by Doxygen for kdeui Library from the source code.
