00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#ifndef KCAL_SCHEDULER_H
00022
#define KCAL_SCHEDULER_H
00023
00024
#include <qstring.h>
00025
#include <qptrlist.h>
00026
00027
namespace KCal {
00028
00029
class IncidenceBase;
00030
class Event;
00031
class Calendar;
00032
class ICalFormat;
00033
class FreeBusyCache;
00034
00042 class ScheduleMessage
00043 {
00044
public:
00048 enum Status { PublishNew, PublishUpdate, Obsolete, RequestNew,
00049 RequestUpdate, Unknown };
00050
00055
ScheduleMessage(
IncidenceBase *,
int method, Status status );
00056 ~
ScheduleMessage() {};
00057
00061 IncidenceBase *
event() {
return mIncidence; }
00065 int method() {
return mMethod; }
00069 Status status() {
return mStatus; }
00073 QString error() {
return mError; }
00074
00078
static QString statusName( Status status );
00079
00080
private:
00081
IncidenceBase *mIncidence;
00082
int mMethod;
00083 Status mStatus;
00084
QString mError;
00085
00086
class Private;
00087 Private *d;
00088 };
00089
00095 class Scheduler
00096 {
00097
public:
00101 enum Method { Publish,Request,Refresh,Cancel,Add,Reply,Counter,
00102 Declinecounter,NoMethod };
00103
00107
Scheduler(
Calendar *calendar );
00108
virtual ~
Scheduler();
00109
00113
virtual bool publish(
IncidenceBase *incidence,
00114
const QString &recipients ) = 0;
00119
virtual bool performTransaction(
IncidenceBase *incidence,
00120 Method method ) = 0;
00126
virtual bool performTransaction(
IncidenceBase *incidence, Method method,
00127
const QString &recipients ) = 0;
00131
virtual QPtrList<ScheduleMessage> retrieveTransactions() = 0;
00132
00139
bool acceptTransaction(
IncidenceBase *, Method method,
00140 ScheduleMessage::Status status );
00141
00145
static QString methodName( Method );
00149
static QString translatedMethodName( Method );
00150
00151
virtual bool deleteTransaction(
IncidenceBase *incidence );
00152
00156
virtual QString freeBusyDir() = 0;
00157
00161
void setFreeBusyCache( FreeBusyCache * );
00165 FreeBusyCache *
freeBusyCache() const;
00166
00167 protected:
00168
bool acceptPublish(
IncidenceBase *,
ScheduleMessage::Status status,
00169 Method method );
00170
bool acceptRequest( IncidenceBase *,
ScheduleMessage::Status status );
00171
bool acceptAdd( IncidenceBase *,
ScheduleMessage::Status status );
00172
bool acceptCancel( IncidenceBase *,
ScheduleMessage::Status status );
00173
bool acceptDeclineCounter( IncidenceBase *,
00174
ScheduleMessage::Status status );
00175
bool acceptReply( IncidenceBase *,
ScheduleMessage::Status status,
00176 Method method );
00177
bool acceptRefresh( IncidenceBase *,
ScheduleMessage::Status status );
00178
bool acceptCounter( IncidenceBase *,
ScheduleMessage::Status status );
00179
bool acceptFreeBusy( IncidenceBase *, Method method );
00180
00181
Calendar *mCalendar;
00182
ICalFormat *mFormat;
00183
00184 private:
00185 class Private;
00186 Private *d;
00187 };
00188
00189 }
00190
00191 #endif