calendarui/controller/src/calennotifier.cpp
branchRCL_3
changeset 86 ed599363c2d7
parent 78 356f28cd5ca0
equal deleted inserted replaced
78:356f28cd5ca0 86:ed599363c2d7
    43 #include "CalendarPrivateCRKeys.h"    // Central Repository keys
    43 #include "CalendarPrivateCRKeys.h"    // Central Repository keys
    44 #include "calensetting.h"
    44 #include "calensetting.h"
    45 #include "calenstatemachine.h"
    45 #include "calenstatemachine.h"
    46 #include "calencontroller.h"
    46 #include "calencontroller.h"
    47 
    47 
       
    48 
    48 const TInt KHashLength = 64;
    49 const TInt KHashLength = 64;
    49 const TInt KBuffLength = 24;
    50 const TInt KBuffLength = 24;
    50 
    51 
    51 _LIT( KCalendarDatabaseFilePath, "c:calendar" );
    52 _LIT( KCalendarDatabaseFilePath, "c:calendar" );
       
    53 
    52 // ----------------------------------------------------------------------------
    54 // ----------------------------------------------------------------------------
    53 // CCalenNotifier::CCalenNotifier
    55 // CCalenNotifier::CCalenNotifier
    54 // C++ default constructor.
    56 // C++ default constructor.
    55 // (other items were commented in a header).
    57 // (other items were commented in a header).
    56 // ----------------------------------------------------------------------------
    58 // ----------------------------------------------------------------------------
    78         {
    80         {
    79         iHandlers[i].iHashSet.Close();
    81         iHandlers[i].iHashSet.Close();
    80         }
    82         }
    81     
    83     
    82     iHandlers.Close();
    84     iHandlers.Close();
    83   
    85     
       
    86     iBroadcastQueue.Close();
       
    87     
       
    88     
    84     if( iFilnameDeleted )
    89     if( iFilnameDeleted )
    85         {
    90         {
    86         delete iFilnameDeleted;
    91         delete iFilnameDeleted;
    87         iFilnameDeleted = NULL;
    92         iFilnameDeleted = NULL;
    88         }
    93         }
   121     
   126     
   122     // Release the global data
   127     // Release the global data
   123     if( iGlobalData )
   128     if( iGlobalData )
   124         {
   129         {
   125         // stop listening for calendar file change notifications
   130         // stop listening for calendar file change notifications
   126         TRAP_IGNORE(iGlobalData->CalSessionL().StopFileChangeNotification());
   131         iGlobalData->CalSessionL().StopFileChangeNotification();
   127         iGlobalData->Release();
   132         iGlobalData->Release();
   128         }
   133         }
   129     
   134 	TRACE_EXIT_POINT;
   130     iBroadcastQueue.Close();
       
   131 
       
   132     TRACE_EXIT_POINT;
       
   133 	}
   135 	}
   134 
   136 
   135 // ----------------------------------------------------------------------------
   137 // ----------------------------------------------------------------------------
   136 // CCalenNotifier::ConstructL
   138 // CCalenNotifier::ConstructL
   137 // Symbian 2nd phase of construction.
   139 // Symbian 2nd phase of construction.
   801                 TRAP(err,pkgMarkAsDelete.Set(calendarInfo->PropertyValueL(keyBuff)));
   803                 TRAP(err,pkgMarkAsDelete.Set(calendarInfo->PropertyValueL(keyBuff)));
   802                 markAsdelete = pkgMarkAsDelete();
   804                 markAsdelete = pkgMarkAsDelete();
   803 
   805 
   804                 CleanupStack::PopAndDestroy(calendarInfo);
   806                 CleanupStack::PopAndDestroy(calendarInfo);
   805 
   807 
   806                 //remove calendar except default calendar
       
   807                 if (err == KErrNone && markAsdelete && aCalendarInfoChangeEntries[index]->FileNameL().CompareF(
   808                 if (err == KErrNone && markAsdelete && aCalendarInfoChangeEntries[index]->FileNameL().CompareF(
   808                                KCalendarDatabaseFilePath))
   809                                KCalendarDatabaseFilePath))
   809                     {
   810                     {
   810                     iFilnameDeleted = aCalendarInfoChangeEntries[index]->FileNameL().AllocL();
   811                     iFilnameDeleted = aCalendarInfoChangeEntries[index]->FileNameL().AllocL();
   811                     BroadcastNotification(ECalenNotifyDeleteInstanceView);
   812                     BroadcastNotification(ECalenNotifyDeleteInstanceView);
   812                     iGlobalData->RemoveCalendarL(iFilnameDeleted->Des());
   813                     iGlobalData->RemoveCalendarL(iFilnameDeleted->Des());
   813                     BroadcastNotification(ECalenNotifyCalendarFileDeleted);
   814                     BroadcastNotification(ECalenNotifyCalendarFileDeleted);
   814                                        
   815                                        
   815                     delete iFilnameDeleted;
   816                     delete iFilnameDeleted;
   816                     iFilnameDeleted = NULL;
   817                     iFilnameDeleted = NULL;
   817                     }
   818                     }				
   818                 else
   819                 else
   819                     {
   820                     {
   820                     BroadcastNotification(ECalenNotifyCalendarInfoUpdated);
   821                     BroadcastNotification(ECalenNotifyCalendarInfoUpdated);
   821                     }
   822                     }
   822                 }
   823                 }