phoneengine/phonemodel/src/cpeprofilesettingmonitor.cpp
branchGCC_SURGE
changeset 51 f39ed5e045e0
parent 21 92ab7f8d0eab
parent 45 6b911d05207e
equal deleted inserted replaced
40:bab96b7ed1a4 51:f39ed5e045e0
    21 #include "cpeprofilesettingmonitor.h"
    21 #include "cpeprofilesettingmonitor.h"
    22 #include "mpephonemodelinternal.h"
    22 #include "mpephonemodelinternal.h"
    23 #include <mpedatastore.h>
    23 #include <mpedatastore.h>
    24 #include <MProfileExtraTones.h>
    24 #include <MProfileExtraTones.h>
    25 #include <talogger.h>
    25 #include <talogger.h>
       
    26 #include <ProfileEngineInternalCRKeys.h>
    26 
    27 
    27 
    28 
    28 /////////////////////////////////////////////////////////////////////////
    29 /////////////////////////////////////////////////////////////////////////
    29 // CPEProfileSettingMonitor
    30 // CPEProfileSettingMonitor
    30 /////////////////////////////////////////////////////////////////////////
    31 /////////////////////////////////////////////////////////////////////////
    61 // might leave.
    62 // might leave.
    62 // -----------------------------------------------------------------------------
    63 // -----------------------------------------------------------------------------
    63 //
    64 //
    64 CPEProfileSettingMonitor::CPEProfileSettingMonitor(
    65 CPEProfileSettingMonitor::CPEProfileSettingMonitor(
    65         MPEPhoneModelInternal& aModel
    66         MPEPhoneModelInternal& aModel
    66         ) : iModel( aModel )
    67         ) : CPECenRepMonitor( KProEngSilenceMode ), 
       
    68             iModel( aModel )
    67     {
    69     {
    68     }
    70     }
    69 
    71 
    70 // -----------------------------------------------------------------------------
    72 // -----------------------------------------------------------------------------
    71 // CPEProfileSettingMonitor::ConstructL
    73 // CPEProfileSettingMonitor::ConstructL
    76     {
    78     {
    77     // Create the profile engine
    79     // Create the profile engine
    78     iProfileEngine = CreateProfileEngineL();
    80     iProfileEngine = CreateProfileEngineL();
    79     
    81     
    80     // Retrieve current profile settings    
    82     // Retrieve current profile settings    
    81     GetProfileSettingsL();
    83 
       
    84     BaseConstructL( KCRUidProfileEngine );
    82     
    85     
    83     iModel.SendMessage( MEngineMonitor::EPEMessageProfileChanged ); 
    86     iModel.SendMessage( MEngineMonitor::EPEMessageProfileChanged ); 
    84     
    87     
    85     // Start listening for profiles change notifications
    88     // Start listening for profiles change notifications
    86     iProfileEventHandler = CProfileChangeNotifyHandler::NewL( this );    
    89     iProfileEventHandler = CProfileChangeNotifyHandler::NewL( this );    
   119             extraTones.VideoCallRingingTone() );
   122             extraTones.VideoCallRingingTone() );
   120         }
   123         }
   121     const TProfileToneSettings& toneSettings = activeTones.ToneSettings();  
   124     const TProfileToneSettings& toneSettings = activeTones.ToneSettings();  
   122     
   125     
   123     // Get ringing type and volume and keypad volume
   126     // Get ringing type and volume and keypad volume
   124     TProfileRingingType ringingType = toneSettings.iRingingType;    
   127     TProfileRingingType ringingType = toneSettings.iRingingType;
   125     iModel.DataStore()->SetRingingType( static_cast<TProfileRingingType>( ringingType ) );
   128     
       
   129     TInt silentVolume(0);
       
   130     if ( KErrNone == Get(silentVolume) && silentVolume )
       
   131         {
       
   132         iModel.DataStore()->SetRingingType(EProfileRingingTypeSilent);
       
   133         }
       
   134     else 
       
   135         {
       
   136         iModel.DataStore()->SetRingingType( static_cast<TProfileRingingType>( ringingType ) );
       
   137         }
       
   138     
   126     iModel.DataStore()->SetRingingVolume( toneSettings.iRingingVolume );
   139     iModel.DataStore()->SetRingingVolume( toneSettings.iRingingVolume );
   127     iModel.DataStore()->SetTextToSpeech( toneSettings.iTextToSpeech );
   140     iModel.DataStore()->SetTextToSpeech( toneSettings.iTextToSpeech );
   128                   
   141                   
   129     TProfileKeypadVolume keypadVolume = toneSettings.iKeypadVolume;
   142     TProfileKeypadVolume keypadVolume = toneSettings.iKeypadVolume;
   130         
   143         
   148     activeProfile->Release();
   161     activeProfile->Release();
   149     __UHEAP_MARKEND;
   162     __UHEAP_MARKEND;
   150     }
   163     }
   151 
   164 
   152 // -----------------------------------------------------------------------------
   165 // -----------------------------------------------------------------------------
       
   166 // CPEProfileSettingMonitor::UpdateL
       
   167 // Callback function - implements virtual function from CPECenRepMonitor
       
   168 // This is called whenever cr settings change
       
   169 // -----------------------------------------------------------------------------
       
   170 //
       
   171 void CPEProfileSettingMonitor::UpdateL()
       
   172     {
       
   173     TEFLOGSTRING( KTAINT, "PE CPEProfileSettingMonitor::UpdateL" );
       
   174     GetProfileSettingsL();
       
   175     iModel.SendMessage( MEngineMonitor::EPEMessageProfileChanged );
       
   176     }
       
   177 
       
   178 // -----------------------------------------------------------------------------
   153 // CPEProfileSettingMonitor::HandleActiveProfileEventL
   179 // CPEProfileSettingMonitor::HandleActiveProfileEventL
   154 // Callback function - implements virtual function from MProfileChangeObserver
   180 // Callback function - implements virtual function from MProfileChangeObserver
   155 // This is called whenever profiles settings change
   181 // This is called whenever profiles settings change
   156 // We're not interested in aProfileId which identifies the number of the active profile changed
   182 // We're not interested in aProfileId which identifies the number of the active profile changed
   157 // This notifier doesn't identify the property changed - so update them all by 
   183 // This notifier doesn't identify the property changed - so update them all by