302 if (iEntryViewCreation) |
302 if (iEntryViewCreation) |
303 { |
303 { |
304 delete iEntryViewCreation; |
304 delete iEntryViewCreation; |
305 iEntryViewCreation = NULL; |
305 iEntryViewCreation = NULL; |
306 } |
306 } |
|
307 |
|
308 if (iNewInstanceView) |
|
309 { |
|
310 delete iNewInstanceView; |
|
311 iNewInstanceView = NULL; |
|
312 iNewInstanceViewCreation = NULL; |
|
313 } |
307 |
314 |
308 if (iNewInstanceViewCreation) |
315 if (iNewInstanceViewCreation) |
309 { |
316 { |
310 delete iNewInstanceViewCreation; |
317 delete iNewInstanceViewCreation; |
311 iNewInstanceViewCreation = NULL; |
318 iNewInstanceViewCreation = NULL; |
312 } |
|
313 |
|
314 if (iNewInstanceView) |
|
315 { |
|
316 delete iNewInstanceView; |
|
317 iNewInstanceView = NULL; |
|
318 } |
319 } |
319 |
320 |
320 delete iContext; |
321 delete iContext; |
321 |
322 |
322 if(iGlobalDataOwnsEntryView) |
323 if(iGlobalDataOwnsEntryView) |
1062 iCalendarForcedExit = ETrue; |
1063 iCalendarForcedExit = ETrue; |
1063 } |
1064 } |
1064 break; |
1065 break; |
1065 case ECalenNotifyCalendarInfoCreated: |
1066 case ECalenNotifyCalendarInfoCreated: |
1066 { |
1067 { |
1067 HandleCalendarInfoCreatedL(); |
1068 TRAP_IGNORE(HandleCalendarInfoCreatedL()); |
1068 } |
1069 } |
1069 break; |
1070 break; |
1070 case ECalenNotifyCalendarInfoUpdated: |
1071 case ECalenNotifyCalendarInfoUpdated: |
1071 { |
1072 { |
1072 HandleCalendarInfoUpdatedL(); |
1073 TRAP_IGNORE(HandleCalendarInfoUpdatedL()); |
1073 } |
1074 } |
1074 break; |
1075 break; |
1075 case ECalenNotifyCalendarFileDeleted: |
1076 case ECalenNotifyCalendarFileDeleted: |
1076 { |
1077 { |
1077 HandleCalendarFileDeletedL(); |
1078 TRAP_IGNORE(HandleCalendarFileDeletedL()); |
1078 } |
1079 } |
1079 break; |
1080 break; |
1080 default: |
1081 default: |
1081 break; |
1082 break; |
1082 } |
1083 } |
1181 TRACE_ENTRY_POINT; |
1182 TRACE_ENTRY_POINT; |
1182 |
1183 |
1183 if ( !aSuccess ) |
1184 if ( !aSuccess ) |
1184 { |
1185 { |
1185 // Something has gone wrong |
1186 // Something has gone wrong |
1186 delete iEntryViewCreation; |
1187 if (iEntryViewCreation) |
1187 delete iInstanceViewCreation; |
1188 { |
1188 delete iNewEntryViewCreation; |
1189 delete iEntryViewCreation; |
1189 delete iNewInstanceViewCreation; |
1190 iEntryViewCreation = NULL; |
|
1191 } |
|
1192 if (iInstanceViewCreation) |
|
1193 { |
|
1194 delete iInstanceViewCreation; |
|
1195 iInstanceViewCreation = NULL; |
|
1196 } |
|
1197 |
|
1198 if (iNewEntryViewCreation) |
|
1199 { |
|
1200 delete iNewEntryViewCreation; |
|
1201 iNewEntryViewCreation = NULL; |
|
1202 |
|
1203 HBufC* fileName = iContext->GetCalendarFileNameL().AllocLC(); |
|
1204 TInt index = iFileMappingArray.Find(*fileName, |
|
1205 CCalenGlobalData::CalenInfoIdentifierL); |
|
1206 CleanupStack::PopAndDestroy(fileName); |
|
1207 |
|
1208 if (index != KErrNotFound) |
|
1209 { |
|
1210 iFileMappingArray[index]->SetEntryView(NULL); |
|
1211 } |
|
1212 } |
|
1213 |
|
1214 if (iNewInstanceViewCreation) |
|
1215 { |
|
1216 delete iNewInstanceViewCreation; |
|
1217 iNewInstanceViewCreation = NULL; |
|
1218 } |
|
1219 |
1190 } |
1220 } |
1191 else |
1221 else |
1192 { |
1222 { |
1193 if ( iEntryViewCreation ) |
1223 if ( iEntryViewCreation ) |
1194 { |
1224 { |
1624 TRAPD(err,pkgSoftDelete.Set(calendarInfo->PropertyValueL(keyBuff))); |
1654 TRAPD(err,pkgSoftDelete.Set(calendarInfo->PropertyValueL(keyBuff))); |
1625 if( KErrNone == err ) |
1655 if( KErrNone == err ) |
1626 { |
1656 { |
1627 softDelete = pkgSoftDelete(); |
1657 softDelete = pkgSoftDelete(); |
1628 } |
1658 } |
1629 if(!softDelete) |
1659 if( softDelete && |
|
1660 calendarInfo->FileNameL().CompareF(CalSessionL().DefaultFileNameL()) ) |
|
1661 { |
|
1662 // delete caleninfo except for default calendar. |
|
1663 delete calendarInfo; |
|
1664 } |
|
1665 else |
1630 { |
1666 { |
1631 iCalendarInfoList.Append(calendarInfo); |
1667 iCalendarInfoList.Append(calendarInfo); |
1632 } |
1668 } |
1633 else |
|
1634 { |
|
1635 delete calendarInfo; |
|
1636 } |
|
1637 } |
1669 } |
1638 CleanupStack::PopAndDestroy(calendarIterator); |
1670 CleanupStack::PopAndDestroy(calendarIterator); |
1639 |
1671 |
1640 TRACE_EXIT_POINT; |
1672 TRACE_EXIT_POINT; |
1641 } |
1673 } |
1642 |
1674 |
|
1675 // ----------------------------------------------------------------------------- |
|
1676 // CCalenGlobalData::UpdateCalendarListL |
|
1677 // Update calendar list whenever CalendarInfoUpdated notification is received. |
|
1678 // ----------------------------------------------------------------------------- |
|
1679 // |
|
1680 void CCalenGlobalData::UpdateCalendarListL() |
|
1681 { |
|
1682 //Getting calendar name updated from calennotifier infochangednotification |
|
1683 HBufC* calendarNameUpdated = iContext->GetCalendarFileNameL().AllocLC(); |
|
1684 TInt index = iFileMappingArray.Find( *calendarNameUpdated, |
|
1685 CCalenGlobalData::CalenInfoIdentifierL); |
|
1686 |
|
1687 if(index != KErrNotFound) |
|
1688 { |
|
1689 CCalSession* session = iFileMappingArray[index]->GetSessionPtr(); |
|
1690 for(TInt i=0; i<iCalendarInfoList.Count() ;i++) |
|
1691 { |
|
1692 if( !iCalendarInfoList[i]->FileNameL().CompareF(calendarNameUpdated->Des())) |
|
1693 { |
|
1694 iCalendarInfoList[i] = session->CalendarInfoL(); |
|
1695 } |
|
1696 } |
|
1697 } |
|
1698 CleanupStack::PopAndDestroy(calendarNameUpdated); |
|
1699 } |
1643 // ----------------------------------------------------------------------------- |
1700 // ----------------------------------------------------------------------------- |
1644 // CCalenGlobalData::GetDefaultCalendarInfoL |
1701 // CCalenGlobalData::GetDefaultCalendarInfoL |
1645 // Get default calendar info |
1702 // Get default calendar info |
1646 // ----------------------------------------------------------------------------- |
1703 // ----------------------------------------------------------------------------- |
1647 // |
1704 // |
1754 // ----------------------------------------------------------------------------- |
1811 // ----------------------------------------------------------------------------- |
1755 // |
1812 // |
1756 void CCalenGlobalData::HandleCalendarInfoUpdatedL() |
1813 void CCalenGlobalData::HandleCalendarInfoUpdatedL() |
1757 { |
1814 { |
1758 TRACE_ENTRY_POINT; |
1815 TRACE_ENTRY_POINT; |
1759 |
1816 |
1760 // reconstruct the calendar list using the iterator |
1817 //Update Calendar list. |
1761 ConstructCalendarsListL(); |
1818 UpdateCalendarListL(); |
1762 |
1819 |
1763 TRACE_EXIT_POINT; |
1820 TRACE_EXIT_POINT; |
1764 } |
1821 } |
1765 |
1822 |
1766 // ----------------------------------------------------------------------------- |
1823 // ----------------------------------------------------------------------------- |
1767 // CCalenGlobalData::HandleCalendarFileDeletedL |
1824 // CCalenGlobalData::HandleCalendarFileDeletedL |