phoneapp/phoneuiqtviewadapter/src/phonecallheaderutil.cpp
changeset 76 cfea66083b62
parent 74 d1c62c765e48
equal deleted inserted replaced
74:d1c62c765e48 76:cfea66083b62
    14 * Description:  A parameter class for setting call header information
    14 * Description:  A parameter class for setting call header information
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include <mpeclientinformation.h>
       
    20 #include <StringLoader.h>
    19 #include <StringLoader.h>
    21 #include <bautils.h>
    20 #include <bautils.h>
    22 
    21 
    23 #include "phonecallheaderutil.h"
    22 #include "phonecallheaderutil.h"
    24 #include "tphonecmdparamboolean.h"
       
    25 #include "cphonemainresourceresolver.h"
    23 #include "cphonemainresourceresolver.h"
    26 #include "phonerssbase.h"
    24 #include "phonerssbase.h"
    27 #include "phoneui.pan"
       
    28 #include "cphonecenrepproxy.h"
    25 #include "cphonecenrepproxy.h"
    29 #include "telephonyvariant.hrh"
    26 #include "telephonyvariant.hrh"
    30 #include "phoneviewcommanddefinitions.h"
    27 #include "phoneviewcommanddefinitions.h"
    31 #include "phonelogger.h"
    28 #include "phonelogger.h"
    32 
    29 
    37 // -----------------------------------------------------------------------------
    34 // -----------------------------------------------------------------------------
    38 //  
    35 //  
    39 PhoneCallHeaderUtil::PhoneCallHeaderUtil(
    36 PhoneCallHeaderUtil::PhoneCallHeaderUtil(
    40         MPEEngineInfo& engineInfo ) 
    37         MPEEngineInfo& engineInfo ) 
    41         : m_engineInfo( engineInfo),
    38         : m_engineInfo( engineInfo),
    42           iCallHeaderType( EPECallTypeUninitialized ),
       
    43           iSetDivertIndication( EFalse ),
       
    44           iLabelText( NULL ),
    39           iLabelText( NULL ),
       
    40           iCliText( NULL ),
       
    41           iSecondaryCliText( NULL ),
       
    42           iCallerImage( NULL ),
    45           iEmergencyHeaderText( NULL ),
    43           iEmergencyHeaderText( NULL ),
    46           iAttemptingEmergencyText( NULL )
    44           iAttemptingEmergencyText( NULL )
    47     {
    45     {
    48     }
    46     }
    49 
    47 
    52 // -----------------------------------------------------------------------------
    50 // -----------------------------------------------------------------------------
    53 //  
    51 //  
    54 PhoneCallHeaderUtil::~PhoneCallHeaderUtil()
    52 PhoneCallHeaderUtil::~PhoneCallHeaderUtil()
    55     {
    53     {
    56     delete iLabelText;
    54     delete iLabelText;
    57     
    55     delete iCliText;
       
    56     delete iSecondaryCliText;
       
    57     delete iCallerImage;
    58     delete iEmergencyHeaderText;
    58     delete iEmergencyHeaderText;
    59     
       
    60     delete iAttemptingEmergencyText;
    59     delete iAttemptingEmergencyText;
    61     }
    60     }
    62 
    61 
    63 // -----------------------------------------------------------
    62 // -----------------------------------------------------------
    64 // PhoneCallHeaderUtil::SetCallHeaderTexts
    63 // PhoneCallHeaderUtil::LabelText
    65 // -----------------------------------------------------------
    64 // -----------------------------------------------------------
    66 //
    65 //
    67 void PhoneCallHeaderUtil::SetCallHeaderTexts(
    66 const TDesC& PhoneCallHeaderUtil::LabelText( TInt aCallId )
    68     const TInt aCallId, 
    67     {
    69     const TBool aWaitingCall,
    68 
    70     const TBool aVideoCall,
    69     if (iLabelText)
    71     TPhoneCmdParamCallHeaderData* aCallHeaderData )
    70         {
    72     {
    71         delete iLabelText;
    73     __LOGMETHODSTARTEND(EPhoneControl, "PhoneCallHeaderUtil::SetCallHeaderTexts( ) ");
    72         iLabelText = NULL;
    74     
    73         }
    75     TInt labelId(KPhoneRssCommonFirst);
    74     
       
    75     switch (m_engineInfo.CallState(aCallId))
       
    76         {
       
    77         case EPEStateDisconnecting:
       
    78             {
       
    79             iLabelText = LoadResource(EPhoneInCallDisconnected);
       
    80             break;
       
    81             }
       
    82         case EPEStateHeld:
       
    83         case EPEStateHeldConference:
       
    84             {
       
    85             iLabelText = LoadResource(EPhoneCallOnHold);
       
    86             break;
       
    87             }
       
    88         case EPEStateConnectedConference:
       
    89             {
       
    90             iLabelText = LoadResource(EPhoneCLIConferenceCall);
       
    91             break;
       
    92             }
       
    93         case EPEStateRinging:
       
    94             {
       
    95             SetCallHeaderLabelTextForRingingCall(aCallId);
       
    96             break;
       
    97             }
       
    98         case EPEStateDialing:
       
    99             {
       
   100             if ( IsVideoCall(aCallId) )
       
   101                 {
       
   102                 iLabelText = LoadResource(EPhoneOutgoingVideoCallLabel);
       
   103                 }
       
   104             else
       
   105                 {
       
   106                 iLabelText = LoadResource(EPhoneOutgoingCallLabel);
       
   107                 }
       
   108             break;
       
   109             }
       
   110         default:
       
   111             break;
       
   112         }
       
   113     
       
   114     return iLabelText ? *iLabelText : KNullDesC();
       
   115     }
       
   116 
       
   117 // -----------------------------------------------------------
       
   118 // PhoneCallHeaderUtil::GetCliTexts
       
   119 // -----------------------------------------------------------
       
   120 //
       
   121 void PhoneCallHeaderUtil::GetCliTexts( 
       
   122         TInt aCallId,
       
   123         TDes& aCliText,
       
   124         ClippingDirection &aCliClip,
       
   125         TDes& aSecondaryCliText,
       
   126         ClippingDirection &aSecondaryCliClip )
       
   127     {
       
   128     if ( aCallId == KEmergencyCallId )
       
   129         {
       
   130         // Set "Emergency call" as cli in emergency call.
       
   131         aCliText = EmergencyHeaderText();
       
   132         aCliClip = PhoneCallHeaderUtil::ERight;
       
   133         }
       
   134     else if ( aCallId == KConferenceCallId )
       
   135         {
       
   136         // No need for secondary cli in conference call.
       
   137         GetCli( aCallId, aCliText, aCliClip );
       
   138         }
       
   139     else
       
   140         {   
       
   141         GetCli( aCallId, aCliText, aCliClip );
       
   142         GetSecondaryCli( aCallId, aSecondaryCliText, aSecondaryCliClip );
       
   143         }
       
   144 
       
   145     }
       
   146     
       
   147 // -----------------------------------------------------------
       
   148 // PhoneCallHeaderUtil::GetCli
       
   149 // -----------------------------------------------------------
       
   150 //
       
   151 void PhoneCallHeaderUtil::GetCli( TInt aCallId,
       
   152         TDes& aCliText,
       
   153         ClippingDirection &aClipping )
       
   154     {
       
   155     if (iCliText)
       
   156         {
       
   157         delete iCliText;
       
   158         iCliText = NULL;
       
   159         }
       
   160     
       
   161     if ( aCallId == KEmergencyCallId )
       
   162         {
       
   163         aCliText = EmergencyHeaderText();
       
   164         aClipping = PhoneCallHeaderUtil::ERight;
       
   165         return;
       
   166         }
       
   167     else if ( aCallId == KConferenceCallId )
       
   168         {
       
   169         iCliText = LoadResource(EPhoneCLIConferenceCall);
       
   170         }
       
   171     else if ( ( m_engineInfo.RemotePhoneNumber( aCallId ).Length() ) && 
       
   172          ( !RemoteNameAvailable( aCallId ) ) )
       
   173         {   
       
   174         iCliText = m_engineInfo.RemotePhoneNumber( aCallId ).Alloc();  
       
   175         aClipping = PhoneCallHeaderUtil::ELeft;
       
   176         }
       
   177     else
       
   178         {
       
   179         TBuf<KCntMaxTextFieldLength> remoteInfoText( KNullDesC ); 
       
   180         GetRemoteInfoData( aCallId, remoteInfoText );
       
   181         
       
   182         iCliText = remoteInfoText.Alloc();
       
   183         aClipping = PhoneCallHeaderUtil::ERight;
       
   184         }
       
   185     
       
   186     aCliText = iCliText ? *iCliText : KNullDesC();
       
   187     }
       
   188 
       
   189 // -----------------------------------------------------------
       
   190 // PhoneCallHeaderUtil::GetSecondaryCli
       
   191 // -----------------------------------------------------------
       
   192 //
       
   193 void PhoneCallHeaderUtil::GetSecondaryCli( TInt aCallId,
       
   194         TDes& aSecondaryCliText,
       
   195         ClippingDirection &aClipping )
       
   196     {
       
   197     if (iSecondaryCliText)
       
   198         {
       
   199         delete iSecondaryCliText;
       
   200         iSecondaryCliText = NULL;
       
   201         }
       
   202     
       
   203     if ( IsSecondaryCliAllowed( aCallId ) )
       
   204         {
       
   205         if (CPhoneCenRepProxy::Instance()->
       
   206                 IsTelephonyFeatureSupported( KTelephonyLVFlagUUS ) &&
       
   207             m_engineInfo.RemotePartyName( aCallId ).Length() )
       
   208             {
       
   209             iSecondaryCliText = m_engineInfo.RemotePartyName( aCallId ).Alloc();
       
   210             aClipping = PhoneCallHeaderUtil::ERight;
       
   211             }
       
   212         else
       
   213             {
       
   214             iSecondaryCliText = m_engineInfo.RemotePhoneNumber( aCallId ).Alloc();
       
   215             aClipping = PhoneCallHeaderUtil::ELeft;
       
   216             }
       
   217         }
       
   218     
       
   219     aSecondaryCliText = iSecondaryCliText ? *iSecondaryCliText : KNullDesC();
       
   220     }
       
   221 
       
   222 // -----------------------------------------------------------
       
   223 // PhoneCallHeaderUtil::RemotePhoneNumber
       
   224 // -----------------------------------------------------------
       
   225 //
       
   226 const TDesC& PhoneCallHeaderUtil::RemotePhoneNumber( TInt aCallId ) const
       
   227     {
       
   228     return m_engineInfo.RemotePhoneNumber( aCallId );
       
   229     }
       
   230 
       
   231 // ---------------------------------------------------------------------------
       
   232 //  PhoneCallHeaderUtil::CallType
       
   233 // ---------------------------------------------------------------------------
       
   234 //
       
   235 TInt PhoneCallHeaderUtil::CallType( 
       
   236         const TInt aCallId )
       
   237     {
       
   238     return  (TInt)m_engineInfo.CallType( aCallId );
       
   239     }
       
   240 
       
   241 // ---------------------------------------------------------------------------
       
   242 //  PhoneCallHeaderUtil::ServiceId
       
   243 // ---------------------------------------------------------------------------
       
   244 //
       
   245 TInt PhoneCallHeaderUtil::ServiceId( 
       
   246         const TInt aCallId )
       
   247     {
       
   248     return m_engineInfo.ServiceId( aCallId );
       
   249     }
       
   250 
       
   251 // -----------------------------------------------------------
       
   252 // PhoneCallHeaderUtil::IsCallForwarded
       
   253 // -----------------------------------------------------------
       
   254 //
       
   255 TBool PhoneCallHeaderUtil::IsCallForwarded( TInt aCallId )
       
   256     {
       
   257     return m_engineInfo.IncomingCallForwarded(aCallId);
       
   258     }
       
   259 
       
   260 // -----------------------------------------------------------
       
   261 // PhoneCallHeaderUtil::SecureSpecified
       
   262 // -----------------------------------------------------------
       
   263 //
       
   264 TBool PhoneCallHeaderUtil::SecureSpecified()
       
   265     {
       
   266     return m_engineInfo.SecureSpecified();
       
   267     }
       
   268 
       
   269 // -----------------------------------------------------------
       
   270 // PhoneCallHeaderUtil::Ciphering
       
   271 // -----------------------------------------------------------
       
   272 //
       
   273 TBool PhoneCallHeaderUtil::Ciphering( TInt aCallId )
       
   274     {
       
   275     return m_engineInfo.IsSecureCall( aCallId );
       
   276     }
       
   277 
       
   278 // -----------------------------------------------------------
       
   279 // PhoneCallHeaderUtil::CallState
       
   280 // -----------------------------------------------------------
       
   281 //
       
   282 TInt PhoneCallHeaderUtil::CallState( TInt aCallId ) const
       
   283     {
       
   284     return m_engineInfo.CallState(aCallId);
       
   285     }
       
   286 
       
   287 // -----------------------------------------------------------------------------
       
   288 // PhoneCallHeaderUtil::CallerImage
       
   289 // -----------------------------------------------------------------------------
       
   290 //     
       
   291 const TDesC& PhoneCallHeaderUtil::CallerImage( const TInt aCallId )
       
   292     {
       
   293     if (iCallerImage)
       
   294         {
       
   295         delete iCallerImage;
       
   296         iCallerImage = NULL;
       
   297         }
       
   298     
       
   299     // Set the call header picture data if it is available
       
   300     if ( ( m_engineInfo.CallerImage( aCallId ).Length() > 0 )  && 
       
   301          ( BaflUtils::FileExists( CCoeEnv::Static()->FsSession(), 
       
   302                  m_engineInfo.CallerImage( aCallId ) ) ) )
       
   303         {
       
   304         iCallerImage = m_engineInfo.CallerImage( aCallId ).Alloc();
       
   305         }
       
   306 
       
   307     return iCallerImage ? *iCallerImage : KNullDesC();
       
   308     }
       
   309 
       
   310 // -----------------------------------------------------------
       
   311 // PhoneCallHeaderUtil::EmergencyHeaderText
       
   312 // -----------------------------------------------------------
       
   313 //
       
   314 const TDesC& PhoneCallHeaderUtil::EmergencyHeaderText()
       
   315     {
       
   316     if (!iEmergencyHeaderText)
       
   317         {
       
   318         iEmergencyHeaderText = LoadResource(EPhoneEmergencyCallHeader);
       
   319         }
       
   320      
       
   321     return iEmergencyHeaderText ? *iEmergencyHeaderText : KNullDesC();
       
   322     }
       
   323 
       
   324 // -----------------------------------------------------------
       
   325 // PhoneCallHeaderUtil::AttemptingEmergencyText
       
   326 // -----------------------------------------------------------
       
   327 //
       
   328 const TDesC& PhoneCallHeaderUtil::AttemptingEmergencyText()
       
   329     {
       
   330     if (!iAttemptingEmergencyText)
       
   331         {
       
   332         iAttemptingEmergencyText = LoadResource(EPhoneAttemptingEmergencyText);
       
   333         }
       
   334      
       
   335     return iAttemptingEmergencyText ? *iAttemptingEmergencyText : KNullDesC();
       
   336     }
       
   337 
       
   338 // ---------------------------------------------------------------------------
       
   339 //  PhoneCallHeaderUtil::IsVoiceCall
       
   340 // ---------------------------------------------------------------------------
       
   341 //
       
   342 TBool PhoneCallHeaderUtil::IsVoiceCall(TInt aCallId) const
       
   343     {
       
   344     if( aCallId < 0 )
       
   345         {
       
   346         return ( m_engineInfo.CallTypeCommand()
       
   347                     == EPECallTypeCSVoice ||
       
   348                 m_engineInfo.CallTypeCommand()
       
   349                     == EPECallTypeVoIP );  
       
   350         }
       
   351     
       
   352     return ( m_engineInfo.CallType( aCallId )
       
   353                 == EPECallTypeCSVoice ||
       
   354              m_engineInfo.CallType( aCallId )
       
   355                 == EPECallTypeVoIP );
       
   356     }
       
   357 
       
   358 // ---------------------------------------------------------------------------
       
   359 //  PhoneCallHeaderUtil::IsVideoCall
       
   360 // ---------------------------------------------------------------------------
       
   361 //
       
   362 TBool PhoneCallHeaderUtil::IsVideoCall(int aCallId ) const
       
   363     {
       
   364     if( aCallId < 0 )
       
   365         {
       
   366         return ( m_engineInfo.CallTypeCommand()
       
   367             == EPECallTypeVideo );  
       
   368         }
       
   369     return ( m_engineInfo.CallType( aCallId )
       
   370             == EPECallTypeVideo );
       
   371     }
       
   372 
       
   373 // -----------------------------------------------------------
       
   374 // PhoneCallHeaderUtil::SetCallHeaderLabelTextForRingingCall
       
   375 // -----------------------------------------------------------
       
   376 //
       
   377 void PhoneCallHeaderUtil::SetCallHeaderLabelTextForRingingCall( TInt aCallId )
       
   378     {
       
   379     __LOGMETHODSTARTEND(EPhoneControl, "PhoneCallHeaderUtil::CallHeaderLabelTextForRingingCall( ) ");
       
   380     
       
   381     TInt labelId(0);
    76     
   382     
    77     // Fetch engine info parameters.
   383     // Fetch engine info parameters.
    78     const TBool auxLine( m_engineInfo.CallALSLine( aCallId ) == CCCECallParameters::ECCELineTypeAux );
   384     const TBool auxLine( m_engineInfo.CallALSLine( aCallId ) == CCCECallParameters::ECCELineTypeAux );
    79     const TBool cli( m_engineInfo.RemotePhoneNumber( aCallId ).Length());
   385     const TBool cli( m_engineInfo.RemotePhoneNumber( aCallId ).Length());
    80     const TBool cnap( m_engineInfo.RemotePartyName( aCallId ).Length());
   386     const TBool cnap( m_engineInfo.RemotePartyName( aCallId ).Length());
       
   387     const TBool videoCall( IsVideoCall( aCallId ) );
       
   388     const TBool waitingCall( IsWaitingCall( aCallId ) );
    81     const TInt numberType( m_engineInfo.RemotePhoneNumberType( aCallId ));
   389     const TInt numberType( m_engineInfo.RemotePhoneNumberType( aCallId ));
    82     
   390 
    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 )
   391     if ( !cli && !cnap && numberType != EPEPrivateNumber && numberType != EPEUnknownNumber )
    87         {
   392         {
    88         if ( auxLine )
   393         if ( auxLine )
    89             {
   394             {
    90             if ( aWaitingCall )
   395             if ( waitingCall )
    91                 {
   396                 {
    92                 labelId = EPhoneIncomingLine2WaitingText; // waiting, line 2
   397                 labelId = EPhoneIncomingLine2WaitingText; // waiting, line 2
    93                 }
   398                 }
    94             else
   399             else
    95                 {
   400                 {
   103             labelId = KPhoneRssCommonFirst; // No second line in call bubble
   408             labelId = KPhoneRssCommonFirst; // No second line in call bubble
   104             }
   409             }
   105         }
   410         }
   106     else  // Voice or video call with CLI or with CNAP.
   411     else  // Voice or video call with CLI or with CNAP.
   107         {
   412         {
   108         if ( aWaitingCall )
   413         if ( waitingCall )
   109             {
   414             {
   110             if ( auxLine  )
   415             if ( auxLine  )
   111                 {
   416                 {
   112                 labelId = EPhoneIncomingLine2WaitingText; // waiting, line 2
   417                 labelId = EPhoneIncomingLine2WaitingText; // waiting, line 2
   113                 }
   418                 }
   124                 }
   429                 }
   125             else
   430             else
   126                 {
   431                 {
   127                 // If CLIR, but not network limitation, then second line 
   432                 // If CLIR, but not network limitation, then second line 
   128                 // (calling or video call) should be shown in call bubble.
   433                 // (calling or video call) should be shown in call bubble.
   129                 if ( aVideoCall )
   434                 if ( videoCall )
   130                     {
   435                     {
   131                     labelId = EPhoneVideoCallIncoming; // video call
   436                     labelId = EPhoneVideoCallIncoming; // video call
   132                     }
   437                     }
   133                 else
   438                 else
   134                     {
   439                     {
   136                     }
   441                     }
   137                 }
   442                 }
   138             }
   443             }
   139         }
   444         }
   140     __PHONELOG1( EBasic, EPhoneControl, "PhoneCallHeaderUtil::SetCallHeaderTexts - labelId(%d)", labelId );
   445     __PHONELOG1( EBasic, EPhoneControl, "PhoneCallHeaderUtil::SetCallHeaderTexts - labelId(%d)", labelId );
   141     LoadCallHeaderTexts( labelId, aCallHeaderData );
   446     iLabelText = LoadResource(labelId) ;
   142     }
   447     }
   143  
   448 
   144 // -----------------------------------------------------------
   449 // ---------------------------------------------------------------------------
   145 // PhoneCallHeaderUtil::LabelText
   450 //  PhoneCallHeaderUtil::RemoteNameAvailable
   146 // -----------------------------------------------------------
   451 // ---------------------------------------------------------------------------
   147 //
   452 //
   148 const TDesC& PhoneCallHeaderUtil::LabelText( TInt aCallId )
   453 TBool PhoneCallHeaderUtil::RemoteNameAvailable( const TInt aCallId ) const
   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     {
   454     {
   406     __LOGMETHODSTARTEND(EPhoneControl, "PhoneCallHeaderUtil::ContactInfoAvailable( ) ");
   455     __LOGMETHODSTARTEND(EPhoneControl, "PhoneCallHeaderUtil::ContactInfoAvailable( ) ");
   407     TBool contactAvailable = EFalse;
   456     
   408     if ( ( m_engineInfo.RemoteName( aCallId ).Length() ) || 
   457     TBool ret( m_engineInfo.RemoteName( aCallId ).Length() || 
   409          ( m_engineInfo.RemoteCompanyName( aCallId ).Length() ) )
   458                m_engineInfo.RemoteCompanyName( aCallId ).Length() );
   410         {
   459     
   411         contactAvailable = ETrue;
   460     if ( EFalse == ret && m_engineInfo.RemotePartyName( aCallId ).Length() )
   412         }
   461         {
   413     return contactAvailable;
   462         ret = !CPhoneCenRepProxy::Instance()->
   414     }
   463                 IsTelephonyFeatureSupported( KTelephonyLVFlagUUS );
   415 
   464         }
   416 // -----------------------------------------------------------------------------
   465                
   417 // PhoneCallHeaderUtil::SetCliAndCnapParamatersL
   466     return ret;
   418 // -----------------------------------------------------------------------------
   467     }
   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 
   468 
   700 // ---------------------------------------------------------------------------
   469 // ---------------------------------------------------------------------------
   701 //  PhoneCallHeaderUtil::GetRemoteInfoDataL
   470 //  PhoneCallHeaderUtil::GetRemoteInfoDataL
   702 // ---------------------------------------------------------------------------
   471 // ---------------------------------------------------------------------------
   703 //
   472 //
   704 TBool PhoneCallHeaderUtil::GetRemoteInfoData( 
   473 void PhoneCallHeaderUtil::GetRemoteInfoData( 
   705         const TInt aCallId, 
   474         const TInt aCallId, 
   706         TDes& aData ) const 
   475         TDes& aData ) const 
   707     {
   476     {
   708     __LOGMETHODSTARTEND( EPhoneControl, "PhoneCallHeaderUtil::GetRemoteInfoDataL() ");
   477     __LOGMETHODSTARTEND( EPhoneControl, "PhoneCallHeaderUtil::GetRemoteInfoDataL() ");
   709     __PHONELOG1( EBasic, EPhoneControl, "PhoneCallHeaderUtil::GetRemoteInfoDataL() - call id =%d ", aCallId);
   478     __PHONELOG1( EBasic, EPhoneControl, "PhoneCallHeaderUtil::GetRemoteInfoDataL() - call id =%d ", aCallId);
   710     
   479 
   711     TBool secondaryCli(EFalse);
       
   712         
       
   713     if ( aCallId == KEmergencyCallId )
   480     if ( aCallId == KEmergencyCallId )
   714         {
   481         {
   715         // Set emergency label text
   482         // Set emergency label text
   716         LoadResource( aData, EPhoneEmergencyCallHeader );
   483         LoadResource( aData, EPhoneEmergencyCallHeader );
   717         }
   484         }
   718     else
   485     else
   719         {
   486         {
   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
   487         // Note next if-statements are in priority order so be careful if you change order
   723         // or add new if-statements.
   488         // or add new if-statements.
   724         if ( m_engineInfo.RemoteName( aCallId ).Length() )
   489         if ( m_engineInfo.RemoteName( aCallId ).Length() )
   725             {
   490             {
   726             // Display the contact name if it is available
   491             // Display the contact name if it is available
   727             aData.Copy( m_engineInfo.RemoteName( aCallId ) );
   492             aData.Copy( m_engineInfo.RemoteName( aCallId ) );
   728             secondaryCli = ETrue;
       
   729             }
   493             }
   730         else if ( m_engineInfo.RemotePartyName( aCallId ).Length() )
   494         else if ( m_engineInfo.RemotePartyName( aCallId ).Length() )
   731             {
   495             {
   732             // Display the CNAP or UUS info if it is available.
   496             // Display the CNAP or UUS info if it is available.
   733             aData.Copy( m_engineInfo.RemotePartyName( aCallId ) );
   497             aData.Copy( m_engineInfo.RemotePartyName( aCallId ) );
   734             secondaryCli = ETrue;
       
   735             }
   498             }
   736         else if ( m_engineInfo.RemoteCompanyName( aCallId ).Length() )
   499         else if ( m_engineInfo.RemoteCompanyName( aCallId ).Length() )
   737             {
   500             {
   738             // Display the company name if it is available
   501             // Display the company name if it is available
   739             aData.Copy( m_engineInfo.RemoteCompanyName( aCallId ) );
   502             aData.Copy( m_engineInfo.RemoteCompanyName( aCallId ) );
   740             }
   503             }
   741         else if ( m_engineInfo.CallDirection( aCallId ) == RMobileCall::EMobileTerminated )
   504         else if ( m_engineInfo.CallDirection( aCallId ) == RMobileCall::EMobileTerminated )
   742             {
   505             {
       
   506             const RMobileCall::TMobileCallRemoteIdentityStatus identity = 
       
   507                     m_engineInfo.RemoteIdentity( aCallId );
       
   508             
   743             if ( EPEPrivateNumber == m_engineInfo.RemotePhoneNumberType( aCallId ) )
   509             if ( EPEPrivateNumber == m_engineInfo.RemotePhoneNumberType( aCallId ) )
   744                 {
   510                 {
   745                 if ( EPECallTypeVoIP == CallHeaderType() )
   511                 if ( EPECallTypeVoIP == m_engineInfo.CallType( aCallId ) )
   746                     {
   512                     {
   747                     // TODO LoadResource( aData, iManagerUtility.Customization()->CustomizeCallHeaderText() );
   513                     // TODO voip LoadResource( aData, iManagerUtility.Customization()->CustomizeCallHeaderText() );
   748                     }
   514                     }
   749                 else
   515                 else
   750                     {
   516                     {
   751                     // private number
   517                     // private number
   752                     LoadResource( aData, EPhoneCLIWithheld );
   518                     LoadResource( aData, EPhoneCLIWithheld );
   768                 {
   534                 {
   769                 // Display the number if it is available
   535                 // Display the number if it is available
   770                 aData.Copy( m_engineInfo.RemotePhoneNumber( aCallId ) );
   536                 aData.Copy( m_engineInfo.RemotePhoneNumber( aCallId ) );
   771                 }            
   537                 }            
   772             }
   538             }
   773 
   539         }
   774         }
   540     }
   775     return secondaryCli;
   541 
   776     }
   542 // -----------------------------------------------------------
   777 
   543 // PhoneCallHeaderUtil::IsSecondaryCliAllowed
   778 // -----------------------------------------------------------
   544 // -----------------------------------------------------------
   779 // PhoneCallHeaderUtil::LoadCallHeaderTexts
   545 //
   780 // -----------------------------------------------------------
   546 TBool PhoneCallHeaderUtil::IsSecondaryCliAllowed( TInt aCallId )
   781 //
   547     {
   782 void PhoneCallHeaderUtil::LoadCallHeaderTexts(
   548     TBool ret( ( aCallId != KEmergencyCallId && 
   783     const TInt aLabelId, 
   549                ( m_engineInfo.RemoteName( aCallId ).Length() ||
   784     TPhoneCmdParamCallHeaderData* aCallHeaderData ) 
   550                  m_engineInfo.RemotePartyName( aCallId ).Length() || 
   785     {
   551                  m_engineInfo.RemoteCompanyName( aCallId ).Length() ) &&
   786     if ( aLabelId != EPhoneStringList )
   552                  m_engineInfo.RemotePhoneNumber( aCallId ).Length() ) );
   787         {
   553     
   788         TBuf<KPhoneCallHeaderLabelMaxLength> labelText( KNullDesC );
   554     if ( ret && RMobileCall::EMobileTerminated == 
   789         LoadResource( labelText, aLabelId );
   555             m_engineInfo.CallDirection( aCallId ) )
   790         aCallHeaderData->SetLabelText( labelText );
   556         {
   791         }
   557         const RMobileCall::TMobileCallRemoteIdentityStatus identity = 
       
   558                 m_engineInfo.RemoteIdentity( aCallId );
       
   559         
       
   560         if ( m_engineInfo.RemotePhoneNumberType( aCallId ) ==  EPEPrivateNumber || 
       
   561             identity == RMobileCall::ERemoteIdentityUnavailableNoCliCoinOrPayphone ||
       
   562             identity == RMobileCall::ERemoteIdentityAvailableNoCliCoinOrPayphone ||
       
   563             identity == RMobileCall::ERemoteIdentityUnknown )
       
   564             {
       
   565             ret = EFalse;
       
   566             }
       
   567         }
       
   568     
       
   569     return ret;
       
   570     }
       
   571 
       
   572 // -----------------------------------------------------------
       
   573 // PhoneCallHeaderUtil::IsWaitingCall
       
   574 // -----------------------------------------------------------
       
   575 //
       
   576 TBool PhoneCallHeaderUtil::IsWaitingCall(int callId) const
       
   577     {
       
   578     bool waiting( EFalse );
       
   579     if ( callId >= 0 && 
       
   580          m_engineInfo.CallState( callId ) == EPEStateRinging )
       
   581         {
       
   582         if ( m_engineInfo.CheckIfCallStateExists(EPEStateConnected) ||
       
   583              m_engineInfo.CheckIfCallStateExists(EPEStateConnectedConference) ||
       
   584              m_engineInfo.CheckIfCallStateExists(EPEStateDisconnecting) ||
       
   585              m_engineInfo.CheckIfCallStateExists(EPEStateHeld) ||
       
   586              m_engineInfo.CheckIfCallStateExists(EPEStateHeldConference) )
       
   587             {
       
   588             waiting = ETrue;
       
   589             }
       
   590         }
       
   591     return waiting;
       
   592     }
       
   593 
       
   594 // ---------------------------------------------------------------------------
       
   595 // PhoneCallHeaderUtil::LoadResource
       
   596 // ---------------------------------------------------------------------------
       
   597 //
       
   598 HBufC* PhoneCallHeaderUtil::LoadResource( const TInt aResource ) const
       
   599     {
       
   600     HBufC* ret = NULL;
       
   601     
       
   602     TRAP_IGNORE( ret = StringLoader::LoadL(  
       
   603             CPhoneMainResourceResolver::Instance()->ResolveResourceID( aResource ), 
       
   604             CCoeEnv::Static() ) );
       
   605     
       
   606     return ret;
   792     }
   607     }
   793 
   608 
   794 // ---------------------------------------------------------------------------
   609 // ---------------------------------------------------------------------------
   795 // PhoneCallHeaderUtil::LoadResource
   610 // PhoneCallHeaderUtil::LoadResource
   796 // ---------------------------------------------------------------------------
   611 // ---------------------------------------------------------------------------
   800     StringLoader::Load(  
   615     StringLoader::Load(  
   801             aData, CPhoneMainResourceResolver::Instance()->ResolveResourceID( aResource ), 
   616             aData, CPhoneMainResourceResolver::Instance()->ResolveResourceID( aResource ), 
   802             CCoeEnv::Static() );
   617             CCoeEnv::Static() );
   803     }
   618     }
   804 
   619 
   805 // ---------------------------------------------------------------------------
   620 
   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     }