browserui/browser/BrowserAppSrc/BrowserAppUi.cpp
branchRCL_3
changeset 45 5a044f6358c2
parent 43 b149f0820e5a
child 46 4baee4f15982
equal deleted inserted replaced
43:b149f0820e5a 45:5a044f6358c2
   160 iFeatureManager( EFalse ),
   160 iFeatureManager( EFalse ),
   161 iUserExit( EFalse ),
   161 iUserExit( EFalse ),
   162 iPgNotFound( EFalse ),
   162 iPgNotFound( EFalse ),
   163 iOverriddenLaunchContextId( EBrowserContextIdNormal ),
   163 iOverriddenLaunchContextId( EBrowserContextIdNormal ),
   164 iBrowserAlreadyRunning (EFalse),
   164 iBrowserAlreadyRunning (EFalse),
   165 iCalledFromExternApp( EFalse ),
   165 iSameWinApp( EFalse ),
   166 iFeedsClientUtilities( 0 )
   166 iFeedsClientUtilities( 0 )
   167     {
   167     {
   168     iViewToBeActivatedIfNeeded.iUid = 0;
   168     iViewToBeActivatedIfNeeded.iUid = 0;
   169     iViewToReturnOnClose.iUid = 0;
   169     iViewToReturnOnClose.iUid = 0;
   170 	}
   170 	}
   340 //
   340 //
   341 void CBrowserAppUi::CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates )
   341 void CBrowserAppUi::CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates )
   342     {
   342     {
   343     LOG_ENTERFN("CBrowserAppUi::CheckUpdatesComplete");
   343     LOG_ENTERFN("CBrowserAppUi::CheckUpdatesComplete");
   344     LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - Entry" );
   344     LOG_WRITE( "CBrowserAppUi::CheckUpdatesComplete - Entry" );
   345     TInt err;
   345 
   346     TBool result;
   346     TBool result = EFalse;
   347     TBool showDialog = EFalse;
   347     TBool showDialog = EFalse;
   348 
   348 
   349     if ( aErrorCode == KErrNone )
   349     if ( aErrorCode == KErrNone )
   350         {
   350         {
   351 		if ( aAvailableUpdates > 0 )
   351 		if ( aAvailableUpdates > 0 )
  2148     	    else if ( iPreferences->SearchFeature() || iPreferences->ServiceFeature())
  2148     	    else if ( iPreferences->SearchFeature() || iPreferences->ServiceFeature())
  2149     	        {
  2149     	        {
  2150     	        
  2150     	        
  2151     	        HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength );  // cleanupstack
  2151     	        HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength );  // cleanupstack
  2152     	        TPtr ptr( buf->Des() );
  2152     	        TPtr ptr( buf->Des() );
  2153     	        TInt pgFound( KErrNotFound );
       
  2154     	        pgFound = Preferences().HomePageUrlL( ptr );
       
  2155     	        
  2153     	        
  2156     			HBufC* searchScheme = HBufC::NewLC( KMaxHomePgUrlLength );  // cleanupstack
  2154     			HBufC* searchScheme = HBufC::NewLC( KMaxHomePgUrlLength );  // cleanupstack
  2157     			TPtr searchSchemePtr( searchScheme->Des() );
  2155     			TPtr searchSchemePtr( searchScheme->Des() );
  2158     			
  2156     			
  2159     			HBufC* serviceScheme = HBufC::NewLC( KMaxHomePgUrlLength );  // cleanupstack
  2157     			HBufC* serviceScheme = HBufC::NewLC( KMaxHomePgUrlLength );  // cleanupstack
  2458                                 BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase );
  2456                                 BrCtlInterface().HandleCommandL( TBrCtlDefs::ECommandCancel + TBrCtlDefs::ECommandIdBase );
  2459                                 // there is already a window, so create a new one
  2457                                 // there is already a window, so create a new one
  2460                                 CBrowserWindow *win = NULL; 
  2458                                 CBrowserWindow *win = NULL; 
  2461                                 if(WindowMgr().CurrentWindow()) 
  2459                                 if(WindowMgr().CurrentWindow()) 
  2462                                 {
  2460                                 {
  2463                                     if(iCalledFromExternApp)
  2461                                     if(iSameWinApp)
  2464                                     {
  2462                                     {
  2465                                         //We will be using same/already opened window if call is from external
  2463                                         //We will be using same/already opened window if call is from external
  2466                                         //application. So no new windows will be opened.
  2464                                         //application. So no new windows will be opened.
  2467                                         win = WindowMgr().CurrentWindow();
  2465                                         win = WindowMgr().CurrentWindow();
  2468                                         iWindowIdFromFromExternApp = win->WindowId();
  2466                                         iWindowIdFromFromExternApp = win->WindowId();
  3174     iBrowserAlreadyRunning = ETrue;
  3172     iBrowserAlreadyRunning = ETrue;
  3175     TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
  3173     TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
  3176     TUid wapUid = KUidBrowserApplication;
  3174     TUid wapUid = KUidBrowserApplication;
  3177     TApaTask task = taskList.FindApp( wapUid );
  3175     TApaTask task = taskList.FindApp( wapUid );
  3178     task.BringToForeground();
  3176     task.BringToForeground();
  3179     //Check for aMessageUid. If it is in array then set iCalledFromExternApp = ETrue
  3177     //Check for aMessageUid. If it is in array then set iSameWinApp = ETrue
  3180     TUid aAppId;
  3178     iSameWinApp = IsSameWinApp(aMessageUid); 
  3181     TRAPD(err, aAppId = FindAppIdL(aMessageUid););
       
  3182     if(!err && (aMessageUid == aAppId))
       
  3183     {
       
  3184         iCalledFromExternApp = ETrue;
       
  3185     }
       
  3186     if ( aMessageParameters.Compare( KLongZeroIdString ) )
  3179     if ( aMessageParameters.Compare( KLongZeroIdString ) )
  3187         {
  3180         {
  3188         ParseAndProcessParametersL( aMessageParameters );
  3181         ParseAndProcessParametersL( aMessageParameters );
  3189         }
  3182         }
  3190     return CAknViewAppUi::HandleMessageL(
  3183     return CAknViewAppUi::HandleMessageL(
  4094         }
  4087         }
  4095     //If this window has been created from Search app
  4088     //If this window has been created from Search app
  4096     if(aWindowId == iWindowIdFromFromExternApp)
  4089     if(aWindowId == iWindowIdFromFromExternApp)
  4097     {
  4090     {
  4098         //Make it false as window is going to close down
  4091         //Make it false as window is going to close down
  4099         iCalledFromExternApp = EFalse;
  4092         iSameWinApp = EFalse;
  4100     }
  4093     }
  4101 #ifdef __RSS_FEEDS
  4094 #ifdef __RSS_FEEDS
  4102 	// If we are closing a Feeds Full Story then go back to feeds
  4095 	// If we are closing a Feeds Full Story then go back to feeds
  4103 	TBool feedsWindow(EFalse);
  4096 	TBool feedsWindow(EFalse);
  4104 	CBrowserWindow* win;
  4097 	CBrowserWindow* win;
  4291      * (See OOMStopper and OOMHandler)
  4284      * (See OOMStopper and OOMHandler)
  4292      */
  4285      */
  4293 	if(aEventType == KAppOomMonitor_FreeRam )
  4286 	if(aEventType == KAppOomMonitor_FreeRam )
  4294 		{
  4287 		{
  4295 		iWindowManager->CloseAllWindowsExceptCurrent();
  4288 		iWindowManager->CloseAllWindowsExceptCurrent();
  4296 		// If we were really doing anything about this event, why do we not want to do it to the foreground?
       
  4297 		if(!iIsForeground)
       
  4298 		    {
       
  4299             BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandFreeMemory + (TInt)TBrCtlDefs::ECommandIdBase);
  4289             BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandFreeMemory + (TInt)TBrCtlDefs::ECommandIdBase);
  4300 		    }
  4290 		    }
  4301 		}
       
  4302 	else if(aEventType == KAppOomMonitor_MemoryGood)
  4291 	else if(aEventType == KAppOomMonitor_MemoryGood)
  4303 		{
  4292 		{
  4304         BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandMemoryGood + (TInt)TBrCtlDefs::ECommandIdBase);
  4293         BrCtlInterface().HandleCommandL( (TInt)TBrCtlDefs::ECommandMemoryGood + (TInt)TBrCtlDefs::ECommandIdBase);
  4305 		}
  4294 		}
  4306     else if ( KAknFullOrPartialForegroundGained == aEventType )
  4295     else if ( KAknFullOrPartialForegroundGained == aEventType )
  4715 // ---------------------------------------------------------
  4704 // ---------------------------------------------------------
  4716 // CBrowserAppUi::ReadUpdateFile
  4705 // CBrowserAppUi::ReadUpdateFile
  4717 // ---------------------------------------------------------
  4706 // ---------------------------------------------------------
  4718 TInt64 CBrowserAppUi::ReadUpdateFile()
  4707 TInt64 CBrowserAppUi::ReadUpdateFile()
  4719     {
  4708     {
  4720     TBool returnvalue = ETrue;
       
  4721     TBuf<KMaxFileName> privatePath;
  4709     TBuf<KMaxFileName> privatePath;
  4722     TBuf<KMaxFileName> updateFileName;
  4710     TBuf<KMaxFileName> updateFileName;
  4723     //Get the private path then append the filename
  4711     //Get the private path then append the filename
  4724     iFs.PrivatePath( privatePath );
  4712     iFs.PrivatePath( privatePath );
  4725     updateFileName.Copy( privatePath );
  4713     updateFileName.Copy( privatePath );
  4742         }        
  4730         }        
  4743     return dataValue;
  4731     return dataValue;
  4744     }
  4732     }
  4745 #endif
  4733 #endif
  4746 
  4734 
  4747 TUid CBrowserAppUi::FindAppIdL(TUid aMessageUid)
  4735 TBool CBrowserAppUi::IsSameWinApp(TUid aMessageUid)
  4748 {
  4736 {      
  4749     TUid aRetVal = TUid::Uid(NULL);
       
  4750     TInt nElements = sizeof(mArrayOfExternalAppUid)/sizeof(TInt);
  4737     TInt nElements = sizeof(mArrayOfExternalAppUid)/sizeof(TInt);
  4751     for(TInt nIndex = 0;nIndex < nElements; nIndex++)
  4738     for(TInt nIndex = 0;nIndex < nElements; nIndex++)
  4752     {
  4739     {
  4753         if(aMessageUid == TUid::Uid(mArrayOfExternalAppUid[nIndex]))
  4740         if(aMessageUid == TUid::Uid(mArrayOfExternalAppUid[nIndex]))
  4754         {
  4741         {
  4755             aRetVal = TUid::Uid(mArrayOfExternalAppUid[nIndex]);
  4742         return ETrue; 
  4756             break;
  4743         }
  4757         }
  4744     }
  4758     }
  4745     return EFalse;
  4759     return aRetVal;
       
  4760 }
  4746 }
  4761 // End of File
  4747 // End of File