widgets/widgetapp/src/WidgetUiWindowManager.cpp
branchRCL_3
changeset 35 1f3c3f2f5b0a
parent 28 d39add9822e2
child 36 c711bdda59f4
equal deleted inserted replaced
34:220a17280356 35:1f3c3f2f5b0a
   179     iConnection = CInternetConnectionManager::NewL( iDb->Database(), EFalse );
   179     iConnection = CInternetConnectionManager::NewL( iDb->Database(), EFalse );
   180     #endif
   180     #endif
   181     
   181     
   182 #ifdef BRDO_WRT_HS_FF    
   182 #ifdef BRDO_WRT_HS_FF    
   183     iCpsPublisher = CCpsPublisher::NewL();
   183     iCpsPublisher = CCpsPublisher::NewL();
       
   184     iCenrepNotifyHandler = CCenrepNotifyHandler::NewL( *this );
       
   185     iNetworkListener = CWidgetUiNetworkListener::NewL( *this );
   184 #endif
   186 #endif
   185     
       
   186     iNetworkListener = CWidgetUiNetworkListener::NewL( *this );
       
   187     }
   187     }
   188 
   188 
   189 // -----------------------------------------------------------------------------
   189 // -----------------------------------------------------------------------------
   190 // CWidgetUiWindowManager::NewL
   190 // CWidgetUiWindowManager::NewL
   191 // Two-phased constructor
   191 // Two-phased constructor
   209 //
   209 //
   210 // -----------------------------------------------------------------------------
   210 // -----------------------------------------------------------------------------
   211 //
   211 //
   212 CWidgetUiWindowManager::~CWidgetUiWindowManager()
   212 CWidgetUiWindowManager::~CWidgetUiWindowManager()
   213     {
   213     {
       
   214 #ifdef BRDO_WRT_HS_FF 
       
   215     iCenrepNotifyHandler->DoCancel();
       
   216     delete iCenrepNotifyHandler;
       
   217 #endif
   214     if( iDialogsProvider)
   218     if( iDialogsProvider)
   215         iDialogsProvider->CancelAll();
   219         iDialogsProvider->CancelAll();
   216     iActiveFsWindow = NULL;
   220     iActiveFsWindow = NULL;
   217     iWindowList.ResetAndDestroy();
   221     iWindowList.ResetAndDestroy();
   218     
   222   
       
   223 #ifdef BRDO_WRT_HS_FF   
   219     delete iNetworkListener;
   224     delete iNetworkListener;
       
   225 #endif
   220 
   226 
   221     // TODO Why there is a "Disconnect" method in the first place...
   227     // TODO Why there is a "Disconnect" method in the first place...
   222     // RHandleBase::Close() should be enough?
   228     // RHandleBase::Close() should be enough?
   223     if ( iServerConnected )
   229     if ( iServerConnected )
   224         {
   230         {
   259     // TODO also other states are possible when we should react?
   265     // TODO also other states are possible when we should react?
   260     
   266     
   261     // Removing . Miniview, shall remove full view as well. For blanket permissions
   267     // Removing . Miniview, shall remove full view as well. For blanket permissions
   262     // will be revoked for miniview
   268     // will be revoked for miniview
   263 
   269 
   264     iClientSession.SetBlanketPermissionL( aUid, EBlanketUnknown );
   270  
   265     iClientSession.SetMiniViewL( aUid, EFalse );
   271     iClientSession.SetMiniViewL( aUid, EFalse );
   266     return CloseWindow( wdgt_window );
   272     return CloseWindow( wdgt_window );
   267     }
   273     }
   268 
   274 
   269 // -----------------------------------------------------------------------------
   275 // -----------------------------------------------------------------------------
  1419     
  1425     
  1420 void CRequestRAM::ConstructL()
  1426 void CRequestRAM::ConstructL()
  1421     {
  1427     {
  1422     User::LeaveIfError(iOomSession.Connect());
  1428     User::LeaveIfError(iOomSession.Connect());
  1423     CActiveScheduler::Add( this );
  1429     CActiveScheduler::Add( this );
  1424 #ifdef FF_OOM_MONITOR2_COMPONENT
  1430 #ifdef BRDO_OOM_MONITOR2_COMPONENT_FF
  1425     iOomSession.RequestOptionalRam(KMemoryToCreateWidgetWindow, KMemoryToCreateWidgetWindow, KUidWidgetOOMPlugin, iStatus);
  1431     iOomSession.RequestOptionalRam(KMemoryToCreateWidgetWindow, KMemoryToCreateWidgetWindow, KUidWidgetOOMPlugin, iStatus);
  1426     SetActive();
  1432     SetActive();
  1427 #else
  1433 #else
  1428     TMemoryInfoV1Buf  info;
  1434     TMemoryInfoV1Buf  info;
  1429     UserHal::MemoryInfo (info);                
  1435     UserHal::MemoryInfo (info);                
  1485     }
  1491     }
  1486 void CRequestRAM::DoCancel()
  1492 void CRequestRAM::DoCancel()
  1487     {
  1493     {
  1488     iOomSession.CancelRequestFreeMemory();
  1494     iOomSession.CancelRequestFreeMemory();
  1489     }    
  1495     }    
  1490 
  1496 void CWidgetUiWindowManager::CenrepChanged(TInt aHSModeOnline)
       
  1497     {
       
  1498     for ( TInt i = 0; i < iWindowList.Count(); i++ )
       
  1499         {
       
  1500         CWidgetUiWindow* window = iWindowList[i];
       
  1501         if( window &&  window->WidgetMiniViewState() == EPublishSuspend )
       
  1502             {
       
  1503             if ( window->NetworkModeWait()->IsStarted() )
       
  1504                 {
       
  1505                 window->NetworkModeWait()->AsyncStop();
       
  1506                 }
       
  1507 		        if(aHSModeOnline)
       
  1508 		            {
       
  1509 		  	        iNetworkMode = EOnlineMode;
       
  1510 		            }
       
  1511 		        else
       
  1512 		  	        {
       
  1513 		  	        iNetworkMode = EOfflineMode;	
       
  1514 		  	        if ( ( !FullViewWidgetsOpen() ) && ( iConnection->Connected() ) )
       
  1515                     {
       
  1516                     TRAP_IGNORE( window->Engine()->HandleCommandL( 
       
  1517                                 (TInt)TBrCtlDefs::ECommandIdBase +
       
  1518                                 (TInt)TBrCtlDefs::ECommandCancelFetch ) );
       
  1519                     
       
  1520                          window->Engine()->HandleCommandL( 
       
  1521                                 (TInt)TBrCtlDefs::ECommandIdBase +
       
  1522                                 (TInt)TBrCtlDefs::ECommandDisconnect );
       
  1523                     iConnection->CancelConnection();
       
  1524                     iConnection->StopConnectionL();
       
  1525                     }
       
  1526 		  	        }
       
  1527 		  	    if(window->IsWidgetLoaded())
       
  1528                 window->DetermineNetworkState();
       
  1529             else
       
  1530                 window->NeedToNotifyNetworkState(ETrue);
       
  1531         
       
  1532             }
       
  1533         }
       
  1534   }        
       
  1535 
       
  1536 
       
  1537 //cenrep notification handling
       
  1538 
       
  1539 CCenrepNotifyHandler * CCenrepNotifyHandler::NewL(
       
  1540     MCenrepWatcher& aObserver)
       
  1541     {
       
  1542     CCenrepNotifyHandler* o =  CCenrepNotifyHandler::NewLC(aObserver);
       
  1543     CleanupStack:: Pop(o);
       
  1544     return o;
       
  1545     }
       
  1546 CCenrepNotifyHandler*  CCenrepNotifyHandler::NewLC(
       
  1547     MCenrepWatcher& aObserver) 
       
  1548     {
       
  1549     CCenrepNotifyHandler* self( new( ELeave ) CCenrepNotifyHandler( aObserver) );
       
  1550     CleanupStack:: PushL(self);
       
  1551     self->ConstructL();
       
  1552     return self;
       
  1553     }    
       
  1554 void CCenrepNotifyHandler::ConstructL()
       
  1555     {
       
  1556     iUid = TUid::Uid( KCRUidActiveIdleLV ); 
       
  1557     iKey = KAIWebStatus;
       
  1558     iRepository = CRepository::NewL( iUid );
       
  1559     CActiveScheduler::Add(this);
       
  1560     StartObservingL();
       
  1561     }
       
  1562          
       
  1563 CCenrepNotifyHandler::CCenrepNotifyHandler(MCenrepWatcher& aObserver) : iObserver(aObserver), CActive (EPriorityLow)
       
  1564    {
       
  1565          
       
  1566    }
       
  1567      
       
  1568 CCenrepNotifyHandler::~CCenrepNotifyHandler()
       
  1569     {
       
  1570     Cancel(); //first cancel because iRepository is used there
       
  1571     delete iRepository;
       
  1572     iRepository=NULL;
       
  1573     }
       
  1574     
       
  1575 void CCenrepNotifyHandler::StartObservingL()
       
  1576     {
       
  1577     if( IsActive() )
       
  1578         {
       
  1579         return; //do nothing if allready observing
       
  1580         }
       
  1581     User::LeaveIfError(
       
  1582                    iRepository->NotifyRequest( iKey, iStatus ) );
       
  1583     SetActive();
       
  1584     }
       
  1585     
       
  1586 void CCenrepNotifyHandler::StopObserving()
       
  1587     {
       
  1588     Cancel();
       
  1589     }
       
  1590     
       
  1591 void CCenrepNotifyHandler::DoCancel()
       
  1592     {
       
  1593     iRepository->NotifyCancel(iKey);
       
  1594     }
       
  1595 
       
  1596 void CCenrepNotifyHandler::RunL()
       
  1597     {
       
  1598     TInt value = 0;
       
  1599     TInt error = iRepository->Get( iKey, value);
       
  1600     if( error == KErrNone )
       
  1601         {
       
  1602         iObserver.CenrepChanged(value);
       
  1603         }
       
  1604     // Re-subscribe
       
  1605    error = iRepository->NotifyRequest( iKey, iStatus );
       
  1606    if( error == KErrNone )
       
  1607        {
       
  1608        SetActive();
       
  1609        }
       
  1610     }
  1491 // End of file
  1611 // End of file