browserui/browser/BrowserAppSrc/BrowserAppUi.cpp
branchRCL_3
changeset 46 4baee4f15982
parent 45 5a044f6358c2
equal deleted inserted replaced
45:5a044f6358c2 46:4baee4f15982
   287 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF
   287 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF
   288     BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible);
   288     BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible);
   289 #else 
   289 #else 
   290     BaseConstructL( EAknEnableSkin | EAknEnableMSK );
   290     BaseConstructL( EAknEnableSkin | EAknEnableMSK );
   291 #endif
   291 #endif
       
   292 
       
   293 
   292     if ( !IsEmbeddedModeOn( ) )
   294     if ( !IsEmbeddedModeOn( ) )
   293     	{
   295     	{
       
   296         // This is for handling low phone memory (c:) condition. Just leave in case phone memory is not sufficient.        
       
   297         TBool lowdisk = SysUtil::DiskSpaceBelowCriticalLevelL(&(CCoeEnv::Static()->FsSession()), KMinimumCDriveDiskSpace, EDriveC );
       
   298         if (lowdisk)   User::Leave(KErrDiskFull);
       
   299         
   294 #ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF     
   300 #ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF     
   295         InitBookmarksL();
   301         InitBookmarksL();
   296 #else
   302 #else
   297         InitBrowserL();
   303         InitBrowserL();
   298 #endif        
   304 #endif        
   529 // -----------------------------------------------------------------------------
   535 // -----------------------------------------------------------------------------
   530 //
   536 //
   531 void CBrowserAppUi::DelayedInitL()
   537 void CBrowserAppUi::DelayedInitL()
   532     {
   538     {
   533     LOG_ENTERFN("CBrowserAppUi::DelayedInitL");
   539     LOG_ENTERFN("CBrowserAppUi::DelayedInitL");
   534     // Check for ciritical disk space
   540     
   535     RFs fs;
       
   536     User::LeaveIfError(fs.Connect());
       
   537     TInt drive( EDriveC );
       
   538     TBool isSpace( EFalse );
       
   539     TInt err( KErrNone );
       
   540     TRAP( err, isSpace = !SysUtil::DiskSpaceBelowCriticalLevelL(&fs, KMinimumCDriveDiskSpace, drive ));
       
   541     fs.Close();
       
   542     if (!isSpace)  User::Leave(KErrDiskFull);
       
   543 
       
   544     // Create Favengine session
   541     // Create Favengine session
   545     User::LeaveIfError( iFavouritesSess.Connect() );
   542     User::LeaveIfError( iFavouritesSess.Connect() );
   546         
   543         
   547     // Init FeatureManager
   544     // Init FeatureManager
   548     FeatureManager::InitializeLibL();
   545     FeatureManager::InitializeLibL();
  1117 // CBrowserAppUi::IsPageLoaded()
  1114 // CBrowserAppUi::IsPageLoaded()
  1118 // -----------------------------------------------------------------------------
  1115 // -----------------------------------------------------------------------------
  1119 //
  1116 //
  1120 TBool CBrowserAppUi::IsPageLoaded()
  1117 TBool CBrowserAppUi::IsPageLoaded()
  1121     {
  1118     {
       
  1119 #ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF    
       
  1120     if(!iStartedUp) // ContentView/WindowMgr is not yet up => no page loaded
       
  1121         return EFalse;
       
  1122 #endif
       
  1123     
  1122     TBool ret( EFalse );
  1124     TBool ret( EFalse );
  1123     TInt winCount( WindowMgr().WindowCount() );
  1125     TInt winCount( WindowMgr().WindowCount() );
  1124 
  1126 
  1125     // at least 2 window -> there is a page loaded
  1127     // at least 2 window -> there is a page loaded
  1126     if( winCount > 1 )
  1128     if( winCount > 1 )
  1153     {
  1155     {
  1154 	// TO DO:
  1156 	// TO DO:
  1155 	// use load obs., remove ifetchstate from this class and use from loadobs.
  1157 	// use load obs., remove ifetchstate from this class and use from loadobs.
  1156 	// iLoadState
  1158 	// iLoadState
  1157     //return ( iFetchState == MFetchObserver::ELoadStart );
  1159     //return ( iFetchState == MFetchObserver::ELoadStart );
  1158 	return ( LoadObserver().LoadState() != CBrowserLoadObserver::ELoadStateIdle );
  1160 #ifdef BRDO_PERF_IMPROVEMENTS_ENABLED_FF    
       
  1161     if (!iStartedUp)  // ContentView is not yet started up, so we are not fetching   
       
  1162         return EFalse;
       
  1163     else
       
  1164 #endif        
       
  1165         return ( LoadObserver().LoadState() != CBrowserLoadObserver::ELoadStateIdle );
  1159     }
  1166     }
  1160 // -----------------------------------------------------------------------------
  1167 // -----------------------------------------------------------------------------
  1161 // CBrowserAppUi::ContentDisplayed()
  1168 // CBrowserAppUi::ContentDisplayed()
  1162 // -----------------------------------------------------------------------------
  1169 // -----------------------------------------------------------------------------
  1163 //
  1170 //
  1681     BROWSER_LOG( ( _L(" iConnection:  %d"), iConnection ) );
  1688     BROWSER_LOG( ( _L(" iConnection:  %d"), iConnection ) );
  1682     BROWSER_LOG( ( _L(" iExitFromEmbeddedMode:  %d"), iExitFromEmbeddedMode ) );
  1689     BROWSER_LOG( ( _L(" iExitFromEmbeddedMode:  %d"), iExitFromEmbeddedMode ) );
  1683     // if browser is embedded, should not call Exit(),
  1690     // if browser is embedded, should not call Exit(),
  1684     // just delete the object, otherwise leave occurs.
  1691     // just delete the object, otherwise leave occurs.
  1685     if( ( IsEmbeddedInOperatorMenu() || IsEmbeddedModeOn() ) &&
  1692     if( ( IsEmbeddedInOperatorMenu() || IsEmbeddedModeOn() ) &&
  1686             !ExitInProgress() &&
  1693             !ExitInProgress() && iStartedUp &&
  1687              ((LoadObserver().LoadUrlType() == CBrowserLoadObserver::ELoadUrlTypeEmbeddedBrowserWithUrl) ||
  1694              ((LoadObserver().LoadUrlType() == CBrowserLoadObserver::ELoadUrlTypeEmbeddedBrowserWithUrl) ||
  1688              (LoadObserver().LoadUrlType() == CBrowserLoadObserver::ELoadUrlTypeOther)   ) )
  1695              (LoadObserver().LoadUrlType() == CBrowserLoadObserver::ELoadUrlTypeOther)   ) )
  1689                // ELoadUrlTypeEmbeddedBrowserWithUrl is typical for load via Phonebook, MMS, OperatorMenu
  1696                // ELoadUrlTypeEmbeddedBrowserWithUrl is typical for load via Phonebook, MMS, OperatorMenu
  1690                // ELoadUrlTypeOther is typical via Media download since those are via GotoPane entered urls
  1697                // ELoadUrlTypeOther is typical via Media download since those are via GotoPane entered urls
  1691         {
  1698         {
  1719             //notify feeds engine to close the connection
  1726             //notify feeds engine to close the connection
  1720             TRAP_IGNORE( iFeedsClientUtilities->DisconnectManualUpdateConnectionL() );
  1727             TRAP_IGNORE( iFeedsClientUtilities->DisconnectManualUpdateConnectionL() );
  1721                 } 
  1728                 } 
  1722 #endif
  1729 #endif
  1723     		}
  1730     		}
  1724         if (SpecialLoadObserver().IsConnectionStarted()) 
  1731         if (iStartedUp && SpecialLoadObserver().IsConnectionStarted()) 
  1725             {
  1732             {
  1726             if ( iWindowManager ) 
       
  1727                {
       
  1728                BROWSER_LOG( ( _L( " iWindowManager->SetUserExit( iUserExit )" ) ) );
  1733                BROWSER_LOG( ( _L( " iWindowManager->SetUserExit( iUserExit )" ) ) );
  1729                iWindowManager->SetUserExit( iUserExit );
  1734                iWindowManager->SetUserExit( iUserExit );
  1730                }
       
  1731                delete iWindowManager;
  1735                delete iWindowManager;
  1732                BROWSER_LOG( ( _L( " User::Exit(KErrNone)" ) ) );
  1736                BROWSER_LOG( ( _L( " User::Exit(KErrNone)" ) ) );
  1733                User::Exit(KErrNone);
  1737                User::Exit(KErrNone);
  1734             }
  1738             }
  1735         else
  1739         else
  1753     		//notify feeds engine to close the connection
  1757     		//notify feeds engine to close the connection
  1754 			TRAP_IGNORE( iFeedsClientUtilities->DisconnectManualUpdateConnectionL() );
  1758 			TRAP_IGNORE( iFeedsClientUtilities->DisconnectManualUpdateConnectionL() );
  1755                 }
  1759                 }
  1756 #endif
  1760 #endif
  1757     		}
  1761     		}
  1758     	if (SpecialLoadObserver().IsConnectionStarted()) // If Connection request is in processing calling CAknAppUI::Exit() causes crash (JSAA-84RG9R)
  1762     	if (iStartedUp && SpecialLoadObserver().IsConnectionStarted()) // If Connection request is in processing calling CAknAppUI::Exit() causes crash (JSAA-84RG9R)
  1759     	    {                                               
  1763     	    {                                               
  1760     	    //ensure that the params are saved in BrCtl            
  1764     	    //ensure that the params are saved in BrCtl            
  1761     	    if ( iWindowManager ) 
  1765     	    if ( iWindowManager ) 
  1762     	       {
  1766     	       {
  1763     	       BROWSER_LOG( ( _L( " iWindowManager->SetUserExit( iUserExit )" ) ) );
  1767     	       BROWSER_LOG( ( _L( " iWindowManager->SetUserExit( iUserExit )" ) ) );
  2122     LOG_WRITE_FORMAT(" aCommand: %d", aCommand);
  2126     LOG_WRITE_FORMAT(" aCommand: %d", aCommand);
  2123 
  2127 
  2124     // The browser is in embedded mode and it is not initialized yet
  2128     // The browser is in embedded mode and it is not initialized yet
  2125     if ( IsEmbeddedModeOn() && !iStartedUp)
  2129     if ( IsEmbeddedModeOn() && !iStartedUp)
  2126     	{
  2130     	{
       
  2131         EnableLocalScreenClearer( EFalse );
  2127     	return EFalse;
  2132     	return EFalse;
  2128     	}
  2133     	}
  2129 
  2134 
  2130     if ( aCommand == EApaCommandOpen )
  2135     if ( aCommand == EApaCommandOpen )
  2131         {
  2136         {
  2148     	    else if ( iPreferences->SearchFeature() || iPreferences->ServiceFeature())
  2153     	    else if ( iPreferences->SearchFeature() || iPreferences->ServiceFeature())
  2149     	        {
  2154     	        {
  2150     	        
  2155     	        
  2151     	        HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength );  // cleanupstack
  2156     	        HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength );  // cleanupstack
  2152     	        TPtr ptr( buf->Des() );
  2157     	        TPtr ptr( buf->Des() );
  2153     	        
  2158     	        TInt pgFound( KErrNotFound );
       
  2159 				pgFound = Preferences().HomePageUrlL( ptr );
  2154     			HBufC* searchScheme = HBufC::NewLC( KMaxHomePgUrlLength );  // cleanupstack
  2160     			HBufC* searchScheme = HBufC::NewLC( KMaxHomePgUrlLength );  // cleanupstack
  2155     			TPtr searchSchemePtr( searchScheme->Des() );
  2161     			TPtr searchSchemePtr( searchScheme->Des() );
  2156     			
  2162     			
  2157     			HBufC* serviceScheme = HBufC::NewLC( KMaxHomePgUrlLength );  // cleanupstack
  2163     			HBufC* serviceScheme = HBufC::NewLC( KMaxHomePgUrlLength );  // cleanupstack
  2158     			TPtr serviceSchemePtr( serviceScheme->Des() );
  2164     			TPtr serviceSchemePtr( serviceScheme->Des() );
  2319                     FetchHomePageL();
  2325                     FetchHomePageL();
  2320                     }
  2326                     }
  2321                 else  
  2327                 else  
  2322                     {
  2328                     {
  2323                     if (iStartedUp)
  2329                     if (iStartedUp)
  2324                     ContentView()->SetFullScreenOffL();
  2330                         ContentView()->SetFullScreenOffL();
  2325 
  2331 
  2326                     if ( !IsEmbeddedModeOn() )
  2332                     if ( !IsEmbeddedModeOn() )
  2327                         {
  2333                         {
  2328                         SetLastActiveViewId( KUidBrowserBookmarksViewId );
  2334                         SetLastActiveViewId( KUidBrowserBookmarksViewId );
  2329                         }
  2335                         }
  2423                                     SetLastActiveViewId( KUidBrowserContentViewId );
  2429                                     SetLastActiveViewId( KUidBrowserContentViewId );
  2424                                     }
  2430                                     }
  2425                                 }                          
  2431                                 }                          
  2426                             else
  2432                             else
  2427                                 {
  2433                                 {
  2428                                 // Cancel history view, mini map, toolbar or any other active control on the current window 
  2434                                 // Cancel history view, mini map, toolbar or any other active control on the current window
  2429                                 BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase );
  2435                                 if (iStartedUp)
       
  2436                                     BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase );
  2430                                 TRAP( err, FetchL(  *url,
  2437                                 TRAP( err, FetchL(  *url,
  2431                                                             KNullDesC,
  2438                                                             KNullDesC,
  2432                                                             KNullDesC,
  2439                                                             KNullDesC,
  2433                                                             accessPoint,
  2440                                                             accessPoint,
  2434                                                             urlType ) );                                
  2441                                                             urlType ) );                                
  2486                                     CleanupStack::Pop();  // win
  2493                                     CleanupStack::Pop();  // win
  2487                                     }
  2494                                     }
  2488                             }
  2495                             }
  2489                             else
  2496                             else
  2490                                 {
  2497                                 {
  2491                                 // Cancel history view, mini map, toolbar or any other active control on the current window 
  2498                                 // Cancel history view, mini map, toolbar or any other active control on the current window
  2492                                 BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase );
  2499                                 if (iStartedUp)
       
  2500                                     BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase );
  2493                                 TRAP( err, FetchL(  *url,
  2501                                 TRAP( err, FetchL(  *url,
  2494                                                             KNullDesC,
  2502                                                             KNullDesC,
  2495                                                             KNullDesC,
  2503                                                             KNullDesC,
  2496                                                             accessPoint,
  2504                                                             accessPoint,
  2497                                                             urlType ) );
  2505                                                             urlType ) );
  2543     	                                CleanupStack::Pop();  // win                                
  2551     	                                CleanupStack::Pop();  // win                                
  2544     	                                }
  2552     	                                }
  2545 	                                }
  2553 	                                }
  2546 	                            else
  2554 	                            else
  2547 	                            	{
  2555 	                            	{
  2548     	                            // Cancel history view, mini map, toolbar or any other active control on the current window 
  2556     	                            // Cancel history view, mini map, toolbar or any other active control on the current window
  2549 	                                BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase );
  2557                                     if (iStartedUp)
       
  2558                                         BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase );
  2550 	                            	TRAP( err, FetchBookmarkL( dataId ) );
  2559 	                            	TRAP( err, FetchBookmarkL( dataId ) );
  2551 	                            	}    
  2560 	                            	}    
  2552 
  2561 
  2553                                 if ( err )
  2562                                 if ( err )
  2554                                     {
  2563                                     {
  3039 // CBrowserAppUi::ClearHistoryL
  3048 // CBrowserAppUi::ClearHistoryL
  3040 // ---------------------------------------------------------
  3049 // ---------------------------------------------------------
  3041 //
  3050 //
  3042 void CBrowserAppUi::ClearHistoryL()
  3051 void CBrowserAppUi::ClearHistoryL()
  3043     {
  3052     {
  3044 	if (iWindowManager)
  3053     if (iWindowManager)
  3045         {
  3054         {
  3046         iWindowManager->SendCommandToAllWindowsL(
  3055         iWindowManager->SendCommandToAllWindowsL(
  3047         (TInt)TBrCtlDefs::ECommandClearHistory + (TInt)TBrCtlDefs::ECommandIdBase);
  3056         (TInt)TBrCtlDefs::ECommandClearHistory + (TInt)TBrCtlDefs::ECommandIdBase);
  3048         }
       
  3049     else
       
  3050         {
       
  3051         BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandClearHistory +
       
  3052                                          (TInt)TBrCtlDefs::ECommandIdBase );
       
  3053 
       
  3054         }
  3057         }
  3055 
  3058 
  3056     if (!(Preferences().AdaptiveBookmarks()==EWmlSettingsAdaptiveBookmarksOff ))
  3059     if (!(Preferences().AdaptiveBookmarks()==EWmlSettingsAdaptiveBookmarksOff ))
  3057         {
  3060         {
  3058         // This call will ensure that the bookmarks are cleared when we are
  3061         // This call will ensure that the bookmarks are cleared when we are
  3287 		{
  3290 		{
  3288 		ExitBrowser(ETrue);
  3291 		ExitBrowser(ETrue);
  3289 		}
  3292 		}
  3290 	else
  3293 	else
  3291 		{
  3294 		{
  3292         if ( ContentView()->GetPreviousViewID() == KUidBrowserBookmarksViewId )
  3295         if ( iStartedUp && ContentView()->GetPreviousViewID() == KUidBrowserBookmarksViewId )
  3293             {
  3296             {
  3294             if ( GetBookmarksView()->GetAdaptiveBookmarksFolderWasActive() )
  3297             if ( GetBookmarksView()->GetAdaptiveBookmarksFolderWasActive() )
  3295                 {
  3298                 {
  3296                 GetBookmarksView()->OpenAdaptiveBookmarksWhenActivated();
  3299                 GetBookmarksView()->OpenAdaptiveBookmarksWhenActivated();
  3297                 }
  3300                 }
  3410 // --------------------------------------------------------------------------
  3413 // --------------------------------------------------------------------------
  3411 //
  3414 //
  3412 void CBrowserAppUi::FetchHomePageL()
  3415 void CBrowserAppUi::FetchHomePageL()
  3413     {
  3416     {
  3414 LOG_ENTERFN( "CBrowserAppUi::FetchHomePageL" );
  3417 LOG_ENTERFN( "CBrowserAppUi::FetchHomePageL" );
       
  3418     if(!iStartedUp) // just in case, not done
       
  3419         CompleteDelayedInit();
       
  3420     
  3415     if ( !Fetching() )
  3421     if ( !Fetching() )
  3416         {
  3422         {
  3417         UpdateSoftKeys();
  3423         UpdateSoftKeys();
  3418 
  3424 
  3419         // If the last active view is content view, return to the bookmark view on close.
  3425         // If the last active view is content view, return to the bookmark view on close.