|
1 /* |
|
2 * Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Test akndialog.h |
|
15 * |
|
16 */ |
|
17 |
|
18 //INCLUDE |
|
19 #include <avkon.rsg> |
|
20 #include <akndialog.h> |
|
21 #include <eikmenup.h> |
|
22 #include <testsdkqueries.rsg> |
|
23 #include <avkon.hrh> |
|
24 #include <eikdialg.h> |
|
25 #include <aknscontrolcontext.h> |
|
26 #include <coemop.h> |
|
27 #include <aknqueryvalue.h> |
|
28 |
|
29 #include "testsdkqueries.h" |
|
30 #include "testsdkakndialgprotected.h" |
|
31 #include "testsdkqueriesview.h" |
|
32 #include "testsdkqueriescontainer.h" |
|
33 |
|
34 // ----------------------------------------------------------------------------- |
|
35 // CTestSDKQueries::TestDlgCAknDialog |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 TInt CTestSDKQueries::TestDlgCAknDialogL( CStifItemParser& /*aItem*/ ) |
|
39 { |
|
40 // Print to UI |
|
41 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
42 _LIT( KTestDlgCAknDialog, "In TestDlgCAknDialog" ); |
|
43 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgCAknDialog ); |
|
44 // Print to log file |
|
45 iLog->Log( KTestDlgCAknDialog ); |
|
46 |
|
47 TInt err = KErrNone; |
|
48 |
|
49 iDialog = new (ELeave) CAknDialog(); |
|
50 |
|
51 return err; |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CTestSDKQueries::TestDlgConstructL |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 TInt CTestSDKQueries::TestDlgConstructL( CStifItemParser& /*aItem*/ ) |
|
59 { |
|
60 // Print to UI |
|
61 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
62 _LIT( KTestDlgConstructL, "In TestDlgConstructL" ); |
|
63 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgConstructL ); |
|
64 // Print to log file |
|
65 iLog->Log( KTestDlgConstructL ); |
|
66 |
|
67 TInt err = KErrNone; |
|
68 |
|
69 TRAP( err, iDialog->ConstructL( R_AVKON_MENUPANE_EXIT ) ); |
|
70 |
|
71 return err; |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CTestSDKQueries::TestDlgDelete |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 TInt CTestSDKQueries::TestDlgDelete( CStifItemParser& /*aItem*/ ) |
|
79 { |
|
80 // Print to UI |
|
81 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
82 _LIT( KTestDlgDelete, "In TestDlgDelete" ); |
|
83 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgDelete ); |
|
84 // Print to log file |
|
85 iLog->Log( KTestDlgDelete ); |
|
86 |
|
87 TInt err = KErrNone; |
|
88 |
|
89 delete iDialog; |
|
90 iDialog = NULL; |
|
91 |
|
92 return err; |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CTestSDKQueries::TestDlgExecuteLD |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 TInt CTestSDKQueries::TestDlgExecuteLD( CStifItemParser& /*aItem*/ ) |
|
100 { |
|
101 // Print to UI |
|
102 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
103 _LIT( KTestDlgExecuteLD, "In TestDlgExecuteLD" ); |
|
104 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgExecuteLD ); |
|
105 // Print to log file |
|
106 iLog->Log( KTestDlgExecuteLD ); |
|
107 |
|
108 TInt err = KErrNone; |
|
109 |
|
110 TRAP( err, iDialog->ExecuteLD( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ) ); |
|
111 |
|
112 return err; |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CTestSDKQueries::TestDlgPrepareLC |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 TInt CTestSDKQueries::TestDlgPrepareLC( CStifItemParser& /*aItem*/ ) |
|
120 { |
|
121 // Print to UI |
|
122 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
123 _LIT( KTestDlgPrepareLC, "In TestDlgPrepareLC" ); |
|
124 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgPrepareLC ); |
|
125 // Print to log file |
|
126 iLog->Log( KTestDlgPrepareLC ); |
|
127 |
|
128 TInt err = KErrNone; |
|
129 |
|
130 iDialog->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ); |
|
131 |
|
132 CleanupStack::PopAndDestroy( iDialog ); |
|
133 |
|
134 return err; |
|
135 } |
|
136 |
|
137 // ----------------------------------------------------------------------------- |
|
138 // CTestSDKQueries::TestDlgRunLD |
|
139 // ----------------------------------------------------------------------------- |
|
140 // |
|
141 TInt CTestSDKQueries::TestDlgRunLD( CStifItemParser& /*aItem*/ ) |
|
142 { |
|
143 // Print to UI |
|
144 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
145 _LIT( KTestDlgRunLD, "In TestDlgRunLD" ); |
|
146 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgRunLD ); |
|
147 // Print to log file |
|
148 iLog->Log( KTestDlgRunLD ); |
|
149 |
|
150 TInt err = KErrNone; |
|
151 |
|
152 iDialog->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ); |
|
153 iDialog->RunLD(); |
|
154 |
|
155 return err; |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CTestSDKQueries::TestDlgSetEmphasis |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 TInt CTestSDKQueries::TestDlgSetEmphasisL( CStifItemParser& /*aItem*/ ) |
|
163 { |
|
164 // Print to UI |
|
165 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
166 _LIT( KTestDlgSetEmphasis, "In TestDlgSetEmphasis" ); |
|
167 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgSetEmphasis ); |
|
168 // Print to log file |
|
169 iLog->Log( KTestDlgSetEmphasis ); |
|
170 |
|
171 TInt err = KErrNone; |
|
172 |
|
173 CCoeControl* menuControl = new (ELeave) CCoeControl(); |
|
174 |
|
175 iDialog->SetEmphasis( menuControl, ETrue ); |
|
176 |
|
177 return err; |
|
178 } |
|
179 |
|
180 // ----------------------------------------------------------------------------- |
|
181 // CTestSDKQueries::TestDlgDynInitMenuPaneL |
|
182 // ----------------------------------------------------------------------------- |
|
183 // |
|
184 TInt CTestSDKQueries::TestDlgDynInitMenuPaneL( CStifItemParser& /*aItem*/ ) |
|
185 { |
|
186 // Print to UI |
|
187 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
188 _LIT( KTestDlgDynInitMenuPaneL, "In TestDlgDynInitMenuPaneL" ); |
|
189 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgDynInitMenuPaneL ); |
|
190 // Print to log file |
|
191 iLog->Log( KTestDlgDynInitMenuPaneL ); |
|
192 |
|
193 TInt err = KErrNone; |
|
194 |
|
195 iDialog->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ); |
|
196 |
|
197 CEikMenuPane* menuPane = new( ELeave ) CEikMenuPane( iDialog ); |
|
198 CleanupStack::PushL( menuPane ); |
|
199 |
|
200 iDialog->DynInitMenuPaneL( R_TESTQUERY_LISTQUERY_MENU, menuPane ); |
|
201 |
|
202 CleanupStack::PopAndDestroy( menuPane ); |
|
203 CleanupStack::PopAndDestroy( iDialog ); |
|
204 |
|
205 return err; |
|
206 } |
|
207 |
|
208 // ----------------------------------------------------------------------------- |
|
209 // CTestSDKQueries::TestDlgProcessCommandL |
|
210 // ----------------------------------------------------------------------------- |
|
211 // |
|
212 TInt CTestSDKQueries::TestDlgProcessCommandL( CStifItemParser& /*aItem*/ ) |
|
213 { |
|
214 // Print to UI |
|
215 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
216 _LIT( KTestDlgProcessCommandL, "In TestDlgProcessCommandL" ); |
|
217 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgProcessCommandL ); |
|
218 // Print to log file |
|
219 iLog->Log( KTestDlgProcessCommandL ); |
|
220 |
|
221 TInt err = KErrNone; |
|
222 |
|
223 iDialog->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ); |
|
224 |
|
225 TRAP( err, iDialog->ProcessCommandL( 0 ) ); |
|
226 |
|
227 CleanupStack::PopAndDestroy( iDialog ); |
|
228 |
|
229 return err; |
|
230 } |
|
231 |
|
232 // ----------------------------------------------------------------------------- |
|
233 // CTestSDKQueries::TestDlgOfferKeyEventL |
|
234 // ----------------------------------------------------------------------------- |
|
235 // |
|
236 TInt CTestSDKQueries::TestDlgOfferKeyEventL( CStifItemParser& /*aItem*/ ) |
|
237 { |
|
238 // Print to UI |
|
239 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
240 _LIT( KTestDlgOfferKeyEventL, "In TestDlgOfferKeyEventL" ); |
|
241 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgOfferKeyEventL ); |
|
242 // Print to log file |
|
243 iLog->Log( KTestDlgOfferKeyEventL ); |
|
244 |
|
245 TInt err = KErrNone; |
|
246 |
|
247 iDialog->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ); |
|
248 |
|
249 TKeyEvent keyEvent; |
|
250 keyEvent.iCode = EKeyEscape; |
|
251 TEventCode type = EEventKey; |
|
252 |
|
253 TRAP( err, iDialog->OfferKeyEventL( keyEvent, type ) ); |
|
254 |
|
255 CleanupStack::PopAndDestroy( iDialog ); |
|
256 |
|
257 return err; |
|
258 } |
|
259 |
|
260 // ----------------------------------------------------------------------------- |
|
261 // CTestSDKQueries::TestDlgFocusChanged |
|
262 // ----------------------------------------------------------------------------- |
|
263 // |
|
264 TInt CTestSDKQueries::TestDlgFocusChangedL( CStifItemParser& /*aItem*/ ) |
|
265 { |
|
266 // Print to UI |
|
267 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
268 _LIT( KTestDlgFocusChanged, "In TestDlgFocusChanged" ); |
|
269 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgFocusChanged ); |
|
270 // Print to log file |
|
271 iLog->Log( KTestDlgFocusChanged ); |
|
272 |
|
273 TInt err = KErrNone; |
|
274 |
|
275 iDialog->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ); |
|
276 |
|
277 TDrawNow drawNow = EDrawNow; |
|
278 iDialog->FocusChanged( drawNow ); |
|
279 |
|
280 CleanupStack::PopAndDestroy( iDialog ); |
|
281 |
|
282 return err; |
|
283 } |
|
284 |
|
285 // ----------------------------------------------------------------------------- |
|
286 // CTestSDKQueries::TestDlgHandlePointerEventL |
|
287 // ----------------------------------------------------------------------------- |
|
288 // |
|
289 TInt CTestSDKQueries::TestDlgHandlePointerEventL( CStifItemParser& /*aItem*/ ) |
|
290 { |
|
291 // Print to UI |
|
292 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
293 _LIT( KTestDlgHandlePointerEventL, "In TestDlgHandlePointerEventL" ); |
|
294 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgHandlePointerEventL ); |
|
295 // Print to log file |
|
296 iLog->Log( KTestDlgHandlePointerEventL ); |
|
297 |
|
298 TInt err = KErrNone; |
|
299 |
|
300 iDialog->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ); |
|
301 |
|
302 TPointerEvent event; |
|
303 event.iType = TPointerEvent::EButton1Down; |
|
304 event.iModifiers = 0; |
|
305 TPoint eventPos( 10, 30 ); |
|
306 event.iPosition = eventPos; |
|
307 event.iParentPosition = eventPos; |
|
308 |
|
309 TRAP( err, iDialog->HandlePointerEventL( event ) ); |
|
310 |
|
311 CleanupStack::PopAndDestroy( iDialog ); |
|
312 |
|
313 return err; |
|
314 } |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
|
317 // CTestSDKQueries::TestDlgOkToExitL |
|
318 // ----------------------------------------------------------------------------- |
|
319 // |
|
320 TInt CTestSDKQueries::TestDlgOkToExitL( CStifItemParser& /*aItem*/ ) |
|
321 { |
|
322 // Print to UI |
|
323 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
324 _LIT( KTestDlgOkToExitL, "In TestDlgOkToExitL" ); |
|
325 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgOkToExitL ); |
|
326 // Print to log file |
|
327 iLog->Log( KTestDlgOkToExitL ); |
|
328 |
|
329 TInt err = KErrNone; |
|
330 |
|
331 iTestDialog = new (ELeave) CTestSDKQueriesDialg(); |
|
332 |
|
333 iTestDialog->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ); |
|
334 |
|
335 TInt buttonId = EAknSoftkeyMark; |
|
336 TRAP( err, iTestDialog->OkToExitL( buttonId ) ); |
|
337 |
|
338 CleanupStack::PopAndDestroy( iTestDialog ); |
|
339 |
|
340 return err; |
|
341 } |
|
342 |
|
343 // ----------------------------------------------------------------------------- |
|
344 // CTestSDKQueries::TestDlgDisplayMenuL |
|
345 // ----------------------------------------------------------------------------- |
|
346 // |
|
347 TInt CTestSDKQueries::TestDlgDisplayMenuL( CStifItemParser& /*aItem*/ ) |
|
348 { |
|
349 // Print to UI |
|
350 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
351 _LIT( KTestDlgDisplayMenuL, "In TestDlgDisplayMenuL" ); |
|
352 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgDisplayMenuL ); |
|
353 // Print to log file |
|
354 iLog->Log( KTestDlgDisplayMenuL ); |
|
355 |
|
356 TInt err = KErrNone; |
|
357 |
|
358 iTestDialog = new (ELeave) CTestSDKQueriesDialg(); |
|
359 |
|
360 iTestDialog->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ); |
|
361 |
|
362 TRAP( err, iTestDialog->DisplayMenuL() ); |
|
363 |
|
364 CleanupStack::PopAndDestroy( iTestDialog ); |
|
365 |
|
366 return err; |
|
367 } |
|
368 |
|
369 // ----------------------------------------------------------------------------- |
|
370 // CTestSDKQueries::TestDlgHideMenu |
|
371 // ----------------------------------------------------------------------------- |
|
372 // |
|
373 TInt CTestSDKQueries::TestDlgHideMenuL( CStifItemParser& /*aItem*/ ) |
|
374 { |
|
375 // Print to UI |
|
376 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
377 _LIT( KTestDlgHideMenu, "In TestDlgHideMenu" ); |
|
378 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgHideMenu ); |
|
379 // Print to log file |
|
380 iLog->Log( KTestDlgHideMenu ); |
|
381 |
|
382 TInt err = KErrNone; |
|
383 |
|
384 |
|
385 iTestDialog = new (ELeave) CTestSDKQueriesDialg(); |
|
386 |
|
387 iTestDialog->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ); |
|
388 |
|
389 iTestDialog->HideMenu(); |
|
390 |
|
391 CleanupStack::PopAndDestroy( iTestDialog ); |
|
392 |
|
393 return err; |
|
394 } |
|
395 |
|
396 // ----------------------------------------------------------------------------- |
|
397 // CTestSDKQueries::TestDlgMenuShowing |
|
398 // ----------------------------------------------------------------------------- |
|
399 // |
|
400 TInt CTestSDKQueries::TestDlgMenuShowingL( CStifItemParser& /*aItem*/ ) |
|
401 { |
|
402 // Print to UI |
|
403 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
404 _LIT( KTestDlgMenuShowing, "In TestDlgMenuShowing" ); |
|
405 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgMenuShowing ); |
|
406 // Print to log file |
|
407 iLog->Log( KTestDlgMenuShowing ); |
|
408 |
|
409 TInt err = KErrNone; |
|
410 |
|
411 iTestDialog = new (ELeave) CTestSDKQueriesDialg(); |
|
412 |
|
413 iTestDialog->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ); |
|
414 |
|
415 iTestDialog->MenuShowing(); |
|
416 |
|
417 CleanupStack::PopAndDestroy( iTestDialog ); |
|
418 |
|
419 return err; |
|
420 } |
|
421 |
|
422 // ----------------------------------------------------------------------------- |
|
423 // CTestSDKQueries::TestDlgSizeChanged |
|
424 // ----------------------------------------------------------------------------- |
|
425 // |
|
426 TInt CTestSDKQueries::TestDlgSizeChangedL( CStifItemParser& /*aItem*/ ) |
|
427 { |
|
428 // Print to UI |
|
429 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
430 _LIT( KTestDlgSizeChanged, "In TestDlgSizeChanged" ); |
|
431 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgSizeChanged ); |
|
432 // Print to log file |
|
433 iLog->Log( KTestDlgSizeChanged ); |
|
434 |
|
435 TInt err = KErrNone; |
|
436 |
|
437 iTestDialog = new (ELeave) CTestSDKQueriesDialg(); |
|
438 |
|
439 iTestDialog->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ); |
|
440 |
|
441 iTestDialog->SizeChanged(); |
|
442 |
|
443 CleanupStack::PopAndDestroy( iTestDialog ); |
|
444 |
|
445 return err; |
|
446 } |
|
447 |
|
448 // ----------------------------------------------------------------------------- |
|
449 // CTestSDKQueries::TestDlgDraw |
|
450 // ----------------------------------------------------------------------------- |
|
451 // |
|
452 TInt CTestSDKQueries::TestDlgDrawL( CStifItemParser& /*aItem*/ ) |
|
453 { |
|
454 // Print to UI |
|
455 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
456 _LIT( KTestDlgDraw, "In TestDlgDraw" ); |
|
457 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgDraw ); |
|
458 // Print to log file |
|
459 iLog->Log( KTestDlgDraw ); |
|
460 |
|
461 TInt err = KErrNone; |
|
462 |
|
463 iTestDialog = new (ELeave) CTestSDKQueriesDialg(); |
|
464 |
|
465 iTestDialog->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ); |
|
466 |
|
467 iTestDialog->SetContainerWindowL( *iContainer ); |
|
468 |
|
469 iContainer->ActivateGc(); |
|
470 TRect rect; |
|
471 iTestDialog->Draw( rect ); |
|
472 iContainer->DeactivateGc(); |
|
473 |
|
474 CleanupStack::PopAndDestroy( iTestDialog ); |
|
475 |
|
476 return err; |
|
477 } |
|
478 |
|
479 // ----------------------------------------------------------------------------- |
|
480 // CTestSDKQueries::TestDlgMopSupplyObjectL |
|
481 // ----------------------------------------------------------------------------- |
|
482 // |
|
483 TInt CTestSDKQueries::TestDlgMopSupplyObjectL( CStifItemParser& /*aItem*/ ) |
|
484 { |
|
485 // Print to UI |
|
486 _LIT( Ktestsdkqueries, "testsdkqueries" ); |
|
487 _LIT( KTestDlgMopSupplyObject, "In TestDlgMopSupplyObject" ); |
|
488 TestModuleIf().Printf( 0, Ktestsdkqueries, KTestDlgMopSupplyObject ); |
|
489 // Print to log file |
|
490 iLog->Log( KTestDlgMopSupplyObject ); |
|
491 |
|
492 TInt err = KErrNone; |
|
493 |
|
494 iTestDialog = new (ELeave) CTestSDKQueriesDialg(); |
|
495 |
|
496 iTestDialog->PrepareLC( R_AVKON_DIALOG_QUERY_VALUE_NUMBER ); |
|
497 |
|
498 TTypeUid uid( MAknsControlContext::ETypeId ); |
|
499 iTestDialog->MopSupplyObject( uid ); |
|
500 |
|
501 CleanupStack::PopAndDestroy( iTestDialog ); |
|
502 |
|
503 return err; |
|
504 } |
|
505 |
|
506 //End file |
|
507 |
|
508 |
|
509 |