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