Qt Cryptographic Architecture
Signals | Public Member Functions | Friends | List of all members
QCA::ConsolePrompt Class Reference

#include <QtCrypto>

Collaboration diagram for QCA::ConsolePrompt:
Collaboration graph
[legend]

Signals

void finished ()
 

Public Member Functions

 ConsolePrompt (QObject *parent=0)
 
void getChar ()
 
void getHidden (const QString &promptStr)
 
SecureArray result () const
 
QChar resultChar () const
 
void waitForFinished ()
 

Friends

class Private
 

Detailed Description

Console prompt handler.

This class provides a convenient way to get user input in a secure way, as shown below:

prompt.getHidden("Passphrase");
prompt.waitForFinished();
QCA:SecureArray pass = prompt.result();
Note
It is not necessary to use waitForFinished(), because you can just connect the finished() signal to a suitable method, however command line (console) applications often require waitForFinished().
Examples:
keyloader.cpp, and saslclient.cpp.

Constructor & Destructor Documentation

QCA::ConsolePrompt::ConsolePrompt ( QObject parent = 0)

Standard constructor.

Parameters
parentthe parent object for this object

Member Function Documentation

void QCA::ConsolePrompt::getHidden ( const QString &  promptStr)

Allow the user to enter data without it being echo'd to the terminal.

This is particularly useful for entry of passwords, passphrases and PINs.

Parameters
promptStrthe prompt to display to the user
See also
result() for how to get the input back.
Examples:
keyloader.cpp, and saslclient.cpp.
void QCA::ConsolePrompt::getChar ( )

Obtain one character from the user.

See also
resultChar() for how to get the input back.
void QCA::ConsolePrompt::waitForFinished ( )

Block waiting for user input.

You may wish to use the finished() signal to avoid blocking.

Examples:
keyloader.cpp, and saslclient.cpp.
SecureArray QCA::ConsolePrompt::result ( ) const

Obtain the result of the user input.

This method is usually called to obtain data from the user that was requested by the getHidden() call.

Examples:
keyloader.cpp, and saslclient.cpp.
QChar QCA::ConsolePrompt::resultChar ( ) const

Obtain the result of the user input.

This method is usually called to obtain data from the user that was requested by the getChar() call.

void QCA::ConsolePrompt::finished ( )
signal

Emitted when the user input activity has been completed.

This corresponds to the provision of a string for getHidden() or a single character for getChar().

See also
waitForFinished

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