|
1 /* |
|
2 * Copyright (c) 2002-2004 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: factory settings for active space |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef HNREPOSITORYOBSERVER_H_ |
|
20 #define HNREPOSITORYOBSERVER_H_ |
|
21 |
|
22 #include <liwcommon.h> |
|
23 #include <e32base.h> |
|
24 #include <centralrepository.h> |
|
25 #include <cenrepnotifyhandler.h> |
|
26 #include "hnmdmodel.h" |
|
27 #include "hnservicehandler.h" |
|
28 #include "hnsuiteobserver.h" |
|
29 |
|
30 /** |
|
31 * Repository Observer base class. |
|
32 * |
|
33 * It is used to be derived by repository observers. |
|
34 * |
|
35 * @lib hnmetadatamodel |
|
36 * @since S60 5.0 |
|
37 * @ingroup group_hnmetadatamodel |
|
38 */ |
|
39 NONSHARABLE_CLASS( CHnRepositoryObserver ): |
|
40 public CBase, |
|
41 public MCenRepNotifyHandlerCallback |
|
42 { |
|
43 public: |
|
44 |
|
45 /** |
|
46 * Default C++ Destructor. |
|
47 * |
|
48 * @since S60 v5.0 |
|
49 */ |
|
50 virtual ~CHnRepositoryObserver(); |
|
51 |
|
52 |
|
53 protected: |
|
54 |
|
55 /** |
|
56 * Defautlt C++ Constructor. |
|
57 * |
|
58 * @param aCmnPtrs Common pointers. |
|
59 * @since S60 v5.0 |
|
60 */ |
|
61 CHnRepositoryObserver( THnMdCommonPointers* aCmnPtrs ); |
|
62 |
|
63 |
|
64 /** |
|
65 * Defautlt C++ Constructor. |
|
66 * |
|
67 * @param aCmnPtrs Common pointers. |
|
68 * @since S60 v5.0 |
|
69 */ |
|
70 CHnRepositoryObserver( THnMdCommonPointers* aCmnPtrs, TUint32 iId ); |
|
71 |
|
72 /** |
|
73 * Second stage constructor. |
|
74 * |
|
75 * @since S60 v5.0 |
|
76 */ |
|
77 void ConstructL( const TUid aRepositoryUid ); |
|
78 |
|
79 protected: |
|
80 |
|
81 /** |
|
82 * Own - Central Repository access class. |
|
83 */ |
|
84 CRepository *iRepository; |
|
85 |
|
86 /** |
|
87 * Id of the CR entry to be watched. |
|
88 */ |
|
89 TUint32 iId; |
|
90 |
|
91 /** |
|
92 * Common pointers. |
|
93 */ |
|
94 THnMdCommonPointers* iCmnPtrs; |
|
95 |
|
96 /** |
|
97 * Own - Central repository notification handler. |
|
98 */ |
|
99 CCenRepNotifyHandler* iNotifyHandler; |
|
100 |
|
101 }; |
|
102 |
|
103 /** |
|
104 * Widget Type Repository Observer. |
|
105 * |
|
106 * It is used to inform hierarchy navigator of changes in the suites repository. |
|
107 * |
|
108 * @lib hnmetadatamodel |
|
109 * @since S60 5.0 |
|
110 * @ingroup group_hnmetadatamodel |
|
111 */ |
|
112 NONSHARABLE_CLASS( CHnRepositoryWidgetTypeObserver ): public CHnRepositoryObserver |
|
113 { |
|
114 public: |
|
115 |
|
116 /** |
|
117 * Default C++ Destructor. |
|
118 * |
|
119 * @since S60 v5.0 |
|
120 */ |
|
121 virtual ~CHnRepositoryWidgetTypeObserver(); |
|
122 |
|
123 /** |
|
124 * Factory function. |
|
125 * |
|
126 * @param aCmnPtrs Common pointers. |
|
127 * @return Repository Observer. |
|
128 * @since S60 v5.0 |
|
129 */ |
|
130 static CHnRepositoryWidgetTypeObserver* NewL( THnMdCommonPointers* aCmnPtrs, const TUid aRepositoryUid ); |
|
131 |
|
132 /** |
|
133 * Factory function. |
|
134 * |
|
135 * @param aCmnPtrs Common pointers. |
|
136 * @return Repository Observer. |
|
137 * @since S60 v5.0 |
|
138 */ |
|
139 static CHnRepositoryWidgetTypeObserver* NewLC( THnMdCommonPointers* aCmnPtrs, const TUid aRepositoryUid ); |
|
140 |
|
141 /** |
|
142 * Change handler method. |
|
143 * It is invoked whenever notifier detects a change in the CR. |
|
144 * |
|
145 * @param aId Id of the entry in CR. |
|
146 * @since S60 v5.0 |
|
147 */ |
|
148 void HandleNotifyGeneric(TUint32 aId); |
|
149 |
|
150 /** |
|
151 * Change handler method. |
|
152 * It is invoked whenever notifier detects a change in the CR. |
|
153 * |
|
154 * @param aId Id of the entry in CR. |
|
155 * @since S60 v5.0 |
|
156 */ |
|
157 void HandleNotifyGenericL(TUint32 aId); |
|
158 |
|
159 private: |
|
160 |
|
161 /** |
|
162 * Defautlt C++ Constructor. |
|
163 * |
|
164 * @param aCmnPtrs Common pointers. |
|
165 * @since S60 v5.0 |
|
166 */ |
|
167 CHnRepositoryWidgetTypeObserver( THnMdCommonPointers* aCmnPtrs ); |
|
168 |
|
169 private: |
|
170 |
|
171 /** |
|
172 * Second stage constructor. |
|
173 * |
|
174 * @since S60 v5.0 |
|
175 */ |
|
176 void ConstructL( const TUid aRepositoryUid ); |
|
177 |
|
178 private: |
|
179 |
|
180 /** |
|
181 * Array holding ids of widgets being switched. |
|
182 * It is used to eliminate double refresh for such suites. |
|
183 */ |
|
184 RArray<TUint32> iWidgetSwitches; |
|
185 |
|
186 }; |
|
187 |
|
188 |
|
189 |
|
190 NONSHARABLE_CLASS( CHnRepositoryShowFolderObserver ): public CHnRepositoryObserver, |
|
191 public MLiwNotifyCallback, |
|
192 public MHnSuiteObserver |
|
193 { |
|
194 public: |
|
195 |
|
196 /** |
|
197 * Default C++ Destructor. |
|
198 * |
|
199 * @since S60 v5.0 |
|
200 */ |
|
201 virtual ~CHnRepositoryShowFolderObserver(); |
|
202 |
|
203 /** |
|
204 * Factory function. |
|
205 * |
|
206 * @param aCmnPtrs Common pointers. |
|
207 * @return Repository Observer. |
|
208 * @since S60 v5.0 |
|
209 */ |
|
210 static CHnRepositoryShowFolderObserver* NewL( |
|
211 THnMdCommonPointers* aCmnPtrs, const TUid aRepositoryUid, |
|
212 const TUint32 aId); |
|
213 |
|
214 /** |
|
215 * Factory function. |
|
216 * |
|
217 * @param aCmnPtrs Common pointers. |
|
218 * @return Repository Observer. |
|
219 * @since S60 v5.0 |
|
220 */ |
|
221 static CHnRepositoryShowFolderObserver* NewLC( |
|
222 THnMdCommonPointers* aCmnPtrs, const TUid aRepositoryUid, |
|
223 const TUint32 aId); |
|
224 |
|
225 /** |
|
226 * Change handler method. |
|
227 * It is invoked whenever notifier detects a change in the CR. |
|
228 * |
|
229 * @param aId Id of the entry in CR. |
|
230 * @since S60 v5.0 |
|
231 */ |
|
232 void HandleNotifyString(TUint32 aId, const TDesC16& aNewValue ); |
|
233 |
|
234 /** |
|
235 * Change handler method. |
|
236 * It is invoked whenever notifier detects a change in the CR. |
|
237 * |
|
238 * @param aId Id of the entry in CR. |
|
239 * @since S60 v5.0 |
|
240 */ |
|
241 void HandleNotifyStringL(TUint32 aId, const TDesC16& aNewValue ); |
|
242 |
|
243 |
|
244 /** |
|
245 * From MLiwNotifyCallback |
|
246 */ |
|
247 TInt HandleNotifyL( |
|
248 TInt aCmdId, |
|
249 TInt aEventId, |
|
250 CLiwGenericParamList& aEventParamList, |
|
251 const CLiwGenericParamList& aInParamList); |
|
252 |
|
253 /** |
|
254 * From MHnSuiteObserver |
|
255 */ |
|
256 virtual void HandleSuiteEventL ( THnCustomSuiteEvent aCustomSuiteEvent, |
|
257 CHnSuiteModel *aModel ); |
|
258 |
|
259 |
|
260 |
|
261 private: |
|
262 |
|
263 /** |
|
264 * Defautlt C++ Constructor. |
|
265 * |
|
266 * @param aCmnPtrs Common pointers. |
|
267 * @since S60 v5.0 |
|
268 */ |
|
269 CHnRepositoryShowFolderObserver( THnMdCommonPointers* aCmnPtrs, TUint32 iId ); |
|
270 |
|
271 /** |
|
272 * Extracts the folder name from the CR key. |
|
273 * |
|
274 * @param aNewValue The CR key. |
|
275 * @since S60 v5.0 |
|
276 */ |
|
277 void ExtractCRKeyShowFolderName( const TDesC& aNewValue ); |
|
278 |
|
279 /** |
|
280 * Request get list for parent folder of an application. |
|
281 * |
|
282 * @param aFolderId A parent folder id |
|
283 * @since S60 v5.0 |
|
284 */ |
|
285 void GetShowFolderL( TUint32 aFolderId ); |
|
286 |
|
287 /** |
|
288 * Request get list for a folder with given application group name |
|
289 * contained in iCRKeyFolderName. |
|
290 * |
|
291 * @since S60 v5.0 |
|
292 */ |
|
293 void GetShowFolderGroupNameL(); |
|
294 |
|
295 private: |
|
296 /** |
|
297 * Type of a flag describing the type of notification. |
|
298 * APP_ID - MCS id is given |
|
299 * APP_UID - Application UID is given |
|
300 * SECOND_NOTIFY - handled notify caused by the second get list |
|
301 */ |
|
302 enum TNotifyType { EAPP_ID=1, EAPP_UID=2, ESECOND_NOTIFY=4 }; |
|
303 |
|
304 private: |
|
305 |
|
306 /** |
|
307 * Second stage constructor. |
|
308 * |
|
309 * @since S60 v5.0 |
|
310 */ |
|
311 void ConstructL( const TUid aRepositoryUid ); |
|
312 |
|
313 private: |
|
314 |
|
315 /** |
|
316 * Folder application group name. |
|
317 */ |
|
318 TBuf8<KApaMaxAppGroupName> iCRKeyFolderName; |
|
319 |
|
320 /** |
|
321 * Mcs id for an application item in a folder with a given app group name. |
|
322 */ |
|
323 TBuf8<KUidStringLength> iCRKeyFolderItemUid; |
|
324 |
|
325 /** |
|
326 * Own. |
|
327 * Intance of the service handler. |
|
328 */ |
|
329 CHnServiceHandler* iServiceHandler; |
|
330 |
|
331 /** |
|
332 * Flag describing the type of notification. |
|
333 */ |
|
334 TInt iNotifyType; |
|
335 }; |
|
336 |
|
337 #endif /*HNREPOSITORYOBSERVER_H_*/ |
|
338 |
|
339 //End of file |
|
340 |