23 #include "WidgetUiAppUi.h" |
23 #include "WidgetUiAppUi.h" |
24 #include "WidgetUiNetworkListener.h" |
24 #include "WidgetUiNetworkListener.h" |
25 #include "WidgetInstallerInternalCRKeys.h" |
25 #include "WidgetInstallerInternalCRKeys.h" |
26 #include "SWInstWidgetUid.h" |
26 #include "SWInstWidgetUid.h" |
27 #include "widgetappdefs.rh" |
27 #include "widgetappdefs.rh" |
28 #include "browser_platform_variant.hrh" |
28 #include "Browser_platform_variant.hrh" |
29 #include "WidgetUiPSNotifier.h" |
|
30 #ifdef BRDO_WRT_HS_FF |
29 #ifdef BRDO_WRT_HS_FF |
31 #include "cpspublisher.h" |
30 #include "cpspublisher.h" |
32 #endif |
31 #endif |
33 |
32 |
34 #include <WidgetUi.rsg> |
33 #include <WidgetUi.rsg> |
35 #include <brctlinterface.h> |
34 #include <brctlinterface.h> |
36 #include <widgetregistryconstants.h> |
35 #include <WidgetRegistryConstants.h> |
37 #include <centralrepository.h> |
36 #include <centralrepository.h> |
38 #include <StringLoader.h> |
37 #include <StringLoader.h> |
39 #include <AknNoteDialog.h> |
38 #include <aknnotedialog.h> |
40 #include <S32FILE.H> |
39 #include <BrowserDialogsProvider.h> |
|
40 #include <s32file.h> |
41 #include <aknnotewrappers.h> |
41 #include <aknnotewrappers.h> |
42 #include "cpglobals.h" // CPS string definitions. |
42 #include "cpglobals.h" // CPS string definitions. |
43 |
43 |
44 #include <internetconnectionmanager.h> |
44 #include <InternetConnectionManager.h> |
45 #include <ActiveApDb.h> |
45 #include <ActiveApDb.h> |
46 #include <oommonitorsession.h> |
46 #include <oommonitorsession.h> |
47 #include <aknglobalnote.h> |
47 #include <AknGlobalNote.h> |
48 |
|
49 #ifdef BRDO_MULTITOUCH_ENABLED_FF |
|
50 #include<akntranseffect.h> |
|
51 #include<gfxtranseffect/GfxTransEffect.h> |
|
52 #endif |
|
53 |
|
54 #ifdef BRDO_OCC_ENABLED_FF |
|
55 #include <extendedconnpref.h> |
|
56 #endif |
|
57 |
48 |
58 // LOCAL FUNCTION PROTOTYPES |
49 // LOCAL FUNCTION PROTOTYPES |
59 TInt doDestructOOMNotifyTimer( TAny* ptr ); |
50 TInt doDestructOOMNotifyTimer( TAny* ptr ); |
60 TInt doNotifyHarvester( TAny* ptr ); |
51 TInt doNotifyHarvester( TAny* ptr ); |
61 |
52 |
176 } |
163 } |
177 |
164 |
178 delete cenRep; |
165 delete cenRep; |
179 } |
166 } |
180 |
167 |
|
168 iDialogsProvider = CBrowserDialogsProvider::NewL( NULL ); |
181 iHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process()); |
169 iHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process()); |
182 |
170 |
183 iDb = CActiveApDb::NewL( EDatabaseTypeIAP ); |
171 iDb = CActiveApDb::NewL( EDatabaseTypeIAP ); |
184 #ifdef BRDO_OCC_ENABLED_FF |
|
185 iConnection = CInternetConnectionManager::NewL( iDb->Database(), ETrue ); |
|
186 #else |
|
187 iConnection = CInternetConnectionManager::NewL( iDb->Database(), EFalse ); |
172 iConnection = CInternetConnectionManager::NewL( iDb->Database(), EFalse ); |
188 #endif |
|
189 |
|
190 #ifdef BRDO_WRT_HS_FF |
173 #ifdef BRDO_WRT_HS_FF |
191 iCpsPublisher = CCpsPublisher::NewL(); |
174 iCpsPublisher = CCpsPublisher::NewL(); |
192 iCenrepNotifyHandler = CCenrepNotifyHandler::NewL( *this ); |
175 #endif |
|
176 |
193 iNetworkListener = CWidgetUiNetworkListener::NewL( *this ); |
177 iNetworkListener = CWidgetUiNetworkListener::NewL( *this ); |
194 #endif |
|
195 |
|
196 #ifdef BRDO_OCC_ENABLED_FF |
|
197 iConnStageNotifier = CConnectionStageNotifierWCB::NewL(); |
|
198 iConnStageNotifier->SetPriority(CActive::EPriorityHigh); |
|
199 iRetryConnectivity = CPeriodic::NewL(CActive::EPriorityStandard); |
|
200 #endif |
|
201 |
|
202 //Creating observer WidgetWindowsObeserver |
|
203 iWidgetNotifier = CWidgetUiPSNotifier::NewL(*this, EWidgetRegAltered); |
|
204 |
|
205 #ifdef BRDO_SAPINTFN_ENABLED_FF |
|
206 iWidgetSapiNotifier = CWidgetUiPSNotifier::NewL(*this, ESapiPrompt); |
|
207 iWidgetSapiClearNotifier = CWidgetUiPSNotifier::NewL(*this, ESapiPromptCleared); |
|
208 #endif |
|
209 } |
178 } |
210 |
179 |
211 // ----------------------------------------------------------------------------- |
180 // ----------------------------------------------------------------------------- |
212 // CWidgetUiWindowManager::NewL |
181 // CWidgetUiWindowManager::NewL |
213 // Two-phased constructor |
182 // Two-phased constructor |
231 // |
200 // |
232 // ----------------------------------------------------------------------------- |
201 // ----------------------------------------------------------------------------- |
233 // |
202 // |
234 CWidgetUiWindowManager::~CWidgetUiWindowManager() |
203 CWidgetUiWindowManager::~CWidgetUiWindowManager() |
235 { |
204 { |
236 #ifdef BRDO_WRT_HS_FF |
205 iWindowList.ResetAndDestroy(); |
237 iCenrepNotifyHandler->DoCancel(); |
206 |
238 delete iCenrepNotifyHandler; |
|
239 #endif |
|
240 |
|
241 iActiveFsWindow = NULL; |
|
242 |
|
243 #ifdef BRDO_OCC_ENABLED_FF |
|
244 if ( iRetryConnectivity) |
|
245 { |
|
246 iRetryConnectivity->Cancel(); |
|
247 delete iRetryConnectivity; |
|
248 iRetryConnectivity = NULL; |
|
249 } |
|
250 #endif |
|
251 |
|
252 iWindowList.ResetAndDestroy(); |
|
253 |
|
254 #ifdef BRDO_WRT_HS_FF |
|
255 delete iNetworkListener; |
207 delete iNetworkListener; |
256 #endif |
|
257 |
208 |
258 // TODO Why there is a "Disconnect" method in the first place... |
209 // TODO Why there is a "Disconnect" method in the first place... |
259 // RHandleBase::Close() should be enough? |
210 // RHandleBase::Close() should be enough? |
260 if ( iServerConnected ) |
211 if ( iServerConnected ) |
261 { |
212 { |
296 if(!wdgt_window) |
243 if(!wdgt_window) |
297 return EFalse; |
244 return EFalse; |
298 wdgt_window->SetWindowStateMiniViewL( EMiniViewEnabled ); |
245 wdgt_window->SetWindowStateMiniViewL( EMiniViewEnabled ); |
299 |
246 |
300 // TODO also other states are possible when we should react? |
247 // TODO also other states are possible when we should react? |
301 |
248 |
302 // Removing . Miniview, shall remove full view as well. For blanket permissions |
249 // Removing . Miniview, shall remove full view as well. For blanket permissions |
303 // will be revoked for miniview |
250 // will be revoked for miniview |
304 |
251 |
305 |
252 iClientSession.SetBlanketPermissionL( aUid, EBlanketUnknown ); |
306 iClientSession.SetMiniViewL( aUid, EFalse ); |
253 iClientSession.SetMiniViewL( aUid, EFalse ); |
307 #ifdef BRDO_OCC_ENABLED_FF |
|
308 wdgt_window->CancelAllDialogs(); |
|
309 |
|
310 if ( wdgt_window->IsDialogsLaunched() ) |
|
311 { |
|
312 return EFalse; |
|
313 } |
|
314 #endif |
|
315 return CloseWindow( wdgt_window ); |
254 return CloseWindow( wdgt_window ); |
316 } |
255 } |
317 |
256 |
318 // ----------------------------------------------------------------------------- |
257 // ----------------------------------------------------------------------------- |
319 // CWidgetUiWindowManager::ActivateMiniView() |
258 // CWidgetUiWindowManager::ActivateMiniView() |
387 break; |
326 break; |
388 case WidgetSelect: |
327 case WidgetSelect: |
389 { |
328 { |
390 // If we don't have window we know that WidgetUI has died |
329 // If we don't have window we know that WidgetUI has died |
391 // We must enable miniview state |
330 // We must enable miniview state |
392 #ifdef BRDO_MULTITOUCH_ENABLED_FF |
|
393 GfxTransEffect::BeginFullScreen(AknTransEffect::EApplicationStart,TRect(0,0,0,0),AknTransEffect::EParameterType,AknTransEffect::GfxTransParam(TUid::Uid(KWidgetAppUid))); |
|
394 #endif |
|
395 if( !GetWindow(aUid)) |
331 if( !GetWindow(aUid)) |
396 { |
332 { |
397 needToNotify = EFalse; |
333 needToNotify = EFalse; |
398 CanWindowBeCreated( aUid, aOperation ); |
334 CanWindowBeCreated( aUid, aOperation ); |
399 break; |
335 break; |
400 } |
336 } |
401 //WidgetLauncher modified to bring app to foreground |
337 //WidgetLauncher modified to bring app to foreground |
402 GetWindow( aUid)->IncrementClickCount(); |
338 GetWindow( aUid)->IncrementClickCount(); |
403 OpenOrCreateWindowL( aUid, LaunchFullscreen ); |
339 OpenOrCreateWindowL( aUid, LaunchFullscreen ); |
404 #ifdef BRDO_MULTITOUCH_ENABLED_FF |
|
405 GfxTransEffect::EndFullScreen(); |
|
406 #endif |
|
407 } |
340 } |
408 break; |
341 break; |
409 case WidgetOnline: |
342 case WidgetOnline: |
410 { |
343 { |
411 iNetworkMode = EOnlineMode; |
344 iNetworkMode = EOnlineMode; |
412 CWidgetUiWindow* wdgt_window( GetWindow( aUid ) ); |
345 CWidgetUiWindow* wdgt_window( GetWindow( aUid ) ); |
413 if (wdgt_window) |
346 #ifdef BRDO_WRT_HS_FF |
|
347 if ( wdgt_window->NetworkModeWait()->IsStarted() ) |
414 { |
348 { |
415 #ifdef BRDO_WRT_HS_FF |
349 wdgt_window->NetworkModeWait()->AsyncStop(); |
416 if ( wdgt_window->NetworkModeWait()->IsStarted() ) |
350 } |
417 { |
|
418 wdgt_window->NetworkModeWait()->AsyncStop(); |
|
419 } |
|
420 #endif |
351 #endif |
421 if(wdgt_window->IsWidgetLoaded()) |
352 wdgt_window->DetermineNetworkState(); |
422 wdgt_window->DetermineNetworkState(); |
|
423 else |
|
424 wdgt_window->NeedToNotifyNetworkState(ETrue); |
|
425 } |
|
426 } |
353 } |
427 break; |
354 break; |
428 case WidgetOffline: |
355 case WidgetOffline: |
429 { |
356 { |
430 iNetworkMode = EOfflineMode; |
357 iNetworkMode = EOfflineMode; |
431 CWidgetUiWindow* wdgt_window( GetWindow( aUid ) ); |
358 CWidgetUiWindow* wdgt_window( GetWindow( aUid ) ); |
432 if (wdgt_window) |
359 #ifdef BRDO_WRT_HS_FF |
|
360 if ( wdgt_window->NetworkModeWait()->IsStarted() ) |
433 { |
361 { |
434 #ifdef BRDO_WRT_HS_FF |
362 wdgt_window->NetworkModeWait()->AsyncStop(); |
435 if ( wdgt_window->NetworkModeWait()->IsStarted() ) |
363 } |
436 { |
|
437 wdgt_window->NetworkModeWait()->AsyncStop(); |
|
438 } |
|
439 #endif |
364 #endif |
440 if ( iConnection->Connected()) |
365 // if no full view widgets open, then close the network connection |
441 { |
366 if ( ( !FullViewWidgetsOpen() ) && ( iConnection->Connected() ) ) |
442 for ( TInt i = 0; i < iWindowList.Count(); i++ ) |
367 { |
443 { |
368 wdgt_window->Engine()->HandleCommandL( |
444 CWidgetUiWindow* window = iWindowList[i]; |
|
445 if ( window && |
|
446 (window->WidgetMiniViewState() == EPublishStart || |
|
447 window->WidgetMiniViewState() == EPublishSuspend) |
|
448 ) |
|
449 //Send cancelFetch to all windows |
|
450 TRAP_IGNORE( window->Engine()->HandleCommandL( |
|
451 (TInt)TBrCtlDefs::ECommandIdBase + |
|
452 (TInt)TBrCtlDefs::ECommandCancelFetch ) ); |
|
453 } |
|
454 TRAP_IGNORE( wdgt_window->Engine()->HandleCommandL( |
|
455 (TInt)TBrCtlDefs::ECommandIdBase + |
369 (TInt)TBrCtlDefs::ECommandIdBase + |
456 (TInt)TBrCtlDefs::ECommandDisconnect ) ); |
370 (TInt)TBrCtlDefs::ECommandDisconnect ); |
457 } |
371 iConnection->StopConnectionL(); |
458 // if no full view widgets open, then close the network connection |
|
459 if ( !FullViewWidgetsOpen() && iConnection->Connected() ) |
|
460 { |
|
461 |
|
462 iConnection->StopConnectionL(); |
|
463 #ifdef BRDO_OCC_ENABLED_FF |
|
464 StopConnectionObserving(); |
|
465 #endif |
|
466 } |
|
467 if(wdgt_window->IsWidgetLoaded()) |
|
468 wdgt_window->DetermineNetworkState(); |
|
469 else |
|
470 wdgt_window->NeedToNotifyNetworkState(ETrue); |
|
471 } |
372 } |
472 } |
373 wdgt_window->DetermineNetworkState(); |
473 break; |
374 } |
474 case WidgetFullViewClose: |
375 break; |
475 { |
376 case WidgetRestart: |
476 needToNotify = EFalse ; |
377 { |
477 #ifdef BRDO_OCC_ENABLED_FF |
378 OpenOrCreateWindowL( aUid, LaunchMiniview ); |
478 CWidgetUiWindow* window( GetWindow( aUid ) ); |
379 ResumeWidgetL( aUid ); |
479 if( !window ) |
380 } |
480 return; |
381 break; |
481 else if ( window->IsDialogsLaunched() ) |
|
482 { |
|
483 iActiveFsWindow = window; |
|
484 // Bring app to foreground |
|
485 iAppUi.SendAppToForeground(); |
|
486 if ( iActiveFsWindow->Engine()->Rect() != View()->ClientRect()) |
|
487 { |
|
488 iActiveFsWindow->Engine()->SetRect( View()->ClientRect() ); |
|
489 } |
|
490 iActiveFsWindow->SetCurrentWindow( ETrue ); |
|
491 |
|
492 } |
|
493 else if (window->getSapiPromptCleared()) |
|
494 { |
|
495 Exit( EEikCmdExit, aUid ); |
|
496 } |
|
497 |
|
498 |
|
499 #else |
|
500 Exit( EEikCmdExit, aUid ); |
|
501 #endif |
|
502 } |
|
503 break; |
|
504 } |
382 } |
505 if(needToNotify) |
383 if(needToNotify) |
506 // Widget is up and running, notify that next one can be launched |
384 // Widget is up and running, notify that next one can be launched |
507 NotifyCommandHandled(); |
385 NotifyCommandHandled(); |
508 |
386 |
726 // ============================================================================= |
604 // ============================================================================= |
727 // |
605 // |
728 TBool CWidgetUiWindowManager::RemoveFromWindowList( CWidgetUiWindow* aWidgetWindow ) |
606 TBool CWidgetUiWindowManager::RemoveFromWindowList( CWidgetUiWindow* aWidgetWindow ) |
729 { |
607 { |
730 __ASSERT_DEBUG( aWidgetWindow, User::Invariant() ); |
608 __ASSERT_DEBUG( aWidgetWindow, User::Invariant() ); |
731 TBool count(EFalse); |
609 if ( iDialogsProvider->IsDialogLaunched() ) |
732 |
610 { |
|
611 return EFalse; |
|
612 } |
|
613 |
733 if ( iClientSession.IsWidgetInFullView ( aWidgetWindow->Uid())) |
614 if ( iClientSession.IsWidgetInFullView ( aWidgetWindow->Uid())) |
734 { |
615 { |
735 #ifdef BRDO_WRT_HS_FF |
|
736 iCpsPublisher->ClearScreenshotL(*(aWidgetWindow->WidgetBundleId()), aWidgetWindow->Uid().iUid); |
|
737 #endif |
|
738 HideWindow( aWidgetWindow ); |
616 HideWindow( aWidgetWindow ); |
739 if (aWidgetWindow == iActiveFsWindow) |
617 if (aWidgetWindow == iActiveFsWindow) |
740 iActiveFsWindow = NULL; |
618 iActiveFsWindow = NULL; |
741 // make widgets act like separate applications by pushing to background |
619 // make widgets act like separate applications by pushing to background |
742 // when widget is in fullview , this way user is sent back to app shell or idle |
620 // when widget is in fullview , this way user is sent back to app shell or idle |
753 TRAP_IGNORE( aWidgetWindow->Engine()->HandleCommandL( |
631 TRAP_IGNORE( aWidgetWindow->Engine()->HandleCommandL( |
754 (TInt)TBrCtlDefs::ECommandIdBase + |
632 (TInt)TBrCtlDefs::ECommandIdBase + |
755 (TInt)TBrCtlDefs::ECommandCancelFetch ) ); |
633 (TInt)TBrCtlDefs::ECommandCancelFetch ) ); |
756 if ( lastOne ) |
634 if ( lastOne ) |
757 { |
635 { |
758 if(aWidgetWindow->CanBeDeleted()) |
636 TRAP_IGNORE( aWidgetWindow->Engine()->HandleCommandL( |
759 { |
637 (TInt)TBrCtlDefs::ECommandIdBase + |
760 #ifdef BRDO_OCC_ENABLED_FF |
638 (TInt)TBrCtlDefs::ECommandDisconnect ) ); |
761 StopConnectionObserving(); |
639 |
762 #endif |
640 delete aWidgetWindow; |
763 iConnection->StopConnectionL(); |
641 return ETrue; |
764 delete aWidgetWindow; |
|
765 return ETrue; |
|
766 } |
|
767 } |
642 } |
768 else |
643 else |
769 { |
644 { |
770 if(aWidgetWindow->CanBeDeleted()) |
645 delete aWidgetWindow; |
771 { |
|
772 for ( TInt i = 0; i < iWindowList.Count(); ++i ) |
|
773 { |
|
774 CWidgetUiWindow* window( iWindowList[i] ); |
|
775 if(window->WidgetMiniViewState() == EMiniViewEnabled || window->WidgetMiniViewState() == EMiniViewNotEnabled) |
|
776 { |
|
777 count = ETrue; |
|
778 break; |
|
779 } |
|
780 } |
|
781 if(!count && iNetworkMode == EOfflineMode){ |
|
782 #ifdef BRDO_OCC_ENABLED_FF |
|
783 StopConnectionObserving(); |
|
784 #endif |
|
785 iConnection->StopConnectionL(); |
|
786 } |
|
787 if(!aWidgetWindow->Engine()->IsSynchRequestPending()) |
|
788 delete aWidgetWindow; |
|
789 else |
|
790 { |
|
791 //Let sync request complete and then delete |
|
792 aWidgetWindow->DeleteItself(); |
|
793 } |
|
794 } |
|
795 } |
646 } |
796 return EFalse; |
647 return EFalse; |
797 } |
648 } |
798 |
649 |
799 // ============================================================================= |
650 // ============================================================================= |
882 void CWidgetUiWindowManager::SendWidgetToBackground( const TUid& aUid ) |
733 void CWidgetUiWindowManager::SendWidgetToBackground( const TUid& aUid ) |
883 { |
734 { |
884 CWidgetUiWindow* window( GetWindow( aUid ) ); |
735 CWidgetUiWindow* window( GetWindow( aUid ) ); |
885 if( !window ) |
736 if( !window ) |
886 return; |
737 return; |
887 |
738 |
888 #ifdef BRDO_WRT_HS_FF |
|
889 iCpsPublisher->ClearScreenshotL(*(GetWindow(aUid )->WidgetBundleId()), aUid.iUid); |
|
890 #endif |
|
891 #ifdef BRDO_MULTITOUCH_ENABLED_FF |
|
892 GfxTransEffect::BeginFullScreen(AknTransEffect::EApplicationExit,TRect(0,0,0,0),AknTransEffect::EParameterType,AknTransEffect::GfxTransParam(TUid::Uid(KWidgetAppUid))); |
|
893 #endif |
|
894 // make widgets act like separate applications by pushing to background |
739 // make widgets act like separate applications by pushing to background |
895 // this way user is sent back to app shell or idle to run another widget |
740 // this way user is sent back to app shell or idle to run another widget |
896 iAppUi.SendAppToBackground(); |
741 iAppUi.SendAppToBackground(); |
897 if ( window == iActiveFsWindow ) |
742 if ( window == iActiveFsWindow ) |
898 { |
743 { |
899 //make the active window NULL and also CurrentWindow as False |
744 //make the active window NULL and also CurrentWindow as False |
900 iActiveFsWindow->SetCurrentWindow(EFalse); |
|
901 iActiveFsWindow->SetIsCurrentWindow(EFalse); |
745 iActiveFsWindow->SetIsCurrentWindow(EFalse); |
902 iActiveFsWindow = NULL; |
746 iActiveFsWindow = NULL; |
903 } |
747 } |
904 |
748 |
905 window->Engine()->MakeVisible( EFalse ); |
749 window->Engine()->MakeVisible( EFalse ); |
1438 // |
1256 // |
1439 // In case of OOM closes all widgets. |
1257 // In case of OOM closes all widgets. |
1440 // ------------------------------------------------------------------------ |
1258 // ------------------------------------------------------------------------ |
1441 TBool CWidgetUiWindowManager::CloseAllWidgetsUnderOOM() |
1259 TBool CWidgetUiWindowManager::CloseAllWidgetsUnderOOM() |
1442 { |
1260 { |
|
1261 TInt temp(0); |
1443 TInt err(KErrNone); |
1262 TInt err(KErrNone); |
1444 CWidgetUiWindow* windowToBeClosed(NULL); |
1263 CWidgetUiWindow* windowToBeClosed(NULL); |
1445 TTime currentTime; |
1264 TTime currentTime; |
1446 currentTime.HomeTime(); |
1265 currentTime.HomeTime(); |
1447 TTimeIntervalSeconds seconds; |
1266 TTimeIntervalSeconds seconds; |
1448 TInt nCountWidgetClosed = 0; |
1267 TInt nCountWidgetClosed = 0; |
1449 TBool bAllWindowsClosed = ETrue; |
1268 TBool bAllWindowsClosed = ETrue; |
1450 |
1269 |
1451 TInt nWidgetsCount = iWindowList.Count(); |
1270 TInt nWidgetsCount = iWindowList.Count(); |
1452 if(nWidgetsCount > 0) |
|
1453 { |
|
1454 CWidgetUiWindow* window = iWindowList[0]; |
|
1455 TRAP_IGNORE( window->Engine()->HandleCommandL( |
|
1456 (TInt)TBrCtlDefs::ECommandIdBase + |
|
1457 (TInt)TBrCtlDefs::ECommandOOMExit ) ); |
|
1458 } |
|
1459 for ( TInt i = (nWidgetsCount-1); i >= 0; i-- ) |
1271 for ( TInt i = (nWidgetsCount-1); i >= 0; i-- ) |
1460 { |
1272 { |
1461 CWidgetUiWindow* window = iWindowList[i]; |
1273 CWidgetUiWindow* window = iWindowList[i]; |
1462 err = currentTime.SecondsFrom(iTimeLastWidgetOpen,seconds); |
1274 err = currentTime.SecondsFrom(iTimeLastWidgetOpen,seconds); |
1463 if ( err == KErrOverflow || seconds.Int() > KOOMWidgetCloseTimeOut) |
1275 if ( err == KErrOverflow || seconds.Int() > KOOMWidgetCloseTimeOut) |
1528 return ETrue; |
1330 return ETrue; |
1529 } |
1331 } |
1530 return EFalse; |
1332 return EFalse; |
1531 } |
1333 } |
1532 |
1334 |
1533 |
|
1534 void CWidgetUiWindowManager::ExitNow() |
|
1535 { |
|
1536 iAppUi.Exit(); |
|
1537 } |
|
1538 #ifdef BRDO_OCC_ENABLED_FF |
|
1539 // ----------------------------------------------------------------------------- |
|
1540 // CWidgetUiWindowManager::ConnectionStageAchievedL() |
|
1541 // ----------------------------------------------------------------------------- |
|
1542 // |
|
1543 void CWidgetUiWindowManager::ConnectionStageAchievedL() |
|
1544 { |
|
1545 iConnection->Disconnect(); |
|
1546 |
|
1547 TNifProgressBuf buf = iConnStageNotifier->GetProgressBuffer(); |
|
1548 CWidgetUiWindow* window( iWindowList[0] ); |
|
1549 if( buf().iError == KErrDisconnected ) |
|
1550 { |
|
1551 TRAP_IGNORE( window->Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
1552 SetRetryFlag(ETrue); |
|
1553 |
|
1554 TRAP_IGNORE( window->Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelQueuedTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
1555 |
|
1556 if( iRetryConnectivity && iRetryConnectivity->IsActive()) |
|
1557 { |
|
1558 iRetryConnectivity->Cancel(); |
|
1559 } |
|
1560 iRetryConnectivity->Start(KRetryConnectivityTimeout, 0,TCallBack(RetryConnectivity,this)); |
|
1561 } |
|
1562 else |
|
1563 { |
|
1564 TRAP_IGNORE( window->Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelFetch + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
1565 } |
|
1566 } |
|
1567 |
|
1568 void CWidgetUiWindowManager::ConnNeededStatusL( TInt aErr ) |
|
1569 { |
|
1570 StopConnectionObserving(); //Need to stop the connection observer first |
|
1571 |
|
1572 |
|
1573 if ( !iConnStageNotifier->IsActive() ) |
|
1574 { |
|
1575 TName* connectionName = iConnection->ConnectionNameL(); |
|
1576 CleanupStack::PushL( connectionName ); |
|
1577 |
|
1578 iConnStageNotifier->StartNotificationL(connectionName, KLinkLayerClosed, this); |
|
1579 |
|
1580 CleanupStack::PopAndDestroy(); //connectionName |
|
1581 } |
|
1582 } |
|
1583 void CWidgetUiWindowManager::StopConnectionObserving() |
|
1584 { |
|
1585 |
|
1586 if ( iConnStageNotifier ) |
|
1587 { |
|
1588 iConnStageNotifier->Cancel(); |
|
1589 } |
|
1590 } |
|
1591 |
|
1592 // ----------------------------------------------------------------------------- |
|
1593 // CWidgetUiWindow::SetRetryFlag |
|
1594 // ----------------------------------------------------------------------------- |
|
1595 // |
|
1596 void CWidgetUiWindowManager::SetRetryFlag(TBool flag) |
|
1597 { |
|
1598 reConnectivityFlag = flag; |
|
1599 } |
|
1600 // ----------------------------------------------------------------------------- |
|
1601 // CWidgetUiWindow::RetryConnectivity |
|
1602 // ----------------------------------------------------------------------------- |
|
1603 // |
|
1604 TInt CWidgetUiWindowManager::RetryConnectivity(TAny* aWindowManager) |
|
1605 { |
|
1606 |
|
1607 TInt err = ((CWidgetUiWindowManager*)aWindowManager)->RetryInternetConnection(); |
|
1608 return err; |
|
1609 } |
|
1610 TInt CWidgetUiWindowManager::RetryInternetConnection() |
|
1611 { |
|
1612 //First cancel the timer |
|
1613 if ( iRetryConnectivity && iRetryConnectivity->IsActive() ) |
|
1614 { |
|
1615 iRetryConnectivity->Cancel(); |
|
1616 } |
|
1617 TInt err = KErrNone; |
|
1618 if ( !iConnection->Connected() ) |
|
1619 { |
|
1620 TRAP_IGNORE( err = iConnection->StartConnectionL( ETrue ) ); |
|
1621 } |
|
1622 |
|
1623 //Root cause needs to be identified.. |
|
1624 //Fix for Array out of bound crash.. |
|
1625 if(!iWindowList.Count()) |
|
1626 return err; |
|
1627 |
|
1628 CWidgetUiWindow* window( iWindowList[0] ); |
|
1629 if( err == KErrNone ) |
|
1630 { |
|
1631 |
|
1632 TRAP_IGNORE( window->Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandUnSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
1633 SetRetryFlag(EFalse); |
|
1634 |
|
1635 TRAP_IGNORE(ConnNeededStatusL(err)); //Start the observer again |
|
1636 TRAP_IGNORE( window->Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandRetryTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
1637 } |
|
1638 else |
|
1639 { |
|
1640 TRAP_IGNORE( window->Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandUnSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
1641 SetRetryFlag(EFalse); |
|
1642 TRAP_IGNORE(window->Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandClearQuedTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) ); |
|
1643 } |
|
1644 |
|
1645 return err; |
|
1646 } |
|
1647 // ----------------------------------------------------------------------------- |
|
1648 // CWidgetUiWindowManager::GetRetryFlag |
|
1649 // ----------------------------------------------------------------------------- |
|
1650 // |
|
1651 TBool CWidgetUiWindowManager::GetRetryFlag() |
|
1652 { |
|
1653 return reConnectivityFlag; |
|
1654 } |
|
1655 #endif // BRDO_OCC_ENABLED_FF |
|
1656 |
|
1657 CRequestRAM::CRequestRAM(CWidgetUiWindowManager* aWidgetUiWindowManager, const TUid& aUid, TUint32 aOperation): |
1335 CRequestRAM::CRequestRAM(CWidgetUiWindowManager* aWidgetUiWindowManager, const TUid& aUid, TUint32 aOperation): |
1658 CActive( EPriorityStandard ), |
1336 CActive( EPriorityStandard ), |
1659 iWidgetUiWindowManager(aWidgetUiWindowManager), |
1337 iOperation(aOperation), |
1660 iUid(aUid), |
1338 iUid(aUid), |
1661 iOperation(aOperation) |
1339 iWidgetUiWindowManager(aWidgetUiWindowManager) |
1662 { |
1340 { |
1663 } |
1341 } |
1664 |
1342 |
1665 CRequestRAM* CRequestRAM::StartLD(CWidgetUiWindowManager* aWidgetUiWindowManager, const TUid& aUid, TUint32 aOperation) |
1343 CRequestRAM* CRequestRAM::StartLD(CWidgetUiWindowManager* aWidgetUiWindowManager, const TUid& aUid, TUint32 aOperation) |
1666 { |
1344 { |
1739 } |
1411 } |
1740 void CRequestRAM::DoCancel() |
1412 void CRequestRAM::DoCancel() |
1741 { |
1413 { |
1742 iOomSession.CancelRequestFreeMemory(); |
1414 iOomSession.CancelRequestFreeMemory(); |
1743 } |
1415 } |
1744 void CWidgetUiWindowManager::CenrepChanged(TInt aHSModeOnline) |
1416 |
1745 { |
|
1746 if(iWindowList.Count()) |
|
1747 { |
|
1748 CWidgetUiWindow* window = iWindowList[0]; |
|
1749 if( window && |
|
1750 (window->WidgetMiniViewState() == EPublishStart || |
|
1751 window->WidgetMiniViewState() == EPublishSuspend) ) |
|
1752 { |
|
1753 if ( window->NetworkModeWait()->IsStarted() && window->WidgetMiniViewState() == EPublishSuspend) |
|
1754 { |
|
1755 window->NetworkModeWait()->AsyncStop(); |
|
1756 } |
|
1757 if(aHSModeOnline) |
|
1758 { |
|
1759 iNetworkMode = EOnlineMode; |
|
1760 } |
|
1761 else |
|
1762 { |
|
1763 iNetworkMode = EOfflineMode; |
|
1764 |
|
1765 if ( iConnection->Connected() ) |
|
1766 { |
|
1767 for ( TInt i = 0; i < iWindowList.Count(); i++ ) |
|
1768 { |
|
1769 CWidgetUiWindow* wdg_window = iWindowList[i]; |
|
1770 //send CancelFetch to all windows |
|
1771 TRAP_IGNORE( window->Engine()->HandleCommandL( |
|
1772 (TInt)TBrCtlDefs::ECommandIdBase + |
|
1773 (TInt)TBrCtlDefs::ECommandCancelFetch ) ); |
|
1774 } |
|
1775 TRAP_IGNORE( window->Engine()->HandleCommandL( |
|
1776 (TInt)TBrCtlDefs::ECommandIdBase + |
|
1777 (TInt)TBrCtlDefs::ECommandDisconnect ) ); |
|
1778 } |
|
1779 } |
|
1780 if(window->IsWidgetLoaded()) |
|
1781 window->DetermineNetworkState(); |
|
1782 else |
|
1783 window->NeedToNotifyNetworkState(ETrue); |
|
1784 |
|
1785 } |
|
1786 } |
|
1787 if ( ( !FullViewWidgetsOpen() ) && iConnection->Connected() && iNetworkMode == EOfflineMode) |
|
1788 { |
|
1789 #ifdef BRDO_OCC_ENABLED_FF |
|
1790 StopConnectionObserving(); |
|
1791 #endif |
|
1792 iConnection->StopConnectionL(); |
|
1793 } |
|
1794 } |
|
1795 |
|
1796 |
|
1797 //cenrep notification handling |
|
1798 |
|
1799 CCenrepNotifyHandler * CCenrepNotifyHandler::NewL( |
|
1800 MCenrepWatcher& aObserver) |
|
1801 { |
|
1802 CCenrepNotifyHandler* o = CCenrepNotifyHandler::NewLC(aObserver); |
|
1803 CleanupStack:: Pop(o); |
|
1804 return o; |
|
1805 } |
|
1806 CCenrepNotifyHandler* CCenrepNotifyHandler::NewLC( |
|
1807 MCenrepWatcher& aObserver) |
|
1808 { |
|
1809 CCenrepNotifyHandler* self( new( ELeave ) CCenrepNotifyHandler( aObserver) ); |
|
1810 CleanupStack:: PushL(self); |
|
1811 self->ConstructL(); |
|
1812 return self; |
|
1813 } |
|
1814 void CCenrepNotifyHandler::ConstructL() |
|
1815 { |
|
1816 iUid = TUid::Uid( KCRUidActiveIdleLV ); |
|
1817 iKey = KAIWebStatus; |
|
1818 iRepository = CRepository::NewL( iUid ); |
|
1819 CActiveScheduler::Add(this); |
|
1820 StartObservingL(); |
|
1821 } |
|
1822 |
|
1823 CCenrepNotifyHandler::CCenrepNotifyHandler(MCenrepWatcher& aObserver) : CActive (EPriorityLow),iObserver(aObserver) |
|
1824 { |
|
1825 |
|
1826 } |
|
1827 |
|
1828 CCenrepNotifyHandler::~CCenrepNotifyHandler() |
|
1829 { |
|
1830 Cancel(); //first cancel because iRepository is used there |
|
1831 delete iRepository; |
|
1832 iRepository=NULL; |
|
1833 } |
|
1834 |
|
1835 void CCenrepNotifyHandler::StartObservingL() |
|
1836 { |
|
1837 if( IsActive() ) |
|
1838 { |
|
1839 return; //do nothing if allready observing |
|
1840 } |
|
1841 User::LeaveIfError( |
|
1842 iRepository->NotifyRequest( iKey, iStatus ) ); |
|
1843 SetActive(); |
|
1844 } |
|
1845 |
|
1846 void CCenrepNotifyHandler::StopObserving() |
|
1847 { |
|
1848 Cancel(); |
|
1849 } |
|
1850 |
|
1851 void CCenrepNotifyHandler::DoCancel() |
|
1852 { |
|
1853 iRepository->NotifyCancel(iKey); |
|
1854 } |
|
1855 |
|
1856 void CCenrepNotifyHandler::RunL() |
|
1857 { |
|
1858 TInt value = 0; |
|
1859 TInt error = iRepository->Get( iKey, value); |
|
1860 if( error == KErrNone ) |
|
1861 { |
|
1862 iObserver.CenrepChanged(value); |
|
1863 } |
|
1864 // Re-subscribe |
|
1865 error = iRepository->NotifyRequest( iKey, iStatus ); |
|
1866 if( error == KErrNone ) |
|
1867 { |
|
1868 SetActive(); |
|
1869 } |
|
1870 } |
|
1871 // End of file |
1417 // End of file |