browserui/browser/BrowserAppSrc/BrowserAppUi.cpp
branchRCL_3
changeset 56 3154c14a33db
parent 55 08ffbd51e3fd
child 58 aead3f7e1bb0
equal deleted inserted replaced
55:08ffbd51e3fd 56:3154c14a33db
   136 const TUint KBrowser8xUID = 0x200267CC;
   136 const TUint KBrowser8xUID = 0x200267CC;
   137 _LIT( KUpdateFileName, "lastupdatechecked.txt" );
   137 _LIT( KUpdateFileName, "lastupdatechecked.txt" );
   138 const TInt64 KMaxTimeToPostponeUpdate = 604800000000;
   138 const TInt64 KMaxTimeToPostponeUpdate = 604800000000;
   139 #endif
   139 #endif
   140 
   140 
       
   141 //Following array stores Uids for external applications. 
       
   142 //This can be appended. This is used in HandleMessageL to enable Single Window browsing.
       
   143 static TInt mArrayOfExternalAppUid[] = { 0x2001f3a9, 0x200159D0};
   141 // ================= MEMBER FUNCTIONS =======================
   144 // ================= MEMBER FUNCTIONS =======================
   142 
   145 
   143 // -----------------------------------------------------------------------------
   146 // -----------------------------------------------------------------------------
   144 // CBrowserAppUi::CBrowserAppUi()
   147 // CBrowserAppUi::CBrowserAppUi()
   145 // -----------------------------------------------------------------------------
   148 // -----------------------------------------------------------------------------
   156 iStartedUp( EFalse ),
   159 iStartedUp( EFalse ),
   157 iFeatureManager( EFalse ),
   160 iFeatureManager( EFalse ),
   158 iUserExit( EFalse ),
   161 iUserExit( EFalse ),
   159 iPgNotFound( EFalse ),
   162 iPgNotFound( EFalse ),
   160 iOverriddenLaunchContextId( EBrowserContextIdNormal ),
   163 iOverriddenLaunchContextId( EBrowserContextIdNormal ),
   161 iBrowserAlreadyRunning (EFalse)
   164 iBrowserAlreadyRunning (EFalse),
       
   165 iCalledFromExternApp( EFalse )
   162     {
   166     {
   163     iViewToBeActivatedIfNeeded.iUid = 0;
   167     iViewToBeActivatedIfNeeded.iUid = 0;
   164     iViewToReturnOnClose.iUid = 0;
   168     iViewToReturnOnClose.iUid = 0;
   165 	}
   169 	}
   166 
   170 
   209         {
   213         {
   210         iWindowManager->SetUserExit( iUserExit );
   214         iWindowManager->SetUserExit( iUserExit );
   211         }
   215         }
   212     delete iWindowManager;
   216     delete iWindowManager;
   213     LOG_WRITE( " iWindowManager deleted" );
   217     LOG_WRITE( " iWindowManager deleted" );
       
   218     
       
   219 #ifdef BRDO_OCC_ENABLED_FF    
       
   220     if(iRetryConnectivity)
       
   221     	iRetryConnectivity->Cancel();
       
   222     	
       
   223     delete iRetryConnectivity;
       
   224     iRetryConnectivity = NULL;
       
   225 #endif    
   214 
   226 
   215     // Delete the inetconman after deleting window manager
   227     // Delete the inetconman after deleting window manager
   216     CInternetConnectionManager* inetconman = (CInternetConnectionManager*)iConnection;
   228     CInternetConnectionManager* inetconman = (CInternetConnectionManager*)iConnection;
   217     delete inetconman;
   229     delete inetconman;
   218     LOG_WRITE( " inetconman deleted" );
   230     LOG_WRITE( " inetconman deleted" );
  1684     		TRAP_IGNORE( iFeedsClientUtilities->DisconnectFeedsViewL() );
  1696     		TRAP_IGNORE( iFeedsClientUtilities->DisconnectFeedsViewL() );
  1685     		//notify feeds engine to close the connection
  1697     		//notify feeds engine to close the connection
  1686 			TRAP_IGNORE( iFeedsClientUtilities->DisconnectManualUpdateConnectionL() );
  1698 			TRAP_IGNORE( iFeedsClientUtilities->DisconnectManualUpdateConnectionL() );
  1687 #endif
  1699 #endif
  1688     		}
  1700     		}
  1689         Exit();
  1701     	if (SpecialLoadObserver().IsConnectionStarted()) // If Connection request is in processing calling CAknAppUI::Exit() causes crash (JSAA-84RG9R)
       
  1702     	    {                                               
       
  1703     	    //ensure that the params are saved in BrCtl            
       
  1704     	    if ( iWindowManager ) 
       
  1705     	       {
       
  1706     	       BROWSER_LOG( ( _L( " iWindowManager->SetUserExit( iUserExit )" ) ) );
       
  1707     	       iWindowManager->SetUserExit( iUserExit );
       
  1708     	       }
       
  1709     	       delete iWindowManager;
       
  1710     	       BROWSER_LOG( ( _L( " User::Exit(KErrNone)" ) ) );
       
  1711     	       User::Exit(KErrNone);                      
       
  1712     	     }
       
  1713         else
       
  1714     	     {      
       
  1715     	     // normal exit
       
  1716              Exit();
       
  1717     	     }
  1690     	}
  1718     	}
  1691     }
  1719     }
  1692 
  1720 
  1693 // -----------------------------------------------------------------------------
  1721 // -----------------------------------------------------------------------------
  1694 // CBrowserAppUi::Display
  1722 // CBrowserAppUi::Display
  1790 // CBrowserAppUi::PopupEngine
  1818 // CBrowserAppUi::PopupEngine
  1791 // -----------------------------------------------------------------------------
  1819 // -----------------------------------------------------------------------------
  1792 //
  1820 //
  1793 CBrowserPopupEngine& CBrowserAppUi::PopupEngine() const
  1821 CBrowserPopupEngine& CBrowserAppUi::PopupEngine() const
  1794     {
  1822     {
       
  1823     LOG_ENTERFN("CBrowserAppUi::PopupEngine");
  1795     if(!iPopupEngine)
  1824     if(!iPopupEngine)
  1796         { 
  1825         { 
  1797             if ( Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) )
  1826             if ( Preferences().UiLocalFeatureSupported( KBrowserMultipleWindows ) )
  1798                 {
  1827                 {
  1799                     iPopupEngine = CBrowserPopupEngine::NewL();
  1828                     iPopupEngine = CBrowserPopupEngine::NewL();
  2361                                 // Cancel history view, mini map, toolbar or any other active control on the current window 
  2390                                 // Cancel history view, mini map, toolbar or any other active control on the current window 
  2362                                 BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase );
  2391                                 BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase );
  2363                                 // there is already a window, so create a new one
  2392                                 // there is already a window, so create a new one
  2364                                 CBrowserWindow *win = NULL; 
  2393                                 CBrowserWindow *win = NULL; 
  2365                                 if(WindowMgr().CurrentWindow()) 
  2394                                 if(WindowMgr().CurrentWindow()) 
  2366                                     win = WindowMgr().CreateWindowL( (WindowMgr().CurrentWindow()->WindowId()) ? WindowMgr().CurrentWindow()->WindowId() : 0, &KNullDesC );
  2395                                 {
       
  2396                                     if(iCalledFromExternApp)
       
  2397                                     {
       
  2398                                         //We will be using same/already opened window if call is from external
       
  2399                                         //application. So no new windows will be opened.
       
  2400                                         win = WindowMgr().CurrentWindow();
       
  2401                                         iWindowIdFromFromExternApp = win->WindowId();
       
  2402                                     }
       
  2403                                     if(!win)
       
  2404                                     {
       
  2405                                         //If not called from external app, then create window.
       
  2406                                         win = WindowMgr().CreateWindowL( (WindowMgr().CurrentWindow()->WindowId()) ? WindowMgr().CurrentWindow()->WindowId() : 0, &KNullDesC );
       
  2407                                     }
       
  2408                                 }
  2367                                 else
  2409                                 else
  2368                                     win = WindowMgr().CreateWindowL( 0, &KNullDesC );
  2410                                     win = WindowMgr().CreateWindowL( 0, &KNullDesC );
  2369                                 if (win != NULL)
  2411                                 if (win != NULL)
  2370                                     {
  2412                                     {
  2371                                         
  2413                                         
  2690         iDialogsProvider->CancelAll(); //connection has been lost, so cancel the authentication dialog.
  2732         iDialogsProvider->CancelAll(); //connection has been lost, so cancel the authentication dialog.
  2691         }
  2733         }
  2692     
  2734     
  2693     return err;
  2735     return err;
  2694     }
  2736     }
       
  2737 
       
  2738 void CBrowserAppUi::CheckOccConnectionStage()
       
  2739     {
       
  2740     LOG_ENTERFN("CBrowserAppUi::CheckOccConnectionStage");
       
  2741     
       
  2742     //Disconnect first
       
  2743     BROWSER_LOG( ( _L( "CBrowserAppUi::CheckOccConnectionStage Disconnecting..." ) ) );
       
  2744     iConnection->Disconnect();
       
  2745     
       
  2746     TNifProgressBuf buf = iConnStageNotifier->GetProgressBuffer();
       
  2747     if( buf().iError == KErrDisconnected )
       
  2748         {
       
  2749         BROWSER_LOG( ( _L("CBrowserAppUi::CheckOccConnectionStage This is OCC roaming error : %d"), buf().iError ) );
       
  2750         BROWSER_LOG( ( _L( "CBrowserAppUi::CheckOccConnectionStage Set retry flags " ) ) );
       
  2751         TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) );
       
  2752         SetRetryFlag(ETrue);    
       
  2753         TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelQueuedTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) );
       
  2754         
       
  2755         if( iRetryConnectivity && iRetryConnectivity->IsActive())
       
  2756             {
       
  2757             iRetryConnectivity->Cancel();
       
  2758             }
       
  2759         iRetryConnectivity->Start(KRetryConnectivityTimeout, 0,TCallBack(RetryConnectivity,this));
       
  2760         }
       
  2761     else
       
  2762         {
       
  2763         BROWSER_LOG( ( _L("CBrowserAppUi::CheckOccConnectionStage This is NOT OCC roaming error : %d"), buf().iError ) );
       
  2764         Display().StopProgressAnimationL();
       
  2765         if ( Fetching() )
       
  2766             {
       
  2767             CancelFetch();
       
  2768             }
       
  2769         iDialogsProvider->UploadProgressNoteL(0, 0, ETrue, (MBrowserDialogsProviderObserver *)this );
       
  2770         iDialogsProvider->CancelAll();
       
  2771         }  
       
  2772     }
  2695 #endif
  2773 #endif
  2696 
  2774 
  2697 // -----------------------------------------------------------------------------
  2775 // -----------------------------------------------------------------------------
  2698 // CBrowserAppUi::ConnectionStageAchievedL()
  2776 // CBrowserAppUi::ConnectionStageAchievedL()
  2699 // -----------------------------------------------------------------------------
  2777 // -----------------------------------------------------------------------------
  2700 //
  2778 //
  2701 void CBrowserAppUi::ConnectionStageAchievedL()
  2779 void CBrowserAppUi::ConnectionStageAchievedL()
  2702     {
  2780     {
  2703 #ifdef BRDO_OCC_ENABLED_FF
  2781 #ifdef BRDO_OCC_ENABLED_FF
  2704     LOG_ENTERFN("CBrowserAppUi::ConnectionStageAchievedL");
  2782     LOG_ENTERFN("CBrowserAppUi::ConnectionStageAchievedL");
  2705     //Disconnect first
  2783     CheckOccConnectionStage();
  2706     BROWSER_LOG( ( _L( "CBrowserAppUi::ConnectionStageAchievedL Disconnecting..." ) ) );
       
  2707     iConnection->Disconnect();
       
  2708 
       
  2709     BROWSER_LOG( ( _L( "CBrowserAppUi::ConnectionStageAchievedL Some transactions are on-going. Need to reconnect. " ) ) );
       
  2710     BROWSER_LOG( ( _L( "CBrowserAppUi::ConnectionStageAchievedL Set retry flags " ) ) );
       
  2711     TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandSetRetryConnectivityFlag + (TInt)TBrCtlDefs::ECommandIdBase ) );
       
  2712     SetRetryFlag(ETrue);    
       
  2713     TRAP_IGNORE( BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandCancelQueuedTransactions + (TInt)TBrCtlDefs::ECommandIdBase ) );
       
  2714     
       
  2715     if( iRetryConnectivity && iRetryConnectivity->IsActive())
       
  2716        {
       
  2717        iRetryConnectivity->Cancel();
       
  2718        }
       
  2719     iRetryConnectivity->Start(KRetryConnectivityTimeout, 0,TCallBack(RetryConnectivity,this));
       
  2720 
       
  2721 #else
  2784 #else
  2722     // this function is called only when network is lost
  2785     // this function is called only when network is lost
  2723     // because we set notifier for KAgentUnconnected only
  2786     // because we set notifier for KAgentUnconnected only
  2724     Display().StopProgressAnimationL();
  2787     Display().StopProgressAnimationL();
  2725 	if ( Fetching() )
  2788 	if ( Fetching() )
  3039     iBrowserAlreadyRunning = ETrue;
  3102     iBrowserAlreadyRunning = ETrue;
  3040     TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
  3103     TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
  3041     TUid wapUid = KUidBrowserApplication;
  3104     TUid wapUid = KUidBrowserApplication;
  3042     TApaTask task = taskList.FindApp( wapUid );
  3105     TApaTask task = taskList.FindApp( wapUid );
  3043     task.BringToForeground();
  3106     task.BringToForeground();
       
  3107     //Check for aMessageUid. If it is in array then set iCalledFromExternApp = ETrue
       
  3108     TUid aAppId;
       
  3109     TRAPD(err, aAppId = FindAppIdL(aMessageUid););
       
  3110     if(!err && (aMessageUid == aAppId))
       
  3111     {
       
  3112         iCalledFromExternApp = ETrue;
       
  3113     }
  3044     if ( aMessageParameters.Compare( KLongZeroIdString ) )
  3114     if ( aMessageParameters.Compare( KLongZeroIdString ) )
  3045         {
  3115         {
  3046         ParseAndProcessParametersL( aMessageParameters );
  3116         ParseAndProcessParametersL( aMessageParameters );
  3047         }
  3117         }
  3048     return CAknViewAppUi::HandleMessageL(
  3118     return CAknViewAppUi::HandleMessageL(
  3948         aWindowId = WindowMgr().CurrentWindow()->WindowId();
  4018         aWindowId = WindowMgr().CurrentWindow()->WindowId();
  3949         // scripts directly pass a real windowId,
  4019         // scripts directly pass a real windowId,
  3950         // so if user initiated the process, we really delete the window
  4020         // so if user initiated the process, we really delete the window
  3951         forceDelete = ETrue;
  4021         forceDelete = ETrue;
  3952         }
  4022         }
  3953 
  4023     //If this window has been created from Search app
       
  4024     if(aWindowId == iWindowIdFromFromExternApp)
       
  4025     {
       
  4026         //Make it false as window is going to close down
       
  4027         iCalledFromExternApp = EFalse;
       
  4028     }
  3954 #ifdef __RSS_FEEDS
  4029 #ifdef __RSS_FEEDS
  3955 	// If we are closing a Feeds Full Story then go back to feeds
  4030 	// If we are closing a Feeds Full Story then go back to feeds
  3956 	TBool feedsWindow(EFalse);
  4031 	TBool feedsWindow(EFalse);
  3957 	CBrowserWindow* win;
  4032 	CBrowserWindow* win;
  3958 	TInt err = WindowMgr().Window(aWindowId, win);
  4033 	TInt err = WindowMgr().Window(aWindowId, win);
  4489 // ---------------------------------------------------------
  4564 // ---------------------------------------------------------
  4490 // CBrowserAppUi::CheckUpdateFileAvailable
  4565 // CBrowserAppUi::CheckUpdateFileAvailable
  4491 // ---------------------------------------------------------
  4566 // ---------------------------------------------------------
  4492 TBool CBrowserAppUi::CheckUpdateFileAvailable()
  4567 TBool CBrowserAppUi::CheckUpdateFileAvailable()
  4493     {
  4568     {
       
  4569     LOG_ENTERFN("CBrowserAppUi::CheckUpdateFileAvailable");
  4494     TBuf<KMaxFileName> privatePath;
  4570     TBuf<KMaxFileName> privatePath;
  4495     TBuf<KMaxFileName> updateFileName;
  4571     TBuf<KMaxFileName> updateFileName;
  4496     iFs.PrivatePath( privatePath );
  4572     iFs.PrivatePath( privatePath );
  4497     updateFileName.Copy( privatePath );
  4573     updateFileName.Copy( privatePath );
  4498     updateFileName.Append( KUpdateFileName );
  4574     updateFileName.Append( KUpdateFileName );
  4514 // ---------------------------------------------------------
  4590 // ---------------------------------------------------------
  4515 // CBrowserAppUi::WriteUpdateFile
  4591 // CBrowserAppUi::WriteUpdateFile
  4516 // ---------------------------------------------------------
  4592 // ---------------------------------------------------------
  4517 void CBrowserAppUi::WriteUpdateFile()
  4593 void CBrowserAppUi::WriteUpdateFile()
  4518     {
  4594     {
       
  4595     LOG_ENTERFN("CBrowserAppUi::WriteUpdateFile");
  4519     TBuf<KMaxFileName> privatePath;
  4596     TBuf<KMaxFileName> privatePath;
  4520     TBuf<KMaxFileName> updateFileName;
  4597     TBuf<KMaxFileName> updateFileName;
  4521     iFs.PrivatePath( privatePath );
  4598     iFs.PrivatePath( privatePath );
  4522     updateFileName.Copy( privatePath );
  4599     updateFileName.Copy( privatePath );
  4523     updateFileName.Append( KUpdateFileName );
  4600     updateFileName.Append( KUpdateFileName );
  4581             }
  4658             }
  4582         }        
  4659         }        
  4583     return dataValue;
  4660     return dataValue;
  4584     }
  4661     }
  4585 #endif
  4662 #endif
       
  4663 
       
  4664 TUid CBrowserAppUi::FindAppIdL(TUid aMessageUid)
       
  4665 {
       
  4666     TUid aRetVal = TUid::Uid(NULL);
       
  4667     TInt nElements = sizeof(mArrayOfExternalAppUid)/sizeof(TInt);
       
  4668     for(TInt nIndex = 0;nIndex < nElements; nIndex++)
       
  4669     {
       
  4670         if(aMessageUid == TUid::Uid(mArrayOfExternalAppUid[nIndex]))
       
  4671         {
       
  4672             aRetVal = TUid::Uid(mArrayOfExternalAppUid[nIndex]);
       
  4673             break;
       
  4674         }
       
  4675     }
       
  4676     return aRetVal;
       
  4677 }
  4586 // End of File
  4678 // End of File