phoneapp/phoneuicontrol/src/tphonecallheaderparam.cpp
branchRCL_3
changeset 24 41a7f70b3818
parent 23 40a3f856b14d
child 25 5266b1f337bd
--- a/phoneapp/phoneuicontrol/src/tphonecallheaderparam.cpp	Thu Aug 19 09:54:27 2010 +0300
+++ b/phoneapp/phoneuicontrol/src/tphonecallheaderparam.cpp	Tue Aug 31 15:14:29 2010 +0300
@@ -43,7 +43,8 @@
         MPhoneStateMachine& aStateMachine ) 
         : iManagerUtility ( aManagerUtility ),
           iStateMachine ( aStateMachine ),
-          iCallHeaderType ( CBubbleManager::ENormal )
+          iCallHeaderType ( EPECallTypeUninitialized ),
+          iSetDivertIndication ( EFalse )
     {
     }
 
@@ -71,7 +72,7 @@
     __PHONELOG2( EBasic, EPhoneControl, "TPhoneCallHeaderParam::SetCallHeaderTexts - NumberType(%d), CLI(%d)", numberType, cli );
     __PHONELOG2( EBasic, EPhoneControl, "TPhoneCallHeaderParam::SetCallHeaderTexts - CNAP(%d), AuxLine(%d)", cnap, auxLine );
     
-    if ( !cli && !cnap && ( numberType != EPEPrivateNumber ) )
+    if ( !cli && !cnap && numberType != EPEPrivateNumber && numberType != EPEUnknownNumber )
         {
         if ( auxLine )
             {
@@ -154,9 +155,8 @@
          ( !ContactInfoAvailable( aCallId ) ) )
         {
         // Set phonenumber/URI as the CLI text for the call header      
-        aCallHeaderData->SetCLIText( 
-                iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ),
-                CBubbleManager::ELeft );
+       aCallHeaderData->SetCLIText( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ),
+                 TPhoneCmdParamCallHeaderData::ELeft );
             
         // No contact name, use phonenumber when available.
         aCallHeaderData->SetParticipantListCLI(
@@ -164,22 +164,19 @@
         }
     else
         {
-        CBubbleManager::TPhoneClippingDirection cnapClippingDirection = CBubbleManager::ERight;
+        TPhoneCmdParamCallHeaderData::TPhoneTextClippingDirection cnapClippingDirection = TPhoneCmdParamCallHeaderData::ERight;
         TBuf<KCntMaxTextFieldLength> remoteInfoText( KNullDesC );
+ 
+        TBool secondaryCli = GetRemoteInfoDataL( aCallId, remoteInfoText );
+        cnapClippingDirection = TPhoneCmdParamCallHeaderData::ELeft;
+
+        aCallHeaderData->SetCLIText( remoteInfoText,  TPhoneCmdParamCallHeaderData::ERight );
         
-        /*If call is Private/PayPhone call then IsCallPrivateOrPayPhone
-        * will set SetIdentitySpecificCallHeaderData parameters therefore
-        * there is no need to call GetRemoteInfoDataL.*/  
-        if ( !IsCallPrivateOrPayPhone( aCallId, remoteInfoText ) )
+        if (secondaryCli)
             {
-            GetRemoteInfoDataL( aCallId, remoteInfoText );
-            cnapClippingDirection = CBubbleManager::ELeft;
+            aCallHeaderData->SetCNAPText( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ), 
+                cnapClippingDirection );
             }
-        
-        // Set remote info data as the CLI text for the call header 
-        aCallHeaderData->SetCLIText( remoteInfoText, CBubbleManager::ERight );
-        aCallHeaderData->SetCNAPText( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ), 
-                cnapClippingDirection );
         }
     
     SetCallerImage( aCallId, aCallHeaderData );
@@ -230,10 +227,10 @@
     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetBasicCallHeaderParamsL( ) ");
     // Set call header call state
     aCallHeaderData->SetCallState( 
-            iStateMachine.PhoneEngineInfo()->CallState( aCallId ) );
-    // Set call header type
+        iStateMachine.PhoneEngineInfo()->CallState( aCallId ) );
+
+    // Set call header type            
     aCallHeaderData->SetCallType( GetCallType( aCallId, aCallHeaderData ) );
-    aCallHeaderData->SetCallFlag( CallHeaderType() );
     
     // Set call header voice privacy status
     aCallHeaderData->SetCiphering( 
@@ -268,33 +265,16 @@
     {
     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::GetCallType( ) ");
     // Set call header type.
-    TPECallType callType = iStateMachine.PhoneEngineInfo()->CallType( aCallId );
-    switch ( callType )
-       {
-       case EPECallTypeCSVoice:
-           {
-           if ( iStateMachine.PhoneEngineInfo()->CallALSLine( aCallId ) 
-                == CCCECallParameters::ECCELineTypeAux )
-               {
-               SetCallHeaderType( CBubbleManager::ELine2 );
-               aCallHeaderData->SetLine2( ETrue );
-               }
-           else
-               {
-               SetCallHeaderType( CBubbleManager::ENormal );
-               }
-           }
-           break;
-       case EPECallTypeVideo:
-           SetCallHeaderType( CBubbleManager::EVideo );
-           break;
-       case EPECallTypeVoIP:
-           SetCallHeaderType( CBubbleManager::EVoIPCall );
-           break;
-         default:
-           // None
-           break;     
-       }
+    TPECallType callType = 
+        iStateMachine.PhoneEngineInfo()->CallType( aCallId );
+    SetCallHeaderType( callType );
+    
+    if ( iStateMachine.PhoneEngineInfo()->CallALSLine( aCallId ) 
+         == CCCECallParameters::ECCELineTypeAux )
+        {
+        aCallHeaderData->SetLine2( ETrue );
+        }
+
     __PHONELOG1( EBasic, EPhoneControl, 
                 "TPhoneCallHeaderParam::GetCallType() - callType: %d ", 
                 callType )
@@ -306,7 +286,7 @@
 // ---------------------------------------------------------------------------
 //
 void TPhoneCallHeaderParam::SetCallHeaderType( 
-    const CBubbleManager::TPhoneCallTypeFlags aCallHeaderType )
+    TInt aCallHeaderType )
     {
     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetCallHeaderType( ) ");
     iCallHeaderType = aCallHeaderType;
@@ -319,7 +299,7 @@
 //  TPhoneCallHeaderParam::CallHeaderType
 // ---------------------------------------------------------------------------
 //
-CBubbleManager::TPhoneCallTypeFlags TPhoneCallHeaderParam::CallHeaderType() const
+TInt TPhoneCallHeaderParam::CallHeaderType() const
     {
     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::CallHeaderType( ) ");
     __PHONELOG1( EBasic, EPhoneControl, 
@@ -365,10 +345,10 @@
          ( !ContactInfoAvailable( aCallId ) ) && 
          ( !info.ShowNumber() ) )
         {
-        // No contact info data available use the phone number.
+        // No contact info data available; use the phone number
         aCallHeaderData->SetCLIText(
                 iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ),
-                CBubbleManager::ELeft);
+                TPhoneCmdParamCallHeaderData::ELeft);
         
         // No contact name, use phonenumber when available.
         aCallHeaderData->SetParticipantListCLI( 
@@ -378,20 +358,12 @@
         {
         TBuf<KCntMaxTextFieldLength> remoteInfoText( KNullDesC );
         
-        /*If call is Private/PayPhone call then IsCallPrivateOrPayPhone
-        * will set SetIdentitySpecificCallHeaderData parameters therefore
-        * there is no need to call GetRemoteInfoDataL.*/        
-        if ( !IsCallPrivateOrPayPhone( aCallId, remoteInfoText ) )
-            {
-            GetRemoteInfoDataL( aCallId, remoteInfoText );
-            }
-        
-        // Set remote info data as the CLI text for the call header
-        aCallHeaderData->SetCLIText( remoteInfoText, CBubbleManager::ERight );
+        GetRemoteInfoDataL( aCallId, remoteInfoText );
+        aCallHeaderData->SetCLIText( remoteInfoText, TPhoneCmdParamCallHeaderData::ERight );
         }
 
     // Fetch CNAP text and clipping direction
-    CBubbleManager::TPhoneClippingDirection cnapClippingDirection; 
+    TPhoneCmdParamCallHeaderData::TPhoneTextClippingDirection cnapClippingDirection;
     GetCNAPText( aCallId, cnapText, cnapClippingDirection );
     
     // Set CNAP data 
@@ -410,7 +382,7 @@
     if ( IsFeatureSupported( KTelephonyLVFlagUUS, aCallId ) )
         {
         aCallHeaderData->SetCNAPText( iStateMachine.PhoneEngineInfo()->RemotePartyName( aCallId ), 
-                CBubbleManager::ERight );
+                TPhoneCmdParamCallHeaderData::ERight );
         }
     }
 
@@ -419,14 +391,14 @@
 // ---------------------------------------------------------------------------
 //
 void TPhoneCallHeaderParam::GetCNAPText( 
-       const TInt aCallId,
+    const TInt aCallId,
        TDes& aData, 
-       CBubbleManager::TPhoneClippingDirection& aDirection ) const
+       TPhoneCmdParamCallHeaderData::TPhoneTextClippingDirection& aDirection ) const
     {
     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::GetCNAPText( ) ");
     
     // Set clipping direction  
-    aDirection = CBubbleManager::ERight;
+    aDirection = TPhoneCmdParamCallHeaderData::ERight;
     
     // If it's not a private number show further info
     if ( iStateMachine.PhoneEngineInfo()->RemotePhoneNumberType( aCallId ) != 
@@ -441,7 +413,7 @@
             aData.Copy( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ) );
             
             // Clipping direction for non-private number
-            aDirection = CBubbleManager::ELeft;
+            aDirection = TPhoneCmdParamCallHeaderData::ELeft;
             }
         }
     }
@@ -487,10 +459,9 @@
     TPhoneCmdParamCallHeaderData* aCallHeaderData )
     {
     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetDivertIndicatorToCallHeader( ) ");
-    TBool forwarded = iStateMachine.PhoneEngineInfo()->CallForwarded( aCallId );
-    if ( forwarded )
+    if( iSetDivertIndication )
         {
-        aCallHeaderData->AddCallFlag( CBubbleManager::EDiverted );
+        aCallHeaderData->SetDiverted( ETrue );
         }
     
     if ( iStateMachine.PhoneEngineInfo()->CallALSLine( aCallId ) == CCCECallParameters::ECCELineTypeAux )
@@ -502,6 +473,19 @@
     }
 
 // ---------------------------------------------------------------------------
+// TPhoneCallHeaderParam::SetDivertIndication
+// ---------------------------------------------------------------------------
+//
+void TPhoneCallHeaderParam::SetDivertIndication( const TBool aDivertIndication )
+    {
+    __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetDivertIndication( ) ");
+    iSetDivertIndication = aDivertIndication;           
+    __PHONELOG1( EBasic, EPhoneControl, 
+                "TPhoneCallHeaderParam::SetDivertIndication() - iSetDivertIndication: %d ", 
+                iSetDivertIndication )
+    }
+
+// ---------------------------------------------------------------------------
 //  TPhoneCallHeaderParam::SetIncomingCallHeaderParamsL
 // ---------------------------------------------------------------------------
 //
@@ -539,18 +523,8 @@
     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetOutgoingCallHeaderParamsL( ) ");
     // Set basic params must be called before update is called.
     SetBasicCallHeaderParamsL( aCallId, aCallHeaderData );
+    
     // Set call header labels
-    SetCallHeaderLabels( aCallHeaderData );
-    SetCliParamatersL( aCallId, aCallHeaderData );
-    }
-
-// ---------------------------------------------------------------------------
-//  TPhoneCallHeaderParam::SetCallHeaderLabels
-// ---------------------------------------------------------------------------
-//
-void TPhoneCallHeaderParam::SetCallHeaderLabels( 
-       TPhoneCmdParamCallHeaderData* aCallHeaderData )
-    {
     if ( aCallHeaderData->CallType() == EPECallTypeVideo )
         {
         iManagerUtility.LoadCallHeaderTexts( 
@@ -565,6 +539,8 @@
                 EPhoneOutgoingCallLabelShort, 
                 aCallHeaderData );
         }
+    
+    SetCliParamatersL( aCallId, aCallHeaderData );
     }
 
 // ---------------------------------------------------------------------------
@@ -583,36 +559,23 @@
     
     // Set call header type
     GetCallType( aCallId, aCallHeaderData );
-    aCallHeaderData->SetCallFlag( CallHeaderType() );
     
     // Set CLI text for the call header
-    GetRemoteInfoDataL( aCallId, remoteInfoText );
+    TBool secondaryCli = GetRemoteInfoDataL( aCallId, remoteInfoText );
     if ( remoteInfoText != KNullDesC )
         {
-        aCallHeaderData->SetCLIText( remoteInfoText, CBubbleManager::ERight );
-        if ( IsCallPrivateOrPayPhone( aCallId, remoteInfoText ) )
-            {
-            aCallHeaderData->SetCNAPText( remoteInfoText, CBubbleManager::ERight );
-            }
-        else
+        aCallHeaderData->SetCLIText( remoteInfoText, TPhoneCmdParamCallHeaderData::ERight );
+        if ( secondaryCli )
             {
             aCallHeaderData->SetCNAPText( iStateMachine.PhoneEngineInfo()->
-                RemotePhoneNumber( aCallId ), CBubbleManager::ELeft );
-
-            // No contact name, use phonenumber when available.
-            if ( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ).Length() 
-                    && !ContactInfoAvailable( aCallId ) )
-                {
-                aCallHeaderData->SetParticipantListCLI(
-                        TPhoneCmdParamCallHeaderData::EPhoneParticipantCNAPText );
-                }
+                RemotePhoneNumber( aCallId ), TPhoneCmdParamCallHeaderData::ELeft );       
             }
         }
     else
         {
         aCallHeaderData->SetCLIText( 
             iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ),
-            CBubbleManager::ERight );
+            TPhoneCmdParamCallHeaderData::ELeft );
         }
 
     // If KTelephonyLVFlagUUS is enabled it will over write RemotePartyName setting.
@@ -625,14 +588,13 @@
         if ( iStateMachine.PhoneEngineInfo()->CallState( aCallId ) == EPEStateRinging )
             {
             // Set CNAP text  
-            aCallHeaderData->SetCNAPText( remotePartyName, CBubbleManager::ERight );
+            aCallHeaderData->SetCNAPText( remotePartyName, TPhoneCmdParamCallHeaderData::ERight );
             }
         else
             {
-            aCallHeaderData->SetCLIText( remotePartyName, CBubbleManager::ERight );
+            aCallHeaderData->SetCLIText( remotePartyName, TPhoneCmdParamCallHeaderData::ERight );
             }
         }   
-
     
     // Set call header labels
     SetCallHeaderTexts( 
@@ -645,44 +607,24 @@
     SetCallerImage( 
             aCallId, 
             aCallHeaderData ); 
-    
-    // Update divert indication
-    SetDivertIndicatorToCallHeader( aCallId, aCallHeaderData );
     }
 
-// ---------------------------------------------------------------------------
-// TPhoneCallHeaderParam::IsCallPrivateOrPayPhone
-// ---------------------------------------------------------------------------
-//
-TBool TPhoneCallHeaderParam::IsCallPrivateOrPayPhone( const TInt aCallId, TDes& aData ) const 
-    {
-    __LOGMETHODSTARTEND( EPhoneControl, "TPhoneCallHeaderParam::IsCallPrivateOrPayPhone() ");
-    __ASSERT_DEBUG( iStateMachine.PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
-    TBool ret( EFalse );
-    const RMobileCall::TMobileCallRemoteIdentityStatus identity = iStateMachine.PhoneEngineInfo()->RemoteIdentity( aCallId );
-    if ( ( iStateMachine.PhoneEngineInfo()->RemotePhoneNumberType( aCallId ) == EPEPrivateNumber ) ||
-            identity == RMobileCall::ERemoteIdentityUnavailableNoCliCoinOrPayphone || 
-            identity == RMobileCall::ERemoteIdentityAvailableNoCliCoinOrPayphone )
-        {
-        SetIdentitySpecificCallHeaderData( aCallId, aData );
-        ret = ETrue;
-        }
-    
-    __PHONELOG1( EBasic, EPhoneControl, "TPhoneCallHeaderParam::IsCallPrivateOrPayPhone() - returns = %d ", ret);
-    return ret;  
-    }
+
 
 // ---------------------------------------------------------------------------
 //  TPhoneCallHeaderParam::GetRemoteInfoDataL
 // ---------------------------------------------------------------------------
 //
-void TPhoneCallHeaderParam::GetRemoteInfoDataL( 
+TBool TPhoneCallHeaderParam::GetRemoteInfoDataL( 
         const TInt aCallId, 
         TDes& aData ) const 
     {
     __LOGMETHODSTARTEND( EPhoneControl, "TPhoneCallHeaderParam::GetRemoteInfoDataL() ");
     __PHONELOG1( EBasic, EPhoneControl, "TPhoneCallHeaderParam::GetRemoteInfoDataL() - call id =%d ", aCallId);
     __ASSERT_DEBUG( iStateMachine.PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
+    
+    TBool secondaryCli(EFalse);
+        
     if ( aCallId == KEmergencyCallId )
         {
         // Set emergency label text
@@ -690,86 +632,61 @@
         }
     else
         {
+        const RMobileCall::TMobileCallRemoteIdentityStatus identity = iStateMachine.PhoneEngineInfo()->RemoteIdentity( aCallId );
         // Note next if-statements are in priority order so be careful if you change order
         // or add new if-statements.
         if ( iStateMachine.PhoneEngineInfo()->RemoteName( aCallId ).Length() )
             {
             // Display the contact name if it is available
             aData.Copy( iStateMachine.PhoneEngineInfo()->RemoteName( aCallId ) );
+            secondaryCli = ETrue;
             }
         else if ( iStateMachine.PhoneEngineInfo()->RemotePartyName( aCallId ).Length() )
             {
             // Display the CNAP or UUS info if it is available.
             aData.Copy( iStateMachine.PhoneEngineInfo()->RemotePartyName( aCallId ) );
+            secondaryCli = ETrue;
             }
         else if ( iStateMachine.PhoneEngineInfo()->RemoteCompanyName( aCallId ).Length() )
             {
             // Display the company name if it is available
             aData.Copy( iStateMachine.PhoneEngineInfo()->RemoteCompanyName( aCallId ) );
             }
-        else if ( iStateMachine.PhoneEngineInfo()->CallState( aCallId ) == EPEStateRinging  )
-            {
-            SetIdentitySpecificCallHeaderData( aCallId, aData );
-           }
-        else
+        else if ( iStateMachine.PhoneEngineInfo()->CallDirection( aCallId ) == RMobileCall::EMobileTerminated )
             {
-            if ( ( iStateMachine.PhoneEngineInfo()->CallState( aCallId ) != EPEStateDialing ) && 
-                 ( iStateMachine.PhoneEngineInfo()->CallState( aCallId ) != EPEStateRinging ) &&
-                 ( iStateMachine.PhoneEngineInfo()->CallState( aCallId ) != EPEStateAnswering ) )
+            if ( EPEPrivateNumber == iStateMachine.PhoneEngineInfo()->RemotePhoneNumberType( aCallId ) )
+                {
+                if ( EPECallTypeVoIP == CallHeaderType() )
+                    {
+                    iManagerUtility.LoadResource( aData, iManagerUtility.Customization()->CustomizeCallHeaderText() );
+                    }
+                else
+                    {
+                    // private number
+                    iManagerUtility.LoadResource( aData, EPhoneCLIWithheld );
+                    }
+                }
+            else if ( identity == RMobileCall::ERemoteIdentityUnavailableNoCliCoinOrPayphone || 
+                    identity == RMobileCall::ERemoteIdentityAvailableNoCliCoinOrPayphone )
                 {
-                iManagerUtility.GetInCallNumberTextL( aCallId, aData );
+                __PHONELOG( EBasic, EPhoneControl, "GetRemoteInfoDataL : payphone" );
+                // Display "Payphone".
+                iManagerUtility.LoadResource( aData, EPhoneCLIPayphone );
+                }
+            else if ( identity == RMobileCall::ERemoteIdentityUnknown )
+                {
+                __PHONELOG( EBasic, EPhoneControl, "GetRemoteInfoDataL : unknown number" );
+                // Display "Unknown Number".
+                iManagerUtility.LoadResource( aData, EPhoneCallCLIUnknown );
                 }
+            else if ( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ).Length() )
+                {
+                // Display the number if it is available
+                aData.Copy( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ) );
+                }            
             }
+
         }
+    return secondaryCli;
     }
 
-// ---------------------------------------------------------------------------
-// TPhoneCallHeaderParam::SetIdentitySpecificCallHeaderData
-// ---------------------------------------------------------------------------
-//
-void TPhoneCallHeaderParam::SetIdentitySpecificCallHeaderData( const TInt aCallId,  TDes& aData ) const 
-    {
-    __LOGMETHODSTARTEND( EPhoneControl, "TPhoneCallHeaderParam::SetIdentitySpecificCallHeaderData() ")
-    __ASSERT_DEBUG( iStateMachine.PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
-    
-    const RMobileCall::TMobileCallRemoteIdentityStatus identity = iStateMachine.PhoneEngineInfo()->RemoteIdentity( aCallId );
-    const TPEPhoneNumberIdType idType = iStateMachine.PhoneEngineInfo()->RemotePhoneNumberType( aCallId );
-    
-    __PHONELOG1( EBasic, EPhoneControl, "TPhoneCallHeaderParam::SetIdentitySpecificCallHeaderData() - RemoteIdentity: %d ", 
-            identity )
-    __PHONELOG1( EBasic, EPhoneControl, "TPhoneCallHeaderParam::SetIdentitySpecificCallHeaderData() - idType: %d ", 
-            idType )
-    // If ringing call is emergency call then do not set identity specific info to call header
-    // because emergency call header doesnt contain identity specific information.
-    if ( aCallId == KEmergencyCallId )
-            {
-            // do nothing.
-            }
-    else if ( idType == EPEPrivateNumber )
-        {
-        // If call header has customized items and callheadertype is voip
-        // then load customized text.
-        if ( ( iManagerUtility.Customization() ) && ( CallHeaderType() == CBubbleManager::EVoIPCall ) )
-            {
-            // Display private address
-            iManagerUtility.LoadResource( aData, iManagerUtility.Customization()->CustomizeCallHeaderText() );
-            }
-        else
-            {
-            // Display "private number".
-            iManagerUtility.LoadResource( aData, EPhoneCLIWithheld );  
-            }       
-        }
-    else if( ( identity == RMobileCall::ERemoteIdentityUnavailableNoCliCoinOrPayphone ) ||
-             ( identity == RMobileCall::ERemoteIdentityAvailableNoCliCoinOrPayphone ) )
-        {
-        // Display "Payphone".
-        iManagerUtility.LoadResource( aData, EPhoneCLIPayphone );
-        }
-    else if ( identity == RMobileCall::ERemoteIdentityUnknown  )
-        {
-        // Display "Call".
-        iManagerUtility.LoadResource( aData, EPhoneCall );
-        }
-    }
-