2
This file is part of the kcal library.
4
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Library General Public
8
License as published by the Free Software Foundation; either
9
version 2 of the License, or (at your option) any later version.
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Library General Public License for more details.
16
You should have received a copy of the GNU Library General Public License
17
along with this library; see the file COPYING.LIB. If not, write to
18
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
Boston, MA 02110-1301, USA.
23
// DummyScheduler - iMIP implementation of iTIP methods
27
#include <QTextStream>
30
#include <kstandarddirs.h>
33
#include "icalformat.h"
35
#include "dummyscheduler.h"
39
DummyScheduler::DummyScheduler(Calendar *calendar)
44
DummyScheduler::~DummyScheduler()
48
bool DummyScheduler::publish (IncidenceBase *incidence,const QString &/*recipients*/)
50
QString messageText = mFormat->createScheduleMessage(incidence,
53
return saveMessage(messageText);
56
bool DummyScheduler::performTransaction(IncidenceBase *incidence,Method method,const QString &/*recipients*/)
58
QString messageText = mFormat->createScheduleMessage(incidence,method);
60
return saveMessage(messageText);
63
bool DummyScheduler::performTransaction(IncidenceBase *incidence,Method method)
65
QString messageText = mFormat->createScheduleMessage(incidence,method);
67
return saveMessage(messageText);
70
bool DummyScheduler::saveMessage(const QString &message)
72
QFile f("dummyscheduler.store");
73
if (f.open(QIODevice::WriteOnly | QIODevice::Append)) {
83
QList<ScheduleMessage*> DummyScheduler::retrieveTransactions()
85
QList<ScheduleMessage*> messageList;
87
QFile f("dummyscheduler.store");
88
if (!f.open(QIODevice::ReadOnly)) {
89
kDebug(5800) << "DummyScheduler::retrieveTransactions(): Can't open file"
93
QString messageString;
94
QString messageLine = t.readLine();
95
while (!messageLine.isNull()) {
96
// kDebug(5800) << "++++++++" << messageLine << endl;
97
messageString += messageLine + '\n';
98
if (messageLine.indexOf("END:VCALENDAR") >= 0) {
99
kDebug(5800) << "---------------" << messageString << endl;
100
ScheduleMessage *message = mFormat->parseScheduleMessage(mCalendar,
102
kDebug(5800) << "--Parsed" << endl;
104
messageList.append(message);
106
QString errorMessage;
107
if (mFormat->exception()) {
108
errorMessage = mFormat->exception()->message();
110
kDebug(5800) << "DummyScheduler::retrieveTransactions() Error parsing "
111
"message: " << errorMessage << endl;
115
messageLine = t.readLine();
123
QString DummyScheduler::freeBusyDir()
125
// the dummy scheduler should never handle freebusy stuff - so it's hardcoded