mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 16:22:00 +00:00
Removed using seperate object for getting display dates. Using EventDisplay object instead.
This commit is contained in:
parent
31487cb0c9
commit
22c287e6fc
@ -418,7 +418,7 @@ oeICalContainerImpl::GetAllEvents(nsISimpleEnumerator **resultList )
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
oeICalContainerImpl::GetEventsForMonth( PRTime datems, nsISimpleEnumerator **datelist, nsISimpleEnumerator **eventlist ) {
|
||||
oeICalContainerImpl::GetEventsForMonth( PRTime datems, nsISimpleEnumerator **eventlist ) {
|
||||
#ifdef ICAL_DEBUG
|
||||
printf( "oeICalContainerImpl::GetEventsForMonth()\n" );
|
||||
#endif
|
||||
@ -427,13 +427,7 @@ oeICalContainerImpl::GetEventsForMonth( PRTime datems, nsISimpleEnumerator **dat
|
||||
if (!eventEnum)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<oeDateEnumerator> dateEnum = new oeDateEnumerator( );
|
||||
|
||||
if (!dateEnum)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
eventEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)eventlist);
|
||||
dateEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)datelist);
|
||||
|
||||
PRUint32 num;
|
||||
unsigned int i;
|
||||
@ -443,14 +437,14 @@ oeICalContainerImpl::GetEventsForMonth( PRTime datems, nsISimpleEnumerator **dat
|
||||
{
|
||||
oeIICal* calendar;
|
||||
m_calendarArray->GetElementAt( i, (nsISupports **)&calendar );
|
||||
calendar->GetEventsForMonth( datems, (nsISimpleEnumerator **)&dateEnum, (nsISimpleEnumerator **)&eventEnum );
|
||||
calendar->GetEventsForMonth( datems, (nsISimpleEnumerator **)&eventEnum );
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
oeICalContainerImpl::GetEventsForWeek( PRTime datems, nsISimpleEnumerator **datelist, nsISimpleEnumerator **eventlist ) {
|
||||
oeICalContainerImpl::GetEventsForWeek( PRTime datems, nsISimpleEnumerator **eventlist ) {
|
||||
#ifdef ICAL_DEBUG
|
||||
printf( "oeICalContainerImpl::GetEventsForWeek()\n" );
|
||||
#endif
|
||||
@ -459,13 +453,7 @@ oeICalContainerImpl::GetEventsForWeek( PRTime datems, nsISimpleEnumerator **date
|
||||
if (!eventEnum)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<oeDateEnumerator> dateEnum = new oeDateEnumerator( );
|
||||
|
||||
if (!dateEnum)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
eventEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)eventlist);
|
||||
dateEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)datelist);
|
||||
|
||||
PRUint32 num;
|
||||
unsigned int i;
|
||||
@ -475,13 +463,13 @@ oeICalContainerImpl::GetEventsForWeek( PRTime datems, nsISimpleEnumerator **date
|
||||
{
|
||||
oeIICal* calendar;
|
||||
m_calendarArray->GetElementAt( i, (nsISupports **)&calendar );
|
||||
calendar->GetEventsForWeek( datems, (nsISimpleEnumerator **)&dateEnum, (nsISimpleEnumerator **)&eventEnum );
|
||||
calendar->GetEventsForWeek( datems, (nsISimpleEnumerator **)&eventEnum );
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
oeICalContainerImpl::GetEventsForDay( PRTime datems, nsISimpleEnumerator **datelist, nsISimpleEnumerator **eventlist ) {
|
||||
oeICalContainerImpl::GetEventsForDay( PRTime datems, nsISimpleEnumerator **eventlist ) {
|
||||
#ifdef ICAL_DEBUG
|
||||
printf( "oeICalContainerImpl::GetEventsForDay()\n" );
|
||||
#endif
|
||||
@ -491,13 +479,7 @@ oeICalContainerImpl::GetEventsForDay( PRTime datems, nsISimpleEnumerator **datel
|
||||
if (!eventEnum)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<oeDateEnumerator> dateEnum = new oeDateEnumerator( );
|
||||
|
||||
if (!dateEnum)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
eventEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)eventlist);
|
||||
dateEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)datelist);
|
||||
|
||||
PRUint32 num;
|
||||
unsigned int i;
|
||||
@ -507,13 +489,13 @@ oeICalContainerImpl::GetEventsForDay( PRTime datems, nsISimpleEnumerator **datel
|
||||
{
|
||||
oeIICal* calendar;
|
||||
m_calendarArray->GetElementAt( i, (nsISupports **)&calendar );
|
||||
calendar->GetEventsForDay( datems, (nsISimpleEnumerator **)&dateEnum, (nsISimpleEnumerator **)&eventEnum );
|
||||
calendar->GetEventsForDay( datems, (nsISimpleEnumerator **)&eventEnum );
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
oeICalContainerImpl::GetEventsForRange( PRTime checkdateinms, PRTime checkenddateinms, nsISimpleEnumerator **datelist, nsISimpleEnumerator **eventlist ) {
|
||||
oeICalContainerImpl::GetEventsForRange( PRTime checkdateinms, PRTime checkenddateinms, nsISimpleEnumerator **eventlist ) {
|
||||
#ifdef ICAL_DEBUG_ALL
|
||||
printf( "oeICalContainerImpl::GetEventsForRange()\n" );
|
||||
#endif
|
||||
@ -523,13 +505,7 @@ oeICalContainerImpl::GetEventsForRange( PRTime checkdateinms, PRTime checkenddat
|
||||
if (!eventEnum)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<oeDateEnumerator> dateEnum = new oeDateEnumerator( );
|
||||
|
||||
if (!dateEnum)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
eventEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)eventlist);
|
||||
dateEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)datelist);
|
||||
|
||||
PRUint32 num;
|
||||
unsigned int i;
|
||||
@ -539,7 +515,7 @@ oeICalContainerImpl::GetEventsForRange( PRTime checkdateinms, PRTime checkenddat
|
||||
{
|
||||
oeIICal* calendar;
|
||||
m_calendarArray->GetElementAt( i, (nsISupports **)&calendar );
|
||||
calendar->GetEventsForRange( checkdateinms, checkenddateinms, (nsISimpleEnumerator **)&dateEnum, (nsISimpleEnumerator **)&eventEnum );
|
||||
calendar->GetEventsForRange( checkdateinms, checkenddateinms, (nsISimpleEnumerator **)&eventEnum );
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -596,7 +572,7 @@ icaltimetype oeICalContainerImpl::GetNextEvent( icaltimetype starting ) {
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
oeICalContainerImpl::GetNextNEvents( PRTime datems, PRInt32 maxcount, nsISimpleEnumerator **datelist, nsISimpleEnumerator **eventlist ) {
|
||||
oeICalContainerImpl::GetNextNEvents( PRTime datems, PRInt32 maxcount, nsISimpleEnumerator **eventlist ) {
|
||||
#ifdef ICAL_DEBUG
|
||||
printf( "oeICalContainerImpl::GetNextNEvents( %d )\n", maxcount );
|
||||
#endif
|
||||
@ -606,13 +582,7 @@ oeICalContainerImpl::GetNextNEvents( PRTime datems, PRInt32 maxcount, nsISimpleE
|
||||
if (!eventEnum)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<oeDateEnumerator> dateEnum = new oeDateEnumerator( );
|
||||
|
||||
if (!dateEnum)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
eventEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)eventlist);
|
||||
dateEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)datelist);
|
||||
|
||||
struct icaltimetype checkdate = ConvertFromPrtime( datems );
|
||||
icaltime_adjust( &checkdate, 0, 0, 0, -1 );
|
||||
@ -633,13 +603,13 @@ oeICalContainerImpl::GetNextNEvents( PRTime datems, PRInt32 maxcount, nsISimpleE
|
||||
EventList *tmplistptr = calendar->GetEventList();
|
||||
while( tmplistptr && count<maxcount ) {
|
||||
if( tmplistptr->event ) {
|
||||
bool isbeginning,isallday;
|
||||
oeIICalEvent* tmpevent = tmplistptr->event;
|
||||
icaltimetype next = ((oeICalEventImpl *)tmpevent)->GetNextRecurrence( checkdate, nsnull );
|
||||
icaltimetype next = ((oeICalEventImpl *)tmpevent)->GetNextRecurrence( checkdate, &isbeginning );
|
||||
isallday = next.is_date;
|
||||
next.is_date = false;
|
||||
if( !icaltime_is_null_time( next ) && (icaltime_compare( nextcheckdate, next ) == 0) ) {
|
||||
eventEnum->AddEvent( tmpevent );
|
||||
PRTime nextdateinms = ConvertToPrtime( nextcheckdate );
|
||||
dateEnum->AddDate( nextdateinms );
|
||||
((oeICalEventImpl *)tmpevent)->ChopAndAddEventToEnum( nextcheckdate, eventlist, isallday, isbeginning );
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
@ -1584,6 +1584,53 @@ NS_IMETHODIMP oeICalEventImpl::GetDuration(PRBool *is_negative, PRUint16 *weeks,
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void oeICalEventImpl::ChopAndAddEventToEnum( struct icaltimetype startdate, nsISimpleEnumerator **eventlist,
|
||||
bool isallday, bool isbeginning ) {
|
||||
|
||||
nsCOMPtr<oeEventEnumerator> eventEnum;
|
||||
eventEnum = (oeEventEnumerator *)*eventlist;
|
||||
|
||||
oeIICalEventDisplay* eventDisplay;
|
||||
nsresult rv = NS_NewICalEventDisplay( this, &eventDisplay );
|
||||
if( NS_FAILED( rv ) ) {
|
||||
#ifdef ICAL_DEBUG
|
||||
printf( "oeICalEventImpl::ChopAndAddEventToEnum() : WARNING Cannot create oeIICalEventDisplay instance: %x\n", rv );
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
eventEnum->AddEvent( eventDisplay );
|
||||
|
||||
PRTime startdateinms = ConvertToPrtime( startdate );
|
||||
eventDisplay->SetDisplayDate( startdateinms );
|
||||
|
||||
struct icaltimetype endofday = startdate;
|
||||
endofday.hour = 23; endofday.minute = 59; endofday.second = 59;
|
||||
|
||||
PRTime enddateinms;
|
||||
if( isallday ) {
|
||||
enddateinms = ConvertToPrtime( endofday );
|
||||
eventDisplay->SetDisplayEndDate( enddateinms );
|
||||
} else {
|
||||
if( isbeginning ) {
|
||||
struct icaldurationtype eventlength = icaltime_subtract( m_end->m_datetime, m_start->m_datetime );
|
||||
struct icaltimetype eventenddate = icaltime_add( startdate, eventlength );
|
||||
|
||||
if( icaltime_compare( endofday, eventenddate ) < 0 ) {
|
||||
enddateinms = ConvertToPrtime( endofday );
|
||||
} else {
|
||||
enddateinms = ConvertToPrtime( eventenddate );
|
||||
}
|
||||
} else {
|
||||
struct icaltimetype eventenddate = endofday;
|
||||
eventenddate.hour = m_end->m_datetime.hour;
|
||||
eventenddate.minute = m_end->m_datetime.minute;
|
||||
eventenddate.second = m_end->m_datetime.second;
|
||||
enddateinms = ConvertToPrtime( eventenddate );
|
||||
}
|
||||
eventDisplay->SetDisplayEndDate( enddateinms );
|
||||
}
|
||||
}
|
||||
|
||||
bool oeICalEventImpl::ParseIcalComponent( icalcomponent *comp )
|
||||
{
|
||||
#ifdef ICAL_DEBUG_ALL
|
||||
|
@ -116,6 +116,8 @@ public:
|
||||
icaltimetype GetPreviousOccurrence( icaltimetype beforethis );
|
||||
NS_IMETHODIMP SetParent( oeIICal *parent );
|
||||
icaltimetype CalculateEventTime( icaltimetype alarmtime );
|
||||
void ChopAndAddEventToEnum( struct icaltimetype startdate, nsISimpleEnumerator **eventlist,
|
||||
bool isallday, bool isbeginning );
|
||||
private:
|
||||
char *m_id;
|
||||
char *m_syncid;
|
||||
|
@ -1268,7 +1268,7 @@ oeICalImpl::GetAllEvents(nsISimpleEnumerator **resultList )
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
oeICalImpl::GetEventsForMonth( PRTime datems, nsISimpleEnumerator **datelist, nsISimpleEnumerator **eventlist ) {
|
||||
oeICalImpl::GetEventsForMonth( PRTime datems, nsISimpleEnumerator **eventlist ) {
|
||||
#ifdef ICAL_DEBUG
|
||||
printf( "oeICalImpl::GetEventsForMonth()\n" );
|
||||
#endif
|
||||
@ -1295,11 +1295,11 @@ oeICalImpl::GetEventsForMonth( PRTime datems, nsISimpleEnumerator **datelist, ns
|
||||
#endif
|
||||
PRTime checkenddateinms = ConvertToPrtime( checkenddate );
|
||||
|
||||
return GetEventsForRange(checkdateinms ,checkenddateinms ,datelist ,eventlist );
|
||||
return GetEventsForRange(checkdateinms ,checkenddateinms, eventlist );
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
oeICalImpl::GetEventsForWeek( PRTime datems, nsISimpleEnumerator **datelist, nsISimpleEnumerator **eventlist ) {
|
||||
oeICalImpl::GetEventsForWeek( PRTime datems, nsISimpleEnumerator **eventlist ) {
|
||||
#ifdef ICAL_DEBUG
|
||||
printf( "oeICalImpl::GetEventsForWeek()\n" );
|
||||
#endif
|
||||
@ -1318,11 +1318,11 @@ oeICalImpl::GetEventsForWeek( PRTime datems, nsISimpleEnumerator **datelist, nsI
|
||||
icaltime_adjust( &checkenddate, 7, 0 , 0, 0 );
|
||||
PRTime checkenddateinms = ConvertToPrtime( checkenddate );
|
||||
|
||||
return GetEventsForRange(checkdateinms ,checkenddateinms ,datelist ,eventlist );
|
||||
return GetEventsForRange(checkdateinms ,checkenddateinms, eventlist );
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
oeICalImpl::GetEventsForDay( PRTime datems, nsISimpleEnumerator **datelist, nsISimpleEnumerator **eventlist ) {
|
||||
oeICalImpl::GetEventsForDay( PRTime datems, nsISimpleEnumerator **eventlist ) {
|
||||
#ifdef ICAL_DEBUG
|
||||
printf( "oeICalImpl::GetEventsForDay()\n" );
|
||||
#endif
|
||||
@ -1341,63 +1341,11 @@ oeICalImpl::GetEventsForDay( PRTime datems, nsISimpleEnumerator **datelist, nsIS
|
||||
icaltime_adjust( &checkenddate, 1, 0, 0, 0 );
|
||||
PRTime checkenddateinms = ConvertToPrtime( checkenddate );
|
||||
|
||||
return GetEventsForRange(checkdateinms ,checkenddateinms ,datelist ,eventlist );
|
||||
}
|
||||
|
||||
void oeICalImpl::ChopAndAddEventToEnum( struct icaltimetype startdate,
|
||||
nsISimpleEnumerator **eventlist, oeICalEventImpl* event, bool isallday, bool isbeginning ) {
|
||||
|
||||
nsCOMPtr<oeEventEnumerator> eventEnum;
|
||||
eventEnum = (oeEventEnumerator *)*eventlist;
|
||||
|
||||
oeIICalEventDisplay* eventDisplay;
|
||||
nsresult rv = NS_NewICalEventDisplay( event, &eventDisplay );
|
||||
if( NS_FAILED( rv ) ) {
|
||||
#ifdef ICAL_DEBUG
|
||||
printf( "oeICalImpl::ChopAndAddEventToEnum() : WARNING Cannot create oeIICalEventDisplay instance: %x\n", rv );
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
eventEnum->AddEvent( eventDisplay );
|
||||
|
||||
PRTime startdateinms = ConvertToPrtime( startdate );
|
||||
eventDisplay->SetDisplayDate( startdateinms );
|
||||
|
||||
struct icaltimetype endofday = startdate;
|
||||
endofday.hour = 23; endofday.minute = 59; endofday.second = 59;
|
||||
|
||||
PRTime enddateinms;
|
||||
if( isallday ) {
|
||||
enddateinms = ConvertToPrtime( endofday );
|
||||
eventDisplay->SetDisplayEndDate( enddateinms );
|
||||
} else {
|
||||
oeIDateTime *end;
|
||||
event->GetEnd( &end );
|
||||
if( isbeginning ) {
|
||||
oeIDateTime *start;
|
||||
event->GetStart( &start );
|
||||
|
||||
struct icaldurationtype eventlength = icaltime_subtract( ((oeDateTimeImpl *)end)->m_datetime, ((oeDateTimeImpl *)start)->m_datetime );
|
||||
struct icaltimetype eventenddate = icaltime_add( startdate, eventlength );
|
||||
|
||||
if( icaltime_compare( endofday, eventenddate ) < 0 ) {
|
||||
enddateinms = ConvertToPrtime( endofday );
|
||||
} else {
|
||||
enddateinms = ConvertToPrtime( eventenddate );
|
||||
}
|
||||
} else {
|
||||
struct icaltimetype eventenddate = endofday;
|
||||
eventenddate.hour = ((oeDateTimeImpl *)end)->m_datetime.hour;
|
||||
eventenddate.minute = ((oeDateTimeImpl *)end)->m_datetime.minute;
|
||||
eventenddate.second = ((oeDateTimeImpl *)end)->m_datetime.second;
|
||||
enddateinms = ConvertToPrtime( eventenddate );
|
||||
}
|
||||
eventDisplay->SetDisplayEndDate( enddateinms );
|
||||
}
|
||||
return GetEventsForRange(checkdateinms ,checkenddateinms, eventlist );
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
oeICalImpl::GetEventsForRange( PRTime checkdateinms, PRTime checkenddateinms, nsISimpleEnumerator **datelist, nsISimpleEnumerator **eventlist ) {
|
||||
oeICalImpl::GetEventsForRange( PRTime checkdateinms, PRTime checkenddateinms, nsISimpleEnumerator **eventlist ) {
|
||||
#ifdef ICAL_DEBUG_ALL
|
||||
printf( "oeICalImpl::GetEventsForRange()\n" );
|
||||
#endif
|
||||
@ -1411,15 +1359,6 @@ oeICalImpl::GetEventsForRange( PRTime checkdateinms, PRTime checkenddateinms, ns
|
||||
} else
|
||||
eventEnum = (oeEventEnumerator *)*eventlist;
|
||||
|
||||
nsCOMPtr<oeDateEnumerator> dateEnum;
|
||||
if( !*datelist ) {
|
||||
dateEnum = new oeDateEnumerator( );
|
||||
if (!dateEnum)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
dateEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)datelist);
|
||||
} else
|
||||
dateEnum = (oeDateEnumerator *)*datelist;
|
||||
|
||||
struct icaltimetype checkdate = ConvertFromPrtime( checkdateinms );
|
||||
icaltime_adjust( &checkdate, 0, 0, 0, -1 );
|
||||
|
||||
@ -1440,9 +1379,7 @@ oeICalImpl::GetEventsForRange( PRTime checkdateinms, PRTime checkenddateinms, ns
|
||||
bool isallday = next.is_date;
|
||||
next.is_date = false;
|
||||
if( !icaltime_is_null_time( next ) && (icaltime_compare( nextcheckdate, next ) == 0) ) {
|
||||
ChopAndAddEventToEnum( nextcheckdate, eventlist, (oeICalEventImpl *)tmpevent, isallday, isbeginning );
|
||||
PRTime nextdateinms = ConvertToPrtime( nextcheckdate );
|
||||
dateEnum->AddDate( nextdateinms );
|
||||
((oeICalEventImpl *)tmpevent)->ChopAndAddEventToEnum( nextcheckdate, eventlist, isallday, isbeginning );
|
||||
}
|
||||
}
|
||||
tmplistptr = tmplistptr->next;
|
||||
@ -1451,8 +1388,6 @@ oeICalImpl::GetEventsForRange( PRTime checkdateinms, PRTime checkenddateinms, ns
|
||||
}
|
||||
} while ( !icaltime_is_null_time( nextcheckdate ) );
|
||||
|
||||
// eventEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)eventlist);
|
||||
// dateEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)datelist);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1517,10 +1452,9 @@ oeICalImpl::GetFirstEventsForRange( PRTime checkdateinms, PRTime checkenddateinm
|
||||
next.is_date = false;
|
||||
if( !icaltime_is_null_time( next ) && (icaltime_compare( nextcheckdate, next ) == 0) ) {
|
||||
eventEnum->AddEvent( tmpevent );
|
||||
// PRTime nextdateinms = ConvertToPrtime( nextcheckdate );
|
||||
// dateEnum->AddDate( nextdateinms );
|
||||
eventArray->RemoveElementAt( i );
|
||||
icaltime_adjust( &nextcheckdate, 0, 0, 0, -1 );
|
||||
//TODO Create an eventdisplay object and asd displaydate & displayenddate to it
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1529,8 +1463,6 @@ oeICalImpl::GetFirstEventsForRange( PRTime checkdateinms, PRTime checkenddateinm
|
||||
} while ( !icaltime_is_null_time( nextcheckdate ) );
|
||||
|
||||
eventArray->Clear();
|
||||
// bump ref count
|
||||
// return eventEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)eventlist);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1556,20 +1488,19 @@ icaltimetype oeICalImpl::GetNextEvent( icaltimetype starting ) {
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
oeICalImpl::GetNextNEvents( PRTime datems, PRInt32 maxcount, nsISimpleEnumerator **datelist, nsISimpleEnumerator **eventlist ) {
|
||||
oeICalImpl::GetNextNEvents( PRTime datems, PRInt32 maxcount, nsISimpleEnumerator **eventlist ) {
|
||||
#ifdef ICAL_DEBUG
|
||||
printf( "oeICalImpl::GetNextNEvents( %d )\n", maxcount );
|
||||
#endif
|
||||
|
||||
nsCOMPtr<oeEventEnumerator> eventEnum = new oeEventEnumerator( );
|
||||
|
||||
if (!eventEnum)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsCOMPtr<oeDateEnumerator> dateEnum = new oeDateEnumerator( );
|
||||
|
||||
if (!dateEnum)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsCOMPtr<oeEventEnumerator> eventEnum;
|
||||
if( !*eventlist ) {
|
||||
eventEnum = new oeEventEnumerator();
|
||||
if (!eventEnum)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
eventEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)eventlist);
|
||||
} else
|
||||
eventEnum = (oeEventEnumerator *)*eventlist;
|
||||
|
||||
struct icaltimetype checkdate = ConvertFromPrtime( datems );
|
||||
icaltime_adjust( &checkdate, 0, 0, 0, -1 );
|
||||
@ -1582,13 +1513,13 @@ oeICalImpl::GetNextNEvents( PRTime datems, PRInt32 maxcount, nsISimpleEnumerator
|
||||
EventList *tmplistptr = &m_eventlist;
|
||||
while( tmplistptr && count<maxcount ) {
|
||||
if( tmplistptr->event ) {
|
||||
bool isbeginning,isallday;
|
||||
oeIICalEvent* tmpevent = tmplistptr->event;
|
||||
icaltimetype next = ((oeICalEventImpl *)tmpevent)->GetNextRecurrence( checkdate, nsnull );
|
||||
icaltimetype next = ((oeICalEventImpl *)tmpevent)->GetNextRecurrence( checkdate, &isbeginning );
|
||||
isallday = next.is_date;
|
||||
next.is_date = false;
|
||||
if( !icaltime_is_null_time( next ) && (icaltime_compare( nextcheckdate, next ) == 0) ) {
|
||||
eventEnum->AddEvent( tmpevent );
|
||||
PRTime nextdateinms = ConvertToPrtime( nextcheckdate );
|
||||
dateEnum->AddDate( nextdateinms );
|
||||
((oeICalEventImpl *)tmpevent)->ChopAndAddEventToEnum( nextcheckdate, eventlist, isallday, isbeginning );
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@ -1598,8 +1529,6 @@ oeICalImpl::GetNextNEvents( PRTime datems, PRInt32 maxcount, nsISimpleEnumerator
|
||||
}
|
||||
} while ( !icaltime_is_null_time( nextcheckdate ) && (count < maxcount) );
|
||||
|
||||
eventEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)eventlist);
|
||||
dateEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)datelist);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -211,12 +211,12 @@ interface oeIICal : nsISupports
|
||||
oeIICalEvent fetchEvent( in string id );
|
||||
// nsISimpleEnumerator searchBySQL( in string sqlstr );
|
||||
nsISimpleEnumerator getAllEvents();
|
||||
nsISimpleEnumerator getEventsForMonth(in PRTime date, out nsISimpleEnumerator datelist );
|
||||
nsISimpleEnumerator getEventsForWeek(in PRTime date, out nsISimpleEnumerator datelist );
|
||||
nsISimpleEnumerator getEventsForDay(in PRTime date, out nsISimpleEnumerator datelist );
|
||||
nsISimpleEnumerator getEventsForRange(in PRTime begindate, in PRTime enddate, out nsISimpleEnumerator datelist );
|
||||
nsISimpleEnumerator getNextNEvents(in PRTime begindate, in long count, out nsISimpleEnumerator datelist );
|
||||
nsISimpleEnumerator getFirstEventsForRange(in PRTime begindate, in PRTime enddate );
|
||||
nsISimpleEnumerator getEventsForMonth( in PRTime date );
|
||||
nsISimpleEnumerator getEventsForWeek( in PRTime date );
|
||||
nsISimpleEnumerator getEventsForDay( in PRTime date );
|
||||
nsISimpleEnumerator getEventsForRange( in PRTime begindate, in PRTime enddate );
|
||||
nsISimpleEnumerator getNextNEvents( in PRTime begindate, in long count );
|
||||
nsISimpleEnumerator getFirstEventsForRange( in PRTime begindate, in PRTime enddate );
|
||||
|
||||
string addTodo( in oeIICalTodo icaltodo );
|
||||
string modifyTodo( in oeIICalTodo icaltodo );
|
||||
@ -246,12 +246,12 @@ interface oeIICalContainer : nsISupports
|
||||
void deleteEvent( in string id );
|
||||
oeIICalEvent fetchEvent( in string id );
|
||||
nsISimpleEnumerator getAllEvents();
|
||||
nsISimpleEnumerator getEventsForMonth(in PRTime date, out nsISimpleEnumerator datelist );
|
||||
nsISimpleEnumerator getEventsForWeek(in PRTime date, out nsISimpleEnumerator datelist );
|
||||
nsISimpleEnumerator getEventsForDay(in PRTime date, out nsISimpleEnumerator datelist );
|
||||
nsISimpleEnumerator getEventsForRange(in PRTime begindate, in PRTime enddate, out nsISimpleEnumerator datelist );
|
||||
nsISimpleEnumerator getNextNEvents(in PRTime begindate, in long count, out nsISimpleEnumerator datelist );
|
||||
nsISimpleEnumerator getFirstEventsForRange(in PRTime begindate, in PRTime enddate );
|
||||
nsISimpleEnumerator getEventsForMonth( in PRTime date );
|
||||
nsISimpleEnumerator getEventsForWeek( in PRTime date );
|
||||
nsISimpleEnumerator getEventsForDay( in PRTime date );
|
||||
nsISimpleEnumerator getEventsForRange( in PRTime begindate, in PRTime enddate );
|
||||
nsISimpleEnumerator getNextNEvents( in PRTime begindate, in long count );
|
||||
nsISimpleEnumerator getFirstEventsForRange( in PRTime begindate, in PRTime enddate );
|
||||
|
||||
string addTodo( in oeIICalTodo icaltodo, in string server );
|
||||
string modifyTodo( in oeIICalTodo icaltodo );
|
||||
|
@ -262,9 +262,7 @@ CalendarEventDataSource.prototype.getEventsForDay = function calEvent_getEventsF
|
||||
{
|
||||
var eventDisplays = new Array();
|
||||
|
||||
var displayDates = new Object();
|
||||
|
||||
var eventList = this.gICalLib.getEventsForDay( date, displayDates );
|
||||
var eventList = this.gICalLib.getEventsForDay( date );
|
||||
|
||||
while( eventList.hasMoreElements() )
|
||||
{
|
||||
@ -302,21 +300,17 @@ CalendarEventDataSource.prototype.getEventsForWeek = function calEvent_getEvents
|
||||
{
|
||||
var eventDisplays = new Array();
|
||||
|
||||
var displayDates = new Object();
|
||||
|
||||
var eventList = this.gICalLib.getEventsForWeek( date, displayDates );
|
||||
var eventList = this.gICalLib.getEventsForWeek( date );
|
||||
|
||||
while( eventList.hasMoreElements() )
|
||||
{
|
||||
var tmpevent = eventList.getNext().QueryInterface(Components.interfaces.oeIICalEventDisplay);
|
||||
|
||||
var displayDate = new Date( displayDates.value.getNext().QueryInterface(Components.interfaces.nsISupportsPRTime).data );
|
||||
|
||||
var EventObject = new Object;
|
||||
|
||||
EventObject.event = tmpevent.event;
|
||||
|
||||
EventObject.displayDate = displayDate;
|
||||
EventObject.displayDate = new Date( tmpevent.displayDate );
|
||||
EventObject.displayEndDate = new Date( tmpevent.displayEndDate );
|
||||
|
||||
eventDisplays[ eventDisplays.length ] = EventObject;
|
||||
@ -342,9 +336,7 @@ CalendarEventDataSource.prototype.getEventsForMonth = function calEvent_getEvent
|
||||
{
|
||||
var eventDisplays = new Array();
|
||||
|
||||
var displayDates = new Object();
|
||||
|
||||
var eventList = this.gICalLib.getEventsForMonth( date, displayDates );
|
||||
var eventList = this.gICalLib.getEventsForMonth( date );
|
||||
|
||||
while( eventList.hasMoreElements() )
|
||||
{
|
||||
@ -372,9 +364,7 @@ CalendarEventDataSource.prototype.getNextEvents = function calEvent_getNextEvent
|
||||
|
||||
var today = new Date();
|
||||
|
||||
var displayDates = new Object();
|
||||
|
||||
var eventList = this.gICalLib.getNextNEvents( today, EventsToGet, displayDates );
|
||||
var eventList = this.gICalLib.getNextNEvents( today, EventsToGet );
|
||||
|
||||
while( eventList.hasMoreElements() )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user