widgets/widgetapp/src/WidgetUiWindowManager.cpp
changeset 11 c8a366e56285
parent 10 a359256acfc6
child 15 60c5402cb945
equal deleted inserted replaced
10:a359256acfc6 11:c8a366e56285
   118 //
   118 //
   119 CWidgetUiWindowManager::CWidgetUiWindowManager(CWidgetUiAppUi& aAppUi):
   119 CWidgetUiWindowManager::CWidgetUiWindowManager(CWidgetUiAppUi& aAppUi):
   120     iAppUi(aAppUi),
   120     iAppUi(aAppUi),
   121     iStrictMode(ETrue),
   121     iStrictMode(ETrue),
   122     iNetworkMode(EUnknownMode),
   122     iNetworkMode(EUnknownMode),
   123     iNetworkConnected(EFalse)
   123     iNetworkConnected(EFalse),
       
   124     iWidgetCursorMode(TBrCtlDefs::EDefaultCursor)
   124     {
   125     {
   125     }
   126     }
   126 
   127 
   127 // -----------------------------------------------------------------------------
   128 // -----------------------------------------------------------------------------
   128 // CWidgetUiWindowManager::ConstructL()
   129 // CWidgetUiWindowManager::ConstructL()
   142 
   143 
   143     TRAPD(error,cenRep = CRepository::NewL( TUid::Uid( KSWInstWidgetUIUid ) ));
   144     TRAPD(error,cenRep = CRepository::NewL( TUid::Uid( KSWInstWidgetUIUid ) ));
   144     if (!error)
   145     if (!error)
   145         {
   146         {
   146         TInt strictMode;
   147         TInt strictMode;
       
   148         TInt cursorMode = -1;
   147         if (cenRep->Get( KWidgetInstallerStrictMode, strictMode ) == KErrNone)
   149         if (cenRep->Get( KWidgetInstallerStrictMode, strictMode ) == KErrNone)
   148             {
   150             {
   149             iStrictMode = strictMode;
   151             iStrictMode = strictMode;
       
   152             }
       
   153         if (cenRep->Get( KWidgetCursorShowMode, cursorMode ) == KErrNone)
       
   154             {
       
   155             iWidgetCursorMode = (TBrCtlDefs::TCursorSettings) cursorMode;
   150             }
   156             }
   151         delete cenRep;
   157         delete cenRep;
   152         }
   158         }
   153         
   159         
   154     iDialogsProvider = CBrowserDialogsProvider::NewL( NULL );
   160     iDialogsProvider = CBrowserDialogsProvider::NewL( NULL );
   326             }
   332             }
   327             break;
   333             break;
   328         case WidgetOnline:
   334         case WidgetOnline:
   329             {
   335             {
   330             iNetworkMode = EOnlineMode;
   336             iNetworkMode = EOnlineMode;
   331             GetWindow( aUid )->DetermineNetworkState();
   337             CWidgetUiWindow* wdgt_window( GetWindow( aUid ) );
       
   338 #ifdef BRDO_WRT_HS_FF
       
   339             if ( wdgt_window->NetworkModeWait()->IsStarted() )
       
   340                 {
       
   341                 wdgt_window->NetworkModeWait()->AsyncStop();
       
   342                 }
       
   343 #endif
       
   344             wdgt_window->DetermineNetworkState();
   332             }
   345             }
   333             break;
   346             break;
   334        case WidgetOffline:
   347        case WidgetOffline:
   335             {
   348             {
   336             iNetworkMode = EOfflineMode;
   349             iNetworkMode = EOfflineMode;
       
   350             CWidgetUiWindow* wdgt_window( GetWindow( aUid ) );
       
   351 #ifdef BRDO_WRT_HS_FF
       
   352             if ( wdgt_window->NetworkModeWait()->IsStarted() )
       
   353                 {
       
   354                 wdgt_window->NetworkModeWait()->AsyncStop();
       
   355                 }
       
   356 #endif
   337             // if no full view widgets open, then close the network connection
   357             // if no full view widgets open, then close the network connection
   338             if ( ( !FullViewWidgetsOpen() ) && ( iConnection->Connected() ) )
   358             if ( ( !FullViewWidgetsOpen() ) && ( iConnection->Connected() ) )
   339                 {
   359                 {
   340                 CWidgetUiWindow* wdgt_window( GetWindow( aUid ) );
       
   341                 wdgt_window->Engine()->HandleCommandL( 
   360                 wdgt_window->Engine()->HandleCommandL( 
   342                         (TInt)TBrCtlDefs::ECommandIdBase +
   361                         (TInt)TBrCtlDefs::ECommandIdBase +
   343                         (TInt)TBrCtlDefs::ECommandDisconnect );
   362                         (TInt)TBrCtlDefs::ECommandDisconnect );
   344                 iConnection->StopConnectionL();
   363                 iConnection->StopConnectionL();
   345                 }
   364                 }
   346             GetWindow( aUid )->DetermineNetworkState();
   365             wdgt_window->DetermineNetworkState();
   347             }
   366             }
   348             break;
   367             break;
   349        case WidgetRestart:
   368        case WidgetRestart:
   350            {
   369            {
   351            OpenOrCreateWindowL( aUid, LaunchMiniview );
   370            OpenOrCreateWindowL( aUid, LaunchMiniview );
   544     ret = RemoveFromWindowList( aWidgetWindow );
   563     ret = RemoveFromWindowList( aWidgetWindow );
   545      
   564      
   546     if ( !lastOne )
   565     if ( !lastOne )
   547         {
   566         {
   548         // Starting JS timer, since we stopped it for deactivating miniview widget
   567         // Starting JS timer, since we stopped it for deactivating miniview widget
       
   568         //If there is a widget on HS then the timer will not be started
   549         CWidgetUiWindow* window = iWindowList[iWindowList.Count() - 1];
   569         CWidgetUiWindow* window = iWindowList[iWindowList.Count() - 1];
   550         if ( window)
   570         if ( window && AnyWidgetPublishing())
   551                TRAP_IGNORE ( window->Engine()->HandleCommandL( 
   571                TRAP_IGNORE ( window->Engine()->HandleCommandL( 
   552                               (TInt)TBrCtlDefs::ECommandAppForeground + 
   572                               (TInt)TBrCtlDefs::ECommandAppForeground + 
   553                               (TInt)TBrCtlDefs::ECommandIdBase));
   573                               (TInt)TBrCtlDefs::ECommandIdBase));
   554 
   574 
   555         for ( TInt i = 0; i < iWindowList.Count(); ++i )// Fix needed. Do we need onShow here.
   575         for ( TInt i = 0; i < iWindowList.Count(); ++i )// Fix needed. Do we need onShow here.
  1269 
  1289 
  1270 void CWidgetUiWindowManager::SendAppToBackground()
  1290 void CWidgetUiWindowManager::SendAppToBackground()
  1271     {
  1291     {
  1272     iAppUi.SendAppToBackground();    
  1292     iAppUi.SendAppToBackground();    
  1273     }
  1293     }
  1274     
  1294 
       
  1295 TBool CWidgetUiWindowManager::AnyWidgetOnHs()
       
  1296     {
       
  1297     for ( TInt i = 0; i < iWindowList.Count(); ++i )
       
  1298         {
       
  1299         CWidgetUiWindow* window( iWindowList[i] );
       
  1300         if( window->WidgetMiniViewState() != EMiniViewEnabled && window->WidgetMiniViewState() != EMiniViewNotEnabled )
       
  1301             return ETrue;
       
  1302         }
       
  1303     return EFalse;
       
  1304     }
       
  1305 
       
  1306 TBool CWidgetUiWindowManager::AnyWidgetPublishing()
       
  1307     {
       
  1308     for ( TInt i = 0; i < iWindowList.Count(); ++i )
       
  1309         {
       
  1310         CWidgetUiWindow* window( iWindowList[i] );
       
  1311         if( window->WidgetMiniViewState() == EPublishStart )
       
  1312             return ETrue;
       
  1313         }
       
  1314     return EFalse;
       
  1315     }
       
  1316 
  1275 CRequestRAM::CRequestRAM(CWidgetUiWindowManager* aWidgetUiWindowManager, const TUid& aUid, TUint32 aOperation):
  1317 CRequestRAM::CRequestRAM(CWidgetUiWindowManager* aWidgetUiWindowManager, const TUid& aUid, TUint32 aOperation):
  1276     CActive( EPriorityStandard ),
  1318     CActive( EPriorityStandard ),
  1277     iOperation(aOperation),
  1319     iOperation(aOperation),
  1278     iUid(aUid),
  1320     iUid(aUid),
  1279     iWidgetUiWindowManager(aWidgetUiWindowManager)
  1321     iWidgetUiWindowManager(aWidgetUiWindowManager)