|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // aplappinforeader.h |
|
15 // |
|
16 |
|
17 #ifndef __APLAPPINFOREADER_H__ |
|
18 #define __APLAPPINFOREADER_H__ |
|
19 |
|
20 #include <apaid.h> |
|
21 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
22 #include <apaidpartner.h> |
|
23 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
24 #include <apmstd.h> |
|
25 #include <barsc.h> |
|
26 #include <barsread.h> |
|
27 #include <apgicnfl.h> |
|
28 |
|
29 class TEntry; |
|
30 class RFs; |
|
31 class CResourceFile; |
|
32 class RResourceReader; |
|
33 class CApaAppList; |
|
34 class CApaAppIconArray; |
|
35 class CApaAppViewData; |
|
36 |
|
37 /** |
|
38 @internalComponent |
|
39 */ |
|
40 NONSHARABLE_CLASS(ApaUtils) |
|
41 { |
|
42 public: |
|
43 static TBool TypeUidIsForRegistrationFile(const TUidType& aUidType); |
|
44 }; |
|
45 |
|
46 |
|
47 /** |
|
48 @internalComponent |
|
49 */ |
|
50 NONSHARABLE_CLASS(CApaIconLoader) : public CBase |
|
51 { |
|
52 public: |
|
53 static CApaIconLoader* NewL(RFs& aFs); |
|
54 static CApaIconLoader* NewLC(RFs& aFs); |
|
55 ~CApaIconLoader(); |
|
56 |
|
57 void AddIconArrayL(const CApaAppIconArray& aIcons); |
|
58 void LoadAllIconsL(); |
|
59 TBool LoadIconsL(TInt aNumOfIcons, const TDesC& aMbmFileName, CArrayPtr<CApaMaskedBitmap>& aIcons); |
|
60 private: |
|
61 CApaIconLoader(RFs& aFs); |
|
62 void ConstructL(); |
|
63 TInt IconIndexL(const TDesC& aFileName, TBool& aUseCache); |
|
64 static TInt CompareIcons(const CApaMaskedBitmap& aFirst, const CApaMaskedBitmap& aSecond); |
|
65 private: |
|
66 struct TKeyValuePair |
|
67 { |
|
68 public: |
|
69 HBufC* iFileName; // key |
|
70 TInt iIndex; // value |
|
71 }; |
|
72 private: |
|
73 RFs& iFs; |
|
74 RArray<TKeyValuePair> iIconIndexArray; |
|
75 TInt iCachedArrayIndex; |
|
76 RPointerArray<CApaAppIconArray> iIconArrays; |
|
77 }; |
|
78 |
|
79 /** |
|
80 @internalComponent |
|
81 */ |
|
82 NONSHARABLE_CLASS(CApaAppIconArray) : public CBase |
|
83 { |
|
84 public: |
|
85 static CApaAppIconArray* NewL(); // creates a dummy icon array |
|
86 static CApaAppIconArray* NewAppIconsL(TInt aNumOfIcons, const TDesC& aMbmFileName, CApaIconLoader& aIconLoader); |
|
87 static CApaAppIconArray* NewViewIconsL(TInt aNumOfIcons, const TDesC& aMbmFileName, CApaIconLoader& aIconLoader); |
|
88 static CApaAppIconArray* NewDefaultIconsL(); // creates a CApaAppIconArray that uses the default icons |
|
89 static CApaAppIconArray* NewRealDefaultIconsLC(TInt aNumOfIcons, const TDesC& aMbmFileName, CApaIconLoader& aIconLoader); // creates the CApaAppIconArray that contains the default icons |
|
90 ~CApaAppIconArray(); |
|
91 |
|
92 TBool LoadIconsL(); |
|
93 |
|
94 CApaMaskedBitmap* IconBySize(const TSize& aSize) const; |
|
95 CArrayFixFlat<TSize>* IconSizesL() const; |
|
96 TInt Count() const; |
|
97 TBool DefaultIconsUsed() const; |
|
98 CApaMaskedBitmap* operator[](TInt aIndex) const; |
|
99 |
|
100 TBool AreAppIconsLoaded() const; |
|
101 TBool AreViewIconsLoaded() const; |
|
102 private: |
|
103 static CApaAppIconArray* NewL(TInt aNumOfIcons, const TDesC& aMbmFileName, CApaIconLoader& aIconLoader, TBool aFallbackToDefaultIcons); |
|
104 static CApaAppIconArray* NewLC(TInt aNumOfIcons, const TDesC& aMbmFileName, CApaIconLoader& aIconLoader, TBool aFallbackToDefaultIcons); |
|
105 CApaAppIconArray(); |
|
106 CApaAppIconArray(TInt aNumOfIcons, CApaIconLoader& aIconLoader, TBool aFallbackToDefaultIcons); |
|
107 void ConstructL(const TDesC& aMbmFileName); |
|
108 void GetDefaultIconsL(); |
|
109 const CApaAppIconArray& DefaultIcons() const; |
|
110 private: |
|
111 TInt iNumOfIcons; |
|
112 CApaIconLoader* iIconLoader; |
|
113 TBool iFallbackToDefaultIcons; |
|
114 HBufC* iMbmFileName; |
|
115 TBool iDefaultIconsUsed; |
|
116 CArrayPtrFlat<CApaMaskedBitmap>* iIcons; |
|
117 CApaAppList* iDefaultIconsProvider; |
|
118 }; |
|
119 |
|
120 /** |
|
121 Reads application information from a combination of registration file, |
|
122 optional localisable resource file and optional icon file. |
|
123 |
|
124 @internalComponent |
|
125 */ |
|
126 class CApaAppInfoReader : public CBase |
|
127 { |
|
128 public: |
|
129 static CApaAppInfoReader* NewL(RFs& aFs, const TDesC& aRegistrationFileName, TUid aAppUid); |
|
130 TBool ReadL(); |
|
131 static TBool FileIsMbmWithGenericExtensionL(const TDesC& aFileName); |
|
132 ~CApaAppInfoReader(); |
|
133 public: |
|
134 HBufC* AppBinaryFullName(); |
|
135 TUidType AppBinaryUidType() const; |
|
136 void Capability(TDes8& aCapabilityBuf) const; |
|
137 TUint DefaultScreenNumber() const; |
|
138 CArrayPtrFlat<CApaAppViewData>* Views(); |
|
139 CDesCArray* OwnedFiles(); |
|
140 |
|
141 HBufC* Caption(); |
|
142 HBufC* ShortCaption(); |
|
143 TInt NumOfAppIcons() const; |
|
144 CApaAppIconArray* Icons(); |
|
145 HBufC* IconFileName(); |
|
146 TBool NonMbmIconFile() const; |
|
147 CApaIconLoader* IconLoader(); |
|
148 |
|
149 TTime TimeStamp() const; |
|
150 TTime IconFileTimeStamp() const; |
|
151 |
|
152 HBufC* LocalisableResourceFileName(); |
|
153 TTime LocalisableResourceFileTimeStamp() const; |
|
154 TLanguage AppLanguage() const; |
|
155 CArrayFixFlat<TApaAppServiceInfo>* ServiceArray(TInt& aIndexOfFirstOpenService); |
|
156 HBufC8* OpaqueData(); |
|
157 private: |
|
158 CApaAppInfoReader(RFs& aFs, const TDesC& aRegistrationFileName, TUid aAppUid); |
|
159 void ConstructL(); |
|
160 void ReadMandatoryInfoL(RResourceReader& aResourceReader); |
|
161 void ReadNonLocalisableInfoL(RResourceReader& aResourceReader, CResourceFile*& aLocalisableResourceFile, TUint& aLocalisableResourceId); |
|
162 void ReadNonLocalisableOptionalInfoL(RResourceReader& aResourceReader, const CResourceFile* aRegistrationFile, CResourceFile* aLocalisableResourceFile); |
|
163 void ReadMimeTypesSupportedL(RResourceReader& aResourceReader, CArrayFixFlat<TDataTypeWithPriority>& aMimeTypesSupported); |
|
164 void ReadLocalisableInfoL(const CResourceFile& aResourceFile, TUint aResourceId, TBool& aUseDefaultIcons); |
|
165 HBufC* CreateFullIconFileNameL(const TDesC& aIconFileName) const; |
|
166 TBool HasWriteDeviceDataCap(); |
|
167 void ReadAppSecurityInfo(); |
|
168 |
|
169 static HBufC8* ReadOpaqueDataL(TUint aResourceId, const CResourceFile* aRegistrationFile, CResourceFile* aLocalisableResourceFile); |
|
170 private: |
|
171 RFs& iFs; |
|
172 TUid iAppUid; |
|
173 HBufC* iAppBinaryFullName; |
|
174 TUidType iAppBinaryUidType; |
|
175 TTime iTimeStamp; |
|
176 TTime iIconFileTimeStamp; |
|
177 TApaAppCapability iCapability; |
|
178 TUint iDefaultScreenNumber; |
|
179 HBufC* iCaption; |
|
180 HBufC* iShortCaption; |
|
181 CApaAppIconArray* iIcons; |
|
182 TInt iNumOfAppIcons; |
|
183 CArrayPtrFlat<CApaAppViewData>* iViewDataArray; |
|
184 CDesCArray* iOwnedFileArray; |
|
185 HBufC* iIconFileName; |
|
186 TBool iNonMbmIconFile; // ETrue if icon filename is not an MBM file, however, EFalse does not necessarily mean it is an MBM file |
|
187 HBufC* iLocalisableResourceFileName; |
|
188 TTime iLocalisableResourceFileTimeStamp; |
|
189 TLanguage iApplicationLanguage; |
|
190 CArrayFixFlat<TApaAppServiceInfo>* iServiceArray; |
|
191 TInt iIndexOfFirstOpenService; |
|
192 TBool iOpenServiceIsLegacy; |
|
193 HBufC8* iOpaqueData; |
|
194 private: |
|
195 const TDesC& iRegistrationFileName; |
|
196 TBool iHasWriteDeviceDataCap; |
|
197 TBool iIsSidTrusted; |
|
198 // This flag is used to determine if app security info was allready read |
|
199 TBool iSecurityInfoHasBeenRead; |
|
200 CApaIconLoader* iIconLoader; |
|
201 }; |
|
202 |
|
203 |
|
204 #endif // __APLAPPINFOREADER_H__ |