tstaskmonitor/server/inc/tsfswdatalist.h
changeset 104 9b022b1f357c
parent 103 b99b84bcd2d1
child 105 e7325f632549
child 109 e0aa398e6810
equal deleted inserted replaced
103:b99b84bcd2d1 104:9b022b1f357c
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Non-closeable app list class
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TSFSWDATALIST_H
       
    20 #define TSFSWDATALIST_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <tswindowgroupsobserver.h>
       
    24 #include "tsfswentry.h"
       
    25 #include "tsdataobserver.h"
       
    26 
       
    27 class CApaWindowGroupName;
       
    28 class CFbsBitmap;
       
    29 
       
    30 /**
       
    31  * Engine's data list.
       
    32  */
       
    33 NONSHARABLE_CLASS( CTsFswDataList ) : public CTsWindowGroupsObserver
       
    34     {
       
    35 public:
       
    36     /**
       
    37      * Two-phased constructor.
       
    38      */
       
    39     static CTsFswDataList* NewL(MTsResourceManager& resources, 
       
    40                                 MTsWindowGroupsMonitor &monitor, 
       
    41                                 MHsDataObserver& observer);
       
    42 
       
    43     /*
       
    44      * Destructor
       
    45      */
       
    46     ~CTsFswDataList();
       
    47 
       
    48 private:
       
    49     /**
       
    50      * Constructor.
       
    51      */
       
    52     CTsFswDataList(MTsResourceManager& resources,
       
    53                    MTsWindowGroupsMonitor &monitor, 
       
    54                    MHsDataObserver& observer);
       
    55 
       
    56     /**
       
    57      * Performs 2nd phase construction.
       
    58      */
       
    59     void ConstructL();
       
    60 
       
    61 public:
       
    62     /**
       
    63      * Returns a reference to the current content.
       
    64      * Also performs sanity checks, e.g. associates application icons
       
    65      * when no screenshot has been received.
       
    66      * @return  ref to content array
       
    67      */
       
    68     const RTsFswArray& FswDataL();
       
    69 
       
    70     /**
       
    71      * Interface implementation
       
    72      * @see MTsWindowGroupsObserver HandleWindowGroupChanged
       
    73      */
       
    74     void HandleWindowGroupChanged(MTsResourceManager &,
       
    75                                   const TArray<RWsSession::TWindowGroupChainInfo> &);
       
    76     
       
    77     /**
       
    78      * Checks if given uid is on hidden list
       
    79      * @param   aUid uid to be checked
       
    80      * @return  ETrue if uid is on hidden list
       
    81      */    
       
    82     TBool IsHiddenUid( TUid uid );
       
    83 
       
    84     /**
       
    85      * Set screenshot 
       
    86      */
       
    87     void SetScreenshotL(const CFbsBitmap* bitmap, UpdatePriority priority, TInt wgId);
       
    88     
       
    89     /**
       
    90      * Removes screenshot 
       
    91      */    
       
    92     void RemoveScreenshotL(TInt wgId);
       
    93     
       
    94 private:
       
    95     /**
       
    96      * Adds running apps to the list.
       
    97      * @param   appsList    array to add to
       
    98      */
       
    99     void CollectAppsL(RTsFswArray& appsList,
       
   100                       const TArray<RWsSession::TWindowGroupChainInfo> &wgList);
       
   101 
       
   102     /**
       
   103      * Called from CollectTasksL for each entry in the task list.
       
   104      * @param   key       entry key
       
   105      * @param   appUid     application uid
       
   106      * @param   wgName     window group name or NULL
       
   107      * @param   newList    list to add to
       
   108      */
       
   109     void AddEntryL(const TTsEntryKey& key, 
       
   110                    const TUid& appUid,
       
   111                    CApaWindowGroupName* wgName,
       
   112                    RTsFswArray& newList );
       
   113 
       
   114     /**
       
   115      * Checks if there is an entry for same app in the content list.
       
   116      * If yes then it takes some of the data for the entry that
       
   117      * will correspond to the same app in the refreshed content list.
       
   118      * @param   key      new key in content list
       
   119      * @return  ETrue if app was found
       
   120      */
       
   121     TBool ConsiderOldDataL( const TTsEntryKey& key );
       
   122 
       
   123     /**
       
   124      * Finds out the application name.
       
   125      * @param   windowName window group name or NULL
       
   126      * @param   appUId     application uid
       
   127      * @param   wgId       window group id
       
   128      * @return  application name, ownership transferred to caller
       
   129      */
       
   130     HBufC* FindAppNameLC(CApaWindowGroupName* windowName,
       
   131                          const TUid& appUid,
       
   132                          TInt wgId );
       
   133 
       
   134 
       
   135     /**
       
   136      * Fit existing class contained data list into give one.
       
   137      * Data is being changed with application type consideration that is based 
       
   138      * on aConsiderWidgets param. 
       
   139      * Function removes or add entries into data depend on given list.
       
   140      * @param   listToFit          list with actual data  
       
   141      */
       
   142     void FitDataToList( RTsFswArray& listToFit);
       
   143 
       
   144     /**
       
   145      * Checks if there is an entry for same app in the given list.
       
   146      * @param   entry      entry
       
   147      * @param   newList    ref to list
       
   148      * @return  ETrue if app was found
       
   149      */
       
   150     TBool CheckIfExists( const CTsFswEntry& entry,
       
   151             const RTsFswArray& newList ) const;
       
   152             
       
   153     /**
       
   154      * Retrieves the bitmap/mask for the icon of the given app.
       
   155      * @param   appUid application uid
       
   156      * @param   bitmapArg bitmap ptr, ownership transferred to caller, or NULL
       
   157      * @param   maskArg   mask ptr, ownership transferred to caller, or NULL
       
   158      */
       
   159     void GetAppIconL(const TUid& appUid,
       
   160                      CFbsBitmap*& bitmapArg, 
       
   161                      CFbsBitmap*& maskArg);
       
   162 
       
   163     /**
       
   164      * Finds entry in array
       
   165      * @param   list list to find
       
   166      * @param   key finding key
       
   167      * @return   position or KErrNotFound
       
   168      */
       
   169     TInt FindEntry(const RTsFswArray& list, const TTsEntryKey& key ) const;
       
   170 
       
   171     /**
       
   172      * Establish entry order accridung to aKeyList, all keys MUST be in iData
       
   173      * @param   keyList reference key list
       
   174      * @return   ETrue if changes occured
       
   175      */
       
   176     TBool EstablishOrder(const RArray<TTsEntryKey>& keyList);
       
   177     
       
   178     /**
       
   179      * Gets allowed uids, tries to filter non GUI application 
       
   180      */
       
   181     TBool VerifyApplicationL(TUid);
       
   182     
       
   183     /**
       
   184      * Function generate task key using window group id
       
   185      * @param wgId - window group id of running application
       
   186      * @param entry key 
       
   187      */
       
   188     TTsEntryKey GenerateKeyL(TInt);
       
   189     
       
   190     /**
       
   191      * Analyse and compress lookup table id needed
       
   192      * @param array - lookup table that has to be checked
       
   193      * 
       
   194      */
       
   195     void CompressLookupTable(RArray<TUid> &array);
       
   196     
       
   197     /**
       
   198      * Change priority of an item in the lookup table
       
   199      * @param array - look up table
       
   200      * @param offset - index of an item in the table
       
   201      */
       
   202     void UpdateLookupTableL(RArray<TUid> &array, TInt offset);
       
   203 
       
   204 private:
       
   205     /**
       
   206      * Resource manager. Not own
       
   207      */
       
   208     MTsResourceManager& mResources;
       
   209     
       
   210     MHsDataObserver &mObserver;
       
   211     
       
   212     RTsFswArray mData; // current fsw content, i.e. the task list
       
   213 
       
   214     // list of hidden uids
       
   215     RArray<TUid> mHiddenUids;
       
   216     
       
   217     // list of allowed uids
       
   218     RArray<TUid> mAllowedUids;
       
   219     };
       
   220 
       
   221 #endif //TSFSWDATALIST_H