|
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 |
|
41 namespace hspswrapper |
|
42 { |
|
43 class CPropertyMap; |
|
44 class CAddPluginResult; |
|
45 class MHspsWrapperObserver; |
|
46 } |
|
47 |
|
48 namespace cpswrapper |
|
49 { |
|
50 class CCpsWrapper; |
|
51 class CPublisherMap; |
|
52 class CPublisherInfo; |
|
53 class MCpsWrapperObserver; |
|
54 } |
|
55 |
|
56 using namespace hspswrapper; |
|
57 using namespace cpswrapper; |
|
58 |
|
59 // Class declaration |
|
60 |
|
61 /** |
|
62 * Editor handles ai3 personalization |
|
63 * |
|
64 * @ingroup group_xnlayoutengine |
|
65 * @lib xn3layoutengine.lib |
|
66 * @since S60 5.0 |
|
67 */ |
|
68 NONSHARABLE_CLASS( CXnEditor ) : public CBase, |
|
69 public MXnViewObserver, |
|
70 public MCpsWrapperObserver, |
|
71 public MHspsWrapperObserver, |
|
72 public MHsContentController |
|
73 { |
|
74 public: |
|
75 //constructors and destructor |
|
76 |
|
77 /** |
|
78 * Two-phased constructor. |
|
79 * |
|
80 * @param aViewManager View manager |
|
81 * @param aWrapper HSPS wrapper |
|
82 */ |
|
83 static CXnEditor* NewL( CXnViewManager& aViewManager, |
|
84 const TDesC8& aUid ); |
|
85 |
|
86 /** |
|
87 * Two-phased constructor. |
|
88 * |
|
89 * @param aViewManager View manager |
|
90 * @param aWrapper HSPS wrapper |
|
91 */ |
|
92 static CXnEditor* NewLC( CXnViewManager& aViewManager, |
|
93 const TDesC8& aUid ); |
|
94 |
|
95 /** |
|
96 * Destructor. |
|
97 */ |
|
98 ~CXnEditor(); |
|
99 |
|
100 public: |
|
101 // new functions |
|
102 |
|
103 /** |
|
104 * Remove uregistered widget from all the views. |
|
105 * |
|
106 * @since S60 5.0 |
|
107 * @param aPublisher publisher |
|
108 */ |
|
109 void RemoveUnRegisteredWidgetL( const TDesC& aPublisher ); |
|
110 |
|
111 /** |
|
112 * Removes uninstalled widget from all views |
|
113 * |
|
114 * @since S60 5.0 |
|
115 * @param aContentInfo content info |
|
116 */ |
|
117 void RemoveUnInstalledWidgetL( const CHsContentInfo& aContentInfo ); |
|
118 |
|
119 /** |
|
120 * Runs add widget list query |
|
121 * |
|
122 * @since S60 5.0 |
|
123 */ |
|
124 void AddWidgetL(); |
|
125 |
|
126 /** |
|
127 * Remove widget from current view. |
|
128 * |
|
129 * @since S60 5.0 |
|
130 * @param aNode Plugin (or its child) where to remove widget. |
|
131 */ |
|
132 void RemoveWidgetL( CXnNode* aNode ); |
|
133 |
|
134 /** |
|
135 * Replaces widget configuration to HSPS |
|
136 * |
|
137 * @since S60 5.0 |
|
138 * @param aContentInfo content info |
|
139 */ |
|
140 void ReplaceWidgetL( CHsContentInfo& aContentInfo, TBool aUseHsps = ETrue ); |
|
141 /** |
|
142 * Commit a new order of plugins to the HSPS. |
|
143 * |
|
144 * @since S60 5.0 |
|
145 * @param aPluginArray Array of plugins |
|
146 */ |
|
147 void ReorderWidgetsL( RPointerArray< CXnNode >* aPluginArray ); |
|
148 |
|
149 /** |
|
150 * Toggles widgets' visibility |
|
151 * |
|
152 * @since S60 5.0 |
|
153 * @return Current widgets' visibility state |
|
154 */ |
|
155 TBool ToggleWidgetsVisibiltyL(); |
|
156 |
|
157 /** |
|
158 * Queries wheter the widgets are visible or not |
|
159 * |
|
160 * @since S60 5.0 |
|
161 * @return ETrue if widgets are now visible, EFalse otherwise |
|
162 */ |
|
163 TBool WidgetsVisible() const; |
|
164 |
|
165 /** |
|
166 * Sets target plugin for add/remove |
|
167 * |
|
168 * @since S60 5.0 |
|
169 * @param aNode a plugin node to be set as target for add/remove action |
|
170 */ |
|
171 void SetTargetPlugin( CXnNode* aNode ); |
|
172 |
|
173 /** |
|
174 * Handles changing of wallpaper |
|
175 * |
|
176 * @since S60 5.0 |
|
177 */ |
|
178 void SetWallpaperL(); |
|
179 |
|
180 /** |
|
181 * Returns the HSPS Wrapper object owned by this. |
|
182 * |
|
183 * @since S60 5.0 |
|
184 * @return HSPSWrapper |
|
185 */ |
|
186 CHspsWrapper& HspsWrapper() const; |
|
187 |
|
188 private: |
|
189 // from MHsContentController |
|
190 |
|
191 TInt WidgetListL( CHsContentInfoArray& aArray ); |
|
192 |
|
193 TInt ViewListL( CHsContentInfoArray& aArray ); |
|
194 |
|
195 TInt AppListL( CHsContentInfoArray& aArray ); |
|
196 |
|
197 TInt AddWidgetL( CHsContentInfo& aInfo ); |
|
198 |
|
199 TInt RemoveWidgetL( CHsContentInfo& aInfo ); |
|
200 |
|
201 TInt AddViewL( CHsContentInfo& aInfo ); |
|
202 |
|
203 TInt RemoveViewL( CHsContentInfo& aInfo ); |
|
204 |
|
205 TInt ActivateViewL( CHsContentInfo& aInfo ); |
|
206 |
|
207 TInt ActivateAppL( CHsContentInfo& aInfo ); |
|
208 |
|
209 private: |
|
210 // constructors |
|
211 |
|
212 /** |
|
213 * C++ constructor |
|
214 */ |
|
215 CXnEditor( CXnViewManager& aViewManager ); |
|
216 |
|
217 /** |
|
218 * Leaving constructor |
|
219 */ |
|
220 void ConstructL( const TDesC8& aUid ); |
|
221 |
|
222 private: |
|
223 // new functions |
|
224 |
|
225 void TemplatedWidgetsL( RPointerArray< CHsContentInfo >& aWidgets ); |
|
226 |
|
227 void HSPSPluginsL( RPointerArray< CHsContentInfo >& aWidgets, |
|
228 const TDesC8& aType ); |
|
229 |
|
230 CPublisherInfo* PublisherInfoL( const CHsContentInfo& aContentInfo ); |
|
231 |
|
232 TInt TemplateWidgetCanBeAddedRemovedL( CHsContentInfo& aContentInfo ); |
|
233 TInt NonTemplateWidgetCanBeAddedRemovedL( CHsContentInfo& aContentInfo ); |
|
234 |
|
235 TBool IsCurrentViewFull(); |
|
236 void FilterWidgetListL( CHsContentInfoArray& aContentInfoArray, |
|
237 TBool aIgnoreViewFull ); |
|
238 void FilterViewListL( CHsContentInfoArray& aContentInfoArray ); |
|
239 |
|
240 /** |
|
241 * Notifies the MHsContentControl and the MHsContentControlUi if widget list was changed. |
|
242 */ |
|
243 void WidgetListChanged(); |
|
244 |
|
245 /** |
|
246 * Notifies the MHsContentControl and the MHsContentControlUi if view list was changed. |
|
247 */ |
|
248 void ViewListChanged(); |
|
249 |
|
250 private: |
|
251 // from MXnViewObserver |
|
252 |
|
253 void NotifyViewActivatedL( const CXnViewData& aViewData ); |
|
254 |
|
255 void NotifyViewDeactivatedL( const CXnViewData& /*aViewData*/ ); |
|
256 |
|
257 void NotifyConfigureWidgetL( const CHsContentInfo& aContentInfo, |
|
258 CXnPluginData& aPluginData ); |
|
259 |
|
260 void NotifyWidgetAdditionL( const CXnPluginData& aPluginData ); |
|
261 |
|
262 void NotifyWidgetRemovalL( const CXnPluginData& aPluginData ); |
|
263 |
|
264 void NotifyViewAdditionL( const CXnPluginData& /*aPluginData*/ ); |
|
265 |
|
266 void NotifyViewRemovalL( const CXnPluginData& /*aPluginData*/ ); |
|
267 |
|
268 private: |
|
269 // from MCpsWrapperObserver |
|
270 |
|
271 void NotifyWidgetUnregisteredL( const TDesC& aPublisher ); |
|
272 |
|
273 void NotifyWidgetRegisteredL(); |
|
274 |
|
275 private: |
|
276 // from MHspsWrapperObserver |
|
277 |
|
278 TInt HandleNotifyL( const TDesC8& aEvent, const TDesC8& aAppConfUid, |
|
279 const TDesC8& aPluginName, const TDesC8& aOrigUid, |
|
280 const TDesC8& aPluginUid, const TDesC8& aPluginId ); |
|
281 |
|
282 private: |
|
283 // data |
|
284 |
|
285 /** View manager, not owned */ |
|
286 CXnViewManager& iViewManager; |
|
287 /** HSPS wrapper, owned */ |
|
288 CHspsWrapper* iHspsWrapper; |
|
289 /** CPS wrapper, owned */ |
|
290 CCpsWrapper* iCpsWrapper; |
|
291 /** Publisher map, owned */ |
|
292 CPublisherMap* iPublisherMap; |
|
293 /** Add widget listquery, not owned */ |
|
294 CAknListQueryDialog* iQuery; |
|
295 /** Target plugin for add/remove, not owned */ |
|
296 CXnNode* iTargetPlugin; |
|
297 /** Widgets visibility state */ |
|
298 TBool iWidgetsVisibilityState; |
|
299 }; |
|
300 |
|
301 #endif // C_XNEDITOR_H |