widgets/widgetapp/src/WidgetUiWindow.cpp
branchRCL_3
changeset 41 4bd5176e1bc8
parent 40 8bfb9186a8b8
child 42 a1a5d4e727e8
equal deleted inserted replaced
40:8bfb9186a8b8 41:4bd5176e1bc8
    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 
    32 #include <browserdialogsprovider.h>
    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>
    54 // CONSTANTS
    54 // CONSTANTS
    55 static const TUint32 KDummyCommand = 0;
    55 static const TUint32 KDummyCommand = 0;
    56 
    56 
    57 const TUint KWmlNoDefaultAccessPoint = KMaxTUint; // see cenrep setting default -1 as int, here as uint
    57 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
    58 const TUint KWmlNoDefaultSnapId = KMaxTUint; // see cenrep setting default -1 as int, here as uint
       
    59 #ifdef BRDO_OCC_ENABLED_FF
    59 const TInt KRetryConnectivityTimeout( 2*1000*1000 ); // 2 seconds
    60 const TInt KRetryConnectivityTimeout( 2*1000*1000 ); // 2 seconds
       
    61 #endif
    60 
    62 
    61 // MACROS
    63 // MACROS
    62 
    64 
    63 // LOCAL CONSTANTS AND MACROS
    65 // LOCAL CONSTANTS AND MACROS
    64 
    66 
   110 // -----------------------------------------------------------------------------
   112 // -----------------------------------------------------------------------------
   111 //
   113 //
   112 void CWidgetUiWindow::ConstructL( const TUid& aUid )
   114 void CWidgetUiWindow::ConstructL( const TUid& aUid )
   113     {
   115     {
   114     iUid = aUid;
   116     iUid = aUid;
   115 
   117     iDialogsProvider = CBrowserDialogsProvider::NewL( NULL );
       
   118     
   116     iPenEnabled = AknLayoutUtils::PenEnabled();
   119     iPenEnabled = AknLayoutUtils::PenEnabled();
   117     iShowSoftkeys = iPenEnabled;
   120     iShowSoftkeys = iPenEnabled;
   118 
   121 
   119     CWidgetUiWindowView* view = iWindowManager.View();
   122     CWidgetUiWindowView* view = iWindowManager.View();
   120     // view->ShowActivatedObject(EFalse);
   123     // view->ShowActivatedObject(EFalse);
   123     TRect rect;
   126     TRect rect;
   124     RWidgetRegistryClientSession clientSession = iWindowManager.WidgetUIClientSession();
   127     RWidgetRegistryClientSession clientSession = iWindowManager.WidgetUIClientSession();
   125     iUrl = GetUlrL( clientSession, aUid );
   128     iUrl = GetUlrL( clientSession, aUid );
   126     iWidgetUiObserver = CWidgetUiObserver::NewL( *this );
   129     iWidgetUiObserver = CWidgetUiObserver::NewL( *this );
   127 
   130 
   128     iWidgetUiDialogsProviderProxy = CWidgetUiDialogsProviderProxy::NewL(*(iWindowManager.DialogsProvider()), NULL, *this);
   131     iWidgetUiDialogsProviderProxy = CWidgetUiDialogsProviderProxy::NewL(*iDialogsProvider, NULL, *this);
   129 
   132 
   130 #ifdef BRDO_WRT_HS_FF
   133 #ifdef BRDO_WRT_HS_FF
   131     iNetworkModeWait = new(ELeave) CActiveSchedulerWait();
   134     iNetworkModeWait = new(ELeave) CActiveSchedulerWait();
   132 #endif
   135 #endif
   133 
   136 
   217 //
   220 //
   218 // -----------------------------------------------------------------------------
   221 // -----------------------------------------------------------------------------
   219 //
   222 //
   220 CWidgetUiWindow::~CWidgetUiWindow()
   223 CWidgetUiWindow::~CWidgetUiWindow()
   221     {
   224     {
       
   225     if( iDialogsProvider)
       
   226         {
       
   227          iDialogsProvider->CancelAll();
       
   228         }
   222     if (iEngine && iWidgetUiObserver)
   229     if (iEngine && iWidgetUiObserver)
   223         {
   230         {
   224         iEngine->RemoveLoadEventObserver( iWidgetUiObserver );
   231         iEngine->RemoveLoadEventObserver( iWidgetUiObserver );
   225         iEngine->RemoveStateChangeObserver( iWindowManager.View() );
   232         iEngine->RemoveStateChangeObserver( iWindowManager.View() );
   226         }
   233         }
   244     if(iAsyncCallBack)
   251     if(iAsyncCallBack)
   245         {
   252         {
   246         iAsyncCallBack->Cancel();
   253         iAsyncCallBack->Cancel();
   247         }
   254         }
   248     delete iAsyncCallBack;
   255     delete iAsyncCallBack;
   249     iAsyncCallBack=NULL;    
   256     iAsyncCallBack=NULL;  
       
   257     delete iDialogsProvider;
   250     }
   258     }
   251 
   259 
   252 // -----------------------------------------------------------------------------
   260 // -----------------------------------------------------------------------------
   253 // CWidgetUiWindow::CbaGroup()
   261 // CWidgetUiWindow::CbaGroup()
   254 // returns cba group
   262 // returns cba group
   354 // -----------------------------------------------------------------------------
   362 // -----------------------------------------------------------------------------
   355 //
   363 //
   356 TBool CWidgetUiWindow::DialogMimeFileSelectLC(HBufC*& aSelectedFileName,
   364 TBool CWidgetUiWindow::DialogMimeFileSelectLC(HBufC*& aSelectedFileName,
   357                                  const TDesC& aMimeType)
   365                                  const TDesC& aMimeType)
   358     {
   366     {
   359     return iWindowManager.DialogsProvider()->DialogMimeFileSelectLC(aSelectedFileName, aMimeType);
   367     return iDialogsProvider->DialogMimeFileSelectLC(aSelectedFileName, aMimeType);
   360     }
   368     }
   361 
   369 
   362 // -----------------------------------------------------------------------------
   370 // -----------------------------------------------------------------------------
   363 // CWidgetUiWindow::SetSoftkeysVisible()
   371 // CWidgetUiWindow::SetSoftkeysVisible()
   364 // -----------------------------------------------------------------------------
   372 // -----------------------------------------------------------------------------
   793                 delete rep;
   801                 delete rep;
   794             }
   802             }
   795 
   803 
   796             if ( prompt )
   804             if ( prompt )
   797                 {
   805                 {
   798                 CBrowserDialogsProvider* dialogProvider
       
   799                             = iWindowManager.DialogsProvider();
       
   800                 TBool grant = EFalse;
   806                 TBool grant = EFalse;
   801                 HBufC* message = StringLoader::LoadLC( R_WIDGETUI_NETWORK_ACCESS );
   807                 HBufC* message = StringLoader::LoadLC( R_WIDGETUI_NETWORK_ACCESS );
   802                 HBufC* yes = StringLoader::LoadLC( R_WIDGETUI_SOFTKEY_YES );
   808                 HBufC* yes = StringLoader::LoadLC( R_WIDGETUI_SOFTKEY_YES );
   803                 HBufC* no = StringLoader::LoadLC( R_WIDGETUI_SOFTKEY_NO );
   809                 HBufC* no = StringLoader::LoadLC( R_WIDGETUI_SOFTKEY_NO );
   804                 grant = dialogProvider->DialogConfirmL( _L(""), *message, *yes, *no );
   810                 grant = iDialogsProvider->DialogConfirmL( _L(""), *message, *yes, *no );
   805                 CleanupStack::PopAndDestroy( 3 );
   811                 CleanupStack::PopAndDestroy( 3 );
   806                 // save prompt result for session
   812                 // save prompt result for session
   807                 SetNetworkAccessGrant( grant? EAllow : EDeny );
   813                 SetNetworkAccessGrant( grant? EAllow : EDeny );
   808 
   814 
   809                 CheckUserPermissionChanged( grant );
   815                 CheckUserPermissionChanged( grant );
  1306 TInt CWidgetUiWindow::DeleteItself(TAny* aPtr)
  1312 TInt CWidgetUiWindow::DeleteItself(TAny* aPtr)
  1307     {
  1313     {
  1308     CWidgetUiWindow* self = (CWidgetUiWindow*)aPtr;
  1314     CWidgetUiWindow* self = (CWidgetUiWindow*)aPtr;
  1309     CWidgetUiWindowManager* p = &self->iWindowManager;
  1315     CWidgetUiWindowManager* p = &self->iWindowManager;
  1310     delete self;
  1316     delete self;
       
  1317     //The Correct fix is to call AppUI::Exit()
       
  1318     //But that is leaving
  1311     if(p->WindowListCount() == 0)
  1319     if(p->WindowListCount() == 0)
  1312         p->ExitNow();
  1320         User::Exit(KErrNone);
  1313     return 0;
  1321     return 0;
  1314     }
  1322     }
  1315     
  1323     
  1316 #ifdef BRDO_OCC_ENABLED_FF
  1324 #ifdef BRDO_OCC_ENABLED_FF
  1317 // -----------------------------------------------------------------------------
  1325 // -----------------------------------------------------------------------------
  1318 // CWidgetUiWindow::ConnectionStageAchievedL()
  1326 // CWidgetUiWindow::ConnectionStageAchievedL()
  1319 // -----------------------------------------------------------------------------
  1327 // -----------------------------------------------------------------------------
  1320 //
  1328 //
  1321 void CWidgetUiWindow::ConnectionStageAchievedL()
  1329 void CWidgetUiWindow::ConnectionStageAchievedL()
  1322     {
  1330     {
  1323 
       
  1324     iWindowManager.GetConnection()->Disconnect();
  1331     iWindowManager.GetConnection()->Disconnect();
  1325    
       
  1326     TRAP_IGNORE( Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) );
       
  1327     SetRetryFlag(ETrue);    
       
  1328     
  1332     
  1329     TRAP_IGNORE( Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelQueuedTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) );
  1333     TNifProgressBuf buf = iConnStageNotifier->GetProgressBuffer();
       
  1334     if( buf().iError == KErrDisconnected )
       
  1335         {
       
  1336         TRAP_IGNORE( Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) );
       
  1337         SetRetryFlag(ETrue);    
  1330     
  1338     
  1331     if( iRetryConnectivity && iRetryConnectivity->IsActive())
  1339         TRAP_IGNORE( Engine()->HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelQueuedTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) );
  1332        {
  1340     
  1333        iRetryConnectivity->Cancel();
  1341         if( iRetryConnectivity && iRetryConnectivity->IsActive())
  1334        }
  1342             {
  1335     iRetryConnectivity->Start(KRetryConnectivityTimeout, 0,TCallBack(RetryConnectivity,this));
  1343             iRetryConnectivity->Cancel();
  1336 
  1344             }
       
  1345         iRetryConnectivity->Start(KRetryConnectivityTimeout, 0,TCallBack(RetryConnectivity,this));
       
  1346         }
  1337     }  
  1347     }  
  1338 
  1348 
  1339 void CWidgetUiWindow::ConnNeededStatusL( TInt aErr )
  1349 void CWidgetUiWindow::ConnNeededStatusL( TInt aErr )
  1340     {
  1350     {
  1341     StopConnectionObserving(); //Need to stop the connection observer first
  1351     StopConnectionObserving(); //Need to stop the connection observer first
  1414 //
  1424 //
  1415  TBool CWidgetUiWindow::GetRetryFlag()
  1425  TBool CWidgetUiWindow::GetRetryFlag()
  1416       {
  1426       {
  1417       return reConnectivityFlag;
  1427       return reConnectivityFlag;
  1418       } 
  1428       } 
       
  1429  
       
  1430  void CWidgetUiWindow::CancelAllDialogs()
       
  1431      {
       
  1432      if( iDialogsProvider)
       
  1433          {
       
  1434           iDialogsProvider->CancelAll();
       
  1435          }
       
  1436      }
       
  1437  
       
  1438  TBool CWidgetUiWindow::IsDialogsLaunched()
       
  1439      {
       
  1440      return (iDialogsProvider && iDialogsProvider->IsDialogLaunched() );
       
  1441      }
  1419 #endif 
  1442 #endif 
  1420 // End of file
  1443 // End of file