// ----------------------------------------------------------------------------- // 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(); } }
// ================= 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 );*/ }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ 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; } }