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 #ifdef BRDO_WRT_HS_FF |
29 #ifdef BRDO_WRT_HS_FF |
30 #include "cpspublisher.h" |
30 #include "cpspublisher.h" |
31 #endif |
31 #endif |
32 |
32 |
33 #include <WidgetUi.rsg> |
33 #include <WidgetUi.rsg> |
34 #include <brctlinterface.h> |
34 #include <BrCtlInterface.h> |
35 #include <widgetregistryconstants.h> |
35 #include <WidgetRegistryConstants.h> |
36 #include <centralrepository.h> |
36 #include <centralrepository.h> |
37 #include <StringLoader.h> |
37 #include <StringLoader.h> |
38 #include <AknNoteDialog.h> |
38 #include <AknNoteDialog.h> |
39 #include <browserdialogsprovider.h> |
39 #include <BrowserDialogsProvider.h> |
40 #include <S32FILE.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_OCC_ENABLED_FF |
|
50 #include <extendedconnpref.h> |
|
51 #endif |
|
52 |
48 |
53 // LOCAL FUNCTION PROTOTYPES |
49 // LOCAL FUNCTION PROTOTYPES |
54 TInt doDestructOOMNotifyTimer( TAny* ptr ); |
50 TInt doDestructOOMNotifyTimer( TAny* ptr ); |
55 TInt doNotifyHarvester( TAny* ptr ); |
51 TInt doNotifyHarvester( TAny* ptr ); |
56 |
52 |
171 |
167 |
172 iDialogsProvider = CBrowserDialogsProvider::NewL( NULL ); |
168 iDialogsProvider = CBrowserDialogsProvider::NewL( NULL ); |
173 iHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process()); |
169 iHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process()); |
174 |
170 |
175 iDb = CActiveApDb::NewL( EDatabaseTypeIAP ); |
171 iDb = CActiveApDb::NewL( EDatabaseTypeIAP ); |
176 #ifdef BRDO_OCC_ENABLED_FF |
|
177 iConnection = CInternetConnectionManager::NewL( iDb->Database(), ETrue ); |
|
178 #else |
|
179 iConnection = CInternetConnectionManager::NewL( iDb->Database(), EFalse ); |
172 iConnection = CInternetConnectionManager::NewL( iDb->Database(), EFalse ); |
180 #endif |
|
181 |
|
182 #ifdef BRDO_WRT_HS_FF |
173 #ifdef BRDO_WRT_HS_FF |
183 iCpsPublisher = CCpsPublisher::NewL(); |
174 iCpsPublisher = CCpsPublisher::NewL(); |
184 #endif |
175 #endif |
185 |
176 |
186 iNetworkListener = CWidgetUiNetworkListener::NewL( *this ); |
177 iNetworkListener = CWidgetUiNetworkListener::NewL( *this ); |
209 // |
200 // |
210 // ----------------------------------------------------------------------------- |
201 // ----------------------------------------------------------------------------- |
211 // |
202 // |
212 CWidgetUiWindowManager::~CWidgetUiWindowManager() |
203 CWidgetUiWindowManager::~CWidgetUiWindowManager() |
213 { |
204 { |
214 if( iDialogsProvider) |
|
215 iDialogsProvider->CancelAll(); |
|
216 iActiveFsWindow = NULL; |
|
217 iWindowList.ResetAndDestroy(); |
205 iWindowList.ResetAndDestroy(); |
218 |
206 |
219 delete iNetworkListener; |
207 delete iNetworkListener; |
220 |
208 |
221 // TODO Why there is a "Disconnect" method in the first place... |
209 // TODO Why there is a "Disconnect" method in the first place... |
255 if(!wdgt_window) |
243 if(!wdgt_window) |
256 return EFalse; |
244 return EFalse; |
257 wdgt_window->SetWindowStateMiniViewL( EMiniViewEnabled ); |
245 wdgt_window->SetWindowStateMiniViewL( EMiniViewEnabled ); |
258 |
246 |
259 // TODO also other states are possible when we should react? |
247 // TODO also other states are possible when we should react? |
260 |
248 |
261 // Removing . Miniview, shall remove full view as well. For blanket permissions |
249 // Removing . Miniview, shall remove full view as well. For blanket permissions |
262 // will be revoked for miniview |
250 // will be revoked for miniview |
263 |
251 |
264 iClientSession.SetBlanketPermissionL( aUid, EBlanketUnknown ); |
252 iClientSession.SetBlanketPermissionL( aUid, EBlanketUnknown ); |
265 iClientSession.SetMiniViewL( aUid, EFalse ); |
253 iClientSession.SetMiniViewL( aUid, EFalse ); |
353 break; |
341 break; |
354 case WidgetOnline: |
342 case WidgetOnline: |
355 { |
343 { |
356 iNetworkMode = EOnlineMode; |
344 iNetworkMode = EOnlineMode; |
357 CWidgetUiWindow* wdgt_window( GetWindow( aUid ) ); |
345 CWidgetUiWindow* wdgt_window( GetWindow( aUid ) ); |
358 if (wdgt_window) |
346 #ifdef BRDO_WRT_HS_FF |
|
347 if ( wdgt_window->NetworkModeWait()->IsStarted() ) |
359 { |
348 { |
360 #ifdef BRDO_WRT_HS_FF |
349 wdgt_window->NetworkModeWait()->AsyncStop(); |
361 if ( wdgt_window->NetworkModeWait()->IsStarted() ) |
350 } |
362 { |
|
363 wdgt_window->NetworkModeWait()->AsyncStop(); |
|
364 } |
|
365 #endif |
351 #endif |
366 if(wdgt_window->IsWidgetLoaded()) |
352 wdgt_window->DetermineNetworkState(); |
367 wdgt_window->DetermineNetworkState(); |
|
368 else |
|
369 wdgt_window->NeedToNotifyNetworkState(ETrue); |
|
370 } |
|
371 } |
353 } |
372 break; |
354 break; |
373 case WidgetOffline: |
355 case WidgetOffline: |
374 { |
356 { |
375 iNetworkMode = EOfflineMode; |
357 iNetworkMode = EOfflineMode; |
376 CWidgetUiWindow* wdgt_window( GetWindow( aUid ) ); |
358 CWidgetUiWindow* wdgt_window( GetWindow( aUid ) ); |
377 if (wdgt_window) |
|
378 { |
|
379 #ifdef BRDO_WRT_HS_FF |
359 #ifdef BRDO_WRT_HS_FF |
380 if ( wdgt_window->NetworkModeWait()->IsStarted() ) |
360 if ( wdgt_window->NetworkModeWait()->IsStarted() ) |
381 { |
361 { |
382 wdgt_window->NetworkModeWait()->AsyncStop(); |
362 wdgt_window->NetworkModeWait()->AsyncStop(); |
383 } |
363 } |
384 #endif |
364 #endif |
385 // if no full view widgets open, then close the network connection |
365 // if no full view widgets open, then close the network connection |
386 if ( ( !FullViewWidgetsOpen() ) && ( iConnection->Connected() ) ) |
366 if ( ( !FullViewWidgetsOpen() ) && ( iConnection->Connected() ) ) |
387 { |
367 { |
388 TRAP_IGNORE( wdgt_window->Engine()->HandleCommandL( |
368 wdgt_window->Engine()->HandleCommandL( |
389 (TInt)TBrCtlDefs::ECommandIdBase + |
369 (TInt)TBrCtlDefs::ECommandIdBase + |
390 (TInt)TBrCtlDefs::ECommandCancelFetch ) ); |
370 (TInt)TBrCtlDefs::ECommandDisconnect ); |
391 |
371 iConnection->StopConnectionL(); |
392 wdgt_window->Engine()->HandleCommandL( |
|
393 (TInt)TBrCtlDefs::ECommandIdBase + |
|
394 (TInt)TBrCtlDefs::ECommandDisconnect ); |
|
395 iConnection->CancelConnection(); |
|
396 iConnection->StopConnectionL(); |
|
397 } |
|
398 if(wdgt_window->IsWidgetLoaded()) |
|
399 wdgt_window->DetermineNetworkState(); |
|
400 else |
|
401 wdgt_window->NeedToNotifyNetworkState(ETrue); |
|
402 } |
372 } |
403 } |
373 wdgt_window->DetermineNetworkState(); |
404 break; |
374 } |
|
375 break; |
|
376 case WidgetRestart: |
|
377 { |
|
378 OpenOrCreateWindowL( aUid, LaunchMiniview ); |
|
379 ResumeWidgetL( aUid ); |
|
380 } |
|
381 break; |
405 } |
382 } |
406 if(needToNotify) |
383 if(needToNotify) |
407 // 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 |
408 NotifyCommandHandled(); |
385 NotifyCommandHandled(); |
409 |
386 |
655 TRAP_IGNORE( aWidgetWindow->Engine()->HandleCommandL( |
631 TRAP_IGNORE( aWidgetWindow->Engine()->HandleCommandL( |
656 (TInt)TBrCtlDefs::ECommandIdBase + |
632 (TInt)TBrCtlDefs::ECommandIdBase + |
657 (TInt)TBrCtlDefs::ECommandCancelFetch ) ); |
633 (TInt)TBrCtlDefs::ECommandCancelFetch ) ); |
658 if ( lastOne ) |
634 if ( lastOne ) |
659 { |
635 { |
660 if(aWidgetWindow->CanBeDeleted()) |
636 TRAP_IGNORE( aWidgetWindow->Engine()->HandleCommandL( |
661 { |
637 (TInt)TBrCtlDefs::ECommandIdBase + |
662 TRAP_IGNORE( aWidgetWindow->Engine()->HandleCommandL( |
638 (TInt)TBrCtlDefs::ECommandDisconnect ) ); |
663 (TInt)TBrCtlDefs::ECommandIdBase + |
639 |
664 (TInt)TBrCtlDefs::ECommandDisconnect ) ); |
640 delete aWidgetWindow; |
665 iConnection->CancelConnection(); |
641 return ETrue; |
666 iConnection->StopConnectionL(); |
|
667 delete aWidgetWindow; |
|
668 return ETrue; |
|
669 } |
|
670 } |
642 } |
671 else |
643 else |
672 { |
644 { |
673 if(aWidgetWindow->CanBeDeleted()) |
645 delete aWidgetWindow; |
674 { |
646 } |
675 for ( TInt i = 0; i < iWindowList.Count(); ++i ) |
647 return EFalse; |
676 { |
|
677 CWidgetUiWindow* window( iWindowList[i] ); |
|
678 if(window->WidgetMiniViewState() == EMiniViewEnabled || window->WidgetMiniViewState() == EMiniViewNotEnabled) |
|
679 { |
|
680 count = ETrue; |
|
681 break; |
|
682 } |
|
683 } |
|
684 if(!count && iNetworkMode == EOfflineMode){ |
|
685 aWidgetWindow->Engine()->HandleCommandL( |
|
686 (TInt)TBrCtlDefs::ECommandIdBase + |
|
687 (TInt)TBrCtlDefs::ECommandDisconnect ); |
|
688 iConnection->StopConnectionL(); |
|
689 } |
|
690 delete aWidgetWindow; |
|
691 } |
|
692 return EFalse; |
|
693 } |
|
694 |
|
695 } |
648 } |
696 |
649 |
697 // ============================================================================= |
650 // ============================================================================= |
698 // CWidgetUiWindowManager::CloseWindowWithLeastClick() |
651 // CWidgetUiWindowManager::CloseWindowWithLeastClick() |
699 // return true for the last widgets to be closed |
652 // return true for the last widgets to be closed |
787 // 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 |
788 iAppUi.SendAppToBackground(); |
741 iAppUi.SendAppToBackground(); |
789 if ( window == iActiveFsWindow ) |
742 if ( window == iActiveFsWindow ) |
790 { |
743 { |
791 //make the active window NULL and also CurrentWindow as False |
744 //make the active window NULL and also CurrentWindow as False |
792 iActiveFsWindow->SetCurrentWindow(EFalse); |
|
793 iActiveFsWindow->SetIsCurrentWindow(EFalse); |
745 iActiveFsWindow->SetIsCurrentWindow(EFalse); |
794 iActiveFsWindow = NULL; |
746 iActiveFsWindow = NULL; |
795 } |
747 } |
796 |
748 |
797 window->Engine()->MakeVisible( EFalse ); |
749 window->Engine()->MakeVisible( EFalse ); |
1045 (TInt)TBrCtlDefs::ECommandAppForeground + |
995 (TInt)TBrCtlDefs::ECommandAppForeground + |
1046 (TInt)TBrCtlDefs::ECommandIdBase); |
996 (TInt)TBrCtlDefs::ECommandIdBase); |
1047 #ifdef BRDO_WRT_HS_FF |
997 #ifdef BRDO_WRT_HS_FF |
1048 wdgt_window->Engine()->MakeVisible( EFalse ); |
998 wdgt_window->Engine()->MakeVisible( EFalse ); |
1049 wdgt_window->Engine()->SetRect( iCpsPublisher->BitmapSize()); |
999 wdgt_window->Engine()->SetRect( iCpsPublisher->BitmapSize()); |
1050 //When HS comes to foreground show the latest updatd content on HS. |
|
1051 //Relayout can sometimes happen only when widget in FullView. |
|
1052 wdgt_window->PublishSnapShot(); |
|
1053 #endif |
1000 #endif |
1054 } |
1001 } |
1055 } |
1002 } |
1056 |
1003 |
1057 // ----------------------------------------------------------------------------- |
1004 // ----------------------------------------------------------------------------- |
1350 void CWidgetUiWindowManager::CloseAllWidgets() |
1297 void CWidgetUiWindowManager::CloseAllWidgets() |
1351 { |
1298 { |
1352 TInt nWidgetsCount = iWindowList.Count(); |
1299 TInt nWidgetsCount = iWindowList.Count(); |
1353 for ( TInt i = (nWidgetsCount-1); i >= 0; i-- ) |
1300 for ( TInt i = (nWidgetsCount-1); i >= 0; i-- ) |
1354 { |
1301 { |
1355 CWidgetUiWindow* window = iWindowList[i]; |
1302 CWidgetUiWindow* window = iWindowList[i]; |
1356 TRAP_IGNORE( window->Engine()->HandleCommandL( |
|
1357 (TInt)TBrCtlDefs::ECommandIdBase + |
|
1358 (TInt)TBrCtlDefs::ECommandCancelFetch ) ); |
|
1359 if(i == 0) |
|
1360 TRAP_IGNORE( window->Engine()->HandleCommandL( |
|
1361 (TInt)TBrCtlDefs::ECommandIdBase + |
|
1362 (TInt)TBrCtlDefs::ECommandDisconnect ) ); |
|
1363 iConnection->CancelConnection(); |
|
1364 iConnection->StopConnectionL(); |
|
1365 delete window; |
1303 delete window; |
1366 } |
1304 } |
1367 iWindowList.Reset(); |
1305 iWindowList.Reset(); |
1368 } |
1306 } |
1369 |
1307 |
1390 CWidgetUiWindow* window( iWindowList[i] ); |
1328 CWidgetUiWindow* window( iWindowList[i] ); |
1391 if( window->WidgetMiniViewState() == EPublishStart ) |
1329 if( window->WidgetMiniViewState() == EPublishStart ) |
1392 return ETrue; |
1330 return ETrue; |
1393 } |
1331 } |
1394 return EFalse; |
1332 return EFalse; |
1395 } |
|
1396 |
|
1397 |
|
1398 void CWidgetUiWindowManager::ExitNow() |
|
1399 { |
|
1400 iAppUi.Exit(); |
|
1401 } |
1333 } |
1402 |
1334 |
1403 CRequestRAM::CRequestRAM(CWidgetUiWindowManager* aWidgetUiWindowManager, const TUid& aUid, TUint32 aOperation): |
1335 CRequestRAM::CRequestRAM(CWidgetUiWindowManager* aWidgetUiWindowManager, const TUid& aUid, TUint32 aOperation): |
1404 CActive( EPriorityStandard ), |
1336 CActive( EPriorityStandard ), |
1405 iOperation(aOperation), |
1337 iOperation(aOperation), |
1437 void CRequestRAM::RunL() |
1369 void CRequestRAM::RunL() |
1438 { |
1370 { |
1439 if(iStatus >= 0) |
1371 if(iStatus >= 0) |
1440 { |
1372 { |
1441 iWidgetUiWindowManager->OpenOrCreateWindowL( iUid, LaunchMiniview ); |
1373 iWidgetUiWindowManager->OpenOrCreateWindowL( iUid, LaunchMiniview ); |
1442 iWidgetUiWindowManager->GetWindow(iUid)->NeedToNotifyNetworkState(ETrue); |
|
1443 iWidgetUiWindowManager->ResumeWidgetL( iUid ); |
1374 iWidgetUiWindowManager->ResumeWidgetL( iUid ); |
1444 iWidgetUiWindowManager->GetWindow(iUid)->SetTime(); |
1375 iWidgetUiWindowManager->GetWindow(iUid)->SetTime(); |
1445 #ifdef OOM_WIDGET_CLOSEALL |
1376 #ifdef OOM_WIDGET_CLOSEALL |
1446 iWidgetUiWindowManager->SetLastWidgetRestartTime( iWidgetUiWindowManager->GetWindow(iUid)->GetTime()); |
1377 iWidgetUiWindowManager->SetLastWidgetRestartTime( iWidgetUiWindowManager->GetWindow(iUid)->GetTime()); |
1447 #endif //OOM_WIDGET_CLOSEALL |
1378 #endif //OOM_WIDGET_CLOSEALL |
1464 iWidgetUiWindowManager->StartHarvesterNotifyTimer(); |
1395 iWidgetUiWindowManager->StartHarvesterNotifyTimer(); |
1465 } |
1396 } |
1466 else |
1397 else |
1467 { |
1398 { |
1468 NotifyCommandHandled(); |
1399 NotifyCommandHandled(); |
1469 TBool lastOne( iWidgetUiWindowManager->WindowListCount() == 0 ); |
|
1470 if( lastOne ) |
|
1471 { |
|
1472 iWidgetUiWindowManager->AppUi().Exit(); |
|
1473 } |
|
1474 iWidgetUiWindowManager->SendAppToBackground(); |
1400 iWidgetUiWindowManager->SendAppToBackground(); |
1475 iWidgetUiWindowManager->WidgetUIClientSession().SetActive( iUid, EFalse ); |
1401 iWidgetUiWindowManager->WidgetUIClientSession().SetActive( iUid, EFalse ); |
1476 } |
1402 } |
1477 delete this; |
1403 delete this; |
1478 } |
1404 } |