2
This file is part of the calendarsupport library.
4
Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
5
Copyright (c) 2010 Sérgio Martins <iamsergio@gmail.com>
7
This library is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Library General Public
9
License as published by the Free Software Foundation; either
10
version 2 of the License, or (at your option) any later version.
12
This library is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
Library General Public License for more details.
17
You should have received a copy of the GNU Library General Public License
18
along with this library; see the file COPYING.LIB. If not, write to
19
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
Boston, MA 02110-1301, USA.
22
#ifndef CALENDARSUPPORT_SCHEDULER_H
23
#define CALENDARSUPPORT_SCHEDULER_H
25
#include "calendarsupport_export.h"
26
#include "nepomukcalendar.h"
28
#include <KCalCore/ScheduleMessage>
29
#include <KCalCore/IncidenceBase>
30
#include <KCalCore/Calendar>
32
#include <QtCore/QString>
33
#include <QtCore/QList>
34
#include <QtCore/QObject>
37
Most scheduler methods are async. They return immediately a unique identifier (a CallId) and
38
to the work in background.
39
Use the CallId to match the call with the result signal( CallId, ResultCode );
49
namespace CalendarSupport {
50
class IncidenceChanger2;
52
This class provides an encapsulation of iTIP transactions (RFC 2446).
53
It is an abstract base class for inheritance by implementations of the
54
iTIP scheme like iMIP or iRIP.
56
class CALENDARSUPPORT_EXPORT Scheduler : public QObject
63
ResultCodeDifferentIncidenceTypes,
64
ResultCodeNewIncidenceTooOld,
65
ResultCodeUnknownStatus,
66
ResultCodeInvalidIncidence,
68
ResultCodeSaveFreeBusyError,
69
ResultCodeIncidenceOrAttendeeNotFound,
70
ResultCodeIncidenceNotFound,
71
ResultCodeErrorDeletingIncidence,
72
ResultCodeErrorCreatingIncidence,
73
ResultCodeErrorUpdatingIncidence,
74
ResultCodeErrorSendingEmail
78
Creates a scheduler for calendar specified as argument.
80
Scheduler( const CalendarSupport::NepomukCalendar::Ptr &calendar,
81
CalendarSupport::IncidenceChanger2 *changer );
88
virtual CallId publish( const KCalCore::IncidenceBase::Ptr &incidence,
89
const QString &recipients ) = 0;
91
Performs iTIP transaction on incidence. The method is specified as the
92
method argument and can be any valid iTIP method.
94
@param incidence the incidence for the transaction.
95
@param method the iTIP transaction method to use.
97
virtual CallId performTransaction( const KCalCore::IncidenceBase::Ptr &incidence,
98
KCalCore::iTIPMethod method ) = 0;
101
Performs iTIP transaction on incidence to specified recipient(s).
102
The method is specified as the method argumanet and can be any valid iTIP method.
104
@param incidence the incidence for the transaction.
105
@param method the iTIP transaction method to use.
106
@param recipients the receipients of the transaction.
108
virtual CallId performTransaction( const KCalCore::IncidenceBase::Ptr &incidence,
109
KCalCore::iTIPMethod method, const QString &recipients ) = 0;
112
Accepts the transaction. The incidence argument specifies the iCal
113
component on which the transaction acts. The status is the result of
114
processing a iTIP message with the current calendar and specifies the
115
action to be taken for this incidence.
117
@param incidence the incidence for the transaction.
118
@param method iTIP transaction method to check.
119
@param status scheduling status.
120
@param email the email address of the person for whom this
121
transaction is to be performed.
123
CallId acceptTransaction( const KCalCore::IncidenceBase::Ptr &incidence,
124
KCalCore::iTIPMethod method,
125
KCalCore::ScheduleMessage::Status status,
126
const QString &email = QString() );
128
virtual bool deleteTransaction( const QString &uid );
131
Returns the directory where the free-busy information is stored.
133
virtual QString freeBusyDir() const = 0;
136
Sets the free/busy cache used to store free/busy information.
138
void setFreeBusyCache( KCalCore::FreeBusyCache * );
141
Returns the free/busy cache.
143
KCalCore::FreeBusyCache *freeBusyCache() const;
147
// This signal sis delayed because it can't be emitted before "return callId",
148
// otherwise the caller would not know the callId that was being sent in the signal
149
void emitOperationFinished( CallId, ResultCode, const QString & );
151
CallId acceptPublish( const KCalCore::IncidenceBase::Ptr &,
152
KCalCore::ScheduleMessage::Status status,
153
KCalCore::iTIPMethod method );
155
CallId acceptRequest( const KCalCore::IncidenceBase::Ptr &,
156
KCalCore::ScheduleMessage::Status status,
157
const QString &email );
159
CallId acceptAdd( const KCalCore::IncidenceBase::Ptr &,
160
KCalCore::ScheduleMessage::Status status );
162
CallId acceptCancel( const KCalCore::IncidenceBase::Ptr &,
163
KCalCore::ScheduleMessage::Status status,
164
const QString &attendee );
166
CallId acceptDeclineCounter( const KCalCore::IncidenceBase::Ptr &,
167
KCalCore::ScheduleMessage::Status status );
169
CallId acceptReply( const KCalCore::IncidenceBase::Ptr &,
170
KCalCore::ScheduleMessage::Status status,
171
KCalCore::iTIPMethod method );
173
CallId acceptRefresh( const KCalCore::IncidenceBase::Ptr &,
174
KCalCore::ScheduleMessage::Status status );
176
CallId acceptCounter( const KCalCore::IncidenceBase::Ptr &,
177
KCalCore::ScheduleMessage::Status status );
179
CallId acceptFreeBusy( const KCalCore::IncidenceBase::Ptr &, KCalCore::iTIPMethod method );
181
NepomukCalendar::Ptr calendar() const;
183
IncidenceChanger2 * changer() const;
188
void acceptTransactionFinished( CallId callId, ResultCode code, const QString &errorMessage );
189
void performTransactionFinished( CallId callId, ResultCode code, const QString &errorMessage );
190
void publishFinished( CallId callId, ResultCode code, const QString &errorMessage );
193
Q_DISABLE_COPY( Scheduler )