114
|
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: This class maintains a list of the running apps, and listen
|
|
15 |
* for changes in the running apps. It calls the observer if there is such a
|
|
16 |
* change.
|
|
17 |
*
|
|
18 |
*
|
|
19 |
*/
|
|
20 |
|
|
21 |
|
|
22 |
#ifndef __MCSRUNNINGAPPSHANDLER_H__
|
|
23 |
#define __MCSRUNNINGAPPSHANDLER_H__
|
|
24 |
|
|
25 |
#include <e32base.h>
|
|
26 |
#include <e32property.h>
|
|
27 |
#include <w32std.h>
|
|
28 |
|
|
29 |
#include "menuengoperation.h"
|
|
30 |
#include "menusrvengutils.h"
|
|
31 |
|
|
32 |
//Forward declatations
|
|
33 |
class CMenuEng;
|
|
34 |
class CMcsCacheHandler;
|
|
35 |
class CMcsRunningAppsWgMonitor;
|
|
36 |
class CMcsRunningAppsFswMonitor;
|
|
37 |
class CMcsRunningAppsHiddenAttrScanner;
|
|
38 |
class CMcsRunningAppsAddRemoveHandler;
|
|
39 |
|
|
40 |
|
|
41 |
/*
|
|
42 |
*
|
|
43 |
*/
|
|
44 |
class TRunningAppsAttr
|
|
45 |
{
|
|
46 |
public:
|
|
47 |
/*
|
|
48 |
*
|
|
49 |
*/
|
|
50 |
TRunningAppsAttr ( TUid aUid, TBool aFswHidden = EFalse,
|
|
51 |
TBool aHidden = EFalse, TBool aIsRunning = EFalse )
|
|
52 |
{
|
|
53 |
iUid = aUid;
|
|
54 |
iHidden = aHidden;
|
|
55 |
iFswHidden = aFswHidden;
|
|
56 |
iIsRunning = aIsRunning;
|
|
57 |
}
|
|
58 |
|
|
59 |
/*
|
|
60 |
*
|
|
61 |
*/
|
|
62 |
TUid GetUid() const
|
|
63 |
{
|
|
64 |
return iUid;
|
|
65 |
}
|
|
66 |
|
|
67 |
/*
|
|
68 |
*
|
|
69 |
*/
|
|
70 |
TBool IsHidden() const
|
|
71 |
{
|
|
72 |
return iHidden;
|
|
73 |
}
|
|
74 |
|
|
75 |
/*
|
|
76 |
*
|
|
77 |
*/
|
|
78 |
void SetHidden( TBool aHidden )
|
|
79 |
{
|
|
80 |
iHidden = aHidden;
|
|
81 |
}
|
|
82 |
|
|
83 |
/*
|
|
84 |
*
|
|
85 |
*/
|
|
86 |
TBool IsFswHidden() const
|
|
87 |
{
|
|
88 |
return iFswHidden;
|
|
89 |
}
|
|
90 |
|
|
91 |
/*
|
|
92 |
*
|
|
93 |
*/
|
|
94 |
void SetFswHidden( TBool aFswHidden )
|
|
95 |
{
|
|
96 |
iFswHidden = aFswHidden;
|
|
97 |
}
|
|
98 |
|
|
99 |
|
|
100 |
/*
|
|
101 |
*
|
|
102 |
*/
|
|
103 |
TBool IsRunning() const
|
|
104 |
{
|
|
105 |
return iIsRunning;
|
|
106 |
}
|
|
107 |
|
|
108 |
/*
|
|
109 |
*
|
|
110 |
*/
|
|
111 |
void SetRunning( TBool aIsRunning )
|
|
112 |
{
|
|
113 |
iIsRunning = aIsRunning;
|
|
114 |
}
|
|
115 |
|
|
116 |
/*
|
|
117 |
*
|
|
118 |
*/
|
|
119 |
static TBool MatchByUid( const TRunningAppsAttr& aArg1,
|
|
120 |
const TRunningAppsAttr& aArg2)
|
|
121 |
{
|
|
122 |
return aArg1.GetUid() == aArg2.GetUid();
|
|
123 |
}
|
|
124 |
|
|
125 |
private: // data
|
|
126 |
|
|
127 |
TUid iUid;
|
|
128 |
TBool iHidden;
|
|
129 |
TBool iFswHidden;
|
|
130 |
TBool iIsRunning;
|
|
131 |
|
|
132 |
};
|
|
133 |
|
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
/**
|
|
138 |
* Interface for updating RunningApps list stored in CMcsRunningAppsHandler class
|
|
139 |
*
|
|
140 |
* @since S60 v3.2
|
|
141 |
*/
|
|
142 |
class MMcsRunningAppsHandler
|
|
143 |
{
|
|
144 |
public:
|
|
145 |
enum TArrayDataType
|
|
146 |
{
|
|
147 |
ERunningApps,
|
|
148 |
EFswHiddenApps,
|
|
149 |
EHiddenApps
|
|
150 |
};
|
|
151 |
/*
|
|
152 |
* Called by HiddenAttr scanner, FSW monitor or WindowsGroup
|
|
153 |
* Monitor.
|
|
154 |
* @param aArray an array containing UIDs of running, hidden or
|
|
155 |
* fsw apps
|
|
156 |
* @param aType type of data stored in aArray
|
|
157 |
*/
|
|
158 |
virtual void HandleListUpdateL(const RArray<TUid>& aArray,
|
|
159 |
TArrayDataType aType ) = 0;
|
|
160 |
|
|
161 |
/*
|
|
162 |
* Called by AddRemoveHandler
|
|
163 |
* @param aFolder id of folder for which the method was invoked
|
|
164 |
*/
|
|
165 |
virtual void HandleAddRemoveRunningAppL( TInt aFolder ) = 0;
|
|
166 |
|
|
167 |
};
|
|
168 |
|
|
169 |
/*
|
|
170 |
* RunningApps Handler.
|
|
171 |
* @lib mcsmenu.lib
|
|
172 |
* @since S60 v5.0
|
|
173 |
*/
|
|
174 |
NONSHARABLE_CLASS( CMcsRunningAppsHandler ): public CBase, MMcsRunningAppsHandler
|
|
175 |
{
|
|
176 |
public:
|
|
177 |
|
|
178 |
/**
|
|
179 |
* Factory method.
|
|
180 |
*/
|
|
181 |
static CMcsRunningAppsHandler* NewL(
|
|
182 |
CMenuEng& aEng,
|
|
183 |
CMcsCacheHandler& aCacheHandler );
|
|
184 |
|
|
185 |
/**
|
|
186 |
* Destructor.
|
|
187 |
*/
|
|
188 |
~CMcsRunningAppsHandler();
|
|
189 |
|
|
190 |
/**
|
|
191 |
* Called by EngineEvents method
|
|
192 |
* @param aFolder folder id
|
|
193 |
* @param aEvents events
|
|
194 |
*/
|
|
195 |
void EngineEventsL( TInt aFolder, TInt aEvents );
|
|
196 |
|
|
197 |
/**
|
|
198 |
* Called by CMenuSrvEng class object
|
|
199 |
* @param aFolder folder id
|
|
200 |
* @param aEvents events
|
|
201 |
*/
|
|
202 |
void EngineEvents( TInt aFolder, TInt aEvents );
|
|
203 |
|
|
204 |
/**
|
|
205 |
* Fills aArray with UIDs of running apps
|
|
206 |
* @param aArray array to be filled with UIDs of running apps
|
|
207 |
*/
|
|
208 |
void GetRunningAppsL( RArray<TUid>& aArray );
|
|
209 |
|
|
210 |
/**
|
|
211 |
* Returns running status of an item
|
|
212 |
* @param aItemId id of the item
|
|
213 |
* @return running status of an item
|
|
214 |
*/
|
|
215 |
TBool GetRunningStatusL( TInt aItemId );
|
|
216 |
|
|
217 |
|
|
218 |
// from MMcsRunningAppsHandler
|
|
219 |
|
|
220 |
/*
|
|
221 |
* Called by HiddenAttr scanner, FSW monitor or WindowsGroup
|
|
222 |
* Monitor.
|
|
223 |
* @param aArray an array containing UIDs of running, hidden or
|
|
224 |
* fsw apps
|
|
225 |
* @param aType type of data stored in aArray
|
|
226 |
*/
|
|
227 |
void HandleListUpdateL(const RArray<TUid>& aArray, TArrayDataType aType );
|
|
228 |
|
|
229 |
/*
|
|
230 |
* Called by AddRemoveHandler
|
|
231 |
* @param id of folder for which the method was invoked
|
|
232 |
*/
|
|
233 |
void HandleAddRemoveRunningAppL( TInt aFolder );
|
|
234 |
|
|
235 |
private:
|
|
236 |
/**
|
|
237 |
* Constructor.
|
|
238 |
*/
|
|
239 |
CMcsRunningAppsHandler(
|
|
240 |
CMenuEng& aEng,
|
|
241 |
CMcsCacheHandler& aCacheHandler );
|
|
242 |
|
|
243 |
/**
|
|
244 |
* 2nd phase constructor
|
|
245 |
*/
|
|
246 |
void ConstructL();
|
|
247 |
|
|
248 |
/**
|
|
249 |
* Called by HandleListUpdateL
|
|
250 |
* @param aArray array with UIDs of running apps
|
|
251 |
*/
|
|
252 |
void HandleRunningAppsChangedL( const RArray<TUid>& aArray );
|
|
253 |
|
|
254 |
/**
|
|
255 |
* Called by HandleListUpdateL
|
|
256 |
* @param aArray array with UIDs of FSW hidden apps
|
|
257 |
*/
|
|
258 |
void HandleFswHiddenAppsChangedL( const RArray<TUid>& aArray );
|
|
259 |
|
|
260 |
/**
|
|
261 |
* Called by HandleListUpdateL
|
|
262 |
* @param aArray array with UIDs of hidden apps
|
|
263 |
*/
|
|
264 |
void HandleHiddenAppsChangedL(const RArray<TUid>& aArray );
|
|
265 |
|
|
266 |
/**
|
|
267 |
* Sends AttributeChange notification for item and parents of the item
|
|
268 |
* it it is necessary, it is also responsible for removing data from cache
|
|
269 |
* if attribute value cahnged
|
|
270 |
* @param aId id of item with changed running status attribute
|
|
271 |
*/
|
|
272 |
void HandleNotificationL( TInt aId );
|
|
273 |
|
|
274 |
/**
|
|
275 |
* Sends AttributeChange notification for items and parents of items with
|
|
276 |
* given uid, it is also responsible for removing data from cache
|
|
277 |
* if attribute value has changed
|
|
278 |
* @param aAppUid uid of items with changed running status attribute
|
|
279 |
*/
|
|
280 |
void HandleNotificationL( TUid aAppUid );
|
|
281 |
|
|
282 |
/**
|
|
283 |
* Gets list of items with secified uid
|
|
284 |
* @param aAppUid items uid
|
|
285 |
* @return KErrNotFound if no item was found KErrNone if succesfull
|
|
286 |
*/
|
|
287 |
TInt GetItemsListL( TUid aAppUid, RArray<TMenuItem>& aItemArray );
|
|
288 |
|
|
289 |
/*
|
|
290 |
* Updates array containing folders with running status
|
|
291 |
* @param aFolderId id of a folder
|
|
292 |
* @param aNewRunningStatus current running status
|
|
293 |
*/
|
|
294 |
void UpdateFolderRunningStatusL( TInt aFolderId, TBool aNewRunningStatus );
|
|
295 |
|
|
296 |
|
|
297 |
/**
|
|
298 |
* Updates array containing folders with running status.
|
|
299 |
* It is called at startup and it scans all folders
|
|
300 |
*/
|
|
301 |
void UpdateFoldersRunningStatusL( );
|
|
302 |
|
|
303 |
/**
|
|
304 |
* Gets running status for CMenuEngObject
|
|
305 |
* @param aEngObj object to be checked
|
|
306 |
* @return running status of an object
|
|
307 |
*/
|
|
308 |
TBool GetRunningStatusL( const CMenuEngObject& aEngObj );
|
|
309 |
|
|
310 |
/**
|
|
311 |
* Gets previous Folder running status
|
|
312 |
* @param aId id of the folder
|
|
313 |
* @return previous running status of a folder (stored in
|
|
314 |
* iRunningFolderStatus array )
|
|
315 |
*/
|
|
316 |
TBool GetFolderPreviousRunningStatusL( TInt aId );
|
|
317 |
|
|
318 |
|
|
319 |
/**
|
|
320 |
* Gets current folder running status
|
|
321 |
* @param aId id of the folder
|
|
322 |
* @return running status of a folder
|
|
323 |
*/
|
|
324 |
TBool GetFolderRunningStatusL( TInt aId );
|
|
325 |
|
|
326 |
/**
|
|
327 |
* Gets current application running status
|
|
328 |
* @param aUid UID of an application
|
|
329 |
* @return running status of an application
|
|
330 |
*/
|
|
331 |
TBool GetAppRunningStatusL( TUid aUid );
|
|
332 |
|
|
333 |
private:
|
|
334 |
|
|
335 |
CMenuEng& iEng ; ///< Engine. not own
|
|
336 |
|
|
337 |
/** not own
|
|
338 |
*/
|
|
339 |
CMcsCacheHandler& iCacheHandler;
|
|
340 |
|
|
341 |
/*
|
|
342 |
* own
|
|
343 |
*/
|
|
344 |
CMcsRunningAppsWgMonitor* iWindowGroupMonitor;
|
|
345 |
|
|
346 |
/*
|
|
347 |
* own
|
|
348 |
*/
|
|
349 |
CMcsRunningAppsFswMonitor* iFswMonitor;
|
|
350 |
|
|
351 |
/*
|
|
352 |
* own
|
|
353 |
*/
|
|
354 |
CMcsRunningAppsHiddenAttrScanner* iHiddenAttrScanner;
|
|
355 |
|
|
356 |
/*
|
|
357 |
* own
|
|
358 |
*/
|
|
359 |
CMcsRunningAppsAddRemoveHandler* iAddRemoveHandler;
|
|
360 |
|
|
361 |
/*
|
|
362 |
* own
|
|
363 |
*/
|
|
364 |
RArray<TRunningAppsAttr> iRunningApps;
|
|
365 |
|
|
366 |
/*
|
|
367 |
* own
|
|
368 |
*/
|
|
369 |
RArray<TInt> iRunningFolderStatus;
|
|
370 |
};
|
|
371 |
|
|
372 |
#endif // __MCSRUNNINGAPPSHANDLER_H__
|