class KPasswordDialog |
|
|
A dialog for requesting a password and optionaly a login from the end user. Usage Exemple Requesting a simple password, assynchronous
KPasswordDialog *dlg = new KPasswordDialog( parent ); dlg->setPrompt( i18n( "Enter a password" ); connect( dlg, SIGNAL( gotPassword( const QString& , bool ) ) , this, SLOT( setPassword( const QString &) ) ); connect( dlg, SIGNAL( rejected() ) , this, SLOT( slotCancel() ) ); dlg->show(); Requesting a login and a password, synchronous
KPasswordDialog dlg( parent , KPasswordDialog.showUsername ); dlg.setPrompt( i18n( "Enter a login and a password" ); if( !dlg.exec() ) return; //the user canceled use( dlg.username() , dlg.password() ); dialog for requesting login and password from the end user |
|
create a password dialog
parent - the parent widget (default:0). flags - a set of KPasswordDialogFlag flags otherButtons - buttons to show in the dialog besides Ok and Cancel. Useful for adding application-specific buttons like "ignore" or "skip". |
|
|
Internal |
|
Adds a comment line to the dialog. This function allows you to add one additional comment line to this widget. Calling this function after a comment has already been added will not have any effect.
label - label for comment (ex:"Command:") comment - the actual comment text. |
|
Virtual function that can be overridden to provide password checking in derived classes. It should return true if the password is valid, false otherwise. |
|
emitted when the dialog has been accepted password - the entered password keep - true if the "remember password" checkbox was checked, false otherwhise. false if ShowKeepPassword was not set in the constructor |
|
emitted when the dialog has been accepted, and ShowUsernameLine was set on the constructor username - the entered username password - the entered password keep - true if the "remember password" checkbox was checked, false otherwhise. false if ShowKeepPassword was not set in the constructor |
|
Determines whether supplied authorization should persist even after the application has been closed. this is set with the check password checkbox is the ShowKeepCheckBox flag is set in the constructor, if it is not set, this function return false Returns true to keep the password |
|
Returns the password entered by the user. Returns the password |
|
|
|
Returns the prompt |
|
Check or uncheck the "keep password" checkbox. This can be used to check it before showing the dialog, to tell the user that the password is stored already (e.g. in the wallet). enableKeep must have been set to true in the constructor. has only effect if ShowKeepCheckBox is set in the constructor |
|
Presets a number of login+password pairs that the user can choose from. The passwords can be empty if you simply want to offer usernames to choose from. This require the flag ShowUnernameLine to be set in the constructoe, and not the flag UsernameReadOnly knownLogins - map of known logins: the keys are usernames, the values are passwords. |
|
Presets the password. password - the password to set |
|
set an image that appears next to the prompt. |
|
Sets the prompt to show to the user. prompt - instructional text to be shown. |
|
set the default username. |
|
Sets the username field read-only and sets the focus to the password field. this can also be set by passing UsernameReadOnly as flag in the constructor
readOnly - true to set the user field to read-only |
|
Shows an error message in the dialog box. Prevents having to show a dialog-on-a-dialog.
message - the error message to show |
|
Returns the username entered by the user. Returns the user name |
UnknownError | - | A problem with the user name as entered /p> p> | |
UsernameError | - | Incorrect password | |
PasswordError | - | Error preventing further attempts, will result in disabling most of the interface | |
FatalError | - |
NoFlags | - | If this flag is set, the "keep this password" checkbox will been shown, otherwhise, it will not be shown and keepPassword will have no effect | |
ShowKeepPassword | - | If this flag is set, there will be an additional line to let the user enter his login. otherwise, only the password line will be shown. | |
ShowUsernameLine | - | If this flag is set, the login lineedit will be in read only mode. | |
UsernameReadOnly | - |