8#ifndef KAUTH_ACTION_REPLY_H
9#define KAUTH_ACTION_REPLY_H
11#include "kauthcore_export.h"
15#include <QSharedDataPointer>
320class ActionReplyData;
441 void addData(
const QString &key,
const QVariant &value);
587 QSharedDataPointer<ActionReplyData> d;
Class that encapsulates a reply coming from the helper after executing an action.
Definition actionreply.h:335
static const ActionReply HelperBusyReply()
errorCode() == HelperBusy
ActionReply(int errorCode)
Constructor that creates a KAuthError reply with a specified error code.
bool operator!=(const ActionReply &reply) const
Negated comparison operator.
ActionReply & operator=(const ActionReply &reply)
Assignment operator.
void addData(const QString &key, const QVariant &value)
Convenience method to add some data to the reply.
bool operator==(const ActionReply &reply) const
Comparison operator.
void setType(Type type)
Sets the reply type.
static const ActionReply SuccessReply()
An empty successful reply. Same as using the default constructor.
void setErrorDescription(const QString &error)
Sets a human-readble description of the error.
static const ActionReply InvalidActionReply()
errorCode() == InvalidAction
static ActionReply deserialize(const QByteArray &data)
Deserialize a reply from a QByteArray.
Type type() const
Returns the reply's type.
QString errorDescription() const
Gets a human-readble description of the error, if available.
static const ActionReply UserCancelledReply()
errorCode() == UserCancelled
ActionReply(Type type)
Constructor to directly set the type.
Error
The enumeration of the possible values of errorCode() when type() is ActionReply::KAuthError.
Definition actionreply.h:362
@ DBusError
An error from D-Bus occurred.
Definition actionreply.h:371
@ AuthorizationDeniedError
You don't have the authorization to execute the action.
Definition actionreply.h:367
@ InvalidActionError
You tried to execute an invalid action object.
Definition actionreply.h:366
@ NoResponderError
The helper responder object hasn't been set. This shouldn't happen if you use the KAUTH_HELPER macro ...
Definition actionreply.h:364
@ BackendError
The underlying backend reported an error.
Definition actionreply.h:372
@ HelperBusyError
The helper is busy executing another action (or group of actions). Try later.
Definition actionreply.h:369
@ NoSuchActionError
The action you tried to execute doesn't exist.
Definition actionreply.h:365
@ UserCancelledError
Action execution has been cancelled by the user.
Definition actionreply.h:368
@ AlreadyStartedError
The action was already started and is currently running.
Definition actionreply.h:370
void setErrorCode(Error errorCode)
Sets the error code of an error reply.
Error errorCode() const
Returns the error code of an error reply.
ActionReply()
Default constructor. Sets type() to Success and errorCode() to zero.
static const ActionReply HelperErrorReply()
An empty reply with type() == HelperError and errorCode() == -1.
static const ActionReply HelperErrorReply(int error)
An empty reply with type() == HelperError and error is set to the passed value.
bool succeeded() const
Returns true if type() == Success.
static const ActionReply NoSuchActionReply()
errorCode() == NoSuchAction
static const ActionReply NoResponderReply()
errorCode() == NoResponder
Type
Enumeration of the different kinds of replies.
Definition actionreply.h:340
@ KAuthErrorType
An error reply generated by the library itself.
Definition actionreply.h:341
@ HelperErrorType
An error reply generated by the helper.
Definition actionreply.h:342
@ SuccessType
The action has been completed successfully.
Definition actionreply.h:343
void setError(int error)
Sets the error code of an error reply.
int error() const
Returns the error code of an error reply.
void setData(const QVariantMap &data)
Sets the custom data to send back to the application.
static const ActionReply DBusErrorReply()
errorCode() == DBusError
QByteArray serialized() const
Serialize the reply into a QByteArray.
static const ActionReply AlreadyStartedReply()
errorCode() == AlreadyStartedError
virtual ~ActionReply()
Virtual destructor.
ActionReply(const ActionReply &reply)
Copy constructor.
static const ActionReply AuthorizationDeniedReply()
errorCode() == AuthorizationDenied
QVariantMap data() const
Returns the custom data coming from the helper.
bool failed() const
Returns true if type() != Success.