|
1 // Copyright (c) 1997-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 // aplapplist.h |
|
15 // |
|
16 |
|
17 #ifndef __APLAPPLIST_H__ |
|
18 #define __APLAPPLIST_H__ |
|
19 |
|
20 /*#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
21 #include <apmfndr.h> |
|
22 #else |
|
23 #include <apmstd.h> |
|
24 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
25 */ |
|
26 #include <apaid.h> |
|
27 #include <badesca.h> |
|
28 #include <s32file.h> |
|
29 |
|
30 // classes defined: |
|
31 class CApaAppList; |
|
32 class CApaAppViewData; |
|
33 // classes referenced: |
|
34 class CApaMaskedBitmap; |
|
35 class TEntry; |
|
36 class RFs; |
|
37 class CApaAppRegFinder; |
|
38 class CApaAppIconArray; |
|
39 class CApaIconLoader; |
|
40 class TApaAppEntry; |
|
41 class CApaAppData; |
|
42 class CApaIconCaptionOverrides; |
|
43 class CApaIconCaptionCenrepObserver; |
|
44 |
|
45 /** |
|
46 KIgnoreScreenMode |
|
47 |
|
48 @internalTechnology |
|
49 */ |
|
50 const TInt KIgnoreScreenMode=-1; |
|
51 |
|
52 |
|
53 /** |
|
54 The MApaAppListObserver interface allows a class to be informed when a CApaAppList is |
|
55 updated. |
|
56 |
|
57 @internalComponent |
|
58 */ |
|
59 class MApaAppListObserver |
|
60 { |
|
61 public: |
|
62 virtual void NotifyUpdate(TInt aReason)=0; |
|
63 virtual void InitialListPopulationComplete()=0; |
|
64 virtual void NotifyScanComplete()=0; |
|
65 }; |
|
66 |
|
67 /** |
|
68 The CApaAppList class provides a list of all available applications present on a device. |
|
69 Its functionality should be accessed through the Apparc Server. |
|
70 |
|
71 @internalComponent |
|
72 */ |
|
73 class CApaAppList : public CBase |
|
74 { |
|
75 public: |
|
76 IMPORT_C static CApaAppList* NewL(RFs& aFs, TBool aLoadMbmIconsOnDemand, TInt aTimeoutDelay = 50000); // takes ownership of aAppRegFinder |
|
77 public: |
|
78 IMPORT_C void PurgeL(); |
|
79 IMPORT_C TInt Count() const; |
|
80 IMPORT_C CApaAppData* FirstApp() const; |
|
81 IMPORT_C CApaAppData* FirstApp(TInt aScreenMode) const; |
|
82 IMPORT_C CApaAppData* NextApp(const CApaAppData* aApp) const; |
|
83 IMPORT_C CApaAppData* NextApp(const CApaAppData* aApp, TInt aScreenMode) const; |
|
84 IMPORT_C CApaAppData* AppDataByUid(TUid aAppUid) const; |
|
85 IMPORT_C void StopScan(TBool aNNAInstall = EFalse); |
|
86 IMPORT_C void RestartScanL(); |
|
87 IMPORT_C TBool AppListUpdatePending(); |
|
88 // ER5 |
|
89 IMPORT_C TUid PreferredDataHandlerL(const TDataType& aDataType) const; |
|
90 IMPORT_C void StartIdleUpdateL(); |
|
91 IMPORT_C void StartIdleUpdateL(MApaAppListObserver* aObserver); |
|
92 IMPORT_C void InitListL(MApaAppListObserver* aObserver); |
|
93 IMPORT_C TBool IsIdleUpdateComplete() const; |
|
94 // |
|
95 IMPORT_C TBool IsFirstScanComplete() const; |
|
96 IMPORT_C TBool AppScanInProgress() const; |
|
97 IMPORT_C CBufFlat* ServiceArrayBufferL(TUid aAppUid) const; |
|
98 IMPORT_C CBufFlat* ServiceImplArrayBufferL(TUid aServiceUid) const; |
|
99 IMPORT_C CBufFlat* ServiceImplArrayBufferL(TUid aServiceUid, const TDataType& aDataType) const; |
|
100 IMPORT_C CBufFlat* ServiceUidBufferL(TUid aAppUid) const; |
|
101 IMPORT_C CBufFlat* ServiceOpaqueDataBufferL(TUid aAppUid, TUid aServiceUid) const; |
|
102 IMPORT_C CApaAppData* FindAndAddSpecificAppL(CApaAppRegFinder* aFinder, TUid aAppUid); |
|
103 IMPORT_C TUid PreferredDataHandlerL(const TDataType& aDataType, const TUid* aServiceUid, |
|
104 TInt& aPriority) const; |
|
105 IMPORT_C ~CApaAppList(); |
|
106 // 9.1 |
|
107 IMPORT_C CApaAppData* AppDataByFileName(const TDesC& aFullFileName) const; |
|
108 /*IMPORT_C*/ RFs& ShareProtectedFileServer(); |
|
109 IMPORT_C void AddForcedRegistrationL(const TDesC& aRegistrationFile); |
|
110 IMPORT_C void ResetForcedRegistrations(); |
|
111 IMPORT_C TBool IsLanguageChangePending() const; |
|
112 IMPORT_C static CApaAppList* Self(); |
|
113 IMPORT_C CArrayFixFlat<TUid>* UninstalledAppArray(); |
|
114 |
|
115 void AcquireDefaultIconArrayL() const; |
|
116 const CApaAppIconArray& DefaultIconArray() const; |
|
117 void ReleaseDefaultIconArray() const; |
|
118 |
|
119 void StoreL(); |
|
120 void NotifyObserver(); |
|
121 void DeleteAppListStorer(); |
|
122 void DeleteAppIconLoader(); |
|
123 void InitiateStoringOfAppList(); |
|
124 |
|
125 IMPORT_C void AddCustomAppInfoInListL(TUid aAppUid, TLanguage aLanguage, const TDesC& aShortCaption); |
|
126 IMPORT_C void UpdateAppListByShortCaptionL(); |
|
127 IMPORT_C void UpdateAppListByIconCaptionOverridesL(); |
|
128 private: |
|
129 enum |
|
130 { |
|
131 EFirstScanComplete = 0x01, |
|
132 EAppListHasChanged = 0x02, // This flag is used to check if the applist has really changed after a re-scan/update scan. |
|
133 ENotifyUpdateOnFirstScanComplete = 0x04,// This flag is used to notify clients for applist update on first boot when AppsList.Bin is used. |
|
134 ELangChangePending = 0x08 // This flag is used to check if applist update is in progress on language change event. |
|
135 }; |
|
136 private: |
|
137 CApaAppList(RFs& aFs, TBool aLoadMbmIconsOnDemand, TInt aIdlePeriodicDelay); |
|
138 void UpdateNextAppL(const TApaAppEntry& aAppEntry,TBool& aHasChanged); |
|
139 void AddToList( CApaAppData* aAppData ); |
|
140 static void SetPending(CApaAppData* aAppData); |
|
141 static void SetNotFound(CApaAppData* aAppData, TBool& aHasChanged); |
|
142 static TInt IdleUpdateCallbackL(TAny* aObject); |
|
143 TInt IdleUpdateL(); |
|
144 void ScanComplete(); |
|
145 void UndoSetPending(CApaAppData* aAppData); |
|
146 |
|
147 void StopIdler(); |
|
148 void DeleteAppData(); |
|
149 CArrayFixFlat<TDataTypeWithPriority>* DataTypeArrayDeepCopyLC(const CArrayFixFlat<TDataTypeWithPriority>& aOriginal) const; |
|
150 CApaAppIconArray* LoadDefaultIconsL() const; |
|
151 void UpdateDefaultIconsL(); |
|
152 |
|
153 void StartIconLoadingL(); |
|
154 void DeleteAppsListBackUpAndTempFiles(); |
|
155 void ScanRemovableDrivesAndUpdateL(); |
|
156 void CreateDefaultAppIconFileNameL(); |
|
157 private: |
|
158 // Persistence Layer |
|
159 void RestoreL(); |
|
160 void ConstructL(); |
|
161 |
|
162 /** |
|
163 Utility class used to Load Icons once applist is populated |
|
164 @internalComponent |
|
165 */ |
|
166 NONSHARABLE_CLASS(CApaIdleIconLoader) : public CActive |
|
167 { |
|
168 public: |
|
169 CApaIdleIconLoader(CApaAppData* aFirstAppData, RFs& aFs, CApaAppList& aAppList); |
|
170 ~CApaIdleIconLoader(); |
|
171 void Start(); |
|
172 private: // from CActive |
|
173 void RunL(); |
|
174 void DoCancel(); |
|
175 TInt RunError(TInt aError); |
|
176 private: |
|
177 CApaAppData* iCurrentAppData; |
|
178 RFs& iFs; |
|
179 CApaAppList& iAppList; |
|
180 }; |
|
181 |
|
182 /** |
|
183 Utility class used to externalize applist to file |
|
184 @internalComponent |
|
185 */ |
|
186 NONSHARABLE_CLASS(CApaAppListStorer) : public CActive |
|
187 { |
|
188 public: |
|
189 static CApaAppListStorer* NewL(CApaAppData* aFirstAppData, RFs& aFs, CApaAppList& aAppList); |
|
190 ~CApaAppListStorer(); |
|
191 void StartL(const TTimeIntervalMicroSeconds32& aDelay); |
|
192 private: |
|
193 CApaAppListStorer(CApaAppData* aFirstAppData, RFs& aFs, CApaAppList& aAppList); |
|
194 static void StoreEntryL(RWriteStream& aWriteStream, const CApaAppData& aApp); |
|
195 void ConstructL(); |
|
196 private: // from CActive |
|
197 void RunL(); |
|
198 void DoCancel(); |
|
199 TInt RunError(TInt aError); |
|
200 private: |
|
201 CApaAppData* iCurrentAppData; |
|
202 TFileName iTempFilename; |
|
203 RFileWriteStream iWriteStream; |
|
204 RTimer iTimer; |
|
205 RFs& iFs; |
|
206 CApaAppList& iAppList; |
|
207 }; |
|
208 |
|
209 /** |
|
210 The CCustomAppInfoData class encapsulate the attributes of customised application information |
|
211 which will be used to modify short caption dynamically. |
|
212 |
|
213 @internalComponent |
|
214 */ |
|
215 NONSHARABLE_CLASS(CCustomAppInfoData) : public CBase |
|
216 { |
|
217 public: |
|
218 static CCustomAppInfoData* NewL(TUid aAppUid, TLanguage aLanguage, const TDesC& aShortCaption); |
|
219 ~CCustomAppInfoData(); |
|
220 inline TUid Uid() const; |
|
221 inline TLanguage Language() const; |
|
222 inline HBufC* ShortCaption() const; |
|
223 private: |
|
224 CCustomAppInfoData(TUid aAppUid, TLanguage aLanguage); |
|
225 void ConstructL(const TDesC& aShortCaption); |
|
226 private: |
|
227 TUid iUid; |
|
228 TLanguage iLanguage; |
|
229 HBufC* iShortCaption; |
|
230 }; |
|
231 |
|
232 private: |
|
233 RFs& iFs; |
|
234 CApaAppData* iAppData; // linked list of apps |
|
235 CPeriodic* iAppIdler; |
|
236 MApaAppListObserver* iObserver; |
|
237 CApaAppData* iValidFirstAppData; //First valid app data in linked list! |
|
238 TInt iFlags; |
|
239 CApaAppRegFinder* iAppRegFinder; |
|
240 TInt iIdlePeriodicDelay; // idle timeout periodic delay |
|
241 RFs iFsShareProtected; |
|
242 mutable CApaAppIconArray* iDefaultIconArray; |
|
243 mutable TInt iDefaultIconUsageCount; |
|
244 CDesCArray* iForcedRegistrations; |
|
245 class CApaLangChangeMonitor; //inner class of CApaAppList. |
|
246 CApaLangChangeMonitor* iAppLangMonitor; // Active Object used for language change monitoring. |
|
247 |
|
248 RBuf iAppsListCacheFileName; |
|
249 RBuf iAppsListCacheBackUpFileName; |
|
250 RBuf iAppsListCachePath; |
|
251 |
|
252 HBufC* iDefaultAppIconMbmFileName; // This member data lives only during the scan |
|
253 CApaAppListStorer* iAppListStorer; //Active Object used for writing applist to file. |
|
254 CApaIdleIconLoader* iAppIconLoader; //Active Object used for icon handling |
|
255 TBool iLoadMbmIconsOnDemand; |
|
256 RPointerArray<CCustomAppInfoData> iCustomAppList; |
|
257 CApaIconCaptionOverrides* iIconCaptionOverrides; |
|
258 CApaIconCaptionCenrepObserver* iIconCaptionObserver; |
|
259 TBool iNNAInstallation; |
|
260 CArrayFixFlat<TUid>* iUninstalledApps; |
|
261 |
|
262 private: |
|
263 friend class CApaLangChangeMonitor; |
|
264 }; |
|
265 |
|
266 #endif //__APLAPPLIST_H__ |