phoneapp/phoneuicontrol/src/tphonecallheaderparam.cpp
changeset 77 2be0b271d017
parent 72 c76a0b1755b9
equal deleted inserted replaced
72:c76a0b1755b9 77:2be0b271d017
     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 ( EPECallTypeUninitialized ),
       
    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 && numberType != EPEUnknownNumber )
       
    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( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ),
       
   159                  TPhoneCmdParamCallHeaderData::ELeft );
       
   160             
       
   161         // No contact name, use phonenumber when available.
       
   162         aCallHeaderData->SetParticipantListCLI(
       
   163                 TPhoneCmdParamCallHeaderData::EPhoneParticipantCNAPText );
       
   164         }
       
   165     else
       
   166         {
       
   167         TPhoneCmdParamCallHeaderData::TPhoneTextClippingDirection cnapClippingDirection = TPhoneCmdParamCallHeaderData::ERight;
       
   168         TBuf<KCntMaxTextFieldLength> remoteInfoText( KNullDesC );
       
   169  
       
   170         TBool secondaryCli = GetRemoteInfoDataL( aCallId, remoteInfoText );
       
   171         cnapClippingDirection = TPhoneCmdParamCallHeaderData::ELeft;
       
   172 
       
   173         aCallHeaderData->SetCLIText( remoteInfoText,  TPhoneCmdParamCallHeaderData::ERight );
       
   174         
       
   175         if (secondaryCli)
       
   176             {
       
   177             aCallHeaderData->SetCNAPText( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ), 
       
   178                 cnapClippingDirection );
       
   179             }
       
   180         }
       
   181     
       
   182     SetCallerImage( aCallId, aCallHeaderData );
       
   183 
       
   184     // Set the Caller text
       
   185     if ( iStateMachine.PhoneEngineInfo()->CallerText( aCallId ).Length() > 0 )
       
   186         {
       
   187         aCallHeaderData->SetCallerText( iStateMachine.PhoneEngineInfo()->CallerText( aCallId ) );
       
   188         }
       
   189     }
       
   190 
       
   191 // -----------------------------------------------------------------------------
       
   192 // TPhoneCallHeaderParam::SetCallerImage
       
   193 // -----------------------------------------------------------------------------
       
   194 //     
       
   195 void TPhoneCallHeaderParam::SetCallerImage( 
       
   196         const TInt aCallId, 
       
   197         TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   198     {
       
   199     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetCallerImage( ) ");
       
   200     // Set the call header picture data if it is available
       
   201     if ( ( iStateMachine.PhoneEngineInfo()->CallerImage( aCallId ).Length() > 0 )  && 
       
   202          ( BaflUtils::FileExists( CCoeEnv::Static()->FsSession(), 
       
   203                                   iStateMachine.PhoneEngineInfo()->CallerImage( aCallId ) ) ) )
       
   204         {
       
   205         aCallHeaderData->SetPicture( iStateMachine.PhoneEngineInfo()->CallerImage( aCallId ) );
       
   206         }
       
   207     else
       
   208         {
       
   209         // Set the thumbnail picture data if it is available
       
   210         aCallHeaderData->SetHasThumbnail( iStateMachine.PhoneEngineInfo()->HasCallerThumbnail( aCallId ) );
       
   211         CFbsBitmap* picture = iStateMachine.PhoneEngineInfo()->CallerThumbnail( aCallId );
       
   212         if ( picture )
       
   213             {
       
   214             aCallHeaderData->SetThumbnail( picture );
       
   215             }
       
   216         }
       
   217     }
       
   218 
       
   219 // ---------------------------------------------------------------------------
       
   220 //  TPhoneCallHeaderParam::SetBasicCallHeaderParamsL
       
   221 // ---------------------------------------------------------------------------
       
   222 //
       
   223 void TPhoneCallHeaderParam::SetBasicCallHeaderParamsL(
       
   224         const TInt aCallId, 
       
   225         TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   226     {
       
   227     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetBasicCallHeaderParamsL( ) ");
       
   228     // Set call header call state
       
   229     aCallHeaderData->SetCallState( 
       
   230         iStateMachine.PhoneEngineInfo()->CallState( aCallId ) );
       
   231 
       
   232     // Set call header type            
       
   233     aCallHeaderData->SetCallType( GetCallType( aCallId, aCallHeaderData ) );
       
   234     
       
   235     // Set call header voice privacy status
       
   236     aCallHeaderData->SetCiphering( 
       
   237         iStateMachine.PhoneEngineInfo()->IsSecureCall( aCallId ) );
       
   238     aCallHeaderData->SetCipheringIndicatorAllowed( 
       
   239         iStateMachine.PhoneEngineInfo()->SecureSpecified() );
       
   240     
       
   241     //see service provider settings API
       
   242     aCallHeaderData->SetServiceId(
       
   243        iStateMachine.PhoneEngineInfo()->ServiceId( aCallId ) );
       
   244        
       
   245     // Set contact link, see virtual phonebook API
       
   246     aCallHeaderData->SetContactLink(
       
   247        iStateMachine.PhoneEngineInfo()->ContactLink( aCallId ) );
       
   248        
       
   249     // Set remote phone number
       
   250     aCallHeaderData->SetRemotePhoneNumber(
       
   251        iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ) );
       
   252     }
       
   253 
       
   254 // ---------------------------------------------------------------------------
       
   255 //  TPhoneCallHeaderParam::GetCallType
       
   256 // ---------------------------------------------------------------------------
       
   257 //
       
   258 TPECallType TPhoneCallHeaderParam::GetCallType( 
       
   259         const TInt aCallId,
       
   260         TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   261     {
       
   262     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::GetCallType( ) ");
       
   263     // Set call header type.
       
   264     TPECallType callType = 
       
   265         iStateMachine.PhoneEngineInfo()->CallType( aCallId );
       
   266     SetCallHeaderType( callType );
       
   267     
       
   268     if ( iStateMachine.PhoneEngineInfo()->CallALSLine( aCallId ) 
       
   269          == CCCECallParameters::ECCELineTypeAux )
       
   270         {
       
   271         aCallHeaderData->SetLine2( ETrue );
       
   272         }
       
   273 
       
   274     __PHONELOG1( EBasic, EPhoneControl, 
       
   275                 "TPhoneCallHeaderParam::GetCallType() - callType: %d ", 
       
   276                 callType )
       
   277     return callType;
       
   278     }
       
   279 
       
   280 // ---------------------------------------------------------------------------
       
   281 //  TPhoneCallHeaderParam::SetCallHeaderType
       
   282 // ---------------------------------------------------------------------------
       
   283 //
       
   284 void TPhoneCallHeaderParam::SetCallHeaderType( 
       
   285     TInt aCallHeaderType )
       
   286     {
       
   287     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetCallHeaderType( ) ");
       
   288     iCallHeaderType = aCallHeaderType;
       
   289     __PHONELOG1( EBasic, EPhoneControl, 
       
   290                     "TPhoneCallHeaderParam::SetCallHeaderType() - iCallHeaderType: %d ", 
       
   291                     iCallHeaderType )
       
   292     }
       
   293 
       
   294 // ---------------------------------------------------------------------------
       
   295 //  TPhoneCallHeaderParam::CallHeaderType
       
   296 // ---------------------------------------------------------------------------
       
   297 //
       
   298 TInt TPhoneCallHeaderParam::CallHeaderType() const
       
   299     {
       
   300     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::CallHeaderType( ) ");
       
   301     __PHONELOG1( EBasic, EPhoneControl, 
       
   302                         "TPhoneCallHeaderParam::CallHeaderType() - iCallHeaderType: %d ", 
       
   303                         iCallHeaderType )
       
   304     return iCallHeaderType;            
       
   305     }
       
   306 
       
   307 // ---------------------------------------------------------------------------
       
   308 //  TPhoneCallHeaderParam::ContactInfoAvailable
       
   309 // ---------------------------------------------------------------------------
       
   310 //
       
   311 TBool TPhoneCallHeaderParam::ContactInfoAvailable( const TInt aCallId ) const
       
   312     {
       
   313     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::ContactInfoAvailable( ) ");
       
   314     TBool contactAvailable = EFalse;
       
   315     if ( ( iStateMachine.PhoneEngineInfo()->RemoteName( aCallId ).Length() ) || 
       
   316          ( iStateMachine.PhoneEngineInfo()->RemoteCompanyName( aCallId ).Length() ) )
       
   317         {
       
   318         contactAvailable = ETrue;
       
   319         }
       
   320     return contactAvailable;
       
   321     }
       
   322 
       
   323 // -----------------------------------------------------------------------------
       
   324 // TPhoneCallHeaderParam::SetCliAndCnapParamatersL
       
   325 // -----------------------------------------------------------------------------
       
   326 // 
       
   327 void TPhoneCallHeaderParam::SetCliAndCnapParamatersL(
       
   328         const TInt aCallId, 
       
   329         TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   330     {
       
   331     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetCliAndCnapParamatersL( ) ");
       
   332     TBuf<KCntMaxTextFieldLength> cnapText( KNullDesC );
       
   333 
       
   334     // Set call header number type
       
   335     aCallHeaderData->SetNumberType( iStateMachine.PhoneEngineInfo()->RemotePhoneNumberType( aCallId ) );
       
   336         
       
   337     const MPEClientInformation& info = 
       
   338         iStateMachine.PhoneEngineInfo()->CallClientInformation( aCallId );
       
   339 
       
   340     if ( ( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ).Length() ) && 
       
   341          ( !ContactInfoAvailable( aCallId ) ) && 
       
   342          ( !info.ShowNumber() ) )
       
   343         {
       
   344         // No contact info data available; use the phone number
       
   345         aCallHeaderData->SetCLIText(
       
   346                 iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ),
       
   347                 TPhoneCmdParamCallHeaderData::ELeft);
       
   348         
       
   349         // No contact name, use phonenumber when available.
       
   350         aCallHeaderData->SetParticipantListCLI( 
       
   351                 TPhoneCmdParamCallHeaderData::EPhoneParticipantCNAPText );
       
   352         }
       
   353     else
       
   354         {
       
   355         TBuf<KCntMaxTextFieldLength> remoteInfoText( KNullDesC );
       
   356         
       
   357         GetRemoteInfoDataL( aCallId, remoteInfoText );
       
   358         aCallHeaderData->SetCLIText( remoteInfoText, TPhoneCmdParamCallHeaderData::ERight );
       
   359         }
       
   360 
       
   361     // Fetch CNAP text and clipping direction
       
   362     TPhoneCmdParamCallHeaderData::TPhoneTextClippingDirection cnapClippingDirection;
       
   363     GetCNAPText( aCallId, cnapText, cnapClippingDirection );
       
   364     
       
   365     // Set CNAP data 
       
   366     aCallHeaderData->SetCNAPText( cnapText, cnapClippingDirection );
       
   367     
       
   368     // Set caller image 
       
   369     SetCallerImage( aCallId, aCallHeaderData );
       
   370 
       
   371     // Set the Caller text
       
   372     if ( iStateMachine.PhoneEngineInfo()->CallerText( aCallId ).Length() > 0 )
       
   373         {
       
   374         aCallHeaderData->SetCallerText( iStateMachine.PhoneEngineInfo()->CallerText( aCallId ) );
       
   375         }        
       
   376     
       
   377     // Set the call header CNAP data ( Contains possible CNAP name or received skype identification ).
       
   378     if ( IsFeatureSupported( KTelephonyLVFlagUUS, aCallId ) )
       
   379         {
       
   380         aCallHeaderData->SetCNAPText( iStateMachine.PhoneEngineInfo()->RemotePartyName( aCallId ), 
       
   381                 TPhoneCmdParamCallHeaderData::ERight );
       
   382         }
       
   383     }
       
   384 
       
   385 // ---------------------------------------------------------------------------
       
   386 //  TPhoneCallHeaderParam::GetCNAPText
       
   387 // ---------------------------------------------------------------------------
       
   388 //
       
   389 void TPhoneCallHeaderParam::GetCNAPText( 
       
   390     const TInt aCallId,
       
   391        TDes& aData, 
       
   392        TPhoneCmdParamCallHeaderData::TPhoneTextClippingDirection& aDirection ) const
       
   393     {
       
   394     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::GetCNAPText( ) ");
       
   395     
       
   396     // Set clipping direction  
       
   397     aDirection = TPhoneCmdParamCallHeaderData::ERight;
       
   398     
       
   399     // If it's not a private number show further info
       
   400     if ( iStateMachine.PhoneEngineInfo()->RemotePhoneNumberType( aCallId ) != 
       
   401         EPEPrivateNumber )
       
   402         {
       
   403         if ( ( iStateMachine.PhoneEngineInfo()->RemoteName( aCallId ).Length() ||
       
   404             iStateMachine.PhoneEngineInfo()->RemotePartyName( aCallId ).Length() || 
       
   405             iStateMachine.PhoneEngineInfo()->RemoteCompanyName( aCallId ).Length() ) &&
       
   406             iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ).Length() )
       
   407             {
       
   408             // Use the phone number for the CNAP display
       
   409             aData.Copy( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ) );
       
   410             
       
   411             // Clipping direction for non-private number
       
   412             aDirection = TPhoneCmdParamCallHeaderData::ELeft;
       
   413             }
       
   414         }
       
   415     }
       
   416 
       
   417 // ---------------------------------------------------------------------------
       
   418 //  TPhoneCallHeaderParam::IsFeatureSupported
       
   419 // ---------------------------------------------------------------------------
       
   420 //
       
   421 TBool TPhoneCallHeaderParam::IsFeatureSupported( 
       
   422         const TInt aFeatureKey, 
       
   423         const TInt aCallId ) const
       
   424     {
       
   425     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::IsFeatureSupported( ) ");
       
   426     TBool featureSupport(EFalse);
       
   427     switch( aFeatureKey )
       
   428         {
       
   429         case KTelephonyLVFlagUUS:
       
   430             {
       
   431             if( ( CPhoneCenRepProxy::Instance()->IsTelephonyFeatureSupported( aFeatureKey ) ) &&
       
   432                 ( iStateMachine.PhoneEngineInfo()->RemotePartyName( aCallId ).Length() ) )
       
   433                 {
       
   434                 featureSupport = ETrue;
       
   435                 }
       
   436             }
       
   437             break;
       
   438         default:
       
   439             //Do nothing.
       
   440             break;
       
   441         }
       
   442     __PHONELOG1( EBasic, EPhoneControl, 
       
   443             "TPhoneCallHeaderParam::IsFeatureSupported() - featureSupport: %d ", 
       
   444             featureSupport )
       
   445     
       
   446     return featureSupport;
       
   447     }
       
   448 
       
   449 // ---------------------------------------------------------------------------
       
   450 // TPhoneCallHeaderParam::SetDivertIndicatorToCallHeader
       
   451 // ---------------------------------------------------------------------------
       
   452 //
       
   453 void TPhoneCallHeaderParam::SetDivertIndicatorToCallHeader( 
       
   454     const TInt aCallId, 
       
   455     TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   456     {
       
   457     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetDivertIndicatorToCallHeader( ) ");
       
   458     if( iSetDivertIndication )
       
   459         {
       
   460         aCallHeaderData->SetDiverted( ETrue );
       
   461         }
       
   462     
       
   463     if ( iStateMachine.PhoneEngineInfo()->CallALSLine( aCallId ) == CCCECallParameters::ECCELineTypeAux )
       
   464         {
       
   465         __PHONELOG( EBasic, EPhoneControl, 
       
   466                 "TPhoneCallHeaderParam::SetDivertIndicatorToCallHeader - CallALSLine() == CCCECallParameters::ECCELineTypeAux");
       
   467         aCallHeaderData->SetLine2( ETrue );    
       
   468         }        
       
   469     }
       
   470 
       
   471 // ---------------------------------------------------------------------------
       
   472 // TPhoneCallHeaderParam::SetDivertIndication
       
   473 // ---------------------------------------------------------------------------
       
   474 //
       
   475 void TPhoneCallHeaderParam::SetDivertIndication( const TBool aDivertIndication )
       
   476     {
       
   477     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetDivertIndication( ) ");
       
   478     iSetDivertIndication = aDivertIndication;           
       
   479     __PHONELOG1( EBasic, EPhoneControl, 
       
   480                 "TPhoneCallHeaderParam::SetDivertIndication() - iSetDivertIndication: %d ", 
       
   481                 iSetDivertIndication )
       
   482     }
       
   483 
       
   484 // ---------------------------------------------------------------------------
       
   485 //  TPhoneCallHeaderParam::SetIncomingCallHeaderParamsL
       
   486 // ---------------------------------------------------------------------------
       
   487 //
       
   488 void TPhoneCallHeaderParam::SetIncomingCallHeaderParamsL(
       
   489         const TInt aCallId, 
       
   490         const TBool aWaitingCall,
       
   491         const TBool aVideoCall,
       
   492         TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   493     {
       
   494     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetIncomingCallHeaderParamsL( ) ");
       
   495     // Set basic params must be called before update is called.
       
   496     SetBasicCallHeaderParamsL( aCallId, aCallHeaderData );
       
   497     
       
   498     // Set call header labels
       
   499     SetCallHeaderTexts( 
       
   500             aCallId, 
       
   501             aWaitingCall, 
       
   502             aVideoCall, 
       
   503             aCallHeaderData );
       
   504     
       
   505     SetCliAndCnapParamatersL( aCallId, aCallHeaderData );
       
   506     
       
   507     // Set divert indication to call header if needed.
       
   508     SetDivertIndicatorToCallHeader( aCallId, aCallHeaderData );
       
   509     }
       
   510 
       
   511 // ---------------------------------------------------------------------------
       
   512 //  TPhoneCallHeaderParam::SetOutgoingCallHeaderParamsL
       
   513 // ---------------------------------------------------------------------------
       
   514 //
       
   515 void TPhoneCallHeaderParam::SetOutgoingCallHeaderParamsL(
       
   516         const TInt aCallId,
       
   517         TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   518     {
       
   519     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::SetOutgoingCallHeaderParamsL( ) ");
       
   520     // Set basic params must be called before update is called.
       
   521     SetBasicCallHeaderParamsL( aCallId, aCallHeaderData );
       
   522     
       
   523     // Set call header labels
       
   524     if ( aCallHeaderData->CallType() == EPECallTypeVideo )
       
   525         {
       
   526         iManagerUtility.LoadCallHeaderTexts( 
       
   527                 EPhoneOutgoingVideoCallLabel, 
       
   528                 EPhoneOutgoingVideoCallLabelShort, 
       
   529                 aCallHeaderData );
       
   530         }
       
   531     else
       
   532         {
       
   533         iManagerUtility.LoadCallHeaderTexts( 
       
   534                 EPhoneOutgoingCallLabel, 
       
   535                 EPhoneOutgoingCallLabelShort, 
       
   536                 aCallHeaderData );
       
   537         }
       
   538     
       
   539     SetCliParamatersL( aCallId, aCallHeaderData );
       
   540     }
       
   541 
       
   542 // ---------------------------------------------------------------------------
       
   543 //  TPhoneCallHeaderParam::UpdateCallHeaderInfoL
       
   544 // ---------------------------------------------------------------------------
       
   545 //
       
   546 void TPhoneCallHeaderParam::UpdateCallHeaderInfoL( 
       
   547         const TInt aCallId,
       
   548         const TBool aWaitingCall,
       
   549         const TBool aVideoCall,
       
   550         TPhoneCmdParamCallHeaderData* aCallHeaderData )
       
   551     {
       
   552     __LOGMETHODSTARTEND(EPhoneControl, "TPhoneCallHeaderParam::UpdateCallHeaderInfoL( ) ");
       
   553     __ASSERT_DEBUG( iStateMachine.PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
       
   554     TBuf<KCntMaxTextFieldLength> remoteInfoText( KNullDesC );
       
   555     
       
   556     // Set call header type
       
   557     GetCallType( aCallId, aCallHeaderData );
       
   558     
       
   559     // Set CLI text for the call header
       
   560     TBool secondaryCli = GetRemoteInfoDataL( aCallId, remoteInfoText );
       
   561     if ( remoteInfoText != KNullDesC )
       
   562         {
       
   563         aCallHeaderData->SetCLIText( remoteInfoText, TPhoneCmdParamCallHeaderData::ERight );
       
   564         if ( secondaryCli )
       
   565             {
       
   566             aCallHeaderData->SetCNAPText( iStateMachine.PhoneEngineInfo()->
       
   567                 RemotePhoneNumber( aCallId ), TPhoneCmdParamCallHeaderData::ELeft );       
       
   568             }
       
   569         }
       
   570     else
       
   571         {
       
   572         aCallHeaderData->SetCLIText( 
       
   573             iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ),
       
   574             TPhoneCmdParamCallHeaderData::ELeft );
       
   575         }
       
   576 
       
   577     // If KTelephonyLVFlagUUS is enabled it will over write RemotePartyName setting.
       
   578     // Contains possible CNAP name or received skype identification
       
   579     if ( IsFeatureSupported( KTelephonyLVFlagUUS, aCallId ) )
       
   580         {
       
   581         TBuf<KCntMaxTextFieldLength> remotePartyName( KNullDesC );
       
   582         remotePartyName.Copy( iStateMachine.PhoneEngineInfo()->RemotePartyName( aCallId ) );
       
   583        
       
   584         if ( iStateMachine.PhoneEngineInfo()->CallState( aCallId ) == EPEStateRinging )
       
   585             {
       
   586             // Set CNAP text  
       
   587             aCallHeaderData->SetCNAPText( remotePartyName, TPhoneCmdParamCallHeaderData::ERight );
       
   588             }
       
   589         else
       
   590             {
       
   591             aCallHeaderData->SetCLIText( remotePartyName, TPhoneCmdParamCallHeaderData::ERight );
       
   592             }
       
   593         }   
       
   594     
       
   595     // Set call header labels
       
   596     SetCallHeaderTexts( 
       
   597             aCallId, 
       
   598             aWaitingCall, 
       
   599             aVideoCall, 
       
   600             aCallHeaderData );
       
   601             
       
   602     // Update caller image
       
   603     SetCallerImage( 
       
   604             aCallId, 
       
   605             aCallHeaderData ); 
       
   606     }
       
   607 
       
   608 
       
   609 
       
   610 // ---------------------------------------------------------------------------
       
   611 //  TPhoneCallHeaderParam::GetRemoteInfoDataL
       
   612 // ---------------------------------------------------------------------------
       
   613 //
       
   614 TBool TPhoneCallHeaderParam::GetRemoteInfoDataL( 
       
   615         const TInt aCallId, 
       
   616         TDes& aData ) const 
       
   617     {
       
   618     __LOGMETHODSTARTEND( EPhoneControl, "TPhoneCallHeaderParam::GetRemoteInfoDataL() ");
       
   619     __PHONELOG1( EBasic, EPhoneControl, "TPhoneCallHeaderParam::GetRemoteInfoDataL() - call id =%d ", aCallId);
       
   620     __ASSERT_DEBUG( iStateMachine.PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
       
   621     
       
   622     TBool secondaryCli(EFalse);
       
   623         
       
   624     if ( aCallId == KEmergencyCallId )
       
   625         {
       
   626         // Set emergency label text
       
   627         iManagerUtility.LoadResource( aData, EPhoneEmergencyCallHeader );
       
   628         }
       
   629     else
       
   630         {
       
   631         const RMobileCall::TMobileCallRemoteIdentityStatus identity = iStateMachine.PhoneEngineInfo()->RemoteIdentity( aCallId );
       
   632         // Note next if-statements are in priority order so be careful if you change order
       
   633         // or add new if-statements.
       
   634         if ( iStateMachine.PhoneEngineInfo()->RemoteName( aCallId ).Length() )
       
   635             {
       
   636             // Display the contact name if it is available
       
   637             aData.Copy( iStateMachine.PhoneEngineInfo()->RemoteName( aCallId ) );
       
   638             secondaryCli = ETrue;
       
   639             }
       
   640         else if ( iStateMachine.PhoneEngineInfo()->RemotePartyName( aCallId ).Length() )
       
   641             {
       
   642             // Display the CNAP or UUS info if it is available.
       
   643             aData.Copy( iStateMachine.PhoneEngineInfo()->RemotePartyName( aCallId ) );
       
   644             secondaryCli = ETrue;
       
   645             }
       
   646         else if ( iStateMachine.PhoneEngineInfo()->RemoteCompanyName( aCallId ).Length() )
       
   647             {
       
   648             // Display the company name if it is available
       
   649             aData.Copy( iStateMachine.PhoneEngineInfo()->RemoteCompanyName( aCallId ) );
       
   650             }
       
   651         else if ( iStateMachine.PhoneEngineInfo()->CallDirection( aCallId ) == RMobileCall::EMobileTerminated )
       
   652             {
       
   653             if ( EPEPrivateNumber == iStateMachine.PhoneEngineInfo()->RemotePhoneNumberType( aCallId ) )
       
   654                 {
       
   655                 if ( EPECallTypeVoIP == CallHeaderType() )
       
   656                     {
       
   657                     iManagerUtility.LoadResource( aData, iManagerUtility.Customization()->CustomizeCallHeaderText() );
       
   658                     }
       
   659                 else
       
   660                     {
       
   661                     // private number
       
   662                     iManagerUtility.LoadResource( aData, EPhoneCLIWithheld );
       
   663                     }
       
   664                 }
       
   665             else if ( identity == RMobileCall::ERemoteIdentityUnavailableNoCliCoinOrPayphone || 
       
   666                     identity == RMobileCall::ERemoteIdentityAvailableNoCliCoinOrPayphone )
       
   667                 {
       
   668                 __PHONELOG( EBasic, EPhoneControl, "GetRemoteInfoDataL : payphone" );
       
   669                 // Display "Payphone".
       
   670                 iManagerUtility.LoadResource( aData, EPhoneCLIPayphone );
       
   671                 }
       
   672             else if ( identity == RMobileCall::ERemoteIdentityUnknown )
       
   673                 {
       
   674                 __PHONELOG( EBasic, EPhoneControl, "GetRemoteInfoDataL : unknown number" );
       
   675                 // Display "Unknown Number".
       
   676                 iManagerUtility.LoadResource( aData, EPhoneCallCLIUnknown );
       
   677                 }
       
   678             else if ( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ).Length() )
       
   679                 {
       
   680                 // Display the number if it is available
       
   681                 aData.Copy( iStateMachine.PhoneEngineInfo()->RemotePhoneNumber( aCallId ) );
       
   682                 }            
       
   683             }
       
   684 
       
   685         }
       
   686     return secondaryCli;
       
   687     }
       
   688