-rw-r--r-- | libkcal/vcalformat.cpp | 71 |
1 files changed, 38 insertions, 33 deletions
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 076cd3f..9307f12 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp @@ -348,20 +348,22 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) for (alarm = alarms.first(); alarm; alarm = alarms.next()) { if (alarm->enabled()) { - VObject *a = addProp(vtodo, VCDAlarmProp); - tmpStr = qDateTimeToISO(alarm->time()); - addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); - addPropValue(a, VCRepeatCountProp, "1"); - addPropValue(a, VCDisplayStringProp, "beep!"); - if (alarm->type() == Alarm::Audio) { - a = addProp(vtodo, VCAAlarmProp); - addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); - addPropValue(a, VCRepeatCountProp, "1"); - addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile())); - } - else if (alarm->type() == Alarm::Procedure) { - a = addProp(vtodo, VCPAlarmProp); - addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); - addPropValue(a, VCRepeatCountProp, "1"); - addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile())); + VObject *a; + tmpStr = qDateTimeToISO(alarm->time()); + if (alarm->type() == Alarm::Audio) { + a = addProp(vtodo, VCAAlarmProp); + addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); + addPropValue(a, VCRepeatCountProp, "1"); + addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile())); + } + else if (alarm->type() == Alarm::Procedure) { + a = addProp(vtodo, VCPAlarmProp); + addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); + addPropValue(a, VCRepeatCountProp, "1"); + addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile())); + } else { + a = addProp(vtodo, VCDAlarmProp); + addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); + addPropValue(a, VCRepeatCountProp, "1"); + addPropValue(a, VCDisplayStringProp, "beep!"); } } @@ -626,21 +628,24 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent) Alarm* alarm; for (alarm = alarms.first(); alarm; alarm = alarms.next()) { - if (alarm->enabled()) { - VObject *a = addProp(vevent, VCDAlarmProp); - tmpStr = qDateTimeToISO(alarm->time()); - addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); - addPropValue(a, VCRepeatCountProp, "1"); - addPropValue(a, VCDisplayStringProp, "beep!"); - if (alarm->type() == Alarm::Audio) { - a = addProp(vevent, VCAAlarmProp); - addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); - addPropValue(a, VCRepeatCountProp, "1"); - addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile())); - } - if (alarm->type() == Alarm::Procedure) { - a = addProp(vevent, VCPAlarmProp); - addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); - addPropValue(a, VCRepeatCountProp, "1"); - addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile())); + if (alarm->enabled()) { + VObject *a ; + tmpStr = qDateTimeToISO(alarm->time()); + if (alarm->type() == Alarm::Audio) { + a = addProp(vevent, VCAAlarmProp); + addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); + addPropValue(a, VCRepeatCountProp, "1"); + addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile())); + } + if (alarm->type() == Alarm::Procedure) { + a = addProp(vevent, VCPAlarmProp); + addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); + addPropValue(a, VCRepeatCountProp, "1"); + addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile())); + } else { + a = addProp(vevent, VCDAlarmProp); + addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); + addPropValue(a, VCRepeatCountProp, "1"); + addPropValue(a, VCDisplayStringProp, "beep!"); + } } |