summaryrefslogtreecommitdiffabout
path: root/libkcal/icalformatimpl.h
Unidiff
Diffstat (limited to 'libkcal/icalformatimpl.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/icalformatimpl.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/libkcal/icalformatimpl.h b/libkcal/icalformatimpl.h
new file mode 100644
index 0000000..2f32365
--- a/dev/null
+++ b/libkcal/icalformatimpl.h
@@ -0,0 +1,109 @@
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 ICALFORMATIMPL_H
21#define ICALFORMATIMPL_H
22
23#include <qstring.h>
24
25#include "scheduler.h"
26#include "freebusy.h"
27
28extern "C" {
29 #include <ical.h>
30 #include <icalss.h>
31}
32
33namespace KCal {
34
35class Compat;
36
37/**
38 This class provides the libical dependent functions for ICalFormat.
39*/
40class ICalFormatImpl {
41 public:
42 /** Create new iCal format for calendar object */
43 ICalFormatImpl( ICalFormat *parent );
44 virtual ~ICalFormatImpl();
45
46 bool populate( Calendar *, icalcomponent *fs);
47
48 icalcomponent *writeIncidence(Incidence *incidence);
49 icalcomponent *writeTodo(Todo *todo);
50 icalcomponent *writeEvent(Event *event);
51 icalcomponent *writeFreeBusy(FreeBusy *freebusy,
52 Scheduler::Method method);
53 icalcomponent *writeJournal(Journal *journal);
54 void writeIncidence(icalcomponent *parent,Incidence *incidence);
55 icalproperty *writeAttendee(Attendee *attendee);
56 icalproperty *writeAttachment(Attachment *attach);
57 icalproperty *writeRecurrenceRule(Recurrence *);
58 icalproperty *writeAlarm(Alarm *alarm);
59
60 QString extractErrorProperty(icalcomponent *);
61 Todo *readTodo(icalcomponent *vtodo);
62 Event *readEvent(icalcomponent *vevent);
63 FreeBusy *readFreeBusy(icalcomponent *vfreebusy);
64 Journal *readJournal(icalcomponent *vjournal);
65 Attendee *readAttendee(icalproperty *attendee);
66 Attachment *readAttachment(icalproperty *attach);
67 void readIncidence(icalcomponent *parent,Incidence *incidence);
68 void readRecurrenceRule(struct icalrecurrencetype rrule,Incidence *event);
69 void readRecurrence( const struct icalrecurrencetype &r, Recurrence* recur,Incidence *event );
70 void readAlarm(icalcomponent *alarm,Incidence *incidence);
71 /** Return the PRODID string loaded from calendar file */
72 const QString &loadedProductId() { return mLoadedProductId; }
73
74 icaltimetype writeICalDate(const QDate &);
75 QDate readICalDate(icaltimetype);
76 icaltimetype writeICalDateTime(const QDateTime &);
77 QDateTime readICalDateTime(icaltimetype);
78 icaldurationtype writeICalDuration(int seconds);
79 int readICalDuration(icaldurationtype);
80 icalcomponent *createCalendarComponent(Calendar * = 0);
81 icalcomponent *createScheduleComponent(IncidenceBase *,Scheduler::Method);
82
83 private:
84 void writeIncidenceBase(icalcomponent *parent,IncidenceBase *);
85 void readIncidenceBase(icalcomponent *parent,IncidenceBase *);
86 void writeCustomProperties(icalcomponent *parent,CustomProperties *);
87 void readCustomProperties(icalcomponent *parent,CustomProperties *);
88 void dumpIcalRecurrence(icalrecurrencetype);
89
90 ICalFormat *mParent;
91 Calendar *mCalendar;
92
93 QString mLoadedProductId; // PRODID string loaded from calendar file
94 int mCalendarVersion; // determines backward compatibility mode on read
95
96 QPtrList<Event> mEventsRelate; // events with relations
97 QPtrList<Todo> mTodosRelate; // todos with relations
98
99 static const int mSecondsPerWeek;
100 static const int mSecondsPerDay;
101 static const int mSecondsPerHour;
102 static const int mSecondsPerMinute;
103
104 Compat *mCompat;
105};
106
107}
108
109#endif