profilesservices/ProfileEngine/ProfileScheduleEventSrc/CProfileChangeEvent.h
changeset 0 8c5d936e5675
child 10 c8b9b0986973
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/profilesservices/ProfileEngine/ProfileScheduleEventSrc/CProfileChangeEvent.h	Thu Dec 17 08:52:52 2009 +0200
@@ -0,0 +1,138 @@
+/*
+* 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