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