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