emailuis/emailui/inc/ceuiexitguardian.h
branchRCL_3
changeset 64 3533d4323edc
equal deleted inserted replaced
63:d189ee25cf9d 64:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  FreestyleEmailUi exit guardian.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_EUIEXITGUARDIAN_H
       
    19 #define C_EUIEXITGUARDIAN_H
       
    20 
       
    21 #include <e32base.h>
       
    22 
       
    23 // FORWARD DECLARATIONS
       
    24 class CFreestyleEmailUiAppUi;
       
    25 /**
       
    26  * Application exit guardian for email UI. This is needed because some routines
       
    27  * in email framework create nested scheduler loops to hide asynchronity in
       
    28  * them. When application is shutdown these nested levels may cause crashes
       
    29  * as resources are freed while they are still being used on other recursion
       
    30  * levels.
       
    31  *
       
    32  *
       
    33  * @since S60 5.1
       
    34  */
       
    35 class CEUiExitGuardian : public CBase
       
    36     {
       
    37 
       
    38 public:
       
    39 
       
    40     /**
       
    41      * Leave safe construction for CEuiExitGuardian.
       
    42      * @return Newly created instance of CEuiExitGuardian
       
    43      */
       
    44     static CEUiExitGuardian* NewL(CFreestyleEmailUiAppUi& aAppUi);
       
    45 
       
    46     /**
       
    47      * Destructor.
       
    48      */
       
    49     ~CEUiExitGuardian();
       
    50 
       
    51 
       
    52     /**
       
    53      * Called by the application to inform that application is ready to
       
    54      * exit. If there is any nested active scheduler levels (i.e. recursion),
       
    55      * exit execution will be delayed until every nested level has returned.
       
    56      *
       
    57      * @return KRequestPending if the exit execution is delayed because of
       
    58      * nesting, KErrNone otherwise.
       
    59      */
       
    60     TInt TryExitApplication();
       
    61 
       
    62 private:
       
    63     /**
       
    64      * Constructor.
       
    65      */
       
    66     CEUiExitGuardian( CFreestyleEmailUiAppUi& aAppUi );
       
    67 
       
    68     /**
       
    69      * Pass 2 constructor, may leave.
       
    70      */
       
    71     void ConstructL();
       
    72 
       
    73     /**
       
    74      * Static callback method for CPeriodic.
       
    75      */
       
    76     static TInt PeriodicCallBack( TAny* aPtr );
       
    77 
       
    78 private:
       
    79     // Reference to application UI
       
    80     CFreestyleEmailUiAppUi& iAppUi;
       
    81     TBool iPeriodicTimerStarted;
       
    82     CPeriodic* iPeriodicTimer;
       
    83     };
       
    84 
       
    85 #endif // C_EUIEXITGUARDIAN_H