|
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 #define __E32SVR_H__ |
|
23 #include <e32event.h> |
|
24 #include <f32file.h> |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <e32hashtab.h> |
|
28 #include <fbs.h> |
|
29 #include <apgcli.h> |
|
30 #include <w32std.h> |
|
31 #include "tsfswentry.h" |
|
32 #include "tsfswobservers.h" |
|
33 |
|
34 class CTsFswEngine; |
|
35 class CTsFswIconCache; |
|
36 class CApaWindowGroupName; |
|
37 class CFbsBitmap; |
|
38 |
|
39 /** |
|
40 * Engine's data list. |
|
41 */ |
|
42 NONSHARABLE_CLASS( CTsFswDataList ) : public CBase |
|
43 { |
|
44 public: |
|
45 /** |
|
46 * Two-phased constructor. |
|
47 * |
|
48 * @param aParent |
|
49 */ |
|
50 static CTsFswDataList* NewL( CTsFswEngine& aEngine ); |
|
51 |
|
52 /* |
|
53 * Destructor |
|
54 */ |
|
55 ~CTsFswDataList(); |
|
56 |
|
57 private: |
|
58 /** |
|
59 * Constructor. |
|
60 */ |
|
61 CTsFswDataList( CTsFswEngine& aEngine ); |
|
62 |
|
63 /** |
|
64 * Performs 2nd phase construction. |
|
65 */ |
|
66 void ConstructL(); |
|
67 |
|
68 public: |
|
69 /** |
|
70 * Returns a reference to the current content. |
|
71 * Also performs sanity checks, e.g. associates application icons |
|
72 * when no screenshot has been received. |
|
73 * @return ref to content array |
|
74 */ |
|
75 const RTsFswArray& FswDataL(); |
|
76 |
|
77 /** |
|
78 * Gets the window group list and reconstructs the fsw content. |
|
79 * @return TBool ETrue if the content iData has been modified |
|
80 */ |
|
81 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 |
|
117 /** |
|
118 * Checks if given uid is on hidden list |
|
119 * @param aUid uid to be checked |
|
120 * @return ETrue if aUid is on hidden list |
|
121 */ |
|
122 TBool IsHiddenUid( TUid aUid ); |
|
123 |
|
124 private: |
|
125 /** |
|
126 * Adds running apps to the list. |
|
127 * @param aAppsList array to add to |
|
128 */ |
|
129 void CollectAppsL( RTsFswArray& aAppsList ); |
|
130 |
|
131 /** |
|
132 * Called from CollectTasksL for each entry in the task list. |
|
133 * @param aWgId window group id |
|
134 * @param aAppUid application uid |
|
135 * @param aWgName window group name or NULL |
|
136 * @param aNewList list to add to |
|
137 * @param aIsWidget true if the entry corresponds to a web widget |
|
138 * @return TBool ETrue if it was really a new entry in the list |
|
139 */ |
|
140 TBool AddEntryL( TInt aWgId, |
|
141 const TUid& aAppUid, |
|
142 CApaWindowGroupName* aWgName, |
|
143 RTsFswArray& aNewList, |
|
144 TBool aIsWidget ); |
|
145 |
|
146 /** |
|
147 * 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 |
|
149 * will correspond to the same app in the refreshed content list. |
|
150 * In case of widget, update window group field 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 |
|
157 */ |
|
158 TBool ConsiderOldDataL( CTsFswEntry& aEntry, |
|
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 |
|
183 /** |
|
184 * Finds out the application name. |
|
185 * @param aWindowName window group name or NULL |
|
186 * @param aAppUId application uid |
|
187 * @param aWgId window group id |
|
188 * @return application name, ownership transferred to caller |
|
189 */ |
|
190 HBufC* FindAppNameLC( CApaWindowGroupName* aWindowName, |
|
191 const TUid& aAppUid, |
|
192 TInt aWgId ); |
|
193 |
|
194 |
|
195 /** |
|
196 * Fit existing class contained data list into give one. |
|
197 * Data is being changed with application type consideration that is based |
|
198 * on aConsiderWidgets param. |
|
199 * Function removes or add entries into data depend on given list. |
|
200 * @param aListToFit list with actual data |
|
201 * @param aConsiderWidgets application type |
|
202 * @return ETrue if change occours on data list, EFalse otherwise |
|
203 */ |
|
204 TBool FitDataToListL( RTsFswArray& aListToFit, TBool aConsiderWidgets ); |
|
205 |
|
206 /** |
|
207 * Checks if there is an entry for same app in the given list. |
|
208 * @param aEntry entry |
|
209 * @param aNewList ref to list |
|
210 * @return ETrue if app was found |
|
211 */ |
|
212 TBool CheckIfExists( const CTsFswEntry& aEntry, |
|
213 const RTsFswArray& aNewList ) const; |
|
214 |
|
215 /** |
|
216 * Retrieves the bitmap/mask for the icon of the given app. |
|
217 * @param aAppUid application uid |
|
218 * @param aBitmap bitmap ptr, ownership transferred to caller, or NULL |
|
219 * @param aMask mask ptr, ownership transferred to caller, or NULL |
|
220 */ |
|
221 void GetAppIconL( const TUid& aAppUid, |
|
222 CFbsBitmap*& aBitmap, CFbsBitmap*& aMask ); |
|
223 |
|
224 |
|
225 private: |
|
226 CTsFswEngine& iEngine; |
|
227 |
|
228 RTsFswArray iData; // current fsw content, i.e. the task list |
|
229 |
|
230 // window server session |
|
231 RWsSession iWsSession; |
|
232 |
|
233 // apparc session |
|
234 RApaLsSession iAppArcSession; |
|
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 |
|
252 // list of hidden uids |
|
253 RArray<TUid> iHiddenUids; |
|
254 }; |
|
255 |
|
256 #endif //TSFSWDATALIST_H |