sl@0
|
1 |
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
|
sl@0
|
17 |
#include "testlauncher.pan"
|
sl@0
|
18 |
#include "testlauncherappUi.h"
|
sl@0
|
19 |
#include "testlauncherappView.h"
|
sl@0
|
20 |
#include "testlauncher.hrh"
|
sl@0
|
21 |
#include "testlauncherquerydialog.h"
|
sl@0
|
22 |
#include "testlistcontainer.h"
|
sl@0
|
23 |
|
sl@0
|
24 |
#include <avkon.hrh>
|
sl@0
|
25 |
#include <aknnotewrappers.h>
|
sl@0
|
26 |
#include <stringloader.h>
|
sl@0
|
27 |
#include <testlauncher.rsg>
|
sl@0
|
28 |
|
sl@0
|
29 |
|
sl@0
|
30 |
void CHelloWorldBasicAppUi::ConstructL()
|
sl@0
|
31 |
{
|
sl@0
|
32 |
// Initialise app UI with standard value.
|
sl@0
|
33 |
BaseConstructL(CAknAppUi::EAknEnableSkin);
|
sl@0
|
34 |
|
sl@0
|
35 |
// Create view object
|
sl@0
|
36 |
iAppView = CHelloWorldBasicAppView::NewL(ClientRect());
|
sl@0
|
37 |
|
sl@0
|
38 |
iAppContainer = new (ELeave) CFileListContainer;
|
sl@0
|
39 |
iAppContainer->SetMopParent(this);
|
sl@0
|
40 |
iAppContainer->ConstructL(ClientRect());
|
sl@0
|
41 |
AddToStackL(iAppContainer);
|
sl@0
|
42 |
}
|
sl@0
|
43 |
|
sl@0
|
44 |
CHelloWorldBasicAppUi::CHelloWorldBasicAppUi()
|
sl@0
|
45 |
{
|
sl@0
|
46 |
// empty
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
CHelloWorldBasicAppUi::~CHelloWorldBasicAppUi()
|
sl@0
|
50 |
{
|
sl@0
|
51 |
delete iAppView;
|
sl@0
|
52 |
if (iAppContainer)
|
sl@0
|
53 |
{
|
sl@0
|
54 |
RemoveFromStack(iAppContainer);
|
sl@0
|
55 |
delete iAppContainer;
|
sl@0
|
56 |
}
|
sl@0
|
57 |
}
|
sl@0
|
58 |
// Handles keyevents. In this application keyevents are
|
sl@0
|
59 |
// caught in CFileListContainer::OfferKeyEventL()
|
sl@0
|
60 |
TKeyResponse CHelloWorldBasicAppUi::HandleKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
|
sl@0
|
61 |
{
|
sl@0
|
62 |
return EKeyWasNotConsumed;
|
sl@0
|
63 |
}
|
sl@0
|
64 |
|
sl@0
|
65 |
// Takes care of command handling.
|
sl@0
|
66 |
void CHelloWorldBasicAppUi::HandleCommandL(TInt aCommand)
|
sl@0
|
67 |
{
|
sl@0
|
68 |
switch(aCommand)
|
sl@0
|
69 |
{
|
sl@0
|
70 |
case EEikCmdExit:
|
sl@0
|
71 |
case EAknSoftkeyExit:
|
sl@0
|
72 |
Exit();
|
sl@0
|
73 |
break;
|
sl@0
|
74 |
|
sl@0
|
75 |
case EHelloWorldBasicCommand1:
|
sl@0
|
76 |
{
|
sl@0
|
77 |
HBufC* defCmd = HBufC::NewLC(16);
|
sl@0
|
78 |
*defCmd = _L("testexecute.exe ");
|
sl@0
|
79 |
TBuf<1024> usrCmd;
|
sl@0
|
80 |
CHelloWorldQueryDialog* dlg = new (ELeave) CHelloWorldQueryDialog(usrCmd, defCmd);
|
sl@0
|
81 |
dlg->ExecuteLD(R_DIALOG_TEXT_EDIT_QUERY);
|
sl@0
|
82 |
CleanupStack::PopAndDestroy(defCmd);
|
sl@0
|
83 |
|
sl@0
|
84 |
TLex lex(usrCmd);
|
sl@0
|
85 |
TPtrC exe = lex.NextToken();
|
sl@0
|
86 |
TPtrC arg = lex.Remainder();
|
sl@0
|
87 |
|
sl@0
|
88 |
RProcess p;
|
sl@0
|
89 |
TInt err = p.Create(exe, arg);
|
sl@0
|
90 |
if (err != KErrNone)
|
sl@0
|
91 |
{
|
sl@0
|
92 |
CEikonEnv::Static()->InfoMsg(_L("Unable to create process"));
|
sl@0
|
93 |
break;
|
sl@0
|
94 |
}
|
sl@0
|
95 |
p.Resume();
|
sl@0
|
96 |
p.Close();
|
sl@0
|
97 |
}
|
sl@0
|
98 |
break;
|
sl@0
|
99 |
|
sl@0
|
100 |
case EHelloWorldBasicCommand2:
|
sl@0
|
101 |
{
|
sl@0
|
102 |
TPtrC exe = _L("testexecute.exe");
|
sl@0
|
103 |
TPtrC arg = _L("c:\\uibench_s60\\te_uibench_s60.script");
|
sl@0
|
104 |
|
sl@0
|
105 |
RProcess p;
|
sl@0
|
106 |
TInt err = p.Create(exe, arg);
|
sl@0
|
107 |
if (err != KErrNone)
|
sl@0
|
108 |
{
|
sl@0
|
109 |
CEikonEnv::Static()->InfoMsg(_L("Unable to create process"));
|
sl@0
|
110 |
break;
|
sl@0
|
111 |
}
|
sl@0
|
112 |
|
sl@0
|
113 |
p.Resume();
|
sl@0
|
114 |
p.Close();
|
sl@0
|
115 |
}
|
sl@0
|
116 |
break;
|
sl@0
|
117 |
|
sl@0
|
118 |
case EHelloWorldBasicCommand3:
|
sl@0
|
119 |
{
|
sl@0
|
120 |
TPtrC exe = _L("testexecute.exe");
|
sl@0
|
121 |
TPtrC arg = _L("c:\\ui_bench_s60\\");
|
sl@0
|
122 |
|
sl@0
|
123 |
RProcess p;
|
sl@0
|
124 |
TInt err = p.Create(exe, arg);
|
sl@0
|
125 |
if (err != KErrNone)
|
sl@0
|
126 |
{
|
sl@0
|
127 |
CEikonEnv::Static()->InfoMsg(_L("Unable to create process"));
|
sl@0
|
128 |
break;
|
sl@0
|
129 |
}
|
sl@0
|
130 |
p.Resume();
|
sl@0
|
131 |
p.Close();
|
sl@0
|
132 |
}
|
sl@0
|
133 |
break;
|
sl@0
|
134 |
case EHelloWorldBasicCommand4:
|
sl@0
|
135 |
{
|
sl@0
|
136 |
TPtrC exe = _L("testexecute.exe");
|
sl@0
|
137 |
TPtrC arg = _L("c:\\ui_bench_s60\\");
|
sl@0
|
138 |
|
sl@0
|
139 |
RProcess p;
|
sl@0
|
140 |
TInt err = p.Create(exe, arg);
|
sl@0
|
141 |
if (err != KErrNone)
|
sl@0
|
142 |
{
|
sl@0
|
143 |
CEikonEnv::Static()->InfoMsg(_L("Unable to create process"));
|
sl@0
|
144 |
break;
|
sl@0
|
145 |
}
|
sl@0
|
146 |
|
sl@0
|
147 |
p.Resume();
|
sl@0
|
148 |
p.Close();
|
sl@0
|
149 |
}
|
sl@0
|
150 |
break;
|
sl@0
|
151 |
case EAknSoftkeySelect:
|
sl@0
|
152 |
{
|
sl@0
|
153 |
iAppContainer->LaunchCurrentL();
|
sl@0
|
154 |
}
|
sl@0
|
155 |
break;
|
sl@0
|
156 |
default:
|
sl@0
|
157 |
Panic(EHelloWorldBasicUi);
|
sl@0
|
158 |
break;
|
sl@0
|
159 |
}
|
sl@0
|
160 |
}
|
sl@0
|
161 |
|
sl@0
|
162 |
// Called by the framework when the application status pane
|
sl@0
|
163 |
// size is changed. Passes the new client rectangle to the
|
sl@0
|
164 |
// AppView
|
sl@0
|
165 |
void CHelloWorldBasicAppUi::HandleStatusPaneSizeChange()
|
sl@0
|
166 |
{
|
sl@0
|
167 |
CAknAppUi::HandleStatusPaneSizeChange(); //call to upper class
|
sl@0
|
168 |
iAppContainer->SetRect(ClientRect());
|
sl@0
|
169 |
iAppView->SetRect(ClientRect());
|
sl@0
|
170 |
}
|