// ---------------------------------------------------------------------------------------- // CTerminalControlServer::StartProcessByFullNameL // ---------------------------------------------------------------------------------------- void CTerminalControlServer::StartProcessByFullNameL ( const TDesC8& aName ) { RDEBUG("CTerminalControlServer::StartProcessByFullNameL"); // 8bit to 16bit string // HBufC* fileNameBuf = HBufC::NewLC( aName.Length() ); TPtr fileName(fileNameBuf->Des()); fileName.Copy( aName ); // Connect to application architecture server // RApaLsSession apaLs; User::LeaveIfError( apaLs.Connect() ); CleanupClosePushL( apaLs ); // Create command line for process // CApaCommandLine* cmd = CApaCommandLine::NewLC(); cmd->SetExecutableNameL( fileName ); cmd->SetDocumentNameL( KNullDesC() ); cmd->SetCommandL( EApaCommandRun ); // Start application // User::LeaveIfError( apaLs.StartApp( *cmd ) ); CleanupStack::PopAndDestroy( cmd ); CleanupStack::PopAndDestroy( &apaLs ); CleanupStack::PopAndDestroy( fileNameBuf ); }
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 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 } } }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CMainContainer::HandleViewCommandL(TInt aCommand) { TBuf<60> Hjelpper; switch(aCommand) { case EAppHelpBack: { delete iMyHelpContainer; iMyHelpContainer = NULL; } SetMenuL(); DrawNow(); break; case EAppHelp: { delete iMyHelpContainer; iMyHelpContainer = NULL; iMyHelpContainer = CMyHelpContainer::NewL(0); } SetMenuL(); DrawNow(); break; case EProfTest: if(iProfileBox) { TInt Curr = iProfileBox->CurrentItemIndex(); if(Curr < 4) { if(Curr >= 0 && Curr < iKeyArray.Count()) { if(iKeyArray[Curr] && iKeyArray[Curr]->iNunmber) { TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); TApaTask task = taskList.FindApp(KUidCallUIApp); if ( task.Exists() ) { TBuf<200> hjelpper; if(iKeyArray[Curr]->iNunmber) hjelpper.Copy(*iKeyArray[Curr]->iNunmber); task.SwitchOpenFile(hjelpper); } else { //Do start UI now. TThreadId app_threadid; CApaCommandLine* cmdLine; cmdLine=CApaCommandLine::NewLC(); cmdLine->SetExecutableNameL(KtxCallUIAppFileName); if(iKeyArray[Curr]->iNunmber) cmdLine->SetDocumentNameL(*iKeyArray[Curr]->iNunmber); cmdLine->SetCommandL( EApaCommandRun ); RApaLsSession ls; User::LeaveIfError(ls.Connect()); ls.StartApp(*cmdLine,app_threadid); ls.Close(); CleanupStack::PopAndDestroy(); // cmdLine } } } } else { Curr = (Curr - 4); if(Curr >= 0 && Curr < iItemArray.Count()) { if(iItemArray[Curr]) { TApaTaskList taskList( CEikonEnv::Static()->WsSession() ); TApaTask task = taskList.FindApp(KUidCallUIApp); if ( task.Exists() ) { TBuf<200> hjelpper; if(iItemArray[Curr]->iNunmber) hjelpper.Copy(*iItemArray[Curr]->iNunmber); task.SwitchOpenFile(hjelpper); } else { //Do start UI now. TThreadId app_threadid; CApaCommandLine* cmdLine; cmdLine=CApaCommandLine::NewLC(); cmdLine->SetExecutableNameL(KtxCallUIAppFileName); if(iItemArray[Curr]->iNunmber) cmdLine->SetDocumentNameL(*iItemArray[Curr]->iNunmber); cmdLine->SetCommandL( EApaCommandRun ); RApaLsSession ls; User::LeaveIfError(ls.Connect()); ls.StartApp(*cmdLine,app_threadid); ls.Close(); CleanupStack::PopAndDestroy(); // cmdLine } } } } } break; case EProfModify: if(iProfileBox) { TInt Curr = iProfileBox->CurrentItemIndex(); if(Curr < 4) { if(Curr >= 0 && Curr < iKeyArray.Count()) { if(iKeyArray[Curr]) { // get current and add data to settings.. delete iProfileSettings; iProfileSettings = NULL; iProfileSettings = new(ELeave)CProfileSettings(iCba,EFalse); iProfileSettings->SetMopParent(this); iProfileSettings->ConstructL(); iProfileSettings->SetDataL(iKeyArray[Curr]); } } } else { Curr = (Curr - 4); if(Curr >= 0 && Curr < iItemArray.Count()) { if(iItemArray[Curr]) { // get current and add data to settings.. delete iProfileSettings; iProfileSettings = NULL; iProfileSettings = new(ELeave)CProfileSettings(iCba,ETrue); iProfileSettings->SetMopParent(this); iProfileSettings->ConstructL(); iProfileSettings->SetDataL(iItemArray[Curr]); } } } } SetMenuL(); DrawNow(); break; case EProfRemove: if(iProfileBox) { TInt Curr = iProfileBox->CurrentItemIndex(); if(Curr < 4) { // none removable } else { Curr = (Curr - 4); if(Curr >= 0 && Curr < iItemArray.Count()) { if(iItemArray[Curr]) { StringLoader::Load(Hjelpper,R_STR_REMMESSAGE); CAknQueryDialog* dlg = CAknQueryDialog::NewL(); if(dlg->ExecuteLD(R_QUERY,Hjelpper)) { CScheduleDB* ScheduleDB = new(ELeave)CScheduleDB(); CleanupStack::PushL(ScheduleDB); ScheduleDB->ConstructL(); ScheduleDB->DeleteFromDatabaseL(iItemArray[Curr]->iIndex); CleanupStack::PopAndDestroy(ScheduleDB); MakeProfileBoxL(); } } } } } SetMenuL(); DrawNow(); break; case EProfNew: { delete iProfileSettings; iProfileSettings = NULL; iProfileSettings = new(ELeave)CProfileSettings(iCba,ETrue); iProfileSettings->SetMopParent(this); iProfileSettings->ConstructL(); } SetMenuL(); DrawNow(); break; case ESettOk2: case ESettOk: if(iProfileSettings) { if(aCommand == ESettOk) { CMsgSched* newIttem = new(ELeave)CMsgSched(); CleanupStack::PushL(newIttem); newIttem->iIndex = -1; newIttem->iTime.HomeTime(); iProfileSettings->GetValuesL(newIttem); newIttem->iEnabled = ETrue; CScheduleDB* ScheduleDB = new(ELeave)CScheduleDB(); CleanupStack::PushL(ScheduleDB); ScheduleDB->ConstructL(); if(newIttem->iIndex >= 0) ScheduleDB->UpdateDatabaseL(newIttem); else ScheduleDB->SaveToDatabaseL(newIttem); CleanupStack::PopAndDestroy(ScheduleDB); CleanupStack::PopAndDestroy(newIttem); }else{ // ESettOk2 TInt Curr = iProfileBox->CurrentItemIndex(); if(Curr >= 0 && Curr < iKeyArray.Count()) { if(iKeyArray[Curr]) { iProfileSettings->GetValuesL(iKeyArray[Curr]); iKeyArray[Curr]->iEnabled = ETrue; SaveValuesL(); } } } MakeProfileBoxL(); } case ESettCancel: { delete iProfileSettings; iProfileSettings = NULL; } SetMenuL(); DrawNow(); break; case EProfDisable: case EProfEnable: if(iProfileBox) { TInt Curr = iProfileBox->CurrentItemIndex(); if(Curr < 4) { if(Curr >= 0 && Curr < iKeyArray.Count()) { if(iKeyArray[Curr]) { if(aCommand == EProfEnable) iKeyArray[Curr]->iEnabled = ETrue; else // EProfDisable iKeyArray[Curr]->iEnabled = EFalse; SaveValuesL(); iProfileBox->Model()->SetItemTextArray(GetProfilesArrayL()); } } } else { Curr = (Curr - 4); if(Curr >= 0 && Curr < iItemArray.Count()) { if(iItemArray[Curr]) { if(aCommand == EProfEnable) iItemArray[Curr]->iEnabled = ETrue; else // EProfDisable iItemArray[Curr]->iEnabled = EFalse; CScheduleDB* ScheduleDB = new(ELeave)CScheduleDB(); CleanupStack::PushL(ScheduleDB); ScheduleDB->ConstructL(); ScheduleDB->UpdateDatabaseL(iItemArray[Curr]); CleanupStack::PopAndDestroy(ScheduleDB); iProfileBox->Model()->SetItemTextArray(GetProfilesArrayL()); } } } } DrawNow(); break; case ESett2Ok: if(iDefaultSettings) { iDefaultSettings->SaveValuesL(); } case ESett2Cancel: { delete iDefaultSettings; iDefaultSettings = NULL; } SetMenuL(); DrawNow(); break; case EDefSettings: { iDefaultSettings = new(ELeave)CDefaultSettings(iCba); iDefaultSettings->ConstructL(); } SetMenuL(); DrawNow(); break; default: if(iDefaultSettings) { iDefaultSettings->HandleViewCommandL(aCommand); } else if(iProfileSettings) { iProfileSettings->HandleViewCommandL(aCommand); } break; } }