Fixed Bug 172395 : Calendar should support duration

This commit is contained in:
mostafah%oeone.com 2002-10-21 16:03:26 +00:00
Родитель 47a5883afc
Коммит 4d47fe471a
5 изменённых файлов: 64 добавлений и 8 удалений

Просмотреть файл

@ -1298,6 +1298,16 @@ NS_IMETHODIMP oeICalContainerFilter::ParseTodoIcalString(const nsACString& aNewV
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 )
{
switch ( icaltype ) {

Просмотреть файл

@ -267,6 +267,7 @@ oeICalEventImpl::oeICalEventImpl()
m_recurweekdays = 0;
m_recurweeknumber = 0;
m_lastalarmack = icaltime_null_time();
m_duration = icaldurationtype_null_duration();
SetAlarmUnits( DEFAULT_ALARM_UNITS );
SetRecurUnits( DEFAULT_RECUR_UNITS );
SetSyncId( "" );
@ -1483,6 +1484,22 @@ NS_IMETHODIMP oeICalEventImpl::RemoveContacts()
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 )
{
#ifdef ICAL_DEBUG_ALL
@ -1781,16 +1798,30 @@ bool oeICalEventImpl::ParseIcalComponent( icalcomponent *comp )
m_start->m_datetime = icaltime_null_time();
}
//enddate
prop = icalcomponent_get_first_property( vevent, ICAL_DTEND_PROPERTY );
//duration
prop = icalcomponent_get_first_property( vevent, ICAL_DURATION_PROPERTY );
if ( prop != 0) {
icaltimetype end;
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;
m_duration = icalproperty_get_duration( prop );
} 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

Просмотреть файл

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

Просмотреть файл

@ -2440,4 +2440,14 @@ NS_IMETHODIMP oeICalFilter::ParseTodoIcalString(const nsACString& aNewVal, PRBoo
{
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;
}

Просмотреть файл

@ -121,6 +121,10 @@ interface oeIICalEvent : nsISupports
attribute short priority;
attribute eventMethodProperty method;
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 getPreviousOccurrence( in PRTime beforethis, out PRTime result);
AUTF8String getIcalString();