widgets/widgetapp/src/WidgetUiWindowManager.cpp
branchRCL_3
changeset 41 4bd5176e1bc8
parent 40 8bfb9186a8b8
child 44 800203832575
equal deleted inserted replaced
40:8bfb9186a8b8 41:4bd5176e1bc8
    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>
       
    40 #include <S32FILE.H>
    39 #include <S32FILE.H>
    41 #include <aknnotewrappers.h>
    40 #include <aknnotewrappers.h>
    42 #include "cpglobals.h" // CPS string definitions.
    41 #include "cpglobals.h" // CPS string definitions.
    43 
    42 
    44 #include <internetconnectionmanager.h>
    43 #include <internetconnectionmanager.h>
   172             }
   171             }
   173         
   172         
   174         delete cenRep;
   173         delete cenRep;
   175         }
   174         }
   176         
   175         
   177     iDialogsProvider = CBrowserDialogsProvider::NewL( NULL );
       
   178     iHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process());
   176     iHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process());
   179 
   177 
   180     iDb = CActiveApDb::NewL( EDatabaseTypeIAP );
   178     iDb = CActiveApDb::NewL( EDatabaseTypeIAP );
   181     #ifdef BRDO_OCC_ENABLED_FF
   179     #ifdef BRDO_OCC_ENABLED_FF
   182     iConnection = CInternetConnectionManager::NewL( iDb->Database(), ETrue );
   180     iConnection = CInternetConnectionManager::NewL( iDb->Database(), ETrue );
   218     {
   216     {
   219 #ifdef BRDO_WRT_HS_FF 
   217 #ifdef BRDO_WRT_HS_FF 
   220     iCenrepNotifyHandler->DoCancel();
   218     iCenrepNotifyHandler->DoCancel();
   221     delete iCenrepNotifyHandler;
   219     delete iCenrepNotifyHandler;
   222 #endif
   220 #endif
   223     if( iDialogsProvider)
   221       iActiveFsWindow = NULL;
   224         iDialogsProvider->CancelAll();
   222 	  
   225     iActiveFsWindow = NULL;
   223 	  iWindowList.ResetAndDestroy();
   226     iWindowList.ResetAndDestroy();
       
   227   
   224   
   228 #ifdef BRDO_WRT_HS_FF   
   225 #ifdef BRDO_WRT_HS_FF   
   229     delete iNetworkListener;
   226     delete iNetworkListener;
   230 #endif
   227 #endif
   231 
   228 
   237         }
   234         }
   238         
   235         
   239     iClientSession.Close();
   236     iClientSession.Close();
   240     
   237     
   241     delete iHandler;
   238     delete iHandler;
   242     delete iDialogsProvider;
       
   243 
       
   244     if ( iConnection )
   239     if ( iConnection )
   245         {
   240         {
   246         TRAP_IGNORE( iConnection->StopConnectionL() );
   241         TRAP_IGNORE( iConnection->StopConnectionL() );
   247         }
   242         }
   248 
   243 
   272     // Removing . Miniview, shall remove full view as well. For blanket permissions
   267     // Removing . Miniview, shall remove full view as well. For blanket permissions
   273     // will be revoked for miniview
   268     // will be revoked for miniview
   274 
   269 
   275  
   270  
   276     iClientSession.SetMiniViewL( aUid, EFalse );
   271     iClientSession.SetMiniViewL( aUid, EFalse );
       
   272 #ifdef BRDO_OCC_ENABLED_FF
       
   273     wdgt_window->CancelAllDialogs();
       
   274         
       
   275      if ( wdgt_window->IsDialogsLaunched() )
       
   276         {
       
   277         return EFalse;
       
   278         }
       
   279 #endif    
   277     return CloseWindow( wdgt_window );
   280     return CloseWindow( wdgt_window );
   278     }
   281     }
   279 
   282 
   280 // -----------------------------------------------------------------------------
   283 // -----------------------------------------------------------------------------
   281 // CWidgetUiWindowManager::ActivateMiniView()
   284 // CWidgetUiWindowManager::ActivateMiniView()
   409                     wdgt_window->Engine()->HandleCommandL( 
   412                     wdgt_window->Engine()->HandleCommandL( 
   410                             (TInt)TBrCtlDefs::ECommandIdBase +
   413                             (TInt)TBrCtlDefs::ECommandIdBase +
   411                             (TInt)TBrCtlDefs::ECommandDisconnect );
   414                             (TInt)TBrCtlDefs::ECommandDisconnect );
   412                     iConnection->CancelConnection();
   415                     iConnection->CancelConnection();
   413                     iConnection->StopConnectionL();
   416                     iConnection->StopConnectionL();
       
   417 #ifdef BRDO_OCC_ENABLED_FF                    
       
   418                     for ( TInt i = 0; i < iWindowList.Count(); i++ )
       
   419         				{
       
   420         				CWidgetUiWindow* window = iWindowList[i];
       
   421         				//send to all windows
       
   422                     	window->StopConnectionObserving();
       
   423                     	}
       
   424 #endif                    	
   414                     }
   425                     }
   415                 if(wdgt_window->IsWidgetLoaded())
   426                 if(wdgt_window->IsWidgetLoaded())
   416                     wdgt_window->DetermineNetworkState();
   427                     wdgt_window->DetermineNetworkState();
   417                 else
   428                 else
   418                     wdgt_window->NeedToNotifyNetworkState(ETrue);
   429                     wdgt_window->NeedToNotifyNetworkState(ETrue);
   419                 }
   430                 }
   420             }
   431             }
   421             break; 
   432             break; 
   422         case WidgetFullViewClose:
   433         case WidgetFullViewClose:
   423         	{
   434         	{
   424         	Exit( EEikCmdExit, aUid );
       
   425         	needToNotify = EFalse ;
   435         	needToNotify = EFalse ;
       
   436 #ifdef BRDO_OCC_ENABLED_FF 
       
   437         	CWidgetUiWindow* window( GetWindow( aUid ) );
       
   438             if( !window )
       
   439                 return;
       
   440             else if ( window->IsDialogsLaunched() )
       
   441                 {
       
   442           	    iActiveFsWindow = window;
       
   443           	    // Bring app to foreground
       
   444           	    iAppUi.SendAppToForeground(); 
       
   445           	    if ( iActiveFsWindow->Engine()->Rect() != View()->ClientRect())
       
   446                     {
       
   447                     iActiveFsWindow->Engine()->SetRect( View()->ClientRect() );
       
   448                     }
       
   449                 iActiveFsWindow->SetCurrentWindow( ETrue ); 
       
   450           	   
       
   451             }else
       
   452          	    Exit( EEikCmdExit, aUid );
       
   453 #else
       
   454                 Exit( EEikCmdExit, aUid );
       
   455 #endif
   426         	}
   456         	}
   427         	break;
   457         	break;
   428         }
   458         }
   429     if(needToNotify)
   459     if(needToNotify)
   430     // Widget is up and running, notify that next one can be launched    
   460     // Widget is up and running, notify that next one can be launched    
   651 //
   681 //
   652 TBool CWidgetUiWindowManager::RemoveFromWindowList( CWidgetUiWindow* aWidgetWindow )
   682 TBool CWidgetUiWindowManager::RemoveFromWindowList( CWidgetUiWindow* aWidgetWindow )
   653     {
   683     {
   654     __ASSERT_DEBUG( aWidgetWindow, User::Invariant() );
   684     __ASSERT_DEBUG( aWidgetWindow, User::Invariant() );
   655     TBool count(EFalse);
   685     TBool count(EFalse);
   656     if ( iDialogsProvider->IsDialogLaunched() )
   686   
   657         {
       
   658         return EFalse;
       
   659         }
       
   660 
       
   661     if ( iClientSession.IsWidgetInFullView ( aWidgetWindow->Uid()))
   687     if ( iClientSession.IsWidgetInFullView ( aWidgetWindow->Uid()))
   662         {
   688         {
   663 #ifdef BRDO_WRT_HS_FF
   689 #ifdef BRDO_WRT_HS_FF
   664           iCpsPublisher->ClearScreenshotL(*(aWidgetWindow->WidgetBundleId()), aWidgetWindow->Uid().iUid);
   690           iCpsPublisher->ClearScreenshotL(*(aWidgetWindow->WidgetBundleId()), aWidgetWindow->Uid().iUid);
   665 #endif
   691 #endif
   940         {
   966         {
   941         ShowWindow( iActiveFsWindow );
   967         ShowWindow( iActiveFsWindow );
   942         }
   968         }
   943     else
   969     else
   944         {
   970         {
   945         if(iDialogsProvider)
   971 #ifdef BRDO_OCC_ENABLED_FF
   946             iDialogsProvider->CancelAll();
   972         if(iActiveFsWindow)
   947             
   973             iActiveFsWindow->CancelAllDialogs();
       
   974 #endif    
       
   975         
   948 #ifdef BRDO_WRT_HS_FF  
   976 #ifdef BRDO_WRT_HS_FF  
   949         CFbsBitmap* bitmap( new CFbsBitmap() );
   977         CFbsBitmap* bitmap( new CFbsBitmap() );
   950         if ( bitmap && iCpsPublisher)
   978         if ( bitmap && iCpsPublisher)
   951             {
   979             {
   952             if(iActiveFsWindow)
   980             if(iActiveFsWindow)
  1081 		
  1109 		
  1082     if( (wdgt_window ->WidgetMiniViewState() == EMiniViewEnabled) ||
  1110     if( (wdgt_window ->WidgetMiniViewState() == EMiniViewEnabled) ||
  1083         (wdgt_window->WidgetMiniViewState() == EPublishSuspend) )
  1111         (wdgt_window->WidgetMiniViewState() == EPublishSuspend) )
  1084         {
  1112         {
  1085         //Widgets on HS cannnot be active
  1113         //Widgets on HS cannnot be active
       
  1114         if (iActiveFsWindow )
       
  1115             {
       
  1116             iActiveFsWindow->Engine()->MakeVisible( EFalse );
       
  1117             iActiveFsWindow->SetIsCurrentWindow( EFalse );
       
  1118             iActiveFsWindow->Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandAppBackground + (TInt)TBrCtlDefs::ECommandIdBase);
       
  1119             }
  1086         iActiveFsWindow = NULL;
  1120         iActiveFsWindow = NULL;
  1087         // Publish should start only after widget is resumed.
  1121         // Publish should start only after widget is resumed.
  1088         wdgt_window->SetWindowStateMiniViewL(EPublishStart);
  1122         wdgt_window->SetWindowStateMiniViewL(EPublishStart);
  1089 
  1123 
  1090         wdgt_window->Engine()->HandleCommandL( 
  1124         wdgt_window->Engine()->HandleCommandL( 
  1360 //
  1394 //
  1361 // In case of OOM closes all widgets. 
  1395 // In case of OOM closes all widgets. 
  1362 // ------------------------------------------------------------------------
  1396 // ------------------------------------------------------------------------
  1363 TBool  CWidgetUiWindowManager::CloseAllWidgetsUnderOOM()
  1397 TBool  CWidgetUiWindowManager::CloseAllWidgetsUnderOOM()
  1364     {
  1398     {
  1365     TInt temp(0);
       
  1366     TInt err(KErrNone);
  1399     TInt err(KErrNone);
  1367     CWidgetUiWindow* windowToBeClosed(NULL);
  1400     CWidgetUiWindow* windowToBeClosed(NULL);
  1368     TTime currentTime;
  1401     TTime currentTime;
  1369     currentTime.HomeTime();    
  1402     currentTime.HomeTime();    
  1370     TTimeIntervalSeconds  seconds;
  1403     TTimeIntervalSeconds  seconds;