void CTestAppUi::TestWaitOnAppStartL() { RDebug::Print(_L("TVIEW1 : Test Wait On App Start")); RThread appThread; TRequestStatus status; TThreadId threadId; RApaLsSession ls; CleanupClosePushL(ls); User::LeaveIfError(ls.Connect()); TApaAppInfo info; User::LeaveIfError(ls.GetAppInfo(info,KUidViewAppTwo)); CleanupStack::PopAndDestroy(); // ls CApaCommandLine* cmdLine=CApaCommandLine::NewLC(); cmdLine->SetExecutableNameL(info.iFullName); cmdLine->SetCommandL(EApaCommandViewActivate); TFileName fName=_L("c:\\Documents\\"); TParsePtrC parse(info.iFullName); fName.Append(parse.Name()); cmdLine->SetDocumentNameL(fName); RApaLsSession lsSession; User::LeaveIfError(lsSession.Connect()); CleanupClosePushL(lsSession); threadId=User::LeaveIfError(lsSession.StartApp(*cmdLine, threadId)); CleanupStack::PopAndDestroy(&lsSession); CleanupStack::PopAndDestroy(); // cmdLine User::LeaveIfError(appThread.Open(threadId)); appThread.Logon(status); User::WaitForRequest(status); }
/*! return always true, and handle the error in ruby. error return is "failed with uid:0x12345678" where 0x12345678 is replaced with given uid */ bool LaunchFixture::execute(void * objectInstance, QString actionName, QHash<QString, QString> parameters, QString & stdOut) { bool result = true; //TasLogger::logger()->debug("> LaunchFixture::execute:" + actionName); if(actionName == "launch_with_uid"){ bool ok; QString temp = parameters.value("UID"); //TasLogger::logger()->debug("> LaunchFixture::UID: '" + temp + "'"); TUint uid_i = temp.toUInt(&ok, 0); //TasLogger::logger()->debug(" ok: " + QString::number(ok) + " uid: " + QString::number(uid_i)); TUid uid = TUid::Uid(uid_i); //T R A P D starts TRAPD(trapErr, RApaLsSession session; TInt err = session.Connect(); User::LeaveIfError(err); //TasLogger::logger()->debug(" session " ); CleanupClosePushL(session); TApaAppInfo info; err = session.GetAppInfo(info,uid); User::LeaveIfError(err); //TasLogger::logger()->debug(" appinfo " ); CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); cmdLine->SetExecutableNameL(info.iFullName); cmdLine->SetCommandL(EApaCommandRun); User::LeaveIfError(session.StartApp(*cmdLine)); //TasLogger::logger()->debug(" command line " ); stdOut.append(QString((QChar*) info.iFullName.Ptr(), info.iFullName.Length())); CleanupStack::PopAndDestroy(2); );
bool IsApplicationInstalled(dword uid){ RApaLsSession ls; ls.Connect(); TApaAppInfo ai; TInt err = ls.GetAppInfo(ai, TUid::Uid(uid)); return (err==KErrNone); }
// --------------------------------------------------------------------------- // Launches the app server. // --------------------------------------------------------------------------- // EXPORT_C void RAlfClientBase::LaunchAppL( TUid aAppUid, TUint aServerDifferentiator, TThreadId& aThreadId ) { RApaLsSession apa; User::LeaveIfError( apa.Connect() ); CleanupClosePushL( apa ); TApaAppInfo info; User::LeaveIfError( apa.GetAppInfo( info, aAppUid ) ); CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); cmdLine->SetExecutableNameL( info.iFullName ); cmdLine->SetServerRequiredL( aServerDifferentiator ); // Set the command to start the server in background cmdLine->SetCommandL( EApaCommandBackground ); TRequestStatus status; TInt err = apa.StartApp( *cmdLine, aThreadId, &status ); User::LeaveIfError( err ); User::WaitForRequest(status); User::LeaveIfError( status.Int() ); CleanupStack::PopAndDestroy( cmdLine ); CleanupStack::PopAndDestroy( &apa ); }
void CDataQuotaView::LaunchOviSignedVersionL() { RApaLsSession lsSession; User::LeaveIfError(lsSession.Connect()); CleanupClosePushL(lsSession); TApaAppInfo appInfo; TInt error(lsSession.GetAppInfo( appInfo, TUid::Uid(KUidOviSigned))); if (KErrNone == error) { CApaCommandLine* cmdLine(CApaCommandLine::NewLC()); cmdLine->SetExecutableNameL(appInfo.iFullName); cmdLine->SetCommandL(EApaCommandRun); User::LeaveIfError(lsSession.StartApp(*cmdLine)); CleanupStack::PopAndDestroy(cmdLine); } CleanupStack::PopAndDestroy(&lsSession); if (KErrNone == error) { HandleCommandL(EEikCmdExit); } }
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); }
/** The function is used to launch an app whose UID is supplied as its second input parameter. The function returns KErrNone upon success, KErrGeneral otherwise. */ TInt CTRuleBasedLaunchingStep::AppLaunchedL(RApaLsSession& aLs, const TUid& aAppUid) { TApaAppInfo info; TFileName fileName; aLs.GetAppInfo(info,aAppUid); //Wait 0.5sec for function to complete User::After(500000); fileName = info.iFullName; CApaCommandLine* cmdLn = CApaCommandLine::NewLC(); cmdLn->SetExecutableNameL(fileName); TInt result = aLs.StartApp(*cmdLn); //Wait 0.5sec for App to start User::After(500000); CleanupStack::PopAndDestroy(cmdLn); return result; }
void RAlfClientBase::StartAsyncL(TRequestStatus* aStatus) { ASSERT(iApa==0 && iCmdLine == 0); // Start the server application TName serverName; TUint differentiator( 0 ); differentiator = KAlfAppServerInterfaceUid3; ConstructServerName( serverName, TUid::Uid(KAlfAppServerInterfaceUid3) , differentiator ); TFindServer serverFinder(serverName); TFullName fullName; if (serverFinder.Next(fullName) == KErrNone) { User::Leave(KErrAlreadyExists); } TThreadId threadId; // we don't have proper destructor and thus we don't take // "normal" ownership on our members... // assign to member after poping from cleanup stack - codescanner now happy RApaLsSession* apa = new (ELeave) RApaLsSession; CleanupStack::PushL(apa); User::LeaveIfError( apa->Connect() ); CleanupClosePushL( *apa ); TApaAppInfo info; User::LeaveIfError( apa->GetAppInfo( info, TUid::Uid(KAlfAppServerInterfaceUid3) ) ); CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); cmdLine->SetExecutableNameL( info.iFullName ); cmdLine->SetServerRequiredL( differentiator ); // Set the command to start the server in background cmdLine->SetCommandL( EApaCommandBackground ); User::LeaveIfError(apa->StartApp( *cmdLine, threadId, aStatus )); CleanupStack::Pop(3); iCmdLine=cmdLine; iApa = apa; }
TBool CIpUpsDialog::ResolveClientNameFromAppArcL(const TSecureId& aSid) /** Gets the caption name for the application from AppArc (if available). @param aSid The secure id of the client process. @return ETrue if a match was found in apparc; otherwise, EFalse is returned. */ { TBool found(EFalse); RApaLsSession apa; CleanupClosePushL(apa); TInt err = apa.Connect(); if (err == KErrNone) { TApaAppInfo* info = new(ELeave) TApaAppInfo(); CleanupStack::PushL(info); err = apa.GetAppInfo(*info, TUid::Uid(aSid)); if (err == KErrNone) { iPromptData->iClientName.Close(); iPromptData->iClientName.Create(info->iCaption); found = ETrue; } else if (err != KErrNotFound) { User::Leave(err); } CleanupStack::PopAndDestroy(info); } else if (err != KErrNotFound) { // If the connection to apparc failed with KErrNotFound // then the error is ignored becase we assume the dialog // creator was invoked from text-shell User::Leave(err); } CleanupStack::PopAndDestroy(&apa); return found; }
CGulIcon* CTap2MenuAppUi::LoadAppIconEasy(TUid aUid) { RApaLsSession ls; ls.Connect(); TApaAppInfo info; User::LeaveIfError(ls.GetAppInfo(info,aUid)); HBufC* path=HBufC::NewL(255); TInt err=ls.GetAppIcon(aUid,path); User::LeaveIfError(err); CFbsBitmap* AppIcon(NULL); CFbsBitmap* AppIconMsk(NULL); //MAknsSkinInstance* skin = AknsUtils::SkinInstance(); if ((err==KErrNone)&&(path->Length()!=0)) {AknsUtils::CreateAppIconLC(AknsUtils::SkinInstance(),aUid, EAknsAppIconTypeContext,AppIcon,AppIconMsk);} else {User::Leave(KErrNotFound);} AknIconUtils::SetSize(AppIcon,TSize(iSettings[4],iSettings[4])); AknIconUtils::SetSize(AppIconMsk,TSize(iSettings[4],iSettings[4])); CleanupStack::Pop(2); CGulIcon* icon=CGulIcon::NewL(AppIcon,AppIconMsk); ls.Close(); return icon; }
// This only works for applications, not your plain EXEs. static TBool IsAppInstalledL() { #if 1 return ETrue; #else TBool result; RApaLsSession ls; User::LeaveIfError(ls.Connect()); CleanupClosePushL(ls); TApaAppInfo appInfo; // Note that this returns false for applications which have not been // installed using a SIS file. TInt errCode = ls.GetAppInfo(appInfo, TUid::Uid(APP_UID_CL2_LOGGER_DAEMON)); if (errCode == KErrNotFound) result = EFalse; else if (errCode) User::Leave(errCode); else result = ETrue; CleanupStack::PopAndDestroy(); // ls return result; #endif }
void Application::ReadSettings() { emit appWorkChanged(settings->value("settings/appwork",KWork).toBool()); emit autostartChanged(settings->value("settings/autostart",KAutostart).toBool()); #ifdef Q_OS_SYMBIAN TParse parse; QString file=settings->value("settings/picture",KPicture).toString(); file=file.replace("file:///",""); TPtrC file1 (reinterpret_cast<const TText*>(file.constData()),file.length()); CEikonEnv::Static()->FsSession().Parse(file1,parse); TBuf<255> a=parse.NameAndExt(); file=QString::fromRawData(reinterpret_cast<const QChar*>(a.Ptr()),a.Length()); emit pictureChanged(file); RApaLsSession ls; ls.Connect(); TApaAppInfo info; bool ok; QString name; ls.GetAppInfo(info, TUid::Uid((TUint32)settings->value("apps/app1",app1).toString().toULong(&ok,16))); name=QString::fromRawData(reinterpret_cast<const QChar*>(info.iCaption.Ptr()),info.iCaption.Length()); app1Changed(name); ls.GetAppInfo(info, TUid::Uid((TUint32)settings->value("apps/app2",app2).toString().toULong(&ok,16))); name=QString::fromRawData(reinterpret_cast<const QChar*>(info.iCaption.Ptr()),info.iCaption.Length()); app2Changed(name); ls.GetAppInfo(info, TUid::Uid((TUint32)settings->value("apps/app3",app3).toString().toULong(&ok,16))); name=QString::fromRawData(reinterpret_cast<const QChar*>(info.iCaption.Ptr()),info.iCaption.Length()); app3Changed(name); ls.GetAppInfo(info, TUid::Uid((TUint32)settings->value("apps/app4",app4).toString().toULong(&ok,16))); name=QString::fromRawData(reinterpret_cast<const QChar*>(info.iCaption.Ptr()),info.iCaption.Length()); app4Changed(name); ls.GetAppInfo(info, TUid::Uid((TUint32)settings->value("apps/app5",app5).toString().toULong(&ok,16))); name=QString::fromRawData(reinterpret_cast<const QChar*>(info.iCaption.Ptr()),info.iCaption.Length()); app5Changed(name); ls.GetAppInfo(info, TUid::Uid((TUint32)settings->value("apps/app6",app6).toString().toULong(&ok,16))); name=QString::fromRawData(reinterpret_cast<const QChar*>(info.iCaption.Ptr()),info.iCaption.Length()); app6Changed(name); ls.GetAppInfo(info, TUid::Uid((TUint32)settings->value("settings/zcamapp",camapp).toString().toULong(&ok,16))); name=QString::fromRawData(reinterpret_cast<const QChar*>(info.iCaption.Ptr()),info.iCaption.Length()); cameraAppChanged(name); #endif emit zoomChanged(settings->value("settings/zoom",KZoom).toInt()); emit playerAlbumChanged(settings->value("settings/playeralbum",KPlayer).toInt()); emit useWallpaperChanged(settings->value("settings/zusewallpaper",0).toInt()); emit useSystemFontChanged(settings->value("settings/zusesystemfont",0).toInt()); emit orientationChanged(settings->value("settings/zzorientation",0).toInt()); settings->beginGroup("keys"); QStringList sets=settings->allKeys(); for (int i=0;i<sets.length();i++) settings->remove(sets[i]); for (int i=0;i<keys.length();i++) settings->setValue(QString::number(i),keys[i]); settings->endGroup(); settings->beginGroup("settings"); qDebug()<<settings->allKeys(); settings->endGroup(); }
EXPORT_C void AknsUtils::CreateAppIconLC( MAknsSkinInstance* aInstance, TUid aAppUid, TAknsAppIconType aType, CFbsBitmap*& aBitmap, CFbsBitmap*& aMask ) { aBitmap = NULL; aMask = NULL; if (!aInstance) { User::Leave(KErrArgument); } TSize legacySize( 42, 29 ); TInt bitmapIndex( 0 ); TInt maskIndex( 1 ); if( aType == EAknsAppIconTypeContext ) { legacySize = TSize( 44, 44 ); bitmapIndex = 2; maskIndex = 3; } else if( aType != EAknsAppIconTypeList ) { User::Leave( KErrArgument ); } // Make the forthcoming pushes safe (up to level 2) CleanupStack::PushL( static_cast<TAny*>(NULL) ); CleanupStack::PushL( static_cast<TAny*>(NULL) ); CleanupStack::Pop( 2 ); // 1. Check if the icon has been configured. TInt ret = KErrNone; TBool configuredIcon = EFalse; // CAknsAppSkinInstance* apskin = static_cast<CAknsAppSkinInstance*>(aInstance); if ( apskin ) { TInt config = apskin->IsIconConfiguredL( aAppUid ); if ( config > 0 ) configuredIcon = ETrue; } if ( !configuredIcon ) { // 2. Skin-originating icon ret = GetAppIconFromSkin( aInstance, aAppUid, legacySize, aBitmap, aMask ); if( ret == KErrNone ) { // These pushes are safe CleanupStack::PushL( aBitmap ); // (1) CleanupStack::PushL( aMask ); // (2) return; } } // Cache connected apparc session for future reuse, if not already cached // This is done per appskininstance when necessary... if (!apskin->iCachedApaSession) { apskin->iCachedApaSession = new (ELeave) RApaLsSession; User::LeaveIfError(apskin->iCachedApaSession->Connect()); } RApaLsSession* lsSession = apskin->iCachedApaSession; TBool forceDefaultIcon = EFalse; TApaAppInfo appInfo; TFileName filename; // 3. New appicon framework HBufC* filenameBuf = NULL; TBool javaIcon = EFalse; ret = lsSession->GetAppIcon( aAppUid, filenameBuf ); if( filenameBuf ) { filename.Copy( *filenameBuf ); delete filenameBuf; } if( ret == KErrNone ) { ret = lsSession->GetAppInfo( appInfo, aAppUid ); } if( (ret==KErrNone) && (filename.Length()>2) && (appInfo.iFullName.Length()>2) ) { // Correct drive letter, if necessary if( appInfo.iFullName[1]==':' ) { if( filename[1]==':' ) { filename[0] = appInfo.iFullName[0]; } else if( filename[0]=='\\' ) { filename.Insert( 0, appInfo.iFullName.Left(2) ); } } // check if the icon is java icon javaIcon = AknsJavaUtils::IsJavaIcon(filename); if( AknIconUtils::IsMifFile( filename ) ) { // SVG icon // SVG always has only one icon bitmapIndex = 0; maskIndex = 1; AknIconUtils::ValidateLogicalAppIconId( filename, bitmapIndex, maskIndex ); if (javaIcon) { AknsJavaUtils::CreateIconLC(*lsSession, aAppUid, aBitmap, aMask, bitmapIndex, maskIndex ); // aBitmap, aMask (2) } else { AknIconUtils::CreateIconLC( aBitmap, aMask, filename, bitmapIndex, maskIndex ); // aBitmap, aMask (2) } AknInternalIconUtils::SetAppIcon(aBitmap); //icon case return; } else { // MBM icon AknIconUtils::ValidateLogicalAppIconId( filename, bitmapIndex, maskIndex ); TRAP( ret, AknIconUtils::CreateIconL( aBitmap, aMask, filename, bitmapIndex, maskIndex ) ); if( ret == KErrNone ) { // These pushes are safe CleanupStack::PushL( aBitmap ); // (1) CleanupStack::PushL( aMask ); // (2) } else { bitmapIndex = 0; maskIndex = 1; AknIconUtils::ValidateLogicalAppIconId( filename, bitmapIndex, maskIndex ); AknIconUtils::CreateIconLC( aBitmap, aMask, filename, bitmapIndex, maskIndex ); // aBitmap, aMask (2) } AknInternalIconUtils::SetAppIcon(aBitmap); //icon case return; } } else if( ret!=KErrNotSupported ) { // New framework, but no icon defined forceDefaultIcon = ETrue; } CApaMaskedBitmap* apaBmp = CApaMaskedBitmap::NewLC(); // apaBmp (1) // 3. Old (AIF-based) framework if( !forceDefaultIcon ) { TInt apaErr = lsSession->GetAppIcon( aAppUid, legacySize, *apaBmp ); // Use default icon if APPARC did not initialize icon bitmaps if( apaErr || (!apaBmp) || (!apaBmp->Mask()) || (!apaBmp->Handle()) || (!apaBmp->Mask()->Handle()) ) { forceDefaultIcon = ETrue; } } if( forceDefaultIcon ) { // Default icon CleanupStack::PopAndDestroy( 1 ); // apaBmp (0) TAknsItemID iid = KAknsIIDQgnMenuUnknownLst; bitmapIndex = EMbmAvkonQgn_menu_unknown_lst; maskIndex = EMbmAvkonQgn_menu_unknown_lst_mask; if( aType == EAknsAppIconTypeContext ) { iid = KAknsIIDQgnMenuUnknownCxt; bitmapIndex = EMbmAvkonQgn_menu_unknown_cxt; maskIndex = EMbmAvkonQgn_menu_unknown_cxt_mask; } AknsUtils::CreateIconLC( aInstance, iid, aBitmap, aMask, AknIconUtils::AvkonIconFileName(), bitmapIndex, maskIndex ); // aBitmap, aMask (2) } else { // AIF-based icon CFbsBitmap* iconOwnedBitmap = new (ELeave) CFbsBitmap(); CleanupStack::PushL( iconOwnedBitmap ); // iob (3) CFbsBitmap* iconOwnedMask = new (ELeave) CFbsBitmap(); CleanupStack::PushL( iconOwnedMask ); // iom (4) User::LeaveIfError( iconOwnedBitmap->Duplicate( apaBmp->Handle() ) ); User::LeaveIfError( iconOwnedMask->Duplicate( apaBmp->Mask()->Handle() ) ); CAknIcon* tmpIcon = CAknIcon::NewL(); CleanupStack::Pop( 2 ); // iom, iob (2) CleanupStack::PopAndDestroy( 1 ); // apaBmp (0) // Ownership is transferred tmpIcon->SetBitmap( iconOwnedBitmap ); tmpIcon->SetMask( iconOwnedMask ); // Ownership of tmpIcon is transferred CAknIcon* appIcon = AknIconUtils::CreateIconL( tmpIcon ); aBitmap = appIcon->Bitmap(); aMask = appIcon->Mask(); // Detach and delete appIcon->SetBitmap( NULL ); appIcon->SetMask( NULL ); delete appIcon; // These are both safe CleanupStack::PushL( aBitmap ); // (1) CleanupStack::PushL( aMask ); // (2) } }
void PlayerController::GoToNowPlaying() { if (playerLaunched) { //Launch player RWsSession wsSession; User::LeaveIfError( wsSession.Connect() ); TApaTaskList list(wsSession); TApaTask task = list.FindApp(KMusicPlayerAppUid); CMPXParameter* param = new ( ELeave ) CMPXParameter(); CleanupStack::PushL( param ); param->iType.iUid = KMPXPluginTypePlaybackUid; param->iCmdForward = EMPXCmdFwdNone; CBufBase* buffer = CBufFlat::NewL(3 ); CleanupStack::PushL( buffer ); RBufWriteStream writeStream( *buffer ); CleanupClosePushL( writeStream ); param->ExternalizeL( writeStream ); writeStream.CommitL(); buffer->Compress(); CleanupStack::PopAndDestroy( &writeStream ); if ( task.Exists() ) { wsSession.SendMessageToWindowGroup( task.WgId(), KAppUidMusicPlayerX, buffer->Ptr( 0 ) ); } else { RApaLsSession ls; CleanupClosePushL( ls ); User::LeaveIfError( ls.Connect() ); TApaAppInfo appInfo; User::LeaveIfError( ls.GetAppInfo( appInfo, KAppUidMusicPlayerX ) ); CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC(); apaCommandLine->SetExecutableNameL( appInfo.iFullName ); apaCommandLine->SetTailEndL( buffer->Ptr( 0 ) ); User::LeaveIfError( ls.StartApp( *apaCommandLine ) ); CleanupStack::PopAndDestroy(); // apaCommandLine CleanupStack::PopAndDestroy(); // ls } CleanupStack::PopAndDestroy( buffer ); CleanupStack::PopAndDestroy( param ); wsSession.Close(); } else if (radioLaunched) { RApaLsSession ls; CleanupClosePushL( ls ); User::LeaveIfError( ls.Connect() ); TApaAppInfo appInfo; User::LeaveIfError( ls.GetAppInfo( appInfo, KRadioUid ) ); CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC(); apaCommandLine->SetExecutableNameL( appInfo.iFullName ); User::LeaveIfError( ls.StartApp( *apaCommandLine ) ); CleanupStack::PopAndDestroy(); // apaCommandLine CleanupStack::PopAndDestroy(); // ls } }
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 } } }
// Each test step must supply a implementation for doTestStepL enum TVerdict CTestAppLoaderEndTask::doTestStepL( void ) { // Printing to the console and log file INFO_PRINTF1(_L("TEST-> END TASK")); TPtrC program; if ( !GetStringFromConfig(ConfigSection(), KProgram, program) ) { ERR_PRINTF2(KErrMissingParameter, &KProgram()); SetTestStepResult(EFail); } else { RApaLsSession apaLsSession; User::LeaveIfError(apaLsSession.Connect()); CleanupClosePushL(apaLsSession); User::LeaveIfError(apaLsSession.GetAllApps()); RWsSession ws; User::LeaveIfError(ws.Connect()); CleanupClosePushL(ws); TInt numWindowGroups = ws.NumWindowGroups(); CArrayFixFlat<TInt>* windowGroupList = new(ELeave) CArrayFixFlat<TInt>(numWindowGroups); CleanupStack::PushL(windowGroupList); // Populate array with current group list ids User::LeaveIfError(ws.WindowGroupList(windowGroupList)); CApaWindowGroupName* windowGroupName = CApaWindowGroupName::NewLC(ws); /* Note: we use windowGroupList->Count() instead of numWindowGroups, as in the middle of the * update the list could change in length (or worse, be reduced) thus producing an out of bounds * error if numWindowGroups were used */ TBool searching=ETrue; for ( TInt i=0; (i<windowGroupList->Count()) && searching; ++i ) { TInt wgId = windowGroupList->At(i); windowGroupName->ConstructFromWgIdL(wgId); TUid appUid = windowGroupName->AppUid(); TApaAppInfo appInfo; HBufC* appCaption = NULL; // Some applications, like midlets, may not provide any info if (apaLsSession.GetAppInfo(appInfo, appUid) == KErrNone) { appCaption = appInfo.iCaption.AllocL(); } else { appCaption = windowGroupName->Caption().AllocL(); } CleanupStack::PushL(appCaption); // Only list 'visible' applications if ( appCaption->Length() ) { TPtrC caption=*appCaption; INFO_PRINTF2(KLogTask, &caption); if ( program.CompareC(caption)==0 ) { searching=EFalse; TApaTask task(ws); task.SetWgId(wgId); if (task.Exists()) { task.EndTask(); } else { ERR_PRINTF2(KErrTaskNotFound, &program); SetTestStepResult(EFail); } } } CleanupStack::Pop(1, appCaption); // taskEntry, appCaption } if ( searching ) { ERR_PRINTF2(KErrTaskNotFound, &program); SetTestStepResult(EFail); } CleanupStack::PopAndDestroy(4, &apaLsSession); // windowGroupName, windowGroupList } // test steps return a result return TestStepResult(); }
// ================= 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 );*/ }