|
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 #include <mcsmenuutils.h> |
|
18 #include <AknIconUtils.h> |
|
19 #include <avkon.mbg> |
|
20 #include <javaregistry.h> |
|
21 #include <javaregistryentry.h> |
|
22 #include <drmrightsinfo.h> |
|
23 #include <e32property.h> |
|
24 #include <SATDomainPSKeys.h> |
|
25 #include <AknTaskList.h> |
|
26 #include <mmf/common/mmfcontrollerpluginresolver.h> |
|
27 #include <WidgetRegistryClient.h> |
|
28 |
|
29 #include "menusrvengutils.h" |
|
30 |
|
31 #include "mcsdef.h" |
|
32 #include "mcsmenu.h" |
|
33 #include "mcsmenuitem.h" |
|
34 #include "mcsmenufilter.h" |
|
35 #include "mcssathandler.h" |
|
36 #include "menusrvappscanner.h" |
|
37 |
|
38 _LIT( KMidletPostfix, ".fakeapp" ); |
|
39 |
|
40 // ================= LOCAL FUNCTIONS ======================== |
|
41 |
|
42 // --------------------------------------------------------- |
|
43 // GetAppUid |
|
44 // --------------------------------------------------------- |
|
45 // |
|
46 TInt CMenuSrvEngUtils::GetAppUid( const CMenuEngObject& aEngObj, TUid& aAppUid ) |
|
47 { |
|
48 TInt err( 0 ); |
|
49 TPtrC attrVal; |
|
50 TBool attrExists( EFalse ); |
|
51 TBool localized( EFalse );// |
|
52 attrExists = aEngObj.FindAttribute(KMenuAttrUid, attrVal, localized); |
|
53 if ( !attrExists ) |
|
54 { |
|
55 err = KErrNotFound; |
|
56 } |
|
57 else |
|
58 { |
|
59 TUint appUid; |
|
60 err = MenuUtils::GetTUint( attrVal, appUid ); |
|
61 if ( !err ) |
|
62 { |
|
63 aAppUid = TUid::Uid( appUid ); |
|
64 } |
|
65 } |
|
66 return err; |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------- |
|
70 // GetApaAppInfo |
|
71 // --------------------------------------------------------- |
|
72 // |
|
73 TInt CMenuSrvEngUtils::GetApaAppInfo( |
|
74 const CMenuEngObject& aEngObj, |
|
75 TApaAppInfo& aInfo ) const |
|
76 { |
|
77 TUid uid; |
|
78 TInt err; |
|
79 err = CMenuSrvEngUtils::GetAppUid( aEngObj, uid ); |
|
80 if ( err == KErrNone ) |
|
81 { |
|
82 err = GetApaAppInfo( uid, aInfo ); |
|
83 } |
|
84 |
|
85 return err; |
|
86 } |
|
87 |
|
88 // --------------------------------------------------------- |
|
89 // GetApaAppInfo |
|
90 // --------------------------------------------------------- |
|
91 // |
|
92 TInt CMenuSrvEngUtils::GetApaAppInfo( |
|
93 TUid aUid, |
|
94 TApaAppInfo& aInfo ) const |
|
95 { |
|
96 return iApaLsSession.GetAppInfo( aInfo, aUid ); |
|
97 } |
|
98 // --------------------------------------------------------- |
|
99 // CMenuSrvEngUtils::GetJavaContentIdL |
|
100 // --------------------------------------------------------- |
|
101 // |
|
102 void CMenuSrvEngUtils::GetJavaContentIdL( TUid aUid, TDes& aContentId ) |
|
103 { |
|
104 Java::CJavaRegistry* javaRegistry; |
|
105 Java::CJavaRegistryEntry* regEntry = NULL; |
|
106 |
|
107 javaRegistry = Java::CJavaRegistry::NewL(); |
|
108 CleanupStack::PushL( javaRegistry ); |
|
109 |
|
110 //regEntry will be NULL if there is no Java application |
|
111 //corresponding to the specified aUid |
|
112 regEntry = javaRegistry->RegistryEntryL( aUid ); |
|
113 |
|
114 //DrmContentId() will return reference to NULL when |
|
115 //Java application is not DRM protected |
|
116 if( regEntry && ( ®Entry->DrmContentId() ) ) |
|
117 { |
|
118 aContentId.Copy( regEntry->DrmContentId() ); |
|
119 } |
|
120 else |
|
121 { |
|
122 aContentId.Copy( KNullDesC ); |
|
123 } |
|
124 |
|
125 delete regEntry; |
|
126 CleanupStack::PopAndDestroy( javaRegistry ); |
|
127 } |
|
128 |
|
129 |
|
130 // ================= MEMBER FUNCTIONS ======================= |
|
131 |
|
132 // --------------------------------------------------------- |
|
133 // CMenuSrvEngUtils::~CMenuSrvEngUtils |
|
134 // --------------------------------------------------------- |
|
135 // |
|
136 CMenuSrvEngUtils::~CMenuSrvEngUtils() |
|
137 { |
|
138 delete iSatHandler; |
|
139 iApaLsSession.Close(); |
|
140 iWidgetSession.Close(); |
|
141 iWsSession.Close(); |
|
142 } |
|
143 |
|
144 // --------------------------------------------------------- |
|
145 // CMenuSrvEngUtils::NewL |
|
146 // --------------------------------------------------------- |
|
147 // |
|
148 CMenuSrvEngUtils* CMenuSrvEngUtils::NewL( CMenuEng& aEng ) |
|
149 { |
|
150 CMenuSrvEngUtils* utils = new (ELeave) CMenuSrvEngUtils( aEng ); |
|
151 CleanupStack::PushL( utils ); |
|
152 utils->ConstructL(); |
|
153 CleanupStack::Pop( utils ); |
|
154 return utils; |
|
155 } |
|
156 |
|
157 // --------------------------------------------------------- |
|
158 // CMenuSrvEngUtils::CMenuSrvEngUtils |
|
159 // --------------------------------------------------------- |
|
160 // |
|
161 CMenuSrvEngUtils::CMenuSrvEngUtils( CMenuEng& aEng ) |
|
162 : iEng( aEng ) |
|
163 { |
|
164 } |
|
165 |
|
166 // --------------------------------------------------------- |
|
167 // CMenuSrvEngUtils::ConstructL |
|
168 // --------------------------------------------------------- |
|
169 // |
|
170 void CMenuSrvEngUtils::ConstructL() |
|
171 { |
|
172 User::LeaveIfError( iApaLsSession.Connect() ); |
|
173 User::LeaveIfError( iWidgetSession.Connect() ); |
|
174 User::LeaveIfError( iWsSession.Connect() ); |
|
175 iSatHandler = CMcsSatHandler::NewL(); |
|
176 } |
|
177 |
|
178 // --------------------------------------------------------- |
|
179 // CMenuSrvEngUtils::GetAppInfo |
|
180 // --------------------------------------------------------- |
|
181 // |
|
182 TInt CMenuSrvEngUtils::GetAppInfo( const CMenuEngObject& aEngObj, TApaAppInfo& aAppInfo ) const |
|
183 { |
|
184 TUid appUid; |
|
185 TInt err = GetAppUid( aEngObj, appUid ); |
|
186 if ( !err ) |
|
187 { |
|
188 if( appUid == KSatUid ) |
|
189 { |
|
190 err = GetSatAppInfo( aAppInfo ); |
|
191 } |
|
192 else |
|
193 { |
|
194 err = iApaLsSession.GetAppInfo( aAppInfo, appUid ); |
|
195 } |
|
196 } |
|
197 return err; |
|
198 } |
|
199 |
|
200 // --------------------------------------------------------- |
|
201 // CMenuSrvEngUtils::GetAppInfo |
|
202 // --------------------------------------------------------- |
|
203 // |
|
204 TInt CMenuSrvEngUtils::GetAppInfoL( TInt aItemId, TApaAppInfo& aAppInfo ) const |
|
205 { |
|
206 TInt err( 0 ); |
|
207 const CMenuEngObject& obj = iEng.ObjectL( aItemId ); |
|
208 err = GetAppInfo( obj, aAppInfo ); |
|
209 return err; |
|
210 } |
|
211 |
|
212 |
|
213 // --------------------------------------------------------- |
|
214 // CMenuSrvEngUtils::GetFolderIcon |
|
215 // Knowing that in case of folders there is no way to query |
|
216 // folder's icon file from APPARC, the responsibility of handling this is |
|
217 // transferred to the caller of this method, so that he may show some default or |
|
218 // display error etc. |
|
219 // --------------------------------------------------------- |
|
220 // |
|
221 TInt CMenuSrvEngUtils::GetFolderIcon( const CMenuEngObject& /*aEngObj*/, |
|
222 HBufC*& aFullFileName, |
|
223 TInt& /*aBitmapId*/, |
|
224 TInt& /*aMaskId*/ ) const |
|
225 { |
|
226 __ASSERT_ALWAYS( !aFullFileName, User::Invariant() ); |
|
227 |
|
228 return KErrNotFound; |
|
229 } |
|
230 |
|
231 // --------------------------------------------------------- |
|
232 // CMenuSrvEngUtils::GetFolderIcon |
|
233 // --------------------------------------------------------- |
|
234 // |
|
235 TInt CMenuSrvEngUtils::GetFolderIconL( TInt aItemId, |
|
236 HBufC*& aFullFileName, |
|
237 TInt& aBitmapId, |
|
238 TInt& aMaskId ) const |
|
239 { |
|
240 __ASSERT_ALWAYS( !aFullFileName, User::Invariant() ); |
|
241 |
|
242 TInt err( 0 ); |
|
243 const CMenuEngObject& obj = iEng.ObjectL( aItemId ); |
|
244 err = GetFolderIcon( obj, aFullFileName, aBitmapId, aMaskId ); |
|
245 return err; |
|
246 } |
|
247 |
|
248 |
|
249 // --------------------------------------------------------- |
|
250 // CMenuSrvEngUtils::IsNative |
|
251 // --------------------------------------------------------- |
|
252 // |
|
253 void CMenuSrvEngUtils::IsNative( const CMenuEngObject& aEngObj, |
|
254 TBool& aAttrExists, TDes& aAttrVal ) |
|
255 { |
|
256 aAttrExists = EFalse; |
|
257 if( aEngObj.Type().CompareF( KMenuTypeApp ) == KErrNone ) |
|
258 { |
|
259 TInt err; |
|
260 TUid uid; |
|
261 err = GetAppUid( aEngObj, uid ); |
|
262 if( err == KErrNone ) |
|
263 { |
|
264 TBool native(EFalse); |
|
265 err = IsNative( uid, native ); |
|
266 if( !err ) |
|
267 { |
|
268 aAttrExists = ETrue; |
|
269 if( native ) |
|
270 { |
|
271 aAttrVal = KMenuTrue(); |
|
272 } |
|
273 else |
|
274 { |
|
275 aAttrVal = KMenuFalse(); |
|
276 } |
|
277 } |
|
278 } |
|
279 } |
|
280 if( !aAttrExists ) |
|
281 { |
|
282 aAttrVal = KNullDesC(); |
|
283 } |
|
284 } |
|
285 |
|
286 // --------------------------------------------------------- |
|
287 // CMenuSrvEngUtils::IsNativeL |
|
288 // --------------------------------------------------------- |
|
289 // |
|
290 |
|
291 TInt CMenuSrvEngUtils::IsNative( TUid aAppUid, TBool& aIsNative ) |
|
292 { |
|
293 TInt error(KErrNotFound); |
|
294 TApaAppInfo appInfo; |
|
295 |
|
296 error = iApaLsSession.GetAppInfo( appInfo, aAppUid ); |
|
297 if( error == KErrNone ) |
|
298 { |
|
299 error = iApaLsSession.IsProgram( appInfo.iFullName, aIsNative ); |
|
300 } |
|
301 |
|
302 return error; |
|
303 } |
|
304 |
|
305 // --------------------------------------------------------- |
|
306 // CMenuSrvEngUtils::GetDrmProtectionByContentIdL |
|
307 // --------------------------------------------------------- |
|
308 // |
|
309 TInt CMenuSrvEngUtils::GetDrmProtectionByContentIdL(const TDesC& aContentId, |
|
310 TDRMProtectionInfo& aProtectionInfo) const |
|
311 { |
|
312 TInt err( KErrNone ); |
|
313 DRM::CDrmRightsInfo* drmInfo = DRM::CDrmRightsInfo::NewL(); |
|
314 CleanupStack::PushL( drmInfo ); |
|
315 |
|
316 { |
|
317 DRM::TDrmRightsInfo drmRightInfo; |
|
318 TRAP( err, drmInfo->CheckRightsL( aContentId, |
|
319 ContentAccess::EExecute, |
|
320 drmRightInfo ); ) |
|
321 if( err == KErrNone ) |
|
322 { |
|
323 switch (drmRightInfo) |
|
324 { |
|
325 case (DRM::EURightsInfoValid)://1 |
|
326 aProtectionInfo = EDRMProtected; |
|
327 break; |
|
328 |
|
329 case (DRM::EURightsInfoExpired)://2 |
|
330 aProtectionInfo = EDRMRightsExpired; |
|
331 break; |
|
332 |
|
333 case (DRM::EURightsInfoMissing)://3 |
|
334 aProtectionInfo = EDRMRightsExpired; |
|
335 break; |
|
336 case (DRM::EURightsInfoFuture)://4 |
|
337 |
|
338 default: |
|
339 aProtectionInfo = EDRMUnknownProtection; |
|
340 break; |
|
341 } |
|
342 } |
|
343 } |
|
344 |
|
345 CleanupStack::PopAndDestroy( drmInfo ); |
|
346 return err; |
|
347 } |
|
348 |
|
349 |
|
350 // --------------------------------------------------------- |
|
351 // CMenuSrvEngUtils::GetDrmProtection |
|
352 // --------------------------------------------------------- |
|
353 // |
|
354 TInt CMenuSrvEngUtils::GetDrmProtectionL( |
|
355 const TUid aAppUid, |
|
356 TDRMProtectionInfo& aProtectionInfo ) const |
|
357 { |
|
358 TInt err( KErrNone ); |
|
359 |
|
360 TApaAppInfo info; |
|
361 |
|
362 aProtectionInfo = EDRMUnknownProtection; |
|
363 |
|
364 err = GetApaAppInfo( aAppUid, info ); |
|
365 if ( err == KErrNone ) |
|
366 { |
|
367 if( IsMiddlet( info ) ) |
|
368 { |
|
369 TBuf<KMaxFileName> contentId; |
|
370 GetJavaContentIdL( info.iUid, contentId ); |
|
371 if ( contentId != KNullDesC ) |
|
372 { |
|
373 GetDrmProtectionByContentIdL( contentId, aProtectionInfo ); |
|
374 } |
|
375 } |
|
376 } |
|
377 |
|
378 |
|
379 return err; |
|
380 } |
|
381 |
|
382 // --------------------------------------------------------- |
|
383 // CMenuSrvEngUtils::GetDrmProtection |
|
384 // --------------------------------------------------------- |
|
385 // |
|
386 TInt CMenuSrvEngUtils::GetDrmProtectionL( |
|
387 const CMenuEngObject& aEngObj, |
|
388 TDRMProtectionInfo& aProtectionInfo ) const |
|
389 { |
|
390 TInt err( KErrNone ); |
|
391 |
|
392 if ( aEngObj.Type().CompareF( KMenuTypeApp ) == 0 ) |
|
393 { |
|
394 TUid uid; |
|
395 err = CMenuSrvEngUtils::GetAppUid( aEngObj, uid ); |
|
396 if ( err == KErrNone ) |
|
397 { |
|
398 err = GetDrmProtectionL( uid, aProtectionInfo ); |
|
399 } |
|
400 } |
|
401 else |
|
402 { |
|
403 err = KErrNone; |
|
404 aProtectionInfo = EDRMUnknownProtection; |
|
405 } |
|
406 |
|
407 return err; |
|
408 } |
|
409 |
|
410 // --------------------------------------------------------- |
|
411 // CMenuSrvEngUtils::GetDrmProtection |
|
412 // --------------------------------------------------------- |
|
413 // |
|
414 TInt CMenuSrvEngUtils::GetDrmProtectionL(TInt aItemId, |
|
415 TDRMProtectionInfo& aProtectionInfo) const |
|
416 { |
|
417 TInt err( 0 ); |
|
418 const CMenuEngObject& obj = iEng.ObjectL( aItemId ); |
|
419 err = GetDrmProtectionL( obj, aProtectionInfo ); |
|
420 return err; |
|
421 } |
|
422 /* |
|
423 // --------------------------------------------------------- |
|
424 // CMenuSrvEngUtils::GetDrmProtection |
|
425 // --------------------------------------------------------- |
|
426 // |
|
427 TBool CMenuSrvEngUtils::GetAppRunningL( TInt aItemId ) |
|
428 { |
|
429 TInt err( 0 ); |
|
430 const CMenuEngObject& obj = iEng.ObjectL( aItemId ); |
|
431 err = GetAppRunningL( obj ); |
|
432 return err; |
|
433 } |
|
434 |
|
435 // --------------------------------------------------------- |
|
436 // CMenuSrvEngUtils::GetDrmProtection |
|
437 // --------------------------------------------------------- |
|
438 // |
|
439 TBool CMenuSrvEngUtils::GetAppRunningL( const CMenuEngObject& aEngObj ) |
|
440 { |
|
441 TBool runningApp( EFalse ); |
|
442 if ( aEngObj.Type().CompareF( KMenuTypeApp ) == KErrNone ) |
|
443 { |
|
444 TUid appUid; |
|
445 TInt errorUid = GetAppUid( aEngObj, appUid ); |
|
446 |
|
447 if( !errorUid ) |
|
448 { |
|
449 CheckAppRunningL( appUid , runningApp ); |
|
450 } |
|
451 else |
|
452 { |
|
453 return EFalse; |
|
454 } |
|
455 } |
|
456 else if( aEngObj.Type().CompareF( KMenuTypeFolder ) == KErrNone ) |
|
457 { |
|
458 GetChildrenRunningAppL( aEngObj.Id(), runningApp ); |
|
459 } |
|
460 |
|
461 return runningApp; |
|
462 } |
|
463 |
|
464 // --------------------------------------------------------- |
|
465 // CMenuSrvEngUtils::GetChildrenRunningAppL |
|
466 // --------------------------------------------------------- |
|
467 // |
|
468 void CMenuSrvEngUtils::GetChildrenRunningAppL( TInt id, |
|
469 TBool& aRunningApp ) |
|
470 { |
|
471 TMenuSrvTypeFilter filter; |
|
472 filter.SetType( KMenuTypeApp() ); |
|
473 |
|
474 RArray<TMenuItem> aItemArray; |
|
475 CleanupClosePushL(aItemArray); |
|
476 iEng.GetItemsL( aItemArray , id , &filter, ETrue ); |
|
477 for( TInt i = 0; i < aItemArray.Count(); i++) |
|
478 { |
|
479 const CMenuEngObject& obj = iEng.ObjectL( aItemArray[i].Id() ); |
|
480 TUid appUid; |
|
481 TInt errorUid = GetAppUid( obj, appUid ); |
|
482 |
|
483 if( !errorUid && |
|
484 !(obj.Flags() & TMenuItem::EHidden) ) |
|
485 { |
|
486 CheckAppRunningL( appUid , aRunningApp ); |
|
487 } |
|
488 if( aRunningApp ) |
|
489 { |
|
490 break; |
|
491 } |
|
492 } |
|
493 CleanupStack::PopAndDestroy( &aItemArray ); |
|
494 } |
|
495 |
|
496 // --------------------------------------------------------- |
|
497 // CMenuSrvEngUtils::CheckAppRunning |
|
498 // --------------------------------------------------------- |
|
499 // |
|
500 void CMenuSrvEngUtils::CheckAppRunningL( TUid aUid, TBool& aRunningApp ) |
|
501 { |
|
502 if ( iWidgetSession.IsWidget( aUid ) ) |
|
503 { |
|
504 aRunningApp = iWidgetSession.IsWidgetRunning( aUid ); |
|
505 } |
|
506 else |
|
507 { |
|
508 CAknTaskList* taskList = CAknTaskList::NewLC( iWsSession ); |
|
509 |
|
510 TApaTask task = taskList->FindRootApp( aUid ); |
|
511 aRunningApp = task.Exists(); |
|
512 |
|
513 CleanupStack::PopAndDestroy( taskList ); |
|
514 } |
|
515 }*/ |
|
516 |
|
517 // --------------------------------------------------------- |
|
518 // CMenuSrvEngUtils::GetSatAppInfo |
|
519 // --------------------------------------------------------- |
|
520 // |
|
521 TInt CMenuSrvEngUtils::GetSatAppInfo( TApaAppInfo& aAppInfo ) const |
|
522 { |
|
523 TBuf<KApaMaxAppCaption> aBuf; |
|
524 TInt err = iSatHandler->GetName( aBuf ); |
|
525 if( err == KErrNone ) |
|
526 { |
|
527 aAppInfo.iShortCaption = aBuf; |
|
528 aAppInfo.iCaption = aBuf; |
|
529 } |
|
530 return err; |
|
531 } |
|
532 |
|
533 // --------------------------------------------------------- |
|
534 // MenuSrvUtil::SetValueSkinMajorId |
|
535 // --------------------------------------------------------- |
|
536 // |
|
537 void CMenuSrvEngUtils::SetValueSkinId( TDes& aAttrName, TInt aValue ) |
|
538 { |
|
539 MenuUtils::SetTUint( aAttrName, aValue ); |
|
540 } |
|
541 |
|
542 // --------------------------------------------------------- |
|
543 // MenuSrvUtil::UidToStringL |
|
544 // --------------------------------------------------------- |
|
545 // |
|
546 void MenuSrvUtil::UidToStringL( TUint aUid, TDes& aResult, |
|
547 TBool aLegacy, TRadix aRadix ) |
|
548 { |
|
549 aResult.Zero(); |
|
550 |
|
551 TBuf<KUidChars> number; |
|
552 if( !aLegacy ) |
|
553 { |
|
554 if (aRadix == EHex) |
|
555 { |
|
556 aResult.Append( KHex ); |
|
557 } |
|
558 } |
|
559 number.AppendNum( aUid, aRadix ); |
|
560 number.UpperCase(); |
|
561 |
|
562 aResult.Append( number ); |
|
563 |
|
564 } |
|
565 |
|
566 // --------------------------------------------------------- |
|
567 // TMenuSrvTypeFilter::MatchesObject |
|
568 // --------------------------------------------------------- |
|
569 // |
|
570 TBool TMenuSrvTypeFilter::MatchesObject |
|
571 ( const CMenuEngObject& aObject ) const |
|
572 { |
|
573 return iType == aObject.Type(); |
|
574 } |
|
575 |
|
576 // ==================== MEMBER FUNCTIONS ==================== |
|
577 |
|
578 // --------------------------------------------------------- |
|
579 // TMenuSrvTypeAttrFilter::MatchesObject |
|
580 // --------------------------------------------------------- |
|
581 // |
|
582 TBool TMenuSrvTypeAttrFilter::MatchesObject |
|
583 ( const CMenuEngObject& aObject ) const |
|
584 { |
|
585 if ( TMenuSrvTypeFilter::MatchesObject( aObject ) ) |
|
586 { |
|
587 TPtrC val; |
|
588 TBool dummy; |
|
589 if( aObject.FindAttribute( iAttrName, val, dummy ) ) |
|
590 { |
|
591 if( !val.CompareF( iAttrValue ) ) |
|
592 { |
|
593 return ETrue; // Match. |
|
594 } |
|
595 } |
|
596 } |
|
597 return EFalse; |
|
598 } |
|
599 |
|
600 // --------------------------------------------------------- |
|
601 // TMenuSrvAttrFilter::MatchesObject |
|
602 // --------------------------------------------------------- |
|
603 // |
|
604 TBool TMenuSrvAttrFilter::MatchesObject |
|
605 ( const CMenuEngObject& aObject ) const |
|
606 { |
|
607 TPtrC val; |
|
608 TBool dummy; |
|
609 if( aObject.FindAttribute( iAttrName, val, dummy ) ) |
|
610 { |
|
611 if( !val.CompareF( iAttrValue ) ) |
|
612 { |
|
613 return ETrue; // Match. |
|
614 } |
|
615 } |
|
616 return EFalse; |
|
617 } |
|
618 |
|
619 // ==================== MEMBER FUNCTIONS ==================== |
|
620 |
|
621 // --------------------------------------------------------- |
|
622 // TMenuSrvTypeAttrFilter::MatchesObject |
|
623 // --------------------------------------------------------- |
|
624 // |
|
625 TBool TMenuSrvTypeAttrExistsFilter::MatchesObject |
|
626 ( const CMenuEngObject& aObject ) const |
|
627 { |
|
628 if ( TMenuSrvTypeFilter::MatchesObject( aObject ) ) |
|
629 { |
|
630 TPtrC val; |
|
631 TBool dummy; |
|
632 if( aObject.FindAttribute( iAttrName, val, dummy ) ) |
|
633 { |
|
634 return ETrue; // Match. |
|
635 } |
|
636 } |
|
637 return EFalse; |
|
638 } |
|
639 |
|
640 // --------------------------------------------------------- |
|
641 // TMenuSrvTypeAttrFilter::MatchesObject |
|
642 // --------------------------------------------------------- |
|
643 // |
|
644 TBool TMenuSrvAttrExistsFilter::MatchesObject |
|
645 ( const CMenuEngObject& aObject ) const |
|
646 { |
|
647 TPtrC val; |
|
648 TBool dummy; |
|
649 if( aObject.FindAttribute( iAttrName, val, dummy ) ) |
|
650 { |
|
651 return ETrue; // Match. |
|
652 } |
|
653 return EFalse; |
|
654 } |
|
655 |
|
656 // --------------------------------------------------------- |
|
657 // TMenuSrvHiddenAppFilter::MatchesObject |
|
658 // --------------------------------------------------------- |
|
659 // |
|
660 TBool TMenuSrvHiddenAppFilter::MatchesObject |
|
661 ( const CMenuEngObject& aObject ) const |
|
662 { |
|
663 if (KMenuTypeApp() == aObject.Type()) |
|
664 { |
|
665 if( aObject.Flags() & TMenuItem::EHidden ) |
|
666 { |
|
667 return ETrue; // Match. |
|
668 } |
|
669 } |
|
670 return EFalse; |
|
671 } |
|
672 |
|
673 // --------------------------------------------------------- |
|
674 // CMenuSrvEngUtils::IsMiddlet |
|
675 // --------------------------------------------------------- |
|
676 // |
|
677 TBool CMenuSrvEngUtils::IsMiddlet( const TApaAppInfo& aInfo ) |
|
678 { |
|
679 TBool ret( EFalse ); |
|
680 if( aInfo.iFullName.Right( KMidletPostfix().Length() ). |
|
681 CompareF( KMidletPostfix ) == 0 ) |
|
682 { |
|
683 ret = ETrue; |
|
684 } |
|
685 return ret; |
|
686 } |
|
687 |