• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

KCal Library

  • sources
  • kde-4.12
  • kdepimlibs
  • kcal
dummyscheduler.cpp
1 /*
2  This file is part of the kcal library.
3 
4  Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 
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.
10 
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.
15 
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.
20 */
21 
22 //
23 // DummyScheduler - iMIP implementation of iTIP methods
24 //
25 
26 #include "dummyscheduler.h"
27 #include "event.h"
28 #include "icalformat.h"
29 
30 #include <kdebug.h>
31 #include <kstandarddirs.h>
32 
33 #include <QtCore/QFile>
34 #include <QtCore/QTextStream>
35 
36 using namespace KCal;
37 
38 DummyScheduler::DummyScheduler( Calendar *calendar )
39  : Scheduler( calendar )
40 {
41 }
42 
43 DummyScheduler::~DummyScheduler()
44 {
45 }
46 
47 bool DummyScheduler::publish( IncidenceBase *incidence, const QString &recipients )
48 {
49  Q_UNUSED( recipients );
50  QString messageText = mFormat->createScheduleMessage( incidence, iTIPPublish );
51 
52  return saveMessage( messageText );
53 }
54 
55 bool DummyScheduler::performTransaction( IncidenceBase *incidence,
56  iTIPMethod method,
57  const QString &recipients )
58 {
59  Q_UNUSED( recipients );
60  QString messageText = mFormat->createScheduleMessage( incidence, method );
61 
62  return saveMessage( messageText );
63 }
64 
65 bool DummyScheduler::performTransaction( IncidenceBase *incidence, iTIPMethod method )
66 {
67  QString messageText = mFormat->createScheduleMessage( incidence, method );
68 
69  return saveMessage( messageText );
70 }
71 
72 bool DummyScheduler::saveMessage( const QString &message )
73 {
74  QFile f( "dummyscheduler.store" );
75  if ( f.open( QIODevice::WriteOnly | QIODevice::Append ) ) {
76  QTextStream t( &f );
77  t << message << endl;
78  f.close();
79  return true;
80  } else {
81  return false;
82  }
83 }
84 
85 QList<ScheduleMessage*> DummyScheduler::retrieveTransactions()
86 {
87  QList<ScheduleMessage*> messageList;
88 
89  QFile f( "dummyscheduler.store" );
90  if ( !f.open( QIODevice::ReadOnly ) ) {
91  kDebug() << "Can't open file";
92  } else {
93  QTextStream t( &f );
94  QString messageString;
95  QString messageLine = t.readLine();
96  while ( !messageLine.isNull() ) {
97  messageString += messageLine + '\n';
98  if ( messageLine.indexOf( "END:VCALENDAR" ) >= 0 ) {
99  kDebug() << "---------------" << messageString;
100  ScheduleMessage *message = mFormat->parseScheduleMessage( mCalendar,
101  messageString );
102  kDebug() << "--Parsed";
103  if ( message ) {
104  messageList.append( message );
105  } else {
106  QString errorMessage;
107  if ( mFormat->exception() ) {
108  errorMessage = mFormat->exception()->message();
109  }
110  kDebug() << "Error parsing message:" << errorMessage;
111  }
112  messageString = "";
113  }
114  messageLine = t.readLine();
115  }
116  f.close();
117  }
118 
119  return messageList;
120 }
121 
122 QString DummyScheduler::freeBusyDir()
123 {
124  // the dummy scheduler should never handle freebusy stuff - so it's hardcoded
125  return QString( "" );
126 }
KCal::DummyScheduler::freeBusyDir
virtual QString freeBusyDir()
Returns the directory where the free-busy information is stored.
Definition: dummyscheduler.cpp:122
KCal::Calendar
Represents the main calendar class.
Definition: calendar.h:119
KCal::IncidenceBase
An abstract class that provides a common base for all calendar incidence classes. ...
Definition: incidencebase.h:102
KCal::ScheduleMessage
A Scheduling message class.
Definition: scheduler.h:58
KCal::DummyScheduler::publish
bool publish(IncidenceBase *incidence, const QString &recipients)
iTIP publish action
Definition: dummyscheduler.cpp:47
KCal::DummyScheduler::performTransaction
bool performTransaction(IncidenceBase *incidence, iTIPMethod method)
Performs iTIP transaction on incidence.
Definition: dummyscheduler.cpp:65
KCal::ErrorFormat::message
QString message()
Returns the format error message.
Definition: exceptions.cpp:84
KCal::DummyScheduler::retrieveTransactions
QList< ScheduleMessage * > retrieveTransactions()
Retrieves incoming iTIP transactions.
Definition: dummyscheduler.cpp:85
KCal::ICalFormat::parseScheduleMessage
ScheduleMessage * parseScheduleMessage(Calendar *calendar, const QString &string)
Parses a Calendar scheduling message string into ScheduleMessage object.
Definition: icalformat.cpp:403
KCal::Scheduler
This class provides an encapsulation of iTIP transactions (RFC 2446).
Definition: scheduler.h:120
event.h
This file is part of the API for handling calendar data and defines the Event class.
KCal::ICalFormat::createScheduleMessage
QString createScheduleMessage(IncidenceBase *incidence, iTIPMethod method)
Creates a scheduling message string for an Incidence.
Definition: icalformat.cpp:339
icalformat.h
This file is part of the API for handling calendar data and defines the ICalFormat class...
KCal::CalFormat::exception
ErrorFormat * exception()
Returns an exception, if there is any, containing information about the last error that occurred...
Definition: calformat.cpp:83
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:57 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KCal Library

Skip menu "KCal Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal