summaryrefslogtreecommitdiffabout
path: root/libkcal
Unidiff
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/alarm.cpp2
-rw-r--r--libkcal/calendar.cpp54
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp56
-rw-r--r--libkcal/calendarlocal.h1
5 files changed, 87 insertions, 27 deletions
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index 0afa0a7..79e0464 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -350,48 +350,50 @@ int Alarm::offset()
350 } 350 }
351 351
352} 352}
353QString Alarm::offsetText() 353QString Alarm::offsetText()
354{ 354{
355 int min = -offset()/60; 355 int min = -offset()/60;
356 int hours = min /60; 356 int hours = min /60;
357 min = min % 60; 357 min = min % 60;
358 int days = hours /24; 358 int days = hours /24;
359 hours = hours % 24; 359 hours = hours % 24;
360 QString message; 360 QString message;
361 //qDebug("%d %d %d ", days, hours, min ); 361 //qDebug("%d %d %d ", days, hours, min );
362 if ( days > 0 ) 362 if ( days > 0 )
363 message += i18n("%1d").arg( days ); 363 message += i18n("%1d").arg( days );
364 if ( hours > 0 ) { 364 if ( hours > 0 ) {
365 if ( !message.isEmpty() ) message += "/"; 365 if ( !message.isEmpty() ) message += "/";
366 message += i18n("%1h").arg( hours ); 366 message += i18n("%1h").arg( hours );
367 } 367 }
368 if ( min > 0 ) { 368 if ( min > 0 ) {
369 if ( !message.isEmpty() ) message += "/"; 369 if ( !message.isEmpty() ) message += "/";
370 message += i18n("%1min").arg( min ); 370 message += i18n("%1min").arg( min );
371 } 371 }
372 if ( message.isEmpty() ) 372 if ( message.isEmpty() )
373 message = i18n("%1min").arg( 0 ); 373 message = i18n("%1min").arg( 0 );
374 if ( !mParent->alarmEnabled() )
375 return "!"+message + i18n("(disabled)");
374 return message; 376 return message;
375} 377}
376 378
377 379
378QDateTime Alarm::time() const 380QDateTime Alarm::time() const
379{ 381{
380 if ( hasTime() ) 382 if ( hasTime() )
381 return mAlarmTime; 383 return mAlarmTime;
382 else 384 else
383 { 385 {
384 if (mParent->typeID() == todoID ) { 386 if (mParent->typeID() == todoID ) {
385 Todo *t = static_cast<Todo*>(mParent); 387 Todo *t = static_cast<Todo*>(mParent);
386 return mOffset.end( t->dtDue() ); 388 return mOffset.end( t->dtDue() );
387 } else if (mEndOffset) { 389 } else if (mEndOffset) {
388 return mOffset.end( mParent->dtEnd() ); 390 return mOffset.end( mParent->dtEnd() );
389 } else { 391 } else {
390 return mOffset.end( mParent->dtStart() ); 392 return mOffset.end( mParent->dtStart() );
391 } 393 }
392 } 394 }
393} 395}
394 396
395bool Alarm::hasTime() const 397bool Alarm::hasTime() const
396{ 398{
397 return mHasTime; 399 return mHasTime;
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index 5092d1a..a662eeb 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -409,75 +409,75 @@ void Calendar::setupRelations( Incidence *incidence )
409 mOrphanUids.remove( i->uid() ); 409 mOrphanUids.remove( i->uid() );
410 } 410 }
411 411
412 // Now see about this incidences parent 412 // Now see about this incidences parent
413 if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) { 413 if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) {
414 // This incidence has a uid it is related to, but is not registered to it yet 414 // This incidence has a uid it is related to, but is not registered to it yet
415 // Try to find it 415 // Try to find it
416 Incidence* parent = this->incidence( incidence->relatedToUid() ); 416 Incidence* parent = this->incidence( incidence->relatedToUid() );
417 if( parent ) { 417 if( parent ) {
418 // Found it 418 // Found it
419 incidence->setRelatedTo( parent ); 419 incidence->setRelatedTo( parent );
420 parent->addRelation( incidence ); 420 parent->addRelation( incidence );
421 } else { 421 } else {
422 // Not found, put this in the mOrphans list 422 // Not found, put this in the mOrphans list
423 mOrphans.insert( incidence->relatedToUid(), incidence ); 423 mOrphans.insert( incidence->relatedToUid(), incidence );
424 mOrphanUids.insert( incidence->uid(), incidence ); 424 mOrphanUids.insert( incidence->uid(), incidence );
425 } 425 }
426 } 426 }
427} 427}
428 428
429// If a task with subtasks is deleted, move it's subtasks to the orphans list 429// If a task with subtasks is deleted, move it's subtasks to the orphans list
430void Calendar::removeRelations( Incidence *incidence ) 430void Calendar::removeRelations( Incidence *incidence )
431{ 431{
432 // qDebug("Calendar::removeRelations "); 432 // qDebug("Calendar::removeRelations ");
433 QString uid = incidence->uid(); 433 QString uid = incidence->uid();
434 434
435 QPtrList<Incidence> relations = incidence->relations(); 435 QPtrList<Incidence> relations = incidence->relations();
436 for( Incidence* i = relations.first(); i; i = relations.next() ) 436 for( Incidence* i = relations.first(); i; i = relations.next() )
437 if( !mOrphanUids.find( i->uid() ) ) { 437 if( !mOrphanUids.find( i->uid() ) ) {
438 mOrphans.insert( uid, i ); 438 mOrphans.insert( uid, i );
439 mOrphanUids.insert( i->uid(), i ); 439 mOrphanUids.insert( i->uid(), i );
440 i->setRelatedTo( 0 ); 440 i->setRelatedTo( 0 );
441 i->setRelatedToUid( uid ); 441 i->setRelatedToUid( uid );
442 } 442 }
443 443
444 // If this incidence is related to something else, tell that about it 444 // If this incidence is related to something else, tell that about it
445 if( incidence->relatedTo() ) 445 if( incidence->relatedTo() )
446 incidence->relatedTo()->removeRelation( incidence ); 446 incidence->relatedTo()->removeRelation( incidence );
447 447
448 // Remove this one from the orphans list 448 // Remove this one from the orphans list
449 if( mOrphanUids.remove( uid ) ) 449 if( mOrphanUids.remove( uid ) )
450 // This incidence is located in the orphans list - it should be removed 450 // This incidence is located in the orphans list - it should be removed
451 if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) { 451 if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) {
452 // Removing wasn't that easy 452 // Removing wasn't that easy
453 for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) { 453 for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) {
454 if( it.current()->uid() == uid ) { 454 if( it.current()->uid() == uid ) {
455 mOrphans.remove( it.currentKey() ); 455 mOrphans.remove( it.currentKey() );
456 break; 456 break;
457 } 457 }
458 } 458 }
459 } 459 }
460} 460}
461 461
462void Calendar::registerObserver( Observer *observer ) 462void Calendar::registerObserver( Observer *observer )
463{ 463{
464 mObserver = observer; 464 mObserver = observer;
465 mNewObserver = true; 465 mNewObserver = true;
466} 466}
467 467
468void Calendar::setModified( bool modified ) 468void Calendar::setModified( bool modified )
469{ 469{
470 if ( mObserver ) mObserver->calendarModified( modified, this ); 470 if ( mObserver ) mObserver->calendarModified( modified, this );
471 if ( modified != mModified || mNewObserver ) { 471 if ( modified != mModified || mNewObserver ) {
472 mNewObserver = false; 472 mNewObserver = false;
473 // if ( mObserver ) mObserver->calendarModified( modified, this ); 473 // if ( mObserver ) mObserver->calendarModified( modified, this );
474 mModified = modified; 474 mModified = modified;
475 } 475 }
476} 476}
477 477
478void Calendar::setLoadedProductId( const QString &id ) 478void Calendar::setLoadedProductId( const QString &id )
479{ 479{
480 mLoadedProductId = id; 480 mLoadedProductId = id;
481} 481}
482 482
483QString Calendar::loadedProductId() 483QString Calendar::loadedProductId()
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 73f82bb..2243e28 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -291,48 +291,49 @@ public:
291 }; 291 };
292 292
293 void registerObserver( Observer * ); 293 void registerObserver( Observer * );
294 294
295 void setModified( bool ); 295 void setModified( bool );
296 296
297 /** 297 /**
298 Set product id returned by loadedProductId(). This function is only 298 Set product id returned by loadedProductId(). This function is only
299 useful for the calendar loading code. 299 useful for the calendar loading code.
300 */ 300 */
301 void setLoadedProductId( const QString & ); 301 void setLoadedProductId( const QString & );
302 /** 302 /**
303 Return product id taken from file that has been loaded. Returns 303 Return product id taken from file that has been loaded. Returns
304 QString::null, if no calendar has been loaded. 304 QString::null, if no calendar has been loaded.
305 */ 305 */
306 QString loadedProductId(); 306 QString loadedProductId();
307 int defaultCalendar(); 307 int defaultCalendar();
308 void setDontDeleteIncidencesOnClose (); 308 void setDontDeleteIncidencesOnClose ();
309 public slots: 309 public slots:
310 void setDefaultCalendar( int ); 310 void setDefaultCalendar( int );
311 virtual void setCalendarEnabled( int id, bool enable ) = 0; 311 virtual void setCalendarEnabled( int id, bool enable ) = 0;
312 virtual void setAlarmEnabled( int id, bool enable ) = 0; 312 virtual void setAlarmEnabled( int id, bool enable ) = 0;
313 virtual void setReadOnly( int id, bool enable ) = 0; 313 virtual void setReadOnly( int id, bool enable ) = 0;
314 virtual void setDefaultCalendarEnabledOnly() = 0; 314 virtual void setDefaultCalendarEnabledOnly() = 0;
315 virtual void setCalendarRemove( int id ) = 0;
315 signals: 316 signals:
316 void calendarChanged(); 317 void calendarChanged();
317 void calendarSaved(); 318 void calendarSaved();
318 void calendarLoaded(); 319 void calendarLoaded();
319 void addAlarm(const QDateTime &qdt, const QString &noti ); 320 void addAlarm(const QDateTime &qdt, const QString &noti );
320 void removeAlarm(const QDateTime &qdt, const QString &noti ); 321 void removeAlarm(const QDateTime &qdt, const QString &noti );
321 322
322 protected: 323 protected:
323 /** 324 /**
324 Get unfiltered events, which occur on the given date. 325 Get unfiltered events, which occur on the given date.
325 */ 326 */
326 virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0; 327 virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0;
327 /** 328 /**
328 Get unfiltered events, which occur on the given date. 329 Get unfiltered events, which occur on the given date.
329 */ 330 */
330 virtual QPtrList<Event> rawEventsForDate( const QDate &date, 331 virtual QPtrList<Event> rawEventsForDate( const QDate &date,
331 bool sorted = false ) = 0; 332 bool sorted = false ) = 0;
332 /** 333 /**
333 Get events in a range of dates. If inclusive is set to true, only events 334 Get events in a range of dates. If inclusive is set to true, only events
334 are returned, which are completely included in the range. 335 are returned, which are completely included in the range.
335 */ 336 */
336 virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, 337 virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
337 bool inclusive = false ) = 0; 338 bool inclusive = false ) = 0;
338 339
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index e48122a..749d9f6 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -64,68 +64,87 @@ void CalendarLocal::init()
64 64
65 65
66CalendarLocal::~CalendarLocal() 66CalendarLocal::~CalendarLocal()
67{ 67{
68 if ( mDeleteIncidencesOnClose ) 68 if ( mDeleteIncidencesOnClose )
69 close(); 69 close();
70} 70}
71bool CalendarLocal::addCalendarFile( QString name, int id ) 71bool CalendarLocal::addCalendarFile( QString name, int id )
72{ 72{
73 CalendarLocal calendar( timeZoneId() ); 73 CalendarLocal calendar( timeZoneId() );
74 calendar.setDefaultCalendar( id ); 74 calendar.setDefaultCalendar( id );
75 if ( calendar.load( name ) ) { 75 if ( calendar.load( name ) ) {
76 addCalendar( &calendar ); 76 addCalendar( &calendar );
77 return true; 77 return true;
78 } 78 }
79 return false; 79 return false;
80} 80}
81void CalendarLocal::addCalendar( Calendar* cal ) 81void CalendarLocal::addCalendar( Calendar* cal )
82{ 82{
83 cal->setDontDeleteIncidencesOnClose(); 83 cal->setDontDeleteIncidencesOnClose();
84 { 84 {
85 QPtrList<Event> EventList = cal->rawEvents(); 85 QPtrList<Event> EventList = cal->rawEvents();
86 Event * ev = EventList.first(); 86 Event * ev = EventList.first();
87 while ( ev ) { 87 while ( ev ) {
88 ev->unRegisterObserver( cal );
89 ev->registerObserver( this );
88 mEventList.append( ev ); 90 mEventList.append( ev );
89 ev = EventList.next(); 91 ev = EventList.next();
90 } 92 }
91 } 93 }
92 { 94 {
95
93 QPtrList<Todo> TodoList = cal->rawTodos(); 96 QPtrList<Todo> TodoList = cal->rawTodos();
94 Todo * ev = TodoList.first(); 97 Todo * ev = TodoList.first();
95 while ( ev ) { 98 while ( ev ) {
99 QString rel = ev->relatedToUid();
100 if ( !rel.isEmpty() ){
101 ev->setRelatedTo ( 0 );
102 ev->setRelatedToUid( rel );
103 }
104 ev = TodoList.next();
105 }
106 //TodoList = cal->rawTodos();
107 ev = TodoList.first();
108 while ( ev ) {
109 ev->unRegisterObserver( cal );
110 ev->registerObserver( this );
96 mTodoList.append( ev ); 111 mTodoList.append( ev );
112 setupRelations( ev );
97 ev = TodoList.next(); 113 ev = TodoList.next();
98 } 114 }
99 } 115 }
100 { 116 {
101 QPtrList<Journal> JournalList = cal->journals(); 117 QPtrList<Journal> JournalList = cal->journals();
102 Journal * ev = JournalList.first(); 118 Journal * ev = JournalList.first();
103 while ( ev ) { 119 while ( ev ) {
120 ev->unRegisterObserver( cal );
121 ev->registerObserver( this );
104 mJournalList.append( ev ); 122 mJournalList.append( ev );
105 ev = JournalList.next(); 123 ev = JournalList.next();
106 } 124 }
107 } 125 }
126 setModified( true );
108} 127}
109bool CalendarLocal::load( const QString &fileName ) 128bool CalendarLocal::load( const QString &fileName )
110{ 129{
111 FileStorage storage( this, fileName ); 130 FileStorage storage( this, fileName );
112 return storage.load(); 131 return storage.load();
113} 132}
114 133
115bool CalendarLocal::save( const QString &fileName, CalFormat *format ) 134bool CalendarLocal::save( const QString &fileName, CalFormat *format )
116{ 135{
117 FileStorage storage( this, fileName, format ); 136 FileStorage storage( this, fileName, format );
118 return storage.save(); 137 return storage.save();
119} 138}
120 139
121void CalendarLocal::close() 140void CalendarLocal::close()
122{ 141{
123 142
124 Todo * i; 143 Todo * i;
125 for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); 144 for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false);
126 145
127 mEventList.setAutoDelete( true ); 146 mEventList.setAutoDelete( true );
128 mTodoList.setAutoDelete( true ); 147 mTodoList.setAutoDelete( true );
129 mJournalList.setAutoDelete( false ); 148 mJournalList.setAutoDelete( false );
130 149
131 mEventList.clear(); 150 mEventList.clear();
@@ -760,75 +779,112 @@ Journal *CalendarLocal::journal( const QDate &date )
760 779
761 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 780 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
762 if ( it->calEnabled() && it->dtStart().date() == date ) 781 if ( it->calEnabled() && it->dtStart().date() == date )
763 return it; 782 return it;
764 783
765 return 0; 784 return 0;
766} 785}
767 786
768Journal *CalendarLocal::journal( const QString &uid ) 787Journal *CalendarLocal::journal( const QString &uid )
769{ 788{
770 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 789 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
771 if ( it->calEnabled() && it->uid() == uid ) 790 if ( it->calEnabled() && it->uid() == uid )
772 return it; 791 return it;
773 792
774 return 0; 793 return 0;
775} 794}
776 795
777QPtrList<Journal> CalendarLocal::journals() 796QPtrList<Journal> CalendarLocal::journals()
778{ 797{
779 QPtrList<Journal> el; 798 QPtrList<Journal> el;
780 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 799 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
781 if ( it->calEnabled() ) el.append( it ); 800 if ( it->calEnabled() ) el.append( it );
782 return el; 801 return el;
783} 802}
803void CalendarLocal::setCalendarRemove( int id )
804{
805
806 {
807 QPtrList<Event> EventList = mEventList;
808 Event * ev = EventList.first();
809 while ( ev ) {
810 if ( ev->calID() == id )
811 deleteEvent( ev );
812 ev = EventList.next();
813 }
814 }
815 {
816
817 QPtrList<Todo> TodoList = mTodoList;
818 Todo * ev = TodoList.first();
819 while ( ev ) {
820 if ( ev->calID() == id )
821 deleteTodo( ev );
822 ev = TodoList.next();
823 }
824 }
825 {
826 QPtrList<Journal> JournalList = mJournalList;
827 Journal * ev = JournalList.first();
828 while ( ev ) {
829 if ( ev->calID() == id )
830 deleteJournal( ev );
831 ev = JournalList.next();
832 }
833 }
834
835 if ( mUndoIncidence ) delete mUndoIncidence;
836 mUndoIncidence = 0;
837
838}
784 839
785void CalendarLocal::setCalendarEnabled( int id, bool enable ) 840void CalendarLocal::setCalendarEnabled( int id, bool enable )
786{ 841{
787 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 842 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
788 if ( it->calID() == id ) it->setCalEnabled( enable ); 843 if ( it->calID() == id ) it->setCalEnabled( enable );
789 844
790 for ( Event *it = mEventList.first(); it; it = mEventList.next() ) 845 for ( Event *it = mEventList.first(); it; it = mEventList.next() )
791 if ( it->calID() == id ) it->setCalEnabled( enable ); 846 if ( it->calID() == id ) it->setCalEnabled( enable );
792 847
793 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 848 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
794 if ( it->calID() == id ) it->setCalEnabled( enable ); 849 if ( it->calID() == id ) it->setCalEnabled( enable );
795 850
796} 851}
797 852
798void CalendarLocal::setReadOnly( int id, bool enable ) 853void CalendarLocal::setReadOnly( int id, bool enable )
799{ 854{
800 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 855 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
801 if ( it->calID() == id ) it->setReadOnly( enable ); 856 if ( it->calID() == id ) it->setReadOnly( enable );
802 857
803 for ( Event *it = mEventList.first(); it; it = mEventList.next() ) 858 for ( Event *it = mEventList.first(); it; it = mEventList.next() )
804 if ( it->calID() == id ) it->setReadOnly( enable ); 859 if ( it->calID() == id ) it->setReadOnly( enable );
805 860
806 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 861 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
807 if ( it->calID() == id ) it->setReadOnly( enable ); 862 if ( it->calID() == id ) it->setReadOnly( enable );
808 863
809} 864}
810 865
811void CalendarLocal::setAlarmEnabled( int id, bool enable ) 866void CalendarLocal::setAlarmEnabled( int id, bool enable )
812{ 867{
813 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 868 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
814 if ( it->calID() == id ) it->setAlarmEnabled( enable ); 869 if ( it->calID() == id ) it->setAlarmEnabled( enable );
815 870
816 for ( Event *it = mEventList.first(); it; it = mEventList.next() ) 871 for ( Event *it = mEventList.first(); it; it = mEventList.next() )
817 if ( it->calID() == id ) it->setAlarmEnabled( enable ); 872 if ( it->calID() == id ) it->setAlarmEnabled( enable );
818 873
819 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 874 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
820 if ( it->calID() == id ) it->setAlarmEnabled( enable ); 875 if ( it->calID() == id ) it->setAlarmEnabled( enable );
876 reInitAlarmSettings();
821 877
822} 878}
823void CalendarLocal::setDefaultCalendarEnabledOnly() 879void CalendarLocal::setDefaultCalendarEnabledOnly()
824{ 880{
825 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 881 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
826 it->setCalEnabled( it->calID() == mDefaultCalendar ); 882 it->setCalEnabled( it->calID() == mDefaultCalendar );
827 883
828 for ( Event *it = mEventList.first(); it; it = mEventList.next() ) 884 for ( Event *it = mEventList.first(); it; it = mEventList.next() )
829 it->setCalEnabled( it->calID() == mDefaultCalendar); 885 it->setCalEnabled( it->calID() == mDefaultCalendar);
830 886
831 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 887 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
832 it->setCalEnabled( it->calID() == mDefaultCalendar); 888 it->setCalEnabled( it->calID() == mDefaultCalendar);
833 889
834} 890}
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 65f6aa7..5bbe55f 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -164,48 +164,49 @@ class CalendarLocal : public Calendar
164 164
165 /** 165 /**
166 Builds and then returns a list of all events that match for the 166 Builds and then returns a list of all events that match for the
167 date specified. useful for dayView, etc. etc. 167 date specified. useful for dayView, etc. etc.
168 */ 168 */
169 QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false ); 169 QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false );
170 /** 170 /**
171 Get unfiltered events for date \a qdt. 171 Get unfiltered events for date \a qdt.
172 */ 172 */
173 QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); 173 QPtrList<Event> rawEventsForDate( const QDateTime &qdt );
174 /** 174 /**
175 Get unfiltered events in a range of dates. If inclusive is set to true, 175 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. 176 only events are returned, which are completely included in the range.
177 */ 177 */
178 QPtrList<Event> rawEvents( const QDate &start, const QDate &end, 178 QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
179 bool inclusive = false ); 179 bool inclusive = false );
180 Todo *todo( QString, QString ); 180 Todo *todo( QString, QString );
181 Event *event( QString, QString ); 181 Event *event( QString, QString );
182 182
183public slots: 183public slots:
184 void setCalendarEnabled( int id, bool enable ); 184 void setCalendarEnabled( int id, bool enable );
185 void setAlarmEnabled( int id, bool enable ); 185 void setAlarmEnabled( int id, bool enable );
186 void setReadOnly( int id, bool enable ); 186 void setReadOnly( int id, bool enable );
187 void setDefaultCalendarEnabledOnly(); 187 void setDefaultCalendarEnabledOnly();
188 void setCalendarRemove( int id );
188 189
189 protected: 190 protected:
190 191
191 // Event* mNextAlarmEvent; 192 // Event* mNextAlarmEvent;
192 QString mNextSummary; 193 QString mNextSummary;
193 QString mNextAlarmEventDateTimeString; 194 QString mNextAlarmEventDateTimeString;
194 QString mLastAlarmNotificationString; 195 QString mLastAlarmNotificationString;
195 QDateTime mNextAlarmEventDateTime; 196 QDateTime mNextAlarmEventDateTime;
196 QDateTime mNextAlarmDateTime; 197 QDateTime mNextAlarmDateTime;
197 void reInitAlarmSettings(); 198 void reInitAlarmSettings();
198 199
199 /** Notification function of IncidenceBase::Observer. */ 200 /** Notification function of IncidenceBase::Observer. */
200 void incidenceUpdated( IncidenceBase *i ) { update( i ); } 201 void incidenceUpdated( IncidenceBase *i ) { update( i ); }
201 202
202 /** inserts an event into its "proper place" in the calendar. */ 203 /** inserts an event into its "proper place" in the calendar. */
203 void insertEvent( Event *event ); 204 void insertEvent( Event *event );
204 205
205 /** Append alarms of incidence in interval to list of alarms. */ 206 /** Append alarms of incidence in interval to list of alarms. */
206 void appendAlarms( Alarm::List &alarms, Incidence *incidence, 207 void appendAlarms( Alarm::List &alarms, Incidence *incidence,
207 const QDateTime &from, const QDateTime &to ); 208 const QDateTime &from, const QDateTime &to );
208 209
209 /** Append alarms of recurring events in interval to list of alarms. */ 210 /** Append alarms of recurring events in interval to list of alarms. */
210 void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence, 211 void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence,
211 const QDateTime &from, const QDateTime &to ); 212 const QDateTime &from, const QDateTime &to );