--- a/calendarui/globaldata/src/calenglobaldata.cpp Thu Jul 15 18:37:27 2010 +0300
+++ b/calendarui/globaldata/src/calenglobaldata.cpp Thu Aug 19 09:53:43 2010 +0300
@@ -304,6 +304,13 @@
delete iEntryViewCreation;
iEntryViewCreation = NULL;
}
+
+ if (iNewInstanceView)
+ {
+ delete iNewInstanceView;
+ iNewInstanceView = NULL;
+ iNewInstanceViewCreation = NULL;
+ }
if (iNewInstanceViewCreation)
{
@@ -311,12 +318,6 @@
iNewInstanceViewCreation = NULL;
}
- if (iNewInstanceView)
- {
- delete iNewInstanceView;
- iNewInstanceView = NULL;
- }
-
delete iContext;
if(iGlobalDataOwnsEntryView)
@@ -1064,17 +1065,17 @@
break;
case ECalenNotifyCalendarInfoCreated:
{
- HandleCalendarInfoCreatedL();
+ TRAP_IGNORE(HandleCalendarInfoCreatedL());
}
break;
case ECalenNotifyCalendarInfoUpdated:
{
- HandleCalendarInfoUpdatedL();
+ TRAP_IGNORE(HandleCalendarInfoUpdatedL());
}
break;
case ECalenNotifyCalendarFileDeleted:
{
- HandleCalendarFileDeletedL();
+ TRAP_IGNORE(HandleCalendarFileDeletedL());
}
break;
default:
@@ -1183,10 +1184,39 @@
if ( !aSuccess )
{
// Something has gone wrong
- delete iEntryViewCreation;
- delete iInstanceViewCreation;
- delete iNewEntryViewCreation;
- delete iNewInstanceViewCreation;
+ if (iEntryViewCreation)
+ {
+ delete iEntryViewCreation;
+ iEntryViewCreation = NULL;
+ }
+ if (iInstanceViewCreation)
+ {
+ delete iInstanceViewCreation;
+ iInstanceViewCreation = NULL;
+ }
+
+ if (iNewEntryViewCreation)
+ {
+ delete iNewEntryViewCreation;
+ iNewEntryViewCreation = NULL;
+
+ HBufC* fileName = iContext->GetCalendarFileNameL().AllocLC();
+ TInt index = iFileMappingArray.Find(*fileName,
+ CCalenGlobalData::CalenInfoIdentifierL);
+ CleanupStack::PopAndDestroy(fileName);
+
+ if (index != KErrNotFound)
+ {
+ iFileMappingArray[index]->SetEntryView(NULL);
+ }
+ }
+
+ if (iNewInstanceViewCreation)
+ {
+ delete iNewInstanceViewCreation;
+ iNewInstanceViewCreation = NULL;
+ }
+
}
else
{
@@ -1201,7 +1231,7 @@
if ( iNewEntryViewCreation )
{
- iNewEntryView = iEntryViewCreation;
+ iNewEntryView = iNewEntryViewCreation;
}
else if ( iNewInstanceViewCreation )
{
@@ -1626,13 +1656,15 @@
{
softDelete = pkgSoftDelete();
}
- if(!softDelete)
+ if( softDelete &&
+ calendarInfo->FileNameL().CompareF(CalSessionL().DefaultFileNameL()) )
{
- iCalendarInfoList.Append(calendarInfo);
+ // delete caleninfo except for default calendar.
+ delete calendarInfo;
}
else
{
- delete calendarInfo;
+ iCalendarInfoList.Append(calendarInfo);
}
}
CleanupStack::PopAndDestroy(calendarIterator);
@@ -1641,6 +1673,31 @@
}
// -----------------------------------------------------------------------------
+// CCalenGlobalData::UpdateCalendarListL
+// Update calendar list whenever CalendarInfoUpdated notification is received.
+// -----------------------------------------------------------------------------
+//
+void CCalenGlobalData::UpdateCalendarListL()
+ {
+ //Getting calendar name updated from calennotifier infochangednotification
+ HBufC* calendarNameUpdated = iContext->GetCalendarFileNameL().AllocLC();
+ TInt index = iFileMappingArray.Find( *calendarNameUpdated,
+ CCalenGlobalData::CalenInfoIdentifierL);
+
+ if(index != KErrNotFound)
+ {
+ CCalSession* session = iFileMappingArray[index]->GetSessionPtr();
+ for(TInt i=0; i<iCalendarInfoList.Count() ;i++)
+ {
+ if( !iCalendarInfoList[i]->FileNameL().CompareF(calendarNameUpdated->Des()))
+ {
+ iCalendarInfoList[i] = session->CalendarInfoL();
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy(calendarNameUpdated);
+ }
+// -----------------------------------------------------------------------------
// CCalenGlobalData::GetDefaultCalendarInfoL
// Get default calendar info
// -----------------------------------------------------------------------------
@@ -1756,10 +1813,10 @@
void CCalenGlobalData::HandleCalendarInfoUpdatedL()
{
TRACE_ENTRY_POINT;
-
- // reconstruct the calendar list using the iterator
- ConstructCalendarsListL();
-
+
+ //Update Calendar list.
+ UpdateCalendarListL();
+
TRACE_EXIT_POINT;
}