phoneapp/phoneuiview/src/cphoneviewcontroller.cpp
changeset 0 5f000ab63145
child 1 838b0a10d15b
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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:  The control class of phone ui view in PhoneUI
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cphoneviewcontroller.h"
       
    21 
       
    22 #include "phoneui.pan"
       
    23 #include "cphonetoolbarcontroller.h"
       
    24 #include "cphonebuttonscontroller.h"
       
    25 #include "cphonedialercontroller.h"
       
    26 #include "cphonemenucontroller.h"
       
    27 #include "cphonenotecontroller.h"
       
    28 #include "cphonequerycontroller.h"
       
    29 #include "cphonekeycapturecontroller.h"
       
    30 #include "cphoneview.h"
       
    31 #include "cphonedialerview.h"
       
    32 #include "tphonecommandparam.h"
       
    33 #include "cphonebubblewrapper.h"
       
    34 #include "tphonecmdparamcallstatedata.h"
       
    35 #include "tphonecmdparaminteger.h"
       
    36 #include "tphonecmdparamboolean.h"
       
    37 #include "tphonecmdparamstring.h"
       
    38 #include "tphonecmdparamappinfo.h"
       
    39 #include "tphonecmdparammessageeditor.h"
       
    40 #include "tphonecmdparamcallheaderdata.h"
       
    41 #include "tphonecmdparamsingleitemfetch.h"
       
    42 #include "tphonecmdparamaudiooutput.h"
       
    43 #include "tphonecmdparamaudioavailability.h"
       
    44 #include "tphonecmdparamquery.h"
       
    45 #include "tphonecmdparamsfidata.h"
       
    46 #include "tphonecmdparamtranseffect.h"
       
    47 #include "phoneconstants.h"
       
    48 #include "cphonestatuspane.h"
       
    49 #include "cphonepubsubproxy.h"
       
    50 #include "cphoneincallindicator.h"
       
    51 #include "phonelogger.h"
       
    52 #include "cphonetimer.h"
       
    53 #include "cphonecenrepproxy.h"
       
    54 #include "cphonerecoverysystem.h"
       
    55 #include "cphonecontactcontroller.h"
       
    56 #include "cphoneapplicationexit.h"
       
    57 #include "cphoneaudiocontroller.h"
       
    58 #include "cphoneringingtoneplayerao.h"
       
    59 #include "cphonevmbxhandler.h"
       
    60 #include "cphonemainresourceresolver.h"
       
    61 #include "phonerssbase.h"
       
    62 #include "telprivatecrkeys.h"
       
    63 #include "cphonesingleitemfetch.h"
       
    64 #include "mnumberentry.h"
       
    65 #include "cdialer.h"
       
    66 #include "dialer.hrh"
       
    67 #include "cphonemediatorfactory.h"
       
    68 #include "cphonemediatorsender.h"
       
    69 #include "mphoneviewcustomization.h"
       
    70 #include "tphonecmdparamcustomdialer.h"
       
    71 #include "tphonecmdparampointer.h"
       
    72 #include "dialer.hrh"
       
    73 #include "phoneui.hrh"
       
    74 #include <apgtask.h>
       
    75 #include <apgwgnam.h>
       
    76 #include <apacmdln.h>
       
    77 #include <coedef.h>  // TKeyResponse
       
    78 #include <eikenv.h>
       
    79 #include <eikappui.h>
       
    80 #include <eikapp.h>
       
    81 #include <eikmenub.h>
       
    82 #include <eikspane.h>
       
    83 #include <aknkeylock.h>
       
    84 #include <SpdiaControl.h>
       
    85 #include <hlplch.h>
       
    86 #include <aknnavide.h>
       
    87 #include <aknnavilabel.h>
       
    88 #include <AknNotifierController.h>
       
    89 #include <CMessageData.h> // CMessageData
       
    90 #include <sendui.h> // CSendUi
       
    91 #include <SenduiMtmUids.h> // KSenduiMtmIrUid
       
    92 #include <cphonecntsaveaddtoname.h>
       
    93 #include <PbkDataSaveAppUi.hrh>
       
    94 #include <PhCltUtils.h>
       
    95 #include <telephonyvariant.hrh>
       
    96 #include <ConeResLoader.h>
       
    97 #include <bldvariant.hrh>
       
    98 #include <data_caging_path_literals.hrh>
       
    99 #include <AknDlgShut.h> // Avkon dialog shutter.
       
   100 #include <cphcntrfshandler.h>
       
   101 #include <bautils.h>
       
   102 #include <CPbkContactEngine.h>
       
   103 #include <CPbkContactItem.h>
       
   104 #include <CPbkFieldInfo.h>
       
   105 #include <PbkFields.hrh>
       
   106 #include <cphcntcontactid.h>
       
   107 #include <AknUtils.h>
       
   108 #include <AknSgcc.h>
       
   109 #include <SettingsInternalCRKeys.h>
       
   110 #include <UikonInternalPSKeys.h>
       
   111 #include <startupdomainpskeys.h>
       
   112 #include <utf.h>
       
   113 #include <activeidle2domainpskeys.h>
       
   114 #include <telinternalpskeys.h>
       
   115 #include <featmgr.h>
       
   116 #include <layoutmetadata.cdl.h>
       
   117 #include <akntoolbar.h>
       
   118 #include <LogsUiCmdStarter.h>
       
   119 #include <AknIndicatorContainer.h>
       
   120 
       
   121 #include <SoftReject.rsg>
       
   122 #include <ConeResLoader.h>
       
   123 #include <StringLoader.h>
       
   124 #include <txtrich.h>
       
   125 
       
   126 #include <vmnumber.h>
       
   127 #include <coreapplicationuisdomainpskeys.h>
       
   128 #include <gfxtranseffect/gfxtranseffect.h>
       
   129 #include <akntranseffect.h>
       
   130 
       
   131 #include <GSLauncher.h> // Call Settings launch.
       
   132 
       
   133 // Kastor effect IDs, aknskincontent/101f84b9.sel
       
   134 const TInt KTouchDialerOpenEffect  = 1505;
       
   135 const TInt KTouchDialerCloseEffect = 1506;
       
   136 
       
   137 // ================= MEMBER FUNCTIONS =======================
       
   138 
       
   139 // ---------------------------------------------------------------------------
       
   140 // CPhoneViewController::CPhoneViewController
       
   141 // C++ default constructor can NOT contain any code, that
       
   142 // might leave.
       
   143 // ---------------------------------------------------------------------------
       
   144 //
       
   145 CPhoneViewController::CPhoneViewController() :
       
   146     iEikEnv( *CEikonEnv::Static() ),
       
   147     iNeedToSendToBackground( EFalse ),
       
   148     iHelpCommand( KINCAL_HLP_CALL_HANDLING ),
       
   149     iBlockingDialogIsDisplayed( EFalse ),
       
   150     iIdleUid( KErrNotFound ),
       
   151     iFetchContent( KNullDesC ),
       
   152     iEffectOngoing( EFalse ),
       
   153     iSendBack( ETrue ),
       
   154     iDialerActive( EFalse ),
       
   155     iPriotityChanged( EFalse )
       
   156     {
       
   157     }
       
   158 
       
   159 // ---------------------------------------------------------------------------
       
   160 // CPhoneViewController::ConstructL
       
   161 // Symbian 2nd phase constructor can leave.
       
   162 // ---------------------------------------------------------------------------
       
   163 //
       
   164 void CPhoneViewController::ConstructL( TRect aRect )
       
   165     {
       
   166     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneViewController::ConstructL()");
       
   167     // Create the status pane singleton
       
   168     iStatusPane = CPhoneStatusPane::Instance();
       
   169     // Reserve the title pane
       
   170     iStatusPane->AddTitlePaneHandlerL( *this );
       
   171     iStatusPane->ReserveTitlePane( *this );
       
   172 
       
   173     iAppui = (CAknAppUi*)iEikEnv.EikAppUi();
       
   174     iCba = iEikEnv.AppUiFactory()->Cba();
       
   175 
       
   176 	iPhoneView = CPhoneView::NewL( aRect, *iCba );
       
   177 
       
   178     iBubbleWrapper = CPhoneBubbleWrapper::NewL( iPhoneView, aRect  );
       
   179 
       
   180     iPhoneView->SetControl( iBubbleWrapper->Control() );
       
   181     iPhoneView->ActivateL(); // We're ready to activate view after the bubble is initialized
       
   182 
       
   183     iIncallIndicator = CPhoneIncallIndicator::NewL();
       
   184     iMenuController = CPhoneMenuController::NewL( iEikEnv );
       
   185     iNoteController = CPhoneNoteController::NewL( iEikEnv );
       
   186     iQueryController = CPhoneQueryController::NewL( iEikEnv );
       
   187     iAudioController = CPhoneAudioController::NewL();
       
   188 
       
   189     iRingingTonePlayerAO = CPhoneRingingTonePlayerAO::NewL();
       
   190     // Set display provider for ringing tone player.
       
   191     // Display access is needed for visual ringing tones.
       
   192     iRingingTonePlayerAO->SetVideoPlayer( iBubbleWrapper );
       
   193 
       
   194     // Contact
       
   195     CPhoneContactController* contactManager =
       
   196         CPhoneContactController::NewL();
       
   197     iContactController = contactManager;
       
   198 
       
   199     iContactControllerId =
       
   200         CPhoneRecoverySystem::Instance()->AddL(
       
   201             TCallBack( DoConstructContactControllerL, this ),
       
   202             CTeleRecoverySystem::EPhonePriorityHigh,
       
   203             CTeleRecoverySystem::EPhoneStateStarting );
       
   204 
       
   205     iKeyCaptureController = CPhoneKeyCaptureController::NewL( iEikEnv );
       
   206 
       
   207     iApplicationExit = CPhoneApplicationExit::NewL(
       
   208         this,
       
   209         iEikEnv.WsSession(),
       
   210         iEikEnv.WsSession().FindWindowGroupIdentifier( 0, KPhoneEikonServer ) );
       
   211 
       
   212     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
       
   213         {
       
   214         iButtonsController = CPhoneButtonsController::NewL( iBubbleWrapper->TouchPane() );
       
   215         }
       
   216 
       
   217     if ( FeatureManager::FeatureSupported( KFeatureIdOnScreenDialer ) )
       
   218         {
       
   219         // Create dialer view
       
   220         iDialerView = CPhoneDialerView::NewL( aRect );
       
   221         iDialerView->DrawableWindow()->SetOrdinalPosition( -1 );
       
   222         iDialerView->MakeVisible( EFalse );
       
   223         // Create dialer
       
   224         iDialer = CDialer::NewL( *iDialerView, aRect );
       
   225         // Set NE for bubbleWrapper
       
   226         iBubbleWrapper->SetNumberEntry( iDialer->NumberEntry() );
       
   227         CCoeEnv* coeEnv = static_cast<CCoeControl*>(iDialer)->ControlEnv();
       
   228         iDialerController = CPhoneDialerController::NewL( *iBubbleWrapper,
       
   229                                                             *coeEnv,
       
   230                                                             *iMenuController );
       
   231         
       
   232         iToolbarController = CPhoneToolbarController::NewL( *coeEnv  );
       
   233                                                            
       
   234       
       
   235 		iDialerView->SetControl( iDialer );
       
   236 		iDialerView->ActivateL();
       
   237 		iDialerActive = EFalse;
       
   238         }
       
   239 
       
   240     User::LeaveIfError( iKeyLock.Connect() );
       
   241 
       
   242     // if you are using sgc-client's session to capserver,
       
   243     //you are not allowed to close the session.
       
   244     iAknUiServerClient = CAknSgcClient::AknSrv();
       
   245     }
       
   246 
       
   247 // -----------------------------------------------------------------------------
       
   248 // CPhoneViewController::NewL
       
   249 // Two-phased constructor.
       
   250 // -----------------------------------------------------------------------------
       
   251 //
       
   252 EXPORT_C CPhoneViewController* CPhoneViewController::NewL( TRect aRect )
       
   253     {
       
   254     __PHONELOG( EBasic, EPhoneUIView,
       
   255             "CPhoneViewController::NewL()" );
       
   256     CPhoneViewController* self = new (ELeave) CPhoneViewController;
       
   257 
       
   258     CleanupStack::PushL( self );
       
   259     self->ConstructL( aRect );
       
   260     CleanupStack::Pop( self );
       
   261 
       
   262     return self;
       
   263     }
       
   264 
       
   265 // Destructor
       
   266 CPhoneViewController::~CPhoneViewController()
       
   267     {
       
   268     __LOGMETHODSTARTEND( EPhoneUIView,
       
   269                         "CPhoneViewController::~CPhoneViewController()" );
       
   270     delete iButtonsController;
       
   271     delete iDialerController;
       
   272     delete iToolbarController;
       
   273     iKeyLock.Close();
       
   274     delete iApplicationExit;
       
   275     delete iSpeedDialController;
       
   276     if ( iVmbxHandler )
       
   277         {
       
   278         delete iVmbxHandler;
       
   279         iVmbxHandler = NULL;
       
   280         }
       
   281     delete iKeyCaptureController;
       
   282     CPhoneRecoverySystem::Remove( iContactControllerId );
       
   283     delete iContactController;
       
   284     delete iRingingTonePlayerAO;
       
   285     delete iAudioController;
       
   286     delete iQueryController;
       
   287     delete iNoteController;
       
   288     delete iMenuController;
       
   289     delete iIncallIndicator;
       
   290     delete iBubbleWrapper;
       
   291     delete iPhoneView;
       
   292     delete iIndiContainer;
       
   293     if ( iDialerView )
       
   294         {
       
   295         if(iAppui) //for codescanner
       
   296             {
       
   297             iAppui->RemoveFromStack( iDialerView );
       
   298             }
       
   299         delete iDialerView;
       
   300         }
       
   301     delete iDialer;
       
   302     if ( iSingleItemFetch )
       
   303         {
       
   304         delete iSingleItemFetch;
       
   305         iSingleItemFetch = NULL;
       
   306         }
       
   307     delete iRfsHandler;
       
   308     RemoveAddToContactDialog();
       
   309 
       
   310 //    delete iStatusPane; <-- CCoeStatic are destroyed outside application
       
   311 
       
   312     iApaLsSession.Close();
       
   313 
       
   314     }
       
   315 
       
   316 // ---------------------------------------------------------
       
   317 // CPhoneViewController::PhoneView
       
   318 // ---------------------------------------------------------
       
   319 //
       
   320 EXPORT_C CPhoneView* CPhoneViewController::PhoneView()
       
   321     {
       
   322     return iPhoneView;
       
   323     }
       
   324 
       
   325 // ---------------------------------------------------------
       
   326 // CPhoneViewController::ExecuteCommandL( aCmdId )
       
   327 // ---------------------------------------------------------
       
   328 //
       
   329 EXPORT_C void CPhoneViewController::ExecuteCommandL(
       
   330     TPhoneViewCommandId aCmdId )
       
   331     {
       
   332     __PHONELOGVIEWMSG( aCmdId, 0 );
       
   333 
       
   334     switch ( aCmdId )
       
   335         {
       
   336         case EPhoneViewLaunchApplication:
       
   337             LaunchApplicationL();
       
   338             break;
       
   339 
       
   340         case EPhoneViewMenuBarClose:
       
   341              iMenuController->CloseMenuBar();
       
   342             break;
       
   343 
       
   344         case EPhoneViewRemoveNumberEntry:
       
   345             if ( iDialer && iDialerActive )
       
   346                 {
       
   347                 SetControltoCallHandlingL();
       
   348                 iBubbleWrapper->RemoveNumberEntry();
       
   349                 iPhoneView->SetActivatePreviousApp( EFalse );
       
   350                 
       
   351                 TPhoneCmdParamCallStateData callStateData;
       
   352                 callStateData.SetCallState( EPEStateConnected );
       
   353                 iBubbleWrapper->GetCallIdByState( &callStateData );
       
   354                 TInt connected = callStateData.CallId();
       
   355                     
       
   356                 // If video call
       
   357                 if( connected == KVideoTelephonyCallId1 ||
       
   358                         connected == KVideoTelephonyCallId2 )
       
   359                     {
       
   360                     TPhoneCmdParamInteger uidParam;
       
   361                     // Bring video telephone app in the foreground
       
   362                     uidParam.SetInteger( KVtUiAppUidValue.iUid );
       
   363                     BringAppToForeground( &uidParam );
       
   364                     }
       
   365                 }
       
   366             else
       
   367                 {
       
   368                 iBubbleWrapper->RemoveNumberEntry();
       
   369                 }
       
   370             break;
       
   371 
       
   372         case EPhoneViewRemoveNote:
       
   373             iNoteController->DestroyNote();
       
   374             break;
       
   375 
       
   376         case EPhoneViewRemoveDtmfNote:
       
   377             iNoteController->DestroyDTMFNote();
       
   378             break;
       
   379 
       
   380         case EPhoneViewRemoveGlobalNote:
       
   381             iNoteController->DestroyGlobalNoteL();
       
   382             break;
       
   383 
       
   384         case EPhoneViewRemoveQuery:
       
   385             iQueryController->DestroyQuery();
       
   386             iQueryController->DestroyGlobalQuery();
       
   387             break;
       
   388 
       
   389         case EPhoneViewRemoveGlobalWaitNote:
       
   390             iQueryController->DestroyGlobalWaitNote();
       
   391             break;
       
   392         case EPhoneViewRemoveProgressNote:
       
   393             iNoteController->DestroyProgressNote();
       
   394             break;
       
   395 
       
   396         case EPhoneViewSendToBackground:
       
   397             SendToBackgroundL();
       
   398             break;
       
   399 
       
   400         case EPhoneViewExitApplications:
       
   401             iApplicationExit->ExitApplication();
       
   402             break;
       
   403 
       
   404         case EPhoneViewHideNaviPaneAudioVolume:
       
   405             iAudioController->DeactivateVolumeControl();
       
   406             break;
       
   407 
       
   408         case EPhoneViewShowNaviPaneAudioVolume:
       
   409             iAudioController->ActivateVolumeControlL();
       
   410             break;
       
   411 
       
   412         case EPhoneViewRemovePhoneDialogs:
       
   413             RemovePhoneDialogsL();
       
   414             break;
       
   415             
       
   416         case EPhoneViewRemoveAllCallHeaders:
       
   417             iBubbleWrapper->RemoveAllCallHeadersL();
       
   418             break;
       
   419 
       
   420         case EPhoneViewMuteRingToneOnAnswer:
       
   421             iRingingTonePlayerAO->MuteRingingToneOnAnswer();
       
   422             break;
       
   423 
       
   424         case EPhoneViewStopRingTone:
       
   425             iRingingTonePlayerAO->StopPlaying();
       
   426             break;
       
   427             
       
   428         case EPhoneViewMuteRingTone:
       
   429             iRingingTonePlayerAO->MuteRingingTone();
       
   430             break;
       
   431 
       
   432         case EPhoneViewAddToConference:
       
   433             iBubbleWrapper->AddToConferenceL();
       
   434             break;
       
   435 
       
   436         case EPhoneViewCreateNumberEntry:
       
   437             // Keep menu controller in synch with number entry mode
       
   438             iMenuController->SetAlphaModeFlag( EFalse );
       
   439             iBubbleWrapper->CreateNumberEntry();
       
   440             if ( iDialer && !iDialerActive )
       
   441                 {
       
   442                 SetControltoDialerL();
       
   443                 }
       
   444             break;
       
   445 
       
   446         case EPhoneViewUpdateMaxConfMemberFlag:
       
   447             iMenuController->SetMaxConfMembersFlag(
       
   448                 iBubbleWrapper->IsMaxMembersInConf() );
       
   449             if ( iButtonsController )
       
   450                 {
       
   451                 TPhoneCmdParamBoolean joinParam;
       
   452                 joinParam.SetBoolean( iBubbleWrapper->IsMaxMembersInConf() );
       
   453                 iButtonsController->SetInCallJoinEnabled( &joinParam );
       
   454                 }
       
   455             break;
       
   456 
       
   457         case EPhoneViewLaunchRfsDeep:
       
   458             LaunchRfsL( ETrue );
       
   459             break;
       
   460 
       
   461         case EPhoneViewLaunchRfsNormal:
       
   462             LaunchRfsL( EFalse );
       
   463             break;
       
   464 
       
   465         case EPhoneViewUpdateView:
       
   466             iPhoneView->DrawDeferred();
       
   467             break;
       
   468 
       
   469         case EPhoneViewUpdateContact:
       
   470             OpenAddToContactL( EPbkCmdDataSaveAddToExisting );
       
   471             break;
       
   472 
       
   473         case EPhoneViewAddContact:
       
   474             OpenAddToContactL( EPbkCmdDataSaveCreateNew );
       
   475             break;
       
   476 
       
   477         case EPhoneViewSendMessage:
       
   478             SendMessageL();
       
   479             break;
       
   480 
       
   481         case EPhoneViewEnableKeyLock:
       
   482             iKeyLock.EnableKeyLock();
       
   483             break;
       
   484 
       
   485         case EPhoneViewEnableKeyLockWithoutNote:
       
   486             iKeyLock.EnableWithoutNote();
       
   487             break;
       
   488             
       
   489         case EPhoneViewDisableKeyLockWithoutNote:
       
   490             iKeyLock.DisableWithoutNote();
       
   491             break;
       
   492 
       
   493         case EPhoneViewUpdateFSW:
       
   494             SetHiddenL( !iBubbleWrapper->IsNumberEntryUsed() );
       
   495             UpdateFSW();
       
   496             break;
       
   497 
       
   498         case EPhoneViewUpdatePhoneIconToFSW:
       
   499             SetHiddenL( EFalse );
       
   500             UpdateFSW();
       
   501             break;
       
   502 
       
   503         case EPhoneViewCloseFSW:
       
   504             iEikEnv.DismissTaskList();
       
   505             break;
       
   506 
       
   507         case EPhoneViewBringIdleToForeground:
       
   508             {
       
   509             // bringe idle application to fore.
       
   510             TPhoneCmdParamInteger uidParam;
       
   511             uidParam.SetInteger( IdleAppUid() );
       
   512             BringAppToForeground( &uidParam );
       
   513             if ( iSingleItemFetch )
       
   514                 {
       
   515                 // Cancel the Single Item Fetch
       
   516                 iSingleItemFetch->Delete();
       
   517                 }
       
   518             }
       
   519             break;
       
   520 
       
   521         case EPhoneViewSetIdleTopApplication:
       
   522             {
       
   523             TPhoneCmdParamInteger uidParam;
       
   524             uidParam.SetInteger( IdleAppUid() );
       
   525             SetTopApplicationL( &uidParam );
       
   526             }
       
   527             break;
       
   528 
       
   529         case EPhoneViewRemoveConferenceBubble:
       
   530             {
       
   531             iBubbleWrapper->RemoveConferenceL();
       
   532             }
       
   533             break;
       
   534 
       
   535         case EPhoneViewClearNumberEntryContent:
       
   536             {
       
   537             iBubbleWrapper->SetNumberEntryContent( KNullDesC );
       
   538             }
       
   539             break;
       
   540 
       
   541         case EPhoneViewUpdateToolbar:
       
   542             {
       
   543             if ( iDialer )
       
   544                 {
       
   545                 iDialerController->UpdateToolbar();
       
   546                 }
       
   547             }
       
   548             break;
       
   549 
       
   550         case EPhoneViewSetControlAndVisibility:
       
   551             if ( iDialer )
       
   552                 {
       
   553                 SetDialerControlAndVisibilityL();
       
   554                 }
       
   555             else
       
   556                 {
       
   557                 // If iDialer is false then set numberentry
       
   558                 // visible.
       
   559                 TPhoneCmdParamBoolean booleanParam;
       
   560                 booleanParam.SetBoolean( ETrue );
       
   561                 iBubbleWrapper->SetNumberEntryVisible( &booleanParam );
       
   562                 }
       
   563             break;
       
   564 
       
   565         case EPhoneViewActivatePreviousApp:
       
   566             {
       
   567             TApaTaskList appList( iEikEnv.WsSession() );
       
   568             TApaTask bring = appList.FindApp( KUidPhoneApplication );
       
   569             // If CheckSendBackRoundEventNeed returns false then the
       
   570             // active/foreground application is phone&singleitemfetch and
       
   571             // there is no need to make SendToBackRound event or update
       
   572             // window group position.
       
   573             if ( bring.Exists() )
       
   574                 {
       
   575                 CAknSgcClient::MoveApp( bring.WgId(),
       
   576                                         ESgcMoveAppToBackground );
       
   577                 // Position needs to be updated to ensure that exit works
       
   578                 // from previous view.
       
   579                 SetWindowGroupPosition();
       
   580                 }
       
   581             }
       
   582             break;
       
   583 
       
   584         case EPhoneViewKeypadAudioEnabled:
       
   585             {
       
   586             iBubbleWrapper->KeypadAudioEnabled();
       
   587             }
       
   588             break;
       
   589 
       
   590         case EPhoneViewKeypadAudioDisabled:
       
   591             {
       
   592             iBubbleWrapper->KeypadAudioDisabled();
       
   593             }
       
   594             break;
       
   595 
       
   596         case EPhoneViewCancelAllNotications:
       
   597             {
       
   598             CancelAllNotications();
       
   599             }
       
   600             break;
       
   601         case EPhoneViewOpenVirtualKeyBoard:
       
   602             {
       
   603             iBubbleWrapper->OpenVkbL();
       
   604             }
       
   605             break;
       
   606         case EPhoneViewCreatePhoneBookServices:
       
   607             {
       
   608             // Open and create phonebook services(phonebook stores etc).
       
   609             iContactController->CreatePhoneBookServiceL();
       
   610             break;
       
   611             }
       
   612         case EPhoneViewHideToolbar:
       
   613             {
       
   614             iToolbarController->HideToolbar();
       
   615             }
       
   616             break;  
       
   617 
       
   618         case EPhoneViewDisableKeyLock:
       
   619             {
       
   620             DisableKeyLock();
       
   621             }
       
   622             break;
       
   623 
       
   624         default:
       
   625             __PHONELOG( EBasic, EPhonePhoneapp,
       
   626                 "CPhoneViewController::ExecuteCommandL -> UnKnownMessage !");
       
   627             break;
       
   628         }
       
   629     CPhoneMediatorFactory::Instance()->Sender()->SendEvent( aCmdId );
       
   630     }
       
   631 
       
   632 // ---------------------------------------------------------------------------
       
   633 // CPhoneViewController::ExecuteCommandL( aCmdId, aCallId )
       
   634 // ---------------------------------------------------------------------------
       
   635 //
       
   636 EXPORT_C void CPhoneViewController::ExecuteCommandL(
       
   637     TPhoneViewCommandId aCmdId,
       
   638     TInt aCallId )
       
   639     {
       
   640     __PHONELOGVIEWMSG( aCmdId, aCallId );
       
   641     __ASSERT_DEBUG( aCallId > KErrNotFound,
       
   642                     Panic( EPhoneViewParameterNotInitialized ) );
       
   643 
       
   644     switch ( aCmdId )
       
   645         {
       
   646         case EPhoneViewRemoveCallHeader:
       
   647             iBubbleWrapper->RemoveCallHeaderL( aCallId );
       
   648             break;
       
   649 
       
   650         case EPhoneViewRemoveFromConference:
       
   651             iBubbleWrapper->RemoveFromConferenceL( aCallId );
       
   652             break;
       
   653 
       
   654         case EPhoneViewPrivateFromConference:
       
   655             iBubbleWrapper->ConferenceMemberToPrivateL( aCallId );
       
   656             break;
       
   657 
       
   658         default:
       
   659             __PHONELOG( EBasic, EPhonePhoneapp,
       
   660              "CPhoneViewController::ExecuteCommandL -> UnKnownMessage !!! ");
       
   661             break;
       
   662         }
       
   663     CPhoneMediatorFactory::Instance()->Sender()->SendEvent( aCmdId, aCallId );
       
   664     }
       
   665 
       
   666 // ---------------------------------------------------------------------------
       
   667 // CPhoneViewController::ExecuteCommandL( aCmdId, aCommandParam )
       
   668 // ---------------------------------------------------------------------------
       
   669 //
       
   670 EXPORT_C void CPhoneViewController::ExecuteCommandL(
       
   671     TPhoneViewCommandId aCmdId,
       
   672     TPhoneCommandParam* aCommandParam )
       
   673     {
       
   674     __PHONELOGVIEWMSG( aCmdId, 0 );
       
   675 
       
   676     switch ( aCmdId )
       
   677         {
       
   678         case EPhoneViewSetSendKeyDialerActivationFlag:
       
   679             {
       
   680             TPhoneCmdParamBoolean* booleanParam =
       
   681                 static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
   682             iPhoneView->SetDialerActivation( booleanParam->Boolean() );
       
   683             }
       
   684             break;
       
   685 
       
   686         case EPhoneViewAllowWaitingCallHeader:
       
   687             AllowWaitingCallHeaderL( aCommandParam );
       
   688             break;
       
   689 
       
   690         case EPhoneViewCreateNumberEntry:
       
   691             iBubbleWrapper->CreateNumberEntry();
       
   692             if ( iDialer && !iDialerActive )
       
   693                 {
       
   694                 SetControltoDialerL();
       
   695                 }
       
   696             // Pass the key event to number entry
       
   697             iBubbleWrapper->HandleKeyEventL( aCommandParam );
       
   698             break;
       
   699 
       
   700         case EPhoneViewUpdateContextMenu:
       
   701             {     
       
   702             iMenuController->SetContextMenu( aCommandParam );     
       
   703             } break; 
       
   704 
       
   705         case EPhoneViewGetLocalizedNumberFromEntry:
       
   706             iBubbleWrapper->GetLocalizedNumberEntryContent( aCommandParam );
       
   707             break;
       
   708 
       
   709         case EPhoneViewSetNumberEntryVisible:
       
   710             if ( iDialer )
       
   711                 {
       
   712                 TPhoneCmdParamBoolean* booleanParam =
       
   713                     static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
   714 
       
   715                 if ( booleanParam->Boolean() )
       
   716                     {
       
   717                     SetControltoDialerL();
       
   718                     }
       
   719                 else
       
   720                     {
       
   721                     // Set activate previous to false since dialer was set to
       
   722                     // hidden status.
       
   723                     iPhoneView->SetActivatePreviousApp( EFalse );
       
   724                     SetControltoCallHandlingL();
       
   725                     }
       
   726                 }
       
   727             else
       
   728                 {
       
   729                 iBubbleWrapper->SetNumberEntryVisible( aCommandParam );
       
   730                 }
       
   731             break;
       
   732 
       
   733         case EPhoneViewGetNumberEntryCount:
       
   734             iBubbleWrapper->GetNumberEntryCount( aCommandParam );
       
   735             break;
       
   736 
       
   737         case EPhoneViewMenuBarOpen:
       
   738             iMenuController->SetNEVisibleFlag(
       
   739                 iBubbleWrapper->IsNumberEntryVisible() );
       
   740             iMenuController->OpenMenuBarL( aCommandParam );
       
   741             break;
       
   742 
       
   743         case EPhoneViewUpdateCba:
       
   744             SetCbaL( aCommandParam );
       
   745             break;
       
   746 
       
   747         case EPhoneViewMenuPane:
       
   748             iMenuController->SetReplaceFlag( IsReplaceAllowed() );
       
   749             iMenuController->DynInitMenuPaneL( aCommandParam );
       
   750             break;
       
   751 
       
   752         case EPhoneViewMenuBar:
       
   753             iMenuController->DynInitMenuBar( aCommandParam );
       
   754             break;
       
   755 
       
   756         case EPhoneViewShowNote:
       
   757             iNoteController->CreateNoteL( aCommandParam );
       
   758             break;
       
   759 
       
   760         case EPhoneViewShowGlobalNote:
       
   761             iNoteController->CreateGlobalNoteL( aCommandParam );
       
   762             break;
       
   763 
       
   764         case EPhoneViewShowQuery:
       
   765             iQueryController->CreateQueryL( aCommandParam );
       
   766             break;
       
   767 
       
   768         case EPhoneViewSetListQueryString:
       
   769             iQueryController->SetListQueryStringL( aCommandParam );
       
   770             break;
       
   771 
       
   772         case EPhoneViewUpdateNoteSoftkeys:
       
   773             iNoteController->UpdateNoteSoftkeysL( aCommandParam );
       
   774             break;
       
   775 
       
   776         case EPhoneViewShowProgressNote:
       
   777             iNoteController->CreateProgressNoteL( aCommandParam );
       
   778             break;
       
   779 
       
   780         case EPhoneViewActivateAudioPathUIChanges:
       
   781             UpdateAudioPathOptions( aCommandParam );
       
   782             break;
       
   783 
       
   784         case EPhoneViewActivateAudioAvailabilityUIChanges:
       
   785             UpdateAudioAvailabilityOptions( aCommandParam );
       
   786             break;
       
   787 
       
   788         case EPhoneViewActivateMuteUIChanges:
       
   789             iMenuController->SetMuteFlag( aCommandParam );
       
   790             iBubbleWrapper->SetPhoneMuted( aCommandParam );
       
   791             iIncallIndicator->HandleMuteChange( aCommandParam );
       
   792             iAudioController->HandleMuteChange( aCommandParam );
       
   793             iToolbarController->SetMuteFlag( aCommandParam );
       
   794             if ( iButtonsController )
       
   795                 {
       
   796                 iButtonsController->SetMuteFlag( aCommandParam );
       
   797                 }
       
   798             break;
       
   799 
       
   800         case EPhoneViewBringAppToForeground:
       
   801             {
       
   802             TPhoneCmdParamInteger* integerParam =
       
   803                    static_cast<TPhoneCmdParamInteger*>( aCommandParam );
       
   804             // If uid is phone app then call phone app specific foreground
       
   805             // method.
       
   806             if ( KUidPhoneApplication.iUid == integerParam->Integer() )
       
   807                 {
       
   808                 BringPhoneAppToForeground( aCommandParam );
       
   809                 }
       
   810             else
       
   811                 {
       
   812                 BringAppToForeground( aCommandParam );
       
   813                 }
       
   814             }
       
   815             break;
       
   816 
       
   817         case EPhoneViewSetNeedToSendToBackgroundStatus:
       
   818             SetNeedToSendToBackground( aCommandParam );
       
   819             break;
       
   820 
       
   821        case EPhoneViewSetBlockingDialogStatus:
       
   822             {
       
   823             TPhoneCmdParamBoolean* booleanParam =
       
   824                 static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
   825             SetBlockingDialogIsDisplayed( booleanParam->Boolean() );
       
   826             }
       
   827             break;
       
   828 
       
   829        case EPhoneViewGetBlockingDialogStatus:
       
   830             GetBlockingDialogIsDisplayed( aCommandParam );
       
   831             break;
       
   832 
       
   833         case EPhoneViewGetForegroundApplication:
       
   834             GetForegroundApplication( aCommandParam );
       
   835             break;
       
   836 
       
   837         case EPhoneViewSetTopApplication:
       
   838             SetTopApplicationL( aCommandParam );
       
   839             break;
       
   840 
       
   841         case EPhoneViewActivateApp:
       
   842             ActivateAppL( aCommandParam );
       
   843             break;
       
   844 
       
   845         case EPhoneViewActivateAppView:
       
   846             ActivateAppViewL( aCommandParam );
       
   847             break;
       
   848 
       
   849         case EPhoneViewActivateAppViewWithCustomMessage:
       
   850             ActivateAppViewWithCustomMessageL( aCommandParam );
       
   851             break;
       
   852 
       
   853         case EPhoneViewActivateAppViewConventional:
       
   854             ActivateAppViewConventionalL( aCommandParam );
       
   855             break;
       
   856 
       
   857         case EPhoneViewUpdateIncallIndicator:
       
   858             iMenuController->CloseMenuBar();
       
   859             iIncallIndicator->Update( aCommandParam );
       
   860             iMenuController->SetCallInProgressFlag( aCommandParam );
       
   861             break;
       
   862 
       
   863         case EPhoneViewStartCapturingKey:
       
   864             iKeyCaptureController->StartCapturingKey( aCommandParam );
       
   865             break;
       
   866 
       
   867         case EPhoneViewStopCapturingKey:
       
   868             iKeyCaptureController->StopCapturingKey( aCommandParam );
       
   869             break;
       
   870 
       
   871         case EPhoneViewSetPointerCapture:
       
   872             CapturePointerEvents( aCommandParam );
       
   873             break;
       
   874         case EPhoneViewSetGlobalNotifiersDisabled:
       
   875             SetGlobalNotifiersDisabledL( aCommandParam );
       
   876             break;
       
   877         case EPhoneViewSetEikonNotifiersDisabled:
       
   878             SetEikonNotifiersDisabled( aCommandParam );
       
   879             break;
       
   880 
       
   881         case EPhoneViewGetHoldFlag:
       
   882             iMenuController->GetHoldFlag( aCommandParam );
       
   883             break;
       
   884 
       
   885         case EPhoneViewSetHoldFlag:
       
   886             iMenuController->SetHoldFlag( aCommandParam );
       
   887             if ( iButtonsController )
       
   888                 {
       
   889                 iButtonsController->SetHoldFlag( aCommandParam );
       
   890                 }
       
   891             break;
       
   892 
       
   893         case EPhoneViewSetVideoCallFlag:
       
   894             if ( iButtonsController )
       
   895                 {
       
   896                 iButtonsController->SetVideoCallFlag( aCommandParam );
       
   897                 }
       
   898             break;
       
   899 
       
   900         case EPhoneViewGetConferenceAndSingleFlag:
       
   901             iMenuController->GetConferenceAndSingleFlag( aCommandParam );
       
   902             break;
       
   903 
       
   904         case EPhoneViewSetConferenceAndSingleFlag:
       
   905             iMenuController->SetConferenceAndSingleFlag( aCommandParam );
       
   906             break;
       
   907 
       
   908         case EPhoneViewGetSoftRejectFlag:
       
   909             iMenuController->GetSoftRejectFlag( aCommandParam );
       
   910             break;
       
   911 
       
   912         case EPhoneViewSetSoftRejectFlag:
       
   913             iMenuController->SetSoftRejectFlag( aCommandParam );
       
   914             break;
       
   915 
       
   916         case EPhoneViewSetServiceCodeFlag:
       
   917             iMenuController->SetServiceCodeFlag( aCommandParam );
       
   918 
       
   919             if ( iDialer )
       
   920                 {
       
   921                 iDialerController->SetServiceCodeFlagL( aCommandParam );
       
   922                 }
       
   923             break;
       
   924 
       
   925         case EPhoneViewGetTextQueryContent:
       
   926             iQueryController->GetTextQueryContentL( aCommandParam );
       
   927             break;
       
   928 
       
   929         case EPhoneViewOpenSoftRejectEditor:
       
   930             OpenSoftRejectMessageEditorL( aCommandParam );
       
   931             break;
       
   932 
       
   933         case EPhoneViewOpenMessageEditor:
       
   934             OpenMessageEditorL( aCommandParam );
       
   935             break;
       
   936 
       
   937         case EPhoneViewOpenConferenceList:
       
   938             iBubbleWrapper->OpenConferenceList( aCommandParam );
       
   939             iMenuController->SetConferenceParticipantsListVisibleFlag(
       
   940                                                               aCommandParam );
       
   941             break;
       
   942 
       
   943         case EPhoneViewGetConferenceListVisibleFlag:
       
   944             iMenuController->GetConferenceParticipantsListVisibleFlag(
       
   945                                                               aCommandParam );
       
   946             break;
       
   947 
       
   948         case EPhoneViewMoveHighLightInList:
       
   949             iBubbleWrapper->MoveHighlightInConference( aCommandParam );
       
   950             break;
       
   951 
       
   952         case EPhoneViewGetCountOfActiveCalls:
       
   953             iBubbleWrapper->GetActiveCallsCount( aCommandParam );
       
   954             break;
       
   955 
       
   956         case EPhoneViewSetNaviPaneAudioVolume:
       
   957             iAudioController->HandleVolumeChangeL( aCommandParam );
       
   958             break;
       
   959 
       
   960         case EPhoneViewSetTitlePanePicture:
       
   961             iStatusPane->SetTitlePanePictureL( aCommandParam );
       
   962             break;
       
   963 
       
   964        case EPhoneViewSetSecurityMode:
       
   965             SetSecurityMode( aCommandParam );
       
   966             break;
       
   967 
       
   968        case EPhoneViewGetSecurityModeStatus:
       
   969             GetSecurityModeStatus( aCommandParam );
       
   970             break;
       
   971 
       
   972        case EPhoneViewSetStatusPaneVisible:
       
   973             SetStatusPaneVisible( aCommandParam );
       
   974             break;
       
   975 
       
   976         case EPhoneViewSetBackgroundImageBitmap:
       
   977             iPhoneView->SetBitmap( aCommandParam );
       
   978             break;
       
   979 
       
   980         case EPhoneViewGetBackgroundImageBitmap:
       
   981             iPhoneView->GetBitmap( aCommandParam );
       
   982             break;
       
   983 
       
   984         case EPhoneViewGetIsConference:
       
   985             iBubbleWrapper->GetIsConference( aCommandParam );
       
   986             break;
       
   987 
       
   988         case EPhoneViewPlayRingTone:
       
   989             iRingingTonePlayerAO->PlayRingToneL( aCommandParam );
       
   990             break;
       
   991 
       
   992         case EPhoneViewGetIsNoteVisible:
       
   993             iNoteController->IsNoteVisible( aCommandParam );
       
   994             break;
       
   995 
       
   996         case EPhoneViewIsNoteActive:
       
   997             iNoteController->IsNoteActive( aCommandParam );
       
   998             break;
       
   999 
       
  1000         case EPhoneViewIsActiveNoteDissmissableByKeyEvent:
       
  1001             iNoteController->IsActiveNoteDissmissableByKeyEvent( aCommandParam );
       
  1002             break;
       
  1003 
       
  1004         case EPhoneViewGetIsProgressNoteVisible:
       
  1005             iNoteController->IsProgressNoteVisible( aCommandParam );
       
  1006             break;
       
  1007 
       
  1008         case EPhoneViewSetPhoneNumberAvailableInPhoneEngine:
       
  1009             iMenuController->SetPhoneNumberAvailableInPhoneEngine(
       
  1010             aCommandParam );
       
  1011             break;
       
  1012 
       
  1013         case EPhoneViewSendAiwCommand:
       
  1014             iMenuController->SendAiwCommandL( aCommandParam );
       
  1015             break;
       
  1016 
       
  1017         case EPhoneViewIsQuery:
       
  1018             iQueryController->IsQueryActive( aCommandParam );
       
  1019             break;
       
  1020 
       
  1021         case EPhoneViewToggleNumberEntryAlphaNumericMode:
       
  1022             {
       
  1023             iBubbleWrapper->ToggleNumberEntryAlphaNumericMode( aCommandParam );
       
  1024             TPhoneCmdParamBoolean*  modeAlpha =
       
  1025                 static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  1026             iMenuController->SetAlphaModeFlag( modeAlpha->Boolean() );
       
  1027             }
       
  1028             break;
       
  1029 
       
  1030         case EPhoneViewSetConfrenceOptionsFlag:
       
  1031             {
       
  1032             TPhoneCmdParamBoolean* param =
       
  1033                             static_cast<TPhoneCmdParamBoolean*>(aCommandParam);
       
  1034             iMenuController->SetRemoveConfrenceOptionsFlag( param->Boolean() );
       
  1035             }
       
  1036             break;
       
  1037 
       
  1038         case EPhoneViewGetSoftRejectWindowGroupId:
       
  1039             GetSoftRejectWindowGroupId( aCommandParam );
       
  1040             break;
       
  1041 
       
  1042         case EPhoneViewSetTouchPaneButtons:
       
  1043             iButtonsController->SetButtonSet( aCommandParam );
       
  1044             break;
       
  1045 
       
  1046         case EPhoneViewSetTouchPaneVisible:
       
  1047             {
       
  1048             TPhoneCmdParamBoolean* booleanParam =
       
  1049                 static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  1050             iBubbleWrapper->SetTouchPaneVisible( booleanParam->Boolean() );
       
  1051             }
       
  1052             break;
       
  1053 
       
  1054         case EPhoneViewSetDtmfDialerViewVisible:
       
  1055             {
       
  1056             if ( iDialer )
       
  1057                 {
       
  1058                 TPhoneCmdParamBoolean* booleanParam =
       
  1059                     static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  1060                 iDialerController->SetDtmfDialerVisibleL(
       
  1061                                                 booleanParam->Boolean() );
       
  1062                  }
       
  1063             break;
       
  1064             }
       
  1065 
       
  1066         case EPhoneViewSetRetrictedDialer:
       
  1067             {
       
  1068             if ( iDialer )
       
  1069                 {
       
  1070                 TPhoneCmdParamBoolean* booleanParam =
       
  1071                     static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  1072                 iDialerController->SetRestrictedDialer(
       
  1073                                                 booleanParam->Boolean() );
       
  1074                 }
       
  1075             break;
       
  1076             }
       
  1077         case EPhoneViewSetDtmfOptionsFlag:
       
  1078             {
       
  1079             TPhoneCmdParamBoolean*  booleanParam =
       
  1080                 static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  1081             iMenuController->SetAllowDtmfOptionsFlag(
       
  1082                                                 booleanParam->Boolean() );
       
  1083             break;
       
  1084             }
       
  1085 
       
  1086         case EPhoneViewSetVideoCallDTMFVisibilityFlag:
       
  1087             {
       
  1088             TPhoneCmdParamBoolean*  booleanParam =
       
  1089                 static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  1090             iMenuController->SetHideVideoCallDTMFVisibilityFlag(
       
  1091                                                     booleanParam->Boolean() );
       
  1092             break;
       
  1093             }
       
  1094 
       
  1095         case EPhoneViewShowVTSetupFailedCreateCallToSameContactQuery:
       
  1096             iQueryController->CreateQueryL( aCommandParam );
       
  1097             break;
       
  1098 
       
  1099         case EPhoneViewGetActivatePreviousApp:
       
  1100             {
       
  1101             TPhoneCmdParamBoolean*  booleanParam =
       
  1102                 static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  1103             booleanParam->SetBoolean( iPhoneView->GetActivatePreviousApp() );
       
  1104             }
       
  1105             break;
       
  1106 
       
  1107         case EPhoneViewShowCustomizedDialer:
       
  1108             {
       
  1109             TPhoneCmdParamCustomDialer* customDialerParam =
       
  1110                 static_cast<TPhoneCmdParamCustomDialer*>( aCommandParam );
       
  1111             iDialerController->ShowCustomizedDialerL(
       
  1112                                       customDialerParam->DialerController() );
       
  1113             }
       
  1114             break;
       
  1115         case EPhoneViewGetNumberFromEntry:
       
  1116             {
       
  1117             iBubbleWrapper->GetNumberEntryContent( aCommandParam );
       
  1118             break;
       
  1119             }
       
  1120         case EPhoneViewUpdateContactByString:
       
  1121             {
       
  1122             TPhoneCmdParamString* paramString =
       
  1123                     static_cast<TPhoneCmdParamString*>( aCommandParam );
       
  1124 
       
  1125             OpenAddToContactL( EPbkCmdDataSaveAddToExisting,
       
  1126                                *paramString->String() );
       
  1127             }
       
  1128             break;
       
  1129 
       
  1130         case EPhoneViewAddContactByString:
       
  1131             {
       
  1132             TPhoneCmdParamString* paramString =
       
  1133                     static_cast<TPhoneCmdParamString*>( aCommandParam );
       
  1134 
       
  1135             OpenAddToContactL( EPbkCmdDataSaveCreateNew,
       
  1136                                *paramString->String() );
       
  1137             }
       
  1138             break;
       
  1139         case EPhoneViewSetNoConnectedCalls:
       
  1140             {
       
  1141             iQueryController->SetNoConnectedCalls( aCommandParam );
       
  1142             }
       
  1143             break;
       
  1144         case EPhoneViewSetToolbarDimming:
       
  1145             {
       
  1146             TPhoneCmdParamBoolean*  booleanParam =
       
  1147                 static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  1148             iToolbarController->DimToolbar( booleanParam->Boolean());
       
  1149             break;
       
  1150             }
       
  1151 
       
  1152         default:
       
  1153             __PHONELOG( EBasic, EPhonePhoneapp,
       
  1154              "CPhoneViewController::ExecuteCommandL -> UnKnownMessage !!! " );
       
  1155             break;
       
  1156         }
       
  1157 
       
  1158     CPhoneMediatorFactory::Instance()->Sender()->SendEvent( aCmdId,
       
  1159                                                             *aCommandParam );
       
  1160     }
       
  1161 
       
  1162 // ---------------------------------------------------------------------------
       
  1163 // CPhoneViewController::ExecuteCommandL( aCmdId, aCallId, aCommandParam )
       
  1164 // ---------------------------------------------------------------------------
       
  1165 //
       
  1166 EXPORT_C void CPhoneViewController::ExecuteCommandL(
       
  1167     TPhoneViewCommandId aCmdId,
       
  1168     TInt aCallId,
       
  1169     TPhoneCommandParam* aCommandParam )
       
  1170     {
       
  1171     __PHONELOGVIEWMSG( aCmdId, aCallId );
       
  1172 
       
  1173     switch ( aCmdId )
       
  1174         {
       
  1175         case EPhoneViewUpdateBubble:
       
  1176             HandleUpdateBubbleL( aCallId, aCommandParam );
       
  1177             break;
       
  1178 
       
  1179         case EPhoneViewCreateCallHeader:
       
  1180             iBubbleWrapper->CreateCallHeaderL( aCallId, aCommandParam );
       
  1181             break;
       
  1182 
       
  1183         case EPhoneViewUpdateCallHeaderRemoteInfoData:
       
  1184             iBubbleWrapper->UpdateCallHeaderDisplay( aCallId, aCommandParam );
       
  1185             break;
       
  1186 
       
  1187         case EPhoneViewUpdateCallHeaderRemoteInfoDataAndLabel:
       
  1188             iBubbleWrapper->UpdateCallHeaderAndLabel( aCallId, aCommandParam );
       
  1189             break;
       
  1190 
       
  1191         case EPhoneViewCreateEmergencyCallHeader:
       
  1192             iBubbleWrapper->CreateEmergencyCallHeaderL( aCallId,
       
  1193                                                         aCommandParam );
       
  1194             break;
       
  1195 
       
  1196         case EPhoneViewCreateConference:
       
  1197             iBubbleWrapper->CreateConferenceL( aCallId, aCommandParam );
       
  1198             break;
       
  1199 
       
  1200         case EPhoneViewGetCallExistsInConference:
       
  1201             iBubbleWrapper->CallExistsInConference( aCallId, aCommandParam );
       
  1202             break;
       
  1203 
       
  1204         case EPhoneViewCipheringInfoChange:
       
  1205             {
       
  1206             iBubbleWrapper->UpdateCipheringIndicator( aCallId, aCommandParam );
       
  1207             }
       
  1208             break;
       
  1209 
       
  1210         default:
       
  1211             __PHONELOG( EBasic, EPhonePhoneapp,
       
  1212              "CPhoneViewController::ExecuteCommandL -> UnKnownMessage !!! " );
       
  1213             break;
       
  1214         }
       
  1215     CPhoneMediatorFactory::Instance()->Sender()->SendEvent( aCmdId, aCallId,
       
  1216                                                             *aCommandParam );
       
  1217     }
       
  1218 
       
  1219 // ---------------------------------------------------------------------------
       
  1220 // CPhoneViewController::ExecuteCommandL( aCmdId, aCallId, aMessage )
       
  1221 // ---------------------------------------------------------------------------
       
  1222 //
       
  1223 EXPORT_C void CPhoneViewController::ExecuteCommandL(
       
  1224     TPhoneViewCommandId aCmdId,
       
  1225     TInt aCallId,
       
  1226     TDesC& aMessage )
       
  1227     {
       
  1228     __PHONELOGVIEWMSG( aCmdId, aCallId );
       
  1229 
       
  1230     switch( aCmdId )
       
  1231         {
       
  1232         case EPhoneViewSetNumberEntryContent:
       
  1233             iBubbleWrapper->SetNumberEntryContent( aMessage );
       
  1234             break;
       
  1235 
       
  1236         case EPhoneViewSetTitlePaneContent:
       
  1237             iStatusPane->SetTitlePaneContentL( aMessage );
       
  1238             break;
       
  1239 
       
  1240         case EPhoneViewSetNaviPaneContent:
       
  1241             {
       
  1242             if ( !iDialer )
       
  1243                 {
       
  1244                 CAknNaviLabel* naviLabel = static_cast<CAknNaviLabel*>(
       
  1245                     iStatusPane->NaviDecorator().DecoratedControl() );
       
  1246                 naviLabel->SetTextL( aMessage );
       
  1247                 iStatusPane->NaviDecorator().DrawDeferred();
       
  1248                 }
       
  1249 
       
  1250             }
       
  1251             break;
       
  1252 
       
  1253         case EPhoneViewLaunchHelpApplication:
       
  1254             LaunchHelpApplicationL( aMessage );
       
  1255             break;
       
  1256 
       
  1257         case EPhoneViewUpdateCallHeaderCallDuration:
       
  1258             iBubbleWrapper->UpdateCallDuration( aCallId, aMessage );
       
  1259             break;
       
  1260 
       
  1261         default:
       
  1262             __PHONELOG (EBasic, EPhonePhoneapp, " CPhoneViewController::ExecuteCommandL -> UnHandledMessage !!! ");
       
  1263             break;
       
  1264         }
       
  1265     CPhoneMediatorFactory::Instance()->Sender()->SendEvent( aCmdId, aCallId, &aMessage );
       
  1266     }
       
  1267 
       
  1268 // ---------------------------------------------------------------------------
       
  1269 // CPhoneViewController::ExecuteCommand( aCmdId )
       
  1270 // ---------------------------------------------------------------------------
       
  1271 //
       
  1272 EXPORT_C void CPhoneViewController::ExecuteCommand(
       
  1273     TPhoneViewCommandId aCmdId )
       
  1274     {
       
  1275     switch( aCmdId )
       
  1276         {
       
  1277         case EPhoneResetTouchButtons:
       
  1278             if ( iButtonsController )
       
  1279                 {
       
  1280                 iButtonsController->SetToggleButtons();
       
  1281                 }
       
  1282             break;
       
  1283 
       
  1284         case EPhoneViewBeginUpdate:
       
  1285             {
       
  1286             iBubbleWrapper->StartChanges();
       
  1287             }
       
  1288             break;
       
  1289 
       
  1290         case EPhoneViewEndUpdate:
       
  1291             {
       
  1292             iBubbleWrapper->EndChanges();
       
  1293             }
       
  1294             break;
       
  1295         case EPhoneViewCloseSingleItemFetchDialog:
       
  1296             {
       
  1297             if ( iSingleItemFetch )
       
  1298                 {
       
  1299                 // Cancel the Single Item Fetch
       
  1300                 iSingleItemFetch->Delete();
       
  1301                 iSingleItemFetch = NULL;
       
  1302                 }
       
  1303             }
       
  1304           break;
       
  1305 
       
  1306         case EPhoneViewPrepareIcons:
       
  1307           iBubbleWrapper->BubbleManager().PrepareIcons();
       
  1308           break;
       
  1309 
       
  1310         case EPhoneViewLoadPlugins:
       
  1311           iBubbleWrapper->LoadPlugins();
       
  1312           break;
       
  1313 
       
  1314         case EPhoneViewCipheringInfoChangePlayTone:
       
  1315             {
       
  1316             iRingingTonePlayerAO->PlayUnsecureVoIPTone();
       
  1317             }
       
  1318             break;
       
  1319 
       
  1320         default:
       
  1321             __PHONELOG (EBasic, EPhonePhoneapp, " CPhoneViewController::ExecuteCommand -> UnHandledMessage !!! ");
       
  1322             break;
       
  1323         }
       
  1324     CPhoneMediatorFactory::Instance()->Sender()->SendEvent( aCmdId );
       
  1325     }
       
  1326 
       
  1327 // ---------------------------------------------------------------------------
       
  1328 // CPhoneViewController::ExecuteCommand( aCmdId, aCommandParam )
       
  1329 // ---------------------------------------------------------------------------
       
  1330 //
       
  1331 EXPORT_C void CPhoneViewController::ExecuteCommand(
       
  1332     TPhoneViewCommandId aCmdId,
       
  1333     TPhoneCommandParam* aCommandParam )
       
  1334     {
       
  1335     __PHONELOGVIEWMSG( aCmdId, 0 );
       
  1336 
       
  1337     switch ( aCmdId )
       
  1338         {
       
  1339         case EPhoneViewGetIsConferenceInSelectionMode:
       
  1340             static_cast<TPhoneCmdParamBoolean*>( aCommandParam )->SetBoolean(
       
  1341                 iBubbleWrapper->BubbleManager().SelectionIdInConference() !=
       
  1342                 KBubbleInvalidId );
       
  1343             break;
       
  1344 
       
  1345         case EPhoneViewEnableTouchButton:
       
  1346             if ( iButtonsController )
       
  1347                 {
       
  1348                 iButtonsController->SetButtonEnabled( aCommandParam );
       
  1349                 }
       
  1350             break;
       
  1351 
       
  1352         case EPhoneViewDisableTouchButton:
       
  1353             if ( iButtonsController )
       
  1354                 {
       
  1355                 iButtonsController->SetButtonDisabled( aCommandParam );
       
  1356                 }
       
  1357             break;
       
  1358 
       
  1359         case EPhoneViewGetAudioVolumeLevel:
       
  1360             {
       
  1361             TInt level = iAudioController->VolumeLevelFromControl();
       
  1362             static_cast<TPhoneCmdParamInteger*>( aCommandParam )->SetInteger(
       
  1363                 level );
       
  1364             }
       
  1365            break;
       
  1366 
       
  1367         case EPhoneViewBeginTransEffect:
       
  1368             {
       
  1369             if ( iDialer )
       
  1370                 {
       
  1371                 TPhoneTransEffectType type =
       
  1372                     static_cast<TPhoneCmdParamTransEffect*>( aCommandParam )->Type();
       
  1373                 TBool isForeground = iAppui->IsForeground();
       
  1374 
       
  1375                 if ( isForeground && // newer run effect if not at front
       
  1376                      ( ( type == EPhoneTransEffectDialerCreate && !iDialerActive ) ||
       
  1377                        ( type == EPhoneTransEffectDialerOpen && !iDialerActive &&
       
  1378                          iBubbleWrapper->IsNumberEntryUsed() ) ||
       
  1379                        ( type == EPhoneTransEffectDialerClose && iDialerActive ) ) )
       
  1380                     {
       
  1381                     HandleTransitionEffect( type );
       
  1382                     }
       
  1383                 }
       
  1384             break;
       
  1385             }
       
  1386 
       
  1387         case EPhoneViewEndTransEffect:
       
  1388             {
       
  1389             if ( iDialer )
       
  1390                 {
       
  1391                 HandleTransitionEffect(
       
  1392                     static_cast<TPhoneCmdParamTransEffect*>( aCommandParam )->Type() );
       
  1393                 }
       
  1394             break;
       
  1395             }
       
  1396         case EPhoneViewGetNumberFromEntry:
       
  1397             {
       
  1398             iBubbleWrapper->GetNumberEntryContent( aCommandParam );
       
  1399             break;
       
  1400             }
       
  1401 
       
  1402         case EPhoneViewGetKeyLockStatus:
       
  1403             {
       
  1404             TPhoneCmdParamBoolean*  booleanParam = static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  1405             booleanParam->SetBoolean( iKeyLock.IsKeyLockEnabled() );
       
  1406             }
       
  1407             break;
       
  1408 
       
  1409         case EPhoneViewSetNumberEntryObserver:
       
  1410             {
       
  1411             NumberEntryChangedHandler()->SetNumberEntryChangedCallBack(
       
  1412                                                 aCommandParam );
       
  1413             break;
       
  1414             }
       
  1415         case EPhoneViewGetSingleItemFetchType:
       
  1416             static_cast<TPhoneCmdParamInteger*>( aCommandParam )->SetInteger( SingleItemFetchType() );
       
  1417             break;
       
  1418 
       
  1419         case EPhoneViewSetPhoneCustomization:
       
  1420             {
       
  1421             TPhoneCmdParamPointer* pointerParam =
       
  1422                 static_cast<TPhoneCmdParamPointer*>( aCommandParam );
       
  1423             MPhoneCustomization* phoneCustomization =
       
  1424                 static_cast<MPhoneCustomization*>( pointerParam->Pointer() );
       
  1425             iBubbleWrapper->SetPhoneCustomization( phoneCustomization );
       
  1426             }
       
  1427             break;
       
  1428      case EPhoneViewSetViewCustomization:
       
  1429             {
       
  1430             TPhoneCmdParamPointer* pointerParam =
       
  1431                 static_cast<TPhoneCmdParamPointer*>( aCommandParam );
       
  1432             iCustomization =
       
  1433                 static_cast<MPhoneViewCustomization*>( pointerParam->Pointer() );
       
  1434             }
       
  1435             break;
       
  1436         case EPhoneViewSetButtonCustomization:
       
  1437             {
       
  1438             if ( iButtonsController )
       
  1439                 {
       
  1440                 TPhoneCmdParamPointer* pointerParam =
       
  1441                     static_cast<TPhoneCmdParamPointer*>( aCommandParam );
       
  1442                 MPhoneButtonCustomization* customization =
       
  1443                     static_cast<MPhoneButtonCustomization*>( pointerParam->Pointer() );
       
  1444                 iButtonsController->SetCustomization( customization );
       
  1445                 }
       
  1446             }
       
  1447             break;
       
  1448 			
       
  1449         case EPhoneViewEnableToolbarButton:
       
  1450             TPhoneCmdParamInteger*  integerParam =
       
  1451                 static_cast<TPhoneCmdParamInteger*>( aCommandParam );
       
  1452             iToolbarController->SetToolbarButtonDimmed( integerParam->Integer(), EFalse );
       
  1453             break;
       
  1454 
       
  1455         default:
       
  1456             __PHONELOG( EBasic, EPhonePhoneapp, "CPhoneViewController::ExecuteCommand -> UnHandledMessage !!! " );
       
  1457             break;
       
  1458         }
       
  1459     CPhoneMediatorFactory::Instance()->Sender()->SendEvent( aCmdId, *aCommandParam );
       
  1460     }
       
  1461 
       
  1462 // ---------------------------------------------------------------------------
       
  1463 // CPhoneViewController::HandleCommandL( aCmdId )
       
  1464 // ---------------------------------------------------------------------------
       
  1465 //
       
  1466 EXPORT_C TPhoneViewResponseId CPhoneViewController::HandleCommandL(
       
  1467     TPhoneViewCommandId aCmdId )
       
  1468     {
       
  1469     __PHONELOGVIEWMSG( aCmdId, 0 );
       
  1470 
       
  1471     TPhoneViewResponseId viewResponse = EPhoneViewResponseSuccess;
       
  1472 
       
  1473     switch ( aCmdId )
       
  1474         {
       
  1475         case EPhoneViewGetNumberEntryIsUsedStatus:
       
  1476             viewResponse = iBubbleWrapper->IsNumberEntryUsed() ?
       
  1477                 EPhoneViewResponseSuccess :
       
  1478                 EPhoneViewResponseFailed;
       
  1479             break;
       
  1480 
       
  1481         case EPhoneViewGetNumberEntryIsVisibleStatus:
       
  1482             if ( iDialer )
       
  1483                 {
       
  1484                 viewResponse = iDialerActive ?
       
  1485                     EPhoneViewResponseSuccess :
       
  1486                     EPhoneViewResponseFailed;
       
  1487                 }
       
  1488             else
       
  1489                 {
       
  1490                 viewResponse = iBubbleWrapper->IsNumberEntryVisible() ?
       
  1491                 EPhoneViewResponseSuccess :
       
  1492                 EPhoneViewResponseFailed;
       
  1493                 }
       
  1494              break;
       
  1495 
       
  1496         case EPhoneViewIsNumberEntryNumericMode:
       
  1497             viewResponse = iBubbleWrapper->IsNENumericMode() ?
       
  1498                 EPhoneViewResponseSuccess :
       
  1499                 EPhoneViewResponseFailed;
       
  1500             break;
       
  1501 
       
  1502         case EPhoneViewGetNeedToSendToBackgroundStatus:
       
  1503             viewResponse = NeedToSendToBackground() ?
       
  1504                 EPhoneViewResponseSuccess :
       
  1505                 EPhoneViewResponseFailed;
       
  1506             break;
       
  1507 
       
  1508         case EPhoneViewGetTopApplicationIsDisplayedStatus:
       
  1509             {
       
  1510             const TInt foregroundWg = ForegroundApplicationWindowGroupId();
       
  1511             const TBool topAppDisplayed = ( IdleWindowGroupId() == foregroundWg ) ||
       
  1512                 ( ApplicationWindowGroupId() == foregroundWg );
       
  1513             viewResponse = topAppDisplayed ?
       
  1514                 EPhoneViewResponseSuccess :
       
  1515                 EPhoneViewResponseFailed;
       
  1516             }
       
  1517             break;
       
  1518 
       
  1519         case EPhoneViewGetTitlePaneIsVisibleStatus:
       
  1520             viewResponse = iStatusPane->IsTitlePaneVisible( *this ) ?
       
  1521                 EPhoneViewResponseSuccess :
       
  1522                 EPhoneViewResponseFailed;
       
  1523             break;
       
  1524             
       
  1525         case EPhoneViewIsMenuBarVisible:
       
  1526             viewResponse = iMenuController->IsMenuBarVisible() ?
       
  1527                 EPhoneViewResponseSuccess :
       
  1528                 EPhoneViewResponseFailed;
       
  1529             break;
       
  1530 
       
  1531         case EPhoneViewIsStraightCallToVideoMailBox:
       
  1532           {
       
  1533           if( !iVmbxHandler )
       
  1534               {
       
  1535               iVmbxHandler = CPhoneVmbxHandler::NewL();
       
  1536               }
       
  1537 
       
  1538           viewResponse = iVmbxHandler->IsStraightCallToVideoMailBox() ?
       
  1539               EPhoneViewResponseSuccess :
       
  1540               EPhoneViewResponseFailed;
       
  1541           }
       
  1542           break;
       
  1543 
       
  1544         case EPhoneViewIsKeyLockEnabled:
       
  1545             viewResponse = IsKeyLockEnabled() ?
       
  1546                 EPhoneViewResponseSuccess :
       
  1547                 EPhoneViewResponseFailed;
       
  1548             break;          
       
  1549 
       
  1550     // Dialer specific commands start
       
  1551 
       
  1552     // Dialer handles these commands.
       
  1553     // ** TODO Here we need just to flag if functionality creates blocking dialog.
       
  1554         case EPhoneDialerCmdLog:
       
  1555             {
       
  1556             LogsUiCmdStarter::CmdStartL( LogsUiCmdStarterConsts::KDialledView());
       
  1557             }
       
  1558             break;
       
  1559 
       
  1560         case EPhoneDialerCmdSpeedDial:
       
  1561             {
       
  1562             // Launch speeddial application.
       
  1563             TPhoneCmdParamAppInfo appInfoParam;
       
  1564             appInfoParam.SetAppUid( KUidSpdia );
       
  1565             ExecuteCommandL( EPhoneViewActivateApp, &appInfoParam );
       
  1566             break;
       
  1567             }
       
  1568             
       
  1569         case EPhoneDialerCallSettings:
       
  1570             {
       
  1571             CGSLauncher* launcher = CGSLauncher::NewLC();
       
  1572             launcher->LaunchGSViewL( TUid::Uid( 0x102824A2),
       
  1573                                     TUid::Uid( 0x100058B3),
       
  1574                                     KNullDesC8 );
       
  1575             CleanupStack::PopAndDestroy( launcher );
       
  1576             break;
       
  1577             }
       
  1578             
       
  1579         case EPhoneViewIsDTMFEditorVisible:
       
  1580             if ( iDialer )
       
  1581                 {
       
  1582                 viewResponse = iDialerController->IsDTMFDialerVisible() ?
       
  1583                     EPhoneViewResponseSuccess :
       
  1584                     EPhoneViewResponseFailed;
       
  1585                 }
       
  1586             else // non-touch.
       
  1587                 {
       
  1588                 viewResponse = iQueryController->IsDTMFQueryVisible() ?
       
  1589                     EPhoneViewResponseSuccess :
       
  1590                     EPhoneViewResponseFailed;
       
  1591                 }
       
  1592             break;
       
  1593             
       
  1594         case EPhoneViewIsConferenceInExpandedMode:
       
  1595             viewResponse = iBubbleWrapper->IsConferenceInExpandedMode() ?
       
  1596                 EPhoneViewResponseSuccess :
       
  1597                 EPhoneViewResponseFailed;
       
  1598             break;
       
  1599 
       
  1600         case EPhoneViewOpenNumberEntry:
       
  1601             if ( iDialer )
       
  1602                 {
       
  1603                 TPhoneCmdParamBoolean booleanParam;
       
  1604                 booleanParam.SetBoolean( ETrue );
       
  1605 
       
  1606                 if ( iBubbleWrapper->IsNumberEntryUsed() )
       
  1607                     {
       
  1608                     // Launch dialer.
       
  1609                     ExecuteCommandL( EPhoneViewSetNumberEntryVisible, &booleanParam );
       
  1610                     }
       
  1611                 else // dialer doesnt exist.
       
  1612                     {
       
  1613                      // Create and launch dialer.
       
  1614                     ExecuteCommandL( EPhoneViewCreateNumberEntry, &booleanParam );
       
  1615                     }
       
  1616                 // Set Number Entry CBA
       
  1617                 TPhoneCmdParamInteger integerParam;
       
  1618                 integerParam.SetInteger( CPhoneMainResourceResolver::Instance()->
       
  1619                     ResolveResourceID( EPhoneNumberAcqCBA ) );
       
  1620                 ExecuteCommandL( EPhoneViewUpdateCba, &integerParam );
       
  1621                 // Set flag to false because dialler is set to open status.
       
  1622                 iPhoneView->SetPhoneAppViewToDialer( EFalse );
       
  1623               }
       
  1624           break;
       
  1625 
       
  1626         case EPhoneViewOpenCallHandling:
       
  1627             if ( iDialer )
       
  1628                 {
       
  1629                 if ( iBlockingDialogIsDisplayed )
       
  1630                     {
       
  1631                     RemovePhoneDialogsL();
       
  1632                     }
       
  1633                 // Remove DTMF dialer when exist
       
  1634                 if ( iDialerController->IsDTMFDialerVisible() )
       
  1635                     {
       
  1636                     static_cast<MEikCommandObserver*>( CEikonEnv::Static()->EikAppUi() )
       
  1637                     ->ProcessCommandL( EPhoneDtmfDialerExit );
       
  1638                     }
       
  1639                 else if ( iCustomization && 
       
  1640                           iDialerController->IsCustomizedDialerVisible() )
       
  1641                     {
       
  1642                     iCustomization->HandleCommandL( 
       
  1643                        *this, EPhoneViewOpenCallHandling, NULL );
       
  1644                     }
       
  1645                 else
       
  1646                     {
       
  1647                     SetControltoCallHandlingL();
       
  1648                     }
       
  1649                 }
       
  1650           break;
       
  1651 
       
  1652         case EPhoneViewIsIdleTopApp:
       
  1653             {
       
  1654             viewResponse = CPhonePubSubProxy::Instance()->Value(
       
  1655                     KPSUidUikon, KUikVideoCallTopApp ) == IdleAppUid() ?
       
  1656                 EPhoneViewResponseSuccess :
       
  1657                 EPhoneViewResponseFailed;
       
  1658             }
       
  1659             break;
       
  1660 
       
  1661         case EPhoneViewSetDialerControlVisible:
       
  1662             {
       
  1663             // If dialer was not active and needtosendback is false
       
  1664             // then check if dialer view is to be opened.
       
  1665             if ( !iDialerActive &&
       
  1666                  !iNeedToSendToBackground &&
       
  1667                  iPhoneView->PhoneAppViewToDialer() )
       
  1668                 {
       
  1669                 SetControltoDialerL();
       
  1670                 // Reset flag.
       
  1671                 iPhoneView->SetPhoneAppViewToDialer( EFalse );
       
  1672                 viewResponse = EPhoneViewResponseSuccess;
       
  1673                 }
       
  1674             else
       
  1675                 {
       
  1676                 // Reset flag.
       
  1677                 iPhoneView->SetPhoneAppViewToDialer( EFalse );
       
  1678                 viewResponse = EPhoneViewResponseFailed;
       
  1679                 }
       
  1680             }
       
  1681             break;
       
  1682 // Dialer specific commands end.
       
  1683 
       
  1684         case EPhoneIsCustomizedDialerVisible:
       
  1685             {
       
  1686             viewResponse = iDialerController->IsCustomizedDialerVisible() ?
       
  1687                 EPhoneViewResponseSuccess :
       
  1688                 EPhoneViewResponseFailed;
       
  1689             }
       
  1690             break;
       
  1691 
       
  1692         case EPhoneViewHideCustomizedDialer:
       
  1693             {
       
  1694             iDialerController->HideCustomizedDialer();
       
  1695             viewResponse = EPhoneViewResponseSuccess;
       
  1696             }
       
  1697             break;
       
  1698         case EPhoneViewShowToolbar:
       
  1699             {
       
  1700             iToolbarController->ShowToolbar();
       
  1701             }
       
  1702             break;
       
  1703         default:
       
  1704             viewResponse = EPhoneViewResponseFailed;
       
  1705             __PHONELOG( EBasic, EPhonePhoneapp, "CPhoneViewController::HandleCommandL -> UnKnownMessage !!! ");
       
  1706             break;
       
  1707         }
       
  1708 
       
  1709     return viewResponse;
       
  1710     }
       
  1711 
       
  1712 // ---------------------------------------------------------------------------
       
  1713 // CPhoneViewController::HandleCommand( aCmdId, aCommandParam )
       
  1714 // ---------------------------------------------------------------------------
       
  1715 //
       
  1716 EXPORT_C TPhoneViewResponseId CPhoneViewController::HandleCommandL(
       
  1717     TPhoneViewCommandId aCmdId,
       
  1718     TPhoneCommandParam* aCommandParam )
       
  1719     {
       
  1720     __PHONELOGVIEWMSG( aCmdId, 0 );
       
  1721     TPhoneViewResponseId viewResponse = EPhoneViewResponseSuccess;
       
  1722     TInt err;
       
  1723     
       
  1724     switch ( aCmdId )
       
  1725         {
       
  1726         case EPhoneViewSendKeyEventToNumberEntry:
       
  1727             {
       
  1728             // Pass the key event to the Bubble Manager (ignore key
       
  1729             // reponse)
       
  1730             iBubbleWrapper->HandleKeyEventL( aCommandParam );
       
  1731 
       
  1732             // Indicate whether the number entry has been cleared
       
  1733             if ( iBubbleWrapper->CountNumberEntryCharacters() == 0 && !iDialer )
       
  1734                 {
       
  1735                 viewResponse = EPhoneViewResponseNumberEntryCleared;
       
  1736                 }
       
  1737             else
       
  1738                 {
       
  1739                 viewResponse = EPhoneViewResponseSuccess;
       
  1740                 }
       
  1741             break;
       
  1742             }
       
  1743 
       
  1744         case EPhoneViewAssignSpeedDialLocation:
       
  1745             {
       
  1746             if ( AssignSpeedDialLocation( aCommandParam ) )
       
  1747                 {
       
  1748                 viewResponse = EPhoneViewResponseSuccess;
       
  1749                 }
       
  1750             else
       
  1751                 {
       
  1752                 viewResponse = EPhoneViewResponseFailed;
       
  1753                 }
       
  1754             break;
       
  1755             }
       
  1756 
       
  1757         case EPhoneViewSelectedConfMember:
       
  1758             {
       
  1759             if ( iBubbleWrapper->SelectedConfMemberCallIdL( aCommandParam ) )
       
  1760                 {
       
  1761                 viewResponse = EPhoneViewResponseSuccess;
       
  1762                 }
       
  1763             else
       
  1764                 {
       
  1765                 viewResponse = EPhoneViewResponseFailed;
       
  1766                 }
       
  1767             break;
       
  1768             }
       
  1769 
       
  1770         case EPhoneViewGetCallState:
       
  1771             {
       
  1772             if ( iBubbleWrapper->GetCallState( aCommandParam ) )
       
  1773                 {
       
  1774                 viewResponse = EPhoneViewResponseSuccess;
       
  1775                 }
       
  1776             else
       
  1777                 {
       
  1778                 viewResponse = EPhoneViewResponseFailed;
       
  1779                 }
       
  1780             break;
       
  1781             }
       
  1782 
       
  1783         case EPhoneViewGetCallIdByState:
       
  1784             {
       
  1785             if ( iBubbleWrapper->GetCallIdByState( aCommandParam ) )
       
  1786                 {
       
  1787                 viewResponse = EPhoneViewResponseFailed;
       
  1788                 }
       
  1789             else
       
  1790                 {
       
  1791                 viewResponse = EPhoneViewResponseSuccess;
       
  1792                 }
       
  1793             break;
       
  1794             }
       
  1795 
       
  1796         case EPhoneViewOpenSingleItemFetchDialog:
       
  1797             {
       
  1798             // Create CPhoneSingleItemFetch, if not exist
       
  1799             if ( !iSingleItemFetch )
       
  1800                 {
       
  1801                 iSingleItemFetch = CPhoneSingleItemFetch::NewL(
       
  1802                     iEikEnv, *this, *iContactController, *iStatusPane );
       
  1803                 }
       
  1804 
       
  1805             iBlockingDialogIsDisplayed = ETrue;
       
  1806 
       
  1807             TRAP( err, iSingleItemFetch->OpenSingleItemFetchDialogL( aCommandParam ))
       
  1808             if ( err )
       
  1809                 {
       
  1810                 iBlockingDialogIsDisplayed = EFalse;
       
  1811                 User::Leave( err );
       
  1812                 }
       
  1813             break;
       
  1814             }
       
  1815 
       
  1816         case EPhoneViewGetNumberFromSpeedDialLocation:
       
  1817             if ( iBlockingDialogIsDisplayed )
       
  1818                 {
       
  1819                 viewResponse = EPhoneViewResponseFailed;
       
  1820                 }
       
  1821             else
       
  1822                 {
       
  1823                 TBool status;
       
  1824                 TRAP( err, status = GetNumberFromSpeedDialLocationL( aCommandParam ))
       
  1825                 if ( err )
       
  1826                     {
       
  1827                     viewResponse = EPhoneViewResponseFailed;
       
  1828                     // Set and reset in GetNumberFromSpeedDialLocationL when not leave
       
  1829                     iBlockingDialogIsDisplayed = EFalse;
       
  1830                     }
       
  1831                 else if ( status )
       
  1832                     {
       
  1833                     viewResponse = EPhoneViewResponseSuccess;
       
  1834                     }
       
  1835                 else
       
  1836                     {
       
  1837                     viewResponse = EPhoneViewResponseFailed;
       
  1838                     }
       
  1839                 }
       
  1840             break;
       
  1841 
       
  1842         case EPhoneViewGetCustomizedDialerMenuResourceId:
       
  1843             {
       
  1844             TInt resId = iDialerController->CustomizedMenuResourceId();
       
  1845             static_cast<TPhoneCmdParamInteger*>( aCommandParam )->SetInteger( resId );
       
  1846             viewResponse = EPhoneViewResponseSuccess;
       
  1847             }
       
  1848             break;
       
  1849         case EPhoneViewGetCustomizedDialerCbaResourceId:
       
  1850             {
       
  1851             TInt resId = iDialerController->CustomizedCbaResourceId();
       
  1852             static_cast<TPhoneCmdParamInteger*>( aCommandParam )->SetInteger( resId );
       
  1853             viewResponse = EPhoneViewResponseSuccess;
       
  1854             }
       
  1855             break;
       
  1856 
       
  1857         default:
       
  1858             if ( iCustomization )
       
  1859                 {
       
  1860                 // Let customization handle view command
       
  1861                 if ( iCustomization->HandleCommandL(
       
  1862                         *this, aCmdId, aCommandParam ) )
       
  1863                     {
       
  1864                     viewResponse = EPhoneViewResponseSuccess;
       
  1865                     }
       
  1866                 else
       
  1867                     {
       
  1868                     viewResponse = EPhoneViewResponseFailed;
       
  1869                     }
       
  1870                 }
       
  1871             else
       
  1872                 {
       
  1873                 __PHONELOG( EBasic, EPhonePhoneapp, "CPhoneViewController::HandleCommandL -> UnKnownMessage !!! ");
       
  1874                 }
       
  1875             break;
       
  1876         }
       
  1877 
       
  1878     return viewResponse;
       
  1879     }
       
  1880 
       
  1881 // ---------------------------------------------------------------------------
       
  1882 // CPhoneViewController::HandleTitlePaneActiveL
       
  1883 // ---------------------------------------------------------------------------
       
  1884 //
       
  1885 void CPhoneViewController::HandleTitlePaneActiveL( TBool aActive )
       
  1886     {
       
  1887     if ( aActive )
       
  1888         {
       
  1889         iStatusPane->UpdateTitlePane();
       
  1890         }
       
  1891     }
       
  1892 
       
  1893 // ---------------------------------------------------------------------------
       
  1894 // CPhoneViewController::ApplicationWindowGroupId
       
  1895 // ---------------------------------------------------------------------------
       
  1896 //
       
  1897 EXPORT_C TInt CPhoneViewController::ApplicationWindowGroupId()
       
  1898     {
       
  1899     TInt phoneAppWg = iEikEnv.RootWin().Identifier();
       
  1900     __PHONELOG1( EBasic, EPhoneUIView,
       
  1901       "CPhoneViewController::ApplicationWindowGroupId - PhoneApplicationWindowGroupId = (%d)",
       
  1902       phoneAppWg );
       
  1903     return phoneAppWg;
       
  1904     }
       
  1905 
       
  1906 // ---------------------------------------------------------------------------
       
  1907 // CPhoneViewController::IdleWindowGroupId
       
  1908 // ---------------------------------------------------------------------------
       
  1909 //
       
  1910 EXPORT_C TInt CPhoneViewController::IdleWindowGroupId()
       
  1911     {
       
  1912     if ( !iIdleWg )
       
  1913         {
       
  1914         // Save Idle window group.
       
  1915         TApaTaskList appList( iEikEnv.WsSession() );
       
  1916         TApaTask bring = appList.FindApp( TUid::Uid( IdleAppUid() ) );
       
  1917         if ( bring.Exists() )
       
  1918             {
       
  1919             iIdleWg = bring.WgId();
       
  1920             __PHONELOG1( EBasic, EPhoneUIView,
       
  1921               "CPhoneViewController::ConstructL -> iIdleWindowGroupId = (%d)",
       
  1922               iIdleWg );
       
  1923             }
       
  1924         }
       
  1925 
       
  1926     return iIdleWg;
       
  1927     }
       
  1928 
       
  1929 // ---------------------------------------------------------------------------
       
  1930 // CPhoneViewController::GetSoftRejectWindowGroupId
       
  1931 // ---------------------------------------------------------------------------
       
  1932 //
       
  1933 void CPhoneViewController::GetSoftRejectWindowGroupId(
       
  1934                                     TPhoneCommandParam* aCommandParam )
       
  1935     {
       
  1936     TInt softRejectWg( KErrNotFound );
       
  1937     TPhoneCmdParamInteger* integerParam =
       
  1938         static_cast<TPhoneCmdParamInteger*>( aCommandParam );
       
  1939 
       
  1940     TApaTaskList appList( iEikEnv.WsSession() );
       
  1941     TApaTask bring = appList.FindApp( TUid::Uid( KSenduiUniEditorUidValue ) );
       
  1942     if ( bring.Exists() )
       
  1943         {
       
  1944         softRejectWg = bring.WgId();
       
  1945         __PHONELOG1( EBasic, EPhoneUIView,
       
  1946             "CPhoneViewController::SoftRejectWindowGroupId = (%d)",
       
  1947             softRejectWg );
       
  1948         }
       
  1949     integerParam->SetInteger( softRejectWg );
       
  1950     }
       
  1951 
       
  1952 // ---------------------------------------------------------------------------
       
  1953 // CPhoneViewController::ForegroundApplicationWindowGroupId
       
  1954 // ---------------------------------------------------------------------------
       
  1955 //
       
  1956 EXPORT_C TInt CPhoneViewController::ForegroundApplicationWindowGroupId()
       
  1957     {
       
  1958     TInt result(0);
       
  1959     TRAP_IGNORE( result = DoFetchForegroundApplicationWindowGroupIdL(
       
  1960                           iEikEnv ) );
       
  1961     __PHONELOG1( EBasic,
       
  1962             EPhoneUIView,
       
  1963             "CPhoneViewController::ForegroundApplicationWindowGroupId() GroupId %d",
       
  1964             result );
       
  1965     return result;
       
  1966     }
       
  1967 
       
  1968 // ---------------------------------------------------------------------------
       
  1969 // CPhoneViewController::DoFetchForegroundApplicationWindowGroupIdL
       
  1970 // ---------------------------------------------------------------------------
       
  1971 //
       
  1972 EXPORT_C TInt CPhoneViewController::DoFetchForegroundApplicationWindowGroupIdL(
       
  1973     CEikonEnv& aEnv )
       
  1974     {
       
  1975     TInt result = 0;
       
  1976 
       
  1977     RWsSession& wsSession = aEnv.WsSession();
       
  1978 
       
  1979     const TInt numWg =
       
  1980         wsSession.NumWindowGroups(
       
  1981             KPhoneApplicationWindowGroupPriority );
       
  1982 
       
  1983     CArrayFixFlat<TInt>* wgList =
       
  1984         new (ELeave) CArrayFixFlat<TInt>( numWg );
       
  1985     CleanupStack::PushL( wgList );
       
  1986     wgList->SetReserveL( numWg );
       
  1987 
       
  1988     // Get list of window groups; all applications should be at priority 0.
       
  1989     //
       
  1990     if ( wsSession.WindowGroupList(
       
  1991         KPhoneApplicationWindowGroupPriority,
       
  1992         wgList ) == KErrNone )
       
  1993         {
       
  1994         if ( wgList->Count() )
       
  1995             {
       
  1996             result = wgList->At( 0 ); // The very first window group id
       
  1997             }
       
  1998         }
       
  1999 
       
  2000     CleanupStack::PopAndDestroy( wgList );
       
  2001     return result;
       
  2002     }
       
  2003 
       
  2004 // ---------------------------------------------------------------------------
       
  2005 // CPhoneViewController::SetHiddenL
       
  2006 // ---------------------------------------------------------------------------
       
  2007 //
       
  2008 EXPORT_C void CPhoneViewController::SetHiddenL( const TBool aHidden )
       
  2009     {
       
  2010     __PHONELOG( EBasic, EPhoneUIView,"CPhoneViewController::SetHiddenL()" )
       
  2011     CApaWindowGroupName* windowGroupName =
       
  2012         CApaWindowGroupName::NewLC(
       
  2013             iEikEnv.WsSession(),
       
  2014             iEikEnv.RootWin().Identifier() );
       
  2015     windowGroupName->SetHidden( aHidden );
       
  2016     User::LeaveIfError(
       
  2017         windowGroupName->SetWindowGroupName(
       
  2018             iEikEnv.RootWin() ) );
       
  2019     CleanupStack::PopAndDestroy( windowGroupName );
       
  2020     }
       
  2021 
       
  2022 // ---------------------------------------------------------------------------
       
  2023 // CPhoneViewController::HandleResourceChangeL
       
  2024 // ---------------------------------------------------------------------------
       
  2025 //
       
  2026 EXPORT_C void CPhoneViewController::HandleResourceChangeL( TInt aType )
       
  2027     {
       
  2028     __PHONELOG( EBasic, EPhoneUIView,
       
  2029                         "CPhoneViewController::HandleResourceChangeL()" )
       
  2030     // Notify the bubble that there has been a resource change
       
  2031     iBubbleWrapper->Control()->HandleResourceChange( aType );
       
  2032 
       
  2033     // Notify dialer and switch statuspane layout.
       
  2034     if ( iDialer )
       
  2035         {
       
  2036         if ( aType == KEikDynamicLayoutVariantSwitch )
       
  2037             {
       
  2038             SwitchLayoutToFlatStatusPaneL( iDialerActive );
       
  2039             
       
  2040             if ( !iDialerActive && Layout_Meta_Data::IsLandscapeOrientation() )
       
  2041                 {        
       
  2042                 iDialerController->HideToolbar(); 
       
  2043                 }
       
  2044             }
       
  2045         static_cast<CCoeControl*>(iDialer)->HandleResourceChange( aType );
       
  2046         }
       
  2047     }
       
  2048 
       
  2049 // ---------------------------------------------------------------------------
       
  2050 // CPhoneViewController::BlockingDialogIsDisplayed
       
  2051 // ---------------------------------------------------------------------------
       
  2052 //
       
  2053 EXPORT_C TBool CPhoneViewController::BlockingDialogIsDisplayed() const
       
  2054     {
       
  2055     return iBlockingDialogIsDisplayed;
       
  2056     }
       
  2057 
       
  2058 // ---------------------------------------------------------------------------
       
  2059 // CPhoneViewController::HandleLayoutChange
       
  2060 // ---------------------------------------------------------------------------
       
  2061 //
       
  2062 EXPORT_C void CPhoneViewController::HandleLayoutChange( TRect aRect )
       
  2063     {
       
  2064     __PHONELOG( EBasic, EPhoneUIView,"CPhoneViewController::HandleLayoutChange()" )
       
  2065     iPhoneView->SetRect( aRect );
       
  2066     if ( iDialerView )
       
  2067 	    {
       
  2068 		iDialerView->SetRect( aRect );
       
  2069 		iStatusPane->UpdateTitlePane();
       
  2070 	    }
       
  2071     }
       
  2072 
       
  2073 // ---------------------------------------------------------------------------
       
  2074 // CPhoneViewController::StatusPaneDisplayed
       
  2075 // ---------------------------------------------------------------------------
       
  2076 //
       
  2077 EXPORT_C TBool CPhoneViewController::StatusPaneDisplayed()
       
  2078     {
       
  2079     return  CPhoneStatusPane::Instance()->IsVisible();
       
  2080     }
       
  2081 
       
  2082 // ---------------------------------------------------------------------------
       
  2083 // CPhoneViewController::IdleAppUid
       
  2084 // ---------------------------------------------------------------------------
       
  2085 //
       
  2086 TInt CPhoneViewController::IdleAppUid()
       
  2087     {
       
  2088     if ( iIdleUid == KErrNotFound )
       
  2089         {
       
  2090         // Get Idle's UID from PubSub.
       
  2091         iIdleUid = CPhonePubSubProxy::Instance()->Value(
       
  2092             KPSUidAiInformation,
       
  2093             KActiveIdleUid );
       
  2094 
       
  2095         __PHONELOG1( EBasic, EPhoneUIView,
       
  2096             "CPhoneViewController::ConstructL -> iIdleUid = (%d)", iIdleUid );
       
  2097         }
       
  2098     return iIdleUid;
       
  2099     }
       
  2100 
       
  2101 // ---------------------------------------------------------------------------
       
  2102 // CPhoneViewController::SetBlockingDialogIsDisplayed
       
  2103 // ---------------------------------------------------------------------------
       
  2104 //
       
  2105 EXPORT_C void CPhoneViewController::SetBlockingDialogIsDisplayed(
       
  2106         TBool aBlockingDialog )
       
  2107     {
       
  2108     iBlockingDialogIsDisplayed = aBlockingDialog;
       
  2109     __PHONELOG1( EBasic, EPhoneUIView,
       
  2110         "CPhoneViewController::SetBlockingDialogIsDisplayed(%d)",
       
  2111         iBlockingDialogIsDisplayed );
       
  2112     }
       
  2113 
       
  2114 // ---------------------------------------------------------------------------
       
  2115 // CPhoneViewController::GetBlockingDialogIsDisplayed
       
  2116 // ---------------------------------------------------------------------------
       
  2117 //
       
  2118 void CPhoneViewController::GetBlockingDialogIsDisplayed(
       
  2119     TPhoneCommandParam* aCommandParam )
       
  2120     {
       
  2121     if( aCommandParam->ParamId() == TPhoneCommandParam::EPhoneParamIdBoolean )
       
  2122         {
       
  2123         TPhoneCmdParamBoolean* booleanValue =
       
  2124             static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  2125         booleanValue->SetBoolean( iBlockingDialogIsDisplayed );
       
  2126         }
       
  2127     }
       
  2128 
       
  2129 // ---------------------------------------------------------------------------
       
  2130 // CPhoneViewController::GetSecurityModeStatus
       
  2131 // ---------------------------------------------------------------------------
       
  2132 //
       
  2133 void CPhoneViewController::GetSecurityModeStatus(
       
  2134     TPhoneCommandParam* aCommandParam )
       
  2135     {
       
  2136     if( aCommandParam->ParamId() == TPhoneCommandParam::EPhoneParamIdBoolean )
       
  2137         {
       
  2138         TPhoneCmdParamBoolean* booleanValue =
       
  2139             static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  2140         booleanValue->SetBoolean( iPhoneView->IsSecurityMode() );
       
  2141         }
       
  2142     }
       
  2143 
       
  2144 // ---------------------------------------------------------------------------
       
  2145 // CPhoneViewController::SetNeedToSendToBackground
       
  2146 // ---------------------------------------------------------------------------
       
  2147 //
       
  2148 void CPhoneViewController::SetNeedToSendToBackground(
       
  2149     TPhoneCommandParam* aCommandParam )
       
  2150     {
       
  2151     TPhoneCmdParamBoolean* booleanParam = static_cast<TPhoneCmdParamBoolean*>(
       
  2152         aCommandParam );
       
  2153 
       
  2154     iNeedToSendToBackground = booleanParam->Boolean();
       
  2155     __PHONELOG1( EBasic, EPhoneUIView,
       
  2156         "CPhoneViewController::SetNeedToSendToBackground(%d)",
       
  2157         iNeedToSendToBackground );
       
  2158     }
       
  2159 
       
  2160 // ---------------------------------------------------------------------------
       
  2161 // CPhoneViewController::NeedToSendToBackground
       
  2162 // ---------------------------------------------------------------------------
       
  2163 //
       
  2164 TBool CPhoneViewController::NeedToSendToBackground()
       
  2165     {
       
  2166     return iNeedToSendToBackground;
       
  2167     }
       
  2168 
       
  2169 // ---------------------------------------------------------------------------
       
  2170 // CPhoneViewController::SendToBackgroundL
       
  2171 // ---------------------------------------------------------------------------
       
  2172 //
       
  2173 void CPhoneViewController::SendToBackgroundL()
       
  2174     {
       
  2175     __PHONELOG( EBasic, EPhoneUIView,
       
  2176         "CPhoneViewController::SendToBackgroundL" );
       
  2177 
       
  2178     TApaTaskList appList( iEikEnv.WsSession() );
       
  2179     TApaTask phoneApp = appList.FindApp( KUidPhoneApplication );
       
  2180     iSendBack = EFalse;
       
  2181 
       
  2182     __PHONELOG1( EBasic, EPhoneUIView,
       
  2183         "CPhoneViewController::SendToBackgroundL - phoneApp.WgId() (%d)",  phoneApp.WgId() );
       
  2184 
       
  2185     // no need for sending phone background if it is not front
       
  2186     if ( ( phoneApp.Exists() ) && phoneApp.WgId() ==
       
  2187             ForegroundApplicationWindowGroupId() )
       
  2188         {
       
  2189         // make sure that previous application window group id is not
       
  2190         //telephony's
       
  2191         if( iPrevForegroundAppWg > 0 &&
       
  2192             iPrevForegroundAppWg != phoneApp.WgId() )
       
  2193             {
       
  2194             // check that previous app still exists. It might be for example
       
  2195             // add to contact - dialog that is allready destroyed.
       
  2196             TInt previousApp = FindAppByWgIDL( iPrevForegroundAppWg );
       
  2197 
       
  2198             if( previousApp != KErrNotFound )
       
  2199                 {
       
  2200                 __PHONELOG1( EBasic, EPhoneUIView,
       
  2201                  "CPhoneViewController::SendToBackgroundL - Bring previous app to foreground (%d)"
       
  2202                         ,  iPrevForegroundAppWg );
       
  2203 
       
  2204                 CAknSgcClient::MoveApp( iPrevForegroundAppWg, ESgcMoveAppToForeground );
       
  2205                 iSendBack = ETrue;
       
  2206                 SetWindowGroupPosition();
       
  2207                 }
       
  2208             }
       
  2209         else
       
  2210             {
       
  2211             __PHONELOG( EBasic, EPhoneUIView,
       
  2212                 "CPhoneViewController::SendToBackgroundL - send telephony to background" );
       
  2213 
       
  2214             iSendBack = ETrue;
       
  2215             CAknSgcClient::MoveApp( phoneApp.WgId(),
       
  2216                                     ESgcMoveAppToBackground );
       
  2217             }
       
  2218         }
       
  2219 
       
  2220     // Clear the send to background flag
       
  2221     iNeedToSendToBackground = EFalse;
       
  2222     }
       
  2223 
       
  2224 // ---------------------------------------------------------------------------
       
  2225 // CPhoneViewController::FindAppByWgIDL
       
  2226 // ---------------------------------------------------------------------------
       
  2227 //
       
  2228 TInt CPhoneViewController::FindAppByWgIDL( TInt aAppWgID )
       
  2229     {
       
  2230     __LOGMETHODSTARTEND( EPhoneUIView,
       
  2231         "CPhoneViewController::FindAppByWgIDL() ")
       
  2232 
       
  2233     TInt appExists( KErrNotFound );
       
  2234 
       
  2235     RWsSession& wsSession = iEikEnv.WsSession();
       
  2236 
       
  2237     const TInt numWg = wsSession.NumWindowGroups(
       
  2238             KPhoneApplicationWindowGroupPriority );
       
  2239 
       
  2240     CArrayFixFlat<TInt>* wgList =
       
  2241         new (ELeave) CArrayFixFlat<TInt>( numWg );
       
  2242     CleanupStack::PushL( wgList );
       
  2243     wgList->SetReserveL( numWg );
       
  2244 
       
  2245     // Get list of window groups; all applications should be at priority 0.
       
  2246     //
       
  2247     if ( wsSession.WindowGroupList(
       
  2248         KPhoneApplicationWindowGroupPriority,
       
  2249         wgList ) == KErrNone )
       
  2250         {
       
  2251         for( TInt i = 0; i < wgList->Count(); i++ )
       
  2252             {
       
  2253             if( aAppWgID == wgList->At( i ) )
       
  2254                 {
       
  2255                 appExists = i;
       
  2256                 break;
       
  2257                 }
       
  2258             }
       
  2259         }
       
  2260 
       
  2261     CleanupStack::PopAndDestroy( wgList );
       
  2262 
       
  2263     return appExists;
       
  2264     }
       
  2265 
       
  2266 // ---------------------------------------------------------------------------
       
  2267 // CPhoneViewController::SetWindowGroupPosition
       
  2268 // This is used when dialer has opened some other
       
  2269 // app(Logs) and MT call arrives, when MT call is
       
  2270 // answered phone is put to backround and it isnt anymore next
       
  2271 // active app which means that when previous app is opened
       
  2272 // after answer and user presses exit we need to update
       
  2273 // ordinal position so that dialer is activated.
       
  2274 // ---------------------------------------------------------------------------
       
  2275 //
       
  2276 void CPhoneViewController::SetWindowGroupPosition()
       
  2277     {
       
  2278     iEikEnv.WsSession().SetWindowGroupOrdinalPosition(
       
  2279         ApplicationWindowGroupId(),
       
  2280         KPhoneWindowGroupPositionBackground );
       
  2281     }
       
  2282 
       
  2283 // ---------------------------------------------------------------------------
       
  2284 // CPhoneViewController::BringAppToForeground
       
  2285 // ---------------------------------------------------------------------------
       
  2286 //
       
  2287 void CPhoneViewController::BringAppToForeground(
       
  2288     TPhoneCommandParam* aCommandParam )
       
  2289     {
       
  2290     TPhoneCmdParamInteger* integerParam =
       
  2291             static_cast<TPhoneCmdParamInteger*>( aCommandParam );
       
  2292 
       
  2293    TApaTaskList appList( iEikEnv.WsSession() );
       
  2294    TApaTask application = appList.FindApp(
       
  2295                                    TUid::Uid( integerParam->Integer() ) );
       
  2296 
       
  2297    __PHONELOG1( EBasic, EPhoneUIView,
       
  2298                  "CPhoneViewController::BringAppToForeground - App WG ID: %d",
       
  2299                  application.WgId() );
       
  2300    if( application.Exists() )
       
  2301        {
       
  2302        iPrevForegroundAppWg = ForegroundApplicationWindowGroupId();
       
  2303        CAknSgcClient::MoveApp( application.WgId(), ESgcMoveAppToForeground );
       
  2304        __PHONELOG1( EBasic, EPhoneUIView,
       
  2305                      "CPhoneViewController::BringAppToForeground - Previous App WG ID: %d",
       
  2306                      iPrevForegroundAppWg );
       
  2307        }
       
  2308     }
       
  2309 
       
  2310 // ---------------------------------------------------------------------------
       
  2311 // CPhoneViewController::BringPhoneAppToForeground
       
  2312 // ---------------------------------------------------------------------------
       
  2313 //
       
  2314 void CPhoneViewController::BringPhoneAppToForeground(
       
  2315     TPhoneCommandParam* aCommandParam )
       
  2316     {
       
  2317     __PHONELOG( EBasic, EPhoneUIView,
       
  2318         "CPhoneViewController::BringPhoneAppToForeground()" );
       
  2319 
       
  2320     TPhoneCmdParamInteger* integerParam =
       
  2321         static_cast<TPhoneCmdParamInteger*>( aCommandParam );
       
  2322 
       
  2323     TApaTaskList appList( iEikEnv.WsSession() );
       
  2324     TApaTask phoneApp = appList.FindApp(
       
  2325                                     TUid::Uid( integerParam->Integer() ) );
       
  2326 
       
  2327     // Saves previous window group id. Test if app is allready in front.
       
  2328     if( phoneApp.Exists() &&
       
  2329         ForegroundApplicationWindowGroupId() !=  phoneApp.WgId() )
       
  2330         {
       
  2331         iPrevForegroundAppWg = ForegroundApplicationWindowGroupId();
       
  2332         CAknSgcClient::MoveApp( phoneApp.WgId(), ESgcMoveAppToForeground );
       
  2333         __PHONELOG1( EBasic, EPhoneUIView,
       
  2334                       "CPhoneViewController::BringPhoneAppToForeground - Previous App WG ID: %d",
       
  2335                       iPrevForegroundAppWg );        
       
  2336         }
       
  2337     }
       
  2338 
       
  2339 // ---------------------------------------------------------------------------
       
  2340 // CPhoneViewController::SetTopApplicationL
       
  2341 // ---------------------------------------------------------------------------
       
  2342 //
       
  2343 void CPhoneViewController::SetTopApplicationL(
       
  2344     TPhoneCommandParam* aCommandParam )
       
  2345     {
       
  2346     // Set the top application
       
  2347     TPhoneCmdParamInteger* integerParam =
       
  2348         static_cast<TPhoneCmdParamInteger*>( aCommandParam );
       
  2349     CPhonePubSubProxy::Instance()->ChangePropertyValue(
       
  2350         KPSUidUikon,
       
  2351         KUikVideoCallTopApp,
       
  2352         integerParam->Integer() );
       
  2353 
       
  2354     // Hide the Phone icon if it is not the top application
       
  2355     SetHiddenL( integerParam->Integer() != KUidPhoneApplication.iUid );
       
  2356     }
       
  2357 
       
  2358 // ---------------------------------------------------------------------------
       
  2359 // CPhoneViewController::GetForegroundApplication
       
  2360 // ---------------------------------------------------------------------------
       
  2361 //
       
  2362 void CPhoneViewController::GetForegroundApplication(
       
  2363     TPhoneCommandParam* aCommandParam )
       
  2364     {
       
  2365     // Get the foreground application window group id
       
  2366     TPhoneCmdParamInteger* integerParam =
       
  2367         static_cast<TPhoneCmdParamInteger*>( aCommandParam );
       
  2368     integerParam->SetInteger( ForegroundApplicationWindowGroupId() );
       
  2369     }
       
  2370 
       
  2371 // ---------------------------------------------------------------------------
       
  2372 // CPhoneViewController::ActivateAppViewConventionalL
       
  2373 // ---------------------------------------------------------------------------
       
  2374 //
       
  2375 void CPhoneViewController::ActivateAppViewConventionalL(
       
  2376     TPhoneCommandParam* aCommandParam )
       
  2377     {
       
  2378     TPhoneCmdParamAppInfo* appInfoParam =
       
  2379         static_cast<TPhoneCmdParamAppInfo*>( aCommandParam );
       
  2380 
       
  2381     TApaTaskList taskList( iEikEnv.WsSession() );
       
  2382     TApaTask task = taskList.FindApp( appInfoParam->AppUid() );
       
  2383     if ( task.Exists() )
       
  2384         {
       
  2385         CAknSgcClient::MoveApp( task.WgId(), ESgcMoveAppToForeground );
       
  2386         }
       
  2387     else
       
  2388         {
       
  2389         CreateConnectionL();
       
  2390         HBufC* param = HBufC::NewLC( appInfoParam->Param().Length() );
       
  2391         param->Des().Copy( appInfoParam->Param() );
       
  2392         TThreadId id;
       
  2393         User::LeaveIfError(
       
  2394             iApaLsSession.StartDocument( *param,
       
  2395             appInfoParam->AppUid(), id ) );
       
  2396         CleanupStack::PopAndDestroy( param );
       
  2397         }
       
  2398     }
       
  2399 
       
  2400 // ---------------------------------------------------------------------------
       
  2401 // CPhoneViewController::ActivateAppL
       
  2402 // ---------------------------------------------------------------------------
       
  2403 //
       
  2404 void CPhoneViewController::ActivateAppL(
       
  2405     TPhoneCommandParam* aCommandParam )
       
  2406     {
       
  2407     TPhoneCmdParamAppInfo* appInfoParam =
       
  2408         static_cast<TPhoneCmdParamAppInfo*>( aCommandParam );
       
  2409 
       
  2410     __PHONELOG( EBasic, EPhoneUIView,"CPhoneViewController::ActivateAppL()" );
       
  2411 
       
  2412     CreateConnectionL();
       
  2413 
       
  2414     if ( appInfoParam->MultipleInstances() )
       
  2415         {
       
  2416         ActivateAppInstanceL( appInfoParam->AppUid() );
       
  2417         }
       
  2418     else
       
  2419         {
       
  2420         TApaTaskList apaTaskList( iEikEnv.WsSession() );
       
  2421         TApaTask apaTask = apaTaskList.FindApp( appInfoParam->AppUid() );
       
  2422         if ( apaTask.Exists() )
       
  2423             {
       
  2424             __PHONELOG( EBasic, EPhoneUIView,
       
  2425                 "CPhoneViewController::ActivateAppL() bring to foreground" );
       
  2426             CAknSgcClient::MoveApp( apaTask.WgId(), ESgcMoveAppToForeground );
       
  2427             }
       
  2428         else
       
  2429             {
       
  2430             ActivateAppInstanceL( appInfoParam->AppUid() );
       
  2431             }
       
  2432         }
       
  2433     }
       
  2434 
       
  2435 // ---------------------------------------------------------------------------
       
  2436 // CPhoneViewController::ActivateAppInstanceL
       
  2437 // ---------------------------------------------------------------------------
       
  2438 //
       
  2439 void CPhoneViewController::ActivateAppInstanceL( TUid aUid )
       
  2440     {
       
  2441     __PHONELOG( EBasic, EPhoneUIView,
       
  2442         "CPhoneViewController::ActivateAppInstanceL()" );
       
  2443     CreateConnectionL();
       
  2444 
       
  2445     TApaAppInfo appInfo;
       
  2446     User::LeaveIfError( iApaLsSession.GetAppInfo( appInfo, aUid ) );
       
  2447 
       
  2448 #ifdef SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1
       
  2449     CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC(
       
  2450         appInfo.iFullName );
       
  2451 #else
       
  2452     CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC();
       
  2453     apaCommandLine->SetExecutableNameL( appInfo.iFullName );
       
  2454     apaCommandLine->SetCommandL( EApaCommandRun );
       
  2455 #endif // SYMBIAN_SUPPORT_UI_FRAMEWORKS_V1
       
  2456 
       
  2457     User::LeaveIfError ( iApaLsSession.StartApp( *apaCommandLine ) );
       
  2458     CleanupStack::PopAndDestroy( apaCommandLine );
       
  2459     __PHONELOG( EBasic, EPhoneUIView,
       
  2460         "CPhoneViewController::ActivateAppInstanceL() done" );
       
  2461     }
       
  2462 
       
  2463 // ---------------------------------------------------------------------------
       
  2464 // CPhoneViewController::ActivateAppViewL
       
  2465 // ---------------------------------------------------------------------------
       
  2466 //
       
  2467 void CPhoneViewController::ActivateAppViewL(
       
  2468     TPhoneCommandParam* aCommandParam )
       
  2469     {
       
  2470     TPhoneCmdParamAppInfo* appInfoParam =
       
  2471         static_cast<TPhoneCmdParamAppInfo*>( aCommandParam );
       
  2472 
       
  2473     __PHONELOG( EBasic, EPhoneUIView,
       
  2474                 "CPhoneViewController::ActivateAppViewL()" );
       
  2475 
       
  2476     TVwsViewId view( appInfoParam->AppUid(), appInfoParam->ViewUid() );
       
  2477     iEikEnv.EikAppUi()->ActivateViewL( view );
       
  2478     }
       
  2479 
       
  2480 // ---------------------------------------------------------------------------
       
  2481 // CPhoneViewController::ActivateAppViewL
       
  2482 // ---------------------------------------------------------------------------
       
  2483 //
       
  2484 void CPhoneViewController::ActivateAppViewWithCustomMessageL(
       
  2485     TPhoneCommandParam* aCommandParam )
       
  2486     {
       
  2487     TPhoneCmdParamAppInfo* appInfoParam =
       
  2488         static_cast<TPhoneCmdParamAppInfo*>( aCommandParam );
       
  2489 
       
  2490     __PHONELOG( EBasic, EPhoneUIView,
       
  2491         "CPhoneViewController::ActivateAppViewWithCustomMessageL()" );
       
  2492 
       
  2493     TVwsViewId view( appInfoParam->AppUid(), appInfoParam->ViewUid() );
       
  2494     iEikEnv.EikAppUi()->ActivateViewL(
       
  2495         view,
       
  2496         appInfoParam->CustomMessageId(),
       
  2497         appInfoParam->CustomMessage() );
       
  2498     }
       
  2499 
       
  2500 // ---------------------------------------------------------------------------
       
  2501 // CPhoneViewController::CreateConnectionL
       
  2502 // ---------------------------------------------------------------------------
       
  2503 //
       
  2504 void CPhoneViewController::CreateConnectionL()
       
  2505     {
       
  2506     if ( !iApaLsSession.Handle() )
       
  2507         {
       
  2508         User::LeaveIfError( iApaLsSession.Connect() );
       
  2509         }
       
  2510     }
       
  2511 
       
  2512 // ---------------------------------------------------------------------------
       
  2513 // CPhoneViewController::LaunchApplicationL
       
  2514 // ---------------------------------------------------------------------------
       
  2515 //
       
  2516 void CPhoneViewController::LaunchApplicationL()
       
  2517     {
       
  2518     //long 0 launches application defined in KTelAppLaunch key.
       
  2519     TInt appId(0);
       
  2520     TUid appUid;
       
  2521     User::LeaveIfError( CPhoneCenRepProxy::Instance()->GetInt(
       
  2522         KCRUidTelPrivateVariation,
       
  2523         KTelAppLaunch,
       
  2524         appId ) );
       
  2525     appUid.iUid = appId;
       
  2526 
       
  2527     __PHONELOG1( EBasic, EPhoneUIView,
       
  2528         "CPhoneViewController::LaunchApplicationL appId: %d",
       
  2529         appId );
       
  2530 
       
  2531     HBufC* params = HBufC::NewLC( KPhoneMaxParamLength );
       
  2532     TPtr ptr = params->Des();
       
  2533     User::LeaveIfError( CPhoneCenRepProxy::Instance()->GetString(
       
  2534         KCRUidTelPrivateVariation,
       
  2535         KTelAppLaunchParam,
       
  2536         ptr ) );
       
  2537 
       
  2538     TApaTaskList taskList( iEikEnv.WsSession() );
       
  2539     TApaTask task = taskList.FindApp( appUid );
       
  2540     if ( task.Exists() )
       
  2541         {
       
  2542         // Uid is not used.
       
  2543         HBufC8* param = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *params );
       
  2544         User::LeaveIfError( task.SendMessage( TUid::Uid( 0 ), *param ) );
       
  2545         delete param;
       
  2546         }
       
  2547     else
       
  2548         {
       
  2549         CreateConnectionL();
       
  2550         TThreadId thread;
       
  2551         User::LeaveIfError(
       
  2552             iApaLsSession.StartDocument(
       
  2553                 *params,
       
  2554                 appUid,
       
  2555                 thread ) );
       
  2556         }
       
  2557     CleanupStack::PopAndDestroy( params ); // params
       
  2558     }
       
  2559 
       
  2560 // ---------------------------------------------------------------------------
       
  2561 // CPhoneViewController::LaunchHelpApplicationL
       
  2562 // ---------------------------------------------------------------------------
       
  2563 //
       
  2564 void CPhoneViewController::LaunchHelpApplicationL(
       
  2565     const TDesC& aHelpCommand )
       
  2566     {
       
  2567     // Save the help command
       
  2568     iHelpCommand.Set( aHelpCommand );
       
  2569 
       
  2570     // Activate Help application
       
  2571     HlpLauncher::LaunchHelpApplicationL(
       
  2572        CCoeEnv::Static()->WsSession(),
       
  2573        iEikEnv.EikAppUi()->AppHelpContextL() );
       
  2574     }
       
  2575 
       
  2576 // ---------------------------------------------------------------------------
       
  2577 // CPhoneViewController::HelpContext
       
  2578 // ---------------------------------------------------------------------------
       
  2579 //
       
  2580 EXPORT_C const TDesC& CPhoneViewController::HelpContext()
       
  2581     {
       
  2582     return iHelpCommand;
       
  2583     }
       
  2584 
       
  2585 // ---------------------------------------------------------------------------
       
  2586 // CPhoneViewController::SetCbaL
       
  2587 // Set the CBA to the specified setting
       
  2588 // (other items were commented in a header).
       
  2589 // ---------------------------------------------------------------------------
       
  2590 //
       
  2591 void CPhoneViewController::SetCbaL( TPhoneCommandParam* aCommandParam )
       
  2592     {
       
  2593     TPhoneCmdParamInteger* cbaResource =
       
  2594         static_cast<TPhoneCmdParamInteger*>( aCommandParam );
       
  2595 
       
  2596     TInt resourceId = cbaResource->Integer();
       
  2597 
       
  2598     iCba->SetCommandSetL( resourceId );
       
  2599     iCba->DrawDeferred();
       
  2600     }
       
  2601 
       
  2602 // ---------------------------------------------------------------------------
       
  2603 // CPhoneViewController::SetEikonNotifiersDisabled
       
  2604 // ---------------------------------------------------------------------------
       
  2605 //
       
  2606 void CPhoneViewController::SetEikonNotifiersDisabled(
       
  2607     TPhoneCommandParam* aCommandParam )
       
  2608     {
       
  2609     TPhoneCmdParamBoolean* booleanParam =
       
  2610         static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  2611 
       
  2612     if ( booleanParam->Boolean() )
       
  2613         {
       
  2614         if ( !iPriotityChanged )
       
  2615             {
       
  2616             //Store current ordinal priority.
       
  2617             iPrevious = CEikonEnv::Static()->RootWin().OrdinalPriority();
       
  2618             iPriotityChanged = ETrue;
       
  2619             //Rise window priority in order to get phoneview on top of eikon
       
  2620             //notifiers. e.g. Select USB mode notifier is the one which using
       
  2621             //eikon notiers.
       
  2622             CEikonEnv::Static()->RootWin().SetOrdinalPosition(
       
  2623                     0,
       
  2624                     ECoeWinPriorityAlwaysAtFront-1 );
       
  2625             __PHONELOG( EBasic, EPhoneUIView,
       
  2626             "CPhoneViewController::SetEikonNotifiersDisabled()_priority_rise" );
       
  2627             }
       
  2628         }
       
  2629     // enable notifiers, sametime reset previous rootwin priority
       
  2630     else if ( iPriotityChanged )
       
  2631         {
       
  2632         TInt ordinalPos = CEikonEnv::Static()->RootWin().OrdinalPosition();
       
  2633         CEikonEnv::Static()->RootWin().SetOrdinalPosition(
       
  2634                 ordinalPos,
       
  2635                 iPrevious );
       
  2636         iPriotityChanged = EFalse;
       
  2637         __PHONELOG( EBasic, EPhoneUIView,
       
  2638         "CPhoneViewController::SetEikonNotifiersDisabled()_priority_reset" );
       
  2639         }
       
  2640     __PHONELOG1( EBasic, EPhoneUIView,
       
  2641         "CPhoneViewController::SetEikonNotifiersDisabled(%d)",
       
  2642         booleanParam->Boolean() );
       
  2643     }
       
  2644 // ---------------------------------------------------------------------------
       
  2645 // CPhoneViewController::SetGlobalNotifiersDisabledL
       
  2646 // ---------------------------------------------------------------------------
       
  2647 //
       
  2648 void CPhoneViewController::SetGlobalNotifiersDisabledL(
       
  2649     TPhoneCommandParam* aCommandParam )
       
  2650     {
       
  2651     TPhoneCmdParamBoolean* booleanParam =
       
  2652         static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  2653 
       
  2654     // Global note always removed if exists when notifiers disabled
       
  2655     if ( booleanParam->Boolean() )
       
  2656         {
       
  2657         ExecuteCommandL( EPhoneViewRemoveGlobalNote );
       
  2658         }
       
  2659     iKeyLock.EnableSoftNotifications( !booleanParam->Boolean() );
       
  2660     __PHONELOG1( EBasic, EPhoneUIView,
       
  2661         "CPhoneViewController::SetGlobalNotifiersDisabledL(%d)",
       
  2662         booleanParam->Boolean() );
       
  2663     }
       
  2664 
       
  2665 // ---------------------------------------------------------
       
  2666 // CPhoneViewController::IsKeyLockEnabled
       
  2667 // ---------------------------------------------------------
       
  2668 //
       
  2669 TBool CPhoneViewController::IsKeyLockEnabled()
       
  2670     {
       
  2671     TBool keylock;
       
  2672     keylock = iKeyLock.IsKeyLockEnabled();
       
  2673     __PHONELOG1( EBasic, EPhoneUIView,
       
  2674         "CPhoneViewController::IsKeyLockEnabled(%d)", keylock );
       
  2675     return keylock;
       
  2676     }
       
  2677 
       
  2678 // ---------------------------------------------------------
       
  2679 // CPhoneViewController::DisableKeyLock
       
  2680 // ---------------------------------------------------------
       
  2681 //
       
  2682 void CPhoneViewController::DisableKeyLock()
       
  2683     {
       
  2684     __PHONELOG( EBasic, EPhoneUIView,
       
  2685         "CPhoneViewController::DisableKeyLock()");
       
  2686     return iKeyLock.DisableWithoutNote();
       
  2687     }
       
  2688 
       
  2689 // CPhoneViewController::CancelAllNotications
       
  2690 // ---------------------------------------------------------------------------
       
  2691 //
       
  2692 void CPhoneViewController::CancelAllNotications()
       
  2693     {
       
  2694     iKeyLock.CancelAllNotifications();
       
  2695     __PHONELOG( EBasic, EPhoneUIView,
       
  2696         "CPhoneViewController::CancelAllNotications()");
       
  2697     }
       
  2698 
       
  2699 // ---------------------------------------------------------------------------
       
  2700 // CPhoneViewController::HandleUpdateBubbleL
       
  2701 // ---------------------------------------------------------------------------
       
  2702 //
       
  2703 void CPhoneViewController::HandleUpdateBubbleL(
       
  2704     TInt aCallId,
       
  2705     TPhoneCommandParam* aCommandParam )
       
  2706     {
       
  2707      // Check is the given parameter valid
       
  2708     if ( aCommandParam->ParamId() ==
       
  2709         TPhoneCommandParam::EPhoneParamIdCallHeaderData )
       
  2710         {
       
  2711         __PHONELOG( EBasic, EPhoneUIView,
       
  2712             "CPhoneViewController::HandleUpdateBubble()" );
       
  2713 
       
  2714         TPhoneCmdParamCallHeaderData* callHeaderParam =
       
  2715             static_cast<TPhoneCmdParamCallHeaderData*>( aCommandParam );
       
  2716         iBubbleWrapper->PrepareCallStateL(
       
  2717             aCallId,
       
  2718             callHeaderParam->CallState(),
       
  2719             callHeaderParam->LabelText(),
       
  2720             callHeaderParam->ShortLabelText() );
       
  2721         }
       
  2722     }
       
  2723 
       
  2724 // ---------------------------------------------------------------------------
       
  2725 
       
  2726 // ---------------------------------------------------------------------------
       
  2727 // CPhoneViewController::SoftRejectIsEnabled
       
  2728 // ---------------------------------------------------------------------------
       
  2729 //
       
  2730 TBool CPhoneViewController::SoftRejectIsEnabled() const
       
  2731     {
       
  2732     // Check if phone is locked
       
  2733     const TBool phoneIsLocked =
       
  2734         CPhonePubSubProxy::Instance()->Value(
       
  2735         KPSUidCoreApplicationUIs,
       
  2736         KCoreAppUIsAutolockStatus ) > EAutolockOff;
       
  2737 
       
  2738     if ( phoneIsLocked || IsSecurityCodeQuery() )
       
  2739         {
       
  2740         // Soft Reject is enabled if the phone is not locked. 
       
  2741 		// Security Code query is checked because in the boot
       
  2742 		// autolock status value is OFF even when it's actually
       
  2743 		// ON so we need to do this double checking.
       
  2744         return EFalse;
       
  2745         }
       
  2746     return ETrue;
       
  2747     }
       
  2748 
       
  2749 // ---------------------------------------------------------------------------
       
  2750 // CPhoneViewController::IsSecurityCodeQuery
       
  2751 // ---------------------------------------------------------------------------
       
  2752 //
       
  2753 TBool CPhoneViewController::IsSecurityCodeQuery() const
       
  2754   {
       
  2755   return CPhonePubSubProxy::Instance()->Value(
       
  2756     KPSUidStartup,
       
  2757     KStartupSecurityCodeQueryStatus ) == ESecurityQueryActive;
       
  2758   }
       
  2759 
       
  2760 // ---------------------------------------------------------------------------
       
  2761 // CPhoneViewController::GetNumberFromSpeedDialLocationL
       
  2762 // ---------------------------------------------------------------------------
       
  2763 //
       
  2764 TBool CPhoneViewController::GetNumberFromSpeedDialLocationL(
       
  2765     TPhoneCommandParam* aCommandParam )
       
  2766     {
       
  2767     __LOGMETHODSTARTEND(EPhoneUIView,
       
  2768         "CPhoneViewController::GetNumberFromSpeedDialLocationL() ");
       
  2769     TPhoneCmdParamSpeedDial* speedDialContent =
       
  2770         static_cast<TPhoneCmdParamSpeedDial*>( aCommandParam );
       
  2771     TBool retValue( ETrue );
       
  2772 
       
  2773     if ( speedDialContent->Location() != KErrNotFound )
       
  2774         {
       
  2775         TBuf<KPhoneNumberEntryBufferSize> speedDialNumber;
       
  2776         speedDialNumber.Zero(); // empty the string
       
  2777 
       
  2778         // Indicate that the speed dial controller is blocking key
       
  2779         // events from the Phone
       
  2780         iBlockingDialogIsDisplayed = ETrue;
       
  2781 
       
  2782         CreateSpeedDialControllerL();
       
  2783 
       
  2784         TInt err = iVmbxHandler->GetStraightSpeedDialNumber(
       
  2785                         speedDialContent->Location(),
       
  2786                         speedDialNumber );
       
  2787 
       
  2788         // Straight number founded
       
  2789         if ( err == KErrNone && speedDialNumber.Length() != 0)
       
  2790             {
       
  2791             if ( iVmbxHandler->GetMailboxType() == EVmbxVideo )
       
  2792                 {
       
  2793                 speedDialContent->SetNumberType( EPhoneNumberTypeVideo );
       
  2794                 }
       
  2795             else
       
  2796                 {
       
  2797                 speedDialContent->SetNumberType( EPhoneNumberTypeCS );
       
  2798                 }
       
  2799             }
       
  2800         else if ( iVmbxHandler->IsStraightCallToVideoMailBox() &&
       
  2801               ( speedDialContent->Location() == KPhoneVideoMbxLocation ||
       
  2802               speedDialContent->Location() == KPhoneVoiceMailBoxLocation ))
       
  2803             {
       
  2804             // Mbx number field of given type was empty and assigning cancelled
       
  2805             retValue = EFalse;
       
  2806             }
       
  2807 
       
  2808         else if ( speedDialContent->Location() == KPhoneVoiceMailBoxLocation )
       
  2809             {
       
  2810             // Get the voice mail box type and service ID
       
  2811             TUint serviceId( 0 );
       
  2812             TInt mailboxType = iVmbxHandler->SelectMailboxTypeL( serviceId );
       
  2813             speedDialContent->SetServiceId( serviceId );
       
  2814 
       
  2815             // Get the voice mail box number
       
  2816             if ( mailboxType == EVmbxNone )
       
  2817               {
       
  2818               // Nothing selected from the mailbox selection
       
  2819               retValue = EFalse;
       
  2820               }
       
  2821             else if ( iVmbxHandler->LaunchMbx( mailboxType, speedDialNumber )
       
  2822                       == KErrNone )
       
  2823                 {
       
  2824                 if ( mailboxType == EVmbxVideo )
       
  2825                     {
       
  2826                     speedDialContent->SetNumberType( EPhoneNumberTypeVideo );
       
  2827                     }
       
  2828                 else if ( mailboxType == EVmbxIP )
       
  2829                     {
       
  2830                     speedDialContent->SetNumberType( EPhoneNumberTypeVoip );
       
  2831                     }
       
  2832                 else
       
  2833                     {
       
  2834                     speedDialContent->SetNumberType( EPhoneNumberTypeCS );
       
  2835                     }
       
  2836                 }
       
  2837             else
       
  2838               {
       
  2839               // Mbx number field of given type was empty and assigning cancelled
       
  2840               retValue = EFalse;
       
  2841               }
       
  2842             }
       
  2843         else
       
  2844             {
       
  2845             // Get the number from the speed dial location
       
  2846             iSpeedDialController->GetSpeedDialFieldL(
       
  2847                 speedDialContent->Location(), speedDialNumber );
       
  2848             if (speedDialNumber.Length() == 0 )
       
  2849                 {
       
  2850                 AssignSpeedDialLocationL( speedDialContent->Location() );
       
  2851                 // Get the number from the speed dial location
       
  2852                 iSpeedDialController->GetSpeedDialFieldL(
       
  2853                     speedDialContent->Location(), speedDialNumber );
       
  2854                 }
       
  2855 
       
  2856             // If assigned
       
  2857             if ( speedDialNumber.Length() )
       
  2858                 {
       
  2859                 speedDialContent->SetNumberType(
       
  2860                     SpeedDialNumberTypeL( speedDialContent->Location() ) );
       
  2861                 }
       
  2862             else
       
  2863                 {
       
  2864                 retValue = EFalse;
       
  2865                 }
       
  2866             }
       
  2867 
       
  2868         // Reset the flag
       
  2869         iBlockingDialogIsDisplayed = EFalse;
       
  2870 
       
  2871         TPtr* phoneNumber = speedDialContent->PhoneNumber();
       
  2872         phoneNumber->Append( speedDialNumber );
       
  2873 
       
  2874         }
       
  2875     return retValue;
       
  2876     }
       
  2877 
       
  2878 // ---------------------------------------------------------------------------
       
  2879 // CPhoneViewController::SpeedDialNumberTypeL
       
  2880 // ---------------------------------------------------------------------------
       
  2881 //
       
  2882 TPhoneNumberType CPhoneViewController::SpeedDialNumberTypeL(
       
  2883         TInt aSpeedDialLocation )
       
  2884     {
       
  2885     __LOGMETHODSTARTEND( EPhoneUIView,
       
  2886             "CPhoneViewController::SpeedDialNumberTypeL() ");
       
  2887     CPhCntSpeedDialMonitor::TSpdDialFieldInfo fieldInfo;
       
  2888 
       
  2889     TBuf<KPhoneNumberEntryBufferSize> number;
       
  2890     TContactItemId itemId = iSpeedDialController->GetSpeedDialFieldL( 
       
  2891                                 aSpeedDialLocation, 
       
  2892                                 number,
       
  2893                                 fieldInfo );
       
  2894 
       
  2895     __PHONELOG1( EBasic, EPhoneUIView,
       
  2896         "CPhoneViewController::SpeedDialNumberTypeL - itemId = %d ", itemId );
       
  2897 
       
  2898     return ConvertNumberTypeFromSpeedDialFieldInfo( fieldInfo );
       
  2899     }
       
  2900 
       
  2901 // ---------------------------------------------------------------------------
       
  2902 // CPhoneViewController::ConvertNumberTypeFromSpeedDialFieldInfo
       
  2903 // ---------------------------------------------------------------------------
       
  2904 //
       
  2905 TPhoneNumberType CPhoneViewController::ConvertNumberTypeFromSpeedDialFieldInfo(
       
  2906     CPhCntSpeedDialMonitor::TSpdDialFieldInfo aFieldInfo )
       
  2907     {
       
  2908     __LOGMETHODSTARTEND(EPhoneUIView,
       
  2909         "CPhoneViewController::ConvertNumberTypeFromSpeedDialFieldInfo() ");
       
  2910     TPhoneNumberType retValue;
       
  2911     switch( aFieldInfo.iNumberType )
       
  2912         {
       
  2913         case MPhCntMatch::EVideoNumber:
       
  2914             retValue =  EPhoneNumberTypeVideo;
       
  2915             break;
       
  2916         case MPhCntMatch::EVoipNumber:
       
  2917             retValue =  EPhoneNumberTypeVoip;
       
  2918             break;
       
  2919         case KErrNotFound:
       
  2920             retValue = EPhoneNumberTypeNotFound;
       
  2921             break;
       
  2922         default:
       
  2923             retValue = EPhoneNumberTypeCS;
       
  2924             break;
       
  2925         }
       
  2926     __PHONELOG1( EBasic, EPhoneUIView,
       
  2927         "CPhoneViewController::ConvertNumberTypeFromSpeedDialFieldInfo - number type = %d ",
       
  2928         retValue );
       
  2929 
       
  2930     return retValue;
       
  2931     }
       
  2932 
       
  2933 // ---------------------------------------------------------------------------
       
  2934 // CPhoneViewController::AssignSpeedDialLocation
       
  2935 // ---------------------------------------------------------------------------
       
  2936 //
       
  2937 TBool CPhoneViewController::AssignSpeedDialLocation(
       
  2938     TPhoneCommandParam* aCommandParam )
       
  2939     {
       
  2940     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneViewController::AssignSpeedDialLocation( ) ")
       
  2941 
       
  2942     TPhoneCmdParamInteger* locationParam =
       
  2943         static_cast<TPhoneCmdParamInteger*>( aCommandParam );
       
  2944 
       
  2945     // Indicate that the contact operation is blocking key
       
  2946     // events from the Phone
       
  2947     iBlockingDialogIsDisplayed = ETrue;
       
  2948     TBool numberAssigned;
       
  2949     TRAPD( err,
       
  2950         numberAssigned = AssignSpeedDialLocationL(
       
  2951         locationParam->Integer()))
       
  2952 
       
  2953     // Reset the flag
       
  2954     iBlockingDialogIsDisplayed = EFalse;
       
  2955 
       
  2956     return err ? EFalse : numberAssigned;
       
  2957     }
       
  2958 
       
  2959 // ---------------------------------------------------------------------------
       
  2960 // CPhoneViewController::AssignSpeedDialLocationL
       
  2961 // ---------------------------------------------------------------------------
       
  2962 //
       
  2963 TBool CPhoneViewController::AssignSpeedDialLocationL(
       
  2964     TInt aLocation )
       
  2965     {
       
  2966   CreateSpeedDialControllerL();
       
  2967 
       
  2968     // Assign speed dial location
       
  2969     TBuf<KPhoneNumberEntryBufferSize> number;
       
  2970 
       
  2971     const TBool numberAssigned =
       
  2972         iSpeedDialController->AssignSpeedDialFieldL( aLocation, number );
       
  2973 
       
  2974     return numberAssigned;
       
  2975     }
       
  2976 
       
  2977 // ---------------------------------------------------------------------------
       
  2978 // CPhoneViewController::OpenMessageEditorL
       
  2979 // ---------------------------------------------------------------------------
       
  2980 //
       
  2981 void CPhoneViewController::OpenMessageEditorL(
       
  2982     TPhoneCommandParam* aCommandParam )
       
  2983     {
       
  2984     TPhoneCmdParamMessageEditor* messageEditorParam =
       
  2985         static_cast<TPhoneCmdParamMessageEditor*>( aCommandParam );
       
  2986 
       
  2987     //Launch message editor standalone
       
  2988     TUid mtmUid = { KSenduiMtmUniMessageUidValue };
       
  2989 
       
  2990     CSendUi* messageEditor = CSendUi::NewL();
       
  2991   CleanupStack::PushL( messageEditor );
       
  2992 
       
  2993     // Inform the SendUi to open the message editor. This is not a blocking
       
  2994     // dialog so the flag does not need to be set.
       
  2995     messageEditor->CreateAndSendMessageL(
       
  2996         mtmUid,
       
  2997         messageEditorParam->MessageData(),
       
  2998         KNullUid,
       
  2999         EFalse );
       
  3000 
       
  3001     CleanupStack::PopAndDestroy( messageEditor );
       
  3002     }
       
  3003 
       
  3004 // ---------------------------------------------------------------------------
       
  3005 // CPhoneViewController::OpenContactL
       
  3006 // ---------------------------------------------------------------------------
       
  3007 //
       
  3008 void CPhoneViewController::OpenAddToContactL(
       
  3009     TInt aCommand,
       
  3010     const TDesC& aString )
       
  3011     {
       
  3012     __LOGMETHODSTARTEND(EPhoneUIView, "CPhoneViewController::OpenAddToContactL( ) ")
       
  3013 
       
  3014     TPhoneCmdParamString phoneNumberString;
       
  3015 
       
  3016     HBufC *phoneNumber = HBufC::NewL( KPhoneNumberEntryBufferSize );
       
  3017 
       
  3018     if ( KErrNone == aString.Compare( KNullDesC ) )
       
  3019         {
       
  3020         // get the number entry contents
       
  3021         TPtr ptr( phoneNumber->Des() );
       
  3022         phoneNumberString.SetString( &ptr );
       
  3023         iBubbleWrapper->GetNumberEntryContent( &phoneNumberString );
       
  3024         }
       
  3025     else
       
  3026         {
       
  3027         phoneNumber->Des().Copy( aString );
       
  3028         }
       
  3029 
       
  3030     // Indicate that the contact operation is blocking key
       
  3031     // events from the Phone
       
  3032     iBlockingDialogIsDisplayed = ETrue;
       
  3033 
       
  3034     TRAPD( err,
       
  3035         {
       
  3036         // Create the contact dialog
       
  3037         iContactSaveAddToName = iContactController->CreateSaveAddToNameL();
       
  3038 
       
  3039         // The contact operation may be cancelled if the END key
       
  3040         // is pressed. If so, the blocking dialog will be removed.
       
  3041         if ( iBlockingDialogIsDisplayed )
       
  3042             {
       
  3043             // Inform the Contact to open the contacts
       
  3044             iContactSaveAddToName->HandlePbkOperationL(
       
  3045                 *phoneNumber, // TelNum
       
  3046                 aCommand );//CreateNew/Update
       
  3047             }
       
  3048         }) //TRAPD
       
  3049 
       
  3050     RemoveAddToContactDialog();
       
  3051     delete phoneNumber;
       
  3052 
       
  3053     // Reset the flag
       
  3054     iBlockingDialogIsDisplayed = EFalse;
       
  3055 
       
  3056     User::LeaveIfError( err );
       
  3057     }
       
  3058 
       
  3059 // ---------------------------------------------------------------------------
       
  3060 // CPhoneViewController::RemovePhoneDialogsL
       
  3061 // ---------------------------------------------------------------------------
       
  3062 //
       
  3063 void CPhoneViewController::RemovePhoneDialogsL()
       
  3064     {
       
  3065     __PHONELOG( EBasic, EPhoneUIView,
       
  3066         "CPhoneViewController::RemovePhoneDialogsL()" );
       
  3067     // Remove the note, if necessary
       
  3068     iNoteController->DestroyNote();
       
  3069 
       
  3070     // Remove the query, if necessary.
       
  3071     // Global query not allowed to destroy in this phase.
       
  3072     iQueryController->DestroyQuery();
       
  3073 
       
  3074     // Remove contact dialog.
       
  3075     RemoveAddToContactDialog();
       
  3076 
       
  3077     // Dismiss queries from customization, if necessary
       
  3078    if ( iCustomization )
       
  3079         {
       
  3080         iCustomization->RemoveDialog();
       
  3081         }
       
  3082 
       
  3083     // Remove speeddial dialogs.
       
  3084     if ( iSpeedDialController )
       
  3085         {
       
  3086         iSpeedDialController->Cancel();
       
  3087         }
       
  3088 
       
  3089     if ( iSingleItemFetch )
       
  3090         {
       
  3091         // Cancel the Single Item Fetch
       
  3092         iSingleItemFetch->Delete();
       
  3093         }
       
  3094 
       
  3095     if ( iVmbxHandler )
       
  3096         {
       
  3097         iVmbxHandler->CancelVmbx();
       
  3098         }
       
  3099 
       
  3100     if ( iRfsHandler )
       
  3101         {
       
  3102         __PHONELOG( EBasic, EPhoneUIView,
       
  3103             "CPhoneViewController::RemovePhoneDialogsL() CPhCntRfsHandler::ERfsCmdCancel" );
       
  3104         iRfsHandler->ProcessCommandL( CPhCntRfsHandler::ERfsCmdCancel );
       
  3105         delete iRfsHandler;
       
  3106         iRfsHandler = NULL;
       
  3107         }
       
  3108 
       
  3109     // Remove all blocking dialogs
       
  3110     if ( iBlockingDialogIsDisplayed )
       
  3111         {
       
  3112         // Reset the flag
       
  3113         iBlockingDialogIsDisplayed = EFalse;
       
  3114 
       
  3115         __PHONELOG( EBasic, EPhoneUIView,
       
  3116             "CPhoneViewController::RemovePhoneDialogsL() AknDialogShutter::ShutDialogsL" );
       
  3117 
       
  3118         TRAP_IGNORE(
       
  3119             AknDialogShutter::ShutDialogsL( iEikEnv ) );
       
  3120         }
       
  3121     }
       
  3122 
       
  3123 // ---------------------------------------------------------------------------
       
  3124 // CPhoneViewController::RemoveAddToContactDialog
       
  3125 // ---------------------------------------------------------------------------
       
  3126 //
       
  3127 void CPhoneViewController::RemoveAddToContactDialog()
       
  3128     {
       
  3129     if ( iContactSaveAddToName )
       
  3130         {
       
  3131         delete iContactSaveAddToName;
       
  3132         iContactSaveAddToName = NULL;
       
  3133         }
       
  3134     }
       
  3135 
       
  3136 // ---------------------------------------------------------------------------
       
  3137 // CPhoneViewController::DoConstructContactControllerL
       
  3138 //
       
  3139 // Callback function.
       
  3140 // ---------------------------------------------------------------------------
       
  3141 //
       
  3142 TInt CPhoneViewController::DoConstructContactControllerL( TAny* aAny )
       
  3143     {
       
  3144     CPhoneViewController* viewController =
       
  3145         static_cast< CPhoneViewController* >( aAny );
       
  3146 
       
  3147     return viewController->iContactController->ContinueConstructL();
       
  3148     }
       
  3149 
       
  3150 // ---------------------------------------------------------------------------
       
  3151 // CPhoneViewController::UpdateAudioPathOptions
       
  3152 // ---------------------------------------------------------------------------
       
  3153 //
       
  3154 void CPhoneViewController::UpdateAudioPathOptions(
       
  3155     TPhoneCommandParam* aCommandParam )
       
  3156     {
       
  3157     __PHONELOG( EBasic, EPhoneUIView,
       
  3158         "CPhoneViewController::UpdateAudioPathOptions()" );
       
  3159     TPhoneCmdParamBoolean ihfParam;
       
  3160     TPhoneCmdParamBoolean wiredParam;
       
  3161     TPhoneCmdParamBoolean btaaParam;
       
  3162 
       
  3163     TPhoneCmdParamAudioOutput* outputParam =
       
  3164         static_cast<TPhoneCmdParamAudioOutput*>( aCommandParam );
       
  3165 
       
  3166     ihfParam.SetBoolean(
       
  3167         outputParam->AudioOutput() == EPELoudspeaker );
       
  3168     wiredParam.SetBoolean(
       
  3169        ( outputParam->AudioOutput() == EPEWiredAudioAccessory ) ||
       
  3170        ( outputParam->AudioOutput() == EPETTY ) );
       
  3171 
       
  3172     btaaParam.SetBoolean(
       
  3173         outputParam->AudioOutput() == EPEBTAudioAccessory );
       
  3174 
       
  3175     // Wired options
       
  3176     iMenuController->SetWiredAccFlag( &wiredParam );
       
  3177 
       
  3178     iMenuController->SetIhfFlag( &ihfParam );
       
  3179     iToolbarController->SetIhfFlag( &ihfParam );
       
  3180 
       
  3181     // btaa menu options
       
  3182     iMenuController->SetBTAccFlag( &btaaParam );
       
  3183 
       
  3184     iAudioController->HandleIhfChange( &ihfParam );
       
  3185 
       
  3186     if ( iButtonsController )
       
  3187         {
       
  3188         iButtonsController->SetIhfFlag( &ihfParam );
       
  3189         iButtonsController->SetWiredAccFlag( &wiredParam );
       
  3190         iButtonsController->SetBTAccFlag( &btaaParam );
       
  3191         iButtonsController->ReplaceAudioButton();
       
  3192         }
       
  3193     }
       
  3194 
       
  3195 // ---------------------------------------------------------------------------
       
  3196 // CPhoneViewController::UpdateAudioAvailabilityOptions
       
  3197 // ---------------------------------------------------------------------------
       
  3198 //
       
  3199 void CPhoneViewController::UpdateAudioAvailabilityOptions(
       
  3200     TPhoneCommandParam* aCommandParam )
       
  3201     {
       
  3202     __PHONELOG( EBasic, EPhoneUIView,
       
  3203         "CPhoneViewController::UpdateAudioAvailabilityOptions()" );
       
  3204 
       
  3205     TPhoneCmdParamBoolean wiredAvailableParam;
       
  3206     TPhoneCmdParamBoolean btAvailableParam;
       
  3207 
       
  3208     TPhoneCmdParamAudioAvailability* outputParam =
       
  3209         static_cast<TPhoneCmdParamAudioAvailability*>( aCommandParam );
       
  3210 
       
  3211     wiredAvailableParam.SetBoolean(
       
  3212         outputParam->IsWiredAccAvailable() );
       
  3213 
       
  3214     btAvailableParam.SetBoolean(
       
  3215         outputParam->IsBTAccAvailable());
       
  3216 
       
  3217     // Wired options
       
  3218     iMenuController->SetWiredAccAvailableFlag( &wiredAvailableParam );
       
  3219 
       
  3220     // btaa menu options
       
  3221     iMenuController->SetBTAccAvailableFlag( &btAvailableParam );
       
  3222 
       
  3223     if ( iButtonsController )
       
  3224         {
       
  3225         iButtonsController->SetBTAccAvailableFlag( &btAvailableParam );
       
  3226         iButtonsController->ReplaceAudioButton();
       
  3227         }
       
  3228 
       
  3229     __PHONELOG2(
       
  3230         EBasic,
       
  3231         EPhoneUIView,
       
  3232         "CPhoneViewController::UpdateAudioAvailabilityOptions( BT: (%d), Wired: (%d) ) )",
       
  3233         btAvailableParam.Boolean(),
       
  3234         wiredAvailableParam.Boolean() );
       
  3235     }
       
  3236 
       
  3237 
       
  3238 // ---------------------------------------------------------------------------
       
  3239 // CPhoneViewController::LaunchRfsL
       
  3240 // ---------------------------------------------------------------------------
       
  3241 //
       
  3242 void CPhoneViewController::LaunchRfsL( TBool aDeepRfs )
       
  3243     {
       
  3244     __LOGMETHODSTARTEND(EPhoneUIView,
       
  3245         "CPhoneViewController::LaunchRfsL()" );
       
  3246     CPhCntRfsHandler::TRfsCommand command;
       
  3247     if ( !iRfsHandler )
       
  3248         {
       
  3249         iRfsHandler = iContactController->CreateRfsHandlerL();
       
  3250         }
       
  3251 
       
  3252     if( aDeepRfs )
       
  3253         {
       
  3254         command = CPhCntRfsHandler::ERfsCmdActivateDeep;
       
  3255         }
       
  3256     else
       
  3257         {
       
  3258         command = CPhCntRfsHandler::ERfsCmdActivateNormal;
       
  3259         }
       
  3260 
       
  3261     // Indicate that the rfs dialog is blocking key
       
  3262     // events from the Phone
       
  3263     iBlockingDialogIsDisplayed = ETrue;
       
  3264 
       
  3265     TRAPD( err,
       
  3266         {
       
  3267         if ( iDialer )
       
  3268             {
       
  3269             ExecuteCommandL( EPhoneViewClearNumberEntryContent );
       
  3270             }
       
  3271         else
       
  3272             {
       
  3273             // Remove number entry
       
  3274             ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
  3275             }
       
  3276 
       
  3277         iRfsHandler->ProcessCommandL( command );
       
  3278         })
       
  3279     delete iRfsHandler;
       
  3280     iRfsHandler = NULL;
       
  3281 
       
  3282     iBlockingDialogIsDisplayed = EFalse;
       
  3283     User::LeaveIfError( err );
       
  3284     }
       
  3285 
       
  3286 // ---------------------------------------------------------------------------
       
  3287 // CPhoneViewController::OpenSoftRejectMessageEditorL
       
  3288 // ---------------------------------------------------------------------------
       
  3289 //
       
  3290 void CPhoneViewController::OpenSoftRejectMessageEditorL(
       
  3291     TPhoneCommandParam* aCommandParam )
       
  3292     {
       
  3293     __LOGMETHODSTARTEND(EPhoneUIView,
       
  3294         "CPhoneViewController::OpenSoftRejectMessageEditorL ()" );
       
  3295 
       
  3296     TPhoneCmdParamSfiData* sfiParam =
       
  3297         static_cast<TPhoneCmdParamSfiData*>( aCommandParam );
       
  3298 
       
  3299     CMessageData* messageData = CMessageData::NewL();
       
  3300     CleanupStack::PushL( messageData );
       
  3301 
       
  3302     // Get message body
       
  3303     HBufC* softRejectTxt = HBufC::NewLC( KPhoneSMSLength );
       
  3304     TPtr string( softRejectTxt->Des() );
       
  3305 
       
  3306     TInt softRejectDefaultInUseValue = 0;
       
  3307     const TInt err = CPhoneCenRepProxy::Instance()->GetInt(
       
  3308         KCRUidTelephonySettings,
       
  3309         KSettingsSoftRejectDefaultInUse,
       
  3310         softRejectDefaultInUseValue );
       
  3311 
       
  3312     if ( err == KErrNone && softRejectDefaultInUseValue )
       
  3313         {
       
  3314         // Default txt used or not
       
  3315         CPhoneCenRepProxy::Instance()->GetString(
       
  3316             KCRUidTelephonySettings,
       
  3317             KSettingsSoftRejectText,
       
  3318             string );
       
  3319         }
       
  3320     else
       
  3321         {
       
  3322 
       
  3323         TParse fp;
       
  3324         fp.Set( KPhoneSoftRejectResource, &KDC_RESOURCE_FILES_DIR, NULL );
       
  3325         TFileName name( fp.FullName() );
       
  3326         // Open soft reject resource file
       
  3327         RConeResourceLoader coneResourceLoader( iEikEnv );
       
  3328         TInt softRejectResourceError = coneResourceLoader.Open( name );
       
  3329         if ( softRejectResourceError != KErrNone )
       
  3330             {
       
  3331             // Indicate that the soft reject feature cannot be enabled
       
  3332             Panic( EPhoneViewErrorInAddingResourceFile );
       
  3333             }
       
  3334 
       
  3335         CleanupStack::PopAndDestroy( softRejectTxt );
       
  3336         softRejectTxt = StringLoader::LoadLC( R_SOFT_REJECT_DEFAULT_TXT );
       
  3337         string.Set( softRejectTxt->Des() );
       
  3338         coneResourceLoader.Close();
       
  3339         }
       
  3340 
       
  3341     CRichText* text = CRichText::NewL(
       
  3342         iEikEnv.SystemParaFormatLayerL(),
       
  3343         iEikEnv.SystemCharFormatLayerL());
       
  3344     CleanupStack::PushL( text );
       
  3345     text->Reset();
       
  3346     text->InsertL( 0, string );
       
  3347 
       
  3348     // Set body text
       
  3349     messageData->SetBodyTextL( text );
       
  3350 
       
  3351     // store the remote caller's info
       
  3352     if ( sfiParam->Name().Length() )
       
  3353         {
       
  3354         // store both the name and the number
       
  3355         messageData->AppendToAddressL(
       
  3356             sfiParam->Number(), sfiParam->Name() );
       
  3357         }
       
  3358     else
       
  3359         {
       
  3360         // store the number
       
  3361         messageData->AppendToAddressL(
       
  3362             sfiParam->Number() );
       
  3363         }
       
  3364 
       
  3365     // Inform SysAp not to re-activate keyguard even if the call ends.
       
  3366     CPhonePubSubProxy::Instance()->ChangePropertyValue(
       
  3367         KPSUidCoreApplicationUIs,
       
  3368         KCoreAppUIsSoftReject,
       
  3369         ECoreAppUIsSoftReject );
       
  3370 
       
  3371     // Launch the Soft Reject message Editor.
       
  3372     TPhoneCmdParamMessageEditor messageEditorParam;
       
  3373     messageEditorParam.SetMessageData( messageData );
       
  3374     OpenMessageEditorL( &messageEditorParam );
       
  3375 
       
  3376     CleanupStack::PopAndDestroy( text );
       
  3377     CleanupStack::PopAndDestroy( softRejectTxt );
       
  3378     CleanupStack::PopAndDestroy( messageData );
       
  3379     }
       
  3380 
       
  3381 // ---------------------------------------------------------------------------
       
  3382 // CPhoneViewController::SendMessageL
       
  3383 // ---------------------------------------------------------------------------
       
  3384 //
       
  3385 void CPhoneViewController::SendMessageL()
       
  3386     {
       
  3387     __LOGMETHODSTARTEND(EPhoneUIView,
       
  3388         "CPhoneViewController::SendMessageL()" );
       
  3389     // get the number entry contents
       
  3390     HBufC *phoneNumber = HBufC::NewLC( KPhoneNumberEntryBufferSize );
       
  3391     TPtr ptr( phoneNumber->Des() );
       
  3392     TPhoneCmdParamString stringParam;
       
  3393     stringParam.SetString( &ptr );
       
  3394     iBubbleWrapper->GetNumberEntryContent( &stringParam );
       
  3395 
       
  3396     // Launch the message Editor.
       
  3397     TPhoneCmdParamMessageEditor messageEditorParam;
       
  3398 
       
  3399     // create the message data
       
  3400     CMessageData* messageData = CMessageData::NewLC();
       
  3401     messageData->AppendToAddressL( ptr );
       
  3402     messageEditorParam.SetMessageData( messageData );
       
  3403 
       
  3404     if ( !iDialer )
       
  3405         {
       
  3406         // Remove number entry from screen
       
  3407         iPhoneView->SetControl( iBubbleWrapper->Control() );
       
  3408         ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
  3409         }
       
  3410 
       
  3411     // Open the message editor
       
  3412     OpenMessageEditorL( &messageEditorParam );
       
  3413 
       
  3414     CleanupStack::PopAndDestroy( messageData );
       
  3415     CleanupStack::PopAndDestroy( phoneNumber );
       
  3416     }
       
  3417 
       
  3418 // ---------------------------------------------------------------------------
       
  3419 // CPhoneViewController::SetSecurityMode
       
  3420 // ---------------------------------------------------------------------------
       
  3421 //
       
  3422 void CPhoneViewController::SetSecurityMode(
       
  3423                                         TPhoneCommandParam* aCommandParam )
       
  3424     {
       
  3425     __LOGMETHODSTARTEND(EPhoneUIView,
       
  3426         "CPhoneViewController::SetSecurityMode()" );
       
  3427     TPhoneCmdParamBoolean* booleanParam = static_cast<TPhoneCmdParamBoolean*>(
       
  3428         aCommandParam );
       
  3429     iPhoneView->SetSecurityMode( booleanParam->Boolean() );
       
  3430     iStatusPane->StatusPane().MakeVisible( !booleanParam->Boolean() );
       
  3431     }
       
  3432 
       
  3433 // -----------------------------------------------------------
       
  3434 // CPhoneViewController::SetStatusPaneVisible
       
  3435 // -----------------------------------------------------------
       
  3436 //
       
  3437 void CPhoneViewController::SetStatusPaneVisible(
       
  3438                                         TPhoneCommandParam* aCommandParam )
       
  3439     {
       
  3440     __LOGMETHODSTARTEND(EPhoneUIView,
       
  3441         "CPhoneViewController::SetStatusPaneVisible()" );
       
  3442     TPhoneCmdParamBoolean* booleanParam = static_cast<TPhoneCmdParamBoolean*>(
       
  3443         aCommandParam );
       
  3444     iStatusPane->StatusPane().MakeVisible( booleanParam->Boolean() );
       
  3445     }
       
  3446 
       
  3447 // ---------------------------------------------------------------------------
       
  3448 // CPhoneViewController::UpdateFSW()
       
  3449 // ---------------------------------------------------------------------------
       
  3450 //
       
  3451 void CPhoneViewController::UpdateFSW()
       
  3452     {
       
  3453     __LOGMETHODSTARTEND( EPhoneUIView, "CPhoneViewController::UpdateFSW()" );
       
  3454     iAknUiServerClient->UpdateTaskList();
       
  3455     }
       
  3456 
       
  3457 // ---------------------------------------------------------------------------
       
  3458 // CPhoneViewController::CreateSpeedDialControllerL
       
  3459 // ---------------------------------------------------------------------------
       
  3460 //
       
  3461 void CPhoneViewController::CreateSpeedDialControllerL()
       
  3462   {
       
  3463     __LOGMETHODSTARTEND( EPhoneUIView,
       
  3464         "CPhoneViewController::CreateSpeedDialControllerL()" );
       
  3465   if( !iSpeedDialController )
       
  3466         {
       
  3467         iSpeedDialController = iContactController->CreateSpeedDialMonitorL();
       
  3468         }
       
  3469 
       
  3470     if( !iVmbxHandler )
       
  3471         {
       
  3472         iVmbxHandler = CPhoneVmbxHandler::NewL();
       
  3473         }
       
  3474   }
       
  3475 
       
  3476 // ---------------------------------------------------------------------------
       
  3477 // CPhoneViewController::IsReplaceAllowed()
       
  3478 // ---------------------------------------------------------------------------
       
  3479 //
       
  3480 TBool CPhoneViewController::IsReplaceAllowed()
       
  3481     {
       
  3482     __LOGMETHODSTARTEND( EPhoneUIView,
       
  3483                          "CPhoneViewController::IsReplaceAllowed()");
       
  3484 
       
  3485     TPhoneCmdParamCallStateData callStateData;
       
  3486     callStateData.SetCallState( EPEStateConnected );
       
  3487     iBubbleWrapper->GetCallIdByState( &callStateData );
       
  3488     TInt connected = callStateData.CallId();
       
  3489 
       
  3490     callStateData.SetCallState( EPEStateRinging );
       
  3491     iBubbleWrapper->GetCallIdByState( &callStateData );
       
  3492     TInt waiting = callStateData.CallId();
       
  3493 
       
  3494     return // both video or
       
  3495         (( connected == KVideoTelephonyCallId1 ||
       
  3496            connected == KVideoTelephonyCallId2 ) &&
       
  3497 
       
  3498          ( waiting == KVideoTelephonyCallId1 ||
       
  3499            waiting == KVideoTelephonyCallId2 )) ||
       
  3500 
       
  3501            // both voice ( including active conference )
       
  3502         ((( connected >= KVoiceCallIdFirst &&
       
  3503             connected < KEmergencyCallId ) ||
       
  3504             connected == KConferenceCallId ) &&
       
  3505 
       
  3506          ( waiting >= KVoiceCallIdFirst &&
       
  3507            waiting < KEmergencyCallId ));
       
  3508     }
       
  3509 
       
  3510 
       
  3511 // ---------------------------------------------------------------------------
       
  3512 // CPhoneViewController::SingleItemFetchL()
       
  3513 // ---------------------------------------------------------------------------
       
  3514 //
       
  3515 void CPhoneViewController::SingleItemFetchL()
       
  3516     {
       
  3517     __LOGMETHODSTARTEND(EPhoneUIView,
       
  3518         "CPhoneViewController::SingleItemFetchL()" );
       
  3519 
       
  3520     TPhoneCmdParamInteger integerParam;
       
  3521     integerParam.SetInteger( EPhoneNewCallFetchTitle );
       
  3522 
       
  3523     // Make sure the dialog is not ended prematurely
       
  3524     HandleCommandL(
       
  3525         EPhoneViewOpenSingleItemFetchDialog,
       
  3526         &integerParam );
       
  3527     }
       
  3528 
       
  3529 // ---------------------------------------------------------------------------
       
  3530 // CPhoneViewController::SetFetchContent
       
  3531 // ---------------------------------------------------------------------------
       
  3532 //
       
  3533 void CPhoneViewController::SetFetchContent( TDesC& aFetchContent )
       
  3534     {
       
  3535     __LOGMETHODSTARTEND(EPhoneUIView,
       
  3536         "CPhoneViewController::SetFetchContent()" );
       
  3537     iFetchContent = aFetchContent;
       
  3538     }
       
  3539 
       
  3540 // ---------------------------------------------------------------------------
       
  3541 // CPhoneViewController::FetchContent
       
  3542 // ---------------------------------------------------------------------------
       
  3543 //
       
  3544 EXPORT_C const TDesC& CPhoneViewController::FetchContent()
       
  3545    {
       
  3546    __LOGMETHODSTARTEND(EPhoneUIView,
       
  3547        "CPhoneViewController::FetchContent()" );
       
  3548    return iFetchContent;
       
  3549    }
       
  3550 
       
  3551 // ---------------------------------------------------------------------------
       
  3552 // CPhoneViewController::SetSingleItemFetchType
       
  3553 // -----------------------------------------------------------
       
  3554 //
       
  3555 void CPhoneViewController::SetSingleItemFetchType( TInt aType )
       
  3556     {
       
  3557     __LOGMETHODSTARTEND(EPhoneUIView,
       
  3558         "CPhoneViewController::SetSingleItemFetchType()" );
       
  3559     iSingleItemFetchType = aType;
       
  3560     }
       
  3561 
       
  3562 // -----------------------------------------------------------
       
  3563 // CPhoneViewController::SingleItemFetchType
       
  3564 // -----------------------------------------------------------
       
  3565 //
       
  3566 TInt CPhoneViewController::SingleItemFetchType() const
       
  3567    {
       
  3568    __LOGMETHODSTARTEND(EPhoneUIView,
       
  3569        "CPhoneViewController::SingleItemFetchType()" );
       
  3570 
       
  3571    return iSingleItemFetchType;
       
  3572    }
       
  3573 
       
  3574 // ---------------------------------------------------------------------------
       
  3575 // CPhoneViewController::SwitchLayoutToFlatStatusPaneL
       
  3576 // ---------------------------------------------------------------------------
       
  3577 //
       
  3578 void CPhoneViewController::SwitchLayoutToFlatStatusPaneL( TBool aSwitch )
       
  3579     {
       
  3580     __LOGMETHODSTARTEND(EPhoneUIView,
       
  3581         "CPhoneViewController::SwitchLayoutToFlatStatusPaneL()" );
       
  3582 
       
  3583     TInt currentLayout = iStatusPane->StatusPane().CurrentLayoutResId();
       
  3584 
       
  3585     if ( aSwitch )
       
  3586         {
       
  3587         // If current layout is different than flat layout then we
       
  3588         // need to do PushDefault for navipane and SwitchLayoutL for
       
  3589         // statuspane.
       
  3590         if ( currentLayout != R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ||
       
  3591              currentLayout != R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL )
       
  3592             {
       
  3593             SwapEmptyIndicatorPaneInSecureStateL( ETrue );
       
  3594 
       
  3595             // Push default so that Operator name can be shown in title pane.
       
  3596             iStatusPane->NaviPane().PushDefaultL();
       
  3597 
       
  3598             if ( !Layout_Meta_Data::IsLandscapeOrientation() )
       
  3599                 {
       
  3600                 iStatusPane->StatusPane().SwitchLayoutL
       
  3601                 ( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT );
       
  3602                 }
       
  3603             else
       
  3604                 {
       
  3605                 iStatusPane->StatusPane().SwitchLayoutL
       
  3606                 ( R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL );
       
  3607                 }
       
  3608             }
       
  3609         }
       
  3610     else
       
  3611         {
       
  3612         // If current layout is flat layout then do Pop for navipane,
       
  3613         // layout is something else there is no need to do Pop and
       
  3614         // SwitchLayoutL for statuspane.
       
  3615         if ( currentLayout == R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ||
       
  3616              currentLayout == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL )
       
  3617             {
       
  3618             SwapEmptyIndicatorPaneInSecureStateL( EFalse );
       
  3619 
       
  3620             iStatusPane->NaviPane().Pop();
       
  3621 
       
  3622             if ( !Layout_Meta_Data::IsLandscapeOrientation() )
       
  3623                 {
       
  3624                 iStatusPane->StatusPane().SwitchLayoutL
       
  3625                         ( R_AVKON_STATUS_PANE_LAYOUT_IDLE );
       
  3626                 }
       
  3627             else
       
  3628                 {
       
  3629                 iStatusPane->StatusPane().SwitchLayoutL
       
  3630                         ( R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE );
       
  3631                 }
       
  3632             }
       
  3633         }
       
  3634     // ApplyCurrentSettingsL is called whenever statuspane
       
  3635     // visibility status or pane layout changes.
       
  3636     iStatusPane->StatusPane().ApplyCurrentSettingsL();
       
  3637     iStatusPane->StatusPane().DrawNow();
       
  3638     }
       
  3639 
       
  3640 // ---------------------------------------------------------------------------
       
  3641 // CPhoneViewController::SwapEmptyIndicatorPaneInSecureStateL
       
  3642 // ---------------------------------------------------------------------------
       
  3643 //
       
  3644 void CPhoneViewController::SwapEmptyIndicatorPaneInSecureStateL(
       
  3645                                     const TBool aSwapEmpty )
       
  3646     {
       
  3647     __LOGMETHODSTARTEND(EPhoneUIView,
       
  3648         "CPhoneViewController::SwapEmptyIndicatorPaneInSecureStateL()" );
       
  3649 
       
  3650     TPhoneCmdParamBoolean security;
       
  3651     GetSecurityModeStatus( &security );
       
  3652 
       
  3653     if ( security.Boolean() )
       
  3654         {
       
  3655         if ( aSwapEmpty )
       
  3656             {
       
  3657             if ( !iIndiContainer )
       
  3658                 {
       
  3659                 iIndiContainer =
       
  3660                 iStatusPane->CreateEmptyIndicatorContainerL();
       
  3661                 }
       
  3662             //Save previous indicator control
       
  3663             iPreviousIndicatorControl =
       
  3664                                     iStatusPane->StatusPane().SwapControlL(
       
  3665             TUid::Uid( EEikStatusPaneUidIndic ), iIndiContainer );
       
  3666             }
       
  3667         else
       
  3668             {
       
  3669             //Restore previous indicator control
       
  3670             iStatusPane->StatusPane().SwapControlL(
       
  3671             TUid::Uid( EEikStatusPaneUidIndic ), iPreviousIndicatorControl );
       
  3672             }
       
  3673         }
       
  3674     }
       
  3675 
       
  3676 
       
  3677 // ---------------------------------------------------------------------------
       
  3678 // CPhoneViewController::HandleTransitionEffect
       
  3679 // ---------------------------------------------------------------------------
       
  3680 //
       
  3681 void CPhoneViewController::HandleTransitionEffect(
       
  3682     TPhoneTransEffectType aType )
       
  3683     {
       
  3684     __LOGMETHODSTARTEND(EPhoneUIView,
       
  3685         "CPhoneViewController::HandleTransitionEffect()" );
       
  3686 
       
  3687     switch ( aType )
       
  3688         {
       
  3689         case EPhoneTransEffectDialerCreate:
       
  3690         case EPhoneTransEffectDialerOpen:
       
  3691             {
       
  3692             GfxTransEffect::BeginFullScreen(
       
  3693                 KTouchDialerOpenEffect,
       
  3694                 TRect(),
       
  3695                 AknTransEffect::EParameterType,
       
  3696                 AknTransEffect::GfxTransParam( KUidPhoneApplication ) );
       
  3697             iEffectOngoing = ETrue;
       
  3698             break;
       
  3699             }
       
  3700         case EPhoneTransEffectDialerClose:
       
  3701             {
       
  3702             GfxTransEffect::BeginFullScreen(
       
  3703                 KTouchDialerCloseEffect,
       
  3704                 TRect(),
       
  3705                 AknTransEffect::EParameterType,
       
  3706                 AknTransEffect::GfxTransParam( KUidPhoneApplication ) );
       
  3707             iEffectOngoing = ETrue;
       
  3708             break;
       
  3709             }
       
  3710         case EPhoneTransEffectStop:
       
  3711             {
       
  3712             if ( iEffectOngoing )
       
  3713                 {
       
  3714                 GfxTransEffect::EndFullScreen();
       
  3715                 iEffectOngoing = EFalse;
       
  3716                 }
       
  3717             break;
       
  3718             }
       
  3719         default:
       
  3720             break;
       
  3721         }
       
  3722     }
       
  3723 
       
  3724 // ---------------------------------------------------------------------------
       
  3725 // CPhoneViewController::SetControltoDialerL
       
  3726 // ---------------------------------------------------------------------------
       
  3727 //
       
  3728 void CPhoneViewController::SetControltoDialerL()
       
  3729     {
       
  3730     __PHONELOG1( EBasic, EPhoneUIView,
       
  3731         "CPhoneViewController::SetControltoDialerL iDialerActive (%d)", iDialerActive );
       
  3732 
       
  3733     if ( !iDialerActive )
       
  3734         {
       
  3735         iDialerActive = ETrue;
       
  3736 
       
  3737         // Make dialer view top most
       
  3738         iDialerView->DrawableWindow()->SetOrdinalPosition(
       
  3739             iPhoneView->DrawableWindow()->OrdinalPosition() );
       
  3740         iDialerView->MakeVisible( ETrue );
       
  3741         iDialerView->DrawNow();
       
  3742 
       
  3743         SwitchLayoutToFlatStatusPaneL( ETrue );
       
  3744 
       
  3745         iPhoneView->DrawableWindow()->SetOrdinalPosition( -1 );
       
  3746         iPhoneView->MakeVisible( EFalse );
       
  3747 
       
  3748         iToolbarController->HideToolbar();
       
  3749         iDialerController->ShowToolbar();
       
  3750 
       
  3751         // Update control stack
       
  3752         iAppui->AddToStackL( iDialerView );
       
  3753 		iAppui->RemoveFromStack( iPhoneView );
       
  3754 		}
       
  3755     }
       
  3756 
       
  3757 // ---------------------------------------------------------------------------
       
  3758 // CPhoneViewController::SetControltoCallHandlingL
       
  3759 // ---------------------------------------------------------------------------
       
  3760 //
       
  3761 void CPhoneViewController::SetControltoCallHandlingL()
       
  3762     {
       
  3763     __PHONELOG1( EBasic, EPhoneUIView,
       
  3764         "CPhoneViewController::SetControltoCallHandlingL iDialerActive (%d)", iDialerActive );
       
  3765 
       
  3766     if ( iDialerActive )
       
  3767         {
       
  3768         iDialerActive = EFalse;
       
  3769 
       
  3770         SwitchLayoutToFlatStatusPaneL( EFalse );
       
  3771 
       
  3772 		// Make call handling view top most
       
  3773 		iPhoneView->DrawableWindow()->SetOrdinalPosition(
       
  3774             iDialerView->DrawableWindow()->OrdinalPosition() );
       
  3775         iPhoneView->MakeVisible( ETrue );
       
  3776         iPhoneView->DrawNow();
       
  3777 
       
  3778 		iDialerView->DrawableWindow()->SetOrdinalPosition( -1 );
       
  3779         iDialerView->MakeVisible( EFalse );
       
  3780 
       
  3781         iDialerController->HideToolbar();
       
  3782 
       
  3783         // Update control stack
       
  3784 		iAppui->AddToStackL( iPhoneView );
       
  3785 		iAppui->RemoveFromStack( iDialerView );
       
  3786 		}
       
  3787 	if ( !iPhoneView->IsSecurityMode() )
       
  3788 		{
       
  3789     	iToolbarController->ShowToolbar();
       
  3790 		}
       
  3791     }
       
  3792 
       
  3793 // ---------------------------------------------------------------------------
       
  3794 // CPhoneViewController::SetDialerControlAndVisibilityL
       
  3795 // ---------------------------------------------------------------------------
       
  3796 //
       
  3797 void CPhoneViewController::SetDialerControlAndVisibilityL()
       
  3798     {
       
  3799     __PHONELOG( EBasic, EPhoneUIView,
       
  3800         "CPhoneViewController::SetDialerControlAndVisibilityL" );
       
  3801 
       
  3802     if ( iBubbleWrapper->IsNumberEntryUsed() )
       
  3803         {
       
  3804         if ( !iSendBack )
       
  3805             {
       
  3806             SetControltoDialerL();
       
  3807             // Reset flag to default value.
       
  3808             iSendBack = ETrue;
       
  3809             }
       
  3810         // next active phone app view is dialer.
       
  3811         iPhoneView->SetPhoneAppViewToDialer( ETrue );
       
  3812         }
       
  3813     else
       
  3814         {
       
  3815         // Reset flag.
       
  3816         iPhoneView->SetPhoneAppViewToDialer( EFalse );
       
  3817         }
       
  3818     }
       
  3819 
       
  3820 // ---------------------------------------------------------------------------
       
  3821 // CPhoneViewController::CapturePointerEvents
       
  3822 // ---------------------------------------------------------------------------
       
  3823 //
       
  3824 void CPhoneViewController::CapturePointerEvents(
       
  3825                                     TPhoneCommandParam* aCommandParam )
       
  3826     {
       
  3827     __LOGMETHODSTARTEND(EPhoneUIView,
       
  3828         "CPhoneViewController::CapturePointerEvents()" );
       
  3829     TPhoneCmdParamBoolean* booleanParam = static_cast<TPhoneCmdParamBoolean*>(
       
  3830         aCommandParam );
       
  3831     iPhoneView->CapturePointerEvents( booleanParam->Boolean() );
       
  3832     }
       
  3833 
       
  3834 // ---------------------------------------------------------------------------
       
  3835 // CPhoneViewController::AllowWaitingCallHeaderL
       
  3836 // ---------------------------------------------------------------------------
       
  3837 //
       
  3838 void CPhoneViewController::AllowWaitingCallHeaderL(
       
  3839                                            TPhoneCommandParam* aCommandParam )
       
  3840     {
       
  3841     __LOGMETHODSTARTEND(EPhoneUIView,
       
  3842         "CPhoneViewController::AllowWaitingCallHeaderL()" );
       
  3843 
       
  3844     TPhoneCmdParamBoolean* booleanParam =
       
  3845         static_cast<TPhoneCmdParamBoolean*>( aCommandParam );
       
  3846 
       
  3847     // Phone in foreground and control is in dialer ->
       
  3848     //do not show waiting call header.
       
  3849     if ( ( ( ApplicationWindowGroupId() ==
       
  3850              ForegroundApplicationWindowGroupId() ) &&
       
  3851          ( iDialerActive ) ) )
       
  3852         {
       
  3853         booleanParam->SetBoolean( EFalse );
       
  3854         }
       
  3855     // Phone isnt in foreground but since control is in dialer and save add to
       
  3856     // name service is active -> do not show waiting call header.
       
  3857     else if ( ( ( ApplicationWindowGroupId() !=
       
  3858                   ForegroundApplicationWindowGroupId() ) &&
       
  3859               ( iDialerActive ) && iContactSaveAddToName ) )
       
  3860         {
       
  3861         booleanParam->SetBoolean( EFalse );
       
  3862         }
       
  3863     // If Phone is in foreground and control is in bubble we need to check
       
  3864     // query status -> if query is active do not show waiting call header, if
       
  3865     // query is not active then show waiting call header.
       
  3866     else if ( ( ( ApplicationWindowGroupId() ==
       
  3867                   ForegroundApplicationWindowGroupId() ) &&
       
  3868               ( !iDialerActive ) ) )
       
  3869         {
       
  3870         TPhoneCmdParamBoolean isQueryDisplayed;
       
  3871         // Check is query displayed
       
  3872         ExecuteCommandL( EPhoneViewIsQuery, &isQueryDisplayed );
       
  3873 
       
  3874         if ( isQueryDisplayed.Boolean() )
       
  3875             {
       
  3876             booleanParam->SetBoolean( EFalse );
       
  3877             }
       
  3878         else
       
  3879             {
       
  3880             booleanParam->SetBoolean( ETrue );
       
  3881             }
       
  3882         }
       
  3883     // Phone isnt in foreground but since control is in bubble and single item
       
  3884     // service is active(note! iBlockingDialogIsDisplayed must be true if it
       
  3885     // not then iSingleItemFetch is not active anymore) -> do not show waiting
       
  3886     // call header.
       
  3887     else if ( ( ( ApplicationWindowGroupId() !=
       
  3888                   ForegroundApplicationWindowGroupId() ) &&
       
  3889               ( !iDialerActive ) &&
       
  3890               ( iSingleItemFetch && iBlockingDialogIsDisplayed ) ) )
       
  3891         {
       
  3892         booleanParam->SetBoolean( EFalse );
       
  3893         }
       
  3894     }
       
  3895 
       
  3896 // ---------------------------------------------------------------------------
       
  3897 // CPhoneViewController::NumberEntryChangedHandler
       
  3898 // ---------------------------------------------------------------------------
       
  3899 //
       
  3900 MPhoneNumberEntryChangedHandler* CPhoneViewController::NumberEntryChangedHandler() const
       
  3901     {
       
  3902     if( iDialerController )
       
  3903         return iDialerController;
       
  3904     else
       
  3905         return iBubbleWrapper;
       
  3906 
       
  3907     }
       
  3908 
       
  3909 // End of File