author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 12:09:15 +0300 | |
branch | RCL_3 |
changeset 38 | ac48f0cc9f9c |
parent 35 | 6c57ef9392d2 |
child 41 | 755f0370535b |
permissions | -rw-r--r-- |
33 | 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 |
||
35
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
512 |
iExiting = EFalse; |
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
513 |
|
33 | 514 |
User::Exit( KErrNone ); |
515 |
} |
|
516 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::HandleExit" ); |
|
517 |
} |
|
518 |
||
519 |
||
520 |
// ----------------------------------------------------------------------------- |
|
521 |
// |
|
522 |
// ----------------------------------------------------------------------------- |
|
523 |
// |
|
524 |
TBool CMusUiAppUi::OrientationCanBeChanged() const |
|
525 |
{ |
|
526 |
return CAknAppUiBase::OrientationCanBeChanged(); |
|
527 |
} |
|
528 |
||
529 |
||
530 |
// ----------------------------------------------------------------------------- |
|
531 |
// From base class CEikAppUi. Handles a change to the application's |
|
532 |
// resources which are shared across the environment. |
|
533 |
// ----------------------------------------------------------------------------- |
|
534 |
// |
|
535 |
void CMusUiAppUi::HandleResourceChangeL( TInt aResourceChangeType ) |
|
536 |
{ |
|
537 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::HandleResourceChangeL" ); |
|
538 |
CAknAppUi::HandleResourceChangeL( aResourceChangeType ); |
|
539 |
||
540 |
if ( aResourceChangeType == KEikDynamicLayoutVariantSwitch && iView ) |
|
541 |
{ |
|
542 |
MUS_LOG( "mus: [MUSUI ] CMusUiAppUi::HandleResourceChangeL:\ |
|
543 |
aResourceChangeType == KEikDynamicLayoutVariantSwitch" ); |
|
544 |
||
545 |
iView->Toolbar()->HandleResourceChange( aResourceChangeType ); |
|
546 |
||
547 |
CMusUiGeneralView* activatedView = |
|
548 |
static_cast<CMusUiGeneralView*>( iView ); |
|
549 |
if ( !IsForeground() ) |
|
550 |
{ |
|
551 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::HandleResourceChangeL" ); |
|
552 |
return; |
|
553 |
} |
|
554 |
||
555 |
if ( activatedView ) |
|
556 |
{ |
|
557 |
activatedView->RefreshView(); |
|
558 |
} |
|
559 |
} |
|
560 |
||
561 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::HandleResourceChangeL" ); |
|
562 |
} |
|
563 |
||
564 |
||
565 |
// ----------------------------------------------------------------------------- |
|
566 |
// takes care of key event handling |
|
567 |
// ----------------------------------------------------------------------------- |
|
568 |
// |
|
569 |
TKeyResponse CMusUiAppUi::HandleKeyEventL( const TKeyEvent& aKeyEvent, |
|
570 |
TEventCode /*aType*/ ) |
|
571 |
{ |
|
572 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiAppUi::HandleKeyEventL: %d", |
|
573 |
aKeyEvent.iScanCode ); |
|
574 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiAppUi::HandleKeyEventL: %d", |
|
575 |
aKeyEvent.iCode ); |
|
576 |
||
577 |
if ( aKeyEvent.iScanCode == EStdKeyDevice1 /*165*/ ) // Cancel in Options |
|
578 |
{ |
|
579 |
SetToolbarVisibility( ETrue ); |
|
580 |
} |
|
581 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::HandleKeyEventL" ); |
|
582 |
return EKeyWasNotConsumed; |
|
583 |
} |
|
584 |
||
585 |
||
586 |
// ----------------------------------------------------------------------------- |
|
587 |
// takes care of command handling |
|
588 |
// ----------------------------------------------------------------------------- |
|
589 |
// |
|
590 |
void CMusUiAppUi::HandleCommandL( TInt aCommand ) |
|
591 |
{ |
|
592 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiAppUi::HandleCommandL [%d]", |
|
593 |
aCommand ); |
|
594 |
switch ( aCommand ) |
|
595 |
{ |
|
596 |
case EMusuiGenCmdExit: |
|
597 |
case EAknSoftkeyExit: |
|
598 |
case EEikCmdExit: |
|
599 |
{ |
|
600 |
CMusUiGeneralView* activatedView = |
|
601 |
static_cast<CMusUiGeneralView*>( iView ); |
|
602 |
activatedView->HandleCommandL( EAknSoftkeyExit ); |
|
603 |
||
604 |
break; |
|
605 |
} |
|
606 |
default: |
|
607 |
break; |
|
608 |
} |
|
609 |
MUS_LOG( "mus: [MUSUI ] <-> CMusUiAppUi::HandleCommandL" ); |
|
610 |
} |
|
611 |
||
612 |
// ----------------------------------------------------------------------------- |
|
613 |
// CMusUiAppUi::GetVolumeFromUi() |
|
614 |
// ----------------------------------------------------------------------------- |
|
615 |
// |
|
616 |
TInt CMusUiAppUi::GetUiVolumeValue() |
|
617 |
{ |
|
618 |
return iStatusPaneHandler->GetVolumeControlValue(); |
|
619 |
} |
|
620 |
||
621 |
// ----------------------------------------------------------------------------- |
|
622 |
// CMusUiAppUi::ResourceHandler() |
|
623 |
// ----------------------------------------------------------------------------- |
|
624 |
// |
|
625 |
CMusUiResourceHandler* CMusUiAppUi::ResourceHandler() |
|
626 |
{ |
|
627 |
return iResourceHandler; |
|
628 |
} |
|
629 |
||
630 |
// ----------------------------------------------------------------------------- |
|
631 |
// CMusUiAppUi::AppHelpContextL() |
|
632 |
// ----------------------------------------------------------------------------- |
|
633 |
// |
|
634 |
CArrayFix<TCoeHelpContext>* CMusUiAppUi::HelpContextL() const |
|
635 |
{ |
|
636 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::HelpContextL" ); |
|
637 |
CArrayFix<TCoeHelpContext>* contexts = |
|
638 |
new (ELeave) CArrayFixFlat<TCoeHelpContext>(1); |
|
639 |
CleanupStack::PushL(contexts); |
|
640 |
||
641 |
TCoeHelpContext help; |
|
642 |
help.iMajor.iUid = KMusUiUid; |
|
643 |
||
644 |
if ( iView->Id() == KMusUidLiveSharingView ) |
|
645 |
{ |
|
646 |
help.iContext = KMSH_HLP_LIVE; |
|
647 |
} |
|
648 |
else if ( iView->Id() == KMusUidClipSharingView ) |
|
649 |
{ |
|
650 |
help.iContext = KMSH_HLP_CLIP; |
|
651 |
} |
|
652 |
else if ( iView->Id() == KMusUidReceivingView ) |
|
653 |
{ |
|
654 |
help.iContext = KMSH_HLP_RECEIVE; |
|
655 |
} |
|
656 |
||
657 |
contexts->AppendL(help); |
|
658 |
CleanupStack::Pop(); // contexts |
|
659 |
||
660 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::HelpContextL" ); |
|
661 |
return contexts; |
|
662 |
} |
|
663 |
||
664 |
||
665 |
// ----------------------------------------------------------------------------- |
|
666 |
// We might get PartialFocusLost also for some notes and |
|
667 |
// overally items that are somehow overlapping screen instead of |
|
668 |
// FocusLost. In those cases we should not put app to background. |
|
669 |
// ----------------------------------------------------------------------------- |
|
670 |
// |
|
671 |
void CMusUiAppUi::DoHandleForegroundEventL( TInt aEventType ) |
|
672 |
{ |
|
673 |
MUS_LOG1( "mus: [MUSUI ] -> CMusUiAppUi::DoHandleForegroundEventL, event:%d", |
|
674 |
aEventType ); |
|
675 |
||
676 |
__ASSERT_ALWAYS( aEventType == KAknFullOrPartialForegroundGained || |
|
677 |
aEventType == KAknFullOrPartialForegroundLost || |
|
678 |
aEventType == EEventFocusLost || |
|
679 |
aEventType == EEventFocusGained, User::Leave( KErrArgument ) ); |
|
680 |
||
681 |
TBool handleEvent( EFalse ); |
|
682 |
TBool foreground( |
|
683 |
aEventType == KAknFullOrPartialForegroundGained || |
|
684 |
aEventType == EEventFocusGained ); |
|
685 |
||
686 |
const TInt windowGroupId = |
|
687 |
iCoeEnv->WsSession().GetFocusWindowGroup(); |
|
688 |
||
689 |
MUS_LOG1( "mus: [MUSUI ] focus wgid:%d", windowGroupId ); |
|
690 |
||
691 |
if ( foreground ) |
|
692 |
{ |
|
693 |
iCoeEnv->RootWin().EnableFocusChangeEvents(); |
|
694 |
handleEvent = ETrue; |
|
695 |
} |
|
696 |
else if ( ( windowGroupId != iThisApplicationWgId ) && |
|
697 |
( windowGroupId != iEikonServerWgId ) && |
|
698 |
( windowGroupId != iAknNfyServerWgId ) ) |
|
699 |
{ |
|
700 |
iCoeEnv->RootWin().DisableFocusChangeEvents(); |
|
701 |
handleEvent = ETrue; |
|
702 |
} |
|
703 |
else |
|
704 |
{ |
|
705 |
// NOP |
|
706 |
} |
|
707 |
||
708 |
if ( handleEvent && iView && foreground != iForeground ) |
|
709 |
{ |
|
710 |
iForeground = foreground; |
|
711 |
||
712 |
CMusUiGeneralView* activatedView = |
|
713 |
static_cast<CMusUiGeneralView*>( iView ); |
|
714 |
||
715 |
activatedView->DoHandleForegroundEventL( foreground ); |
|
716 |
} |
|
717 |
||
718 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::DoHandlerForegroundEventL" ); |
|
719 |
} |
|
720 |
||
721 |
// ----------------------------------------------------------------------------- |
|
722 |
// |
|
723 |
// ----------------------------------------------------------------------------- |
|
724 |
// |
|
725 |
void CMusUiAppUi::FindWindowGroupIdentifiersL() |
|
726 |
{ |
|
727 |
MUS_LOG( "mus: [MUSUI ] -> CMusUiAppUi::FindWindowGroupIdentifiersL" ); |
|
728 |
||
729 |
// Name of the EIKON server window group. |
|
730 |
_LIT( KMusUiEikonServer, "EikonServer" ); |
|
731 |
||
732 |
// Name of the AknCapServer window group. |
|
733 |
_LIT( KMusUiAknCapServer, "*akncapserver*" ); |
|
734 |
||
735 |
// Name of the AknNotifierServer window group. |
|
736 |
_LIT( KMusUiAknNotifierServer, "*aknnfysrv*" ); |
|
737 |
||
738 |
CEikonEnv& eikEnv = *( iEikonEnv ); |
|
739 |
eikEnv.SetSystem( ETrue ); |
|
740 |
eikEnv.WsSession().ComputeMode( RWsSession::EPriorityControlDisabled ); |
|
741 |
||
742 |
iThisApplicationWgId = eikEnv.RootWin().Identifier(); |
|
743 |
MUS_LOG1( "mus: [MUSUI ] own wgid:%d", iThisApplicationWgId ); |
|
744 |
iEikonServerWgId = |
|
745 |
eikEnv.WsSession().FindWindowGroupIdentifier( 0, KMusUiEikonServer ); |
|
746 |
MUS_LOG1( "mus: [MUSUI ] eikonserv wgid:%d", iEikonServerWgId ); |
|
747 |
iAknCapServerWgId = |
|
748 |
eikEnv.WsSession().FindWindowGroupIdentifier( 0, KMusUiAknCapServer ); |
|
749 |
MUS_LOG1( "mus: [MUSUI ] akncapserv wgid:%d", iAknCapServerWgId ); |
|
750 |
iAknNfyServerWgId = |
|
751 |
eikEnv.WsSession().FindWindowGroupIdentifier( 0, |
|
752 |
KMusUiAknNotifierServer ); |
|
753 |
MUS_LOG1( "mus: [MUSUI ] aknnotifserv wgid:%d", iAknNfyServerWgId ); |
|
754 |
||
755 |
eikEnv.RootWin().EnableFocusChangeEvents(); |
|
756 |
||
757 |
MUS_LOG( "mus: [MUSUI ] <- CMusUiAppUi::FindWindowGroupIdentifiersL" ); |
|
758 |
} |
|
759 |
||
760 |
||
761 |
// ----------------------------------------------------------------------------- |
|
762 |
// |
|
763 |
// ----------------------------------------------------------------------------- |
|
764 |
// |
|
765 |
void CMusUiAppUi::HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType) |
|
766 |
{ |
|
767 |
CAknVolumePopup* popup = iStatusPaneHandler->GetVolumePopup(); |
|
768 |
if ( popup && popup->IsVisible() && (popup == aControl) && |
|
769 |
(aEventType == MCoeControlObserver::EEventStateChanged) ) |
|
770 |
{ |
|
771 |
MUS_LOG1( "mus: [MUSUI ] CMusUiAppUi::HandleControlEventL(): volume[%d]", |
|
772 |
popup->Value() ); |
|
773 |
CMusUiGeneralView* activatedView = |
|
774 |
static_cast<CMusUiGeneralView*>( iView ); |
|
775 |
activatedView->HandleCommandL( EMusuiCmdViewVolumeChanged ); |
|
776 |
} |
|
777 |
||
778 |
} |
|
35
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
779 |
|
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
780 |
|
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
781 |
// ----------------------------------------------------------------------------- |
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
782 |
// |
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
783 |
// ----------------------------------------------------------------------------- |
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
784 |
// |
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
785 |
void CMusUiAppUi::SetExitingFlag() |
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
786 |
{ |
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
787 |
iExiting = ETrue; |
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
788 |
} |
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
789 |
|
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
790 |
|
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
791 |
// ----------------------------------------------------------------------------- |
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
792 |
// |
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
793 |
// ----------------------------------------------------------------------------- |
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
794 |
// |
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
795 |
TBool CMusUiAppUi::IsExiting () |
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
796 |
{ |
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
797 |
return iExiting; |
6c57ef9392d2
Revision: 201032
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
798 |
} |
33 | 799 |
// end of file |