|
1 /* |
|
2 * Copyright (c) 2005 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: Application's UI class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "musuieventcontroller.h" |
|
21 #include "musuieventobserver.h" |
|
22 #include "musuisharingobserver.h" |
|
23 #include "musuipropertywatch.h" |
|
24 #include "musuicallbackservice.h" |
|
25 #include "musuiactivitymanger.h" |
|
26 #include "musuifileutil.h" |
|
27 #include "musuidialogutil.h" |
|
28 #include "musuicontactutil.h" |
|
29 #include "mussessionproperties.h" |
|
30 #include "musuibitmapdecoder.h" |
|
31 #include "muscommon.h" |
|
32 #include "mussettings.h" |
|
33 #include "musenguriparser.h" |
|
34 #include "musuimmcmonitor.h" |
|
35 #include "musresourceproperties.h" |
|
36 #include "musuiresourcehandler.h" |
|
37 #include "musui.hrh" |
|
38 #include "muslogger.h" // debug logging |
|
39 #include "musuigeneralview.h" |
|
40 |
|
41 #include "musengmcesession.h" |
|
42 |
|
43 #include <musui.rsg> |
|
44 |
|
45 #include <fbs.h> |
|
46 #include <e32property.h> |
|
47 |
|
48 #include <StringLoader.h> |
|
49 #include <pathinfo.h> |
|
50 #include <featmgr.h> |
|
51 #include <bldvariant.hrh> // for feature definitions |
|
52 #include <pathconfiguration.hrh> |
|
53 |
|
54 #include <hlplch.h> // HlpLauncher |
|
55 #include <AknUtils.h> |
|
56 #include <telmicmutestatuspskeys.h> |
|
57 |
|
58 using namespace MusSettingsKeys; |
|
59 using namespace NMusSessionApi; |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CMusUiEventController::~CMusUiEventController() |
|
66 { |
|
67 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::~CMusUiEventController" ); |
|
68 delete iStatusPropertyWatch; |
|
69 delete iContactName; |
|
70 delete iTelNumber; |
|
71 delete iVideoCodec; |
|
72 delete iDialogPrompt; |
|
73 delete iCallbackService; |
|
74 delete iMmcMonitor; |
|
75 delete iActivityManager; |
|
76 delete iMicMuteStatusPropertyWatch; |
|
77 FeatureManager::UnInitializeLib(); |
|
78 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::~CMusUiEventController" ); |
|
79 } |
|
80 |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 void CMusUiEventController::ConstructL() |
|
87 { |
|
88 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::ConstructL" ); |
|
89 |
|
90 TInt error( KErrNotFound ); |
|
91 |
|
92 FeatureManager::InitializeLibL(); |
|
93 |
|
94 iCallbackService = CMusUiCallbackService::NewL( *this ); |
|
95 |
|
96 // read ps properties (no need to read again later) |
|
97 |
|
98 TRAP( error, iVideoCodec = CMusUiPropertyWatch::ReadDescPropertyL( |
|
99 KVideoCodecs ) ); |
|
100 if ( error != KErrNone ) |
|
101 { |
|
102 iVideoCodec = KNullDesC().AllocL(); |
|
103 } |
|
104 |
|
105 TRAP( error, iTelNumber = CMusUiPropertyWatch::ReadDescPropertyL( |
|
106 KTelNumber ) ); |
|
107 if ( error != KErrNone ) |
|
108 { |
|
109 iTelNumber = KNullDesC().AllocL(); |
|
110 } |
|
111 |
|
112 TRAP( error, iSipProfileId = CMusUiPropertyWatch::ReadIntPropertyL( |
|
113 NMusSessionApi::KSipProfileId ) ); |
|
114 if ( error != KErrNone ) |
|
115 { |
|
116 iSipProfileId = KErrNotFound; |
|
117 } |
|
118 |
|
119 TRAP( error, |
|
120 iContactId = CMusUiPropertyWatch::ReadIntPropertyL( KContactId ) ); |
|
121 if ( error != KErrNone ) |
|
122 { |
|
123 iContactId = KErrNotFound; |
|
124 } |
|
125 |
|
126 TRAP( error, iContactName = CMusUiPropertyWatch::ReadDescPropertyL( |
|
127 KContactName ) ); |
|
128 |
|
129 if ( error != KErrNone ) |
|
130 { |
|
131 iContactName = KNullDesC().AllocL(); |
|
132 } |
|
133 |
|
134 // follow session status property |
|
135 iStatusPropertyWatch = CMusUiPropertyWatch::NewL( |
|
136 *this, |
|
137 NMusSessionApi::KCategoryUid, |
|
138 KStatus ); |
|
139 |
|
140 iMmcMonitor = CMusUiMmcMonitor::NewL( *this ); |
|
141 |
|
142 iResourceHandler = iEventObserver.ResourceHandler(); |
|
143 __ASSERT_ALWAYS( iResourceHandler, User::Leave( KErrNotFound ) ); |
|
144 |
|
145 //Mic mute status property |
|
146 iMicMuteStatusPropertyWatch = CMusUiPropertyWatch::NewL( |
|
147 *this, |
|
148 KPSUidTelMicrophoneMuteStatus, |
|
149 KTelMicrophoneMuteState ); |
|
150 |
|
151 // start monitoring activity |
|
152 iActivityManager = CMusUiActivityManager::NewL( KMusBacklightTimeOut ); |
|
153 iActivityManager->Reset(); |
|
154 |
|
155 // check if operator specific functionality is needed |
|
156 iOperatorSpecificFunctionality = |
|
157 ( MultimediaSharingSettings::OperatorVariantSettingL() == |
|
158 EOperatorSpecific ); |
|
159 |
|
160 iShutdownState = EMusUiShutdownNotDefined; |
|
161 |
|
162 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::ConstructL" ); |
|
163 } |
|
164 |
|
165 |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 // ----------------------------------------------------------------------------- |
|
169 // |
|
170 CMusUiEventController::CMusUiEventController( |
|
171 MMusUiEventObserver& aEventObserver, |
|
172 MMusUiSharingObserver& aSharingObserver ) |
|
173 : iEventObserver( aEventObserver ), |
|
174 iSharingObserver( aSharingObserver ), |
|
175 iForeground( ETrue ), |
|
176 iShowDialog( EFalse ), |
|
177 iActiveCall( ETrue ) |
|
178 |
|
179 { |
|
180 } |
|
181 |
|
182 |
|
183 // ----------------------------------------------------------------------------- |
|
184 // Called by CMusUiPropertyWatch, when resource key values change in P&S |
|
185 // Sets the member values common to all sharing types. |
|
186 // ----------------------------------------------------------------------------- |
|
187 // |
|
188 void CMusUiEventController::PropertyChanged( const TUint aKey, |
|
189 const TInt aValue ) |
|
190 { |
|
191 MUS_LOG2( "mus: [MUSUI ] -> CMusUiEventController::ResourcePropertyChanged:\ |
|
192 aKey: [%u] aValue: [%d]", aKey, aValue ); |
|
193 switch( aKey ) |
|
194 { |
|
195 case KTelMicrophoneMuteState: |
|
196 { |
|
197 if ( aValue == EPSTelMicMuteOff) |
|
198 { |
|
199 iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarUnmute, |
|
200 EMusuiCmdToolbarMute,ETrue ); |
|
201 } |
|
202 else if ( aValue == EPSTelMicMuteOn ) |
|
203 { |
|
204 iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarMute, |
|
205 EMusuiCmdToolbarUnmute,ETrue ); |
|
206 } |
|
207 break; |
|
208 } |
|
209 case KStatus: |
|
210 { |
|
211 TRAP_IGNORE( |
|
212 HandleChangedStatusL( ( TMusAvailabilityStatus ) aValue ) ); |
|
213 break; |
|
214 } |
|
215 default: |
|
216 { |
|
217 break; |
|
218 } |
|
219 } |
|
220 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::ResourcePropertyChanged" ); |
|
221 } |
|
222 |
|
223 |
|
224 // ----------------------------------------------------------------------------- |
|
225 // |
|
226 // ----------------------------------------------------------------------------- |
|
227 // |
|
228 void CMusUiEventController::HandlePropertyError( const TInt aReason ) |
|
229 { |
|
230 MUS_LOG1( "mus: [MUSUI ] -> CMusUiEventController::HandleError [%d]", |
|
231 aReason ); |
|
232 |
|
233 HandleError( aReason ); |
|
234 |
|
235 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::HandleError" ); |
|
236 } |
|
237 |
|
238 |
|
239 // ----------------------------------------------------------------------------- |
|
240 // |
|
241 // ----------------------------------------------------------------------------- |
|
242 // |
|
243 void CMusUiEventController::HandleAsyncEventL( TMusUiAsyncEvent aEventId ) |
|
244 { |
|
245 MUS_LOG1( "mus: [MUSUI ] -> CMusUiEventController::HandleAsyncEventL [%d]", |
|
246 aEventId ); |
|
247 |
|
248 switch ( aEventId ) |
|
249 { |
|
250 case EMusUiAsyncHandleExit: |
|
251 { |
|
252 MUS_LOG( "mus: [MUSUI ] CMusUiEventController::\ |
|
253 HandleAsyncEventL: EMusUiAsyncHandleExit" ); |
|
254 HandleExitL(); |
|
255 break; |
|
256 } |
|
257 default: |
|
258 { |
|
259 break; |
|
260 } |
|
261 } |
|
262 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::HandleAsyncEventL" ); |
|
263 } |
|
264 |
|
265 |
|
266 // ----------------------------------------------------------------------------- |
|
267 // |
|
268 // ----------------------------------------------------------------------------- |
|
269 // |
|
270 TInt CMusUiEventController::HandleAsyncError( TInt aError ) |
|
271 { |
|
272 iEventObserver.HandleError( aError ); // Stop the execution |
|
273 |
|
274 return KErrNone; |
|
275 } |
|
276 |
|
277 |
|
278 // ----------------------------------------------------------------------------- |
|
279 // |
|
280 // ----------------------------------------------------------------------------- |
|
281 // |
|
282 void CMusUiEventController::MmcRemoved() |
|
283 { |
|
284 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::MmcRemoved" ); |
|
285 TRAP_IGNORE( MusUiDialogUtil::ShowInformationDialogL( |
|
286 R_MUS_LIVE_SHARING_VIEW_NOTE_SHARING_ENDED ) ) |
|
287 |
|
288 iEventObserver.HandleExit(); |
|
289 |
|
290 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::MmcRemoved" ); |
|
291 } |
|
292 |
|
293 |
|
294 // ----------------------------------------------------------------------------- |
|
295 // |
|
296 // ----------------------------------------------------------------------------- |
|
297 // |
|
298 void CMusUiEventController::SessionEstablished() |
|
299 { |
|
300 TRAPD( error, iSharingObserver.ShowStatusPaneTitleL() ) |
|
301 |
|
302 if ( error != KErrNone ) |
|
303 { |
|
304 iEventObserver.HandleError( error ); |
|
305 } |
|
306 |
|
307 if ( MUS_NO_TOOLBAR ) |
|
308 { |
|
309 TRAPD( error, iSharingObserver.EnableMiddleSoftkeyL( IsLoudSpeakerEnabled() ? |
|
310 R_MUSUI_VIEW_OPS_MSK_IHF_OFF : |
|
311 R_MUSUI_VIEW_OPS_MSK_IHF_ON )); |
|
312 if ( error != KErrNone ) |
|
313 { |
|
314 iEventObserver.HandleError( error ); |
|
315 } |
|
316 } |
|
317 } |
|
318 |
|
319 |
|
320 // ----------------------------------------------------------------------------- |
|
321 // |
|
322 // ----------------------------------------------------------------------------- |
|
323 // |
|
324 void CMusUiEventController::AudioRoutingChanged( TBool aShowNote ) |
|
325 { |
|
326 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::AudioRoutingChanged" ); |
|
327 |
|
328 if ( aShowNote ) |
|
329 { |
|
330 if ( IsLoudSpeakerEnabled() ) |
|
331 { |
|
332 MUS_LOG( "mus: [MUSUI ] show activated note" ); |
|
333 TRAP_IGNORE( |
|
334 MusUiDialogUtil::ShowGlobalInformationDialogL( R_MUS_NOTE_HF_ACTIVATED ) ) |
|
335 } |
|
336 } |
|
337 |
|
338 iSharingObserver.RefreshAudioRoutingToolbarButton(); |
|
339 |
|
340 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::AudioRoutingChanged" ); |
|
341 } |
|
342 |
|
343 |
|
344 // ----------------------------------------------------------------------------- |
|
345 // |
|
346 // ----------------------------------------------------------------------------- |
|
347 // |
|
348 TBool CMusUiEventController::AudioRouteChangeAllowed() const |
|
349 { |
|
350 // Do not allow audio routing if call has ended |
|
351 return iActiveCall; |
|
352 } |
|
353 |
|
354 // ----------------------------------------------------------------------------- |
|
355 // |
|
356 // ----------------------------------------------------------------------------- |
|
357 // |
|
358 void CMusUiEventController::VolumeChanged( TInt aVolume, TBool aAudioRouteChanged ) |
|
359 { |
|
360 // Set Volume: |
|
361 //If volume changed due to audio route change, we want to update volume |
|
362 //popup control only if it is already visible |
|
363 TBool onlyIfVisible = aAudioRouteChanged; |
|
364 TRAP_IGNORE( iSharingObserver.ActivateVolumeControlL(aVolume, onlyIfVisible) ); |
|
365 } |
|
366 // ----------------------------------------------------------------------------- |
|
367 // |
|
368 // ----------------------------------------------------------------------------- |
|
369 // |
|
370 void CMusUiEventController::SetRect(const TRect& aRect) |
|
371 { |
|
372 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::SetRect" ); |
|
373 |
|
374 if ( EngineSession() ) |
|
375 { |
|
376 TRAPD( err, EngineSession()->SetRectL( aRect ) ); |
|
377 if ( err != KErrNone ) |
|
378 { |
|
379 iEventObserver.HandleError( err ); |
|
380 } |
|
381 } |
|
382 |
|
383 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::SetRect" ); |
|
384 } |
|
385 |
|
386 |
|
387 // ----------------------------------------------------------------------------- |
|
388 // |
|
389 // ----------------------------------------------------------------------------- |
|
390 // |
|
391 const TDesC& CMusUiEventController::MusContactName() |
|
392 { |
|
393 return *iContactName; |
|
394 } |
|
395 |
|
396 |
|
397 // ----------------------------------------------------------------------------- |
|
398 // |
|
399 // ----------------------------------------------------------------------------- |
|
400 // |
|
401 const TDesC& CMusUiEventController::MusVideoCodecValue() |
|
402 { |
|
403 return *iVideoCodec; |
|
404 } |
|
405 |
|
406 |
|
407 // ----------------------------------------------------------------------------- |
|
408 // |
|
409 // ----------------------------------------------------------------------------- |
|
410 // |
|
411 const TDesC& CMusUiEventController::MusTelNumberValue() |
|
412 { |
|
413 MUS_LOG_TDESC("mus: [MUSUI ] <> CMusUiEventController::MusTelNumberValue()", |
|
414 iTelNumber->Des() ) |
|
415 return *iTelNumber; |
|
416 } |
|
417 |
|
418 |
|
419 // ----------------------------------------------------------------------------- |
|
420 // |
|
421 // ----------------------------------------------------------------------------- |
|
422 // |
|
423 const TDesC& CMusUiEventController::SessionTimeFormatted( |
|
424 const TTimeIntervalSeconds& aSeconds ) |
|
425 { |
|
426 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::SessionTimeFormatted" ); |
|
427 iTimeBuffer.SetLength( 0 ); |
|
428 TLocale locale; |
|
429 _LIT( KZeroSymbol, "0" ); |
|
430 TInt sessionHours( 0 ); |
|
431 TInt sessionMinutes( 0 ); |
|
432 TInt sessionSeconds( aSeconds.Int() ); |
|
433 if ( aSeconds.Int() > ( KMusOneMinuteInSeconds - 1 ) ) |
|
434 { |
|
435 sessionMinutes = (int)(aSeconds.Int() / KMusOneMinuteInSeconds ); |
|
436 sessionSeconds = sessionSeconds - ( sessionMinutes * KMusOneMinuteInSeconds ); |
|
437 } |
|
438 if ( sessionMinutes > ( KMusOneMinuteInSeconds - 1 ) ) |
|
439 { |
|
440 sessionHours = (int)( sessionMinutes / KMusOneMinuteInSeconds ); |
|
441 sessionMinutes = sessionMinutes - ( sessionHours * KMusOneMinuteInSeconds ); |
|
442 } |
|
443 if ( sessionHours != 0 ) |
|
444 { |
|
445 iTimeBuffer.AppendNum( sessionHours ); |
|
446 iTimeBuffer.Append( locale.TimeSeparator( KMusLocaleHoursAndMinutesSeparator ) ); |
|
447 if ( sessionMinutes < KMusNumberValueTen ) |
|
448 { |
|
449 iTimeBuffer.Append( KZeroSymbol ); |
|
450 } |
|
451 } |
|
452 |
|
453 iTimeBuffer.AppendNum( sessionMinutes ); |
|
454 iTimeBuffer.Append( locale.TimeSeparator( KMusLocaleMinutesAndSecondsSeparator ) ); |
|
455 if ( sessionSeconds < KMusNumberValueTen ) |
|
456 { |
|
457 iTimeBuffer.Append( KZeroSymbol ); |
|
458 } |
|
459 iTimeBuffer.AppendNum( sessionSeconds ); |
|
460 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::SessionTimeFormatted" ); |
|
461 return iTimeBuffer; |
|
462 } |
|
463 |
|
464 |
|
465 // ----------------------------------------------------------------------------- |
|
466 // |
|
467 // ----------------------------------------------------------------------------- |
|
468 // |
|
469 void CMusUiEventController::SaveContactQueryL() |
|
470 { |
|
471 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::SaveContactQueryL" ); |
|
472 if ( !MusUiContactUtil::ShareViewFieldExistsL( *iEventObserver.EikonEnv(), |
|
473 iContactId ) ) |
|
474 { |
|
475 delete iDialogPrompt; |
|
476 iDialogPrompt = NULL; |
|
477 iDialogPrompt = StringLoader::LoadL( R_MUS_VIEW_SAVE_ADDRESS_QUERY_TXT ); |
|
478 iEventObserver.ShowAsyncConfirmationQueryDialogL( *iDialogPrompt ); |
|
479 } |
|
480 else |
|
481 { |
|
482 AsyncQueryDialogAcceptedL( EFalse ); |
|
483 } |
|
484 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::SaveContactQueryL" ); |
|
485 } |
|
486 |
|
487 |
|
488 // ----------------------------------------------------------------------------- |
|
489 // |
|
490 // ----------------------------------------------------------------------------- |
|
491 // |
|
492 void CMusUiEventController::HandleError( const TInt aError ) |
|
493 { |
|
494 MUS_LOG1( "mus: [MUSUI ] -> CMusUiEventController::HandleError %d", |
|
495 aError ); |
|
496 |
|
497 iEventObserver.HandleError( aError ); |
|
498 |
|
499 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::HandleError" ); |
|
500 } |
|
501 |
|
502 |
|
503 // ----------------------------------------------------------------------------- |
|
504 // |
|
505 // ----------------------------------------------------------------------------- |
|
506 // |
|
507 TBool CMusUiEventController::ExitOccured() |
|
508 { |
|
509 return ( iShutdownState != EMusUiShutdownNotDefined ); |
|
510 } |
|
511 |
|
512 |
|
513 // ----------------------------------------------------------------------------- |
|
514 // |
|
515 // ----------------------------------------------------------------------------- |
|
516 // |
|
517 TBool CMusUiEventController::AudioRoutingCanBeChanged() |
|
518 { |
|
519 return ( EngineSession() && EngineSession()->AudioRoutingCanBeChanged() ); |
|
520 } |
|
521 |
|
522 |
|
523 // ----------------------------------------------------------------------------- |
|
524 // |
|
525 // ----------------------------------------------------------------------------- |
|
526 // |
|
527 TBool CMusUiEventController::IsLoudSpeakerEnabled() |
|
528 { |
|
529 return ( EngineSession() && EngineSession()->IsLoudSpeakerEnabled() ); |
|
530 } |
|
531 |
|
532 |
|
533 // ----------------------------------------------------------------------------- |
|
534 // |
|
535 // ----------------------------------------------------------------------------- |
|
536 // |
|
537 TBool CMusUiEventController::DeviceHasDedicatedVolumeKeys() |
|
538 { |
|
539 return FeatureManager::FeatureSupported( KFeatureIdSideVolumeKeys ); |
|
540 } |
|
541 |
|
542 |
|
543 // ----------------------------------------------------------------------------- |
|
544 // |
|
545 // ----------------------------------------------------------------------------- |
|
546 // |
|
547 void CMusUiEventController::HandleExitL( TBool aTerminateCall ) |
|
548 { |
|
549 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::HandleExitL" ); |
|
550 if ( iShutdownState == EMusUiShutdownNotDefined ) |
|
551 { |
|
552 iShutdownState = EMusUiShutdownStarted; |
|
553 |
|
554 if ( iStatusPropertyWatch ) |
|
555 { |
|
556 iStatusPropertyWatch->Cancel(); |
|
557 } |
|
558 |
|
559 if ( iMmcMonitor ) |
|
560 { |
|
561 iMmcMonitor->Cancel(); |
|
562 } |
|
563 |
|
564 if ( iActivityManager ) |
|
565 { |
|
566 iActivityManager->Cancel(); |
|
567 } |
|
568 |
|
569 if ( iCallbackService ) |
|
570 { |
|
571 iCallbackService->Cancel(); |
|
572 } |
|
573 |
|
574 iEventObserver.SetToolbarVisibility( EFalse ); |
|
575 |
|
576 // This must be done before showing the end note, because showing of |
|
577 // note may cause the session to continue for extra few seconds. |
|
578 DeleteEngineSession(); |
|
579 if ( iShowDialog ) |
|
580 { |
|
581 MusUiDialogUtil::ShowGlobalInformationDialogL( |
|
582 R_MUS_NOTE_HF_DEACTIVATED ); |
|
583 } |
|
584 // Sharing Ended note |
|
585 MusUiDialogUtil::ShowGlobalInformationDialogL( |
|
586 R_MUS_LIVE_SHARING_VIEW_NOTE_SHARING_ENDED ); |
|
587 |
|
588 if( aTerminateCall ) |
|
589 { |
|
590 iEventObserver.TerminateCall(); |
|
591 } |
|
592 |
|
593 // TODO: Continue Recording query, if sharing live video and receiving end |
|
594 // terminates the sharing session |
|
595 |
|
596 ExitProcedureL( EFalse ); |
|
597 |
|
598 } |
|
599 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::HandleExitL" ); |
|
600 } |
|
601 |
|
602 |
|
603 // ----------------------------------------------------------------------------- |
|
604 // |
|
605 // ----------------------------------------------------------------------------- |
|
606 // |
|
607 void CMusUiEventController::ExitProcedureL( TBool aUserAcceptance ) |
|
608 { |
|
609 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::ExitProcedureL" ); |
|
610 |
|
611 iSharingObserver.DismissMenuBar(); |
|
612 |
|
613 switch ( iShutdownState ) |
|
614 { |
|
615 case EMusUiShutdownStarted: |
|
616 { |
|
617 MUS_LOG( "mus: [MUSUI ] ExitProcedureL: EMusUiShutdownStarted" ); |
|
618 // No general functionality, skip the state |
|
619 iShutdownState = EMusUiShutdownVideoSaved; |
|
620 ExitProcedureL( EFalse ); |
|
621 break; |
|
622 } |
|
623 case EMusUiShutdownVideoSaved: |
|
624 { |
|
625 MUS_LOG( "mus: [MUSUI ] ExitProcedureL: EMusuiShutdownVideoSaved" ); |
|
626 iEventObserver.HandleExit(); |
|
627 break; |
|
628 } |
|
629 |
|
630 case EMusUiShutdownContactSavingQueried: |
|
631 { |
|
632 MUS_LOG( "mus: [MUSUI ] ExitProcedureL: EMusUiShutdownContactSavingQueried" ); |
|
633 // Stop app execution |
|
634 if ( aUserAcceptance ) |
|
635 { |
|
636 if ( iResourceHandler->RequestKeypadL( EFalse ) ) |
|
637 { |
|
638 MusUiContactUtil::ActivateContactViewL( |
|
639 *iEventObserver.EikonEnv(), |
|
640 iContactId, |
|
641 TypedAddress(), |
|
642 MusTelNumberValue() ); |
|
643 } |
|
644 } |
|
645 iEventObserver.HandleExit(); |
|
646 break; |
|
647 } |
|
648 case EMusUiShutdownOver: |
|
649 { |
|
650 iEventObserver.HandleExit(); |
|
651 break; |
|
652 } |
|
653 case EMusUiShutdownNotDefined: |
|
654 default: |
|
655 { |
|
656 break; |
|
657 } |
|
658 } |
|
659 |
|
660 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::ExitProcedureL" ); |
|
661 } |
|
662 |
|
663 |
|
664 // ----------------------------------------------------------------------------- |
|
665 // |
|
666 // ----------------------------------------------------------------------------- |
|
667 // |
|
668 void CMusUiEventController::AsyncQueryDialogAcceptedL( TBool aAccepted ) |
|
669 { |
|
670 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::AsyncQueryDialogAcceptedL" ); |
|
671 |
|
672 if ( ExitOccured() ) |
|
673 { |
|
674 ExitProcedureL( aAccepted ); |
|
675 } |
|
676 |
|
677 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::AsyncQueryDialogAcceptedL" ); |
|
678 } |
|
679 |
|
680 |
|
681 // ----------------------------------------------------------------------------- |
|
682 // |
|
683 // ----------------------------------------------------------------------------- |
|
684 // |
|
685 TBool CMusUiEventController::ConnectionEstablished() const |
|
686 { |
|
687 return iConnectionEstablished; |
|
688 } |
|
689 |
|
690 // ----------------------------------------------------------------------------- |
|
691 // |
|
692 // ----------------------------------------------------------------------------- |
|
693 // |
|
694 void CMusUiEventController::SetConnectionInitialized( |
|
695 TBool aConnectionInitialized ) |
|
696 { |
|
697 MUS_LOG1( |
|
698 "mus: [MUSUI ] -> CMusUiEventController::SetConnectionInitialized ( %d )", |
|
699 aConnectionInitialized ); |
|
700 |
|
701 iConnectionInitialized = aConnectionInitialized; |
|
702 |
|
703 if ( !iForeground && !ExitOccured() ) |
|
704 { |
|
705 TRAP_IGNORE( EnableDisplayL(EFalse) ) |
|
706 } |
|
707 } |
|
708 |
|
709 // ----------------------------------------------------------------------------- |
|
710 // |
|
711 // ----------------------------------------------------------------------------- |
|
712 // |
|
713 TBool CMusUiEventController::ConnectionInitialized() const |
|
714 { |
|
715 return iConnectionInitialized; |
|
716 } |
|
717 |
|
718 // ----------------------------------------------------------------------------- |
|
719 // |
|
720 // ----------------------------------------------------------------------------- |
|
721 // |
|
722 void CMusUiEventController::EnableDisplayL( TBool aEnable ) |
|
723 { |
|
724 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::EnableDisplayL" ); |
|
725 if ( EngineSession() ) |
|
726 { |
|
727 EngineSession()->EnableDisplayL( aEnable ); |
|
728 } |
|
729 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::EnableDisplayL" ); |
|
730 } |
|
731 |
|
732 |
|
733 // ----------------------------------------------------------------------------- |
|
734 // |
|
735 // ----------------------------------------------------------------------------- |
|
736 // |
|
737 void CMusUiEventController::ChangeOrientationL( |
|
738 CAknAppUiBase::TAppUiOrientation aOrientation ) |
|
739 { |
|
740 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::ChangeOrientationL" ); |
|
741 iEventObserver.SwitchOrientationL( aOrientation ); |
|
742 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::ChangeOrientationL" ); |
|
743 } |
|
744 |
|
745 // ----------------------------------------------------------------------------- |
|
746 // |
|
747 // ----------------------------------------------------------------------------- |
|
748 // |
|
749 TBool CMusUiEventController::IsDisplayEnabledL() |
|
750 { |
|
751 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::IsDisplayEnabledL" ); |
|
752 TBool ret = EFalse; |
|
753 if ( EngineSession() ) |
|
754 { |
|
755 ret = EngineSession()->IsDisplayEnabledL(); |
|
756 } |
|
757 MUS_LOG1( "mus: [MUSUI ] <- CMusUiEventController::IsDisplayEnabledL, %d", ret ); |
|
758 return ret; |
|
759 } |
|
760 |
|
761 // ----------------------------------------------------------------------------- |
|
762 // |
|
763 // ----------------------------------------------------------------------------- |
|
764 // |
|
765 TBool CMusUiEventController::IsAudioRoutingLoudSpeaker() |
|
766 { |
|
767 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::IsAudioRoutingLoudSpeaker" ); |
|
768 TBool ret = EFalse; |
|
769 if ( EngineSession() ) |
|
770 { |
|
771 ret = EngineSession()->IsAudioRoutingLoudSpeaker(); |
|
772 } |
|
773 MUS_LOG1( "mus: [MUSUI ] <- CMusUiEventController::IsAudioRoutingLoudSpeaker, %d", ret ); |
|
774 return ret; |
|
775 } |
|
776 |
|
777 // ----------------------------------------------------------------------------- |
|
778 // |
|
779 // ----------------------------------------------------------------------------- |
|
780 // |
|
781 TBool CMusUiEventController::ToolbarVolumeSelected() |
|
782 { |
|
783 return iToolbarVolumeSelected; |
|
784 } |
|
785 |
|
786 |
|
787 // ----------------------------------------------------------------------------- |
|
788 // |
|
789 // ----------------------------------------------------------------------------- |
|
790 // |
|
791 TBool CMusUiEventController::IsMicMutedL() |
|
792 { |
|
793 __ASSERT_ALWAYS( EngineSession(), User::Leave( KErrNotReady ) ); |
|
794 |
|
795 return EngineSession()->IsMicMutedL(); |
|
796 } |
|
797 |
|
798 |
|
799 // ----------------------------------------------------------------------------- |
|
800 // |
|
801 // ----------------------------------------------------------------------------- |
|
802 // |
|
803 TBool CMusUiEventController::ManualAddressTyped() const |
|
804 { |
|
805 return EFalse; |
|
806 } |
|
807 |
|
808 |
|
809 // ----------------------------------------------------------------------------- |
|
810 // |
|
811 // ----------------------------------------------------------------------------- |
|
812 // |
|
813 void CMusUiEventController::HandleForegroundEventL( TBool aForeground ) |
|
814 { |
|
815 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::HandleForegroundEventL" ); |
|
816 |
|
817 iForeground = aForeground; |
|
818 |
|
819 if ( ConnectionInitialized() && !ExitOccured() ) |
|
820 { |
|
821 EnableDisplayL( aForeground ); |
|
822 |
|
823 // Change toolbar according to a real state. Other items than speaker |
|
824 // and mic states cannot be changed from phone app and thus there is |
|
825 // no need to check them |
|
826 if ( aForeground ) |
|
827 { |
|
828 if ( MUS_NO_TOOLBAR ) |
|
829 { |
|
830 iSharingObserver.EnableMiddleSoftkeyL( IsLoudSpeakerEnabled() ? |
|
831 R_MUSUI_VIEW_OPS_MSK_IHF_OFF : |
|
832 R_MUSUI_VIEW_OPS_MSK_IHF_ON ); |
|
833 } |
|
834 else |
|
835 { |
|
836 if ( IsMicMutedL() ) |
|
837 { |
|
838 iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarMute, |
|
839 EMusuiCmdToolbarUnmute, |
|
840 EFalse ); |
|
841 } |
|
842 else |
|
843 { |
|
844 iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarUnmute, |
|
845 EMusuiCmdToolbarMute, |
|
846 EFalse ); |
|
847 } |
|
848 |
|
849 if ( IsLoudSpeakerEnabled() ) |
|
850 { |
|
851 iSharingObserver.ReplaceToolbarCommand( |
|
852 EMusuiCmdToolbarSpeakerOn, |
|
853 EMusuiCmdToolbarSpeakerOff, |
|
854 EFalse ); |
|
855 } |
|
856 else |
|
857 { |
|
858 iSharingObserver.ReplaceToolbarCommand( |
|
859 EMusuiCmdToolbarSpeakerOff, |
|
860 EMusuiCmdToolbarSpeakerOn, |
|
861 EFalse ); |
|
862 } |
|
863 if ( ConnectionEstablished() ) |
|
864 { |
|
865 iEventObserver.SetToolbarVisibility( aForeground ); |
|
866 } |
|
867 |
|
868 } |
|
869 } |
|
870 |
|
871 } |
|
872 |
|
873 |
|
874 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::HandleForegroundEventL" ); |
|
875 } |
|
876 |
|
877 // ----------------------------------------------------------------------------- |
|
878 // |
|
879 // ----------------------------------------------------------------------------- |
|
880 // |
|
881 TBool CMusUiEventController::IsForeground() const |
|
882 { |
|
883 return iForeground; |
|
884 } |
|
885 |
|
886 // ----------------------------------------------------------------------------- |
|
887 // |
|
888 // ----------------------------------------------------------------------------- |
|
889 // |
|
890 void CMusUiEventController::OfferToolbarEventL( TInt aCommand ) |
|
891 { |
|
892 MUS_LOG1( "mus: [MUSUI ] -> CMusUiEventController::OfferToolbarEventL [%d]", |
|
893 aCommand ); |
|
894 |
|
895 __ASSERT_ALWAYS( EngineSession(), User::Leave( KErrNotReady ) ); |
|
896 |
|
897 switch ( aCommand ) |
|
898 { |
|
899 case EMusuiCmdToolbarVolume: |
|
900 { |
|
901 iToolbarVolumeSelected = !iToolbarVolumeSelected; |
|
902 iSharingObserver.HighlightSelectedToolbarItem( |
|
903 EMusuiCmdToolbarVolume ); |
|
904 iSharingObserver.ActivateVolumeControlL( |
|
905 EngineSession()->VolumeL() ); |
|
906 break; |
|
907 } |
|
908 case EMusuiCmdToolbarMute: |
|
909 { |
|
910 EngineSession()->MuteMicL( ETrue ); |
|
911 iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarMute, |
|
912 EMusuiCmdToolbarUnmute, |
|
913 ETrue ); |
|
914 break; |
|
915 } |
|
916 case EMusuiCmdToolbarUnmute: |
|
917 { |
|
918 EngineSession()->MuteMicL( EFalse ); |
|
919 iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarUnmute, |
|
920 EMusuiCmdToolbarMute, |
|
921 ETrue ); |
|
922 break; |
|
923 } |
|
924 case EMusuiCmdToolbarSpeakerOff: |
|
925 { |
|
926 EngineSession()->EnableLoudspeakerL( ELoudspeakerDisabled, EFalse ); |
|
927 // Toolbar will be changed when asynchronous request is completed |
|
928 break; |
|
929 } |
|
930 case EMusuiCmdToolbarSpeakerOn: |
|
931 { |
|
932 EngineSession()->EnableLoudspeakerL( ELoudspeakerEnabled, EFalse ); |
|
933 // Toolbar will be changed when asynchronous request is completed |
|
934 break; |
|
935 } |
|
936 default: // Never should be the case |
|
937 { |
|
938 HandleExitL(); |
|
939 break; |
|
940 } |
|
941 |
|
942 } |
|
943 |
|
944 MUS_LOG1( "mus: [MUSUI ] <- CMusUiEventController::OfferToolbarEventL [%d]", |
|
945 aCommand ); |
|
946 |
|
947 } |
|
948 |
|
949 |
|
950 // ----------------------------------------------------------------------------- |
|
951 // Handles commands common to all sharing types. |
|
952 // ----------------------------------------------------------------------------- |
|
953 // |
|
954 void CMusUiEventController::HandleCommandL( TInt aCommand ) |
|
955 { |
|
956 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::HandleCommandL" ); |
|
957 |
|
958 switch ( aCommand ) |
|
959 { |
|
960 case EMusuiCmdViewVolumeUp: |
|
961 { |
|
962 // Set Volume: |
|
963 __ASSERT_ALWAYS( EngineSession(), User::Leave( KErrNotReady ) ); |
|
964 EngineSession()->VolumeUpL(); |
|
965 // Status pane update will be done later. When we get |
|
966 // VolumeChanged() callback |
|
967 break; |
|
968 } |
|
969 case EMusuiCmdViewVolumeDown: |
|
970 { |
|
971 // Set Volume: |
|
972 __ASSERT_ALWAYS( EngineSession(), User::Leave( KErrNotReady ) ); |
|
973 EngineSession()->VolumeDownL(); |
|
974 // Status pane update will be done later. When we get |
|
975 // VolumeChanged() callback |
|
976 break; |
|
977 } |
|
978 case EMusuiCmdViewVolumeChanged: |
|
979 { |
|
980 __ASSERT_ALWAYS( EngineSession(), User::Leave( KErrNotReady ) ); |
|
981 TInt volumeFromEngine = EngineSession()->VolumeL(); |
|
982 TInt volumeFromUi = iEventObserver.GetUiVolumeValue(); |
|
983 if ( volumeFromUi != volumeFromEngine ) |
|
984 { |
|
985 EngineSession()->SetVolumeL( volumeFromUi ); |
|
986 } |
|
987 break; |
|
988 } |
|
989 |
|
990 case EMusuiCmdViewLoadspeaker: |
|
991 { |
|
992 EngineSession()->EnableLoudspeakerL( ELoudspeakerEnabled, ETrue ); |
|
993 break; |
|
994 } |
|
995 |
|
996 case EMusuiCmdViewHandset: |
|
997 { |
|
998 EngineSession()->EnableLoudspeakerL( ELoudspeakerDisabled, ETrue ); |
|
999 break; |
|
1000 } |
|
1001 |
|
1002 case EMusuiCmdViewMicrophoneMute: |
|
1003 { |
|
1004 EngineSession()->MuteMicL( ETrue ); |
|
1005 break; |
|
1006 } |
|
1007 |
|
1008 case EMusuiCmdViewMicrophoneUnmute: |
|
1009 { |
|
1010 EngineSession()->MuteMicL( EFalse ); |
|
1011 break; |
|
1012 } |
|
1013 |
|
1014 case EMusuiCmdViewEndActiveCall: |
|
1015 { |
|
1016 MUS_LOG( "mus: [MUSUI ] CMusUiReceiveController::ConstructL:\ |
|
1017 EMusuiCmdViewEndActiveCall" ); |
|
1018 HandleExitL( ETrue ); |
|
1019 break; |
|
1020 } |
|
1021 case EMusuiGenCmdExit: |
|
1022 case EAknSoftkeyExit: |
|
1023 { |
|
1024 HandleExitL(); |
|
1025 break; |
|
1026 } |
|
1027 |
|
1028 case EAknCmdHelp: |
|
1029 { |
|
1030 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
1031 { |
|
1032 HlpLauncher::LaunchHelpApplicationL( |
|
1033 iEventObserver.EikonEnv()->WsSession(), |
|
1034 iEventObserver.EikonEnv()->AppUi()->AppHelpContextL() ); |
|
1035 } |
|
1036 break; |
|
1037 } |
|
1038 |
|
1039 default: |
|
1040 { |
|
1041 //NOP |
|
1042 break; |
|
1043 } |
|
1044 } |
|
1045 |
|
1046 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::HandleCommandL" ); |
|
1047 } |
|
1048 |
|
1049 |
|
1050 // ----------------------------------------------------------------------------- |
|
1051 // Handles status changes common to all sharing types. |
|
1052 // ----------------------------------------------------------------------------- |
|
1053 // |
|
1054 void CMusUiEventController::HandleChangedStatusL( |
|
1055 TMusAvailabilityStatus aStatus ) |
|
1056 { |
|
1057 MUS_LOG( "mus: [MUSUI ] -> CMusUiEventController::HandleChangedStatusL" ); |
|
1058 switch( aStatus ) |
|
1059 { |
|
1060 case EErrNoActiveCall: |
|
1061 { |
|
1062 MUS_LOG( "mus: [MUSUI ] EErrNoActiveCall" ); |
|
1063 iActiveCall = EFalse; |
|
1064 HandleExitL(); |
|
1065 break; |
|
1066 } |
|
1067 case EErrCallOnHold: |
|
1068 case EErrConferenceCall: |
|
1069 case EMultimediaSharingNotAvailable: |
|
1070 { |
|
1071 MUS_LOG( "mus: [MUSUI ]\ |
|
1072 EErrCallOnHold, EErrConferenceCall, EMultimediaSharingNotAvailable" ); |
|
1073 HandleExitL(); |
|
1074 break; |
|
1075 } |
|
1076 case EErrSipRegistration: |
|
1077 { |
|
1078 MUS_LOG( "mus: [MUSUI ] EErrSipRegistration" ); |
|
1079 MusUiDialogUtil::ShowInformationDialogL( |
|
1080 R_MUS_LIVE_SHARING_VIEW_NOTE_SERVICE_N_A ); |
|
1081 HandleExitL(); |
|
1082 break; |
|
1083 } |
|
1084 case EErrRoaming: |
|
1085 { |
|
1086 MUS_LOG( "mus: [MUSUI ] EErrRoaming" ); |
|
1087 HandleExitL(); |
|
1088 break; |
|
1089 } |
|
1090 case EErrNetwork: |
|
1091 { |
|
1092 MUS_LOG( "mus: [MUSUI ] EErrNetwork" ); |
|
1093 MusUiDialogUtil::ShowInformationDialogL( |
|
1094 R_MUS_LIVE_SHARING_VIEW_NOTE_SERVICE_N_A ); |
|
1095 HandleExitL(); |
|
1096 break; |
|
1097 } |
|
1098 case EErrConnection: |
|
1099 { |
|
1100 MUS_LOG( "mus: [MUSUI ] EErrConnection" ); |
|
1101 MusUiDialogUtil::ShowInformationDialogL( |
|
1102 R_MUS_LIVE_SHARING_VIEW_NOTE_ONLY_3G ); |
|
1103 HandleExitL(); |
|
1104 break; |
|
1105 } |
|
1106 |
|
1107 case EErrServerShutDown: |
|
1108 { |
|
1109 MUS_LOG( "mus: [MUSUI ] EErrServerShutDown" ); |
|
1110 HandleExitL(); |
|
1111 break; |
|
1112 } |
|
1113 |
|
1114 default: |
|
1115 { |
|
1116 MUS_LOG( "mus: [MUSUI ] Default" ); |
|
1117 // TODO |
|
1118 break; |
|
1119 } |
|
1120 } |
|
1121 MUS_LOG( "mus: [MUSUI ] <- CMusUiEventController::HandleChangedStatusL" ); |
|
1122 } |
|
1123 |
|
1124 |