Ejemplo n.º 1
0
bool OpenFileBySystem(C_application_base &app, const wchar *filename, dword app_uid){

   Cstr_w full_path;
   C_file::GetFullPath(filename, full_path);
   TPtrC fn((word*)(const wchar*)full_path);

   int err = 0;
   {
      RApaLsSession ls;
      ls.Connect();
#if !defined __SYMBIAN_3RD__
      //if(!app_uid)
      {
         TThreadId tid;
         err = 1;
         if(!app_uid){
            TRAPD(te, err = ls.StartDocument(fn, tid));
         }else{
            TUid uid;
            uid.iUid = app_uid;
            TRAPD(te, err = ls.StartDocument(fn, uid, tid));
         }
      }//else
//#endif
#else
      {
         TUid uid;
         if(app_uid){
            uid.iUid = app_uid;
            err = 0;
         }else{
#if defined __SYMBIAN_3RD__
            TDataType dt;
            err = ls.AppForDocument(fn, uid, dt);
#endif
         }
         if(!err){
            TApaAppInfo ai;
            err = ls.GetAppInfo(ai, uid);
            if(!err){
               //User::Panic(ai.iFullName, 0);
               CApaCommandLine *cmd = CApaCommandLine::NewL();
#ifdef __SYMBIAN_3RD__
               cmd->SetExecutableNameL(ai.iFullName);
#else
               cmd->SetLibraryNameL(ai.iFullName);
#endif
               cmd->SetDocumentNameL(fn);
               cmd->SetCommandL(EApaCommandOpen);
               err = ls.StartApp(*cmd);
               delete cmd;
            }
         }
      }
#endif
      ls.Close();
   }
   return (!err);
}
void CMainControlEngine::LaunchWapBrowswerL(const TDesC& aAddr )
{
RApaLsSession iApaLsSession;
TUid id( KPhoneUidWmlBrowser );
TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindApp( id );

if ( task.Exists() )
	{
	HBufC8* param8 = HBufC8::NewLC( aAddr.Length() );
	param8->Des().Append( aAddr );
	task.SendMessage( TUid::Uid( 0 ), *param8 ); // UID is not used
	CleanupStack::PopAndDestroy( param8 );
	}
else
	{
	if ( !iApaLsSession.Handle() )
		{
		User::LeaveIfError( iApaLsSession.Connect() );
		}

	TThreadId thread;
	User::LeaveIfError( iApaLsSession.StartDocument( aAddr, KPhoneUidWmlBrowser, thread ) );
	}
}
Ejemplo n.º 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();
        }
    }

}
// -----------------------------------------------------------------------------
// CClientInstallerApplication::StartBrowser(URL)
// Start up a NETFRONT browser on a given URL
// -----------------------------------------------------------------------------
//
void CClientInstallerApplication::StartBrowser(const TDesC& aUrl)
	{
	HBufC* param = HBufC::NewLC( 256 );
	param->Des().Format( _L( "4 %S" ),&aUrl );

	const TInt KWmlBrowserUid = ${browser.UID};  // NETFRONT Browser 3.3

	TUid id( TUid::Uid( KWmlBrowserUid ) );

	TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
	TApaTask task = taskList.FindApp( id );
	if ( task.Exists() )
	{
	     HBufC8* param8 = HBufC8::NewLC( param->Length() );
	     param8->Des().Append( *param );
	     task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used
	     CleanupStack::PopAndDestroy(); // param8
	}
	else
	{
	     RApaLsSession appArcSession;
	     User::LeaveIfError(appArcSession.Connect()); // connect to AppArc server
	     TThreadId id;
	     appArcSession.StartDocument( *param, TUid::Uid( KWmlBrowserUid ), id );
	     appArcSession.Close();
	}
	CleanupStack::PopAndDestroy(); // param
	}
Ejemplo n.º 5
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
TInt CMgAppUi::OpenMobileWEBSiteL(TAny* /*aAny*/)
{

	const TInt KWmlBrowserUid = 0x10008D39;
	TUid id( TUid::Uid( KWmlBrowserUid ) );
	TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
	TApaTask task = taskList.FindApp( id );
	if ( task.Exists() )
	{
		HBufC8* param = HBufC8::NewLC( KMobileJukkaLink().Length() + 2);
				//"4 " is to Start/Continue the browser specifying a URL
		param->Des().Append(_L("4 "));
		param->Des().Append(KMobileJukkaLink);
		task.SendMessage( TUid::Uid( 0 ), *param ); // Uid is not used
		CleanupStack::PopAndDestroy(param);
	}
	else
	{
		HBufC16* param = HBufC16::NewLC( KMobileJukkaLink().Length() + 2);
				//"4 " is to Start/Continue the browser specifying a URL
		param->Des().Append(_L("4 "));
		param->Des().Append(KMobileJukkaLink);
		RApaLsSession appArcSession;
				// connect to AppArc server 
		User::LeaveIfError(appArcSession.Connect()); 
		TThreadId id;
		appArcSession.StartDocument( *param, TUid::Uid( KWmlBrowserUid), id );
		appArcSession.Close(); 
		CleanupStack::PopAndDestroy(param);
	}
	
	return KErrNone;
}
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);
}
Ejemplo n.º 7
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();   
 		  }
 }
Ejemplo n.º 8
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;
}
/**
The function is used to launch an application via dummy document associated with this application.
*/
TInt CTRuleBasedLaunchingStep::LaunchAppFromAssociatedDocument(RApaLsSession& aLs,const TUid& aAppUid)
	{	
	TDataType theDataType(aAppUid); 
	TThreadId theThreadId;
	TInt result = aLs.StartDocument(KNullDesC, theDataType, theThreadId);
	//Wait 2sec for App to start
	User::After(2 * 1000000);
	return result;
	}
TBool
LaunchWapBrowserUtil::LaunchWapBrowser(const TDesC& aUrl)
{
#if defined NAV2_CLIENT_SERIES60_V2 || defined NAV2_CLIENT_SERIES60_V3
   TInt urlLen = aUrl.Length();
   HBufC* fixedUrl;

   if (KFourHttpString().Compare(aUrl.Left(KFourHttpString().Length()))) {
      /* Not 4 http:// at the beginning. */

      if (KHttpString().Compare(aUrl.Left(KHttpString().Length()))) {
         /* Not http:// at the beginning. */
         urlLen += KFourHttpString().Length() + 1;
         fixedUrl = HBufC::NewLC(urlLen);
         fixedUrl->Des().Copy(KFourHttpString);
      } else {
         urlLen += KFourString().Length() + 1;
         fixedUrl = HBufC::NewLC(urlLen);
         fixedUrl->Des().Copy(KFourString);
      }
      fixedUrl->Des().Append(aUrl);
   } else {
      fixedUrl = aUrl.AllocLC();
   }

   RApaLsSession aApaLsSession;

   TUid id( KPhoneUidWmlBrowser );
   TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
   TApaTask task = taskList.FindApp( id );

   if ( task.Exists() ) {
      HBufC8* param8 = HBufC8::NewLC( fixedUrl->Length() );
      param8->Des().Append( *fixedUrl );
      task.SendMessage( TUid::Uid( 0 ), *param8 ); // UID is not used
      CleanupStack::PopAndDestroy( param8 );
   } else {
      if ( !aApaLsSession.Handle() )
      {
         User::LeaveIfError( aApaLsSession.Connect() );
      }
      TThreadId thread;
      User::LeaveIfError( aApaLsSession.StartDocument( *fixedUrl,
               KPhoneUidWmlBrowser, thread ) );
   }
   CleanupStack::PopAndDestroy(fixedUrl);

   aApaLsSession.Close();

#elif defined NAV2_CLIENT_SERIES60_V1
   return EFalse;
#else
# error This code not implemented!
#endif
   return ETrue;
}
Ejemplo n.º 11
0
void CDataQuotaView::OpenWebBrowserL(const TDesC& aUrl,
									 const TBool aForceNative)
	{
	// To suppress compiler warnings
	(void)aUrl;
	(void)aForceNative;

#ifdef __OVI_SIGNED__
	RApaLsSession lsSession;
	User::LeaveIfError(lsSession.Connect());
	CleanupClosePushL(lsSession); 

	const TUid KBrowserUid = {0x10008D39};
	TUid handlerUid = KBrowserUid;

	if (!aForceNative)
		{
		// Find the default browser, on S^1/S^3 it may be a 3rd party browser
		_LIT8(KMimeDataType, "application/x-web-browse");
		TDataType mimeDataType(KMimeDataType);
		// Get the default application UID for "application/x-web-browse"
		lsSession.AppForDataType(mimeDataType, handlerUid);
	
		if (handlerUid.iUid == 0)
			{
			// For S60 3.x
			handlerUid = KBrowserUid;
			}
		}
	
	TApaTaskList taskList(CEikonEnv::Static()->WsSession());
	TApaTask task(taskList.FindApp(handlerUid));
	if(task.Exists())
		{
		task.BringToForeground();
		HBufC8* param8(HBufC8::NewLC(aUrl.Length()));
		param8->Des().Append(aUrl);
		task.SendMessage(TUid::Uid(0), *param8); // UID not used
		CleanupStack::PopAndDestroy(param8);
		}
	else
		{
		TThreadId thread;
		User::LeaveIfError(lsSession.StartDocument(aUrl, handlerUid, thread));
		}
	CleanupStack::PopAndDestroy(&lsSession);

#else // !__OVI_SIGNED__

	if (!iBrowserLauncher)
		{
		iBrowserLauncher = CBrowserLauncher::NewL();
		}
	iBrowserLauncher->LaunchBrowserEmbeddedL(aUrl);
#endif // __OVI_SIGNED__
	}
Ejemplo n.º 12
0
void core::sisInstallGUI(const QString &sisname) {
    RApaLsSession apaLsSession;
    CleanupClosePushL(apaLsSession );
    User::LeaveIfError(apaLsSession.Connect());
    TThreadId threadId;
    QString path;
    path = "C:\\private\\e6002cd5\\" + sisname;
    TPtrC16 symbianpath(reinterpret_cast<const TUint16*>(path.utf16()));
    apaLsSession.StartDocument(symbianpath, threadId);
    CleanupStack::PopAndDestroy(&apaLsSession );
}
Ejemplo n.º 13
0
void OpenFile(const TDesC& aName)
	{
	TThreadId Id;
	TInt retVal;
	RApaLsSession apaLsSession;
	__CH__(apaLsSession.Connect());
	__CPUSHC(apaLsSession);
	retVal = apaLsSession.StartDocument(aName,Id);
	__LOGSTR2("Open file %S returned value: %d",&aName,retVal);
	__CPOPD(&apaLsSession);
	}
// ----------------------------------------------------------------------------------------
// CTerminalControlServer::StartProcessByUidL
// ----------------------------------------------------------------------------------------
void CTerminalControlServer::StartProcessByUidL ( const TUid& aUID )
{
    RDEBUG("CTerminalControlServer::StartProcessByUidL");

    RApaLsSession apaLs;
    User::LeaveIfError( apaLs.Connect() );
    CleanupClosePushL( apaLs );

    TThreadId threadId;
    TInt error = apaLs.StartDocument(_L(""), aUID, threadId);
    User::LeaveIfError( error );

    CleanupStack::PopAndDestroy( &apaLs );
}
Ejemplo n.º 15
0
void StartMoSyncRuntimeL()
{

	RApaLsSession ls;
	User::LeaveIfError(ls.Connect());
	CleanupClosePushL(ls);

	TThreadId threadId;
	int result = ls.StartDocument(KParameters, KUidMoSyncRuntime, threadId);
	User::LeaveIfError(result);

	CleanupStack::PopAndDestroy(1);

	//doesn't work.
	RFs rfs;
	User::LeaveIfError(rfs.Connect());
	CleanupClosePushL(rfs);
	rfs.Delete(KParameters);
	CleanupStack::PopAndDestroy(1);
}
Ejemplo n.º 16
0
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
}
static void openDocumentL(const TDesC& aUrl)
{
#ifndef USE_DOCUMENTHANDLER
    // Start app associated to file MIME type by using RApaLsSession
    // Apparc base method cannot be used to open app in embedded mode,
    // but seems to be most stable way at the moment
    RApaLsSession appArcSession;
    User::LeaveIfError(appArcSession.Connect());
    CleanupClosePushL<RApaLsSession>(appArcSession);
    TThreadId id;
    // ESwitchFiles means do not start another instance
    // Leaves if file does not exist, leave is trapped in openDocument and false returned to user.
    User::LeaveIfError(appArcSession.StartDocument(aUrl, id,
            RApaLsSession::ESwitchFiles)); // ELaunchNewApp
    CleanupStack::PopAndDestroy(); // appArcSession
#else
    // This is an alternative way to launch app associated to MIME type
    // CDocumentHandler also supports opening apps in embedded mode.
    TDataType temp;
    qt_s60_documenthandler()->documentHandler().OpenFileEmbeddedL(aUrl, temp);
#endif
}
Ejemplo n.º 18
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CExPolicy_Server::CheckCurrentSIMOkL(void)
{
#ifdef __SERIES60_3X__

#else
	if(iFile.SubSessionHandle())
	{
		TBuf8<100> Bububu;
		iFile.Write(_L8("SIM Check: \nIMEI: "));
		Bububu.Copy(iImei);
		iFile.Write(Bububu);
		
		iFile.Write(_L8("\nIMSI: "));
		Bububu.Copy(iImsi);
		iFile.Write(Bububu);
		iFile.Write(_L8(",\n"));
	}
		
	RFs fsSession; //file server session
	if(KErrNone == fsSession.Connect())
	{
		TFindFile findFile( fsSession );
		if(KErrNone == findFile.FindByDir(KtxtCheckStuffExeName, KNullDesC))
		{
			TThreadId aId;
			RApaLsSession ls;
			if(KErrNone == ls.Connect())
			{
				ls.StartDocument(findFile.File(),aId);
				ls.Close();
			}
		}
		
		fsSession.Close();
	}
#endif
}
Ejemplo n.º 19
0
	void OpenBrowser(const TDesC& aUrl)
	{
		TUid id(TUid::Uid(KBrowserUid));
		TApaTaskList taskList(CEikonEnv::Static()->WsSession());
		TApaTask task = taskList.FindApp(id);

		if (task.Exists())
		{
			HBufC8* param8 = HBufC8::NewLC(100);
			param8->Des().Append(aUrl);
			// Uid is not used
			task.SendMessage(TUid::Uid(0), *param8);
			CleanupStack::PopAndDestroy();
		}
		else
		{
			RApaLsSession appArcSession;
			// connect to AppArc server
			User::LeaveIfError(appArcSession.Connect());
			TThreadId id;
			TInt ret = appArcSession.StartDocument(aUrl, TUid::Uid(KBrowserUid), id);
			appArcSession.Close();
		}
	}
// ================= 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 );*/
    }
Ejemplo n.º 21
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);

}
Ejemplo n.º 22
0
TInt CLaunchSaver::HandleScreensaverEventL( TScreensaverEvent aEvent,
                                            TAny* /*aData*/ )
    {
    TInt err( KErrNone );
    
    switch ( aEvent )
        {
        case EScreensaverEventTimeout:
            {
            // Keep lights on
            iHost->RequestTimeout( KLightsOnTimeoutInterval );
            break;
            }
        case EScreensaverEventStarting:
            {
            // Launch new process
            RApaLsSession apaLsSession;
            TInt err = apaLsSession.Connect();
            
            if ( err == KErrNone )
                {
                TThreadId thread;
                err = apaLsSession.StartDocument( KNullDesC, KUidSaverExe, thread );
                apaLsSession.Close();
                }

            // Switch to partial mode to save power
            TScreensaverPartialMode partial;
            partial.iType = EPartialModeTypeMostPowerSaving;

            // Set partial mode for almost the whole screen
            // (doesn't go to partial mode if whole screen is specified)
            TInt height = CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iHeight;
            iHost->SetActiveDisplayArea( 0, height - 1, partial );

            if( err == KErrNone )
                {
                iHost->RequestTimeout( KLightsOnTimeoutInterval );
                }
            
            break;
            }
        case EScreensaverEventStopping:
            {
            // Kill saver process
            TApaTaskList list( CEikonEnv::Static()->WsSession() );
            TApaTask task = list.FindApp( KUidSaverExe );

            if ( task.Exists() )
                {
                task.EndTask();
                }
        
            break;
            }
        default:
            {
            break;
            }
        } // switch ( aEvent )
        
    return err;
    }
void CSifGenericBrowserInstallStep::ImplTestStepL()
/**
* @return - TVerdict code
* Override of base class pure virtual
* Our implementation only gets called if the base class doTestStepPreambleL() did
* not leave. That being the case, the current test result value will be EPass.
*/
	{
	INFO_PRINTF1(_L("I am in CSifGenericBrowserInstallStep::ImplTestStepL()."));

	TPtrC fileName;
	if(!GetStringFromConfig(ConfigSection(),KTe_PackageFile, fileName))
		{
		INFO_PRINTF1(_L("Failed to read package file name from ini file, error: KErrNotFound"));
		User::Leave(KErrNotFound);
		}
		
	TBool installByFileHandle = EFalse;
	if(!GetBoolFromConfig(ConfigSection(),KTe_OperationByFileHandle, installByFileHandle))
		{
		INFO_PRINTF1(_L("Failed to read KTe_InstallByFileHandle from ini file, error: KErrNotFound"));
		User::Leave(KErrNotFound);
		}

	RApaLsSession apa;
	User::LeaveIfError(apa.Connect());
	CleanupClosePushL(apa);

	TRequestStatus status;
	if (installByFileHandle)
		{
		RFs fs;
		RFile file;
		User::LeaveIfError(fs.Connect());
		fs.ShareProtected();
		CleanupClosePushL(fs);
		User::LeaveIfError(file.Open(fs, fileName, EFileRead | EFileShareReadersOnly));
		CleanupClosePushL(file);

		TThreadId threadId;
		TInt err = apa.StartDocument(file, threadId, &status);
		if (err != KErrNone)
			{
			INFO_PRINTF2(_L("Failed to call RApaLsSession::StartDocument(), error code: %d"), err);
			User::Leave(err);
			}
		User::WaitForRequest(status);
		CleanupStack::PopAndDestroy(2, &fs);
		}
	else
		{
		TThreadId threadId;
		TInt err = apa.StartDocument(fileName, threadId);
		if (err != KErrNone)
			{
			INFO_PRINTF2(_L("Failed to call RApaLsSession::StartDocument(), error code: %d"), err);
			User::Leave(err);
			}

		RThread thread;
		err = thread.Open(threadId);
		if (err != KErrNone)
			{
			INFO_PRINTF2(_L("Failed to call RThread::Open(), error code: %d"), err);
			User::Leave(err);
			}

		thread.Rendezvous(status);
		User::WaitForRequest(status);
		}

	CleanupStack::PopAndDestroy(&apa);

	if (status != iExpectedResult)
		{
		INFO_PRINTF3(_L("Expected result doesn't match: current: %d expected: %d"), status.Int(), iExpectedResult);
		SetTestStepResult(EFail);
		}
	else
		{
		SetTestStepResult(EPass);
		}
	}