summaryrefslogtreecommitdiffabout
path: root/libkcal/icalformatimpl.cpp
Side-by-side diff
Diffstat (limited to 'libkcal/icalformatimpl.cpp') (more/less context) (ignore 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)
kdDebug(5800) << "Write alarm for " << incidence->summary() << endl;
icalcomponent_add_component(parent,writeAlarm(alarm));
}
}
if( incidence->hasRecurrenceID() ) {
icalcomponent_add_property(parent,
icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID())));
}
// duration
// turned off as it always is set to PTS0 (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));
+ }
}
void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase)
{
icalcomponent_add_property(parent,icalproperty_new_dtstamp(
writeICalDateTime(QDateTime::currentDateTime())));
// organizer stuff
icalcomponent_add_property(parent,icalproperty_new_organizer(
("MAILTO:" + incidenceBase->organizer()).utf8()));
// attendees
@@ -1760,35 +1760,36 @@ QDateTime ICalFormatImpl::readICalDateTime(icaltimetype t)
return dt;
}
QDate ICalFormatImpl::readICalDate(icaltimetype t)
{
return QDate(t.year,t.month,t.day);
}
icaldurationtype ICalFormatImpl::writeICalDuration(int seconds)
{
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;
}
int ICalFormatImpl::readICalDuration(icaldurationtype d)
{
int result = 0;
result += d.weeks * gSecondsPerWeek;
result += d.days * gSecondsPerDay;
result += d.hours * gSecondsPerHour;
result += d.minutes * gSecondsPerMinute;
result += d.seconds;