idlefw/plugins/profileplugin/src/caiprofileengine.cpp
branchRCL_3
changeset 18 bd874ee5e5e2
parent 9 d0529222e3f0
child 51 15e4dd19031c
equal deleted inserted replaced
9:d0529222e3f0 18:bd874ee5e5e2
    18 
    18 
    19 // System includes
    19 // System includes
    20 #include <w32std.h> 
    20 #include <w32std.h> 
    21 #include <ProEngFactory.h>
    21 #include <ProEngFactory.h>
    22 #include <MProfileEngine.h>
    22 #include <MProfileEngine.h>
       
    23 #include <MProfile.h>
    23 #include <MProEngEngine.h>
    24 #include <MProEngEngine.h>
    24 #include <MProEngProfile.h>
    25 #include <MProEngProfile.h>
    25 #include <MProEngProfileName.h>
    26 #include <MProEngProfileName.h>
    26 #include <MProEngProfileNameArray.h>
    27 #include <MProEngProfileNameArray.h>
    27 #include <MProEngNotifyHandler.h>
    28 #include <MProEngNotifyHandler.h>
   122     // Start to listen profile changes.
   123     // Start to listen profile changes.
   123     iProfileNotifier = ProEngFactory::NewNotifyHandlerL();
   124     iProfileNotifier = ProEngFactory::NewNotifyHandlerL();
   124     
   125     
   125     iProfileNotifier->RequestActiveProfileNotificationsL( *this );
   126     iProfileNotifier->RequestActiveProfileNotificationsL( *this );
   126     iProfileNotifier->RequestProfileNameArrayNotificationsL( *this );
   127     iProfileNotifier->RequestProfileNameArrayNotificationsL( *this );
   127     iProfileNotifier->RequestProfileActivationNotificationsL( *this ); 
   128     iProfileNotifier->RequestProfileActivationNotificationsL( *this );
       
   129     
       
   130     DetermineTimedAndSilentStatesL();
   128     }
   131     }
   129     
   132     
   130 // ----------------------------------------------------------------------------
   133 // ----------------------------------------------------------------------------
   131 // CAiProfileEngine::~CAiProfileEngine
   134 // CAiProfileEngine::~CAiProfileEngine
   132 //
   135 //
   154         iProfileEngine->Release();
   157         iProfileEngine->Release();
   155         }
   158         }
   156             
   159             
   157     iResourceLoader.Close();
   160     iResourceLoader.Close();
   158     }
   161     }
   159     
   162 
       
   163 // ----------------------------------------------------------------------------
       
   164 // CAiProfileEngine::DetermineTimedAndSilentStatesL()
       
   165 //
       
   166 // ----------------------------------------------------------------------------
       
   167 //
       
   168 void CAiProfileEngine::DetermineTimedAndSilentStatesL()
       
   169     {
       
   170     iTimed = EFalse;
       
   171     iSilent = EFalse;
       
   172     
       
   173     MProfileEngine* engine = CreateProfileEngineL();
       
   174                 
       
   175     iTimed = engine->IsActiveProfileTimedL();
       
   176     
       
   177     MProfile* profile = engine->ActiveProfileLC();
       
   178     
       
   179     iSilent = profile->IsSilent();
       
   180     
       
   181     CleanupStack::PopAndDestroy(); // profile
       
   182     
       
   183     engine->Release();    
       
   184     }
       
   185 
   160 // ----------------------------------------------------------------------------
   186 // ----------------------------------------------------------------------------
   161 // CAiProfileEngine::UpdateProfileNamesL()
   187 // CAiProfileEngine::UpdateProfileNamesL()
   162 //
   188 //
   163 // ----------------------------------------------------------------------------
   189 // ----------------------------------------------------------------------------
   164 //
   190 //
   369 //
   395 //
   370 // ----------------------------------------------------------------------------
   396 // ----------------------------------------------------------------------------
   371 //
   397 //
   372 TBool CAiProfileEngine::IsActiveProfileSilentL() const
   398 TBool CAiProfileEngine::IsActiveProfileSilentL() const
   373 	{
   399 	{
   374     MProEngProfile* profile( iProfileEngine->ActiveProfileLC() );
   400 	return iSilent;
   375     	
       
   376 	TBool silent( profile->IsSilent() );
       
   377 	
       
   378 	CleanupStack::PopAndDestroy();
       
   379 	
       
   380 	return silent; 
       
   381 	}
   401 	}
   382 
   402 
   383 // ----------------------------------------------------------------------------
   403 // ----------------------------------------------------------------------------
   384 // CAiProfileEngine::IsActiveProfileTimedL
   404 // CAiProfileEngine::IsActiveProfileTimedL
   385 // 
   405 // 
   386 // ----------------------------------------------------------------------------
   406 // ----------------------------------------------------------------------------
   387 //
   407 //
   388 TBool CAiProfileEngine::IsActiveProfileTimedL() const
   408 TBool CAiProfileEngine::IsActiveProfileTimedL() const
   389 	{    
   409 	{    
   390     MProfileEngine* engine = CreateProfileEngineL();
   410     return iTimed;    
   391         
       
   392     TBool retval( EFalse );
       
   393     
       
   394     TRAP_IGNORE( retval = engine->IsActiveProfileTimedL() );
       
   395     
       
   396     engine->Release();
       
   397     
       
   398     return retval;	
       
   399 	}
   411 	}
   400 
   412 
   401 // ----------------------------------------------------------------------------
   413 // ----------------------------------------------------------------------------
   402 // CAiProfileEngine::NumberOfProfiles
   414 // CAiProfileEngine::NumberOfProfiles
   403 //
   415 //
   620 //
   632 //
   621 // ----------------------------------------------------------------------------
   633 // ----------------------------------------------------------------------------
   622 //
   634 //
   623 void CAiProfileEngine::HandleActiveProfileModifiedL()
   635 void CAiProfileEngine::HandleActiveProfileModifiedL()
   624     {
   636     {
       
   637     DetermineTimedAndSilentStatesL();
       
   638     
   625     NotifyContentUpdate();
   639     NotifyContentUpdate();
   626     }
   640     }
   627 
   641 
   628 // ----------------------------------------------------------------------------
   642 // ----------------------------------------------------------------------------
   629 // CAiProfileEngine::HandleProfileNameArrayModificationL
   643 // CAiProfileEngine::HandleProfileNameArrayModificationL
   640 //
   654 //
   641 // ----------------------------------------------------------------------------
   655 // ----------------------------------------------------------------------------
   642 //
   656 //
   643 void CAiProfileEngine::HandleProfileActivatedL( TInt /*aProfileId*/ )
   657 void CAiProfileEngine::HandleProfileActivatedL( TInt /*aProfileId*/ )
   644     {
   658     {
       
   659     DetermineTimedAndSilentStatesL();
       
   660     
   645     NotifyContentUpdate();
   661     NotifyContentUpdate();
   646     }
   662     }
   647 
   663 
   648 // ----------------------------------------------------------------------------
   664 // ----------------------------------------------------------------------------
   649 // CAiProfileEngine::NotifyContentUpdate
   665 // CAiProfileEngine::NotifyContentUpdate