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 );
|
|
151 |
|
|
152 |
private:
|
|
153 |
/**
|
|
154 |
* Adds running apps to the list.
|
|
155 |
* @param aAppsList array to add to
|
|
156 |
*/
|
|
157 |
void CollectAppsL( RTsFswArray& aAppsList );
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Called from CollectTasksL for each entry in the task list.
|
|
161 |
* @param aWgId window group id
|
|
162 |
* @param aAppUid application uid
|
|
163 |
* @param aWgName window group name or NULL
|
|
164 |
* @param aNewList list to add to
|
|
165 |
* @param aIsWidget true if the entry corresponds to a web widget
|
|
166 |
* @return TBool ETrue if it was really a new entry in the list
|
|
167 |
*/
|
|
168 |
TBool AddEntryL( TInt aWgId,
|
|
169 |
const TUid& aAppUid,
|
|
170 |
CApaWindowGroupName* aWgName,
|
|
171 |
RTsFswArray& aNewList,
|
|
172 |
TBool aIsWidget );
|
|
173 |
|
|
174 |
/**
|
|
175 |
* Checks if there is an entry for same app in the content list.
|
|
176 |
* If yes then it takes some of the data for the entry that
|
|
177 |
* will correspond to the same app in the refreshed content list.
|
|
178 |
* In case of widget, update window group field in content list.
|
|
179 |
* @param aEntry new entry in content list
|
|
180 |
* @param aAppUid application uid
|
|
181 |
* @param aChanged ref to change-flag, set to ETrue if it is sure
|
|
182 |
* that the new content list will be different from the previous one
|
|
183 |
* @param aNewList ref to new content list
|
|
184 |
* @return ETrue if app was found
|
|
185 |
*/
|
|
186 |
TBool ConsiderOldDataL( CTsFswEntry& aEntry,
|
|
187 |
const TUid& aAppUid,
|
|
188 |
TBool& aChanged,
|
|
189 |
RTsFswArray& aNewList );
|
|
190 |
|
|
191 |
/**
|
|
192 |
* Adds running widgets to the list.
|
|
193 |
* @param aWidgetsList array to add to
|
|
194 |
*/
|
|
195 |
void CollectWidgetsL( RTsFswArray& aWidgetsList );
|
|
196 |
|
|
197 |
/**
|
|
198 |
* Returns the parent's wg id or KErrNotFound.
|
|
199 |
* @param aWgId a valid window group id
|
|
200 |
* @return parent wg id or KErrNotFound if there is no parent
|
|
201 |
*/
|
|
202 |
TInt FindParentWgId( TInt aWgId );
|
|
203 |
|
|
204 |
/**
|
|
205 |
* Finds out the application name.
|
|
206 |
* @param aWindowName window group name or NULL
|
|
207 |
* @param aAppUId application uid
|
|
208 |
* @param aWgId window group id
|
|
209 |
* @return application name, ownership transferred to caller
|
|
210 |
*/
|
|
211 |
HBufC* FindAppNameLC( CApaWindowGroupName* aWindowName,
|
|
212 |
const TUid& aAppUid,
|
|
213 |
TInt aWgId );
|
|
214 |
|
|
215 |
/**
|
|
216 |
* Checks if the app to which the screenshot belongs is in the task list
|
|
217 |
* and updates the entry when found. Also triggers change notification
|
|
218 |
* to observer when data is modified.
|
|
219 |
* @param aWgIdForScreenshot wgid for the screenshot
|
|
220 |
* @param aBitmapHandle handle for screenshot bitmap
|
|
221 |
* @return TBool ETrue if the list has been modified
|
|
222 |
*/
|
|
223 |
TBool AssignScreenshotHandle( TInt aWgIdForScreenshot, TInt aBitmapHandle );
|
|
224 |
|
|
225 |
/**
|
|
226 |
* Checks if the app to which the screenshot belongs is in the task list
|
|
227 |
* and updates the entry when found.
|
|
228 |
* @param aWgIdForScreenshot wgid for the screenshot,
|
|
229 |
* in case of widget it stands for widget id
|
|
230 |
* @param aBitmapHandle handle for screenshot bitmap
|
|
231 |
* @param aAsigned result of operation
|
|
232 |
*/
|
|
233 |
void AssignScreenshotHandle( TInt aWgIdForScreenshot,
|
|
234 |
TInt aBitmapHandle,
|
|
235 |
TBool& aAsigned );
|
|
236 |
|
|
237 |
/**
|
|
238 |
* Returns the bitmap handle for the screenshot belonging to the given app
|
|
239 |
* or 0 if not (yet) found.
|
|
240 |
* @param aWgIdForApp a window group id (from the window group list)
|
|
241 |
* @return bitmap handle or 0
|
|
242 |
*/
|
|
243 |
TInt LookupScreenshotHandle( TInt aWgIdForApp );
|
|
244 |
|
|
245 |
/**
|
|
246 |
* Fit existing class contained data list into give one.
|
|
247 |
* Data is being changed with application type consideration that is based
|
|
248 |
* on aConsiderWidgets param.
|
|
249 |
* Function removes or add entries into data depend on given list.
|
|
250 |
* @param aListToFit list with actual data
|
|
251 |
* @param aConsiderWidgets application type
|
|
252 |
* @return ETrue if change occours on data list, EFalse otherwise
|
|
253 |
*/
|
|
254 |
TBool FitDataToListL( RTsFswArray& aListToFit, TBool aConsiderWidgets );
|
|
255 |
|
|
256 |
/**
|
|
257 |
* Checks if there is an entry for same app in the given list.
|
|
258 |
* @param aEntry entry
|
|
259 |
* @param aNewList ref to list
|
|
260 |
* @return ETrue if app was found
|
|
261 |
*/
|
|
262 |
TBool CheckIfExists( const CTsFswEntry& aEntry,
|
|
263 |
const RTsFswArray& aNewList ) const;
|
|
264 |
|
|
265 |
/**
|
|
266 |
* Set flag iTaskListDirty;
|
|
267 |
* @param aDirty new flag value.
|
|
268 |
*/
|
|
269 |
void SetDirty( TBool aDirty );
|
|
270 |
|
|
271 |
/**
|
|
272 |
* Removes the screenshot handle from content entry.
|
|
273 |
* Reverts to parental screenshot, if previously was set to embeded.
|
|
274 |
* @param aBmpHandle handle of removed screenshot.
|
|
275 |
*/
|
|
276 |
TBool RemoveScreenshotFromParent( TInt aBmpHandle );
|
|
277 |
|
|
278 |
private:
|
|
279 |
CTsFswEngine& iEngine;
|
|
280 |
|
|
281 |
RTsFswArray iData; // current fsw content, i.e. the task list
|
|
282 |
|
|
283 |
// always shown app list, own
|
|
284 |
CTsFsAlwaysShownAppList* iAlwaysShownAppList;
|
|
285 |
|
|
286 |
// hidden app list, own
|
|
287 |
CTsFsHiddenAppList* iHiddenAppList;
|
|
288 |
|
|
289 |
// web widget list, own
|
|
290 |
CTsFsWidgetList* iWidgetList;
|
|
291 |
|
|
292 |
// window server session
|
|
293 |
RWsSession iWsSession;
|
|
294 |
|
|
295 |
// apparc session
|
|
296 |
RApaLsSession iAppArcSession;
|
|
297 |
|
|
298 |
/**
|
|
299 |
* Hash table storing the screenshots.
|
|
300 |
* Key: window group id for the screenshot
|
|
301 |
* (the one received in ApplicationChange)
|
|
302 |
* Value: CFbsBitmap*, pointers owned
|
|
303 |
*/
|
|
304 |
RHashMap<TInt, CFbsBitmap*> iScreenshots;
|
|
305 |
|
|
306 |
// app icon provider/container instance, own
|
|
307 |
CTsFswIconCache* iAppIcons;
|
|
308 |
|
|
309 |
// true if web widgets are supported by the system
|
|
310 |
TBool iWidgetsSupported;
|
|
311 |
|
|
312 |
// when true CollectTasksL will call GetAllApps etc.
|
|
313 |
// which is slow and need not be done normally, except
|
|
314 |
// during startup and perhaps when new applications are installed
|
|
315 |
TBool iAppDataRefreshNeeded;
|
|
316 |
|
|
317 |
// Dirty flag, indicates that iData is not up-to-date because
|
|
318 |
// there were no subscribed clients during a previous possible
|
|
319 |
// change of the task list.
|
|
320 |
TBool iTaskListDirty;
|
|
321 |
};
|
|
322 |
|
|
323 |
#endif //TSFSWDATALIST_H
|