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