1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
|
/*
This file is part of libkcal.
Copyright (c) 2003 Cornelius Schumacher <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/*
@file calendarnull.h
A null calendar class with does nothing.
@author Cornelius Schumacher
*/
#ifndef KCAL_CALENDARNULL_H
#define KCAL_CALENDARNULL_H
#include "calendar.h"
#include "libkcal_export.h"
class KConfig;
/**
@namespace KCal
Namespace KCal is for global classes, objects and/or functions in libkcal.
*/
namespace KCal {
/**
@class CalendarNull
This is a null calendar class which does nothing. It can be passed to
functions which need a calendar object when there actually isn't a real
calendar yet. CalendarNull can be used to implement the null object
design pattern. Instead of passing a 0 pointer and checking for 0 with
each access a CalendarNull object can be passed.
*/
class LIBKCAL_EXPORT CalendarNull : public Calendar
{
public:
/**
Constructor.
*/
CalendarNull( const TQString &timeZoneId );
/**
Destructor.
*/
~CalendarNull() {}
/**
Returns a pointer to a CalendarNull object, which is constructed
if necessary.
*/
static CalendarNull *self();
/**
Clears out the current Calendar, freeing all used memory etc.
*/
void close() {}
/**
Sync changes in memory to persistant storage.
*/
void save() {}
bool reload( const TQString & ) { return true;}
// Event Specific Methods //
/**
Insert an Evenet into the Calendar.
First parameter is a pointer to the Event to insert.
Returns false.
*/
bool addEvent( Event * /*event*/ )
{ return false; }
/**
Remove an Event from the Calendar.
First parameter is a pointer to the Event to remove.
Returns false.
*/
bool deleteEvent( Event * /*event*/ )
{ return false; }
/**
Return a sorted, unfiltered list of all Events for this Calendar.
First parameter specifies the EventSortField.\n
Second parameter specifies the SortDirection.
Returns an empty Event List.
*/
Event::List rawEvents( EventSortField /*sortField*/,
SortDirection /*sortDirection*/ )
{ return Event::List(); }
/**
Return an unfiltered list of all Events occurring within a date range.
First parameter is the starting date.\n
Second parameter is the ending date.\n
Third parameter, if true, specifies that only Events which are
completely included within the date range are returned.
Returns an empty Event List.
*/
Event::List rawEvents( const TQDate & /*start*/, const TQDate & /*end*/,
bool /*inclusive*/ )
{ return Event::List(); }
/**
Return an unfiltered list of all Events which occur on the given
timestamp.
First parameter is a TQDateTime to return unfiltered events for.
Returns an empty Event List.
*/
Event::List rawEventsForDate( const TQDateTime & /*qdt*/ )
{ return Event::List(); }
/**
Return a sorted, unfiltered list of all Events which occur on the given
date. The Events are sorted according to @a sortField and
@a sortDirection.
First parameter is a TQDate to return unfiltered Events for.\n
Second parameter specifies the EventSortField.\n
Third parameter specifies the SortDirection.
Returns an empty Event List.
*/
Event::List rawEventsForDate(
const TQDate & /*date*/,
EventSortField /*sortField=EventSortUnsorted*/,
SortDirection /*sortDirection=SortDirectionAscending*/ )
{ return Event::List(); }
/**
Returns the Event associated with the given unique identifier.
First parameter is a unique identifier string.
Return a null Event pointer.
*/
Event *event( const TQString & /*uid*/ )
{ return 0; }
// Todo Specific Methods //
/**
Insert a Todo into the Calendar.
First parameter is a pointer to the Todo to insert.
Returns false.
*/
bool addTodo( Todo * /*todo*/ )
{ return false; }
/**
Remove a Todo from the Calendar.
First parameter is a pointer to the Todo to remove.
Returns false.
*/
bool deleteTodo( Todo * /*todo*/ )
{ return false; }
/**
Return a sorted, unfiltered list of all Todos for this Calendar.
First parameter specifies the TodoSortField.\n
Second parameter specifies the SortDirection.
Returns an empty Todo List.
*/
Todo::List rawTodos( TodoSortField /*sortField*/,
SortDirection /*sortDirection*/ )
{ return Todo::List(); }
/**
Return an unfiltered list of all Todos for this Calendar which
are due on the specifed date.
First parameter is the due date to return unfiltered Todos for.
Returns an empty Todo List.
*/
Todo::List rawTodosForDate( const TQDate & /*date*/ )
{ return Todo::List(); }
/**
Returns the Todo associated with the given unique identifier.
First parameter is a unique identifier string.
Returns a null Todo pointer.
*/
Todo *todo( const TQString & /*uid*/ )
{ return 0; }
// Journal Specific Methods //
/**
Insert a Journal into the Calendar.
First parameter is a pointer to the Journal to insert.
Returns false.
*/
bool addJournal( Journal * /*journal*/ )
{ return false; }
/**
Remove a Journal from the Calendar.
First parameter is a pointer to the Journal to remove.
Returns false.
*/
bool deleteJournal( Journal * /*journal*/ )
{ return false; }
/**
Return a sorted, filtered list of all Journals for this Calendar.
First parameter specifies the JournalSortField.\n
Second parameterd specifies the SortDirection.
Returns an empty Journal List.
*/
Journal::List rawJournals( JournalSortField /*sortField*/,
SortDirection /*sortDirection*/ )
{ return Journal::List(); }
/**
Return an unfiltered list of all Journals for on the specifed date.
First parameter specifies the data to return the unfiltered Journals for.
Returns an empty Journal List.
*/
Journal::List rawJournalsForDate( const TQDate & /*date*/ )
{ return Journal::List(); }
/**
Returns the Journal associated with the given unique identifier.
First parameter is a unique identifier string.
Returns an null Journal pointer.
*/
Journal *journal( const TQString & /*uid*/ )
{ return 0; }
// Alarm Specific Methods //
/**
Return a list of Alarms within a time range for this Calendar.
First parameter is the starting timestamp.\n
Second parameter is the ending timestamp.
Returns an empty Alarm List.
*/
Alarm::List alarms( const TQDateTime & /*from*/, const TQDateTime & /*to*/ )
{ return Alarm::List(); }
// Observer Specific Methods //
/**
The Observer interface. So far not implemented.
First parameter is a pointer an IncidenceBase object.
*/
void incidenceUpdated( IncidenceBase * /*incidenceBase*/ ) {}
void setTimeZoneIdViewOnly( const TQString& ) {};
private:
static CalendarNull *mSelf;
class Private;
Private *d;
};
}
#endif
|