36#include <klocalizedstring.h>
46class KCal::KResult::Private
51 mErrorType( NotAnError ),
60 if ( mType == Error ) {
61 mErrorType = Undefined;
63 mErrorType = NotAnError;
67 Private( ErrorType error,
const QString &details )
83 : d( new KCal::
KResult::Private )
88 : d( new KCal::
KResult::Private( type ) )
93 : d( new KCal::
KResult::Private( error, details ) )
99 delete d->mChainedResult;
105 d->mType = o.d->mType;
106 d->mErrorType = o.d->mErrorType;
107 d->mDetails = o.d->mDetails;
108 if ( o.d->mChainedResult ) {
109 d->mChainedResult =
new KResult( *o.d->mChainedResult );
111 d->mChainedResult = 0;
115KResult::operator bool()
const
122 return d->mType ==
Ok;
132 return d->mType ==
Error;
137 return d->mErrorType;
142 switch ( d->mType ) {
146 return i18n(
"In progress" );
148 switch ( d->mErrorType ) {
150 return i18n(
"Not an error" );
152 return i18n(
"Error" );
154 return i18n(
"Invalid URL" );
156 return i18n(
"Connection failed" );
158 return i18n(
"Write error" );
160 return i18n(
"Read error" );
162 return i18n(
"Wrong Parameter" );
164 return i18n(
"Parse Error" );
166 return i18n(
"Wrong revision of schema" );
170 kError() <<
"Unhandled case";
186 d->mChainedResult =
new KResult( result );
192 return d->mChainedResult;
197 return *d->mChainedResult;
This class represents the result of an operation.
~KResult()
Destroys the result.
void setDetails(const QString &details)
Sets a detailed error message.
QString chainedMessage() const
Returns an error message including full details of all chained messages.
bool isError() const
Returns true if the result is Error.
bool isOk() const
Returns true if the result is Ok.
KResult chainedResult() const
Returns a chained KResult object.
KResult()
Constructs a KResult object.
QString details() const
Returns the detailed error message.
bool hasChainedResult() const
Returns true if the KResult object has a chained KResult object; else returns false.
KResult & chain(const KResult &result)
Chains result objects.
QString message() const
Returns a translated string describing the result corresponding to Type and ErrorType.
bool isInProgress() const
Returns true if the result is InProgress.
QString fullMessage() const
Returns the full error message.
ErrorType error() const
Returns the specific result ErrorType.
Type
The different types of results.
@ Ok
Operation successfully completed.
@ InProgress
Operation still in-progress.
ErrorType
The different types of error conditions.
@ WrongParameter
Invalid parameter.
@ Undefined
Undefined error.
@ WrongSchemaRevision
Invalid schema revision.
@ ConnectionFailed
unable to establish a connection
@ NotAnError
Not an error.
This file is part of the API for handling calendar data and defines the CalendarLocal class.