phoneapp/phoneuicontrol/src/tphonetransitionhandler.cpp
branchRCL_3
changeset 81 c26cc2a7c548
parent 73 e30d4a1b8bad
child 82 b49b5af297a7
equal deleted inserted replaced
73:e30d4a1b8bad 81:c26cc2a7c548
     1 /*
       
     2 * Copyright (c) 2010 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: Class handles phoneapp internal/external transitions.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "tphonetransitionhandler.h"
       
    19 #include "cphonestate.h"
       
    20 #include "phonelogger.h"
       
    21 
       
    22 // ---------------------------------------------------------------------------
       
    23 // TPhoneTransitionHandler::TPhoneTransitionHandler
       
    24 // ---------------------------------------------------------------------------
       
    25 //
       
    26 TPhoneTransitionHandler::TPhoneTransitionHandler(
       
    27         CPhoneState& aState,
       
    28         MPhoneViewCommandHandle& aViewCommandHandle )
       
    29    : iState ( aState ), 
       
    30      iViewCommandHandle ( aViewCommandHandle )
       
    31     {
       
    32     __LOGMETHODSTARTEND( EPhoneControl, 
       
    33             "TPhoneTransitionHandler::TPhoneTransitionHandler( ) ");
       
    34     }
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 // TPhoneTransitionHandler::BeginUiUpdateLC
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 EXPORT_C void TPhoneTransitionHandler::BeginUiUpdateLC()
       
    41     {
       
    42     __LOGMETHODSTARTEND( EPhoneControl, 
       
    43             "TPhoneTransitionHandler::BeginUiUpdateLC( ) ");
       
    44     iViewCommandHandle.ExecuteCommand( EPhoneViewBeginUpdate );
       
    45     TCleanupItem operation( UiUpdateCleanup, this );
       
    46     CleanupStack::PushL( operation );
       
    47     }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // TPhoneTransitionHandler::EndUiUpdate
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 EXPORT_C void TPhoneTransitionHandler::EndUiUpdate()
       
    54     {
       
    55     __LOGMETHODSTARTEND( EPhoneControl, 
       
    56             "TPhoneTransitionHandler::EndUiUpdate( ) ");
       
    57     CleanupStack::PopAndDestroy(); // Call UiUpdateCleanup
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // TPhoneTransitionHandler::IncomingCallUiUpdateLC
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 EXPORT_C void TPhoneTransitionHandler::IncomingCallUiUpdateLC()
       
    65     {
       
    66     __LOGMETHODSTARTEND( EPhoneControl, 
       
    67             "TPhoneTransitionHandler::IncomingCallUiUpdateLC( ) ");
       
    68     iState.IsNumberEntryUsedL() ?
       
    69         BeginTransEffectLC( EPhoneTransEffectCallUiAppear ) :
       
    70         BeginTransEffectLC( EPhoneTransEffectPhoneUiOpen );
       
    71     BeginUiUpdateLC();
       
    72     }
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // TPhoneTransitionHandler::IdleCallUiUpdateLC
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 EXPORT_C void TPhoneTransitionHandler::IdleCallUiUpdateLC()
       
    79     {
       
    80     __LOGMETHODSTARTEND( EPhoneControl, "TPhoneTransitionHandler::IdleCallUiUpdateLC( ) ");
       
    81     iState.IsNumberEntryUsedL() ?
       
    82         BeginTransEffectLC( EPhoneTransEffectCallUiDisappear ) :
       
    83         BeginTransEffectLC( EPhoneTransEffectPhoneUiClose );
       
    84     BeginUiUpdateLC();
       
    85     }
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // TPhoneTransitionHandler::EndUiUpdateAndEffect
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 EXPORT_C void TPhoneTransitionHandler::EndUiUpdateAndEffect()
       
    92     {
       
    93     __LOGMETHODSTARTEND( EPhoneControl, 
       
    94             "TPhoneTransitionHandler::EndUiUpdateAndEffect( ) ");
       
    95     EndUiUpdate();
       
    96     EndTransEffect();
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // TPhoneTransitionHandler::BeginTransEffectLC
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 EXPORT_C void TPhoneTransitionHandler::BeginTransEffectLC( TPhoneTransEffectType aType )
       
   104     {
       
   105     __LOGMETHODSTARTEND( EPhoneControl, 
       
   106             "TPhoneTransitionHandler::BeginTransEffectLC( ) ");
       
   107     TPhoneCmdParamTransEffect effectParam;
       
   108     effectParam.SetType( aType );
       
   109     effectParam.SetAppUid( KUidPhoneApplication );
       
   110     iViewCommandHandle.ExecuteCommand( 
       
   111             EPhoneViewBeginTransEffect, 
       
   112             &effectParam );
       
   113     // Always put the cleanup item into stack as expected by the caller.
       
   114     TCleanupItem operation( EffectCleanup, this );
       
   115     CleanupStack::PushL( operation );
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // TPhoneTransitionHandler::EndTransEffect
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 EXPORT_C void TPhoneTransitionHandler::EndTransEffect()
       
   123     {
       
   124     __LOGMETHODSTARTEND( EPhoneControl,
       
   125             "TPhoneTransitionHandler::EndTransEffect( ) ");
       
   126     CleanupStack::PopAndDestroy(); // Call EffectCleanup
       
   127     }
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // TPhoneTransitionHandler::UiUpdateCleanup
       
   131 // -----------------------------------------------------------------------------
       
   132 //
       
   133 void TPhoneTransitionHandler::UiUpdateCleanup(TAny* aThis )
       
   134     {
       
   135     __LOGMETHODSTARTEND( EPhoneControl, 
       
   136             "TPhoneTransitionHandler::UiUpdateCleanup( ) ");
       
   137     static_cast<TPhoneTransitionHandler*>( aThis )->
       
   138             iViewCommandHandle.ExecuteCommand( EPhoneViewEndUpdate );
       
   139     }
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // TPhoneTransitionHandler::EffectCleanup
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 void TPhoneTransitionHandler::EffectCleanup(TAny* aThis )
       
   146     {
       
   147     __LOGMETHODSTARTEND( EPhoneControl, 
       
   148             "TPhoneTransitionHandler::EffectCleanup( ) ");
       
   149     TPhoneCmdParamTransEffect effectParam;
       
   150     effectParam.SetType( EPhoneTransEffectStop );
       
   151     // won't do anything if effect wasn't started
       
   152     static_cast<TPhoneTransitionHandler*>( aThis )->
       
   153             iViewCommandHandle.ExecuteCommand( 
       
   154                     EPhoneViewEndTransEffect, &effectParam );
       
   155     }
       
   156