114
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef __MENUSRVENG_H__
|
|
19 |
#define __MENUSRVENG_H__
|
|
20 |
|
|
21 |
// INCLUDES
|
|
22 |
|
|
23 |
#include <e32base.h>
|
|
24 |
#include "menuengobserver.h"
|
|
25 |
#include "menuengobject.h"
|
|
26 |
#include "menusrvengutils.h"
|
|
27 |
#include "menusrvattr.h"
|
|
28 |
// FORWARD DECLARATION
|
|
29 |
|
|
30 |
class CMenuEng;
|
|
31 |
class CMenuSrv;
|
|
32 |
class CMenuSrvSession;
|
|
33 |
class CTimeout;
|
|
34 |
class CMenuSrvAppScanner;
|
|
35 |
class CMenuSrvFolderCrNotifier;
|
|
36 |
class CMcsSatMonitor;
|
|
37 |
class CMcsDrmHandler;
|
|
38 |
class CMcsCacheHandler;
|
|
39 |
class CMcsChildrenHandler;
|
|
40 |
class CMcsRunningAppsHandler;
|
|
41 |
class CMcsGetlistHandler;
|
|
42 |
/**
|
|
43 |
* In release code the macro must be undefined and application
|
|
44 |
* scanning must be enabled!
|
|
45 |
* Define the macro only for testing purposes!
|
|
46 |
*/
|
|
47 |
#undef __TEST_DISABLE_APPSCAN
|
|
48 |
|
|
49 |
// GLOBAL FUNCTIONS
|
|
50 |
|
|
51 |
/**
|
|
52 |
* Menu engine instance.
|
|
53 |
* Shared by the sessions using the same content file.
|
|
54 |
* It is also "shared" by its own iTimedClose timer. The timer keeps this
|
|
55 |
* object alive without any sessions, for a short time.
|
|
56 |
* It is a reference counting object, but that is only used for sanity
|
|
57 |
* checking: this->CObject::iAccessCount == iSessions.Count() + 1.
|
|
58 |
*/
|
|
59 |
NONSHARABLE_CLASS( CMenuSrvEng ) : public CObject, public MMenuEngObserver
|
|
60 |
{
|
|
61 |
public:
|
|
62 |
enum TExtendedAttributes
|
|
63 |
{
|
|
64 |
EMenuAttrTitleName,
|
|
65 |
EMenuAttrShortName,
|
|
66 |
EMenuAttrLongName,
|
|
67 |
EMenuAttrIconFile,
|
|
68 |
EMenuAttrIconId,
|
|
69 |
EMenuAttrMaskId
|
|
70 |
};
|
|
71 |
|
|
72 |
public: // construction
|
|
73 |
|
|
74 |
/**
|
|
75 |
* Destructor.
|
|
76 |
*/
|
|
77 |
virtual ~CMenuSrvEng();
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Two-phased constructor. Leaves on failure.
|
|
81 |
* @param aMenuSrv Menu Server.
|
|
82 |
* @param aContentName Content file name.
|
|
83 |
* @return The constructed object.
|
|
84 |
*/
|
|
85 |
static CMenuSrvEng* NewL( CMenuSrv& aMenuSrv, const TDesC& aContentName );
|
|
86 |
|
|
87 |
private: // construction
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Constructor.
|
|
91 |
* @param aMenuSrv Menu Server.
|
|
92 |
*/
|
|
93 |
CMenuSrvEng( CMenuSrv& aMenuSrv );
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Second-phase constructor.
|
|
97 |
* @param aContentName Content file name.
|
|
98 |
*/
|
|
99 |
void ConstructL( const TDesC& aContentName );
|
|
100 |
|
|
101 |
public: // new methods
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Get content file name (without extension).
|
|
105 |
* @return Content file name.
|
|
106 |
*/
|
|
107 |
const TDesC& ContentName() const { return iContentName; }
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Get the Engine.
|
|
111 |
* @return Engine.
|
|
112 |
*/
|
|
113 |
CMenuEng& Engine() { return *iEng; }
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Add a session. Ownership not taken, this object only keeps a list of
|
|
117 |
* sessions that are dependent on its engine.
|
|
118 |
* @param aSession Session.
|
|
119 |
*/
|
|
120 |
void AddSessionL( CMenuSrvSession* aSession );
|
|
121 |
|
|
122 |
/**
|
|
123 |
* Remove a session. Safe to call if not added.
|
|
124 |
* When no more sessions remain dependent on this object, timed
|
|
125 |
* self-deletion is scheduled.
|
|
126 |
*/
|
|
127 |
void RemoveSession( CMenuSrvSession* aSession );
|
|
128 |
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Get attribute name list.
|
|
132 |
* @since S60 v5.0
|
|
133 |
* @param aList Attribute name list.
|
|
134 |
* @throws System-wide error codes if an error occurs.
|
|
135 |
* @panic None.
|
|
136 |
*
|
|
137 |
*/
|
|
138 |
void GetAttributeListL(
|
|
139 |
TInt aId,
|
|
140 |
RArray<TPtrC>& aList );
|
|
141 |
|
|
142 |
/**
|
|
143 |
* Get attribute value.
|
|
144 |
* @since S60 v5.0
|
|
145 |
* @param aAttrName Attribute name.
|
|
146 |
* @param aAttrExists Will be set to indicate whether attribute exists
|
|
147 |
* or not.
|
|
148 |
* @return Attribute value. Empty string if attribute does not exist.
|
|
149 |
*/
|
|
150 |
TPtrC GetAttributeL( TInt aId, const TDesC& aAttrName, TBool& aAttrExists );
|
|
151 |
|
|
152 |
void GetAttributeL( TInt aId, const TDesC& aAttrName,
|
|
153 |
TBool& aAttrExists, TDes& aAttrVal );
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Get array of running apps
|
|
157 |
*
|
|
158 |
*/
|
|
159 |
void GetRunningAppsL( RArray<TUid>& aArray );
|
|
160 |
|
|
161 |
|
|
162 |
/**
|
|
163 |
* Fetches children count for a folder
|
|
164 |
*/
|
|
165 |
TUint GetChildrenCountL( TInt aId );
|
|
166 |
|
|
167 |
/**
|
|
168 |
* Builds output list for GetList operation and returns result
|
|
169 |
* @param aSerializedInput serialized list with input parameters
|
|
170 |
* for GetList operation
|
|
171 |
* @return size of output list
|
|
172 |
*/
|
|
173 |
TInt GetListSizeL( const TDesC8& aSerializedInput );
|
|
174 |
|
|
175 |
/**
|
|
176 |
* Returns serialized list containing result of GetList oepration
|
|
177 |
* @return serialized output list
|
|
178 |
*/
|
|
179 |
TPtrC8 GetListDataL( );
|
|
180 |
|
|
181 |
/**
|
|
182 |
* Closes output buffer.
|
|
183 |
*/
|
|
184 |
void CloseOutputBuffer( );
|
|
185 |
|
|
186 |
/**
|
|
187 |
* Cleans attribute cache. Used in case of no memory.
|
|
188 |
*/
|
|
189 |
void CleanAttributeCache( );
|
|
190 |
|
|
191 |
private: // from MMenuEngObserver
|
|
192 |
|
|
193 |
|
|
194 |
void GetExtendedAttributesL( TInt aId, const TDesC& aAttrName,
|
|
195 |
TBool& aAttrExists, TDes& aAttrVal );
|
|
196 |
|
|
197 |
void AddToCacheL( TInt aId, const TDesC& aAttrName, TDes& aAttrVal );
|
|
198 |
|
|
199 |
|
|
200 |
/**
|
|
201 |
* Fetches an application native attribute value.
|
|
202 |
* @param aId item id.
|
|
203 |
* @param aAttrExists ETrue if attribute exist.
|
|
204 |
* @param aAttrVal attribute value.
|
|
205 |
*/
|
|
206 |
void ApplicationNativeAttributeL(
|
|
207 |
TInt aId,
|
|
208 |
TBool & aAttrExists,
|
|
209 |
TDes & aAttrVal );
|
|
210 |
|
|
211 |
/**
|
|
212 |
* Engine event. Dispatch events to all dependent sessions.
|
|
213 |
* @param aFolder Events relate to this folder. May be 0.
|
|
214 |
* @param aEvents Events.
|
|
215 |
*/
|
|
216 |
void EngineEvents( TInt aFolder, TInt aEvents );
|
|
217 |
|
|
218 |
/**
|
|
219 |
* Unrecoverable engine error. Dispatch to all dependent sessions.
|
|
220 |
* @param aErr Error code.
|
|
221 |
*/
|
|
222 |
void EngineError( TInt aErr );
|
|
223 |
|
|
224 |
/**
|
|
225 |
* Engine tree reload event.
|
|
226 |
* Run appscanner again.
|
|
227 |
*/
|
|
228 |
void EngineTreeReloaded();
|
|
229 |
/**
|
|
230 |
* Fetches an attribute value from the caption info attributes
|
|
231 |
*/
|
|
232 |
void CaptionInfoL( TInt aId, const TDesC& aAttrName,
|
|
233 |
TBool& aExists, TDes& aAttrVal );
|
|
234 |
|
|
235 |
|
|
236 |
/**
|
|
237 |
* Fetches an attribute value from the skin icon info attributes
|
|
238 |
*/
|
|
239 |
void SkinInfoL( TInt aId, TInt aSelect, TBool& aExists, TDes& aAttrVal );
|
|
240 |
|
|
241 |
/**
|
|
242 |
* Fetches the DRM protection attribute value
|
|
243 |
*/
|
|
244 |
void AppDrmProtectionL( TInt aId, TBool& aExists, TDes& aAttrVal );
|
|
245 |
|
|
246 |
/**
|
|
247 |
* Fetches an attribute value from the caption info attributes for application
|
|
248 |
*/
|
|
249 |
TPtrC AppCaptionInfoL( const CMenuEngObject& aEngObj,
|
|
250 |
const TDesC& aAttrName, TBool& aExists );
|
|
251 |
|
|
252 |
/**
|
|
253 |
* Fetches the children_count attribute value (for folders)
|
|
254 |
*/
|
|
255 |
void FolderChildrenCountL( TInt aId, TBool& aExists, TDes& aAttrVal );
|
|
256 |
|
|
257 |
/**
|
|
258 |
* Fetches the running status for application and folder
|
|
259 |
*/
|
|
260 |
void GetAppRunningL( TInt aId, TBool& aExists, TDes& aAttrVal );
|
|
261 |
|
|
262 |
/**
|
|
263 |
* Appends extended attributes to attributes list
|
|
264 |
*/
|
|
265 |
void AppendExtendedAttrributesL(
|
|
266 |
const TDesC& aType,
|
|
267 |
RArray<TPtrC>& aList );
|
|
268 |
|
|
269 |
|
|
270 |
private: // Data
|
|
271 |
|
|
272 |
CMenuSrv& iMenuSrv; ///< Menu Server.
|
|
273 |
RBuf iContentName; ///< Content name. Own.
|
|
274 |
RPointerArray<CMenuSrvSession> iSessions; ///< Sessions using this engine.
|
|
275 |
CMenuEng* iEng; ///< Engine. Own.
|
|
276 |
CTimeout* iTimedClose; ///< Closing timer. Closes this object.
|
|
277 |
CMenuSrvAppScanner* iAppScanner; ///< App scanner. Own.
|
|
278 |
CMenuSrvFolderCrNotifier* iFolderNotifier; ///< Folder scanner. Own.
|
|
279 |
CMenuSrvEngUtils* iCMenuSrvEngUtils;///CMenuSrvEngUtils. Own.
|
|
280 |
CMcsSatMonitor* iMcsSatMonitor;
|
|
281 |
CMcsDrmHandler* iDrmHander;
|
|
282 |
CMcsRunningAppsHandler* iRunningAppsHandler;//own
|
|
283 |
CMcsCacheHandler* iCacheHandler;
|
|
284 |
CMcsChildrenHandler* iChildrenHandler;
|
|
285 |
CMcsGetlistHandler* iGetlistHandler;
|
|
286 |
};
|
|
287 |
|
|
288 |
#ifdef __TEST_DISABLE_APPSCAN
|
|
289 |
#pragma message("Undefine __TEST_DISABLE_APPSCAN !")
|
|
290 |
#endif
|
|
291 |
|
|
292 |
#endif // __MENUSRVENG_H__
|
|
293 |
|
|
294 |
// End of File
|