phoneapp/phoneuiview/src/cphonebubblewrapper.cpp
branchRCL_3
changeset 62 5266b1f337bd
child 69 8baf28733c3d
equal deleted inserted replaced
61:41a7f70b3818 62:5266b1f337bd
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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: Implementation of CPhoneBubbleWrapper class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <AknPhoneNumberEditor.h>
       
    21 #include <featmgr.h>
       
    22 #include <StringLoader.h>
       
    23 #include <telephonyvariant.hrh>
       
    24 #include <eikspane.h>
       
    25 #include <layoutmetadata.cdl.h>
       
    26 #include <bautils.h>
       
    27 #include <bmtouchpaneinterface.h>
       
    28 #include <AknUtils.h>
       
    29 #include <spsettings.h>
       
    30 #include <spproperty.h>
       
    31 
       
    32 #include "cphonebubblewrapper.h"
       
    33 #include "cphonebubblemapping.h"
       
    34 #include "tphonecommandparam.h"
       
    35 #include "cphonecallheadertextanimation.h"
       
    36 #include "cphonemainresourceresolver.h"
       
    37 #include "tphonecmdparamboolean.h"
       
    38 #include "tphonecmdparaminteger.h"
       
    39 #include "tphonecmdparamstring.h"
       
    40 #include "tphonecmdparamkeyevent.h"
       
    41 #include "tphonecmdparamdynmenu.h"
       
    42 #include "tphonecmdparamcallheaderdata.h"
       
    43 #include "tphonecmdparamemergencycallheaderdata.h"
       
    44 #include "tphonecmdparamcallstatedata.h"
       
    45 #include "tphonecmdparamincallindicatordata.h"
       
    46 #include "cphonestatuspane.h"
       
    47 #include "phoneconstants.h"
       
    48 #include "phonerssbase.h"
       
    49 #include "cphonecenrepproxy.h"
       
    50 #include "phonelogger.h"
       
    51 #include "mphonevideoplayerobserver.h"
       
    52 #include "mphoneviewcommandhandle.h"
       
    53 #include "phoneui.pan"
       
    54 #include "mnumberentry.h"
       
    55 #include "mphonenumberentry.h"
       
    56 #include "cphonenumberentry.h"
       
    57 #include "phonebubbleextensionmanager.h"
       
    58 #include "phonevanitydialingutils.h"
       
    59 
       
    60 #include "mphonecustomization.h"
       
    61 
       
    62 // ================= MEMBER FUNCTIONS =======================
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CPhoneBubbleWrapper::CPhoneBubbleWrapper
       
    66 // C++ default constructor can NOT contain any code, that
       
    67 // might leave.
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 CPhoneBubbleWrapper::CPhoneBubbleWrapper( ) :
       
    71     iNumberEntryVisible( EFalse ),
       
    72     iConference( EFalse ),
       
    73     iCipheringIndicatorAllowed( ETrue ),
       
    74     iFlags ( 0 ),
       
    75     iVideoCallAnimationHeader( NULL ),
       
    76     iCallImageTextSupported ( EFalse ),
       
    77     iVideoPlayerObserver ( NULL ),
       
    78     iDialerNumberEntry ( NULL ),
       
    79     iUseDialer ( EFalse ),
       
    80     iIsNumberEntryModeNumeric( ETrue )
       
    81     {
       
    82     }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // CPhoneBubbleWrapper::ConstructL
       
    86 // Symbian 2nd phase constructor can leave.
       
    87 // -----------------------------------------------------------------------------
       
    88 //
       
    89 void CPhoneBubbleWrapper::ConstructL(
       
    90     CCoeControl* aControl,
       
    91     const TRect& aRect )
       
    92     {
       
    93     TPoint position ( 0, 0 );
       
    94 
       
    95     // Construct bubble manager
       
    96     iBubbleManager = CBubbleManager::NewL(
       
    97         *aControl,
       
    98         aRect,
       
    99         ETrue  );
       
   100     iBubbleManager->SetPosition( position );
       
   101 
       
   102     CCoeControl* bubbleNe = iBubbleManager->GetNumberEntry()->Parent();
       
   103     //cannot set bubblewrapper as an observer straight to CAknPhoneNumberEditor
       
   104     //because BMBubbleOutlookNE will not receive control events then.
       
   105     bubbleNe->SetObserver( this );
       
   106     
       
   107     // Construct extension manager
       
   108     iBubbleExtensionManager = CPhoneBubbleExtensionManager::NewL(
       
   109            *iBubbleManager );
       
   110 
       
   111     iPhoneNumberEntry = CPhoneNumberEntry::NewL( *iBubbleManager );
       
   112 
       
   113     // Construct bubble mapping
       
   114     iMapping = CPhoneBubbleMapping::NewL( KMaxNumberOfCallerBubbles );
       
   115 
       
   116     if( FeatureManager::FeatureSupported( KFeatureIdCallImagetext ) )
       
   117 	    {
       
   118 	    iCallTheme = CPhoneCallThemeMonitor::NewL();
       
   119 	    iCallImageTextSupported = ETrue;
       
   120 	    iBubbleManager->PreloadCallThemeImage(
       
   121 	            iCallTheme->CallImageThemeSettings() == 2  );
       
   122 	    iCallTheme->SetCallThemeSettingsObserver( this );
       
   123 	    }
       
   124 
       
   125     if ( FeatureManager::FeatureSupported( KFeatureIdOnScreenDialer ) )
       
   126         {
       
   127         iUseDialer = ETrue;
       
   128         }
       
   129     }
       
   130 
       
   131 // -----------------------------------------------------------------------------
       
   132 // CPhoneBubbleWrapper::NewL
       
   133 // Two-phased constructor.
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136 CPhoneBubbleWrapper* CPhoneBubbleWrapper::NewL(
       
   137     CCoeControl* aControl,
       
   138     const TRect& aRect )
       
   139     {
       
   140     CPhoneBubbleWrapper* self = new( ELeave ) CPhoneBubbleWrapper( );
       
   141 
       
   142     CleanupStack::PushL( self );
       
   143     self->ConstructL( aControl, aRect );
       
   144     CleanupStack::Pop( self );
       
   145 
       
   146     return self;
       
   147     }
       
   148 
       
   149 // Destructor
       
   150 CPhoneBubbleWrapper::~CPhoneBubbleWrapper()
       
   151     {
       
   152     delete iBubbleExtensionManager;
       
   153     delete iPhoneNumberEntry;
       
   154     delete iMapping;
       
   155     delete iBubbleManager;
       
   156     delete iVideoCallAnimationHeader;
       
   157     if( iParticipants )
       
   158 	    {
       
   159 	    iParticipants->Reset();
       
   160     	delete iParticipants;
       
   161 	    }
       
   162 	delete iCallTheme;
       
   163 
       
   164 	iVideoPlayerObserver = NULL;
       
   165 	iDialerNumberEntry = NULL;
       
   166 	
       
   167     }
       
   168 
       
   169 // -----------------------------------------------------------------------------
       
   170 // CPhoneBubbleWrapper.::RemoveCallHeaderL
       
   171 // -----------------------------------------------------------------------------
       
   172 //
       
   173 void CPhoneBubbleWrapper::RemoveCallHeaderL( TInt aCallId )
       
   174     {
       
   175     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::RemoveCallHeader");
       
   176     CBubbleManager::TBubbleId bubble;
       
   177 
       
   178     if ( iMapping->FindBubbleByCall( aCallId, bubble ) )
       
   179         {
       
   180         iBubbleManager->StartChanges();
       
   181 
       
   182 		if( aCallId == KVideoTelephonyCallId1 ||
       
   183 			aCallId == KVideoTelephonyCallId2 )
       
   184     		{
       
   185     		CPhoneCallHeaderTextAnimation::InstanceL()->RemoveAnimatingVideoCallHeader();
       
   186     		delete iVideoCallAnimationHeader;
       
   187     		iVideoCallAnimationHeader = NULL;
       
   188     		}
       
   189 
       
   190         // remove the bubble
       
   191 		iBubbleExtensionManager->StopCall( bubble );
       
   192         iBubbleManager->RemoveCallHeader( bubble );
       
   193         iBubbleManager->EndChanges();
       
   194         iMapping->RemoveFromMapping( aCallId );
       
   195 
       
   196         __PHONELOG1(
       
   197             EBasic,
       
   198             EPhoneUIView,
       
   199             "CPhoneBubbleWrapper::RemoveCallHeader ShownHeaderCount = %d",
       
   200             iBubbleManager->ShownHeaderCount() );
       
   201 
       
   202 		if (!FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) &&
       
   203 		    iConference && ( iBubbleManager->ShownHeaderCount() == 1 ) )
       
   204             {
       
   205             SetConferenceExpand( ETrue );
       
   206             }
       
   207         }
       
   208     }
       
   209 
       
   210 // -----------------------------------------------------------------------------
       
   211 // CPhoneBubbleWrapper.::CreateCallHeaderL
       
   212 // -----------------------------------------------------------------------------
       
   213 //
       
   214 CBubbleManager::TBubbleId CPhoneBubbleWrapper::CreateCallHeaderL(
       
   215     TInt aCallId,
       
   216     TPhoneCommandParam *aCommandParam )
       
   217     {
       
   218     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::CreateCallHeader");
       
   219     CBubbleManager::TBubbleId bubble;
       
   220 
       
   221     if ( iMapping->FindBubbleByCall( aCallId, bubble ) )
       
   222         {
       
   223         // Invalid - don't create a bubble
       
   224         return bubble;
       
   225         }
       
   226 
       
   227     TPhoneCmdParamCallHeaderData* callHeaderParam =
       
   228         static_cast<TPhoneCmdParamCallHeaderData*>( aCommandParam );
       
   229 
       
   230     iCipheringIndicatorAllowed = callHeaderParam->CipheringIndicatorAllowed();
       
   231 
       
   232     iBubbleManager->StartChanges();
       
   233     // Create call header
       
   234     bubble = iBubbleManager->CreateCallHeader();
       
   235     iMapping->AddToMappingL( bubble, aCallId, CBubbleManager::ENone, NULL );
       
   236 
       
   237     if ( iConference )
       
   238 	    {
       
   239 	    SetConferenceExpand( EFalse );
       
   240 	    }
       
   241 
       
   242     // Set call state
       
   243     PrepareCallStateL(
       
   244         aCallId,
       
   245         callHeaderParam->CallState(),
       
   246         callHeaderParam->LabelText(),
       
   247         callHeaderParam->ShortLabelText() );
       
   248 
       
   249     // Set call flag ( EDivert... )    
       
   250     iBubbleManager->SetCallFlags( 
       
   251         bubble, 
       
   252         callHeaderParam->CallFlag() );
       
   253 
       
   254 	 __PHONELOG1(
       
   255 	    EBasic,
       
   256 	    EPhoneUIView,
       
   257 	    "CPhoneBubbleWrapper::CreateCallHeader callHeaderParam->CLIText = %S",
       
   258 	    &callHeaderParam->CLIText() );
       
   259 
       
   260     // Set CLI text
       
   261     iBubbleManager->SetCLI(
       
   262         bubble,
       
   263         callHeaderParam->CLIText(),
       
   264         callHeaderParam->CLITextClippingDirection() );
       
   265     
       
   266     // Set CNAP text if applicable
       
   267     iBubbleManager->SetCNAP( 
       
   268             bubble, 
       
   269             callHeaderParam->CNAPText(), 
       
   270             callHeaderParam->CNAPTextClippingDirection() );
       
   271     
       
   272     // Set CLI type to be used in conference call participant list
       
   273     CBubbleManager::TBubbleParticipantListCLI partipantCli =
       
   274         ( callHeaderParam->ParticipantCLI() ==
       
   275           TPhoneCmdParamCallHeaderData::EPhoneParticipantCNAPText ) ?
       
   276         CBubbleManager::EParticipantListCNAP :
       
   277         CBubbleManager::EParticipantListCLIText;
       
   278     iBubbleManager->SetParticipantListCLI( bubble, partipantCli );
       
   279 
       
   280     // Set ciphering indicator
       
   281     iBubbleManager->SetCallFlag(
       
   282         bubble,
       
   283         CBubbleManager::ENoCiphering,
       
   284         iCipheringIndicatorAllowed &&
       
   285         !callHeaderParam->Ciphering() );
       
   286 
       
   287 	 __PHONELOG1(
       
   288 	    EBasic,
       
   289 	    EPhoneUIView,
       
   290 	    "CPhoneBubbleWrapper::CreateCallHeader Line2() = %d",
       
   291 	    callHeaderParam->Line2() );
       
   292 
       
   293     // Set line2 indicator
       
   294     iBubbleManager->SetCallFlag(
       
   295         bubble,
       
   296         CBubbleManager::ELine2,
       
   297         callHeaderParam->Line2() );
       
   298 
       
   299     // Set number type indicator
       
   300     SetNumberTypeIndicator( bubble, static_cast<TPEPhoneNumberIdType>(
       
   301         callHeaderParam->NumberType() ) );
       
   302 
       
   303     if ( !iCallImageTextSupported )
       
   304 		{
       
   305         if( callHeaderParam->Thumbnail() )
       
   306             {
       
   307             // Thumbnail
       
   308             iBubbleManager->SetThumbnail( bubble, callHeaderParam->Thumbnail(), NULL );
       
   309             }
       
   310 		}
       
   311     else  // call object display
       
   312         {
       
   313         if ( callHeaderParam->CallerText().Length() )
       
   314             {
       
   315             __PHONELOG(
       
   316                 EBasic,
       
   317                 EPhoneUIView,
       
   318                 "CPhoneBubbleWrapper::CreateCallHeaderL()-> Set 1.Call text");
       
   319             // 1. Call text
       
   320             iBubbleManager->SetCallObjectText( bubble, callHeaderParam->CallerText() );
       
   321             }
       
   322         else if( callHeaderParam->Picture().Length() )
       
   323             {
       
   324             __PHONELOG(
       
   325                 EBasic,
       
   326                 EPhoneUIView,
       
   327                 "CPhoneBubbleWrapper::CreateCallHeaderL()-> Set 2. Call image");
       
   328             // 2. Call image
       
   329             iBubbleManager->SetCallObjectImage( bubble, callHeaderParam->Picture() );
       
   330             }
       
   331         else if( callHeaderParam->HasThumbnail() )
       
   332             {
       
   333             __PHONELOG(
       
   334                 EBasic,
       
   335                 EPhoneUIView,
       
   336                 "CPhoneBubbleWrapper::CreateCallHeaderL()-> Set 3. Thumbnail");
       
   337             // 3. Thumbnail
       
   338             if ( callHeaderParam->Thumbnail() )
       
   339                 {
       
   340                 iBubbleManager->SetThumbnail( bubble, callHeaderParam->Thumbnail(), NULL );
       
   341                 }
       
   342             }
       
   343         else if ( iCallTheme->CallImageThemeSettings() == 2 )
       
   344             {
       
   345             __PHONELOG(
       
   346                 EBasic,
       
   347                 EPhoneUIView,
       
   348                 "CPhoneBubbleWrapper::CreateCallHeaderL()-> Set 4. Theme image");
       
   349             // 4. Theme image
       
   350             iBubbleManager->SetCallObjectFromTheme( bubble );
       
   351             }
       
   352         else if ( iCallTheme->CallImageThemeSettings() == 1 &&
       
   353                   BaflUtils::FileExists( CCoeEnv::Static()->FsSession(),
       
   354                                          iCallTheme->CallImageThemeFilePath() ) )
       
   355             {
       
   356             __PHONELOG(
       
   357                 EBasic,
       
   358                 EPhoneUIView,
       
   359                 "CPhoneBubbleWrapper::CreateCallHeaderL()-> Set 5. User defined theme image");
       
   360             // 5. User defined theme image
       
   361             iBubbleManager->SetCallObjectImage(
       
   362                 bubble,
       
   363                 iCallTheme->CallImageThemeFilePath() );
       
   364             }
       
   365         else
       
   366             {
       
   367             __PHONELOG(
       
   368                 EBasic,
       
   369                 EPhoneUIView,
       
   370                 "CPhoneBubbleWrapper::CreateCallHeaderL()-> Do nothing ");
       
   371             // do nothing
       
   372             }
       
   373         }
       
   374 
       
   375     iBubbleExtensionManager->StartCallL( bubble, callHeaderParam );
       
   376     iBubbleManager->EndChanges();
       
   377 
       
   378     return bubble;
       
   379     }
       
   380 
       
   381 // -----------------------------------------------------------------------------
       
   382 // CPhoneBubbleWrapper.::StartMOVideoCallAnimationHeaderL
       
   383 // -----------------------------------------------------------------------------
       
   384 //
       
   385 void CPhoneBubbleWrapper::StartMOVideoCallAnimationHeaderL(
       
   386 	CBubbleManager::TBubbleId aBubbleId,
       
   387 	const TDesC& aStateLabelText,
       
   388     const TDesC& aStateShortLabelText)
       
   389 	{
       
   390     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::StartMOVideoCallAnimationHeaderL");
       
   391 
       
   392 	// We have MO video call - start animating
       
   393 	iVideoCallAnimationHeader = CPhoneCallHeaderTextAnimation::InstanceL();
       
   394 	iVideoCallAnimationHeader->StartAnimatingVideoCallHeaderL(
       
   395 		aBubbleId,
       
   396 		aStateLabelText,
       
   397 		aStateShortLabelText,
       
   398 		*iBubbleManager );
       
   399 
       
   400 	}
       
   401 
       
   402 // -----------------------------------------------------------------------------
       
   403 // CPhoneBubbleWrapper.::CreateEmergencyCallHeaderL
       
   404 // -----------------------------------------------------------------------------
       
   405 //
       
   406 CBubbleManager::TBubbleId CPhoneBubbleWrapper::CreateEmergencyCallHeaderL(
       
   407     TInt aCallId,
       
   408     TPhoneCommandParam *aCommandParam )
       
   409     {
       
   410     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::CreateEmergencyCallHeader");
       
   411     TPhoneCmdParamEmergencyCallHeaderData* emergencyHeaderParam =
       
   412         static_cast<TPhoneCmdParamEmergencyCallHeaderData*>(
       
   413         aCommandParam );
       
   414 
       
   415     iBubbleManager->StartChanges();
       
   416 
       
   417     // Create the bubble if necessary
       
   418     CBubbleManager::TBubbleId bubble;
       
   419     if ( !iMapping->FindBubbleByCall( aCallId, bubble ) )
       
   420         {
       
   421         bubble = iBubbleManager->CreateCallHeader();
       
   422         iMapping->AddToMappingL( bubble, aCallId, CBubbleManager::EActive, NULL );
       
   423         }
       
   424 
       
   425     iBubbleManager->SetState( bubble, CBubbleManager::EActive );
       
   426 
       
   427     // Set the call header title
       
   428     iBubbleManager->SetCLI(
       
   429         bubble,
       
   430         emergencyHeaderParam->HeaderText(),
       
   431         CBubbleManager::ERight );
       
   432 
       
   433     // Set ciphering indicator
       
   434     iBubbleManager->SetCallFlag(
       
   435         bubble,
       
   436         CBubbleManager::ENoCiphering,
       
   437         iCipheringIndicatorAllowed &&
       
   438         !emergencyHeaderParam->Ciphering() );
       
   439 
       
   440     // Set the call label as the CNAP text
       
   441     SetCNAP( bubble, 
       
   442             emergencyHeaderParam->LabelText(), 
       
   443             CBubbleManager::ELeft );
       
   444 
       
   445     // Set own phone number as the label
       
   446     iBubbleManager->SetLabel(
       
   447         bubble,
       
   448         emergencyHeaderParam->OwnPhoneNumberText(),
       
   449         CBubbleManager::ELeft );
       
   450     iBubbleManager->EndChanges();
       
   451 
       
   452     return bubble;
       
   453     }
       
   454 
       
   455 // -----------------------------------------------------------------------------
       
   456 // CPhoneBubbleWrapper.::UpdateCallHeaderDisplay
       
   457 // -----------------------------------------------------------------------------
       
   458 //
       
   459 void CPhoneBubbleWrapper::UpdateCallHeaderDisplay(
       
   460     TInt aCallId,
       
   461     TPhoneCommandParam* aCommandParam )
       
   462     {
       
   463     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::UpdateCallHeaderDisplay");
       
   464     CBubbleManager::TBubbleId bubble;
       
   465 
       
   466     if ( iMapping->FindBubbleByCall( aCallId, bubble ) )
       
   467         {
       
   468         TPhoneCmdParamCallHeaderData* callHeaderParam =
       
   469             static_cast<TPhoneCmdParamCallHeaderData*>( aCommandParam );
       
   470 
       
   471         iBubbleManager->StartChanges();
       
   472 
       
   473         SetCallHeaderParameters( bubble, callHeaderParam );
       
   474 
       
   475 		if( iVideoCallAnimationHeader )
       
   476 			{
       
   477 			if( callHeaderParam->CallState() != EPEStateDialing )
       
   478 				{
       
   479 				iVideoCallAnimationHeader->RemoveAnimatingVideoCallHeader();
       
   480 				delete iVideoCallAnimationHeader;
       
   481     		    iVideoCallAnimationHeader = NULL;
       
   482 				}
       
   483 			}
       
   484         // End changes
       
   485         iBubbleManager->EndChanges();
       
   486         }
       
   487     }
       
   488 
       
   489 // -----------------------------------------------------------------------------
       
   490 // CPhoneBubbleWrapper.::UpdateCallHeaderAndLabel
       
   491 // -----------------------------------------------------------------------------
       
   492 //
       
   493 void CPhoneBubbleWrapper::UpdateCallHeaderAndLabel(
       
   494     TInt aCallId,
       
   495     TPhoneCommandParam* aCommandParam )
       
   496     {
       
   497     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::UpdateCallHeaderAndLabel");
       
   498         CBubbleManager::TBubbleId bubble;
       
   499 
       
   500     if ( iMapping->FindBubbleByCall( aCallId, bubble ) )
       
   501         {
       
   502         TPhoneCmdParamCallHeaderData* callHeaderParam =
       
   503             static_cast<TPhoneCmdParamCallHeaderData*>( aCommandParam );
       
   504 
       
   505         iBubbleManager->StartChanges();
       
   506 
       
   507         SetCallHeaderParameters( bubble, callHeaderParam );
       
   508 
       
   509         // Set the call label associated with the state
       
   510         iBubbleManager->SetLabel(
       
   511             bubble,
       
   512             callHeaderParam->LabelText(),
       
   513             CBubbleManager::ERight );
       
   514 
       
   515         if( iVideoCallAnimationHeader )
       
   516             {
       
   517             if( callHeaderParam->CallState() != EPEStateDialing )
       
   518                 {
       
   519                 iVideoCallAnimationHeader->RemoveAnimatingVideoCallHeader();
       
   520                 delete iVideoCallAnimationHeader;
       
   521                 iVideoCallAnimationHeader = NULL;
       
   522                 }
       
   523             }
       
   524 
       
   525         // End changes
       
   526         iBubbleManager->EndChanges();
       
   527         }
       
   528     }
       
   529 
       
   530 // -----------------------------------------------------------------------------
       
   531 // CPhoneBubbleWrapper.::SetCallHeaderParameters
       
   532 // -----------------------------------------------------------------------------
       
   533 //
       
   534 void CPhoneBubbleWrapper::SetCallHeaderParameters(
       
   535         TInt aBubble,
       
   536         TPhoneCmdParamCallHeaderData* aCallHeaderParam )
       
   537     {
       
   538     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::SetCallHeaderParameters");
       
   539     __PHONELOG1(
       
   540         EBasic,
       
   541         EPhoneUIView,
       
   542         "CPhoneBubbleWrapper::SetCallHeaderParameters callHeaderParam->CLIText = %S",
       
   543         &aCallHeaderParam->CLIText() );
       
   544 
       
   545     // Set CLI text
       
   546     iBubbleManager->SetCLI(
       
   547         aBubble,
       
   548         aCallHeaderParam->CLIText(),
       
   549         aCallHeaderParam->CLITextClippingDirection() );
       
   550 
       
   551     // Set CNAP text if applicable
       
   552     iBubbleManager->SetCNAP(
       
   553             aBubble,
       
   554             aCallHeaderParam->CNAPText(),
       
   555             aCallHeaderParam->CNAPTextClippingDirection() );
       
   556 
       
   557     // Set CLI type to be used in conference call participant list
       
   558     CBubbleManager::TBubbleParticipantListCLI partipantCli =
       
   559         ( aCallHeaderParam->ParticipantCLI() ==
       
   560           TPhoneCmdParamCallHeaderData::EPhoneParticipantCNAPText ) ?
       
   561         CBubbleManager::EParticipantListCNAP :
       
   562         CBubbleManager::EParticipantListCLIText;
       
   563     iBubbleManager->SetParticipantListCLI( aBubble, partipantCli );
       
   564 
       
   565     iBubbleManager->SetCallFlags( aBubble, aCallHeaderParam->CallFlag() );
       
   566 
       
   567     // Set ciphering indicator
       
   568     iBubbleManager->SetCallFlag(
       
   569         aBubble,
       
   570         CBubbleManager::ENoCiphering, 
       
   571         aCallHeaderParam->CipheringIndicatorAllowed() && 
       
   572         !aCallHeaderParam->Ciphering() );
       
   573 
       
   574     // Set line2 indicator
       
   575     iBubbleManager->SetCallFlag(
       
   576         aBubble,
       
   577         CBubbleManager::ELine2,
       
   578         aCallHeaderParam->Line2() );
       
   579 
       
   580     if ( !iCallImageTextSupported )
       
   581         {
       
   582         if( aCallHeaderParam->Thumbnail() )
       
   583             {
       
   584             __PHONELOG(
       
   585                 EBasic,
       
   586                 EPhoneUIView,
       
   587                 "CPhoneBubbleWrapper::SetCallHeaderParameters()-> Set Thumbnail" );
       
   588             // Thumbnail
       
   589             iBubbleManager->SetThumbnail( aBubble, aCallHeaderParam->Thumbnail(), NULL );
       
   590             }
       
   591         }
       
   592     else  // call object display
       
   593         {
       
   594         if ( aCallHeaderParam->CallerText().Length() )
       
   595             {
       
   596             __PHONELOG(
       
   597                 EBasic,
       
   598                 EPhoneUIView,
       
   599                 "CPhoneBubbleWrapper::SetCallHeaderParameters()-> Set 1.Call text");
       
   600             // 1. Call text
       
   601             iBubbleManager->SetCallObjectText( aBubble, aCallHeaderParam->CallerText() );
       
   602             }
       
   603         else if( aCallHeaderParam->Picture().Length() )
       
   604             {
       
   605             __PHONELOG(
       
   606                 EBasic,
       
   607                 EPhoneUIView,
       
   608                 "CPhoneBubbleWrapper::SetCallHeaderParameters()-> Set 2.Call image");
       
   609             // 2. Call image
       
   610             iBubbleManager->SetCallObjectImage( aBubble, aCallHeaderParam->Picture() );
       
   611             }
       
   612         else if( aCallHeaderParam->HasThumbnail() )
       
   613             {
       
   614             // 3. Thumbnail
       
   615             __PHONELOG(
       
   616                 EBasic,
       
   617                 EPhoneUIView,
       
   618                 "CPhoneBubbleWrapper::SetCallHeaderParameters()-> Set 3.Thumbnail");
       
   619             if ( aCallHeaderParam->Thumbnail() )
       
   620                 {
       
   621                 iBubbleManager->SetThumbnail( aBubble, aCallHeaderParam->Thumbnail(), NULL );
       
   622                 }
       
   623             }
       
   624         else
       
   625             {
       
   626             // do nothing
       
   627             __PHONELOG(
       
   628                 EBasic,
       
   629                 EPhoneUIView,
       
   630                 "CPhoneBubbleWrapper::SetCallHeaderParameters()-> Do nothing");
       
   631             }
       
   632         }
       
   633     }
       
   634 
       
   635 // -----------------------------------------------------------------------------
       
   636 // CPhoneBubbleWrapper.::SetNumberEntryContent
       
   637 // -----------------------------------------------------------------------------
       
   638 //
       
   639 void CPhoneBubbleWrapper::SetNumberEntryContent( const TDesC& aContent )
       
   640     {
       
   641     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::SetNumberEntryContent");
       
   642     iPhoneNumberEntry->SetNumberEntryContent( aContent );
       
   643     }
       
   644 
       
   645 // -----------------------------------------------------------------------------
       
   646 // CPhoneBubbleWrapper.::GetNumberEntryContent
       
   647 // -----------------------------------------------------------------------------
       
   648 //
       
   649 void CPhoneBubbleWrapper::GetNumberEntryContent(
       
   650     TPhoneCommandParam* aCommandParam )
       
   651     {
       
   652     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::GetNumberEntryContent");
       
   653 
       
   654     GetLocalizedNumberEntryContent( aCommandParam );
       
   655 
       
   656     TPhoneCmdParamString* entryContent =
       
   657         static_cast<TPhoneCmdParamString*>( aCommandParam );
       
   658 
       
   659     __PHONELOG1( EBasic, EPhoneUIView,
       
   660         "CPhoneBubbleWrapper::GetNumberEntryContent(%S)",
       
   661         entryContent->String() );
       
   662 
       
   663     AknTextUtils::ConvertDigitsTo( *entryContent->String(), EDigitTypeWestern );
       
   664 
       
   665     if ( FeatureManager::FeatureSupported( KFeatureIdFfHomeScreenVanityDialing ) )
       
   666         {
       
   667         PhoneVanityDialingUtils::DoVanityNumberConversion( *entryContent->String() );
       
   668         }
       
   669     
       
   670     __PHONELOG1( EBasic, EPhoneUIView,
       
   671         "CPhoneBubbleWrapper::GetNumberEntryContent(%S)",
       
   672         entryContent->String() );
       
   673     }
       
   674 
       
   675 // -----------------------------------------------------------------------------
       
   676 // CPhoneBubbleWrapper.::GetLocalizedNumberEntryContent
       
   677 // -----------------------------------------------------------------------------
       
   678 //
       
   679 void CPhoneBubbleWrapper::GetLocalizedNumberEntryContent(
       
   680     TPhoneCommandParam* aCommandParam )
       
   681     {
       
   682     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::GetLocalizedNumberEntryContent");
       
   683     TPhoneCmdParamString* entryContent =
       
   684         static_cast<TPhoneCmdParamString*>( aCommandParam );
       
   685 
       
   686     // Get the initial number from number entry window
       
   687     if ( iUseDialer )
       
   688         {
       
   689         iDialerNumberEntry->GetTextFromNumberEntry( *entryContent->String() );
       
   690         }
       
   691     else
       
   692         {
       
   693         iBubbleManager->GetTextFromNumberEntry( *entryContent->String() );
       
   694         }
       
   695     }
       
   696 
       
   697 // -----------------------------------------------------------------------------
       
   698 // CPhoneBubbleWrapper.::CreateNumberEntry
       
   699 // -----------------------------------------------------------------------------
       
   700 //
       
   701 void CPhoneBubbleWrapper::CreateNumberEntry()
       
   702     {
       
   703     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::CreateNumberEntry");
       
   704 
       
   705     iIsNumberEntryModeNumeric = ETrue;
       
   706     if ( iUseDialer )
       
   707         {
       
   708         iDialerNumberEntry->CreateNumberEntry();
       
   709         }
       
   710     else
       
   711         {
       
   712         iBubbleManager->ResetEditorToDefaultValues();
       
   713         if( iPhoneCustomization && 
       
   714             iPhoneCustomization->AllowAlphaNumericMode() )
       
   715             {    
       
   716             iBubbleManager->ChangeEditorMode( ETrue );  
       
   717             }
       
   718         TInt flags = iFlags;
       
   719         flags &= ~EFlagNumberEntryExists;
       
   720 
       
   721         flags |= EFlagNumberEntryExists;
       
   722         flags |= EFlagNumberEntryVisible;
       
   723 
       
   724         HandleFlagsUpdated( flags );
       
   725         }
       
   726     }
       
   727 // -----------------------------------------------------------------------------
       
   728 // CPhoneBubbleWrapper.::SetNumberEntryObserver
       
   729 // -----------------------------------------------------------------------------
       
   730 //
       
   731 void CPhoneBubbleWrapper::SetNumberEntryObserver( MNumberEntryObserver& aObserver )
       
   732     {
       
   733     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::SetNumberEntryObserver");
       
   734 
       
   735     if ( iUseDialer )
       
   736         {
       
   737         iDialerNumberEntry->SetNumberEntryObserver( aObserver );
       
   738         }
       
   739 
       
   740     }
       
   741 // -----------------------------------------------------------------------------
       
   742 // CPhoneBubbleWrapper.::SetNumberEntryPromptText
       
   743 // -----------------------------------------------------------------------------
       
   744 //
       
   745 void CPhoneBubbleWrapper::SetNumberEntryPromptText( const TDesC& aPromptText )
       
   746     {
       
   747     iPhoneNumberEntry->SetNumberEntryPromptText( aPromptText );
       
   748     }
       
   749 
       
   750 // -----------------------------------------------------------------------------
       
   751 // CPhoneBubbleWrapper.::SetNumberEntryVisible
       
   752 // -----------------------------------------------------------------------------
       
   753 //
       
   754 void CPhoneBubbleWrapper::SetNumberEntryVisible(
       
   755     TPhoneCommandParam* aCommandParam )
       
   756     {
       
   757     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::SetNumberEntryVisible");
       
   758     // Check is the given parameter valid
       
   759     if ( aCommandParam->ParamId() == TPhoneCommandParam::EPhoneParamIdBoolean )
       
   760         {
       
   761         TPhoneCmdParamBoolean* visible =
       
   762             static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
   763 
       
   764         if ( iUseDialer )
       
   765             {
       
   766             iDialerNumberEntry->SetNumberEntryVisible( visible->Boolean() );
       
   767             }
       
   768         else
       
   769             {
       
   770             TInt flags = iFlags;
       
   771             flags &= ~EFlagNumberEntryVisible;
       
   772             if ( visible->Boolean() )
       
   773                 {
       
   774                 flags |= EFlagNumberEntryVisible;
       
   775                 }
       
   776             HandleFlagsUpdated( flags );
       
   777             }
       
   778         }
       
   779     }
       
   780 
       
   781 // -----------------------------------------------------------------------------
       
   782 // CPhoneBubbleWrapper.::RemoveNumberEntry
       
   783 // -----------------------------------------------------------------------------
       
   784 //
       
   785 void CPhoneBubbleWrapper::RemoveNumberEntry()
       
   786     {
       
   787     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::RemoveNumberEntry");
       
   788 
       
   789     if ( iUseDialer )
       
   790         {
       
   791         iDialerNumberEntry->RemoveNumberEntry( );
       
   792         }
       
   793     else
       
   794         {
       
   795         TInt flags = iFlags;
       
   796         flags &= ~EFlagNumberEntryExists;
       
   797 
       
   798         HandleFlagsUpdated( flags );
       
   799         }
       
   800     }
       
   801 
       
   802 // -----------------------------------------------------------------------------
       
   803 // CPhoneBubbleWrapper::GetNumberEntryCount
       
   804 // -----------------------------------------------------------------------------
       
   805 //
       
   806 void CPhoneBubbleWrapper::GetNumberEntryCount(
       
   807     TPhoneCommandParam* aCommandParam )
       
   808     {
       
   809     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::CountNumberEntryCharacters");
       
   810     TPhoneCmdParamInteger* integerParam = static_cast<TPhoneCmdParamInteger*>(
       
   811         aCommandParam );
       
   812 
       
   813     // Return the number of characters in the number entry
       
   814     integerParam->SetInteger( CountNumberEntryCharacters() );
       
   815     }
       
   816 
       
   817 // ---------------------------------------------------------------------------
       
   818 // CPhoneBubbleWrapper::CountNumberEntryCharacters
       
   819 // ---------------------------------------------------------------------------
       
   820 //
       
   821 TInt CPhoneBubbleWrapper::CountNumberEntryCharacters()
       
   822     {
       
   823     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::CountNumberEntryCharacters");
       
   824 
       
   825     return iPhoneNumberEntry->CountNumberEntryCharacters();
       
   826     }
       
   827 
       
   828 // ---------------------------------------------------------------------------
       
   829 // CPhoneBubbleWrapper::HandleNumberEntryChanged
       
   830 // ---------------------------------------------------------------------------
       
   831 //
       
   832 void CPhoneBubbleWrapper::HandleNumberEntryChanged()
       
   833     {
       
   834     iPhoneNumberEntry->HandleNumberEntryChanged();
       
   835 
       
   836     }
       
   837 
       
   838 // ---------------------------------------------------------------------------
       
   839 // CPhoneBubbleWrapper::HandleNumberEntryCommand
       
   840 // ---------------------------------------------------------------------------
       
   841 //
       
   842 void CPhoneBubbleWrapper::SetNumberEntryChangedCallBack( 
       
   843         TPhoneCommandParam* aCommandParam )
       
   844     {
       
   845     iPhoneNumberEntry->SetNumberEntryChangedCallBack( aCommandParam );
       
   846 
       
   847     }
       
   848 
       
   849 
       
   850 // ---------------------------------------------------------------------------
       
   851 // CPhoneBubbleWrapper::HandleControlEventL
       
   852 //  
       
   853 //  This must be non leaving function, because others use it too.
       
   854 // ---------------------------------------------------------------------------
       
   855 //
       
   856 void CPhoneBubbleWrapper::HandleControlEventL( CCoeControl* aControl, 
       
   857                                                      TCoeEvent aEventType)
       
   858     {
       
   859     if ( aControl == iBubbleManager->GetNumberEntry()->Parent() 
       
   860          && aEventType == EEventStateChanged )
       
   861         {
       
   862         HandleNumberEntryChanged();
       
   863                 
       
   864         }
       
   865     }
       
   866 
       
   867 // ---------------------------------------------------------------------------
       
   868 // CPhoneBubbleWrapper::IsNumberEntryUsed
       
   869 // ---------------------------------------------------------------------------
       
   870 //
       
   871 TBool CPhoneBubbleWrapper::IsNumberEntryUsed()
       
   872     {
       
   873     return iPhoneNumberEntry->IsNumberEntryUsed();
       
   874     }
       
   875 
       
   876 // ---------------------------------------------------------------------------
       
   877 // CPhoneBubbleWrapper::IsNumberEntryVisible
       
   878 // ---------------------------------------------------------------------------
       
   879 //
       
   880 TBool CPhoneBubbleWrapper::IsNumberEntryVisible()
       
   881     {
       
   882     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::IsNumberEntryVisible");
       
   883     __PHONELOG1(
       
   884             EBasic,
       
   885             EPhoneUIView,
       
   886             "CPhoneBubbleWrapper::IsNumberEntryVisible() Visible = %d",
       
   887             iNumberEntryVisible );
       
   888 
       
   889     if ( iUseDialer )
       
   890         {
       
   891         return iDialerNumberEntry->IsNumberEntryUsed();
       
   892         }
       
   893     else
       
   894         {
       
   895         return iBubbleManager->IsNumberEntryUsed() && iNumberEntryVisible;
       
   896         }
       
   897     }
       
   898 
       
   899 // ---------------------------------------------------------------------------
       
   900 // CPhoneBubbleWrapper::HandleKeyEventL
       
   901 // ---------------------------------------------------------------------------
       
   902 //
       
   903 TKeyResponse CPhoneBubbleWrapper::HandleKeyEventL(
       
   904     TPhoneCommandParam* aCommandParam )
       
   905     {
       
   906     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::HandleKeyEventL");
       
   907     TKeyResponse response = EKeyWasNotConsumed;
       
   908 
       
   909     CCoeControl* control(NULL);
       
   910     if ( iUseDialer )
       
   911         {
       
   912         // TODO: We should try to clarify the dialer control hierarchy.
       
   913         // Currently, we have three controls, each of which are somewhere
       
   914         // referred as "number entry": CDialer, CDialerNumberEntry, and CAknPhoneNumberEditor.
       
   915         // Each of these are present on the code line below.
       
   916         control = iDialerNumberEntry->GetNumberEntry()->Parent();
       
   917         }
       
   918     else
       
   919         {
       
   920         control = iBubbleManager->GetNumberEntry();
       
   921         if ( iPhoneCustomization && control )
       
   922             {
       
   923             iBubbleManager->GetEditorMode();
       
   924             }
       
   925         }
       
   926 
       
   927     if ( control )
       
   928         {
       
   929         // Check if the given parameter is valid
       
   930         if ( aCommandParam->ParamId() ==
       
   931             TPhoneCommandParam::EPhoneParamIdKeyEvent )
       
   932             {
       
   933             TPhoneCmdParamKeyEvent* keyEventParam =
       
   934                 static_cast<TPhoneCmdParamKeyEvent*>( aCommandParam );
       
   935 
       
   936             response = control->OfferKeyEventL(
       
   937                 keyEventParam->KeyEvent(), keyEventParam->EventCode() );
       
   938             }
       
   939         }
       
   940 
       
   941     return response;
       
   942     }
       
   943 
       
   944 // ---------------------------------------------------------------------------
       
   945 // CPhoneBubbleWrapper::SetPhoneMuted
       
   946 // Show or clear the "Mute" Icon.
       
   947 // ---------------------------------------------------------------------------
       
   948 //
       
   949 void CPhoneBubbleWrapper::SetPhoneMuted( TPhoneCommandParam* aCommandParam )
       
   950     {
       
   951     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::SetPhoneMuted");
       
   952     // Check if the given parameter is valid
       
   953     if ( aCommandParam->ParamId() == TPhoneCommandParam::EPhoneParamIdBoolean )
       
   954         {
       
   955         TPhoneCmdParamBoolean* booleanParam =
       
   956             static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
   957 
       
   958         iBubbleManager->StartChanges();
       
   959         iBubbleManager->SetPhoneMuted( booleanParam->Boolean() );
       
   960         iBubbleManager->EndChanges();
       
   961         }
       
   962     }
       
   963 
       
   964 // ---------------------------------------------------------------------------
       
   965 // CPhoneBubbleWrapper::PrepareCallStateL
       
   966 // Prepare call bubble state.
       
   967 // (other items were commented in a header).
       
   968 // ---------------------------------------------------------------------------
       
   969 //
       
   970 void CPhoneBubbleWrapper::PrepareCallStateL(
       
   971     TInt aCallId,
       
   972     TPEState aState,
       
   973     const TDesC& aStateLabelText,
       
   974     const TDesC& aStateShortLabelText )
       
   975     {
       
   976     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::PrepareCallState");
       
   977 
       
   978     if ( aCallId == KConferenceCallId && !iConference )
       
   979         {
       
   980         return;
       
   981         }
       
   982 
       
   983     // JMK: moved these two lines temporarily here
       
   984     iBubbleManager->StartChanges();
       
   985     CBubbleManager::TBubbleId bubble;
       
   986 
       
   987     if ( !iMapping->FindBubbleByCall( aCallId, bubble ) )
       
   988         {
       
   989         bubble = iBubbleManager->CreateCallHeader();
       
   990         iMapping->AddToMappingL( bubble, aCallId, CBubbleManager::ENone, NULL );
       
   991         }
       
   992 
       
   993     // Set the call label associated with the state
       
   994     iBubbleManager->SetLabel(
       
   995         bubble,
       
   996         aStateLabelText,
       
   997         CBubbleManager::ERight );
       
   998 
       
   999 
       
  1000     if( aState == EPEStateDialing &&
       
  1001         ( aCallId == KVideoTelephonyCallId1 ||
       
  1002 	    aCallId == KVideoTelephonyCallId2 ) )
       
  1003 		{
       
  1004         StartMOVideoCallAnimationHeaderL( bubble,
       
  1005                                           aStateLabelText,
       
  1006                                           aStateShortLabelText );
       
  1007 		}
       
  1008 
       
  1009     // Stop video call header animation if no EPEStateDialing state
       
  1010 	if( iVideoCallAnimationHeader && ( aState != EPEStateDialing ))
       
  1011     	{
       
  1012     	iVideoCallAnimationHeader->RemoveAnimatingVideoCallHeader();
       
  1013     	}
       
  1014 
       
  1015     CBubbleManager::TPhoneCallState callState = GetBubbleState( aState );
       
  1016 
       
  1017     // Set state
       
  1018     iBubbleManager->SetState( bubble, callState );
       
  1019     iMapping->SetCallStateByCall( aCallId, callState );
       
  1020 
       
  1021     // inform extension plugins
       
  1022     iBubbleExtensionManager->UpdateCallState( bubble, aState );
       
  1023 
       
  1024     iBubbleManager->EndChanges();
       
  1025     }
       
  1026 
       
  1027 // ---------------------------------------------------------------------------
       
  1028 // CPhoneBubbleWrapper::UpdateCallDuration
       
  1029 // ---------------------------------------------------------------------------
       
  1030 //
       
  1031 void CPhoneBubbleWrapper::UpdateCallDuration(
       
  1032     TInt aCallId,
       
  1033     const TDesC& aDurationText )
       
  1034     {
       
  1035     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::UpdateCallDuration");
       
  1036     CBubbleManager::TBubbleId bubble;
       
  1037 
       
  1038     if ( iMapping->FindBubbleByCall( aCallId, bubble ) )
       
  1039         {
       
  1040         iBubbleManager->UpdateCallTime( bubble, aDurationText );
       
  1041         }
       
  1042     }
       
  1043 
       
  1044 // ---------------------------------------------------------------------------
       
  1045 // CPhoneBubbleWrapper::CreateBubbleL
       
  1046 // ---------------------------------------------------------------------------
       
  1047 //
       
  1048 CBubbleManager::TBubbleId CPhoneBubbleWrapper::CreateBubbleL( TInt aCallId )
       
  1049     {
       
  1050     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::CreateBubble");
       
  1051     CBubbleManager::TBubbleId bubble;
       
  1052 
       
  1053     if ( !iMapping->FindBubbleByCall( aCallId, bubble ) )
       
  1054         {
       
  1055         bubble = iBubbleManager->CreateCallHeader();
       
  1056         iMapping->AddToMappingL( bubble, aCallId, CBubbleManager::ENone, NULL );
       
  1057         }
       
  1058 
       
  1059     return bubble;
       
  1060     }
       
  1061 
       
  1062 // ---------------------------------------------------------------------------
       
  1063 // CPhoneBubbleWrapper::SetCLI
       
  1064 // ---------------------------------------------------------------------------
       
  1065 //
       
  1066 void CPhoneBubbleWrapper::SetCLI(
       
  1067     CBubbleManager::TBubbleId aId,
       
  1068     const TDesC& aText,
       
  1069     CBubbleManager::TPhoneClippingDirection aDirection )
       
  1070     {
       
  1071     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::SetCLI");
       
  1072 
       
  1073     // Start bubble manager changes
       
  1074     iBubbleManager->StartChanges();
       
  1075 
       
  1076     iBubbleManager->SetCLI(
       
  1077         aId,
       
  1078         aText,
       
  1079         aDirection );
       
  1080 
       
  1081     // End bubble manager changes
       
  1082     iBubbleManager->EndChanges();
       
  1083     }
       
  1084 
       
  1085 // ---------------------------------------------------------------------------
       
  1086 // CPhoneBubbleWrapper::SetCnap
       
  1087 // needed because of __SERIES60_PHONE_CNAP
       
  1088 // ---------------------------------------------------------------------------
       
  1089 //
       
  1090 void CPhoneBubbleWrapper::SetCNAP(
       
  1091     CBubbleManager::TBubbleId aId,
       
  1092     const TDesC& aCnapText, 
       
  1093     CBubbleManager::TPhoneClippingDirection aDirection )
       
  1094     {
       
  1095     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::SetCNAP");
       
  1096 
       
  1097     iBubbleManager->SetCNAP(
       
  1098         aId, 
       
  1099         aCnapText, 
       
  1100         aDirection );
       
  1101     }
       
  1102 
       
  1103 // ---------------------------------------------------------------------------
       
  1104 // CPhoneBubbleWrapper::SetNumberTypeIndicator
       
  1105 // ---------------------------------------------------------------------------
       
  1106 //
       
  1107 void CPhoneBubbleWrapper::SetNumberTypeIndicator(
       
  1108     CBubbleManager::TBubbleId aBubbleId,
       
  1109     TPEPhoneNumberIdType aNumberType )
       
  1110     {
       
  1111     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::SetNumberTypeIndicator");
       
  1112     CBubbleManager::TPhoneNumberType phoneNumberType =
       
  1113         CBubbleManager::ENotSet;
       
  1114 
       
  1115     // map the number type to the bubble's number types
       
  1116     switch( aNumberType )
       
  1117         {
       
  1118         case EPEFaxNumber:
       
  1119             phoneNumberType = CBubbleManager::EFaxNumber;
       
  1120             break;
       
  1121 
       
  1122         case EPEMobileNumber:
       
  1123             phoneNumberType = CBubbleManager::EMobile;
       
  1124             break;
       
  1125 
       
  1126         case EPEPager:
       
  1127             phoneNumberType = CBubbleManager::EPager;
       
  1128             break;
       
  1129 
       
  1130         case EPETelephoneNumber:
       
  1131             phoneNumberType = CBubbleManager::EPhone;
       
  1132             break;
       
  1133 
       
  1134         case EPEAssistantNumber:
       
  1135             phoneNumberType = CBubbleManager::EAssistant;
       
  1136             break;
       
  1137 
       
  1138         case EPECarNumber:
       
  1139             phoneNumberType = CBubbleManager::ECar;
       
  1140             break;
       
  1141 
       
  1142         default:
       
  1143             break;
       
  1144         }
       
  1145 
       
  1146     // signal the bubble manager to update the call type icon
       
  1147     iBubbleManager->SetNumberType( aBubbleId, phoneNumberType );
       
  1148     }
       
  1149 
       
  1150 // ---------------------------------------------------------------------------
       
  1151 // CPhoneBubbleWrapper::CreateConferenceL
       
  1152 // (other items were commented in a header).
       
  1153 // ---------------------------------------------------------------------------
       
  1154 //
       
  1155 void CPhoneBubbleWrapper::CreateConferenceL(
       
  1156     TInt aCallId,
       
  1157     TPhoneCommandParam *aCommandParam )
       
  1158     {
       
  1159     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::CreateConference");
       
  1160 
       
  1161     TPhoneCmdParamCallHeaderData* callHeaderParam =
       
  1162             static_cast<TPhoneCmdParamCallHeaderData*>( aCommandParam );
       
  1163 
       
  1164 	if( !iParticipants )
       
  1165 		{
       
  1166 		// Create participants array if doesn't exist
       
  1167 	    iParticipants = new ( ELeave ) CParticipantArray(
       
  1168 	        KConferenceMaxParticipants );
       
  1169 	    iParticipants->SetReserveL( KConferenceMaxParticipants );
       
  1170 		}
       
  1171 
       
  1172     // find out call ids for initial conference members
       
  1173     TInt firstCallId( KErrNotFound );
       
  1174     TInt secondCallId( KErrNotFound );
       
  1175     TInt callCount = iMapping->ItemCount();
       
  1176 
       
  1177     // Find bubbles to conference
       
  1178     for ( TInt index = 0; index < callCount; index++ )
       
  1179         {
       
  1180         TInt callId = iMapping->CallIdAt( index );
       
  1181         CBubbleManager::TPhoneCallState bubbleState;
       
  1182         bubbleState = iMapping->FindCallStateByCall( callId );
       
  1183 
       
  1184 
       
  1185         if ( firstCallId == KErrNotFound )
       
  1186             {
       
  1187             TInt callId = iMapping->CallIdAt( index );
       
  1188             if( bubbleState == CBubbleManager::EActive ||
       
  1189                 bubbleState == CBubbleManager::EOnHold )
       
  1190                 {
       
  1191                 firstCallId = iMapping->CallIdAt( index );
       
  1192                 }
       
  1193             }
       
  1194         else if ( secondCallId == KErrNotFound )
       
  1195             {
       
  1196             if( bubbleState == CBubbleManager::EActive ||
       
  1197                 bubbleState == CBubbleManager::EOnHold )
       
  1198 
       
  1199                 {
       
  1200                 secondCallId = iMapping->CallIdAt( index );
       
  1201                 }
       
  1202             }
       
  1203         }
       
  1204 
       
  1205     if ( firstCallId != KErrNotFound && secondCallId != KErrNotFound )
       
  1206         {
       
  1207         // get bubbles which have to connect to conference
       
  1208         CBubbleManager::TBubbleId first = CreateBubbleL( firstCallId );
       
  1209         CBubbleManager::TBubbleId second = CreateBubbleL( secondCallId );
       
  1210 
       
  1211         iBubbleManager->StartChanges();
       
  1212         CBubbleManager::TBubbleId conference =
       
  1213             iBubbleManager->CreateConference( first, second );
       
  1214         iBubbleManager->SetState( conference, CBubbleManager::EActive );
       
  1215         iBubbleManager->SetLabel( conference, KNullDesC );
       
  1216         iBubbleManager->SetCallTime( conference, KNullDesC );
       
  1217         // Set CLI text
       
  1218         iBubbleManager->SetCLI(
       
  1219                 conference, callHeaderParam->CLIText(), CBubbleManager::ERight );
       
  1220 
       
  1221         // Set ciphering indicator
       
  1222         iBubbleManager->SetCallFlag(
       
  1223             conference,
       
  1224             CBubbleManager::ENoCiphering,
       
  1225             callHeaderParam->CipheringIndicatorAllowed() && 
       
  1226             !callHeaderParam->Ciphering() );
       
  1227 
       
  1228         // add calls to participant list - conference call itself is not a participant
       
  1229         iParticipants->AppendL(firstCallId);
       
  1230         iParticipants->AppendL(secondCallId);
       
  1231 
       
  1232         if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) ||
       
  1233              callCount > KNumberOfActiveCalls )
       
  1234             {
       
  1235             SetConferenceExpand( EFalse );
       
  1236             }
       
  1237         else
       
  1238             {
       
  1239             SetConferenceExpand( ETrue );
       
  1240             }
       
  1241 
       
  1242         // add conference to mapping
       
  1243         iMapping->AddToMappingL(conference, aCallId, CBubbleManager::EActive, NULL);
       
  1244 
       
  1245         TInt count = iParticipants->Count();
       
  1246 
       
  1247         for ( TInt index = 0; index < count; index++ )
       
  1248             {
       
  1249             CBubbleManager::TBubbleId bubble =
       
  1250                 CreateBubbleL( iParticipants->At( index ) );
       
  1251             iBubbleManager->SetState( bubble, CBubbleManager::EActive );
       
  1252             iBubbleManager->SetLabel( bubble, KNullDesC );
       
  1253             iBubbleManager->SetCallTime( bubble, KNullDesC );
       
  1254             }
       
  1255 
       
  1256     	// If image/text is enabled and theme image is set, use it
       
  1257       	if( iCallImageTextSupported )
       
  1258     	  	{
       
  1259             if ( iCallTheme->CallImageThemeSettings() == 2 )
       
  1260                 {
       
  1261                 // 4. Theme image
       
  1262                 iBubbleManager->SetCallObjectFromTheme( conference );
       
  1263                 }
       
  1264             else if ( iCallTheme->CallImageThemeSettings() == 1 )
       
  1265                 {
       
  1266                 // 5. User defined theme image
       
  1267                 iBubbleManager->SetCallObjectImage(
       
  1268                     conference,
       
  1269                     iCallTheme->CallImageThemeFilePath() );
       
  1270                 }
       
  1271     	  	}
       
  1272       	
       
  1273       	// Read and save internally the simplified conference call header 
       
  1274       	// setting for the service where conference is to be created.
       
  1275       	SetSimplifiedConferenceCallHeaderStatus( 
       
  1276       	    IsSimplifiedConferenceCallHeaderEnabledL( 
       
  1277       	        callHeaderParam->ServiceId() ) );
       
  1278       	
       
  1279         iBubbleManager->EndChanges();
       
  1280         iConference = ETrue;
       
  1281         }
       
  1282     else
       
  1283         {
       
  1284         __PHONELOG(
       
  1285             EBasic,
       
  1286             EPhoneUIView,
       
  1287             "CPhoneBubbleWrapper::CreateConference -> No valid call bubbles -> Can't Create conference " );
       
  1288         }
       
  1289     }
       
  1290 
       
  1291 // ---------------------------------------------------------
       
  1292 // CPhoneBubbleWrapper::RemoveConferenceBubbleL
       
  1293 // (other items were commented in a header).
       
  1294 // ---------------------------------------------------------
       
  1295 //
       
  1296 void CPhoneBubbleWrapper::RemoveConferenceBubbleL()
       
  1297     {
       
  1298     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::RemoveConferenceBubbleL");
       
  1299     iBubbleManager->SetState( CreateBubbleL( KConferenceCallId ), CBubbleManager::EDisconnected );
       
  1300     
       
  1301     SetConferenceExpand( EFalse );
       
  1302     SetConferenceHighlight( EFalse );
       
  1303     SetSimplifiedConferenceCallHeaderStatus( EFalse );
       
  1304     iBubbleManager->RemoveConference();
       
  1305     
       
  1306     // remove conference from mapping
       
  1307     iMapping->RemoveFromMapping( KConferenceCallId );
       
  1308     }
       
  1309 
       
  1310 // ---------------------------------------------------------
       
  1311 // CPhoneBubbleWrapper::RemoveConferenceL
       
  1312 // (other items were commented in a header).
       
  1313 // ---------------------------------------------------------
       
  1314 //
       
  1315 void CPhoneBubbleWrapper::RemoveConferenceL()
       
  1316     {
       
  1317     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::RemoveConference");
       
  1318 
       
  1319 	if ( iConference )
       
  1320 		{
       
  1321 		iBubbleManager->StartChanges();
       
  1322 
       
  1323 	    // Set conference bubble state and remove bubble
       
  1324 	    RemoveConferenceBubbleL();
       
  1325 
       
  1326 	    TInt count = iParticipants->Count();
       
  1327 
       
  1328 	    // empty participants list
       
  1329 	    iParticipants->Delete(0, count);
       
  1330 
       
  1331 	    iBubbleManager->EndChanges();
       
  1332 
       
  1333 	    iConference = EFalse;
       
  1334 		}
       
  1335     }
       
  1336 // ---------------------------------------------------------
       
  1337 // CPhoneBubbleWrapper::AddToConferenceL
       
  1338 // (other items were commented in a header).
       
  1339 // ---------------------------------------------------------
       
  1340 //
       
  1341 void CPhoneBubbleWrapper::AddToConferenceL( TInt aCallId )
       
  1342     {
       
  1343     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::AddToConference");
       
  1344 
       
  1345     iBubbleManager->StartChanges();
       
  1346 
       
  1347     CBubbleManager::TBubbleId bubble = CreateBubbleL( aCallId );
       
  1348 
       
  1349     iBubbleManager->AddRowToConference( bubble );
       
  1350 
       
  1351     iBubbleManager->SetState( bubble, CBubbleManager::EActive );
       
  1352     iBubbleManager->SetLabel( bubble, KNullDesC );
       
  1353     iBubbleManager->SetCallTime( bubble, KNullDesC );
       
  1354 
       
  1355     if ( !FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) &&
       
  1356          iMapping->FindCallIdByCallState( CBubbleManager::EWaiting ) < 0 &&
       
  1357          iMapping->FindCallIdByCallState( CBubbleManager::EOutgoing ) < 0 &&
       
  1358          iMapping->FindCallIdByCallState( CBubbleManager::EDisconnected ) < 0 )
       
  1359         {
       
  1360         SetConferenceExpand( ETrue );
       
  1361         }
       
  1362 
       
  1363     iParticipants->AppendL( aCallId );
       
  1364 
       
  1365     iBubbleManager->EndChanges();
       
  1366     }
       
  1367 
       
  1368 // ---------------------------------------------------------
       
  1369 // CPhoneBubbleWrapper::RemoveFromConferenceL
       
  1370 // (other items were commented in a header).
       
  1371 // ---------------------------------------------------------
       
  1372 //
       
  1373 void CPhoneBubbleWrapper::RemoveFromConferenceL( TInt aCallId )
       
  1374     {
       
  1375     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::RemoveFromConference");
       
  1376     TInt pos = FindParticipantPosition( aCallId );
       
  1377 
       
  1378     if ( pos != KErrNotFound )
       
  1379         {
       
  1380         iBubbleManager->StartChanges();
       
  1381         TInt count = iParticipants->Count();
       
  1382         CBubbleManager::TBubbleId bubble = CreateBubbleL( aCallId );
       
  1383 	    iBubbleManager->RemoveRowFromConference( bubble );
       
  1384 
       
  1385         // If there are enough participants for conference, then
       
  1386         // simply remove it from conference.
       
  1387         if ( count > KPhoneConferenceInitialSize )
       
  1388             {
       
  1389             iParticipants->Delete( pos );
       
  1390             }
       
  1391         else
       
  1392         // Otherwise we also have to clear the conference.
       
  1393             {
       
  1394             RemoveConferenceL();
       
  1395             }
       
  1396 
       
  1397 	    iBubbleManager->RemoveCallHeader( bubble );
       
  1398 	    iMapping->RemoveFromMapping( aCallId );
       
  1399 	    iBubbleManager->EndChanges();
       
  1400         }
       
  1401     }
       
  1402 
       
  1403 // ---------------------------------------------------------
       
  1404 // CPhoneBubbleWrapper::FindParticipantPosition
       
  1405 // ---------------------------------------------------------
       
  1406 //
       
  1407 TInt CPhoneBubbleWrapper::FindParticipantPosition(
       
  1408     const TInt aCallId )
       
  1409     {
       
  1410     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::FindParticipantPosition");
       
  1411     TInt result = KErrNotFound;
       
  1412 
       
  1413     TInt index;
       
  1414     TInt count = iParticipants->Count();
       
  1415 
       
  1416     for ( index = 0; index < count; index++ )
       
  1417         {
       
  1418         if ( iParticipants->At( index ) == aCallId )
       
  1419             {
       
  1420             result = index;
       
  1421             break;
       
  1422             }
       
  1423         }
       
  1424 
       
  1425     return result;
       
  1426     }
       
  1427 
       
  1428 // -----------------------------------------------------------------------------
       
  1429 // CPhoneBubbleWrapper::SetConferenceExpand
       
  1430 // -----------------------------------------------------------------------------
       
  1431 //
       
  1432 void CPhoneBubbleWrapper::SetConferenceExpand( TBool aStatus )
       
  1433     {
       
  1434     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::SetConferenceExpand");
       
  1435     TInt flags = iFlags;
       
  1436 
       
  1437     flags &= ~EFlagConferenceExpanded;
       
  1438 
       
  1439     if ( aStatus )
       
  1440         {
       
  1441         flags |= EFlagConferenceExpanded;
       
  1442         }
       
  1443 
       
  1444     HandleFlagsUpdated( flags );
       
  1445     }
       
  1446 
       
  1447 
       
  1448 // -----------------------------------------------------------------------------
       
  1449 // CPhoneBubbleWrapper::SetConferenceHighlight
       
  1450 // -----------------------------------------------------------------------------
       
  1451 //
       
  1452 void CPhoneBubbleWrapper::SetConferenceHighlight(TBool aStatus)
       
  1453     {
       
  1454     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::SetConferenceHighlight");
       
  1455     TInt flags = iFlags;
       
  1456     flags &= ~EFlagConferenceReqExpanded;
       
  1457 
       
  1458     if ( aStatus )
       
  1459         {
       
  1460         flags |= EFlagConferenceReqExpanded;
       
  1461         }
       
  1462 
       
  1463     HandleFlagsUpdated( flags );
       
  1464     }
       
  1465 
       
  1466 // ---------------------------------------------------------
       
  1467 // CPhoneBubbleWrapper::HandleFlagsUpdated
       
  1468 // ---------------------------------------------------------
       
  1469 //
       
  1470 void CPhoneBubbleWrapper::HandleFlagsUpdated(
       
  1471     TInt aNewFlags )
       
  1472     {
       
  1473     // If no changes, then just return.
       
  1474     if ( iFlags == aNewFlags )
       
  1475         {
       
  1476         return;
       
  1477         }
       
  1478 
       
  1479     TInt old = iFlags;
       
  1480     iFlags = aNewFlags;
       
  1481 
       
  1482     if ( !( iFlags & EFlagNumberEntryExists ) )
       
  1483         {
       
  1484         // Number entry can't be visible if it doesn't exist.
       
  1485         iFlags &= ~EFlagNumberEntryVisible;
       
  1486         iNumberEntryVisible = EFalse;
       
  1487         }
       
  1488 
       
  1489     iBubbleManager->StartChanges();
       
  1490 
       
  1491     // Check if number entry has been removed.
       
  1492     if ( old & ~iFlags & EFlagNumberEntryExists )
       
  1493         {
       
  1494         iBubbleManager->RemoveNumberEntry();
       
  1495         }
       
  1496 
       
  1497     // If conference is required to expanded, then it must be
       
  1498     // kept so.
       
  1499     if ( iFlags & EFlagConferenceReqExpanded )
       
  1500         {
       
  1501         // If there has been change, then enable it.
       
  1502         if ( !( old & EFlagConferenceReqExpanded) )
       
  1503             {
       
  1504             iBubbleManager->SetExpandedConferenceCallHeader( ETrue );
       
  1505             iBubbleManager->SetSelectionInConference( 1 );
       
  1506             iBubbleManager->SetNumberEntryVisible( EFalse );
       
  1507             iNumberEntryVisible = EFalse;
       
  1508             }
       
  1509 
       
  1510         // We do not have to anything else.
       
  1511         iBubbleManager->EndChanges();
       
  1512         return;
       
  1513         }
       
  1514 
       
  1515     // Now we can consider that there is no highlight.
       
  1516     iBubbleManager->SetSelectionInConference( 0 );
       
  1517 
       
  1518     // Number entry exists now.
       
  1519     if ( iFlags & EFlagNumberEntryExists )
       
  1520         {
       
  1521         // If there has been change, create number entry.
       
  1522         if ( !( old & EFlagNumberEntryExists ) )
       
  1523             {
       
  1524             iBubbleManager->CreateNumberEntry();
       
  1525             iNumberEntryVisible = ETrue;
       
  1526             }
       
  1527 
       
  1528         // If number entry exists, then make it visible.
       
  1529         iBubbleManager->SetNumberEntryVisible( iFlags & EFlagNumberEntryVisible );
       
  1530         iNumberEntryVisible = ( iFlags & EFlagNumberEntryVisible );
       
  1531 
       
  1532         // Shrink conference
       
  1533         iBubbleManager->SetExpandedConferenceCallHeader( EFalse );
       
  1534         }
       
  1535 
       
  1536     // If conference expanded flag, then expand/shrink conference.
       
  1537     if ( iFlags == EFlagConferenceExpanded )
       
  1538         {
       
  1539         iBubbleManager->SetExpandedConferenceCallHeader( ETrue );
       
  1540         }
       
  1541     else if ( !( iFlags & EFlagConferenceExpanded ) )
       
  1542         {
       
  1543         iBubbleManager->SetExpandedConferenceCallHeader( EFalse );
       
  1544         }
       
  1545     
       
  1546     // Simplified conference call header setting overrides 
       
  1547     // EFlagConferenceExpanded setting.
       
  1548     if ( iFlags & EFlagSimplifiedConferenceCallHeader )
       
  1549         {
       
  1550         iBubbleManager->SetExpandedConferenceCallHeader( EFalse );
       
  1551         }
       
  1552     
       
  1553     iBubbleManager->EndChanges();
       
  1554     }
       
  1555 
       
  1556 // ---------------------------------------------------------
       
  1557 // CPhoneBubbleWrapper::SelectedConfMemberCallIdL
       
  1558 // ---------------------------------------------------------
       
  1559 //
       
  1560 TBool CPhoneBubbleWrapper::SelectedConfMemberCallIdL(
       
  1561     TPhoneCommandParam* aCommandParam )
       
  1562     {
       
  1563     CBubbleManager::TBubbleId selected =
       
  1564         iBubbleManager->SelectionIdInConference();
       
  1565     TInt callId;
       
  1566 
       
  1567     TBool ok = iMapping->FindCallByBubble( selected, callId );
       
  1568 
       
  1569     TPhoneCmdParamInteger* locationContent =
       
  1570         static_cast<TPhoneCmdParamInteger*>( aCommandParam );
       
  1571 
       
  1572     locationContent->SetInteger( callId );
       
  1573     return ok;
       
  1574     }
       
  1575 
       
  1576 // ---------------------------------------------------------
       
  1577 // CPhoneBubbleWrapper::OpenConferenceList
       
  1578 // ---------------------------------------------------------
       
  1579 //
       
  1580 void CPhoneBubbleWrapper::OpenConferenceList(
       
  1581     TPhoneCommandParam* aCommandParam )
       
  1582     {
       
  1583     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::OpenConferenceList");
       
  1584     // Check if the given parameter is valid
       
  1585     if ( aCommandParam->ParamId() == TPhoneCommandParam::EPhoneParamIdBoolean )
       
  1586         {
       
  1587         TPhoneCmdParamBoolean* booleanParam =
       
  1588             static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  1589         SetConferenceHighlight( booleanParam->Boolean() );
       
  1590         }
       
  1591     }
       
  1592 
       
  1593 // -----------------------------------------------------------------------------
       
  1594 // CPhoneBubbleWrapper::MoveHighlightInConference
       
  1595 // -----------------------------------------------------------------------------
       
  1596 //
       
  1597 void CPhoneBubbleWrapper::MoveHighlightInConference(
       
  1598     TPhoneCommandParam* aCommandParam )
       
  1599     {
       
  1600     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::MoveHighlightInConference");
       
  1601     // Check Is selection list Highlight
       
  1602     if ( iFlags & EFlagConferenceReqExpanded )
       
  1603         {
       
  1604         if ( aCommandParam->ParamId() ==
       
  1605             TPhoneCommandParam::EPhoneParamIdKeyEvent )
       
  1606             {
       
  1607             TPhoneCmdParamKeyEvent* keyEventParam =
       
  1608                 static_cast<TPhoneCmdParamKeyEvent*>( aCommandParam );
       
  1609 
       
  1610             if ( keyEventParam->KeyEvent().iCode == EKeyUpArrow )
       
  1611                 {
       
  1612                 iBubbleManager->MoveHighlightOneUpInConference();
       
  1613                 }
       
  1614             else if ( keyEventParam->KeyEvent().iCode == EKeyDownArrow  )
       
  1615                 {
       
  1616                 iBubbleManager->MoveHighlightOneDownInConference();
       
  1617                 }
       
  1618             }
       
  1619         }
       
  1620     }
       
  1621 
       
  1622 // -----------------------------------------------------------------------------
       
  1623 // CPhoneBubbleWrapper::GetCallState
       
  1624 // -----------------------------------------------------------------------------
       
  1625 //
       
  1626 TInt CPhoneBubbleWrapper::GetCallState(
       
  1627     TPhoneCommandParam* aCommandParam )
       
  1628     {
       
  1629     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::GetCallState");
       
  1630     TPEState callState = EPEStateUnknown;
       
  1631 
       
  1632     CBubbleManager::TPhoneCallState bubbleState = CBubbleManager::ENone;
       
  1633     if ( aCommandParam->ParamId() ==
       
  1634         TPhoneCommandParam::EPhoneParamIdCallStateData )
       
  1635         {
       
  1636         TPhoneCmdParamCallStateData* stateParam =
       
  1637             static_cast<TPhoneCmdParamCallStateData*>( aCommandParam );
       
  1638         bubbleState = iMapping->FindCallStateByCall( stateParam->CallId() );
       
  1639         callState = ConvertCallState(  bubbleState );
       
  1640         stateParam->SetCallState( callState );
       
  1641         }
       
  1642     return bubbleState;
       
  1643     }
       
  1644 
       
  1645 // -----------------------------------------------------------------------------
       
  1646 // CPhoneBubbleWrapper::GetCallIdByState
       
  1647 // -----------------------------------------------------------------------------
       
  1648 //
       
  1649 TInt CPhoneBubbleWrapper::GetCallIdByState(
       
  1650     TPhoneCommandParam* aCommandParam )
       
  1651     {
       
  1652     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::GetCallIdByState");
       
  1653     TInt callId = KErrNotFound;
       
  1654 
       
  1655     if ( aCommandParam->ParamId() ==
       
  1656         TPhoneCommandParam::EPhoneParamIdCallStateData )
       
  1657         {
       
  1658         TPhoneCmdParamCallStateData* stateParam =
       
  1659             static_cast<TPhoneCmdParamCallStateData*>( aCommandParam );
       
  1660         CBubbleManager::TPhoneCallState callState =
       
  1661             GetBubbleState( stateParam->CallState() );
       
  1662 
       
  1663          __PHONELOG1(
       
  1664             EBasic,
       
  1665             EPhoneUIView,
       
  1666             "CPhoneBubbleWrapper::GetCallIdByState iConference = %d",
       
  1667             iConference );
       
  1668 
       
  1669         if ( iConference )
       
  1670             {
       
  1671             if ( iMapping->FindCallStateByCall( KConferenceCallId ) == callState )
       
  1672                 {
       
  1673                 callId = KConferenceCallId;
       
  1674                 }
       
  1675             else
       
  1676                 {
       
  1677                 callId = iMapping->FindCallIdByCallState( callState );
       
  1678 
       
  1679                 // check if this call conference member
       
  1680                 if ( FindParticipantPosition( callId ) != KErrNotFound )
       
  1681                     {
       
  1682                     callId = KConferenceCallId;
       
  1683                     }
       
  1684 
       
  1685                 // Check if not found Incoming that is there waiting
       
  1686                 if ( ( callId == KErrNotFound ) &&
       
  1687                     ( callState == CBubbleManager::EIncoming ) )
       
  1688                     {
       
  1689                     callId = iMapping->FindCallIdByCallState( CBubbleManager::EWaiting );
       
  1690                     }
       
  1691                 }
       
  1692             }
       
  1693         else
       
  1694             {
       
  1695             callId = iMapping->FindCallIdByCallState( callState );
       
  1696             // Check if not found Incoming that is there waiting
       
  1697             if ( ( callId == KErrNotFound ) &&
       
  1698                 ( callState == CBubbleManager::EIncoming ) )
       
  1699                 {
       
  1700                 callId = iMapping->FindCallIdByCallState(
       
  1701                     CBubbleManager::EWaiting );
       
  1702                 }
       
  1703             }
       
  1704 
       
  1705         stateParam->SetCallId( callId );
       
  1706         }
       
  1707     return KErrNone;
       
  1708     }
       
  1709 
       
  1710 // -----------------------------------------------------------------------------
       
  1711 // CPhoneBubbleWrapper::GetBubbleState
       
  1712 // -----------------------------------------------------------------------------
       
  1713 //
       
  1714 CBubbleManager::TPhoneCallState CPhoneBubbleWrapper::GetBubbleState(
       
  1715     TPEState aState )
       
  1716     {
       
  1717     CBubbleManager::TPhoneCallState callState = CBubbleManager::ENone;
       
  1718     switch ( aState )
       
  1719         {
       
  1720         case EPEStateIdle:
       
  1721             callState = CBubbleManager::EDisconnected;
       
  1722             break;
       
  1723 
       
  1724         case EPEStateDialing:
       
  1725             callState = CBubbleManager::EOutgoing;
       
  1726             break;
       
  1727 
       
  1728         case EPEStateRinging:
       
  1729             if ( iMapping->ItemCount() > 1 )
       
  1730                 {
       
  1731                 callState = CBubbleManager::EWaiting;
       
  1732                 }
       
  1733             else
       
  1734                 {
       
  1735                 callState = CBubbleManager::EIncoming;
       
  1736                 }
       
  1737             break;
       
  1738 
       
  1739         case EPEStateConnecting:
       
  1740             callState = CBubbleManager::EAlerting;
       
  1741             break;
       
  1742 
       
  1743         case EPEStateConnected:
       
  1744             callState = CBubbleManager::EActive;
       
  1745             break;
       
  1746 
       
  1747         case EPEStateHeld:
       
  1748             callState = CBubbleManager::EOnHold;
       
  1749             break;
       
  1750 
       
  1751         case EPEStateDisconnecting:
       
  1752             callState = CBubbleManager::EDisconnected;
       
  1753             break;
       
  1754 
       
  1755         case EPEStateConferenceIdle:
       
  1756             callState = CBubbleManager::EDisconnected;
       
  1757             break;
       
  1758 
       
  1759         // GSM specific
       
  1760         case EPEStateConnectedConference:
       
  1761             callState = CBubbleManager::EActive;
       
  1762             break;
       
  1763 
       
  1764         case EPEStateHeldConference:
       
  1765             callState = CBubbleManager::EOnHold;
       
  1766             break;
       
  1767 
       
  1768         case EPEStateUnknown:
       
  1769             break;
       
  1770 
       
  1771         default:
       
  1772             break;
       
  1773         }
       
  1774     return callState;
       
  1775     }
       
  1776 
       
  1777 // -----------------------------------------------------------------------------
       
  1778 // CPhoneBubbleWrapper::ConvertCallState
       
  1779 // -----------------------------------------------------------------------------
       
  1780 //
       
  1781 TPEState CPhoneBubbleWrapper::ConvertCallState(
       
  1782     CBubbleManager::TPhoneCallState aBubbleState )
       
  1783     {
       
  1784     TPEState callState = EPEStateUnknown;
       
  1785     switch ( aBubbleState )
       
  1786         {
       
  1787         case CBubbleManager::EOutgoing:
       
  1788             callState = EPEStateDialing;
       
  1789             break;
       
  1790         case CBubbleManager::EWaiting:
       
  1791         case CBubbleManager::EIncoming:
       
  1792             callState = EPEStateRinging;
       
  1793             break;
       
  1794         case CBubbleManager::EAlerting:
       
  1795             callState = EPEStateConnecting;
       
  1796             break;
       
  1797         case CBubbleManager::EActive:
       
  1798             callState = EPEStateConnected;
       
  1799             break;
       
  1800         case CBubbleManager::EOnHold:
       
  1801             callState = EPEStateHeld;
       
  1802             break;
       
  1803         case CBubbleManager::EDisconnected:
       
  1804             callState = EPEStateDisconnecting;
       
  1805             break;
       
  1806         default:
       
  1807             break;
       
  1808         }
       
  1809     return callState;
       
  1810     }
       
  1811 
       
  1812 // -----------------------------------------------------------------------------
       
  1813 // CPhoneBubbleWrapper::ConferenceMemberToPrivateL
       
  1814 // -----------------------------------------------------------------------------
       
  1815 //
       
  1816 void CPhoneBubbleWrapper::ConferenceMemberToPrivateL(
       
  1817         TInt aCallId )
       
  1818     {
       
  1819     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::ConferenceMemberToPrivate");
       
  1820     TInt pos = FindParticipantPosition( aCallId );
       
  1821 
       
  1822     if ( pos != KErrNotFound )
       
  1823         {
       
  1824         TInt count = iParticipants->Count();
       
  1825 
       
  1826         // If there are enough participants for conference, then
       
  1827         // simply remove it from conference.
       
  1828         if ( count > KPhoneConferenceInitialSize )
       
  1829             {
       
  1830             iParticipants->Delete( pos );
       
  1831             SetConferenceHighlight( EFalse );
       
  1832             SetConferenceExpand( EFalse );
       
  1833             iBubbleManager->StartChanges();
       
  1834             CBubbleManager::TBubbleId bubble = CreateBubbleL( aCallId );
       
  1835             iBubbleManager->RemoveRowFromConference( bubble );
       
  1836             iBubbleManager->EndChanges();
       
  1837             }
       
  1838         else
       
  1839         // Otherwise we also have to clear the conference.
       
  1840             {
       
  1841             RemoveConferenceL();
       
  1842             }
       
  1843         }
       
  1844     }
       
  1845 
       
  1846 // -----------------------------------------------------------------------------
       
  1847 // CPhoneBubbleWrapper::GetActiveCallsCount
       
  1848 // -----------------------------------------------------------------------------
       
  1849 //
       
  1850 void CPhoneBubbleWrapper::GetActiveCallsCount( TPhoneCommandParam* aCommandParam )
       
  1851     {
       
  1852     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::GetActiveCallsCount");
       
  1853 
       
  1854     if ( aCommandParam->ParamId() ==
       
  1855         TPhoneCommandParam::EPhoneParamIdInteger )
       
  1856         {
       
  1857         TPhoneCmdParamInteger* intParam =
       
  1858             static_cast<TPhoneCmdParamInteger*>( aCommandParam );
       
  1859 
       
  1860         intParam->SetInteger( CountNumberOfActiveCalls() );
       
  1861         }
       
  1862     }
       
  1863 
       
  1864 // -----------------------------------------------------------------------------
       
  1865 // CPhoneBubbleWrapper::CountNumberOfActiveCalls
       
  1866 // -----------------------------------------------------------------------------
       
  1867 //
       
  1868 TInt CPhoneBubbleWrapper::CountNumberOfActiveCalls() const
       
  1869     {
       
  1870     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::CountNumberOfActiveCalls");
       
  1871     TInt callCount = iMapping->ItemCount();
       
  1872     TInt activeCallCount = 0;
       
  1873 
       
  1874     if ( iConference )
       
  1875         {
       
  1876         if ( iMapping->FindCallIdByCallState(
       
  1877             CBubbleManager::EActive ) != KErrNotFound )
       
  1878             {
       
  1879             activeCallCount++;
       
  1880             }
       
  1881         if ( iMapping->FindCallIdByCallState(
       
  1882             CBubbleManager::EOnHold ) != KErrNotFound )
       
  1883             {
       
  1884             activeCallCount++;
       
  1885             }
       
  1886         if ( iMapping->FindCallIdByCallState(
       
  1887             CBubbleManager::EDisconnected ) != KErrNotFound )
       
  1888             {
       
  1889             activeCallCount++;
       
  1890             }
       
  1891         }
       
  1892     else
       
  1893         {
       
  1894         CBubbleManager::TPhoneCallState bubbleState = CBubbleManager::ENone;
       
  1895         TInt callId ( KErrNotFound );
       
  1896 
       
  1897         for ( TInt index = ( callCount - 1 ); index >= 0; index-- )
       
  1898             {
       
  1899             callId = iMapping->CallIdAt( index );
       
  1900             bubbleState = iMapping->FindCallStateByCall( callId );
       
  1901 
       
  1902             if ( bubbleState == CBubbleManager::EActive ||
       
  1903                  bubbleState == CBubbleManager::EOnHold ||
       
  1904                  bubbleState == CBubbleManager::EDisconnected )
       
  1905                 {
       
  1906                 activeCallCount++;
       
  1907                 }
       
  1908             }
       
  1909         }
       
  1910     return activeCallCount;
       
  1911     }
       
  1912 
       
  1913 // -----------------------------------------------------------------------------
       
  1914 // CPhoneBubbleWrapper::GetIsConference
       
  1915 // -----------------------------------------------------------------------------
       
  1916 //
       
  1917 void CPhoneBubbleWrapper::GetIsConference( TPhoneCommandParam* aCommandParam )
       
  1918     {
       
  1919     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::GetIsConference");
       
  1920 
       
  1921     if( aCommandParam->ParamId() == TPhoneCommandParam::EPhoneParamIdBoolean )
       
  1922         {
       
  1923         TPhoneCmdParamBoolean* booleanValue =
       
  1924             static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  1925         booleanValue->SetBoolean( iConference );
       
  1926         }
       
  1927     }
       
  1928 
       
  1929 // -----------------------------------------------------------------------------
       
  1930 // CPhoneBubbleWrapper::CallExistsInConference
       
  1931 // -----------------------------------------------------------------------------
       
  1932 //
       
  1933 void CPhoneBubbleWrapper::CallExistsInConference(
       
  1934     TInt aCallId,
       
  1935     TPhoneCommandParam* aCommandParam )
       
  1936     {
       
  1937     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::CallExistsInConference");
       
  1938 
       
  1939     if( aCommandParam->ParamId() == TPhoneCommandParam::EPhoneParamIdBoolean )
       
  1940         {
       
  1941         TPhoneCmdParamBoolean*  conferenceDataValue =
       
  1942             static_cast<TPhoneCmdParamBoolean*>(
       
  1943             aCommandParam );
       
  1944         if ( FindParticipantPosition( aCallId ) == KErrNotFound )
       
  1945             {
       
  1946             conferenceDataValue->SetBoolean( EFalse );
       
  1947             }
       
  1948         else
       
  1949             {
       
  1950             conferenceDataValue->SetBoolean( ETrue );
       
  1951             }
       
  1952         }
       
  1953     }
       
  1954 // -----------------------------------------------------------------------------
       
  1955 // CPhoneBubbleWrapper::RemoveAllCalls
       
  1956 // -----------------------------------------------------------------------------
       
  1957 //
       
  1958 void CPhoneBubbleWrapper::RemoveAllCallHeadersL()
       
  1959     {
       
  1960     __LOGMETHODSTARTEND(EPhoneUIView, "RemoveAllCallHeaders::RemoveAllCallHeadersL");
       
  1961     if ( iConference )
       
  1962         {
       
  1963         RemoveConferenceL();
       
  1964         }
       
  1965     TInt callCount = iMapping->ItemCount();
       
  1966 
       
  1967     // Find bubbles to conference
       
  1968     // Delete in reverse order or otherwise mapping gets corrupted in between
       
  1969     for ( TInt index = ( callCount - 1 ); index >= 0; index-- )
       
  1970         {
       
  1971         RemoveCallHeaderL( iMapping->CallIdAt( index ));
       
  1972         }
       
  1973     }
       
  1974 
       
  1975 // -----------------------------------------------------------------------------
       
  1976 // CPhoneBubbleWrapper::AddToConferenceL
       
  1977 // -----------------------------------------------------------------------------
       
  1978 //
       
  1979 void CPhoneBubbleWrapper::AddToConferenceL()
       
  1980     {
       
  1981     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::AddToConference");
       
  1982     if ( iConference && !IsMaxMembersInConf() )
       
  1983         {
       
  1984         TInt callCount = iMapping->ItemCount();
       
  1985         TInt index = callCount-1;
       
  1986         TInt callId;
       
  1987 
       
  1988         while ( index >= 0 )
       
  1989             {
       
  1990             callId = iMapping->CallIdAt( index );
       
  1991             // Check that call not conference
       
  1992             if ( callId != KConferenceCallId &&
       
  1993                  iMapping->FindCallStateByCall( callId ) !=
       
  1994                         CBubbleManager::EWaiting )
       
  1995                 {
       
  1996                 if ( FindParticipantPosition( callId )
       
  1997                     == KErrNotFound )
       
  1998                     {
       
  1999                     AddToConferenceL( callId );
       
  2000                     return;
       
  2001                     }
       
  2002                 }
       
  2003             index--;
       
  2004             }
       
  2005         }
       
  2006     }
       
  2007 
       
  2008 // -----------------------------------------------------------------------------
       
  2009 // CPhoneBubbleWrapper::UpdateCipheringIndicator
       
  2010 // -----------------------------------------------------------------------------
       
  2011 //
       
  2012 void CPhoneBubbleWrapper::UpdateCipheringIndicator(
       
  2013     TInt aCallId, TPhoneCommandParam* aCommandParam )
       
  2014     {
       
  2015     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::SetCiphering");
       
  2016     
       
  2017     TPhoneCmdParamCallHeaderData* callHeaderParam = 
       
  2018         static_cast<TPhoneCmdParamCallHeaderData*>( aCommandParam );
       
  2019         
       
  2020     iCipheringIndicatorAllowed = callHeaderParam->CipheringIndicatorAllowed();
       
  2021     
       
  2022     TInt callCount( iMapping->ItemCount() );
       
  2023     if( callCount > 0 )
       
  2024         {
       
  2025         iBubbleManager->StartChanges();
       
  2026 
       
  2027         for( TInt i = 0; i < callCount; i++ )
       
  2028             {
       
  2029 // Update ciphering to active bubble
       
  2030             CBubbleManager::TBubbleId bubble = iMapping->BubbleAt( i );
       
  2031             if ( aCallId == iMapping->CallIdAt( i ) )
       
  2032                 {
       
  2033                 iBubbleManager->SetCallFlag( 
       
  2034                     bubble, 
       
  2035                     CBubbleManager::ENoCiphering,
       
  2036                     iCipheringIndicatorAllowed && 
       
  2037                     !callHeaderParam->Ciphering() ); 
       
  2038                 }
       
  2039             }
       
  2040             
       
  2041         iBubbleManager->EndChanges();
       
  2042         }
       
  2043     }
       
  2044 
       
  2045 // -----------------------------------------------------------------------------
       
  2046 // CPhoneBubbleWrapper::IsMaxMembersInConf
       
  2047 // -----------------------------------------------------------------------------
       
  2048 //
       
  2049 TBool CPhoneBubbleWrapper::IsMaxMembersInConf() const
       
  2050     {
       
  2051     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::IsMaxMembersInConf");
       
  2052     return ( iParticipants->Count() == KConferenceMaxParticipants );
       
  2053     }
       
  2054 
       
  2055 
       
  2056 // -----------------------------------------------------------------------------
       
  2057 // CPhoneBubbleWrapper::PlayVideoRingTone
       
  2058 // -----------------------------------------------------------------------------
       
  2059 //
       
  2060 void CPhoneBubbleWrapper::PlayVideoRingTone(
       
  2061     const TDesC& aFileName,
       
  2062     TPlayMode aPlayMode,
       
  2063     TInt aVolumeLevel,
       
  2064     TBool aArbitraryScaling,
       
  2065     MPhoneVideoPlayerObserver* aObserver )
       
  2066     {
       
  2067     // store the observer
       
  2068     iVideoPlayerObserver = aObserver;
       
  2069 
       
  2070     // convert the play type
       
  2071     CBubbleManager::TBubbleVideoPlayMode bmPlayMode;
       
  2072     switch ( aPlayMode )
       
  2073         {
       
  2074         case EPlayOnce:
       
  2075             bmPlayMode = CBubbleManager::EPlayOnce;
       
  2076             break;
       
  2077         case EPlayAscending:
       
  2078             bmPlayMode = CBubbleManager::EPlayAscending;
       
  2079             break;
       
  2080         case EPlayInLoop:
       
  2081         default:
       
  2082             bmPlayMode = CBubbleManager::EPlayInLoop;
       
  2083             break;
       
  2084         }
       
  2085 
       
  2086     iBubbleManager->StartChanges();
       
  2087     iBubbleManager->SetVideoRingTone( aFileName,
       
  2088                                      bmPlayMode,
       
  2089                                      aVolumeLevel,
       
  2090                                      aArbitraryScaling,
       
  2091                                      this );
       
  2092     iBubbleManager->EndChanges();
       
  2093     }
       
  2094 
       
  2095 // -----------------------------------------------------------------------------
       
  2096 // CPhoneBubbleWrapper::StopVideoRingTone
       
  2097 // -----------------------------------------------------------------------------
       
  2098 //
       
  2099 void CPhoneBubbleWrapper::StopVideoRingTone()
       
  2100     {
       
  2101     iBubbleManager->StopVideoRingTone();
       
  2102     }
       
  2103 
       
  2104 // -----------------------------------------------------------------------------
       
  2105 // CPhoneBubbleWrapper::MuteVideoRingTone
       
  2106 // -----------------------------------------------------------------------------
       
  2107 //
       
  2108 void CPhoneBubbleWrapper::MuteVideoRingTone()
       
  2109     {
       
  2110     iBubbleManager->MuteVideoRingTone();
       
  2111     }
       
  2112 
       
  2113 // -----------------------------------------------------------------------------
       
  2114 // CPhoneBubbleWrapper::CancelVideoRingTone
       
  2115 // -----------------------------------------------------------------------------
       
  2116 //
       
  2117 void CPhoneBubbleWrapper::CancelVideoRingTone()
       
  2118     {
       
  2119     iBubbleManager->StartChanges();
       
  2120     iBubbleManager->CancelVideoRingTone();
       
  2121     iBubbleManager->EndChanges();
       
  2122     }
       
  2123 
       
  2124 // -----------------------------------------------------------------------------
       
  2125 // CPhoneBubbleWrapper::HandleBubbleVideoPlaybackEvent
       
  2126 // -----------------------------------------------------------------------------
       
  2127 //
       
  2128 void CPhoneBubbleWrapper::HandleBubbleVideoPlaybackEvent(
       
  2129     TBubbleVideoPlaybackEvent aEvent )
       
  2130     {
       
  2131 
       
  2132     if ( iVideoPlayerObserver )
       
  2133         {
       
  2134         switch ( aEvent )
       
  2135             {
       
  2136             case EPlayerInitComplete:
       
  2137                 iVideoPlayerObserver->HandleVideoPlayerInitComplete();
       
  2138                 break;
       
  2139             case EPlayingComplete:
       
  2140                 iVideoPlayerObserver->HandleVideoPlayerPlayingComplete();
       
  2141                 break;
       
  2142             default:
       
  2143                 break;
       
  2144             }
       
  2145         }
       
  2146     }
       
  2147 
       
  2148 // -----------------------------------------------------------------------------
       
  2149 // CPhoneBubbleManager::HandleBubbleVideoPlaybackError
       
  2150 // -----------------------------------------------------------------------------
       
  2151 //
       
  2152 void CPhoneBubbleWrapper::HandleBubbleVideoPlaybackError(
       
  2153     TBubbleVideoPlaybackError aErrorType, TInt aErrorCode )
       
  2154     {
       
  2155 
       
  2156     if ( iVideoPlayerObserver )
       
  2157         {
       
  2158         switch ( aErrorType )
       
  2159             {
       
  2160             case EPlayerInitFailure:
       
  2161                 iVideoPlayerObserver->HandleVideoPlayerError(
       
  2162                     MPhoneVideoPlayerObserver::EVideoPlayerInitializingFailure,
       
  2163                     aErrorCode );
       
  2164                 break;
       
  2165             case EPlaybackFailure:
       
  2166                 iVideoPlayerObserver->HandleVideoPlayerError(
       
  2167                     MPhoneVideoPlayerObserver::EVideoPlayerPlayingFailure,
       
  2168                     aErrorCode );
       
  2169                 break;
       
  2170             default:
       
  2171                 break;
       
  2172             }
       
  2173         }
       
  2174     }
       
  2175 
       
  2176 // -----------------------------------------------------------------------------
       
  2177 // CPhoneBubbleManager::HandleCommandL
       
  2178 // -----------------------------------------------------------------------------
       
  2179 //
       
  2180 void CPhoneBubbleWrapper::HandleCommandL( TInt /*aCommand*/ )
       
  2181     {
       
  2182     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneBubbleWrapper::HandleCommandL");
       
  2183     }
       
  2184 
       
  2185 // -----------------------------------------------------------------------------
       
  2186 // CPhoneBubbleWrapper::ToggleNumberEntryAlphaNumericMode
       
  2187 // -----------------------------------------------------------------------------
       
  2188 //
       
  2189 void CPhoneBubbleWrapper::ToggleNumberEntryAlphaNumericMode(
       
  2190     TPhoneCommandParam* aCommandParam )
       
  2191     {
       
  2192     __LOGMETHODSTARTEND( EPhoneUIView,
       
  2193         "CPhoneBubbleWrapper::ToggleNumberEntryAlphaNumericMode()" );
       
  2194     if( aCommandParam->ParamId() == TPhoneCommandParam::EPhoneParamIdBoolean )
       
  2195         {
       
  2196         TPhoneCmdParamBoolean*  modeAlpha =
       
  2197             static_cast<TPhoneCmdParamBoolean*>(
       
  2198             aCommandParam );
       
  2199 
       
  2200         if ( iIsNumberEntryModeNumeric )
       
  2201 	        {
       
  2202 	        iIsNumberEntryModeNumeric = EFalse;
       
  2203 	        if ( IsNumberEntryNumericMode() )
       
  2204 		        {
       
  2205 		        if ( !iUseDialer )
       
  2206 		            {
       
  2207 		            if ( CountNumberEntryCharacters() == 1 )
       
  2208 	                    {
       
  2209 	                    // Number entry contents is cleared as specified in 
       
  2210 	                    // In-Call Operations, 4.2 Option menu functions.
       
  2211 	                    iBubbleManager->SetTextToNumberEntry( KNullDesC() );
       
  2212 	                    }
       
  2213 		            iBubbleManager->ChangeEditorMode( EFalse );
       
  2214 		            }
       
  2215 		        }
       
  2216 	        }
       
  2217         else
       
  2218 	        {
       
  2219 	        iIsNumberEntryModeNumeric = ETrue;
       
  2220 	        if ( !IsNumberEntryNumericMode() )
       
  2221 		        {
       
  2222 	             if ( !iUseDialer )
       
  2223 	                 {
       
  2224 	                 iBubbleManager->ChangeEditorMode( EFalse );
       
  2225 	                 }
       
  2226 		        }		
       
  2227 	        }
       
  2228         modeAlpha->SetBoolean( !iIsNumberEntryModeNumeric );
       
  2229         }
       
  2230     }
       
  2231         
       
  2232 // -----------------------------------------------------------------------------
       
  2233 // CPhoneBubbleWrapper::OpenVKBL
       
  2234 // -----------------------------------------------------------------------------
       
  2235 //
       
  2236 void CPhoneBubbleWrapper::OpenVkbL()
       
  2237     {
       
  2238     if ( iUseDialer )
       
  2239         {
       
  2240         iDialerNumberEntry->OpenVkbL();
       
  2241         }
       
  2242     }
       
  2243 
       
  2244 // -----------------------------------------------------------------------------
       
  2245 // CPhoneBubbleWrapper::GetNumberEntryCursorPosition
       
  2246 // -----------------------------------------------------------------------------
       
  2247 //
       
  2248 void CPhoneBubbleWrapper::GetNumberEntryCursorPosition(
       
  2249     TPhoneCommandParam* aCommandParam )
       
  2250     {
       
  2251     __LOGMETHODSTARTEND( EPhoneUIView,
       
  2252         "CPhoneBubbleWrapper::GetNumberEntryCursorPosition()" );
       
  2253     if ( aCommandParam->ParamId() ==
       
  2254         TPhoneCommandParam::EPhoneParamIdInteger )
       
  2255         {
       
  2256         TPhoneCmdParamInteger* intParam =
       
  2257             static_cast<TPhoneCmdParamInteger*>( aCommandParam );
       
  2258 
       
  2259         CAknPhoneNumberEditor* control(NULL); 
       
  2260             
       
  2261         if ( iUseDialer )
       
  2262             {
       
  2263             control = static_cast<CAknPhoneNumberEditor*>
       
  2264                 ( iDialerNumberEntry->GetNumberEntry() );
       
  2265             }
       
  2266         else
       
  2267             {
       
  2268             control = static_cast<CAknPhoneNumberEditor*>
       
  2269                 ( iBubbleManager->GetNumberEntry() );
       
  2270             }
       
  2271         intParam->SetInteger( control->CursorPos() );
       
  2272         }
       
  2273     }
       
  2274 
       
  2275 // -----------------------------------------------------------------------------
       
  2276 // CPhoneBubbleWrapper::SetNumberEntryCursorPositionL
       
  2277 // -----------------------------------------------------------------------------
       
  2278 //
       
  2279 void CPhoneBubbleWrapper::SetNumberEntryCursorPositionL(
       
  2280     TPhoneCommandParam* aCommandParam )
       
  2281     {
       
  2282     __LOGMETHODSTARTEND( EPhoneUIView,
       
  2283         "CPhoneBubbleWrapper::SetNumberEntryCursorPositionL() ");
       
  2284     if ( aCommandParam->ParamId() ==
       
  2285         TPhoneCommandParam::EPhoneParamIdInteger )
       
  2286         {
       
  2287         TPhoneCmdParamInteger* intParam =
       
  2288             static_cast<TPhoneCmdParamInteger*>( aCommandParam );
       
  2289         CAknPhoneNumberEditor* control(NULL);
       
  2290             
       
  2291         if ( iUseDialer )
       
  2292             {    
       
  2293             control = static_cast<CAknPhoneNumberEditor*>
       
  2294                 ( iDialerNumberEntry->GetNumberEntry() );
       
  2295             }
       
  2296         else
       
  2297             {
       
  2298             control = static_cast<CAknPhoneNumberEditor*>
       
  2299                 ( iBubbleManager->GetNumberEntry() );
       
  2300             }
       
  2301         control->SetCursorPosL( intParam->Integer(), EFalse );
       
  2302         }
       
  2303     }
       
  2304 
       
  2305 // -----------------------------------------------------------------------------
       
  2306 // CPhoneBubbleWrapper::IsNumberEntryNumericMode
       
  2307 // -----------------------------------------------------------------------------
       
  2308 //
       
  2309 TBool CPhoneBubbleWrapper::IsNumberEntryNumericMode() const
       
  2310     {
       
  2311     __LOGMETHODSTARTEND( EPhoneUIView, "CPhoneBubbleWrapper::IsNumberEntryNumericMode()" );
       
  2312     if ( iUseDialer )
       
  2313         { 
       
  2314         return iDialerNumberEntry->GetEditorMode() == EAknEditorNumericInputMode;
       
  2315         }
       
  2316     else
       
  2317         {
       
  2318         return iBubbleManager->GetEditorMode() == EAknEditorNumericInputMode;
       
  2319         }
       
  2320     }
       
  2321 
       
  2322 // -----------------------------------------------------------------------------
       
  2323 // CPhoneBubbleWrapper::IsNENumericMode()
       
  2324 // -----------------------------------------------------------------------------
       
  2325 //
       
  2326 TBool CPhoneBubbleWrapper::IsNENumericMode() const
       
  2327     {
       
  2328     __LOGMETHODSTARTEND( EPhoneUIView, "CPhoneBubbleWrapper::IsNENumericMode()" );
       
  2329     
       
  2330     if ( iUseDialer )
       
  2331         {
       
  2332         return EAknEditorNumericInputMode == 
       
  2333             iDialerNumberEntry->GetEditorMode();
       
  2334         }
       
  2335     else
       
  2336         {
       
  2337         return iIsNumberEntryModeNumeric;    
       
  2338         }
       
  2339     }
       
  2340 
       
  2341 // -----------------------------------------------------------------------------
       
  2342 // CPhoneBubbleWrapper::StartChanges
       
  2343 // -----------------------------------------------------------------------------
       
  2344 //
       
  2345 void CPhoneBubbleWrapper::StartChanges()
       
  2346     {
       
  2347     iBubbleManager->StartChanges();
       
  2348     }
       
  2349 
       
  2350 // -----------------------------------------------------------------------------
       
  2351 // CPhoneBubbleWrapper::EndChanges
       
  2352 // -----------------------------------------------------------------------------
       
  2353 //
       
  2354 void CPhoneBubbleWrapper::EndChanges()
       
  2355     {
       
  2356     iBubbleManager->EndChanges();
       
  2357     }
       
  2358 
       
  2359 // -----------------------------------------------------------------------------
       
  2360 // CPhoneBubbleManager::SetTouchPaneVisible
       
  2361 // -----------------------------------------------------------------------------
       
  2362 //
       
  2363 void CPhoneBubbleWrapper::SetTouchPaneVisible( TBool aVisible )
       
  2364     {
       
  2365     iBubbleManager->StartChanges();
       
  2366     iBubbleManager->SetTouchPaneVisible( aVisible );
       
  2367     iBubbleManager->EndChanges();
       
  2368     }
       
  2369 
       
  2370 // -----------------------------------------------------------------------------
       
  2371 // CPhoneBubbleWrapper::TouchPane
       
  2372 // -----------------------------------------------------------------------------
       
  2373 //
       
  2374 MBubbleTouchPaneInterface& CPhoneBubbleWrapper::TouchPane() const
       
  2375     {
       
  2376     return *iBubbleManager->TouchPane();
       
  2377     }
       
  2378 
       
  2379 // -----------------------------------------------------------------------------
       
  2380 // CPhoneBubbleWrapper::BubbleManager
       
  2381 // -----------------------------------------------------------------------------
       
  2382 //
       
  2383 CBubbleManager& CPhoneBubbleWrapper::BubbleManager()
       
  2384     {
       
  2385     return *iBubbleManager;
       
  2386     }
       
  2387 
       
  2388 // -----------------------------------------------------------------------------
       
  2389 // CPhoneBubbleWrapper::BubbleManager
       
  2390 // -----------------------------------------------------------------------------
       
  2391 //
       
  2392 CCoeControl* CPhoneBubbleWrapper::Control()
       
  2393     {
       
  2394     return iBubbleManager;
       
  2395     }
       
  2396 
       
  2397 // -----------------------------------------------------------------------------
       
  2398 // CPhoneBubbleWrapper::IsConferenceInExpandedMode
       
  2399 // -----------------------------------------------------------------------------
       
  2400 //
       
  2401 TBool CPhoneBubbleWrapper::IsConferenceInExpandedMode() const
       
  2402     {
       
  2403     return iFlags & EFlagConferenceReqExpanded;
       
  2404     }
       
  2405 
       
  2406 // -----------------------------------------------------------------------------
       
  2407 // CPhoneBubbleWrapper::LoadPlugins
       
  2408 // Loads the bubble extension plugins.
       
  2409 // -----------------------------------------------------------------------------
       
  2410 //
       
  2411 void CPhoneBubbleWrapper::LoadPlugins()
       
  2412     {
       
  2413     TRAP_IGNORE( iBubbleExtensionManager->InitializeL() );
       
  2414     }
       
  2415 
       
  2416 // -----------------------------------------------------------------------------
       
  2417 // CPhoneBubbleWrapper::SetPhoneCustomization
       
  2418 // -----------------------------------------------------------------------------
       
  2419 //
       
  2420 void CPhoneBubbleWrapper::SetPhoneCustomization( 
       
  2421         MPhoneCustomization* aCustomization )
       
  2422     {
       
  2423     iPhoneCustomization = aCustomization;
       
  2424     }
       
  2425 
       
  2426 // -----------------------------------------------------------------------------
       
  2427 // CPhoneBubbleWrapper::SetNumberEntry
       
  2428 // -----------------------------------------------------------------------------
       
  2429 //
       
  2430 void CPhoneBubbleWrapper::SetNumberEntry( MNumberEntry* aNumberEntry )
       
  2431     {
       
  2432     iDialerNumberEntry = aNumberEntry;
       
  2433     iPhoneNumberEntry->SetNumberEntry( aNumberEntry );
       
  2434     }
       
  2435 
       
  2436 // -----------------------------------------------------------------------------
       
  2437 // CPhoneBubbleWrapper::CallThemeSettingsChanged
       
  2438 // -----------------------------------------------------------------------------
       
  2439 //
       
  2440 void CPhoneBubbleWrapper::CallThemeSettingsChanged()
       
  2441     {
       
  2442     iBubbleManager->PreloadCallThemeImage(
       
  2443             iCallTheme->CallImageThemeSettings() == 2 );
       
  2444     }
       
  2445 
       
  2446 // -----------------------------------------------------------------------------
       
  2447 // CPhoneBubbleWrapper::KeypadAudioEnabled
       
  2448 // -----------------------------------------------------------------------------
       
  2449 //
       
  2450 void CPhoneBubbleWrapper::KeypadAudioEnabled()
       
  2451     {
       
  2452     // Tactile sound feedback must be disabled when keypad volume is 1...5
       
  2453     // otherwise DTMF tone and tactile tone is played simultaneously.
       
  2454     iPhoneNumberEntry->EnableTactileFeedback( EFalse );
       
  2455     }
       
  2456 
       
  2457 // -----------------------------------------------------------------------------
       
  2458 // CPhoneBubbleWrapper::KeypadAudioDisabled
       
  2459 // -----------------------------------------------------------------------------
       
  2460 //
       
  2461 void CPhoneBubbleWrapper::KeypadAudioDisabled()
       
  2462     {
       
  2463     // Tactile sound feedback can be enabled when keypad volume is 0
       
  2464     iPhoneNumberEntry->EnableTactileFeedback( ETrue );
       
  2465     }
       
  2466 
       
  2467 
       
  2468 // -----------------------------------------------------------------------------
       
  2469 // CPhoneBubbleWrapper::IsSimplifiedConferenceCallHeaderEnabledL
       
  2470 // -----------------------------------------------------------------------------
       
  2471 //
       
  2472 TBool CPhoneBubbleWrapper::IsSimplifiedConferenceCallHeaderEnabledL( 
       
  2473         TUint32 aServiceId ) const
       
  2474     {
       
  2475     __LOGMETHODSTARTEND( EPhoneUIView, 
       
  2476         "CPhoneBubbleWrapper::IsSimplifiedConferenceCallHeaderEnabledL" );
       
  2477     
       
  2478     TBool isSimplifiedBubble = EFalse;
       
  2479     
       
  2480     CSPSettings* settings = CSPSettings::NewLC();
       
  2481     CSPProperty* property = CSPProperty::NewLC();
       
  2482     
       
  2483     TInt serviceMask = 0;
       
  2484     TInt result = settings->FindPropertyL( 
       
  2485         aServiceId, EPropertyServiceAttributeMask, *property );
       
  2486     if ( KErrNone == result ) 
       
  2487         {
       
  2488         result = property->GetValue( serviceMask );
       
  2489         if ( KErrNone == result ) 
       
  2490             {
       
  2491             isSimplifiedBubble =
       
  2492                 ( serviceMask & static_cast<TInt>( ESimplifiedConferenceCallBubble ) );
       
  2493             }
       
  2494         }
       
  2495     
       
  2496     CleanupStack::PopAndDestroy( property );
       
  2497     CleanupStack::PopAndDestroy( settings );
       
  2498     
       
  2499     return isSimplifiedBubble; 
       
  2500     }
       
  2501 
       
  2502 
       
  2503 // -----------------------------------------------------------------------------
       
  2504 // CPhoneBubbleWrapper::SetSimplifiedConferenceCallHeaderStatus
       
  2505 // -----------------------------------------------------------------------------
       
  2506 //
       
  2507 void CPhoneBubbleWrapper::SetSimplifiedConferenceCallHeaderStatus( 
       
  2508         TBool aOnOff )
       
  2509     {
       
  2510     __LOGMETHODSTARTEND( EPhoneUIView, 
       
  2511         "CPhoneBubbleWrapper::SetSimplifiedConferenceCallHeaderStatus" );
       
  2512     
       
  2513     TInt flags = iFlags;
       
  2514     flags &= ~EFlagSimplifiedConferenceCallHeader;
       
  2515     
       
  2516     if ( aOnOff )
       
  2517         {
       
  2518         flags |= EFlagSimplifiedConferenceCallHeader;
       
  2519         }
       
  2520     
       
  2521     HandleFlagsUpdated( flags );
       
  2522     }
       
  2523 
       
  2524 //  End of File