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