appsupport_plat/restore_factory_settings_api/inc/rfsHandler.h
changeset 0 2e3d3ce01487
child 21 c4cbaa4fb734
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2002-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: 
       
    15 *
       
    16 *     This class provides UI for RFS activation. The process can be canceled
       
    17 *     from any active object's RunL() while the RFS queries are on the screen.
       
    18 *     (By deleting the object or using Cancel() method)
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 #ifndef RFS_HANDLER_H
       
    24 #define RFS_HANDLER_H
       
    25 
       
    26 //  INCLUDES
       
    27 
       
    28 #include <e32std.h>
       
    29 #include <etel.h>
       
    30 #include <etelmm.h>
       
    31 
       
    32 // CONSTANTS
       
    33 
       
    34 // Rfs level
       
    35 
       
    36 enum TRfsType
       
    37     {
       
    38     ERfsNormal  = 0,
       
    39     ERfsDeep    = 1
       
    40     };
       
    41 
       
    42 // FORWARD DECLARATIONS
       
    43 
       
    44 class CAknQueryDialog;
       
    45 class CAknInformationNote;
       
    46 class CEikonEnv;
       
    47 class CSecurityHandler;
       
    48 class CRfsSecurityHandler;
       
    49 class CRfsPdpObserver;
       
    50 
       
    51 // CLASS DECLARATION
       
    52 
       
    53 /**
       
    54 *  This class provides a method to activate the rfs process including all UI.
       
    55 *  (notes etc.)
       
    56 */
       
    57 class CRfsHandler : public CBase
       
    58     {
       
    59     public:  // Constructors and destructor
       
    60 
       
    61         /**
       
    62         * Constructor doesn't allocate any resources.
       
    63         */
       
    64         IMPORT_C CRfsHandler();
       
    65 
       
    66         /**
       
    67         * Destructor also calls Cancel()
       
    68         */
       
    69         IMPORT_C ~CRfsHandler();
       
    70 
       
    71     public: // New functions
       
    72 
       
    73         /**
       
    74         * Activates the RFS process. Returns when the user either canceled RFS
       
    75         * or confirmed it, in which case the phone will be rebooted.
       
    76         *
       
    77         * While the queries are on the screen, the active scheduler is running,
       
    78         * allowing the operation to be canceled.
       
    79         *
       
    80         * In RFS process:
       
    81         *
       
    82         * Security code is asked and confirmation query is shown
       
    83         * (order depending on the parameter aAskSecurityCodeFirst).
       
    84         * If the correct security code is entered and the confirmation query
       
    85         * approved, the phone is rebooted with RFS reason.
       
    86         *
       
    87         * @param aMode - rfs level
       
    88         * @param aAskSecurityCodeFirst - If true, the security code is asked
       
    89         * first and the confirmation query shown after that. If false,
       
    90         * confirmation query is shown first.
       
    91         *
       
    92         * Method leaves if the initialisations can't be done (problems in ETel
       
    93         * connection or memory allocations)
       
    94         */
       
    95         IMPORT_C void ActivateRfsL( TRfsType aMode, 
       
    96                                     TBool aAskSecurityCodeFirst = EFalse );
       
    97 
       
    98 
       
    99         /**
       
   100         * Cancels the RFS process.
       
   101         * Deletes the RFS notes/queries from the screen.
       
   102         *
       
   103         * This can be called from an active object's RunL() while
       
   104         * ActivateRfsL() is being executed.
       
   105         *
       
   106         * Multiple cancel calls have no effect.
       
   107         */
       
   108         IMPORT_C void Cancel();
       
   109 
       
   110     private:    // new functions
       
   111 
       
   112         /**
       
   113         * Loads the resources needed for the confirmation query.
       
   114         *
       
   115         * @return resource file offset
       
   116         */
       
   117         void LoadResourceL();
       
   118 
       
   119         /**
       
   120         * Sets the default language code in HAL.
       
   121         * This must be done before rebooting the phone for deep level RFS.
       
   122         */
       
   123         void SetDefaultLanguage() const;
       
   124 
       
   125         /**
       
   126         * Shows the RFS confirmation query.
       
   127         * 
       
   128         * @param aThisDestroyed  ETrue, if the RFS handler object was destroyed, otherwise EFalse.          
       
   129         * @param aType           Represents RFS reason Normal or Deep.              
       
   130         * @return                ETrue, if user selected 'YES' as an option at the confirmation query dialog
       
   131         *                        otherwise EFalse.
       
   132         * @leave                 leaves with one of the system wide error.
       
   133         */
       
   134         TBool AskConfirmationL( const TBool& aThisDestroyed, TRfsType aType );
       
   135 
       
   136         /**
       
   137         * Cleans up the mess, by calling Cancel().
       
   138         */
       
   139         static void DoCleanup( TAny* aAny );
       
   140 
       
   141         /**
       
   142         * Checks for calls or data sessions and warns if active
       
   143         *
       
   144         * @return ETrue if there are active connection, EFalse otherwise
       
   145         */
       
   146         TBool CheckConnectionsL();
       
   147 
       
   148         /**
       
   149         * Checks if 2G or 3G connection is active
       
   150         *
       
   151         * @return ETrue if 2G is active or EFalse if 3G
       
   152         */
       
   153         TBool IsGprs() const;
       
   154 
       
   155     private:    // Data
       
   156 
       
   157         // resource file
       
   158         TInt iResourceFileOffset;
       
   159 
       
   160         // UIKON environment
       
   161         CEikonEnv* iEnv;
       
   162 
       
   163         // flags
       
   164         TInt iFlags;
       
   165 
       
   166         // confirmation query
       
   167         CAknQueryDialog* iQuery;
       
   168 
       
   169         // for security code query when using SecUI
       
   170         CSecurityHandler* iSecurityHandler;
       
   171 
       
   172         RTelServer iTelServer;
       
   173         RMobilePhone iPhone;
       
   174 
       
   175         // pointer to a stack variable in ActivateRfsL()
       
   176         TBool* iDestroyedPtr;
       
   177 
       
   178         // for security code query when using Security Engine
       
   179         CRfsSecurityHandler* iSecHandler;
       
   180 
       
   181         TBool iAlwaysOnlineConnectionClosed;
       
   182 
       
   183     private:    // friend classes
       
   184 
       
   185         friend class CRfsQueryDialog;
       
   186     };
       
   187 
       
   188 #endif          // RFS_HANDLER_H   
       
   189             
       
   190 // End of File