Sailfish Secrets
API DocumentationInteractionRequest Class
(Sailfish::Secrets::InteractionRequest)Allows a client request user input, mediated by the secrets service More...
Header: | #include <Secrets/interactionrequest.h> |
Inherits: | Sailfish::Secrets::Request |
Properties
- interactionParameters : Sailfish::Secrets::InteractionParameters
- 3 properties inherited from Sailfish::Secrets::Request
Public Functions
InteractionRequest(QObject *parent = Q_NULLPTR) | |
~InteractionRequest() | |
Sailfish::Secrets::InteractionParameters | interactionParameters() const |
void | setInteractionParameters(const Sailfish::Secrets::InteractionParameters &uiParams) |
QByteArray | userInput() const |
Reimplemented Public Functions
virtual Sailfish::Secrets::SecretManager * | manager() const |
virtual Sailfish::Secrets::Result | result() const |
virtual void | setManager(Sailfish::Secrets::SecretManager *manager) |
virtual void | startRequest() |
virtual Sailfish::Secrets::Request::Status | status() const |
virtual void | waitForFinished() |
- 6 public functions inherited from Sailfish::Secrets::Request
Signals
void | interactionParametersChanged() |
void | userInputChanged() |
- 3 signals inherited from Sailfish::Secrets::Request
Detailed Description
Allows a client request user input, mediated by the secrets service
This class allows clients to request user input, via a system-mediated user interaction flow. The user will be explicitly informed that the application has initiated the user interaction request, and that the supplied data should not be considered to be secure.
Most applications should not have any need to use this request type, as they can usually show their own input dialog and ask the user for input directly that way, however some daemon services without any UI capability may need to use this request type to retrieve non-sensitive or transient data from the user.
An example of retrieving user input follows:
// Define the interaction request prompt parameters. Sailfish::Secrets::InteractionParameters uiParams; uiParams.setInputType(Sailfish::Secrets::InteractionParameters::AlphaNumericInput); uiParams.setEchoMode(Sailfish::Secrets::InteractionParameters::NormalEcho); uiParams.setPromptText(tr("Enter some data")); // Perform the request. Sailfish::Secrets::SecretManager sm; Sailfish::Secrets::InteractionRequest ir; ir.setManager(&sm); ir.setInteractionParameters(&uiParams); ir.startRequest(); // status() will change to Finished when complete ir.waitForFinished(); // or better: connect to statusChanged() QByteArray userInput = ir.userInput();
Note that if the user canceled the user input (or authentication or confirmation) dialog the result will contain the Result::InteractionViewUserCanceledError
error code.
Property Documentation
interactionParameters : Sailfish::Secrets::InteractionParameters
Access functions:
Sailfish::Secrets::InteractionParameters | interactionParameters() const |
void | setInteractionParameters(const Sailfish::Secrets::InteractionParameters &uiParams) |
Notifier signal:
void | interactionParametersChanged() |
Member Function Documentation
InteractionRequest::InteractionRequest(QObject *parent = Q_NULLPTR)
Constructs a new InteractionRequest object with the given parent.
InteractionRequest::~InteractionRequest()
Destroys the InteractionRequest
Sailfish::Secrets::InteractionParameters InteractionRequest::interactionParameters() const
Returns the interaction parameters which allow customisation of the input prompt
Note: Getter function for property interactionParameters.
See also setInteractionParameters().
[virtual]
Sailfish::Secrets::SecretManager *InteractionRequest::manager() const
See also setManager().
[virtual]
Sailfish::Secrets::Result InteractionRequest::result() const
[virtual]
void InteractionRequest::setManager(Sailfish::Secrets::SecretManager *manager)
See also manager().
[virtual]
void InteractionRequest::startRequest()
[virtual]
Sailfish::Secrets::Request::Status InteractionRequest::status() const
QByteArray InteractionRequest::userInput() const
Returns the user input which was retrieved for the client