widgets/widgetapp/src/WidgetUiWindow.cpp
changeset 11 c8a366e56285
parent 10 a359256acfc6
child 15 60c5402cb945
equal deleted inserted replaced
10:a359256acfc6 11:c8a366e56285
    40 #include <AiwGenericParam.h>
    40 #include <AiwGenericParam.h>
    41 #include <ActiveApDb.h>
    41 #include <ActiveApDb.h>
    42 #include <aknsdrawutils.h>
    42 #include <aknsdrawutils.h>
    43 #include "SWInstWidgetUid.h"
    43 #include "SWInstWidgetUid.h"
    44 
    44 
       
    45 
    45 // EXTERNAL DATA STRUCTURES
    46 // EXTERNAL DATA STRUCTURES
    46 
    47 
    47 // EXTERNAL FUNCTION PROTOTYPES
    48 // EXTERNAL FUNCTION PROTOTYPES
    48 
    49 
    49 // CONSTANTS
    50 // CONSTANTS
   118     RWidgetRegistryClientSession clientSession = iWindowManager.WidgetUIClientSession();
   119     RWidgetRegistryClientSession clientSession = iWindowManager.WidgetUIClientSession();
   119     iUrl = GetUlrL( clientSession, aUid );
   120     iUrl = GetUlrL( clientSession, aUid );
   120     iWidgetUiObserver = CWidgetUiObserver::NewL( *this );
   121     iWidgetUiObserver = CWidgetUiObserver::NewL( *this );
   121 
   122 
   122     iWidgetUiDialogsProviderProxy = CWidgetUiDialogsProviderProxy::NewL(*(iWindowManager.DialogsProvider()), NULL, *this);
   123     iWidgetUiDialogsProviderProxy = CWidgetUiDialogsProviderProxy::NewL(*(iWindowManager.DialogsProvider()), NULL, *this);
   123 
   124     
       
   125 #ifdef BRDO_WRT_HS_FF
       
   126     iNetworkModeWait = new(ELeave) CActiveSchedulerWait();
       
   127 #endif
       
   128 
       
   129     unsigned int capabilities;
       
   130     if (iWindowManager.CursorShowMode() == TBrCtlDefs::ENoCursor)
       
   131         {
       
   132         //no cursor
       
   133         capabilities = TBrCtlDefs::ECapabilityLoadHttpFw |
       
   134                          TBrCtlDefs::ECapabilityWebKitLite |
       
   135                          TBrCtlDefs::ECapabilityClientResolveEmbeddedURL;
       
   136         }
       
   137     else
       
   138         {
       
   139         //cursor is setting
       
   140         capabilities = TBrCtlDefs::ECapabilityLoadHttpFw |
       
   141                         TBrCtlDefs::ECapabilityCursorNavigation|
       
   142                         TBrCtlDefs::ECapabilityWebKitLite |
       
   143                         TBrCtlDefs::ECapabilityClientResolveEmbeddedURL;
       
   144 
       
   145         }
   124     iEngine = CreateBrowserControlL(
   146     iEngine = CreateBrowserControlL(
   125         view->Container(),
   147         view->Container(),
   126         rect,
   148         rect,
   127         TBrCtlDefs::ECapabilityLoadHttpFw |
   149             capabilities,
   128         TBrCtlDefs::ECapabilityCursorNavigation|
       
   129         TBrCtlDefs::ECapabilityWebKitLite |
       
   130         TBrCtlDefs::ECapabilityClientResolveEmbeddedURL,
       
   131         TBrCtlDefs::ECommandIdBase,
   150         TBrCtlDefs::ECommandIdBase,
   132         iWidgetUiObserver, /* softkeys */
   151         iWidgetUiObserver, /* softkeys */
   133         iWidgetUiObserver, /* link resolver */
   152         iWidgetUiObserver, /* link resolver */
   134         this, /* special load observer */
   153         this, /* special load observer */
   135         iWidgetUiObserver, /* layout observer */
   154         iWidgetUiObserver, /* layout observer */
   136         iWidgetUiDialogsProviderProxy,
   155         iWidgetUiDialogsProviderProxy,
   137         iWidgetUiObserver, /* window observer */
   156         iWidgetUiObserver, /* window observer */
   138         iWidgetUiObserver /* download observer */);
   157         iWidgetUiObserver /* download observer */);
       
   158     //Set the cursor mode inside Widget
       
   159     iEngine->SetBrowserSettingL(TBrCtlDefs::ESettingsCursorShowMode, iWindowManager.CursorShowMode());
   139 
   160 
   140     iEngine->AddLoadEventObserverL( iWidgetUiObserver );
   161     iEngine->AddLoadEventObserverL( iWidgetUiObserver );
   141     iEngine->AddStateChangeObserverL( view );
   162     iEngine->AddStateChangeObserverL( view );
   142     iEngine->SetComponentsToInheritVisibility();
   163     iEngine->SetComponentsToInheritVisibility();
   143 
   164 
   197     delete iRightSoftKeyLabel;
   218     delete iRightSoftKeyLabel;
   198     delete iLeftSoftKeyLabel;
   219     delete iLeftSoftKeyLabel;
   199     delete iWidgetUiDialogsProviderProxy;
   220     delete iWidgetUiDialogsProviderProxy;
   200     delete iSchemeHandler;
   221     delete iSchemeHandler;
   201     delete iMiniviewBitmap;
   222     delete iMiniviewBitmap;
       
   223 #ifdef BRDO_WRT_HS_FF
       
   224     delete iNetworkModeWait;
       
   225 #endif
   202     }
   226     }
   203 
   227 
   204 // -----------------------------------------------------------------------------
   228 // -----------------------------------------------------------------------------
   205 // CWidgetUiWindow::CbaGroup()
   229 // CWidgetUiWindow::CbaGroup()
   206 // returns cba group
   230 // returns cba group
   317 //
   341 //
   318 void CWidgetUiWindow::SetSoftkeysVisible(TBool aVisible)
   342 void CWidgetUiWindow::SetSoftkeysVisible(TBool aVisible)
   319     {
   343     {
   320     iShowSoftkeys = (aVisible);
   344     iShowSoftkeys = (aVisible);
   321 
   345 
   322     if (CbaGroup())
   346     MakeSoftkeysVisible(aVisible, EFalse);
   323         {
   347 
   324         CbaGroup()->MakeVisible( iShowSoftkeys );
       
   325         iWindowManager.View()->UpdateStatusPane( aVisible );
       
   326         //in case CBA keys are disbaled by javascript ,SetToolbarVisibility EFalse,
       
   327         //Since it would take entire screen.Else SetToolbarVisibility to ETrue in Landscape mode
       
   328         iShowSoftkeys?iWindowManager.View()->UpdateToolbar(ETrue):iWindowManager.View()->UpdateToolbar(EFalse);
       
   329         CbaGroup()->DrawNow();
       
   330         TRect clientRect = iWindowManager.View()->ClientRect();
       
   331         // resize the container to take into account the size of the softkey labels
       
   332         // reduction is only needed for portrait mode (softkey on bottom) since landscape
       
   333         // mode softkeys don't take up screen real estate
       
   334         if (AknLayoutUtils::CbaLocation() == AknLayoutUtils::EAknCbaLocationBottom)
       
   335             {
       
   336             CbaGroup()->ReduceRect(clientRect);
       
   337             }
       
   338         //Check if the container rect needs change and then call setRect
       
   339         if(clientRect != iWindowManager.View()->Container()->Rect())
       
   340            iWindowManager.View()->Container()->SetRect(clientRect);
       
   341         }
       
   342     }
   348     }
   343 
   349 
   344 // -----------------------------------------------------------------------------
   350 // -----------------------------------------------------------------------------
   345 // CWidgetUiWindow::SetDisplayMode()
   351 // CWidgetUiWindow::SetDisplayMode()
   346 // switch the display orientation to landscape or portrait
   352 // switch the display orientation to landscape or portrait
   521             iWindowManager.View()->StopDisplayingMenuBar();
   527             iWindowManager.View()->StopDisplayingMenuBar();
   522             //deactivate optionsmenu flag
   528             //deactivate optionsmenu flag
   523             iWindowManager.View()->DeActivateOptionsMenu();
   529             iWindowManager.View()->DeActivateOptionsMenu();
   524             Engine()->MakeVisible(EFalse);// hide the active widget
   530             Engine()->MakeVisible(EFalse);// hide the active widget
   525             }
   531             }
   526         if ( !aCurrent &&  (EPublishStart != WidgetMiniViewState()))
   532         if ( !aCurrent &&  (EPublishStart != WidgetMiniViewState()) )
   527             {
   533             {			
   528             iWidgetExtension->HandleCommandL ( (TInt)TBrCtlDefs::ECommandAppBackground + (TInt)TBrCtlDefs::ECommandIdBase );
   534             iWidgetExtension->HandleCommandL ( (TInt)TBrCtlDefs::ECommandAppBackground + (TInt)TBrCtlDefs::ECommandIdBase );
   529             Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandAppBackground + (TInt)TBrCtlDefs::ECommandIdBase);
   535             if( iWindowManager.AnyWidgetOnHs() )
       
   536                 {
       
   537                 //If there is no widget on HS then we should not stop the JS timers
       
   538                 Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandAppBackground + (TInt)TBrCtlDefs::ECommandIdBase);
       
   539                 }
   530             }
   540             }
   531         if ( aCurrent )
   541         if ( aCurrent )
   532             {
   542             {
   533             Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandAppForeground + (TInt)TBrCtlDefs::ECommandIdBase);
   543             Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandAppForeground + (TInt)TBrCtlDefs::ECommandIdBase);
   534             iWidgetExtension->HandleCommandL( (TInt)TBrCtlDefs::ECommandAppForeground + (TInt)TBrCtlDefs::ECommandIdBase );
   544             iWidgetExtension->HandleCommandL( (TInt)TBrCtlDefs::ECommandAppForeground + (TInt)TBrCtlDefs::ECommandIdBase );
   664 #ifdef BRDO_WRT_HS_FF
   674 #ifdef BRDO_WRT_HS_FF
   665         if ( WidgetFullViewState() && WidgetMiniViewState() != EPublishStart )
   675         if ( WidgetFullViewState() && WidgetMiniViewState() != EPublishStart )
   666             {
   676             {
   667             iCpsPublisher->NetworkConnectionAllowedL();
   677             iCpsPublisher->NetworkConnectionAllowedL();
   668             }
   678             }
       
   679         iNetworkModeWait->Start();
   669 #endif
   680 #endif
   670         SetNetworkAccessGrant( EDeny );
   681         if (iWindowManager.GetNetworkMode() == EOfflineMode)
   671         User::Leave( KErrAccessDenied );
   682             {
       
   683             SetNetworkAccessGrant( EDeny );
       
   684             User::Leave( KErrAccessDenied );
       
   685             }
   672         }
   686         }
   673     
   687     
   674     // begin info.plist (declare EAllowNetworkAccess or EAllowFullAccess ?)
   688     // begin info.plist (declare EAllowNetworkAccess or EAllowFullAccess ?)
   675     RWidgetRegistryClientSession& widgetRegistry
   689     RWidgetRegistryClientSession& widgetRegistry
   676                 = iWindowManager.WidgetUIClientSession();
   690                 = iWindowManager.WidgetUIClientSession();
  1132         // send the new widget network state to widget engine
  1146         // send the new widget network state to widget engine
  1133         iWidgetExtension->SetParamL( TBrCtlDefs::EWidgetNetworkState, (TInt)iNetworkState );
  1147         iWidgetExtension->SetParamL( TBrCtlDefs::EWidgetNetworkState, (TInt)iNetworkState );
  1134         }
  1148         }
  1135     }
  1149     }
  1136 
  1150 
       
  1151 
       
  1152 // -----------------------------------------------------------------------------
       
  1153 // CWidgetUiWindow::MakeSoftkeysVisible()
       
  1154 // -----------------------------------------------------------------------------
       
  1155 //
       
  1156 void CWidgetUiWindow::MakeSoftkeysVisible(TBool aVisible, TBool aTextBoxUpdate)
       
  1157     {
       
  1158     if (CbaGroup() && !(aTextBoxUpdate && iShowSoftkeys))
       
  1159         {
       
  1160         CbaGroup()->MakeVisible( aVisible );
       
  1161         //in case CBA keys are disbaled by javascript ,SetToolbarVisibility EFalse,
       
  1162         //Since it would take entire screen.Else SetToolbarVisibility to ETrue in Landscape mode
       
  1163         aVisible?iWindowManager.View()->UpdateToolbar(ETrue):iWindowManager.View()->UpdateToolbar(EFalse);
       
  1164         CbaGroup()->DrawNow();
       
  1165         TRect clientRect = iWindowManager.View()->ClientRect();
       
  1166         // resize the container to take into account the size of the softkey labels
       
  1167         // reduction is only needed for portrait mode (softkey on bottom) since landscape
       
  1168         // mode softkeys don't take up screen real estate
       
  1169         if (AknLayoutUtils::CbaLocation() == AknLayoutUtils::EAknCbaLocationBottom)
       
  1170             {
       
  1171             CbaGroup()->ReduceRect(clientRect);
       
  1172             }
       
  1173         //Check if the container rect needs change and then call setRect
       
  1174         if(clientRect != iWindowManager.View()->Container()->Rect())
       
  1175            iWindowManager.View()->Container()->SetRect(clientRect);
       
  1176         
       
  1177         if (!aTextBoxUpdate)
       
  1178             {
       
  1179             // status pane always off unless in text box
       
  1180             iWindowManager.View()->UpdateStatusPane(EFalse);
       
  1181             }
       
  1182         }
       
  1183     }
  1137 // End of file
  1184 // End of file