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