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