36 #include <klocalizedstring.h>
46 class 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;
115 KResult::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 file is part of the API for handling calendar data and defines the CalendarLocal class...
~KResult()
Destroys the result.
Type
The different types of results.
Operation successfully completed.
KResult()
Constructs a KResult object.
QString message() const
Returns a translated string describing the result corresponding to Type and ErrorType.
This class represents the result of an operation.
bool isOk() const
Returns true if the result is Ok.
bool isError() const
Returns true if the result is Error.
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 isInProgress() const
Returns true if the result is InProgress.
ErrorType
The different types of error conditions.
QString fullMessage() const
Returns the full error message.
KResult & chain(const KResult &result)
Chains result objects.
ErrorType error() const
Returns the specific result ErrorType.
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.
Operation still in-progress.
KResult chainedResult() const
Returns a chained KResult object.
unable to establish a connection