|
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: Manages Ai3 personalization |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_XNEDITOR_H |
|
20 #define C_XNEDITOR_H |
|
21 |
|
22 // System includes |
|
23 #include <e32base.h> |
|
24 #include <badesca.h> |
|
25 #include <hscontentcontroller.h> |
|
26 #include <hscontentinfo.h> |
|
27 #include <hscontentinfoarray.h> |
|
28 #include <AknsSrvClient.h> |
|
29 |
|
30 // User includes |
|
31 #include "hspswrapper.h" |
|
32 #include "cpswrapper.h" |
|
33 #include "xnviewmanager.h" |
|
34 |
|
35 // Forward declarations |
|
36 class CXnNode; |
|
37 class CAknListQueryDialog; |
|
38 class CXnViewManager; |
|
39 class CXnViewData; |
|
40 class CRepository; |
|
41 class CXnBackgroundManager; |
|
42 class CXnOomSysHandler; |
|
43 |
|
44 namespace hspswrapper |
|
45 { |
|
46 class CPropertyMap; |
|
47 class CAddPluginResult; |
|
48 class MHspsWrapperObserver; |
|
49 } |
|
50 |
|
51 namespace cpswrapper |
|
52 { |
|
53 class CCpsWrapper; |
|
54 class CPublisherMap; |
|
55 class CPublisherInfo; |
|
56 class MCpsWrapperObserver; |
|
57 } |
|
58 |
|
59 using namespace hspswrapper; |
|
60 using namespace cpswrapper; |
|
61 |
|
62 // Class declaration |
|
63 |
|
64 /** |
|
65 * Editor handles ai3 personalization |
|
66 * |
|
67 * @ingroup group_xnlayoutengine |
|
68 * @lib xn3layoutengine.lib |
|
69 * @since S60 5.0 |
|
70 */ |
|
71 NONSHARABLE_CLASS( CXnEditor ) : public CBase, |
|
72 public MXnViewObserver, |
|
73 public MCpsWrapperObserver, |
|
74 public MHspsWrapperObserver, |
|
75 public MHsContentController |
|
76 { |
|
77 public: |
|
78 //constructors and destructor |
|
79 |
|
80 /** |
|
81 * Two-phased constructor. |
|
82 * |
|
83 * @param aViewManager View manager |
|
84 * @param aWrapper HSPS wrapper |
|
85 */ |
|
86 static CXnEditor* NewL( CXnViewManager& aViewManager, |
|
87 const TDesC8& aUid ); |
|
88 |
|
89 /** |
|
90 * Two-phased constructor. |
|
91 * |
|
92 * @param aViewManager View manager |
|
93 * @param aWrapper HSPS wrapper |
|
94 */ |
|
95 static CXnEditor* NewLC( CXnViewManager& aViewManager, |
|
96 const TDesC8& aUid ); |
|
97 |
|
98 /** |
|
99 * Destructor. |
|
100 */ |
|
101 ~CXnEditor(); |
|
102 |
|
103 public: |
|
104 // new functions |
|
105 |
|
106 /** |
|
107 * Remove uregistered widget from all the views. |
|
108 * |
|
109 * @since S60 5.0 |
|
110 * @param aPublisher publisher |
|
111 */ |
|
112 void RemoveUnRegisteredWidgetL( const TDesC& aPublisher ); |
|
113 |
|
114 /** |
|
115 * Removes uninstalled widget from all views |
|
116 * |
|
117 * @since S60 5.0 |
|
118 * @param aContentInfo content info |
|
119 */ |
|
120 void RemoveUnInstalledWidgetL( const CHsContentInfo& aContentInfo ); |
|
121 |
|
122 /** |
|
123 * Runs add widget list query |
|
124 * |
|
125 * @since S60 5.0 |
|
126 */ |
|
127 void AddWidgetL(); |
|
128 |
|
129 /** |
|
130 * Remove widget from current view. |
|
131 * |
|
132 * @since S60 5.0 |
|
133 * @param aNode Plugin (or its child) where to remove widget. |
|
134 */ |
|
135 void RemoveWidgetL( CXnNode* aNode ); |
|
136 |
|
137 /** |
|
138 * Replaces widget configuration to HSPS |
|
139 * |
|
140 * @since S60 5.0 |
|
141 * @param aContentInfo content info |
|
142 */ |
|
143 void ReplaceWidgetL( CHsContentInfo& aContentInfo ); |
|
144 /** |
|
145 * Commit a new order of plugins to the HSPS. |
|
146 * |
|
147 * @since S60 5.0 |
|
148 * @param aPluginArray Array of plugins |
|
149 */ |
|
150 void ReorderWidgetsL( RPointerArray< CXnNode >* aPluginArray ); |
|
151 |
|
152 /** |
|
153 * Toggles widgets' visibility |
|
154 * |
|
155 * @since S60 5.0 |
|
156 * @return Current widgets' visibility state |
|
157 */ |
|
158 TBool ToggleWidgetsVisibiltyL(); |
|
159 |
|
160 /** |
|
161 * Queries wheter the widgets are visible or not |
|
162 * |
|
163 * @since S60 5.0 |
|
164 * @return ETrue if widgets are now visible, EFalse otherwise |
|
165 */ |
|
166 TBool WidgetsVisible() const; |
|
167 |
|
168 /** |
|
169 * Sets target plugin for add/remove |
|
170 * |
|
171 * @since S60 5.0 |
|
172 * @param aNode a plugin node to be set as target for add/remove action |
|
173 */ |
|
174 void SetTargetPlugin( CXnNode* aNode ); |
|
175 |
|
176 /** |
|
177 * Handles changing of wallpaper |
|
178 * |
|
179 * @since S60 5.0 |
|
180 */ |
|
181 void SetWallpaperL(); |
|
182 |
|
183 /** |
|
184 * Returns the HSPS Wrapper object owned by this. |
|
185 * |
|
186 * @since S60 5.0 |
|
187 * @return HSPSWrapper |
|
188 */ |
|
189 CHspsWrapper& HspsWrapper() const; |
|
190 |
|
191 /** |
|
192 * Retrives Id read from central repository. |
|
193 * |
|
194 * @since S60 5.0 |
|
195 * @return sucess or failure standard error code |
|
196 */ |
|
197 TInt IdFromCrep ( TDes8& aUid ) const; |
|
198 |
|
199 private: |
|
200 // from MHsContentController |
|
201 |
|
202 TInt WidgetListL( CHsContentInfoArray& aArray ); |
|
203 |
|
204 TInt WidgetListL( CHsContentInfo& aInfo, CHsContentInfoArray& aArray ); |
|
205 |
|
206 TInt ViewListL( CHsContentInfoArray& aArray ); |
|
207 |
|
208 TInt ViewListL( CHsContentInfo& aInfo, CHsContentInfoArray& aArray ); |
|
209 |
|
210 TInt AppListL( CHsContentInfoArray& aArray ); |
|
211 |
|
212 TInt AddWidgetL( CHsContentInfo& aInfo ); |
|
213 |
|
214 TInt RemoveWidgetL( CHsContentInfo& aInfo ); |
|
215 |
|
216 TInt AddViewL( CHsContentInfo& aInfo ); |
|
217 |
|
218 TInt RemoveViewL( CHsContentInfo& aInfo ); |
|
219 |
|
220 TInt ActivateViewL( CHsContentInfo& aInfo ); |
|
221 |
|
222 TInt ActivateAppL( CHsContentInfo& aInfo ); |
|
223 |
|
224 TInt ActiveViewL( CHsContentInfo& aInfo ); |
|
225 |
|
226 TInt ActiveAppL( CHsContentInfo& aInfo ); |
|
227 |
|
228 private: |
|
229 // constructors |
|
230 |
|
231 /** |
|
232 * C++ constructor |
|
233 */ |
|
234 CXnEditor( CXnViewManager& aViewManager ); |
|
235 |
|
236 /** |
|
237 * Leaving constructor |
|
238 */ |
|
239 void ConstructL( const TDesC8& aUid ); |
|
240 |
|
241 private: |
|
242 // new functions |
|
243 |
|
244 CPublisherInfo* PublisherInfoL( const CHsContentInfo& aContentInfo ); |
|
245 |
|
246 TInt TemplateWidgetCanBeAddedRemovedL( CHsContentInfo& aContentInfo ); |
|
247 TInt NonTemplateWidgetCanBeAddedRemovedL( CHsContentInfo& aContentInfo ); |
|
248 |
|
249 TBool IsCurrentViewFull(); |
|
250 |
|
251 /** |
|
252 * Filters plugins from the list and checks whether the plugins can be added or removed. |
|
253 */ |
|
254 void FilterPluginsL( CHsContentInfoArray& aContentInfoArray, |
|
255 TBool aIgnoreViewFull ); |
|
256 |
|
257 void FilterViewListL( CHsContentInfoArray& aContentInfoArray ); |
|
258 CXnOomSysHandler& OomSysHandler() const; |
|
259 |
|
260 /** |
|
261 * Notifies the MHsContentControl and the MHsContentControlUi if widget list was changed. |
|
262 */ |
|
263 void WidgetListChanged(); |
|
264 |
|
265 /** |
|
266 * Notifies the MHsContentControl and the MHsContentControlUi if view list was changed. |
|
267 */ |
|
268 void ViewListChanged(); |
|
269 |
|
270 /** |
|
271 * Creates content info for defined plugin |
|
272 */ |
|
273 CHsContentInfo* CreateContentInfoLC( CXnPluginData& aPlugin, |
|
274 RPointerArray< CHsContentInfo >& aInfos ); |
|
275 |
|
276 /** |
|
277 * Appends plugin configurations to the content info array. |
|
278 */ |
|
279 void AppendPluginsL( |
|
280 RPointerArray< hspswrapper::CPluginInfo > aPlugins, |
|
281 RPointerArray< CHsContentInfo >& aWidgets ); |
|
282 |
|
283 /** |
|
284 * Resets pluging configurations and templated publishers. |
|
285 */ |
|
286 void ResetPluginsAndPublishers(); |
|
287 |
|
288 /** |
|
289 * Retrieves native application configuration plugins from HSPS |
|
290 */ |
|
291 void HspsApplicationPluginsL( RPointerArray< CHsContentInfo >& aWidgets ); |
|
292 |
|
293 /** |
|
294 * Retrieves native view configuration plugins from HSPS |
|
295 */ |
|
296 void HspsViewPluginsL( RPointerArray< CHsContentInfo >& aWidgets ); |
|
297 |
|
298 /** |
|
299 * Retrieves widget and template configuration plugins from HSPS |
|
300 */ |
|
301 void HspsWidgetPluginsL( RPointerArray< CHsContentInfo >& aWidgets ); |
|
302 void DoHspsWidgetPluginsL(); |
|
303 |
|
304 /** |
|
305 * Retrieves publishers from CPS and them with the HSPS's template plugins |
|
306 */ |
|
307 void CpsWidgetPluginsL( RPointerArray< CHsContentInfo >& aWidgets ); |
|
308 |
|
309 /** |
|
310 * Checks whether the view is full |
|
311 */ |
|
312 TBool IsViewFull( CXnViewData& aViewData ); |
|
313 |
|
314 /* |
|
315 * Notifies observers that widget list is changed |
|
316 */ |
|
317 void NotifyWidgetListChanged(); |
|
318 |
|
319 /** callback for notify widget launcher */ |
|
320 static TInt WidgetListChangedCallBack( TAny* aSelf ); |
|
321 |
|
322 /* |
|
323 * Notifies observers that view list is changed |
|
324 */ |
|
325 void NotifyViewListChanged(); |
|
326 |
|
327 /** callback for notify view launcher */ |
|
328 static TInt ViewListChangedCallBack( TAny* aSelf ); |
|
329 |
|
330 private: |
|
331 // from MXnViewObserver |
|
332 |
|
333 void NotifyViewActivatedL( const CXnViewData& aViewData ); |
|
334 |
|
335 void NotifyViewDeactivatedL( const CXnViewData& /*aViewData*/ ); |
|
336 |
|
337 void NotifyConfigureWidgetL( const CHsContentInfo& aContentInfo, |
|
338 CXnPluginData& aPluginData ); |
|
339 |
|
340 void NotifyWidgetAdditionL( const CXnPluginData& aPluginData ); |
|
341 |
|
342 void NotifyWidgetRemovalL( const CXnPluginData& aPluginData ); |
|
343 |
|
344 void NotifyViewAdditionL( const CXnPluginData& /*aPluginData*/ ); |
|
345 |
|
346 void NotifyViewRemovalL( const CXnPluginData& /*aPluginData*/ ); |
|
347 |
|
348 void NotifyAllViewsLoadedL(); |
|
349 |
|
350 void NotifyContainerActivatedL( const CXnViewData& aViewData ); |
|
351 |
|
352 private: |
|
353 // from MCpsWrapperObserver |
|
354 |
|
355 void NotifyWidgetUnregisteredL( const TDesC& aPublisher ); |
|
356 |
|
357 void NotifyWidgetRegisteredL(); |
|
358 |
|
359 void NotifyWidgetUpdatedL(); |
|
360 |
|
361 private: |
|
362 // from MHspsWrapperObserver |
|
363 |
|
364 TInt HandleNotifyL( const TDesC8& aEvent, const TDesC8& aAppConfUid, |
|
365 const TDesC8& aPluginName, const TDesC8& aOrigUid, |
|
366 const TDesC8& aPluginUid, const TDesC8& aPluginId ); |
|
367 |
|
368 private: |
|
369 // data |
|
370 |
|
371 /** View manager, not owned */ |
|
372 CXnViewManager& iViewManager; |
|
373 /** HSPS wrapper, owned */ |
|
374 CHspsWrapper* iHspsWrapper; |
|
375 /** CPS wrapper, owned */ |
|
376 CCpsWrapper* iCpsWrapper; |
|
377 /** Publisher map, owned */ |
|
378 CPublisherMap* iPublisherMap; |
|
379 /** Add widget listquery, not owned */ |
|
380 CAknListQueryDialog* iQuery; |
|
381 /** Target plugin for add/remove, not owned */ |
|
382 CXnNode* iTargetPlugin; |
|
383 /** Widgets visibility state */ |
|
384 TBool iWidgetsVisibilityState; |
|
385 /** Central repository , to choose plugin, owned*/ |
|
386 CRepository* iRepository; |
|
387 /** Widget/template plugin configurations, owned */ |
|
388 RPointerArray< hspswrapper::CPluginInfo > iPluginConfigurations; |
|
389 /** Oom handler, owned. */ |
|
390 CXnOomSysHandler* iOomSysHandler; |
|
391 /** Launcher for notifying widget list changes */ |
|
392 CPeriodic* iNotifyWidgetListChanged; |
|
393 /** Launcher for notifying view list changes */ |
|
394 CPeriodic* iNotifyViewListChanged; |
|
395 }; |
|
396 |
|
397 #endif // C_XNEDITOR_H |