libkcal

calendarnull.h
1 /*
2  This file is part of libkcal.
3 
4  Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 /*
22  @file calendarnull.h
23  A null calendar class with does nothing.
24 
25  @author Cornelius Schumacher
26 */
27 #ifndef KCAL_CALENDARNULL_H
28 #define KCAL_CALENDARNULL_H
29 
30 #include "calendar.h"
31 #include "libkcal_export.h"
32 
33 class TDEConfig;
34 
39 namespace KCal {
40 
50 class LIBKCAL_EXPORT CalendarNull : public Calendar
51 {
52  public:
56  CalendarNull( const TQString &timeZoneId );
57 
62 
67  static CalendarNull *self();
68 
72  void close() {}
73 
77  void closeEvents() {}
78 
82  void closeTodos() {}
83 
87  void closeJournals() {}
88 
92  void save() {}
93 
94  bool reload( const TQString & ) { return true;}
95 
96 // Event Specific Methods //
97 
105  bool addEvent( Event * /*event*/ )
106  { return false; }
107 
115  bool deleteEvent( Event * /*event*/ )
116  { return false; }
117 
127  SortDirection /*sortDirection*/ )
128  { return Event::List(); }
129 
140  Event::List rawEvents( const TQDate & /*start*/, const TQDate & /*end*/,
141  bool /*inclusive*/ )
142  { return Event::List(); }
143 
152  Event::List rawEventsForDate( const TQDateTime & /*qdt*/ )
153  { return Event::List(); }
154 
167  const TQDate & /*date*/,
168  EventSortField /*sortField=EventSortUnsorted*/,
169  SortDirection /*sortDirection=SortDirectionAscending*/ )
170  { return Event::List(); }
171 
179  Event *event( const TQString & /*uid*/ )
180  { return 0; }
181 
182 // Todo Specific Methods //
183 
191  bool addTodo( Todo * /*todo*/ )
192  { return false; }
193 
201  bool deleteTodo( Todo * /*todo*/ )
202  { return false; }
203 
213  SortDirection /*sortDirection*/ )
214  { return Todo::List(); }
215 
224  Todo::List rawTodosForDate( const TQDate & /*date*/ )
225  { return Todo::List(); }
226 
234  Todo *todo( const TQString & /*uid*/ )
235  { return 0; }
236 
237 // Journal Specific Methods //
238 
246  bool addJournal( Journal * /*journal*/ )
247  { return false; }
248 
256  bool deleteJournal( Journal * /*journal*/ )
257  { return false; }
258 
268  SortDirection /*sortDirection*/ )
269  { return Journal::List(); }
270 
278  Journal::List rawJournalsForDate( const TQDate & /*date*/ )
279  { return Journal::List(); }
280 
288  Journal *journal( const TQString & /*uid*/ )
289  { return 0; }
290 
291 // Alarm Specific Methods //
292 
302  Alarm::List alarms( const TQDateTime & /*from*/, const TQDateTime & /*to*/ )
303  { return Alarm::List(); }
304 
305 // Observer Specific Methods //
306 
311  void incidenceUpdated( IncidenceBase * /*incidenceBase*/ ) {}
312 
313  void setTimeZoneIdViewOnly( const TQString& ) {};
314 
315  private:
316  static CalendarNull *mSelf;
317 
318  class Private;
319  Private *d;
320 };
321 
322 }
323 
324 #endif
Provides the main "calendar" object class.
This is a null calendar class which does nothing.
Definition: calendarnull.h:51
bool deleteTodo(Todo *)
Remove a Todo from the Calendar.
Definition: calendarnull.h:201
Todo::List rawTodosForDate(const TQDate &)
Return an unfiltered list of all Todos for this Calendar which are due on the specifed date.
Definition: calendarnull.h:224
Todo * todo(const TQString &)
Returns the Todo associated with the given unique identifier.
Definition: calendarnull.h:234
bool reload(const TQString &)
Load the calendar contents from storage.
Definition: calendarnull.h:94
Journal::List rawJournals(JournalSortField, SortDirection)
Return a sorted, filtered list of all Journals for this Calendar.
Definition: calendarnull.h:267
Journal::List rawJournalsForDate(const TQDate &)
Return an unfiltered list of all Journals for on the specifed date.
Definition: calendarnull.h:278
Event::List rawEventsForDate(const TQDate &, EventSortField, SortDirection)
Return a sorted, unfiltered list of all Events which occur on the given date.
Definition: calendarnull.h:166
Journal * journal(const TQString &)
Returns the Journal associated with the given unique identifier.
Definition: calendarnull.h:288
void setTimeZoneIdViewOnly(const TQString &)
Set the timezone used for viewing the incidences in this calendar.
Definition: calendarnull.h:313
~CalendarNull()
Destructor.
Definition: calendarnull.h:61
void save()
Sync changes in memory to persistant storage.
Definition: calendarnull.h:92
void closeEvents()
Clears out the current Calendar, freeing all used memory etc.
Definition: calendarnull.h:77
bool addTodo(Todo *)
Insert a Todo into the Calendar.
Definition: calendarnull.h:191
bool addEvent(Event *)
Insert an Evenet into the Calendar.
Definition: calendarnull.h:105
Event::List rawEventsForDate(const TQDateTime &)
Return an unfiltered list of all Events which occur on the given timestamp.
Definition: calendarnull.h:152
Event * event(const TQString &)
Returns the Event associated with the given unique identifier.
Definition: calendarnull.h:179
bool addJournal(Journal *)
Insert a Journal into the Calendar.
Definition: calendarnull.h:246
bool deleteEvent(Event *)
Remove an Event from the Calendar.
Definition: calendarnull.h:115
void incidenceUpdated(IncidenceBase *)
The Observer interface.
Definition: calendarnull.h:311
void closeJournals()
Clears out the current Calendar, freeing all used memory etc.
Definition: calendarnull.h:87
Event::List rawEvents(EventSortField, SortDirection)
Return a sorted, unfiltered list of all Events for this Calendar.
Definition: calendarnull.h:126
bool deleteJournal(Journal *)
Remove a Journal from the Calendar.
Definition: calendarnull.h:256
void close()
Clears out the current Calendar, freeing all used memory etc.
Definition: calendarnull.h:72
Todo::List rawTodos(TodoSortField, SortDirection)
Return a sorted, unfiltered list of all Todos for this Calendar.
Definition: calendarnull.h:212
Event::List rawEvents(const TQDate &, const TQDate &, bool)
Return an unfiltered list of all Events occurring within a date range.
Definition: calendarnull.h:140
Alarm::List alarms(const TQDateTime &, const TQDateTime &)
Return a list of Alarms within a time range for this Calendar.
Definition: calendarnull.h:302
void closeTodos()
Clears out the current Calendar, freeing all used memory etc.
Definition: calendarnull.h:82
This is the main "calendar" object class.
Definition: calendar.h:171
This class provides an Event in the sense of RFC2445.
Definition: event.h:33
This class provides the base class common to all calendar components.
Definition: incidencebase.h:46
This class provides a Journal in the sense of RFC2445.
Definition: journal.h:34
This class provides a Todo in the sense of RFC2445.
Definition: todo.h:32
Namespace KCal is for global classes, objects and/or functions in libkcal.
Definition: alarm.h:38
TodoSortField
How Todos are to be sorted.
Definition: calendar.h:91
JournalSortField
How Journals are to be sorted.
Definition: calendar.h:111
EventSortField
How Events are to be sorted.
Definition: calendar.h:75
SortDirection
Sort direction.
Definition: calendar.h:63