author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:18:30 +0300 | |
branch | RCL_3 |
changeset 102 | ba63c83f4716 |
parent 88 | 3321d3e205b6 |
permissions | -rw-r--r-- |
83 | 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 <e32hashtab.h> |
|
24 |
#include <fbs.h> |
|
25 |
#include <apgcli.h> |
|
26 |
#include <w32std.h> |
|
27 |
#include "tsfswentry.h" |
|
28 |
#include "tsfswobservers.h" |
|
29 |
||
30 |
class CTsFswEngine; |
|
31 |
class CTsFsAlwaysShownAppList; |
|
32 |
class CTsFsHiddenAppList; |
|
33 |
class CTsFsWidgetList; |
|
34 |
class CTsFswIconCache; |
|
35 |
class CApaWindowGroupName; |
|
36 |
||
37 |
/** |
|
38 |
* Engine's data list. |
|
39 |
*/ |
|
40 |
NONSHARABLE_CLASS( CTsFswDataList ) : public CBase |
|
41 |
{ |
|
42 |
public: |
|
43 |
/** |
|
44 |
* Two-phased constructor. |
|
45 |
* |
|
46 |
* @param aParent |
|
47 |
*/ |
|
48 |
static CTsFswDataList* NewL( CTsFswEngine& aEngine ); |
|
49 |
||
50 |
/* |
|
51 |
* Destructor |
|
52 |
*/ |
|
53 |
~CTsFswDataList(); |
|
54 |
||
55 |
private: |
|
56 |
/** |
|
57 |
* Constructor. |
|
58 |
*/ |
|
59 |
CTsFswDataList( CTsFswEngine& aEngine ); |
|
60 |
||
61 |
/** |
|
62 |
* Performs 2nd phase construction. |
|
63 |
*/ |
|
64 |
void ConstructL(); |
|
65 |
||
66 |
public: |
|
67 |
/** |
|
68 |
* Returns a reference to the current content. |
|
69 |
* Also performs sanity checks, e.g. associates application icons |
|
70 |
* when no screenshot has been received. |
|
71 |
* @return ref to content array |
|
72 |
*/ |
|
73 |
const RTsFswArray& FswDataL(); |
|
74 |
||
75 |
/** |
|
76 |
* Gets the window group list and reconstructs the fsw content. |
|
77 |
* @return TBool ETrue if the content iData has been modified |
|
78 |
*/ |
|
79 |
TBool CollectTasksL(); |
|
80 |
||
81 |
/** |
|
82 |
* Return contained iAlwaysShownAppList member. |
|
83 |
*/ |
|
84 |
CTsFsAlwaysShownAppList* AlwaysShownApps(); |
|
85 |
||
86 |
/** |
|
87 |
* Return contained iHiddenAppList member. |
|
88 |
*/ |
|
89 |
CTsFsHiddenAppList* HiddenApps(); |
|
90 |
||
91 |
/** |
|
92 |
* Return containd iWidgetList member |
|
93 |
*/ |
|
94 |
CTsFsWidgetList* Widgets(); |
|
95 |
||
96 |
/** |
|
97 |
* Set flag iAppDataRefreshNeeded |
|
98 |
*/ |
|
99 |
void SetAppDataRefreshNeeded(); |
|
100 |
||
101 |
/** |
|
102 |
* Store or updarte screenshot bitmap for specified window group. |
|
103 |
*/ |
|
104 |
TBool StoreScreenshot( TInt aWgId, CFbsBitmap* aBmp ); |
|
105 |
||
106 |
/** |
|
107 |
* remove screenshot bitmap. |
|
108 |
*/ |
|
109 |
TBool RemoveScreenshot( TInt aWgId ); |
|
110 |
||
111 |
/** |
|
112 |
* Obtain screenshot if exists |
|
113 |
*/ |
|
114 |
CFbsBitmap** FindScreenshot( TInt aWgId ); |
|
115 |
||
116 |
/** |
|
117 |
* Moves entry on given window app/widget id to |
|
118 |
* the first position on conten data list |
|
119 |
*/ |
|
120 |
TBool MoveEntryAtStart( TInt aAppId, TBool aWidget ); |
|
121 |
||
122 |
/** |
|
123 |
* If application uid exists in the contained CTsFsAlwaysShownAppList |
|
124 |
* @return ETrue application uid exists in the list |
|
125 |
* EFalse application uid doesn't exist in the list |
|
126 |
* @param TInt aWgId the window group application |
|
127 |
*/ |
|
128 |
TBool IsAlwaysShownAppL( TInt aWgId ); |
|
129 |
||
130 |
/** |
|
131 |
* Finds out the app uid for the given window group id. |
|
132 |
* @param aWgId a valid window group id |
|
133 |
* @param aUid requested uid |
|
134 |
* @return error code |
|
135 |
*/ |
|
136 |
TInt AppUidForWgId( TInt aWgId, TUid& aUid ); |
|
137 |
||
138 |
/** |
|
139 |
* Finds out the app uid for the given window group id. |
|
140 |
* @param aWgId a valid window group id |
|
141 |
* @return application uid |
|
142 |
*/ |
|
143 |
TUid AppUidForWgIdL( TInt aWgId ); |
|
144 |
||
145 |
/** |
|
146 |
* Returns the most top parent's wg id or KErrNotFound. |
|
147 |
* @param aWgId a valid window group id |
|
148 |
* @return parent wg id or KErrNotFound if there is no parent |
|
149 |
*/ |
|
150 |
TInt FindMostTopParentWgId( TInt aWgId ); |
|
102
ba63c83f4716
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
88
diff
changeset
|
151 |
|
88
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
152 |
/** |
102
ba63c83f4716
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
88
diff
changeset
|
153 |
* Checks whether window group id was used by contained data. |
88
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
154 |
*/ |
102
ba63c83f4716
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
88
diff
changeset
|
155 |
TBool CheckForWgIdUsage( TInt aWgId ); |
88
3321d3e205b6
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
83
diff
changeset
|
156 |
|
83 | 157 |
private: |
158 |
/** |
|
159 |
* Adds running apps to the list. |
|
160 |
* @param aAppsList array to add to |
|
161 |
*/ |
|
162 |
void CollectAppsL( RTsFswArray& aAppsList ); |
|
163 |
||
164 |
/** |
|
165 |
* Called from CollectTasksL for each entry in the task list. |
|
166 |
* @param aWgId window group id |
|
167 |
* @param aAppUid application uid |
|
168 |
* @param aWgName window group name or NULL |
|
169 |
* @param aNewList list to add to |
|
170 |
* @param aIsWidget true if the entry corresponds to a web widget |
|
171 |
* @return TBool ETrue if it was really a new entry in the list |
|
172 |
*/ |
|
173 |
TBool AddEntryL( TInt aWgId, |
|
174 |
const TUid& aAppUid, |
|
175 |
CApaWindowGroupName* aWgName, |
|
176 |
RTsFswArray& aNewList, |
|
177 |
TBool aIsWidget ); |
|
178 |
||
179 |
/** |
|
180 |
* Checks if there is an entry for same app in the content list. |
|
181 |
* If yes then it takes some of the data for the entry that |
|
182 |
* will correspond to the same app in the refreshed content list. |
|
183 |
* In case of widget, update window group field in content list. |
|
184 |
* @param aEntry new entry in content list |
|
185 |
* @param aAppUid application uid |
|
186 |
* @param aChanged ref to change-flag, set to ETrue if it is sure |
|
187 |
* that the new content list will be different from the previous one |
|
188 |
* @param aNewList ref to new content list |
|
189 |
* @return ETrue if app was found |
|
190 |
*/ |
|
191 |
TBool ConsiderOldDataL( CTsFswEntry& aEntry, |
|
192 |
const TUid& aAppUid, |
|
193 |
TBool& aChanged, |
|
194 |
RTsFswArray& aNewList ); |
|
195 |
||
196 |
/** |
|
197 |
* Adds running widgets to the list. |
|
198 |
* @param aWidgetsList array to add to |
|
199 |
*/ |
|
200 |
void CollectWidgetsL( RTsFswArray& aWidgetsList ); |
|
201 |
||
202 |
/** |
|
203 |
* Returns the parent's wg id or KErrNotFound. |
|
204 |
* @param aWgId a valid window group id |
|
205 |
* @return parent wg id or KErrNotFound if there is no parent |
|
206 |
*/ |
|
207 |
TInt FindParentWgId( TInt aWgId ); |
|
208 |
||
209 |
/** |
|
210 |
* Finds out the application name. |
|
211 |
* @param aWindowName window group name or NULL |
|
212 |
* @param aAppUId application uid |
|
213 |
* @param aWgId window group id |
|
214 |
* @return application name, ownership transferred to caller |
|
215 |
*/ |
|
216 |
HBufC* FindAppNameLC( CApaWindowGroupName* aWindowName, |
|
217 |
const TUid& aAppUid, |
|
218 |
TInt aWgId ); |
|
219 |
||
220 |
/** |
|
221 |
* Checks if the app to which the screenshot belongs is in the task list |
|
222 |
* and updates the entry when found. Also triggers change notification |
|
223 |
* to observer when data is modified. |
|
224 |
* @param aWgIdForScreenshot wgid for the screenshot |
|
225 |
* @param aBitmapHandle handle for screenshot bitmap |
|
226 |
* @return TBool ETrue if the list has been modified |
|
227 |
*/ |
|
228 |
TBool AssignScreenshotHandle( TInt aWgIdForScreenshot, TInt aBitmapHandle ); |
|
229 |
||
230 |
/** |
|
231 |
* Checks if the app to which the screenshot belongs is in the task list |
|
232 |
* and updates the entry when found. |
|
233 |
* @param aWgIdForScreenshot wgid for the screenshot, |
|
234 |
* in case of widget it stands for widget id |
|
235 |
* @param aBitmapHandle handle for screenshot bitmap |
|
236 |
* @param aAsigned result of operation |
|
237 |
*/ |
|
238 |
void AssignScreenshotHandle( TInt aWgIdForScreenshot, |
|
239 |
TInt aBitmapHandle, |
|
240 |
TBool& aAsigned ); |
|
241 |
||
242 |
/** |
|
243 |
* Returns the bitmap handle for the screenshot belonging to the given app |
|
244 |
* or 0 if not (yet) found. |
|
245 |
* @param aWgIdForApp a window group id (from the window group list) |
|
246 |
* @return bitmap handle or 0 |
|
247 |
*/ |
|
248 |
TInt LookupScreenshotHandle( TInt aWgIdForApp ); |
|
249 |
||
250 |
/** |
|
251 |
* Fit existing class contained data list into give one. |
|
252 |
* Data is being changed with application type consideration that is based |
|
253 |
* on aConsiderWidgets param. |
|
254 |
* Function removes or add entries into data depend on given list. |
|
255 |
* @param aListToFit list with actual data |
|
256 |
* @param aConsiderWidgets application type |
|
257 |
* @return ETrue if change occours on data list, EFalse otherwise |
|
258 |
*/ |
|
259 |
TBool FitDataToListL( RTsFswArray& aListToFit, TBool aConsiderWidgets ); |
|
260 |
||
261 |
/** |
|
262 |
* Checks if there is an entry for same app in the given list. |
|
263 |
* @param aEntry entry |
|
264 |
* @param aNewList ref to list |
|
265 |
* @return ETrue if app was found |
|
266 |
*/ |
|
267 |
TBool CheckIfExists( const CTsFswEntry& aEntry, |
|
268 |
const RTsFswArray& aNewList ) const; |
|
269 |
||
270 |
/** |
|
271 |
* Set flag iTaskListDirty; |
|
272 |
* @param aDirty new flag value. |
|
273 |
*/ |
|
274 |
void SetDirty( TBool aDirty ); |
|
275 |
||
276 |
/** |
|
277 |
* Removes the screenshot handle from content entry. |
|
278 |
* Reverts to parental screenshot, if previously was set to embeded. |
|
279 |
* @param aBmpHandle handle of removed screenshot. |
|
280 |
*/ |
|
281 |
TBool RemoveScreenshotFromParent( TInt aBmpHandle ); |
|
282 |
||
283 |
private: |
|
284 |
CTsFswEngine& iEngine; |
|
285 |
||
286 |
RTsFswArray iData; // current fsw content, i.e. the task list |
|
287 |
||
288 |
// always shown app list, own |
|
289 |
CTsFsAlwaysShownAppList* iAlwaysShownAppList; |
|
290 |
||
291 |
// hidden app list, own |
|
292 |
CTsFsHiddenAppList* iHiddenAppList; |
|
293 |
||
294 |
// web widget list, own |
|
295 |
CTsFsWidgetList* iWidgetList; |
|
296 |
||
297 |
// window server session |
|
298 |
RWsSession iWsSession; |
|
299 |
||
300 |
// apparc session |
|
301 |
RApaLsSession iAppArcSession; |
|
302 |
||
303 |
/** |
|
304 |
* Hash table storing the screenshots. |
|
305 |
* Key: window group id for the screenshot |
|
306 |
* (the one received in ApplicationChange) |
|
307 |
* Value: CFbsBitmap*, pointers owned |
|
308 |
*/ |
|
309 |
RHashMap<TInt, CFbsBitmap*> iScreenshots; |
|
310 |
||
311 |
// app icon provider/container instance, own |
|
312 |
CTsFswIconCache* iAppIcons; |
|
313 |
||
314 |
// true if web widgets are supported by the system |
|
315 |
TBool iWidgetsSupported; |
|
316 |
||
317 |
// when true CollectTasksL will call GetAllApps etc. |
|
318 |
// which is slow and need not be done normally, except |
|
319 |
// during startup and perhaps when new applications are installed |
|
320 |
TBool iAppDataRefreshNeeded; |
|
321 |
||
322 |
// Dirty flag, indicates that iData is not up-to-date because |
|
323 |
// there were no subscribed clients during a previous possible |
|
324 |
// change of the task list. |
|
325 |
TBool iTaskListDirty; |
|
326 |
}; |
|
327 |
||
328 |
#endif //TSFSWDATALIST_H |