phoneapp/phoneuicontrol/src/cphonestateidle.cpp
branchRCL_3
changeset 25 91c2fb4b78df
parent 17 38529f706030
child 39 b8d67d6176f5
equal deleted inserted replaced
19:544e34b3255a 25:91c2fb4b78df
    30 #include <ScreensaverInternalPSKeys.h>
    30 #include <ScreensaverInternalPSKeys.h>
    31 #include <mpeengineinfo.h>
    31 #include <mpeengineinfo.h>
    32 #include <activeidle2domainpskeys.h>
    32 #include <activeidle2domainpskeys.h>
    33 #include <mpeclientinformation.h>
    33 #include <mpeclientinformation.h>
    34 #include <bldvariant.hrh>
    34 #include <bldvariant.hrh>
       
    35 #include <MProEngEngine.h>
       
    36 #include <ProEngFactory.h>
    35 
    37 
    36 #include "cphonepubsubproxy.h"
    38 #include "cphonepubsubproxy.h"
    37 #include "cphonecenrepproxy.h"
    39 #include "cphonecenrepproxy.h"
    38 #include "cphonestateidle.h"
    40 #include "cphonestateidle.h"
    39 #include "tphonecmdparaminteger.h"
    41 #include "tphonecmdparaminteger.h"
   394     CPhonePubSubProxy::Instance()->ChangePropertyValue(
   396     CPhonePubSubProxy::Instance()->ChangePropertyValue(
   395         KPSUidScreenSaver,
   397         KPSUidScreenSaver,
   396         KScreenSaverAllowScreenSaver,
   398         KScreenSaverAllowScreenSaver,
   397         EPhoneScreensaverNotAllowed );
   399         EPhoneScreensaverNotAllowed );
   398     
   400     
   399     BeginTransEffectLC( ENumberEntryClose );
       
   400     BeginUiUpdateLC();
   401     BeginUiUpdateLC();
   401     
   402     
   402     // Hide the number entry if it exists
   403     // Hide the number entry if it exists
   403     if ( IsNumberEntryUsedL() )
   404     if ( IsNumberEntryUsedL() )
   404         {
   405         {
   414     
   415     
   415     // Display incoming call
   416     // Display incoming call
   416     DisplayIncomingCallL( aCallId );
   417     DisplayIncomingCallL( aCallId );
   417 
   418 
   418     EndUiUpdate();
   419     EndUiUpdate();
   419     
       
   420     EndTransEffect();
       
   421     
   420     
   422     // Go to incoming state
   421     // Go to incoming state
   423     iCbaManager->UpdateIncomingCbaL( aCallId );
   422     iCbaManager->UpdateIncomingCbaL( aCallId );
   424     UpdateSilenceButtonDimming();
   423     UpdateSilenceButtonDimming();
   425     UpdateIncomingContextMenuL( aCallId );
   424     UpdateIncomingContextMenuL( aCallId );
   441 //
   440 //
   442 EXPORT_C void CPhoneStateIdle::HandleDialingL( TInt aCallId )
   441 EXPORT_C void CPhoneStateIdle::HandleDialingL( TInt aCallId )
   443     {
   442     {
   444     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleDialingL( ) ");
   443     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleDialingL( ) ");
   445 
   444 
   446     BeginTransEffectLC( ENumberEntryClose );
       
   447     BeginUiUpdateLC();
   445     BeginUiUpdateLC();
   448     
   446     
   449     SetNumberEntryVisibilityL(EFalse);
   447     SetNumberEntryVisibilityL(EFalse);
   450 
   448 
   451     // Show call setup buttons
   449     // Show call setup buttons
   461             
   459             
   462     // Go to call setup state
   460     // Go to call setup state
   463     iCbaManager->UpdateCbaL( EPhoneCallHandlingCallSetupCBA );
   461     iCbaManager->UpdateCbaL( EPhoneCallHandlingCallSetupCBA );
   464 
   462 
   465     SetToolbarDimming( ETrue );
   463     SetToolbarDimming( ETrue );
   466     
       
   467     EndTransEffect();
       
   468     
   464     
   469     iStateMachine->ChangeState( EPhoneStateCallSetup );
   465     iStateMachine->ChangeState( EPhoneStateCallSetup );
   470     }
   466     }
   471 
   467 
   472 // -----------------------------------------------------------
   468 // -----------------------------------------------------------
   489         uidParam.SetInteger( KUidPhoneApplication.iUid );
   485         uidParam.SetInteger( KUidPhoneApplication.iUid );
   490         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground, 
   486         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground, 
   491             &uidParam );
   487             &uidParam );
   492         }
   488         }
   493  
   489  
   494     BeginTransEffectLC( ENumberEntryClose );
       
   495     BeginUiUpdateLC();
   490     BeginUiUpdateLC();
   496             
   491             
   497     // Remove the number entry
   492     // Remove the number entry
   498     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   493     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   499  
   494  
   506     // Update touch buttons
   501     // Update touch buttons
   507     SetTouchPaneButtons( EPhoneIncallButtons );
   502     SetTouchPaneButtons( EPhoneIncallButtons );
   508     SetToolbarDimming( EFalse );
   503     SetToolbarDimming( EFalse );
   509     
   504     
   510     EndUiUpdate();
   505     EndUiUpdate();
   511     EndTransEffect();
       
   512   
   506   
   513     // Go to single state
   507     // Go to single state
   514     iCbaManager->UpdateCbaL( EPhoneCallHandlingInCallCBA );
   508     iCbaManager->UpdateCbaL( EPhoneCallHandlingInCallCBA );
   515     iStateMachine->ChangeState( EPhoneStateSingle );
   509     iStateMachine->ChangeState( EPhoneStateSingle );
   516     }
   510     }
   586                EPhoneViewMenuBarOpen, &integerParam );
   580                EPhoneViewMenuBarOpen, &integerParam );
   587            commandStatus = ETrue;
   581            commandStatus = ETrue;
   588            }
   582            }
   589            break;       
   583            break;       
   590            
   584            
       
   585        case EPhoneViewOpenNumberEntry:   
       
   586            {
       
   587            BeginTransEffectLC( ENumberEntryOpen );
       
   588            commandStatus = CPhoneState::ProcessCommandL( aCommand );
       
   589            EndTransEffect();
       
   590            }
       
   591            break;
       
   592            
   591        default:
   593        default:
   592            commandStatus = CPhoneState::ProcessCommandL( aCommand );
   594            commandStatus = CPhoneState::ProcessCommandL( aCommand );
   593            break;
   595            break;
   594        }
   596        }
   595     return commandStatus;
   597     return commandStatus;
   915     if ( NULL != phoneNumber && KNullDesC() != *phoneNumber )
   917     if ( NULL != phoneNumber && KNullDesC() != *phoneNumber )
   916         {
   918         {
   917         DialL( *phoneNumber, speedDialParam.NumberType(), aDialMethod );
   919         DialL( *phoneNumber, speedDialParam.NumberType(), aDialMethod );
   918         
   920         
   919         if ( IsNumberEntryUsedL()  ) 
   921         if ( IsNumberEntryUsedL()  ) 
   920             {
   922             {         
   921             BeginTransEffectLC( ENumberEntryClose ); 
       
   922             
       
   923             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   923             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   924             
   924             
   925             // Set Idle background, if still idle
   925             // Set Idle background, if still idle
   926             if ( iStateMachine->State() == this )
   926             if ( iStateMachine->State() == this )
   927                 {
   927                 {
   928                 SetupIdleScreenInBackgroundL();
   928                 SetupIdleScreenInBackgroundL();
   929                 }
   929                 }
   930             
       
   931             EndTransEffect();
       
   932             }
   930             }
   933         }
   931         }
   934     else
   932     else
   935         {
   933         {
   936         // User cancelled dialog or didn't give a valid number
   934         // User cancelled dialog or didn't give a valid number
  1102                 iStateMachine->SendPhoneEngineMessage(
  1100                 iStateMachine->SendPhoneEngineMessage(
  1103                         MPEPhoneModel::EPEMessageTerminateAllConnections );   
  1101                         MPEPhoneModel::EPEMessageTerminateAllConnections );   
  1104 
  1102 
  1105                 if ( IsNumberEntryUsedL() )
  1103                 if ( IsNumberEntryUsedL() )
  1106                     {
  1104                     {
       
  1105                     BeginTransEffectLC( ENumberEntryClose );
  1107                     // Remove number entry from screen
  1106                     // Remove number entry from screen
  1108                     iViewCommandHandle->ExecuteCommandL( 
  1107                     iViewCommandHandle->ExecuteCommandL( 
  1109                         EPhoneViewRemoveNumberEntry );
  1108                         EPhoneViewRemoveNumberEntry );
       
  1109                     EndTransEffect();
  1110                     // Do state-specific operation when number entry is cleared
  1110                     // Do state-specific operation when number entry is cleared
  1111                     HandleNumberEntryClearedL();
  1111                     HandleNumberEntryClearedL();
  1112                     
  1112                     
  1113                     // If long end key event occures then all calls are terminated and
  1113                     // If long end key event occures then all calls are terminated and
  1114                     // dialer is closed, therefore tel.icon must be removed from FSW.
  1114                     // dialer is closed, therefore tel.icon must be removed from FSW.
  1120                     DisplayIdleScreenL();
  1120                     DisplayIdleScreenL();
  1121                     }
  1121                     }
  1122                 }
  1122                 }
  1123             else if ( IsNumberEntryUsedL() && TopAppIsDisplayedL() )
  1123             else if ( IsNumberEntryUsedL() && TopAppIsDisplayedL() )
  1124                 {
  1124                 {
  1125                 // Remove number entry from screen
  1125                 // Remove number entry from screen with effect
       
  1126                 BeginTransEffectLC( ENumberEntryClose );
  1126                 iViewCommandHandle->ExecuteCommandL( 
  1127                 iViewCommandHandle->ExecuteCommandL( 
  1127                     EPhoneViewRemoveNumberEntry );
  1128                     EPhoneViewRemoveNumberEntry );
       
  1129                 EndTransEffect();
  1128                 // Do state-specific operation when number entry is cleared
  1130                 // Do state-specific operation when number entry is cleared
  1129                 HandleNumberEntryClearedL();
  1131                 HandleNumberEntryClearedL();
  1130                 }
  1132                 }
  1131             else if ( !TopAppIsDisplayedL() )
  1133             else if ( !TopAppIsDisplayedL() )
  1132                 {
  1134                 {
  1182     // the return value of CheckAppLaunchingL ignored.
  1184     // the return value of CheckAppLaunchingL ignored.
  1183     CheckAppLaunchingL( TKeyCode( KPhoneDtmfHashCharacter ) );
  1185     CheckAppLaunchingL( TKeyCode( KPhoneDtmfHashCharacter ) );
  1184     }
  1186     }
  1185 
  1187 
  1186 // ---------------------------------------------------------
  1188 // ---------------------------------------------------------
       
  1189 // CPhoneStateIdle::CanTransEffectTypeBeUsed
       
  1190 // ---------------------------------------------------------
       
  1191 //
       
  1192 EXPORT_C TBool CPhoneStateIdle::CanTransEffectTypeBeUsed( TStateTransEffectType aType )
       
  1193     {
       
  1194     TBool okToUse( EFalse );
       
  1195     // These effects can be used for transitions between
       
  1196     // phone and some other app.
       
  1197     if ( aType == ENumberEntryOpen || 
       
  1198          aType == ENumberEntryClose ||
       
  1199          aType == ENumberEntryCreate )
       
  1200         {
       
  1201         okToUse = ETrue;
       
  1202         }
       
  1203     return okToUse;
       
  1204     }
       
  1205 
       
  1206 // ---------------------------------------------------------
  1187 // CPhoneStateIdle::ChangeMannerModeL
  1207 // CPhoneStateIdle::ChangeMannerModeL
  1188 // ---------------------------------------------------------
  1208 // ---------------------------------------------------------
  1189 //
  1209 //
  1190 void CPhoneStateIdle::ChangeMannerModeL()
  1210 void CPhoneStateIdle::ChangeMannerModeL()
  1191     {
  1211     {
  1192     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateIdle::ChangeMannerModeL( ) ");
  1212     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateIdle::ChangeMannerModeL( ) ");
  1193 
  1213 
  1194     // Get the profile information
  1214     // Get the profile information
  1195     const TInt profileId = 
  1215     MProEngEngine* profileEngine = ProEngFactory::NewEngineLC();
  1196         iStateMachine->PhoneEngineInfo()->ProfileId();
  1216     const TInt profileId =
       
  1217             profileEngine->ActiveProfileId();
       
  1218     
  1197     TInt newProfile;
  1219     TInt newProfile;
  1198     
  1220     
  1199     if ( profileId == EProfileSilentId )
  1221     if ( profileId == EProfileSilentId )
  1200         {
  1222         {
  1201         newProfile = EProfileGeneralId;
  1223         newProfile = EProfileGeneralId;
  1202         }
  1224         }
  1203     else
  1225     else
  1204         {
  1226         {
  1205         newProfile = EProfileSilentId;    
  1227         newProfile = EProfileSilentId;    
  1206         }
  1228         }
  1207         
  1229     
  1208     if ( !iEngine )
  1230     profileEngine->SetActiveProfileL( newProfile );
  1209         {
  1231     
  1210         iEngine = CreateProfileEngineL();
  1232     CleanupStack::Pop(); // profileEngine 
  1211         }
  1233     profileEngine->Release();
  1212 
       
  1213     iEngine->SetActiveProfileL( newProfile );
       
  1214     
  1234     
  1215     // Stop playing DTMF tone
  1235     // Stop playing DTMF tone
  1216     iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF ); 
  1236     iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF ); 
  1217     
  1237     
  1218     if ( !iOnScreenDialer )
  1238     if ( !iOnScreenDialer )