From 75d1358a1fd350b92a177e3a192ac75b2d845bb3 Mon Sep 17 00:00:00 2001 From: "mvl%exedo.nl" Date: Tue, 27 Jul 2004 20:59:40 +0000 Subject: [PATCH] Update GetAllTodos. Attempt to make it work for 1.7. bug 253319, r=mostafah --- calendar/libxpical/oeICalContainerImpl.cpp | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/calendar/libxpical/oeICalContainerImpl.cpp b/calendar/libxpical/oeICalContainerImpl.cpp index 9024883377bf..c1b650d9e364 100644 --- a/calendar/libxpical/oeICalContainerImpl.cpp +++ b/calendar/libxpical/oeICalContainerImpl.cpp @@ -300,12 +300,11 @@ oeICalContainerImpl::AddCalendar( const char *server, const char *type ) { } nsCAutoString contractid; - contractid.AssignLiteral("@mozilla.org/ical;1"); + contractid.Assign(NS_LITERAL_CSTRING("@mozilla.org/ical;1")); if (type && strlen(type)) { - contractid.AppendLiteral("?type="); + contractid.Append(NS_LITERAL_CSTRING("?type=")); contractid.Append(type); } - printf("\nContractID: %s\n\n",contractid.get()); calendar = do_CreateInstance(contractid.get(), &rv); if (NS_FAILED(rv)) { return NS_ERROR_FAILURE; @@ -1046,23 +1045,25 @@ oeICalContainerImpl::GetAllTodos(nsISimpleEnumerator **resultList ) #ifdef ICAL_DEBUG printf( "oeICalContainerImpl::GetAllTodos()\n" ); #endif - oeEventEnumerator* eventEnum = new oeEventEnumerator(); - - if (!eventEnum) - return NS_ERROR_OUT_OF_MEMORY; - - eventEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)resultList); - PRUint32 num; unsigned int i; + nsCOMArray listOfEnums; m_calendarArray->Count( &num ); for( i=0; i calendar; m_calendarArray->GetElementAt( i, getter_AddRefs( calendar ) ); - calendar->GetAllTodos( (nsISimpleEnumerator **)&eventEnum ); + nsCOMPtr eventEnum; + calendar->GetAllTodos( getter_AddRefs(eventEnum) ); + listOfEnums.AppendObject(eventEnum); } + + *resultList = new oeCollectedEventEnumerator(listOfEnums); + if (!*resultList) + return NS_ERROR_OUT_OF_MEMORY; + + NS_ADDREF(*resultList); return NS_OK; }