widgets/widgetapp/src/WidgetUiWindow.cpp
branchRCL_3
changeset 48 79859ed3eea9
parent 47 e1bea15f9a39
child 49 919f36ff910f
equal deleted inserted replaced
47:e1bea15f9a39 48:79859ed3eea9
    19 #include "WidgetUiWindow.h"
    19 #include "WidgetUiWindow.h"
    20 #include "WidgetUiWindowView.h"
    20 #include "WidgetUiWindowView.h"
    21 #include "WidgetUiWindowContainer.h"
    21 #include "WidgetUiWindowContainer.h"
    22 #include "WidgetUiWindowManager.h"
    22 #include "WidgetUiWindowManager.h"
    23 #include "WidgetUiDialogsProviderProxy.h"
    23 #include "WidgetUiDialogsProviderProxy.h"
    24 #include <widgetregistryconstants.h>
    24 #include "WidgetRegistryConstants.h"
    25 #include "browser_platform_variant.hrh"
    25 #include "Browser_platform_variant.hrh"
    26 #ifdef BRDO_WRT_HS_FF
    26 #ifdef BRDO_WRT_HS_FF
    27 #include "cpspublisher.h"
    27 #include "cpspublisher.h"
    28 #endif
    28 #endif
    29 #include <AknUtils.h>
    29 #include <AknUtils.h>
    30 #include <ImageConversion.h>
    30 #include <imageconversion.h>
    31 #include <WidgetUi.rsg>
    31 #include <WidgetUi.rsg>
    32 #include <browserdialogsprovider.h>
    32 
    33 #include <schemehandler.h>
    33 #include <SchemeHandler.h>
    34 #include <internetconnectionmanager.h>
    34 #include <InternetConnectionManager.h>
    35 #include "WidgetInstallerInternalCRKeys.h"
    35 #include "WidgetInstallerInternalCRKeys.h"
    36 #include <browseruisdkcrkeys.h>
    36 #include <BrowserUiSDKCRKeys.h>
    37 #include <StringLoader.h>
    37 #include <StringLoader.h>
    38 #include <centralrepository.h>
    38 #include <centralrepository.h>
    39 #include <ApUtils.h>
    39 #include <ApUtils.h>
    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 #ifdef RD_SCALABLE_UI_V2
       
    46 #include <centralrepository.h>
       
    47 #include <SensorPluginDomainCrKeys.h>
       
    48 #endif //RD_SCALABLE_UI_V2
       
    49 
    45 
    50 // EXTERNAL DATA STRUCTURES
    46 // EXTERNAL DATA STRUCTURES
    51 
    47 
    52 // EXTERNAL FUNCTION PROTOTYPES
    48 // EXTERNAL FUNCTION PROTOTYPES
    53 
    49 
    54 // CONSTANTS
    50 // CONSTANTS
    55 static const TUint32 KDummyCommand = 0;
    51 static const TUint32 KDummyCommand = 0;
    56 
    52 
    57 const TUint KWmlNoDefaultAccessPoint = KMaxTUint; // see cenrep setting default -1 as int, here as uint
    53 const TUint KWmlNoDefaultAccessPoint = KMaxTUint; // see cenrep setting default -1 as int, here as uint
    58 const TUint KWmlNoDefaultSnapId = KMaxTUint; // see cenrep setting default -1 as int, here as uint
    54 const TUint KWmlNoDefaultSnapId = KMaxTUint; // see cenrep setting default -1 as int, here as uint
    59 
       
    60 
    55 
    61 // MACROS
    56 // MACROS
    62 
    57 
    63 // LOCAL CONSTANTS AND MACROS
    58 // LOCAL CONSTANTS AND MACROS
    64 
    59 
    96 //
    91 //
    97 CWidgetUiWindow::CWidgetUiWindow( CWidgetUiWindowManager& aWindowManager, CCpsPublisher* aCpsPublisher )
    92 CWidgetUiWindow::CWidgetUiWindow( CWidgetUiWindowManager& aWindowManager, CCpsPublisher* aCpsPublisher )
    98     : iWindowManager( aWindowManager ), iCpsPublisher( aCpsPublisher ), iNetworkAccessGrant(EInvalid),
    93     : iWindowManager( aWindowManager ), iCpsPublisher( aCpsPublisher ), iNetworkAccessGrant(EInvalid),
    99       iPreferredOrientation(TBrCtlDefs::EOrientationUndefined),
    94       iPreferredOrientation(TBrCtlDefs::EOrientationUndefined),
   100       iIsCurrent(EFalse), iShowSoftkeys(EFalse), iWidgetLoaded(EFalse),
    95       iIsCurrent(EFalse), iShowSoftkeys(EFalse), iWidgetLoaded(EFalse),
   101       iSchemeProcessing (EFalse), iNetworkState(ENetworkNotAllowed), iUserPermission(ETrue), 
    96       iSchemeProcessing (EFalse),iClickCount(0), iWidgetLoadStarted(EFalse),
   102       iClickCount(0), iWidgetLoadStarted(EFalse), iSapiPromptCleared(ETrue),iNeedToIgnoreSapiNtfn(0),
    97       iNetworkState(ENetworkNotAllowed), iUserPermission(ETrue)
   103       iNeedToIgnoreSapiClearNtfn(0)
       
   104     {
    98     {
   105     }
    99     }
   106 
   100 
   107 // -----------------------------------------------------------------------------
   101 // -----------------------------------------------------------------------------
   108 // CWidgetUiWindow::ConstructL()
   102 // CWidgetUiWindow::ConstructL()
   111 // -----------------------------------------------------------------------------
   105 // -----------------------------------------------------------------------------
   112 //
   106 //
   113 void CWidgetUiWindow::ConstructL( const TUid& aUid )
   107 void CWidgetUiWindow::ConstructL( const TUid& aUid )
   114     {
   108     {
   115     iUid = aUid;
   109     iUid = aUid;
   116     iDialogsProvider = CBrowserDialogsProvider::NewL( NULL );
   110 
   117     
       
   118     iPenEnabled = AknLayoutUtils::PenEnabled();
   111     iPenEnabled = AknLayoutUtils::PenEnabled();
   119     iShowSoftkeys = iPenEnabled;
   112     iShowSoftkeys = iPenEnabled;
   120 
   113 
   121     CWidgetUiWindowView* view = iWindowManager.View();
   114     CWidgetUiWindowView* view = iWindowManager.View();
   122     // view->ShowActivatedObject(EFalse);
   115     // view->ShowActivatedObject(EFalse);
   125     TRect rect;
   118     TRect rect;
   126     RWidgetRegistryClientSession clientSession = iWindowManager.WidgetUIClientSession();
   119     RWidgetRegistryClientSession clientSession = iWindowManager.WidgetUIClientSession();
   127     iUrl = GetUlrL( clientSession, aUid );
   120     iUrl = GetUlrL( clientSession, aUid );
   128     iWidgetUiObserver = CWidgetUiObserver::NewL( *this );
   121     iWidgetUiObserver = CWidgetUiObserver::NewL( *this );
   129 
   122 
   130     iWidgetUiDialogsProviderProxy = CWidgetUiDialogsProviderProxy::NewL(*iDialogsProvider, NULL, *this);
   123     iWidgetUiDialogsProviderProxy = CWidgetUiDialogsProviderProxy::NewL(*(iWindowManager.DialogsProvider()), NULL, *this);
   131 
   124 
   132 #ifdef BRDO_WRT_HS_FF
   125 #ifdef BRDO_WRT_HS_FF
   133     iNetworkModeWait = new(ELeave) CActiveSchedulerWait();
   126     iNetworkModeWait = new(ELeave) CActiveSchedulerWait();
   134 #endif
   127 #endif
   135 
   128 
   199         SetWindowStateMiniViewL( EMiniViewNotEnabled );
   192         SetWindowStateMiniViewL( EMiniViewNotEnabled );
   200         }
   193         }
   201 
   194 
   202     iDlId = 0;
   195     iDlId = 0;
   203 
   196 
   204     iNeedToNotifyNetworkState = EFalse;
       
   205     // determine initial widget online/offline network state
   197     // determine initial widget online/offline network state
   206     DetermineNetworkState();
   198     DetermineNetworkState();
   207     iAsyncCallBack = new (ELeave) CAsyncCallBack(TCallBack(DeleteItself,this),CActive::EPriorityLow);
       
   208     }
   199     }
   209 
   200 
   210 // -----------------------------------------------------------------------------
   201 // -----------------------------------------------------------------------------
   211 // CWidgetUiWindow::~CWidgetUiWindow()
   202 // CWidgetUiWindow::~CWidgetUiWindow()
   212 // Destructor
   203 // Destructor
   213 //
   204 //
   214 // -----------------------------------------------------------------------------
   205 // -----------------------------------------------------------------------------
   215 //
   206 //
   216 CWidgetUiWindow::~CWidgetUiWindow()
   207 CWidgetUiWindow::~CWidgetUiWindow()
   217     {
   208     {
   218     if( iDialogsProvider)
       
   219         {
       
   220          iDialogsProvider->CancelAll();
       
   221         }
       
   222     if (iEngine && iWidgetUiObserver)
   209     if (iEngine && iWidgetUiObserver)
   223         {
   210         {
   224         iEngine->RemoveLoadEventObserver( iWidgetUiObserver );
   211         iEngine->RemoveLoadEventObserver( iWidgetUiObserver );
   225         iEngine->RemoveStateChangeObserver( iWindowManager.View() );
   212         iEngine->RemoveStateChangeObserver( iWindowManager.View() );
   226         }
   213         }
   231     delete iWidgetBundleId;
   218     delete iWidgetBundleId;
   232     delete iRightSoftKeyLabel;
   219     delete iRightSoftKeyLabel;
   233     delete iLeftSoftKeyLabel;
   220     delete iLeftSoftKeyLabel;
   234     delete iWidgetUiDialogsProviderProxy;
   221     delete iWidgetUiDialogsProviderProxy;
   235     delete iSchemeHandler;
   222     delete iSchemeHandler;
   236     
   223     delete iMiniviewBitmap;
   237     iActiveMiniviewBitmap = 0;
       
   238     iMiniviewBitmap1.Reset();
       
   239     iMiniviewBitmap2.Reset();
       
   240     
       
   241 #ifdef BRDO_WRT_HS_FF
   224 #ifdef BRDO_WRT_HS_FF
   242     delete iNetworkModeWait;
   225     delete iNetworkModeWait;
   243 #endif
   226 #endif
   244     if(iAsyncCallBack)
       
   245         {
       
   246         iAsyncCallBack->Cancel();
       
   247         }
       
   248     delete iAsyncCallBack;
       
   249     iAsyncCallBack=NULL;  
       
   250     delete iDialogsProvider;
       
   251     }
   227     }
   252 
   228 
   253 // -----------------------------------------------------------------------------
   229 // -----------------------------------------------------------------------------
   254 // CWidgetUiWindow::CbaGroup()
   230 // CWidgetUiWindow::CbaGroup()
   255 // returns cba group
   231 // returns cba group
   355 // -----------------------------------------------------------------------------
   331 // -----------------------------------------------------------------------------
   356 //
   332 //
   357 TBool CWidgetUiWindow::DialogMimeFileSelectLC(HBufC*& aSelectedFileName,
   333 TBool CWidgetUiWindow::DialogMimeFileSelectLC(HBufC*& aSelectedFileName,
   358                                  const TDesC& aMimeType)
   334                                  const TDesC& aMimeType)
   359     {
   335     {
   360     return iDialogsProvider->DialogMimeFileSelectLC(aSelectedFileName, aMimeType);
   336     return iWindowManager.DialogsProvider()->DialogMimeFileSelectLC(aSelectedFileName, aMimeType);
   361     }
   337     }
   362 
   338 
   363 // -----------------------------------------------------------------------------
   339 // -----------------------------------------------------------------------------
   364 // CWidgetUiWindow::SetSoftkeysVisible()
   340 // CWidgetUiWindow::SetSoftkeysVisible()
   365 // -----------------------------------------------------------------------------
   341 // -----------------------------------------------------------------------------
   508 
   484 
   509     CleanupStack::PopAndDestroy(3);// filename,bitmap,mask
   485     CleanupStack::PopAndDestroy(3);// filename,bitmap,mask
   510     }
   486     }
   511 
   487 
   512 // -----------------------------------------------------------------------------
   488 // -----------------------------------------------------------------------------
   513 // CWidgetUiWindow::RelayoutL( TInt aType )
   489 // CWidgetUiWindow::Relayout()
   514 // switch the display orientation based on preferred setting
   490 // switch the display orientation based on preferred setting
   515 //
   491 //
   516 // -----------------------------------------------------------------------------
   492 // -----------------------------------------------------------------------------
   517 //
   493 //
   518 void CWidgetUiWindow::RelayoutL( TInt aType )
   494 void CWidgetUiWindow::Relayout( )
   519     {
   495     {
   520     if (iIsCurrent)
   496     if (iIsCurrent)
   521         {
   497         {
   522 #ifdef RD_SCALABLE_UI_V2
       
   523         if(aType == KEikDynamicLayoutVariantSwitch)
       
   524             {
       
   525             CRepository* iSensor = CRepository::NewLC(KCRUidSensorSettings);
       
   526             TInt sensorOn = 0;
       
   527             //get sensor is on/off from general settings
       
   528             iSensor->Get(KSenSettingsSensorsOn, sensorOn);
       
   529             if(sensorOn == 0)
       
   530                 {    
       
   531                 TRect rec = iWindowManager.View()->Container()->Rect();
       
   532                 if( rec.Height() < rec.Width())
       
   533                     iPreferredOrientation = TBrCtlDefs::EOrientationLandscape;
       
   534                 else
       
   535                     iPreferredOrientation = TBrCtlDefs::EOrientationPortrait;
       
   536                 }
       
   537             CleanupStack::PopAndDestroy();
       
   538             }
       
   539 #endif // RD_SCALABLE_UI_V2
       
   540         SetDisplayMode(iPreferredOrientation);
   498         SetDisplayMode(iPreferredOrientation);
   541         SetSoftkeysVisible(iShowSoftkeys);
   499         SetSoftkeysVisible(iShowSoftkeys);
   542         //iWindowManager.View()->Container()->SizeChanged();
   500         //iWindowManager.View()->Container()->SizeChanged();
   543         }
   501         }
   544     }
   502     }
   560         if (aCurrent)
   518         if (aCurrent)
   561             {
   519             {
   562             UpdateCba();
   520             UpdateCba();
   563             Engine()->MakeVisible( iWidgetLoaded );
   521             Engine()->MakeVisible( iWidgetLoaded );
   564             // redraw incase the orientation changed while in the background
   522             // redraw incase the orientation changed while in the background
   565             RelayoutL(KEikDynamicLayoutVariantSwitch);
   523             Relayout();
   566             }
   524             }
   567         else
   525         else
   568             {
   526             {
   569             // close the menu
   527             // close the menu
   570             iWindowManager.View()->StopDisplayingMenuBar();
   528             iWindowManager.View()->StopDisplayingMenuBar();
   610         else
   568         else
   611             {
   569             {
   612             // reset the Right Softkey
   570             // reset the Right Softkey
   613             TRAP_IGNORE(iWidgetUiObserver->UpdateSoftkeyL(EKeyRight,KNullDesC,KDummyCommand,EChangeReasonLoad));
   571             TRAP_IGNORE(iWidgetUiObserver->UpdateSoftkeyL(EKeyRight,KNullDesC,KDummyCommand,EChangeReasonLoad));
   614             }
   572             }
   615         if (iLeftSoftKeyLabel)
   573 
   616             {
       
   617             // restore the Left Softkey
       
   618             TRAP_IGNORE(iWidgetUiObserver->UpdateSoftkeyL(EKeyLeft,*iLeftSoftKeyLabel,KDummyCommand,EChangeReasonLoad));
       
   619             }
       
   620         else
       
   621             {
       
   622             // reset the Left Softkey
       
   623             TRAP_IGNORE(iWidgetUiObserver->UpdateSoftkeyL(EKeyLeft,KNullDesC,KDummyCommand,EChangeReasonLoad));
       
   624             }
       
   625         
       
   626         // restore state
   574         // restore state
   627         if ( !showSoftkeys )
   575         if ( !showSoftkeys )
   628             {
   576             {
   629             CbaGroup()->MakeVisible( EFalse );
   577             CbaGroup()->MakeVisible( EFalse );
   630             }
   578             }
   663 
   611 
   664     if (iWidgetLoaded && iIsCurrent && fullView )
   612     if (iWidgetLoaded && iIsCurrent && fullView )
   665         {
   613         {
   666         Engine()->MakeVisible( ETrue );
   614         Engine()->MakeVisible( ETrue );
   667         }
   615         }
   668     PublishSnapShot();
       
   669     if(iWidgetLoaded && iNeedToNotifyNetworkState)
       
   670         DetermineNetworkState();
       
   671     }
   616     }
   672 
   617 
   673 // -----------------------------------------------------------------------------
   618 // -----------------------------------------------------------------------------
   674 // CWidgetUiWindow::PublishSnapShot()
   619 // CWidgetUiWindow::PublishSnapShot()
   675 // pubish offscreen bitmap to CPSpublisger
   620 // pubish offscreen bitmap to CPSpublisger
   680     {
   625     {
   681     if( iWidgetLoaded && (WidgetMiniViewState() == EPublishStart ) )
   626     if( iWidgetLoaded && (WidgetMiniViewState() == EPublishStart ) )
   682         {
   627         {
   683 #ifdef BRDO_WRT_HS_FF
   628 #ifdef BRDO_WRT_HS_FF
   684 
   629 
   685         if ( iCpsPublisher)
   630         if ( !iMiniviewBitmap )
   686             {
   631             {
   687             // Swap bitmaps
   632             iMiniviewBitmap = new CFbsBitmap();
   688             if(iActiveMiniviewBitmap == &iMiniviewBitmap1)
   633             }
   689             	iActiveMiniviewBitmap = &iMiniviewBitmap2;
   634 
   690             else
   635         if ( iMiniviewBitmap && iCpsPublisher)
   691             	iActiveMiniviewBitmap = &iMiniviewBitmap1;
   636             {
   692             
       
   693             // Take snapshot and publish	
       
   694             TRAP_IGNORE(
   637             TRAP_IGNORE(
   695                (iEngine->TakeSnapshotL( *iActiveMiniviewBitmap ));
   638                (iEngine->TakeSnapshotL( *iMiniviewBitmap ));
   696                 iCpsPublisher->PublishBitmapL( *iActiveMiniviewBitmap, *iWidgetBundleId );
   639                 iCpsPublisher->PublishBitmapL( *iMiniviewBitmap, *iWidgetBundleId );
   697                 );
   640                 );
   698             }
   641             }
   699 #endif
   642 #endif
   700         }
   643         }
   701     }
   644     }
   749                 = iWindowManager.WidgetUIClientSession();
   692                 = iWindowManager.WidgetUIClientSession();
   750 
   693 
   751     CWidgetPropertyValue* propValue = widgetRegistry.GetWidgetPropertyValueL(iUid, EAllowNetworkAccess );
   694     CWidgetPropertyValue* propValue = widgetRegistry.GetWidgetPropertyValueL(iUid, EAllowNetworkAccess );
   752     TInt networkAccess = *propValue;
   695     TInt networkAccess = *propValue;
   753     delete propValue;
   696     delete propValue;
   754 
       
   755     propValue = widgetRegistry.GetWidgetPropertyValueL(iUid, EAllowFullAccess );
   697     propValue = widgetRegistry.GetWidgetPropertyValueL(iUid, EAllowFullAccess );
   756     TInt fullAccess = *propValue;
   698     TInt fullAccess = *propValue;
   757     delete propValue;
   699     delete propValue;
   758 
   700 
   759     if ( !( networkAccess || fullAccess ) )
   701     if ( !( networkAccess || fullAccess ) )
   794                 delete rep;
   736                 delete rep;
   795             }
   737             }
   796 
   738 
   797             if ( prompt )
   739             if ( prompt )
   798                 {
   740                 {
       
   741                 CBrowserDialogsProvider* dialogProvider
       
   742                             = iWindowManager.DialogsProvider();
   799                 TBool grant = EFalse;
   743                 TBool grant = EFalse;
   800                 HBufC* message = StringLoader::LoadLC( R_WIDGETUI_NETWORK_ACCESS );
   744                 HBufC* message = StringLoader::LoadLC( R_WIDGETUI_NETWORK_ACCESS );
   801                 HBufC* yes = StringLoader::LoadLC( R_WIDGETUI_SOFTKEY_YES );
   745                 HBufC* yes = StringLoader::LoadLC( R_WIDGETUI_SOFTKEY_YES );
   802                 HBufC* no = StringLoader::LoadLC( R_WIDGETUI_SOFTKEY_NO );
   746                 HBufC* no = StringLoader::LoadLC( R_WIDGETUI_SOFTKEY_NO );
   803                 grant = iDialogsProvider->DialogConfirmL( _L(""), *message, *yes, *no );
   747                 grant = dialogProvider->DialogConfirmL( _L(""), *message, *yes, *no );
   804                 CleanupStack::PopAndDestroy( 3 );
   748                 CleanupStack::PopAndDestroy( 3 );
   805                 // save prompt result for session
   749                 // save prompt result for session
   806                 SetNetworkAccessGrant( grant? EAllow : EDeny );
   750                 SetNetworkAccessGrant( grant? EAllow : EDeny );
   807 
   751 
   808                 CheckUserPermissionChanged( grant );
   752                 CheckUserPermissionChanged( grant );
   836 
   780 
   837         // 2.1. deal with access point settings
   781         // 2.1. deal with access point settings
   838         TInt ask( 1 );
   782         TInt ask( 1 );
   839         TInt wmlId( KWmlNoDefaultAccessPoint );
   783         TInt wmlId( KWmlNoDefaultAccessPoint );
   840         TInt snapId( KWmlNoDefaultSnapId );
   784         TInt snapId( KWmlNoDefaultSnapId );
   841 #ifndef BRDO_OCC_ENABLED_FF
       
   842         CRepository* rep( NULL );
   785         CRepository* rep( NULL );
   843         TRAPD( cenrepError, rep = CRepository::NewL( KCRUidBrowser ) );
   786         TRAPD( cenrepError, rep = CRepository::NewL( KCRUidBrowser ) );
   844         if ( KErrNone == cenrepError )
   787         if ( KErrNone == cenrepError )
   845             {
   788             {
   846             (void)rep->Get( KBrowserAccessPointSelectionMode, ask );
   789             (void)rep->Get( KBrowserAccessPointSelectionMode, ask );
   847             (void)rep->Get( KBrowserDefaultAccessPoint, wmlId );
   790             (void)rep->Get( KBrowserDefaultAccessPoint, wmlId );
   848             (void)rep->Get( KBrowserNGDefaultSnapId, snapId );
   791             (void)rep->Get( KBrowserNGDefaultSnapId, snapId );
   849             }
   792             }
   850         delete rep;
   793         delete rep;
   851 #endif
       
   852         if ( ask == EBrowserCenRepApSelModeDestination &&
   794         if ( ask == EBrowserCenRepApSelModeDestination &&
   853            ( snapId != KWmlNoDefaultSnapId) )
   795            ( snapId != KWmlNoDefaultSnapId) )
   854             {
   796             {
   855             iWindowManager.GetConnection()->SetRequestedSnap( snapId );
   797             iWindowManager.GetConnection()->SetRequestedSnap( snapId );
   856             iWindowManager.GetConnection()->SetConnectionType( CMManager::EDestination );
   798             iWindowManager.GetConnection()->SetConnectionType( CMManager::EDestination );
   866                     TUint32 iap = apUtils->IapIdFromWapIdL( wmlId );
   808                     TUint32 iap = apUtils->IapIdFromWapIdL( wmlId );
   867                     CleanupStack::PopAndDestroy();
   809                     CleanupStack::PopAndDestroy();
   868                     iWindowManager.GetConnection()->SetRequestedAP( iap );
   810                     iWindowManager.GetConnection()->SetRequestedAP( iap );
   869                 );
   811                 );
   870             }
   812             }
   871 
       
   872         if ( EBrowserCenRepApSelModeAlwaysAsk == ask )
       
   873             {
       
   874               //Always ask case
       
   875               TUint32 ap( 0 );
       
   876               iWindowManager.GetConnection()->SetRequestedAP( ap );
       
   877 #ifdef BRDO_OCC_ENABLED_FF
       
   878               TUint32 snapId = 0; //Defaults connects to Internet snap
       
   879               iWindowManager.GetConnection()->SetConnectionType(CMManager::EDestination);
       
   880               iWindowManager.GetConnection()->SetRequestedSnap(snapId);
       
   881 #endif
       
   882             }
       
   883         }
   813         }
   884     }
   814     }
   885 
   815 
   886 // -----------------------------------------------------------------------------
   816 // -----------------------------------------------------------------------------
   887 // CWidgetUiWindow::StartNetworkConnection()
   817 // CWidgetUiWindow::StartNetworkConnection()
   893     {
   823     {
   894     *aNewConn = EFalse;
   824     *aNewConn = EFalse;
   895     if ( !iWindowManager.GetConnection()->Connected() )
   825     if ( !iWindowManager.GetConnection()->Connected() )
   896         {
   826         {
   897         // 2.2. make a connection
   827         // 2.2. make a connection
   898         iConnecting=ETrue;
   828         TInt connFailure = iWindowManager.GetConnection()->StartConnectionL( ETrue );
   899         TInt connFailure = 0;
       
   900         TRAPD(err, connFailure=iWindowManager.GetConnection()->StartConnectionL( ETrue ));
       
   901         iConnecting=EFalse;
       
   902         User::LeaveIfError(err);
       
   903         if(iDeleteItself)
       
   904             iAsyncCallBack->CallBack();
       
   905         if (KErrCancel == connFailure)
   829         if (KErrCancel == connFailure)
   906             {
   830             {
   907 #ifdef BRDO_WRT_HS_FF
   831 #ifdef BRDO_WRT_HS_FF
   908             if(! (EMiniViewEnabled == WidgetMiniViewState() || 
   832             iCpsPublisher->NetworkConnectionCancelledL();
   909                   EMiniViewNotEnabled == WidgetMiniViewState()) )
       
   910                 {        
       
   911                 iCpsPublisher->NetworkConnectionCancelledL();
       
   912                 iNetworkModeWait->Start();
       
   913                 }
       
   914 #endif
   833 #endif
   915             User::Leave( connFailure );
   834             User::Leave( connFailure );
   916             }
   835             }
   917         else if ( KErrNone != connFailure )
   836         else if ( KErrNone != connFailure )
   918             {
   837             {
   922             // or hit cancel altogether in which case the KErrCancel block above
   841             // or hit cancel altogether in which case the KErrCancel block above
   923             // kicks in and sets a EDeny.
   842             // kicks in and sets a EDeny.
   924             User::Leave( connFailure );
   843             User::Leave( connFailure );
   925             }
   844             }
   926         *aNewConn = ETrue;
   845         *aNewConn = ETrue;
   927         if(iWindowManager.GetNetworkMode() == EOfflineMode)
   846 
   928         	{
       
   929             iWindowManager.GetConnection()->CancelConnection();
       
   930             iWindowManager.GetConnection()->StopConnectionL();
       
   931             User::Leave( KErrAccessDenied );
       
   932         	}      
       
   933 #ifdef BRDO_OCC_ENABLED_FF        
       
   934 		else
       
   935         	TRAP_IGNORE(iWindowManager.ConnNeededStatusL(KErrNone)); 
       
   936 #endif        
       
   937         }
   847         }
   938     }
   848     }
   939 
   849 
   940 // -----------------------------------------------------------------------------
   850 // -----------------------------------------------------------------------------
   941 // CWidgetUiWindow::NetworkConnectionNeededL()
   851 // CWidgetUiWindow::NetworkConnectionNeededL()
   946                                       TInt* aSockSvrHandle,
   856                                       TInt* aSockSvrHandle,
   947                                       TBool* aNewConn,
   857                                       TBool* aNewConn,
   948                                       TApBearerType* aBearerType )
   858                                       TApBearerType* aBearerType )
   949 
   859 
   950     {
   860     {
   951 #ifdef BRDO_OCC_ENABLED_FF
       
   952     TBool retryFlag = iWindowManager.GetRetryFlag();
       
   953     if( retryFlag )
       
   954         {
       
   955         return;
       
   956         }
       
   957 #endif
       
   958     // default in case connection setup fails
   861     // default in case connection setup fails
   959     *aConnectionPtr = 0;
   862     *aConnectionPtr = 0;
   960 
   863 
   961     if( EMiniViewEnabled == WidgetMiniViewState() ||
   864     if( EMiniViewEnabled == WidgetMiniViewState() ||
   962         EMiniViewNotEnabled == WidgetMiniViewState())
   865         EMiniViewNotEnabled == WidgetMiniViewState())
  1052                             EParamTransactionId,
   955                             EParamTransactionId,
  1053                             aTypeArray,
   956                             aTypeArray,
  1054                             aDesArray,
   957                             aDesArray,
  1055                             paramFound );
   958                             paramFound );
  1056 
   959 
  1057     if ( paramFound )
   960     TLex lex(dlId);
  1058         {
   961     User::LeaveIfError(lex.Val(iDlId));
  1059         TLex lex(dlId);
       
  1060         User::LeaveIfError(lex.Val(iDlId));
       
  1061         }
       
  1062 
   962 
  1063     TDataType dataType( *contentType8 );
   963     TDataType dataType( *contentType8 );
  1064     CAiwGenericParamList* genericParamList =
   964     CAiwGenericParamList* genericParamList =
  1065         BrCtlParamList2GenericParamListL( aTypeArray, aDesArray );
   965         BrCtlParamList2GenericParamListL( aTypeArray, aDesArray );
  1066     CleanupStack::PushL( genericParamList );
   966     CleanupStack::PushL( genericParamList );
  1219 //
  1119 //
  1220 void CWidgetUiWindow::DetermineNetworkState()
  1120 void CWidgetUiWindow::DetermineNetworkState()
  1221     {
  1121     {
  1222     TNetworkState currNetState;
  1122     TNetworkState currNetState;
  1223     RWidgetRegistryClientSession& widgetRegistry = iWindowManager.WidgetUIClientSession();
  1123     RWidgetRegistryClientSession& widgetRegistry = iWindowManager.WidgetUIClientSession();
  1224     TInt inMiniView = !(WidgetMiniViewState()==EMiniViewEnabled || WidgetMiniViewState()==EMiniViewNotEnabled);//widgetRegistry.IsWidgetInMiniView( iUid);
  1124     TInt inMiniView = widgetRegistry.IsWidgetInMiniView( iUid);
  1225     CWidgetPropertyValue* propValue = widgetRegistry.GetWidgetPropertyValueL( iUid, EAllowNetworkAccess );
  1125     CWidgetPropertyValue* propValue = widgetRegistry.GetWidgetPropertyValueL( iUid, EAllowNetworkAccess );
  1226     TInt netAccessWdgtProp = propValue && *propValue;    // AllowNetworkAccess in the info.plist file
  1126     TInt netAccessWdgtProp = *propValue;    // AllowNetworkAccess in the info.plist file
  1227     delete propValue;
       
  1228 
  1127 
  1229     if ( netAccessWdgtProp && ((inMiniView && (iWindowManager.GetNetworkMode() == (TInt)EOnlineMode))
  1128     if ( netAccessWdgtProp && ((inMiniView && (iWindowManager.GetNetworkMode() == (TInt)EOnlineMode))
  1230                                     || (!inMiniView && iUserPermission)) )
  1129                                     || (!inMiniView && iUserPermission)) )
  1231         {
  1130         {
  1232         if ( iWindowManager.GetNetworkConn() )
  1131         if ( iWindowManager.GetNetworkConn() )
  1282             // status pane always off unless in text box
  1181             // status pane always off unless in text box
  1283             iWindowManager.View()->UpdateStatusPane(EFalse);
  1182             iWindowManager.View()->UpdateStatusPane(EFalse);
  1284             }
  1183             }
  1285         }
  1184         }
  1286     }
  1185     }
  1287 
       
  1288 // -----------------------------------------------------------------------------
       
  1289 // CWidgetUiWindow::NeedToNotifyNetworkState()
       
  1290 // -----------------------------------------------------------------------------
       
  1291 //
       
  1292 void CWidgetUiWindow::NeedToNotifyNetworkState(TBool aNetworkState)
       
  1293     {
       
  1294     iNeedToNotifyNetworkState = aNetworkState;
       
  1295     }
       
  1296 
       
  1297 // -----------------------------------------------------------------------------
       
  1298 // CWidgetUiWindow::CanBeDeleted()
       
  1299 // -----------------------------------------------------------------------------
       
  1300 //
       
  1301 TBool CWidgetUiWindow::CanBeDeleted()
       
  1302     {
       
  1303     iDeleteItself = iConnecting;
       
  1304     return !iConnecting;
       
  1305     }
       
  1306     
       
  1307 
       
  1308 void CWidgetUiWindow::DeleteItself()    
       
  1309 	{	
       
  1310 	iAsyncCallBack->CallBack();    
       
  1311 	}
       
  1312 
       
  1313 // -----------------------------------------------------------------------------
       
  1314 // CWidgetUiWindow::DeleteItself()
       
  1315 // -----------------------------------------------------------------------------
       
  1316 //
       
  1317 TInt CWidgetUiWindow::DeleteItself(TAny* aPtr)
       
  1318     {
       
  1319     CWidgetUiWindow* self = (CWidgetUiWindow*)aPtr;
       
  1320     CWidgetUiWindowManager* p = &self->iWindowManager;
       
  1321     //if sync request start another event loop
       
  1322     if(self->Engine()->IsSynchRequestPending())
       
  1323     	{
       
  1324     	self->DeleteItself();
       
  1325     	return KErrNone;
       
  1326     	}
       
  1327     delete self;
       
  1328     //The Correct fix is to call AppUI::Exit()
       
  1329     //But that is leaving
       
  1330     if(p->WindowListCount() == 0)
       
  1331         User::Exit(KErrNone);
       
  1332     return 0;
       
  1333     }
       
  1334     
       
  1335 #ifdef BRDO_OCC_ENABLED_FF
       
  1336  void CWidgetUiWindow::CancelAllDialogs()
       
  1337      {
       
  1338      if( iDialogsProvider)
       
  1339          {
       
  1340           iDialogsProvider->CancelAll();
       
  1341          }
       
  1342      }
       
  1343  
       
  1344  TBool CWidgetUiWindow::IsDialogsLaunched()
       
  1345      {
       
  1346      return (iDialogsProvider && iDialogsProvider->IsDialogLaunched() );
       
  1347      }
       
  1348 #endif 
       
  1349 // End of file
  1186 // End of file