phoneapp/phoneuicontrol/src/tphonecallheaderparam.cpp
changeset 0 5f000ab63145
child 21 92ab7f8d0eab
child 44 3c221667e687
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  A parameter class for setting call header information
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <mpeclientinformation.h>
       
    20 #include <StringLoader.h>
       
    21 #include <bautils.h>
       
    22 
       
    23 #include "tphonecallheaderparam.h"
       
    24 #include "tphonecmdparamboolean.h"
       
    25 #include "mphonestatemachine.h"
       
    26 #include "mphonecallheadermanagerutility.h"
       
    27 #include "cphonemainresourceresolver.h"
       
    28 #include "phonerssbase.h"
       
    29 #include "phoneui.pan"
       
    30 #include "cphonecenrepproxy.h"
       
    31 #include "telephonyvariant.hrh"
       
    32 #include "phoneviewcommanddefinitions.h"
       
    33 #include "phonelogger.h"
       
    34 
       
    35 // ======== MEMBER FUNCTIONS ========
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // TPhoneCallHeaderParam::TPhoneCallHeaderParam
       
    39 // -----------------------------------------------------------------------------
       
    40 //  
       
    41 TPhoneCallHeaderParam::TPhoneCallHeaderParam(
       
    42         MPhoneCallHeaderManagerUtility& aManagerUtility,
       
    43         MPhoneStateMachine& aStateMachine ) 
       
    44         : iManagerUtility ( aManagerUtility ),
       
    45           iStateMachine ( aStateMachine ),
       
    46           iCallHeaderType ( CBubbleManager::ENormal ),
       
    47           iSetDivertIndication ( EFalse )
       
    48     {
       
    49     }
       
    50 
       
    51 // -----------------------------------------------------------
       
    52 // TPhoneCallHeaderParam::SetCallHeaderTexts
       
    53 // -----------------------------------------------------------
       
    54 //
       
    55 void TPhoneCallHeaderParam::SetCallHeaderTexts(
       
    56     const TInt aCallId, 
       
    57     const TBool aWaitingCall,
       
    58     const TBool aVideoCall,
       
    59     TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
    60     {
       
    61     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetCallHeaderTexts( ) ");
       
    62     
       
    63     TInt labelId(KPhoneRssCommonFirst);
       
    64     TInt shortLabelId( KPhoneRssCommonFirst );
       
    65     
       
    66     // Fetch engine info parameters.
       
    67     const TBool auxLine( iStateMachine.PhoneEngineInfo()->CallALSLine( aCallId ) == CCCECallParameters::ECCELineTypeAux );
       
    68     const TBool cli( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ).Length());
       
    69     const TBool cnap( iStateMachine.PhoneEngineInfo()->RemotePartyName( aCallId ).Length());
       
    70     const TInt numberType( iStateMachine.PhoneEngineInfo()->RemotePhoneNumberType( aCallId ));
       
    71     
       
    72     __PHONELOG2( EBasic, EPhoneControl, "TPhoneCallHeaderParam::SetCallHeaderTexts - NumberType(%d), CLI(%d)", numberType, cli );
       
    73     __PHONELOG2( EBasic, EPhoneControl, "TPhoneCallHeaderParam::SetCallHeaderTexts - CNAP(%d), AuxLine(%d)", cnap, auxLine );
       
    74     
       
    75     if ( !cli && !cnap && ( numberType != EPEPrivateNumber ) )
       
    76         {
       
    77         if ( auxLine )
       
    78             {
       
    79             if ( aWaitingCall )
       
    80                 {
       
    81                 labelId = EPhoneIncomingLine2WaitingText; // waiting, line 2
       
    82                 shortLabelId = EPhoneIncomingLine2Text; // on line 2
       
    83                 }
       
    84             else
       
    85                 {
       
    86                 labelId = EPhoneIncomingLine2Text; // on line 2
       
    87                 }
       
    88             }
       
    89         // If CLIR, but also network limitation(e.g. EPEUnknownNumber), then second line 
       
    90         // should be empty in call bubble.
       
    91         else
       
    92             {
       
    93             labelId = KPhoneRssCommonFirst; // No second line in call bubble
       
    94             }
       
    95         }
       
    96     else  // Voice or video call with CLI or with CNAP.
       
    97         {
       
    98         if ( aWaitingCall )
       
    99             {
       
   100             if ( auxLine  )
       
   101                 {
       
   102                 labelId = EPhoneIncomingLine2WaitingText; // waiting, line 2
       
   103                 shortLabelId = EPhoneIncomingLine2Text; // on line 2
       
   104                 }
       
   105             else
       
   106                 {
       
   107                 labelId = EPhoneCallWaitingLabel; // waiting
       
   108                 shortLabelId = EPhoneCallWaitingLabelShort; // waiting
       
   109                 }
       
   110             }
       
   111         else // Mo other calls
       
   112             {
       
   113             if ( auxLine )
       
   114                 {
       
   115                 labelId = EPhoneIncomingLine2CallingText; // calling, line 2
       
   116                 shortLabelId = EPhoneIncomingLine2Text; // on line 2
       
   117                 }
       
   118             else
       
   119                 {
       
   120                 // If CLIR, but not network limitation, then second line 
       
   121                 // (calling or video call) should be shown in call bubble.
       
   122                 if ( aVideoCall )
       
   123                     {
       
   124                     labelId = EPhoneVideoCallIncoming; // video call
       
   125                     shortLabelId = EPhoneVideoCallIncomingShort; // video call
       
   126                     }
       
   127                 else
       
   128                     {
       
   129                     labelId = EPhoneIncomingCallLabel; // calling
       
   130                     shortLabelId = EPhoneIncomingCallLabelShort; // calling
       
   131                     }
       
   132                 }
       
   133             }
       
   134         }
       
   135     __PHONELOG2( EBasic, EPhoneControl, 
       
   136             "TPhoneCallHeaderParam::SetCallHeaderTexts - labelId(%d) , shortLabelId(%d)",
       
   137             labelId, shortLabelId );
       
   138     iManagerUtility.LoadCallHeaderTexts( labelId, shortLabelId, aCallHeaderData );
       
   139     }
       
   140     
       
   141 // -----------------------------------------------------------------------------
       
   142 // TPhoneCallHeaderParam::SetCliParamatersL
       
   143 // -----------------------------------------------------------------------------
       
   144 // 
       
   145 void TPhoneCallHeaderParam::SetCliParamatersL(
       
   146         const TInt aCallId, 
       
   147         TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   148     {
       
   149     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetCliParamatersL( ) ");
       
   150     
       
   151     // Set call header number type
       
   152     aCallHeaderData->SetNumberType( iStateMachine.PhoneEngineInfo()->RemotePhoneNumberType( aCallId ) );
       
   153     
       
   154     if ( ( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ).Length() ) && 
       
   155          ( !ContactInfoAvailable( aCallId ) ) )
       
   156         {
       
   157         // Set phonenumber/URI as the CLI text for the call header      
       
   158         aCallHeaderData->SetCLIText( 
       
   159                 iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ),
       
   160                 CBubbleManager::ELeft );
       
   161             
       
   162         // No contact name, use phonenumber when available.
       
   163         aCallHeaderData->SetParticipantListCLI(
       
   164                 TPhoneCmdParamCallHeaderData::EPhoneParticipantCNAPText );
       
   165         }
       
   166     else
       
   167         {
       
   168         CBubbleManager::TPhoneClippingDirection cnapClippingDirection = CBubbleManager::ERight;
       
   169         TBuf<KCntMaxTextFieldLength> remoteInfoText( KNullDesC );
       
   170         
       
   171         /*If call is Private/PayPhone call then IsCallPrivateOrPayPhone
       
   172         * will set SetIdentitySpecificCallHeaderData parameters therefore
       
   173         * there is no need to call GetRemoteInfoDataL.*/  
       
   174         if ( !IsCallPrivateOrPayPhone( aCallId, remoteInfoText ) )
       
   175             {
       
   176             GetRemoteInfoDataL( aCallId, remoteInfoText );
       
   177             cnapClippingDirection = CBubbleManager::ELeft;
       
   178             }
       
   179         
       
   180         // Set remote info data as the CLI text for the call header 
       
   181         aCallHeaderData->SetCLIText( remoteInfoText, CBubbleManager::ERight );
       
   182         aCallHeaderData->SetCNAPText( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ), 
       
   183                 cnapClippingDirection );
       
   184         }
       
   185     
       
   186     SetCallerImage( aCallId, aCallHeaderData );
       
   187 
       
   188     // Set the Caller text
       
   189     if ( iStateMachine.PhoneEngineInfo()->CallerText( aCallId ).Length() > 0 )
       
   190         {
       
   191         aCallHeaderData->SetCallerText( iStateMachine.PhoneEngineInfo()->CallerText( aCallId ) );
       
   192         }
       
   193     }
       
   194 
       
   195 // -----------------------------------------------------------------------------
       
   196 // TPhoneCallHeaderParam::SetCallerImage
       
   197 // -----------------------------------------------------------------------------
       
   198 //     
       
   199 void TPhoneCallHeaderParam::SetCallerImage( 
       
   200         const TInt aCallId, 
       
   201         TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   202     {
       
   203     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetCallerImage( ) ");
       
   204     // Set the call header picture data if it is available
       
   205     if ( ( iStateMachine.PhoneEngineInfo()->CallerImage( aCallId ).Length() > 0 )  && 
       
   206          ( BaflUtils::FileExists( CCoeEnv::Static()->FsSession(), 
       
   207                                   iStateMachine.PhoneEngineInfo()->CallerImage( aCallId ) ) ) )
       
   208         {
       
   209         aCallHeaderData->SetPicture( iStateMachine.PhoneEngineInfo()->CallerImage( aCallId ) );
       
   210         }
       
   211     else
       
   212         {
       
   213         // Set the thumbnail picture data if it is available
       
   214         aCallHeaderData->SetHasThumbnail( iStateMachine.PhoneEngineInfo()->HasCallerThumbnail( aCallId ) );
       
   215         CFbsBitmap* picture = iStateMachine.PhoneEngineInfo()->CallerThumbnail( aCallId );
       
   216         if ( picture )
       
   217             {
       
   218             aCallHeaderData->SetThumbnail( picture );
       
   219             }
       
   220         }
       
   221     }
       
   222 
       
   223 // ---------------------------------------------------------------------------
       
   224 //  TPhoneCallHeaderParam::SetBasicCallHeaderParamsL
       
   225 // ---------------------------------------------------------------------------
       
   226 //
       
   227 void TPhoneCallHeaderParam::SetBasicCallHeaderParamsL(
       
   228         const TInt aCallId, 
       
   229         TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   230     {
       
   231     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetBasicCallHeaderParamsL( ) ");
       
   232     // Set call header call state
       
   233     aCallHeaderData->SetCallState( 
       
   234         iStateMachine.PhoneEngineInfo()->CallState( aCallId ) );
       
   235 
       
   236     // Set call header type            
       
   237     aCallHeaderData->SetCallType( GetCallType( aCallId, aCallHeaderData ) );
       
   238     aCallHeaderData->SetCallFlag( CallHeaderType() );
       
   239     
       
   240     // Set call header voice privacy status
       
   241     aCallHeaderData->SetCiphering( 
       
   242         iStateMachine.PhoneEngineInfo()->IsSecureCall( aCallId ) );
       
   243     aCallHeaderData->SetCipheringIndicatorAllowed( 
       
   244         iStateMachine.PhoneEngineInfo()->SecureSpecified() );
       
   245     
       
   246     iManagerUtility.SetPhoneNumberAvailabilityL( 
       
   247             iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ).Length(),
       
   248             ContactInfoAvailable( aCallId ) );
       
   249     
       
   250     //see service provider settings API
       
   251     aCallHeaderData->SetServiceId(
       
   252        iStateMachine.PhoneEngineInfo()->ServiceId( aCallId ) );
       
   253        
       
   254     // Set contact link, see virtual phonebook API
       
   255     aCallHeaderData->SetContactLink(
       
   256        iStateMachine.PhoneEngineInfo()->ContactLink( aCallId ) );
       
   257        
       
   258     // Set remote phone number
       
   259     aCallHeaderData->SetRemotePhoneNumber(
       
   260        iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ) );
       
   261     }
       
   262 
       
   263 // ---------------------------------------------------------------------------
       
   264 //  TPhoneCallHeaderParam::GetCallType
       
   265 // ---------------------------------------------------------------------------
       
   266 //
       
   267 TPECallType TPhoneCallHeaderParam::GetCallType( 
       
   268         const TInt aCallId,
       
   269         TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   270     {
       
   271     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::GetCallType( ) ");
       
   272     // Set call header type.
       
   273     TPECallType callType = iStateMachine.PhoneEngineInfo()->CallType( aCallId );
       
   274     switch ( callType )
       
   275        {
       
   276        case EPECallTypeCSVoice:
       
   277            {
       
   278            if ( iStateMachine.PhoneEngineInfo()->CallALSLine( aCallId ) 
       
   279                 == CCCECallParameters::ECCELineTypeAux )
       
   280                {
       
   281                SetCallHeaderType( CBubbleManager::ELine2 );
       
   282                aCallHeaderData->SetLine2( ETrue );
       
   283                }
       
   284            else
       
   285                {
       
   286                SetCallHeaderType( CBubbleManager::ENormal );
       
   287                }
       
   288            }
       
   289            break;
       
   290        case EPECallTypeVideo:
       
   291            SetCallHeaderType( CBubbleManager::EVideo );
       
   292            break;
       
   293        case EPECallTypeVoIP:
       
   294            SetCallHeaderType( CBubbleManager::EVoIPCall );
       
   295            break;
       
   296          default:
       
   297            // None
       
   298            break;     
       
   299        }
       
   300     __PHONELOG1( EBasic, EPhoneControl, 
       
   301                 "TPhoneCallHeaderParam::GetCallType() - callType: %d ", 
       
   302                 callType )
       
   303     return callType;
       
   304     }
       
   305 
       
   306 // ---------------------------------------------------------------------------
       
   307 //  TPhoneCallHeaderParam::SetCallHeaderType
       
   308 // ---------------------------------------------------------------------------
       
   309 //
       
   310 void TPhoneCallHeaderParam::SetCallHeaderType( 
       
   311     const CBubbleManager::TPhoneCallTypeFlags aCallHeaderType )
       
   312     {
       
   313     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetCallHeaderType( ) ");
       
   314     iCallHeaderType = aCallHeaderType;
       
   315     __PHONELOG1( EBasic, EPhoneControl, 
       
   316                     "TPhoneCallHeaderParam::SetCallHeaderType() - iCallHeaderType: %d ", 
       
   317                     iCallHeaderType )
       
   318     }
       
   319 
       
   320 // ---------------------------------------------------------------------------
       
   321 //  TPhoneCallHeaderParam::CallHeaderType
       
   322 // ---------------------------------------------------------------------------
       
   323 //
       
   324 CBubbleManager::TPhoneCallTypeFlags TPhoneCallHeaderParam::CallHeaderType() const
       
   325     {
       
   326     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::CallHeaderType( ) ");
       
   327     __PHONELOG1( EBasic, EPhoneControl, 
       
   328                         "TPhoneCallHeaderParam::CallHeaderType() - iCallHeaderType: %d ", 
       
   329                         iCallHeaderType )
       
   330     return iCallHeaderType;            
       
   331     }
       
   332 
       
   333 // ---------------------------------------------------------------------------
       
   334 //  TPhoneCallHeaderParam::ContactInfoAvailable
       
   335 // ---------------------------------------------------------------------------
       
   336 //
       
   337 TBool TPhoneCallHeaderParam::ContactInfoAvailable( const TInt aCallId ) const
       
   338     {
       
   339     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::ContactInfoAvailable( ) ");
       
   340     TBool contactAvailable = EFalse;
       
   341     if ( ( iStateMachine.PhoneEngineInfo()->RemoteName( aCallId ).Length() ) || 
       
   342          ( iStateMachine.PhoneEngineInfo()->RemoteCompanyName( aCallId ).Length() ) )
       
   343         {
       
   344         contactAvailable = ETrue;
       
   345         }
       
   346     return contactAvailable;
       
   347     }
       
   348 
       
   349 // -----------------------------------------------------------------------------
       
   350 // TPhoneCallHeaderParam::SetCliAndCnapParamatersL
       
   351 // -----------------------------------------------------------------------------
       
   352 // 
       
   353 void TPhoneCallHeaderParam::SetCliAndCnapParamatersL(
       
   354         const TInt aCallId, 
       
   355         TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   356     {
       
   357     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetCliAndCnapParamatersL( ) ");
       
   358     TBuf<KCntMaxTextFieldLength> cnapText( KNullDesC );
       
   359 
       
   360     // Set call header number type
       
   361     aCallHeaderData->SetNumberType( iStateMachine.PhoneEngineInfo()->RemotePhoneNumberType( aCallId ) );
       
   362         
       
   363     const MPEClientInformation& info = 
       
   364         iStateMachine.PhoneEngineInfo()->CallClientInformation( aCallId );
       
   365 
       
   366     if ( ( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ).Length() ) && 
       
   367          ( !ContactInfoAvailable( aCallId ) ) && 
       
   368          ( !info.ShowNumber() ) )
       
   369         {
       
   370         // No contact info data available use the phone number.
       
   371         aCallHeaderData->SetCLIText(
       
   372                 iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ),
       
   373                 CBubbleManager::ELeft);
       
   374         
       
   375         // No contact name, use phonenumber when available.
       
   376         aCallHeaderData->SetParticipantListCLI( 
       
   377                 TPhoneCmdParamCallHeaderData::EPhoneParticipantCNAPText );
       
   378         }
       
   379     else
       
   380         {
       
   381         TBuf<KCntMaxTextFieldLength> remoteInfoText( KNullDesC );
       
   382         
       
   383         /*If call is Private/PayPhone call then IsCallPrivateOrPayPhone
       
   384         * will set SetIdentitySpecificCallHeaderData parameters therefore
       
   385         * there is no need to call GetRemoteInfoDataL.*/        
       
   386         if ( !IsCallPrivateOrPayPhone( aCallId, remoteInfoText ) )
       
   387             {
       
   388             GetRemoteInfoDataL( aCallId, remoteInfoText );
       
   389             }
       
   390         
       
   391         // Set remote info data as the CLI text for the call header
       
   392         aCallHeaderData->SetCLIText( remoteInfoText, CBubbleManager::ERight );
       
   393         }
       
   394 
       
   395     // Fetch CNAP text and clipping direction
       
   396     CBubbleManager::TPhoneClippingDirection cnapClippingDirection; 
       
   397     GetCNAPText( aCallId, cnapText, cnapClippingDirection );
       
   398     
       
   399     // Set CNAP data 
       
   400     aCallHeaderData->SetCNAPText( cnapText, cnapClippingDirection );
       
   401     
       
   402     // Set caller image 
       
   403     SetCallerImage( aCallId, aCallHeaderData );
       
   404 
       
   405     // Set the Caller text
       
   406     if ( iStateMachine.PhoneEngineInfo()->CallerText( aCallId ).Length() > 0 )
       
   407         {
       
   408         aCallHeaderData->SetCallerText( iStateMachine.PhoneEngineInfo()->CallerText( aCallId ) );
       
   409         }        
       
   410     
       
   411     // Set the call header CNAP data ( Contains possible CNAP name or received skype identification ).
       
   412     if ( IsFeatureSupported( KTelephonyLVFlagUUS, aCallId ) )
       
   413         {
       
   414         aCallHeaderData->SetCNAPText( iStateMachine.PhoneEngineInfo()->RemotePartyName( aCallId ), 
       
   415                 CBubbleManager::ERight );
       
   416         }
       
   417     }
       
   418 
       
   419 // ---------------------------------------------------------------------------
       
   420 //  TPhoneCallHeaderParam::GetCNAPText
       
   421 // ---------------------------------------------------------------------------
       
   422 //
       
   423 void TPhoneCallHeaderParam::GetCNAPText( 
       
   424        const TInt aCallId,
       
   425        TDes& aData, 
       
   426        CBubbleManager::TPhoneClippingDirection& aDirection ) const
       
   427     {
       
   428     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::GetCNAPText( ) ");
       
   429     
       
   430     // Set clipping direction  
       
   431     aDirection = CBubbleManager::ERight;
       
   432     
       
   433     // If it's not a private number show further info
       
   434     if ( iStateMachine.PhoneEngineInfo()->RemotePhoneNumberType( aCallId ) != 
       
   435         EPEPrivateNumber )
       
   436         {
       
   437         if ( ( iStateMachine.PhoneEngineInfo()->RemoteName( aCallId ).Length() ||
       
   438             iStateMachine.PhoneEngineInfo()->RemotePartyName( aCallId ).Length() || 
       
   439             iStateMachine.PhoneEngineInfo()->RemoteCompanyName( aCallId ).Length() ) &&
       
   440             iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ).Length() )
       
   441             {
       
   442             // Use the phone number for the CNAP display
       
   443             aData.Copy( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ) );
       
   444             
       
   445             // Clipping direction for non-private number
       
   446             aDirection = CBubbleManager::ELeft;
       
   447             }
       
   448         }
       
   449     }
       
   450 
       
   451 // ---------------------------------------------------------------------------
       
   452 //  TPhoneCallHeaderParam::IsFeatureSupported
       
   453 // ---------------------------------------------------------------------------
       
   454 //
       
   455 TBool TPhoneCallHeaderParam::IsFeatureSupported( 
       
   456         const TInt aFeatureKey, 
       
   457         const TInt aCallId ) const
       
   458     {
       
   459     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::IsFeatureSupported( ) ");
       
   460     TBool featureSupport(EFalse);
       
   461     switch( aFeatureKey )
       
   462         {
       
   463         case KTelephonyLVFlagUUS:
       
   464             {
       
   465             if( ( CPhoneCenRepProxy::Instance()->IsTelephonyFeatureSupported( aFeatureKey ) ) &&
       
   466                 ( iStateMachine.PhoneEngineInfo()->RemotePartyName( aCallId ).Length() ) )
       
   467                 {
       
   468                 featureSupport = ETrue;
       
   469                 }
       
   470             }
       
   471             break;
       
   472         default:
       
   473             //Do nothing.
       
   474             break;
       
   475         }
       
   476     __PHONELOG1( EBasic, EPhoneControl, 
       
   477             "TPhoneCallHeaderParam::IsFeatureSupported() - featureSupport: %d ", 
       
   478             featureSupport )
       
   479     
       
   480     return featureSupport;
       
   481     }
       
   482 
       
   483 // ---------------------------------------------------------------------------
       
   484 // TPhoneCallHeaderParam::SetDivertIndicatorToCallHeader
       
   485 // ---------------------------------------------------------------------------
       
   486 //
       
   487 void TPhoneCallHeaderParam::SetDivertIndicatorToCallHeader( 
       
   488     const TInt aCallId, 
       
   489     TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   490     {
       
   491     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetDivertIndicatorToCallHeader( ) ");
       
   492     if( iSetDivertIndication )
       
   493         {
       
   494         aCallHeaderData->AddCallFlag( CBubbleManager::EDiverted );
       
   495         }
       
   496     
       
   497     if ( iStateMachine.PhoneEngineInfo()->CallALSLine( aCallId ) == CCCECallParameters::ECCELineTypeAux )
       
   498         {
       
   499         __PHONELOG( EBasic, EPhoneControl, 
       
   500                 "TPhoneCallHeaderParam::SetDivertIndicatorToCallHeader - CallALSLine() == CCCECallParameters::ECCELineTypeAux");
       
   501         aCallHeaderData->SetLine2( ETrue );    
       
   502         }        
       
   503     }
       
   504 
       
   505 // ---------------------------------------------------------------------------
       
   506 // TPhoneCallHeaderParam::SetDivertIndication
       
   507 // ---------------------------------------------------------------------------
       
   508 //
       
   509 void TPhoneCallHeaderParam::SetDivertIndication( const TBool aDivertIndication )
       
   510     {
       
   511     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetDivertIndication( ) ");
       
   512     iSetDivertIndication = aDivertIndication;           
       
   513     __PHONELOG1( EBasic, EPhoneControl, 
       
   514                 "TPhoneCallHeaderParam::SetDivertIndication() - iSetDivertIndication: %d ", 
       
   515                 iSetDivertIndication )
       
   516     }
       
   517 
       
   518 // ---------------------------------------------------------------------------
       
   519 //  TPhoneCallHeaderParam::SetIncomingCallHeaderParamsL
       
   520 // ---------------------------------------------------------------------------
       
   521 //
       
   522 void TPhoneCallHeaderParam::SetIncomingCallHeaderParamsL(
       
   523         const TInt aCallId, 
       
   524         const TBool aWaitingCall,
       
   525         const TBool aVideoCall,
       
   526         TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   527     {
       
   528     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetIncomingCallHeaderParamsL( ) ");
       
   529     // Set basic params must be called before update is called.
       
   530     SetBasicCallHeaderParamsL( aCallId, aCallHeaderData );
       
   531     
       
   532     // Set call header labels
       
   533     SetCallHeaderTexts( 
       
   534             aCallId, 
       
   535             aWaitingCall, 
       
   536             aVideoCall, 
       
   537             aCallHeaderData );
       
   538     
       
   539     SetCliAndCnapParamatersL( aCallId, aCallHeaderData );
       
   540     
       
   541     // Set divert indication to call header if needed.
       
   542     SetDivertIndicatorToCallHeader( aCallId, aCallHeaderData );
       
   543     }
       
   544 
       
   545 // ---------------------------------------------------------------------------
       
   546 //  TPhoneCallHeaderParam::SetOutgoingCallHeaderParamsL
       
   547 // ---------------------------------------------------------------------------
       
   548 //
       
   549 void TPhoneCallHeaderParam::SetOutgoingCallHeaderParamsL(
       
   550         const TInt aCallId,
       
   551         TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   552     {
       
   553     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetOutgoingCallHeaderParamsL( ) ");
       
   554     // Set basic params must be called before update is called.
       
   555     SetBasicCallHeaderParamsL( aCallId, aCallHeaderData );
       
   556     
       
   557     // Set call header labels
       
   558     if ( aCallHeaderData->CallType() == EPECallTypeVideo )
       
   559         {
       
   560         iManagerUtility.LoadCallHeaderTexts( 
       
   561                 EPhoneOutgoingVideoCallLabel, 
       
   562                 EPhoneOutgoingVideoCallLabelShort, 
       
   563                 aCallHeaderData );
       
   564         }
       
   565     else
       
   566         {
       
   567         iManagerUtility.LoadCallHeaderTexts( 
       
   568                 EPhoneOutgoingCallLabel, 
       
   569                 EPhoneOutgoingCallLabelShort, 
       
   570                 aCallHeaderData );
       
   571         }
       
   572     
       
   573     SetCliParamatersL( aCallId, aCallHeaderData );
       
   574     }
       
   575 
       
   576 // ---------------------------------------------------------------------------
       
   577 //  TPhoneCallHeaderParam::UpdateCallHeaderInfoL
       
   578 // ---------------------------------------------------------------------------
       
   579 //
       
   580 void TPhoneCallHeaderParam::UpdateCallHeaderInfoL( 
       
   581         const TInt aCallId,
       
   582         const TBool aWaitingCall,
       
   583         const TBool aVideoCall,
       
   584         TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   585     {
       
   586     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::UpdateCallHeaderInfoL( ) ");
       
   587     __ASSERT_DEBUG( iStateMachine.PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
       
   588     TBuf<KCntMaxTextFieldLength> remoteInfoText( KNullDesC );
       
   589     
       
   590     // Set call header type
       
   591     GetCallType( aCallId, aCallHeaderData );
       
   592     aCallHeaderData->SetCallFlag( CallHeaderType() );
       
   593     
       
   594     // Set CLI text for the call header
       
   595     GetRemoteInfoDataL( aCallId, remoteInfoText );
       
   596     if ( remoteInfoText != KNullDesC )
       
   597         {
       
   598         aCallHeaderData->SetCLIText( remoteInfoText, CBubbleManager::ERight );
       
   599         if ( IsCallPrivateOrPayPhone( aCallId, remoteInfoText ) )
       
   600             {
       
   601             aCallHeaderData->SetCNAPText( remoteInfoText, CBubbleManager::ERight );
       
   602             }
       
   603         else
       
   604             {
       
   605             aCallHeaderData->SetCNAPText( iStateMachine.PhoneEngineInfo()->
       
   606                 RemotePhoneNumber( aCallId ), CBubbleManager::ELeft );       
       
   607             }
       
   608         }
       
   609     else
       
   610         {
       
   611         aCallHeaderData->SetCLIText( 
       
   612             iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ),
       
   613             CBubbleManager::ERight );
       
   614         }
       
   615 
       
   616     // If KTelephonyLVFlagUUS is enabled it will over write RemotePartyName setting.
       
   617     // Contains possible CNAP name or received skype identification
       
   618     if ( IsFeatureSupported( KTelephonyLVFlagUUS, aCallId ) )
       
   619         {
       
   620         TBuf<KCntMaxTextFieldLength> remotePartyName( KNullDesC );
       
   621         remotePartyName.Copy( iStateMachine.PhoneEngineInfo()->RemotePartyName( aCallId ) );
       
   622        
       
   623         if ( iStateMachine.PhoneEngineInfo()->CallState( aCallId ) == EPEStateRinging )
       
   624             {
       
   625             // Set CNAP text  
       
   626             aCallHeaderData->SetCNAPText( remotePartyName, CBubbleManager::ERight );
       
   627             }
       
   628         else
       
   629             {
       
   630             aCallHeaderData->SetCLIText( remotePartyName, CBubbleManager::ERight );
       
   631             }
       
   632         }   
       
   633 
       
   634     
       
   635     // Set call header labels
       
   636     SetCallHeaderTexts( 
       
   637             aCallId, 
       
   638             aWaitingCall, 
       
   639             aVideoCall, 
       
   640             aCallHeaderData );
       
   641             
       
   642     // Update caller image
       
   643     SetCallerImage( 
       
   644             aCallId, 
       
   645             aCallHeaderData ); 
       
   646     }
       
   647 
       
   648 // ---------------------------------------------------------------------------
       
   649 // TPhoneCallHeaderParam::IsCallPrivateOrPayPhone
       
   650 // ---------------------------------------------------------------------------
       
   651 //
       
   652 TBool TPhoneCallHeaderParam::IsCallPrivateOrPayPhone( const TInt aCallId, TDes& aData ) const 
       
   653     {
       
   654     __LOGMETHODSTARTEND( EPhoneControl, "TPhoneCallHeaderParam::IsCallPrivateOrPayPhone() ");
       
   655     __ASSERT_DEBUG( iStateMachine.PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
       
   656     TBool ret( EFalse );
       
   657     const RMobileCall::TMobileCallRemoteIdentityStatus identity = iStateMachine.PhoneEngineInfo()->RemoteIdentity( aCallId );
       
   658     if ( ( iStateMachine.PhoneEngineInfo()->RemotePhoneNumberType( aCallId ) == EPEPrivateNumber ) ||
       
   659             identity == RMobileCall::ERemoteIdentityUnavailableNoCliCoinOrPayphone || 
       
   660             identity == RMobileCall::ERemoteIdentityAvailableNoCliCoinOrPayphone )
       
   661         {
       
   662         SetIdentitySpecificCallHeaderData( aCallId, aData );
       
   663         ret = ETrue;
       
   664         }
       
   665     
       
   666     __PHONELOG1( EBasic, EPhoneControl, "TPhoneCallHeaderParam::IsCallPrivateOrPayPhone() - returns = %d ", ret);
       
   667     return ret;  
       
   668     }
       
   669 
       
   670 // ---------------------------------------------------------------------------
       
   671 //  TPhoneCallHeaderParam::GetRemoteInfoDataL
       
   672 // ---------------------------------------------------------------------------
       
   673 //
       
   674 void TPhoneCallHeaderParam::GetRemoteInfoDataL( 
       
   675         const TInt aCallId, 
       
   676         TDes& aData ) const 
       
   677     {
       
   678     __LOGMETHODSTARTEND( EPhoneControl, "TPhoneCallHeaderParam::GetRemoteInfoDataL() ");
       
   679     __PHONELOG1( EBasic, EPhoneControl, "TPhoneCallHeaderParam::GetRemoteInfoDataL() - call id =%d ", aCallId);
       
   680     __ASSERT_DEBUG( iStateMachine.PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
       
   681     if ( aCallId == KEmergencyCallId )
       
   682         {
       
   683         // Set emergency label text
       
   684         iManagerUtility.LoadResource( aData, EPhoneEmergencyCallHeader );
       
   685         }
       
   686     else
       
   687         {
       
   688         // Note next if-statements are in priority order so be careful if you change order
       
   689         // or add new if-statements.
       
   690         if ( iStateMachine.PhoneEngineInfo()->RemoteName( aCallId ).Length() )
       
   691             {
       
   692             // Display the contact name if it is available
       
   693             aData.Copy( iStateMachine.PhoneEngineInfo()->RemoteName( aCallId ) );
       
   694             }
       
   695         else if ( iStateMachine.PhoneEngineInfo()->RemotePartyName( aCallId ).Length() )
       
   696             {
       
   697             // Display the CNAP or UUS info if it is available.
       
   698             aData.Copy( iStateMachine.PhoneEngineInfo()->RemotePartyName( aCallId ) );
       
   699             }
       
   700         else if ( iStateMachine.PhoneEngineInfo()->RemoteCompanyName( aCallId ).Length() )
       
   701             {
       
   702             // Display the company name if it is available
       
   703             aData.Copy( iStateMachine.PhoneEngineInfo()->RemoteCompanyName( aCallId ) );
       
   704             }
       
   705         else if ( iStateMachine.PhoneEngineInfo()->CallState( aCallId ) == EPEStateRinging  )
       
   706             {
       
   707             SetIdentitySpecificCallHeaderData( aCallId, aData );
       
   708            }
       
   709         else
       
   710             {
       
   711             if ( ( iStateMachine.PhoneEngineInfo()->CallState( aCallId ) != EPEStateDialing ) && 
       
   712                  ( iStateMachine.PhoneEngineInfo()->CallState( aCallId ) != EPEStateRinging ) &&
       
   713                  ( iStateMachine.PhoneEngineInfo()->CallState( aCallId ) != EPEStateAnswering ) )
       
   714                 {
       
   715                 iManagerUtility.GetInCallNumberTextL( aCallId, aData );
       
   716                 }
       
   717             }
       
   718         }
       
   719     }
       
   720 
       
   721 // ---------------------------------------------------------------------------
       
   722 // TPhoneCallHeaderParam::SetIdentitySpecificCallHeaderData
       
   723 // ---------------------------------------------------------------------------
       
   724 //
       
   725 void TPhoneCallHeaderParam::SetIdentitySpecificCallHeaderData( const TInt aCallId,  TDes& aData ) const 
       
   726     {
       
   727     __LOGMETHODSTARTEND( EPhoneControl, "TPhoneCallHeaderParam::SetIdentitySpecificCallHeaderData() ")
       
   728     __ASSERT_DEBUG( iStateMachine.PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
       
   729     
       
   730     const RMobileCall::TMobileCallRemoteIdentityStatus identity = iStateMachine.PhoneEngineInfo()->RemoteIdentity( aCallId );
       
   731     const TPEPhoneNumberIdType idType = iStateMachine.PhoneEngineInfo()->RemotePhoneNumberType( aCallId );
       
   732     
       
   733     __PHONELOG1( EBasic, EPhoneControl, "TPhoneCallHeaderParam::SetIdentitySpecificCallHeaderData() - RemoteIdentity: %d ", 
       
   734             identity )
       
   735     __PHONELOG1( EBasic, EPhoneControl, "TPhoneCallHeaderParam::SetIdentitySpecificCallHeaderData() - idType: %d ", 
       
   736             idType )
       
   737     // If ringing call is emergency call then do not set identity specific info to call header
       
   738     // because emergency call header doesnt contain identity specific information.
       
   739     if ( aCallId == KEmergencyCallId )
       
   740             {
       
   741             // do nothing.
       
   742             }
       
   743     else if ( idType == EPEPrivateNumber )
       
   744         {
       
   745         // If call header has customized items and callheadertype is voip
       
   746         // then load customized text.
       
   747         if ( ( iManagerUtility.Customization() ) && ( CallHeaderType() == CBubbleManager::EVoIPCall ) )
       
   748             {
       
   749             // Display private address
       
   750             iManagerUtility.LoadResource( aData, iManagerUtility.Customization()->CustomizeCallHeaderText() );
       
   751             }
       
   752         else
       
   753             {
       
   754             // Display "private number".
       
   755             iManagerUtility.LoadResource( aData, EPhoneCLIWithheld );  
       
   756             }       
       
   757         }
       
   758     else if( ( identity == RMobileCall::ERemoteIdentityUnavailableNoCliCoinOrPayphone ) ||
       
   759              ( identity == RMobileCall::ERemoteIdentityAvailableNoCliCoinOrPayphone ) )
       
   760         {
       
   761         // Display "Payphone".
       
   762         iManagerUtility.LoadResource( aData, EPhoneCLIPayphone );
       
   763         }
       
   764     else if ( identity == RMobileCall::ERemoteIdentityUnknown  )
       
   765         {
       
   766         // Display "Call".
       
   767         iManagerUtility.LoadResource( aData, EPhoneCall );
       
   768         }
       
   769     }
       
   770