phoneapp/phoneuicontrol/src/cphonestateidle.cpp
branchRCL_3
changeset 25 91c2fb4b78df
parent 17 38529f706030
child 39 b8d67d6176f5
--- a/phoneapp/phoneuicontrol/src/cphonestateidle.cpp	Wed Apr 14 15:56:42 2010 +0300
+++ b/phoneapp/phoneuicontrol/src/cphonestateidle.cpp	Tue Apr 27 16:37:10 2010 +0300
@@ -32,6 +32,8 @@
 #include <activeidle2domainpskeys.h>
 #include <mpeclientinformation.h>
 #include <bldvariant.hrh>
+#include <MProEngEngine.h>
+#include <ProEngFactory.h>
 
 #include "cphonepubsubproxy.h"
 #include "cphonecenrepproxy.h"
@@ -396,7 +398,6 @@
         KScreenSaverAllowScreenSaver,
         EPhoneScreensaverNotAllowed );
     
-    BeginTransEffectLC( ENumberEntryClose );
     BeginUiUpdateLC();
     
     // Hide the number entry if it exists
@@ -417,8 +418,6 @@
 
     EndUiUpdate();
     
-    EndTransEffect();
-    
     // Go to incoming state
     iCbaManager->UpdateIncomingCbaL( aCallId );
     UpdateSilenceButtonDimming();
@@ -443,7 +442,6 @@
     {
     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::HandleDialingL( ) ");
 
-    BeginTransEffectLC( ENumberEntryClose );
     BeginUiUpdateLC();
     
     SetNumberEntryVisibilityL(EFalse);
@@ -464,8 +462,6 @@
 
     SetToolbarDimming( ETrue );
     
-    EndTransEffect();
-    
     iStateMachine->ChangeState( EPhoneStateCallSetup );
     }
 
@@ -491,7 +487,6 @@
             &uidParam );
         }
  
-    BeginTransEffectLC( ENumberEntryClose );
     BeginUiUpdateLC();
             
     // Remove the number entry
@@ -508,7 +503,6 @@
     SetToolbarDimming( EFalse );
     
     EndUiUpdate();
-    EndTransEffect();
   
     // Go to single state
     iCbaManager->UpdateCbaL( EPhoneCallHandlingInCallCBA );
@@ -588,6 +582,14 @@
            }
            break;       
            
+       case EPhoneViewOpenNumberEntry:   
+           {
+           BeginTransEffectLC( ENumberEntryOpen );
+           commandStatus = CPhoneState::ProcessCommandL( aCommand );
+           EndTransEffect();
+           }
+           break;
+           
        default:
            commandStatus = CPhoneState::ProcessCommandL( aCommand );
            break;
@@ -917,9 +919,7 @@
         DialL( *phoneNumber, speedDialParam.NumberType(), aDialMethod );
         
         if ( IsNumberEntryUsedL()  ) 
-            {
-            BeginTransEffectLC( ENumberEntryClose ); 
-            
+            {         
             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
             
             // Set Idle background, if still idle
@@ -927,8 +927,6 @@
                 {
                 SetupIdleScreenInBackgroundL();
                 }
-            
-            EndTransEffect();
             }
         }
     else
@@ -1104,9 +1102,11 @@
 
                 if ( IsNumberEntryUsedL() )
                     {
+                    BeginTransEffectLC( ENumberEntryClose );
                     // Remove number entry from screen
                     iViewCommandHandle->ExecuteCommandL( 
                         EPhoneViewRemoveNumberEntry );
+                    EndTransEffect();
                     // Do state-specific operation when number entry is cleared
                     HandleNumberEntryClearedL();
                     
@@ -1122,9 +1122,11 @@
                 }
             else if ( IsNumberEntryUsedL() && TopAppIsDisplayedL() )
                 {
-                // Remove number entry from screen
+                // Remove number entry from screen with effect
+                BeginTransEffectLC( ENumberEntryClose );
                 iViewCommandHandle->ExecuteCommandL( 
                     EPhoneViewRemoveNumberEntry );
+                EndTransEffect();
                 // Do state-specific operation when number entry is cleared
                 HandleNumberEntryClearedL();
                 }
@@ -1184,6 +1186,24 @@
     }
 
 // ---------------------------------------------------------
+// CPhoneStateIdle::CanTransEffectTypeBeUsed
+// ---------------------------------------------------------
+//
+EXPORT_C TBool CPhoneStateIdle::CanTransEffectTypeBeUsed( TStateTransEffectType aType )
+    {
+    TBool okToUse( EFalse );
+    // These effects can be used for transitions between
+    // phone and some other app.
+    if ( aType == ENumberEntryOpen || 
+         aType == ENumberEntryClose ||
+         aType == ENumberEntryCreate )
+        {
+        okToUse = ETrue;
+        }
+    return okToUse;
+    }
+
+// ---------------------------------------------------------
 // CPhoneStateIdle::ChangeMannerModeL
 // ---------------------------------------------------------
 //
@@ -1192,8 +1212,10 @@
     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateIdle::ChangeMannerModeL( ) ");
 
     // Get the profile information
-    const TInt profileId = 
-        iStateMachine->PhoneEngineInfo()->ProfileId();
+    MProEngEngine* profileEngine = ProEngFactory::NewEngineLC();
+    const TInt profileId =
+            profileEngine->ActiveProfileId();
+    
     TInt newProfile;
     
     if ( profileId == EProfileSilentId )
@@ -1204,13 +1226,11 @@
         {
         newProfile = EProfileSilentId;    
         }
-        
-    if ( !iEngine )
-        {
-        iEngine = CreateProfileEngineL();
-        }
-
-    iEngine->SetActiveProfileL( newProfile );
+    
+    profileEngine->SetActiveProfileL( newProfile );
+    
+    CleanupStack::Pop(); // profileEngine 
+    profileEngine->Release();
     
     // Stop playing DTMF tone
     iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );