browserui/browser/BrowserAppSrc/BrowserAppUi.cpp
branchRCL_3
changeset 48 5c11946e75b3
parent 46 5dedbccec665
child 50 c9249d037530
equal deleted inserted replaced
46:5dedbccec665 48:5c11946e75b3
   105 
   105 
   106 #include "BrowserAppUi.h"
   106 #include "BrowserAppUi.h"
   107 
   107 
   108 #include "BrowserPushMtmObserver.h"
   108 #include "BrowserPushMtmObserver.h"
   109 
   109 
       
   110 #ifdef BRDO_IAD_UPDATE_ENABLED_FF
       
   111 #include <iaupdate.h>
       
   112 #include <iaupdateparameters.h>
       
   113 #include <iaupdateresult.h>
       
   114 #endif
       
   115 
   110 //CONSTANTS
   116 //CONSTANTS
   111 const TUint KBookmarkId = 1;
   117 const TUint KBookmarkId = 1;
   112 const TUint KUrlId = 4;
   118 const TUint KUrlId = 4;
   113 _LIT8 ( KLongZeroIdString, "5" );
   119 _LIT8 ( KLongZeroIdString, "5" );
   114 const TUint KFolderId = 6;
   120 const TUint KFolderId = 6;
   121 const TUint KSlash('/');
   127 const TUint KSlash('/');
   122 _LIT( KDefaultSchema, "http://" );
   128 _LIT( KDefaultSchema, "http://" );
   123 const TInt KDefaultSchemaLength = 7;
   129 const TInt KDefaultSchemaLength = 7;
   124 
   130 
   125 const TInt KMinimumCDriveDiskSpace = 512 * 1024;
   131 const TInt KMinimumCDriveDiskSpace = 512 * 1024;
       
   132 
       
   133 const TInt KRetryConnectivityTimeout( 2*1000*1000 ); // 2 seconds
       
   134 
       
   135 #ifdef BRDO_IAD_UPDATE_ENABLED_FF
       
   136 const TUint KBrowser8xUID = 0x200267CC;
       
   137 _LIT( KUpdateFileName, "lastupdatechecked.txt" );
       
   138 const TInt64 KMaxTimeToPostponeUpdate = 604800000000;
       
   139 #endif
   126 
   140 
   127 // ================= MEMBER FUNCTIONS =======================
   141 // ================= MEMBER FUNCTIONS =======================
   128 
   142 
   129 // -----------------------------------------------------------------------------
   143 // -----------------------------------------------------------------------------
   130 // CBrowserAppUi::CBrowserAppUi()
   144 // CBrowserAppUi::CBrowserAppUi()
   156 //
   170 //
   157 CBrowserAppUi::~CBrowserAppUi()
   171 CBrowserAppUi::~CBrowserAppUi()
   158     {
   172     {
   159     LOG_ENTERFN("CBrowserAppUi::~CBrowserAppUi");
   173     LOG_ENTERFN("CBrowserAppUi::~CBrowserAppUi");
   160 
   174 
       
   175 #ifdef BRDO_IAD_UPDATE_ENABLED_FF
       
   176     iFs.Close();
       
   177 #endif
       
   178     
   161     SetExitInProgress( ETrue );
   179     SetExitInProgress( ETrue );
   162     if(iBrowserAsyncExit)
   180     if(iBrowserAsyncExit)
   163     	{
   181     	{
   164     	iBrowserAsyncExit->Cancel();
   182     	iBrowserAsyncExit->Cancel();
   165     	}
   183     	}
   232     delete iBrowserAsyncExit;
   250     delete iBrowserAsyncExit;
   233     LOG_WRITE( " iBrowserAsyncExit deleted" );
   251     LOG_WRITE( " iBrowserAsyncExit deleted" );
   234 
   252 
   235     iFavouritesSess.Close();
   253     iFavouritesSess.Close();
   236     LOG_WRITE( " iFavouritesSess.Close() deleted" );
   254     LOG_WRITE( " iFavouritesSess.Close() deleted" );
       
   255 #ifdef BRDO_IAD_UPDATE_ENABLED_FF
       
   256     CleanUpdateParams(); 
       
   257 #endif
   237     }
   258     }
   238 
   259 
   239 // -----------------------------------------------------------------------------
   260 // -----------------------------------------------------------------------------
   240 // CBrowserAppUi::ConstructL()
   261 // CBrowserAppUi::ConstructL()
   241 // -----------------------------------------------------------------------------
   262 // -----------------------------------------------------------------------------
   262 	else
   283 	else
   263 		{
   284 		{
   264 		iStartedUp = EFalse;
   285 		iStartedUp = EFalse;
   265 		LOG_WRITE( "Browser started embedded" );
   286 		LOG_WRITE( "Browser started embedded" );
   266 		}
   287 		}
   267 
   288 #ifdef BRDO_IAD_UPDATE_ENABLED_FF
       
   289     User::LeaveIfError(iFs.Connect());
       
   290     // Check updates from IAD, continue UI launching even if something fails there  
       
   291     TRAP_IGNORE( CheckUpdatesL() );
       
   292 #endif
       
   293         
   268 PERFLOG_STOP_WRITE("BrowserUI::ConstructL");
   294 PERFLOG_STOP_WRITE("BrowserUI::ConstructL");
   269 
   295 
   270     }
   296     }
   271 
   297 #ifdef BRDO_IAD_UPDATE_ENABLED_FF
       
   298 // ---------------------------------------------------------
       
   299 // CBrowserAppUi::CheckUpdatesL
       
   300 // ---------------------------------------------------------
       
   301 void CBrowserAppUi::CheckUpdatesL()
       
   302     {
       
   303     LOG_ENTERFN("CBrowserAppUi::CheckUpdatesL");
       
   304     LOG_WRITE( "CBrowserAppUi::CheckUpdatesL() entering" );
       
   305     if ( FeatureManager::FeatureSupported( KFeatureIdIAUpdate ) )
       
   306         {
       
   307         LOG_WRITE( "CBrowserAppUi::CheckUpdatesL() IAD Update supported" );
       
   308         TRAP_IGNORE( iUpdate = CIAUpdate::NewL( *this ) );
       
   309         LOG_WRITE( "CBrowserAppUi::CheckUpdatesL() IAD Update Client Created" );
       
   310         if ( iUpdate )
       
   311             {
       
   312             LOG_WRITE( "CBrowserAppUi::CheckUpdatesL() creating IAD Update paramentes" );
       
   313             iParameters = CIAUpdateParameters::NewL();
       
   314             // Search for updates using SIS package UID
       
   315             iParameters->SetUid( TUid::Uid( KBrowser8xUID ) );
       
   316             //check the updates
       
   317             iUpdate->CheckUpdates( *iParameters );
       
   318             }
       
   319         }
       
   320     LOG_WRITE( "CBrowserAppUi::CheckUpdatesL() exiting" );
       
   321     }
       
   322 
       
   323 // ---------------------------------------------------------
       
   324 // CBrowserAppUi::CheckUpdatesComplete
       
   325 // rest of the details commented in the header
       
   326 // ---------------------------------------------------------
       
   327 //
       
   328 void CBrowserAppUi::CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates )
       
   329     {
       
   330     LOG_ENTERFN("CBrowserAppUi::CheckUpdatesComplete");
       
   331     LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - Entry" );
       
   332     TInt err;
       
   333     TBool result;
       
   334     TBool showDialog = EFalse;
       
   335 
       
   336     if ( aErrorCode == KErrNone )
       
   337         {
       
   338 		if ( aAvailableUpdates > 0 )
       
   339             {
       
   340             LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - update available" );
       
   341             //Check if the file is available in folder or not
       
   342             if(CheckUpdateFileAvailable())
       
   343                 {
       
   344                 LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - update file available" );
       
   345                 TTime timenow;
       
   346                 timenow.HomeTime();
       
   347                 TInt64 time = timenow.Int64();
       
   348                 TInt64 dataValue = ReadUpdateFile();
       
   349                 //If the diference of the current time and the Previous Check time is more than 1 Week
       
   350                 //then show the dialog
       
   351                 if((time - dataValue)>KMaxTimeToPostponeUpdate)
       
   352                     {
       
   353                     LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - diference of the current time and the time available in th file is more than 7 days" );
       
   354                     showDialog = ETrue;
       
   355                     }
       
   356                 }
       
   357             else
       
   358                 {
       
   359                 LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - update file is not available" );
       
   360                 showDialog = ETrue;
       
   361                 }
       
   362                     
       
   363             if(showDialog)
       
   364                 {
       
   365                 HBufC* message = StringLoader::LoadLC(R_INSTALL_ADDON_BROWSER);
       
   366                 HBufC* lsc_now = StringLoader::LoadLC(R_INSTALL_BROWSER_NOW);
       
   367                 HBufC* rsc_later = StringLoader::LoadLC(R_INSTALL_BROWSER_LATER);
       
   368                 
       
   369                 TRAPD(err, result = iDialogsProvider->DialogConfirmL(_L(""),
       
   370                 *message,
       
   371                 *lsc_now,
       
   372                 *rsc_later));
       
   373                                    
       
   374                 CleanupStack::PopAndDestroy(3); //message, lsc_now, rsc_later
       
   375                 
       
   376                 if (err != KErrNone)
       
   377                     {
       
   378                     return ;
       
   379                     }
       
   380                 if ( result )  //  user selected NOW
       
   381                     {
       
   382                     LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - if file exists, just delete it." );
       
   383                     // if file exists, just delete it.
       
   384                     DeleteUpdateFile();
       
   385                     iUpdate->ShowUpdates( *iParameters );
       
   386                     }
       
   387                 if ( !result )  // user selected LATER
       
   388                     {
       
   389                     LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - create the file and store the current time." );
       
   390                     //create the file and store the current time.
       
   391                     WriteUpdateFile();
       
   392                     }
       
   393                 }
       
   394             LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - update available" );
       
   395             }
       
   396         else
       
   397             {
       
   398             LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - no update available" );
       
   399             // The answer was 'Later'. CIAUpdate object could be deleted
       
   400             CleanUpdateParams();
       
   401             }
       
   402         }
       
   403     LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - Exit" );
       
   404     }
       
   405 
       
   406 // -----------------------------------------------------------------------------
       
   407 // CBrowserAppUi::CleanUpdateParams
       
   408 // -----------------------------------------------------------------------------
       
   409 //
       
   410 void CBrowserAppUi::CleanUpdateParams()
       
   411     {
       
   412     LOG_ENTERFN("CBrowserAppUi::CleanUpdateParams");
       
   413     LOG_WRITE( "CBrowserAppUi::CleanUpdateParams() entering" );
       
   414     if(iUpdate)
       
   415         {
       
   416         delete iUpdate;
       
   417         iUpdate = NULL;
       
   418         }
       
   419     if(iParameters)
       
   420         {
       
   421         delete iParameters;
       
   422         iParameters = NULL;
       
   423         }
       
   424     LOG_WRITE( "CBrowserAppUi::CleanUpdateParams() exiting" );
       
   425     }
       
   426 
       
   427 // ---------------------------------------------------------
       
   428 // CBrowserAppUi::UpdateComplete
       
   429 // rest of the details commented in the header
       
   430 // ---------------------------------------------------------
       
   431 //
       
   432 void CBrowserAppUi::UpdateComplete( TInt aErrorCode, CIAUpdateResult* aResult )
       
   433     {
       
   434     LOG_ENTERFN("CBrowserAppUi::UpdateComplete");
       
   435     LOG_WRITE( "CBrowserAppUi::UpdateComplete - Entry" );
       
   436     delete aResult; // Ownership was transferred, so this must be deleted by the client
       
   437     CleanUpdateParams();
       
   438     LOG_WRITE( "CBrowserAppUi::UpdateComplete - Exit" );
       
   439     }
       
   440 #endif
   272 // -----------------------------------------------------------------------------
   441 // -----------------------------------------------------------------------------
   273 // CBrowserAppUi::InitBrowser()
   442 // CBrowserAppUi::InitBrowser()
   274 // -----------------------------------------------------------------------------
   443 // -----------------------------------------------------------------------------
   275 //
   444 //
   276 void CBrowserAppUi::InitBrowserL()
   445 void CBrowserAppUi::InitBrowserL()
   360         BROWSER_LOG( ( _L( "ConnectionManager up" ) ) );
   529         BROWSER_LOG( ( _L( "ConnectionManager up" ) ) );
   361 
   530 
   362 
   531 
   363         PERFLOG_STOPWATCH_START;
   532         PERFLOG_STOPWATCH_START;
   364         iConnStageNotifier = CConnectionStageNotifierWCB::NewL();
   533         iConnStageNotifier = CConnectionStageNotifierWCB::NewL();
       
   534 		
       
   535         //this is required, browser's connection oberver should be hit first. (incase of netscape plgins, transactions will be closed.)
       
   536         iConnStageNotifier->SetPriority(CActive::EPriorityHigh);
       
   537 
   365         PERFLOG_STOP_WRITE("\t StageNotif NewL");
   538         PERFLOG_STOP_WRITE("\t StageNotif NewL");
   366         BROWSER_LOG( ( _L( "StageNofier up" ) ) );
   539         BROWSER_LOG( ( _L( "StageNofier up" ) ) );
   367 
   540 
   368         // Starts a background processing, so it must be started early, to get
   541         // Starts a background processing, so it must be started early, to get
   369         // finished before the first send operation! Or it must be synchronized!
   542         // finished before the first send operation! Or it must be synchronized!
   481         iStartedUp = ETrue;
   654         iStartedUp = ETrue;
   482         iSecureSiteVisited = EFalse;
   655         iSecureSiteVisited = EFalse;
   483 
   656 
   484 	    iPushMtmObserver = CBrowserPushMtmObserver::NewL( this );
   657 	    iPushMtmObserver = CBrowserPushMtmObserver::NewL( this );
   485 	    iPushMtmObserver->StartObserver();
   658 	    iPushMtmObserver->StartObserver();
       
   659 #ifdef BRDO_OCC_ENABLED_FF
       
   660         iRetryConnectivity = CPeriodic::NewL(CActive::EPriorityStandard);
       
   661 #endif
   486         } //if (iStartedUp)
   662         } //if (iStartedUp)
   487     }
   663     }
   488 
   664 
   489 // -----------------------------------------------------------------------------
   665 // -----------------------------------------------------------------------------
   490 // CBrowserAppUi::ProcessCommandL(TInt aCommand)
   666 // CBrowserAppUi::ProcessCommandL(TInt aCommand)
  1272 			{
  1448 			{
  1273             if ( (Preferences().AccessPointSelectionMode() == EConnectionMethod) || 
  1449             if ( (Preferences().AccessPointSelectionMode() == EConnectionMethod) || 
  1274                  (Preferences().AccessPointSelectionMode() == EAlwaysAsk) )
  1450                  (Preferences().AccessPointSelectionMode() == EAlwaysAsk) )
  1275                 {
  1451                 {
  1276                 iRequestedAp = Preferences().DefaultAccessPoint();
  1452                 iRequestedAp = Preferences().DefaultAccessPoint();
  1277 #ifdef BRDO_OCC_ENABLED_FF //Setting ap should not be taken if OCC is enabled, instead bookmark ap should be taken
       
  1278 #ifndef __WINS__
       
  1279                 iRequestedAp = aAccessPoint.ApId();
       
  1280                 BROWSER_LOG( ( _L( "Bookmark Iap id : %d" ), iRequestedAp ) );
       
  1281 #endif
       
  1282 #endif                
       
  1283                 }
  1453                 }
  1284             else if ( Preferences().AccessPointSelectionMode() == EDestination ) 
  1454             else if ( Preferences().AccessPointSelectionMode() == EDestination ) 
  1285                 {
  1455                 {
  1286                 // for bug fix MLAN-7EKFV4
  1456                 // for bug fix MLAN-7EKFV4
  1287     			iRequestedAp = KWmlNoDefaultAccessPoint;
  1457     			iRequestedAp = KWmlNoDefaultAccessPoint;
  2373             }
  2543             }
  2374         // if any error, return Cancel to Kimono.
  2544         // if any error, return Cancel to Kimono.
  2375         return;
  2545         return;
  2376         }
  2546         }
  2377 
  2547 
       
  2548     BROWSER_LOG( ( _L( " CBrowserAppUi::ConnNeededStatusL First Stop Connection Observer" ) ) );
       
  2549     StopConnectionObserving(); //Need to stop the connection observer first
  2378 
  2550 
  2379 
  2551 
  2380     if ( !iConnStageNotifier->IsActive() )
  2552     if ( !iConnStageNotifier->IsActive() )
  2381         {
  2553         {
  2382         BROWSER_LOG( ( _L( " CBrowserAppUi::ConnNeededStatusL Starting Connection Observer" ) ) );
  2554         BROWSER_LOG( ( _L( " CBrowserAppUi::ConnNeededStatusL Starting Connection Observer" ) ) );
  2383         TName* connectionName = Connection().ConnectionNameL();
  2555         TName* connectionName = Connection().ConnectionNameL();
  2384         CleanupStack::PushL( connectionName );
  2556         CleanupStack::PushL( connectionName );
  2385         iConnStageNotifier->StartNotificationL(
  2557 
  2386             connectionName, KConnectionUninitialised, this);
  2558         iConnStageNotifier->StartNotificationL(connectionName, KLinkLayerClosed, this);
       
  2559 
  2387         CleanupStack::PopAndDestroy();  //connectionName
  2560         CleanupStack::PopAndDestroy();  //connectionName
  2388         }
  2561         }
  2389     }
  2562     }
  2390 
  2563 
  2391 
  2564 
  2430             buf = KNullDesC().AllocLC();
  2603             buf = KNullDesC().AllocLC();
  2431             }
  2604             }
  2432         }
  2605         }
  2433     return buf;
  2606     return buf;
  2434     }
  2607     }
  2435 
  2608 	
       
  2609 #ifdef BRDO_OCC_ENABLED_FF
       
  2610 // -----------------------------------------------------------------------------
       
  2611 // CBrowserContentView::SetRetryFlag
       
  2612 // -----------------------------------------------------------------------------
       
  2613 //
       
  2614 void CBrowserAppUi::SetRetryFlag(TBool flag)
       
  2615      {
       
  2616      LOG_ENTERFN("CBrowserAppUi::SetRetryFlag");
       
  2617      BROWSER_LOG( ( _L(" CBrowserAppUi::SetRetryFlag flag: %d"), flag ) );
       
  2618      reConnectivityFlag = flag;
       
  2619      }
       
  2620 
       
  2621 // -----------------------------------------------------------------------------
       
  2622 // CBrowserContentView::GetRetryFlag
       
  2623 // -----------------------------------------------------------------------------
       
  2624 //
       
  2625  TBool CBrowserAppUi::GetRetryFlag()
       
  2626       {
       
  2627       LOG_ENTERFN("CBrowserAppUi::GetRetryFlag");
       
  2628       BROWSER_LOG( ( _L(" CBrowserAppUi::GetRetryFlag flag: %d"), reConnectivityFlag ) );
       
  2629       return reConnectivityFlag;
       
  2630       }
       
  2631 	  
       
  2632 // -----------------------------------------------------------------------------
       
  2633 // CBrowserContentView::RetryConnectivity
       
  2634 // -----------------------------------------------------------------------------
       
  2635 //
       
  2636 TInt CBrowserAppUi::RetryConnectivity(TAny* aCBrowserAppUi)
       
  2637     {
       
  2638     LOG_ENTERFN("CBrowserAppUi::RetryConnectivity");
       
  2639     __ASSERT_DEBUG(aCBrowserAppUi, Util::Panic( Util::EUninitializedData ));
       
  2640   
       
  2641     TInt err = ((CBrowserAppUi*)aCBrowserAppUi)->RetryInternetConnection();
       
  2642     
       
  2643     BROWSER_LOG( ( _L(" CBrowserAppUi::RetryConnectivity Error: %d"), err ) );
       
  2644     return err;
       
  2645     }
       
  2646 	
       
  2647 TInt CBrowserAppUi::RetryInternetConnection()
       
  2648     {
       
  2649     LOG_ENTERFN("CBrowserAppUi::RetryInternetConnection");
       
  2650     //First cancel the timer
       
  2651     if ( iRetryConnectivity && iRetryConnectivity->IsActive() )
       
  2652     {
       
  2653         iRetryConnectivity->Cancel();
       
  2654         BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection Timer Cancelled successfully " ) ) );
       
  2655     }
       
  2656     TInt err = KErrNone;
       
  2657     if ( !iConnection->Connected() )
       
  2658        {
       
  2659        TRAP_IGNORE( err = iConnection->StartConnectionL( ETrue ) );
       
  2660        }
       
  2661     if( err == KErrNone )
       
  2662        { 
       
  2663        BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection Connection restablished successfully " ) ) );
       
  2664        
       
  2665        BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection UNSET retry flags " ) ) );
       
  2666        TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandUnSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) );
       
  2667        SetRetryFlag(EFalse);
       
  2668        
       
  2669        TRAP_IGNORE(ConnNeededStatusL(err)); //Start the observer again
       
  2670        TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandRetryTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) );
       
  2671        //Let download manager knows about this new connection
       
  2672        TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandConnToDownloadManager + (TInt)TBrCtlDefs::ECommandIdBase ) );
       
  2673        }
       
  2674     else
       
  2675         {
       
  2676         BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection Connection failed " ) ) );
       
  2677         BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection unset retry flags " ) ) );
       
  2678         TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandUnSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) );
       
  2679         SetRetryFlag(EFalse);
       
  2680         BROWSER_LOG( ( _L( "CBrowserAppUi::RetryInternetConnection clear queued transactions " ) ) );
       
  2681         TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandClearQuedTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) );
       
  2682         Display().StopProgressAnimationL(); //Stop Progress animation
       
  2683         iDialogsProvider->UploadProgressNoteL(0, 0, ETrue, (MBrowserDialogsProviderObserver *)this ); //Close the uploading dialog.
       
  2684         iDialogsProvider->CancelAll(); //connection has been lost, so cancel the authentication dialog.
       
  2685         }
       
  2686     
       
  2687     return err;
       
  2688     }
       
  2689 #endif
  2436 
  2690 
  2437 // -----------------------------------------------------------------------------
  2691 // -----------------------------------------------------------------------------
  2438 // CBrowserAppUi::ConnectionStageAchievedL()
  2692 // CBrowserAppUi::ConnectionStageAchievedL()
  2439 // -----------------------------------------------------------------------------
  2693 // -----------------------------------------------------------------------------
  2440 //
  2694 //
  2441 void CBrowserAppUi::ConnectionStageAchievedL()
  2695 void CBrowserAppUi::ConnectionStageAchievedL()
  2442     {
  2696     {
       
  2697 #ifdef BRDO_OCC_ENABLED_FF
       
  2698     LOG_ENTERFN("CBrowserAppUi::ConnectionStageAchievedL");
       
  2699     //Disconnect first
       
  2700     BROWSER_LOG( ( _L( "CBrowserAppUi::ConnectionStageAchievedL Disconnecting..." ) ) );
       
  2701     iConnection->Disconnect();
       
  2702 
       
  2703     BROWSER_LOG( ( _L( "CBrowserAppUi::ConnectionStageAchievedL Some transactions are on-going. Need to reconnect. " ) ) );
       
  2704     BROWSER_LOG( ( _L( "CBrowserAppUi::ConnectionStageAchievedL Set retry flags " ) ) );
       
  2705     TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) );
       
  2706     SetRetryFlag(ETrue);    
       
  2707     
       
  2708     if( iRetryConnectivity && iRetryConnectivity->IsActive())
       
  2709        {
       
  2710        iRetryConnectivity->Cancel();
       
  2711        }
       
  2712     iRetryConnectivity->Start(KRetryConnectivityTimeout, 0,TCallBack(RetryConnectivity,this));
       
  2713 
       
  2714 #else
  2443     // this function is called only when network is lost
  2715     // this function is called only when network is lost
  2444     // because we set notifier for KAgentUnconnected only
  2716     // because we set notifier for KAgentUnconnected only
  2445     Display().StopProgressAnimationL();
  2717     Display().StopProgressAnimationL();
  2446 	if ( Fetching() )
  2718 	if ( Fetching() )
  2447 		{
  2719 		{
  2454     iDialogsProvider->CancelAll();
  2726     iDialogsProvider->CancelAll();
  2455     // SendDisconnectEventL();
  2727     // SendDisconnectEventL();
  2456     // not needed as by that point HTTPSession was already shutdown by executing disconnect menu option
  2728     // not needed as by that point HTTPSession was already shutdown by executing disconnect menu option
  2457     // will cause a crash when user tries to quickly reconnect right after disconnecting, as HTTP session
  2729     // will cause a crash when user tries to quickly reconnect right after disconnecting, as HTTP session
  2458     // is starting to initialize, while this call is trying to close it.
  2730     // is starting to initialize, while this call is trying to close it.
       
  2731 #endif
  2459     }
  2732     }
  2460 
  2733 
  2461 
  2734 
  2462 // -----------------------------------------------------------------------------
  2735 // -----------------------------------------------------------------------------
  2463 // CBrowserAppUi::UpdateSoftKeys
  2736 // CBrowserAppUi::UpdateSoftKeys
  4203     if( error != KErrNone )
  4476     if( error != KErrNone )
  4204         {
  4477         {
  4205         CloseContentViewL();
  4478         CloseContentViewL();
  4206         }                
  4479         }                
  4207     }
  4480     }
  4208 
  4481 #ifdef BRDO_IAD_UPDATE_ENABLED_FF
       
  4482 // ---------------------------------------------------------
       
  4483 // CBrowserAppUi::CheckUpdateFileAvailable
       
  4484 // ---------------------------------------------------------
       
  4485 TBool CBrowserAppUi::CheckUpdateFileAvailable()
       
  4486     {
       
  4487     TBuf<KMaxFileName> privatePath;
       
  4488     TBuf<KMaxFileName> updateFileName;
       
  4489     iFs.PrivatePath( privatePath );
       
  4490     updateFileName.Copy( privatePath );
       
  4491     updateFileName.Append( KUpdateFileName );
       
  4492     RFile updatefile;   
       
  4493     TInt err = updatefile.Open( iFs, updateFileName, EFileRead );
       
  4494     if ( err == KErrNotFound ) 
       
  4495         {
       
  4496         LOG_WRITE( "CBrowserAppUi::CheckUpdateFileAvailable - update file not available" );
       
  4497         return EFalse;
       
  4498         }
       
  4499     else
       
  4500         {
       
  4501         LOG_WRITE( "CBrowserAppUi::CheckUpdateFileAvailable - update file available" );
       
  4502         updatefile.Close();
       
  4503         }
       
  4504     return ETrue;       
       
  4505     }
       
  4506 
       
  4507 // ---------------------------------------------------------
       
  4508 // CBrowserAppUi::WriteUpdateFile
       
  4509 // ---------------------------------------------------------
       
  4510 void CBrowserAppUi::WriteUpdateFile()
       
  4511     {
       
  4512     TBuf<KMaxFileName> privatePath;
       
  4513     TBuf<KMaxFileName> updateFileName;
       
  4514     iFs.PrivatePath( privatePath );
       
  4515     updateFileName.Copy( privatePath );
       
  4516     updateFileName.Append( KUpdateFileName );
       
  4517     RFile updatefile;
       
  4518     TInt err = updatefile.Open( iFs, updateFileName, EFileWrite | EFileShareExclusive );
       
  4519     if(err == KErrNotFound)
       
  4520         {
       
  4521         LOG_WRITE( "CBrowserAppUi::WriteUpdateFile - update file not available so create it" );
       
  4522         err = updatefile.Create( iFs, updateFileName, EFileWrite | EFileShareExclusive );
       
  4523         }
       
  4524     //Get the current time
       
  4525     TTime timenow;
       
  4526     timenow.HomeTime();
       
  4527     TInt64 time = timenow.Int64();
       
  4528     TBuf8<50> data;
       
  4529     data.AppendNum(time);
       
  4530     LOG_WRITE( "CBrowserAppUi::WriteUpdateFile - write the current time in update file" );
       
  4531     updatefile.Write(data);
       
  4532     updatefile.Close();
       
  4533     }
       
  4534 
       
  4535 // ---------------------------------------------------------
       
  4536 // CBrowserAppUi::DeleteUpdateFile
       
  4537 // ---------------------------------------------------------
       
  4538 void CBrowserAppUi::DeleteUpdateFile()
       
  4539     {
       
  4540     TBuf<KMaxFileName> privatePath;
       
  4541     TBuf<KMaxFileName> updateFileName;
       
  4542     iFs.PrivatePath( privatePath );
       
  4543     updateFileName.Copy( privatePath );
       
  4544     updateFileName.Append( KUpdateFileName );
       
  4545     iFs.Delete(updateFileName);  
       
  4546     }
       
  4547 
       
  4548 // ---------------------------------------------------------
       
  4549 // CBrowserAppUi::ReadUpdateFile
       
  4550 // ---------------------------------------------------------
       
  4551 TInt64 CBrowserAppUi::ReadUpdateFile()
       
  4552     {
       
  4553     TBool returnvalue = ETrue;
       
  4554     TBuf<KMaxFileName> privatePath;
       
  4555     TBuf<KMaxFileName> updateFileName;
       
  4556     //Get the private path then append the filename
       
  4557     iFs.PrivatePath( privatePath );
       
  4558     updateFileName.Copy( privatePath );
       
  4559     updateFileName.Append( KUpdateFileName );
       
  4560     RFile updatefile;
       
  4561     TInt err = updatefile.Open( iFs, updateFileName, EFileRead );
       
  4562     TInt64 dataValue = 0;
       
  4563     //If file is found
       
  4564     if ( err != KErrNotFound ) 
       
  4565         {
       
  4566         TBuf8<50> readBuf;
       
  4567         err = updatefile.Read(readBuf);
       
  4568         updatefile.Close();
       
  4569         if((err == KErrNone) && (readBuf.Length()>NULL))
       
  4570             {
       
  4571             //Convert from TBuf8 to TInt64
       
  4572             TLex8 lex(readBuf);
       
  4573             lex.Val(dataValue);
       
  4574             }
       
  4575         }        
       
  4576     return dataValue;
       
  4577     }
       
  4578 #endif
  4209 // End of File
  4579 // End of File