summaryrefslogtreecommitdiffabout
path: root/libkcal/calendarlocal.h
authorzautrix <zautrix>2004-06-29 11:59:46 (UTC)
committer zautrix <zautrix>2004-06-29 11:59:46 (UTC)
commitda43dbdc6c82453228f34766fc74585615cba938 (patch) (unidiff)
tree16576932cea08bf117b2d0320b0d5f66ee8ad093 /libkcal/calendarlocal.h
parent627489ea2669d3997676bc3cee0f5d0d0c16c4d4 (diff)
downloadkdepimpi-da43dbdc6c82453228f34766fc74585615cba938.zip
kdepimpi-da43dbdc6c82453228f34766fc74585615cba938.tar.gz
kdepimpi-da43dbdc6c82453228f34766fc74585615cba938.tar.bz2
New lib ical.Some minor changes as well.
Diffstat (limited to 'libkcal/calendarlocal.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendarlocal.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index a17cf11..a2e50e3 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -1,216 +1,217 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 3
4 Copyright (c) 1998 Preston Brown 4 Copyright (c) 1998 Preston Brown
5 Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> 5 Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This library is distributed in the hope that it will be useful, 12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 Library General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public License 17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to 18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22#ifndef KCAL_CALENDARLOCAL_H 22#ifndef KCAL_CALENDARLOCAL_H
23#define KCAL_CALENDARLOCAL_H 23#define KCAL_CALENDARLOCAL_H
24 24
25#include "calendar.h" 25#include "calendar.h"
26 26
27namespace KCal { 27namespace KCal {
28 28
29class CalFormat; 29class CalFormat;
30 30
31/** 31/**
32 This class provides a calendar stored as a local file. 32 This class provides a calendar stored as a local file.
33*/ 33*/
34class CalendarLocal : public Calendar 34class CalendarLocal : public Calendar
35{ 35{
36 public: 36 public:
37 /** 37 /**
38 Constructs a new calendar, with variables initialized to sane values. 38 Constructs a new calendar, with variables initialized to sane values.
39 */ 39 */
40 CalendarLocal(); 40 CalendarLocal();
41 /** 41 /**
42 Constructs a new calendar, with variables initialized to sane values. 42 Constructs a new calendar, with variables initialized to sane values.
43 */ 43 */
44 CalendarLocal( const QString &timeZoneId ); 44 CalendarLocal( const QString &timeZoneId );
45 ~CalendarLocal(); 45 ~CalendarLocal();
46 46
47 /** 47 /**
48 Loads a calendar on disk in vCalendar or iCalendar format into the current 48 Loads a calendar on disk in vCalendar or iCalendar format into the current
49 calendar. Any information already present is lost. 49 calendar. Any information already present is lost.
50 @return true, if successfull, false on error. 50 @return true, if successfull, false on error.
51 @param fileName the name of the calendar on disk. 51 @param fileName the name of the calendar on disk.
52 */ 52 */
53 bool load( const QString &fileName ); 53 bool load( const QString &fileName );
54 /** 54 /**
55 Writes out the calendar to disk in the specified \a format. 55 Writes out the calendar to disk in the specified \a format.
56 CalendarLocal takes ownership of the CalFormat object. 56 CalendarLocal takes ownership of the CalFormat object.
57 @return true, if successfull, false on error. 57 @return true, if successfull, false on error.
58 @param fileName the name of the file 58 @param fileName the name of the file
59 */ 59 */
60 bool save( const QString &fileName, CalFormat *format = 0 ); 60 bool save( const QString &fileName, CalFormat *format = 0 );
61 61
62 /** 62 /**
63 Clears out the current calendar, freeing all used memory etc. etc. 63 Clears out the current calendar, freeing all used memory etc. etc.
64 */ 64 */
65 void close(); 65 void close();
66 66
67 void save() {} 67 void save() {}
68 68
69 /** 69 /**
70 Add Event to calendar. 70 Add Event to calendar.
71 */ 71 */
72 bool addAnniversaryNoDup( Event *event );
72 bool addEventNoDup( Event *event ); 73 bool addEventNoDup( Event *event );
73 bool addEvent( Event *event ); 74 bool addEvent( Event *event );
74 /** 75 /**
75 Deletes an event from this calendar. 76 Deletes an event from this calendar.
76 */ 77 */
77 void deleteEvent( Event *event ); 78 void deleteEvent( Event *event );
78 79
79 /** 80 /**
80 Retrieves an event on the basis of the unique string ID. 81 Retrieves an event on the basis of the unique string ID.
81 */ 82 */
82 Event *event( const QString &uid ); 83 Event *event( const QString &uid );
83 /** 84 /**
84 Return unfiltered list of all events in calendar. 85 Return unfiltered list of all events in calendar.
85 */ 86 */
86 QPtrList<Event> rawEvents(); 87 QPtrList<Event> rawEvents();
87 88
88 /** 89 /**
89 Add a todo to the todolist. 90 Add a todo to the todolist.
90 */ 91 */
91 bool addTodo( Todo *todo ); 92 bool addTodo( Todo *todo );
92 bool addTodoNoDup( Todo *todo ); 93 bool addTodoNoDup( Todo *todo );
93 /** 94 /**
94 Remove a todo from the todolist. 95 Remove a todo from the todolist.
95 */ 96 */
96 void deleteTodo( Todo * ); 97 void deleteTodo( Todo * );
97 /** 98 /**
98 Searches todolist for an event with this unique string identifier, 99 Searches todolist for an event with this unique string identifier,
99 returns a pointer or null. 100 returns a pointer or null.
100 */ 101 */
101 Todo *todo( const QString &uid ); 102 Todo *todo( const QString &uid );
102 /** 103 /**
103 Return list of all todos. 104 Return list of all todos.
104 */ 105 */
105 QPtrList<Todo> rawTodos(); 106 QPtrList<Todo> rawTodos();
106 /** 107 /**
107 Returns list of todos due on the specified date. 108 Returns list of todos due on the specified date.
108 */ 109 */
109 QPtrList<Todo> todos( const QDate &date ); 110 QPtrList<Todo> todos( const QDate &date );
110 /** 111 /**
111 Return list of all todos. 112 Return list of all todos.
112 113
113 Workaround because compiler does not recognize function of base class. 114 Workaround because compiler does not recognize function of base class.
114 */ 115 */
115 QPtrList<Todo> todos() { return Calendar::todos(); } 116 QPtrList<Todo> todos() { return Calendar::todos(); }
116 117
117 /** 118 /**
118 Add a Journal entry to calendar. 119 Add a Journal entry to calendar.
119 */ 120 */
120 bool addJournal( Journal * ); 121 bool addJournal( Journal * );
121 /** 122 /**
122 Remove a Journal from the calendar. 123 Remove a Journal from the calendar.
123 */ 124 */
124 void deleteJournal( Journal * ); 125 void deleteJournal( Journal * );
125 /** 126 /**
126 Return Journal for given date. 127 Return Journal for given date.
127 */ 128 */
128 Journal *journal( const QDate & ); 129 Journal *journal( const QDate & );
129 /** 130 /**
130 Return Journal with given UID. 131 Return Journal with given UID.
131 */ 132 */
132 Journal *journal( const QString &uid ); 133 Journal *journal( const QString &uid );
133 /** 134 /**
134 Return list of all Journals stored in calendar. 135 Return list of all Journals stored in calendar.
135 */ 136 */
136 QPtrList<Journal> journals(); 137 QPtrList<Journal> journals();
137 138
138 /** 139 /**
139 Return all alarms, which ocur in the given time interval. 140 Return all alarms, which ocur in the given time interval.
140 */ 141 */
141 Alarm::List alarms( const QDateTime &from, const QDateTime &to ); 142 Alarm::List alarms( const QDateTime &from, const QDateTime &to );
142 143
143 /** 144 /**
144 Return all alarms, which ocur before given date. 145 Return all alarms, which ocur before given date.
145 */ 146 */
146 Alarm::List alarmsTo( const QDateTime &to ); 147 Alarm::List alarmsTo( const QDateTime &to );
147 148
148 QDateTime nextAlarm( int daysTo ) ; 149 QDateTime nextAlarm( int daysTo ) ;
149 QDateTime nextAlarmEventDateTime() const; 150 QDateTime nextAlarmEventDateTime() const;
150 void checkAlarmForIncidence( Incidence *, bool deleted ) ; 151 void checkAlarmForIncidence( Incidence *, bool deleted ) ;
151 void registerAlarm(); 152 void registerAlarm();
152 void deRegisterAlarm(); 153 void deRegisterAlarm();
153 QString getAlarmNotification(); 154 QString getAlarmNotification();
154 QString nextSummary() const ; 155 QString nextSummary() const ;
155 /** 156 /**
156 This method should be called whenever a Event is modified directly 157 This method should be called whenever a Event is modified directly
157 via it's pointer. It makes sure that the calendar is internally 158 via it's pointer. It makes sure that the calendar is internally
158 consistent. 159 consistent.
159 */ 160 */
160 void update( IncidenceBase *incidence ); 161 void update( IncidenceBase *incidence );
161 162
162 /** 163 /**
163 Builds and then returns a list of all events that match for the 164 Builds and then returns a list of all events that match for the
164 date specified. useful for dayView, etc. etc. 165 date specified. useful for dayView, etc. etc.
165 */ 166 */
166 QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false ); 167 QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false );
167 /** 168 /**
168 Get unfiltered events for date \a qdt. 169 Get unfiltered events for date \a qdt.
169 */ 170 */
170 QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); 171 QPtrList<Event> rawEventsForDate( const QDateTime &qdt );
171 /** 172 /**
172 Get unfiltered events in a range of dates. If inclusive is set to true, 173 Get unfiltered events in a range of dates. If inclusive is set to true,
173 only events are returned, which are completely included in the range. 174 only events are returned, which are completely included in the range.
174 */ 175 */
175 QPtrList<Event> rawEvents( const QDate &start, const QDate &end, 176 QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
176 bool inclusive = false ); 177 bool inclusive = false );
177 Todo *CalendarLocal::todo( int uid ); 178 Todo *CalendarLocal::todo( int uid );
178 Event *CalendarLocal::event( int uid ); 179 Event *CalendarLocal::event( int uid );
179 180
180 181
181 182
182 protected: 183 protected:
183 184
184 // Event* mNextAlarmEvent; 185 // Event* mNextAlarmEvent;
185 QString mNextSummary; 186 QString mNextSummary;
186 QString mNextAlarmEventDateTimeString; 187 QString mNextAlarmEventDateTimeString;
187 QString mLastAlarmNotificationString; 188 QString mLastAlarmNotificationString;
188 QDateTime mNextAlarmEventDateTime; 189 QDateTime mNextAlarmEventDateTime;
189 QDateTime mNextAlarmDateTime; 190 QDateTime mNextAlarmDateTime;
190 void reInitAlarmSettings(); 191 void reInitAlarmSettings();
191 192
192 /** Notification function of IncidenceBase::Observer. */ 193 /** Notification function of IncidenceBase::Observer. */
193 void incidenceUpdated( IncidenceBase *i ) { update( i ); } 194 void incidenceUpdated( IncidenceBase *i ) { update( i ); }
194 195
195 /** inserts an event into its "proper place" in the calendar. */ 196 /** inserts an event into its "proper place" in the calendar. */
196 void insertEvent( Event *event ); 197 void insertEvent( Event *event );
197 198
198 /** Append alarms of incidence in interval to list of alarms. */ 199 /** Append alarms of incidence in interval to list of alarms. */
199 void appendAlarms( Alarm::List &alarms, Incidence *incidence, 200 void appendAlarms( Alarm::List &alarms, Incidence *incidence,
200 const QDateTime &from, const QDateTime &to ); 201 const QDateTime &from, const QDateTime &to );
201 202
202 /** Append alarms of recurring events in interval to list of alarms. */ 203 /** Append alarms of recurring events in interval to list of alarms. */
203 void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence, 204 void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence,
204 const QDateTime &from, const QDateTime &to ); 205 const QDateTime &from, const QDateTime &to );
205 206
206 private: 207 private:
207 void init(); 208 void init();
208 209
209 QPtrList<Event> mEventList; 210 QPtrList<Event> mEventList;
210 QPtrList<Todo> mTodoList; 211 QPtrList<Todo> mTodoList;
211 QPtrList<Journal> mJournalList; 212 QPtrList<Journal> mJournalList;
212}; 213};
213 214
214} 215}
215 216
216#endif 217#endif