|
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 "musuiappui.h" |
|
21 #include "musuilivesharingview.h" |
|
22 #include "musuiclipsharingview.h" |
|
23 #include "musuireceiveview.h" |
|
24 #include "musuistatuspanehandler.h" |
|
25 #include "musuistartcontroller.h" |
|
26 #include "musuiactivequerydialog.h" |
|
27 #include "musuidefinitions.h" |
|
28 #include "mussettings.h" |
|
29 #include "mussettingskeys.h" |
|
30 #include "musmanagercommon.h" |
|
31 #include "musuiresourcehandler.h" |
|
32 #include "musui.hrh" |
|
33 #include "musuid.hrh" |
|
34 #include "muslogger.h" // debug logging |
|
35 #include <musui.rsg> |
|
36 #include <musui.mbg> |
|
37 |
|
38 #include <csxhelp/msh.hlp.hrh> |
|
39 #include <avkon.hrh> |
|
40 #include <AknsUtils.h> |
|
41 #include <remconcoreapitarget.h> |
|
42 #include <remconinterfaceselector.h> |
|
43 #include <akntoolbar.h> |
|
44 #include <AknVolumePopup.h> |
|
45 |
|
46 using namespace MusSettingsKeys; |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // Symbian second-phase constructor. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 void CMusUiAppUi::ConstructL() |
|
53 { |
|
54 MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::ConstructL" ); |
|
55 BaseConstructL( EAknEnableSkin | EAppOrientationAutomatic | EAknEnableMSK |
|
56 | EAknSingleClickCompatible ); |
|
57 |
|
58 iResourceHandler = CMusUiResourceHandler::NewL( *this ); |
|
59 MultimediaSharing::TMusUseCase usecase = MusUiStartController::ReadUseCaseL(); |
|
60 iResourceHandler->CheckInitialOrientationL(usecase); |
|
61 |
|
62 iForeground = ETrue; |
|
63 |
|
64 // View for Live Sharing: |
|
65 CMusUiLiveSharingView* liveSharingView = |
|
66 new ( ELeave ) CMusUiLiveSharingView; |
|
67 CleanupStack::PushL( liveSharingView ); |
|
68 liveSharingView->ConstructL(); |
|
69 AddViewL( liveSharingView ); // transfer ownership to CAknViewAppUi |
|
70 CleanupStack::Pop( liveSharingView ); |
|
71 |
|
72 // View for Clip Sharing: |
|
73 CMusUiClipSharingView* clipSharingView = |
|
74 new ( ELeave ) CMusUiClipSharingView; |
|
75 CleanupStack::PushL( clipSharingView ); |
|
76 clipSharingView->ConstructL(); |
|
77 AddViewL( clipSharingView ); // transfer ownership to CAknViewAppUi |
|
78 CleanupStack::Pop( clipSharingView ); |
|
79 |
|
80 // View for Receiving: |
|
81 CMusUiReceiveView* receiveView = new ( ELeave ) CMusUiReceiveView; |
|
82 CleanupStack::PushL( receiveView ); |
|
83 receiveView->ConstructL(); |
|
84 AddViewL( receiveView ); // transfer ownership to CAknViewAppUi |
|
85 CleanupStack::Pop( receiveView ); |
|
86 |
|
87 FindWindowGroupIdentifiersL(); |
|
88 |
|
89 iStatusPaneHandler = CMusUiStatusPaneHandler::NewL( *iEikonEnv ); |
|
90 // The application icon: |
|
91 iStatusPaneHandler->SetStatusPaneIconsL( |
|
92 EMbmMusuiQgn_menu_mus_app_cxt, |
|
93 EMbmMusuiQgn_menu_mus_app_cxt_mask ); |
|
94 |
|
95 iStatusPaneHandler->GetVolumePopup()->SetObserver(this); |
|
96 |
|
97 AknsUtils::InitSkinSupportL(); |
|
98 AknsUtils::SetAvkonSkinEnabledL( ETrue ); |
|
99 |
|
100 // Check use case and set default view |
|
101 switch ( usecase ) |
|
102 { |
|
103 case MultimediaSharing::EMusLiveVideo: |
|
104 ActivateLocalViewL( liveSharingView->Id() ); |
|
105 break; |
|
106 case MultimediaSharing::EMusClipVideo: |
|
107 ActivateLocalViewL( clipSharingView->Id() ); |
|
108 break; |
|
109 case MultimediaSharing::EMusReceive: |
|
110 ActivateLocalViewL( receiveView->Id() ); |
|
111 break; |
|
112 default: |
|
113 User::Leave( KErrNotSupported ); |
|
114 break; |
|
115 } |
|
116 |
|
117 iInterfaceSelector = CRemConInterfaceSelector::NewL(); |
|
118 iCoreTarget = CRemConCoreApiTarget::NewL(*iInterfaceSelector, *this); |
|
119 iInterfaceSelector->OpenTargetL(); |
|
120 |
|
121 // check if operator specific functionality is needed |
|
122 iOperatorSpecificFunctionality = |
|
123 ( MultimediaSharingSettings::OperatorVariantSettingL() == |
|
124 EOperatorSpecific ); |
|
125 |
|
126 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::ConstructL" ); |
|
127 } |
|
128 |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // Destructor. |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 CMusUiAppUi::~CMusUiAppUi() |
|
135 { |
|
136 MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::~CMusUiAppUi" ); |
|
137 delete iResourceHandler; |
|
138 delete iConfirmationQuery; |
|
139 delete iStatusPaneHandler; |
|
140 delete iInterfaceSelector; |
|
141 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::~CMusUiAppUi" ); |
|
142 } |
|
143 |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // Fetches a handle to status pane handler |
|
147 // ----------------------------------------------------------------------------- |
|
148 // |
|
149 CMusUiStatusPaneHandler* CMusUiAppUi::MusStatusPane() |
|
150 { |
|
151 return iStatusPaneHandler; |
|
152 } |
|
153 |
|
154 |
|
155 // ----------------------------------------------------------------------------- |
|
156 // |
|
157 // ----------------------------------------------------------------------------- |
|
158 // |
|
159 TBool CMusUiAppUi::ExitValue() |
|
160 { |
|
161 return iExit; |
|
162 } |
|
163 |
|
164 |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 // ----------------------------------------------------------------------------- |
|
168 // |
|
169 void CMusUiAppUi::HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination ) |
|
170 { |
|
171 MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::HandleWsEventL" ); |
|
172 |
|
173 const TInt type = aEvent.Type(); |
|
174 |
|
175 // Avoiding unknown failures |
|
176 if( !iView ) |
|
177 { |
|
178 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::HandleWsEventL, view is NULL" ); |
|
179 return; |
|
180 } |
|
181 |
|
182 if( type == EEventKeyUp ) |
|
183 { |
|
184 static_cast<CMusUiGeneralView*> |
|
185 ( iView )->HandleKeyUpEvent( iLastKeyCode ); |
|
186 } |
|
187 |
|
188 if ( ( type == EEventKey ) && iView->Toolbar()->IsShown() && !MUS_NO_TOOLBAR ) |
|
189 { |
|
190 const TKeyEvent* keyEvent = aEvent.Key(); |
|
191 |
|
192 iLastKeyCode = keyEvent->iCode; |
|
193 |
|
194 MUS_LOG1( "mus: [MUSUI ] CMusUiAppUi::HandleWsEventL iCode: %d", |
|
195 keyEvent->iCode ); |
|
196 CMusUiGeneralView* activatedView = |
|
197 static_cast<CMusUiGeneralView*>( iView ); |
|
198 activatedView->HandleToolbarCommandL( keyEvent->iCode ); |
|
199 } |
|
200 |
|
201 if ( type == KAknFullOrPartialForegroundLost || |
|
202 type == EEventFocusLost || |
|
203 type == KAknFullOrPartialForegroundGained || |
|
204 type == EEventFocusGained ) |
|
205 { |
|
206 DoHandleForegroundEventL( type ); |
|
207 } |
|
208 |
|
209 // All events are sent to base class. |
|
210 CAknAppUi::HandleWsEventL( aEvent, aDestination ); |
|
211 |
|
212 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::HandleWsEventL" ); |
|
213 } |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 void CMusUiAppUi::HandleForegroundEventL( TBool aForeground ) |
|
220 { |
|
221 MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::HandleForegroundEventL" ); |
|
222 |
|
223 CAknViewAppUi::HandleForegroundEventL( aForeground ); |
|
224 |
|
225 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::HandleForegroundEventL" ); |
|
226 } |
|
227 |
|
228 // ----------------------------------------------------------------------------- |
|
229 // |
|
230 // ----------------------------------------------------------------------------- |
|
231 // |
|
232 void CMusUiAppUi::MrccatoCommand( TRemConCoreApiOperationId aOperationId, |
|
233 TRemConCoreApiButtonAction aButtonAct ) |
|
234 { |
|
235 MUS_LOG2( "mus: [MUSUI ] -> CMusUiAppUi::MrccatoCommand: %d, %d", |
|
236 aOperationId, |
|
237 aButtonAct ); |
|
238 |
|
239 switch ( aOperationId ) |
|
240 { |
|
241 case ERemConCoreApiVolumeUp: // Volume Up |
|
242 { |
|
243 switch ( aButtonAct ) |
|
244 { |
|
245 case ERemConCoreApiButtonClick: |
|
246 { |
|
247 // volume up clicked |
|
248 CMusUiGeneralView* activatedView = |
|
249 static_cast<CMusUiGeneralView*>( iView ); |
|
250 if( MUS_NO_TOOLBAR ) |
|
251 { |
|
252 TRAP_IGNORE( activatedView->HandleCommandL( |
|
253 EMusuiCmdViewVolumeUp ) ) |
|
254 } |
|
255 else |
|
256 { |
|
257 TRAP_IGNORE( activatedView->HandleToolbarCommandL( |
|
258 EMusuiCmdViewVolumeUp ) ) |
|
259 } |
|
260 break; |
|
261 } |
|
262 default: |
|
263 // Never hits this |
|
264 break; |
|
265 } |
|
266 break; |
|
267 } |
|
268 case ERemConCoreApiVolumeDown: // Volume Down |
|
269 { |
|
270 switch ( aButtonAct ) |
|
271 { |
|
272 case ERemConCoreApiButtonClick: |
|
273 { |
|
274 // volume down clicked |
|
275 CMusUiGeneralView* activatedView = |
|
276 static_cast<CMusUiGeneralView*>( iView ); |
|
277 if( MUS_NO_TOOLBAR ) |
|
278 { |
|
279 TRAP_IGNORE( activatedView->HandleCommandL( |
|
280 EMusuiCmdViewVolumeDown ) ) |
|
281 } |
|
282 else |
|
283 { |
|
284 TRAP_IGNORE( activatedView->HandleToolbarCommandL( |
|
285 EMusuiCmdViewVolumeDown ) ) |
|
286 } |
|
287 break; |
|
288 } |
|
289 default: |
|
290 // Never hits this |
|
291 break; |
|
292 } |
|
293 break; |
|
294 } |
|
295 } |
|
296 |
|
297 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::MrccatoCommand" ); |
|
298 } |
|
299 |
|
300 |
|
301 // ----------------------------------------------------------------------------- |
|
302 // |
|
303 // ----------------------------------------------------------------------------- |
|
304 // |
|
305 void CMusUiAppUi::QueryAcceptedL( TBool aAccepted ) |
|
306 { |
|
307 MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::QueryAccepted" ); |
|
308 CMusUiGeneralView* activatedView = static_cast<CMusUiGeneralView*>( iView ); |
|
309 // TODO: If next call leaves, it causes error handling to be done with |
|
310 // previously deleted query object. This leads to crash. |
|
311 activatedView->AsyncQueryDialogAcceptedL( aAccepted ); |
|
312 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::QueryAccepted" ); |
|
313 } |
|
314 |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
|
317 // |
|
318 // ----------------------------------------------------------------------------- |
|
319 // |
|
320 TInt CMusUiAppUi::HandleQueryError( TInt aError ) |
|
321 { |
|
322 HandleError( aError ); // Forward to general error handler |
|
323 return KErrNone; |
|
324 } |
|
325 |
|
326 |
|
327 // ----------------------------------------------------------------------------- |
|
328 // |
|
329 // ----------------------------------------------------------------------------- |
|
330 // |
|
331 void CMusUiAppUi::ActivateLocalMusViewL( TUid aViewId ) |
|
332 { |
|
333 MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::ActivateLocalMusViewL" ); |
|
334 ActivateLocalViewL( aViewId ); |
|
335 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::ActivateLocalMusViewL" ); |
|
336 } |
|
337 |
|
338 |
|
339 // ----------------------------------------------------------------------------- |
|
340 // |
|
341 // ----------------------------------------------------------------------------- |
|
342 // |
|
343 void CMusUiAppUi::ActivateLocalMusViewL( TUid aViewId, |
|
344 TUid aCustomMessageId, |
|
345 const TDesC8& aCustomMessage ) |
|
346 { |
|
347 MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::ActivateLocalMusViewL" ); |
|
348 ActivateLocalViewL( aViewId, aCustomMessageId, aCustomMessage ); |
|
349 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::ActivateLocalMusViewL" ); |
|
350 } |
|
351 |
|
352 |
|
353 // ----------------------------------------------------------------------------- |
|
354 // |
|
355 // ----------------------------------------------------------------------------- |
|
356 // |
|
357 void CMusUiAppUi::ShowAsyncConfirmationQueryDialogL( const TDesC& aPrompt ) |
|
358 { |
|
359 MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::ShowAsyncConfirmationQueryDialogL" ); |
|
360 if ( !iConfirmationQuery ) |
|
361 { |
|
362 iConfirmationQuery = CMusUiActiveQueryDialog::NewL( *this ); |
|
363 } |
|
364 iConfirmationQuery->ShowL( aPrompt ); |
|
365 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::ShowAsyncConfirmationQueryDialogL" ); |
|
366 } |
|
367 |
|
368 |
|
369 // ----------------------------------------------------------------------------- |
|
370 // |
|
371 // ----------------------------------------------------------------------------- |
|
372 // |
|
373 void CMusUiAppUi::SetToolbarVisibility( TBool aVisible ) |
|
374 { |
|
375 CMusUiGeneralView* activatedView = static_cast<CMusUiGeneralView*>( iView ); |
|
376 if ( activatedView ) |
|
377 { |
|
378 activatedView->SetToolbarVisibility( aVisible ); |
|
379 } |
|
380 } |
|
381 |
|
382 |
|
383 // ----------------------------------------------------------------------------- |
|
384 // |
|
385 // ----------------------------------------------------------------------------- |
|
386 // |
|
387 void CMusUiAppUi::ShowNaviPaneIconL( TMusUiNaviMediaDecorator aIcon ) |
|
388 { |
|
389 MusStatusPane()->ShowNaviPaneIconL( aIcon ); |
|
390 } |
|
391 |
|
392 |
|
393 // ----------------------------------------------------------------------------- |
|
394 // |
|
395 // ----------------------------------------------------------------------------- |
|
396 // |
|
397 CEikonEnv* CMusUiAppUi::EikonEnv( ) const |
|
398 { |
|
399 return iEikonEnv; |
|
400 } |
|
401 |
|
402 |
|
403 // ----------------------------------------------------------------------------- |
|
404 // |
|
405 // ----------------------------------------------------------------------------- |
|
406 // |
|
407 void CMusUiAppUi::TerminateCall() |
|
408 { |
|
409 // TODO: Remove hard-coded values! |
|
410 MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::TerminateCall" ); |
|
411 RWsSession sess = iEikonEnv->WsSession(); |
|
412 |
|
413 TApaTaskList taskList(sess); |
|
414 |
|
415 TApaTask phoneTask = taskList.FindApp(TUid::Uid(0x100058B3)); |
|
416 MUS_LOG( "mus: [MUSUI ] phoneTask" ); |
|
417 TInt id = 0; |
|
418 if (phoneTask.Exists()) |
|
419 id = phoneTask.WgId(); |
|
420 MUS_LOG1( "PhoneTask ID: %d",id ); |
|
421 TWsEvent event; |
|
422 |
|
423 MUS_LOG( "mus: [MUSUI ] CMusUiAppUi::TerminateCall: 1" ); |
|
424 MUS_LOG( "mus: [MUSUI ] CMusUiAppUi::EEventKeyDown" ); |
|
425 event.SetType( EEventKeyDown ); |
|
426 event.SetTimeNow(); |
|
427 event.Key()->iCode = 0; |
|
428 event.Key()->iModifiers = EModifierNumLock; |
|
429 event.Key()->iRepeats = 0; |
|
430 event.Key()->iScanCode = EStdKeyNo; |
|
431 sess.SendEventToWindowGroup( id, event ); |
|
432 |
|
433 MUS_LOG( "mus: [MUSUI ] CMusUiAppUi::TerminateCall: 2" ); |
|
434 MUS_LOG( "mus: [MUSUI ] CMusUiAppUi::EEventKey" ); |
|
435 event.SetType( EEventKey ); |
|
436 event.SetTimeNow(); |
|
437 event.Key()->iCode = EKeyNo; |
|
438 event.Key()->iModifiers = 32769; |
|
439 event.Key()->iRepeats = 0; |
|
440 event.Key()->iScanCode = EStdKeyNo; |
|
441 sess.SendEventToWindowGroup( id, event ); |
|
442 |
|
443 MUS_LOG( "mus: [MUSUI ] CMusUiAppUi::TerminateCall: 3" ); |
|
444 MUS_LOG( "mus: [MUSUI ] CMusUiAppUi::EEventKeyUp" ); |
|
445 event.SetType( EEventKeyUp ); |
|
446 event.SetTimeNow(); |
|
447 event.Key()->iCode = 0; |
|
448 event.Key()->iModifiers = 32769; |
|
449 event.Key()->iRepeats = 0; |
|
450 event.Key()->iScanCode = EStdKeyNo; |
|
451 sess.SendEventToWindowGroup( id, event ); |
|
452 |
|
453 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::TerminateCall" ); |
|
454 } |
|
455 |
|
456 |
|
457 // ----------------------------------------------------------------------------- |
|
458 // Return current app orientation. |
|
459 // ----------------------------------------------------------------------------- |
|
460 // |
|
461 CAknAppUiBase::TAppUiOrientation CMusUiAppUi::AppOrientation() const |
|
462 { |
|
463 return ( ApplicationRect().Width() > ApplicationRect().Height() ) ? |
|
464 CAknAppUiBase::EAppUiOrientationLandscape : |
|
465 CAknAppUiBase::EAppUiOrientationPortrait; |
|
466 } |
|
467 |
|
468 |
|
469 // ----------------------------------------------------------------------------- |
|
470 // Switch the active view's orientation, if it's in the foreground. |
|
471 // ----------------------------------------------------------------------------- |
|
472 // |
|
473 void CMusUiAppUi::SwitchOrientationL( TAppUiOrientation aAppOrientation ) |
|
474 { |
|
475 MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::SwitchOrientationL" ); |
|
476 SetOrientationL( aAppOrientation ); |
|
477 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::SwitchOrientationL" ); |
|
478 } |
|
479 |
|
480 |
|
481 // ----------------------------------------------------------------------------- |
|
482 // |
|
483 // ----------------------------------------------------------------------------- |
|
484 // |
|
485 void CMusUiAppUi::HandleError( const TInt aReason ) |
|
486 { |
|
487 MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::HandleError" ); |
|
488 if ( aReason != KErrNone ) |
|
489 { |
|
490 HandleExit(); |
|
491 } |
|
492 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::HandleError" ); |
|
493 } |
|
494 |
|
495 |
|
496 // ----------------------------------------------------------------------------- |
|
497 // |
|
498 // ----------------------------------------------------------------------------- |
|
499 // |
|
500 void CMusUiAppUi::HandleExit() |
|
501 { |
|
502 MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::HandleExit" ); |
|
503 if ( !iExit ) |
|
504 { |
|
505 iExit = ETrue; |
|
506 PrepareToExit(); |
|
507 |
|
508 RemoveView( KMusUidLiveSharingView ); |
|
509 RemoveView( KMusUidClipSharingView ); |
|
510 RemoveView( KMusUidReceivingView ); |
|
511 |
|
512 User::Exit( KErrNone ); |
|
513 } |
|
514 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::HandleExit" ); |
|
515 } |
|
516 |
|
517 |
|
518 // ----------------------------------------------------------------------------- |
|
519 // |
|
520 // ----------------------------------------------------------------------------- |
|
521 // |
|
522 TBool CMusUiAppUi::OrientationCanBeChanged() const |
|
523 { |
|
524 return CAknAppUiBase::OrientationCanBeChanged(); |
|
525 } |
|
526 |
|
527 |
|
528 // ----------------------------------------------------------------------------- |
|
529 // From base class CEikAppUi. Handles a change to the application's |
|
530 // resources which are shared across the environment. |
|
531 // ----------------------------------------------------------------------------- |
|
532 // |
|
533 void CMusUiAppUi::HandleResourceChangeL( TInt aResourceChangeType ) |
|
534 { |
|
535 MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::HandleResourceChangeL" ); |
|
536 CAknAppUi::HandleResourceChangeL( aResourceChangeType ); |
|
537 |
|
538 if ( aResourceChangeType == KEikDynamicLayoutVariantSwitch && iView ) |
|
539 { |
|
540 MUS_LOG( "mus: [MUSUI ] CMusUiAppUi::HandleResourceChangeL:\ |
|
541 aResourceChangeType == KEikDynamicLayoutVariantSwitch" ); |
|
542 |
|
543 iView->Toolbar()->HandleResourceChange( aResourceChangeType ); |
|
544 |
|
545 CMusUiGeneralView* activatedView = |
|
546 static_cast<CMusUiGeneralView*>( iView ); |
|
547 if ( !IsForeground() ) |
|
548 { |
|
549 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::HandleResourceChangeL" ); |
|
550 return; |
|
551 } |
|
552 |
|
553 if ( activatedView ) |
|
554 { |
|
555 activatedView->RefreshView(); |
|
556 } |
|
557 } |
|
558 |
|
559 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::HandleResourceChangeL" ); |
|
560 } |
|
561 |
|
562 |
|
563 // ----------------------------------------------------------------------------- |
|
564 // takes care of key event handling |
|
565 // ----------------------------------------------------------------------------- |
|
566 // |
|
567 TKeyResponse CMusUiAppUi::HandleKeyEventL( const TKeyEvent& aKeyEvent, |
|
568 TEventCode /*aType*/ ) |
|
569 { |
|
570 MUS_LOG1( "mus: [MUSUI ] -> CMusUiAppUi::HandleKeyEventL: %d", |
|
571 aKeyEvent.iScanCode ); |
|
572 MUS_LOG1( "mus: [MUSUI ] -> CMusUiAppUi::HandleKeyEventL: %d", |
|
573 aKeyEvent.iCode ); |
|
574 |
|
575 if ( aKeyEvent.iScanCode == EStdKeyDevice1 /*165*/ ) // Cancel in Options |
|
576 { |
|
577 SetToolbarVisibility( ETrue ); |
|
578 } |
|
579 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::HandleKeyEventL" ); |
|
580 return EKeyWasNotConsumed; |
|
581 } |
|
582 |
|
583 |
|
584 // ----------------------------------------------------------------------------- |
|
585 // takes care of command handling |
|
586 // ----------------------------------------------------------------------------- |
|
587 // |
|
588 void CMusUiAppUi::HandleCommandL( TInt aCommand ) |
|
589 { |
|
590 MUS_LOG1( "mus: [MUSUI ] -> CMusUiAppUi::HandleCommandL [%d]", |
|
591 aCommand ); |
|
592 switch ( aCommand ) |
|
593 { |
|
594 case EMusuiGenCmdExit: |
|
595 case EAknSoftkeyExit: |
|
596 case EEikCmdExit: |
|
597 { |
|
598 CMusUiGeneralView* activatedView = |
|
599 static_cast<CMusUiGeneralView*>( iView ); |
|
600 activatedView->HandleCommandL( EAknSoftkeyExit ); |
|
601 |
|
602 break; |
|
603 } |
|
604 default: |
|
605 break; |
|
606 } |
|
607 MUS_LOG( "mus: [MUSUI ] <-> CMusUiAppUi::HandleCommandL" ); |
|
608 } |
|
609 |
|
610 // ----------------------------------------------------------------------------- |
|
611 // CMusUiAppUi::GetVolumeFromUi() |
|
612 // ----------------------------------------------------------------------------- |
|
613 // |
|
614 TInt CMusUiAppUi::GetUiVolumeValue() |
|
615 { |
|
616 return iStatusPaneHandler->GetVolumeControlValue(); |
|
617 } |
|
618 |
|
619 // ----------------------------------------------------------------------------- |
|
620 // CMusUiAppUi::ResourceHandler() |
|
621 // ----------------------------------------------------------------------------- |
|
622 // |
|
623 CMusUiResourceHandler* CMusUiAppUi::ResourceHandler() |
|
624 { |
|
625 return iResourceHandler; |
|
626 } |
|
627 |
|
628 // ----------------------------------------------------------------------------- |
|
629 // CMusUiAppUi::AppHelpContextL() |
|
630 // ----------------------------------------------------------------------------- |
|
631 // |
|
632 CArrayFix<TCoeHelpContext>* CMusUiAppUi::HelpContextL() const |
|
633 { |
|
634 MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::HelpContextL" ); |
|
635 CArrayFix<TCoeHelpContext>* contexts = |
|
636 new (ELeave) CArrayFixFlat<TCoeHelpContext>(1); |
|
637 CleanupStack::PushL(contexts); |
|
638 |
|
639 TCoeHelpContext help; |
|
640 help.iMajor.iUid = KMusUiUid; |
|
641 |
|
642 if ( iView->Id() == KMusUidLiveSharingView ) |
|
643 { |
|
644 help.iContext = KMSH_HLP_LIVE; |
|
645 } |
|
646 else if ( iView->Id() == KMusUidClipSharingView ) |
|
647 { |
|
648 help.iContext = KMSH_HLP_CLIP; |
|
649 } |
|
650 else if ( iView->Id() == KMusUidReceivingView ) |
|
651 { |
|
652 help.iContext = KMSH_HLP_RECEIVE; |
|
653 } |
|
654 |
|
655 contexts->AppendL(help); |
|
656 CleanupStack::Pop(); // contexts |
|
657 |
|
658 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::HelpContextL" ); |
|
659 return contexts; |
|
660 } |
|
661 |
|
662 |
|
663 // ----------------------------------------------------------------------------- |
|
664 // We might get PartialFocusLost also for some notes and |
|
665 // overally items that are somehow overlapping screen instead of |
|
666 // FocusLost. In those cases we should not put app to background. |
|
667 // ----------------------------------------------------------------------------- |
|
668 // |
|
669 void CMusUiAppUi::DoHandleForegroundEventL( TInt aEventType ) |
|
670 { |
|
671 MUS_LOG1( "mus: [MUSUI ] -> CMusUiAppUi::DoHandleForegroundEventL, event:%d", |
|
672 aEventType ); |
|
673 |
|
674 __ASSERT_ALWAYS( aEventType == KAknFullOrPartialForegroundGained || |
|
675 aEventType == KAknFullOrPartialForegroundLost || |
|
676 aEventType == EEventFocusLost || |
|
677 aEventType == EEventFocusGained, User::Leave( KErrArgument ) ); |
|
678 |
|
679 TBool handleEvent( EFalse ); |
|
680 TBool foreground( |
|
681 aEventType == KAknFullOrPartialForegroundGained || |
|
682 aEventType == EEventFocusGained ); |
|
683 |
|
684 const TInt windowGroupId = |
|
685 iCoeEnv->WsSession().GetFocusWindowGroup(); |
|
686 |
|
687 MUS_LOG1( "mus: [MUSUI ] focus wgid:%d", windowGroupId ); |
|
688 |
|
689 if ( foreground ) |
|
690 { |
|
691 iCoeEnv->RootWin().EnableFocusChangeEvents(); |
|
692 handleEvent = ETrue; |
|
693 } |
|
694 else if ( ( windowGroupId != iThisApplicationWgId ) && |
|
695 ( windowGroupId != iEikonServerWgId ) && |
|
696 ( windowGroupId != iAknNfyServerWgId ) ) |
|
697 { |
|
698 iCoeEnv->RootWin().DisableFocusChangeEvents(); |
|
699 handleEvent = ETrue; |
|
700 } |
|
701 else |
|
702 { |
|
703 // NOP |
|
704 } |
|
705 |
|
706 if ( handleEvent && iView && foreground != iForeground ) |
|
707 { |
|
708 iForeground = foreground; |
|
709 |
|
710 CMusUiGeneralView* activatedView = |
|
711 static_cast<CMusUiGeneralView*>( iView ); |
|
712 |
|
713 activatedView->DoHandleForegroundEventL( foreground ); |
|
714 } |
|
715 |
|
716 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::DoHandlerForegroundEventL" ); |
|
717 } |
|
718 |
|
719 // ----------------------------------------------------------------------------- |
|
720 // |
|
721 // ----------------------------------------------------------------------------- |
|
722 // |
|
723 void CMusUiAppUi::FindWindowGroupIdentifiersL() |
|
724 { |
|
725 MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::FindWindowGroupIdentifiersL" ); |
|
726 |
|
727 // Name of the EIKON server window group. |
|
728 _LIT( KMusUiEikonServer, "EikonServer" ); |
|
729 |
|
730 // Name of the AknCapServer window group. |
|
731 _LIT( KMusUiAknCapServer, "*akncapserver*" ); |
|
732 |
|
733 // Name of the AknNotifierServer window group. |
|
734 _LIT( KMusUiAknNotifierServer, "*aknnfysrv*" ); |
|
735 |
|
736 CEikonEnv& eikEnv = *( iEikonEnv ); |
|
737 eikEnv.SetSystem( ETrue ); |
|
738 eikEnv.WsSession().ComputeMode( RWsSession::EPriorityControlDisabled ); |
|
739 |
|
740 iThisApplicationWgId = eikEnv.RootWin().Identifier(); |
|
741 MUS_LOG1( "mus: [MUSUI ] own wgid:%d", iThisApplicationWgId ); |
|
742 iEikonServerWgId = |
|
743 eikEnv.WsSession().FindWindowGroupIdentifier( 0, KMusUiEikonServer ); |
|
744 MUS_LOG1( "mus: [MUSUI ] eikonserv wgid:%d", iEikonServerWgId ); |
|
745 iAknCapServerWgId = |
|
746 eikEnv.WsSession().FindWindowGroupIdentifier( 0, KMusUiAknCapServer ); |
|
747 MUS_LOG1( "mus: [MUSUI ] akncapserv wgid:%d", iAknCapServerWgId ); |
|
748 iAknNfyServerWgId = |
|
749 eikEnv.WsSession().FindWindowGroupIdentifier( 0, |
|
750 KMusUiAknNotifierServer ); |
|
751 MUS_LOG1( "mus: [MUSUI ] aknnotifserv wgid:%d", iAknNfyServerWgId ); |
|
752 |
|
753 eikEnv.RootWin().EnableFocusChangeEvents(); |
|
754 |
|
755 MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::FindWindowGroupIdentifiersL" ); |
|
756 } |
|
757 |
|
758 |
|
759 // ----------------------------------------------------------------------------- |
|
760 // |
|
761 // ----------------------------------------------------------------------------- |
|
762 // |
|
763 void CMusUiAppUi::HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType) |
|
764 { |
|
765 CAknVolumePopup* popup = iStatusPaneHandler->GetVolumePopup(); |
|
766 if ( popup && popup->IsVisible() && (popup == aControl) && |
|
767 (aEventType == MCoeControlObserver::EEventStateChanged) ) |
|
768 { |
|
769 MUS_LOG1( "mus: [MUSUI ] CMusUiAppUi::HandleControlEventL(): volume[%d]", |
|
770 popup->Value() ); |
|
771 CMusUiGeneralView* activatedView = |
|
772 static_cast<CMusUiGeneralView*>( iView ); |
|
773 activatedView->HandleCommandL( EMusuiCmdViewVolumeChanged ); |
|
774 } |
|
775 |
|
776 } |
|
777 // end of file |