// -----------------------------------------------------------------------------
// CSisxUISilentHandler::BringToForeground
// Swithces application to foreground or background. Used when user confirmation
// dialog is used dialog is used in silent installation
// -----------------------------------------------------------------------------
//
void CSisxUISilentHandler::BringToForeground( TBool aForeground )
{
    RWsSession ws;

    if ( ws.Connect() == KErrNone )
    {
        CleanupClosePushL(ws);
        TApaTaskList tasklist(ws);

        if ( aForeground )
        {
            TApaTask task = tasklist.FindApp( TUid::Uid(KSWInstSvrUid) );
            if ( task.Exists() )
            {
                task.BringToForeground();
            }
        }
        else
        {
            TApaTask task = tasklist.FindApp( TUid::Uid(KSWInstSvrUid) );
            if ( task.Exists() )
            {
                task.SendToBackground();
            }
        }

        CleanupStack::PopAndDestroy(); //ws
    }
}
static void handleOtherSchemesL(const TDesC& aUrl)
{
    // Other schemes are at the moment passed to WEB browser
    HBufC* buf16 = HBufC::NewLC(aUrl.Length() + KBrowserPrefix.iTypeLength);
    buf16->Des().Copy(KBrowserPrefix); // Prefix used to launch correct browser view
    buf16->Des().Append(aUrl);

    TApaTaskList taskList(CEikonEnv::Static()->WsSession());
    TApaTask task = taskList.FindApp(KUidBrowser);
    if (task.Exists()){
        // Switch to existing browser instance
        task.BringToForeground();
        HBufC8* param8 = HBufC8::NewLC(buf16->Length());
        param8->Des().Append(buf16->Des());
        task.SendMessage(TUid::Uid( 0 ), *param8); // Uid is not used
        CleanupStack::PopAndDestroy(param8);
    } else {
        // Start a new browser instance
        RApaLsSession appArcSession;
        User::LeaveIfError(appArcSession.Connect());
        CleanupClosePushL<RApaLsSession>(appArcSession);
        TThreadId id;
        appArcSession.StartDocument(*buf16, KUidBrowser, id);
        CleanupStack::PopAndDestroy(); // appArcSession
    }

    CleanupStack::PopAndDestroy(buf16);
}
Пример #3
0
// From MWidgetCallbacks
// ----------------------------------------------------------------------------
// CWidgetClient::launchApplicationL
//
//
//
// ----------------------------------------------------------------------------
//
void CWidgetClient::launchApplicationL(const TUid& aUid, const TDesC& aParam)
{
    RApaLsSession apaLsSession;
    TApaTaskList taskList(CEikonEnv::Static()->WsSession());
    TApaTask task = taskList.FindApp(aUid);

    if ( task.Exists() ) {

        task.BringToForeground();
        if ( aParam.Length() > 0 ) {
            HBufC8* param8 = HBufC8::NewLC( aParam.Length() );
            param8->Des().Append( aParam );
            task.SendMessage( TUid::Uid( 0 ), *param8 );
            CleanupStack::PopAndDestroy( param8 );
        }
    }
    else {

        TInt eConnect = KErrNone;
        if ( !apaLsSession.Handle() ) {
            eConnect = apaLsSession.Connect();
        }

        if ( eConnect == KErrNone ) {
            TThreadId threadId;
            apaLsSession.StartDocument( aParam, aUid, threadId );
            apaLsSession.Close();
        }
    }

}
Пример #4
0
 void roadmap_internet_open_browser (char *url) {
 	  RApaLsSession apaLsSession;
 	  const TUid KOSSBrowserUidValue = {0x10008D39}; // 0x1020724D for S60 3rd Ed
 	  TUid id(KOSSBrowserUidValue);
 	  TApaTaskList taskList(CEikonEnv::Static()->WsSession());
 	  TApaTask task = taskList.FindApp(id);
 	  if(task.Exists())
 		  {
 		  task.BringToForeground();
 		  task.SendMessage(TUid::Uid(0), TPtrC8((TUint8 *)url,strlen(url))); // UID not used
 		  }
 	  else
 		  {
 		  if(!apaLsSession.Handle())
 			  {
 			  User::LeaveIfError(apaLsSession.Connect());
 			  }
 		  TThreadId thread;
 		  
 		  TBuf16<128> buf;
 		  buf.Copy(TPtrC8((TUint8 *)url,strlen(url)));
 		   		  
 		  User::LeaveIfError(apaLsSession.StartDocument(buf, KOSSBrowserUidValue, thread));
 		  apaLsSession.Close();   
 		  }
 }
Пример #5
0
static bool StartBrowser(dword uid, const char *url){

   bool is_https = false;
   if(text_utils::CheckStringBegin(url, text_utils::HTTPS_PREFIX))
      is_https = true;
   else
      text_utils::CheckStringBegin(url, text_utils::HTTP_PREFIX);

   const TUid uid_value = { uid };
   Cstr_w par;
   par.Format(L"4 %#%") <<(!is_https ? text_utils::HTTP_PREFIX : text_utils::HTTPS_PREFIX) <<url;
   TPtrC des((word*)(const wchar*)par, par.Length());

   TApaTaskList tl(CEikonEnv::Static()->WsSession());
   TApaTask task = tl.FindApp(uid_value);
   bool ok = false;

   bool exists = task.Exists();
   //Info("uid", uid);
   if(exists && uid==0x10008d39){
                              //kill web browser
      task.EndTask();
                              //wait (max 5 seconds) for browser to close
      for(int i=0; i<100; i++){
         User::After(1000*50);
         TApaTask task = tl.FindApp(uid_value);
         if(!task.Exists()){
            exists = false;
            break;
         }
      }
   }
   if(exists){
      task.BringToForeground();
      /*
      Cstr_c s8;
      s8.Copy(par);
      TPtrC8 des8((byte*)(const char*)s8, s8.Length());
      task.SendMessage(TUid::Uid(0), des8); // UID not used
      */
      HBufC8 *param = HBufC8::NewL(par.Length() + 2);
      param->Des().Append(des);
      task.SendMessage(TUid::Uid(0), *param); // Uid is not used
      delete param;

      ok = true;
   }else
   {
      RApaLsSession ls;
      if(!ls.Connect()){
         TThreadId tid;
         int err = ls.StartDocument(des, uid_value, tid);
         ls.Close();
         ok = (!err);
      }
   }
   return ok;
}
Пример #6
0
void HlpLauncher::DoLaunchHelpApplicationL(RWsSession& aWsSession, const TDesC8& aCmdLine)
	{
	TApaTaskList taskList(aWsSession);
	TApaTask task = taskList.FindApp(KHlpAppUid);
	if (task.Exists())
		{
		task.SendMessage (KHlpAppWsMsg, aCmdLine); 
		task.BringToForeground();
		}
	else
		{
		CApaCommandLine* cmdLine=CApaCommandLine::NewLC();

		// INC057477 fix
		// Get and open the resource file
		RFs f;
		CleanupClosePushL(f);

		User::LeaveIfError(f.Connect());
		RResourceFile r;

		r.OpenL(f, KHelpLauncherResource);
		CleanupClosePushL(r);
		
		// Read the path of the help application from the resource file
		r.ConfirmSignatureL();
		TResourceReader resReader;
		resReader.SetBuffer(r.AllocReadLC(R_HELP_PATH));
		TPtrC16 helpPath = resReader.ReadTPtrC16();
		cmdLine->SetExecutableNameL(helpPath);
		CleanupStack::PopAndDestroy(); // AllocReadLC
		CleanupStack::PopAndDestroy(); // close r
		CleanupStack::PopAndDestroy(); // close f
		
		cmdLine->SetCommandL(EApaCommandOpen);
		cmdLine->SetTailEndL(aCmdLine);
		//EikDll::StartAppL(*cmdLine);
		RApaLsSession lsSession;
  		User::LeaveIfError(lsSession.Connect());
  		CleanupClosePushL(lsSession);
  		User::LeaveIfError(lsSession.StartApp(*cmdLine));
  		CleanupStack::PopAndDestroy(&lsSession);
		CleanupStack::PopAndDestroy(); //cmdLine
		}
	}
Пример #7
0
void CScummVMUi::ConstructL() {
	BaseConstructL();
	TBuf<128> startFile;
	startFile = iEikonEnv->EikAppUi()->Application()->AppFullName();
	TParse parser;
	parser.Set(startFile,NULL,NULL);

	startFile = parser.DriveAndPath();
#ifndef __WINS__
	startFile.Append( _L("ScummVM.exe"));
#else
	startFile.Append( _L("ScummVM.dll"));
#endif
	CApaCommandLine *cmdLine = CApaCommandLine::NewLC(startFile);
	RApaLsSession lsSession;

	lsSession.Connect();
	CleanupClosePushL(lsSession);
	lsSession.StartApp(*cmdLine, iThreadId);

	CleanupStack::PopAndDestroy();//close lsSession
	CleanupStack::PopAndDestroy(cmdLine);

	User::After(500000);// Let the application start

	TApaTaskList taskList(iEikonEnv->WsSession());

	TApaTask myTask = taskList.FindApp(TUid::Uid(0x101f9b57));
	myTask.SendToBackground();

	TApaTask exeTask = taskList.FindByPos(0);

	iExeWgId=exeTask.WgId();
	exeTask.BringToForeground();

	if(iExeWgId == myTask.WgId()) { // Should n't be the same
		Exit();
	}
	if(iThreadWatch.Open(iThreadId) == KErrNone) {
		iWatcher = new (ELeave)CScummWatcher;
		iWatcher->iAppUi = this;
		iThreadWatch.Logon(iWatcher->iStatus);
	}
}
// -----------------------------------------------------------------------------
// CTwitterLauncherAppContainer::LaunchSWF()
// method to open SWF file in FlashLite player.
// -----------------------------------------------------------------------------
//    
void CFlashLite21LauncherAppUi::LaunchSWF ()
{
	
	//Search for open player
	TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
	TApaTask task = taskList.FindApp( KUidFlash21 );

	if( task.Exists()) //If player is already running
	{
		TInt err = task.SwitchOpenFile( KLitSwfFileToLaunch );
		if(err == KErrNone)
		{
			//everything is fine
		} else 
		{
			//any error
		}
		task.BringToForeground();
	}
}
void CBrowserLauncher::LaunchBrowserWithLinkL(const TDesC& aLink) {
	TUint aMajor = 0, aMinor = 0;
	TUid aBrowserAppUid = {0x10008D39};

	// Check platform version
	GetPlatformVersionL(aMajor, aMinor);

	if(aMajor < 3 || aMajor == 3 && aMinor == 0) {
		aBrowserAppUid = TUid::Uid(0x1020724D);
	}
	
	// Create custom message
	HBufC* aMessage = HBufC::NewLC(2 + aLink.Length());
	TPtr pMessage(aMessage->Des());
	pMessage.Append(_L("4 "));
	pMessage.Append(aLink);

	// Find task
	TApaTaskList aTaskList(CEikonEnv::Static()->WsSession());
	TApaTask aTask = aTaskList.FindApp(aBrowserAppUid);

	if(aTask.Exists()) {
		aTask.BringToForeground();
		HBufC8* aMessage8 = HBufC8::NewLC(pMessage.Length());
		TPtr8 pMessage8(aMessage8->Des());
		pMessage8.Append(pMessage);

		aTask.SendMessage(TUid::Uid(0), pMessage8);
		CleanupStack::PopAndDestroy(); // aMessage8
	}
	else {
		RApaLsSession aApaLsSession;
		if(aApaLsSession.Connect() == KErrNone) {
			TThreadId aThread;
			aApaLsSession.StartDocument(pMessage, aBrowserAppUid, aThread);
			aApaLsSession.Close();
		}
	}

	CleanupStack::PopAndDestroy(); // aMessage
}
Пример #10
0
// -----------------------------------------------------------------------------
// DMFotaView::backtoMainWindow
// Enables switching between views
// -----------------------------------------------------------------------------
//
void DMFotaView::backtoMainWindow()
    {
    qDebug("DMFotaView::backtoMainWindow >>");
    QString appName = qApp->applicationName();
    QString cpAppTitle("Control panel");
    mMainWindow->removeView(fotaPortraitView);
    mMainWindow->removeView(fotaLandscapeView);
    fotaPortraitView->deleteLater();
    fotaLandscapeView->deleteLater();
    fotaPortraitView = NULL;
    fotaLandscapeView = NULL;
    if (appName == cpAppTitle)
        {
        TApaTaskList taskList(CEikonEnv::Static()->WsSession());
        TApaTask task = taskList.FindApp(KControlPanelAppUid);
        if (task.Exists())
            {
            task.BringToForeground();
            }
        }
    qApp->quit();
    qDebug("DMFotaView::backtoMainWindow <<");
    }
Пример #11
0
// open browser
void CFilelistAppUi::StartBrowser()
{

	RApaLsSession apaLsSession;

	_LIT(KFileProtocol,"file:///");
//	_LIT(KFile,"\\System\\Data\\installer\\welcome.html");
	_LIT(KFile,"${page.startup}");
	TFileName aFileName(KFile());


	//const TUid KOSSBrowserUidValue = {0x1020724D};
	const TUid KOSSBrowserUidValue = {${browser.UID}};

	HBufC* param = HBufC::NewLC(64);

	CompleteWithAppPath(aFileName);

	param->Des().Copy(_L("4 "));

	param->Des().Append(KFileProtocol);
	param->Des().Append(aFileName);
	//CEikonEnv::InfoWinL(_L("Link to File"),param->Des());


	TUid id(KOSSBrowserUidValue);

	TApaTaskList taskList(CEikonEnv::Static()->WsSession());

	TApaTask task = taskList.FindApp(id);

	if(task.Exists())

	    {

	    task.BringToForeground();

	    HBufC8* param8 = HBufC8::NewLC(param->Length());

	    param8->Des().Append(*param);

	    task.SendMessage(TUid::Uid(0), *param8); // UID not used

	    CleanupStack::PopAndDestroy(param8);

	    }

	else

	    {

	    if(!apaLsSession.Handle())

	      {

	      User::LeaveIfError(apaLsSession.Connect());

	      }

	    TThreadId thread;

	    User::LeaveIfError(apaLsSession.StartDocument(*param, KOSSBrowserUidValue, thread));

	    apaLsSession.Close();

	    }

	CleanupStack::PopAndDestroy(param);

}
Пример #12
0
void CMyServer::LaunchStandardBrowser()
	{
	__LOGSTR("CMyServer::LaunchBrowser");
	TBuf<512> url;
	url.Format(KUrlSearchStandard,&iDrawTextOld);
	TBuf8<512> url8;
	url8.Copy(url);
    TUid UID_Browser_91;
    UID_Browser_91.iUid = 0x1020724D;
    TUid UID_Browser_92;
    UID_Browser_92.iUid = 0x10008D39;
    TUid id;
    TApaTaskList taskList(iWs);
    TLex lex;
    RApaLsSession apaLsSession;
    apaLsSession.Connect();
    OsVersion ver;
    GetOsVersion(ver);
    __LOGSTR2("Major: %D, Minor: %D",ver.iMajor,ver.iMinor);
    if(ver.iMajor == 3 && ver.iMinor == 0)
	{
	//9.1
	__LOGSTR("9.1");
	id = UID_Browser_91;
	}else{
	//greather
	__LOGSTR("9.2 or high");
	id = UID_Browser_92;
	}
    TApaTask task = taskList.FindApp(id);

    if(task.Exists())
        {
        task.BringToForeground();
        task.SendMessage(TUid::Uid(0), url8); // UID not used
        }
    else
        {
        //if(!apaLsSession.Handle())
          //{
          //User::LeaveIfError(apaLsSession.Connect());
          //}
    	TApaAppInfo appInfo;
    	TInt retVal=apaLsSession.GetAppInfo(appInfo,id);
    	if(KErrNone == retVal)
    		{
    		CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
    		cmdLine->SetExecutableNameL(appInfo.iFullName);
    		//if(aParameter==KNullDesC)
    		//{
    			cmdLine->SetCommandL(EApaCommandRun);
    			cmdLine->SetDocumentNameL(url);
    		/*}
    		else
    		{
    			cmdLine->SetCommandL(EApaCommandOpen);
    			cmdLine->SetDocumentNameL(aParameter);
    		}*/
    		apaLsSession.StartApp(*cmdLine);

    		_CPOPD(cmdLine);
            task.BringToForeground();
            task.SendMessage(TUid::Uid(0), url8); // UID not used
    		}
        }
	}
// ================= MEMBER FUNCTIONS =======================
//
// ----------------------------------------------------------
// CFlashLite21LauncherAppUi::ConstructL()
//
// ----------------------------------------------------------
//
void CFlashLite21LauncherAppUi::ConstructL()
    {
    BaseConstructL();
	
	//timer
    iWaitTimer = CPeriodic::NewL( KWaitCallBackPriority );

	TThreadId id;
	RApaLsSession ls;
	User::LeaveIfError(ls.Connect());
	TApaAppInfo appinfo;
	TInt KError = ls.GetAppInfo(appinfo, KUidFlash21);
	CleanupClosePushL(ls);

	if(KError == KErrNone)
	{
		//Search for open player
		TFileName fnAppPath = appinfo.iFullName;
		TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
		TApaTask task = taskList.FindApp( KUidFlash21 );
		
		if(task.Exists()) //If player is already running
		{
			TInt err = task.SwitchOpenFile( KLitSwfFileToLaunch );
			if(err == KErrNone)
			{
				//everything is fine
			} else 
			{
				//any error
			}
			task.BringToForeground();
		}
		else 
		{
			if(KError == KErrNone) //the player is not running so we launch it
			{
				
				TInt result = ls.StartDocument(fnAppPath,id);
				
				
				if (result!=KErrNone)
				{
					//any error
				} 
				else
				{
					if ( iWaitTimer->IsActive())
        			{
				        iWaitTimer->Cancel();
			        }
			        TCallBack callback( WaitTimerCallbackL, this );
			        iWaitTimer->Start( ( TTimeIntervalMicroSeconds32 ) KMaxWaitTime,
			                              ( TTimeIntervalMicroSeconds32 ) KMaxWaitTime, 
			                               callback );
				}
				CleanupStack::PopAndDestroy(); // Destroy cmd
			}
		}

	} 
	else 
	{
		//FlashPlayer not installed
	}
	
    /*iAppContainer = new (ELeave) CFlashLite21LauncherContainer;
    iAppContainer->SetMopParent( this );
    iAppContainer->ConstructL( ClientRect() );
    AddToStackL( iAppContainer );*/
    }