|
1 /* |
|
2 * Copyright (c) 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: Engine part of the Application Manager |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_APPMNGR2MODEL_H |
|
20 #define C_APPMNGR2MODEL_H |
|
21 |
|
22 #include <e32base.h> // CActive |
|
23 #include <bamdesca.h> // MDesCArray |
|
24 #include <apgnotif.h> // MApaAppListServObserver |
|
25 #include <appmngr2debugutils.h> // FLOG macros |
|
26 #include <appmngr2runtimeobserver.h> // MAppMngr2RuntimeObserver |
|
27 #include "appmngr2scannerobserver.h" // MAppMngr2ScannerObserver |
|
28 #include "appmngr2infomakerobserver.h" // MAppMngr2InfoMakerObserver |
|
29 #include "appmngr2infoarrayobserver.h" // MAppMngr2InfoArrayObserver |
|
30 |
|
31 class CAppMngr2Runtime; |
|
32 class CAppMngr2InfoBase; |
|
33 class CAppMngr2AppInfo; |
|
34 class CAppMngr2PackageInfo; |
|
35 class CAppMngr2Scanner; |
|
36 class MAppMngr2ModelObserver; |
|
37 class CAppMngr2InfoMaker; |
|
38 class CAppMngr2AppInfoArray; |
|
39 class CAppMngr2PackageInfoArray; |
|
40 class CAppMngr2PluginHolder; |
|
41 class CAknIconArray; |
|
42 class RFs; |
|
43 |
|
44 |
|
45 class CAppMngr2Model : public CActive, public MAppMngr2RuntimeObserver, |
|
46 public MAppMngr2ScannerObserver, public MApaAppListServObserver, |
|
47 public MAppMngr2InfoMakerObserver, public MAppMngr2InfoArrayObserver |
|
48 { |
|
49 public: // constructor and destructor |
|
50 static CAppMngr2Model* NewL( RFs& aFsSession, MAppMngr2ModelObserver& aObserver ); |
|
51 ~CAppMngr2Model(); |
|
52 |
|
53 public: // new functions |
|
54 TInt AppInfoCount() const; |
|
55 CAppMngr2AppInfo& AppInfo( TInt aIndex ) const; |
|
56 TInt PackageInfoCount() const; |
|
57 CAppMngr2PackageInfo& PackageInfo( TInt aIndex ) const; |
|
58 void LoadIconsL( CAknIconArray& aIconArray ); |
|
59 void GetIconIndexesL( TUid aUid, TInt& aIconIndexBase, TInt& aIconIndexMax ) const; |
|
60 void HandleCommandL( CAppMngr2InfoBase& aInfo, TInt aCommand ); |
|
61 void StartFetchingInstallationFilesL(); |
|
62 void StartFetchingInstalledAppsL(); |
|
63 |
|
64 protected: // from CActive |
|
65 void DoCancel(); |
|
66 void RunL(); |
|
67 |
|
68 public: // from MAppMngr2RuntimeObserver |
|
69 void RefreshInstalledApps(); |
|
70 void RefreshInstallationFiles(); |
|
71 |
|
72 public: // from MAppMngr2ScannerObserver |
|
73 void ScanningResultL( RPointerArray<CAppMngr2RecognizedFile>& aResult ); |
|
74 void ScanningComplete(); |
|
75 void DirectoryChangedL( const TDesC& aChangedDir ); |
|
76 |
|
77 public: // from MApaAppListServObserver |
|
78 void HandleAppListEvent( TInt aEvent ); |
|
79 |
|
80 public: // from MAppMngr2InfoMakerObserver |
|
81 void NewAppsCreatedL( const CAppMngr2InfoMaker& aMaker, |
|
82 RPointerArray<CAppMngr2AppInfo>& aAppInfos ); |
|
83 void ErrorInCreatingAppsL( const CAppMngr2InfoMaker& aMaker, TInt aError ); |
|
84 void NewPackagesCreatedL( const CAppMngr2InfoMaker& aMaker, |
|
85 RPointerArray<CAppMngr2PackageInfo>& aPackageInfos ); |
|
86 void ErrorInCreatingPackagesL( const CAppMngr2InfoMaker& aMaker, TInt aError ); |
|
87 |
|
88 public: // from MAppMngr2InfoArrayObserver |
|
89 void ArrayContentChanged( CAppMngr2InfoArray* aArray, TInt aMoreRefreshesExpected ); |
|
90 |
|
91 private: // new functions |
|
92 CAppMngr2Model( RFs& aFsSession, MAppMngr2ModelObserver& aObserver ); |
|
93 void ConstructL(); |
|
94 void LoadDefaultIconsL( CAknIconArray& aIconArray ); |
|
95 void LoadPluginsL(); |
|
96 CAppMngr2PluginHolder* DoLoadPluginL( TUid aUid ); |
|
97 void CreateScannerL(); |
|
98 void FetchDataTypesL(); |
|
99 void CloseInfoMaker( const CAppMngr2InfoMaker& aMaker ); |
|
100 |
|
101 private: // data |
|
102 RFs& iFs; |
|
103 MAppMngr2ModelObserver& iObs; |
|
104 RPointerArray<CAppMngr2PluginHolder> iPlugins; |
|
105 CAppMngr2Scanner* iScanner; |
|
106 CApaAppListNotifier* iApaAppListNotifier; |
|
107 RPointerArray<CAppMngr2InfoMaker> iInfoMakers; |
|
108 CAppMngr2AppInfoArray* iInstalledApps; |
|
109 CAppMngr2PackageInfoArray* iInstallationFiles; |
|
110 CAppMngr2InfoBase* iActiveItem; // not owned |
|
111 TInt iActiveCommand; |
|
112 TBool iClosing; |
|
113 |
|
114 FLOG_PERF_DEFINE( FetchInstallationFiles ) |
|
115 FLOG_PERF_DEFINE( FetchInstalledApps ) |
|
116 }; |
|
117 |
|
118 #endif // C_APPMNGR2MODEL_H |
|
119 |