|
1 /* |
|
2 * Copyright (c) 2006 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 UI class required by AVKON application architecture. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <AknGlobalNote.h> |
|
22 #include <avkon.hrh> |
|
23 #include <apgwgnam.h> |
|
24 #include <hlplch.h> |
|
25 #include <e32base.h> |
|
26 #include <e32property.h> |
|
27 #include <eikproc.h> |
|
28 #include <apacln.h> |
|
29 #include <coeutils.h> |
|
30 #include <StringLoader.h> |
|
31 #include <textresolver.h> |
|
32 #include <aknnotewrappers.h> |
|
33 #include <AknTaskList.h> |
|
34 #include <aknview.h> |
|
35 #include <featmgr.h> |
|
36 #include <centralrepository.h> |
|
37 #include <settingsinternalcrkeys.h> |
|
38 #include <ctsydomainpskeys.h> |
|
39 #include <caf/caferr.h> |
|
40 #include <eikapp.h> |
|
41 #include <pathinfo.h> |
|
42 #include <sysutil.h> |
|
43 #include <apgcli.h> |
|
44 #include <AknDlgShut.h> |
|
45 #include <aknconsts.h> |
|
46 #include <activeidle2domainpskeys.h> |
|
47 #ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER |
|
48 #include <AiwGenericParam.h> |
|
49 #endif |
|
50 |
|
51 #include <mpxplaybackutility.h> |
|
52 #include <mpxcollectionutility.h> |
|
53 #include <mpxplaybackmessage.h> |
|
54 #include <mpxviewutility.h> |
|
55 #include <mpxmusicplayerviewplugin.hrh> |
|
56 #include <mpx.rsg> |
|
57 #include <mpxcollectionmessage.h> |
|
58 #include <mpxcollectionplaylist.h> |
|
59 #include <mpxcollectionpath.h> |
|
60 #include <mpxcollectionplugin.hrh> |
|
61 #include <mpxmedia.h> |
|
62 #include <mpxmediageneraldefs.h> |
|
63 #include <mpxmediadrmdefs.h> |
|
64 #include <mpxcollectionuihelper.h> |
|
65 #include <mpxcollectionhelperfactory.h> |
|
66 #include <mpxmediaarray.h> |
|
67 #include <mpxmediacontainerdefs.h> |
|
68 #include <mpxmediakeyhandler.h> |
|
69 #include <mpxharvesterutility.h> |
|
70 #include <mpxdrmmediautility.h> |
|
71 #include <mpxcollectionmessagedefs.h> |
|
72 #include <mpxmessagegeneraldefs.h> |
|
73 #include <mpxcollectionplugin.hrh> |
|
74 #include <mpxcommandgeneraldefs.h> |
|
75 #include <mpxcollectioncommanddefs.h> |
|
76 #include <gfxtranseffect/gfxtranseffect.h> |
|
77 #include <akntranseffect.h> |
|
78 #include <layoutmetadata.cdl.h> |
|
79 |
|
80 // Cover UI start |
|
81 //#ifdef __COVER_DISPLAY |
|
82 #include <aknSDData.h> |
|
83 #include <AknMediatorFacade.h> |
|
84 #include <MediatorCommandInitiator.h> |
|
85 #include <MediatorDomainUIDs.h> |
|
86 #include "mplayersecondarydisplayapi.h" |
|
87 #include <featmgr.h> |
|
88 //#endif |
|
89 // Cover UI end |
|
90 |
|
91 #ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT |
|
92 #include "camesedrmhandler.h" |
|
93 #endif |
|
94 |
|
95 #ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER |
|
96 #include <DocumentHandler.h> |
|
97 #include <apmstd.h> |
|
98 #endif //RD_RA_SUPPORT_FOR_MUSIC_PLAYER |
|
99 |
|
100 #include "mpxinternalcrkeys.h" |
|
101 #include "mpxcommandhandler.h" |
|
102 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
103 #include <AiwGenericParam.h> |
|
104 #include "mpxPDcommandhandler.h" |
|
105 #endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
106 #include "mpxcommonuihelper.h" |
|
107 #include <mpxcommonui.rsg> //for R_MPX_FILE_NOT_FOUND_TEXT |
|
108 #include "mpxappui.h" |
|
109 #include "mpxcontroller.h" |
|
110 #include "mpxrestorepath.h" |
|
111 #include "mpxdocument.h" |
|
112 #include "mpxtlshelper.h" |
|
113 #include "mpxlog.h" |
|
114 #include "mpxappui.hrh" |
|
115 #include <mpxconstants.h> |
|
116 #include <mpxviewpluginmanager.h> |
|
117 #include <mpxviewplugin.h> |
|
118 |
|
119 #include <iaupdate.h> |
|
120 #include <iaupdateparameters.h> |
|
121 #include <iaupdateresult.h> |
|
122 |
|
123 #include <mpxparameter.h> // CMPXParameter |
|
124 |
|
125 // CONSTANTS |
|
126 _LIT( KMPXLineChange, "\n" ); |
|
127 _LIT(KMPXMusicplayerPrivateFolder, "\\private\\"); |
|
128 _LIT(KMPXMusicPlayerExec, "mpx.exe" ); |
|
129 _LIT8(KRemConTspControllerPlayParam, "play"); |
|
130 |
|
131 const TInt KMPXMusicPlayerAlreadySaved( -5000 ); |
|
132 |
|
133 const TInt KPlayerMusicPlayerParameterGranularity = 50; |
|
134 |
|
135 // Application Uid for Active Idle app |
|
136 #ifdef __ACTIVE_IDLE |
|
137 const TUid KMPXUidIdleApp = { 0x101FD64C }; |
|
138 #else |
|
139 const TUid KMPXUidIdleApp = KPSUidActiveIdle2; // use this one instead because the "aisystemuids.hrh" is not export |
|
140 #endif |
|
141 |
|
142 // MusicPlayer SIS Package UID |
|
143 #define KMPXMusicPlayerSISPkgUid 0x101FFC62 |
|
144 |
|
145 _LIT8( KMmMessage, "mm://musicsuite?action=exit" ); |
|
146 const TInt KMmUid3( 0x101f4cd2 ); |
|
147 |
|
148 // Granularity for ring tone mime types array |
|
149 const TInt KMPXRingToneMimeTypesGranularity( 10 ); |
|
150 |
|
151 const TInt KMPXMinVolume( 0 ); |
|
152 const TInt KMPXMaxVolume(100); |
|
153 |
|
154 #ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER |
|
155 _LIT8(KDataTypeRAM,"audio/x-pn-realaudio-plugin"); |
|
156 #endif //RD_RA_SUPPORT_FOR_MUSIC_PLAYER |
|
157 |
|
158 const TInt KMaxIntLen( 10 ); |
|
159 _LIT8( KMVPrefix, "MVviewID:" ); |
|
160 const TInt KMVPrefixLen( 9 ); |
|
161 |
|
162 const TUid KLocalPlaybackUid = { 0x101FFC06 }; |
|
163 const TUid KPhoneAppUid = {0x100058B3}; |
|
164 const TInt KWaitNoteImpUid = 0x101FFC6C; // refresh wait note UID |
|
165 const TInt KLowestMemoryNeeded = 5242880; //5 Mbytes |
|
166 |
|
167 const TUid KCRUidMPXMPSettings = {0x101FFCDC}; |
|
168 const TUint32 KMPXMPPlaybackRandomMode = 0x0B; |
|
169 const TUint32 KMPXMPPlaybackRepeatMode = 0x0C; |
|
170 const TInt KIMMusicPluginUid = 0x10282960; |
|
171 |
|
172 // ======== MEMBER FUNCTIONS ======== |
|
173 |
|
174 // --------------------------------------------------------------------------- |
|
175 // C++ default constructor. |
|
176 // --------------------------------------------------------------------------- |
|
177 // |
|
178 CMPXAppUi::CMPXAppUi() |
|
179 : iRingToneMimeTypes( KMPXRingToneMimeTypesGranularity ), |
|
180 iCurrentIndex( KErrNotFound ), iSaveMode( EMPXSaveModeIdle ), |
|
181 iStandAlone(EFalse), |
|
182 iMaxVolume(KMPXMaxVolume) |
|
183 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
184 ,iAppStartedByBrowser(EFalse) |
|
185 ,iPdPbvStartedByBrowser(EFalse) |
|
186 ,icollectionBrowsed(EFalse) |
|
187 #endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
188 #ifdef FF_OOM_MONITOR2_COMPONENT //__ENABLE_MPX_BUSYSETTING_FOR_OOM2 |
|
189 ,iOomPriority( ROomMonitorSession::EOomPriorityNormal ) |
|
190 #endif //FF_OOM_MONITOR2_COMPONENT |
|
191 { |
|
192 } |
|
193 |
|
194 |
|
195 // --------------------------------------------------------------------------- |
|
196 // Symbian 2nd phase constructor can leave. |
|
197 // --------------------------------------------------------------------------- |
|
198 // |
|
199 void CMPXAppUi::ConstructL() |
|
200 { |
|
201 MPX_FUNC( "CMPXAppUi::ConstructL" ); |
|
202 #ifndef __ENABLE_MSK |
|
203 BaseConstructL( EAknEnableSkin |
|
204 #ifdef SINGLE_CLICK_INCLUDED |
|
205 | EAknSingleClickCompatible |
|
206 #endif |
|
207 ); |
|
208 #else |
|
209 BaseConstructL( EAknEnableSkin | EAknEnableMSK |
|
210 #ifdef SINGLE_CLICK_INCLUDED |
|
211 | EAknSingleClickCompatible |
|
212 #endif |
|
213 ); |
|
214 #endif // __ENABLE_MSK |
|
215 |
|
216 iCommonUiHelper = CMPXCommonUiHelper::NewL(); |
|
217 |
|
218 // Cover UI start |
|
219 //#ifdef __COVER_DISPLAY |
|
220 // initialize FeatureManager |
|
221 FeatureManager::InitializeLibL(); |
|
222 |
|
223 // Check updates from IAD, continue UI launching even if something fails there |
|
224 // Uncomment when to add IAD update checking functionality to music player |
|
225 // TRAP_IGNORE( CheckUpdatesL() ); |
|
226 |
|
227 if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) ) |
|
228 { |
|
229 iCoverDisplay = ETrue; |
|
230 iCommandInitiator = CMediatorCommandInitiator::NewL( NULL ); |
|
231 } |
|
232 else |
|
233 { |
|
234 iCoverDisplay = EFalse; |
|
235 } |
|
236 //#endif // __COVER_DISPLAY |
|
237 // Cover UI end |
|
238 |
|
239 if ( MPXUser::IsCallOngoing( EPSCTsyCallTypeH324Multimedia ) ) |
|
240 { |
|
241 HBufC* text = |
|
242 StringLoader::LoadLC( R_MPX_VIDEO_CALL_ONGOING ); |
|
243 CAknGlobalNote* globalInfoNote = CAknGlobalNote::NewLC(); |
|
244 |
|
245 // Cover UI start |
|
246 //#ifdef __COVER_DISPLAY |
|
247 if ( iCoverDisplay ) |
|
248 { |
|
249 CAknSDData* sddata = CAknSDData::NewL( |
|
250 KMPlayerNoteCategory, |
|
251 EMPlayerNoteVideoCall, |
|
252 KNullDesC8); |
|
253 globalInfoNote->SetSecondaryDisplayData(sddata); // ownership transferred |
|
254 } |
|
255 //#endif //__COVER_DISPLAY |
|
256 // Cover UI end |
|
257 |
|
258 globalInfoNote->ShowNoteL( |
|
259 EAknGlobalInformationNote, |
|
260 text->Des() ); |
|
261 CleanupStack::PopAndDestroy( globalInfoNote ); |
|
262 CleanupStack::PopAndDestroy( text ); |
|
263 Exit(); |
|
264 return; |
|
265 } |
|
266 |
|
267 //check memory |
|
268 #ifdef FF_OOM_MONITOR2_COMPONENT |
|
269 CheckAvailableMemoryByOomL( KLowestMemoryNeeded ); |
|
270 #else |
|
271 CheckAvailableMemoryL( KLowestMemoryNeeded ); |
|
272 #endif //FF_OOM_MONITOR2_COMPONENT |
|
273 |
|
274 if ( !IsEmbedded() ) |
|
275 { |
|
276 // Do we support podcasting in music player? |
|
277 // Event if repository get fails, it will default to EFalse |
|
278 // |
|
279 TInt val(0); |
|
280 CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures ); |
|
281 repository->Get( KMPXMPLocalVariation, val ); |
|
282 iDisablePodcasting = val&KMPXDisablePodcastingOption ? ETrue : EFalse; |
|
283 iStartInAlbumMenu = val&KMPXStartMusicPlayerinArtistsandAlbums ? ETrue : EFalse; |
|
284 delete repository; |
|
285 CreateMemberVariablesL(); |
|
286 |
|
287 TUid defaultView( iViewUtility->DefaultViewUid() ); |
|
288 |
|
289 // Pre-load views in standalone mode |
|
290 iViewUtility->PreLoadViewsL( TUid::Uid( KMusicPlayerAppUidConstant ) ); |
|
291 #ifndef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
292 iCollectionUtility->Collection().OpenL( |
|
293 TUid::Uid(EMPXCollectionPluginMusic)); |
|
294 #endif |
|
295 |
|
296 if ( iStartInAlbumMenu ) |
|
297 { |
|
298 |
|
299 // We want to open the music player to the albums level for 9.2 |
|
300 // Changes in other areas will also be needed. |
|
301 |
|
302 CMPXCollectionPath* path = iCollectionUiHelper->MusicMenuPathL(); |
|
303 CleanupStack::PushL( path ); |
|
304 path->AppendL(3); // Albums |
|
305 MPX_DEBUG_PATH(*path); |
|
306 iCollectionUtility->Collection().OpenL( *path ); |
|
307 CleanupStack::PopAndDestroy( path ); |
|
308 } |
|
309 else |
|
310 { |
|
311 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
312 CleanupStack::PushL( path ); |
|
313 MPX_DEBUG1("CMPXAppUi::ConstructL() current collection path"); |
|
314 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
315 MPX_DEBUG1("CMPXAppUi::ConstructL() restoring stale path"); |
|
316 CMPXCollectionPath* mainMusicMenu = CMPXCollectionPath::NewL(); |
|
317 CleanupStack::PushL( mainMusicMenu ); |
|
318 mainMusicMenu->AppendL(0x101FFC3A); |
|
319 iCollectionUtility->Collection().OpenL( *mainMusicMenu ); |
|
320 CleanupStack::PopAndDestroy( mainMusicMenu ); |
|
321 CleanupStack::PopAndDestroy( path ); |
|
322 #else |
|
323 MPX_DEBUG1( "CMPXAppUi::ConstructL wrong path" ); |
|
324 if( path->Levels() > 1 ) |
|
325 { |
|
326 // Correct the path by opening 0 levels |
|
327 MPX_DEBUG1("CMPXAppUi::ConstructL() restoring stale path"); |
|
328 CMPXCollectionPath* root = CMPXCollectionPath::NewL(); |
|
329 CleanupStack::PushL( root ); |
|
330 iCollectionUtility->Collection().OpenL( *root ); |
|
331 CleanupStack::PopAndDestroy( root ); |
|
332 } |
|
333 CleanupStack::PopAndDestroy( path ); |
|
334 #endif |
|
335 } |
|
336 |
|
337 |
|
338 if ( defaultView != KNullUid ) |
|
339 { |
|
340 iViewUtility->SetAsDefaultViewL( defaultView ); |
|
341 } |
|
342 else |
|
343 { |
|
344 iViewUtility->SetAsDefaultViewL( |
|
345 TUid::Uid( KMPXPluginTypeMainUid ) ); |
|
346 } |
|
347 |
|
348 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
349 // Startup database checker |
|
350 iController = CMPXController::NewL(iDisablePodcasting); |
|
351 #endif // __ENABLE_PODCAST_IN_MUSIC_MENU |
|
352 |
|
353 // Only in stand alone mode |
|
354 iHarvesterUtility = CMPXHarvesterFactory::NewL(); |
|
355 iHarvesterUtility->CheckForSystemEventsL(); |
|
356 |
|
357 #ifdef _DEBUG |
|
358 TBool iExitOptionHidden = EFalse; |
|
359 #else // _DEBUG |
|
360 TBool iExitOptionHidden = iCommonUiHelper->ExitOptionHiddenL(); |
|
361 #endif // _DEBUG |
|
362 if(iExitOptionHidden) |
|
363 { |
|
364 // Do not offer choice to exit application from task swapper. |
|
365 CEikonEnv::Static()->SetSystem( ETrue ); |
|
366 } |
|
367 |
|
368 RProcess proc; |
|
369 CleanupClosePushL( proc ); |
|
370 CMPXCommonUiHelper::SetStandAloneModePId( proc.Id().Id() ); |
|
371 CleanupStack::PopAndDestroy( &proc ); |
|
372 } |
|
373 |
|
374 iRingToneMimeTypes.AppendL(_L("application/vnd.nokia.ringing-tone")); |
|
375 iRingToneMimeTypes.AppendL(_L("audio/x-midi")); |
|
376 iRingToneMimeTypes.AppendL(_L("audio/midi")); |
|
377 iRingToneMimeTypes.AppendL(_L("audio/sp-midi")); |
|
378 iRingToneMimeTypes.AppendL(_L("audio/amr")); |
|
379 iRingToneMimeTypes.AppendL(_L("audio/amr-wb")); |
|
380 iRingToneMimeTypes.AppendL(_L("audio/awb")); |
|
381 iRingToneMimeTypes.AppendL(_L("audio/x-amr")); |
|
382 iRingToneMimeTypes.AppendL(_L("audio/audio/vnd.nokia.mobile-xmf")); |
|
383 iLaunchModePlaying = EFalse; |
|
384 } |
|
385 |
|
386 |
|
387 // --------------------------------------------------------------------------- |
|
388 // Destructor |
|
389 // --------------------------------------------------------------------------- |
|
390 // |
|
391 CMPXAppUi::~CMPXAppUi() |
|
392 { |
|
393 MPX_DEBUG1( "-->CMPXAppUi::~CMPXAppUi()" ); |
|
394 #ifdef FF_OOM_MONITOR2_COMPONENT |
|
395 TRAP_IGNORE( SetMpxOomPriorityL( ROomMonitorSession::EOomPriorityNormal ) ); |
|
396 #endif //FF_OOM_MONITOR2_COMPONENT |
|
397 |
|
398 if ( !IsEmbedded() ) |
|
399 { |
|
400 CMPXCommonUiHelper::SetStandAloneModePId( 0 ); |
|
401 } |
|
402 |
|
403 // Cover UI Start |
|
404 // #ifdef __COVER_DISPLAY |
|
405 |
|
406 FeatureManager::UnInitializeLib(); |
|
407 delete iCommandInitiator; |
|
408 |
|
409 // #endif // __COVER_DISPLAY |
|
410 // Cover UI End |
|
411 delete iPathRestore; |
|
412 delete iController; |
|
413 delete iProcessParameter; |
|
414 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
415 delete iPdParameterHandler; |
|
416 #endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
417 delete iIdle; |
|
418 |
|
419 if ( iCollectionUtility ) |
|
420 { |
|
421 iCollectionUtility->Close(); |
|
422 } |
|
423 |
|
424 if ( iPlaybackUtility ) |
|
425 { |
|
426 TRAP_IGNORE( iPlaybackUtility->CommandL( EPbCmdClose ) ); |
|
427 TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) ); |
|
428 iPlaybackUtility->Close(); |
|
429 } |
|
430 |
|
431 if ( iViewUtility ) |
|
432 { |
|
433 iViewUtility->RemoveObserver( this ); |
|
434 iViewUtility->Close(); |
|
435 } |
|
436 delete iCommonUiHelper; |
|
437 |
|
438 if( iCollectionUiHelper ) |
|
439 { |
|
440 iCollectionUiHelper->Close(); |
|
441 } |
|
442 |
|
443 if ( iCollectionHelper ) |
|
444 { |
|
445 iCollectionHelper->Close(); |
|
446 } |
|
447 if( iHarvesterUtility ) |
|
448 { |
|
449 iHarvesterUtility->Close(); |
|
450 } |
|
451 |
|
452 delete iMediaKeyHandler; |
|
453 delete iSettingsRepository; |
|
454 iFile.Close(); |
|
455 iDeferredViewActivationUid.Close(); |
|
456 delete iSavePath; |
|
457 iRingToneMimeTypes.Reset(); |
|
458 |
|
459 delete iSaveHelper; |
|
460 #ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT |
|
461 delete iCameseDrmHandler; |
|
462 #endif |
|
463 |
|
464 #ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER |
|
465 delete iDocHandler; |
|
466 #endif //RD_RA_SUPPORT_FOR_MUSIC_PLAYER |
|
467 |
|
468 CleanUpdateParams(); |
|
469 |
|
470 MPX_DEBUG1( "<--CMPXAppUi::~CMPXAppUi()" ); |
|
471 } |
|
472 |
|
473 |
|
474 // --------------------------------------------------------------------------- |
|
475 // Querying whether the application is launched in embedded mode or not. |
|
476 // --------------------------------------------------------------------------- |
|
477 // |
|
478 TBool CMPXAppUi::IsEmbedded() const |
|
479 { |
|
480 return iEikonEnv->StartedAsServerApp(); |
|
481 } |
|
482 |
|
483 |
|
484 // --------------------------------------------------------------------------- |
|
485 // Opens temporary playlist or album from buffer. |
|
486 // --------------------------------------------------------------------------- |
|
487 // |
|
488 void CMPXAppUi::OpenPlaylistFromBufferL( |
|
489 const TDesC& aBuffer, |
|
490 TDesC& aName ) |
|
491 { |
|
492 MPX_FUNC( "CMPXAppUi::OpenPlaylistFromBufferL" ); |
|
493 TPtrC bufPtr( aBuffer ); |
|
494 TInt offset = 0; |
|
495 CMPXMediaArray* tracksArray = CMPXMediaArray::NewL(); |
|
496 CleanupStack::PushL( tracksArray ); |
|
497 |
|
498 while ( bufPtr.Length() > 0 ) |
|
499 { |
|
500 offset = bufPtr.Find( KMPXLineChange ); |
|
501 CMPXMedia* track = CMPXMedia::NewL(); |
|
502 CleanupStack::PushL( track ); |
|
503 track->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem); |
|
504 track->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong ); |
|
505 if ( offset == KErrNotFound ) |
|
506 { |
|
507 TParsePtrC fn( bufPtr ); |
|
508 track->SetTextValueL( KMPXMediaGeneralTitle, fn.Name() ); |
|
509 track->SetTextValueL( KMPXMediaGeneralUri, bufPtr ); |
|
510 // Set bufPtr to the end of buffer |
|
511 bufPtr.Set( bufPtr.Right( 0 ) ); //magic |
|
512 } |
|
513 else |
|
514 { |
|
515 TParsePtrC fn( bufPtr.Left( offset ) ); |
|
516 track->SetTextValueL( KMPXMediaGeneralTitle, fn.Name() ); |
|
517 track->SetTextValueL( KMPXMediaGeneralUri, fn.FullName() ); |
|
518 // Move past the line feed |
|
519 bufPtr.Set( bufPtr.Mid( ++offset ) ); |
|
520 } |
|
521 tracksArray->AppendL( track ); |
|
522 CleanupStack::Pop( track ); |
|
523 } |
|
524 |
|
525 CMPXMedia* media = CMPXMedia::NewL(); |
|
526 CleanupStack::PushL( media ); |
|
527 media->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem); |
|
528 media->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXPlaylist ); |
|
529 if ( aName.Length() > 0 ) |
|
530 { |
|
531 media->SetTObjectValueL( KMPXMediaGeneralTitle, aName ); |
|
532 } |
|
533 media->SetCObjectValueL( KMPXMediaArrayContents, tracksArray ); |
|
534 media->SetTObjectValueL( KMPXMediaArrayCount, tracksArray->Count() ); |
|
535 iCollectionUiHelper->OpenL( MPXTlsHelper::HostUid(), *media, |
|
536 this, EMPXCollectionPluginMusic ); |
|
537 CleanupStack::PopAndDestroy( media ); |
|
538 CleanupStack::PopAndDestroy( tracksArray ); |
|
539 } |
|
540 |
|
541 #ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER |
|
542 // ----------------------------------------------------------------------------- |
|
543 // CMPXAppUi::ForwardAiwParametersToMediaPlayer |
|
544 // ----------------------------------------------------------------------------- |
|
545 // |
|
546 CAiwGenericParamList* CMPXAppUi::CreateForwardAiwParametersLC( |
|
547 const CAiwGenericParamList* aParamList) const |
|
548 { |
|
549 MPX_FUNC( "CMPXAppUi::ForwardAiwParametersToMediaPlayerL" ); |
|
550 |
|
551 //Read parameters that were appended to the parameter list |
|
552 |
|
553 //Creates a new parameter list which will be forwarded to Media Player |
|
554 CAiwGenericParamList* newParamList = CAiwGenericParamList::NewLC(); |
|
555 |
|
556 if (aParamList) |
|
557 { |
|
558 TInt index = 0; |
|
559 |
|
560 //param contains the specific parameter being looked for in the parameter list |
|
561 //if found, append it again so it can be passed to Media Player |
|
562 |
|
563 //Move parameter |
|
564 const TAiwGenericParam* param = aParamList->FindFirst(index, |
|
565 EGenericParamAllowMove); |
|
566 if (param) |
|
567 { |
|
568 TBool allowMove(ETrue); |
|
569 TAiwVariant allowMoveVariant(allowMove); |
|
570 TAiwGenericParam genericParamAllowMove(EGenericParamAllowMove, |
|
571 allowMoveVariant); |
|
572 newParamList->AppendL(genericParamAllowMove); |
|
573 } |
|
574 |
|
575 index = 0; |
|
576 param = NULL; |
|
577 //Save parameter |
|
578 param = aParamList->FindFirst(index, EGenericParamAllowSave); |
|
579 if (param) |
|
580 { |
|
581 TBool allowSave(ETrue); |
|
582 TAiwVariant allowSaveVariant(allowSave); |
|
583 TAiwGenericParam genericParamAllowSave(EGenericParamAllowSave, |
|
584 allowSaveVariant); |
|
585 newParamList->AppendL(genericParamAllowSave); |
|
586 } |
|
587 |
|
588 index = 0; |
|
589 param = NULL; |
|
590 //Resolution parameter |
|
591 param = aParamList->FindFirst(index, EGenericParamResolution); |
|
592 if (param) |
|
593 { |
|
594 //For future use |
|
595 } |
|
596 |
|
597 index = 0; |
|
598 param = NULL; |
|
599 //File parameter |
|
600 param = aParamList->FindFirst(index, EGenericParamFile); |
|
601 if (param) |
|
602 { |
|
603 TDataType dataType( _L8("audio/x-pn-realaudio") ); |
|
604 TAiwVariant filename( _L8("c:\\system\\temp\\RtspTemp.ram") ); |
|
605 TAiwGenericParam param( EGenericParamFile, filename ); |
|
606 newParamList->AppendL( param ); |
|
607 } |
|
608 |
|
609 index = 0; |
|
610 param = NULL; |
|
611 //Access Point parameter |
|
612 param = aParamList->FindFirst(index, EGenericParamAccessPoint); |
|
613 if (param) |
|
614 { |
|
615 TInt32 value = 0; |
|
616 TInt32 ret = param->Value().Get(value); |
|
617 if (ret) |
|
618 { |
|
619 TAiwVariant accessPointVariant(value); |
|
620 TAiwGenericParam genericParamAccessPoint(EGenericParamAccessPoint, |
|
621 accessPointVariant); |
|
622 newParamList->AppendL(genericParamAccessPoint); |
|
623 } |
|
624 } |
|
625 } |
|
626 return newParamList; |
|
627 } |
|
628 #endif |
|
629 |
|
630 // --------------------------------------------------------------------------- |
|
631 // Opens the specified file in response to a corresponding message. |
|
632 // --------------------------------------------------------------------------- |
|
633 // |
|
634 void CMPXAppUi::OpenFileL( |
|
635 CFileStore*& /* aFileStore */, |
|
636 RFile& aFile, |
|
637 const CAiwGenericParamList* aParams ) |
|
638 { |
|
639 MPX_FUNC( "CMPXAppUi::OpenFileL" ); |
|
640 |
|
641 // Duplicate the file handle passed in before |
|
642 // creating the member variables. |
|
643 TFileName filename; |
|
644 aFile.FullName( filename ); |
|
645 iFile.Close(); |
|
646 iFile.Duplicate( aFile ); |
|
647 aFile.Close(); |
|
648 |
|
649 if ( IsEmbedded() ) |
|
650 { |
|
651 CreateMemberVariablesL(); |
|
652 iViewUtility->PreLoadViewL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid )); |
|
653 } |
|
654 |
|
655 #ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER |
|
656 // Get MIME type |
|
657 RApaLsSession apa; |
|
658 User::LeaveIfError( apa.Connect() ); |
|
659 CleanupClosePushL( apa ); |
|
660 TDataRecognitionResult result; |
|
661 User::LeaveIfError( apa.RecognizeData( iFile, result )); |
|
662 CleanupStack::PopAndDestroy( &apa ); |
|
663 |
|
664 TDataType dataType = TDataType( KDataTypeRAM() ); |
|
665 |
|
666 if ( result.iDataType == dataType ) |
|
667 { |
|
668 CAiwGenericParamList* paramList = CreateForwardAiwParametersLC(aParams); |
|
669 iDocHandler->OpenFileEmbeddedL(iFile, dataType, *paramList); |
|
670 CleanupStack::PopAndDestroy(paramList); |
|
671 iDocHandler->SetExitObserver(this); |
|
672 } |
|
673 else |
|
674 #endif //RD_RA_SUPPORT_FOR_MUSIC_PLAYER |
|
675 { |
|
676 // Open File with Collection Helper |
|
677 iCollectionUiHelper->OpenL( MPXTlsHelper::HostUid(), filename, |
|
678 this, EMPXCollectionPluginMusic ); |
|
679 } |
|
680 } |
|
681 |
|
682 |
|
683 // --------------------------------------------------------------------------- |
|
684 // CMPXAppUi::ActivatePhoneAppL |
|
685 // --------------------------------------------------------------------------- |
|
686 // |
|
687 void CMPXAppUi::ActivatePhoneAppL() |
|
688 { |
|
689 MPX_FUNC( "CMPXAppUi::ActivatePhoneAppL" ); |
|
690 TApaTaskList apaTaskList( CCoeEnv::Static()->WsSession() ); |
|
691 TApaTask apaTask = apaTaskList.FindApp( KPhoneAppUid ); |
|
692 if ( apaTask.Exists() ) |
|
693 { |
|
694 // Bring phone to foreground |
|
695 apaTask.BringToForeground(); |
|
696 } |
|
697 |
|
698 // Move Music Player to background |
|
699 // magic: -1 = force wg to background |
|
700 } |
|
701 |
|
702 // ---------------------------------------------------------------------------- |
|
703 // void CMPXAppUi::DeferredExitCallback |
|
704 // call back function for deferred exit. |
|
705 // ---------------------------------------------------------------------------- |
|
706 // |
|
707 TInt CMPXAppUi::DeferredExitCallback( TAny* aPtr ) |
|
708 { |
|
709 MPX_FUNC( "CMPXAppUi::DeferredExitCallback" ); |
|
710 CMPXAppUi* self = static_cast<CMPXAppUi*>( aPtr ); |
|
711 TRAP_IGNORE( self->HandleCommandL( EEikCmdExit ) ); |
|
712 return KErrNone; |
|
713 } |
|
714 |
|
715 // --------------------------------------------------------------------------- |
|
716 // Start a waitnote dialog |
|
717 // --------------------------------------------------------------------------- |
|
718 // |
|
719 void CMPXAppUi::StartWaitNoteL( TWaitNoteType aNoteType ) |
|
720 { |
|
721 CloseWaitNoteL(); |
|
722 TUid waitnoteId = TUid::Uid( KMPXPluginTypeWaitNoteDialogUid ); |
|
723 TPckg<TWaitNoteType> note = aNoteType; |
|
724 HBufC* arg = MPXUser::AllocL( note ); |
|
725 CleanupStack::PushL( arg ); |
|
726 iViewUtility->ActivateViewL( waitnoteId, arg ); |
|
727 CleanupStack::PopAndDestroy( arg ); |
|
728 } |
|
729 |
|
730 // --------------------------------------------------------------------------- |
|
731 // Close the waitnote dialog |
|
732 // --------------------------------------------------------------------------- |
|
733 // |
|
734 void CMPXAppUi::CloseWaitNoteL() |
|
735 { |
|
736 TUid waitnoteId = TUid::Uid( KMPXPluginTypeWaitNoteDialogUid ); |
|
737 TUid activeView = iViewUtility->ActiveViewType(); |
|
738 if( activeView == waitnoteId ) |
|
739 { |
|
740 CMPXViewPlugin* pi = |
|
741 iViewUtility->ViewPluginManager().PluginL( TUid::Uid(KWaitNoteImpUid) ); |
|
742 pi->DeactivateView(); |
|
743 } |
|
744 } |
|
745 |
|
746 // --------------------------------------------------------------------------- |
|
747 // From MMPXMediaKeyHandlerObserver. |
|
748 // Handle media key commands. |
|
749 // --------------------------------------------------------------------------- |
|
750 // |
|
751 void CMPXAppUi::HandleMediaKeyCommand( |
|
752 const TMPXPlaybackCommand aCommand, |
|
753 const TInt aData ) |
|
754 { |
|
755 MPX_FUNC( "CMPXAppUi::HandleMediaKeyCommand" ); |
|
756 |
|
757 switch ( aCommand ) |
|
758 { |
|
759 case EPbCmdSetVolume: |
|
760 { |
|
761 TRAP_IGNORE( |
|
762 TMPXPlaybackState playerState( EPbStateNotInitialised ); |
|
763 playerState = iPlaybackUtility->StateL(); |
|
764 if ( !MPXUser::IsCallOngoing( KMPXCallTypeGenericVoice ) || |
|
765 ( playerState == EPbStatePlaying ) || |
|
766 ( playerState == EPbStateSeekingForward ) || |
|
767 ( playerState == EPbStateSeekingBackward ) || |
|
768 iPdParameterHandler ) |
|
769 { |
|
770 TMPXPlaybackState pdPlayerState( EPbStateNotInitialised ); |
|
771 if ( iPdParameterHandler ) |
|
772 { |
|
773 pdPlayerState = iPdParameterHandler->PdStateL(); |
|
774 } |
|
775 |
|
776 // only process command if there no call ongoing |
|
777 // or if we're actively playing during call |
|
778 if ( IsForeground() || EPbStatePlaying == playerState || EPbStatePlaying == pdPlayerState ) |
|
779 { |
|
780 if ( aData != iCurrentVolume ) |
|
781 { |
|
782 SetVolumeL( aData ); |
|
783 } |
|
784 // popup volume control even if volume didn't change |
|
785 HandlePopupL( EPbCmdSetVolume ); |
|
786 } |
|
787 } |
|
788 ); |
|
789 break; |
|
790 } |
|
791 case EPbCmdMuteVolume: |
|
792 { |
|
793 TRAP_IGNORE( |
|
794 TMPXPlaybackState playerState( EPbStateNotInitialised ); |
|
795 playerState = iPlaybackUtility->StateL(); |
|
796 if ( !MPXUser::IsCallOngoing( KMPXCallTypeGenericVoice ) || |
|
797 ( playerState == EPbStatePlaying ) || |
|
798 ( playerState == EPbStateSeekingForward ) || |
|
799 ( playerState == EPbStateSeekingBackward ) || |
|
800 iPdParameterHandler ) |
|
801 { |
|
802 TMPXPlaybackState pdPlayerState( EPbStateNotInitialised ); |
|
803 if ( iPdParameterHandler ) |
|
804 { |
|
805 pdPlayerState = iPdParameterHandler->PdStateL(); |
|
806 } |
|
807 // only process command if there no call ongoing |
|
808 // or if we're actively playing during call |
|
809 if ( IsForeground() || EPbStatePlaying == playerState || EPbStatePlaying == pdPlayerState ) |
|
810 { |
|
811 MuteVolumeL(); |
|
812 HandlePopupL( EPbCmdMuteVolume ); |
|
813 } |
|
814 } |
|
815 ); |
|
816 break; |
|
817 } |
|
818 case EPbCmdUnMuteVolume: |
|
819 { |
|
820 TRAP_IGNORE( |
|
821 TMPXPlaybackState playerState( EPbStateNotInitialised ); |
|
822 playerState = iPlaybackUtility->StateL(); |
|
823 if ( !MPXUser::IsCallOngoing( KMPXCallTypeGenericVoice ) || |
|
824 ( playerState == EPbStatePlaying ) || |
|
825 ( playerState == EPbStateSeekingForward ) || |
|
826 ( playerState == EPbStateSeekingBackward ) || |
|
827 iPdParameterHandler ) |
|
828 { |
|
829 // only process command if there no call ongoing |
|
830 // or if we're actively playing during call |
|
831 TMPXPlaybackState pdPlayerState( EPbStateNotInitialised ); |
|
832 if ( iPdParameterHandler ) |
|
833 { |
|
834 pdPlayerState = iPdParameterHandler->PdStateL(); |
|
835 } |
|
836 if ( IsForeground() || EPbStatePlaying == playerState || EPbStatePlaying == pdPlayerState ) |
|
837 { |
|
838 UnMuteVolumeL(); |
|
839 HandlePopupL( EPbCmdUnMuteVolume ); |
|
840 } |
|
841 } |
|
842 ); |
|
843 break; |
|
844 } |
|
845 default: |
|
846 { |
|
847 // Dispatches all other commands |
|
848 |
|
849 TBool foregroundApp( IsForeground() ); |
|
850 if ( !IsDisplayingMenuOrDialog() && foregroundApp ) |
|
851 { |
|
852 // Forward the command to view to handle when |
|
853 // music is foreground app and not displaying |
|
854 // dialogs or the options menu |
|
855 if ( iView ) |
|
856 { |
|
857 MPX_TRAPD( err, iView->HandleCommandL( MPXCmdForPbCmd(aCommand) ) ); |
|
858 MPX_DEBUG3( "CMPXAppUi::HandleMediaKeyCommand sending command %d to view err%d", MPXCmdForPbCmd(aCommand), err ); |
|
859 } |
|
860 } |
|
861 else |
|
862 { |
|
863 TMPXPlaybackState playerState( EPbStateNotInitialised ); |
|
864 MPX_TRAPD( err, playerState = iPlaybackUtility->StateL() ); |
|
865 if ( foregroundApp && IsDisplayingDialog() ) |
|
866 { |
|
867 // displaying dialog in the foreground |
|
868 if ( EPbStatePlaying == playerState || |
|
869 EPbStatePaused == playerState || |
|
870 EPbStateSeekingForward == playerState || |
|
871 EPbStateSeekingBackward == playerState || |
|
872 aCommand == EPbCmdPlay || |
|
873 aCommand == EPbCmdPlayPause ) |
|
874 { |
|
875 // In playing/paused state, all media keys are active. |
|
876 // Now playing view is not bring to foreground. |
|
877 // Seeking forward/backwards is also "playing" |
|
878 MPX_TRAP( err, DoHandleMediaKeyCommandL( aCommand ) ); |
|
879 MPX_DEBUG3( "CMPXAppUi::HandleMediaKeyCommand Dialog displaying, sending command %d to DoHandleMediaKeyCommandL err%d", aCommand, err ); |
|
880 } |
|
881 else |
|
882 { |
|
883 MPX_DEBUG3( "CMPXAppUi::HandleMediaKeyCommand Dialog displaying, inactive state, command %d, err%d ignored", aCommand , err ); |
|
884 } |
|
885 } |
|
886 else |
|
887 { |
|
888 // displaying menu/not foreground, pass to view to handle only play command |
|
889 if ( EPbStatePlaying == playerState || |
|
890 EPbStatePaused == playerState || |
|
891 EPbStateSeekingForward == playerState || |
|
892 EPbStateSeekingBackward == playerState ) |
|
893 { |
|
894 MPX_TRAP( err, DoHandleMediaKeyCommandL( aCommand ) ); |
|
895 MPX_DEBUG3( "CMPXAppUi::HandleMediaKeyCommand Menu displaying/not foreground, sending command %d to DoHandleMediaKeyCommandL err%d", aCommand, err ); |
|
896 } |
|
897 else if ( ( aCommand == EPbCmdPlay || aCommand == EPbCmdPlayPause ) && iView ) |
|
898 { |
|
899 if ( !foregroundApp ) |
|
900 { |
|
901 // not foreground, play without loading playback view |
|
902 MPX_TRAP( err, DoHandleMediaKeyCommandL( aCommand ) ); |
|
903 MPX_DEBUG3( "CMPXAppUi::HandleMediaKeyCommand Menu displaying/not foreground, active idle foreground, sending command %d to DoHandleMediaKeyCommandL err%d", aCommand, err ); |
|
904 } |
|
905 else |
|
906 { |
|
907 MPX_TRAP( err, iView->HandleCommandL( MPXCmdForPbCmd(aCommand) ) ); |
|
908 MPX_DEBUG3( "CMPXAppUi::HandleMediaKeyCommand Menu displaying/not foreground, sending command %d to view err%d", aCommand, err ); |
|
909 } |
|
910 } |
|
911 else if ( aCommand == EPbCmdPlay || aCommand == EPbCmdPlayPause ) |
|
912 { |
|
913 // play command without a view, this case |
|
914 // happens when music player is started in starter |
|
915 // and has not been activated yet |
|
916 // if music player gets this event, that means embedded mode |
|
917 // is not active. safe to just use TApaTask to switch task |
|
918 // bring music player to foreground in this case |
|
919 TApaTaskList tasList( CEikonEnv::Static()->WsSession() ); |
|
920 TApaTask task = |
|
921 tasList.FindApp( KAppUidMusicPlayerX ); |
|
922 if ( task.Exists() ) |
|
923 { |
|
924 task.BringToForeground(); |
|
925 } |
|
926 } |
|
927 else |
|
928 { |
|
929 MPX_DEBUG2( "CMPXAppUi::HandleMediaKeyCommand Menu displaying/not foreground, inactive state, command %d ignored", aCommand ); |
|
930 } |
|
931 } |
|
932 } |
|
933 break; |
|
934 } |
|
935 } |
|
936 } |
|
937 |
|
938 // --------------------------------------------------------------------------- |
|
939 // Additional handling of media key commands. |
|
940 // Determine if the command will be passed to the playback engine. |
|
941 // --------------------------------------------------------------------------- |
|
942 // |
|
943 void CMPXAppUi::DoHandleMediaKeyCommandL( |
|
944 TMPXPlaybackCommand aCommand ) |
|
945 { |
|
946 MPX_FUNC( "CMPXAppUi::DoHandleMediaKeyCommandL" ); |
|
947 |
|
948 TBool handleCommand(EFalse); |
|
949 TMPXPlaybackState playerState( iPlaybackUtility->StateL() ); |
|
950 |
|
951 MMPXSource* source( iPlaybackUtility->Source() ); |
|
952 switch ( aCommand ) |
|
953 { |
|
954 case EPbCmdPlay: |
|
955 case EPbCmdPause: |
|
956 case EPbCmdPlayPause: |
|
957 { |
|
958 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
959 if ( source || iPdParameterHandler ) |
|
960 #else |
|
961 if ( source ) |
|
962 #endif |
|
963 { |
|
964 handleCommand = ETrue; |
|
965 } |
|
966 break; |
|
967 } |
|
968 case EPbCmdStop: |
|
969 { |
|
970 handleCommand = ETrue; |
|
971 break; |
|
972 } |
|
973 case EPbCmdNext: |
|
974 { |
|
975 // TODO: Invalid if in progressive download mode?? |
|
976 |
|
977 // ignore next key in stopped mode, except when |
|
978 // the foreground is playbackview |
|
979 if (( EPbStateStopped != playerState || |
|
980 KMPXPluginTypePlaybackUid == iCurrentViewType.iUid || |
|
981 KMPXPluginTypeEmbeddedPlaybackUid == iCurrentViewType.iUid ) && |
|
982 source ) |
|
983 { |
|
984 handleCommand = ETrue; |
|
985 } |
|
986 break; |
|
987 } |
|
988 case EPbCmdPrevious: |
|
989 { |
|
990 // TODO: Invalid if in progressive download mode?? |
|
991 |
|
992 // ignore previous key in stopped mode, except when |
|
993 // the foreground is playbackview |
|
994 if (( EPbStateStopped != playerState || |
|
995 KMPXPluginTypePlaybackUid == iCurrentViewType.iUid || |
|
996 KMPXPluginTypeEmbeddedPlaybackUid == iCurrentViewType.iUid) && |
|
997 source ) |
|
998 { |
|
999 handleCommand = ETrue; |
|
1000 } |
|
1001 break; |
|
1002 } |
|
1003 case EPbCmdStartSeekForward: |
|
1004 { |
|
1005 // TODO: Invalid if in progressive download mode?? |
|
1006 if (( EPbStatePlaying == playerState || |
|
1007 EPbStatePaused == playerState || |
|
1008 EPbStateSeekingBackward == playerState ) && |
|
1009 source ) |
|
1010 { |
|
1011 handleCommand = ETrue; |
|
1012 } |
|
1013 break; |
|
1014 } |
|
1015 case EPbCmdStartSeekBackward: |
|
1016 { |
|
1017 // TODO: Invalid if in progressive download mode?? |
|
1018 if (( EPbStatePlaying == playerState || |
|
1019 EPbStatePaused == playerState || |
|
1020 EPbStateSeekingForward == playerState ) && |
|
1021 source ) |
|
1022 { |
|
1023 handleCommand = ETrue; |
|
1024 } |
|
1025 break; |
|
1026 } |
|
1027 case EPbCmdStopSeeking: |
|
1028 { |
|
1029 if (( EPbStateSeekingForward == playerState || |
|
1030 EPbStateSeekingBackward == playerState ) && |
|
1031 source ) |
|
1032 { |
|
1033 handleCommand = ETrue; |
|
1034 } |
|
1035 break; |
|
1036 } |
|
1037 default: |
|
1038 { |
|
1039 // Do nothing |
|
1040 break; |
|
1041 } |
|
1042 } |
|
1043 |
|
1044 if ( handleCommand ) |
|
1045 { |
|
1046 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
1047 |
|
1048 if (iPdParameterHandler) |
|
1049 { |
|
1050 iPdParameterHandler->HandleCommandL( aCommand ); |
|
1051 } |
|
1052 else |
|
1053 { |
|
1054 iPlaybackUtility->CommandL( aCommand ); |
|
1055 } |
|
1056 #else |
|
1057 iPlaybackUtility->CommandL( aCommand ); |
|
1058 #endif |
|
1059 // Control popup behaviour |
|
1060 HandlePopupL( aCommand ); |
|
1061 } |
|
1062 } |
|
1063 |
|
1064 // ----------------------------------------------------------------------------- |
|
1065 // Control popup behaviour. |
|
1066 // ----------------------------------------------------------------------------- |
|
1067 // |
|
1068 void CMPXAppUi::HandlePopupL( |
|
1069 TMPXPlaybackCommand aCommand ) |
|
1070 { |
|
1071 MPX_FUNC( "CMPXAppUi::HandlePopupL" ); |
|
1072 TBool showPlaybackPopup( ETrue ); |
|
1073 TBool showVolumePopup( ETrue ); |
|
1074 |
|
1075 if ( IsForeground() ) |
|
1076 { |
|
1077 switch ( iCurrentViewType.iUid ) |
|
1078 { |
|
1079 case KMPXPluginTypePlaybackUid: |
|
1080 case KMPXPluginTypeEmbeddedPlaybackUid: |
|
1081 case KMPXPluginTypeMainUid: |
|
1082 { |
|
1083 // do not show playback popup in these views |
|
1084 MPX_DEBUG2( "CMPXAppUi::HandlePopupL active view type is 0x%x, not showing popup", iCurrentViewType.iUid ); |
|
1085 showPlaybackPopup = EFalse; |
|
1086 break; |
|
1087 } |
|
1088 default: |
|
1089 { |
|
1090 MPX_DEBUG2( "CMPXAppUi::HandlePopupL active view type is 0x%x, showing popup", iCurrentViewType.iUid ); |
|
1091 break; |
|
1092 } |
|
1093 } |
|
1094 } |
|
1095 else if ( !IsForeground() && IsActiveIdleEnabled() && IsIdleAppForeground() ) |
|
1096 { |
|
1097 showPlaybackPopup = EFalse; |
|
1098 } |
|
1099 |
|
1100 if ( !IsForeground()) |
|
1101 { |
|
1102 if ( IsActiveIdleEnabled() && IsIdleAppForeground() ) |
|
1103 { |
|
1104 showVolumePopup = ETrue; |
|
1105 } |
|
1106 else |
|
1107 { |
|
1108 showVolumePopup = EFalse; |
|
1109 } |
|
1110 } |
|
1111 |
|
1112 switch ( aCommand ) |
|
1113 { |
|
1114 case EPbCmdStop: |
|
1115 { |
|
1116 iMediaKeyHandler->DismissNotifier( EDisplayMediaPopup ); |
|
1117 break; |
|
1118 } |
|
1119 case EPbCmdPrevious: |
|
1120 case EPbCmdNext: |
|
1121 { |
|
1122 if ( showPlaybackPopup ) |
|
1123 { |
|
1124 // skip backwards should start timer right away |
|
1125 // because it'll not receive events to trigger the timer |
|
1126 // if skipping multiple songs, the timer will be reset |
|
1127 // everytime it reaches a song |
|
1128 |
|
1129 // skip fowards should also start timer right away |
|
1130 // becuase if it's the last song, there won't be any events |
|
1131 // to trigger the timer |
|
1132 iMediaKeyHandler->ShowPlaybackPopupL( EMPXPopupTimeout ); |
|
1133 } |
|
1134 break; |
|
1135 } |
|
1136 case EPbCmdPlay: |
|
1137 case EPbCmdPause: |
|
1138 case EPbCmdPlayPause: |
|
1139 case EPbCmdStartSeekForward: |
|
1140 case EPbCmdStartSeekBackward: |
|
1141 { |
|
1142 if ( showPlaybackPopup ) |
|
1143 { |
|
1144 iMediaKeyHandler->ShowPlaybackPopupL( EMPXPopupNoTimeout ); |
|
1145 } |
|
1146 break; |
|
1147 } |
|
1148 case EPbCmdStopSeeking: |
|
1149 { |
|
1150 if ( showPlaybackPopup ) |
|
1151 { |
|
1152 iMediaKeyHandler->ShowPlaybackPopupL( EMPXPopupTimeout ); |
|
1153 } |
|
1154 break; |
|
1155 } |
|
1156 case EPbCmdSetVolume: |
|
1157 case EPbCmdMuteVolume: |
|
1158 case EPbCmdUnMuteVolume: |
|
1159 { |
|
1160 if ( showVolumePopup && iMediaKeyHandler) |
|
1161 { |
|
1162 // display pop up volume control |
|
1163 iMediaKeyHandler->ShowVolumePopupL(); |
|
1164 } |
|
1165 break; |
|
1166 } |
|
1167 default: |
|
1168 { |
|
1169 // Do nothing |
|
1170 break; |
|
1171 } |
|
1172 } |
|
1173 } |
|
1174 |
|
1175 // ----------------------------------------------------------------------------- |
|
1176 // Check if Active Idle app is on foreground |
|
1177 // ----------------------------------------------------------------------------- |
|
1178 // |
|
1179 TBool CMPXAppUi::IsIdleAppForeground() |
|
1180 { |
|
1181 MPX_FUNC( "CMPXAppUi::IsIdleAppForeground" ); |
|
1182 TBool isIdleActive( EFalse ); |
|
1183 // Gets the window group id of the app in foreground |
|
1184 RWsSession& wsSession = CCoeEnv::Static()->WsSession(); |
|
1185 TInt windowGroupId = wsSession.GetFocusWindowGroup(); |
|
1186 if ( windowGroupId >= 0 ) |
|
1187 { |
|
1188 TRAP_IGNORE( |
|
1189 { |
|
1190 CApaWindowGroupName* wgName = CApaWindowGroupName::NewL( |
|
1191 wsSession, windowGroupId ); |
|
1192 |
|
1193 isIdleActive = ( wgName->AppUid() == KMPXUidIdleApp ); |
|
1194 delete wgName; |
|
1195 } ); |
|
1196 } |
|
1197 |
|
1198 return isIdleActive; |
|
1199 } |
|
1200 |
|
1201 // ----------------------------------------------------------------------------- |
|
1202 // Check if Active Idle is enabled |
|
1203 // ----------------------------------------------------------------------------- |
|
1204 // |
|
1205 TBool CMPXAppUi::IsActiveIdleEnabled() |
|
1206 { |
|
1207 MPX_FUNC( "CMPXAppUi::IsActiveIdleEnabled" ); |
|
1208 TBool res( EFalse ); |
|
1209 |
|
1210 #ifdef __ACTIVE_IDLE |
|
1211 if (! FeatureManager::FeatureSupported( KFeatureIdActiveIdle ) ) |
|
1212 return EFalse; |
|
1213 #endif |
|
1214 if ( !iSettingsRepository ) |
|
1215 { |
|
1216 TRAP_IGNORE( |
|
1217 { |
|
1218 iSettingsRepository = CRepository::NewL( |
|
1219 KCRUidPersonalizationSettings ); |
|
1220 } ); |
|
1221 } |
|
1222 |
|
1223 if ( iSettingsRepository ) |
|
1224 { |
|
1225 TInt value( 0 ); |
|
1226 TInt err( iSettingsRepository->Get( KSettingsActiveIdleState, value ) ); |
|
1227 if ( !err && value ) |
|
1228 { |
|
1229 res = ETrue; |
|
1230 } |
|
1231 } |
|
1232 return res; |
|
1233 } |
|
1234 |
|
1235 // --------------------------------------------------------------------------- |
|
1236 // Creates and initializes all member variables |
|
1237 // --------------------------------------------------------------------------- |
|
1238 // |
|
1239 void CMPXAppUi::CreateMemberVariablesL() |
|
1240 { |
|
1241 MPX_FUNC("CMPXAppUi::CreateMemberVariablesL()"); |
|
1242 |
|
1243 TUid playbackMode( KAppUidMusicPlayerX ); |
|
1244 TUid collectionMode( KAppUidMusicPlayerX ); |
|
1245 if ( IsEmbedded() ) |
|
1246 { |
|
1247 playbackMode = KPbModeNewPlayer; |
|
1248 collectionMode = MPXTlsHelper::HostUid(); // Collection context == host UID |
|
1249 } |
|
1250 |
|
1251 if ( !iCollectionUtility ) |
|
1252 { |
|
1253 iCollectionUtility = MMPXCollectionUtility::NewL( this, collectionMode ); |
|
1254 } |
|
1255 |
|
1256 // Get an instance of view utility |
|
1257 if ( !iViewUtility ) |
|
1258 { |
|
1259 iViewUtility = MMPXViewUtility::UtilityL(); |
|
1260 iViewUtility->AddObserverL( this ); |
|
1261 iViewUtility->ConstructDefaultViewHistoryL(); |
|
1262 } |
|
1263 |
|
1264 if ( !iCollectionUiHelper ) |
|
1265 { |
|
1266 iCollectionUiHelper = CMPXCollectionHelperFactory:: NewCollectionUiHelperL(); |
|
1267 } |
|
1268 |
|
1269 // Create a new playback utility instance |
|
1270 if ( !iPlaybackUtility ) |
|
1271 { |
|
1272 iPlaybackUtility = MMPXPlaybackUtility::UtilityL( playbackMode ); |
|
1273 iPlaybackUtility->AddObserverL( *this ); |
|
1274 |
|
1275 // get the current Volume and Max Volume |
|
1276 iPlaybackUtility->PropertyL(*this, EPbPropertyVolume); |
|
1277 iPlaybackUtility->PropertyL(*this, EPbPropertyMaxVolume); |
|
1278 if( !IsEmbedded() ) |
|
1279 { |
|
1280 TInt randomMode = 0; |
|
1281 TInt repeatMode = 0; |
|
1282 |
|
1283 CRepository* repository = CRepository::NewL( KCRUidMPXMPSettings ); |
|
1284 repository->Get( KMPXMPPlaybackRandomMode, randomMode ); |
|
1285 repository->Get( KMPXMPPlaybackRepeatMode, repeatMode ); |
|
1286 delete repository; |
|
1287 repository = NULL; |
|
1288 |
|
1289 MPX_DEBUG3("CMPXAppUi::CreateMemberVariablesL() randomMode(%d), repeatMode(%d)", randomMode, repeatMode); |
|
1290 |
|
1291 iPlaybackUtility->SetL( EPbPropertyRandomMode, randomMode ); |
|
1292 iPlaybackUtility->SetL( EPbPropertyRepeatMode, repeatMode ); |
|
1293 } |
|
1294 } |
|
1295 |
|
1296 if ( !iMediaKeyHandler ) |
|
1297 { |
|
1298 // Handle media key in appui |
|
1299 iMediaKeyHandler = MMPXMediaKeyHandler::NewL( |
|
1300 EDisplayVolumePopup | EDisplayMediaPopup, |
|
1301 this ); |
|
1302 } |
|
1303 |
|
1304 if( !IsEmbedded() ) |
|
1305 { |
|
1306 iPathRestore = CMPXRestorePath::NewL( iPlaybackUtility, |
|
1307 iCollectionUiHelper ); |
|
1308 |
|
1309 // Fetch the music collection UID |
|
1310 RArray<TUid> uid; |
|
1311 CleanupClosePushL( uid ); |
|
1312 uid.AppendL( TUid::Uid(EMPXCollectionPluginMusic) ); |
|
1313 iMusicCollectionId = iCollectionUtility->CollectionIDL( uid.Array() ); |
|
1314 |
|
1315 // Fetch the podcast collection UID |
|
1316 if( !iDisablePodcasting ) |
|
1317 { |
|
1318 uid.Reset(); |
|
1319 uid.AppendL( TUid::Uid(EMPXCollectionPluginPodCast) ); |
|
1320 iPodcastCollectionId = iCollectionUtility->CollectionIDL( uid.Array() );; |
|
1321 } |
|
1322 |
|
1323 CleanupStack::PopAndDestroy( &uid ); |
|
1324 } |
|
1325 #ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT |
|
1326 // In case Camese Superdistribution is enabled, |
|
1327 // we just need to initialize the Camese Drm Handler |
|
1328 // object. It will act as a collection utility |
|
1329 // observer and will handle WMDRM protected content |
|
1330 // in lieu of the AppUi. |
|
1331 if ( !iCameseDrmHandler ) |
|
1332 { |
|
1333 iCameseDrmHandler = CCameseDrmHandler::NewL(iFile); |
|
1334 } |
|
1335 #endif |
|
1336 |
|
1337 #ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER |
|
1338 if( !iDocHandler ) |
|
1339 { |
|
1340 iDocHandler = CDocumentHandler::NewL(iEikonEnv->Process()); |
|
1341 } |
|
1342 #endif //RD_RA_SUPPORT_FOR_MUSIC_PLAYER |
|
1343 } |
|
1344 |
|
1345 // --------------------------------------------------------------------------- |
|
1346 // Save file |
|
1347 // --------------------------------------------------------------------------- |
|
1348 // |
|
1349 void CMPXAppUi::DoSaveL() |
|
1350 { |
|
1351 MPX_DEBUG1("CMPXAppUi::DoSaveL(): entering"); |
|
1352 ASSERT( iFile.SubSessionHandle() ); |
|
1353 |
|
1354 // Get target path |
|
1355 TFileName newFile; |
|
1356 CreateAutomaticSavePathL( newFile ); |
|
1357 delete iSavePath; |
|
1358 iSavePath = NULL; |
|
1359 iSavePath = newFile.AllocL(); |
|
1360 |
|
1361 // display waiting note |
|
1362 TParsePtrC fileParse( newFile ); |
|
1363 HBufC* string( StringLoader::LoadLC( R_MPX_SAVE_ONE_ITEM_WAIT_NOTE, |
|
1364 fileParse.Name() )); |
|
1365 // Cover UI start |
|
1366 //#ifdef __COVER_DISPLAY |
|
1367 if ( iCommandInitiator ) |
|
1368 { |
|
1369 HBufC8* filename8 = HBufC8::NewLC( KMaxFileName ); |
|
1370 filename8->Des().Copy( fileParse.Name() ); |
|
1371 TPtrC name(KNullDesC); |
|
1372 name.Set( fileParse.Name() ); |
|
1373 HBufC8* data = HBufC8::NewLC(KMaxFileName); |
|
1374 |
|
1375 TPtr8 dataPtr = data->Des(); |
|
1376 RDesWriteStream str(dataPtr); |
|
1377 |
|
1378 TPtrC8 b(KNullDesC8); |
|
1379 b.Set(*filename8); |
|
1380 |
|
1381 str << b; |
|
1382 str.CommitL(); |
|
1383 |
|
1384 iCommandInitiator->IssueCommand( KMediatorSecondaryDisplayDomain, |
|
1385 KMPlayerNoteCategory, |
|
1386 EMPlayerNoteSaveOneItem, |
|
1387 TVersion (0,0,0), |
|
1388 *data ); |
|
1389 CleanupStack::PopAndDestroy(2); |
|
1390 } |
|
1391 //#endif // __COVER_DISPLAY |
|
1392 // Cover UI end |
|
1393 |
|
1394 iCommonUiHelper->ShowWaitNoteL( |
|
1395 *string, |
|
1396 R_AVKON_SOFTKEYS_EMPTY, |
|
1397 EFalse, |
|
1398 this ); |
|
1399 CleanupStack::PopAndDestroy( string ); |
|
1400 |
|
1401 TMPXLaunchMode mode( MPXTlsHelper::LaunchMode() ); |
|
1402 iPausedForSave = EFalse; |
|
1403 if ( EMPXLaunchModeTrack == mode ) |
|
1404 { |
|
1405 // Close the file in playback engine |
|
1406 iPlaybackUtility->CommandL( EPbCmdPreservePosition ); |
|
1407 iPlaybackUtility->CommandL( EPbCmdPreserveState ); |
|
1408 iPlaybackUtility->CommandL( EPbCmdClose ); |
|
1409 } |
|
1410 else |
|
1411 { |
|
1412 if ( EPbStatePlaying == iPlaybackUtility->StateL() ) |
|
1413 { |
|
1414 iPlaybackUtility->CommandL( EPbCmdPause ); |
|
1415 iPausedForSave = ETrue; |
|
1416 } |
|
1417 } |
|
1418 |
|
1419 // Check disk space |
|
1420 TBool allowMove( MPXTlsHelper::AllowMove() ); |
|
1421 #ifdef RD_MULTIPLE_DRIVE |
|
1422 // Only need to check if on phone memory. All other drives were |
|
1423 // checked while creating the automatic save path |
|
1424 if( fileParse.Drive().CompareF( PathInfo::PhoneMemoryRootPath().Left(2) ) == 0 ) |
|
1425 #else |
|
1426 // Do not need to check if on memory card as that was already done |
|
1427 if( fileParse.Drive().CompareF( PathInfo::MemoryCardRootPath().Left(2) ) != 0 ) |
|
1428 #endif // RD_MULTIPLE_DRIVE |
|
1429 { |
|
1430 // If a file is being moved then there is no need to check for |
|
1431 // available space, as moving the file doesn't increase space consumption |
|
1432 // Check is still needed if a file is being copied |
|
1433 RFs& fs( iEikonEnv->FsSession() ); |
|
1434 TInt size( 0 ); |
|
1435 iFile.Size( size ); |
|
1436 if ( !allowMove ) |
|
1437 { |
|
1438 if ( SysUtil::FFSSpaceBelowCriticalLevelL( &fs, size ) ) |
|
1439 { |
|
1440 iCommonUiHelper->DismissWaitNoteL(); |
|
1441 User::Leave( KErrDiskFull ); // Phone memory full, Avkon shows note |
|
1442 } |
|
1443 } |
|
1444 } |
|
1445 |
|
1446 // Create save helper if not created |
|
1447 if ( !iSaveHelper ) |
|
1448 { |
|
1449 iSaveHelper = CMPXSaveHelper::NewL( this, this ); |
|
1450 } |
|
1451 |
|
1452 // s60 change. playlist could be opened from messaging app. |
|
1453 // in the case we don't want to copy in async mode |
|
1454 if (( EMPXLaunchModeTrack != MPXTlsHelper::LaunchMode() ) |
|
1455 && (!iCommonUiHelper->IsHostMessagingL())) |
|
1456 { |
|
1457 iSaveHelper->StartCopyOperationL( iFile, newFile, allowMove ); |
|
1458 iFile.Close(); |
|
1459 } |
|
1460 else |
|
1461 { |
|
1462 if ( iCommonUiHelper->IsHostMessagingL() ) |
|
1463 { |
|
1464 // save ringtone. We need to do sync call to save file because |
|
1465 // the asyc calls doesn't guarantee the file is copied completely. |
|
1466 // This is deal with a situation when set ringtone from messaging app |
|
1467 // that the ringtone files are kept in proviate directory. |
|
1468 iSaveHelper->StartCopyOperationL( iFile, newFile, EFalse, ETrue ); |
|
1469 } |
|
1470 else |
|
1471 { |
|
1472 iSaveHelper->StartCopyOperationL( iFile, newFile, allowMove ); |
|
1473 iFile.Close(); |
|
1474 } |
|
1475 } |
|
1476 |
|
1477 MPX_DEBUG1("CMPXAppUi::DoSaveL(): exiting"); |
|
1478 } |
|
1479 |
|
1480 // ----------------------------------------------------------------------------- |
|
1481 // CreateAutomaticSavePathL |
|
1482 // ----------------------------------------------------------------------------- |
|
1483 // |
|
1484 void CMPXAppUi::CreateAutomaticSavePathL( TFileName& aNewPath ) |
|
1485 { |
|
1486 MPX_DEBUG1("CMPXAppUi::CreateAutomaticSavePathL(): entering"); |
|
1487 |
|
1488 RFs& fs( iEikonEnv->FsSession() ); |
|
1489 TFileName fileName; |
|
1490 iFile.FullName( fileName ); |
|
1491 TParsePtrC fileParse( fileName ); |
|
1492 |
|
1493 // Get the size and check if there's enough room to store |
|
1494 TInt size( 0 ); |
|
1495 User::LeaveIfError( iFile.Size( size )); |
|
1496 |
|
1497 #ifdef RD_MULTIPLE_DRIVE |
|
1498 // Get the next available drive (internal mass store, MMC or phone memory) |
|
1499 HBufC* defaultRootPath( iCommonUiHelper->AvailableDriveLC( size ) ); |
|
1500 aNewPath = *defaultRootPath; |
|
1501 CleanupStack::PopAndDestroy( defaultRootPath ); |
|
1502 #else |
|
1503 HBufC* defaultRootPath( iCommonUiHelper->DefaultDriveLC() ); |
|
1504 aNewPath = *defaultRootPath; |
|
1505 CleanupStack::PopAndDestroy( defaultRootPath ); |
|
1506 if ( aNewPath.CompareF( PathInfo::MemoryCardRootPath()) == 0 ) |
|
1507 { |
|
1508 // only if memory card is supported, check if there is enough space |
|
1509 // on the card. |
|
1510 TBool isBelowCritical( EFalse ); |
|
1511 TRAPD( err, isBelowCritical = |
|
1512 SysUtil::MMCSpaceBelowCriticalLevelL( &fs, size )); |
|
1513 if ( err || isBelowCritical ) |
|
1514 { |
|
1515 aNewPath = PathInfo::PhoneMemoryRootPath(); |
|
1516 } |
|
1517 } |
|
1518 #endif // RD_MULTIPLE_DRIVE |
|
1519 |
|
1520 TInt pathResId( KErrNotFound ); |
|
1521 |
|
1522 // Get MIME type to see if it's a ringtone |
|
1523 RApaLsSession apa; |
|
1524 User::LeaveIfError( apa.Connect() ); |
|
1525 CleanupClosePushL( apa ); |
|
1526 TDataRecognitionResult result; |
|
1527 User::LeaveIfError( apa.RecognizeData( iFile, result )); |
|
1528 CleanupStack::PopAndDestroy( &apa ); |
|
1529 TPtrC resultPtr( result.iDataType.Des() ); |
|
1530 TInt val( 0 ); |
|
1531 if ( iRingToneMimeTypes.Find( resultPtr, val ) == 0 ) |
|
1532 { |
|
1533 pathResId = R_MPX_TARGETFOLDER_RINGTONES; |
|
1534 } |
|
1535 else if ( iCommonUiHelper->IsHostMessagingL() ) |
|
1536 { |
|
1537 pathResId = R_MPX_TARGETFOLDER_ATTACHMENT; |
|
1538 } |
|
1539 else |
|
1540 { |
|
1541 pathResId = R_MPX_TARGETFOLDER_DOWNLOADS; |
|
1542 } |
|
1543 |
|
1544 HBufC* defaultPath( StringLoader::LoadLC( pathResId )); |
|
1545 aNewPath += *defaultPath; |
|
1546 aNewPath += fileParse.NameAndExt(); |
|
1547 CleanupStack::PopAndDestroy( defaultPath ); |
|
1548 |
|
1549 if ( !ConeUtils::FileExists( aNewPath ) ) |
|
1550 { |
|
1551 User::LeaveIfError( |
|
1552 Application()->GenerateFileName( fs, aNewPath )); |
|
1553 } |
|
1554 else if ( iCommonUiHelper->IsHostMessagingL() ) |
|
1555 { |
|
1556 MPXTlsHelper::SetNeedSave( EFalse ); |
|
1557 } |
|
1558 |
|
1559 MPX_DEBUG1("CMPXAppUi::CreateAutomaticSavePathL(): exiting"); |
|
1560 } |
|
1561 |
|
1562 // ----------------------------------------------------------------------------- |
|
1563 // HandlePostSaveOperationL |
|
1564 // ----------------------------------------------------------------------------- |
|
1565 // |
|
1566 void CMPXAppUi::HandlePostSaveOperationL() |
|
1567 { |
|
1568 MPX_DEBUG1("CMPXAppUi::HandlePostSaveOperationL(): entering"); |
|
1569 |
|
1570 if ( iSaveMode == EMPXExitAppAfterSave ) |
|
1571 { |
|
1572 MPX_DEBUG1( "CMPXAppUi::HandlePostSaveOperationL() exit after save" ); |
|
1573 iSaveMode = EMPXSaveModeIdle; |
|
1574 iFile.Close(); |
|
1575 RunAppShutter(); |
|
1576 } |
|
1577 else if ( iSaveMode == EMPXExitHostAppAfterSave ) |
|
1578 { |
|
1579 MPX_DEBUG1( "CMPXAppUi::HandlePostSaveOperationL() exit host app after save" ); |
|
1580 iSaveMode = EMPXSaveModeIdle; |
|
1581 iFile.Close(); |
|
1582 CAknEnv::RunAppShutter(); |
|
1583 } |
|
1584 else |
|
1585 { |
|
1586 MPX_DEBUG1( "CMPXAppUi::HandlePostSaveOperationL() reopen" ); |
|
1587 if ( EMPXLaunchModeTrack == MPXTlsHelper::LaunchMode() ) |
|
1588 { |
|
1589 if ( iSavePath ) |
|
1590 { |
|
1591 iCollectionUiHelper->OpenL( MPXTlsHelper::HostUid(), |
|
1592 *iSavePath, |
|
1593 this, |
|
1594 EMPXCollectionPluginMusic ); |
|
1595 delete iSavePath; |
|
1596 iSavePath = NULL; |
|
1597 // User may set ringtone or contact more than once so don't close it after save. |
|
1598 // The iFile.Close will be called at destructor. It is safe because we are |
|
1599 // in Embedded mode. |
|
1600 if ( EMPXLaunchModeTrack != MPXTlsHelper::LaunchMode() ) |
|
1601 { |
|
1602 iFile.Close(); |
|
1603 } |
|
1604 } |
|
1605 else |
|
1606 { |
|
1607 if ( iFile.SubSessionHandle() ) |
|
1608 { |
|
1609 TFileName filename; |
|
1610 iFile.FullName( filename ); |
|
1611 iCollectionUiHelper->OpenL( MPXTlsHelper::HostUid(), |
|
1612 filename, |
|
1613 this, |
|
1614 EMPXCollectionPluginMusic ); |
|
1615 } |
|
1616 } |
|
1617 } |
|
1618 else |
|
1619 { |
|
1620 if ( iPausedForSave ) |
|
1621 { |
|
1622 iPlaybackUtility->CommandL( EPbCmdPlay ); |
|
1623 } |
|
1624 } |
|
1625 iSaveMode = EMPXSaveModeIdle; |
|
1626 } |
|
1627 |
|
1628 MPX_DEBUG1("CMPXAppUi::HandlePostSaveOperationL(): exiting"); |
|
1629 } |
|
1630 |
|
1631 // --------------------------------------------------------------------------- |
|
1632 // From MMPXPlaybackObserver |
|
1633 // Handle playback message. |
|
1634 // --------------------------------------------------------------------------- |
|
1635 // |
|
1636 void CMPXAppUi::HandlePlaybackMessage( |
|
1637 CMPXMessage* aMessage, TInt aError ) |
|
1638 { |
|
1639 TBool skip = EFalse; |
|
1640 |
|
1641 #ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT |
|
1642 if (aMessage) |
|
1643 { |
|
1644 TMPXMessageId* id( aMessage->Value<TMPXMessageId>( KMPXMessageGeneralId ) ); |
|
1645 if ( id ) |
|
1646 { |
|
1647 if ( KMPXMessageGeneral == *id ) |
|
1648 { |
|
1649 // Prefilter the playback event before passing in to |
|
1650 // AppUi handler. |
|
1651 MPX_TRAP( aError, HandleCamesePlaybackPreProcessingL(*aMessage, skip) ); |
|
1652 } |
|
1653 } |
|
1654 } |
|
1655 #endif |
|
1656 |
|
1657 if ( !skip && aError == KErrNone && aMessage ) |
|
1658 { |
|
1659 TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) ); |
|
1660 } |
|
1661 } |
|
1662 |
|
1663 // --------------------------------------------------------------------------- |
|
1664 // From MMPXCollectionObserver. |
|
1665 // Handle media properties. |
|
1666 // --------------------------------------------------------------------------- |
|
1667 // |
|
1668 void CMPXAppUi::HandleCollectionMediaL( |
|
1669 const CMPXMedia& aMedia, |
|
1670 TInt aError ) |
|
1671 { |
|
1672 MPX_FUNC( "CMPXAppUi::HandleCollectionMediaL" ); |
|
1673 TBool okToOpen( ETrue ); |
|
1674 |
|
1675 const CMPXMedia* media( &aMedia ); |
|
1676 |
|
1677 // Check if rights OK |
|
1678 if ( !aError ) |
|
1679 { |
|
1680 // First make sure it's a DRM file and the file protection type |
|
1681 if ( media->IsSupported( KMPXMediaDrmProtected ) && |
|
1682 media->IsSupported( KMPXMediaDrmType ) ) |
|
1683 { |
|
1684 TBool prot( |
|
1685 media->ValueTObjectL<TBool>( KMPXMediaDrmProtected ) ); |
|
1686 if ( prot ) |
|
1687 { |
|
1688 #ifdef CAMESE_IN_DRM_UTILITY |
|
1689 // OMA and WMDRM cases will be handled with same logic now |
|
1690 okToOpen = HandleDRMProtectionL(*media); |
|
1691 #else |
|
1692 TMPXMediaDrmType type( |
|
1693 media->ValueTObjectL<TMPXMediaDrmType>( KMPXMediaDrmType ) ); |
|
1694 if ( EMPXDrmTypeWMA == type ) |
|
1695 { |
|
1696 okToOpen = HandleWMAProtectionL(); |
|
1697 } |
|
1698 |
|
1699 else |
|
1700 { |
|
1701 okToOpen = HandleDRMProtectionL(*media); |
|
1702 } |
|
1703 #endif |
|
1704 } |
|
1705 |
|
1706 } |
|
1707 } |
|
1708 else |
|
1709 { |
|
1710 okToOpen = EFalse; |
|
1711 #ifndef __CAMESE_SUPERDISTRIBUTION_SUPPORT |
|
1712 // Leave Error Handling for Camese Ui |
|
1713 // if Camese support is enabled |
|
1714 iCommonUiHelper->HandleErrorL( aError ); |
|
1715 #endif |
|
1716 } |
|
1717 |
|
1718 // If all checking passed then open |
|
1719 if ( okToOpen ) |
|
1720 { |
|
1721 iCollectionUtility->Collection().OpenL(); |
|
1722 } |
|
1723 else if ( MPXTlsHelper::NeedSave() ) |
|
1724 { |
|
1725 MPX_DEBUG1( "CMPXAppUi::HandleCollectionMediaL open failed, attempting to save" ); |
|
1726 HandleCommandL( EMPXCmdSaveAndExit ); |
|
1727 } |
|
1728 } |
|
1729 |
|
1730 // --------------------------------------------------------------------------- |
|
1731 // CMPXAppUi::HandleWMAProtectionL |
|
1732 // --------------------------------------------------------------------------- |
|
1733 // |
|
1734 TBool CMPXAppUi::HandleWMAProtectionL() |
|
1735 { |
|
1736 #ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT |
|
1737 |
|
1738 if ( !IsPlaybackRemote() ) |
|
1739 { |
|
1740 // Indicates we are currently handling WMA Protected Media |
|
1741 iHandlingProtectedWMAMedia = ETrue; |
|
1742 } |
|
1743 #endif |
|
1744 // Regardless of Camese support enabled or not, |
|
1745 // we always proceed to starting playback of |
|
1746 // protected WMA media. |
|
1747 return ETrue; |
|
1748 } |
|
1749 |
|
1750 // --------------------------------------------------------------------------- |
|
1751 // CMPXAppUi::HandleDRMProtectionL |
|
1752 // --------------------------------------------------------------------------- |
|
1753 // |
|
1754 TBool CMPXAppUi::HandleDRMProtectionL(const CMPXMedia& aMedia) |
|
1755 { |
|
1756 TBool okToOpen( ETrue ); |
|
1757 |
|
1758 // DRM Protection |
|
1759 // Now check the rights status and if it's about to expire. |
|
1760 if ( aMedia.IsSupported( KMPXMediaDrmRightsStatus ) && |
|
1761 aMedia.IsSupported( KMPXMediaDrmAboutToExpire ) ) |
|
1762 { |
|
1763 TMPXMediaDrmRightsStatus status( |
|
1764 aMedia.ValueTObjectL<TMPXMediaDrmRightsStatus>( |
|
1765 KMPXMediaDrmRightsStatus ) ); |
|
1766 TBool aboutToExpire( |
|
1767 aMedia.ValueTObjectL<TBool>( KMPXMediaDrmAboutToExpire) ); |
|
1768 |
|
1769 // Preview clips cannot be saved |
|
1770 if ( EMPXDrmRightsPreview == status ) |
|
1771 { |
|
1772 MPXTlsHelper::SetNeedSave( EFalse ); |
|
1773 } |
|
1774 |
|
1775 RFile* file( NULL ); |
|
1776 if ( iFile.SubSessionHandle() && |
|
1777 MPXTlsHelper::LaunchMode() != EMPXLaunchModePlaylist ) |
|
1778 { |
|
1779 file = &iFile; |
|
1780 } |
|
1781 |
|
1782 // Display error message if about to expire, or if |
|
1783 // there are no rights |
|
1784 if ( aboutToExpire ) |
|
1785 { |
|
1786 TInt ret( iCommonUiHelper->HandleErrorL( |
|
1787 KMPXRightsAboutToExpire, &aMedia, file )); |
|
1788 if ( KErrNone != ret ) |
|
1789 { |
|
1790 okToOpen = EFalse; |
|
1791 } |
|
1792 } |
|
1793 else if ( EMPXDrmRightsMissing == status || |
|
1794 EMPXDrmRightsExpired == status ) |
|
1795 { |
|
1796 // DRMStream: |
|
1797 // for silent cases the rights may have been recieved |
|
1798 TInt ret( iCommonUiHelper->HandleErrorL( KErrCANoRights, &aMedia, file )); |
|
1799 if ( KErrNone != ret ) |
|
1800 { |
|
1801 okToOpen = EFalse; |
|
1802 } |
|
1803 } |
|
1804 |
|
1805 if ( !okToOpen ) |
|
1806 { |
|
1807 // If embedded and no rights, then close |
|
1808 if ( IsEmbedded() ) |
|
1809 { |
|
1810 // Only close embedded mode if not a playlist |
|
1811 if ( MPXTlsHelper::LaunchMode() != EMPXLaunchModePlaylist ) |
|
1812 { |
|
1813 RunAppShutter(); |
|
1814 } |
|
1815 else |
|
1816 { |
|
1817 // Reset collection path and save index |
|
1818 MMPXCollection& col( iCollectionUtility->Collection() ); |
|
1819 CMPXCollectionPath* cPath( col.PathL() ); |
|
1820 CleanupStack::PushL( cPath ); |
|
1821 iCurrentIndex = cPath->Index(); |
|
1822 cPath->Back(); |
|
1823 col.OpenL( *cPath ); |
|
1824 CleanupStack::PopAndDestroy( cPath ); |
|
1825 } |
|
1826 } |
|
1827 |
|
1828 // If standalone and no rights, mark item as invalid |
|
1829 // and reset collection path |
|
1830 else |
|
1831 { |
|
1832 // Check if DRM Flag is already mark as invalid, only set if it's not. |
|
1833 MMPXCollection& col( iCollectionUtility->Collection() ); |
|
1834 TBool setDrm( ETrue ); |
|
1835 TBool clearOtherFlags( EFalse ); |
|
1836 TUint flag( 0 ); |
|
1837 |
|
1838 if ( aMedia.IsSupported( KMPXMediaGeneralFlags )) |
|
1839 { |
|
1840 flag = aMedia.ValueTObjectL<TUint>( KMPXMediaGeneralFlags ); |
|
1841 if ( flag & KMPXMediaGeneralFlagsIsDrmLicenceInvalid ) |
|
1842 { |
|
1843 setDrm = EFalse; |
|
1844 } |
|
1845 if ( flag & KMPXMediaGeneralFlagsIsCorrupted || |
|
1846 flag & KMPXMediaGeneralFlagsIsInvalid ) |
|
1847 { |
|
1848 clearOtherFlags = ETrue; |
|
1849 } |
|
1850 } |
|
1851 if ( setDrm ) |
|
1852 { |
|
1853 CMPXMedia* entry( CMPXMedia::NewL( aMedia )); |
|
1854 CleanupStack::PushL( entry ); |
|
1855 |
|
1856 flag = KMPXMediaGeneralFlagsSetOrUnsetBit | |
|
1857 KMPXMediaGeneralFlagsIsDrmLicenceInvalid; |
|
1858 entry->SetTObjectValueL( KMPXMediaGeneralFlags, flag ); |
|
1859 SetMediaL( *entry ); |
|
1860 CleanupStack::PopAndDestroy( entry ); |
|
1861 } |
|
1862 |
|
1863 // Reset corrupted and invalid flags if they are set |
|
1864 if ( clearOtherFlags ) |
|
1865 { |
|
1866 CMPXMedia* entry( CMPXMedia::NewL( aMedia )); |
|
1867 CleanupStack::PushL( entry ); |
|
1868 |
|
1869 flag = KMPXMediaGeneralFlagsIsCorrupted | |
|
1870 KMPXMediaGeneralFlagsIsInvalid; |
|
1871 entry->SetTObjectValueL( KMPXMediaGeneralFlags, flag ); |
|
1872 SetMediaL( *entry ); |
|
1873 CleanupStack::PopAndDestroy( entry ); |
|
1874 } |
|
1875 |
|
1876 // Reset collection path and save index |
|
1877 CMPXCollectionPath* cPath( col.PathL() ); |
|
1878 CleanupStack::PushL( cPath ); |
|
1879 iCurrentIndex = cPath->Index(); |
|
1880 cPath->Back(); |
|
1881 col.OpenL( *cPath ); |
|
1882 CleanupStack::PopAndDestroy( cPath ); |
|
1883 } |
|
1884 } |
|
1885 } |
|
1886 else |
|
1887 { |
|
1888 // If rights status and about to expire attributes are |
|
1889 // not set, retrieve them. |
|
1890 RArray<TMPXAttribute> attrs; |
|
1891 CleanupClosePushL(attrs); |
|
1892 attrs.Append( TMPXAttribute( KMPXMediaIdGeneral, |
|
1893 EMPXMediaGeneralBasic | |
|
1894 EMPXMediaGeneralUri | |
|
1895 EMPXMediaGeneralFlags | |
|
1896 EMPXMediaGeneralCollectionId | |
|
1897 EMPXMediaGeneralId )); |
|
1898 attrs.Append( KMPXMediaDrmAll ); |
|
1899 CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL(); |
|
1900 CleanupStack::PushL( cPath ); |
|
1901 iCollectionUtility->Collection().MediaL( |
|
1902 *cPath, |
|
1903 attrs.Array() ); |
|
1904 CleanupStack::PopAndDestroy( cPath ); |
|
1905 CleanupStack::PopAndDestroy( &attrs ); |
|
1906 okToOpen = EFalse; |
|
1907 } |
|
1908 |
|
1909 return okToOpen; |
|
1910 } |
|
1911 |
|
1912 // --------------------------------------------------------------------------- |
|
1913 // Handle Broadcast messages from the collection |
|
1914 // --------------------------------------------------------------------------- |
|
1915 // |
|
1916 void CMPXAppUi::HandleBroadcastMessageL( const CMPXMessage& aMessage ) |
|
1917 { |
|
1918 // Disable media keys during system operations. |
|
1919 TInt op( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) ); |
|
1920 MPX_DEBUG2( "CMPXAppUi::HandleBroadcastMessageL EBroadcastEvent, op = %d", op ); |
|
1921 if( op == EMcMsgUSBMassStorageStart || |
|
1922 op == EMcMsgUSBMTPStart || |
|
1923 op == EMcMsgRefreshStart || |
|
1924 op == EMcMsgFormatStart ) |
|
1925 { |
|
1926 MPX_DEBUG1( "CMPXAppUi::HandleBroadcastMessageL EBroadcastEvent disable media key" ); |
|
1927 if ( !IsEmbedded() || op != EMcMsgUSBMTPStart ) |
|
1928 { |
|
1929 iMediaKeyHandler->SetEnableMediaKeys( EFalse ); |
|
1930 } |
|
1931 } |
|
1932 else if( op == EMcMsgUSBMassStorageEnd || |
|
1933 op == EMcMsgUSBMTPEnd || |
|
1934 op == EMcMsgRefreshEnd || |
|
1935 op == EMcMsgFormatEnd ) |
|
1936 { |
|
1937 MPX_DEBUG1( "CMPXAppUi::HandleBroadcastMessageL EBroadcastEvent enable media key" ); |
|
1938 if ( !IsEmbedded() || op != EMcMsgUSBMTPEnd ) |
|
1939 { |
|
1940 iMediaKeyHandler->SetEnableMediaKeys( ETrue ); |
|
1941 } |
|
1942 } |
|
1943 if (op == EMcMsgRefreshEnd) |
|
1944 { |
|
1945 TInt err = aMessage.ValueTObjectL<TInt>(KMPXMessageGeneralData); |
|
1946 |
|
1947 MPX_DEBUG2("EMcMsgRefreshEnd, err = %d", err); |
|
1948 |
|
1949 if (err < KErrNone) |
|
1950 iCommonUiHelper->HandleErrorL(err); |
|
1951 } |
|
1952 |
|
1953 // Re-open the path so that the view can be refreshed, |
|
1954 // because there could be changes in the view contents |
|
1955 // |
|
1956 if ( op == EMcMsgUSBMassStorageStart || |
|
1957 op == EMcMsgUSBMTPStart ) |
|
1958 { |
|
1959 iIsUsbOnGoing = ETrue; |
|
1960 if ( iProcessParameter ) |
|
1961 { |
|
1962 iProcessParameter->SetUsbInUse( ETrue ); |
|
1963 } |
|
1964 } |
|
1965 if ( op == EMcMsgUSBMassStorageEnd || |
|
1966 op == EMcMsgUSBMTPEnd ) |
|
1967 { |
|
1968 iIsUsbOnGoing = EFalse; |
|
1969 if ( iProcessParameter ) |
|
1970 { |
|
1971 iProcessParameter->SetUsbInUse( EFalse ); |
|
1972 } |
|
1973 if( op == EMcMsgUSBMTPEnd ) |
|
1974 { |
|
1975 DoUpdatePluginRefreshedTimeL(); |
|
1976 } |
|
1977 } |
|
1978 if( op == EMcMsgFormatStart ) |
|
1979 { |
|
1980 iFormattingOnGoing = ETrue; |
|
1981 } |
|
1982 else if( op == EMcMsgFormatEnd ) |
|
1983 { |
|
1984 iFormattingOnGoing = EFalse; |
|
1985 } |
|
1986 else if ( op == EMcMsgRefreshStart ) |
|
1987 { |
|
1988 iRefreshOnGoing = ETrue; |
|
1989 if( iProcessParameter ) |
|
1990 { |
|
1991 iProcessParameter->SetRefreshState( ETrue ); |
|
1992 } |
|
1993 } |
|
1994 else if ( op == EMcMsgRefreshEnd ) |
|
1995 { |
|
1996 iRefreshOnGoing = EFalse; |
|
1997 if( iProcessParameter ) |
|
1998 { |
|
1999 iProcessParameter->SetRefreshState( EFalse ); |
|
2000 } |
|
2001 } |
|
2002 |
|
2003 if ( op == EMcMsgUSBMTPEnd ) |
|
2004 { |
|
2005 if ( !IsEmbedded() ) |
|
2006 { |
|
2007 CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL ( ); |
|
2008 CleanupStack::PushL ( cPath ); |
|
2009 TBool usbDiskRemovalEvent(EFalse); |
|
2010 if ( (op == EMcMsgDiskRemoved) && iIsUsbOnGoing ) |
|
2011 { |
|
2012 usbDiskRemovalEvent = ETrue; |
|
2013 } |
|
2014 |
|
2015 if ( cPath->Levels ( )> 1 && !iFormattingOnGoing && !usbDiskRemovalEvent && |
|
2016 iCurrentViewType.iUid != KMPXPluginTypePlaybackUid && |
|
2017 iCurrentViewType.iUid != KMPXPluginTypeAudioEffectsUid ) |
|
2018 { |
|
2019 |
|
2020 cPath->Back ( ); |
|
2021 iCollectionUtility->Collection().OpenL ( *cPath ); |
|
2022 |
|
2023 } |
|
2024 CleanupStack::PopAndDestroy ( cPath ); |
|
2025 } |
|
2026 |
|
2027 } |
|
2028 else if ( op == EMcMsgDiskRemoved ) |
|
2029 { |
|
2030 TBool usbDiskRemovalEvent( EFalse ); |
|
2031 if ( (op == EMcMsgDiskRemoved) && iIsUsbOnGoing ) |
|
2032 { |
|
2033 usbDiskRemovalEvent = ETrue; |
|
2034 } |
|
2035 else |
|
2036 { |
|
2037 MPX_DEBUG1( "CMPXAppUi::HandleBroadcastMessageL. MMC ejected and the application needs to close." ); |
|
2038 RunAppShutter(); |
|
2039 return; |
|
2040 } |
|
2041 |
|
2042 CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL ( ); |
|
2043 CleanupStack::PushL ( cPath ); |
|
2044 if ( cPath->Levels ( )> 1 && !iFormattingOnGoing && !usbDiskRemovalEvent && |
|
2045 iCurrentViewType.iUid != KMPXPluginTypePlaybackUid ) |
|
2046 { |
|
2047 cPath->Back(); |
|
2048 iCollectionUtility->Collection().OpenL( *cPath ); |
|
2049 |
|
2050 } |
|
2051 CleanupStack::PopAndDestroy( cPath ); |
|
2052 } |
|
2053 // Re-open the collection view after a refresh |
|
2054 // and after album art or metadata dialog or add songs editor dialog closes |
|
2055 if (((op == EMcMsgRefreshEnd ) || (op == EMcMsgUSBMassStorageEnd)) |
|
2056 && (IsActiveView(KMPXPluginTypeAlbumArtEditorUid) |
|
2057 || IsActiveView(KMPXPluginTypeMetadataEditorUid) |
|
2058 || IsActiveView( KMPXPluginTypeAddSongsEditorUid ) ) ) |
|
2059 { |
|
2060 if ( !IsEmbedded() ) |
|
2061 { |
|
2062 iRefreshCollectionView = ETrue; |
|
2063 } |
|
2064 } |
|
2065 // Re-open the collection view after a refresh |
|
2066 // if we were currently in collection view. |
|
2067 if( op == EMcMsgRefreshEnd && IsActiveView(KMPXPluginTypeCollectionUid)) |
|
2068 { |
|
2069 if( !IsEmbedded() ) |
|
2070 { |
|
2071 iRefreshCollectionView = EFalse; |
|
2072 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
2073 CleanupStack::PushL( path ); |
|
2074 if( path->Levels() > 1 && |
|
2075 iCurrentViewType.iUid != KMPXPluginTypePlaybackUid ) |
|
2076 { |
|
2077 path->Back(); |
|
2078 iCollectionUtility->Collection().OpenL( *path ); |
|
2079 } |
|
2080 CleanupStack::PopAndDestroy( path ); |
|
2081 } |
|
2082 } |
|
2083 } |
|
2084 |
|
2085 // --------------------------------------------------------------------------- |
|
2086 // Handles commands passed in by other applications |
|
2087 // --------------------------------------------------------------------------- |
|
2088 // |
|
2089 void CMPXAppUi::HandleCommandParametersL( const TDesC8& aCommand ) |
|
2090 { |
|
2091 MPX_FUNC( "CMPXAppUi::HandleCommandParametersL" ); |
|
2092 if ( !iIgnoreExternalCommand && aCommand.Size() > 0 ) |
|
2093 { |
|
2094 delete iProcessParameter; |
|
2095 iProcessParameter = NULL; |
|
2096 TUid collectionMode( KAppUidMusicPlayerX ); |
|
2097 if ( IsEmbedded() ) |
|
2098 { |
|
2099 collectionMode = MPXTlsHelper::HostUid(); // Collection context == host UID |
|
2100 } |
|
2101 iProcessParameter = CMPXCommandHandler::NewL( |
|
2102 iPlaybackUtility, collectionMode, aCommand ); |
|
2103 |
|
2104 TBool fwdStandAlone( iProcessParameter->ForwardCmdToStandAloneMode() ); |
|
2105 TBool fwdNowPlaying( iProcessParameter->ForwardCmdToNowPlaying() ); |
|
2106 |
|
2107 MPX_DEBUG2( "CMPXAppUi::HandleCommandParametersL iIsUsbOnGoing = %d", iIsUsbOnGoing ); |
|
2108 // if ActiveIdle plugin sends a command i.e., EMPXCmdFwdNowPlaying, it doesn't make any dialogs dismiss. |
|
2109 if ( !fwdNowPlaying && iCurrentViewType.iUid != KMPXPluginTypeWaitNoteDialogUid && !iIsUsbOnGoing ) |
|
2110 { |
|
2111 MPX_DEBUG1( "CMPXAppUi::HandleCommandParametersL dismissing dialogs" ); |
|
2112 // dismiss all the dialogs except scaning wait note |
|
2113 AknDialogShutter::ShutDialogsL( *CEikonEnv::Static() ); |
|
2114 } |
|
2115 |
|
2116 iCmdActivatedViewTypeId = iProcessParameter->ActivatedViewTypeId(); |
|
2117 MPX_DEBUG2( "CMPXAppUi::HandleCommandParametersL activated view type= =0x%x", |
|
2118 iCmdActivatedViewTypeId ); |
|
2119 |
|
2120 MPX_DEBUG3( "CMPXAppUi::HandleCommandParametersL should forward to standalone %d, now playing %d", fwdStandAlone, fwdNowPlaying ); |
|
2121 |
|
2122 RArray<TProcessId> procArray; |
|
2123 CleanupClosePushL( procArray ); |
|
2124 TProcessId npProcId( 0 ); |
|
2125 MMPXPlaybackUtility* activePbU = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer ); |
|
2126 CleanupClosePushL( *activePbU ); |
|
2127 activePbU->GetClientsL( procArray ); |
|
2128 CleanupStack::PopAndDestroy( activePbU ); |
|
2129 npProcId = procArray[ 0 ]; |
|
2130 CleanupStack::PopAndDestroy( &procArray ); |
|
2131 |
|
2132 TInt64 standAlonePId( CMPXCommonUiHelper::StandAloneModePId() ); |
|
2133 |
|
2134 RProcess currProc; |
|
2135 TProcessId currPId( currProc.Id() ); |
|
2136 currProc.Close(); |
|
2137 |
|
2138 MPX_DEBUG2( "CMPXAppUi::HandleCommandParametersL current pid 0x%lx", currPId.Id() ); |
|
2139 MPX_DEBUG2( "CMPXAppUi::HandleCommandParametersL nppid 0x%lx", npProcId.Id() ); |
|
2140 MPX_DEBUG2( "CMPXAppUi::HandleCommandParametersL standalone pid 0x%lx", standAlonePId ); |
|
2141 |
|
2142 if ( ( !fwdStandAlone && !fwdNowPlaying ) || // no forward |
|
2143 ( fwdStandAlone && ( currPId.Id() == standAlonePId ) ) || // we're standalone mode |
|
2144 ( fwdNowPlaying && ( currPId == npProcId ) ) ) // we are now playing |
|
2145 { |
|
2146 if ( iPathRestore ) |
|
2147 { |
|
2148 if ( !iPathRestore->Initialized() && |
|
2149 iProcessParameter->IsInitPlaybackEngineNeeded() ) |
|
2150 { |
|
2151 if ( iPathRestore->IsInitializing() ) |
|
2152 { |
|
2153 MPX_DEBUG1( "CMPXAppUi::HandleCommandParametersL command handling delayed until path restore completes" ); |
|
2154 // delay command processing until path restore is complete |
|
2155 iDelayedParameterHandling = ETrue; |
|
2156 } |
|
2157 else |
|
2158 { |
|
2159 MPX_DEBUG1( "CMPXAppUi::HandleCommandParametersL canceling path restore" ); |
|
2160 // command will init playback engine, can cancel path restore's init |
|
2161 iPathRestore->CancelInit(); |
|
2162 } |
|
2163 } |
|
2164 } |
|
2165 if ( !iDelayedParameterHandling ) |
|
2166 { |
|
2167 // command should be handled locally |
|
2168 iProcessParameter->ProcessMessageL( iIsUsbOnGoing, iRefreshOnGoing, iFormattingOnGoing ); |
|
2169 } |
|
2170 } |
|
2171 else |
|
2172 { |
|
2173 TInt64 procId( 0 ); |
|
2174 if ( iProcessParameter->ForwardCmdToStandAloneMode() ) |
|
2175 { |
|
2176 MPX_DEBUG1( "CMPXAppUi::HandleCommandParametersL forwarding to standalone" ); |
|
2177 procId = standAlonePId; |
|
2178 } |
|
2179 else if ( iProcessParameter->ForwardCmdToNowPlaying() ) |
|
2180 { |
|
2181 MPX_DEBUG1( "CMPXAppUi::HandleCommandParametersL forwarding to now playing" ); |
|
2182 procId = npProcId.Id(); |
|
2183 } |
|
2184 delete iProcessParameter; |
|
2185 iProcessParameter = NULL; |
|
2186 |
|
2187 if ( procId != 0 ) |
|
2188 { |
|
2189 // standalone music player exist, forward command to it |
|
2190 RWsSession& wsSession( iCoeEnv->WsSession() ); |
|
2191 TInt wgId( MPXUser::FindWindowGroupIdL( procId, wsSession ) ); |
|
2192 MPX_DEBUG2( "CMPXAppUi::HandleCommandParametersL() forwarding message to wgId 0x%x", wgId ); |
|
2193 wsSession.SendMessageToWindowGroup( wgId, KAppUidMusicPlayerX, aCommand ); |
|
2194 } |
|
2195 else |
|
2196 { |
|
2197 MPX_DEBUG1( "CMPXAppUi::HandleCommandParametersL no music player instance, starting a new one" ); |
|
2198 // no music player instance, start a new one |
|
2199 RApaLsSession ls; |
|
2200 CleanupClosePushL( ls ); |
|
2201 User::LeaveIfError( ls.Connect() ); |
|
2202 TApaAppInfo appInfo; |
|
2203 User::LeaveIfError( ls.GetAppInfo( appInfo, KAppUidMusicPlayerX ) ); |
|
2204 CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC(); |
|
2205 apaCommandLine->SetExecutableNameL( appInfo.iFullName ); |
|
2206 apaCommandLine->SetTailEndL( aCommand ); |
|
2207 User::LeaveIfError( ls.StartApp( *apaCommandLine ) ); |
|
2208 CleanupStack::PopAndDestroy(); // apaCommandLine |
|
2209 CleanupStack::PopAndDestroy(); // ls |
|
2210 } |
|
2211 } |
|
2212 } |
|
2213 else if ( iIgnoreExternalCommand ) |
|
2214 { |
|
2215 MPX_DEBUG1( "CMPXAppUi::HandleCommandParametersL command to be ignored, requested by views" ); |
|
2216 // bring musicplayer to foreground |
|
2217 // have to use window group to activate, in case some other window |
|
2218 // has higher priority than us (e.g. playback popup and volume popup) |
|
2219 RWindowGroup myWin = CEikonEnv::Static()->RootWin(); |
|
2220 myWin.SetOrdinalPosition( 0, ECoeWinPriorityNormal ); |
|
2221 } |
|
2222 else |
|
2223 { |
|
2224 MPX_DEBUG1( "CMPXAppUi::HandleCommandParametersL invalid parameter length, command ignored" ); |
|
2225 } |
|
2226 } |
|
2227 |
|
2228 // --------------------------------------------------------------------------- |
|
2229 // Handle playback message. |
|
2230 // --------------------------------------------------------------------------- |
|
2231 // |
|
2232 void CMPXAppUi::DoHandlePlaybackMessageL( |
|
2233 const CMPXMessage& aMessage ) |
|
2234 { |
|
2235 MPX_FUNC( "CMPXAppUi::DoHandlePlaybackMessageL" ); |
|
2236 |
|
2237 TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) ); |
|
2238 if ( KMPXMessageGeneral == id ) |
|
2239 { |
|
2240 switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) ) |
|
2241 { |
|
2242 case TMPXPlaybackMessage::EPlayerChanged: |
|
2243 { |
|
2244 MPX_DEBUG1( "CMPXAppUi::DoHandlePlaybackMessageL EPlayerChanged" ); |
|
2245 // get the current Volume and Max Volume |
|
2246 iPlaybackUtility->PropertyL(*this, EPbPropertyVolume); |
|
2247 iPlaybackUtility->PropertyL(*this, EPbPropertyMaxVolume); |
|
2248 HandlePlaybackPlayerChangedL(); |
|
2249 break; |
|
2250 } |
|
2251 case TMPXPlaybackMessage::EInitializeComplete: |
|
2252 { |
|
2253 MPX_DEBUG1( "CMPXAppUi::DoHandlePlaybackMessageL init complete" ); |
|
2254 TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) ); |
|
2255 if ( ( IsEmbedded() || iPathRestore && iPathRestore->Initialized() ) && data ) |
|
2256 { |
|
2257 TMPXLaunchMode mode = MPXTlsHelper::LaunchMode(); |
|
2258 if ( EMPXLaunchModeStopped != mode && |
|
2259 EMPXLaunchModeUnknown!= mode ) |
|
2260 { |
|
2261 // Play the track |
|
2262 MPX_DEBUG1( "CMPXAppUi::DoHandlePlaybackMessageL send play command" ); |
|
2263 CMPXCommand* cmd( CMPXCommand::NewL() ); |
|
2264 CleanupStack::PushL( cmd ); |
|
2265 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, |
|
2266 KMPXCommandIdPlaybackGeneral ); |
|
2267 cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, |
|
2268 EPbCmdPlay ); |
|
2269 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, |
|
2270 ETrue ); |
|
2271 cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, |
|
2272 ETrue ); |
|
2273 iPlaybackUtility->CommandL( *cmd ); |
|
2274 CleanupStack::PopAndDestroy( cmd ); |
|
2275 } |
|
2276 } |
|
2277 else // iPathRestore not initialized |
|
2278 { |
|
2279 if ( iPathRestore ) |
|
2280 { |
|
2281 iPathRestore->SetInitialized( ETrue ); |
|
2282 } |
|
2283 |
|
2284 if ( iStandAlone ) |
|
2285 { |
|
2286 iPlaybackUtility->CommandL( EPbCmdPlay ); |
|
2287 } |
|
2288 |
|
2289 if ( iDelayedParameterHandling ) |
|
2290 { |
|
2291 MPX_DEBUG1( "CMPXAppUi::DoHandlePlaybackMessageL start command handling" ); |
|
2292 iDelayedParameterHandling = EFalse; |
|
2293 iProcessParameter->ProcessMessageL( iIsUsbOnGoing, iRefreshOnGoing, iFormattingOnGoing ); |
|
2294 } |
|
2295 } |
|
2296 |
|
2297 break; |
|
2298 } |
|
2299 case TMPXPlaybackMessage::EPlayerUnavailable: |
|
2300 { |
|
2301 MPX_DEBUG1( "CMPXAppUi::DoHandlePlaybackMessageL EPlayerUnavailable" ); |
|
2302 iUPnPUnavailableEventFromCollection = EFalse; |
|
2303 |
|
2304 MMPXSource* source = iPlaybackUtility->Source(); |
|
2305 if ( source ) |
|
2306 { |
|
2307 CMPXCollectionPlaylist* playlist = source->PlaylistL(); |
|
2308 if ( playlist ) |
|
2309 { |
|
2310 CleanupStack::PushL( playlist ); |
|
2311 iPlaybackUtility->PlayerManager().ClearSelectPlayersL(); |
|
2312 MPX_DEBUG2( "CMPXAppUi::DoHandlePlaybackMessageL playlist index = %d", playlist->Index()); |
|
2313 iPlaybackUtility->InitL( *playlist, ETrue ); |
|
2314 CleanupStack::PopAndDestroy( playlist ); |
|
2315 } |
|
2316 } |
|
2317 |
|
2318 if ( iCurrentViewType.iUid != KMPXPluginTypePlaybackUid ) |
|
2319 { |
|
2320 iUPnPUnavailableEventFromCollection = ETrue; |
|
2321 } |
|
2322 |
|
2323 break; |
|
2324 } |
|
2325 case TMPXPlaybackMessage::EPropertyChanged: |
|
2326 { |
|
2327 TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) ); |
|
2328 TMPXPlaybackProperty property( |
|
2329 static_cast<TMPXPlaybackProperty>( type ) ); |
|
2330 if ( property == EPbPropertyVolume ) |
|
2331 { |
|
2332 iCurrentVolume = aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ); |
|
2333 MPX_DEBUG2( "CMPXAppUi::DoHandlePlaybackMessageL iCurrentVolume = %d", iCurrentVolume ); |
|
2334 } |
|
2335 else if( property == EPbPropertyRandomMode |
|
2336 || property == EPbPropertyRepeatMode ) |
|
2337 { |
|
2338 TInt value = aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ); |
|
2339 TUint32 key = KMPXMPPlaybackRandomMode; |
|
2340 if( property == EPbPropertyRepeatMode ) |
|
2341 { |
|
2342 key = KMPXMPPlaybackRepeatMode; |
|
2343 } |
|
2344 MPX_DEBUG3( "CMPXAppUi::DoHandlePlaybackMessageL EPropertyChanged key = %d, value = %d", key, value ); |
|
2345 CRepository* repository = CRepository::NewL( KCRUidMPXMPSettings ); |
|
2346 repository->Set( key, value ); |
|
2347 delete repository; |
|
2348 repository = NULL; |
|
2349 } |
|
2350 break; |
|
2351 } |
|
2352 case TMPXPlaybackMessage::EStateChanged: |
|
2353 { |
|
2354 TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) ); |
|
2355 TMPXPlaybackState state( |
|
2356 static_cast<TMPXPlaybackState>( type ) ); |
|
2357 |
|
2358 #ifndef FF_OOM_MONITOR2_COMPONENT |
|
2359 // Obtain wgname |
|
2360 // Gets the window group id of the app in foreground |
|
2361 RWsSession& wsSession( iCoeEnv->WsSession() ); |
|
2362 RWindowGroup myWin = iEikonEnv->RootWin(); |
|
2363 CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, myWin.Identifier() ); |
|
2364 #endif //FF_OOM_MONITOR2_COMPONENT |
|
2365 switch( state ) |
|
2366 { |
|
2367 case EPbStateInitialising: |
|
2368 case EPbStatePlaying: |
|
2369 case EPbStatePaused: |
|
2370 case EPbStateSeekingForward: |
|
2371 case EPbStateSeekingBackward: |
|
2372 case EPbStateBuffering: |
|
2373 case EPbStateDownloading: |
|
2374 { |
|
2375 #ifdef FF_OOM_MONITOR2_COMPONENT |
|
2376 SetMpxOomPriorityL( ROomMonitorSession::EOomPriorityBusy ); |
|
2377 #else |
|
2378 wgName->SetBusy(ETrue); |
|
2379 #endif //FF_OOM_MONITOR2_COMPONENT |
|
2380 break; |
|
2381 } |
|
2382 case EPbStateNotInitialised: |
|
2383 case EPbStateStopped: |
|
2384 case EPbStateShuttingDown: |
|
2385 { |
|
2386 #ifdef FF_OOM_MONITOR2_COMPONENT |
|
2387 SetMpxOomPriorityL( ROomMonitorSession::EOomPriorityNormal ); |
|
2388 #else |
|
2389 wgName->SetBusy(EFalse); |
|
2390 #endif //FF_OOM_MONITOR2_COMPONENT |
|
2391 break; |
|
2392 } |
|
2393 default: |
|
2394 { |
|
2395 break; |
|
2396 } |
|
2397 } |
|
2398 #ifndef FF_OOM_MONITOR2_COMPONENT |
|
2399 CleanupStack::PopAndDestroy(); //wgName |
|
2400 #endif //FF_OOM_MONITOR2_COMPONENT |
|
2401 |
|
2402 break; |
|
2403 } |
|
2404 case TMPXPlaybackMessage::EError: |
|
2405 { |
|
2406 MPX_DEBUG2( "CMPXAppUi::DoHandlePlaybackMessageL error = %d", aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) ); |
|
2407 break; |
|
2408 } |
|
2409 default: |
|
2410 { |
|
2411 break; |
|
2412 } |
|
2413 } |
|
2414 } |
|
2415 } |
|
2416 |
|
2417 #ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT |
|
2418 // --------------------------------------------------------------------------- |
|
2419 // Handle Camese Playback Message Preprocessing |
|
2420 // --------------------------------------------------------------------------- |
|
2421 // |
|
2422 void CMPXAppUi::HandleCamesePlaybackPreProcessingL(const CMPXMessage& aMessage, |
|
2423 TBool& aSkipEvent) |
|
2424 { |
|
2425 aSkipEvent = EFalse; |
|
2426 |
|
2427 // Pre-filter events, avoiding handling if Camese |
|
2428 // is handling WMA songs in pre-init phase. |
|
2429 if (iHandlingProtectedWMAMedia) |
|
2430 { |
|
2431 TInt event = aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ); |
|
2432 if (event == TMPXPlaybackMessage::EPlayerChanged) |
|
2433 { |
|
2434 MPX_DEBUG1("CMPXAppUi::HandleCamesePlaybackPreProcessingL EPlayerChanged"); |
|
2435 |
|
2436 // Do not allow processing of the player changed stage |
|
2437 // to avoid view switching. |
|
2438 aSkipEvent = ETrue; |
|
2439 } |
|
2440 else if (event == TMPXPlaybackMessage::EInitializeComplete) |
|
2441 { |
|
2442 MPX_DEBUG1("CMPXAppUi::HandleCamesePlaybackPreProcessingL EStateChanged EInitializeComplete"); |
|
2443 // Execute view switching now. |
|
2444 HandlePlaybackPlayerChangedL(); |
|
2445 // Finished Protected Media Handling stage. |
|
2446 iHandlingProtectedWMAMedia = EFalse; |
|
2447 } |
|
2448 else if (event == TMPXPlaybackMessage::EError) |
|
2449 { |
|
2450 MPX_DEBUG2( "CMPXAppUi::HandleCamesePlaybackPreProcessingL error = %d", aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) ); |
|
2451 |
|
2452 // Finished Protected Media Handling stage. |
|
2453 iHandlingProtectedWMAMedia = EFalse; |
|
2454 } |
|
2455 } |
|
2456 } |
|
2457 #endif |
|
2458 |
|
2459 // --------------------------------------------------------------------------- |
|
2460 // Handle playback message for player changed. |
|
2461 // --------------------------------------------------------------------------- |
|
2462 // |
|
2463 void CMPXAppUi::HandlePlaybackPlayerChangedL() |
|
2464 { |
|
2465 // Don't switch views if we are getting player changed |
|
2466 // event from path restore or when we switch player because of a UPnP |
|
2467 // Unavailable event in Collection view |
|
2468 // |
|
2469 if ( !iUPnPUnavailableEventFromCollection && |
|
2470 ( IsEmbedded() || iPathRestore ) ) |
|
2471 { |
|
2472 if( iPathRestore && !iPathRestore->Initialized() ) |
|
2473 { |
|
2474 iPathRestore->CancelInit(); |
|
2475 } |
|
2476 MMPXPlayer* player = |
|
2477 iPlaybackUtility->PlayerManager().CurrentPlayer(); |
|
2478 TUid pluginUid( KNullUid ); |
|
2479 RArray<TUid> array; |
|
2480 CleanupClosePushL( array ); |
|
2481 |
|
2482 if ( player ) |
|
2483 { |
|
2484 pluginUid = player->UidL(); |
|
2485 MPX_DEBUG2( "CMPXAppUi::HandlePlaybackPlayerChangedL pluginUid uid = 0x%x", pluginUid.iUid ); |
|
2486 array.AppendL( pluginUid ); |
|
2487 } |
|
2488 |
|
2489 MMPXSource* source = iPlaybackUtility->Source(); |
|
2490 if ( source ) |
|
2491 { |
|
2492 CMPXCollectionPlaylist* playlist = source->PlaylistL(); |
|
2493 if ( playlist ) |
|
2494 { |
|
2495 CleanupStack::PushL( playlist ); |
|
2496 CMPXCollectionPath* pbPath = |
|
2497 CMPXCollectionPath::NewL( playlist->Path() ); |
|
2498 CleanupStack::PushL( pbPath ); |
|
2499 if ( pbPath->Levels() > 0 ) |
|
2500 { |
|
2501 MPX_DEBUG2( "CMPXAppUi::HandlePlaybackPlayerChangedL collection uid = 0x%x", pbPath->Id( 0 ).iId1 ); |
|
2502 array.AppendL( TUid::Uid( pbPath->Id( 0 ) ) ); |
|
2503 } |
|
2504 CleanupStack::PopAndDestroy( pbPath ); |
|
2505 CleanupStack::PopAndDestroy( playlist ); |
|
2506 } |
|
2507 } |
|
2508 |
|
2509 if ( IsEmbedded() ) |
|
2510 { |
|
2511 array.AppendL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid )); |
|
2512 } |
|
2513 else |
|
2514 { |
|
2515 array.AppendL( TUid::Uid( KMPXPluginTypePlaybackUid ) ); |
|
2516 } |
|
2517 iViewUtility->ActivateViewL( array ); |
|
2518 CleanupStack::PopAndDestroy( &array ); |
|
2519 |
|
2520 MPX_DEBUG2( "-->Plugin Uid:(%d)", pluginUid.iUid ); |
|
2521 } |
|
2522 iUPnPUnavailableEventFromCollection = EFalse; |
|
2523 } |
|
2524 |
|
2525 |
|
2526 // --------------------------------------------------------------------------- |
|
2527 // Callback function to signal that saving a file is complete |
|
2528 // --------------------------------------------------------------------------- |
|
2529 // |
|
2530 void CMPXAppUi::DoHandleSaveCompleteL( TInt aErr ) |
|
2531 { |
|
2532 MPX_DEBUG2("CMPXAppUi::DoHandleSaveCompleteL(%d) entering", aErr); |
|
2533 |
|
2534 if( iIsUsbOnGoing && (aErr != KErrNone) ) |
|
2535 { |
|
2536 // Kill mpx embedded mode so usb can start |
|
2537 // |
|
2538 MPX_DEBUG1("CMPXAppUi::HandleAddFileCompleteL usb ongoing"); |
|
2539 iSaveMode = EMPXExitAppAfterSave; |
|
2540 HandlePostSaveOperationL(); |
|
2541 } |
|
2542 else if ( !iCancelFileMan ) |
|
2543 { |
|
2544 if ( !aErr ) |
|
2545 { |
|
2546 if ( !iCollectionHelper ) |
|
2547 { |
|
2548 iCollectionHelper = CMPXCollectionHelperFactory::NewCollectionHelperL(); |
|
2549 } |
|
2550 iCollectionHelper->AddL( *iSavePath, this ); |
|
2551 if ( iView ) |
|
2552 { |
|
2553 if ( iSaveMode == EMPXAssignRingtone ) |
|
2554 { |
|
2555 TRAP_IGNORE( |
|
2556 MPXTlsHelper::SetFilePath( iSavePath->Des() ); |
|
2557 iView->HandleCommandL( EMPXCmdAfterSaveAiwCmdAssign )); |
|
2558 MPXTlsHelper::SetNeedSave( EFalse ); |
|
2559 } |
|
2560 else if ( iSaveMode == EMPXAssignContact ) |
|
2561 { |
|
2562 TRAP_IGNORE( |
|
2563 MPXTlsHelper::SetFilePath( iSavePath->Des() ); |
|
2564 iView->HandleCommandL( EMPXCmdAfterSaveUseAsCascade )); |
|
2565 MPXTlsHelper::SetNeedSave( EFalse ); |
|
2566 } |
|
2567 } |
|
2568 } |
|
2569 else |
|
2570 { |
|
2571 iCommonUiHelper->DismissWaitNoteL(); |
|
2572 iCommonUiHelper->HandleErrorL( aErr ); |
|
2573 delete iSavePath; |
|
2574 iSavePath = NULL; |
|
2575 if ( iView ) |
|
2576 { |
|
2577 iView->HandleCommandL( EMPXCmdSaveCancelled ); |
|
2578 } |
|
2579 HandlePostSaveOperationL(); |
|
2580 } |
|
2581 } |
|
2582 else |
|
2583 { |
|
2584 MPX_DEBUG1("CMPXAppUi::DoHandleSaveCompleteL() during cancel, starting callback" ); |
|
2585 iIdle = CIdle::NewL( CActive::EPriorityIdle ); |
|
2586 iSaveMode = EMPXSaveModeIdle; |
|
2587 iIdle->Start( TCallBack( CMPXAppUi::DeferredExitCallback, this ) ); |
|
2588 } |
|
2589 |
|
2590 MPX_DEBUG1("CMPXAppUi::DoHandleSaveCompleteL() exiting" ); |
|
2591 } |
|
2592 |
|
2593 // ----------------------------------------------------------------------------- |
|
2594 // Handle collection message |
|
2595 // ----------------------------------------------------------------------------- |
|
2596 // |
|
2597 void CMPXAppUi::DoHandleCollectionMessageL( const CMPXMessage& aMessage ) |
|
2598 { |
|
2599 MPX_FUNC( "CMPXAppUi::DoHandleCollectionMessageL" ); |
|
2600 |
|
2601 TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) ); |
|
2602 if ( KMPXCustomMessageId == id ) |
|
2603 { |
|
2604 // This is a custom collection message |
|
2605 // |
|
2606 TInt colId = aMessage.ValueTObjectL<TInt>( TMPXAttribute( KMPXCustomMessageId, |
|
2607 EMPXCustomMessageCollectionId ) ); |
|
2608 TInt op = aMessage.ValueTObjectL<TInt>( TMPXAttribute( KMPXCustomMessageId, |
|
2609 EMPXCustomMessageEventType ) ); |
|
2610 TInt err = aMessage.ValueTObjectL<TInt>( TMPXAttribute( KMPXCustomMessageId, |
|
2611 EMPXCustomMessageErrorCode ) ); |
|
2612 |
|
2613 MPX_DEBUG4("CMPXAppUi::DoHandleCollectionMessageL -- KMPXCustomMessageId \ |
|
2614 %i %i %i", colId, op, err); |
|
2615 |
|
2616 if( colId == iMusicCollectionId.iUid || |
|
2617 colId == iPodcastCollectionId.iUid ) |
|
2618 { |
|
2619 if( op == EMcsOpen ) |
|
2620 { |
|
2621 // @todo, need UI spec |
|
2622 // popup special error note for out of disk |
|
2623 iCommonUiHelper->HandleErrorL( err ); |
|
2624 } |
|
2625 } |
|
2626 } |
|
2627 else if ( KMPXMessageGeneral == id ) |
|
2628 { |
|
2629 TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) ); |
|
2630 TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) ); |
|
2631 TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) ); |
|
2632 |
|
2633 MPX_DEBUG3( "CMPXAppUi::DoHandleCollectionMessageL Event = %d, Type() = %d", |
|
2634 event, type ); |
|
2635 if ( event == TMPXCollectionMessage::ECollectionChanged && !SuppressCollectionView() ) |
|
2636 { |
|
2637 MPX_DEBUG1( "CMPXAppUi::DoHandleCollectionMessageL ECollectionChanged" ); |
|
2638 if ( EMPXLaunchModeTrack != MPXTlsHelper::LaunchMode() ) |
|
2639 { |
|
2640 CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL(); |
|
2641 CleanupStack::PushL( cPath ); |
|
2642 if ( cPath->Levels() != 1 ) |
|
2643 { |
|
2644 RArray<TUid> uids; |
|
2645 CleanupClosePushL( uids ); |
|
2646 if ( iLaunchModePlaying && EMPXLaunchModePlaylist == MPXTlsHelper::LaunchMode() ) |
|
2647 { |
|
2648 iLaunchModePlaying = EFalse; |
|
2649 cPath->SelectL(TMPXItemId(0)); |
|
2650 iCollectionUtility->Collection().OpenL( *cPath ); |
|
2651 } |
|
2652 else |
|
2653 { |
|
2654 uids.AppendL( TUid::Uid( KMPXPluginTypeCollectionUid ) ); |
|
2655 uids.AppendL( TUid::Uid( data ) ); |
|
2656 } |
|
2657 |
|
2658 // If transitioning from Now Playing to Collection view, |
|
2659 // We have to set the selection index |
|
2660 // Only applicable if path levels is > 2, ie not music / podcast menu |
|
2661 // |
|
2662 if( iCurrentViewType.iUid == KMPXPluginTypePlaybackUid ) |
|
2663 { |
|
2664 MMPXSource* s = iPlaybackUtility->Source(); |
|
2665 if( s && cPath->Levels() > 2 ) |
|
2666 { |
|
2667 CMPXCollectionPlaylist* pl = s->PlaylistL(); |
|
2668 TInt browsePathCount = cPath->Count(); |
|
2669 |
|
2670 if( pl ) |
|
2671 { |
|
2672 CleanupStack::PushL( pl ); |
|
2673 if( browsePathCount > 0 ) // don't set index since this playlist |
|
2674 // no longer contains any items, this can |
|
2675 // happen in the case of autoplaylists and cause |
|
2676 // a hang |
|
2677 { |
|
2678 TInt playlistIndex = pl->Path().Index(); |
|
2679 if(playlistIndex < browsePathCount) |
|
2680 { |
|
2681 iCollectionUtility->Collection().CommandL(EMcCmdSelect, |
|
2682 playlistIndex); |
|
2683 } |
|
2684 } |
|
2685 CleanupStack::PopAndDestroy( pl ); |
|
2686 } |
|
2687 } |
|
2688 } |
|
2689 |
|
2690 // Activate the collection view |
|
2691 MPX_DEBUG2( "CMPXAppUi::DoHandleCollectionMessageL cpath depth = %d", cPath->Levels() ); |
|
2692 // only activate collection view when it's not at plugin selection |
|
2693 // screen, it is handled by main view |
|
2694 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
2695 icollectionBrowsed = ETrue; |
|
2696 #endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
2697 iViewUtility->ActivateViewL( uids ); |
|
2698 CleanupStack::PopAndDestroy( &uids ); |
|
2699 } |
|
2700 CleanupStack::PopAndDestroy( cPath ); |
|
2701 } |
|
2702 } |
|
2703 else if ( event == TMPXCollectionMessage::EPathChanged && |
|
2704 !SuppressCollectionView() && |
|
2705 type == EMcPathChangedByOpen && |
|
2706 data == EMcItemOpened) |
|
2707 { // Open new entries |
|
2708 |
|
2709 MPX_DEBUG1( "CMPXAppUi::HandleCollectionMessageL EPathChanged EMcItemOpened" ); |
|
2710 |
|
2711 // First get media to check for protected state |
|
2712 RArray<TMPXAttribute> attrs; |
|
2713 CleanupClosePushL(attrs); |
|
2714 attrs.Append( TMPXAttribute( KMPXMediaIdGeneral, |
|
2715 EMPXMediaGeneralBasic | |
|
2716 EMPXMediaGeneralUri )); |
|
2717 |
|
2718 attrs.Append( TMPXAttribute( KMPXMediaIdDrm, |
|
2719 EMPXMediaDrmType | |
|
2720 EMPXMediaDrmProtected )); |
|
2721 CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL(); |
|
2722 CleanupStack::PushL( cPath ); |
|
2723 if( cPath->Count() > 0 ) |
|
2724 { |
|
2725 iCollectionUtility->Collection().MediaL( |
|
2726 *cPath, |
|
2727 attrs.Array() ); |
|
2728 } |
|
2729 else |
|
2730 { |
|
2731 // OpenL the blank playlist |
|
2732 iCollectionUtility->Collection().OpenL(); |
|
2733 } |
|
2734 // do not change launch mode if track mode, required for saving file |
|
2735 if ( EMPXLaunchModeTrack != MPXTlsHelper::LaunchMode() ) |
|
2736 { |
|
2737 // Default start up state for local playback is Playing |
|
2738 MPXTlsHelper::SetLaunchModeL( EMPXLaunchModePlaying ); |
|
2739 } |
|
2740 CleanupStack::PopAndDestroy( cPath ); |
|
2741 CleanupStack::PopAndDestroy( &attrs ); |
|
2742 } |
|
2743 else if( event == TMPXCollectionMessage::EPathChanged && |
|
2744 !SuppressCollectionView() && |
|
2745 type == EMcPathChangedByOpen && |
|
2746 data == EMcContainerOpened && |
|
2747 ( iCurrentViewType.iUid == KMPXPluginTypePlaybackUid || |
|
2748 iCurrentViewType.iUid == KMPXPluginTypeEmbeddedPlaybackUid || |
|
2749 iCurrentViewType.iUid == KMPXPluginTypeAudioEffectsUid || |
|
2750 iCurrentViewType.iUid == KMPXPluginTypeEqualizerUid) ) |
|
2751 { |
|
2752 MPX_DEBUG1( "CMPXAppUi::HandleCollectionMessageL EPathChanged EMcContainerOpened" ); |
|
2753 CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL(); |
|
2754 CleanupStack::PushL( cPath ); |
|
2755 |
|
2756 TInt levels( cPath->Levels() ); |
|
2757 if ( levels != 1 ) |
|
2758 { |
|
2759 iDeferredViewActivationUid.Reset(); |
|
2760 if ( iLaunchModePlaying && EMPXLaunchModePlaylist == MPXTlsHelper::LaunchMode() ) |
|
2761 { |
|
2762 iLaunchModePlaying = EFalse; |
|
2763 cPath->SelectL(TMPXItemId(0)); |
|
2764 iCollectionUtility->Collection().OpenL( *cPath ); |
|
2765 } |
|
2766 else |
|
2767 { |
|
2768 iDeferredViewActivationUid.AppendL( TUid::Uid( KMPXPluginTypeCollectionUid ) ); |
|
2769 iDeferredViewActivationUid.AppendL( TUid::Uid( data ) ); |
|
2770 } |
|
2771 // add the collection uid to make sure the correct view is |
|
2772 // activated |
|
2773 if ( levels > 0 ) |
|
2774 { |
|
2775 iDeferredViewActivationUid.AppendL( TUid::Uid( cPath->Id( 0 ) ) ); |
|
2776 } |
|
2777 |
|
2778 // Set selection to playlist index if transitioning from |
|
2779 // playback to collection view |
|
2780 // Only applicable if path levels is > 2, ie not music / podcast menu |
|
2781 // |
|
2782 MMPXSource* s = iPlaybackUtility->Source(); |
|
2783 if( s && levels > 2 ) |
|
2784 { |
|
2785 CMPXCollectionPlaylist* pl = s->PlaylistL(); |
|
2786 TInt browsePathCount = cPath->Count(); |
|
2787 |
|
2788 // don't set index since this playlist |
|
2789 // no longer contains any items, this can |
|
2790 // happen in the case of autoplaylists and cause |
|
2791 // a hang |
|
2792 // |
|
2793 // Make sure we are the same level and the same container before making index call |
|
2794 // |
|
2795 if( pl ) |
|
2796 { |
|
2797 CleanupStack::PushL( pl ); |
|
2798 if ( browsePathCount > 0 && |
|
2799 levels == pl->Path().Levels() && |
|
2800 cPath->Id(levels-2) == pl->Path().Id(levels-2) ) |
|
2801 { |
|
2802 TInt playlistIndex = pl->Path().Index(); |
|
2803 |
|
2804 if(playlistIndex < browsePathCount) |
|
2805 { |
|
2806 iCollectionUtility->Collection().CommandL(EMcCmdSelect, |
|
2807 playlistIndex); |
|
2808 } |
|
2809 } |
|
2810 CleanupStack::PopAndDestroy( pl ); |
|
2811 } |
|
2812 } |
|
2813 |
|
2814 MPX_DEBUG2( "CMPXAppUi::HandleCollectionMessageL cpath depth = %d", cPath->Levels() ); |
|
2815 if ( IsForeground() ) |
|
2816 { |
|
2817 MPX_DEBUG3( "CMPXAppUi::HandleCollectionMessageL Activating view now CurUid=0x%x, DefUid=0x%x", iCurrentViewType.iUid, iDeferredViewActivationUid[iDeferredViewActivationUid.Count()-1].iUid); |
|
2818 // only activate collection view when it's not at plugin selection |
|
2819 // screen, it is handled by main view |
|
2820 iViewUtility->ActivateViewL( iDeferredViewActivationUid ); |
|
2821 iDeferredViewActivationUid.Reset(); |
|
2822 } |
|
2823 else |
|
2824 { |
|
2825 MPX_DEBUG1( "CMPXAppUi::HandleCollectionMessageL musicplayer in background, deferred view activation" ); |
|
2826 } |
|
2827 } |
|
2828 CleanupStack::PopAndDestroy( cPath ); |
|
2829 } |
|
2830 |
|
2831 else if( event == TMPXCollectionMessage::EPathChanged && |
|
2832 type == EMcPathChangedByOpen && |
|
2833 data == EMcContainerOpened ) |
|
2834 { |
|
2835 MPXTlsHelper::SetLaunchModeL( EMPXLaunchModePlaying ); |
|
2836 CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL(); |
|
2837 CleanupStack::PushL( cPath ); |
|
2838 |
|
2839 if ( cPath->Levels() == 1 && !IsEmbedded() && |
|
2840 iCurrentViewType.iUid != KMPXPluginTypeMainUid && |
|
2841 iCurrentViewType.iUid != KMPXPluginTypeWaitNoteDialogUid && |
|
2842 !SuppressCollectionView() ) |
|
2843 { |
|
2844 // activate main view if other clients navigated to first level |
|
2845 if ( IsForeground() ) |
|
2846 { |
|
2847 MPX_DEBUG1( "CMPXAppUi::HandleCollectionMessageL Switching to main view" ); |
|
2848 iViewUtility->ActivateViewL( |
|
2849 TUid::Uid( KMPXPluginTypeMainUid ) ); |
|
2850 } |
|
2851 else |
|
2852 { |
|
2853 MPX_DEBUG1( "CMPXAppUi::HandleCollectionMessageL musicplayer in background, deferred view activation" ); |
|
2854 iDeferredViewActivationUid.Reset(); |
|
2855 iDeferredViewActivationUid.Append( TUid::Uid( KMPXPluginTypeMainUid ) ); |
|
2856 } |
|
2857 } |
|
2858 |
|
2859 TInt level(2); |
|
2860 if ( iStartInAlbumMenu ) |
|
2861 { |
|
2862 level = 3; |
|
2863 } |
|
2864 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
2865 // Music Player opens directly at level 2 so we need to initialize |
|
2866 // the path then |
|
2867 if( cPath->Levels() == level && iPathRestore && !iPathRestore->Initialized() && !iStandAlone ) |
|
2868 #else |
|
2869 if( cPath->Levels() == 1 && iPathRestore && !iPathRestore->Initialized() ) |
|
2870 #endif |
|
2871 { |
|
2872 if ( iProcessParameter ) |
|
2873 { |
|
2874 if ( !iProcessParameter->IsPathInited() ) |
|
2875 { |
|
2876 MPX_DEBUG1( "CMPXAppUi::HandleCollectionMessageL load path" ); |
|
2877 iPathRestore->LoadPathL(); |
|
2878 } |
|
2879 else |
|
2880 { |
|
2881 MPX_DEBUG1( "CMPXAppUi::HandleCollectionMessageL path inited by command handler, not restore path" ); |
|
2882 } |
|
2883 } |
|
2884 else |
|
2885 { |
|
2886 MPX_DEBUG1( "CMPXAppUi::HandleCollectionMessageL load path" ); |
|
2887 iPathRestore->LoadPathL(); |
|
2888 } |
|
2889 } |
|
2890 else if ( iCurrentIndex != KErrNotFound ) |
|
2891 { |
|
2892 iCollectionUtility->Collection().CommandL( EMcCmdSelect, iCurrentIndex ); |
|
2893 iCurrentIndex = KErrNotFound; |
|
2894 iCollectionUtility->Collection().OpenL(); |
|
2895 } |
|
2896 CleanupStack::PopAndDestroy( cPath ); |
|
2897 } |
|
2898 |
|
2899 else if( event == TMPXCollectionMessage::EBroadcastEvent ) |
|
2900 { |
|
2901 HandleBroadcastMessageL( aMessage ); |
|
2902 } |
|
2903 } |
|
2904 } |
|
2905 |
|
2906 // ----------------------------------------------------------------------------- |
|
2907 // CMPXAppUi::IsPlaybackRemote |
|
2908 // ----------------------------------------------------------------------------- |
|
2909 // |
|
2910 TBool CMPXAppUi::IsPlaybackRemote() |
|
2911 { |
|
2912 TBool isRemote = EFalse; |
|
2913 |
|
2914 TMPXPlaybackPlayerType type( EPbLocal ); |
|
2915 TUid uid; |
|
2916 TInt index; |
|
2917 MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager(); |
|
2918 HBufC* subPlayerName = NULL; |
|
2919 TRAP_IGNORE( manager.GetSelectionL( type, uid, index, subPlayerName ) ); |
|
2920 delete subPlayerName; |
|
2921 |
|
2922 //#ifdef __UPNP_FRAMEWORK_2_0_ |
|
2923 if ( FeatureManager::FeatureSupported( KFeatureIdUpnpFramework20 ) ) |
|
2924 { |
|
2925 // Check for Remote, since in embedded mode |
|
2926 // playback utility will report type as Unknown. |
|
2927 if ( type == EPbRemote ) |
|
2928 { |
|
2929 isRemote = ETrue; |
|
2930 } |
|
2931 } |
|
2932 |
|
2933 //#endif //__UPNP_FRAMEWORK_2_0_ |
|
2934 |
|
2935 return isRemote; |
|
2936 } |
|
2937 |
|
2938 // ----------------------------------------------------------------------------- |
|
2939 // CMPXAppUi::SetMediaL |
|
2940 // ----------------------------------------------------------------------------- |
|
2941 // |
|
2942 void CMPXAppUi::SetMediaL( CMPXMedia& aMedia ) |
|
2943 { |
|
2944 // Set to collection |
|
2945 CMPXCommand* cmd( CMPXCommand::NewL() ); |
|
2946 CleanupStack::PushL( cmd ); |
|
2947 cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet ); |
|
2948 cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); |
|
2949 TUid colId( aMedia.ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId)); |
|
2950 cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, colId.iUid ); |
|
2951 cmd->SetCObjectValueL<CMPXMedia>( KMPXCommandColSetMedia, &aMedia ); |
|
2952 iCollectionUtility->Collection().CommandL( *cmd ); |
|
2953 CleanupStack::PopAndDestroy( cmd ); |
|
2954 } |
|
2955 |
|
2956 // --------------------------------------------------------------------------- |
|
2957 // Handle Custom messages from the collection |
|
2958 // --------------------------------------------------------------------------- |
|
2959 // |
|
2960 void CMPXAppUi::HandleCollectionMessage( CMPXMessage* aMessage, TInt aError ) |
|
2961 { |
|
2962 if ( aError == KErrNone && aMessage ) |
|
2963 { |
|
2964 TRAP_IGNORE( DoHandleCollectionMessageL( *aMessage ) ) |
|
2965 } |
|
2966 } |
|
2967 |
|
2968 // --------------------------------------------------------------------------- |
|
2969 // From MMPXCollectionObserver. |
|
2970 // Handles the collection entries being opened. |
|
2971 // --------------------------------------------------------------------------- |
|
2972 // |
|
2973 void CMPXAppUi::HandleOpenL( |
|
2974 const CMPXMedia& /* aEntries */, |
|
2975 TInt /* aIndex */, |
|
2976 TBool /* aComplete */, |
|
2977 TInt aError ) |
|
2978 { |
|
2979 if ( aError != KErrNone ) |
|
2980 { |
|
2981 // Clip the collection path to root level and reopen |
|
2982 // This could happen after a USB refresh event where the |
|
2983 // item no longer exists |
|
2984 // |
|
2985 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
2986 CleanupStack::PushL( path ); |
|
2987 while( path->Levels() > 1) |
|
2988 { |
|
2989 path->Back(); |
|
2990 } |
|
2991 iCollectionUtility->Collection().OpenL( *path ); |
|
2992 CleanupStack::PopAndDestroy( path ); |
|
2993 } |
|
2994 } |
|
2995 |
|
2996 |
|
2997 // --------------------------------------------------------------------------- |
|
2998 // From MMPXCollectionObserver. |
|
2999 // Handles the item being opened. |
|
3000 // --------------------------------------------------------------------------- |
|
3001 // |
|
3002 void CMPXAppUi::HandleOpenL( |
|
3003 const CMPXCollectionPlaylist& aPlaylist, |
|
3004 TInt aError ) |
|
3005 { |
|
3006 MPX_FUNC("CMPXAppUi::HandleOpenL()"); |
|
3007 if ( KErrNone == aError ) |
|
3008 { |
|
3009 if( !IsEmbedded() ) |
|
3010 { |
|
3011 TInt count ( aPlaylist.Count() ) ; |
|
3012 |
|
3013 // temporarily disable repeat and shuffle if playlist |
|
3014 // is a podcast playlist and the list is not empty. |
|
3015 if(KMPXUidPodcastDBPlugin == TUid::Uid((TInt)aPlaylist.Path().Id(0))) |
|
3016 { |
|
3017 if(count > 0) |
|
3018 { |
|
3019 CMPXCollectionPlaylist* tmpPlaylist = |
|
3020 CMPXCollectionPlaylist::NewL( aPlaylist ); |
|
3021 CleanupStack::PushL( tmpPlaylist ); |
|
3022 tmpPlaylist->SetRepeatEnabled( EFalse ); |
|
3023 tmpPlaylist->SetShuffleEnabledL( EFalse ); |
|
3024 iPlaybackUtility->InitL( *tmpPlaylist, ETrue ); |
|
3025 CleanupStack::PopAndDestroy( tmpPlaylist ); |
|
3026 } |
|
3027 else |
|
3028 { |
|
3029 // Empty now playing |
|
3030 // |
|
3031 CMPXCollectionPlaylist* tmpPlaylist = |
|
3032 CMPXCollectionPlaylist::NewL( aPlaylist ); |
|
3033 CleanupStack::PushL( tmpPlaylist ); |
|
3034 tmpPlaylist->SetRepeatEnabled( EFalse ); |
|
3035 tmpPlaylist->SetShuffleEnabledL( EFalse ); |
|
3036 iPlaybackUtility->InitL( *tmpPlaylist, ETrue ); |
|
3037 |
|
3038 RArray<TUid> array; |
|
3039 CleanupClosePushL( array ); |
|
3040 |
|
3041 CMPXCollectionPath* pbPath = |
|
3042 CMPXCollectionPath::NewL( tmpPlaylist->Path() ); |
|
3043 CleanupStack::PushL( pbPath ); |
|
3044 if ( pbPath->Levels() > 0 ) |
|
3045 { |
|
3046 array.AppendL( TUid::Uid( pbPath->Id( 0 ) ) ); |
|
3047 } |
|
3048 CleanupStack::PopAndDestroy( pbPath ); |
|
3049 |
|
3050 array.AppendL( KLocalPlaybackUid ); |
|
3051 |
|
3052 if ( IsEmbedded() ) |
|
3053 { |
|
3054 array.AppendL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid )); |
|
3055 } |
|
3056 else |
|
3057 { |
|
3058 array.AppendL( TUid::Uid( KMPXPluginTypePlaybackUid ) ); |
|
3059 } |
|
3060 iViewUtility->ActivateViewL( array ); |
|
3061 CleanupStack::PopAndDestroy( &array ); |
|
3062 CleanupStack::PopAndDestroy( tmpPlaylist ); |
|
3063 } |
|
3064 } |
|
3065 else |
|
3066 { |
|
3067 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
3068 if ( iPdParameterHandler && !iPdParameterHandler->IsPlaybackCompleted()) |
|
3069 { |
|
3070 iPdParameterHandler->HandleCommandL(EPbCmdPause); |
|
3071 } |
|
3072 #endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
3073 if ( count > 0 ) |
|
3074 { |
|
3075 iPlaybackUtility->InitL( aPlaylist, ETrue ); |
|
3076 } |
|
3077 else if( count == 0 && |
|
3078 iPathRestore->Initialized() ) |
|
3079 { |
|
3080 // Empty now playing |
|
3081 // |
|
3082 iPlaybackUtility->InitL( aPlaylist, EFalse ); |
|
3083 |
|
3084 RArray<TUid> array; |
|
3085 CleanupClosePushL( array ); |
|
3086 |
|
3087 CMPXCollectionPath* pbPath = |
|
3088 CMPXCollectionPath::NewL( aPlaylist.Path() ); |
|
3089 CleanupStack::PushL( pbPath ); |
|
3090 if ( pbPath->Levels() > 0 ) |
|
3091 { |
|
3092 array.AppendL( TUid::Uid( pbPath->Id( 0 ) ) ); |
|
3093 } |
|
3094 CleanupStack::PopAndDestroy( pbPath ); |
|
3095 |
|
3096 if ( IsEmbedded() ) |
|
3097 { |
|
3098 array.AppendL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid )); |
|
3099 } |
|
3100 else |
|
3101 { |
|
3102 array.AppendL( TUid::Uid( KMPXPluginTypePlaybackUid ) ); |
|
3103 } |
|
3104 iViewUtility->ActivateViewL( array ); |
|
3105 CleanupStack::PopAndDestroy( &array ); |
|
3106 } |
|
3107 } |
|
3108 // ETrue->initialize next song concurrently |
|
3109 } |
|
3110 else |
|
3111 { |
|
3112 // aPlaylist is const, must copy |
|
3113 // |
|
3114 CMPXCollectionPlaylist* tmp = |
|
3115 CMPXCollectionPlaylist::NewL( aPlaylist ); |
|
3116 CleanupStack::PushL( tmp ); |
|
3117 tmp->SetEmbeddedPlaylist( ETrue ); |
|
3118 tmp->SetRepeatEnabled( EFalse ); |
|
3119 tmp->SetShuffleEnabledL( EFalse ); |
|
3120 iPlaybackUtility->InitL( *tmp, ETrue ); |
|
3121 CleanupStack::PopAndDestroy( tmp ); |
|
3122 } |
|
3123 } |
|
3124 } |
|
3125 |
|
3126 // --------------------------------------------------------------------------- |
|
3127 // From MMPXCHelperEmbeddedOpenObserver |
|
3128 // Handles OpenL from that occured in embedded mode |
|
3129 // --------------------------------------------------------------------------- |
|
3130 // |
|
3131 void CMPXAppUi::HandleEmbeddedOpenL( TInt aErr, TMPXGeneralCategory aCategory ) |
|
3132 { |
|
3133 MPX_FUNC( "CMPXAppUi::HandleEmbeddedOpenL" ); |
|
3134 if( aErr != KErrNone ) |
|
3135 { |
|
3136 iCommonUiHelper->HandleErrorL( aErr ); |
|
3137 |
|
3138 // Kill MPX |
|
3139 RunAppShutter(); |
|
3140 } |
|
3141 else // No error, set the launch mode |
|
3142 { |
|
3143 iPlaybackUtility->CommandL( EPbCmdDisableEffect ); |
|
3144 if( aCategory == EMPXPlaylist ) |
|
3145 { |
|
3146 if ( MPXTlsHelper::LaunchMode() == EMPXLaunchModePlaying ) |
|
3147 { |
|
3148 iLaunchModePlaying = ETrue; |
|
3149 } |
|
3150 MPXTlsHelper::SetLaunchModeL( EMPXLaunchModePlaylist ); |
|
3151 } |
|
3152 else // ( aCategory == EMPXSong ) |
|
3153 { |
|
3154 MPXTlsHelper::SetLaunchModeL( EMPXLaunchModeTrack ); |
|
3155 iViewUtility->ActivateViewL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid )); |
|
3156 } |
|
3157 } |
|
3158 } |
|
3159 |
|
3160 // --------------------------------------------------------------------------- |
|
3161 // From MMPXViewActivationObserver. |
|
3162 // Handle view activation. |
|
3163 // --------------------------------------------------------------------------- |
|
3164 // |
|
3165 void CMPXAppUi::HandleViewActivation( |
|
3166 const TUid& aCurrentViewType, |
|
3167 const TUid& aPreviousViewType ) |
|
3168 { |
|
3169 MPX_FUNC( "CMPXAppUi::HandleViewActivation" ); |
|
3170 MPX_DEBUG3("CurrentViewType=0x%x, PreviousViewType=0x%x", aCurrentViewType.iUid, aPreviousViewType.iUid); |
|
3171 iCurrentViewType = aCurrentViewType; |
|
3172 iPreviousViewType = aPreviousViewType; |
|
3173 iDeferredViewActivationUid.Reset(); |
|
3174 |
|
3175 switch ( aCurrentViewType.iUid ) |
|
3176 { |
|
3177 case KMPXPluginTypePlaybackUid: |
|
3178 { |
|
3179 if ( IsForeground() ) |
|
3180 { |
|
3181 iMediaKeyHandler->DismissNotifier( EDisplayMediaPopup ); |
|
3182 } |
|
3183 break; |
|
3184 } |
|
3185 |
|
3186 case KMPXPluginTypeCollectionUid: |
|
3187 { |
|
3188 if (iRefreshCollectionView ) |
|
3189 { |
|
3190 iRefreshCollectionView = EFalse; |
|
3191 TRAP_IGNORE(ReOpenPathL()); |
|
3192 } |
|
3193 break; |
|
3194 } |
|
3195 default: |
|
3196 { |
|
3197 // Do nothing |
|
3198 break; |
|
3199 } |
|
3200 } |
|
3201 } |
|
3202 |
|
3203 // --------------------------------------------------------------------------- |
|
3204 // From CEikAppUi. |
|
3205 // Opens the specified file |
|
3206 // --------------------------------------------------------------------------- |
|
3207 // |
|
3208 void CMPXAppUi::HandleViewUpdate( |
|
3209 TUid /* aViewUid */, |
|
3210 MMPXViewActivationObserver::TViewUpdateEvent /* aUpdateEvent */, |
|
3211 TBool /* aLoaded */, |
|
3212 TInt /* aData */) |
|
3213 { |
|
3214 MPX_FUNC( "CMPXAppUi::HandleViewUpdate" ); |
|
3215 } |
|
3216 |
|
3217 // --------------------------------------------------------------------------- |
|
3218 // From CEikAppUi. |
|
3219 // Opens the specified file |
|
3220 // --------------------------------------------------------------------------- |
|
3221 // |
|
3222 void CMPXAppUi::OpenFileL( const TDesC& aFileName ) |
|
3223 { |
|
3224 MPX_FUNC( "CMPXAppUi::OpenFileL" ); |
|
3225 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
3226 if ( iPdParameterHandler ) |
|
3227 { |
|
3228 // no need to open file at this time. |
|
3229 return; |
|
3230 } |
|
3231 #endif //RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
3232 if ( IsEmbedded() ) |
|
3233 { |
|
3234 CreateMemberVariablesL(); |
|
3235 |
|
3236 iViewUtility->PreLoadViewL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid )); |
|
3237 // Open file with collection helper |
|
3238 iCollectionUiHelper->OpenL( MPXTlsHelper::HostUid(), |
|
3239 aFileName, this, |
|
3240 EMPXCollectionPluginMusic ); |
|
3241 } |
|
3242 else |
|
3243 { |
|
3244 |
|
3245 MPX_DEBUG1( "CMPXAppUi::OpenFileL Standalone" ); |
|
3246 TDataType datatype( TUid::Uid( KMusicPlayerAppUidConstant ) ); |
|
3247 iDocHandler->OpenTempFileL( aFileName, iFile ); |
|
3248 |
|
3249 CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(); |
|
3250 TMPXLaunchMode mode( EMPXLaunchModeStopped ); |
|
3251 TAiwVariant value( mode ); |
|
3252 TAiwGenericParam param( EGenericParamPlayerInitMode, value ); |
|
3253 paramList->AppendL( param ); // Takes ownership |
|
3254 |
|
3255 TRAPD( err, iDocHandler->OpenFileEmbeddedL( iFile, datatype, *paramList )); |
|
3256 |
|
3257 // |
|
3258 // ignore some document handler errors |
|
3259 // |
|
3260 if ( err == KErrServerTerminated ) |
|
3261 { |
|
3262 // |
|
3263 // Document handler leaves with -15 if end key is pressed when |
|
3264 // embedded application is not fully started or embedded |
|
3265 // application panics in start up. So we can only close the |
|
3266 // App in this point and hope that user is press end key |
|
3267 // |
|
3268 HandleCommandL( EEikCmdExit ); |
|
3269 } |
|
3270 else if ( err != KErrNone ) |
|
3271 { |
|
3272 // Reset error since it was handled here and |
|
3273 // the program will exit |
|
3274 // |
|
3275 User::Leave( err ); |
|
3276 } |
|
3277 |
|
3278 CleanupStack::PopAndDestroy(paramList); |
|
3279 MPX_DEBUG1( "CMPXAppUi::OpenFileL Register as callback for exit" ); |
|
3280 iDocHandler->SetExitObserver(this); |
|
3281 |
|
3282 iStandAlone = ETrue; |
|
3283 |
|
3284 } |
|
3285 } |
|
3286 |
|
3287 // --------------------------------------------------------------------------- |
|
3288 // From CCoeAppUi. |
|
3289 // Handle foreground event. |
|
3290 // --------------------------------------------------------------------------- |
|
3291 // |
|
3292 void CMPXAppUi::HandleForegroundEventL( |
|
3293 TBool aForeground ) |
|
3294 { |
|
3295 MPX_FUNC_EX( "CMPXAppUi::HandleForegroundEventL" ); |
|
3296 |
|
3297 if ( !aForeground ) |
|
3298 { |
|
3299 // music player is going to background |
|
3300 // set key repeat rate to normal avkon rate |
|
3301 CEikonEnv::Static()->WsSession().SetKeyboardRepeatRate( |
|
3302 KAknKeyboardRepeatInitialDelay, KAknStandardKeyboardRepeatRate ); |
|
3303 CEikonEnv::Static()->WsSession().Flush(); |
|
3304 } |
|
3305 |
|
3306 // Dismiss playback popup if foreground app is active idle or playback |
|
3307 // view is on foreground |
|
3308 if ( ( !aForeground && IsActiveIdleEnabled() && IsIdleAppForeground() ) |
|
3309 || ( aForeground |
|
3310 && ( KMPXPluginTypePlaybackUid == iCurrentViewType.iUid ) ) ) |
|
3311 { |
|
3312 iMediaKeyHandler->DismissNotifier( EDisplayMediaPopup ); |
|
3313 } |
|
3314 |
|
3315 if ( aForeground && iDeferredViewActivationUid.Count() != 0 ) |
|
3316 { |
|
3317 MPX_DEBUG1( "CMPXAppUi::HandleForegroundEventL deferred view activation, activating" ); |
|
3318 iViewUtility->ActivateViewL( iDeferredViewActivationUid ); |
|
3319 iDeferredViewActivationUid.Reset(); |
|
3320 } |
|
3321 |
|
3322 CAknViewAppUi::HandleForegroundEventL( aForeground ); |
|
3323 } |
|
3324 |
|
3325 // --------------------------------------------------------------------------- |
|
3326 // From CEikAppUi. |
|
3327 // Owerwritten -> file opening |
|
3328 // (app startup via shell commands) |
|
3329 // --------------------------------------------------------------------------- |
|
3330 // |
|
3331 TBool CMPXAppUi::ProcessCommandParametersL( |
|
3332 TApaCommand /*aCommand*/, |
|
3333 TFileName& aDocumentName, |
|
3334 const TDesC8& /*aTail*/ ) |
|
3335 { |
|
3336 MPX_FUNC_EX( "CMPXAppUi::ProcessCommandParametersL TApaCommand" ); |
|
3337 return ConeUtils::FileExists( aDocumentName ); |
|
3338 } |
|
3339 |
|
3340 |
|
3341 // --------------------------------------------------------------------------- |
|
3342 // Launch matrix menu suite with specific message |
|
3343 // --------------------------------------------------------------------------- |
|
3344 // |
|
3345 void CMPXAppUi::LaunchMmViewL( const TDesC8& aMessage ) |
|
3346 { |
|
3347 TApaTaskList taskList( iCoeEnv->WsSession() ); |
|
3348 TApaTask task = taskList.FindApp( TUid::Uid( KMmUid3 ) ); |
|
3349 |
|
3350 if ( task.Exists() ) |
|
3351 { |
|
3352 task.SendMessage( TUid::Uid( KUidApaMessageSwitchOpenFileValue ), |
|
3353 aMessage ); |
|
3354 } |
|
3355 } |
|
3356 |
|
3357 // --------------------------------------------------------------------------- |
|
3358 // From CEikAppUi. |
|
3359 // Handle commands. |
|
3360 // --------------------------------------------------------------------------- |
|
3361 // |
|
3362 void CMPXAppUi::HandleCommandL( |
|
3363 TInt aCommand ) |
|
3364 { |
|
3365 MPX_FUNC( "CMPXAppUi::HandleCommandL" ); |
|
3366 TMPXPlaybackCommand cmd = EPbCmdEnd; |
|
3367 switch ( aCommand ) |
|
3368 { |
|
3369 case EMPXCmdPlay: |
|
3370 case EMPXCmdPause: |
|
3371 case EMPXCmdPlayPause: |
|
3372 case EMPXCmdStop: |
|
3373 case EMPXCmdNext: |
|
3374 case EMPXCmdPrevious: |
|
3375 case EMPXCmdSeekForward: |
|
3376 case EMPXCmdSeekBackward: |
|
3377 case EMPXCmdStopSeeking: |
|
3378 { |
|
3379 switch ( aCommand ) |
|
3380 { |
|
3381 case EMPXCmdPlay: |
|
3382 cmd = EPbCmdPlay; |
|
3383 break; |
|
3384 case EMPXCmdPause: |
|
3385 cmd = EPbCmdPause; |
|
3386 break; |
|
3387 case EMPXCmdPlayPause: |
|
3388 cmd = EPbCmdPlayPause; |
|
3389 break; |
|
3390 case EMPXCmdStop: |
|
3391 cmd = EPbCmdStop; |
|
3392 break; |
|
3393 case EMPXCmdNext: |
|
3394 cmd = EPbCmdNext; |
|
3395 break; |
|
3396 case EMPXCmdPrevious: |
|
3397 cmd = EPbCmdPrevious; |
|
3398 break; |
|
3399 case EMPXCmdSeekForward: |
|
3400 cmd = EPbCmdStartSeekForward; |
|
3401 break; |
|
3402 case EMPXCmdSeekBackward: |
|
3403 cmd = EPbCmdStartSeekBackward; |
|
3404 break; |
|
3405 case EMPXCmdStopSeeking: |
|
3406 cmd = EPbCmdStopSeeking; |
|
3407 break; |
|
3408 default: |
|
3409 break; |
|
3410 } |
|
3411 DoHandleMediaKeyCommandL( cmd ); |
|
3412 break; |
|
3413 } |
|
3414 case EMPXCmdGoToNowPlaying: |
|
3415 { |
|
3416 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
3417 |
|
3418 TBool pdPlaybackCompleted(EFalse); |
|
3419 if ( iPdParameterHandler ) |
|
3420 { |
|
3421 pdPlaybackCompleted = iPdParameterHandler->IsPlaybackCompleted(); |
|
3422 if ( pdPlaybackCompleted ) |
|
3423 { |
|
3424 delete iPdParameterHandler; |
|
3425 iPdParameterHandler = NULL; |
|
3426 } |
|
3427 } |
|
3428 |
|
3429 MMPXPlaybackUtility* activePlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer ); |
|
3430 |
|
3431 |
|
3432 MMPXSource* source = activePlaybackUtility->Source(); |
|
3433 CMPXCollectionPlaylist* pl = NULL; |
|
3434 if( source ) |
|
3435 { |
|
3436 CMPXCollectionPlaylist* pl = source->PlaylistL(); |
|
3437 if (pl) |
|
3438 { |
|
3439 CleanupStack::PushL( pl ); |
|
3440 const CMPXCollectionPath& path = pl->Path(); |
|
3441 if(path.Levels() > 0) |
|
3442 { |
|
3443 //Fix for ou1cimx1#355699 Go to Now Playing view doesn’t work after application interaction |
|
3444 //If active player is KIMMusicPluginUid i.e. embedded player, we don't want use it because |
|
3445 //eventually plugin resolver resolves then wrong plugin. Instead of it get this instance's |
|
3446 //default playback utility |
|
3447 if ((TUid::Uid(path.Id(0)).iUid) == KIMMusicPluginUid) |
|
3448 { |
|
3449 source = NULL; |
|
3450 activePlaybackUtility->Close(); |
|
3451 activePlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault ); |
|
3452 } |
|
3453 } |
|
3454 CleanupStack::PopAndDestroy( pl ); |
|
3455 pl = NULL; |
|
3456 } |
|
3457 } |
|
3458 |
|
3459 TUid pluginUid( KNullUid ); |
|
3460 RArray<TUid> array; |
|
3461 CleanupClosePushL( array ); |
|
3462 |
|
3463 MMPXPlayer* player = |
|
3464 activePlaybackUtility->PlayerManager().CurrentPlayer(); |
|
3465 |
|
3466 if (!source) |
|
3467 { |
|
3468 source = activePlaybackUtility->Source(); |
|
3469 } |
|
3470 if( source ) |
|
3471 { |
|
3472 pl = source->PlaylistL(); |
|
3473 } |
|
3474 |
|
3475 if ( pl || !pdPlaybackCompleted ) |
|
3476 { |
|
3477 if (pl) |
|
3478 delete pl; |
|
3479 if ( player ) |
|
3480 { |
|
3481 array.AppendL( player->UidL() ); |
|
3482 if ( IsEmbedded() ) |
|
3483 { |
|
3484 array.AppendL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid ) ); |
|
3485 } |
|
3486 } |
|
3487 else |
|
3488 { |
|
3489 if ( IsEmbedded() ) |
|
3490 { |
|
3491 array.AppendL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid ) ); |
|
3492 } |
|
3493 else |
|
3494 { |
|
3495 array.AppendL( TUid::Uid( KMPXPluginTypePlaybackUid ) ); |
|
3496 } |
|
3497 } |
|
3498 |
|
3499 // add the collection plugin UID to ensure the correct |
|
3500 // last playback view is activated |
|
3501 //MMPXSource* source = activePlaybackUtility->Source(); |
|
3502 if( source ) |
|
3503 { |
|
3504 CMPXCollectionPlaylist* pl = source->PlaylistL(); |
|
3505 if (pl) |
|
3506 { |
|
3507 CleanupStack::PushL( pl ); |
|
3508 const CMPXCollectionPath& path = pl->Path(); |
|
3509 if(path.Levels() > 0) |
|
3510 { |
|
3511 array.AppendL(TUid::Uid(path.Id(0))); |
|
3512 } |
|
3513 CleanupStack::PopAndDestroy( pl ); |
|
3514 } |
|
3515 } |
|
3516 else if ( !iPathRestore->Initialized() ) |
|
3517 { |
|
3518 if ( iPathRestore->RooPathId() != KNullUid ) |
|
3519 { |
|
3520 array.AppendL( iPathRestore->RooPathId() ); |
|
3521 } |
|
3522 } |
|
3523 } |
|
3524 else |
|
3525 { |
|
3526 CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL(); |
|
3527 CleanupStack::PushL( cPath ); |
|
3528 |
|
3529 array.AppendL( TUid::Uid( KMPXPluginTypeCollectionUid ) ); |
|
3530 if ( cPath->Levels() > 0 ) |
|
3531 { |
|
3532 array.AppendL( TUid::Uid( cPath->Id( 0 ) ) ); |
|
3533 } |
|
3534 CleanupStack::PopAndDestroy( cPath ); |
|
3535 } |
|
3536 |
|
3537 if ( iAppStartedByBrowser && !icollectionBrowsed && pdPlaybackCompleted) |
|
3538 { |
|
3539 activePlaybackUtility->Close(); |
|
3540 CleanupStack::PopAndDestroy( &array ); |
|
3541 RunAppShutter(); |
|
3542 break; |
|
3543 } |
|
3544 else |
|
3545 { |
|
3546 activePlaybackUtility->Close(); |
|
3547 iViewUtility->ActivateViewL( array ); |
|
3548 CleanupStack::PopAndDestroy( &array ); |
|
3549 } |
|
3550 |
|
3551 break; |
|
3552 } |
|
3553 #else // RD_BROWSER_PROGRESSIVE_DOWNLOAD not supported |
|
3554 MMPXPlayer* player = |
|
3555 iPlaybackUtility->PlayerManager().CurrentPlayer(); |
|
3556 TUid pluginUid( KNullUid ); |
|
3557 RArray<TUid> array; |
|
3558 CleanupClosePushL( array ); |
|
3559 |
|
3560 if ( player ) |
|
3561 { |
|
3562 array.AppendL( player->UidL() ); |
|
3563 if ( IsEmbedded() ) |
|
3564 { |
|
3565 array.AppendL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid ) ); |
|
3566 } |
|
3567 } |
|
3568 else |
|
3569 { |
|
3570 if ( IsEmbedded() ) |
|
3571 { |
|
3572 array.AppendL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid ) ); |
|
3573 } |
|
3574 else |
|
3575 { |
|
3576 array.AppendL( TUid::Uid( KMPXPluginTypePlaybackUid ) ); |
|
3577 } |
|
3578 } |
|
3579 |
|
3580 // add the collection plugin UID to ensure the correct |
|
3581 // last playback view is activated |
|
3582 MMPXSource* source = iPlaybackUtility->Source(); |
|
3583 if( source ) |
|
3584 { |
|
3585 CMPXCollectionPlaylist* pl = source->PlaylistL(); |
|
3586 if (pl) |
|
3587 { |
|
3588 CleanupStack::PushL( pl ); |
|
3589 const CMPXCollectionPath& path = pl->Path(); |
|
3590 if(path.Levels() > 0) |
|
3591 { |
|
3592 array.AppendL(TUid::Uid(path.Id(0))); |
|
3593 } |
|
3594 CleanupStack::PopAndDestroy( pl ); |
|
3595 } |
|
3596 } |
|
3597 |
|
3598 iViewUtility->ActivateViewL( array ); |
|
3599 CleanupStack::PopAndDestroy( &array ); |
|
3600 break; |
|
3601 } |
|
3602 #endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
3603 |
|
3604 case EMPXCmdVolumeChanged: |
|
3605 cmd = EPbCmdSetVolume; |
|
3606 HandlePopupL(cmd); |
|
3607 break; |
|
3608 case EMPXCmdIgnoreExternalCommand: |
|
3609 { |
|
3610 iIgnoreExternalCommand = ETrue; |
|
3611 break; |
|
3612 } |
|
3613 case EMPXCmdHandleExternalCommand: |
|
3614 { |
|
3615 iIgnoreExternalCommand = EFalse; |
|
3616 break; |
|
3617 } |
|
3618 case EMPXCmdHideApp: |
|
3619 { |
|
3620 // Move Music Player to background |
|
3621 // magic: -1 = force wg to background |
|
3622 if ( !Layout_Meta_Data::IsLandscapeOrientation() ) |
|
3623 { |
|
3624 GfxTransEffect::BeginFullScreen( |
|
3625 AknTransEffect::EApplicationExit, |
|
3626 TRect(), |
|
3627 AknTransEffect::EParameterType, |
|
3628 AknTransEffect::GfxTransParam( KAppUidMusicPlayerX, |
|
3629 AknTransEffect::TParameter::EActivateExplicitCancel | |
|
3630 AknTransEffect::TParameter::EEndCheck ) ); |
|
3631 } |
|
3632 |
|
3633 iEikonEnv->RootWin().SetOrdinalPosition( -1 ); |
|
3634 break; |
|
3635 } |
|
3636 |
|
3637 case EAknSoftkeyBack: |
|
3638 { |
|
3639 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
3640 if ( iViewUtility->ViewHistoryDepth() == 1 || iAppStartedByBrowser ) |
|
3641 { |
|
3642 HandleCommandL( EEikCmdExit ); |
|
3643 } |
|
3644 |
|
3645 else if ( iPbvStartedByBrowser && !iAppStartedByBrowser ) |
|
3646 { |
|
3647 iPbvStartedByBrowser = EFalse; |
|
3648 |
|
3649 if( iPdParameterHandler ) |
|
3650 { |
|
3651 if( !( iPdParameterHandler->IsPlaybackCompleted() ) ) |
|
3652 { |
|
3653 |
|
3654 iPdParameterHandler->HandleCommandL( EPbCmdStop ); |
|
3655 } |
|
3656 iPdParameterHandler->HandleCommandL( EPbCmdClose ); |
|
3657 delete iPdParameterHandler; |
|
3658 iPdParameterHandler = NULL; |
|
3659 } |
|
3660 |
|
3661 iRefreshCollectionView = ETrue; |
|
3662 iViewUtility->ActivatePreviousViewL(); |
|
3663 BringUpBrowserL(); |
|
3664 } |
|
3665 |
|
3666 else if ( !iPdParameterHandler || !iAppStartedByBrowser ) |
|
3667 { |
|
3668 iViewUtility->ActivatePreviousViewL(); |
|
3669 } |
|
3670 |
|
3671 else |
|
3672 { |
|
3673 HandleCommandL( EEikCmdExit ); |
|
3674 } |
|
3675 #else |
|
3676 // if we're in top level of our local view stack, |
|
3677 // back command exits the app. otherwise activate |
|
3678 // the previous view in our local view stack |
|
3679 if ( iViewUtility->ViewHistoryDepth() == 1 ) |
|
3680 { |
|
3681 HandleCommandL( EEikCmdExit ); |
|
3682 } |
|
3683 else |
|
3684 { |
|
3685 iViewUtility->ActivatePreviousViewL(); |
|
3686 } |
|
3687 #endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
3688 break; |
|
3689 } |
|
3690 case EEikCmdExit: // fall through |
|
3691 case EAknCmdExit: |
|
3692 case EAknSoftkeyExit: |
|
3693 { |
|
3694 if ( iView && KMPXPluginTypeCollectionUid == iCurrentViewType.iUid ) |
|
3695 { |
|
3696 MPX_DEBUG2( "CMPXAppUi::HandleCommand() " |
|
3697 "sending EMPXCmdCancelReorder to view %d", |
|
3698 KMPXPluginTypeCollectionUid ); |
|
3699 iView->HandleCommandL( EMPXCmdCancelReorder ); |
|
3700 } |
|
3701 CloseWaitNoteL(); |
|
3702 |
|
3703 if( aCommand == EAknCmdExit || aCommand == EEikCmdExit ) |
|
3704 { |
|
3705 TKeyEvent key; |
|
3706 key.iCode = EKeyEscape; |
|
3707 key.iModifiers = 0; |
|
3708 |
|
3709 // Under EQ it is possible to have multiple dialogs open |
|
3710 TInt err( KErrNone ); |
|
3711 while( IsDisplayingDialog() && err == KErrNone ) |
|
3712 { |
|
3713 TRAP( err, iCoeEnv->SimulateKeyEventL(key,EEventKey); ) |
|
3714 } |
|
3715 } |
|
3716 |
|
3717 TBool needToExit( EFalse ); |
|
3718 if ( iSaveMode != EMPXSaveModeIdle ) |
|
3719 { |
|
3720 iCancelFileMan = ETrue; |
|
3721 } |
|
3722 else |
|
3723 { |
|
3724 if( iPathRestore ) |
|
3725 { |
|
3726 TRAP_IGNORE(iPathRestore->SavePathL()); |
|
3727 } |
|
3728 |
|
3729 if ( iPlaybackUtility ) |
|
3730 { |
|
3731 MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager(); |
|
3732 TRAP_IGNORE( manager.ClearSelectPlayersL() ); |
|
3733 iPlaybackUtility->CommandL( EPbCmdClose ); |
|
3734 } |
|
3735 needToExit = ETrue; |
|
3736 } |
|
3737 |
|
3738 |
|
3739 if( needToExit ) |
|
3740 { |
|
3741 Exit(); |
|
3742 } |
|
3743 break; |
|
3744 } |
|
3745 case EAknCmdHelp: |
|
3746 { |
|
3747 HlpLauncher::LaunchHelpApplicationL( |
|
3748 iEikonEnv->WsSession(), |
|
3749 AppHelpContextL() ); |
|
3750 break; |
|
3751 } |
|
3752 case EMPXCmdSaveAndReopen: |
|
3753 { |
|
3754 iCancelFileMan = EFalse; |
|
3755 iSaveMode = EMPXOpenAfterSave; |
|
3756 MPX_TRAPD( err, DoSaveL()); |
|
3757 if ( KErrNone != err ) |
|
3758 { |
|
3759 HandleSaveComplete( err ); |
|
3760 } |
|
3761 break; |
|
3762 } |
|
3763 case EMPXCmdIsFileSaved: |
|
3764 { |
|
3765 TFileName SavedAudioFile; |
|
3766 CreateAutomaticSavePathL( SavedAudioFile ); |
|
3767 break; |
|
3768 } |
|
3769 case EMPXCmdSaveForUseAsContact: |
|
3770 case EMPXCmdSaveForUseAsRingtone: |
|
3771 { |
|
3772 iCancelFileMan = EFalse; |
|
3773 ASSERT( iFile.SubSessionHandle() ); |
|
3774 TBool abort = EFalse; |
|
3775 TBool aiwExecuted = EFalse; |
|
3776 TFileName fullName; |
|
3777 iFile.FullName( fullName ); |
|
3778 TParsePtrC fileParse( fullName ); |
|
3779 TBool isPrivate = (fileParse.NamePresent() && |
|
3780 !KMPXMusicplayerPrivateFolder().CompareF( |
|
3781 fileParse.Path().Left( |
|
3782 KMPXMusicplayerPrivateFolder().Length()))); |
|
3783 TFileName savedFile; |
|
3784 CreateAutomaticSavePathL( savedFile ); |
|
3785 |
|
3786 |
|
3787 if ( isPrivate && !ConeUtils::FileExists( savedFile ) ) |
|
3788 { |
|
3789 HBufC* string( StringLoader::LoadLC( R_MPX_QUERY_CONF_SAVE_DOWNLOADED, |
|
3790 fileParse.Name() )); |
|
3791 CAknQueryDialog* confirmationDlg( CAknQueryDialog::NewL( |
|
3792 CAknQueryDialog::EConfirmationTone )); |
|
3793 if ( confirmationDlg->ExecuteLD( R_MPX_SAVE_SONG_CONFIRMATION_QUERY, |
|
3794 *string )) |
|
3795 { |
|
3796 // User wants to save the file and execute AIW function |
|
3797 if ( aCommand == EMPXCmdSaveForUseAsRingtone ) |
|
3798 { |
|
3799 iSaveMode = EMPXAssignRingtone; |
|
3800 } |
|
3801 else if ( aCommand == EMPXCmdSaveForUseAsContact ) |
|
3802 { |
|
3803 iSaveMode = EMPXAssignContact; |
|
3804 } |
|
3805 MPX_TRAPD( err, DoSaveL() ); |
|
3806 if ( KErrNone != err ) |
|
3807 { |
|
3808 HandleSaveComplete( err ); |
|
3809 } |
|
3810 abort = EFalse; |
|
3811 aiwExecuted = ETrue; |
|
3812 if ( iView ) |
|
3813 { |
|
3814 iView->HandleCommandL( EMPXCmdSaveComplete ); |
|
3815 } |
|
3816 } |
|
3817 else |
|
3818 { |
|
3819 if ( iView ) |
|
3820 { |
|
3821 iView->HandleCommandL( EMPXCmdSaveNotProgress ); |
|
3822 } |
|
3823 abort = ETrue; |
|
3824 } |
|
3825 CleanupStack::PopAndDestroy( string ); |
|
3826 } |
|
3827 else if ( ConeUtils::FileExists( savedFile ) ) |
|
3828 { |
|
3829 if ( iView ) |
|
3830 { |
|
3831 iView->HandleCommandL( EMPXCmdSaveNotProgress ); |
|
3832 } |
|
3833 MPXTlsHelper::SetFilePath( savedFile ); |
|
3834 } |
|
3835 |
|
3836 if ( !abort && !aiwExecuted && iView ) |
|
3837 { |
|
3838 if ( aCommand == EMPXCmdSaveForUseAsRingtone ) |
|
3839 { |
|
3840 TRAP_IGNORE( |
|
3841 iView->HandleCommandL( EMPXCmdAfterSaveAiwCmdAssign )); |
|
3842 } |
|
3843 else if ( aCommand == EMPXCmdSaveForUseAsContact ) |
|
3844 { |
|
3845 TRAP_IGNORE( |
|
3846 iView->HandleCommandL( EMPXCmdAfterSaveUseAsCascade )); |
|
3847 } |
|
3848 } |
|
3849 break; |
|
3850 } |
|
3851 case EMPXCmdSaveAndExit: // fall though |
|
3852 case EMPXCmdSaveAndExitHostApp: |
|
3853 { |
|
3854 iCancelFileMan = EFalse; |
|
3855 ASSERT( iFile.SubSessionHandle() ); |
|
3856 TFileName fullName; |
|
3857 iFile.FullName( fullName ); |
|
3858 TParsePtrC fileParse( fullName ); |
|
3859 HBufC* string( StringLoader::LoadLC( R_MPX_QUERY_CONF_SAVE_DOWNLOADED, |
|
3860 fileParse.Name() )); |
|
3861 CAknQueryDialog* confirmationDlg( CAknQueryDialog::NewL( |
|
3862 CAknQueryDialog::EConfirmationTone )); |
|
3863 //#ifdef __COVER_DISPLAY |
|
3864 confirmationDlg->PublishDialogL( |
|
3865 EMPlayerQueryNotSaved, |
|
3866 KMPlayerNoteCategory); |
|
3867 |
|
3868 CAknMediatorFacade* covercl( |
|
3869 AknMediatorFacade( confirmationDlg ) ); |
|
3870 if ( covercl ) |
|
3871 { |
|
3872 covercl->BufStream() << fileParse.Name(); |
|
3873 } |
|
3874 //#endif //__COVER_DISPLAY |
|
3875 |
|
3876 if ( confirmationDlg->ExecuteLD( R_MPX_SAVE_SONG_CONFIRMATION_QUERY, |
|
3877 *string )) |
|
3878 { |
|
3879 iSaveMode = ( aCommand == EMPXCmdSaveAndExit ? |
|
3880 EMPXExitAppAfterSave : EMPXExitHostAppAfterSave ); |
|
3881 MPX_TRAPD( err, DoSaveL() ); |
|
3882 if ( KErrNone != err ) |
|
3883 { |
|
3884 HandleSaveComplete( err ); |
|
3885 } |
|
3886 } |
|
3887 else |
|
3888 { |
|
3889 if ( aCommand == EMPXCmdSaveAndExit ) |
|
3890 { |
|
3891 RunAppShutter(); |
|
3892 } |
|
3893 else |
|
3894 { |
|
3895 // EMPXCmdSaveAndExitHostApp |
|
3896 CAknEnv::RunAppShutter(); |
|
3897 } |
|
3898 } |
|
3899 CleanupStack::PopAndDestroy( string ); |
|
3900 break; |
|
3901 } |
|
3902 case EAknCmdTaskSwapper: |
|
3903 { |
|
3904 // Handle command when Music Player is selected in Multitasker |
|
3905 // and Music Player is the foreground app. |
|
3906 break; |
|
3907 } |
|
3908 |
|
3909 case EMPXCmdGotoCollection: |
|
3910 { |
|
3911 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
3912 iPdPbvStartedByBrowser = EFalse; |
|
3913 icollectionBrowsed = ETrue; |
|
3914 #endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
3915 iStandAlone = EFalse; |
|
3916 |
|
3917 break; |
|
3918 } |
|
3919 |
|
3920 default: |
|
3921 { |
|
3922 // do nothing if the command is not reconized |
|
3923 MPX_DEBUG2( "CMPXAppUi::HandleCommandL unknown command 0x%x", aCommand ); |
|
3924 break; |
|
3925 } |
|
3926 } |
|
3927 } |
|
3928 |
|
3929 |
|
3930 // --------------------------------------------------------------------------- |
|
3931 // From CEikAppUi. |
|
3932 // Handle window server events. |
|
3933 // --------------------------------------------------------------------------- |
|
3934 // |
|
3935 void CMPXAppUi::HandleWsEventL( |
|
3936 const TWsEvent& aEvent, |
|
3937 CCoeControl* aDestination ) |
|
3938 { |
|
3939 MPX_FUNC_EX( "CMPXAppUi::HandleWsEventL" ); |
|
3940 if ( aEvent.Type() == KAknUidValueEndKeyCloseEvent ) |
|
3941 { |
|
3942 TMPXPlaybackState playerState( EPbStateNotInitialised ); |
|
3943 if( iPlaybackUtility ) |
|
3944 { |
|
3945 TRAP_IGNORE( playerState = iPlaybackUtility->StateL() ); |
|
3946 } |
|
3947 |
|
3948 if ( ( iCommonUiHelper->ExitOptionHiddenL() && !IsEmbedded() ) || |
|
3949 EPbStatePlaying == playerState || |
|
3950 EPbStatePaused == playerState ) |
|
3951 { |
|
3952 // Go back to Idle when End key is pressed in non-embedded mode or |
|
3953 // player is in playing/paused mode |
|
3954 if( IsForeground() ) |
|
3955 { |
|
3956 ActivatePhoneAppL(); |
|
3957 } |
|
3958 return; |
|
3959 } |
|
3960 } |
|
3961 |
|
3962 // Notify the playback popup that orientation is about to change |
|
3963 if( iMediaKeyHandler && aEvent.Type() == EEventScreenDeviceChanged ) |
|
3964 { |
|
3965 iMediaKeyHandler->NotifyOrientationChangeBegin(); |
|
3966 } |
|
3967 |
|
3968 CAknAppUi::HandleWsEventL( aEvent, aDestination ); |
|
3969 } |
|
3970 |
|
3971 // --------------------------------------------------------------------------- |
|
3972 // From MCoeMessageObserver. |
|
3973 // Handle messages from windows server. |
|
3974 // --------------------------------------------------------------------------- |
|
3975 // |
|
3976 MCoeMessageObserver::TMessageResponse CMPXAppUi::HandleMessageL( |
|
3977 TUint32 aClientHandleOfTargetWindowGroup, |
|
3978 TUid aMessageUid, |
|
3979 const TDesC8& aMessageParameters ) |
|
3980 { |
|
3981 MPX_FUNC_EX( "CMPXAppUi::HandleMessageL" ); |
|
3982 |
|
3983 MCoeMessageObserver::TMessageResponse ret( EMessageNotHandled ); |
|
3984 |
|
3985 if ( aMessageUid == KAppUidMusicPlayerX ) |
|
3986 { |
|
3987 MPX_DEBUG2( "CMPXAppUi::HandleMessageL Message received for music player, size = %d", aMessageParameters.Size() ); |
|
3988 // message for music player |
|
3989 HandleCommandParametersL( aMessageParameters ); |
|
3990 ret = EMessageHandled; |
|
3991 } |
|
3992 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
3993 else if ( aMessageUid == KNullUid ) |
|
3994 { |
|
3995 ASSERT(!IsEmbedded());////browser should not send messages to music player if it is not RootApp. |
|
3996 if ( aMessageParameters.Length() ) |
|
3997 { |
|
3998 if ( IsBrowserClosedL(aMessageParameters) ) |
|
3999 { |
|
4000 if ( iAppStartedByBrowser ) |
|
4001 { |
|
4002 RunAppShutter(); |
|
4003 return EMessageHandled; |
|
4004 } |
|
4005 } |
|
4006 else |
|
4007 { |
|
4008 if (!iPdParameterHandler) |
|
4009 { |
|
4010 iPdParameterHandler = CMPXPdCommandHandler::NewL(iPlaybackUtility); |
|
4011 } |
|
4012 if(KErrNotFound == iPdParameterHandler->HandleCommandParametersL( aMessageParameters )) // File or dl id do not exist. |
|
4013 { |
|
4014 iCommonUiHelper->DisplayInfoNoteL(R_MPX_FILE_NOT_FOUND_TEXT); |
|
4015 HandleCommandL(EMPXCmdGoToNowPlaying); |
|
4016 BringUpBrowserL(); |
|
4017 } |
|
4018 else |
|
4019 { |
|
4020 iPbvStartedByBrowser = ETrue; |
|
4021 } |
|
4022 ret = EMessageHandled; |
|
4023 } |
|
4024 } |
|
4025 } |
|
4026 #endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
4027 else |
|
4028 { |
|
4029 ret = CAknViewAppUi::HandleMessageL( |
|
4030 aClientHandleOfTargetWindowGroup, |
|
4031 aMessageUid, |
|
4032 aMessageParameters ); |
|
4033 } |
|
4034 return ret; |
|
4035 } |
|
4036 |
|
4037 // ----------------------------------------------------------------------------- |
|
4038 // From CEikAppUi. |
|
4039 // process message sent by another application |
|
4040 // ----------------------------------------------------------------------------- |
|
4041 // |
|
4042 void CMPXAppUi::ProcessMessageL( |
|
4043 TUid aUid, const TDesC8& aParams ) |
|
4044 { |
|
4045 MPX_FUNC_EX( "CMPXAppUi::ProcessMessageL" ); |
|
4046 if ( aUid == KAppUidMusicPlayerX ) |
|
4047 { |
|
4048 // message for music player |
|
4049 MPX_DEBUG2( "CMPXAppUi::ProcessMessageL Message received for music player, size = %d", aParams.Size() ); |
|
4050 HandleCommandParametersL( aParams ); |
|
4051 } |
|
4052 } |
|
4053 |
|
4054 // ----------------------------------------------------------------------------- |
|
4055 // From CEikAppUi. |
|
4056 // process command line parameter |
|
4057 // ----------------------------------------------------------------------------- |
|
4058 // |
|
4059 TBool CMPXAppUi::ProcessCommandParametersL( CApaCommandLine& aCommandLine ) |
|
4060 { |
|
4061 MPX_FUNC_EX( "CMPXAppUi::ProcessCommandParametersL CApaCommandLine" ); |
|
4062 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
4063 if (EApaCommandOpen == aCommandLine.Command()) |
|
4064 { |
|
4065 TPtrC param = aCommandLine.DocumentName(); |
|
4066 if ( param.Length() ) |
|
4067 { |
|
4068 if (!ConeUtils::FileExists(param)) |
|
4069 { |
|
4070 iAppStartedByBrowser = ETrue; |
|
4071 iPdPbvStartedByBrowser = ETrue; |
|
4072 // Convert param to 8-bit. |
|
4073 HBufC8* param8 = HBufC8::NewLC( param.Length() ); |
|
4074 param8->Des().Copy( param ); |
|
4075 if ( IsBrowserClosedL(*param8) ) |
|
4076 { |
|
4077 Exit(); |
|
4078 } |
|
4079 else |
|
4080 { |
|
4081 if (!iPdParameterHandler) |
|
4082 { |
|
4083 iPdParameterHandler = CMPXPdCommandHandler::NewL(iPlaybackUtility);//this is where it is created the first time |
|
4084 } |
|
4085 if ( KErrNotFound == iPdParameterHandler->HandleCommandParametersL( *param8 ) ) |
|
4086 { |
|
4087 delete iPdParameterHandler; |
|
4088 iPdParameterHandler = NULL; |
|
4089 iCommonUiHelper->DisplayInfoNoteL(R_MPX_FILE_NOT_FOUND_TEXT); |
|
4090 BringUpBrowserL(); |
|
4091 Exit(); |
|
4092 } |
|
4093 else |
|
4094 { |
|
4095 // Default start up state for Progressive Download playback is Playing |
|
4096 MPXTlsHelper::SetLaunchModeL( EMPXLaunchModePlaying ); |
|
4097 } |
|
4098 } |
|
4099 CleanupStack::PopAndDestroy( param8 ); |
|
4100 } |
|
4101 } |
|
4102 } |
|
4103 #endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
4104 const TPtrC8 command = aCommandLine.TailEnd(); |
|
4105 if ( command.Size() > 0 ) |
|
4106 { |
|
4107 // Play command from RemConTspController |
|
4108 if (command.Compare(KRemConTspControllerPlayParam) == 0) |
|
4109 { |
|
4110 RWsSession wsSession = iEikonEnv->WsSession(); |
|
4111 CAknTaskList *taskList = CAknTaskList::NewL( wsSession ); |
|
4112 CleanupStack::PushL( taskList ); |
|
4113 TApaTask task = taskList->FindRootApp( KAppUidMusicPlayerX ); |
|
4114 CMPXParameter* param = new ( ELeave ) CMPXParameter(); |
|
4115 CleanupStack::PushL( param ); |
|
4116 param->iType.iUid = KMPXPluginTypeLastPlayedUid; |
|
4117 param->iCmdForward = EMPXCmdFwdNone; |
|
4118 CBufBase* buffer = CBufFlat::NewL( KPlayerMusicPlayerParameterGranularity ); |
|
4119 CleanupStack::PushL( buffer ); |
|
4120 RBufWriteStream writeStream( *buffer ); |
|
4121 CleanupClosePushL( writeStream ); |
|
4122 param->ExternalizeL( writeStream ); |
|
4123 writeStream.CommitL(); |
|
4124 buffer->Compress(); |
|
4125 CleanupStack::PopAndDestroy( &writeStream ); |
|
4126 wsSession.SendMessageToWindowGroup( task.WgId(), KAppUidMusicPlayerX, |
|
4127 buffer->Ptr( 0 ) ); |
|
4128 CleanupStack::PopAndDestroy( buffer); |
|
4129 CleanupStack::PopAndDestroy( param ); |
|
4130 CleanupStack::PopAndDestroy( taskList ); |
|
4131 } |
|
4132 else |
|
4133 { |
|
4134 HandleCommandParametersL( command ); |
|
4135 } |
|
4136 } |
|
4137 return ETrue; |
|
4138 } |
|
4139 |
|
4140 // --------------------------------------------------------------------------- |
|
4141 // From MMPXSaveHelperObserver |
|
4142 // Callback function to signal that saving a file is complete |
|
4143 // --------------------------------------------------------------------------- |
|
4144 // |
|
4145 void CMPXAppUi::HandleSaveComplete( TInt aErr ) |
|
4146 { |
|
4147 MPX_DEBUG2("CMPXAppUi::HandleSaveComplete(%d) entering", aErr); |
|
4148 TRAP_IGNORE( DoHandleSaveCompleteL( aErr ) ); |
|
4149 MPX_DEBUG1("CMPXAppUi::HandleSaveComplete() exiting" ); |
|
4150 } |
|
4151 |
|
4152 // --------------------------------------------------------------------------- |
|
4153 // From MMPXCollectionHelperObserver |
|
4154 // Callback function to signal that adding a file is complete |
|
4155 // --------------------------------------------------------------------------- |
|
4156 // |
|
4157 void CMPXAppUi::HandleAddFileCompleteL( TInt aErr ) |
|
4158 { |
|
4159 MPX_DEBUG2("CMPXAppUi::HandleAddFileCompleteL(%d) entering", aErr); |
|
4160 |
|
4161 iCommonUiHelper->DismissWaitNoteL(); |
|
4162 |
|
4163 // close collectionhelper since it is not needed now |
|
4164 if ( iCollectionHelper ) |
|
4165 { |
|
4166 iCollectionHelper->Close(); |
|
4167 iCollectionHelper = NULL; |
|
4168 } |
|
4169 |
|
4170 if ( !aErr ) |
|
4171 { |
|
4172 if (( iSaveMode != EMPXAssignRingtone ) && |
|
4173 ( iSaveMode != EMPXAssignContact )) |
|
4174 { |
|
4175 iCommonUiHelper->DisplayConfirmNoteL( R_MPX_SAVED_TO_COLLECTION_NOTE ); |
|
4176 } |
|
4177 } |
|
4178 else if ( KErrNotSupported == aErr ) |
|
4179 { |
|
4180 iCommonUiHelper->DisplayConfirmNoteL( R_MPX_SAVED_NOTE ); |
|
4181 } |
|
4182 else if( iIsUsbOnGoing && (aErr != KErrNone) ) |
|
4183 { |
|
4184 // Kill mpx embedded mode so usb can start |
|
4185 // |
|
4186 MPX_DEBUG1("CMPXAppUi::HandleAddFileCompleteL usb ongoing"); |
|
4187 iSaveMode = EMPXExitAppAfterSave; |
|
4188 } |
|
4189 else |
|
4190 { |
|
4191 iCommonUiHelper->HandleErrorL( aErr ); |
|
4192 } |
|
4193 |
|
4194 if ( iView ) |
|
4195 { |
|
4196 iView->HandleCommandL( EMPXCmdSaveComplete ); |
|
4197 } |
|
4198 |
|
4199 HandlePostSaveOperationL(); |
|
4200 |
|
4201 MPX_DEBUG1("CMPXAppUi::HandleAddFileCompleteL() exiting" ); |
|
4202 } |
|
4203 |
|
4204 // --------------------------------------------------------------------------- |
|
4205 // From MProgressDialogCallback. |
|
4206 // Get's called when a dialog is dismissed. |
|
4207 // --------------------------------------------------------------------------- |
|
4208 // |
|
4209 void CMPXAppUi::DialogDismissedL( TInt aButtonId ) |
|
4210 { |
|
4211 MPX_DEBUG1("CMPXAppUi::DialogDismissedL"); |
|
4212 |
|
4213 // Cover UI start |
|
4214 //#ifdef __COVER_DISPLAY |
|
4215 if ( iCommandInitiator ) |
|
4216 { |
|
4217 iCommandInitiator->CancelCommand( KMediatorSecondaryDisplayDomain, |
|
4218 KMPlayerNoteCategory, |
|
4219 EMPlayerNoteSaveOneItem ); |
|
4220 } |
|
4221 //#endif |
|
4222 // Cover UI end |
|
4223 |
|
4224 if ( aButtonId == EAknSoftkeyCancel && iView ) |
|
4225 { |
|
4226 iView->HandleCommandL( EMPXCmdSaveCancelled ); |
|
4227 if ( iSaveMode != EMPXSaveModeIdle ) |
|
4228 { |
|
4229 iCancelFileMan = ETrue; |
|
4230 if( iSaveHelper ) |
|
4231 { |
|
4232 iSaveHelper->Cancel(); |
|
4233 } |
|
4234 iSaveMode = EMPXSaveModeIdle; |
|
4235 } |
|
4236 } |
|
4237 MPX_DEBUG1("CMPXAppUi::DialogDismissedL"); |
|
4238 } |
|
4239 |
|
4240 // ----------------------------------------------------------------------------- |
|
4241 // CMPXAppUi::NotifyFileManOperation |
|
4242 // ----------------------------------------------------------------------------- |
|
4243 // |
|
4244 MFileManObserver::TControl CMPXAppUi::NotifyFileManOperation() |
|
4245 { |
|
4246 MPX_DEBUG1("CMPXAppUi::NotifyFileManOperation(): entering"); |
|
4247 // this code is run in CFileMan working thread. |
|
4248 if( iCancelFileMan ) |
|
4249 { |
|
4250 MPX_DEBUG1("CMPXAppUi::NotifyFileManOperation(): ECancel"); |
|
4251 return MFileManObserver::ECancel; |
|
4252 } |
|
4253 return MFileManObserver::EContinue; |
|
4254 } |
|
4255 |
|
4256 // ----------------------------------------------------------------------------- |
|
4257 // CMPXAppUi::DoUpdatePluginRefreshedTimeL |
|
4258 // ----------------------------------------------------------------------------- |
|
4259 // |
|
4260 void CMPXAppUi::DoUpdatePluginRefreshedTimeL() |
|
4261 { |
|
4262 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
4263 CleanupStack::PushL( cmd ); |
|
4264 cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdUpdateRefreshTime ); |
|
4265 cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); |
|
4266 |
|
4267 // Update Music |
|
4268 cmd->SetTObjectValueL<TUid>( KMPXCommandGeneralCollectionId, iMusicCollectionId ); |
|
4269 iCollectionUtility->Collection().CommandL( *cmd ); |
|
4270 |
|
4271 // Update Podcast |
|
4272 if( !iDisablePodcasting ) |
|
4273 { |
|
4274 cmd->SetTObjectValueL<TUid>( KMPXCommandGeneralCollectionId, iPodcastCollectionId ); |
|
4275 iCollectionUtility->Collection().CommandL( *cmd ); |
|
4276 } |
|
4277 CleanupStack::PopAndDestroy( cmd ); |
|
4278 } |
|
4279 |
|
4280 // ----------------------------------------------------------------------------- |
|
4281 // CMPXAppUi::HandlePropertyL |
|
4282 // ----------------------------------------------------------------------------- |
|
4283 // |
|
4284 void CMPXAppUi::HandlePropertyL(TMPXPlaybackProperty aProperty, TInt aValue, TInt aError) |
|
4285 { |
|
4286 if (aError == KErrNone) |
|
4287 { |
|
4288 switch (aProperty) |
|
4289 { |
|
4290 case EPbPropertyVolume: |
|
4291 { |
|
4292 iCurrentVolume = aValue; |
|
4293 } |
|
4294 break; |
|
4295 |
|
4296 case EPbPropertyMaxVolume: |
|
4297 { |
|
4298 iMaxVolume = aValue; |
|
4299 } |
|
4300 break; |
|
4301 |
|
4302 default: |
|
4303 break; |
|
4304 } |
|
4305 } |
|
4306 else |
|
4307 { |
|
4308 // How to handle error? |
|
4309 } |
|
4310 } |
|
4311 |
|
4312 |
|
4313 // ----------------------------------------------------------------------------- |
|
4314 // CMPXAppUi::HandleSubPlayerNamesL |
|
4315 // ----------------------------------------------------------------------------- |
|
4316 // |
|
4317 void CMPXAppUi::HandleSubPlayerNamesL( |
|
4318 TUid /*aPlayer*/, |
|
4319 const MDesCArray* /*aSubPlayers*/, |
|
4320 TBool /*aComplete*/, |
|
4321 TInt /*aError*/) |
|
4322 { |
|
4323 |
|
4324 } |
|
4325 |
|
4326 // ----------------------------------------------------------------------------- |
|
4327 // CMPXAppUi::HandleMediaL |
|
4328 // ----------------------------------------------------------------------------- |
|
4329 // |
|
4330 void CMPXAppUi::HandleMediaL( |
|
4331 const CMPXMedia& /*aProperties*/, |
|
4332 TInt /*aError*/) |
|
4333 { |
|
4334 |
|
4335 } |
|
4336 // ----------------------------------------------------------------------------- |
|
4337 // CMPXAppUi::IsActiveView |
|
4338 // ----------------------------------------------------------------------------- |
|
4339 // |
|
4340 TBool CMPXAppUi::IsActiveView(TInt aViewType ) |
|
4341 { |
|
4342 return (iCurrentViewType.iUid == aViewType ) || ((iCurrentViewType.iUid == KMPXPluginTypeWaitNoteDialogUid ) && (iPreviousViewType.iUid == aViewType)); |
|
4343 } |
|
4344 |
|
4345 // ----------------------------------------------------------------------------- |
|
4346 // CMPXAppUi::ReOpenPathL |
|
4347 // ----------------------------------------------------------------------------- |
|
4348 // |
|
4349 void CMPXAppUi::ReOpenPathL() |
|
4350 { |
|
4351 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL ( ); |
|
4352 CleanupStack::PushL ( path ); |
|
4353 if ( path->Levels ( )> 1 ) |
|
4354 { |
|
4355 path->Back ( ); |
|
4356 iCollectionUtility->Collection().OpenL ( *path ); |
|
4357 } |
|
4358 CleanupStack::PopAndDestroy ( path ); |
|
4359 } |
|
4360 |
|
4361 // ----------------------------------------------------------------------------- |
|
4362 // CMPXAppUi::HandleServerAppExit |
|
4363 // ----------------------------------------------------------------------------- |
|
4364 // |
|
4365 void CMPXAppUi::HandleServerAppExit(TInt /*aReason*/) |
|
4366 { |
|
4367 RunAppShutter(); |
|
4368 } |
|
4369 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
4370 // ----------------------------------------------------------------------------- |
|
4371 // CMPXAppUi::IsBrowserClosedL |
|
4372 // ----------------------------------------------------------------------------- |
|
4373 // |
|
4374 TBool CMPXAppUi::IsBrowserClosedL( |
|
4375 const TDesC8& aParams ) |
|
4376 { |
|
4377 TBool ret(EFalse); |
|
4378 CBufFlat* paramBuf = CBufFlat::NewL( /*anExpandSize*/1 ); |
|
4379 CleanupStack::PushL( paramBuf ); |
|
4380 paramBuf->InsertL( 0, aParams ); |
|
4381 RBufReadStream readStream( *paramBuf ); |
|
4382 |
|
4383 CAiwGenericParamList* genParList = CAiwGenericParamList::NewLC( readStream ); |
|
4384 |
|
4385 TInt index = 0; |
|
4386 const TAiwGenericParam* paramTerminate = genParList->FindFirst( index, |
|
4387 EGenericParamTerminate, EVariantTypeTInt32 ); |
|
4388 TInt32 terminateID = 0; |
|
4389 if ( paramTerminate ) |
|
4390 { |
|
4391 paramTerminate->Value().Get( terminateID ); |
|
4392 } |
|
4393 |
|
4394 if ( terminateID ) |
|
4395 { |
|
4396 ret = ETrue; |
|
4397 } |
|
4398 |
|
4399 CleanupStack::PopAndDestroy( genParList ); |
|
4400 CleanupStack::PopAndDestroy( paramBuf ); |
|
4401 |
|
4402 return ret; |
|
4403 } |
|
4404 |
|
4405 // --------------------------------------------------------- |
|
4406 // Bring Browser application to the foreground. |
|
4407 // --------------------------------------------------------- |
|
4408 // |
|
4409 TBool CMPXAppUi::BringUpBrowserL() |
|
4410 { |
|
4411 TBool browserFound(EFalse); |
|
4412 RWsSession& wsSession=iEikonEnv->WsSession(); |
|
4413 CAknTaskList* taskList = CAknTaskList::NewL( wsSession ); |
|
4414 TApaTask task = taskList->FindRootApp( TUid::Uid(KMPXBrowserUid) ); |
|
4415 delete taskList; |
|
4416 if( task.Exists() ) |
|
4417 { |
|
4418 task.BringToForeground(); |
|
4419 browserFound = ETrue; |
|
4420 } |
|
4421 return browserFound; |
|
4422 } |
|
4423 |
|
4424 #endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
4425 |
|
4426 // ----------------------------------------------------------------------------- |
|
4427 // CMPXAppUi::SuppressCollectionView |
|
4428 // ----------------------------------------------------------------------------- |
|
4429 // |
|
4430 TBool CMPXAppUi::SuppressCollectionView() |
|
4431 { |
|
4432 #ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
4433 return ( iPdPbvStartedByBrowser || iStandAlone ); |
|
4434 #else |
|
4435 return ( iStandAlone ); |
|
4436 #endif |
|
4437 } |
|
4438 |
|
4439 // ----------------------------------------------------------------------------- |
|
4440 // CMPXAppUi::SetVolumeL |
|
4441 // ----------------------------------------------------------------------------- |
|
4442 // |
|
4443 void CMPXAppUi::SetVolumeL( const TInt aVolume ) |
|
4444 { |
|
4445 CMPXCommand* cmd( CMPXCommand::NewL() ); |
|
4446 CleanupStack::PushL( cmd ); |
|
4447 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral ); |
|
4448 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
4449 cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue ); |
|
4450 cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdSetVolume ); |
|
4451 cmd->SetTObjectValueL<TUint>( KMPXCommandPlaybackGeneralData, aVolume ); |
|
4452 |
|
4453 MMPXPlaybackUtility* activePbu = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer ); |
|
4454 CleanupClosePushL( *activePbu ); |
|
4455 activePbu->CommandL( *cmd ); |
|
4456 CleanupStack::PopAndDestroy( activePbu ); |
|
4457 |
|
4458 CleanupStack::PopAndDestroy( cmd ); |
|
4459 } |
|
4460 |
|
4461 // ----------------------------------------------------------------------------- |
|
4462 // CMPXAppUi::MuteVolumeL |
|
4463 // ----------------------------------------------------------------------------- |
|
4464 // |
|
4465 void CMPXAppUi::MuteVolumeL() |
|
4466 { |
|
4467 CMPXCommand* cmd( CMPXCommand::NewL() ); |
|
4468 CleanupStack::PushL( cmd ); |
|
4469 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral ); |
|
4470 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
4471 cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue ); |
|
4472 cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdMuteVolume ); |
|
4473 |
|
4474 MMPXPlaybackUtility* activePbu = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer ); |
|
4475 CleanupClosePushL( *activePbu ); |
|
4476 activePbu->CommandL( *cmd ); |
|
4477 CleanupStack::PopAndDestroy( activePbu ); |
|
4478 |
|
4479 CleanupStack::PopAndDestroy( cmd ); |
|
4480 } |
|
4481 |
|
4482 // ----------------------------------------------------------------------------- |
|
4483 // CMPXAppUi::UnMuteVolumeL |
|
4484 // ----------------------------------------------------------------------------- |
|
4485 // |
|
4486 void CMPXAppUi::UnMuteVolumeL() |
|
4487 { |
|
4488 CMPXCommand* cmd( CMPXCommand::NewL() ); |
|
4489 CleanupStack::PushL( cmd ); |
|
4490 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral ); |
|
4491 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
4492 cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue ); |
|
4493 cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdUnMuteVolume ); |
|
4494 |
|
4495 MMPXPlaybackUtility* activePbu = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer ); |
|
4496 CleanupClosePushL( *activePbu ); |
|
4497 activePbu->CommandL( *cmd ); |
|
4498 CleanupStack::PopAndDestroy( activePbu ); |
|
4499 |
|
4500 CleanupStack::PopAndDestroy( cmd ); |
|
4501 } |
|
4502 |
|
4503 // ----------------------------------------------------------------------------- |
|
4504 // CMPXAppUi::UnMuteVolume |
|
4505 // ----------------------------------------------------------------------------- |
|
4506 // |
|
4507 TInt CMPXAppUi::MPXCmdForPbCmd( |
|
4508 TMPXPlaybackCommand aCommand ) |
|
4509 { |
|
4510 TInt cmd( KErrNotFound ); |
|
4511 |
|
4512 switch ( aCommand ) |
|
4513 { |
|
4514 case EPbCmdStop: |
|
4515 { |
|
4516 cmd = EMPXCmdStop; |
|
4517 break; |
|
4518 } |
|
4519 case EPbCmdPlay: |
|
4520 { |
|
4521 cmd = EMPXCmdPlay; |
|
4522 break; |
|
4523 } |
|
4524 case EPbCmdPause: |
|
4525 { |
|
4526 cmd = EMPXCmdPause; |
|
4527 break; |
|
4528 } |
|
4529 case EPbCmdPlayPause: |
|
4530 { |
|
4531 cmd = EMPXCmdPlayPause; |
|
4532 break; |
|
4533 } |
|
4534 case EPbCmdNext: |
|
4535 { |
|
4536 cmd = EMPXCmdNext; |
|
4537 break; |
|
4538 } |
|
4539 case EPbCmdPrevious: |
|
4540 { |
|
4541 cmd = EMPXCmdPrevious; |
|
4542 break; |
|
4543 } |
|
4544 case EPbCmdStartSeekForward: |
|
4545 { |
|
4546 cmd = EMPXCmdSeekForward; |
|
4547 break; |
|
4548 } |
|
4549 case EPbCmdStartSeekBackward: |
|
4550 { |
|
4551 cmd = EMPXCmdSeekBackward; |
|
4552 break; |
|
4553 } |
|
4554 case EPbCmdStopSeeking: |
|
4555 { |
|
4556 cmd = EMPXCmdStopSeeking; |
|
4557 break; |
|
4558 } |
|
4559 default: |
|
4560 { |
|
4561 // Command not found |
|
4562 break; |
|
4563 } |
|
4564 } |
|
4565 return cmd; |
|
4566 } |
|
4567 |
|
4568 // ----------------------------------------------------------------------------- |
|
4569 // CMPXAppUi::CheckAvailableMemoryL |
|
4570 // ----------------------------------------------------------------------------- |
|
4571 // |
|
4572 void CMPXAppUi::CheckAvailableMemoryL( TInt aNeedMemory ) |
|
4573 { |
|
4574 TMemoryInfoV1Buf info; |
|
4575 UserHal::MemoryInfo(info); |
|
4576 if( info().iFreeRamInBytes < aNeedMemory ) |
|
4577 { |
|
4578 HBufC* title = |
|
4579 StringLoader::LoadLC( R_MPX_NO_MEMORY_INFO ); |
|
4580 CAknGlobalNote* infoNote = CAknGlobalNote::NewLC(); |
|
4581 infoNote->ShowNoteL( |
|
4582 EAknGlobalInformationNote, |
|
4583 title->Des() ); |
|
4584 CleanupStack::PopAndDestroy( infoNote ); |
|
4585 CleanupStack::PopAndDestroy( title ); |
|
4586 Exit(); |
|
4587 return; |
|
4588 } |
|
4589 } |
|
4590 |
|
4591 |
|
4592 // ----------------------------------------------------------------------------- |
|
4593 // CMPXAppUi::CheckUpdatesComplete |
|
4594 // from base class MIAUpdateObserver |
|
4595 // ----------------------------------------------------------------------------- |
|
4596 // |
|
4597 void CMPXAppUi::CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates ) |
|
4598 { |
|
4599 MPX_DEBUG2("CMPXAppUi::CheckUpdatesComplete(UpdatesComplete: %d) entering", aErrorCode); |
|
4600 if ( aErrorCode == KErrNone ) |
|
4601 { |
|
4602 MPX_DEBUG2("CMPXAppUi::CheckUpdatesComplete(AvailableUpdates: %d)", aAvailableUpdates); |
|
4603 if ( aAvailableUpdates > 0 ) |
|
4604 { |
|
4605 // There were some updates available. Let's ask if the user wants to update them. |
|
4606 iUpdate->UpdateQuery(); |
|
4607 } |
|
4608 else |
|
4609 { |
|
4610 // No updates available. CIAUpdate object could be deleted |
|
4611 CleanUpdateParams(); |
|
4612 } |
|
4613 } |
|
4614 MPX_DEBUG1( "CMPXAppUi::CheckUpdatesComplete() exiting" ); |
|
4615 } |
|
4616 |
|
4617 // ----------------------------------------------------------------------------- |
|
4618 // CMPXAppUi::UpdateComplete |
|
4619 // from base class MIAUpdateObserver |
|
4620 // ----------------------------------------------------------------------------- |
|
4621 // |
|
4622 void CMPXAppUi::UpdateComplete( TInt /*aErrorCode*/, CIAUpdateResult* aResultDetails ) |
|
4623 { |
|
4624 MPX_DEBUG1( "CMPXAppUi::UpdateComplete() entering" ); |
|
4625 // The update process that the user started from IAUpdate UI is now completed. |
|
4626 if(aResultDetails) |
|
4627 { |
|
4628 delete aResultDetails; // Ownership was transferred, so this must be deleted by the client |
|
4629 aResultDetails = NULL; |
|
4630 } |
|
4631 |
|
4632 // We do not need the client-server session anymore, let's delete the object to close the session |
|
4633 CleanUpdateParams(); |
|
4634 MPX_DEBUG1( "CMPXAppUi::UpdateComplete() exiting" ); |
|
4635 } |
|
4636 |
|
4637 // ----------------------------------------------------------------------------- |
|
4638 // CMPXAppUi::UpdateQueryComplete |
|
4639 // from base class MIAUpdateObserver |
|
4640 // ----------------------------------------------------------------------------- |
|
4641 // |
|
4642 void CMPXAppUi::UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow ) |
|
4643 { |
|
4644 MPX_DEBUG2("CMPXAppUi::UpdateQueryComplete(QueryComplete: %d) entering", aErrorCode); |
|
4645 if ( aErrorCode == KErrNone ) |
|
4646 { |
|
4647 MPX_DEBUG2("CMPXAppUi::UpdateQueryComplete(UpdateNow: %d) ", aUpdateNow); |
|
4648 if ( aUpdateNow ) |
|
4649 { |
|
4650 // User choosed to update now, so let's launch the IAUpdate UI. |
|
4651 iUpdate->ShowUpdates( *iParameters ); |
|
4652 } |
|
4653 else |
|
4654 { |
|
4655 // The answer was 'Later'. CIAUpdate object could be deleted |
|
4656 CleanUpdateParams(); |
|
4657 } |
|
4658 } |
|
4659 MPX_DEBUG1( "CMPXAppUi::UpdateQueryComplete() exiting" ); |
|
4660 } |
|
4661 |
|
4662 // ----------------------------------------------------------------------------- |
|
4663 // CMPXAppUi::UpdateQueryComplete |
|
4664 // ----------------------------------------------------------------------------- |
|
4665 // |
|
4666 void CMPXAppUi::CleanUpdateParams() |
|
4667 { |
|
4668 MPX_DEBUG1( "CMPXAppUi::CleanUpdateParams() entering" ); |
|
4669 if(iUpdate) |
|
4670 { |
|
4671 delete iUpdate; |
|
4672 iUpdate = NULL; |
|
4673 } |
|
4674 if(iParameters) |
|
4675 { |
|
4676 delete iParameters; |
|
4677 iParameters = NULL; |
|
4678 } |
|
4679 MPX_DEBUG1( "CMPXAppUi::CleanUpdateParams() exiting" ); |
|
4680 } |
|
4681 |
|
4682 // ----------------------------------------------------------------------------- |
|
4683 // CMPXAppUi::CheckUpdatesL |
|
4684 // ----------------------------------------------------------------------------- |
|
4685 // |
|
4686 void CMPXAppUi::CheckUpdatesL() |
|
4687 { |
|
4688 MPX_DEBUG1( "CMPXAppUi::CheckUpdatesL() entering" ); |
|
4689 if ( FeatureManager::FeatureSupported( KFeatureIdIAUpdate ) ) |
|
4690 { |
|
4691 MPX_DEBUG1( "CMPXAppUi::CheckUpdatesL() IAD Update supported" ); |
|
4692 |
|
4693 TRAP_IGNORE( iUpdate = CIAUpdate::NewL( *this ) ); |
|
4694 |
|
4695 MPX_DEBUG1( "CMPXAppUi::CheckUpdatesL() IAD Update Client Created" ); |
|
4696 |
|
4697 if ( iUpdate ) |
|
4698 { |
|
4699 MPX_DEBUG1( "CMPXAppUi::CheckUpdatesL() creating IAD Update paramentes" ); |
|
4700 iParameters = CIAUpdateParameters::NewL(); |
|
4701 |
|
4702 // Search for updates using SIS package UID |
|
4703 iParameters->SetUid( TUid::Uid( KMPXMusicPlayerSISPkgUid ) ); |
|
4704 |
|
4705 //mpx.exe to be started after update is finished |
|
4706 iParameters->SetCommandLineExecutableL( KMPXMusicPlayerExec ); |
|
4707 |
|
4708 //check the updates |
|
4709 iUpdate->CheckUpdates( *iParameters ); |
|
4710 } |
|
4711 } |
|
4712 MPX_DEBUG1( "CMPXAppUi::CheckUpdatesL() exiting" ); |
|
4713 } |
|
4714 |
|
4715 #ifdef FF_OOM_MONITOR2_COMPONENT |
|
4716 // ----------------------------------------------------------------------------- |
|
4717 // CMPXAppUi::SetMpxOomPriorityL |
|
4718 // ----------------------------------------------------------------------------- |
|
4719 // |
|
4720 void CMPXAppUi::SetMpxOomPriorityL( ROomMonitorSession::TOomPriority aPriority ) |
|
4721 { |
|
4722 if( aPriority != iOomPriority ) |
|
4723 { |
|
4724 ROomMonitorSession monitorSession; |
|
4725 User::LeaveIfError ( monitorSession.Connect() ); |
|
4726 // No leaving code after this point, so no need to use cleanup stack |
|
4727 monitorSession.SetOomPriority( aPriority ); |
|
4728 iOomPriority = aPriority; |
|
4729 monitorSession.Close(); // CLOSE THE OOM SESSION.... |
|
4730 } |
|
4731 } |
|
4732 |
|
4733 // ----------------------------------------------------------------------------- |
|
4734 // CMPXAppUi::CheckAvailableMemoryByOomL |
|
4735 // ----------------------------------------------------------------------------- |
|
4736 // |
|
4737 void CMPXAppUi::CheckAvailableMemoryByOomL( TInt aNeedMemory ) |
|
4738 { |
|
4739 ROomMonitorSession oomMonitor; |
|
4740 User::LeaveIfError( oomMonitor.Connect() ); |
|
4741 // No leaving code after this point, so no need to use cleanup stack |
|
4742 TInt errorCode = oomMonitor.RequestFreeMemory( aNeedMemory ); |
|
4743 oomMonitor.Close(); |
|
4744 |
|
4745 if ( errorCode != KErrNone ) |
|
4746 { |
|
4747 // NOT ENOUGH MEMORY ....Show Information note and exit out.. |
|
4748 HBufC* title = StringLoader::LoadLC( R_MPX_NO_MEMORY_INFO ); |
|
4749 CAknGlobalNote* infoNote = CAknGlobalNote::NewLC(); |
|
4750 infoNote->ShowNoteL( |
|
4751 EAknGlobalInformationNote, |
|
4752 title->Des() ); |
|
4753 CleanupStack::PopAndDestroy( infoNote ); |
|
4754 CleanupStack::PopAndDestroy( title ); |
|
4755 Exit(); |
|
4756 } |
|
4757 } |
|
4758 #endif // FF_OOM_MONITOR2_COMPONENT |
|
4759 |
|
4760 // End of File |