equal
deleted
inserted
replaced
76 for(TInt i = 0 ; i < iHandlers.Count() ; i++) |
76 for(TInt i = 0 ; i < iHandlers.Count() ; i++) |
77 { |
77 { |
78 iHandlers[i].iHashSet.Close(); |
78 iHandlers[i].iHashSet.Close(); |
79 } |
79 } |
80 |
80 |
81 iHandlers.Reset(); |
81 iHandlers.Close(); |
82 iBroadcastQueue.Reset(); |
82 |
83 |
83 iBroadcastQueue.Close(); |
84 if( iAsyncCallback ) |
84 |
85 { |
|
86 iAsyncCallback->Cancel(); |
|
87 delete iAsyncCallback; |
|
88 iAsyncCallback = NULL; |
|
89 } |
|
90 |
85 |
91 if( iFilnameDeleted ) |
86 if( iFilnameDeleted ) |
92 { |
87 { |
93 delete iFilnameDeleted; |
88 delete iFilnameDeleted; |
94 iFilnameDeleted = NULL; |
89 iFilnameDeleted = NULL; |
128 |
123 |
129 // Release the global data |
124 // Release the global data |
130 if( iGlobalData ) |
125 if( iGlobalData ) |
131 { |
126 { |
132 // stop listening for calendar file change notifications |
127 // stop listening for calendar file change notifications |
133 iGlobalData->CalSessionL().StopFileChangeNotification(); |
128 TRAP_IGNORE(iGlobalData->CalSessionL().StopFileChangeNotification()); |
134 iGlobalData->Release(); |
129 iGlobalData->Release(); |
135 } |
130 } |
136 TRACE_EXIT_POINT; |
131 TRACE_EXIT_POINT; |
137 } |
132 } |
138 |
133 |
169 iIgnoreFirstLocaleChange = ETrue; |
164 iIgnoreFirstLocaleChange = ETrue; |
170 |
165 |
171 // start listening for calendar file change notifications |
166 // start listening for calendar file change notifications |
172 iGlobalData->CalSessionL().StartFileChangeNotificationL(*this); |
167 iGlobalData->CalSessionL().StartFileChangeNotificationL(*this); |
173 |
168 |
174 TCallBack callback(CCalenNotifier::AsyncRemoveCalendarL,this); |
|
175 iAsyncCallback = new(ELeave) CAsyncCallBack(callback,CActive::EPriorityStandard); |
|
176 |
169 |
177 iFilnameDeleted = NULL; |
170 iFilnameDeleted = NULL; |
178 |
171 |
179 TRACE_EXIT_POINT; |
172 TRACE_EXIT_POINT; |
180 } |
173 } |
597 // ---------------------------------------------------------------------------- |
590 // ---------------------------------------------------------------------------- |
598 // |
591 // |
599 TBool CCalenNotifier::NotifyProgress() |
592 TBool CCalenNotifier::NotifyProgress() |
600 { |
593 { |
601 TRACE_ENTRY_POINT; |
594 TRACE_ENTRY_POINT; |
602 |
595 // No one interested in this notification.Removing to avoid notification clutter. |
603 BroadcastNotification( ECalenNotifyViewCreationStarted ); |
596 // BroadcastNotification( ECalenNotifyViewCreationStarted ); |
604 |
597 |
605 TRACE_EXIT_POINT; |
598 TRACE_EXIT_POINT; |
606 return EFalse; |
599 return EFalse; |
607 } |
600 } |
608 |
601 |
636 } |
629 } |
637 errorUi->ShowGlobalErrorNoteL( aStatus ); |
630 errorUi->ShowGlobalErrorNoteL( aStatus ); |
638 CleanupStack::PopAndDestroy( errorUi ); |
631 CleanupStack::PopAndDestroy( errorUi ); |
639 ); |
632 ); |
640 |
633 |
641 // Exit application |
634 // If Instance view creation is cancelled, no need to |
642 if (iAvkonAppUi) |
635 // exit application.All other errors exit application. |
643 { |
636 if(aStatus != KErrCancel) |
644 iAvkonAppUi->Exit(); |
637 { |
645 } |
638 // Exit application |
|
639 if (iAvkonAppUi) |
|
640 { |
|
641 iAvkonAppUi->Exit(); |
|
642 } |
|
643 } |
646 } |
644 } |
647 |
645 |
648 TRACE_EXIT_POINT; |
646 TRACE_EXIT_POINT; |
649 } |
647 } |
650 |
648 |
759 MCalFileChangeObserver::TChangeType changeType = |
757 MCalFileChangeObserver::TChangeType changeType = |
760 aCalendarInfoChangeEntries[index]->ChangeType(); |
758 aCalendarInfoChangeEntries[index]->ChangeType(); |
761 switch(changeType) |
759 switch(changeType) |
762 { |
760 { |
763 case MCalFileChangeObserver::ECalendarFileCreated: |
761 case MCalFileChangeObserver::ECalendarFileCreated: |
|
762 { |
|
763 TFileName lastCreatedFileName = aCalendarInfoChangeEntries[index]->FileNameL(); |
|
764 CRepository* cenRep = CRepository::NewLC(KCRUidCalendar); |
|
765 User::LeaveIfError( cenRep->Set( KCalendarLastUsedCalendar, lastCreatedFileName ) ); |
|
766 CleanupStack::PopAndDestroy( cenRep ); |
|
767 } |
764 case MCalFileChangeObserver::ECalendarInfoCreated: |
768 case MCalFileChangeObserver::ECalendarInfoCreated: |
765 { |
769 { |
766 BroadcastNotification(ECalenNotifyDeleteInstanceView); |
770 BroadcastNotification(ECalenNotifyDeleteInstanceView); |
767 BroadcastNotification(ECalenNotifyCalendarInfoCreated); |
771 BroadcastNotification(ECalenNotifyCalendarInfoCreated); |
768 } |
772 } |
796 TRAP(err,pkgMarkAsDelete.Set(calendarInfo->PropertyValueL(keyBuff))); |
800 TRAP(err,pkgMarkAsDelete.Set(calendarInfo->PropertyValueL(keyBuff))); |
797 markAsdelete = pkgMarkAsDelete(); |
801 markAsdelete = pkgMarkAsDelete(); |
798 |
802 |
799 CleanupStack::PopAndDestroy(calendarInfo); |
803 CleanupStack::PopAndDestroy(calendarInfo); |
800 |
804 |
801 if (err == KErrNone && markAsdelete) |
805 //remove calendar except default calendar |
|
806 if (err == KErrNone && markAsdelete |
|
807 && aCalendarInfoChangeEntries[index]->FileNameL().CompareF( |
|
808 iGlobalData->CalSessionL().DefaultFileNameL())) |
802 { |
809 { |
803 iFilnameDeleted = aCalendarInfoChangeEntries[index]->FileNameL().AllocL(); |
810 iFilnameDeleted = aCalendarInfoChangeEntries[index]->FileNameL().AllocL(); |
804 iAsyncCallback->CallBack(); |
811 BroadcastNotification(ECalenNotifyDeleteInstanceView); |
|
812 iGlobalData->RemoveCalendarL(iFilnameDeleted->Des()); |
|
813 BroadcastNotification(ECalenNotifyCalendarFileDeleted); |
|
814 |
|
815 delete iFilnameDeleted; |
|
816 iFilnameDeleted = NULL; |
805 } |
817 } |
806 else |
818 else |
807 { |
819 { |
808 BroadcastNotification(ECalenNotifyCalendarInfoUpdated); |
820 BroadcastNotification(ECalenNotifyCalendarInfoUpdated); |
809 } |
821 } |
816 } |
828 } |
817 |
829 |
818 TRACE_EXIT_POINT; |
830 TRACE_EXIT_POINT; |
819 } |
831 } |
820 |
832 |
821 // ---------------------------------------------------------------------------- |
833 |
822 // CCalenNotifier::AsyncRemoveCalendarL(TAny* aThisPtr) |
|
823 // ---------------------------------------------------------------------------- |
|
824 TInt CCalenNotifier::AsyncRemoveCalendarL(TAny* aThisPtr) |
|
825 { |
|
826 TRACE_ENTRY_POINT |
|
827 static_cast<CCalenNotifier*>(aThisPtr)->AsyncRemoveCalendarL(); |
|
828 TRACE_EXIT_POINT |
|
829 return 0; |
|
830 } |
|
831 |
|
832 // ---------------------------------------------------------------------------- |
|
833 // CCalenNotifier::AsyncRemoveCalendarL() |
|
834 // |
|
835 void CCalenNotifier::AsyncRemoveCalendarL() |
|
836 { |
|
837 TRACE_ENTRY_POINT |
|
838 BroadcastNotification(ECalenNotifyDeleteInstanceView); |
|
839 iGlobalData->RemoveCalendarL(iFilnameDeleted->Des()); |
|
840 BroadcastNotification(ECalenNotifyCalendarFileDeleted); |
|
841 |
|
842 delete iFilnameDeleted; |
|
843 iFilnameDeleted = NULL; |
|
844 TRACE_EXIT_POINT |
|
845 } |
|
846 // End of file |
834 // End of file |