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