appinstaller/AppMngr2/src/appmngr2exittimer.cpp
branchRCL_3
changeset 25 7333d7932ef7
parent 24 5cc91383ab1e
child 26 8b7f4e561641
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
     1 /*
       
     2 *
       
     3 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 * All rights reserved.
       
     5 * This component and the accompanying materials are made available
       
     6 * under the terms of "Eclipse Public License v1.0"
       
     7 * which accompanies this distribution, and is available
       
     8 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9 *
       
    10 * Initial Contributors:
       
    11 * Nokia Corporation - initial contribution.
       
    12 *
       
    13 * Contributors:
       
    14 *
       
    15 * Description:   This file contains the implementation of CAppMngr2ExitTimer
       
    16 *                class member functions.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include <appmngr2runtime.h>            // FLOG macros
       
    24 #include <appmngr2debugutils.h>         // FLOG macros
       
    25 #include "appmngr2exittimer.h"
       
    26 #include "appmngr2appui.h"              // CAppMngr2AppUi
       
    27 
       
    28 const TInt KAppMngr2ExitDelayInterval = 1000000; // 1,0 sec
       
    29 
       
    30 // ============================ MEMBER FUNCTIONS ===============================
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // CAppMngr2ExitTimer::CAppMngr2ExitTimer
       
    34 // C++ default constructor can NOT contain any code, that might leave.
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CAppMngr2ExitTimer::CAppMngr2ExitTimer( CAppMngr2AppUi* aAppUi )
       
    38     : CTimer( CActive::EPriorityHigh ),
       
    39     iAppUi( aAppUi )
       
    40     {
       
    41     FLOG( "CAppMngr2ExitTimer::CAppMngr2ExitTimer" );
       
    42     CActiveScheduler::Add( this );    
       
    43     }
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // CAppMngr2ExitTimer::ConstructL
       
    47 // Symbian 2nd phase constructor can leave.
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 void CAppMngr2ExitTimer::ConstructL()
       
    51     {    
       
    52     CTimer::ConstructL();      
       
    53     }
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CAppMngr2ExitTimer::NewL
       
    57 // Two-phased constructor.
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 EXPORT_C CAppMngr2ExitTimer* CAppMngr2ExitTimer::NewL( CAppMngr2AppUi* aAppUi )
       
    61     {
       
    62     CAppMngr2ExitTimer* self = new( ELeave ) CAppMngr2ExitTimer( aAppUi );
       
    63     CleanupStack::PushL( self );
       
    64     self->ConstructL();
       
    65     CleanupStack::Pop( self );
       
    66     return self;    
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CAppMngr2ExitTimer::Destructor
       
    71 // 
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 EXPORT_C CAppMngr2ExitTimer::~CAppMngr2ExitTimer()
       
    75     {
       
    76     FLOG( "CAppMngr2ExitTimer::~CAppMngr2ExitTimer" );
       
    77     CTimer::Cancel();    
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CAppMngr2ExitTimer::StartExitTimer
       
    82 // 
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 EXPORT_C void CAppMngr2ExitTimer::StartExitTimer()
       
    86     {
       
    87     FLOG( "CAppMngr2ExitTimer::StartExitTimer" );
       
    88     FLOG( "CAppMngr2ExitTimer After = %d", KAppMngr2ExitDelayInterval );
       
    89     TTimeIntervalMicroSeconds32 timeout( KAppMngr2ExitDelayInterval );    
       
    90     After( timeout );
       
    91     FLOG( "CAppMngr2ExitTimer::StartExitTimer END" );
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CAppMngr2ExitTimer::RunL
       
    96 //
       
    97 // -----------------------------------------------------------------------------
       
    98 //    
       
    99 void CAppMngr2ExitTimer::RunL()
       
   100     {
       
   101     FLOG( "CAppMngr2ExitTimer::RunL START" );
       
   102     // Exit will leave but this is handled in RunError function.    
       
   103     FLOG( "CAppMngr2ExitTimer::RunL: iAppUi->Exit()" );
       
   104     iAppUi->Exit();       
       
   105     FLOG( "CAppMngr2ExitTimer::RunL END" );
       
   106     }
       
   107 
       
   108 // -----------------------------------------------------------------------------
       
   109 // CAppMngr2ExitTimer::RunError
       
   110 // 
       
   111 // -----------------------------------------------------------------------------
       
   112 // 
       
   113 TInt CAppMngr2ExitTimer::RunError( TInt aError )
       
   114     {
       
   115     // RunL will leave with the error -1003 KLeaveExit and RunError
       
   116     // needs to return this error to CActiveScheduler which will then
       
   117     // make exit leave in CBaActiveScheduler::Error function.
       
   118     FLOG( "CAppMngr2ExitTimer::RunError error = %d", aError );     
       
   119     return aError;    
       
   120     }
       
   121 
       
   122 //  End of File