summaryrefslogtreecommitdiffabout
path: root/libkcal/vcalformat.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/vcalformat.h
downloadkdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2
Initial revision
Diffstat (limited to 'libkcal/vcalformat.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/vcalformat.h108
1 files changed, 108 insertions, 0 deletions
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h
new file mode 100644
index 0000000..d4cecbc
--- a/dev/null
+++ b/libkcal/vcalformat.h
@@ -0,0 +1,108 @@
1/*
2 This file is part of libkcal.
3 Copyright (c) 1998 Preston Brown
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., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
20*/
21
22#ifndef _VCALFORMAT_H
23#define _VCALFORMAT_H
24
25#include "calformat.h"
26
27#define _VCAL_VERSION "1.0"
28
29class VObject;
30
31namespace KCal {
32
33/**
34 This class implements the vCalendar format. It provides methods for
35 loading/saving/converting vCalendar format data into the internal KOrganizer
36 representation as Calendar and Events.
37
38 @short vCalendar format implementation
39*/
40class VCalFormat : public CalFormat {
41 public:
42 VCalFormat();
43 virtual ~VCalFormat();
44
45 /** loads a calendar on disk in vCalendar format into the current calendar.
46 * any information already present is lost. Returns TRUE if successful,
47 * else returns FALSE.
48 * @param fileName the name of the calendar on disk.
49 */
50 bool load(Calendar *,const QString &fileName);
51 /** writes out the calendar to disk in vCalendar format. Returns true if
52 * successful and false on error.
53 * @param fileName the name of the file
54 */
55 bool save(Calendar *,const QString &fileName);
56
57 /**
58 Parse string and populate calendar with that information.
59 */
60 bool fromString( Calendar *, const QString & );
61 /**
62 Return calendar information as string.
63 */
64 QString toString( Calendar * );
65
66 protected:
67 /** translates a VObject of the TODO type into a Event */
68 Todo *VTodoToEvent(VObject *vtodo);
69 /** translates a VObject into a Event and returns a pointer to it. */
70 Event *VEventToEvent(VObject *vevent);
71 /** translate a Event into a VTodo-type VObject and return pointer */
72 VObject *eventToVTodo(const Todo *anEvent);
73 /** translate a Event into a VObject and returns a pointer to it. */
74 VObject* eventToVEvent(const Event *anEvent);
75
76 /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */
77 QString qDateToISO(const QDate &);
78 /** takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS */
79 QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE);
80 /** takes a string in the format YYYYMMDDTHHMMSS and returns a
81 * valid QDateTime. */
82 QDateTime ISOToQDateTime(const QString & dtStr);
83 /** takes a string in the format YYYYMMDD and returns a
84 * valid QDate. */
85 QDate ISOToQDate(const QString & dtStr);
86 /** takes a vCalendar tree of VObjects, and puts all of them that have
87 * the "event" property into the dictionary, todos in the todo-list, etc. */
88 void populate(VObject *vcal);
89
90 /** takes a number 0 - 6 and returns the two letter string of that day,
91 * i.e. MO, TU, WE, etc. */
92 const char *dayFromNum(int day);
93 /** the reverse of the above function. */
94 int numFromDay(const QString &day);
95
96 Attendee::PartStat readStatus(const char *s) const;
97 QCString writeStatus(Attendee::PartStat status) const;
98
99 private:
100 Calendar *mCalendar;
101
102 QPtrList<Event> mEventsRelate; // events with relations
103 QPtrList<Todo> mTodosRelate; // todos with relations
104};
105
106}
107
108#endif