summaryrefslogtreecommitdiffabout
path: root/libkcal
Unidiff
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendar.cpp3
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp75
-rw-r--r--libkcal/calendarlocal.h3
4 files changed, 81 insertions, 1 deletions
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index a662eeb..b7990d4 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -235,254 +235,255 @@ const QString &Calendar::getEmail()
235{ 235{
236 return mOwnerEmail; 236 return mOwnerEmail;
237} 237}
238 238
239void Calendar::setEmail(const QString &e) 239void Calendar::setEmail(const QString &e)
240{ 240{
241 mOwnerEmail = e; 241 mOwnerEmail = e;
242 242
243 setModified( true ); 243 setModified( true );
244} 244}
245 245
246void Calendar::setFilter(CalFilter *filter) 246void Calendar::setFilter(CalFilter *filter)
247{ 247{
248 mFilter = filter; 248 mFilter = filter;
249} 249}
250 250
251CalFilter *Calendar::filter() 251CalFilter *Calendar::filter()
252{ 252{
253 return mFilter; 253 return mFilter;
254} 254}
255 255
256QPtrList<Incidence> Calendar::incidences() 256QPtrList<Incidence> Calendar::incidences()
257{ 257{
258 QPtrList<Incidence> incidences; 258 QPtrList<Incidence> incidences;
259 259
260 Incidence *i; 260 Incidence *i;
261 261
262 QPtrList<Event> e = events(); 262 QPtrList<Event> e = events();
263 for( i = e.first(); i; i = e.next() ) incidences.append( i ); 263 for( i = e.first(); i; i = e.next() ) incidences.append( i );
264 264
265 QPtrList<Todo> t = todos(); 265 QPtrList<Todo> t = todos();
266 for( i = t.first(); i; i = t.next() ) incidences.append( i ); 266 for( i = t.first(); i; i = t.next() ) incidences.append( i );
267 267
268 QPtrList<Journal> j = journals(); 268 QPtrList<Journal> j = journals();
269 for( i = j.first(); i; i = j.next() ) incidences.append( i ); 269 for( i = j.first(); i; i = j.next() ) incidences.append( i );
270 270
271 return incidences; 271 return incidences;
272} 272}
273 273
274void Calendar::resetPilotStat(int id ) 274void Calendar::resetPilotStat(int id )
275{ 275{
276 QPtrList<Incidence> incidences; 276 QPtrList<Incidence> incidences;
277 277
278 Incidence *i; 278 Incidence *i;
279 279
280 QPtrList<Event> e = rawEvents(); 280 QPtrList<Event> e = rawEvents();
281 for( i = e.first(); i; i = e.next() ) i->setPilotId( id ); 281 for( i = e.first(); i; i = e.next() ) i->setPilotId( id );
282 282
283 QPtrList<Todo> t = rawTodos(); 283 QPtrList<Todo> t = rawTodos();
284 for( i = t.first(); i; i = t.next() ) i->setPilotId( id ); 284 for( i = t.first(); i; i = t.next() ) i->setPilotId( id );
285 285
286 QPtrList<Journal> j = journals(); 286 QPtrList<Journal> j = journals();
287 for( i = j.first(); i; i = j.next() ) i->setPilotId( id ); 287 for( i = j.first(); i; i = j.next() ) i->setPilotId( id );
288} 288}
289void Calendar::resetTempSyncStat() 289void Calendar::resetTempSyncStat()
290{ 290{
291 QPtrList<Incidence> incidences; 291 QPtrList<Incidence> incidences;
292 292
293 Incidence *i; 293 Incidence *i;
294 294
295 QPtrList<Event> e = rawEvents(); 295 QPtrList<Event> e = rawEvents();
296 for( i = e.first(); i; i = e.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 296 for( i = e.first(); i; i = e.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
297 297
298 QPtrList<Todo> t = rawTodos(); 298 QPtrList<Todo> t = rawTodos();
299 for( i = t.first(); i; i = t.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 299 for( i = t.first(); i; i = t.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
300 300
301 QPtrList<Journal> j = journals(); 301 QPtrList<Journal> j = journals();
302 for( i = j.first(); i; i = j.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 302 for( i = j.first(); i; i = j.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
303} 303}
304QPtrList<Incidence> Calendar::rawIncidences() 304QPtrList<Incidence> Calendar::rawIncidences()
305{ 305{
306 QPtrList<Incidence> incidences; 306 QPtrList<Incidence> incidences;
307 307
308 Incidence *i; 308 Incidence *i;
309 309
310 QPtrList<Event> e = rawEvents(); 310 QPtrList<Event> e = rawEvents();
311 for( i = e.first(); i; i = e.next() ) incidences.append( i ); 311 for( i = e.first(); i; i = e.next() ) incidences.append( i );
312 312
313 QPtrList<Todo> t = rawTodos(); 313 QPtrList<Todo> t = rawTodos();
314 for( i = t.first(); i; i = t.next() ) incidences.append( i ); 314 for( i = t.first(); i; i = t.next() ) incidences.append( i );
315 315
316 QPtrList<Journal> j = journals(); 316 QPtrList<Journal> j = journals();
317 for( i = j.first(); i; i = j.next() ) incidences.append( i ); 317 for( i = j.first(); i; i = j.next() ) incidences.append( i );
318 318
319 return incidences; 319 return incidences;
320} 320}
321 321
322QPtrList<Event> Calendar::events( const QDate &date, bool sorted ) 322QPtrList<Event> Calendar::events( const QDate &date, bool sorted )
323{ 323{
324 QPtrList<Event> el = rawEventsForDate(date,sorted); 324 QPtrList<Event> el = rawEventsForDate(date,sorted);
325 mFilter->apply(&el); 325 mFilter->apply(&el);
326 return el; 326 return el;
327} 327}
328 328
329QPtrList<Event> Calendar::events( const QDateTime &qdt ) 329QPtrList<Event> Calendar::events( const QDateTime &qdt )
330{ 330{
331 QPtrList<Event> el = rawEventsForDate(qdt); 331 QPtrList<Event> el = rawEventsForDate(qdt);
332 mFilter->apply(&el); 332 mFilter->apply(&el);
333 return el; 333 return el;
334} 334}
335 335
336QPtrList<Event> Calendar::events( const QDate &start, const QDate &end, 336QPtrList<Event> Calendar::events( const QDate &start, const QDate &end,
337 bool inclusive) 337 bool inclusive)
338{ 338{
339 QPtrList<Event> el = rawEvents(start,end,inclusive); 339 QPtrList<Event> el = rawEvents(start,end,inclusive);
340 mFilter->apply(&el); 340 mFilter->apply(&el);
341 return el; 341 return el;
342} 342}
343 343
344QPtrList<Event> Calendar::events() 344QPtrList<Event> Calendar::events()
345{ 345{
346 QPtrList<Event> el = rawEvents(); 346 QPtrList<Event> el = rawEvents();
347 mFilter->apply(&el); 347 mFilter->apply(&el);
348 return el; 348 return el;
349} 349}
350void Calendar::addIncidenceBranch(Incidence *i) 350void Calendar::addIncidenceBranch(Incidence *i)
351{ 351{
352 addIncidence( i ); 352 addIncidence( i );
353 Incidence * inc; 353 Incidence * inc;
354 QPtrList<Incidence> Relations = i->relations(); 354 QPtrList<Incidence> Relations = i->relations();
355 for (inc=Relations.first();inc;inc=Relations.next()) { 355 for (inc=Relations.first();inc;inc=Relations.next()) {
356 addIncidenceBranch( inc ); 356 addIncidenceBranch( inc );
357 } 357 }
358} 358}
359 359
360bool Calendar::addIncidence(Incidence *i) 360bool Calendar::addIncidence(Incidence *i)
361{ 361{
362 Incidence::AddVisitor<Calendar> v(this); 362 Incidence::AddVisitor<Calendar> v(this);
363 i->setCalID( mDefaultCalendar ); 363 if ( i->calID() == 0 )
364 i->setCalID( mDefaultCalendar );
364 i->setCalEnabled( true ); 365 i->setCalEnabled( true );
365 return i->accept(v); 366 return i->accept(v);
366} 367}
367void Calendar::deleteIncidence(Incidence *in) 368void Calendar::deleteIncidence(Incidence *in)
368{ 369{
369 if ( in->typeID() == eventID ) 370 if ( in->typeID() == eventID )
370 deleteEvent( (Event*) in ); 371 deleteEvent( (Event*) in );
371 else if ( in->typeID() == todoID ) 372 else if ( in->typeID() == todoID )
372 deleteTodo( (Todo*) in); 373 deleteTodo( (Todo*) in);
373 else if ( in->typeID() == journalID ) 374 else if ( in->typeID() == journalID )
374 deleteJournal( (Journal*) in ); 375 deleteJournal( (Journal*) in );
375} 376}
376 377
377Incidence* Calendar::incidence( const QString& uid ) 378Incidence* Calendar::incidence( const QString& uid )
378{ 379{
379 Incidence* i; 380 Incidence* i;
380 381
381 if( (i = todo( uid )) != 0 ) 382 if( (i = todo( uid )) != 0 )
382 return i; 383 return i;
383 if( (i = event( uid )) != 0 ) 384 if( (i = event( uid )) != 0 )
384 return i; 385 return i;
385 if( (i = journal( uid )) != 0 ) 386 if( (i = journal( uid )) != 0 )
386 return i; 387 return i;
387 388
388 return 0; 389 return 0;
389} 390}
390 391
391QPtrList<Todo> Calendar::todos() 392QPtrList<Todo> Calendar::todos()
392{ 393{
393 QPtrList<Todo> tl = rawTodos(); 394 QPtrList<Todo> tl = rawTodos();
394 mFilter->apply( &tl ); 395 mFilter->apply( &tl );
395 return tl; 396 return tl;
396} 397}
397 398
398// When this is called, the todo have already been added to the calendar. 399// When this is called, the todo have already been added to the calendar.
399// This method is only about linking related todos 400// This method is only about linking related todos
400void Calendar::setupRelations( Incidence *incidence ) 401void Calendar::setupRelations( Incidence *incidence )
401{ 402{
402 QString uid = incidence->uid(); 403 QString uid = incidence->uid();
403 //qDebug("Calendar::setupRelations "); 404 //qDebug("Calendar::setupRelations ");
404 // First, go over the list of orphans and see if this is their parent 405 // First, go over the list of orphans and see if this is their parent
405 while( Incidence* i = mOrphans[ uid ] ) { 406 while( Incidence* i = mOrphans[ uid ] ) {
406 mOrphans.remove( uid ); 407 mOrphans.remove( uid );
407 i->setRelatedTo( incidence ); 408 i->setRelatedTo( incidence );
408 incidence->addRelation( i ); 409 incidence->addRelation( i );
409 mOrphanUids.remove( i->uid() ); 410 mOrphanUids.remove( i->uid() );
410 } 411 }
411 412
412 // Now see about this incidences parent 413 // Now see about this incidences parent
413 if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) { 414 if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) {
414 // This incidence has a uid it is related to, but is not registered to it yet 415 // This incidence has a uid it is related to, but is not registered to it yet
415 // Try to find it 416 // Try to find it
416 Incidence* parent = this->incidence( incidence->relatedToUid() ); 417 Incidence* parent = this->incidence( incidence->relatedToUid() );
417 if( parent ) { 418 if( parent ) {
418 // Found it 419 // Found it
419 incidence->setRelatedTo( parent ); 420 incidence->setRelatedTo( parent );
420 parent->addRelation( incidence ); 421 parent->addRelation( incidence );
421 } else { 422 } else {
422 // Not found, put this in the mOrphans list 423 // Not found, put this in the mOrphans list
423 mOrphans.insert( incidence->relatedToUid(), incidence ); 424 mOrphans.insert( incidence->relatedToUid(), incidence );
424 mOrphanUids.insert( incidence->uid(), incidence ); 425 mOrphanUids.insert( incidence->uid(), incidence );
425 } 426 }
426 } 427 }
427} 428}
428 429
429// If a task with subtasks is deleted, move it's subtasks to the orphans list 430// If a task with subtasks is deleted, move it's subtasks to the orphans list
430void Calendar::removeRelations( Incidence *incidence ) 431void Calendar::removeRelations( Incidence *incidence )
431{ 432{
432 // qDebug("Calendar::removeRelations "); 433 // qDebug("Calendar::removeRelations ");
433 QString uid = incidence->uid(); 434 QString uid = incidence->uid();
434 435
435 QPtrList<Incidence> relations = incidence->relations(); 436 QPtrList<Incidence> relations = incidence->relations();
436 for( Incidence* i = relations.first(); i; i = relations.next() ) 437 for( Incidence* i = relations.first(); i; i = relations.next() )
437 if( !mOrphanUids.find( i->uid() ) ) { 438 if( !mOrphanUids.find( i->uid() ) ) {
438 mOrphans.insert( uid, i ); 439 mOrphans.insert( uid, i );
439 mOrphanUids.insert( i->uid(), i ); 440 mOrphanUids.insert( i->uid(), i );
440 i->setRelatedTo( 0 ); 441 i->setRelatedTo( 0 );
441 i->setRelatedToUid( uid ); 442 i->setRelatedToUid( uid );
442 } 443 }
443 444
444 // If this incidence is related to something else, tell that about it 445 // If this incidence is related to something else, tell that about it
445 if( incidence->relatedTo() ) 446 if( incidence->relatedTo() )
446 incidence->relatedTo()->removeRelation( incidence ); 447 incidence->relatedTo()->removeRelation( incidence );
447 448
448 // Remove this one from the orphans list 449 // Remove this one from the orphans list
449 if( mOrphanUids.remove( uid ) ) 450 if( mOrphanUids.remove( uid ) )
450 // This incidence is located in the orphans list - it should be removed 451 // This incidence is located in the orphans list - it should be removed
451 if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) { 452 if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) {
452 // Removing wasn't that easy 453 // Removing wasn't that easy
453 for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) { 454 for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) {
454 if( it.current()->uid() == uid ) { 455 if( it.current()->uid() == uid ) {
455 mOrphans.remove( it.currentKey() ); 456 mOrphans.remove( it.currentKey() );
456 break; 457 break;
457 } 458 }
458 } 459 }
459 } 460 }
460} 461}
461 462
462void Calendar::registerObserver( Observer *observer ) 463void Calendar::registerObserver( Observer *observer )
463{ 464{
464 mObserver = observer; 465 mObserver = observer;
465 mNewObserver = true; 466 mNewObserver = true;
466} 467}
467 468
468void Calendar::setModified( bool modified ) 469void Calendar::setModified( bool modified )
469{ 470{
470 if ( mObserver ) mObserver->calendarModified( modified, this ); 471 if ( mObserver ) mObserver->calendarModified( modified, this );
471 if ( modified != mModified || mNewObserver ) { 472 if ( modified != mModified || mNewObserver ) {
472 mNewObserver = false; 473 mNewObserver = false;
473 // if ( mObserver ) mObserver->calendarModified( modified, this ); 474 // if ( mObserver ) mObserver->calendarModified( modified, this );
474 mModified = modified; 475 mModified = modified;
475 } 476 }
476} 477}
477 478
478void Calendar::setLoadedProductId( const QString &id ) 479void Calendar::setLoadedProductId( const QString &id )
479{ 480{
480 mLoadedProductId = id; 481 mLoadedProductId = id;
481} 482}
482 483
483QString Calendar::loadedProductId() 484QString Calendar::loadedProductId()
484{ 485{
485 return mLoadedProductId; 486 return mLoadedProductId;
486} 487}
487 488
488//#include "calendar.moc" 489//#include "calendar.moc"
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 4652fe5..14a1a45 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -1,206 +1,207 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 1998 Preston Brown 3 Copyright (c) 1998 Preston Brown
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 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 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#ifndef CALENDAR_H 22#ifndef CALENDAR_H
23#define CALENDAR_H 23#define CALENDAR_H
24 24
25#include <qobject.h> 25#include <qobject.h>
26#include <qstring.h> 26#include <qstring.h>
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qptrlist.h> 28#include <qptrlist.h>
29#include <qdict.h> 29#include <qdict.h>
30 30
31#include "customproperties.h" 31#include "customproperties.h"
32#include "event.h" 32#include "event.h"
33#include "todo.h" 33#include "todo.h"
34#include "journal.h" 34#include "journal.h"
35#include "calfilter.h" 35#include "calfilter.h"
36 36
37//#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */ 37//#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */
38 38
39class KConfig; 39class KConfig;
40 40
41namespace KCal { 41namespace KCal {
42 42
43 43
44/** 44/**
45 This is the main "calendar" object class for KOrganizer. It holds 45 This is the main "calendar" object class for KOrganizer. It holds
46 information like all appointments/events, user information, etc. etc. 46 information like all appointments/events, user information, etc. etc.
47 one calendar is associated with each CalendarView (@see calendarview.h). 47 one calendar is associated with each CalendarView (@see calendarview.h).
48 This is an abstract base class defining the interface to a calendar. It is 48 This is an abstract base class defining the interface to a calendar. It is
49 implemented by subclasses like @see CalendarLocal, which use different 49 implemented by subclasses like @see CalendarLocal, which use different
50 methods to store and access the data. 50 methods to store and access the data.
51 51
52 Ownership of events etc. is handled by the following policy: As soon as an 52 Ownership of events etc. is handled by the following policy: As soon as an
53 event (or any other subclass of IncidenceBase) object is added to the 53 event (or any other subclass of IncidenceBase) object is added to the
54 Calendar by addEvent() it is owned by the Calendar object. The Calendar takes 54 Calendar by addEvent() it is owned by the Calendar object. The Calendar takes
55 care of deleting it. All Events returned by the query functions are returned 55 care of deleting it. All Events returned by the query functions are returned
56 as pointers, that means all changes to the returned events are immediately 56 as pointers, that means all changes to the returned events are immediately
57 visible in the Calendar. You shouldn't delete any Event object you get from 57 visible in the Calendar. You shouldn't delete any Event object you get from
58 Calendar. 58 Calendar.
59*/ 59*/
60class Calendar : public QObject, public CustomProperties, 60class Calendar : public QObject, public CustomProperties,
61 public IncidenceBase::Observer 61 public IncidenceBase::Observer
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64public: 64public:
65 Calendar(); 65 Calendar();
66 Calendar(const QString &timeZoneId); 66 Calendar(const QString &timeZoneId);
67 virtual ~Calendar(); 67 virtual ~Calendar();
68 Incidence * undoIncidence() { return mUndoIncidence; }; 68 Incidence * undoIncidence() { return mUndoIncidence; };
69 bool undoDeleteIncidence(); 69 bool undoDeleteIncidence();
70 void deleteIncidence(Incidence *in); 70 void deleteIncidence(Incidence *in);
71 void resetTempSyncStat(); 71 void resetTempSyncStat();
72 void resetPilotStat(int id); 72 void resetPilotStat(int id);
73 /** 73 /**
74 Clears out the current calendar, freeing all used memory etc. 74 Clears out the current calendar, freeing all used memory etc.
75 */ 75 */
76 virtual void close() = 0; 76 virtual void close() = 0;
77 virtual void addCalendar( Calendar* ) = 0; 77 virtual void addCalendar( Calendar* ) = 0;
78 virtual bool addCalendarFile( QString name, int id ) = 0; 78 virtual bool addCalendarFile( QString name, int id ) = 0;
79 virtual bool mergeCalendarFile( QString name ) = 0;
79 virtual void setSyncEventsReadOnly() = 0; 80 virtual void setSyncEventsReadOnly() = 0;
80 virtual void stopAllTodos() = 0; 81 virtual void stopAllTodos() = 0;
81 82
82 /** 83 /**
83 Sync changes in memory to persistant storage. 84 Sync changes in memory to persistant storage.
84 */ 85 */
85 virtual void save() = 0; 86 virtual void save() = 0;
86 virtual QPtrList<Event> getExternLastSyncEvents() = 0; 87 virtual QPtrList<Event> getExternLastSyncEvents() = 0;
87 virtual void removeSyncInfo( QString syncProfile) = 0; 88 virtual void removeSyncInfo( QString syncProfile) = 0;
88 virtual bool isSaving() { return false; } 89 virtual bool isSaving() { return false; }
89 90
90 /** 91 /**
91 Return the owner of the calendar's full name. 92 Return the owner of the calendar's full name.
92 */ 93 */
93 const QString &getOwner() const; 94 const QString &getOwner() const;
94 /** 95 /**
95 Set the owner of the calendar. Should be owner's full name. 96 Set the owner of the calendar. Should be owner's full name.
96 */ 97 */
97 void setOwner( const QString &os ); 98 void setOwner( const QString &os );
98 /** 99 /**
99 Return the email address of the calendar owner. 100 Return the email address of the calendar owner.
100 */ 101 */
101 const QString &getEmail(); 102 const QString &getEmail();
102 /** 103 /**
103 Set the email address of the calendar owner. 104 Set the email address of the calendar owner.
104 */ 105 */
105 void setEmail( const QString & ); 106 void setEmail( const QString & );
106 107
107 /** 108 /**
108 Set time zone from a timezone string (e.g. -2:00) 109 Set time zone from a timezone string (e.g. -2:00)
109 */ 110 */
110 void setTimeZone( const QString &tz ); 111 void setTimeZone( const QString &tz );
111 /** 112 /**
112 Set time zone from a minutes value (e.g. -60) 113 Set time zone from a minutes value (e.g. -60)
113 */ 114 */
114 void setTimeZone( int tz ); 115 void setTimeZone( int tz );
115 /** 116 /**
116 Return time zone as offest in minutes. 117 Return time zone as offest in minutes.
117 */ 118 */
118 int getTimeZone() const; 119 int getTimeZone() const;
119 /** 120 /**
120 Compute an ISO 8601 format string from the time zone. 121 Compute an ISO 8601 format string from the time zone.
121 */ 122 */
122 QString getTimeZoneStr() const; 123 QString getTimeZoneStr() const;
123 /** 124 /**
124 Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal 125 Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal
125 values). 126 values).
126 */ 127 */
127 void setTimeZoneId( const QString & ); 128 void setTimeZoneId( const QString & );
128 /** 129 /**
129 Return time zone id. 130 Return time zone id.
130 */ 131 */
131 QString timeZoneId() const; 132 QString timeZoneId() const;
132 /** 133 /**
133 Use local time, not UTC or a time zone. 134 Use local time, not UTC or a time zone.
134 */ 135 */
135 void setLocalTime(); 136 void setLocalTime();
136 /** 137 /**
137 Return whether local time is being used. 138 Return whether local time is being used.
138 */ 139 */
139 bool isLocalTime() const; 140 bool isLocalTime() const;
140 141
141 /** 142 /**
142 Add an incidence to calendar. 143 Add an incidence to calendar.
143 144
144 @return true on success, false on error. 145 @return true on success, false on error.
145 */ 146 */
146 virtual bool addIncidence( Incidence * ); 147 virtual bool addIncidence( Incidence * );
147 148
148 // Adds an incidence and all relatedto incidences to the cal 149 // Adds an incidence and all relatedto incidences to the cal
149 void addIncidenceBranch( Incidence * ); 150 void addIncidenceBranch( Incidence * );
150 /** 151 /**
151 Return filtered list of all incidences of this calendar. 152 Return filtered list of all incidences of this calendar.
152 */ 153 */
153 virtual QPtrList<Incidence> incidences(); 154 virtual QPtrList<Incidence> incidences();
154 155
155 /** 156 /**
156 Return unfiltered list of all incidences of this calendar. 157 Return unfiltered list of all incidences of this calendar.
157 */ 158 */
158 virtual QPtrList<Incidence> rawIncidences(); 159 virtual QPtrList<Incidence> rawIncidences();
159 160
160 /** 161 /**
161 Adds a Event to this calendar object. 162 Adds a Event to this calendar object.
162 @param anEvent a pointer to the event to add 163 @param anEvent a pointer to the event to add
163 164
164 @return true on success, false on error. 165 @return true on success, false on error.
165 */ 166 */
166 virtual bool addEventNoDup( Event *event ) = 0; 167 virtual bool addEventNoDup( Event *event ) = 0;
167 virtual bool addAnniversaryNoDup( Event *event ) = 0; 168 virtual bool addAnniversaryNoDup( Event *event ) = 0;
168 virtual bool addEvent( Event *anEvent ) = 0; 169 virtual bool addEvent( Event *anEvent ) = 0;
169 /** 170 /**
170 Delete event from calendar. 171 Delete event from calendar.
171 */ 172 */
172 virtual void deleteEvent( Event * ) = 0; 173 virtual void deleteEvent( Event * ) = 0;
173 /** 174 /**
174 Retrieves an event on the basis of the unique string ID. 175 Retrieves an event on the basis of the unique string ID.
175 */ 176 */
176 virtual Event *event( const QString &UniqueStr ) = 0; 177 virtual Event *event( const QString &UniqueStr ) = 0;
177 virtual Event *event( QString, QString ) = 0; 178 virtual Event *event( QString, QString ) = 0;
178 /** 179 /**
179 Builds and then returns a list of all events that match for the 180 Builds and then returns a list of all events that match for the
180 date specified. useful for dayView, etc. etc. 181 date specified. useful for dayView, etc. etc.
181 The calendar filter is applied. 182 The calendar filter is applied.
182 */ 183 */
183 QPtrList<Event> events( const QDate &date, bool sorted = false); 184 QPtrList<Event> events( const QDate &date, bool sorted = false);
184 /** 185 /**
185 Get events, which occur on the given date. 186 Get events, which occur on the given date.
186 The calendar filter is applied. 187 The calendar filter is applied.
187 */ 188 */
188 QPtrList<Event> events( const QDateTime &qdt ); 189 QPtrList<Event> events( const QDateTime &qdt );
189 /** 190 /**
190 Get events in a range of dates. If inclusive is set to true, only events 191 Get events in a range of dates. If inclusive is set to true, only events
191 are returned, which are completely included in the range. 192 are returned, which are completely included in the range.
192 The calendar filter is applied. 193 The calendar filter is applied.
193 */ 194 */
194 QPtrList<Event> events( const QDate &start, const QDate &end, 195 QPtrList<Event> events( const QDate &start, const QDate &end,
195 bool inclusive = false); 196 bool inclusive = false);
196 /** 197 /**
197 Return filtered list of all events in calendar. 198 Return filtered list of all events in calendar.
198 */ 199 */
199 virtual QPtrList<Event> events(); 200 virtual QPtrList<Event> events();
200 /** 201 /**
201 Return unfiltered list of all events in calendar. 202 Return unfiltered list of all events in calendar.
202 */ 203 */
203 virtual QPtrList<Event> rawEvents() = 0; 204 virtual QPtrList<Event> rawEvents() = 0;
204 205
205 /** 206 /**
206 Add a todo to the todolist. 207 Add a todo to the todolist.
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index cce798f..3e42ec0 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -1,198 +1,273 @@
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 22
23#include <qdatetime.h> 23#include <qdatetime.h>
24#include <qstring.h> 24#include <qstring.h>
25#include <qptrlist.h> 25#include <qptrlist.h>
26 26
27#include <kdebug.h> 27#include <kdebug.h>
28#include <kconfig.h> 28#include <kconfig.h>
29#include <kglobal.h> 29#include <kglobal.h>
30#include <klocale.h> 30#include <klocale.h>
31 31
32#include "vcaldrag.h" 32#include "vcaldrag.h"
33#include "vcalformat.h" 33#include "vcalformat.h"
34#include "icalformat.h" 34#include "icalformat.h"
35#include "exceptions.h" 35#include "exceptions.h"
36#include "incidence.h" 36#include "incidence.h"
37#include "journal.h" 37#include "journal.h"
38#include "filestorage.h" 38#include "filestorage.h"
39#include "calfilter.h" 39#include "calfilter.h"
40 40
41#include "calendarlocal.h" 41#include "calendarlocal.h"
42 42
43// #ifndef DESKTOP_VERSION 43// #ifndef DESKTOP_VERSION
44// #include <qtopia/alarmserver.h> 44// #include <qtopia/alarmserver.h>
45// #endif 45// #endif
46using namespace KCal; 46using namespace KCal;
47 47
48CalendarLocal::CalendarLocal() 48CalendarLocal::CalendarLocal()
49 : Calendar() 49 : Calendar()
50{ 50{
51 init(); 51 init();
52} 52}
53 53
54CalendarLocal::CalendarLocal(const QString &timeZoneId) 54CalendarLocal::CalendarLocal(const QString &timeZoneId)
55 : Calendar(timeZoneId) 55 : Calendar(timeZoneId)
56{ 56{
57 init(); 57 init();
58} 58}
59 59
60void CalendarLocal::init() 60void CalendarLocal::init()
61{ 61{
62 mNextAlarmIncidence = 0; 62 mNextAlarmIncidence = 0;
63} 63}
64 64
65 65
66CalendarLocal::~CalendarLocal() 66CalendarLocal::~CalendarLocal()
67{ 67{
68 if ( mDeleteIncidencesOnClose ) 68 if ( mDeleteIncidencesOnClose )
69 close(); 69 close();
70} 70}
71bool CalendarLocal::mergeCalendarFile( QString name )
72{
73 CalendarLocal calendar( timeZoneId() );
74 calendar.setDefaultCalendar( 1 );
75 if ( calendar.load( name ) ) {
76 mergeCalendar( &calendar );
77 return true;
78 }
79 return false;
80}
81
82Incidence* CalendarLocal::incidenceForUid( const QString& uid )
83{
84 Todo *todo;;
85 Incidence *retVal = 0;
86 for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
87 if ( todo->uid() == uid ) {
88 if ( retVal ) {
89 if ( retVal->calID() > todo->calID() ) {
90 retVal = todo;
91 }
92 } else {
93 retVal = todo;
94 }
95 }
96 }
97 if ( retVal ) return retVal;
98 Event *event;
99 for ( event = mEventList.first(); event; event = mEventList.next() ) {
100 if ( event->uid() == uid ) {
101 if ( retVal ) {
102 if ( retVal->calID() > event->calID() ) {
103 retVal = event;
104 }
105 } else {
106 retVal = event;
107 }
108 }
109 }
110 if ( retVal ) return retVal;
111 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
112 if ( it->uid() == uid ) {
113 if ( retVal ) {
114 if ( retVal->calID() > it->calID() ) {
115 retVal = it;
116 }
117 } else {
118 retVal = it;
119 }
120 }
121 return retVal;
122}
123
124bool CalendarLocal::mergeCalendar( Calendar* remote )
125{
126 QPtrList<Incidence> er = remote->rawIncidences();
127 Incidence* inR = er.first();
128 Incidence* inL;
129 while ( inR ) {
130 inL = incidenceForUid( inR->uid() );
131 if ( inL ) {
132 int calID = inL->calID();
133 deleteIncidence( inL );
134 inL = inR->clone();
135 inL->setCalID( calID );
136 addIncidence( inL );
137 } else {
138 inL = inR->clone();
139 inL->setCalID( 0 );// add to default cal
140 addIncidence( inL );
141 }
142 inR = er.next();
143 }
144 return true;
145}
71bool CalendarLocal::addCalendarFile( QString name, int id ) 146bool CalendarLocal::addCalendarFile( QString name, int id )
72{ 147{
73 CalendarLocal calendar( timeZoneId() ); 148 CalendarLocal calendar( timeZoneId() );
74 calendar.setDefaultCalendar( id ); 149 calendar.setDefaultCalendar( id );
75 if ( calendar.load( name ) ) { 150 if ( calendar.load( name ) ) {
76 addCalendar( &calendar ); 151 addCalendar( &calendar );
77 return true; 152 return true;
78 } 153 }
79 return false; 154 return false;
80} 155}
81void CalendarLocal::setSyncEventsReadOnly() 156void CalendarLocal::setSyncEventsReadOnly()
82{ 157{
83 Event * ev; 158 Event * ev;
84 ev = mEventList.first(); 159 ev = mEventList.first();
85 while ( ev ) { 160 while ( ev ) {
86 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 161 if ( ev->uid().left(15) == QString("last-syncEvent-") )
87 ev->setReadOnly( true ); 162 ev->setReadOnly( true );
88 ev = mEventList.next(); 163 ev = mEventList.next();
89 } 164 }
90} 165}
91void CalendarLocal::addCalendar( Calendar* cal ) 166void CalendarLocal::addCalendar( Calendar* cal )
92{ 167{
93 cal->setDontDeleteIncidencesOnClose(); 168 cal->setDontDeleteIncidencesOnClose();
94 { 169 {
95 QPtrList<Event> EventList = cal->rawEvents(); 170 QPtrList<Event> EventList = cal->rawEvents();
96 Event * ev = EventList.first(); 171 Event * ev = EventList.first();
97 while ( ev ) { 172 while ( ev ) {
98 ev->unRegisterObserver( cal ); 173 ev->unRegisterObserver( cal );
99 ev->registerObserver( this ); 174 ev->registerObserver( this );
100 mEventList.append( ev ); 175 mEventList.append( ev );
101 ev = EventList.next(); 176 ev = EventList.next();
102 } 177 }
103 } 178 }
104 { 179 {
105 180
106 QPtrList<Todo> TodoList = cal->rawTodos(); 181 QPtrList<Todo> TodoList = cal->rawTodos();
107 Todo * ev = TodoList.first(); 182 Todo * ev = TodoList.first();
108 while ( ev ) { 183 while ( ev ) {
109 QString rel = ev->relatedToUid(); 184 QString rel = ev->relatedToUid();
110 if ( !rel.isEmpty() ){ 185 if ( !rel.isEmpty() ){
111 ev->setRelatedTo ( 0 ); 186 ev->setRelatedTo ( 0 );
112 ev->setRelatedToUid( rel ); 187 ev->setRelatedToUid( rel );
113 } 188 }
114 ev = TodoList.next(); 189 ev = TodoList.next();
115 } 190 }
116 //TodoList = cal->rawTodos(); 191 //TodoList = cal->rawTodos();
117 ev = TodoList.first(); 192 ev = TodoList.first();
118 while ( ev ) { 193 while ( ev ) {
119 ev->unRegisterObserver( cal ); 194 ev->unRegisterObserver( cal );
120 ev->registerObserver( this ); 195 ev->registerObserver( this );
121 mTodoList.append( ev ); 196 mTodoList.append( ev );
122 setupRelations( ev ); 197 setupRelations( ev );
123 ev = TodoList.next(); 198 ev = TodoList.next();
124 } 199 }
125 } 200 }
126 { 201 {
127 QPtrList<Journal> JournalList = cal->journals(); 202 QPtrList<Journal> JournalList = cal->journals();
128 Journal * ev = JournalList.first(); 203 Journal * ev = JournalList.first();
129 while ( ev ) { 204 while ( ev ) {
130 ev->unRegisterObserver( cal ); 205 ev->unRegisterObserver( cal );
131 ev->registerObserver( this ); 206 ev->registerObserver( this );
132 mJournalList.append( ev ); 207 mJournalList.append( ev );
133 ev = JournalList.next(); 208 ev = JournalList.next();
134 } 209 }
135 } 210 }
136 setModified( true ); 211 setModified( true );
137} 212}
138bool CalendarLocal::load( const QString &fileName ) 213bool CalendarLocal::load( const QString &fileName )
139{ 214{
140 FileStorage storage( this, fileName ); 215 FileStorage storage( this, fileName );
141 return storage.load(); 216 return storage.load();
142} 217}
143 218
144bool CalendarLocal::save( const QString &fileName, CalFormat *format ) 219bool CalendarLocal::save( const QString &fileName, CalFormat *format )
145{ 220{
146 FileStorage storage( this, fileName, format ); 221 FileStorage storage( this, fileName, format );
147 return storage.save(); 222 return storage.save();
148} 223}
149 224
150void CalendarLocal::stopAllTodos() 225void CalendarLocal::stopAllTodos()
151{ 226{
152 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 227 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
153 it->setRunning( false ); 228 it->setRunning( false );
154 229
155} 230}
156void CalendarLocal::close() 231void CalendarLocal::close()
157{ 232{
158 233
159 Todo * i; 234 Todo * i;
160 for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); 235 for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false);
161 236
162 mEventList.setAutoDelete( true ); 237 mEventList.setAutoDelete( true );
163 mTodoList.setAutoDelete( true ); 238 mTodoList.setAutoDelete( true );
164 mJournalList.setAutoDelete( false ); 239 mJournalList.setAutoDelete( false );
165 240
166 mEventList.clear(); 241 mEventList.clear();
167 mTodoList.clear(); 242 mTodoList.clear();
168 mJournalList.clear(); 243 mJournalList.clear();
169 244
170 mEventList.setAutoDelete( false ); 245 mEventList.setAutoDelete( false );
171 mTodoList.setAutoDelete( false ); 246 mTodoList.setAutoDelete( false );
172 mJournalList.setAutoDelete( false ); 247 mJournalList.setAutoDelete( false );
173 248
174 setModified( false ); 249 setModified( false );
175} 250}
176 251
177bool CalendarLocal::addAnniversaryNoDup( Event *event ) 252bool CalendarLocal::addAnniversaryNoDup( Event *event )
178{ 253{
179 QString cat; 254 QString cat;
180 bool isBirthday = true; 255 bool isBirthday = true;
181 if( event->categoriesStr() == i18n( "Anniversary" ) ) { 256 if( event->categoriesStr() == i18n( "Anniversary" ) ) {
182 isBirthday = false; 257 isBirthday = false;
183 cat = i18n( "Anniversary" ); 258 cat = i18n( "Anniversary" );
184 } else if( event->categoriesStr() == i18n( "Birthday" ) ) { 259 } else if( event->categoriesStr() == i18n( "Birthday" ) ) {
185 isBirthday = true; 260 isBirthday = true;
186 cat = i18n( "Birthday" ); 261 cat = i18n( "Birthday" );
187 } else { 262 } else {
188 qDebug("addAnniversaryNoDup called without fitting category! "); 263 qDebug("addAnniversaryNoDup called without fitting category! ");
189 return false; 264 return false;
190 } 265 }
191 Event * eve; 266 Event * eve;
192 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { 267 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) {
193 if ( !(eve->categories().contains( cat ) )) 268 if ( !(eve->categories().contains( cat ) ))
194 continue; 269 continue;
195 // now we have an event with fitting category 270 // now we have an event with fitting category
196 if ( eve->dtStart().date() != event->dtStart().date() ) 271 if ( eve->dtStart().date() != event->dtStart().date() )
197 continue; 272 continue;
198 // now we have an event with fitting category+date 273 // now we have an event with fitting category+date
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 98d16a3..23b0542 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -1,175 +1,178 @@
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 */