sl@0: // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: sl@0: #include "testlauncher.pan" sl@0: #include "testlauncherappUi.h" sl@0: #include "testlauncherappView.h" sl@0: #include "testlauncher.hrh" sl@0: #include "testlauncherquerydialog.h" sl@0: #include "testlistcontainer.h" sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: sl@0: void CHelloWorldBasicAppUi::ConstructL() sl@0: { sl@0: // Initialise app UI with standard value. sl@0: BaseConstructL(CAknAppUi::EAknEnableSkin); sl@0: sl@0: // Create view object sl@0: iAppView = CHelloWorldBasicAppView::NewL(ClientRect()); sl@0: sl@0: iAppContainer = new (ELeave) CFileListContainer; sl@0: iAppContainer->SetMopParent(this); sl@0: iAppContainer->ConstructL(ClientRect()); sl@0: AddToStackL(iAppContainer); sl@0: } sl@0: sl@0: CHelloWorldBasicAppUi::CHelloWorldBasicAppUi() sl@0: { sl@0: // empty sl@0: } sl@0: sl@0: CHelloWorldBasicAppUi::~CHelloWorldBasicAppUi() sl@0: { sl@0: delete iAppView; sl@0: if (iAppContainer) sl@0: { sl@0: RemoveFromStack(iAppContainer); sl@0: delete iAppContainer; sl@0: } sl@0: } sl@0: // Handles keyevents. In this application keyevents are sl@0: // caught in CFileListContainer::OfferKeyEventL() sl@0: TKeyResponse CHelloWorldBasicAppUi::HandleKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/) sl@0: { sl@0: return EKeyWasNotConsumed; sl@0: } sl@0: sl@0: // Takes care of command handling. sl@0: void CHelloWorldBasicAppUi::HandleCommandL(TInt aCommand) sl@0: { sl@0: switch(aCommand) sl@0: { sl@0: case EEikCmdExit: sl@0: case EAknSoftkeyExit: sl@0: Exit(); sl@0: break; sl@0: sl@0: case EHelloWorldBasicCommand1: sl@0: { sl@0: HBufC* defCmd = HBufC::NewLC(16); sl@0: *defCmd = _L("testexecute.exe "); sl@0: TBuf<1024> usrCmd; sl@0: CHelloWorldQueryDialog* dlg = new (ELeave) CHelloWorldQueryDialog(usrCmd, defCmd); sl@0: dlg->ExecuteLD(R_DIALOG_TEXT_EDIT_QUERY); sl@0: CleanupStack::PopAndDestroy(defCmd); sl@0: sl@0: TLex lex(usrCmd); sl@0: TPtrC exe = lex.NextToken(); sl@0: TPtrC arg = lex.Remainder(); sl@0: sl@0: RProcess p; sl@0: TInt err = p.Create(exe, arg); sl@0: if (err != KErrNone) sl@0: { sl@0: CEikonEnv::Static()->InfoMsg(_L("Unable to create process")); sl@0: break; sl@0: } sl@0: p.Resume(); sl@0: p.Close(); sl@0: } sl@0: break; sl@0: sl@0: case EHelloWorldBasicCommand2: sl@0: { sl@0: TPtrC exe = _L("testexecute.exe"); sl@0: TPtrC arg = _L("c:\\uibench_s60\\te_uibench_s60.script"); sl@0: sl@0: RProcess p; sl@0: TInt err = p.Create(exe, arg); sl@0: if (err != KErrNone) sl@0: { sl@0: CEikonEnv::Static()->InfoMsg(_L("Unable to create process")); sl@0: break; sl@0: } sl@0: sl@0: p.Resume(); sl@0: p.Close(); sl@0: } sl@0: break; sl@0: sl@0: case EHelloWorldBasicCommand3: sl@0: { sl@0: TPtrC exe = _L("testexecute.exe"); sl@0: TPtrC arg = _L("c:\\ui_bench_s60\\"); sl@0: sl@0: RProcess p; sl@0: TInt err = p.Create(exe, arg); sl@0: if (err != KErrNone) sl@0: { sl@0: CEikonEnv::Static()->InfoMsg(_L("Unable to create process")); sl@0: break; sl@0: } sl@0: p.Resume(); sl@0: p.Close(); sl@0: } sl@0: break; sl@0: case EHelloWorldBasicCommand4: sl@0: { sl@0: TPtrC exe = _L("testexecute.exe"); sl@0: TPtrC arg = _L("c:\\ui_bench_s60\\"); sl@0: sl@0: RProcess p; sl@0: TInt err = p.Create(exe, arg); sl@0: if (err != KErrNone) sl@0: { sl@0: CEikonEnv::Static()->InfoMsg(_L("Unable to create process")); sl@0: break; sl@0: } sl@0: sl@0: p.Resume(); sl@0: p.Close(); sl@0: } sl@0: break; sl@0: case EAknSoftkeySelect: sl@0: { sl@0: iAppContainer->LaunchCurrentL(); sl@0: } sl@0: break; sl@0: default: sl@0: Panic(EHelloWorldBasicUi); sl@0: break; sl@0: } sl@0: } sl@0: sl@0: // Called by the framework when the application status pane sl@0: // size is changed. Passes the new client rectangle to the sl@0: // AppView sl@0: void CHelloWorldBasicAppUi::HandleStatusPaneSizeChange() sl@0: { sl@0: CAknAppUi::HandleStatusPaneSizeChange(); //call to upper class sl@0: iAppContainer->SetRect(ClientRect()); sl@0: iAppView->SetRect(ClientRect()); sl@0: }