Fixed Bug 172395 : Calendar should support duration

git-svn-id: svn://10.0.0.236/trunk@132323 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mostafah%oeone.com 2002-10-21 16:03:26 +00:00
parent 10062bfef3
commit c44c19db53
5 changed files with 64 additions and 8 deletions

View File

@ -1298,6 +1298,16 @@ NS_IMETHODIMP oeICalContainerFilter::ParseTodoIcalString(const nsACString& aNewV
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }
NS_IMETHODIMP oeICalContainerFilter::SetDuration(PRBool is_negative, PRUint16 weeks, PRUint16 days, PRUint16 hours, PRUint16 minutes, PRUint16 seconds)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP oeICalContainerFilter::GetDuration(PRBool *is_negative, PRUint16 *weeks, PRUint16 *days, PRUint16 *hours, PRUint16 *minutes, PRUint16 *seconds)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void oeICalContainerFilter::UpdateAllFilters( PRInt32 icaltype ) void oeICalContainerFilter::UpdateAllFilters( PRInt32 icaltype )
{ {
switch ( icaltype ) { switch ( icaltype ) {

View File

@ -267,6 +267,7 @@ oeICalEventImpl::oeICalEventImpl()
m_recurweekdays = 0; m_recurweekdays = 0;
m_recurweeknumber = 0; m_recurweeknumber = 0;
m_lastalarmack = icaltime_null_time(); m_lastalarmack = icaltime_null_time();
m_duration = icaldurationtype_null_duration();
SetAlarmUnits( DEFAULT_ALARM_UNITS ); SetAlarmUnits( DEFAULT_ALARM_UNITS );
SetRecurUnits( DEFAULT_RECUR_UNITS ); SetRecurUnits( DEFAULT_RECUR_UNITS );
SetSyncId( "" ); SetSyncId( "" );
@ -1483,6 +1484,22 @@ NS_IMETHODIMP oeICalEventImpl::RemoveContacts()
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP oeICalEventImpl::SetDuration(PRBool is_negative, PRUint16 weeks, PRUint16 days, PRUint16 hours, PRUint16 minutes, PRUint16 seconds)
{
#ifdef ICAL_DEBUG_ALL
printf( "oeICalEventImpl::SetDuration()\n" );
#endif
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP oeICalEventImpl::GetDuration(PRBool *is_negative, PRUint16 *weeks, PRUint16 *days, PRUint16 *hours, PRUint16 *minutes, PRUint16 *seconds)
{
#ifdef ICAL_DEBUG_ALL
printf( "oeICalEventImpl::GetDuration()\n" );
#endif
return NS_ERROR_NOT_IMPLEMENTED;
}
bool oeICalEventImpl::ParseIcalComponent( icalcomponent *comp ) bool oeICalEventImpl::ParseIcalComponent( icalcomponent *comp )
{ {
#ifdef ICAL_DEBUG_ALL #ifdef ICAL_DEBUG_ALL
@ -1781,16 +1798,30 @@ bool oeICalEventImpl::ParseIcalComponent( icalcomponent *comp )
m_start->m_datetime = icaltime_null_time(); m_start->m_datetime = icaltime_null_time();
} }
//enddate //duration
prop = icalcomponent_get_first_property( vevent, ICAL_DTEND_PROPERTY ); prop = icalcomponent_get_first_property( vevent, ICAL_DURATION_PROPERTY );
if ( prop != 0) { if ( prop != 0) {
icaltimetype end; m_duration = icalproperty_get_duration( prop );
end = icalproperty_get_dtstart( prop );
m_end->m_datetime = end;
} else if( !icaltime_is_null_time( m_start->m_datetime ) ) {
m_end->m_datetime = m_start->m_datetime;
} else { } else {
m_end->m_datetime = icaltime_null_time(); m_duration = icaldurationtype_null_duration();
}
//enddate
if( icaldurationtype_is_null_duration( m_duration ) ) {
prop = icalcomponent_get_first_property( vevent, ICAL_DTEND_PROPERTY );
if ( prop != 0) {
m_end->m_datetime = icalproperty_get_dtend( prop );
} else if( !icaltime_is_null_time( m_start->m_datetime ) ) {
m_end->m_datetime = m_start->m_datetime;
} else {
m_end->m_datetime = icaltime_null_time();
}
} else {
if( !icaltime_is_null_time( m_start->m_datetime ) ) {
m_end->m_datetime = icaltime_add( m_start->m_datetime, m_duration );
} else {
m_end->m_datetime = icaltime_null_time();
}
} }
//stampdate //stampdate

View File

@ -141,6 +141,7 @@ private:
char *m_recurunits; char *m_recurunits;
short m_recurweekdays; short m_recurweekdays;
short m_recurweeknumber; short m_recurweeknumber;
icaldurationtype m_duration;
oeDateTimeImpl *m_start; oeDateTimeImpl *m_start;
oeDateTimeImpl *m_end; oeDateTimeImpl *m_end;
oeDateTimeImpl *m_stamp; oeDateTimeImpl *m_stamp;

View File

@ -2440,4 +2440,14 @@ NS_IMETHODIMP oeICalFilter::ParseTodoIcalString(const nsACString& aNewVal, PRBoo
{ {
return NS_ERROR_NOT_IMPLEMENTED; return NS_ERROR_NOT_IMPLEMENTED;
} }
NS_IMETHODIMP oeICalFilter::SetDuration(PRBool is_negative, PRUint16 weeks, PRUint16 days, PRUint16 hours, PRUint16 minutes, PRUint16 seconds)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP oeICalFilter::GetDuration(PRBool *is_negative, PRUint16 *weeks, PRUint16 *days, PRUint16 *hours, PRUint16 *minutes, PRUint16 *seconds)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@ -121,6 +121,10 @@ interface oeIICalEvent : nsISupports
attribute short priority; attribute short priority;
attribute eventMethodProperty method; attribute eventMethodProperty method;
attribute eventStatusProperty status; attribute eventStatusProperty status;
void setDuration( in boolean is_negative, in unsigned short weeks, in unsigned short days, in unsigned short hours,
in unsigned short minutes, in unsigned short seconds );
void getDuration( out boolean is_negative, out unsigned short weeks, out unsigned short days, out unsigned short hours,
out unsigned short minutes, out unsigned short seconds );
boolean getNextRecurrence( in PRTime begin, out PRTime result); boolean getNextRecurrence( in PRTime begin, out PRTime result);
boolean getPreviousOccurrence( in PRTime beforethis, out PRTime result); boolean getPreviousOccurrence( in PRTime beforethis, out PRTime result);
AUTF8String getIcalString(); AUTF8String getIcalString();