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