|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "CMCETestUIAppUi.h" |
|
20 #include "CMCETestUIDoc.h" |
|
21 #include "CMCETestUIAppView.h" |
|
22 #include "CMCETestUISessionView.h" |
|
23 #include "CMCETestUIStreamView.h" |
|
24 #include "createpocsessiondialog.h" |
|
25 #include "createvoipsessiondialog.h" |
|
26 #include "create2wayvideosessiondialog.h" |
|
27 #include "createsessiondialog.h" |
|
28 #include "createeventdialog.h" |
|
29 #include "createreferdialog.h" |
|
30 #include "createNotifyDialog.h" |
|
31 #include "createsessionEstablishValuesdialog.h" |
|
32 #include "createMceTestValueSettingsDialog.h" |
|
33 #include "createMceTestSettingsDialog.h" |
|
34 #include "createStartDTMFDialog.h" |
|
35 #include "createSendDTMFDialog.h" |
|
36 #include "createSendDTMFSequenceDialog.h" |
|
37 #include "createCryptoHandlingDialog.h" |
|
38 #include "createAudioCodecDialog.h" |
|
39 #include "mcetestuiactivitymanager.h" |
|
40 #include <MCETestUI.rsg> |
|
41 |
|
42 #include <aknappui.h> |
|
43 #include <aknpopup.h> |
|
44 #include <AknQueryDialog.h> |
|
45 #include <AknNoteWrappers.h> |
|
46 |
|
47 #include "CMCETestUIEngine.h" |
|
48 |
|
49 const TInt KBufLength = 100; |
|
50 const TInt KMCETestUIBacklightTimeOut = 4; // seconds |
|
51 |
|
52 |
|
53 CMCETestUIAppUi::CMCETestUIAppUi( CMCETestUIEngine& aEngine ) |
|
54 :iEngine(aEngine) |
|
55 { |
|
56 iEngine.SetUserInterface( this ); |
|
57 } |
|
58 |
|
59 void CMCETestUIAppUi::ConstructL() |
|
60 { |
|
61 |
|
62 BaseConstructL(EAknEnableSkin); |
|
63 |
|
64 |
|
65 iMainView = CMCETestUIAppView::NewL( iEngine ); |
|
66 AddViewL( iMainView ); // transfer ownership |
|
67 |
|
68 iSessionView = CMCETestUISessionView::NewL( iEngine ); |
|
69 AddViewL( iSessionView ); |
|
70 |
|
71 iStreamView = CMCETestUIStreamView::NewL(iEngine); |
|
72 AddViewL(iStreamView); |
|
73 |
|
74 SetDefaultViewL( *iMainView ); |
|
75 iEnableVideo = EFalse; |
|
76 |
|
77 iActivityManager = CMCETestUIActivityManager::NewL( KMCETestUIBacklightTimeOut ); |
|
78 iActivityManager->Reset(); |
|
79 |
|
80 } |
|
81 |
|
82 |
|
83 CMCETestUIAppUi::~CMCETestUIAppUi() |
|
84 { |
|
85 delete iActivityManager; |
|
86 } |
|
87 |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CMCETestUIAppUi::EngineStateChanged |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 void CMCETestUIAppUi::EngineStateChangedL() |
|
94 { |
|
95 iMainView->EngineStateChangedL(); |
|
96 iSessionView->EngineStateChangedL(); |
|
97 iStreamView->EngineStateChangedL(); |
|
98 } |
|
99 |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CMCETestUIAppUi::NotifyUser |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void CMCETestUIAppUi::NotifyUser( const TDesC& aMessage ) |
|
106 { |
|
107 // User::InfoPrint( aMessage ); |
|
108 CAknInformationNote* note = new (ELeave) CAknInformationNote( EFalse ); |
|
109 note->SetTimeout( CAknNoteDialog::EShortTimeout ); |
|
110 note->ExecuteLD( aMessage ); |
|
111 } |
|
112 |
|
113 void CMCETestUIAppUi::NotifyUserWaitL( const TDesC& aMessage ) |
|
114 { |
|
115 CAknConfirmationNote* note = new (ELeave) CAknConfirmationNote( ETrue ); |
|
116 note->SetTimeout( CAknNoteDialog::ENoTimeout ); |
|
117 note->ExecuteLD( aMessage ); |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CMCETestUIAppUi::AskQuestion |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 TInt CMCETestUIAppUi::AskQuestionL( |
|
125 const CMCETestUIQuestionSingleSelection& aQuestion ) |
|
126 { |
|
127 |
|
128 // Generate list |
|
129 CAknSinglePopupMenuStyleListBox* listBox = |
|
130 new (ELeave) CAknSinglePopupMenuStyleListBox; |
|
131 CleanupStack::PushL( listBox ); |
|
132 |
|
133 CAknPopupList* popup = CAknPopupList::NewL( |
|
134 listBox, |
|
135 R_AVKON_SOFTKEYS_MENU_LIST, |
|
136 AknPopupLayouts::EPopupSNotePopupWindow ); |
|
137 CleanupStack::PushL( popup ); |
|
138 popup->SetTitleL( aQuestion.Caption() ); |
|
139 |
|
140 listBox->ConstructL( popup, |
|
141 EAknListBoxSelectionList | EAknListBoxLoopScrolling); |
|
142 |
|
143 listBox->CreateScrollBarFrameL( ETrue ); |
|
144 listBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
145 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
|
146 |
|
147 listBox->Model()->SetItemTextArray( &(aQuestion.Choices()) ); |
|
148 listBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
149 |
|
150 CleanupStack::Pop( popup ); |
|
151 TInt selectedIndex = -1; |
|
152 if ( popup->ExecuteLD() ) |
|
153 { |
|
154 selectedIndex = listBox->CurrentItemIndex(); |
|
155 } |
|
156 |
|
157 CleanupStack::PopAndDestroy( listBox ); |
|
158 return selectedIndex; |
|
159 |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CMCETestUIAppUi::AskQuestion |
|
164 // ----------------------------------------------------------------------------- |
|
165 // |
|
166 void CMCETestUIAppUi::AskQuestionL( CMCETestUIQuestionDataQuery& aQuestion ) |
|
167 { |
|
168 |
|
169 TBuf<KBufLength> answer; |
|
170 answer.Copy( aQuestion.DefaultValue() ); |
|
171 CAknTextQueryDialog* dlg = CAknTextQueryDialog::NewL( answer ); |
|
172 dlg->SetMaxLength( KBufLength ); |
|
173 dlg->ExecuteLD( R_TEXT_QUERY_DIALOG, aQuestion.Caption() ); |
|
174 aQuestion.SetAnswerL( answer ); |
|
175 |
|
176 } |
|
177 // ----------------------------------------------------------------------------- |
|
178 // CMCETestUIAppUi::SessionParams |
|
179 // ----------------------------------------------------------------------------- |
|
180 // |
|
181 TBool CMCETestUIAppUi::SessionParamsL(TSessionParams &aSessionParams, TSessionType aSessionType) |
|
182 { |
|
183 if( aSessionType == EPoCSession) |
|
184 { |
|
185 CCreatePoCSessionDialog* dialog = new ( ELeave ) CCreatePoCSessionDialog( &aSessionParams ); |
|
186 if(dialog->ExecuteLD( R_POC_SESSION_DIALOG )) |
|
187 { |
|
188 return ETrue; |
|
189 } |
|
190 } |
|
191 else if( aSessionType == EVoIPSession) |
|
192 { |
|
193 CCreateVoIPSessionDialog* dialog = new ( ELeave ) CCreateVoIPSessionDialog( &aSessionParams ); |
|
194 if(dialog->ExecuteLD( R_VOIP_SESSION_DIALOG )) |
|
195 { |
|
196 return ETrue; |
|
197 } |
|
198 } |
|
199 else if ( aSessionType == E2WayVideoSession ) |
|
200 { |
|
201 CCreate2WayVideoSessionDialog* dialog = new ( ELeave ) CCreate2WayVideoSessionDialog( &aSessionParams ); |
|
202 if(dialog->ExecuteLD( R_2WAYVIDEO_SESSION_DIALOG )) |
|
203 { |
|
204 return ETrue; |
|
205 } |
|
206 } |
|
207 else if ( aSessionType == ECustomSession) |
|
208 { |
|
209 CCreateSessionDialog* dialog = new ( ELeave ) CCreateSessionDialog( &aSessionParams ); |
|
210 if(dialog->ExecuteLD( R_MCE_SESSION_DIALOG ) ) |
|
211 { |
|
212 return ETrue; |
|
213 } |
|
214 } |
|
215 return ETrue ;// this code still needs to be updated as it is wrong behaviour |
|
216 } |
|
217 |
|
218 // ----------------------------------------------------------------------------- |
|
219 // CMCETestUIAppUi::SessionEstablishValues |
|
220 // ----------------------------------------------------------------------------- |
|
221 // |
|
222 |
|
223 TBool CMCETestUIAppUi::SessionEstablishValues(TSessionEstablishValues &sessionValues) |
|
224 { |
|
225 CSessionEstablishValuesDialog *dialog = new (ELeave)CSessionEstablishValuesDialog(&sessionValues); |
|
226 if (dialog->ExecuteLD(R_MCE_ESTABLISH_VALUES_DIALOG)) |
|
227 { |
|
228 return ETrue; |
|
229 } |
|
230 |
|
231 return EFalse; |
|
232 } |
|
233 |
|
234 // ----------------------------------------------------------------------------- |
|
235 // CMCETestUIAppUi::SessionEstablishValues |
|
236 // ----------------------------------------------------------------------------- |
|
237 // |
|
238 |
|
239 TBool CMCETestUIAppUi::NotifyValues(TNotifyValues ¬ifyValues) |
|
240 { |
|
241 CNotifyDialog *dialog = new (ELeave)CNotifyDialog(¬ifyValues); |
|
242 if (dialog->ExecuteLD(R_MCE_NOTIFY_DIALOG)) |
|
243 { |
|
244 return ETrue; |
|
245 } |
|
246 |
|
247 return EFalse; |
|
248 } |
|
249 |
|
250 // ----------------------------------------------------------------------------- |
|
251 // CMCETestUIAppUi::SessionResponseValues |
|
252 // ----------------------------------------------------------------------------- |
|
253 // |
|
254 |
|
255 TBool CMCETestUIAppUi::SessionResponseValues(TSessionResponseValues &responseValues) |
|
256 { |
|
257 CSessionResponseValuesDialog *dialog = new (ELeave)CSessionResponseValuesDialog(&responseValues); |
|
258 if (dialog->ExecuteLD(R_MCE_RESPONSE_VALUES_DIALOG)) |
|
259 { |
|
260 return ETrue; |
|
261 } |
|
262 |
|
263 return EFalse; |
|
264 } |
|
265 // ----------------------------------------------------------------------------- |
|
266 // CMCETestUIAppUi::StartDTMFToneL |
|
267 // ----------------------------------------------------------------------------- |
|
268 // |
|
269 TBool CMCETestUIAppUi::StartDTMFToneL( TChar& aChar ) |
|
270 { |
|
271 CStartDTMFDialog *dialog = new (ELeave)CStartDTMFDialog( aChar ); |
|
272 if (dialog->ExecuteLD( R_MCE_START_DTMF_TONE_DIALOG )) |
|
273 { |
|
274 return ETrue; |
|
275 } |
|
276 |
|
277 return EFalse; |
|
278 } |
|
279 |
|
280 // ----------------------------------------------------------------------------- |
|
281 // CMCETestUIAppUi::StartDTMFToneL |
|
282 // ----------------------------------------------------------------------------- |
|
283 // |
|
284 TBool CMCETestUIAppUi::SendDTMFToneL( TChar& aChar, TInt& aInterval ) |
|
285 { |
|
286 CSendDTMFDialog *dialog = new (ELeave)CSendDTMFDialog( aChar, aInterval ); |
|
287 if (dialog->ExecuteLD( R_MCE_SEND_DTMF_TONE_DIALOG )) |
|
288 { |
|
289 return ETrue; |
|
290 } |
|
291 |
|
292 return EFalse; |
|
293 } |
|
294 // ----------------------------------------------------------------------------- |
|
295 // CMCETestUIAppUi::StartDTMFToneL |
|
296 // ----------------------------------------------------------------------------- |
|
297 // |
|
298 TBool CMCETestUIAppUi::SendDTMFToneSequenceL( TDes& aSequence ) |
|
299 { |
|
300 CSendDTMFSequenceDialog *dialog = new (ELeave)CSendDTMFSequenceDialog( aSequence ); |
|
301 if (dialog->ExecuteLD( R_MCE_SEND_DTMF_TONE_SEQUENCE_DIALOG )) |
|
302 { |
|
303 return ETrue; |
|
304 } |
|
305 |
|
306 return EFalse; |
|
307 } |
|
308 |
|
309 // ----------------------------------------------------------------------------- |
|
310 // CMCETestUIAppUi::GetCodecTypeL |
|
311 // ----------------------------------------------------------------------------- |
|
312 // |
|
313 TBool CMCETestUIAppUi::GetCodecTypeL( TInt &aCodecIndex) |
|
314 { |
|
315 aCodecIndex = 1; |
|
316 CAddCodecDialog* dlg = new (ELeave) CAddCodecDialog(aCodecIndex); |
|
317 if(dlg->ExecuteLD(R_MCE_ADD_CODEC_DIALOG)) |
|
318 { |
|
319 return ETrue; |
|
320 } |
|
321 return EFalse; |
|
322 } |
|
323 // ----------------------------------------------------------------------------- |
|
324 // CMCETestUIAppUi::GetIapIdL |
|
325 // ----------------------------------------------------------------------------- |
|
326 // |
|
327 TBool CMCETestUIAppUi::GetIapIdL( TInt &aNumber) |
|
328 { |
|
329 aNumber = 1; |
|
330 CAknNumberQueryDialog* dlg = new (ELeave) CAknNumberQueryDialog(aNumber,CAknQueryDialog::ENoTone); |
|
331 if(dlg->ExecuteLD(R_NUMBER_QUERY_DIALOG)) |
|
332 { |
|
333 return ETrue; |
|
334 } |
|
335 return EFalse; |
|
336 } |
|
337 |
|
338 |
|
339 // ----------------------------------------------------------------------------- |
|
340 // CMCETestUIAppUi::GetIapIdL |
|
341 // ----------------------------------------------------------------------------- |
|
342 // |
|
343 void CMCETestUIAppUi::ShowCurrentCryptoContextsL(TBool aCrypto32,TBool aCrypto80) |
|
344 { |
|
345 CCurrentCryptoContextsDialog *dialog = new (ELeave)CCurrentCryptoContextsDialog( aCrypto32,aCrypto80 ); |
|
346 dialog->ExecuteLD( R_MCE_SECURE_SESSION_DIALOG ); |
|
347 } |
|
348 |
|
349 // ----------------------------------------------------------------------------- |
|
350 // CMCETestUIAppUi::GetIapIdL |
|
351 // ----------------------------------------------------------------------------- |
|
352 // |
|
353 void CMCETestUIAppUi::ShowSupportedCryptoContextsL(TBool aCrypto32,TBool aCrypto80) |
|
354 { |
|
355 CSupportedCryptoContextsDialog *dialog = new (ELeave)CSupportedCryptoContextsDialog( aCrypto32,aCrypto80 ); |
|
356 dialog->ExecuteLD( R_MCE_SECURE_SESSION_DIALOG ); |
|
357 } |
|
358 |
|
359 // ----------------------------------------------------------------------------- |
|
360 // CMCETestUIAppUi::GetIapIdL |
|
361 // ----------------------------------------------------------------------------- |
|
362 // |
|
363 void CMCETestUIAppUi::GetCryptoContextsL(TBool& aCrypto32,TBool& aCrypto80) |
|
364 { |
|
365 CGetCryptoContextsDialog *dialog = new (ELeave)CGetCryptoContextsDialog( aCrypto32,aCrypto80 ); |
|
366 dialog->ExecuteLD( R_MCE_SECURE_SESSION_DIALOG ); |
|
367 } |
|
368 // ----------------------------------------------------------------------------- |
|
369 // CMCETestUIAppUi::EventParams |
|
370 // ----------------------------------------------------------------------------- |
|
371 // |
|
372 TBool CMCETestUIAppUi::EventParamsL(TEventParams& aEventParams) |
|
373 { |
|
374 |
|
375 CCreateEventDialog* dialog = new ( ELeave ) CCreateEventDialog( &aEventParams ); |
|
376 if (dialog->ExecuteLD( R_MCE_EVENT_DIALOG ) ) |
|
377 { |
|
378 return ETrue; |
|
379 } |
|
380 return ETrue ; // this code still needs to be updated as it is wrong behaviour |
|
381 } |
|
382 |
|
383 // ----------------------------------------------------------------------------- |
|
384 // CMCETestUIAppUi::ReferParamsL |
|
385 // ----------------------------------------------------------------------------- |
|
386 // |
|
387 TBool CMCETestUIAppUi::ReferParamsL(TReferParams& aReferParams) |
|
388 { |
|
389 |
|
390 CCreateReferDialog* dialog = new ( ELeave ) CCreateReferDialog( &aReferParams ); |
|
391 if (dialog->ExecuteLD( R_MCE_REFER_DIALOG ) ) |
|
392 { |
|
393 return ETrue; |
|
394 } |
|
395 return ETrue ; // this code still needs to be updated as it is wrong behaviour |
|
396 } |
|
397 |
|
398 // ----------------------------------------------------------------------------- |
|
399 // CMCETestUIAppUi::ReferToParamsL |
|
400 // ----------------------------------------------------------------------------- |
|
401 // |
|
402 TBool CMCETestUIAppUi::ReferToParamsL(TReferParams& aReferParams) |
|
403 { |
|
404 |
|
405 CCreateReferToDialog* dialog = new ( ELeave ) CCreateReferToDialog( &aReferParams ); |
|
406 if (dialog->ExecuteLD( R_MCE_REFERTO_DIALOG ) ) |
|
407 { |
|
408 return ETrue; |
|
409 } |
|
410 return ETrue ; // this code still needs to be updated as it is wrong behaviour |
|
411 } |
|
412 |
|
413 // ----------------------------------------------------------------------------- |
|
414 // CMCETestUIEngine::CreateMceSettingsL |
|
415 // ----------------------------------------------------------------------------- |
|
416 // |
|
417 |
|
418 void CMCETestUIAppUi::CreateMceSettingsL() |
|
419 { |
|
420 CCreateMceSettingsDialog* dialog = new(ELeave)CCreateMceSettingsDialog(iEngine); |
|
421 dialog->ExecuteLD(R_MCE_MCESETTINGS_DIALOG ); |
|
422 |
|
423 } |
|
424 |
|
425 // ----------------------------------------------------------------------------- |
|
426 // CMCETestUIEngine::CreateMceValueSettingsL |
|
427 // ----------------------------------------------------------------------------- |
|
428 // |
|
429 |
|
430 void CMCETestUIAppUi::CreateMceValueSettingsL() |
|
431 { |
|
432 CCreateMceValueSettingsDialog* dialog = new(ELeave)CCreateMceValueSettingsDialog(iEngine); |
|
433 dialog->ExecuteLD(R_MCE_VALUE_SETTINGS_DIALOG ); |
|
434 |
|
435 } |
|
436 |
|
437 // ----------------------------------------------------------------------------- |
|
438 // CMCETestUIEngine::HandleCommandL |
|
439 // ----------------------------------------------------------------------------- |
|
440 // |
|
441 void CMCETestUIAppUi::HandleCommandL(TInt aCommand) |
|
442 { |
|
443 switch (aCommand) |
|
444 { |
|
445 case EAknSoftkeyExit: |
|
446 case EEikCmdExit: |
|
447 { |
|
448 Exit(); |
|
449 break; |
|
450 } |
|
451 case EAknSoftkeyBack: |
|
452 { |
|
453 iSessionView->ChangeToMainViewL(); |
|
454 break; |
|
455 } |
|
456 case EAknSoftkeyOptions: |
|
457 { |
|
458 if ( iView ) |
|
459 { |
|
460 iView->HandleCommandL(aCommand); |
|
461 } |
|
462 break; |
|
463 } |
|
464 default: |
|
465 break; |
|
466 |
|
467 } |
|
468 } |
|
469 |
|
470 // ----------------------------------------------------------------------------- |
|
471 // CMCETestUIAppUi::ProcessCommandL |
|
472 // ----------------------------------------------------------------------------- |
|
473 // |
|
474 void CMCETestUIAppUi::ProcessCommandL(TInt aCommand) |
|
475 { |
|
476 if ( aCommand == EAknSoftkeyOptions) |
|
477 { |
|
478 if ( iView ) |
|
479 { |
|
480 iView->HandleCommandL(aCommand); |
|
481 } |
|
482 return; |
|
483 } |
|
484 CAknViewAppUi::ProcessCommandL(aCommand); |
|
485 } |
|
486 |
|
487 // ----------------------------------------------------------------------------- |
|
488 // CMCETestUIEngine::ChangeToMainViewL |
|
489 // ----------------------------------------------------------------------------- |
|
490 // |
|
491 void CMCETestUIAppUi::ChangeToMainViewL() |
|
492 { |
|
493 iSessionView->ChangeToMainViewL(); |
|
494 } |
|
495 // ----------------------------------------------------------------------------- |
|
496 // CMCETestUIEngine::IsVideoEnabled |
|
497 // ----------------------------------------------------------------------------- |
|
498 // |
|
499 TBool CMCETestUIAppUi::IsVideoEnabled() |
|
500 { |
|
501 return iEnableVideo; |
|
502 } |
|
503 |
|
504 // ----------------------------------------------------------------------------- |
|
505 // CMCETestUIEngine::EnableVideo |
|
506 // ----------------------------------------------------------------------------- |
|
507 // |
|
508 void CMCETestUIAppUi::EnableVideo() |
|
509 { |
|
510 iMainView->iContainer->MakeVisible( EFalse ); |
|
511 // iMainView->MakeVisible( EFalse ); |
|
512 iEnableVideo = ETrue; |
|
513 } |
|
514 |
|
515 // ----------------------------------------------------------------------------- |
|
516 // CMCETestUIEngine::DisableVideo |
|
517 // ----------------------------------------------------------------------------- |
|
518 // |
|
519 void CMCETestUIAppUi::DisableVideo() |
|
520 { |
|
521 iMainView->iContainer->MakeVisible( ETrue ); |
|
522 // iMainView->MakeVisible( ETrue ); |
|
523 |
|
524 iEnableVideo = EFalse; |
|
525 } |
|
526 // ----------------------------------------------------------------------------- |
|
527 // CMCETestUIEngine::DisableVideo |
|
528 // ----------------------------------------------------------------------------- |
|
529 // |
|
530 TRect CMCETestUIAppUi::GetRect() |
|
531 { |
|
532 return ClientRect(); |
|
533 } |