|
1 /* |
|
2 * Copyright (c) 2004-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: Defines a internal static utility class AknsJavaUtils. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include <AknIconUtils.h> |
|
22 #include <apgcli.h> |
|
23 #include "AknsJavaUtils.h" |
|
24 |
|
25 _LIT(KJavaIconPath,"\\private\\10003a3f\\import\\apps\\NonNative\\Resource"); |
|
26 const TInt KJavaIconPathLength = 48; |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 // ----------------------------------------------------------------------------- |
|
30 // AknsJavaUtils::CreateIconLC |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 void AknsJavaUtils::CreateIconLC( |
|
34 RApaLsSession& aApaSession, |
|
35 TUid aAppUid, |
|
36 CFbsBitmap*& aBitmap, CFbsBitmap*& aMask, |
|
37 TInt aFileBitmapId, TInt aFileMaskId ) |
|
38 { |
|
39 CJavaIconFileProvider* javaIconFileProvider = |
|
40 CJavaIconFileProvider::NewL( aApaSession, aAppUid); |
|
41 AknIconUtils::CreateIconLC(aBitmap,aMask, |
|
42 *javaIconFileProvider,aFileBitmapId,aFileMaskId ); |
|
43 } |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // AknsJavaUtils::IsJavaIcon |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 TBool AknsJavaUtils::IsJavaIcon(const TDesC& aIconFilename) |
|
50 { |
|
51 TBool javaIcon = EFalse; |
|
52 TPtrC fileName = aIconFilename; |
|
53 |
|
54 if (fileName.Length() >= KMaxDriveName + KJavaIconPathLength) |
|
55 { |
|
56 // Remove drive letter and colon from the beginning of |
|
57 // fileName |
|
58 fileName.Set(fileName.Mid( KMaxDriveName )); |
|
59 |
|
60 // Check if fileName contains string KJavaIconPath as prefix |
|
61 if ( fileName.Left( KJavaIconPathLength ).CompareF( KJavaIconPath ) == 0 ) |
|
62 { |
|
63 javaIcon = ETrue; |
|
64 } |
|
65 } |
|
66 return javaIcon; |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // AknsJavaUtils::JavaIconFileProvider::NewL |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 AknsJavaUtils::CJavaIconFileProvider* AknsJavaUtils::CJavaIconFileProvider:: |
|
74 NewL( RApaLsSession& aApaSession, TUid aAppUid) |
|
75 { |
|
76 return new (ELeave) CJavaIconFileProvider(aApaSession,aAppUid); |
|
77 } |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // AknsJavaUtils::JavaIconFileProvider::RetrieveIconFileHandleL |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 void AknsJavaUtils::CJavaIconFileProvider:: |
|
84 RetrieveIconFileHandleL(RFile& aFile, const TIconFileType aType ) |
|
85 { |
|
86 if (aType == MAknIconFileProvider::EMbmFile) |
|
87 { |
|
88 User::Leave( KErrNotFound ); |
|
89 } |
|
90 |
|
91 User::LeaveIfError(iApaSession.GetAppIcon(iAppUid, aFile)); |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // AknsJavaUtils::JavaIconFileProvider::Finished |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 void AknsJavaUtils::CJavaIconFileProvider::Finished() |
|
99 { |
|
100 // commit suicide because AknIcon framework |
|
101 // requested |
|
102 delete this; |
|
103 } |
|
104 |
|
105 // End of File |