calendarui/controller/src/calencontroller.cpp
changeset 26 a949c2543c15
parent 23 fd30d51f876b
child 37 360d55486d7f
equal deleted inserted replaced
23:fd30d51f876b 26:a949c2543c15
    49 CCalenController::CCalenController(bool isFromServiceFrmwrk)
    49 CCalenController::CCalenController(bool isFromServiceFrmwrk)
    50 {
    50 {
    51     TRACE_ENTRY_POINT;
    51     TRACE_ENTRY_POINT;
    52     iIsFromServiceFrmWrk = isFromServiceFrmwrk;
    52     iIsFromServiceFrmWrk = isFromServiceFrmwrk;
    53     iNextServicesCommandBase = KCustomCommandRangeStart;
    53     iNextServicesCommandBase = KCustomCommandRangeStart;
       
    54     iRefCount = 0;
    54     
    55     
    55     // Store the pointer in tls, also avoid multiple creations
    56     // Store the pointer in tls, also avoid multiple creations
    56     checkMultipleCreation();
    57     checkMultipleCreation();
    57     
    58     
    58     // Get an instance of AgendaUtil interface class
    59     // Get an instance of AgendaUtil interface class
   169     ++self->iRefCount;
   170     ++self->iRefCount;
   170 
   171 
   171     TRACE_EXIT_POINT;
   172     TRACE_EXIT_POINT;
   172     return self;    
   173     return self;    
   173     }
   174     }
   174     
   175 
       
   176 // ----------------------------------------------------------------------------
       
   177 // CCalenController::ReleaseCustomisations
       
   178 // Releases any plugins by deleting the customisation manager
       
   179 // should only be called on exiting by the application.
       
   180 // (other items were commented in a header).
       
   181 // ----------------------------------------------------------------------------
       
   182 //
       
   183 void CCalenController::ReleaseCustomisations()
       
   184     {
       
   185     TRACE_ENTRY_POINT;
       
   186     
       
   187     delete iCustomisationManager;
       
   188     iCustomisationManager = NULL;
       
   189     
       
   190     TRACE_EXIT_POINT;
       
   191     }
       
   192 
   175 // ----------------------------------------------------------------------------
   193 // ----------------------------------------------------------------------------
   176 // CCalenController::Release
   194 // CCalenController::Release
   177 // Decrement the reference count of this singleton.
   195 // Decrement the reference count of this singleton.
   178 // When the reference count is 0, the controller will self delete and free
   196 // When the reference count is 0, the controller will self delete and free
   179 // all resources
   197 // all resources
   202 // ----------------------------------------------------------------------------
   220 // ----------------------------------------------------------------------------
   203 //
   221 //
   204 CCalenController::~CCalenController()
   222 CCalenController::~CCalenController()
   205     {
   223     {
   206     TRACE_ENTRY_POINT;
   224     TRACE_ENTRY_POINT;
       
   225     
   207     if ( iServices )
   226     if ( iServices )
   208         {
   227         {
   209         iServices->Release();
   228         iServices->Release();
   210         }
   229         }
   211     delete iNotifier;
   230     
   212     delete iActionUi;
   231     if( iNotifier )
   213     delete iViewManager;
   232 		{
   214     delete iCustomisationManager;
   233     	delete iNotifier;
       
   234     	iNotifier = NULL;
       
   235 		}
       
   236     
       
   237    if( iActionUi )
       
   238 	   {
       
   239 	   delete iActionUi;
       
   240 	   iActionUi = NULL;
       
   241 	   }
       
   242    
       
   243     if( iViewManager )
       
   244 		{
       
   245     	delete iViewManager;
       
   246     	iViewManager = NULL;
       
   247 		}
       
   248     
       
   249     if( iCustomisationManager )
       
   250 		{
       
   251     	delete iCustomisationManager;
       
   252     	iCustomisationManager = NULL;
       
   253 		}
       
   254     
       
   255     
       
   256     Dll::SetTls( NULL );
   215     
   257     
   216     TRACE_EXIT_POINT;
   258     TRACE_EXIT_POINT;
   217     }
   259     }
   218 
   260 
   219 
   261