phoneapp/phoneuiview/src/cphonedialercontroller.cpp
branchRCL_3
changeset 4 24062c24fe38
parent 3 8871b09be73b
child 6 38529f706030
--- a/phoneapp/phoneuiview/src/cphonedialercontroller.cpp	Fri Feb 19 22:50:26 2010 +0200
+++ b/phoneapp/phoneuiview/src/cphonedialercontroller.cpp	Fri Mar 12 15:42:40 2010 +0200
@@ -43,9 +43,9 @@
 /** States for Call button. */
 enum TCallButtonState
     {
-    ECallButtonCallStateIndex = 0,
-    ECallButtonLogStateIndex,
-    ECallButtonSendStateIndex
+    ECallButtonCallState = 0,
+    ECallButtonLogState,
+    ECallButtonSendState
     };
 static const CPhoneDialerController::TLocalButtonData KCallButtonDataTable[] =
     {
@@ -75,8 +75,8 @@
 /** States for Phonebook button */
 enum TPhonebookButtonState
     {
-    EPhonebookButtonContactsIndex = 0,
-    EPhonebookButtonAddContactIndex
+    EPhonebookButtonContactsState = 0,
+    EPhonebookButtonAddContactState
     };
 static const CPhoneDialerController::TLocalButtonData KPhonebookButtonDataTable[] =
     {
@@ -100,7 +100,7 @@
 /** States for Clear button */
 enum TClearButtonState
     {
-    EClearButtonClearIndex = 0
+    EClearButtonClearState = 0
     };
 static const CPhoneDialerController::TLocalButtonData KClearButtonDataTable[] =
     {
@@ -301,32 +301,27 @@
 //
 EXPORT_C TInt CPhoneDialerController::ButtonState( TButtonIndex aIndex ) const
     {
-    TInt state = 0;
+    TInt state( KErrNotFound );
     // Figure out correct state for each key
     switch ( aIndex )
         {
         case ECallButton:
             {
-            state = ECallButtonCallStateIndex;
             if ( !iNumberAvailable )
                 {
-                state = ECallButtonLogStateIndex;
+                // Show "Recent calls" when no number available
+                state = ECallButtonLogState;
                 }
-            else if ( iServiceCodeFlag )
+            else if ( iServiceCodeFlag && !EasyDialingFocused() )
                 {
-                // Set "Send" state unless Easy dialing is focused
-                TBool edFocused = EFalse;
-                if ( iEasyDialingController )
-                    {
-                    TInt commandResponse( EPhoneViewResponseFailed );
-                    TRAP_IGNORE( commandResponse = iEasyDialingController->HandleCommandL(
-                            EPhoneViewGetEasyDialingInFocusStatus) );
-                    edFocused = ( commandResponse == EPhoneViewResponseSuccess );
-                    }
-                if ( !edFocused )
-                    {
-                    state = ECallButtonSendStateIndex;
-                    }
+                // Show "Send" if service code entered and contact list
+                // is not focused.
+                state = ECallButtonSendState;
+                }
+            else
+                {
+                // Show "Call" in all other cases
+                state = ECallButtonCallState;
                 }
             }
             break;
@@ -334,17 +329,17 @@
             {
             if ( !iNumberAvailable )
                 {
-                state = EPhonebookButtonContactsIndex;
+                state = EPhonebookButtonContactsState;
                 }
             else
                 {
-                state = EPhonebookButtonAddContactIndex;
+                state = EPhonebookButtonAddContactState;
                 }
             }
             break;
         case EClearButton:
             {
-            state = EClearButtonClearIndex;
+            state = EClearButtonClearState;
             }
             break;
         default:
@@ -411,6 +406,23 @@
     }
 
 // ---------------------------------------------------------------------------
+// EasyDialingFocused
+// ---------------------------------------------------------------------------
+//
+TBool CPhoneDialerController::EasyDialingFocused() const
+    {
+    TBool edFocused = EFalse;
+    if ( iEasyDialingController )
+        {
+        TInt commandResponse( EPhoneViewResponseFailed );
+        TRAP_IGNORE( commandResponse = iEasyDialingController->HandleCommandL(
+                EPhoneViewGetEasyDialingInFocusStatus) );
+        edFocused = ( commandResponse == EPhoneViewResponseSuccess );
+        }
+    return edFocused;
+    }
+
+// ---------------------------------------------------------------------------
 // CreateButtonDataL
 // ---------------------------------------------------------------------------
 //