profilesservices/ProfileEngine/ProfileScheduleEventSrc/CProfileChangeEvent.h
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:20:44 +0100
branchRCL_3
changeset 25 7e0eff37aedb
parent 24 8ee96d21d9bf
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Handles reactivation of the previous profile when the scheduler
*                runs.
*
*/



#ifndef CPROFILECHANGEEVENT_H
#define CPROFILECHANGEEVENT_H

//  INCLUDES
#include <e32base.h>
#include <f32file.h>

// FORWARD DECLARATIONS
class MProfileEngine;
class CAknGlobalNote;

// CLASS DECLARATION

/**
* Profile Change event run by the scheduler when the timer expires.
*
*  @lib ProfileChangeEvent.lib
*  @since S60 3.2
*/
class CProfileChangeEvent : public CBase
    {
    public:  // Constructors and destructor

        /**
        * Two-phased constructor.
        */
        static CProfileChangeEvent* NewL();

        static CProfileChangeEvent* NewLC();

        /**
        * Destructor.
        */
        virtual ~CProfileChangeEvent();

    public: // New functions

        /**
         * Creates an instance of CProfileChangeEvent and calls ChangeProfileL
         * from it.
         */
        static void ExecuteL();

    protected:  // New functions

        /**
         * Reads the ID of the profile to be activated after expiration, shows
         * the note about expiration and activates the new profile. Everything
         * as an atomic operation. If the ID of the profile to be activated is
         * invalid (means: someone just called SetActiveProfileL() after the
         * scheduler started running this dll) does nothing.
         */
        void DoProfileExpirationL();

        /**
        * Reads the ID of the profile which was active before current timed
        * profile.
        * @return ETrue if a valid ID was found.
        */
        TBool ReadProfileIdL();

        /**
         * Activates the profile which was active before timed profile.
         */
        void ChangeProfileL();

        /**
         * Shows the confirmation note about the expiration of the timed
         * profile.
         */
        void ShowNoteL();

        /**
         * Reads the resource for the confirmation note.
         */
        void ReadResourcesL();

    private:

        /**
        * C++ default constructor.
        */
        CProfileChangeEvent();

        /**
        * By default Symbian 2nd phase constructor is private.
        */
        void ConstructL();

    private:    // Data
        // Own: Profiles Engine for profile activation
        MProfileEngine* iProfileEngine;

        // Own: Global note to show the expiration conf. note to the user
        CAknGlobalNote* iGlobalNote;

        // Own: buffer for the confirmation note text
        HBufC* iNoteText;

        // File server session needed for resource reading:
        RFs iFs;

        // Used to store the resource file name
        TFileName iResourceFile;

        // Mutex controlling access to profiles data
        RMutex iMutex;

        // The ID of the profile which should be reactivated
        TInt iPreviousId;
        
        // Supported features
        TBool iCoverDisplay;
        
     
    };

#endif      // CPROFILECHANGEEVENT_H

// End of File