-rw-r--r-- | libkcal/vcalformat.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h index 6dae3d2..cac9634 100644 --- a/libkcal/vcalformat.h +++ b/libkcal/vcalformat.h | |||
@@ -1,113 +1,116 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 1998 Preston Brown | 3 | Copyright (c) 1998 Preston Brown |
4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 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 | 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, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifndef _VCALFORMAT_H | 22 | #ifndef _VCALFORMAT_H |
23 | #define _VCALFORMAT_H | 23 | #define _VCALFORMAT_H |
24 | 24 | ||
25 | #include "calformat.h" | 25 | #include "calformat.h" |
26 | //Added by qt3to4: | ||
27 | #include <Q3CString> | ||
28 | #include <Q3PtrList> | ||
26 | 29 | ||
27 | #define _VCAL_VERSION "1.0" | 30 | #define _VCAL_VERSION "1.0" |
28 | 31 | ||
29 | class VObject; | 32 | class VObject; |
30 | 33 | ||
31 | namespace KCal { | 34 | namespace KCal { |
32 | 35 | ||
33 | /** | 36 | /** |
34 | This class implements the vCalendar format. It provides methods for | 37 | This class implements the vCalendar format. It provides methods for |
35 | loading/saving/converting vCalendar format data into the internal KOrganizer | 38 | loading/saving/converting vCalendar format data into the internal KOrganizer |
36 | representation as Calendar and Events. | 39 | representation as Calendar and Events. |
37 | 40 | ||
38 | @short vCalendar format implementation | 41 | @short vCalendar format implementation |
39 | */ | 42 | */ |
40 | class VCalFormat : public CalFormat { | 43 | class VCalFormat : public CalFormat { |
41 | public: | 44 | public: |
42 | VCalFormat(); | 45 | VCalFormat(); |
43 | virtual ~VCalFormat(); | 46 | virtual ~VCalFormat(); |
44 | 47 | ||
45 | /** loads a calendar on disk in vCalendar format into the current calendar. | 48 | /** loads a calendar on disk in vCalendar format into the current calendar. |
46 | * any information already present is lost. Returns TRUE if successful, | 49 | * any information already present is lost. Returns TRUE if successful, |
47 | * else returns FALSE. | 50 | * else returns FALSE. |
48 | * @param fileName the name of the calendar on disk. | 51 | * @param fileName the name of the calendar on disk. |
49 | */ | 52 | */ |
50 | bool load(Calendar *,const QString &fileName ); | 53 | bool load(Calendar *,const QString &fileName ); |
51 | /** writes out the calendar to disk in vCalendar format. Returns true if | 54 | /** writes out the calendar to disk in vCalendar format. Returns true if |
52 | * successful and false on error. | 55 | * successful and false on error. |
53 | * @param fileName the name of the file | 56 | * @param fileName the name of the file |
54 | */ | 57 | */ |
55 | bool save(Calendar *,const QString &fileName ); | 58 | bool save(Calendar *,const QString &fileName ); |
56 | 59 | ||
57 | /** | 60 | /** |
58 | Parse string and populate calendar with that information. | 61 | Parse string and populate calendar with that information. |
59 | */ | 62 | */ |
60 | bool fromString( Calendar *, const QString & ); | 63 | bool fromString( Calendar *, const QString & ); |
61 | /** | 64 | /** |
62 | Return calendar information as string. | 65 | Return calendar information as string. |
63 | */ | 66 | */ |
64 | void setLocalTime ( bool ); | 67 | void setLocalTime ( bool ); |
65 | QString toString( Calendar * ); | 68 | QString toString( Calendar * ); |
66 | QString eventToString( Event *, Calendar *calendar, bool useLocalTime = true ); | 69 | QString eventToString( Event *, Calendar *calendar, bool useLocalTime = true ); |
67 | QString todoToString( Todo * ,Calendar *calendar, bool useLocalTime = true ); | 70 | QString todoToString( Todo * ,Calendar *calendar, bool useLocalTime = true ); |
68 | 71 | ||
69 | protected: | 72 | protected: |
70 | /** translates a VObject of the TODO type into a Event */ | 73 | /** translates a VObject of the TODO type into a Event */ |
71 | Todo *VTodoToEvent(VObject *vtodo); | 74 | Todo *VTodoToEvent(VObject *vtodo); |
72 | /** translates a VObject into a Event and returns a pointer to it. */ | 75 | /** translates a VObject into a Event and returns a pointer to it. */ |
73 | Event *VEventToEvent(VObject *vevent); | 76 | Event *VEventToEvent(VObject *vevent); |
74 | /** translate a Event into a VTodo-type VObject and return pointer */ | 77 | /** translate a Event into a VTodo-type VObject and return pointer */ |
75 | VObject *eventToVTodo(const Todo *anEvent); | 78 | VObject *eventToVTodo(const Todo *anEvent); |
76 | /** translate a Event into a VObject and returns a pointer to it. */ | 79 | /** translate a Event into a VObject and returns a pointer to it. */ |
77 | VObject* eventToVEvent(Event *anEvent); | 80 | VObject* eventToVEvent(Event *anEvent); |
78 | 81 | ||
79 | /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */ | 82 | /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */ |
80 | QString qDateToISO(const QDate &); | 83 | QString qDateToISO(const QDate &); |
81 | /** takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS */ | 84 | /** takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS */ |
82 | QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE); | 85 | QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE); |
83 | /** takes a string in the format YYYYMMDDTHHMMSS and returns a | 86 | /** takes a string in the format YYYYMMDDTHHMMSS and returns a |
84 | * valid QDateTime. */ | 87 | * valid QDateTime. */ |
85 | QDateTime ISOToQDateTime(const QString & dtStr); | 88 | QDateTime ISOToQDateTime(const QString & dtStr); |
86 | /** takes a string in the format YYYYMMDD and returns a | 89 | /** takes a string in the format YYYYMMDD and returns a |
87 | * valid QDate. */ | 90 | * valid QDate. */ |
88 | QDate ISOToQDate(const QString & dtStr); | 91 | QDate ISOToQDate(const QString & dtStr); |
89 | /** takes a vCalendar tree of VObjects, and puts all of them that have | 92 | /** takes a vCalendar tree of VObjects, and puts all of them that have |
90 | * the "event" property into the dictionary, todos in the todo-list, etc. */ | 93 | * the "event" property into the dictionary, todos in the todo-list, etc. */ |
91 | void populate(VObject *vcal); | 94 | void populate(VObject *vcal); |
92 | 95 | ||
93 | /** takes a number 0 - 6 and returns the two letter string of that day, | 96 | /** takes a number 0 - 6 and returns the two letter string of that day, |
94 | * i.e. MO, TU, WE, etc. */ | 97 | * i.e. MO, TU, WE, etc. */ |
95 | const char *dayFromNum(int day); | 98 | const char *dayFromNum(int day); |
96 | /** the reverse of the above function. */ | 99 | /** the reverse of the above function. */ |
97 | int numFromDay(const QString &day); | 100 | int numFromDay(const QString &day); |
98 | Attendee::Role VCalFormat::readRole(const char *s) const; | 101 | Attendee::Role readRole(const char *s) const; |
99 | QCString writeRole(Attendee::Role role) const; | 102 | Q3CString writeRole(Attendee::Role role) const; |
100 | Attendee::PartStat readStatus(const char *s) const; | 103 | Attendee::PartStat readStatus(const char *s) const; |
101 | QCString writeStatus(Attendee::PartStat status) const; | 104 | Q3CString writeStatus(Attendee::PartStat status) const; |
102 | 105 | ||
103 | private: | 106 | private: |
104 | Calendar *mCalendar; | 107 | Calendar *mCalendar; |
105 | bool useLocalTime; | 108 | bool useLocalTime; |
106 | 109 | ||
107 | QPtrList<Event> mEventsRelate; // events with relations | 110 | Q3PtrList<Event> mEventsRelate; // events with relations |
108 | QPtrList<Todo> mTodosRelate; // todos with relations | 111 | Q3PtrList<Todo> mTodosRelate; // todos with relations |
109 | }; | 112 | }; |
110 | 113 | ||
111 | } | 114 | } |
112 | 115 | ||
113 | #endif | 116 | #endif |