|
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 |
|
18 #ifndef __MENUSRVFOLDERSCANNER_H__ |
|
19 #define __MENUSRVFOLDERSCANNER_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <apgcli.h> |
|
23 #include <apgnotif.h> |
|
24 #include <cenrepnotifyhandler.h> |
|
25 #include "menuengoperation.h" |
|
26 #include "menuengfilter.h" |
|
27 #include "mcsfreespaceobserver.h" |
|
28 |
|
29 |
|
30 // FORWARD DECLARATION |
|
31 |
|
32 class CMenuEng; |
|
33 class TMenuItem; |
|
34 class CMenuSrvMmcHistory; |
|
35 class CRepository; |
|
36 class CCenRepNotifyHandler; |
|
37 |
|
38 /** |
|
39 * Folder scanner. |
|
40 * Using AppArc application information, keeps menu application |
|
41 * items ("menu:application") up-to-date. |
|
42 * |
|
43 * Operation is asynchronous (because AppArc startup is asynchronous): |
|
44 * 1. ConstructL(): invokes iApaLsSession to build app list (async). |
|
45 * 2. RunL(): App list is complete, this object schedules itself to Engine. |
|
46 * 3. RunMenuEngOperationL(): The operation is executed by the engine. |
|
47 * 4. HandleAppListEvent(): change in app list, go back to step 2. |
|
48 * |
|
49 * App scanning does the following: |
|
50 * - Applications present in the system but not appearing in the menu are added |
|
51 * to the appropriate folder. |
|
52 * - Java apps should appear / disappear. |
|
53 * - Hide hidden applications, show non-hidden applications (flag "hidden"). |
|
54 * - Hide / show MMC-related items, according to whether MMC is present or not |
|
55 * (flag "missing"). Keep an MMC history, purge old MMC-based menu items |
|
56 * (== missing menu items whose MMC card has not been seen for long). |
|
57 * - Observing AppArc (and MMC, and Java, etc etc) to keep the menu data up |
|
58 * to date continuously. |
|
59 */ |
|
60 NONSHARABLE_CLASS( CMenuSrvFolderCrNotifier ) |
|
61 : public CActive, public MMenuEngOperation, public MCenRepNotifyHandlerCallback, |
|
62 MMcsFreeSpaceObserver |
|
63 { |
|
64 |
|
65 public: // Constructor |
|
66 |
|
67 /** |
|
68 * Destructor. |
|
69 */ |
|
70 virtual ~CMenuSrvFolderCrNotifier(); |
|
71 |
|
72 /** |
|
73 * Two-phased constructor. |
|
74 * @param aEng Engine. |
|
75 */ |
|
76 static CMenuSrvFolderCrNotifier* NewL( CMenuEng& aEng ); |
|
77 |
|
78 private: // Constructors and destructor |
|
79 |
|
80 /** |
|
81 * Constructor. |
|
82 * @param aEng Engine. |
|
83 */ |
|
84 CMenuSrvFolderCrNotifier( CMenuEng& aEng ); |
|
85 |
|
86 /** |
|
87 * Second phased constructor. |
|
88 */ |
|
89 void ConstructL(); |
|
90 |
|
91 private: // from CActive |
|
92 |
|
93 /** |
|
94 * Request completed, schedule engine operation. |
|
95 */ |
|
96 void RunL(); |
|
97 |
|
98 /** |
|
99 * Cancel request. |
|
100 */ |
|
101 void DoCancel(); |
|
102 |
|
103 /** |
|
104 * Error handling: ignore error. |
|
105 * @param aErr Error code. |
|
106 */ |
|
107 TInt RunError( TInt aError ); |
|
108 |
|
109 private: // from MMcsFreeSpaceObserver |
|
110 /** |
|
111 * Handle Free Space Event. |
|
112 */ |
|
113 void HandleFreeSpaceEventL(); |
|
114 |
|
115 private: // from MMenuEngOperation |
|
116 |
|
117 /** |
|
118 * Execute engine operation: |
|
119 * Do the application scan and update menu accordingly. |
|
120 */ |
|
121 void RunMenuEngOperationL(); |
|
122 |
|
123 /** |
|
124 * Error handling: ignore error. |
|
125 * @param aErr Error code. |
|
126 */ |
|
127 void CompletedMenuEngOperation( TInt aErr ); |
|
128 |
|
129 /** |
|
130 * Notifies engine with events |
|
131 * @param aNewHiddenFolder nome of a folder. |
|
132 */ |
|
133 void NotifyEngineL( const TDesC& aFolder ); |
|
134 |
|
135 /** |
|
136 * Compares arrays and sends notification to engine abaut differences |
|
137 * @param aLeftArray array with folders names. |
|
138 * @param aRightArray array with folders names. |
|
139 */ |
|
140 void NotifyEngineL( const RArray<TPtrC>& aLeftArray, |
|
141 const RArray<TPtrC>& aRightArray ); |
|
142 |
|
143 /** |
|
144 */ |
|
145 void HandleNewCrHiddenFoldersL( const TDesC& aNewHiddenFolder ); |
|
146 |
|
147 |
|
148 |
|
149 private: // from MCenRepNotifyHandlerCallback |
|
150 |
|
151 /** |
|
152 * Called if one of CR keys has changed |
|
153 * @param aId Id of the key that has changed. |
|
154 * @param aNewValue The new value of the key. |
|
155 */ |
|
156 void HandleNotifyString( TUint32 aKey, const TDesC16& aNewValue ); |
|
157 |
|
158 |
|
159 private: // new methods |
|
160 |
|
161 /** |
|
162 */ |
|
163 void ParseHiddenFoldersL( const TDesC& aHiddenFolders, |
|
164 RArray<TPtrC>& aHiddenFoldersArray ); |
|
165 |
|
166 private: // data |
|
167 |
|
168 CMenuEng& iEng ; ///< Engine. |
|
169 RFs iFs; ///< File Server Session. Own. |
|
170 |
|
171 /* |
|
172 * Central repository session |
|
173 */ |
|
174 CRepository* iCenRepSession; |
|
175 |
|
176 /* |
|
177 *Central repository change handler for Control Panel Hidden Folders |
|
178 */ |
|
179 CCenRepNotifyHandler* iCenRepNotifyHandlerCPHiddenFolders; |
|
180 |
|
181 TBool iOpStatus; |
|
182 |
|
183 /* |
|
184 * Free Space observer. |
|
185 */ |
|
186 CMcsFreeSpaceObserver* iFreeSpaceObserver; |
|
187 |
|
188 /* |
|
189 * Old value from central repository. |
|
190 */ |
|
191 RBuf iHiddenCRFolders; |
|
192 |
|
193 /* |
|
194 * New value from central repository. |
|
195 */ |
|
196 RBuf iNewHiddenCRFolders; |
|
197 |
|
198 }; |
|
199 |
|
200 |
|
201 |
|
202 #endif // __MENUSRVFOLDERSCANNER_H__ |