summaryrefslogtreecommitdiffabout
path: root/libkcal/calendarlocal.h
Unidiff
Diffstat (limited to 'libkcal/calendarlocal.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendarlocal.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index b611704..1ceabce 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -1,233 +1,234 @@
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 void addCalendar( Calendar* ); 46 void addCalendar( Calendar* );
47 bool addCalendarFile( QString name, int id ); 47 bool addCalendarFile( QString name, int id );
48 bool mergeCalendarFile( QString name ); 48 bool mergeCalendarFile( QString name );
49 bool mergeCalendar( Calendar* cal ); 49 bool mergeCalendar( Calendar* cal );
50 Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates, bool enabledOnly = false ); 50 Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates, bool enabledOnly = false,int * isDup = 0 );
51 Todo* todoForUid( const QString& uid, bool doNotCheckDuplicates = true, bool enabledOnly = false ,int * isDup = 0 );
51 void setSyncEventsReadOnly(); 52 void setSyncEventsReadOnly();
52 void setSyncEventsEnabled(); 53 void setSyncEventsEnabled();
53 void stopAllTodos(); 54 void stopAllTodos();
54 /** 55 /**
55 Loads a calendar on disk in vCalendar or iCalendar format into the current 56 Loads a calendar on disk in vCalendar or iCalendar format into the current
56 calendar. Any information already present is lost. 57 calendar. Any information already present is lost.
57 @return true, if successfull, false on error. 58 @return true, if successfull, false on error.
58 @param fileName the name of the calendar on disk. 59 @param fileName the name of the calendar on disk.
59 */ 60 */
60 bool load( const QString &fileName ); 61 bool load( const QString &fileName );
61 /** 62 /**
62 Writes out the calendar to disk in the specified \a format. 63 Writes out the calendar to disk in the specified \a format.
63 CalendarLocal takes ownership of the CalFormat object. 64 CalendarLocal takes ownership of the CalFormat object.
64 @return true, if successfull, false on error. 65 @return true, if successfull, false on error.
65 @param fileName the name of the file 66 @param fileName the name of the file
66 */ 67 */
67 bool save( const QString &fileName, CalFormat *format = 0 ); 68 bool save( const QString &fileName, CalFormat *format = 0 );
68 69
69 /** 70 /**
70 Clears out the current calendar, freeing all used memory etc. etc. 71 Clears out the current calendar, freeing all used memory etc. etc.
71 */ 72 */
72 void close(); 73 void close();
73 74
74 void save() {} 75 void save() {}
75 76
76 /** 77 /**
77 Add Event to calendar. 78 Add Event to calendar.
78 */ 79 */
79 void removeSyncInfo( QString syncProfile); 80 void removeSyncInfo( QString syncProfile);
80 bool addAnniversaryNoDup( Event *event ); 81 bool addAnniversaryNoDup( Event *event );
81 bool addEventNoDup( Event *event ); 82 bool addEventNoDup( Event *event );
82 bool addEvent( Event *event ); 83 bool addEvent( Event *event );
83 /** 84 /**
84 Deletes an event from this calendar. 85 Deletes an event from this calendar.
85 */ 86 */
86 void deleteEvent( Event *event ); 87 void deleteEvent( Event *event );
87 88
88 /** 89 /**
89 Retrieves an event on the basis of the unique string ID. 90 Retrieves an event on the basis of the unique string ID.
90 */ 91 */
91 Event *event( const QString &uid ); 92 Event *event( const QString &uid );
92 /** 93 /**
93 Return unfiltered list of all events in calendar. 94 Return unfiltered list of all events in calendar.
94 */ 95 */
95 QPtrList<Event> rawEvents(); 96 QPtrList<Event> rawEvents();
96 QPtrList<Event> getExternLastSyncEvents(); 97 QPtrList<Event> getExternLastSyncEvents();
97 /** 98 /**
98 Add a todo to the todolist. 99 Add a todo to the todolist.
99 */ 100 */
100 bool addTodo( Todo *todo ); 101 bool addTodo( Todo *todo );
101 bool addTodoNoDup( Todo *todo ); 102 bool addTodoNoDup( Todo *todo );
102 /** 103 /**
103 Remove a todo from the todolist. 104 Remove a todo from the todolist.
104 */ 105 */
105 void deleteTodo( Todo * ); 106 void deleteTodo( Todo * );
106 /** 107 /**
107 Searches todolist for an event with this unique string identifier, 108 Searches todolist for an event with this unique string identifier,
108 returns a pointer or null. 109 returns a pointer or null.
109 */ 110 */
110 Todo *todo( const QString &uid ); 111 Todo *todo( const QString &uid );
111 /** 112 /**
112 Return list of all todos. 113 Return list of all todos.
113 */ 114 */
114 QPtrList<Todo> rawTodos(); 115 QPtrList<Todo> rawTodos();
115 /** 116 /**
116 Returns list of todos due on the specified date. 117 Returns list of todos due on the specified date.
117 */ 118 */
118 QPtrList<Todo> todos( const QDate &date ); 119 QPtrList<Todo> todos( const QDate &date );
119 /** 120 /**
120 Return list of all todos. 121 Return list of all todos.
121 122
122 Workaround because compiler does not recognize function of base class. 123 Workaround because compiler does not recognize function of base class.
123 */ 124 */
124 QPtrList<Todo> todos() { return Calendar::todos(); } 125 QPtrList<Todo> todos() { return Calendar::todos(); }
125 126
126 /** 127 /**
127 Add a Journal entry to calendar. 128 Add a Journal entry to calendar.
128 */ 129 */
129 bool addJournal( Journal * ); 130 bool addJournal( Journal * );
130 /** 131 /**
131 Remove a Journal from the calendar. 132 Remove a Journal from the calendar.
132 */ 133 */
133 void deleteJournal( Journal * ); 134 void deleteJournal( Journal * );
134 /** 135 /**
135 Return Journal for given date. 136 Return Journal for given date.
136 */ 137 */
137 Journal *journal( const QDate & ); 138 Journal *journal( const QDate & );
138 QPtrList<Journal> journals4Date( const QDate & ); 139 QPtrList<Journal> journals4Date( const QDate & );
139 /** 140 /**
140 Return Journal with given UID. 141 Return Journal with given UID.
141 */ 142 */
142 Journal *journal( const QString &uid ); 143 Journal *journal( const QString &uid );
143 /** 144 /**
144 Return list of all Journals stored in calendar. 145 Return list of all Journals stored in calendar.
145 */ 146 */
146 QPtrList<Journal> journals(); 147 QPtrList<Journal> journals();
147 148
148 /** 149 /**
149 Return all alarms, which ocur in the given time interval. 150 Return all alarms, which ocur in the given time interval.
150 */ 151 */
151 Alarm::List alarms( const QDateTime &from, const QDateTime &to ); 152 Alarm::List alarms( const QDateTime &from, const QDateTime &to );
152 153
153 /** 154 /**
154 Return all alarms, which ocur before given date. 155 Return all alarms, which ocur before given date.
155 */ 156 */
156 Alarm::List alarmsTo( const QDateTime &to ); 157 Alarm::List alarmsTo( const QDateTime &to );
157 158
158 QDateTime nextAlarm( int daysTo ) ; 159 QDateTime nextAlarm( int daysTo ) ;
159 QDateTime nextAlarmEventDateTime() const; 160 QDateTime nextAlarmEventDateTime() const;
160 void checkAlarmForIncidence( Incidence *, bool deleted ) ; 161 void checkAlarmForIncidence( Incidence *, bool deleted ) ;
161 void registerAlarm(); 162 void registerAlarm();
162 void deRegisterAlarm(); 163 void deRegisterAlarm();
163 QString getAlarmNotification(); 164 QString getAlarmNotification();
164 QString nextSummary() const ; 165 QString nextSummary() const ;
165 /** 166 /**
166 This method should be called whenever a Event is modified directly 167 This method should be called whenever a Event is modified directly
167 via it's pointer. It makes sure that the calendar is internally 168 via it's pointer. It makes sure that the calendar is internally
168 consistent. 169 consistent.
169 */ 170 */
170 void update( IncidenceBase *incidence ); 171 void update( IncidenceBase *incidence );
171 172
172 /** 173 /**
173 Builds and then returns a list of all events that match for the 174 Builds and then returns a list of all events that match for the
174 date specified. useful for dayView, etc. etc. 175 date specified. useful for dayView, etc. etc.
175 */ 176 */
176 QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false ); 177 QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false );
177 /** 178 /**
178 Get unfiltered events for date \a qdt. 179 Get unfiltered events for date \a qdt.
179 */ 180 */
180 QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); 181 QPtrList<Event> rawEventsForDate( const QDateTime &qdt );
181 /** 182 /**
182 Get unfiltered events in a range of dates. If inclusive is set to true, 183 Get unfiltered events in a range of dates. If inclusive is set to true,
183 only events are returned, which are completely included in the range. 184 only events are returned, which are completely included in the range.
184 */ 185 */
185 QPtrList<Event> rawEvents( const QDate &start, const QDate &end, 186 QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
186 bool inclusive = false ); 187 bool inclusive = false );
187 Todo *todo( QString, QString ); 188 Todo *todo( QString, QString );
188 Event *event( QString, QString ); 189 Event *event( QString, QString );
189 void getIncidenceCount( int calId, int& events, int & todos, int & journals); 190 void getIncidenceCount( int calId, int& events, int & todos, int & journals);
190 191
191public slots: 192public slots:
192 void setCalendarEnabled( int id, bool enable ); 193 void setCalendarEnabled( int id, bool enable );
193 void setAlarmEnabled( int id, bool enable ); 194 void setAlarmEnabled( int id, bool enable );
194 void setReadOnly( int id, bool enable ); 195 void setReadOnly( int id, bool enable );
195 void setDefaultCalendarEnabledOnly(); 196 void setDefaultCalendarEnabledOnly();
196 void setCalendarRemove( int id ); 197 void setCalendarRemove( int id );
197 void setAllCalendarEnabled( bool enable ); 198 void setAllCalendarEnabled( bool enable );
198 199
199 protected: 200 protected:
200 201
201 // Event* mNextAlarmEvent; 202 // Event* mNextAlarmEvent;
202 QString mNextSummary; 203 QString mNextSummary;
203 QString mNextAlarmEventDateTimeString; 204 QString mNextAlarmEventDateTimeString;
204 QString mLastAlarmNotificationString; 205 QString mLastAlarmNotificationString;
205 QDateTime mNextAlarmEventDateTime; 206 QDateTime mNextAlarmEventDateTime;
206 QDateTime mNextAlarmDateTime; 207 QDateTime mNextAlarmDateTime;
207 void reInitAlarmSettings(); 208 void reInitAlarmSettings();
208 209
209 /** Notification function of IncidenceBase::Observer. */ 210 /** Notification function of IncidenceBase::Observer. */
210 void incidenceUpdated( IncidenceBase *i ) { update( i ); } 211 void incidenceUpdated( IncidenceBase *i ) { update( i ); }
211 212
212 /** inserts an event into its "proper place" in the calendar. */ 213 /** inserts an event into its "proper place" in the calendar. */
213 void insertEvent( Event *event ); 214 void insertEvent( Event *event );
214 215
215 /** Append alarms of incidence in interval to list of alarms. */ 216 /** Append alarms of incidence in interval to list of alarms. */
216 void appendAlarms( Alarm::List &alarms, Incidence *incidence, 217 void appendAlarms( Alarm::List &alarms, Incidence *incidence,
217 const QDateTime &from, const QDateTime &to ); 218 const QDateTime &from, const QDateTime &to );
218 219
219 /** Append alarms of recurring events in interval to list of alarms. */ 220 /** Append alarms of recurring events in interval to list of alarms. */
220 void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence, 221 void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence,
221 const QDateTime &from, const QDateTime &to ); 222 const QDateTime &from, const QDateTime &to );
222 223
223 private: 224 private:
224 void init(); 225 void init();
225 226
226 QPtrList<Event> mEventList; 227 QPtrList<Event> mEventList;
227 QPtrList<Todo> mTodoList; 228 QPtrList<Todo> mTodoList;
228 QPtrList<Journal> mJournalList; 229 QPtrList<Journal> mJournalList;
229}; 230};
230 231
231} 232}
232 233
233#endif 234#endif