summaryrefslogtreecommitdiffabout
path: root/libkcal/scheduler.h
authorzautrix <zautrix>2004-06-26 19:01:18 (UTC)
committer zautrix <zautrix>2004-06-26 19:01:18 (UTC)
commitb9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff)
tree2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /libkcal/scheduler.h
downloadkdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2
Initial revision
Diffstat (limited to 'libkcal/scheduler.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/scheduler.h133
1 files changed, 133 insertions, 0 deletions
diff --git a/libkcal/scheduler.h b/libkcal/scheduler.h
new file mode 100644
index 0000000..a9f43b9
--- a/dev/null
+++ b/libkcal/scheduler.h
@@ -0,0 +1,133 @@
1/*
2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20#ifndef SCHEDULER_H
21#define SCHEDULER_H
22
23// iTIP transactions base class
24
25#include <qstring.h>
26#include <qptrlist.h>
27
28namespace KCal {
29
30class IncidenceBase;
31class Event;
32class Calendar;
33class ICalFormat;
34
35/**
36 This class provides an encapsulation of a scheduling message. It associates an
37 incidence with a method and status information. This class is used by the
38 Scheduler class.
39
40 @short A Scheduling message
41*/
42class ScheduleMessage {
43 public:
44 /** Message status. */
45 enum Status { PublishNew, Obsolete, RequestNew, RequestUpdate, Unknown };
46
47 /**
48 Create a scheduling message with method as defined in Scheduler::Method
49 and a status.
50 */
51 ScheduleMessage(IncidenceBase *,int method,Status status);
52 ~ScheduleMessage() {};
53
54 /** Return event associated with this message. */
55 IncidenceBase *event() { return mIncidence; }
56 /** Return iTIP method associated with this message. */
57 int method() { return mMethod; }
58 /** Return status of this message. */
59 Status status() { return mStatus; }
60 /** Return error message if there is any. */
61 QString error() { return mError; }
62
63 /** Return a human-readable name for an ical message status. */
64 static QString statusName(Status status);
65
66 private:
67 IncidenceBase *mIncidence;
68 int mMethod;
69 Status mStatus;
70 QString mError;
71};
72
73/**
74 This class provides an encapsulation of iTIP transactions. It is an abstract
75 base class for inheritance by implementations of the iTIP scheme like iMIP or
76 iRIP.
77*/
78class Scheduler {
79 public:
80 /** iTIP methods. */
81 enum Method { Publish,Request,Refresh,Cancel,Add,Reply,Counter,
82 Declinecounter,NoMethod };
83
84 /** Create scheduler for calendar specified as argument. */
85 Scheduler(Calendar *calendar);
86 virtual ~Scheduler();
87
88 /** iTIP publish action */
89 virtual bool publish (IncidenceBase *incidence,const QString &recipients) = 0;
90 /** Perform iTIP transaction on incidence. The method is specified as the
91 method argumanet and can be any valid iTIP method. */
92 virtual bool performTransaction(IncidenceBase *incidence,Method method) = 0;
93 /** Perform iTIP transaction on incidence to specified recipient(s). The
94 method is specified as the method argumanet and can be any valid iTIP
95 method. */
96 virtual bool performTransaction(IncidenceBase *incidence,Method method,const QString &recipients) = 0;
97 /** Retrieve incoming iTIP transactions */
98 virtual QPtrList<ScheduleMessage> retrieveTransactions() = 0;
99
100 /**
101 Accept transaction. The incidence argument specifies the iCal compoennt
102 on which the transaction acts. The status is the result of processing a
103 iTIP message with the current calendar and specifies the action to be
104 taken for this incidence.
105 */
106 bool acceptTransaction(IncidenceBase *,Method method,ScheduleMessage::Status status);
107
108 /** Return a machine-readable name for a iTIP method. */
109 static QString methodName(Method);
110 /** Return a translated and human-readable name for a iTIP method. */
111 static QString translatedMethodName(Method);
112
113 virtual bool deleteTransaction(IncidenceBase *incidence);
114
115 protected:
116
117 bool acceptPublish(IncidenceBase *,ScheduleMessage::Status status, Method method);
118 bool acceptRequest(IncidenceBase *,ScheduleMessage::Status status);
119 bool acceptAdd(IncidenceBase *,ScheduleMessage::Status status);
120 bool acceptCancel(IncidenceBase *,ScheduleMessage::Status status);
121 bool acceptDeclineCounter(IncidenceBase *,ScheduleMessage::Status status);
122 bool acceptReply(IncidenceBase *,ScheduleMessage::Status status, Method method);
123 bool acceptRefresh(IncidenceBase *,ScheduleMessage::Status status);
124 bool acceptCounter(IncidenceBase *,ScheduleMessage::Status status);
125 bool acceptFreeBusy(IncidenceBase *,Method method);
126
127 Calendar *mCalendar;
128 ICalFormat *mFormat;
129};
130
131}
132
133#endif // SCHEDULER_H