|
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 * Declares main container control for Widget Manager application. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef WMMAINCONTAINER_H |
|
20 #define WMMAINCONTAINER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <e32cmn.h> |
|
24 #include <f32file.h> |
|
25 #include <coecobs.h> |
|
26 #include <coecntrl.h> |
|
27 #include <AknsUtils.h> |
|
28 #include <gulicon.h> |
|
29 #include <eiklbo.h> // MEikListBoxObserver |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CWmPlugin; |
|
33 class CWmListBox; |
|
34 class CAknsBasicBackgroundControlContext; |
|
35 class CAknViewAppUi; |
|
36 class CAknSearchField; |
|
37 class CCoeControl; |
|
38 class CAknSearchField; |
|
39 class CWmPortalButton; |
|
40 class CWmWidgetLoaderAo; |
|
41 class CWmMainContainerView; |
|
42 |
|
43 /** |
|
44 * Container class for WmMainContainer |
|
45 * |
|
46 * @class CWmMainContainer WmMainContainer.h |
|
47 */ |
|
48 NONSHARABLE_CLASS( CWmMainContainer ) : public CCoeControl, |
|
49 public MEikListBoxObserver |
|
50 { |
|
51 public: // constructors and destructor |
|
52 |
|
53 /* |
|
54 * Two-phased constructor. |
|
55 * |
|
56 * @param aRect container rect |
|
57 * @param aWmPlugin wm plugin |
|
58 */ |
|
59 static CWmMainContainer* NewL( |
|
60 const TRect& aRect, |
|
61 CWmPlugin& aWmPlugin ); |
|
62 |
|
63 /* |
|
64 * Two-phased constructor. |
|
65 * |
|
66 * @param aRect container rect |
|
67 * @param aWmPlugin wm plugin |
|
68 */ |
|
69 static CWmMainContainer* NewLC( |
|
70 const TRect& aRect, |
|
71 CWmPlugin& aWmPlugin ); |
|
72 |
|
73 /** Destructor */ |
|
74 virtual ~CWmMainContainer(); |
|
75 |
|
76 private: |
|
77 /** constructor */ |
|
78 CWmMainContainer( |
|
79 CWmPlugin& aWmPlugin ); |
|
80 |
|
81 /** 2nd phase constructor */ |
|
82 void ConstructL( |
|
83 const TRect& aRect ); |
|
84 |
|
85 public: // new functions |
|
86 |
|
87 /** |
|
88 * @return reference to WmPlugin |
|
89 */ |
|
90 CWmPlugin& WmPlugin(); |
|
91 |
|
92 /** |
|
93 * @return true, if portal button is currently selected |
|
94 */ |
|
95 TBool PortalSelected(); |
|
96 |
|
97 /** |
|
98 * @return true, if a widget in list is currently selected |
|
99 */ |
|
100 TBool WidgetSelected(); |
|
101 |
|
102 /** |
|
103 * @return true, ADD command is possible |
|
104 */ |
|
105 TBool CanDoAdd(); |
|
106 |
|
107 /** |
|
108 * @return true, if UNINSTALL command is possible |
|
109 */ |
|
110 TBool CanDoUninstall(); |
|
111 |
|
112 /** |
|
113 * @return true, if LAUNCH command is possible |
|
114 */ |
|
115 TBool CanDoLaunch(); |
|
116 |
|
117 /** |
|
118 * @return true, if FIND command is possible |
|
119 */ |
|
120 TBool CanDoFind(); |
|
121 |
|
122 /** |
|
123 * @return true, if SORT command is possible |
|
124 */ |
|
125 TBool CanDoSort(); |
|
126 |
|
127 /** |
|
128 * @return true, if DETAILS command is possible |
|
129 */ |
|
130 TBool CanDoDetails(); |
|
131 |
|
132 /** |
|
133 * @return true, if HELP command is possible |
|
134 */ |
|
135 TBool CanDoHelp(); |
|
136 |
|
137 /** |
|
138 * executes widget details dialog launch |
|
139 */ |
|
140 void LaunchDetailsDialogL(); |
|
141 |
|
142 /** |
|
143 * executes widget addition to home screen |
|
144 */ |
|
145 void AddWidgetToHomeScreenL(); |
|
146 |
|
147 /** |
|
148 * executes widget launch |
|
149 */ |
|
150 void LaunchWidgetL(); |
|
151 |
|
152 /** |
|
153 * executes findbox activation |
|
154 */ |
|
155 void ActivateFindPaneL(); |
|
156 |
|
157 /** |
|
158 * executes findbox deactivation |
|
159 */ |
|
160 void DeactivateFindPaneL(); |
|
161 |
|
162 /** |
|
163 * sorts the widget list in alphabetical order |
|
164 */ |
|
165 void SortListAlphabeticallyL(); |
|
166 |
|
167 /** |
|
168 * executes widget uninstall |
|
169 */ |
|
170 void UninstallWidgetL(); |
|
171 |
|
172 /** |
|
173 * opens OVI portal |
|
174 */ |
|
175 void OpenOviPortalL(); |
|
176 |
|
177 /** |
|
178 * Selection key (middle soft key) |
|
179 */ |
|
180 void SelectL(); |
|
181 |
|
182 /** |
|
183 * Show widget manager help |
|
184 */ |
|
185 void ShowHelpL(); |
|
186 |
|
187 /** |
|
188 * handles situation when widget list has changed. |
|
189 * in practice reloads the widget list from the widgets API |
|
190 * and redraws the screen. |
|
191 */ |
|
192 void HandleWidgetListChanged(); |
|
193 |
|
194 public: |
|
195 |
|
196 /** |
|
197 * Handles key events. |
|
198 * |
|
199 * @see CCoeControl::OfferKeyEventL |
|
200 */ |
|
201 TKeyResponse OfferKeyEventL( |
|
202 const TKeyEvent& aKeyEvent, |
|
203 TEventCode aType ); |
|
204 |
|
205 /** |
|
206 * Handles a change to the control's resources |
|
207 * |
|
208 * @see CCoeControl::HandleResourceChange |
|
209 */ |
|
210 void HandleResourceChange( TInt aType ); |
|
211 |
|
212 /** |
|
213 * Handles pointer events. |
|
214 * |
|
215 * @see CCoeControl::HandlePointerEventL |
|
216 */ |
|
217 void HandlePointerEventL( const TPointerEvent& aPointerEvent ); |
|
218 |
|
219 /** |
|
220 * Moves focus to the OVI button |
|
221 */ |
|
222 void SetFocusToOviButton(); |
|
223 |
|
224 /** |
|
225 * Moves focus to the widgets list, alternatively also setting the currently |
|
226 * selected item. |
|
227 * @param aIndex the item in widgets list to highlight during setting focus. |
|
228 * By default the previously selected item will be highlighted. |
|
229 */ |
|
230 void SetFocusToWidgetList( TInt aIndex = KErrUnknown ); |
|
231 |
|
232 /* |
|
233 * Tells if user inputs should be handeled or not. If ret is EFalse wm |
|
234 * can ignore user inputs. This is becouse closing view is async and user |
|
235 * might give some inputs before view is closed. |
|
236 */ |
|
237 TBool ClosingDown(); |
|
238 |
|
239 /* |
|
240 * To set iClosingDown. See above. |
|
241 */ |
|
242 void SetClosingDown( TBool aClosingDown ); |
|
243 |
|
244 protected: // from base class CCoeControl |
|
245 |
|
246 /** |
|
247 * Sets the control's extent, specifying a rectangle. |
|
248 * |
|
249 * @see CCoeControl::SizeChanged |
|
250 */ |
|
251 void SizeChanged(); |
|
252 |
|
253 private: // from base class CCoeControl |
|
254 |
|
255 /* |
|
256 * Draws the control. |
|
257 * |
|
258 * @see CCoeControl::Draw |
|
259 */ |
|
260 void Draw( const TRect& aRect ) const; |
|
261 |
|
262 /** |
|
263 * Suppy Mop object for control context |
|
264 * @param TTypeUid aId |
|
265 */ |
|
266 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
267 |
|
268 private: // from MEikListBoxObserver |
|
269 |
|
270 /** |
|
271 * List box observer interface. |
|
272 * |
|
273 * @see MEikListBoxObserver::HandleListBoxEventL |
|
274 */ |
|
275 void HandleListBoxEventL( |
|
276 CEikListBox* aListBox, |
|
277 TListBoxEvent aEventType); |
|
278 |
|
279 private: // New functions |
|
280 |
|
281 void AddControlL( CCoeControl* aControl, TInt aControlId ); |
|
282 void InitializeControlsL( const TRect& aRect ); |
|
283 void LayoutControls(); |
|
284 void StartLoadingWidgetsL(); |
|
285 void RemoveCtrlsFromStack(); |
|
286 TKeyResponse MoveFocusByKeys( |
|
287 const TKeyEvent& aKeyEvent, |
|
288 TEventCode aType ); |
|
289 void UpdateFocusMode(); |
|
290 CCoeControl* FindChildControlByPoint( const TPoint& aPoint ); |
|
291 void HandleFindSizeChanged(); |
|
292 void FetchRepositoryDataL(); |
|
293 |
|
294 private: |
|
295 |
|
296 /** |
|
297 * the plugin root |
|
298 */ |
|
299 CWmPlugin& iWmPlugin; |
|
300 |
|
301 /** |
|
302 * the widgets list |
|
303 */ |
|
304 CWmListBox* iWidgetsList; |
|
305 |
|
306 /** |
|
307 * search filed |
|
308 */ |
|
309 CAknSearchField* iFindbox; |
|
310 |
|
311 /** |
|
312 * search filed visibility switch |
|
313 */ |
|
314 TBool iFindPaneIsVisible; |
|
315 |
|
316 /** |
|
317 * background |
|
318 */ |
|
319 CAknsBasicBackgroundControlContext* iBgContext; |
|
320 |
|
321 /** |
|
322 * Ovi portal |
|
323 */ |
|
324 CWmPortalButton* iOviPortal; |
|
325 |
|
326 /** GUI layout modes */ |
|
327 enum TWmLayout |
|
328 { |
|
329 EPortrait, |
|
330 ELandscape, |
|
331 ELandscapeMirrored |
|
332 }; |
|
333 |
|
334 /** |
|
335 * current widget manager container layout |
|
336 */ |
|
337 TWmLayout iLayout; |
|
338 |
|
339 /** focus modes */ |
|
340 enum TWmFocusMode |
|
341 { |
|
342 ENowhere, |
|
343 EOvi, |
|
344 EList, |
|
345 EFind |
|
346 }; |
|
347 |
|
348 /** |
|
349 * current widget manager focus mode |
|
350 */ |
|
351 TWmFocusMode iFocusMode; |
|
352 |
|
353 /** |
|
354 * AO for loading widgets into the list UI |
|
355 */ |
|
356 CWmWidgetLoaderAo* iWidgetLoader; |
|
357 |
|
358 /** |
|
359 * If this is set to ETrue it means wmview is closing and all user inputs |
|
360 * should be ignored. |
|
361 */ |
|
362 TBool iClosingDown; |
|
363 |
|
364 /** |
|
365 * Localized Url to start browser |
|
366 */ |
|
367 HBufC* iOviStoreUrl; |
|
368 |
|
369 /** |
|
370 * OviStore bundleId |
|
371 */ |
|
372 HBufC* iOviStoreClientBundleId; |
|
373 |
|
374 /** |
|
375 * OviStore client param |
|
376 */ |
|
377 HBufC* iOviStoreClientParam; |
|
378 |
|
379 }; |
|
380 |
|
381 #endif // WMMAINCONTAINER_H |
|
382 |
|
383 // End of File |