Fixed bug 155757: Parse error in ics file for TODO's because DTSTART is invalid

This commit is contained in:
mostafah%oeone.com 2002-07-04 14:00:10 +00:00
parent 7cad1ecc84
commit 088eecb485
2 changed files with 27 additions and 19 deletions

View File

@ -1787,7 +1787,7 @@ icalcomponent* oeICalEventImpl::AsIcalComponent()
}
//Create enddate if does not exist
if( icaltime_is_null_time( m_end->m_datetime ) ) {
if( icaltime_is_null_time( m_end->m_datetime ) && !icaltime_is_null_time( m_start->m_datetime ) ) {
//Set to the same as start date 23:59
m_end->m_datetime = m_start->m_datetime;
m_end->SetHour( 23 ); m_end->SetMinute( 59 );
@ -1921,21 +1921,24 @@ icalcomponent* oeICalEventImpl::AsIcalComponent()
}
//startdate
if( m_allday ) {
m_start->SetHour( 0 );
m_start->SetMinute( 0 );
if( m_start && !icaltime_is_null_time( m_start->m_datetime ) ) {
if( m_allday ) {
m_start->SetHour( 0 );
m_start->SetMinute( 0 );
}
prop = icalproperty_new_dtstart( m_start->m_datetime );
icalcomponent_add_property( vevent, prop );
}
prop = icalproperty_new_dtstart( m_start->m_datetime );
icalcomponent_add_property( vevent, prop );
//enddate
if( m_allday ) {
m_end->SetHour( 23 );
m_end->SetMinute( 59 );
if( m_end && !icaltime_is_null_time( m_end->m_datetime ) ) {
//enddate
if( m_allday ) {
m_end->SetHour( 23 );
m_end->SetMinute( 59 );
}
prop = icalproperty_new_dtend( m_end->m_datetime );
icalcomponent_add_property( vevent, prop );
}
prop = icalproperty_new_dtend( m_end->m_datetime );
icalcomponent_add_property( vevent, prop );
//snoozetimes
icalcomponent *tmpcomp=NULL;
@ -1984,7 +1987,6 @@ icalcomponent* oeICalEventImpl::AsIcalComponent()
}
}
//add event to newcalendar
icalcomponent_add_component( newcalendar, vevent );
return newcalendar;

View File

@ -286,9 +286,12 @@ icalcomponent* oeICalTodoImpl::AsIcalComponent()
}
//percent
prop = icalproperty_new_percentcomplete( m_percent );
icalcomponent_add_property( vtodo, prop );
if( m_percent ) {
prop = icalproperty_new_percentcomplete( m_percent );
icalcomponent_add_property( vtodo, prop );
}
/* This isn't really needed
//Create due if does not exist
if( icaltime_is_null_time( m_due->m_datetime ) ) {
prop = icalcomponent_get_first_property( vtodo, ICAL_DTSTART_PROPERTY );
@ -299,15 +302,18 @@ icalcomponent* oeICalTodoImpl::AsIcalComponent()
}
}
//due
PRBool m_allday;
GetAllDay ( &m_allday );
if( m_allday ) {
m_due->SetHour( 23 );
m_due->SetMinute( 59 );
}*/
//due
if( m_due && !icaltime_is_null_time( m_due->m_datetime ) ) {
prop = icalproperty_new_due( m_due->m_datetime );
icalcomponent_add_property( vtodo, prop );
}
prop = icalproperty_new_due( m_due->m_datetime );
icalcomponent_add_property( vtodo, prop );
//completed
if( m_completed && !icaltime_is_null_time( m_completed->m_datetime ) ) {