contextframework/cfwplugins/ApplicationStateSourcePlugIn/inc/ApplicationStateSourcePlugin.h
branchRCL_3
changeset 20 c2c61fdca848
parent 19 924385140d98
equal deleted inserted replaced
19:924385140d98 20:c2c61fdca848
    27 #include <viewclipartner.h>
    27 #include <viewclipartner.h>
    28 #endif
    28 #endif
    29 #include <cfcontextsourceplugin.h>
    29 #include <cfcontextsourceplugin.h>
    30 #include <cfcontextobject.h>
    30 #include <cfcontextobject.h>
    31 #include <cenrepnotifyhandler.h>
    31 #include <cenrepnotifyhandler.h>
    32 #include <w32std.h>
    32 
    33 #include <apgwgnam.h>
    33 #include <apgwgnam.h>
    34 #include "cfapplicationstatesettings.h"
    34 #include "cfapplicationstatesettings.h"
    35 #include "uidorientationpair.h"
    35 #include "uidorientationpair.h"
    36 
    36 
    37 // FORWARD DECLARATIONS
    37 // FORWARD DECLARATIONS
    38 class CRepository;
    38 class CRepository;
    39 class CCenRepNotifyHandler;
    39 class CCenRepNotifyHandler;
    40 // FORWARD DECLARATIONS
       
    41 class CWsEventHandler;
       
    42 
    40 
    43 NONSHARABLE_CLASS( MWsEventObserver )
       
    44     {
       
    45 public:
       
    46 
       
    47     /**
       
    48      * Handles window server event.
       
    49      * 
       
    50      * @since S60 5.0
       
    51      * @param aEvent New window server event.
       
    52      * @return None.
       
    53      */
       
    54     virtual void HandleWsEventL( RWsSession& aWsSession ) = 0;    
       
    55     };
       
    56 // CLASS DECLARATION
    41 // CLASS DECLARATION
    57 
    42 
    58 /**
    43 /**
    59  * Application state source plugin.
    44  * Application state source plugin.
    60  * Application state source plugin is responsible for listening view activations
    45  * Application state source plugin is responsible for listening view activations
    64  * @lib -
    49  * @lib -
    65  * @since S60 4.0
    50  * @since S60 4.0
    66  */
    51  */
    67 NONSHARABLE_CLASS( CApplicationStateSourcePlugIn ): 
    52 NONSHARABLE_CLASS( CApplicationStateSourcePlugIn ): 
    68 	public CCFContextSourcePlugIn,
    53 	public CCFContextSourcePlugIn,
    69 	public MWsEventObserver,
    54 	public MVwsSessionWrapperObserver,
    70 	public MCenRepNotifyHandlerCallback
    55 	public MCenRepNotifyHandlerCallback
    71     {
    56     {
    72 public: // Constructors and destructor
    57 public: // Constructors and destructor
    73 
    58 
    74     // Two phased constructors
    59     // Two phased constructors
    89     void DefineContextsL();
    74     void DefineContextsL();
    90 
    75 
    91     // @see CCFContextSourcePlugIn
    76     // @see CCFContextSourcePlugIn
    92     void InitializeL();
    77     void InitializeL();
    93 
    78 
       
    79 public: // From MVwsSessionWrapperObserver
    94 
    80 
       
    81     // @see MVwsSessionWrapperObserver
       
    82     void HandleViewEventL( const TVwsViewEvent& aEvent );
    95 
    83 
    96 public: // From MCenRepNotifyHandlerCallback
    84 public: // From MCenRepNotifyHandlerCallback
    97 
    85 
    98     // @see MCenRepNotifyHandlerCallback
    86     // @see MCenRepNotifyHandlerCallback
    99     void HandleNotifyGeneric( TUint32 aId );
    87     void HandleNotifyGeneric( TUint32 aId );
   121     // Initialize application settings from XML
   109     // Initialize application settings from XML
   122     void InitializeApplicationsFromXMLL();
   110     void InitializeApplicationsFromXMLL();
   123     
   111     
   124     // Initialize the fg application context
   112     // Initialize the fg application context
   125     void InitializeFgApplicationL();
   113     void InitializeFgApplicationL();
   126     void HandleWsEventL( RWsSession& aWsSession );
   114     
   127     // Handles the view server event
   115     // Handles the view server event
   128     void DoHandleViewEventL( const TVwsViewEvent& aEvent );
   116     void DoHandleViewEventL( const TVwsViewEvent& aEvent );
   129     
   117     
   130     // Resolve fg app orientation
   118     // Resolve fg app orientation
   131     TPtrC ResolveFgAppOrientation( const TUid& aUid );
   119     TPtrC ResolveFgAppOrientation( const TUid& aUid );
   159     // My settings.
   147     // My settings.
   160     CCFContextSourceSettingArray* iSettings;
   148     CCFContextSourceSettingArray* iSettings;
   161 
   149 
   162     // Foreground application setting list
   150     // Foreground application setting list
   163     RApplicationStateSettingsPointerArray iApplicationSettings;
   151     RApplicationStateSettingsPointerArray iApplicationSettings;
   164     CWsEventHandler* iWsEventHandler;
   152     
   165     
   153     
   166     // Previous foreground application orientation
   154     // Previous foreground application orientation
   167     TPtrC iPreviousOrientation;
   155     TPtrC iPreviousOrientation;
   168     
   156     
   169     // KCRUidDefaultAppOrientation cenrep
   157     // KCRUidDefaultAppOrientation cenrep
   176     RUidOrientationList iUidOrientationList;
   164     RUidOrientationList iUidOrientationList;
   177     
   165     
   178     // KCRUidDefaultAppOrientation listener
   166     // KCRUidDefaultAppOrientation listener
   179     CCenRepNotifyHandler* iCRAppOrientationListener;
   167     CCenRepNotifyHandler* iCRAppOrientationListener;
   180     };
   168     };
   181 /**
       
   182  * Listens events from window server and forwards them to observer.
       
   183  */
       
   184 NONSHARABLE_CLASS( CWsEventHandler ): public CActive
       
   185     {
       
   186 public:
       
   187 
   169 
   188     /**
       
   189      * Symbian two phased constructors.
       
   190      *
       
   191      * @since S60 5.0
       
   192      * @param None.
       
   193      * @return CDisplayServiceUILayout
       
   194      */
       
   195     static CWsEventHandler* NewL( MWsEventObserver& aObserver );
       
   196     static CWsEventHandler* NewLC( MWsEventObserver& aObserver );
       
   197 
       
   198     /**
       
   199      * C++ destructor.
       
   200      */
       
   201     virtual ~CWsEventHandler();
       
   202     
       
   203 public:
       
   204     
       
   205     /**
       
   206      * Start event listening.
       
   207      * 
       
   208      * @since S60 5.0
       
   209      * @param None.
       
   210      * @return None.
       
   211      */
       
   212     void IssueRequest();
       
   213     
       
   214 protected:
       
   215     
       
   216     // @see CActive
       
   217     virtual void RunL();
       
   218     
       
   219     // @see CActive
       
   220     virtual void DoCancel(); 
       
   221     
       
   222     // @see CActive
       
   223     virtual TInt RunError( TInt aError ); 
       
   224     
       
   225 private:
       
   226 
       
   227     CWsEventHandler( MWsEventObserver& aObserver );
       
   228     void ConstructL();
       
   229 
       
   230 private: // Data
       
   231     
       
   232     /** Observer */
       
   233     MWsEventObserver& iObserver;
       
   234 
       
   235     /** Window server session */
       
   236     RWsSession iWsSession;
       
   237     
       
   238     /** Window group for receiving window server events */
       
   239     RWindowGroup* iWindowGroup;
       
   240     
       
   241     /** Window group name to hide it from the task manager */
       
   242     CApaWindowGroupName* iWindowGroupName;
       
   243     };
       
   244 #endif // C_APPLICATIONSTATESOURCEPLUGIN_H
   170 #endif // C_APPLICATIONSTATESOURCEPLUGIN_H