diff --git a/calendar/libxpical/oeICalContainerImpl.cpp b/calendar/libxpical/oeICalContainerImpl.cpp index 9e69dd60a6ac..d6bacaf242d3 100644 --- a/calendar/libxpical/oeICalContainerImpl.cpp +++ b/calendar/libxpical/oeICalContainerImpl.cpp @@ -309,7 +309,7 @@ oeICalContainerImpl::AddCalendars( PRUint32 serverCount, const char **servers ) #ifdef ICAL_DEBUG printf( "oeICalContainerImpl::AddCalendars( %d, [Array] )\n", serverCount ); #endif - nsresult rv; + nsresult rv=NS_OK; for( unsigned int i=0; iReportError( severity, errorid, errorstring ); + return NS_OK; +} + /********************************************************************************************/ #include "nsIServiceManager.h" diff --git a/calendar/libxpical/oeICalImpl.cpp b/calendar/libxpical/oeICalImpl.cpp index 9fa5acc75406..71bdda1d1a1d 100644 --- a/calendar/libxpical/oeICalImpl.cpp +++ b/calendar/libxpical/oeICalImpl.cpp @@ -1473,7 +1473,7 @@ oeICalImpl::GetFirstEventsForRange( PRTime checkdateinms, PRTime checkenddateinm eventArray->GetElementAt( i, getter_AddRefs( tmpcomp ) ); oeIICalEvent* tmpevent = tmpcomp; bool isbeginning; - icaltimetype next = ((oeICalEventImpl *)tmpevent)->GetNextRecurrence( checkdate, nsnull ); + icaltimetype next = ((oeICalEventImpl *)tmpevent)->GetNextRecurrence( checkdate, &isbeginning ); bool isallday = next.is_date; next.is_date = false; if( !icaltime_is_null_time( next ) && (icaltime_compare( nextcheckdate, next ) == 0) ) { @@ -2052,6 +2052,47 @@ oeICalImpl::GetAllTodos(nsISimpleEnumerator **resultList ) return NS_OK; } +NS_IMETHODIMP oeICalImpl::ReportError( PRInt16 severity, PRUint32 errorid, const char *errorstring ) { + + if( severity >= ICAL_ERROR_PROBLEM ) { + #ifdef ICAL_DEBUG + printf( "oeICalImpl::ReportError(%d,%x) : %s\n", severity, errorid, errorstring ); + #endif + } else { + #ifdef ICAL_DEBUG_ALL + printf( "oeICalImpl::ReportError(%d,%x) : %s\n", severity, errorid, errorstring ); + #endif + } + + unsigned int i; + PRUint32 observercount; + m_observerlist->Count(&observercount); + for( i=0; iobserver; + m_observerlist->QueryElementAt( i, NS_GET_IID(oeIICalObserver), getter_AddRefs(observer)); + nsresult rv; + rv = observer->OnError( severity, errorid, errorstring ); + #ifdef ICAL_DEBUG + if( NS_FAILED( rv ) ) { + printf( "oeICalImpl::ReportError() : WARNING Call to observer's onError() unsuccessful: %x\n", rv ); + } + #endif + } + m_todoobserverlist->Count(&observercount); + for( i=0; iobserver; + m_todoobserverlist->QueryElementAt( i, NS_GET_IID(oeIICalTodoObserver), getter_AddRefs(observer)); + nsresult rv; + rv = observer->OnError( severity, errorid, errorstring ); + #ifdef ICAL_DEBUG + if( NS_FAILED( rv ) ) { + printf( "oeICalImpl::ReportError() : WARNING Call to observer's onError() unsuccessful: %x\n", rv ); + } + #endif + } + return NS_OK; +} + /*************************************************************************************************************/ /*************************************************************************************************************/ /*************************************************************************************************************/ @@ -2509,4 +2550,7 @@ NS_IMETHODIMP oeICalFilter::GetDuration(PRBool *is_negative, PRUint16 *weeks, PR return NS_ERROR_NOT_IMPLEMENTED; } +NS_IMETHODIMP oeICalFilter::ReportError( PRInt16 severity, PRUint32 errorid, const char *errorstring ) { + return NS_ERROR_NOT_IMPLEMENTED; +} diff --git a/calendar/libxpical/oeIICal.idl b/calendar/libxpical/oeIICal.idl index 6e13b6bcc29f..0507cc7ffef3 100644 --- a/calendar/libxpical/oeIICal.idl +++ b/calendar/libxpical/oeIICal.idl @@ -150,6 +150,8 @@ interface oeIICalEvent : nsISupports void addContact(in nsIAbCard contact); void removeContact(in nsIAbCard contact); void removeContacts(); + + void reportError( in short severity, in unsigned long errorid, in string errorstring ); }; [scriptable, uuid(f95df40e-0d5f-49ec-9ba8-4b88d3eb53e0)] @@ -180,6 +182,7 @@ interface oeIICalObserver : nsISupports void onModifyItem( in oeIICalEvent e, in oeIICalEvent olde ); void onDeleteItem( in oeIICalEvent e); void onAlarm( in oeIICalEventDisplay e); + void onError( in short severity, in unsigned long errorid, in string errorstring ); }; [scriptable, uuid(7a4fd625-69a8-4008-932e-cccc227b402c)] @@ -192,11 +195,17 @@ interface oeIICalTodoObserver : nsISupports void onModifyItem( in oeIICalTodo e, in oeIICalTodo olde ); void onDeleteItem( in oeIICalTodo e); void onAlarm( in oeIICalTodo e); + void onError( in short severity, in unsigned long errorid, in string errorstring ); }; [scriptable, uuid(981ab93d-ad51-45bb-a4a2-e158c2cfdeb4)] interface oeIICal : nsISupports { + const long ICAL_ERROR_DEBUG = 0; + const long ICAL_ERROR_WARN = 1; + const long ICAL_ERROR_PROBLEM = 1; + const long ICAL_ERROR_CRITICAL = 1; + void Test(); attribute boolean batchMode; @@ -227,6 +236,7 @@ interface oeIICal : nsISupports nsISimpleEnumerator getAllTodos(); void resetFilter(); + void reportError( in short severity, in unsigned long errorid, in string errorstring ); }; [scriptable, uuid(c89ec938-f690-4f62-a4b3-11e962ba2314)] diff --git a/calendar/resources/content/calendarEvent.js b/calendar/resources/content/calendarEvent.js index 4796cf882fbb..45c23b795afe 100644 --- a/calendar/resources/content/calendarEvent.js +++ b/calendar/resources/content/calendarEvent.js @@ -87,6 +87,7 @@ onModifyItem : function( calendarEvent, originalEvent ) {}, onDeleteItem : function( calendarEvent ) {}, onAlarm : function( calendarEvent ) {}, + onError : function() {}, }; These methods are now called synchronously, if you add an event the onAddItem @@ -684,6 +685,7 @@ CalendarAlarmObserver.prototype.onLoad = function( calendarEvent ){} CalendarAlarmObserver.prototype.onAddItem = function( calendarEvent ){} CalendarAlarmObserver.prototype.onModifyItem = function( calendarEvent, originalEvent ){} CalendarAlarmObserver.prototype.onDeleteItem = function( calendarEvent ){} +CalendarAlarmObserver.prototype.onError = function(){} CalendarAlarmObserver.prototype.onAlarm = function calAlarm_onAlarm( calendarEvent ) { diff --git a/calendar/resources/content/calendarWindow.js b/calendar/resources/content/calendarWindow.js index 6fc25baa12be..b2027726acdd 100644 --- a/calendar/resources/content/calendarWindow.js +++ b/calendar/resources/content/calendarWindow.js @@ -200,6 +200,9 @@ function CalendarWindow( ) onAlarm : function( calendarEvent ) { + }, + onError : function() + { } }; diff --git a/calendar/resources/content/test/testCalendarEvent.js b/calendar/resources/content/test/testCalendarEvent.js index a0757d96dc18..c5bf5dd961c1 100644 --- a/calendar/resources/content/test/testCalendarEvent.js +++ b/calendar/resources/content/test/testCalendarEvent.js @@ -282,9 +282,11 @@ function testAdd( ) onDeleteItem : function( calendarEvent ) { + }, + + onError : function() + { } - - }; var ds = new CalendarEventDataSource( calendarObserver, "/tmp/" ); @@ -332,6 +334,10 @@ function testAddDelete( owner ) { testAddDeleteObject.deletedEvent = calendarEvent; testAddDeleteObject.done = true; + }, + + onError : function() + { } @@ -473,6 +479,10 @@ function testModify( owner ) { testModifyObject.deletedEvent = calendarEvent; testModifyObject.done = true; + }, + + onError : function() + { } }; @@ -696,6 +706,10 @@ function testAlarm( owner ) testAlarmObject.alarmEvent = calendarEvent; } }, + + onError : function() + { + } }; @@ -846,6 +860,10 @@ function testGetDay( owner ) { testGetDayObject.deletedEvent = calendarEvent; --testGetDayObject.done; + }, + + onError : function() + { } }; @@ -1068,6 +1086,10 @@ function testGetById( owner ) { testGetByIdObject.deletedEvent = calendarEvent; testGetByIdObject.done = true; + }, + + onError : function() + { } }; diff --git a/calendar/resources/content/unifinder.js b/calendar/resources/content/unifinder.js index 0e6d6a61d8ce..36733e567b64 100644 --- a/calendar/resources/content/unifinder.js +++ b/calendar/resources/content/unifinder.js @@ -181,6 +181,9 @@ var unifinderEventDataSourceObserver = onAlarm : function( calendarEvent ) { + }, + onError : function() + { } }; diff --git a/calendar/resources/content/unifinderToDo.js b/calendar/resources/content/unifinderToDo.js index 0c4e4f57584f..28fe850e9658 100644 --- a/calendar/resources/content/unifinderToDo.js +++ b/calendar/resources/content/unifinderToDo.js @@ -94,6 +94,10 @@ var unifinderToDoDataSourceObserver = onAlarm : function( calendarToDo ) { + }, + + onError : function() + { } };