phoneapp/phoneuiview/src/cphonetoolbarcontroller.cpp
branchRCL_3
changeset 23 40a3f856b14d
parent 10 ba54057fe027
--- a/phoneapp/phoneuiview/src/cphonetoolbarcontroller.cpp	Thu Jul 15 18:38:16 2010 +0300
+++ b/phoneapp/phoneuiview/src/cphonetoolbarcontroller.cpp	Thu Aug 19 09:54:27 2010 +0300
@@ -42,7 +42,7 @@
 _LIT ( KPhoneMifFileName, "phoneui.mif" );
 _LIT( KToolbarButtonEmptyStr, "" );
 
-const TInt KNumberOfButtons = 5;
+const TInt KNumberOfButtons = 6;
 struct SPhoneToolbarButton
     {
     TInt iIconIndex;
@@ -71,7 +71,11 @@
 	        {  EMbmPhoneuiQgn_indi_tb_handset,
 	           EMbmPhoneuiQgn_indi_tb_handset_mask,
 	           EPhoneInCallCmdHandset
-	        }
+	        },
+	        {  EMbmPhoneuiQgn_indi_tb_bthf,
+               EMbmPhoneuiQgn_indi_tb_bthf,
+               EPhoneInCallCmdBtHandsfree
+           }
         }; 
 
 
@@ -203,8 +207,27 @@
     iToolbar->HideItem( EPhoneInCallCmdUnmute, !iMuteFlag, ETrue );   
 
     // Show 'Handset'/'Ihf' icon
-    iToolbar->HideItem( EPhoneInCallCmdActivateIhf, iIhfFlag, EFalse );
-    iToolbar->HideItem( EPhoneInCallCmdHandset, !iIhfFlag, ETrue );
+     if ( iWiredAccFlag )
+         {    
+         __PHONELOG( EBasic, EPhoneUIView, "CPhoneToolbarController::UpdateToolbar(), wired ");
+         iToolbar->HideItem( EPhoneInCallCmdHandset, ETrue, EFalse );
+         iToolbar->HideItem( EPhoneInCallCmdBtHandsfree, ETrue, EFalse );
+         iToolbar->HideItem( EPhoneInCallCmdActivateIhf, EFalse, ETrue );
+         }
+     else if ( iBTAccAvailableFlag && !iBTAccFlag )
+         {    
+         __PHONELOG( EBasic, EPhoneUIView, "CPhoneToolbarController::UpdateToolbar(), BT ");
+         iToolbar->HideItem( EPhoneInCallCmdActivateIhf, ETrue, EFalse );
+         iToolbar->HideItem( EPhoneInCallCmdHandset, ETrue, EFalse );
+         iToolbar->HideItem( EPhoneInCallCmdBtHandsfree, EFalse, ETrue );
+         }
+     else
+         {
+         __PHONELOG( EBasic, EPhoneUIView, "CPhoneToolbarController::UpdateToolbar(), else ");
+         iToolbar->HideItem( EPhoneInCallCmdHandset, !iIhfFlag, EFalse );
+         iToolbar->HideItem( EPhoneInCallCmdActivateIhf, iIhfFlag, EFalse );
+         iToolbar->HideItem( EPhoneInCallCmdBtHandsfree, ETrue, ETrue );
+         }
     }   
 
 // ---------------------------------------------------------------------------
@@ -264,6 +287,10 @@
             resourceId = R_PHONEUI_TOOLTIP_HANDSET;
             break;
             
+        case EPhoneInCallCmdBtHandsfree:
+            resourceId = R_PHONEUI_TOOLTIP_BT_HANDSFREE;
+            break;
+            
         default:
             aText = KNullDesC().Alloc();
             break;
@@ -297,6 +324,9 @@
         case EPhoneInCallCmdHandset:
             skinId = KAknsIIDQgnIndiButtonHandset;
             break;
+        case EPhoneInCallCmdBtHandsfree:
+            skinId = KAknsIIDQgnIndiButtonBluetooth;
+            break;
         default:
             skinId = KAknsIIDNone;
             break;
@@ -409,6 +439,38 @@
             }
         }
     }
+// ---------------------------------------------------------
+// CPhoneToolbarController::SetBTAccFlag
+// ---------------------------------------------------------
+//
+void CPhoneToolbarController::SetBTAccFlag( TPhoneCommandParam* aCommandParam )
+    {
+    if ( aCommandParam->ParamId() == TPhoneCommandParam::EPhoneParamIdBoolean )
+        {
+        TPhoneCmdParamBoolean* booleanParam = 
+            static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
+        iBTAccFlag = booleanParam->Boolean();
+        UpdateToolbar(); 
+        }     
+    }
+
+// ---------------------------------------------------------
+// CPhoneToolbarController::SetBTAccAvailableFlag
+// ---------------------------------------------------------
+//
+void CPhoneToolbarController::SetBTAccAvailableFlag( TPhoneCommandParam* aCommandParam )
+    {
+    // Check is the given parameter valid
+    if ( aCommandParam->ParamId() == TPhoneCommandParam::EPhoneParamIdBoolean )
+        {
+        TPhoneCmdParamBoolean* accFlag = 
+            static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
+
+        iBTAccAvailableFlag = accFlag->Boolean();
+        UpdateToolbar();
+        }
+    }
+
 
 // ---------------------------------------------------------
 // CPhoneToolbarController::SetCallInProgressFlag
@@ -456,6 +518,7 @@
     iToolbar->SetItemDimmed( EPhoneInCallCmdUnmute, aDimmed, ETrue );
     iToolbar->SetItemDimmed( EPhoneInCallCmdActivatEPhonebook, aDimmed, ETrue );
     iToolbar->SetItemDimmed( EPhoneInCallCmdHandset, aDimmed, ETrue );  
+    iToolbar->SetItemDimmed( EPhoneInCallCmdBtHandsfree, aDimmed, ETrue );
     // Don't dim/undim iHF when complete toolbar dimming is changed. 
     if ( !iWiredAccFlag )
         {