menucontentsrv/srvinc/mcsrunningappshandler.h
branchRCL_3
changeset 78 1b207dd38b72
parent 0 79c6a41cd166
equal deleted inserted replaced
74:edd621764147 78:1b207dd38b72
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  This class maintains a list of the running apps, and listen 
    14 * Description:  This class maintains a list of the running apps, and listen
    15 *  for changes in the running apps. It calls the observer if there is such a 
    15 *  for changes in the running apps. It calls the observer if there is such a
    16 *  change.
    16 *  change.
    17 *
    17 *
    18 *
    18 *
    19 */
    19 */
    20 
    20 
    34 class CMcsCacheHandler;
    34 class CMcsCacheHandler;
    35 class CMcsRunningAppsWgMonitor;
    35 class CMcsRunningAppsWgMonitor;
    36 class CMcsRunningAppsFswMonitor;
    36 class CMcsRunningAppsFswMonitor;
    37 class CMcsRunningAppsHiddenAttrScanner;
    37 class CMcsRunningAppsHiddenAttrScanner;
    38 class CMcsRunningAppsAddRemoveHandler;
    38 class CMcsRunningAppsAddRemoveHandler;
       
    39 
       
    40 
       
    41 /*
       
    42 *
       
    43 */
       
    44 class TRunningAppsAttr
       
    45     {
       
    46 public:
       
    47     /*
       
    48     *
       
    49     */
       
    50     TRunningAppsAttr ( TUid aUid, TBool aFswHidden = EFalse,
       
    51         TBool aHidden = EFalse, TBool aIsRunning = EFalse )
       
    52         {
       
    53         iUid = aUid;
       
    54         iHidden = aHidden;
       
    55         iFswHidden = aFswHidden;
       
    56         iIsRunning = aIsRunning;
       
    57         }
       
    58 
       
    59     /*
       
    60     *
       
    61     */
       
    62     TUid GetUid() const
       
    63         {
       
    64         return iUid;
       
    65         }
       
    66 
       
    67     /*
       
    68     *
       
    69     */
       
    70     TBool IsHidden() const
       
    71         {
       
    72         return iHidden;
       
    73         }
       
    74 
       
    75     /*
       
    76     *
       
    77     */
       
    78     void SetHidden( TBool aHidden )
       
    79         {
       
    80         iHidden = aHidden;
       
    81         }
       
    82 
       
    83     /*
       
    84     *
       
    85     */
       
    86     TBool IsFswHidden() const
       
    87         {
       
    88         return iFswHidden;
       
    89         }
       
    90 
       
    91     /*
       
    92     *
       
    93     */
       
    94     void SetFswHidden( TBool aFswHidden )
       
    95         {
       
    96         iFswHidden = aFswHidden;
       
    97         }
       
    98 
       
    99 
       
   100     /*
       
   101     *
       
   102     */
       
   103     TBool IsRunning() const
       
   104         {
       
   105         return iIsRunning;
       
   106         }
       
   107 
       
   108     /*
       
   109     *
       
   110     */
       
   111     void SetRunning( TBool aIsRunning )
       
   112         {
       
   113         iIsRunning = aIsRunning;
       
   114         }
       
   115 
       
   116     /*
       
   117     *
       
   118     */
       
   119     static TBool MatchByUid( const TRunningAppsAttr& aArg1,
       
   120             const TRunningAppsAttr& aArg2)
       
   121         {
       
   122         return aArg1.GetUid() == aArg2.GetUid();
       
   123         }
       
   124 
       
   125 private:    // data
       
   126 
       
   127     TUid iUid;
       
   128     TBool iHidden;
       
   129     TBool iFswHidden;
       
   130     TBool iIsRunning;
       
   131 
       
   132     };
       
   133 
       
   134 
       
   135 
    39 
   136 
    40 /**
   137 /**
    41  * Interface for updating RunningApps list stored in CMcsRunningAppsHandler class
   138  * Interface for updating RunningApps list stored in CMcsRunningAppsHandler class
    42  *
   139  *
    43  * @since S60 v3.2
   140  * @since S60 v3.2
    50     	ERunningApps,
   147     	ERunningApps,
    51     	EFswHiddenApps,
   148     	EFswHiddenApps,
    52     	EHiddenApps
   149     	EHiddenApps
    53     	};
   150     	};
    54     /*
   151     /*
    55 	 * Called by HiddenAttr scanner, FSW monitor or WindowsGroup 
   152 	 * Called by HiddenAttr scanner, FSW monitor or WindowsGroup
    56 	 * Monitor.
   153 	 * Monitor.
    57      * @param aArray an array containing UIDs of running, hidden or
   154      * @param aArray an array containing UIDs of running, hidden or
    58      * 	fsw apps  
   155      * 	fsw apps
    59      * @param aType type of data stored in aArray   
   156      * @param aType type of data stored in aArray
    60 	 */
   157 	 */
    61     virtual void HandleListUpdateL(const RArray<TUid>& aArray, 
   158     virtual void HandleListUpdateL(const RArray<TUid>& aArray,
    62     		TArrayDataType aType ) = 0;
   159     		TArrayDataType aType ) = 0;
    63     
   160 
    64 	/*
   161 	/*
    65 	 * Called by AddRemoveHandler
   162 	 * Called by AddRemoveHandler
    66 	 * @param aFolder id of folder for which the method was invoked
   163 	 * @param aFolder id of folder for which the method was invoked
    67 	 */
   164 	 */
    68     virtual void HandleAddRemoveRunningAppL( TInt aFolder ) = 0;
   165     virtual void HandleAddRemoveRunningAppL( TInt aFolder ) = 0;
    69     
   166 
    70     };
   167     };
    71 
   168 
    72 /*
   169 /*
    73  *  RunningApps Handler.
   170  *  RunningApps Handler.
    74  *  @lib mcsmenu.lib
   171  *  @lib mcsmenu.lib
    79     public:
   176     public:
    80 
   177 
    81 	/**
   178 	/**
    82 	*   Factory method.
   179 	*   Factory method.
    83 	*/
   180 	*/
    84     static CMcsRunningAppsHandler* NewL( 
   181     static CMcsRunningAppsHandler* NewL(
    85 		CMenuEng& aEng,
   182 		CMenuEng& aEng,
    86     	CMcsCacheHandler& aCacheHandler );
   183     	CMcsCacheHandler& aCacheHandler );
    87 
   184 
    88     /**
   185     /**
    89     *   Destructor.
   186     *   Destructor.
    90     */
   187     */
    91     ~CMcsRunningAppsHandler();
   188     ~CMcsRunningAppsHandler();
    92     
   189 
    93     /**
   190     /**
    94      * Called by EngineEvents method
   191      * Called by EngineEvents method
    95      * @param aFolder folder id
   192      * @param aFolder folder id
    96      * @param aEvents events
   193      * @param aEvents events
    97      */
   194      */
   101      * Called by CMenuSrvEng class object
   198      * Called by CMenuSrvEng class object
   102      * @param aFolder folder id
   199      * @param aFolder folder id
   103      * @param aEvents events
   200      * @param aEvents events
   104      */
   201      */
   105     void EngineEvents( TInt aFolder, TInt aEvents );
   202     void EngineEvents( TInt aFolder, TInt aEvents );
   106     
   203 
   107     /**
   204     /**
   108      * Fills aArray with UIDs of running apps
   205      * Fills aArray with UIDs of running apps
   109      * @param aArray array to be filled with UIDs of running apps
   206      * @param aArray array to be filled with UIDs of running apps
   110      */
   207      */
   111     void GetRunningAppsL( RArray<TUid>& aArray );
   208     void GetRunningAppsL( RArray<TUid>& aArray );
   112 
   209 
   113     /**
   210     /**
   114      * Returns running status of an item
   211      * Returns running status of an item
   115      * @param aItemId id of the item
   212      * @param aItemId id of the item
   116      * @return running status of an item
   213      * @return running status of an item
   117      */    
   214      */
   118     TBool GetRunningStatusL( TInt aItemId );
   215     TBool GetRunningStatusL( TInt aItemId );
   119 
   216 
   120     
   217 
   121 // from MMcsRunningAppsHandler
   218 // from MMcsRunningAppsHandler
   122     
   219 
   123     /*
   220     /*
   124 	 * Called by HiddenAttr scanner, FSW monitor or WindowsGroup 
   221 	 * Called by HiddenAttr scanner, FSW monitor or WindowsGroup
   125 	 * Monitor.
   222 	 * Monitor.
   126      * @param aArray an array containing UIDs of running, hidden or
   223      * @param aArray an array containing UIDs of running, hidden or
   127      * 	fsw apps  
   224      * 	fsw apps
   128      * @param aType type of data stored in aArray   
   225      * @param aType type of data stored in aArray
   129 	 */
   226 	 */
   130     void HandleListUpdateL(const RArray<TUid>& aArray, TArrayDataType aType );
   227     void HandleListUpdateL(const RArray<TUid>& aArray, TArrayDataType aType );
   131 
   228 
   132 	/*
   229 	/*
   133 	 * Called by AddRemoveHandler
   230 	 * Called by AddRemoveHandler
   134 	 * @param id of folder for which the method was invoked
   231 	 * @param id of folder for which the method was invoked
   135 	 */
   232 	 */
   136 	void HandleAddRemoveRunningAppL( TInt aFolder );    
   233 	void HandleAddRemoveRunningAppL( TInt aFolder );
   137 
   234 
   138 private:
   235 private:
   139 	/**
   236 	/**
   140 	*   Constructor.
   237 	*   Constructor.
   141 	*/
   238 	*/
   142 	CMcsRunningAppsHandler( 
   239 	CMcsRunningAppsHandler(
   143 		CMenuEng& aEng, 
   240 		CMenuEng& aEng,
   144 	    CMcsCacheHandler& aCacheHandler );
   241 	    CMcsCacheHandler& aCacheHandler );
   145 
   242 
   146 	/**
   243 	/**
   147 	 * 2nd phase constructor
   244 	 * 2nd phase constructor
   148 	 */
   245 	 */
   163     /**
   260     /**
   164     * Called by HandleListUpdateL
   261     * Called by HandleListUpdateL
   165     * @param aArray array with UIDs of hidden apps
   262     * @param aArray array with UIDs of hidden apps
   166     */
   263     */
   167 	void HandleHiddenAppsChangedL(const RArray<TUid>& aArray );
   264 	void HandleHiddenAppsChangedL(const RArray<TUid>& aArray );
   168 	
   265 
   169 	/**
   266 	/**
   170 	 * Sends AttributeChange notification for item and parents of the item
   267 	 * Sends AttributeChange notification for item and parents of the item
   171 	 * it it is necessary, it is also responsible for removing data from cache
   268 	 * it it is necessary, it is also responsible for removing data from cache
   172 	 * if attribute value cahnged
   269 	 * if attribute value cahnged
   173 	 * @param aId id of item with changed running status attribute
   270 	 * @param aId id of item with changed running status attribute
   179 	 * given uid, it is also responsible for removing data from cache
   276 	 * given uid, it is also responsible for removing data from cache
   180 	 * if attribute value has changed
   277 	 * if attribute value has changed
   181 	 * @param aAppUid uid of items with changed running status attribute
   278 	 * @param aAppUid uid of items with changed running status attribute
   182 	 */
   279 	 */
   183 	void HandleNotificationL( TUid aAppUid );
   280 	void HandleNotificationL( TUid aAppUid );
   184 	
   281 
   185 	/**
   282 	/**
   186 	 * Gets list of items with secified uid
   283 	 * Gets list of items with secified uid
   187 	 * @param aAppUid items uid
   284 	 * @param aAppUid items uid
   188 	 * @return KErrNotFound if no item was found KErrNone if succesfull
   285 	 * @return KErrNotFound if no item was found KErrNone if succesfull
   189 	 */
   286 	 */
   194 	 * @param aFolderId id of a folder
   291 	 * @param aFolderId id of a folder
   195 	 * @param aNewRunningStatus current running status
   292 	 * @param aNewRunningStatus current running status
   196 	 */
   293 	 */
   197 	void UpdateFolderRunningStatusL( TInt aFolderId, TBool aNewRunningStatus );
   294 	void UpdateFolderRunningStatusL( TInt aFolderId, TBool aNewRunningStatus );
   198 
   295 
   199 	
   296 
   200 	/**
   297 	/**
   201 	 * Updates array containing folders with running status.
   298 	 * Updates array containing folders with running status.
   202 	 * It is called at startup and it scans all folders
   299 	 * It is called at startup and it scans all folders
   203 	 */
   300 	 */
   204 	void UpdateFoldersRunningStatusL( );
   301 	void UpdateFoldersRunningStatusL( );
   205 	
   302 
   206 	/**
   303 	/**
   207 	 * Gets running status for CMenuEngObject
   304 	 * Gets running status for CMenuEngObject
   208 	 * @param aEngObj object to be checked
   305 	 * @param aEngObj object to be checked
   209 	 * @return running status of an object
   306 	 * @return running status of an object
   210 	 */
   307 	 */
   211 	TBool GetRunningStatusL( const CMenuEngObject& aEngObj );
   308 	TBool GetRunningStatusL( const CMenuEngObject& aEngObj );
   212 
   309 
   213 	/**
   310 	/**
   214 	 * Gets previous Folder running status
   311 	 * Gets previous Folder running status
   215 	 * @param aId id of the folder
   312 	 * @param aId id of the folder
   216 	 * @return previous running status of a folder (stored in 
   313 	 * @return previous running status of a folder (stored in
   217 	 * 	iRunningFolderStatus array )
   314 	 * 	iRunningFolderStatus array )
   218 	 */
   315 	 */
   219 	TBool GetFolderPreviousRunningStatusL( TInt aId );
   316 	TBool GetFolderPreviousRunningStatusL( TInt aId );
   220 
   317 
   221 	
   318 
   222 	/**
   319 	/**
   223 	 * Gets current folder running status
   320 	 * Gets current folder running status
   224 	 * @param aId id of the folder
   321 	 * @param aId id of the folder
   225 	 * @return running status of a folder
   322 	 * @return running status of a folder
   226 	 */
   323 	 */
   227 	TBool GetFolderRunningStatusL( TInt aId );
   324 	TBool GetFolderRunningStatusL( TInt aId );
   228 	
   325 
   229 	/**
   326 	/**
   230 	 * Gets current application running status
   327 	 * Gets current application running status
   231 	 * @param aUid UID of an application
   328 	 * @param aUid UID of an application
   232 	 * @return running status of an application
   329 	 * @return running status of an application
   233 	 */
   330 	 */
   234 	TBool GetAppRunningStatusL( TUid aUid );
   331 	TBool GetAppRunningStatusL( TUid aUid );
   235 
   332 
   236 private:    
   333 private:
   237 
   334 
   238     CMenuEng& iEng ; ///< Engine. not own
   335     CMenuEng& iEng ; ///< Engine. not own
   239 
   336 
   240     /** not own
   337     /** not own
   241     */
   338     */
   242     CMcsCacheHandler& iCacheHandler;
   339     CMcsCacheHandler& iCacheHandler;
   243     
   340 
   244     /*
   341     /*
   245     * own
   342     * own
   246     */
   343     */
   247     CMcsRunningAppsWgMonitor* iWindowGroupMonitor;
   344     CMcsRunningAppsWgMonitor* iWindowGroupMonitor;
   248 
   345 
   249     /*
   346     /*
   250     * own
   347     * own
   251     */
   348     */
   252     CMcsRunningAppsFswMonitor* iFswMonitor;
   349     CMcsRunningAppsFswMonitor* iFswMonitor;
   253     
   350 
   254     /*
   351     /*
   255      * own
   352      * own
   256      */
   353      */
   257     CMcsRunningAppsHiddenAttrScanner* iHiddenAttrScanner;    
   354     CMcsRunningAppsHiddenAttrScanner* iHiddenAttrScanner;
   258     
   355 
   259     /*
   356     /*
   260      * own 
   357      * own
   261      */
   358      */
   262     CMcsRunningAppsAddRemoveHandler* iAddRemoveHandler;
   359     CMcsRunningAppsAddRemoveHandler* iAddRemoveHandler;
   263     
   360 
   264     /*
   361     /*
   265     * own
   362     * own
   266     */
   363     */
   267     RArray<TRunningAppsAttr> iRunningApps;
   364     RArray<TRunningAppsAttr> iRunningApps;
   268     
   365 
   269     /*
   366     /*
   270     * own
   367     * own
   271     */
   368     */
   272     RArray<TInt> iRunningFolderStatus;
   369     RArray<TInt> iRunningFolderStatus;
   273     };
   370     };
   274 	
   371 
   275 #endif // __MCSRUNNINGAPPSHANDLER_H__
   372 #endif // __MCSRUNNINGAPPSHANDLER_H__