summaryrefslogtreecommitdiffabout
path: root/libkcal/icalformatimpl.cpp
Unidiff
Diffstat (limited to 'libkcal/icalformatimpl.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/icalformatimpl.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index 2e38ae3..eae41aa 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -399,29 +399,29 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
399 kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; 399 kdDebug(5800) << "Write alarm for " << incidence->summary() << endl;
400 icalcomponent_add_component(parent,writeAlarm(alarm)); 400 icalcomponent_add_component(parent,writeAlarm(alarm));
401 } 401 }
402 } 402 }
403 if( incidence->hasRecurrenceID() ) { 403 if( incidence->hasRecurrenceID() ) {
404 icalcomponent_add_property(parent, 404 icalcomponent_add_property(parent,
405 icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID()))); 405 icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID())));
406 } 406 }
407 // duration 407 // duration
408 408
409// turned off as it always is set to PTS0 (and must not occur together with DTEND 409// turned off as it always is set to PTS0 (and must not occur together with DTEND
410 410
411// if (incidence->hasDuration()) { 411 if (incidence->hasDuration()) {
412// icaldurationtype duration; 412 icaldurationtype duration;
413// duration = writeICalDuration(incidence->duration()); 413 duration = writeICalDuration(incidence->duration());
414// icalcomponent_add_property(parent,icalproperty_new_duration(duration)); 414 icalcomponent_add_property(parent,icalproperty_new_duration(duration));
415// } 415 }
416} 416}
417 417
418void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) 418void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase)
419{ 419{
420 icalcomponent_add_property(parent,icalproperty_new_dtstamp( 420 icalcomponent_add_property(parent,icalproperty_new_dtstamp(
421 writeICalDateTime(QDateTime::currentDateTime()))); 421 writeICalDateTime(QDateTime::currentDateTime())));
422 422
423 // organizer stuff 423 // organizer stuff
424 icalcomponent_add_property(parent,icalproperty_new_organizer( 424 icalcomponent_add_property(parent,icalproperty_new_organizer(
425 ("MAILTO:" + incidenceBase->organizer()).utf8())); 425 ("MAILTO:" + incidenceBase->organizer()).utf8()));
426 426
427 // attendees 427 // attendees
@@ -1760,35 +1760,36 @@ QDateTime ICalFormatImpl::readICalDateTime(icaltimetype t)
1760 return dt; 1760 return dt;
1761} 1761}
1762 1762
1763QDate ICalFormatImpl::readICalDate(icaltimetype t) 1763QDate ICalFormatImpl::readICalDate(icaltimetype t)
1764{ 1764{
1765 return QDate(t.year,t.month,t.day); 1765 return QDate(t.year,t.month,t.day);
1766} 1766}
1767 1767
1768icaldurationtype ICalFormatImpl::writeICalDuration(int seconds) 1768icaldurationtype ICalFormatImpl::writeICalDuration(int seconds)
1769{ 1769{
1770 icaldurationtype d; 1770 icaldurationtype d;
1771 1771
1772 d.weeks = seconds % gSecondsPerWeek; 1772 d.is_neg = (seconds<0)?1:0;
1773 seconds -= d.weeks * gSecondsPerWeek; 1773 if (seconds<0) seconds = -seconds;
1774 d.days = seconds % gSecondsPerDay; 1774
1775 seconds -= d.days * gSecondsPerDay; 1775 d.weeks = seconds / gSecondsPerWeek;
1776 d.hours = seconds % gSecondsPerHour; 1776 seconds %= gSecondsPerWeek;
1777 seconds -= d.hours * gSecondsPerHour; 1777 d.days = seconds / gSecondsPerDay;
1778 d.minutes = seconds % gSecondsPerMinute; 1778 seconds %= gSecondsPerDay;
1779 seconds -= d.minutes * gSecondsPerMinute; 1779 d.hours = seconds / gSecondsPerHour;
1780 seconds %= gSecondsPerHour;
1781 d.minutes = seconds / gSecondsPerMinute;
1782 seconds %= gSecondsPerMinute;
1780 d.seconds = seconds; 1783 d.seconds = seconds;
1781 d.is_neg = 0;
1782
1783 return d; 1784 return d;
1784} 1785}
1785 1786
1786int ICalFormatImpl::readICalDuration(icaldurationtype d) 1787int ICalFormatImpl::readICalDuration(icaldurationtype d)
1787{ 1788{
1788 int result = 0; 1789 int result = 0;
1789 1790
1790 result += d.weeks * gSecondsPerWeek; 1791 result += d.weeks * gSecondsPerWeek;
1791 result += d.days * gSecondsPerDay; 1792 result += d.days * gSecondsPerDay;
1792 result += d.hours * gSecondsPerHour; 1793 result += d.hours * gSecondsPerHour;
1793 result += d.minutes * gSecondsPerMinute; 1794 result += d.minutes * gSecondsPerMinute;
1794 result += d.seconds; 1795 result += d.seconds;