|
1 /* |
|
2 * Copyright (c) 2006-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 the License "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 widget windows, each window display one widget |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef WIDGETUIWINDOWMANAGER_H_ |
|
20 #define WIDGETUIWINDOWMANAGER_H_ |
|
21 |
|
22 // INCLUDES FILES |
|
23 |
|
24 #include <WidgetRegistryClient.h> |
|
25 #include <aknglobalconfirmationquery.h> |
|
26 #include <coecntrl.h> |
|
27 #include "WidgetUiObserver.h" |
|
28 #include "Browser_platform_variant.hrh" |
|
29 // CONSTANTS |
|
30 |
|
31 // MACROS |
|
32 |
|
33 // DATA TYPES |
|
34 |
|
35 // FUNCTION PROTOTYPES |
|
36 |
|
37 // FORWARD DECLARATIONS |
|
38 class CDocumentHandler; |
|
39 class CWidgetUiWindowView; |
|
40 class CWidgetUiWindow; |
|
41 class CWidgetUiAppUi; |
|
42 class CWidgetUiCpsObserver; |
|
43 class CAknNoteDialog; |
|
44 class CBrowserDialogsProvider; |
|
45 class CBrCtlInterface; |
|
46 class CLiwServiceHandler; |
|
47 class MLiwInterface; |
|
48 class CInternetConnectionManager; |
|
49 class CSchemeHandler; |
|
50 |
|
51 #ifdef BRDO_WRT_HS_FF |
|
52 class CCpsPublisher; |
|
53 #endif |
|
54 // CLASS DECLARATION |
|
55 |
|
56 /** |
|
57 * CWidgetUiWindowManager |
|
58 * @lib WidgetUi.app |
|
59 * @since 3.1 |
|
60 */ |
|
61 class CWidgetUiWindowManager : public CBase |
|
62 { |
|
63 public: // constructors / destructor |
|
64 |
|
65 /** |
|
66 * NewL |
|
67 * Two-phased constructor. |
|
68 * @since 3.1 |
|
69 * @param none |
|
70 * @return CWidgetUiWindowManager* |
|
71 */ |
|
72 static CWidgetUiWindowManager* NewL( CWidgetUiAppUi& aAppUi ); |
|
73 |
|
74 /** |
|
75 * ~CWidgetUiWindowManger |
|
76 * Destructor |
|
77 * @since 3.1 |
|
78 * @param none |
|
79 * @return none |
|
80 */ |
|
81 virtual ~CWidgetUiWindowManager(); |
|
82 |
|
83 public: |
|
84 |
|
85 // Create window |
|
86 |
|
87 /** |
|
88 * HandleWidgetCommandL |
|
89 * @since 5.0 |
|
90 * @param aUid UID of widget. |
|
91 * @param aOperation Whether to open or close the widget, and how. |
|
92 */ |
|
93 void HandleWidgetCommandL( |
|
94 const TUid& aUid, |
|
95 TUint32 aOperation ); |
|
96 |
|
97 // Suspend/resume miniview stuff. |
|
98 /** |
|
99 * Suspend a widget. |
|
100 * @since 5.0 |
|
101 * @param aUid UID of widget. |
|
102 */ |
|
103 void SuspendWidget( const TUid& aUid ); |
|
104 |
|
105 /** |
|
106 * Resume a suspended widget. |
|
107 * @since 5.0 |
|
108 * @param aUid UID of widget. |
|
109 */ |
|
110 void ResumeWidgetL( const TUid& aUid ); |
|
111 |
|
112 /** |
|
113 * Suspend all the publishing widget. |
|
114 * @since 5.0 |
|
115 * @return none. |
|
116 */ |
|
117 void SuspendAllWidget(); |
|
118 |
|
119 /** |
|
120 * Stop mini view and exit |
|
121 * @since 5.0 |
|
122 * @param aUrl |
|
123 * @return none |
|
124 */ |
|
125 void DeactivateMiniViewL( const TUid& aUid ); |
|
126 |
|
127 /** |
|
128 * Suspend publishing on home screen |
|
129 * @since 5.0 |
|
130 * @param aUid UID of widget. |
|
131 * @param aSize Size of miniview. |
|
132 * @return Successful or not. |
|
133 */ |
|
134 TBool ActivateMiniViewL( const TUid& aUid, const TRect& aRect ); |
|
135 |
|
136 // Close / terminate widgets. |
|
137 |
|
138 /** |
|
139 * CloseWindow |
|
140 * Closes the window of the widget identified by a Uid |
|
141 * @since 3.1 |
|
142 * @param aUid - Uid to identify the widget |
|
143 * @return none |
|
144 */ |
|
145 void CloseWindow( const TUid& aUid ); |
|
146 |
|
147 /** |
|
148 * CloseWindow |
|
149 * Closes the window of the widget |
|
150 * @since 3.1 |
|
151 * @param aWidgetWindow - window of the widget |
|
152 * @return none |
|
153 */ |
|
154 void CloseWindow( CWidgetUiWindow* aWidgetWindow ); |
|
155 |
|
156 /** |
|
157 * RemoveFromWindowList |
|
158 * Remove the widget window from window list |
|
159 * @since 5.0 |
|
160 * @param aWidgetWindow - window of the widget |
|
161 * @return none |
|
162 */ |
|
163 void RemoveFromWindowList( CWidgetUiWindow* aWidgetWindow ); |
|
164 |
|
165 /** |
|
166 * CloseWindowsAsync |
|
167 * Close window async |
|
168 * @param aAllWindows ETrue closes all windows; EFalse closes active window |
|
169 * @since 3.1 |
|
170 */ |
|
171 void CloseWindowsAsync( TBool aAllWindows ); |
|
172 |
|
173 /** |
|
174 * CloseAllWindowsExceptCurrent |
|
175 * Closes all of the window except the current widget |
|
176 * @since 3.1 |
|
177 * @return none |
|
178 */ |
|
179 void CloseAllWindowsExceptCurrent(); |
|
180 |
|
181 /** |
|
182 * CheckIfWindowNeedsToBeClosed |
|
183 * Returns false only for current window |
|
184 * @since 5.0 |
|
185 * @return true if widget needs to be closed |
|
186 */ |
|
187 TBool CheckIfWindowNeedsToBeClosed(CWidgetUiWindow* aWindow) const; |
|
188 |
|
189 /** |
|
190 * Exit the widget, if the widget is the only widget running, exit the application |
|
191 * otherwise, close the widget window and activate the next widget window who is running |
|
192 * @since 3.1 |
|
193 */ |
|
194 void Exit( TInt aCommand , const TUid& aUid); |
|
195 |
|
196 /** |
|
197 * SetActiveWidgetAtExit |
|
198 * Sets the FullView window which is not publishing to active |
|
199 * @since 5.0 |
|
200 */ |
|
201 void SetActiveWidgetAtExit(); |
|
202 |
|
203 // Query/set states. |
|
204 |
|
205 /** |
|
206 * SetDisplayLandscape |
|
207 * Called to change the display orientation to landscape |
|
208 * @since 3.1 |
|
209 */ |
|
210 void SetDisplayLandscape( ); |
|
211 |
|
212 /** |
|
213 * GetWidgetEntryForUrl |
|
214 * Returns the UId of widget entry with a particular Url |
|
215 * @since 3.1 |
|
216 * @param none |
|
217 * @return UId |
|
218 */ |
|
219 TInt GetWidgetEntryForUrl( const TDesC& aUrl ); //const; |
|
220 |
|
221 /** |
|
222 * ActiveWindow |
|
223 * @since 3.1 |
|
224 * @param none |
|
225 * @return CWidgetUiWindow* |
|
226 */ |
|
227 inline CWidgetUiWindow* ActiveWindow() const { return iActiveFsWindow; } |
|
228 |
|
229 /** |
|
230 * GetWindow |
|
231 * Gets the window for certain widget identified by a URL |
|
232 * @since 3.1 |
|
233 * @param aUrl - a URL to identify the widget |
|
234 * @return the widget running, null if not found |
|
235 */ |
|
236 CWidgetUiWindow* GetWindow( const TDesC& aUrl ); |
|
237 |
|
238 /** |
|
239 * GetWindow |
|
240 * Gets the window for certain widget identified by a Uid |
|
241 * @since 3.1 |
|
242 * @param aUid - Uid to identify the widget |
|
243 * @return the widget running, null if not found |
|
244 */ |
|
245 CWidgetUiWindow* GetWindow( const TUid& aUid ); |
|
246 |
|
247 /** |
|
248 * SetView |
|
249 * @since 3.1 |
|
250 * @param aContentView |
|
251 * @return void |
|
252 */ |
|
253 void SetView( CWidgetUiWindowView& aContentView ) { iContentView = &aContentView; } |
|
254 |
|
255 /** |
|
256 * View |
|
257 * @since 3.1 |
|
258 * @param none |
|
259 * @return CWidgetUiWindowView* |
|
260 */ |
|
261 CWidgetUiWindowView* View() const { return iContentView; } |
|
262 |
|
263 /** |
|
264 * SetDisplayPortrait |
|
265 * Called to change the display orientation to portrait |
|
266 * @since 3.1 |
|
267 */ |
|
268 void SetDisplayPortrait( ); |
|
269 |
|
270 /** |
|
271 * SetDisplayAuto |
|
272 * Called to change the display orientation to device defined |
|
273 * @since 3.1 |
|
274 */ |
|
275 void SetDisplayAuto( ); |
|
276 |
|
277 /** |
|
278 * HandleForegroundEvent |
|
279 * Called when application goes to background or comes back to foreground |
|
280 * @since 3.1 |
|
281 */ |
|
282 void HandleForegroundEvent( TBool aForeground ); |
|
283 |
|
284 /** |
|
285 * HandleOOMEventL |
|
286 * Called when out of memory message is received by app ui |
|
287 * @since 3.1 |
|
288 */ |
|
289 void HandleOOMEventL( TBool aForeground ); |
|
290 |
|
291 /** |
|
292 * AllowPlatformAccessL |
|
293 * Prompt for Allow Platform Access |
|
294 * @since 5.0 |
|
295 */ |
|
296 void AllowPlatformAccessL( const TUid& aUid ); |
|
297 |
|
298 // Utility stuff. |
|
299 |
|
300 /** |
|
301 * WindowList |
|
302 * Gets the list of running windows |
|
303 * @since 3.1 |
|
304 * @param none |
|
305 * @return CArrayPtrFlat<CWidgetUiWindow>* |
|
306 */ |
|
307 void WindowList( RPointerArray<CWidgetUiWindow>& ) { /*return iWindowList; */ User::Invariant(); } |
|
308 |
|
309 /** |
|
310 * WidgetUIClientSession |
|
311 * @since 3.1 |
|
312 * @param none |
|
313 * @return RWidgetUIRegistryClientSession* |
|
314 */ |
|
315 RWidgetRegistryClientSession& WidgetUIClientSession() { return iClientSession; } |
|
316 |
|
317 /** |
|
318 * DialogsProvider |
|
319 * @since 3.1 |
|
320 * @param none |
|
321 * @return CBrowserDialogsProvider |
|
322 */ |
|
323 CBrowserDialogsProvider* DialogsProvider() { return iDialogsProvider; } |
|
324 |
|
325 /** |
|
326 * HandleLSKCommandL |
|
327 * @since 5.0 |
|
328 * @param TInt - command to execute |
|
329 * @return TBool - True if LSK handler is executed |
|
330 */ |
|
331 TBool HandleLSKCommandL( TInt aCommand ); |
|
332 |
|
333 /** |
|
334 * DocHandler |
|
335 * @since 5.0 |
|
336 * @return Document Handler. |
|
337 */ |
|
338 inline CDocumentHandler& DocHandler() { return *iHandler; } |
|
339 |
|
340 /** |
|
341 * GetConnection |
|
342 * @since 5.0 |
|
343 * @return CInternetConnectionManager |
|
344 */ |
|
345 CInternetConnectionManager* GetConnection() {return iConnection;} |
|
346 |
|
347 /** |
|
348 * GetDb |
|
349 * @since 5.0 |
|
350 * @return CActiveApDb |
|
351 */ |
|
352 CActiveApDb* GetDb() {return iDb;} |
|
353 |
|
354 protected: |
|
355 |
|
356 /** |
|
357 * CWidgetUiWindowManager |
|
358 * Constructor |
|
359 * @since 3.1 |
|
360 * @param none |
|
361 * @return none |
|
362 */ |
|
363 CWidgetUiWindowManager( CWidgetUiAppUi& aAppUi ); |
|
364 |
|
365 /** |
|
366 * ConstructL |
|
367 * EPOC default constructor |
|
368 * @since 3.1 |
|
369 * @param none |
|
370 * @return void |
|
371 */ |
|
372 void ConstructL(); |
|
373 |
|
374 private: |
|
375 |
|
376 /** |
|
377 * Hide the window. |
|
378 * @param aWindow Window. Ownership is retained. |
|
379 */ |
|
380 void HideWindow( CWidgetUiWindow* aWindow ); |
|
381 |
|
382 /** |
|
383 * Is the widget allowed to run or not |
|
384 * |
|
385 * @param aUid out-param, contains the UID of widget aon return. |
|
386 */ |
|
387 TBool IsWidgetAllowedL( const TUid& aUid );// const; |
|
388 |
|
389 /** |
|
390 * Notify user if widget is not allowed to run. |
|
391 * |
|
392 * @param aResourceID String identifier. |
|
393 */ |
|
394 void ShowNoteDialogL( TInt aResourceID ) const; |
|
395 |
|
396 /** |
|
397 * Create new window for a widget and add it to window list. |
|
398 * |
|
399 * @param aUid UID |
|
400 * @return Newly created window. |
|
401 */ |
|
402 CWidgetUiWindow* CreateNewWidgetWindowL( const TUid& aUid ); |
|
403 |
|
404 /** |
|
405 * Check if widget is supposed to support miniviews. |
|
406 * |
|
407 * @param aUid UID. |
|
408 * @return Whether widgets are supported or not. |
|
409 */ |
|
410 TBool DoesWidgetSupportMiniviewL( const TUid& aUid ); |
|
411 |
|
412 /** |
|
413 * OpenOrCreateWindowL |
|
414 * @since 5.0 |
|
415 * @param aUid UID of widget. |
|
416 * @param aOperation Whether to open widget to miniview or full screen. |
|
417 */ |
|
418 void OpenOrCreateWindowL( |
|
419 const TUid& aUid, |
|
420 TUint32 aOperation ); |
|
421 |
|
422 /** |
|
423 * Set the given window as "active full-screen window". |
|
424 * The method handles swapping of active window. |
|
425 * @since 5.0 |
|
426 * @param aWindow Window. Onwership is retained. |
|
427 */ |
|
428 void ShowWindow( |
|
429 CWidgetUiWindow* aWindow ); |
|
430 |
|
431 /** |
|
432 * Exit Publishing Widget |
|
433 * @since 5.0 |
|
434 * @param aUid |
|
435 * @return none |
|
436 */ |
|
437 void ExitPublishingWidget( const TUid& aUid ); |
|
438 |
|
439 private: |
|
440 |
|
441 CWidgetUiWindow* iActiveFsWindow; // reference. |
|
442 CWidgetUiWindowView* iContentView; // not owned, not responsible for deleting |
|
443 RPointerArray<CWidgetUiWindow> iWindowList; // owned, responsible for deleting |
|
444 CWidgetUiAppUi& iAppUi; // not owned, not responsible for deleting. |
|
445 CDocumentHandler* iHandler; // own |
|
446 RWidgetRegistryClientSession iClientSession; // owned |
|
447 TBool iServerConnected; // connected to Widget Registry server ? |
|
448 TBool iStrictMode; |
|
449 CBrowserDialogsProvider* iDialogsProvider;// owned, responsible for deleting |
|
450 CInternetConnectionManager* iConnection; // owned, responsible for deleting |
|
451 #ifdef BRDO_WRT_HS_FF |
|
452 CCpsPublisher* iCpsPublisher; // Owned, interface to publish bitmap to CPS |
|
453 #endif |
|
454 // TODO should this be created only when needed? |
|
455 CActiveApDb* iDb; // owned, responsible for deleting |
|
456 |
|
457 }; |
|
458 |
|
459 #endif // WIDGETUIWINDOWMANAGER_H_ |
|
460 |
|
461 // End of File |