profilesservices/ProfileEngine/ProfileScheduleEventSrc/CProfileChangeEvent.h
changeset 0 8c5d936e5675
child 10 c8b9b0986973
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Handles reactivation of the previous profile when the scheduler
       
    15 *                runs.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CPROFILECHANGEEVENT_H
       
    22 #define CPROFILECHANGEEVENT_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <f32file.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MProfileEngine;
       
    30 class CAknGlobalNote;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 * Profile Change event run by the scheduler when the timer expires.
       
    36 *
       
    37 *  @lib ProfileChangeEvent.lib
       
    38 *  @since S60 3.2
       
    39 */
       
    40 class CProfileChangeEvent : public CBase
       
    41     {
       
    42     public:  // Constructors and destructor
       
    43 
       
    44         /**
       
    45         * Two-phased constructor.
       
    46         */
       
    47         static CProfileChangeEvent* NewL();
       
    48 
       
    49         static CProfileChangeEvent* NewLC();
       
    50 
       
    51         /**
       
    52         * Destructor.
       
    53         */
       
    54         virtual ~CProfileChangeEvent();
       
    55 
       
    56     public: // New functions
       
    57 
       
    58         /**
       
    59          * Creates an instance of CProfileChangeEvent and calls ChangeProfileL
       
    60          * from it.
       
    61          */
       
    62         static void ExecuteL();
       
    63 
       
    64     protected:  // New functions
       
    65 
       
    66         /**
       
    67          * Reads the ID of the profile to be activated after expiration, shows
       
    68          * the note about expiration and activates the new profile. Everything
       
    69          * as an atomic operation. If the ID of the profile to be activated is
       
    70          * invalid (means: someone just called SetActiveProfileL() after the
       
    71          * scheduler started running this dll) does nothing.
       
    72          */
       
    73         void DoProfileExpirationL();
       
    74 
       
    75         /**
       
    76         * Reads the ID of the profile which was active before current timed
       
    77         * profile.
       
    78         * @return ETrue if a valid ID was found.
       
    79         */
       
    80         TBool ReadProfileIdL();
       
    81 
       
    82         /**
       
    83          * Activates the profile which was active before timed profile.
       
    84          */
       
    85         void ChangeProfileL();
       
    86 
       
    87         /**
       
    88          * Shows the confirmation note about the expiration of the timed
       
    89          * profile.
       
    90          */
       
    91         void ShowNoteL();
       
    92 
       
    93         /**
       
    94          * Reads the resource for the confirmation note.
       
    95          */
       
    96         void ReadResourcesL();
       
    97 
       
    98     private:
       
    99 
       
   100         /**
       
   101         * C++ default constructor.
       
   102         */
       
   103         CProfileChangeEvent();
       
   104 
       
   105         /**
       
   106         * By default Symbian 2nd phase constructor is private.
       
   107         */
       
   108         void ConstructL();
       
   109 
       
   110     private:    // Data
       
   111         // Own: Profiles Engine for profile activation
       
   112         MProfileEngine* iProfileEngine;
       
   113 
       
   114         // Own: Global note to show the expiration conf. note to the user
       
   115         CAknGlobalNote* iGlobalNote;
       
   116 
       
   117         // Own: buffer for the confirmation note text
       
   118         HBufC* iNoteText;
       
   119 
       
   120         // File server session needed for resource reading:
       
   121         RFs iFs;
       
   122 
       
   123         // Used to store the resource file name
       
   124         TFileName iResourceFile;
       
   125 
       
   126         // Mutex controlling access to profiles data
       
   127         RMutex iMutex;
       
   128 
       
   129         // The ID of the profile which should be reactivated
       
   130         TInt iPreviousId;
       
   131         
       
   132         // Supported features
       
   133         TBool iCoverDisplay;
       
   134     };
       
   135 
       
   136 #endif      // CPROFILECHANGEEVENT_H
       
   137 
       
   138 // End of File