Summary: | duration / end date not included when saving in iCalendar format | ||
---|---|---|---|
Product: | [Applications] korganizer | Reporter: | Gintautas Miliauskas <gintautas.m> |
Component: | general | Assignee: | Reinhold Kainhofer <reinhold> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 3.3 | ||
Target Milestone: | --- | ||
Platform: | Debian testing | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Gintautas Miliauskas
2004-10-28 12:54:31 UTC
CVS commit by kainhofe: Correctly write out the duration of an event (if the original event had a duration, no DTEND). The code to calculcate the duration was also completely messed up (but funnly not wrong): For example, a duration of 2 hours was written out as DURATION:P7200W-55904DT475552800S And yes, that's actually just a very complicated way to write 2 hours (7200 weeks into the future, then 55904 days back, and then we'll have to go another 475552800 seconds forward, and we are two hours in the future from now)... BUG: 92255 M +16 -14 icalformatimpl.cpp 1.125 --- kdepim/libkcal/icalformatimpl.cpp #1.124:1.125 @@ -710,9 +710,9 @@ void ICalFormatImpl::writeIncidence(ical // @TODO: turned off as it always is set to PT0S (and must not occur together with DTEND -// if (incidence->hasDuration()) { -// icaldurationtype duration; -// duration = writeICalDuration(incidence->duration()); -// icalcomponent_add_property(parent,icalproperty_new_duration(duration)); -// } + if (incidence->hasDuration()) { + icaldurationtype duration; + duration = writeICalDuration( incidence->duration() ); + icalcomponent_add_property(parent,icalproperty_new_duration(duration)); + } } @@ -2164,14 +2164,16 @@ icaldurationtype ICalFormatImpl::writeIC icaldurationtype d; - d.weeks = seconds % gSecondsPerWeek; - seconds -= d.weeks * gSecondsPerWeek; - d.days = seconds % gSecondsPerDay; - seconds -= d.days * gSecondsPerDay; - d.hours = seconds % gSecondsPerHour; - seconds -= d.hours * gSecondsPerHour; - d.minutes = seconds % gSecondsPerMinute; - seconds -= d.minutes * gSecondsPerMinute; + d.is_neg = (seconds<0)?1:0; + if (seconds<0) seconds = -seconds; + + d.weeks = seconds / gSecondsPerWeek; + seconds %= gSecondsPerWeek; + d.days = seconds / gSecondsPerDay; + seconds %= gSecondsPerDay; + d.hours = seconds / gSecondsPerHour; + seconds %= gSecondsPerHour; + d.minutes = seconds / gSecondsPerMinute; + seconds %= gSecondsPerMinute; d.seconds = seconds; - d.is_neg = 0; return d; |