108 |
107 |
109 /** |
108 /** |
110 * Callback for rotation completion. Takes ownership of a given |
109 * Callback for rotation completion. Takes ownership of a given |
111 * bitmap. |
110 * bitmap. |
112 */ |
111 */ |
113 void RotationComplete( TInt aWgId, |
112 void RotationComplete( TInt aWgId, |
114 CFbsBitmap* aBitmap, |
113 CFbsBitmap* aBitmap, |
115 CTsRotationTask* aCompletedTask, |
114 CTsRotationTask* aCompletedTask, |
116 TInt aError ); |
115 TInt aError ); |
117 |
116 |
|
117 /** |
|
118 * Called by CPS publisher when changes occours on widgets' CPS data. |
|
119 * Copies screenshot with use of delivered bitmap handle. |
|
120 * Moves last changed widget with entry into start position. |
|
121 */ |
|
122 void HandleWidgetUpdateL( TInt aWidgetId, TInt aBitmapHandle ); |
|
123 |
118 private: |
124 private: |
119 // from CActive |
125 // from CActive |
120 void RunL(); |
126 void RunL(); |
121 TInt RunError( TInt aError ); |
127 TInt RunError( TInt aError ); |
122 void DoCancel(); |
128 void DoCancel(); |
123 |
129 |
124 // from MTsFswTaskListObserver |
130 // from MTsFswTaskListObserver |
125 void UpdateTaskList(); |
131 void UpdateTaskList(); |
126 |
132 |
127 // from MTsFswResourceObserver |
133 // from MTsFswResourceObserver |
128 void HandleResourceChange( TInt aType ); |
134 void HandleResourceChange( TInt aType ); |
129 |
135 |
130 // from MTsFsHiddenAppListObserver |
136 // from MTsFsHiddenAppListObserver |
131 void HiddenAppListUpdated(); |
137 void HiddenAppListUpdated(); |
132 |
138 |
133 // from MTsFastSwapPreviewObserver |
139 // from MTsFastSwapPreviewObserver |
134 void HandleFswPpApplicationChange( TInt aWgId, TInt aFbsHandle ); |
140 void HandleFswPpApplicationChange( TInt aWgId, TInt aFbsHandle ); |
135 void HandleFswPpApplicationUnregistered( TInt aWgId ); |
141 void HandleFswPpApplicationUnregistered( TInt aWgId ); |
136 void HandleFswPpApplicationBitmapRotation( TInt aWgId, TBool aClockwise ); |
142 void HandleFswPpApplicationBitmapRotation( TInt aWgId, TBool aClockwise ); |
137 |
143 |
138 void RotateL( CFbsBitmap& aBitmap, TInt aWgId, TBool aClockwise ); |
144 void RotateL( CFbsBitmap& aBitmap, TInt aWgId, TBool aClockwise ); |
139 |
145 |
140 private: |
146 private: |
141 /** |
147 /** |
142 * Constructor. |
148 * Constructor. |
143 */ |
149 */ |
144 CTsFswEngine( MTsFswEngineObserver& aObserver ); |
150 CTsFswEngine( MTsFswEngineObserver& aObserver ); |
145 |
151 |
146 /** |
152 /** |
147 * Performs 2nd phase construction. |
153 * Performs 2nd phase construction. |
148 */ |
154 */ |
149 void ConstructL(); |
155 void ConstructL(); |
150 |
156 |
151 /** |
157 /** |
152 * Gets the window group list and reconstructs the fsw content. |
158 * Gets the window group list and reconstructs the fsw content. |
153 * @return TBool ETrue if the list has been modified |
159 * @return TBool ETrue if the list has been modified |
154 */ |
160 */ |
155 TBool CollectTasksL(); |
161 TBool CollectTasksL(); |
156 |
|
157 /** |
|
158 * Called from CollectTasksL for each entry in the task list. |
|
159 * @param aWgId window group id |
|
160 * @param aAppUid application uid |
|
161 * @param aWgName window group name or NULL |
|
162 * @param aNewList list to add to |
|
163 * @param aIsWidget true if the entry corresponds to a web widget |
|
164 * @return TBool ETrue if it was really a new entry in the list |
|
165 */ |
|
166 TBool AddEntryL( TInt aWgId, const TUid& aAppUid, |
|
167 CApaWindowGroupName* aWgName, RTsFswArray& aNewList, |
|
168 TBool aIsWidget ); |
|
169 |
|
170 /** |
|
171 * Checks if there is an entry for same app in the content list. |
|
172 * If yes then it takes some of the data for the entry that |
|
173 * will correspond to the same app in the refreshed content list. |
|
174 * @param aEntry new entry in content list |
|
175 * @param aAppUid application uid |
|
176 * @param aChanged ref to change-flag, set to ETrue if it is sure |
|
177 * that the new content list will be different from the previous one |
|
178 * @param aNewList ref to new content list |
|
179 * @return ETrue if app was found |
|
180 */ |
|
181 TBool CheckIfExistsL( CTsFswEntry& aEntry, |
|
182 const TUid& aAppUid, |
|
183 TBool& aChanged, |
|
184 RTsFswArray& aNewList ); |
|
185 |
|
186 /** |
|
187 * Adds running widgets to the list. |
|
188 * @param aNewList array to add to |
|
189 */ |
|
190 void CheckWidgetsL( RTsFswArray& aNewList ); |
|
191 |
162 |
192 /** |
163 /** |
193 * Finds out the app uid for the given window group id. |
164 * Finds out the app uid for the given window group id. |
194 * @param aWgId a valid window group id |
165 * @param aWgId a valid window group id |
195 * @return application uid |
166 * @return application uid |
196 */ |
167 */ |
197 TUid AppUidForWgIdL( TInt aWgId ); |
168 TUid AppUidForWgIdL( TInt aWgId ); |
198 |
169 |
199 /** |
|
200 * Returns the parent's wg id or KErrNotFound. |
|
201 * @param aWgId a valid window group id |
|
202 * @return parent wg id or KErrNotFound if there is no parent |
|
203 */ |
|
204 TInt FindParentWgId( TInt aWgId ); |
|
205 |
|
206 /** |
|
207 * Returns the most top parent's wg id or KErrNotFound. |
|
208 * @param aWgId a valid window group id |
|
209 * @return parent wg id or KErrNotFound if there is no parent |
|
210 */ |
|
211 TInt FindMostTopParentWgId( TInt aWgId ); |
|
212 |
|
213 /** |
170 /** |
214 * Finds out the application name. |
171 * Finds out the application name. |
215 * @param aWindowName window group name or NULL |
172 * @param aWindowName window group name or NULL |
216 * @param aAppUId application uid |
173 * @param aAppUId application uid |
217 * @param aWgId window group id |
174 * @param aWgId window group id |
218 * @return application name, ownership transferred to caller |
175 * @return application name, ownership transferred to caller |
219 */ |
176 */ |
220 HBufC* FindAppNameLC( CApaWindowGroupName* aWindowName, |
177 HBufC* FindAppNameLC( CApaWindowGroupName* aWindowName, |
221 const TUid& aAppUid, TInt aWgId ); |
178 const TUid& aAppUid, |
|
179 TInt aWgId ); |
222 |
180 |
223 /** |
181 /** |
224 * Makes a copy of the bitmap with the given handle. |
182 * Makes a copy of the bitmap with the given handle. |
225 * @param aFbsHandle bitmap handle |
183 * @param aFbsHandle bitmap handle |
226 * @param aKeepAspectRatio if true then aspect ratio is kept |
184 * @param aKeepAspectRatio if true then aspect ratio is kept |
227 * @return CFbsBitmap* the copy, ownership transferred to caller |
185 * @return CFbsBitmap* the copy, ownership transferred to caller |
228 */ |
186 */ |
229 CFbsBitmap* CopyBitmapL( TInt aFbsHandle, TBool aKeepAspectRatio ); |
187 CFbsBitmap* CopyBitmapL( TInt aFbsHandle, TBool aKeepAspectRatio ); |
230 |
188 |
231 /** |
|
232 * Checks if the app to which the screenshot belongs is in the task list |
|
233 * and updates the entry when found. Also triggers change notification |
|
234 * to observer when data is modified. |
|
235 * @param aWgIdForScreenshot wgid for the screenshot |
|
236 * @param aBitmapHandle handle for screenshot bitmap |
|
237 */ |
|
238 void AssignScreenshotHandle( TInt aWgIdForScreenshot, TInt aBitmapHandle ); |
|
239 |
|
240 /** |
|
241 * Checks if the app to which the screenshot belongs is in the task list |
|
242 * and updates the entry when found. |
|
243 * @param aWgIdForScreenshot wgid for the screenshot |
|
244 * @param aBitmapHandle handle for screenshot bitmap |
|
245 * @param aAsigned result of operation |
|
246 */ |
|
247 void AssignScreenshotHandle( TInt aWgIdForScreenshot, |
|
248 TInt aBitmapHandle, TBool& aAsigned ); |
|
249 |
|
250 /** |
|
251 * Returns the bitmap handle for the screenshot belonging to the given app |
|
252 * or 0 if not (yet) found. |
|
253 * @param aWgIdForApp a window group id (from the window group list) |
|
254 * @return bitmap handle or 0 |
|
255 */ |
|
256 TInt LookupScreenshotHandle( TInt aWgIdForApp ); |
|
257 |
|
258 /** |
189 /** |
259 * Callback for the iUpdateStarter timer. |
190 * Callback for the iUpdateStarter timer. |
260 * Calls CollectTasksL and notifies the observer if the task list |
191 * Calls CollectTasksL and notifies the observer if the task list |
261 * has really been modified. |
192 * has really been modified. |
262 */ |
193 */ |
286 |
217 |
287 /** |
218 /** |
288 * Close running widget |
219 * Close running widget |
289 * @param aOffset - widget info offset |
220 * @param aOffset - widget info offset |
290 */ |
221 */ |
291 void CloseWidgetL(TInt aOffset); |
222 void CloseWidgetL( TInt aOffset ); |
292 |
223 |
293 private: // data |
224 /** |
|
225 * Removes screenshot bitmap from contained iDataList |
|
226 */ |
|
227 void RemoveScreenshot( TInt aWgId ); |
|
228 |
|
229 /** |
|
230 * Add or overwrite screenshot datamap into iDataList |
|
231 * @return ETrue if content was changed |
|
232 */ |
|
233 TBool StoreScreenshot( TInt aWgId, CFbsBitmap* aBmp ); |
|
234 |
|
235 private: |
|
236 // data |
294 MTsFswEngineObserver& iObserver; |
237 MTsFswEngineObserver& iObserver; |
295 RTsFswArray iData; // current fsw content, i.e. the task list |
|
296 CEikonEnv* iEnv; // not own |
238 CEikonEnv* iEnv; // not own |
297 |
|
298 // always shown app list, own |
|
299 CTsFsAlwaysShownAppList* iAlwaysShownAppList; |
|
300 |
|
301 // hidden app list, own |
|
302 CTsFsHiddenAppList* iHiddenAppList; |
|
303 |
|
304 // web widget list, own |
|
305 CTsFsWidgetList* iWidgetList; |
|
306 |
239 |
307 // window server session |
240 // window server session |
308 RWsSession iWsSession; |
241 RWsSession iWsSession; |
309 |
242 |
310 // apparc session |
243 // apparc session |
311 RApaLsSession iAppArcSession; |
244 RApaLsSession iAppArcSession; |
312 |
245 |
313 /** |
|
314 * Hash table storing the screenshots. |
|
315 * Key: window group id for the screenshot |
|
316 * (the one received in ApplicationChange) |
|
317 * Value: CFbsBitmap*, pointers owned |
|
318 */ |
|
319 RHashMap<TInt, CFbsBitmap*> iScreenshots; |
|
320 |
|
321 // preview provider instance, own |
246 // preview provider instance, own |
322 CTsFastSwapPreviewProvider* iPreviewProvider; |
247 CTsFastSwapPreviewProvider* iPreviewProvider; |
323 |
248 |
324 // timer to defer content refresh |
249 // timer to defer content refresh |
325 CPeriodic* iUpdateStarter; |
250 CPeriodic* iUpdateStarter; |
326 |
251 |
327 // app icon provider/container instance, own |
|
328 CTsFswIconCache* iAppIcons; |
|
329 |
|
330 // true if web widgets are supported by the system |
252 // true if web widgets are supported by the system |
331 TBool iWidgetsSupported; |
253 TBool iWidgetsSupported; |
332 |
254 |
333 // PS property to listen for swi status changes |
255 // PS property to listen for swi status changes |
334 RProperty iSwiProp; |
256 RProperty iSwiProp; |
335 // when true CollectTasksL will call GetAllApps etc. |
|
336 // which is slow and need not be done normally, except |
|
337 // during startup and perhaps when new applications are installed |
|
338 TBool iAppDataRefreshNeeded; |
|
339 |
257 |
340 // window group ids returned by last WindowGroupList call |
258 // window group ids returned by last WindowGroupList call |
341 RArray<TInt> iWgIds; |
259 RArray<TInt> iWgIds; |
342 |
|
343 // Dirty flag, indicates that iData is not up-to-date because |
|
344 // there were no subscribed clients during a previous possible |
|
345 // change of the task list. |
|
346 TBool iTaskListDirty; |
|
347 |
260 |
348 // For publishing the foreground app uid to Context Framework |
261 // For publishing the foreground app uid to Context Framework |
349 TAppUidHexString iFgAppUidStr; |
262 TAppUidHexString iFgAppUidStr; |
350 TUid iFgAppUid; |
263 TUid iFgAppUid; |
351 |
264 |
352 // For rotating bitmaps |
265 // For rotating bitmaps |
353 RPointerArray<CTsRotationTask> iRotaTasks; |
266 RPointerArray<CTsRotationTask> iRotaTasks; |
|
267 |
|
268 CTsFswDataList* iDataList;//own |
|
269 |
|
270 //Used to observ wigets' actions on CPS service |
|
271 CTSCpsNotifier* iCpsWidgetPublisher;//owned |
354 }; |
272 }; |
355 |
|
356 |
273 |
357 /** |
274 /** |
358 * Listener for rotation complete event |
275 * Listener for rotation complete event |
359 */ |
276 */ |
360 NONSHARABLE_CLASS( CTsRotationTask ) : public CActive |
277 NONSHARABLE_CLASS( CTsRotationTask ) : public CActive |
361 { |
278 { |
362 public: |
279 public: |
363 CTsRotationTask( CTsFswEngine& aEngine ); |
280 CTsRotationTask( CTsFswEngine& aEngine ); |
364 ~CTsRotationTask(); |
281 ~CTsRotationTask(); |
365 void StartLD( TInt aWgId, |
282 void StartLD( TInt aWgId, CFbsBitmap* aBitmapHandle, TBool aClockwise ); |
366 CFbsBitmap* aBitmapHandle, |
|
367 TBool aClockwise ); |
|
368 private: |
283 private: |
369 void RunL(); |
284 void RunL(); |
370 void DoCancel(); |
285 void DoCancel(); |
371 private: // Data |
286 private: |
|
287 // Data |
372 CTsFswEngine& iEngine; |
288 CTsFswEngine& iEngine; |
373 TInt iWgId; |
289 TInt iWgId; |
374 CFbsBitmap* iBitmap; // owned for the duration of transformation |
290 CFbsBitmap* iBitmap; // owned for the duration of transformation |
375 CBitmapRotator* iRotator; // owned |
291 CBitmapRotator* iRotator; // owned |
376 }; |
292 }; |