# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KIO::PasswordDialog Class Reference

A dialog for requesting a login and a password from the end user. dialog for requesting login and password from the end user. More...

`#include <passdlg.h>`

Inheritance diagram for KIO::PasswordDialog:

[legend]
Collaboration diagram for KIO::PasswordDialog:

[legend]
List of all members.

## Public Member Functions

| PasswordDialog (const QString &prompt, const QString &user, bool enableKeep=false, bool modal=true, QWidget *parent=0, const char *name=0)
| ~PasswordDialog ()
void | setPrompt (const QString &prompt)
void | addCommentLine (const QString &label, const QString comment)
QString | password () const
QString | username () const
bool | keepPassword () const
void | setKeepPassword (bool b)
void | setUserReadOnly (bool readOnly)
KDE_DEPRECATED void | setEnableUserField (bool enable, bool=false)
void | setPassword (const QString &password)
void | setKnownLogins (const QMap< QString, QString > &knownLogins)

## Static Public Member Functions

static int | getNameAndPassword (QString &user, QString &pass, bool *keep, const QString &prompt=QString::null, bool readOnly=false, const QString &caption=QString::null, const QString &comment=QString::null, const QString &label=QString::null)

## Protected Member Functions

virtual void | virtual_hook (int id, void *data)

## Detailed Description

A dialog for requesting a login and a password from the end user. dialog for requesting login and password from the end user.

KIO-Slave authors are encouraged to use SlaveBase::openPassDlg instead of directly instantiating this dialog.

Definition at line 36 of file passdlg.h.

## Constructor & Destructor Documentation

KIO::PasswordDialog::PasswordDialog | ( | const QString & | prompt,
|  | const QString & | user,
|  | bool | enableKeep = `false`,
|  | bool | modal = `true`,
|  | QWidget * | parent = `0`,
|  | const char * | name = `0`
| ) |

Create a password dialog.

Parameters:

  | prompt | instructional text to be shown.
  | user | username, if known initially.
  | enableKeep | if true, shows checkbox that makes password persistent until KDE is shutdown.
  | modal | if true, the dialog will be modal (default:true).
  | parent | the parent widget (default:NULL).
  | name | the dialog name (default:NULL).

KIO::PasswordDialog::~PasswordDialog | ( |  | ) |

| Destructor.

## Member Function Documentation

void KIO::PasswordDialog::setPrompt | ( | const QString & | prompt | ) |

Sets the prompt to show to the user.

Parameters:

  | prompt | instructional text to be shown.

void KIO::PasswordDialog::addCommentLine | ( | const QString & | label,
|  | const QString | comment
| ) |

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.

Parameters:

  | label | label for comment (ex:"Command:")
  | comment | the actual comment text.

QString KIO::PasswordDialog::password | ( |  | ) | const

Returns the password entered by the user.

Returns:
  the password

QString KIO::PasswordDialog::username | ( |  | ) | const

Returns the username entered by the user.

Returns:
  the user name

bool KIO::PasswordDialog::keepPassword | ( |  | ) | const

Determines whether supplied authorization should persist even after the application has been closed.

Returns:
  true to keep the password

void KIO::PasswordDialog::setKeepPassword | ( | bool | b | ) |

| 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.

void KIO::PasswordDialog::setUserReadOnly | ( | bool | readOnly | ) |

Sets the username field read-only and sets the focus to the password field.

Parameters:

  | readOnly | true to set the user field to read-only

KDE_DEPRECATED void KIO::PasswordDialog::setEnableUserField | ( | bool | enable,
|  | bool | = `false`
| ) | `[inline]`

Deprecated:
  . Use setUserReadOnly(bool).

Definition at line 116 of file passdlg.h.

void KIO::PasswordDialog::setPassword | ( | const QString & | password | ) |

Presets the password.

Parameters:

  | password | the password to set

Since:
  3.1

void KIO::PasswordDialog::setKnownLogins | ( | const QMap< QString, QString > & | knownLogins | ) |

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 is incompatible with setUserReadOnly(true).

Parameters:

  | knownLogins | map of known logins: the keys are usernames, the values are passwords.

Since:
  3.4

static int KIO::PasswordDialog::getNameAndPassword | ( | QString & | user,
|  | QString & | pass,
|  | bool * | keep,
|  | const QString & | prompt = `QString::null`,
|  | bool | readOnly = `false`,
|  | const QString & | caption = `QString::null`,
|  | const QString & | comment = `QString::null`,
|  | const QString & | label = `QString::null`
| ) | `[static]`

A convienence static method for obtaining authorization information from the end user.

Parameters:

  | user | username
  | pass | password
  | keep | pointer to flag that indicates whether to keep password (can be null)
  | prompt | text to display to user.
  | readOnly | make the username field read-only.
  | caption | set the title bar to given text.
  | comment | extra comment to display to user.
  | label | optinal label for extra comment.

Returns:
  Accepted/Rejected based on the user choice.

Referenced by Observer::openPassDlg().

The documentation for this class was generated from the following file:

- passdlg.h

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:26:25 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003