-rw-r--r-- | libkcal/calendar.cpp | 6 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 4 | ||||
-rw-r--r-- | libkcal/calfilter.cpp | 6 | ||||
-rw-r--r-- | libkcal/event.h | 1 | ||||
-rw-r--r-- | libkcal/freebusy.h | 1 | ||||
-rw-r--r-- | libkcal/icalformat.cpp | 4 | ||||
-rw-r--r-- | libkcal/icalformatimpl.cpp | 6 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 6 | ||||
-rw-r--r-- | libkcal/incidencebase.h | 2 | ||||
-rw-r--r-- | libkcal/journal.h | 1 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 4 | ||||
-rw-r--r-- | libkcal/todo.cpp | 5 | ||||
-rw-r--r-- | libkcal/todo.h | 1 |
13 files changed, 25 insertions, 22 deletions
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index ed39ddb..7e8e2c5 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -353,11 +353,11 @@ bool Calendar::addIncidence(Incidence *i) | |||
353 | } | 353 | } |
354 | void Calendar::deleteIncidence(Incidence *in) | 354 | void Calendar::deleteIncidence(Incidence *in) |
355 | { | 355 | { |
356 | if ( in->type() == "Event" ) | 356 | if ( in->typeID() == eventID ) |
357 | deleteEvent( (Event*) in ); | 357 | deleteEvent( (Event*) in ); |
358 | else if ( in->type() =="Todo" ) | 358 | else if ( in->typeID() == todoID ) |
359 | deleteTodo( (Todo*) in); | 359 | deleteTodo( (Todo*) in); |
360 | else if ( in->type() =="Journal" ) | 360 | else if ( in->typeID() == journalID ) |
361 | deleteJournal( (Journal*) in ); | 361 | deleteJournal( (Journal*) in ); |
362 | } | 362 | } |
363 | 363 | ||
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index bc76c0b..fe74052 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -458,8 +458,6 @@ Alarm::List CalendarLocal::alarmsTo( const QDateTime &to ) | |||
458 | 458 | ||
459 | Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) | 459 | Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to ) |
460 | { | 460 | { |
461 | kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - " | ||
462 | << to.toString() << ")\n"; | ||
463 | 461 | ||
464 | Alarm::List alarms; | 462 | Alarm::List alarms; |
465 | 463 | ||
@@ -488,8 +486,6 @@ void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence, | |||
488 | // << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; | 486 | // << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl; |
489 | if ( alarm->enabled() ) { | 487 | if ( alarm->enabled() ) { |
490 | if ( alarm->time() >= from && alarm->time() <= to ) { | 488 | if ( alarm->time() >= from && alarm->time() <= to ) { |
491 | kdDebug(5800) << "CalendarLocal::appendAlarms() '" << incidence->summary() | ||
492 | << "': " << alarm->time().toString() << endl; | ||
493 | alarms.append( alarm ); | 489 | alarms.append( alarm ); |
494 | } | 490 | } |
495 | } | 491 | } |
diff --git a/libkcal/calfilter.cpp b/libkcal/calfilter.cpp index c425dfc..20078a7 100644 --- a/libkcal/calfilter.cpp +++ b/libkcal/calfilter.cpp | |||
@@ -78,11 +78,11 @@ void CalFilter::apply(QPtrList<Todo> *eventlist) | |||
78 | } | 78 | } |
79 | bool CalFilter::filterCalendarItem(Incidence *in) | 79 | bool CalFilter::filterCalendarItem(Incidence *in) |
80 | { | 80 | { |
81 | if ( in->type() == "Event" ) | 81 | if ( in->typeID() == eventID ) |
82 | return filterEvent( (Event*) in ); | 82 | return filterEvent( (Event*) in ); |
83 | else if ( in->type() =="Todo" ) | 83 | else if ( in->typeID() == todoID ) |
84 | return filterTodo( (Todo*) in); | 84 | return filterTodo( (Todo*) in); |
85 | else if ( in->type() =="Journal" ) | 85 | else if ( in->typeID () == journalID ) |
86 | return filterJournal( (Journal*) in ); | 86 | return filterJournal( (Journal*) in ); |
87 | return false; | 87 | return false; |
88 | } | 88 | } |
diff --git a/libkcal/event.h b/libkcal/event.h index 8729956..287d403 100644 --- a/libkcal/event.h +++ b/libkcal/event.h | |||
@@ -40,6 +40,7 @@ class Event : public Incidence | |||
40 | ~Event(); | 40 | ~Event(); |
41 | 41 | ||
42 | QCString type() const { return "Event"; } | 42 | QCString type() const { return "Event"; } |
43 | IncTypeID typeID() const { return eventID; } | ||
43 | 44 | ||
44 | Incidence *clone(); | 45 | Incidence *clone(); |
45 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; | 46 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; |
diff --git a/libkcal/freebusy.h b/libkcal/freebusy.h index 054feda..d741c72 100644 --- a/libkcal/freebusy.h +++ b/libkcal/freebusy.h | |||
@@ -48,6 +48,7 @@ class FreeBusy : public IncidenceBase | |||
48 | ~FreeBusy(); | 48 | ~FreeBusy(); |
49 | 49 | ||
50 | QCString type() const { return "FreeBusy"; } | 50 | QCString type() const { return "FreeBusy"; } |
51 | IncTypeID typeID() const { return freebusyID; } | ||
51 | 52 | ||
52 | virtual QDateTime dtEnd() const; | 53 | virtual QDateTime dtEnd() const; |
53 | bool setDtEnd( const QDateTime &end ); | 54 | bool setDtEnd( const QDateTime &end ); |
diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp index 3a2aac6..d9fe40b 100644 --- a/libkcal/icalformat.cpp +++ b/libkcal/icalformat.cpp | |||
@@ -384,12 +384,12 @@ ScheduleMessage *ICalFormat::parseScheduleMessage( Calendar *cal, | |||
384 | Incidence *existingIncidence = cal->event(incidence->uid()); | 384 | Incidence *existingIncidence = cal->event(incidence->uid()); |
385 | if (existingIncidence) { | 385 | if (existingIncidence) { |
386 | // TODO: check, if cast is required, or if it can be done by virtual funcs. | 386 | // TODO: check, if cast is required, or if it can be done by virtual funcs. |
387 | if (existingIncidence->type() == "Todo") { | 387 | if (existingIncidence->typeID() == todoID ) { |
388 | Todo *todo = static_cast<Todo *>(existingIncidence); | 388 | Todo *todo = static_cast<Todo *>(existingIncidence); |
389 | icalcomponent_add_component(calendarComponent, | 389 | icalcomponent_add_component(calendarComponent, |
390 | mImpl->writeTodo(todo)); | 390 | mImpl->writeTodo(todo)); |
391 | } | 391 | } |
392 | if (existingIncidence->type() == "Event") { | 392 | if (existingIncidence->typeID() == eventID ) { |
393 | Event *event = static_cast<Event *>(existingIncidence); | 393 | Event *event = static_cast<Event *>(existingIncidence); |
394 | icalcomponent_add_component(calendarComponent, | 394 | icalcomponent_add_component(calendarComponent, |
395 | mImpl->writeEvent(event)); | 395 | mImpl->writeEvent(event)); |
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index 2405682..3e28714 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -2155,15 +2155,15 @@ icalcomponent *ICalFormatImpl::createScheduleComponent(IncidenceBase *incidence, | |||
2155 | icalcomponent_add_property(message,icalproperty_new_method(icalmethod)); | 2155 | icalcomponent_add_property(message,icalproperty_new_method(icalmethod)); |
2156 | 2156 | ||
2157 | // TODO: check, if dynamic cast is required | 2157 | // TODO: check, if dynamic cast is required |
2158 | if(incidence->type() == "Todo") { | 2158 | if(incidence->typeID() == todoID ) { |
2159 | Todo *todo = static_cast<Todo *>(incidence); | 2159 | Todo *todo = static_cast<Todo *>(incidence); |
2160 | icalcomponent_add_component(message,writeTodo(todo)); | 2160 | icalcomponent_add_component(message,writeTodo(todo)); |
2161 | } | 2161 | } |
2162 | if(incidence->type() == "Event") { | 2162 | if(incidence->typeID() == eventID ) { |
2163 | Event *event = static_cast<Event *>(incidence); | 2163 | Event *event = static_cast<Event *>(incidence); |
2164 | icalcomponent_add_component(message,writeEvent(event)); | 2164 | icalcomponent_add_component(message,writeEvent(event)); |
2165 | } | 2165 | } |
2166 | if(incidence->type() == "FreeBusy") { | 2166 | if(incidence->typeID() == freebusyID) { |
2167 | FreeBusy *freebusy = static_cast<FreeBusy *>(incidence); | 2167 | FreeBusy *freebusy = static_cast<FreeBusy *>(incidence); |
2168 | icalcomponent_add_component(message,writeFreeBusy(freebusy, method)); | 2168 | icalcomponent_add_component(message,writeFreeBusy(freebusy, method)); |
2169 | } | 2169 | } |
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 762103f..f446197 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -236,7 +236,7 @@ Incidence* Incidence::recreateCloneException( QDate d ) | |||
236 | if ( doesRecur() ) { | 236 | if ( doesRecur() ) { |
237 | addExDate( d ); | 237 | addExDate( d ); |
238 | newInc->recurrence()->unsetRecurs(); | 238 | newInc->recurrence()->unsetRecurs(); |
239 | if ( type() == "Event") { | 239 | if ( typeID() == eventID ) { |
240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); | 240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); |
241 | QTime tim = dtStart().time(); | 241 | QTime tim = dtStart().time(); |
242 | newInc->setDtStart( QDateTime(d, tim) ); | 242 | newInc->setDtStart( QDateTime(d, tim) ); |
@@ -724,7 +724,7 @@ QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const | |||
724 | if ( hasStartDate () ) { | 724 | if ( hasStartDate () ) { |
725 | incidenceStart = dtStart(); | 725 | incidenceStart = dtStart(); |
726 | } | 726 | } |
727 | if ( type() =="Todo" ) { | 727 | if ( typeID() == todoID ) { |
728 | if ( ((Todo*)this)->hasDueDate() ) | 728 | if ( ((Todo*)this)->hasDueDate() ) |
729 | incidenceStart = ((Todo*)this)->dtDue(); | 729 | incidenceStart = ((Todo*)this)->dtDue(); |
730 | } | 730 | } |
@@ -736,7 +736,7 @@ QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const | |||
736 | QDateTime Incidence::dtStart() const | 736 | QDateTime Incidence::dtStart() const |
737 | { | 737 | { |
738 | if ( doesRecur() ) { | 738 | if ( doesRecur() ) { |
739 | if ( type() == "Todo" ) { | 739 | if ( typeID() == todoID ) { |
740 | ((Todo*)this)->checkSetCompletedFalse(); | 740 | ((Todo*)this)->checkSetCompletedFalse(); |
741 | } | 741 | } |
742 | } | 742 | } |
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h index 8624786..05209e0 100644 --- a/libkcal/incidencebase.h +++ b/libkcal/incidencebase.h | |||
@@ -34,6 +34,7 @@ | |||
34 | namespace KCal { | 34 | namespace KCal { |
35 | 35 | ||
36 | typedef QValueList<QDate> DateList; | 36 | typedef QValueList<QDate> DateList; |
37 | enum IncTypeID { eventID,todoID,journalID,freebusyID }; | ||
37 | 38 | ||
38 | /** | 39 | /** |
39 | This class provides the base class common to all calendar components. | 40 | This class provides the base class common to all calendar components. |
@@ -51,6 +52,7 @@ class IncidenceBase : public CustomProperties | |||
51 | virtual ~IncidenceBase(); | 52 | virtual ~IncidenceBase(); |
52 | 53 | ||
53 | virtual QCString type() const = 0; | 54 | virtual QCString type() const = 0; |
55 | virtual IncTypeID typeID() const = 0; | ||
54 | 56 | ||
55 | /** Set the unique id for the event */ | 57 | /** Set the unique id for the event */ |
56 | void setUid(const QString &); | 58 | void setUid(const QString &); |
diff --git a/libkcal/journal.h b/libkcal/journal.h index 2c1d7ea..1cd0a22 100644 --- a/libkcal/journal.h +++ b/libkcal/journal.h | |||
@@ -37,6 +37,7 @@ class Journal : public Incidence | |||
37 | ~Journal(); | 37 | ~Journal(); |
38 | 38 | ||
39 | QCString type() const { return "Journal"; } | 39 | QCString type() const { return "Journal"; } |
40 | IncTypeID typeID() const { return journalID; } | ||
40 | 41 | ||
41 | Incidence *clone(); | 42 | Incidence *clone(); |
42 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; | 43 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; |
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 7d61b7f..d1ace4f 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -21,9 +21,9 @@ QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bo | |||
21 | mCreated = created ; | 21 | mCreated = created ; |
22 | mModified = modified; | 22 | mModified = modified; |
23 | mText = ""; | 23 | mText = ""; |
24 | if ( inc->type() == "Event" ) | 24 | if ( inc->typeID() == eventID ) |
25 | setEvent((Event *) inc ); | 25 | setEvent((Event *) inc ); |
26 | else if ( inc->type() == "Todo" ) | 26 | else if ( inc->typeID() == todoID ) |
27 | setTodo((Todo *) inc ); | 27 | setTodo((Todo *) inc ); |
28 | return mText; | 28 | return mText; |
29 | } | 29 | } |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 38ba2c7..c97a61e 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -130,7 +130,7 @@ void Todo::saveParents() | |||
130 | if (!relatedTo() ) | 130 | if (!relatedTo() ) |
131 | return; | 131 | return; |
132 | Incidence * inc = relatedTo(); | 132 | Incidence * inc = relatedTo(); |
133 | if ( inc->type() != "Todo" ) | 133 | if ( inc->typeID() != todoID ) |
134 | return; | 134 | return; |
135 | Todo* to = (Todo*)inc; | 135 | Todo* to = (Todo*)inc; |
136 | bool saveTodo = false; | 136 | bool saveTodo = false; |
@@ -564,8 +564,9 @@ QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_d | |||
564 | 564 | ||
565 | void Todo::checkSetCompletedFalse() | 565 | void Todo::checkSetCompletedFalse() |
566 | { | 566 | { |
567 | if ( !hasRecurrenceID() ) { | 567 | if ( !mHasRecurrenceID ) { |
568 | qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); | 568 | qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); |
569 | return; | ||
569 | } | 570 | } |
570 | // qDebug("Todo::checkSetCompletedFalse()"); | 571 | // qDebug("Todo::checkSetCompletedFalse()"); |
571 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); | 572 | //qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() ); |
diff --git a/libkcal/todo.h b/libkcal/todo.h index ab8fdf1..501c2ba 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h | |||
@@ -41,6 +41,7 @@ namespace KCal { | |||
41 | ~Todo(); | 41 | ~Todo(); |
42 | typedef ListBase<Todo> List; | 42 | typedef ListBase<Todo> List; |
43 | QCString type() const { return "Todo"; } | 43 | QCString type() const { return "Todo"; } |
44 | IncTypeID typeID() const { return todoID; } | ||
44 | 45 | ||
45 | /** Return an exact copy of this todo. */ | 46 | /** Return an exact copy of this todo. */ |
46 | Incidence *clone(); | 47 | Incidence *clone(); |