tstaskmonitor/server/inc/tsfswdatalist.h
changeset 96 5d243a69bdda
parent 94 dbb8300717f7
child 98 d2f833ab7940
equal deleted inserted replaced
95:c739008478cc 96:5d243a69bdda
    17 
    17 
    18 
    18 
    19 #ifndef TSFSWDATALIST_H
    19 #ifndef TSFSWDATALIST_H
    20 #define TSFSWDATALIST_H
    20 #define TSFSWDATALIST_H
    21 
    21 
    22 #define __E32SVR_H__
       
    23 #include <e32event.h>
       
    24 #include <f32file.h>
       
    25 
       
    26 #include <e32base.h>
    22 #include <e32base.h>
    27 #include <e32hashtab.h>
       
    28 #include <fbs.h>
       
    29 #include <apgcli.h>
    23 #include <apgcli.h>
    30 #include <w32std.h>
    24 #include <w32std.h>
    31 #include "tsfswentry.h"
    25 #include "tsfswentry.h"
    32 #include "tsfswobservers.h"
    26 #include "tsdataobserver.h"
    33 
    27 
    34 class CTsFswEngine;
       
    35 class CTsFswIconCache;
       
    36 class CApaWindowGroupName;
    28 class CApaWindowGroupName;
    37 class CFbsBitmap;
    29 class CFbsBitmap;
    38 
    30 
    39 /**
    31 /**
    40  * Engine's data list.
    32  * Engine's data list.
    45     /**
    37     /**
    46      * Two-phased constructor.
    38      * Two-phased constructor.
    47      *
    39      *
    48      * @param aParent
    40      * @param aParent
    49      */
    41      */
    50     static CTsFswDataList* NewL( CTsFswEngine& aEngine );
    42     static CTsFswDataList* NewL(MHsDataObserver& observer);
    51 
    43 
    52     /*
    44     /*
    53      * Destructor
    45      * Destructor
    54      */
    46      */
    55     ~CTsFswDataList();
    47     ~CTsFswDataList();
    56 
    48 
    57 private:
    49 private:
    58     /**
    50     /**
    59      * Constructor.
    51      * Constructor.
    60      */
    52      */
    61     CTsFswDataList( CTsFswEngine& aEngine );
    53     CTsFswDataList(MHsDataObserver& observer);
    62 
    54 
    63     /**
    55     /**
    64      * Performs 2nd phase construction.
    56      * Performs 2nd phase construction.
    65      */
    57      */
    66     void ConstructL();
    58     void ConstructL();
    77     /**
    69     /**
    78      * Gets the window group list and reconstructs the fsw content.
    70      * Gets the window group list and reconstructs the fsw content.
    79      * @return   TBool   ETrue if the content iData has been modified
    71      * @return   TBool   ETrue if the content iData has been modified
    80      */
    72      */
    81     TBool CollectTasksL();
    73     TBool CollectTasksL();
    82 
       
    83 
       
    84     /**
       
    85      * Set flag iTaskListDirty;
       
    86      */
       
    87     void SetDirty();
       
    88 
       
    89     /**
       
    90      * Set flag iAppDataRefreshNeeded
       
    91      */
       
    92     void SetAppDataRefreshNeeded();
       
    93 
       
    94 
       
    95     /**
       
    96      * Moves entry on given window app/widget id to 
       
    97      * the first position on conten data list
       
    98      */
       
    99     void MoveEntryAtStart( TInt aAppId, TBool aWidget );
       
   100     
       
   101     
       
   102     /**
       
   103      * Finds out the app uid for the given window group id.
       
   104      * @param   aWgId   a valid window group id
       
   105      * @param   aUid   	requested uid
       
   106      * @return  error code
       
   107      */
       
   108     TInt AppUidForWgId( TInt aWgId, TUid& aUid );
       
   109     
       
   110     /**
       
   111      * Finds out the app uid for the given window group id.
       
   112      * @param   aWgId   a valid window group id
       
   113      * @return  application uid
       
   114      */
       
   115     TUid AppUidForWgIdL( TInt aWgId );
       
   116     
    74     
   117     /**
    75     /**
   118      * Checks if given uid is on hidden list
    76      * Checks if given uid is on hidden list
   119      * @param   aUid uid to be checked
    77      * @param   aUid uid to be checked
   120      * @return  ETrue if aUid is on hidden list
    78      * @return  ETrue if uid is on hidden list
   121      */    
    79      */    
   122     TBool IsHiddenUid( TUid aUid );
    80     TBool IsHiddenUid( TUid uid );
   123 
    81 
       
    82     /**
       
    83      * Set screenshot 
       
    84      */
       
    85     TBool SetScreenshotL(const CFbsBitmap* bitmap, UpdatePriority priority, TInt wgId);
       
    86     
       
    87     /**
       
    88      * Removes screenshot 
       
    89      */    
       
    90     TBool RemoveScreenshotL(TInt wgId);
       
    91     
   124 private:
    92 private:
   125     /**
    93     /**
   126      * Adds running apps to the list.
    94      * Adds running apps to the list.
   127      * @param   aAppsList    array to add to
    95      * @param   appsList    array to add to
   128      */
    96      */
   129     void CollectAppsL( RTsFswArray& aAppsList );
    97     void CollectAppsL( RTsFswArray& appsList );
   130 
    98 
   131     /**
    99     /**
   132      * Called from CollectTasksL for each entry in the task list.
   100      * Called from CollectTasksL for each entry in the task list.
   133      * @param   aWgId       window group id
   101      * @param   key       entry key
   134      * @param   aAppUid     application uid
   102      * @param   appUid     application uid
   135      * @param   aWgName     window group name or NULL
   103      * @param   wgName     window group name or NULL
   136      * @param   aNewList    list to add to
   104      * @param   newList    list to add to
   137      * @param   aIsWidget   true if the entry corresponds to a web widget
   105      */
   138      * @return  TBool   ETrue if it was really a new entry in the list
   106     void AddEntryL( const TTsEntryKey& key, 
   139      */
   107 			const TUid& appUid,
   140     TBool AddEntryL( TInt aWgId, 
   108             CApaWindowGroupName* wgName,
   141 			const TUid& aAppUid,
   109 			RTsFswArray& newList );
   142             CApaWindowGroupName* aWgName,
       
   143 			RTsFswArray& aNewList,
       
   144             TBool aIsWidget );
       
   145 
   110 
   146     /**
   111     /**
   147      * Checks if there is an entry for same app in the content list.
   112      * Checks if there is an entry for same app in the content list.
   148      * If yes then it takes some of the data for the entry that
   113      * If yes then it takes some of the data for the entry that
   149      * will correspond to the same app in the refreshed content list.
   114      * will correspond to the same app in the refreshed content list.
   150      * In case of widget, update window group field in content list.
   115      * @param   key      new key in content list
   151      * @param   aEntry      new entry in content list
       
   152      * @param   aAppUid     application uid
       
   153      * @param   aChanged    ref to change-flag, set to ETrue if it is sure
       
   154      * that the new content list will be different from the previous one
       
   155      * @param   aNewList    ref to new content list
       
   156      * @return  ETrue if app was found
   116      * @return  ETrue if app was found
   157      */
   117      */
   158     TBool ConsiderOldDataL( CTsFswEntry& aEntry,
   118     TBool ConsiderOldDataL( const TTsEntryKey& key );
   159         const TUid& aAppUid,
       
   160         TBool& aChanged,
       
   161         RTsFswArray& aNewList );
       
   162 
       
   163     /**
       
   164      * Adds running widgets to the list.
       
   165      * @param   aWidgetsList    array to add to
       
   166      */
       
   167     void CollectWidgetsL( RTsFswArray& aWidgetsList );
       
   168 
       
   169     /**
       
   170      * Returns the parent's wg id or KErrNotFound.
       
   171      * @param   aWgId   a valid window group id
       
   172      * @return parent wg id or KErrNotFound if there is no parent
       
   173      */
       
   174     TInt FindParentWgId( TInt aWgId );
       
   175 
       
   176     /**
       
   177      * Returns the most top parent's wg id or KErrNotFound.
       
   178      * @param   aWgId   a valid window group id
       
   179      * @return parent wg id or KErrNotFound if there is no parent
       
   180      */
       
   181     TInt FindMostTopParentWgId( TInt aWgId );
       
   182 
   119 
   183     /**
   120     /**
   184      * Finds out the application name.
   121      * Finds out the application name.
   185      * @param   aWindowName window group name or NULL
   122      * @param   windowName window group name or NULL
   186      * @param   aAppUId     application uid
   123      * @param   appUId     application uid
   187      * @param   aWgId       window group id
   124      * @param   wgId       window group id
   188      * @return  application name, ownership transferred to caller
   125      * @return  application name, ownership transferred to caller
   189      */
   126      */
   190     HBufC* FindAppNameLC( CApaWindowGroupName* aWindowName,
   127     HBufC* FindAppNameLC(CApaWindowGroupName* windowName,
   191             	const TUid& aAppUid,
   128                          const TUid& appUid,
   192 				TInt aWgId );
   129                          TInt wgId );
   193 
   130 
   194 
   131 
   195     /**
   132     /**
   196      * Fit existing class contained data list into give one.
   133      * Fit existing class contained data list into give one.
   197      * Data is being changed with application type consideration that is based 
   134      * Data is being changed with application type consideration that is based 
   198      * on aConsiderWidgets param. 
   135      * on aConsiderWidgets param. 
   199      * Function removes or add entries into data depend on given list.
   136      * Function removes or add entries into data depend on given list.
   200      * @param   aListToFit          list with actual data 
   137      * @param   listToFit          list with actual data  
   201      * @param   aConsiderWidgets    application type 
       
   202      * @return  ETrue if change occours on data list, EFalse otherwise   
   138      * @return  ETrue if change occours on data list, EFalse otherwise   
   203      */
   139      */
   204     TBool FitDataToListL( RTsFswArray& aListToFit, TBool aConsiderWidgets );
   140     TBool FitDataToListL( RTsFswArray& listToFit);
   205 
   141 
   206     /**
   142     /**
   207      * Checks if there is an entry for same app in the given list.
   143      * Checks if there is an entry for same app in the given list.
   208      * @param   aEntry      entry
   144      * @param   entry      entry
   209      * @param   aNewList    ref to list
   145      * @param   newList    ref to list
   210      * @return  ETrue if app was found
   146      * @return  ETrue if app was found
   211      */
   147      */
   212     TBool CheckIfExists( const CTsFswEntry& aEntry,
   148     TBool CheckIfExists( const CTsFswEntry& entry,
   213             const RTsFswArray& aNewList ) const;
   149             const RTsFswArray& newList ) const;
   214             
   150             
   215     /**
   151     /**
   216      * Retrieves the bitmap/mask for the icon of the given app.
   152      * Retrieves the bitmap/mask for the icon of the given app.
   217      * @param   aAppUid application uid
   153      * @param   appUid application uid
   218      * @param   aBitmap bitmap ptr, ownership transferred to caller, or NULL
   154      * @param   bitmapArg bitmap ptr, ownership transferred to caller, or NULL
   219      * @param   aMask   mask ptr, ownership transferred to caller, or NULL
   155      * @param   maskArg   mask ptr, ownership transferred to caller, or NULL
   220      */
   156      */
   221     void GetAppIconL( const TUid& aAppUid,
   157     void GetAppIconL(const TUid& appUid,
   222         CFbsBitmap*& aBitmap, CFbsBitmap*& aMask );            
   158                      CFbsBitmap*& bitmapArg, 
       
   159                      CFbsBitmap*& maskArg);
       
   160 
       
   161     /**
       
   162      * Finds entry in array
       
   163      * @param   list list to find
       
   164      * @param   key finding key
       
   165      * @return   position or KErrNotFound
       
   166      */
       
   167     TInt FindEntry(const RTsFswArray& list, const TTsEntryKey& key ) const;
       
   168 
       
   169     /**
       
   170      * Establish entry order accridung to aKeyList, all keys MUST be in iData
       
   171      * @param   keyList reference key list
       
   172      * @return   ETrue if changes occured
       
   173      */
       
   174     TBool EstablishOrder(const RArray<TTsEntryKey>& keyList);
       
   175     
       
   176     /**
       
   177      * Gets allowed uids, tries to filter non GUI application 
       
   178      */
       
   179     void GetAllowedUidsL();
   223     
   180     
   224 
   181 
   225 private:
   182 private:
   226     CTsFswEngine& iEngine;
   183     MHsDataObserver &mObserver;
   227 
   184     
   228     RTsFswArray iData; // current fsw content, i.e. the task list
   185     RTsFswArray mData; // current fsw content, i.e. the task list
   229 
   186 
   230     // window server session
   187     // window server session
   231     RWsSession iWsSession;
   188     RWsSession mWsSession;
   232 
   189 
   233     // apparc session
   190     // apparc session
   234     RApaLsSession iAppArcSession;
   191     RApaLsSession mAppArcSession;
   235 
       
   236 
       
   237 
       
   238 
       
   239     // when true CollectTasksL will call GetAllApps etc.
       
   240     // which is slow and need not be done normally, except
       
   241     // during startup and perhaps when new applications are installed
       
   242     TBool iAppDataRefreshNeeded;
       
   243 
       
   244     // Dirty flag, indicates that iData is not up-to-date because
       
   245     // there were no subscribed clients during a previous possible
       
   246     // change of the task list.
       
   247     TBool iTaskListDirty;
       
   248     
       
   249     // if ETrue application order has been changed
       
   250     TBool iOrderChanged;
       
   251     
   192     
   252     // list of hidden uids
   193     // list of hidden uids
   253     RArray<TUid> iHiddenUids;
   194     RArray<TUid> mHiddenUids;
       
   195     
       
   196     // list of allowed uids
       
   197     RArray<TUid> mAllowedUids;
   254     };
   198     };
   255 
   199 
   256 #endif //TSFSWDATALIST_H
   200 #endif //TSFSWDATALIST_H