|
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: Implementation of Collection view |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <bldvariant.hrh> |
|
20 #include <f32file.h> |
|
21 #include <eikmenub.h> |
|
22 #include <coeutils.h> |
|
23 #include <aknlists.h> |
|
24 #include <aknViewAppUi.h> |
|
25 #include <AknQueryDialog.h> |
|
26 #include <StringLoader.h> |
|
27 #include <aknnavilabel.h> |
|
28 #include <aknnavide.h> |
|
29 #include <akntitle.h> |
|
30 #include <textresolver.h> |
|
31 #include <aknnotewrappers.h> |
|
32 #include <aknnavi.h> |
|
33 #include <hlplch.h> |
|
34 #include <avkon.hrh> |
|
35 #include <avkon.rsg> |
|
36 #include <avkon.mbg> |
|
37 #include <sendui.h> |
|
38 #include <cmessagedata.h> |
|
39 #include <centralrepository.h> |
|
40 #include <mprofileengine.h> |
|
41 #include <akndlgshut.h> |
|
42 #ifdef RD_MULTIPLE_DRIVE |
|
43 #include <driveinfo.h> |
|
44 #endif //RD_MULTIPLE_DRIVE |
|
45 |
|
46 #include <upnpcopycommand.h> |
|
47 #include <AiwServiceHandler.h> //Copy to remote feature |
|
48 |
|
49 #include <mediarecognizer.h> |
|
50 #include <featmgr.h> |
|
51 #include <aknmediatorfacade.h> |
|
52 #include <MediatorCommandInitiator.h> |
|
53 #include <mediatordomainuids.h> |
|
54 |
|
55 #include <mplayersecondarydisplayapi.h> |
|
56 #include <data_caging_path_literals.hrh> |
|
57 #include <layoutmetadata.cdl.h> |
|
58 #include <mpxplaybackframeworkdefs.h> |
|
59 #include <mpxcollectionmessage.h> |
|
60 #include <mpxviewutility.h> |
|
61 #include <mpxmusicplayerviewplugin.hrh> |
|
62 #include <mpxcollectionviewhg.rsg> |
|
63 #include <mpxcollectionviewhg.mbg> |
|
64 #include <mpxcommonui.rsg> |
|
65 #include <mpxcollectionutility.h> |
|
66 #include <mpxplaybackutility.h> |
|
67 #include <mpxplaybackmessage.h> |
|
68 #include <mpxmedia.h> |
|
69 #include <mpxcollectionhelperfactory.h> |
|
70 #include <mpxcollectionplaylist.h> |
|
71 #include <mpxmediacontainerdefs.h> |
|
72 #include <mpxmediamusicdefs.h> |
|
73 #include <mpxmediacollectiondetaildefs.h> |
|
74 #include <mpxmediadrmdefs.h> |
|
75 #include <mpxmediaarray.h> |
|
76 #include <mpxcollectioncommanddefs.h> |
|
77 #include <mpxcommandgeneraldefs.h> |
|
78 #include <mpxmessagegeneraldefs.h> |
|
79 #include <mpxcommandgeneraldefs.h> |
|
80 #include <mpxcollectioncommanddefs.h> |
|
81 #include <mpxviewpluginmanager.h> |
|
82 #include <mpxviewplugin.h> |
|
83 #include <mpxbacksteppingutility.h> |
|
84 #include <mpxcollectionopenutility.h> |
|
85 |
|
86 #include <mpxfindinmusicshop.h> |
|
87 #include <mpxfindinmusicshopcommon.h> // KFindInMShopKeyInValid |
|
88 #include <MusicWapCenRepKeys.h> |
|
89 |
|
90 // cenrep key need to be checked whether USB cable is connected in MTP/Combined Mode |
|
91 #include <UsbWatcherInternalPSKeys.h> |
|
92 #include <usbpersonalityids.h> |
|
93 #include <mpxappui.hrh> |
|
94 #include <mpxinternalcrkeys.h> |
|
95 #include <mpxtlshelper.h> |
|
96 #include <mpxuser.h> |
|
97 #include "mpxcollectionviewhglistboxarray.h" |
|
98 #include "mpxcommoncontainer.hrh" |
|
99 #include "mpxcommonuihelper.h" |
|
100 #include "mpxcollectionviewhgcontainer.h" |
|
101 #include "mpxcollectionviewhg.hrh" |
|
102 #include "mpxcollectionviewhg.hlp.hrh" |
|
103 #include "mpxcollectionviewhgimp.h" |
|
104 #include "mpxviewprivatepskeys.h" |
|
105 #include "mpxlog.h" |
|
106 |
|
107 |
|
108 // CONSTANTS |
|
109 _LIT( KMPXCollectionRscPath, "mpxcollectionviewhg.rsc" ); |
|
110 |
|
111 const TInt KMilliSecondsToSeconds( 1000 ); |
|
112 const TInt KMPXReorderNaviPaneGranularity( 2 ); |
|
113 const TInt KMPXMaxBufferLength( 160 ); |
|
114 const TInt KMPXMaxTimeLength( 36 ); |
|
115 const TInt KMPXDurationDisplayResvLen( 10 ); |
|
116 const TInt KMPXPlaylistExportRetry( 10 ); |
|
117 const TInt KMPXDirectionUp( -1 ); |
|
118 const TInt KMPXDirectionDown( 1 ); |
|
119 const TInt KMPXErrDataNotReady( -8000 ); |
|
120 const TInt KMPXErrDataNotReadyCacheCommand( -8001 ); |
|
121 const TInt KMPXArrayGranularity( 100 ); |
|
122 const TInt KMusicCollectionMenuLevel( 2 ); |
|
123 |
|
124 _LIT( KMPXCollDetailsItemsFormat, "%S\t%S" ); |
|
125 |
|
126 _LIT( KCategoryEmpty, "" ); |
|
127 |
|
128 const TInt KIncrementalDelayNone = 0; |
|
129 const TInt KIncrementalDelayHalfSecond = 1000000; |
|
130 const TInt KIncrementalFetchBlockSize = 400; |
|
131 const TInt KIncrementalDirectionCount = 8; |
|
132 const TInt KProgressBarMaxValue = 100; // Max Value for the Progress Info bar |
|
133 const TInt KWaitNoteImpUid = 0x101FFC6C; // refresh wait note UID |
|
134 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
135 const TInt KMusicMenuPodcastMenuItemIndex = 4; // podcast menu item index |
|
136 #define KPodcastCollectionUid 0x101FFC3C |
|
137 #endif |
|
138 |
|
139 const TInt KMaxIntLen( 10 ); |
|
140 _LIT8( KMVPrefix, "MVviewID:" ); |
|
141 const TInt KMVPrefixLen( 9 ); |
|
142 |
|
143 // Music setting |
|
144 const TUid KCRUidMPXMPSettings = {0x101FFCDC}; |
|
145 const TUint32 KMPXMusicStoreUID = 0x00000003; |
|
146 const TUint32 KOperatorMusicStore = 0x00000004; |
|
147 const TUint32 KOperatorMusicStoreType = 0x00000005; |
|
148 const TUint32 KOperatorMusicStoreDisplayName = 0x00000006; |
|
149 const TUint32 KOperatorMusicStoreNativeUid = 0x00000007; |
|
150 const TUint32 KOperatorMusicStoreJavaName = 0x00000008; |
|
151 const TUint32 KOperatorMusicStoreWebPage = 0x00000009; |
|
152 const TUint32 KOperatorMusicStoreURI = 0x0000000A; |
|
153 |
|
154 |
|
155 const TInt KJavaMusicShopType( 1 ); |
|
156 const TInt KUIDMaxLength = 8; |
|
157 const TInt KMPXMaxHistoryLength( 255 ); |
|
158 |
|
159 #define KProgressDownloadUid 0x10207BCD |
|
160 |
|
161 // Music collection browse type |
|
162 const TInt KMPXCollectionArtistAlbum( 3 ); |
|
163 const TInt KMPXCollectionGenre( 5 ); |
|
164 |
|
165 |
|
166 // ======== MEMBER FUNCTIONS ======== |
|
167 |
|
168 // --------------------------------------------------------------------------- |
|
169 // Two-phased constructor. |
|
170 // --------------------------------------------------------------------------- |
|
171 // |
|
172 CMPXCollectionViewHgImp* CMPXCollectionViewHgImp::NewL() |
|
173 { |
|
174 MPX_FUNC( "CMPXCollectionViewHgImp::NewL" ); |
|
175 CMPXCollectionViewHgImp* self = CMPXCollectionViewHgImp::NewLC(); |
|
176 CleanupStack::Pop( self ); |
|
177 return self; |
|
178 } |
|
179 |
|
180 // --------------------------------------------------------------------------- |
|
181 // Two-phased constructor. |
|
182 // --------------------------------------------------------------------------- |
|
183 // |
|
184 CMPXCollectionViewHgImp* CMPXCollectionViewHgImp::NewLC() |
|
185 { |
|
186 CMPXCollectionViewHgImp* self = new ( ELeave ) CMPXCollectionViewHgImp(); |
|
187 CleanupStack::PushL( self ); |
|
188 self->ConstructL(); |
|
189 return self; |
|
190 } |
|
191 |
|
192 // --------------------------------------------------------------------------- |
|
193 // Destructor |
|
194 // --------------------------------------------------------------------------- |
|
195 // |
|
196 CMPXCollectionViewHgImp::~CMPXCollectionViewHgImp() |
|
197 { |
|
198 MPX_FUNC( "CMPXCollectionViewHgImp::~CMPXCollectionViewHgImp" ); |
|
199 |
|
200 if ( iCoverDisplay ) |
|
201 { |
|
202 delete iCommandInitiator; |
|
203 } |
|
204 |
|
205 // Cleanup observer, does not panic if not found |
|
206 // |
|
207 AppUi()->RemoveViewDeactivationObserver( this ); |
|
208 |
|
209 if ( iCollectionUtility ) |
|
210 { |
|
211 iCollectionUtility->Close(); |
|
212 } |
|
213 |
|
214 if ( iPlaybackUtility ) |
|
215 { |
|
216 TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) ); |
|
217 iPlaybackUtility->Close(); |
|
218 } |
|
219 |
|
220 if ( iViewUtility ) |
|
221 { |
|
222 iViewUtility->RemoveObserver( this ); |
|
223 iViewUtility->Close(); |
|
224 } |
|
225 |
|
226 if ( iCollectionUiHelper ) |
|
227 { |
|
228 iCollectionUiHelper->Close(); |
|
229 } |
|
230 |
|
231 if ( iCollectionHelper ) |
|
232 { |
|
233 iCollectionHelper->Close(); |
|
234 } |
|
235 |
|
236 if ( iProfileEngine ) |
|
237 { |
|
238 iProfileEngine->Release(); |
|
239 } |
|
240 |
|
241 if ( iUpnpFrameworkSupport ) |
|
242 { |
|
243 MPX_DEBUG1(_L("CMPXCollectionViewHgImp::~CMPXCollectionViewHgImp Detaching 'Copy to external' menu service...")); |
|
244 if ( iServiceHandler ) |
|
245 { |
|
246 iServiceHandler->DetachMenu( R_MPX_COLLECTION_VIEW_MENU_1, |
|
247 R_MPX_UPNP_COPY_TO_EXTERNAL_MENU_INTEREST ); |
|
248 iServiceHandler->DetachMenu( R_MPX_USE_AS_CASCADE, |
|
249 R_MPX_AIW_ASSIGN_INTEREST ); |
|
250 delete iServiceHandler; |
|
251 iServiceHandler = NULL; |
|
252 } |
|
253 iPlayersList.Close(); |
|
254 delete iSubPlayerName; |
|
255 } |
|
256 if ( iUpnpCopyCommand ) |
|
257 { |
|
258 delete iUpnpCopyCommand; |
|
259 } |
|
260 |
|
261 if ( iServiceHandler ) |
|
262 { |
|
263 iServiceHandler->DetachMenu( R_MPX_USE_AS_CASCADE, |
|
264 R_MPX_AIW_ASSIGN_INTEREST ); |
|
265 delete iServiceHandler; |
|
266 } |
|
267 if ( iMediaRecognizer ) |
|
268 { |
|
269 delete iMediaRecognizer; |
|
270 } |
|
271 |
|
272 if( iBackSteppingUtility ) |
|
273 { |
|
274 iBackSteppingUtility->Close(); |
|
275 } |
|
276 |
|
277 if ( iResourceOffset ) |
|
278 { |
|
279 iEikonEnv->DeleteResourceFile( iResourceOffset ); |
|
280 } |
|
281 |
|
282 if ( iContainer ) |
|
283 { |
|
284 AppUi()->RemoveFromStack( iContainer ); |
|
285 delete iContainer; |
|
286 } |
|
287 |
|
288 delete iNaviDecorator; |
|
289 delete iUserPlaylists; |
|
290 delete iCommonUiHelper; |
|
291 delete iSendUi; |
|
292 delete iTitle; |
|
293 delete iDuration; |
|
294 delete iOriginalTitle; |
|
295 delete iOriginalDuration; |
|
296 delete iNewName; |
|
297 delete iBottomIndex; |
|
298 delete iCurrentCba; |
|
299 delete iIncrementalOpenUtil; |
|
300 delete iCachedSelectionIndex; |
|
301 FeatureManager::UnInitializeLib(); |
|
302 delete iOperatorMusicStoreName ; |
|
303 if ( iOperatorMusicStoreURI ) |
|
304 { |
|
305 delete iOperatorMusicStoreURI; |
|
306 } |
|
307 } |
|
308 |
|
309 // --------------------------------------------------------------------------- |
|
310 // C++ default constructor can NOT contain any code, that |
|
311 // might leave. |
|
312 // --------------------------------------------------------------------------- |
|
313 // |
|
314 CMPXCollectionViewHgImp::CMPXCollectionViewHgImp() : |
|
315 iLastDepth( 1 ), iPlayIndex( KErrNotFound ), |
|
316 iSetMediaLCount( KErrNotFound ), |
|
317 iCurrentHighlightedIndex( KErrNotFound ), |
|
318 iCachedCommand( KErrNotFound ), |
|
319 iNoteType( EMPXNoteNotDefined ), |
|
320 iFirstIncrementalBatch( ETrue ) |
|
321 { |
|
322 MPX_FUNC( "CMPXCollectionViewHgImp::CMPXCollectionViewHgImp" ); |
|
323 iUsingNokiaService = EFalse; |
|
324 #ifdef __ENABLE_MSK |
|
325 iCurrentMskId = KErrNotFound; |
|
326 iShowContextMenu = EFalse; |
|
327 iCollectionCacheReady = ETrue; |
|
328 #endif // __ENABLE_MSK |
|
329 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
330 iPodcast = EFalse; |
|
331 #endif // __ENABLE_PODCAST_IN_MUSIC_MENU |
|
332 iInAlbumArtDialog = EFalse; |
|
333 |
|
334 iMarkedAll = EFalse; |
|
335 // grab the current process priority |
|
336 RProcess proc; |
|
337 iPriority = proc.Priority(); |
|
338 } |
|
339 |
|
340 void CMPXCollectionViewHgImp::HandleStatusPaneSizeChange() |
|
341 { |
|
342 MPX_FUNC( "CMPXCollectionViewHgImp::HandleStatusPaneSizeChange" ); |
|
343 CMPXCollectionViewHg::HandleStatusPaneSizeChange(); |
|
344 if ( iContainer ) |
|
345 { |
|
346 iContainer->SetRect( ClientRect() ); |
|
347 } |
|
348 } |
|
349 |
|
350 // --------------------------------------------------------------------------- |
|
351 // Symbian 2nd phase constructor can leave. |
|
352 // --------------------------------------------------------------------------- |
|
353 // |
|
354 void CMPXCollectionViewHgImp::ConstructL() |
|
355 { |
|
356 MPX_FUNC( "CMPXCollectionViewHgImp::ConstructL" ); |
|
357 |
|
358 // initialize FeatureManager |
|
359 FeatureManager::InitializeLibL(); |
|
360 |
|
361 if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) ) |
|
362 { |
|
363 iCoverDisplay = ETrue; |
|
364 iCommandInitiator = CMediatorCommandInitiator::NewL( NULL ); |
|
365 } |
|
366 else |
|
367 { |
|
368 iCoverDisplay = EFalse; |
|
369 } |
|
370 |
|
371 |
|
372 CCoeEnv* coeEnv( iEikonEnv ); |
|
373 TParse parse; |
|
374 parse.Set( KMPXCollectionRscPath, &KDC_APP_RESOURCE_DIR, NULL ); |
|
375 TFileName resourceFile( parse.FullName() ); |
|
376 User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) ); |
|
377 BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile ); |
|
378 iResourceOffset = coeEnv->AddResourceFileL( resourceFile ); |
|
379 |
|
380 BaseConstructL( R_MPX_COLLECTION_VIEW ); |
|
381 |
|
382 iIsEmbedded = iEikonEnv->StartedAsServerApp(); |
|
383 |
|
384 // create a new collection utility bound to the default context. |
|
385 iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeDefault ); |
|
386 iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault ); |
|
387 iPlaybackUtility->AddObserverL( *this ); |
|
388 iViewUtility = MMPXViewUtility::UtilityL(); |
|
389 iViewUtility->AddObserverL( this ); |
|
390 iBottomIndex = new (ELeave) CArrayFixFlat<TInt>( 1 ); |
|
391 |
|
392 iCommonUiHelper = CMPXCommonUiHelper::NewL( iCollectionUtility ); |
|
393 iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL(); |
|
394 |
|
395 // Monitor for view activation |
|
396 AppUi()->AddViewActivationObserverL( this ); |
|
397 |
|
398 if (!iUpnpCopyCommand ) |
|
399 { |
|
400 MPX_TRAPD ( error, iUpnpCopyCommand = CUpnpCopyCommand::NewL() ); |
|
401 if ( error == KErrNone ) |
|
402 { |
|
403 iUpnpFrameworkSupport = ETrue; |
|
404 iServiceHandler = CAiwServiceHandler::NewL(); |
|
405 MPX_DEBUG1("CMPXCollectionViewHgImp::ConstructL() Attaching 'Copy to external' menu service..."); |
|
406 MPX_TRAP( iErrorAttachCopyMenu, iServiceHandler->AttachMenuL( R_MPX_COLLECTION_VIEW_MENU_1, |
|
407 R_MPX_UPNP_COPY_TO_EXTERNAL_MENU_INTEREST ) ); |
|
408 if ( iErrorAttachCopyMenu == KErrNotSupported ) |
|
409 { |
|
410 // when CCoeEnv is not available |
|
411 User::Leave( iErrorAttachCopyMenu ); |
|
412 } |
|
413 MPX_DEBUG2( "CMPXCollectionViewHgImp::ConstructL(): attach Copy menu error: %d", iErrorAttachCopyMenu ); |
|
414 } |
|
415 else |
|
416 { |
|
417 iUpnpFrameworkSupport = EFalse; |
|
418 iUpnpCopyCommand = NULL; |
|
419 } |
|
420 } |
|
421 iMediaRecognizer = CMediaRecognizer::NewL(); |
|
422 if ( iServiceHandler == NULL) |
|
423 { |
|
424 iServiceHandler = CAiwServiceHandler::NewL(); |
|
425 } |
|
426 MPX_DEBUG1("CMPXCollectionViewHgImp::ConstructL() Attaching 'use tone as' menu service..."); |
|
427 MPX_TRAP( iErrorAttachAssignMenu, iServiceHandler->AttachMenuL( R_MPX_USE_AS_CASCADE, |
|
428 R_MPX_AIW_ASSIGN_INTEREST ) ); |
|
429 |
|
430 iNaviPane = |
|
431 static_cast<CAknNavigationControlContainer*> |
|
432 ( iAvkonViewAppUi->StatusPane()->ControlL( |
|
433 TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
434 iNaviDecorator = iNaviPane->CreateNavigationLabelL( KNullDesC ); |
|
435 //Create label to change text in Navi pane |
|
436 iNaviLabel = static_cast<CAknNaviLabel*> |
|
437 ( iNaviDecorator->DecoratedControl() ); |
|
438 |
|
439 TInt flags( 0 ); |
|
440 CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures ); |
|
441 repository->Get( KMPXMPLocalVariation, flags ); |
|
442 delete repository; |
|
443 iGoToMusicShopOptionHidden = |
|
444 !static_cast<TBool>( flags & KMPXEnableGoToMusicShopOption ); |
|
445 iUsingNokiaService = |
|
446 static_cast<TBool>( flags & KMPXEnableFindInMusicShopOption ); |
|
447 MPX_DEBUG2( "CMPXCollectionViewHgImp::ConstructL(): iUsingNokiaService: %d", iUsingNokiaService ); |
|
448 iDisablePodcasting = flags&KMPXDisablePodcastingOption ? ETrue : EFalse; |
|
449 |
|
450 #ifdef _DEBUG |
|
451 iExitOptionHidden = EFalse; |
|
452 #else // _DEBUG |
|
453 iExitOptionHidden = iCommonUiHelper->ExitOptionHiddenL() && !iIsEmbedded; |
|
454 #endif // _DEBUG |
|
455 |
|
456 iBottomIndex->AppendL( 0 ); |
|
457 iProfileEngine = CreateProfileEngineL(); |
|
458 |
|
459 _LIT_SECURITY_POLICY_C1(KMPlayerRemoteReadPolicy, ECapabilityReadUserData); |
|
460 _LIT_SECURITY_POLICY_C1(KMPlayerRemoteWritePolicy, ECapabilityWriteUserData); |
|
461 |
|
462 if (iGoToMusicShopOptionHidden) |
|
463 { |
|
464 iMusicStoreUID = 0; |
|
465 } |
|
466 else |
|
467 { |
|
468 // Get music store uid from cenrep |
|
469 // |
|
470 TBuf8< KUIDMaxLength > musicStoreUID; |
|
471 TRAP_IGNORE( |
|
472 { |
|
473 CRepository* repository = CRepository::NewL( KCRUidMPXMPSettings ); |
|
474 repository->Get( KMPXMusicStoreUID, musicStoreUID ); |
|
475 delete repository; |
|
476 repository = NULL; |
|
477 } ); |
|
478 |
|
479 GetUint32Presentation( iMusicStoreUID, musicStoreUID, 0 ); |
|
480 if (iMusicStoreUID == 0) |
|
481 { |
|
482 iGoToMusicShopOptionHidden = ETrue; |
|
483 } |
|
484 } |
|
485 MPX_DEBUG2("CMPXCollectionViewHgImp::ConstructL musicStoreUID = %x", iMusicStoreUID); |
|
486 |
|
487 TInt retval(KErrNone); |
|
488 // P/S key for music shop |
|
489 retval = RProperty::Define( TUid::Uid(iMusicStoreUID), |
|
490 KMShopCategoryId, |
|
491 RProperty::EInt, |
|
492 KMPlayerRemoteReadPolicy, |
|
493 KMPlayerRemoteWritePolicy ); |
|
494 |
|
495 if( retval != KErrAlreadyExists) |
|
496 { |
|
497 RProperty::Set( TUid::Uid(iMusicStoreUID), |
|
498 KMShopCategoryId, |
|
499 KFindInMShopKeyInValid ); // initialize Find In Musicshop was not called |
|
500 |
|
501 |
|
502 RProperty::Define( TUid::Uid(iMusicStoreUID), |
|
503 KMShopCategoryName, |
|
504 RProperty::ELargeText, |
|
505 KMPlayerRemoteReadPolicy, |
|
506 KMPlayerRemoteWritePolicy ); |
|
507 } |
|
508 |
|
509 iCachedSelectionIndex = new ( ELeave )CArrayFixFlat<TInt>( KMPXArrayGranularity ); |
|
510 iIncrementalOpenUtil = CMPXCollectionOpenUtility::NewL( this ); |
|
511 |
|
512 // Initialize the Back Stepping Service Utility with the MPX Music Player |
|
513 iBackSteppingUtility = MMPXBackSteppingUtility::UtilityL(); |
|
514 iBackSteppingUtility->InitializeL( |
|
515 TUid::Uid( KMusicPlayerAppUidConstant ) ); |
|
516 iActivateBackStepping = EFalse; |
|
517 |
|
518 iIsAddingToPlaylist = EFalse; |
|
519 |
|
520 // Get music store information from cenrep |
|
521 // |
|
522 TBuf8< KUIDMaxLength > operatorMusicStoreUID; |
|
523 |
|
524 iOperatorMusicStoreName = HBufC16::NewL( KMPXMaxHistoryLength ); |
|
525 TPtr operatorMusicStoreMenuOption = iOperatorMusicStoreName->Des(); |
|
526 |
|
527 HBufC16* musicStoreJavaName = HBufC16::NewLC( KMPXMaxHistoryLength ); |
|
528 TPtr operatorMusicStoreJavaName = musicStoreJavaName->Des(); |
|
529 |
|
530 TRAP_IGNORE( |
|
531 { |
|
532 CRepository* musicshoprepository = CRepository::NewL( KCRUidMPXMPSettings ); |
|
533 musicshoprepository->Get( KOperatorMusicStore, iOperatorMusicStore ); |
|
534 if(iOperatorMusicStore) |
|
535 { |
|
536 musicshoprepository->Get( KOperatorMusicStoreType, iOperatorMusicStoreType ); |
|
537 musicshoprepository->Get( KOperatorMusicStoreDisplayName, operatorMusicStoreMenuOption ); |
|
538 if (iOperatorMusicStoreType == KJavaMusicShopType) |
|
539 { |
|
540 musicshoprepository->Get( KOperatorMusicStoreJavaName, operatorMusicStoreJavaName ); |
|
541 } |
|
542 else |
|
543 { |
|
544 musicshoprepository->Get( KOperatorMusicStoreNativeUid, operatorMusicStoreUID ); |
|
545 GetUint32Presentation( iOperatorNativeMusicStoreUID, operatorMusicStoreUID, 0 ); |
|
546 |
|
547 musicshoprepository->Get(KOperatorMusicStoreWebPage, iMusicStoreWebPage); |
|
548 iOperatorMusicStoreURI = HBufC16::NewL( KMPXMaxHistoryLength ); |
|
549 TPtr16 operatorMusicStoreuri = iOperatorMusicStoreURI->Des(); |
|
550 musicshoprepository->Get(KOperatorMusicStoreURI, operatorMusicStoreuri); |
|
551 |
|
552 } |
|
553 } |
|
554 delete musicshoprepository; |
|
555 musicshoprepository = NULL; |
|
556 } ); |
|
557 |
|
558 if(iOperatorMusicStoreType == KJavaMusicShopType) |
|
559 { |
|
560 TApaAppInfo appInfo; |
|
561 RApaLsSession apaSession; |
|
562 User::LeaveIfError( apaSession.Connect() ); |
|
563 CleanupClosePushL( apaSession ); |
|
564 User::LeaveIfError( apaSession.GetAllApps() ); |
|
565 |
|
566 while ( apaSession.GetNextApp( appInfo ) == KErrNone ) |
|
567 { |
|
568 if(appInfo.iFullName.Right(8).Compare(_L(".fakeapp")) == 0) |
|
569 { |
|
570 TApaAppCaption appname; |
|
571 appname = appInfo.iCaption ; |
|
572 if (!appInfo.iCaption.Compare(operatorMusicStoreJavaName)) |
|
573 { |
|
574 iOperatorMusicStoreUID = appInfo.iUid; |
|
575 } |
|
576 } |
|
577 } |
|
578 CleanupStack::PopAndDestroy(&apaSession); // close apaSession |
|
579 } |
|
580 //else |
|
581 // { |
|
582 // GetUint32Presentation( iMusicStoreUID, operatorMusicStoreUID, 0 ); |
|
583 // } |
|
584 CleanupStack::PopAndDestroy(musicStoreJavaName); |
|
585 |
|
586 TInt retval2(KErrNone); |
|
587 // P/S key for usb unblocking |
|
588 retval2 = RProperty::Define( KMPXViewPSUid, |
|
589 KMPXUSBUnblockingPSStatus, |
|
590 RProperty::EInt, |
|
591 KMPlayerRemoteReadPolicy, |
|
592 KMPlayerRemoteWritePolicy ); |
|
593 |
|
594 TInt usbStatus; |
|
595 RProperty::Get(KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, usbStatus); |
|
596 |
|
597 |
|
598 // if object doesn't exist or the usb doesn't connect |
|
599 if(( retval2 != KErrAlreadyExists ) |
|
600 || ( usbStatus != KUsbPersonalityIdPCSuite |
|
601 || usbStatus != KUsbPersonalityIdMS |
|
602 || usbStatus != KUsbPersonalityIdPTP |
|
603 || usbStatus != KUsbPersonalityIdMTP |
|
604 || usbStatus != KUsbPersonalityIdPCSuiteMTP )) |
|
605 { |
|
606 RProperty::Set( KMPXViewPSUid, |
|
607 KMPXUSBUnblockingPSStatus, |
|
608 EMPXUSBUnblockingPSStatusUninitialized ); |
|
609 } |
|
610 // if usb mode is in MTP mode or pc suite mode |
|
611 else if ( usbStatus == KUsbPersonalityIdMTP |
|
612 || usbStatus == KUsbPersonalityIdPCSuiteMTP |
|
613 || usbStatus == KUsbPersonalityIdPCSuite ) |
|
614 { |
|
615 RProperty::Set( KMPXViewPSUid, |
|
616 KMPXUSBUnblockingPSStatus, |
|
617 EMPXUSBUnblockingPSStatusActive ); |
|
618 } |
|
619 } |
|
620 |
|
621 // --------------------------------------------------------------------------- |
|
622 // Delete the selected items |
|
623 // --------------------------------------------------------------------------- |
|
624 // |
|
625 void CMPXCollectionViewHgImp::DeleteSelectedItemsL(TInt aCommand) |
|
626 { |
|
627 MPX_FUNC( "CMPXCollectionViewHgImp::DeleteSelectedItemsL" ); |
|
628 |
|
629 // if reorder mode is on, or something is currently deleting, disable delete |
|
630 TBool isIgnore( iContainer->IsInReorderMode() || iIsDeleting ); |
|
631 |
|
632 CMPXCommonListBoxArrayBase* listboxArray( |
|
633 iContainer->ListBoxArray() ); |
|
634 const CMPXMedia& containerMedia( listboxArray->ContainerMedia() ); |
|
635 TInt currentIndex( iContainer->CurrentLbxItemIndex() ); |
|
636 |
|
637 // Marked indicies |
|
638 // cannot use the caches indexes since this can be reached by pressing the cancel key |
|
639 const CArrayFix<TInt>* array ( |
|
640 iContainer->CurrentSelectionIndicesL() ); // not owned |
|
641 TInt arrayCount( array->Count() ); |
|
642 |
|
643 if ( !isIgnore ) |
|
644 { |
|
645 if ( iContainer->CurrentListItemCount() == 0 ) |
|
646 { |
|
647 // list is empty |
|
648 isIgnore = ETrue; |
|
649 } |
|
650 if ( !isIgnore && |
|
651 containerMedia.IsSupported( KMPXMediaGeneralNonPermissibleActions ) ) |
|
652 { |
|
653 TMPXGeneralNonPermissibleActions attr( |
|
654 containerMedia.ValueTObjectL<TMPXGeneralNonPermissibleActions>( |
|
655 KMPXMediaGeneralNonPermissibleActions ) ); |
|
656 if ( attr & EMPXWrite ) |
|
657 { |
|
658 isIgnore = ETrue; |
|
659 } |
|
660 } |
|
661 if ( !isIgnore ) |
|
662 { |
|
663 const CMPXMedia& media( listboxArray->MediaL( currentIndex ) ); |
|
664 if ( ( arrayCount == 0 || arrayCount == 1 ) && |
|
665 ( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId ) ) |
|
666 { |
|
667 // not marked, or only 1 item is marked |
|
668 // and the highlighted item is not yet available |
|
669 isIgnore = ETrue; |
|
670 } |
|
671 else if ( media.IsSupported( KMPXMediaGeneralNonPermissibleActions ) ) |
|
672 { |
|
673 TMPXGeneralNonPermissibleActions attr( |
|
674 media.ValueTObjectL<TMPXGeneralNonPermissibleActions>( |
|
675 KMPXMediaGeneralNonPermissibleActions ) ); |
|
676 if ( attr & EMPXWrite ) |
|
677 { |
|
678 isIgnore = ETrue; |
|
679 } |
|
680 } |
|
681 } |
|
682 } |
|
683 |
|
684 if ( !isIgnore ) |
|
685 { |
|
686 // Create a copy of collection path |
|
687 CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() ); |
|
688 CleanupStack::PushL( path ); |
|
689 HBufC* promptTxt( NULL ); |
|
690 HBufC* waitNoteText( NULL ); |
|
691 TInt waitNoteCBA( R_AVKON_SOFTKEYS_EMPTY ); |
|
692 MPX_DEBUG2( "CMPXCollectionViewHgImp::DeleteSelectedItemsL delete array count = %d", arrayCount ); |
|
693 |
|
694 TMPXGeneralType containerType( |
|
695 containerMedia.ValueTObjectL<TMPXGeneralType>( |
|
696 KMPXMediaGeneralType ) ); |
|
697 TMPXGeneralCategory containerCategory( |
|
698 containerMedia.ValueTObjectL<TMPXGeneralCategory>( |
|
699 KMPXMediaGeneralCategory ) ); |
|
700 |
|
701 if ( arrayCount > 1 ) |
|
702 { |
|
703 if ( containerType == EMPXItem && containerCategory == EMPXPlaylist ) |
|
704 { |
|
705 // playlist view |
|
706 waitNoteText = StringLoader::LoadLC( |
|
707 R_MPX_QTN_NMP_NOTE_REMOVING_MANY ); |
|
708 promptTxt = StringLoader::LoadLC( |
|
709 R_MPX_QTN_MUS_QUERY_CONF_REMOVE_MANY, |
|
710 arrayCount ); |
|
711 } |
|
712 else |
|
713 { |
|
714 waitNoteText = StringLoader::LoadLC( |
|
715 R_MPX_QTN_NMP_DEL_SONGS_WAIT_NOTE ); |
|
716 promptTxt = StringLoader::LoadLC( |
|
717 R_MPX_QTN_NMP_DEL_SONGS_QUERY, |
|
718 arrayCount ); |
|
719 } |
|
720 waitNoteCBA = R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP; |
|
721 iConfirmationDlg = CAknQueryDialog::NewL( |
|
722 CAknQueryDialog::EConfirmationTone ); |
|
723 if ( iCoverDisplay ) |
|
724 { |
|
725 if ( containerType == EMPXItem && containerCategory == EMPXPlaylist ) |
|
726 { |
|
727 iConfirmationDlg->PublishDialogL( |
|
728 EMPlayerQueryRemoveTracks, |
|
729 KMPlayerNoteCategory); |
|
730 iWaitNoteId = EMPlayerNoteRemovingMany; |
|
731 } |
|
732 else |
|
733 { |
|
734 iConfirmationDlg->PublishDialogL( |
|
735 EMPlayerQueryDeleteTracks, |
|
736 KMPlayerNoteCategory); |
|
737 iWaitNoteId = EMPlayerNoteDeletingMany; |
|
738 } |
|
739 CAknMediatorFacade* covercl( |
|
740 AknMediatorFacade( iConfirmationDlg ) ); |
|
741 if ( covercl ) |
|
742 { |
|
743 covercl->BufStream().WriteInt32L( arrayCount ); |
|
744 } |
|
745 } |
|
746 if(iCollectionReady || aCommand == EMPXCmdCommonDelete ) |
|
747 { |
|
748 for ( TInt i = 0; i < arrayCount; i++ ) |
|
749 { |
|
750 MPX_DEBUG2( "CMPXCollectionViewHgImp::DeleteSelectedItemsL delete array index = %d", array->At( i ) ); |
|
751 path->SelectL( array->At(i) ); |
|
752 } |
|
753 } |
|
754 } |
|
755 else |
|
756 { |
|
757 // not marked, process the highlighted item |
|
758 const CMPXMedia& media( listboxArray->MediaL( |
|
759 ( arrayCount > 0 ) ? array->At( 0 ) : currentIndex ) ); |
|
760 const TDesC& title( media.ValueText( KMPXMediaGeneralTitle ) ); |
|
761 |
|
762 TMPXGeneralType type( |
|
763 media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) ); |
|
764 TMPXGeneralCategory category( |
|
765 media.ValueTObjectL<TMPXGeneralCategory>( |
|
766 KMPXMediaGeneralCategory ) ); |
|
767 |
|
768 if ( containerType == EMPXItem && containerCategory == EMPXPlaylist ) |
|
769 { |
|
770 // playlist view |
|
771 waitNoteText = StringLoader::LoadLC( |
|
772 R_MPX_QTN_MUS_NOTE_REMOVING_TRACK, title ); |
|
773 promptTxt = StringLoader::LoadLC( |
|
774 R_MPX_QTN_MUS_QUERY_CONF_REMOVE_TRACK, |
|
775 title ); |
|
776 } |
|
777 else if ( containerType == EMPXItem && containerCategory == EMPXArtist |
|
778 && type == EMPXItem && category == EMPXAlbum && currentIndex == 0 ) |
|
779 { |
|
780 // deleting first entry in artist/album view |
|
781 const TDesC& containerTitle( |
|
782 containerMedia.ValueText( KMPXMediaGeneralTitle ) ); |
|
783 waitNoteText = StringLoader::LoadLC( |
|
784 R_MPX_QTN_MUS_QUERY_CONF_DELETE_ALL, containerTitle ); |
|
785 waitNoteCBA = R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP; |
|
786 promptTxt = StringLoader::LoadLC( |
|
787 R_MPX_QTN_NMP_QUERY_CONF_DELETE_GROUP, |
|
788 containerTitle ); |
|
789 } |
|
790 else |
|
791 { |
|
792 if ( ( type == EMPXItem && category == EMPXSong ) || |
|
793 ( type == EMPXItem && category == EMPXPlaylist ) ) |
|
794 { |
|
795 // tracks level, or deleting a playlist |
|
796 waitNoteText = StringLoader::LoadLC( |
|
797 R_MPX_QTN_ALBUM_WAITING_DELETING, title ); |
|
798 promptTxt = StringLoader::LoadLC( |
|
799 R_MPX_QTN_QUERY_COMMON_CONF_DELETE, |
|
800 title ); |
|
801 } |
|
802 else |
|
803 { |
|
804 // deleting a group |
|
805 if ( ( currentIndex == ( iContainer->CurrentListItemCount() - 1 ) ) && |
|
806 title.Compare( KNullDesC ) == 0 ) |
|
807 { |
|
808 // check for unknown entry |
|
809 // if it's the last entry, and it's null text |
|
810 // load "unknown" text to display in prompt |
|
811 HBufC* unknownText( StringLoader::LoadLC( R_MPX_QTN_MP_UNKNOWN ) ); |
|
812 waitNoteText = StringLoader::LoadLC( |
|
813 R_MPX_QTN_MUS_QUERY_CONF_DELETE_ALL, *unknownText ); |
|
814 promptTxt = StringLoader::LoadL( |
|
815 R_MPX_QTN_NMP_QUERY_CONF_DELETE_GROUP, *unknownText ); |
|
816 CleanupStack::Pop( waitNoteText ); |
|
817 CleanupStack::PopAndDestroy( unknownText ); |
|
818 CleanupStack::PushL( waitNoteText ); |
|
819 CleanupStack::PushL( promptTxt ); |
|
820 } |
|
821 else |
|
822 { |
|
823 waitNoteText = StringLoader::LoadLC( |
|
824 R_MPX_QTN_MUS_QUERY_CONF_DELETE_ALL, title ); |
|
825 promptTxt = StringLoader::LoadLC( |
|
826 R_MPX_QTN_NMP_QUERY_CONF_DELETE_GROUP, title ); |
|
827 } |
|
828 waitNoteCBA = R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP; |
|
829 } |
|
830 } |
|
831 iConfirmationDlg = CAknQueryDialog::NewL( |
|
832 CAknQueryDialog::EConfirmationTone ); |
|
833 if ( iCoverDisplay ) |
|
834 { |
|
835 if ( containerType == EMPXItem && containerCategory == EMPXPlaylist ) |
|
836 { |
|
837 iConfirmationDlg->PublishDialogL( |
|
838 EMPlayerQueryRemoveTrack, |
|
839 KMPlayerNoteCategory); |
|
840 iWaitNoteId = EMPlayerNoteRemovingTrack; |
|
841 } |
|
842 else if ( containerType == EMPXItem && containerCategory == EMPXArtist |
|
843 && type == EMPXItem && category == EMPXAlbum && currentIndex == 0 ) |
|
844 { |
|
845 iConfirmationDlg->PublishDialogL( |
|
846 EMPlayerQueryDeleteCategory, |
|
847 KMPlayerNoteCategory); |
|
848 iWaitNoteId = EMPlayerNoteDeletingSingle; |
|
849 } |
|
850 else |
|
851 { |
|
852 if ( ( type == EMPXItem && category == EMPXSong ) || |
|
853 ( type == EMPXItem && category == EMPXPlaylist ) ) |
|
854 { |
|
855 // tracks level |
|
856 iConfirmationDlg->PublishDialogL( |
|
857 EMPlayerQueryDeleteCategory, |
|
858 KMPlayerNoteCategory); |
|
859 iWaitNoteId = EMPlayerNoteDeletingSingle; |
|
860 } |
|
861 else |
|
862 { |
|
863 iConfirmationDlg->PublishDialogL( |
|
864 EMPlayerQueryDeleteTrack, |
|
865 KMPlayerNoteCategory); |
|
866 iWaitNoteId = EMPlayerNoteDeletingSingle; |
|
867 } |
|
868 } |
|
869 CAknMediatorFacade* covercl( |
|
870 AknMediatorFacade( iConfirmationDlg ) ); |
|
871 if ( covercl ) |
|
872 { |
|
873 covercl->BufStream() << title; |
|
874 } |
|
875 iItemTitle.Set( title ); |
|
876 } |
|
877 //#endif //__COVER_DISPLAY |
|
878 // Cover UI end |
|
879 if(iCollectionReady || aCommand == EMPXCmdCommonDelete ) |
|
880 { |
|
881 path->SelectL( arrayCount > 0 ? array->At( 0 ) : currentIndex ); |
|
882 } |
|
883 } |
|
884 iConfirmationDlg->SetPromptL( *promptTxt ); |
|
885 CleanupStack::PopAndDestroy( promptTxt ); |
|
886 TBool performDelete(EFalse); |
|
887 if(iCachedCommand == aCommand) |
|
888 { |
|
889 performDelete = ETrue; |
|
890 } |
|
891 if (!performDelete) |
|
892 { |
|
893 if ( iConfirmationDlg->ExecuteLD( R_MPX_CUI_DELETE_CONFIRMATION_QUERY ) ) |
|
894 { |
|
895 performDelete = ETrue; |
|
896 } |
|
897 } |
|
898 if (performDelete) |
|
899 { |
|
900 HandleCommandL( EMPXCmdIgnoreExternalCommand ); |
|
901 // Cover UI start |
|
902 //#ifdef __COVER_DISPLAY |
|
903 if ( iCoverDisplay ) |
|
904 { |
|
905 InitiateWaitDialogL(); |
|
906 } |
|
907 //#endif // __COVER_DISPLAY |
|
908 // Cover UI end |
|
909 MPX_PERF_START_EX( MPX_PERF_SHOW_WAITNOTE ); |
|
910 if(iCachedCommand != aCommand) |
|
911 { |
|
912 iIsWaitNoteCanceled = EFalse; |
|
913 StartProgressNoteL(); |
|
914 TPtr buf = waitNoteText->Des(); |
|
915 UpdateProcessL(0, buf); |
|
916 } |
|
917 |
|
918 if ( !iIsWaitNoteCanceled ) |
|
919 { |
|
920 iIsDeleting = ETrue; |
|
921 iCollectionUiHelper->DeleteL( *path, this ); |
|
922 } |
|
923 else if( iContainer ) |
|
924 { |
|
925 // delete was canceled before it even began, clear marked items |
|
926 iContainer->ClearLbxSelection(); |
|
927 } |
|
928 iIsWaitNoteCanceled = EFalse; |
|
929 |
|
930 |
|
931 if(iContainer->FindBoxVisibility()) |
|
932 { |
|
933 iContainer->EnableFindBox(EFalse); |
|
934 } |
|
935 } |
|
936 iConfirmationDlg = NULL; |
|
937 CleanupStack::PopAndDestroy( waitNoteText ); |
|
938 CleanupStack::PopAndDestroy( path ); |
|
939 } |
|
940 } |
|
941 |
|
942 // --------------------------------------------------------------------------- |
|
943 // Initiates wait dialog |
|
944 // --------------------------------------------------------------------------- |
|
945 // |
|
946 void CMPXCollectionViewHgImp::InitiateWaitDialogL() |
|
947 { |
|
948 if ( iCommandInitiator ) |
|
949 { |
|
950 HBufC8* filename8 = HBufC8::NewLC( KMaxFileName ); |
|
951 filename8->Des().Copy( iItemTitle ); |
|
952 HBufC8* data = HBufC8::NewLC(KMaxFileName); |
|
953 |
|
954 TPtr8 dataPtr = data->Des(); |
|
955 RDesWriteStream str(dataPtr); |
|
956 |
|
957 TPtrC8 b(KNullDesC8); |
|
958 b.Set(*filename8); |
|
959 |
|
960 str << b; |
|
961 str.CommitL(); |
|
962 |
|
963 iCommandInitiator->IssueCommand( KMediatorSecondaryDisplayDomain, |
|
964 KMPlayerNoteCategory, |
|
965 iWaitNoteId, |
|
966 TVersion ( 0,0,0 ), |
|
967 *data ); |
|
968 |
|
969 CleanupStack::PopAndDestroy( data ); |
|
970 CleanupStack::PopAndDestroy( filename8 ); |
|
971 } |
|
972 } |
|
973 |
|
974 // --------------------------------------------------------------------------- |
|
975 // Updates list box |
|
976 // --------------------------------------------------------------------------- |
|
977 // |
|
978 void CMPXCollectionViewHgImp::UpdateListBoxL( |
|
979 const CMPXMedia& aEntries, |
|
980 TInt aIndex, |
|
981 TBool aComplete) |
|
982 { |
|
983 MPX_FUNC( "CMPXCollectionViewHgImp::UpdateListBox" ); |
|
984 MPX_DEBUG2( "CMPXCollectionViewHgImp::UpdateListBox aIndex = %d", aIndex ); |
|
985 if ( iContainer ) |
|
986 { |
|
987 CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() ); |
|
988 MPX_DEBUG_PATH(*cpath); |
|
989 |
|
990 CleanupStack::PushL( cpath ); |
|
991 |
|
992 TInt topIndex = 0; |
|
993 if (iContainer->IsInReorderMode()) |
|
994 { |
|
995 TInt currentItem( iContainer->CurrentLbxItemIndex() ); |
|
996 TInt currentBottomIndex( iContainer->BottomLbxItemIndex() ); |
|
997 topIndex = iContainer->CalculateTopIndex( currentBottomIndex ) ; |
|
998 } |
|
999 |
|
1000 CMPXCommonListBoxArrayBase* array( iContainer->ListBoxArray() ); |
|
1001 array->ResetMediaArrayL(); |
|
1002 array->AppendMediaL( aEntries ); |
|
1003 iCollectionCacheReady = ETrue; |
|
1004 //keep the marked item indicies |
|
1005 const CArrayFix<TInt>* markedList = iContainer->CurrentSelectionIndicesL(); |
|
1006 if ( iFirstIncrementalBatch ) |
|
1007 { |
|
1008 iContainer->HandleLbxItemAdditionL(); |
|
1009 iFirstIncrementalBatch = EFalse; |
|
1010 } |
|
1011 else |
|
1012 { |
|
1013 iContainer->HandleListBoxArrayEventL( |
|
1014 MMPXCommonListBoxArrayObserver::EMPXCommonListBoxArrayEventMediaArrayChange ); |
|
1015 } |
|
1016 |
|
1017 if (aComplete) |
|
1018 { |
|
1019 iFirstIncrementalBatch = ETrue; |
|
1020 } |
|
1021 //mark all again after list box item addition |
|
1022 if (iMarkedAll) |
|
1023 { |
|
1024 iContainer->HandleMarkableListProcessCommandL(EAknMarkAll); |
|
1025 if (aComplete) |
|
1026 { |
|
1027 iMarkedAll = EFalse; |
|
1028 } |
|
1029 } |
|
1030 //mark again individual items after list box item addition |
|
1031 else if ( markedList ) |
|
1032 { |
|
1033 TInt markedItemCount( markedList->Count() ); |
|
1034 if ( markedItemCount >0 ) |
|
1035 { |
|
1036 iContainer->SetCurrentSelectionIndicesL( const_cast<CArrayFix<TInt>*>(markedList) ); |
|
1037 } |
|
1038 } |
|
1039 UpdatePlaybackStatusL(); |
|
1040 |
|
1041 if ( iBackOneLevel || iPossibleJump ) |
|
1042 { |
|
1043 if ( cpath->Levels() == iLastDepth ) |
|
1044 { |
|
1045 iLastDepth--; |
|
1046 iContainer->SetLbxTopItemIndex( |
|
1047 iContainer->CalculateTopIndex( |
|
1048 iBottomIndex->At( iLastDepth ) ) ); |
|
1049 iContainer->SetLbxCurrentItemIndexAndDraw( aIndex ); |
|
1050 iBottomIndex->Delete( iLastDepth ); |
|
1051 } |
|
1052 else |
|
1053 { |
|
1054 MPX_DEBUG1( "CMPXCollectionViewHgImp::UpdateListBox Invalid history, rebuilding" ); |
|
1055 // invalid path, rebuild with all 0. possibily caused by a jump in views |
|
1056 iBottomIndex->Reset(); |
|
1057 iLastDepth = cpath->Levels(); |
|
1058 for ( TInt i = 0; i < iLastDepth; i++ ) |
|
1059 { |
|
1060 iBottomIndex->AppendL( 0 ); |
|
1061 } |
|
1062 iContainer->SetLbxCurrentItemIndexAndDraw( aIndex ); |
|
1063 } |
|
1064 iPossibleJump = EFalse; |
|
1065 iBackOneLevel = EFalse; |
|
1066 } |
|
1067 else |
|
1068 { |
|
1069 if ( iAddingSong ) |
|
1070 { |
|
1071 // always highlight the last item when a track |
|
1072 // is added in add tracks view |
|
1073 TInt currentItemCount = |
|
1074 iContainer->CurrentListItemCount(); |
|
1075 if ( currentItemCount > 0 ) |
|
1076 { |
|
1077 iContainer-> |
|
1078 SetLbxCurrentItemIndexAndDraw( currentItemCount - 1 ); |
|
1079 } |
|
1080 } |
|
1081 else if ( iCurrentHighlightedIndex > KErrNotFound && |
|
1082 ( iCurrentHighlightedIndex < |
|
1083 iContainer->CurrentListItemCount() ) ) |
|
1084 { |
|
1085 if (iContainer->IsInReorderMode()) |
|
1086 { |
|
1087 iContainer->SetLbxTopItemIndex( topIndex ); |
|
1088 } |
|
1089 iContainer-> |
|
1090 SetLbxCurrentItemIndexAndDraw( iCurrentHighlightedIndex ); |
|
1091 iCollectionUtility->Collection().CommandL( |
|
1092 EMcCmdSelect, iCurrentHighlightedIndex ); |
|
1093 iCurrentHighlightedIndex = KErrNotFound; |
|
1094 } |
|
1095 else if ( ( aIndex > 0 ) |
|
1096 && ( aIndex < iContainer->CurrentListItemCount() ) ) |
|
1097 { |
|
1098 iContainer->SetLbxCurrentItemIndexAndDraw( aIndex ); |
|
1099 } |
|
1100 else |
|
1101 { |
|
1102 iContainer->SetLbxCurrentItemIndexAndDraw( 0 ); |
|
1103 } |
|
1104 } |
|
1105 if (!aComplete || cpath->Levels() == KMusicCollectionMenuLevel || iContainer->IsInReorderMode()) |
|
1106 { |
|
1107 iContainer->EnableFindBox(EFalse); |
|
1108 } |
|
1109 else |
|
1110 { |
|
1111 iContainer->EnableFindBox(ETrue); |
|
1112 } |
|
1113 |
|
1114 CleanupStack::PopAndDestroy( cpath ); |
|
1115 } |
|
1116 } |
|
1117 |
|
1118 // --------------------------------------------------------------------------- |
|
1119 // Displays error notes. |
|
1120 // --------------------------------------------------------------------------- |
|
1121 // |
|
1122 void CMPXCollectionViewHgImp::HandleError( TInt aError ) |
|
1123 { |
|
1124 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleError(%d)", aError ); |
|
1125 ASSERT( aError ); |
|
1126 |
|
1127 // only display error message if collection view is in the foreground |
|
1128 if ( iContainer ) |
|
1129 { |
|
1130 TRAP_IGNORE( iCommonUiHelper->HandleErrorL( aError ) ); |
|
1131 } |
|
1132 } |
|
1133 |
|
1134 // --------------------------------------------------------------------------- |
|
1135 // Updates the navi pane |
|
1136 // --------------------------------------------------------------------------- |
|
1137 // |
|
1138 void CMPXCollectionViewHgImp::UpdateNaviPaneL() |
|
1139 { |
|
1140 MPX_FUNC( "CMPXCollectionViewHgImp::UpdateNaviPaneL" ); |
|
1141 if ( iContainer && |
|
1142 (iViewUtility->ActiveViewType() != |
|
1143 TUid::Uid( KMPXPluginTypeAddSongsEditorUid )) && |
|
1144 (iViewUtility->ActiveViewType() != |
|
1145 TUid::Uid( KMPXPluginTypeAlbumArtEditorUid )) && |
|
1146 (iViewUtility->ActiveViewType() != |
|
1147 TUid::Uid( KMPXPluginTypeMetadataEditorUid )) |
|
1148 ) |
|
1149 { |
|
1150 MPX_DEBUG2("CMPXCollectionViewHgImp::UpdateNaviPaneL updating %d", iDuration); |
|
1151 if ( iDuration ) |
|
1152 { |
|
1153 iNaviLabel->SetTextL( *iDuration ); |
|
1154 iNaviPane->PushL( *iNaviDecorator ); |
|
1155 } |
|
1156 else |
|
1157 { |
|
1158 iNaviPane->Pop( iNaviDecorator ); |
|
1159 } |
|
1160 iNaviPane->DrawNow(); |
|
1161 } |
|
1162 } |
|
1163 |
|
1164 // --------------------------------------------------------------------------- |
|
1165 // Updates the title pane |
|
1166 // --------------------------------------------------------------------------- |
|
1167 // |
|
1168 void CMPXCollectionViewHgImp::UpdateTitlePaneL() |
|
1169 { |
|
1170 MPX_FUNC( "CMPXCollectionViewHgImp::UpdateTitlePaneL" ); |
|
1171 // Set title |
|
1172 |
|
1173 if ( iViewUtility->ActiveViewType() == |
|
1174 TUid::Uid( KMPXPluginTypeCollectionUid ) || |
|
1175 ( iViewUtility->ActiveViewType() == |
|
1176 TUid::Uid( KMPXPluginTypeWaitNoteDialogUid ) && iContainer ) ) |
|
1177 { |
|
1178 CAknTitlePane* title( NULL ); |
|
1179 |
|
1180 TRAP_IGNORE( |
|
1181 { |
|
1182 title = static_cast<CAknTitlePane*> |
|
1183 ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
1184 } ); |
|
1185 |
|
1186 if ( title ) |
|
1187 { |
|
1188 if ( iTitle ) |
|
1189 { |
|
1190 title->SetTextL( *iTitle ); |
|
1191 } |
|
1192 else if ( !iIsEmbedded ) |
|
1193 { |
|
1194 // use default title if no metadata is available |
|
1195 // and is not in embedded view |
|
1196 HBufC* titleText = StringLoader::LoadLC( |
|
1197 R_MPX_COLLECTION_VIEW_TITLE ); |
|
1198 title->SetTextL( *titleText ); |
|
1199 CleanupStack::PopAndDestroy( titleText ); |
|
1200 } |
|
1201 } |
|
1202 } |
|
1203 } |
|
1204 |
|
1205 // --------------------------------------------------------------------------- |
|
1206 // Updates playback status indicator |
|
1207 // --------------------------------------------------------------------------- |
|
1208 // |
|
1209 TInt CMPXCollectionViewHgImp::UpdatePlaybackStatusL() |
|
1210 { |
|
1211 MPX_FUNC( "CMPXCollectionViewHgImp::UpdatePlaybackStatusL" ); |
|
1212 TInt ret( KErrNotFound ); // default selection |
|
1213 if ( iContainer ) |
|
1214 { |
|
1215 TMPXPlaybackState pbState( EPbStateNotInitialised ); |
|
1216 TInt selectedIndex( KErrNotFound ); |
|
1217 TMPXItemId selectedItemId( KMPXInvalidItemId ); |
|
1218 CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() ); |
|
1219 CleanupStack::PushL( cpath ); |
|
1220 |
|
1221 MMPXSource* source( iPlaybackUtility->Source() ); |
|
1222 if ( source ) |
|
1223 { |
|
1224 CMPXCollectionPlaylist* playlist( source->PlaylistL() ); |
|
1225 if ( playlist ) |
|
1226 { |
|
1227 CleanupStack::PushL( playlist ); |
|
1228 CMPXCollectionPath* pbPath( |
|
1229 CMPXCollectionPath::NewL( playlist->Path() ) ); |
|
1230 CleanupStack::PushL( pbPath ); |
|
1231 TInt playbackPathCount( pbPath->Levels() ); |
|
1232 if ( cpath->Levels() == playbackPathCount ) |
|
1233 { |
|
1234 // not comparing the index |
|
1235 TBool isEqual( ETrue ); |
|
1236 for ( TInt i = 0; i < playbackPathCount - 1; i++ ) |
|
1237 { |
|
1238 if ( cpath->Id( i ) != pbPath->Id( i ) ) |
|
1239 { |
|
1240 isEqual = EFalse; |
|
1241 break; |
|
1242 } |
|
1243 } |
|
1244 if ( isEqual ) |
|
1245 { |
|
1246 selectedIndex = pbPath->Index(); |
|
1247 selectedItemId = pbPath->Id(); |
|
1248 ret = selectedIndex; |
|
1249 pbState = iPlaybackUtility->StateL(); |
|
1250 } |
|
1251 } |
|
1252 CleanupStack::PopAndDestroy( pbPath ); |
|
1253 CleanupStack::PopAndDestroy( playlist ); |
|
1254 } |
|
1255 } |
|
1256 CleanupStack::PopAndDestroy( cpath ); |
|
1257 if ( selectedIndex != KErrNotFound ) |
|
1258 { |
|
1259 if ( iContainer->IsInReorderMode() ) |
|
1260 { |
|
1261 // in reorder mode, need to pass unique ID to list box |
|
1262 // to search for now playing song |
|
1263 iContainer->SetPlaybackStatusByIdL( selectedItemId, pbState ); |
|
1264 } |
|
1265 else |
|
1266 { |
|
1267 // Fixed for EBLI-7AG8ZN, the Playlist in the Engine is updated |
|
1268 // later than UI (because of Inc Open), so index does not work |
|
1269 iContainer->SetPlaybackStatusByIdL( selectedItemId, pbState, selectedIndex ); |
|
1270 } |
|
1271 } |
|
1272 } |
|
1273 return ret; |
|
1274 } |
|
1275 |
|
1276 // --------------------------------------------------------------------------- |
|
1277 // Start a refreshing note |
|
1278 // --------------------------------------------------------------------------- |
|
1279 // |
|
1280 void CMPXCollectionViewHgImp::StartWaitNoteL( TWaitNoteType aNoteType ) |
|
1281 { |
|
1282 MPX_FUNC( "CMPXCollectionViewHgImp::StartWaitNoteL" ); |
|
1283 TUid waitnoteId = TUid::Uid( KMPXPluginTypeWaitNoteDialogUid ); |
|
1284 TUid activeView = iViewUtility->ActiveViewType(); |
|
1285 if( !iIsEmbedded && activeView != waitnoteId ) |
|
1286 { |
|
1287 TPckg<TWaitNoteType> note = aNoteType; |
|
1288 HBufC* arg = MPXUser::AllocL( note ); |
|
1289 CleanupStack::PushL( arg ); |
|
1290 RProcess proc; |
|
1291 iPriority = proc.Priority(); |
|
1292 proc.SetPriority( EPriorityHigh ); |
|
1293 iNoteType = aNoteType; |
|
1294 iViewUtility->ActivateViewL( waitnoteId, arg ); |
|
1295 CleanupStack::PopAndDestroy( arg ); |
|
1296 } |
|
1297 } |
|
1298 |
|
1299 // --------------------------------------------------------------------------- |
|
1300 // Start a Progress note |
|
1301 // --------------------------------------------------------------------------- |
|
1302 // |
|
1303 void CMPXCollectionViewHgImp::StartProgressNoteL() |
|
1304 { |
|
1305 iProgressDialog = new (ELeave) CAknProgressDialog( |
|
1306 (REINTERPRET_CAST(CEikDialog**, &iProgressDialog)), |
|
1307 ETrue); |
|
1308 iProgressDialog->PrepareLC(R_MPX_PROGRESS_NOTE); |
|
1309 iProgressInfo = iProgressDialog->GetProgressInfoL(); |
|
1310 iProgressDialog->SetCallback(this); |
|
1311 iProgressDialog->RunLD(); |
|
1312 iProgressInfo->SetFinalValue(KProgressBarMaxValue); |
|
1313 } |
|
1314 |
|
1315 // --------------------------------------------------------------------------- |
|
1316 // Update the Progress note |
|
1317 // --------------------------------------------------------------------------- |
|
1318 // |
|
1319 void CMPXCollectionViewHgImp::UpdateProcessL( TInt aProgress, const TDesC& aProgressText ) |
|
1320 { |
|
1321 if ( iProgressDialog ) |
|
1322 { |
|
1323 iProgressDialog->SetTextL(aProgressText); |
|
1324 iProgressInfo->SetAndDraw(aProgress); |
|
1325 } |
|
1326 } |
|
1327 |
|
1328 // --------------------------------------------------------------------------- |
|
1329 // Close waitnote dialog |
|
1330 // --------------------------------------------------------------------------- |
|
1331 // |
|
1332 void CMPXCollectionViewHgImp::CloseWaitNoteL() |
|
1333 { |
|
1334 MPX_FUNC( "CMPXCollectionViewHgImp::CloseWaitNoteL" ); |
|
1335 if( !iUSBOnGoing && !iIsEmbedded) |
|
1336 { |
|
1337 RProcess proc; |
|
1338 proc.SetPriority( iPriority ); |
|
1339 // Fix for ESLU-7CFEPF, try to close the WaitNote even if it's not the current view |
|
1340 TRAP_IGNORE( |
|
1341 CMPXViewPlugin* pi = |
|
1342 iViewUtility->ViewPluginManager().PluginL( TUid::Uid(KWaitNoteImpUid) ); |
|
1343 pi->DeactivateView(); |
|
1344 ); |
|
1345 } |
|
1346 } |
|
1347 |
|
1348 |
|
1349 // ----------------------------------------------------------------------------- |
|
1350 // Change the navi pane |
|
1351 // ----------------------------------------------------------------------------- |
|
1352 // |
|
1353 void CMPXCollectionViewHgImp::UpdateReorderNaviPaneL() |
|
1354 { |
|
1355 MPX_FUNC( "CMPXCollectionViewHgImp::UpdateReorderNaviPaneL" ); |
|
1356 delete iDuration; |
|
1357 iDuration = NULL; |
|
1358 |
|
1359 // Set playlist counter text to pos/size by default |
|
1360 CArrayFixFlat<TInt>* params = |
|
1361 new ( ELeave ) CArrayFixFlat<TInt>( KMPXReorderNaviPaneGranularity ); |
|
1362 CleanupStack::PushL( params ); |
|
1363 // Position of selection in index |
|
1364 params->AppendL( iContainer->CurrentLbxItemIndex() + 1 ); |
|
1365 // Total Number of items in lbx |
|
1366 params->AppendL( iContainer->TotalListItemCount() ); |
|
1367 iDuration = StringLoader::LoadL( |
|
1368 R_MPX_CUI_POSITION_COUNTER_TXT, *params ); |
|
1369 CleanupStack::PopAndDestroy( params ); |
|
1370 UpdateNaviPaneL(); |
|
1371 } |
|
1372 |
|
1373 // --------------------------------------------------------------------------- |
|
1374 // Activates reorder mode |
|
1375 // --------------------------------------------------------------------------- |
|
1376 // |
|
1377 void CMPXCollectionViewHgImp::ActivateReorderGrabbedModeL() |
|
1378 { |
|
1379 MPX_FUNC( "CMPXCollectionViewHgImp::ActivateReorderGrabbedModeL" ); |
|
1380 iIsGrabbed = ETrue; |
|
1381 TInt currentItem( iContainer->CurrentLbxItemIndex() ); |
|
1382 iContainer->EnableFindBox( EFalse ); |
|
1383 iContainer->SetReorderGrabbedMode( ETrue, currentItem ); |
|
1384 if ( !iContainer->IsInReorderMode() ) |
|
1385 { |
|
1386 iContainer->UpdateReorderTitleIconL(); |
|
1387 |
|
1388 if ( iTitle ) |
|
1389 { |
|
1390 delete iOriginalTitle; |
|
1391 iOriginalTitle = NULL; |
|
1392 iOriginalTitle = iTitle->AllocL(); |
|
1393 delete iTitle; |
|
1394 iTitle = NULL; |
|
1395 } |
|
1396 iTitle = StringLoader::LoadL( R_QTN_NMP_TITLE_REORDER_LIST ); |
|
1397 UpdateTitlePaneL(); |
|
1398 |
|
1399 if ( iDuration ) |
|
1400 { |
|
1401 delete iOriginalDuration; |
|
1402 iOriginalDuration = NULL; |
|
1403 iOriginalDuration = iDuration->AllocL(); |
|
1404 delete iDuration; |
|
1405 iDuration = NULL; |
|
1406 } |
|
1407 iContainer->ActivateReorderMode( ETrue ); |
|
1408 SetNewCbaL( R_MPX_CUI_REORDER_DROP_CANCEL_CBA ); |
|
1409 } |
|
1410 iContainer->SetLbxCurrentItemIndexAndDraw( currentItem ); |
|
1411 UpdateReorderNaviPaneL(); |
|
1412 } |
|
1413 |
|
1414 // --------------------------------------------------------------------------- |
|
1415 // Deactivates reorder mode |
|
1416 // --------------------------------------------------------------------------- |
|
1417 // |
|
1418 void CMPXCollectionViewHgImp::DeactivateReorderGrabbedModeL( TBool aExit ) |
|
1419 { |
|
1420 MPX_FUNC( "CMPXCollectionViewHgImp::DeactivateReorderGrabbedModeL" ); |
|
1421 iIsGrabbed = EFalse; |
|
1422 delete iCurrentCba; |
|
1423 iCurrentCba = NULL; |
|
1424 |
|
1425 iContainer->SetReorderGrabbedMode( EFalse ); |
|
1426 if ( aExit ) |
|
1427 { |
|
1428 CEikButtonGroupContainer* cba = Cba(); |
|
1429 if ( cba ) |
|
1430 { |
|
1431 cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); |
|
1432 cba->DrawDeferred(); |
|
1433 |
|
1434 #ifdef __ENABLE_MSK |
|
1435 // set middle softkey label display |
|
1436 UpdateMiddleSoftKeyDisplayL( R_QTN_MSK_PLAY ); |
|
1437 #endif // __ENABLE_MSK |
|
1438 |
|
1439 } |
|
1440 |
|
1441 iContainer->RestoreOriginalTitleIconL(); |
|
1442 delete iTitle; |
|
1443 iTitle = NULL; |
|
1444 if ( iOriginalTitle ) |
|
1445 { |
|
1446 iTitle = iOriginalTitle->AllocL(); |
|
1447 delete iOriginalTitle; |
|
1448 iOriginalTitle = NULL; |
|
1449 } |
|
1450 UpdateTitlePaneL(); |
|
1451 |
|
1452 delete iDuration; |
|
1453 iDuration = NULL; |
|
1454 if ( iOriginalDuration ) |
|
1455 { |
|
1456 iDuration = iOriginalDuration->AllocL(); |
|
1457 delete iOriginalDuration; |
|
1458 iOriginalDuration = NULL; |
|
1459 } |
|
1460 if ( iViewUtility->ActiveViewType() == TUid::Uid( KMPXPluginTypeCollectionUid ) ) |
|
1461 { |
|
1462 UpdateNaviPaneL(); |
|
1463 } |
|
1464 iContainer->ActivateReorderMode( EFalse ); |
|
1465 iContainer->EnableFindBox( ETrue ); |
|
1466 } |
|
1467 iContainer->HandleLbxItemAdditionPreserveIndexL(); |
|
1468 } |
|
1469 |
|
1470 // ----------------------------------------------------------------------------- |
|
1471 // Change the button group |
|
1472 // ----------------------------------------------------------------------------- |
|
1473 // |
|
1474 void CMPXCollectionViewHgImp::SetNewCbaL( TInt aResId ) |
|
1475 { |
|
1476 MPX_FUNC( "CMPXCollectionViewHgImp::SetNewCbaL" ); |
|
1477 if ( !iCurrentCba ) |
|
1478 { |
|
1479 iCurrentCba = CEikButtonGroupContainer::NewL( |
|
1480 CEikButtonGroupContainer::ECba, |
|
1481 CEikButtonGroupContainer::EHorizontal, |
|
1482 this, |
|
1483 aResId, *iContainer ); |
|
1484 } |
|
1485 else |
|
1486 { |
|
1487 iCurrentCba->SetCommandSetL( aResId ); |
|
1488 iCurrentCba->DrawDeferred(); |
|
1489 } |
|
1490 } |
|
1491 |
|
1492 // ----------------------------------------------------------------------------- |
|
1493 // Display the details dialog |
|
1494 // ----------------------------------------------------------------------------- |
|
1495 // |
|
1496 void CMPXCollectionViewHgImp::DisplayDetailsDialogL( MDesC16Array& aDataArray, |
|
1497 TInt aDialogResourceId, TInt aTitleResourceId ) |
|
1498 { |
|
1499 MPX_FUNC( "CMPXCollectionViewHgImp::DisplayDetailsDialogL" ); |
|
1500 CAknSingleHeadingPopupMenuStyleListBox* list = |
|
1501 new ( ELeave ) CAknSingleHeadingPopupMenuStyleListBox; |
|
1502 CleanupStack::PushL( list ); |
|
1503 CAknPopupList* popupList = CAknPopupList::NewL( |
|
1504 list, R_AVKON_SOFTKEYS_OK_EMPTY, |
|
1505 AknPopupLayouts::EMenuGraphicHeadingWindow); |
|
1506 CleanupStack::PushL( popupList ); |
|
1507 list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect ); |
|
1508 list->CreateScrollBarFrameL( ETrue ); |
|
1509 list->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
1510 CEikScrollBarFrame::EOff, |
|
1511 CEikScrollBarFrame::EAuto); |
|
1512 |
|
1513 // Enable Marquee |
|
1514 static_cast<CEikFormattedCellListBox*>( list )->ItemDrawer()->ColumnData()-> |
|
1515 EnableMarqueeL( ETrue ); |
|
1516 |
|
1517 // Retrieve heading array |
|
1518 CDesCArrayFlat* headingsArray( |
|
1519 iCoeEnv->ReadDesCArrayResourceL( aDialogResourceId ) ); |
|
1520 CleanupStack::PushL( headingsArray ); |
|
1521 |
|
1522 // Item array combines heading array and data array |
|
1523 CDesCArrayFlat* itemArray = |
|
1524 new ( ELeave ) CDesCArrayFlat( headingsArray->Count() ); |
|
1525 CleanupStack::PushL( itemArray ); |
|
1526 |
|
1527 TInt count = headingsArray->Count(); |
|
1528 for ( TInt i = 0; i < count; i++ ) |
|
1529 { |
|
1530 HBufC* item = HBufC::NewLC( |
|
1531 headingsArray->MdcaPoint( i ).Length() + |
|
1532 aDataArray.MdcaPoint( i ).Length() + |
|
1533 KMPXDurationDisplayResvLen ); |
|
1534 |
|
1535 TPtrC tempPtr1 = headingsArray->MdcaPoint( i ); |
|
1536 TPtrC tempPtr2 = aDataArray.MdcaPoint( i ); |
|
1537 |
|
1538 item->Des().Format( KMPXCollDetailsItemsFormat, |
|
1539 &tempPtr1, |
|
1540 &tempPtr2 ); |
|
1541 |
|
1542 itemArray->AppendL( *item ); |
|
1543 CleanupStack::PopAndDestroy( item ); |
|
1544 } |
|
1545 |
|
1546 CleanupStack::Pop( itemArray ); |
|
1547 CleanupStack::PopAndDestroy( headingsArray ); |
|
1548 |
|
1549 // Set list items |
|
1550 CTextListBoxModel* model = list->Model(); |
|
1551 model->SetOwnershipType( ELbmOwnsItemArray ); |
|
1552 model->SetItemTextArray( itemArray ); |
|
1553 |
|
1554 // Set title |
|
1555 HBufC* title = StringLoader::LoadLC( aTitleResourceId ); |
|
1556 popupList->SetTitleL( *title ); |
|
1557 CleanupStack::PopAndDestroy( title ); |
|
1558 |
|
1559 // Show popup list |
|
1560 CleanupStack::Pop( popupList ); |
|
1561 popupList->ExecuteLD(); |
|
1562 CleanupStack::PopAndDestroy( list ); |
|
1563 } |
|
1564 |
|
1565 // ----------------------------------------------------------------------------- |
|
1566 // Display collection details |
|
1567 // ----------------------------------------------------------------------------- |
|
1568 // |
|
1569 void CMPXCollectionViewHgImp::DoShowCollectionDetailsL( const CMPXMedia& aMedia ) |
|
1570 { |
|
1571 MPX_FUNC( "CMPXCollectionViewHgImp::ShowCollectionDetailsL" ); |
|
1572 CDesCArrayFlat* dataArray = |
|
1573 new ( ELeave ) CDesCArrayFlat( EMPXCollectionDetailsCount ); |
|
1574 CleanupStack::PushL( dataArray ); |
|
1575 |
|
1576 // number of items |
|
1577 HBufC* dataToAppend = HBufC::NewLC( KMPXMaxBufferLength ); |
|
1578 TInt songsCount( 0 ); |
|
1579 if ( aMedia.IsSupported( KMPXMediaColDetailNumberOfItems ) ) |
|
1580 { |
|
1581 songsCount = aMedia.ValueTObjectL<TInt>( KMPXMediaColDetailNumberOfItems ); |
|
1582 } |
|
1583 TPtr ptr( dataToAppend->Des() ); |
|
1584 ptr.AppendNum( songsCount ); |
|
1585 AknTextUtils::LanguageSpecificNumberConversion( ptr ); |
|
1586 dataArray->AppendL( ptr ); |
|
1587 CleanupStack::PopAndDestroy( dataToAppend ); |
|
1588 |
|
1589 // total duration |
|
1590 TInt duration( 0 ); |
|
1591 if ( aMedia.IsSupported( KMPXMediaColDetailDuration ) ) |
|
1592 { |
|
1593 duration = aMedia.ValueTObjectL<TInt>( KMPXMediaColDetailDuration ); |
|
1594 } |
|
1595 if ( duration > 0 ) |
|
1596 { |
|
1597 dataToAppend = iCommonUiHelper->DisplayableDurationInTextL( duration/KMilliSecondsToSeconds ); |
|
1598 CleanupStack::PushL( dataToAppend ); |
|
1599 ptr.Set( dataToAppend->Des() ); |
|
1600 AknTextUtils::LanguageSpecificNumberConversion( ptr ); |
|
1601 dataArray->AppendL( ptr ); |
|
1602 CleanupStack::PopAndDestroy( dataToAppend ); |
|
1603 } |
|
1604 else |
|
1605 { |
|
1606 dataArray->AppendL( KNullDesC ); |
|
1607 } |
|
1608 |
|
1609 #ifdef RD_MULTIPLE_DRIVE |
|
1610 RFs& fileSession( iCoeEnv->FsSession() ); |
|
1611 TDriveList driveList; |
|
1612 TInt driveCount(0); |
|
1613 TInt64 freePhoneMemory(KErrNotFound); |
|
1614 TInt64 freeInternalMemory(KErrNotFound); |
|
1615 TInt64 freeExternalMemory(KErrNotFound); |
|
1616 TVolumeInfo volInfo; |
|
1617 |
|
1618 // Get all visible drives |
|
1619 User::LeaveIfError( DriveInfo::GetUserVisibleDrives( |
|
1620 fileSession, driveList, driveCount ) ); |
|
1621 MPX_DEBUG2 ("CMPXCollectionViewHgImp::ShowCollectionDetailsL - driveCount = %d", driveCount); |
|
1622 |
|
1623 for( TInt driveNum = EDriveA; driveNum <= EDriveZ; driveNum++ ) |
|
1624 { |
|
1625 if (driveList[driveNum]) |
|
1626 { |
|
1627 // Get the volume information |
|
1628 if ( fileSession.Volume( volInfo, driveNum ) == KErrNone ) |
|
1629 { |
|
1630 // Get the drive status |
|
1631 TUint driveStatus(0); |
|
1632 DriveInfo::GetDriveStatus( fileSession, driveNum, driveStatus ); |
|
1633 |
|
1634 // Add up free memory depending on memory location |
|
1635 if ( driveNum == EDriveC ) |
|
1636 { |
|
1637 if ( freePhoneMemory == KErrNotFound ) |
|
1638 { |
|
1639 freePhoneMemory = 0; |
|
1640 } |
|
1641 freePhoneMemory += volInfo.iFree; |
|
1642 } |
|
1643 else if ( driveStatus & DriveInfo::EDriveInternal ) |
|
1644 { |
|
1645 if ( freeInternalMemory == KErrNotFound ) |
|
1646 { |
|
1647 freeInternalMemory = 0; |
|
1648 } |
|
1649 freeInternalMemory += volInfo.iFree; |
|
1650 } |
|
1651 else if ( driveStatus & |
|
1652 (DriveInfo::EDriveRemovable | DriveInfo::EDriveRemote) ) |
|
1653 { |
|
1654 if ( freeExternalMemory == KErrNotFound ) |
|
1655 { |
|
1656 freeExternalMemory = 0; |
|
1657 } |
|
1658 freeExternalMemory += volInfo.iFree; |
|
1659 } |
|
1660 } |
|
1661 } |
|
1662 } |
|
1663 |
|
1664 // phone memory free |
|
1665 if ( freePhoneMemory != KErrNotFound ) |
|
1666 { |
|
1667 dataToAppend = iCommonUiHelper->UnitConversionL( |
|
1668 freePhoneMemory, ETrue ); |
|
1669 ptr.Set(dataToAppend->Des()); |
|
1670 AknTextUtils::LanguageSpecificNumberConversion( ptr); |
|
1671 } |
|
1672 else |
|
1673 { |
|
1674 dataToAppend = StringLoader::LoadL( |
|
1675 R_MPX_CUI_COLLECTION_DETAILS_MEMORY_UNAVAILABLE ); |
|
1676 ptr.Set(dataToAppend->Des()); |
|
1677 } |
|
1678 |
|
1679 CleanupStack::PushL( dataToAppend ); |
|
1680 dataArray->AppendL( ptr ); |
|
1681 CleanupStack::PopAndDestroy( dataToAppend ); |
|
1682 |
|
1683 // internal memory (mass storage) free |
|
1684 if ( freeInternalMemory != KErrNotFound ) |
|
1685 { |
|
1686 dataToAppend = iCommonUiHelper->UnitConversionL( |
|
1687 freeInternalMemory, ETrue ); |
|
1688 ptr.Set(dataToAppend->Des()); |
|
1689 AknTextUtils::LanguageSpecificNumberConversion( ptr); |
|
1690 } |
|
1691 else |
|
1692 { |
|
1693 dataToAppend = StringLoader::LoadL( |
|
1694 R_MPX_CUI_COLLECTION_DETAILS_MEMORY_UNAVAILABLE ); |
|
1695 ptr.Set(dataToAppend->Des()); |
|
1696 } |
|
1697 |
|
1698 CleanupStack::PushL( dataToAppend ); |
|
1699 dataArray->AppendL( ptr ); |
|
1700 CleanupStack::PopAndDestroy( dataToAppend ); |
|
1701 |
|
1702 // removable/remote (memory card) memory free |
|
1703 if ( freeExternalMemory != KErrNotFound ) |
|
1704 { |
|
1705 dataToAppend = iCommonUiHelper->UnitConversionL( |
|
1706 freeExternalMemory, ETrue ); |
|
1707 ptr.Set(dataToAppend->Des()); |
|
1708 AknTextUtils::LanguageSpecificNumberConversion( ptr); |
|
1709 } |
|
1710 else |
|
1711 { |
|
1712 dataToAppend = StringLoader::LoadL( |
|
1713 R_MPX_CUI_COLLECTION_DETAILS_CARD_UNAVAILABLE_ITEM ); |
|
1714 ptr.Set(dataToAppend->Des()); |
|
1715 } |
|
1716 CleanupStack::PushL( dataToAppend ); |
|
1717 dataArray->AppendL( ptr ); |
|
1718 CleanupStack::PopAndDestroy( dataToAppend ); |
|
1719 #else |
|
1720 // phone memory free |
|
1721 HBufC* driveLetter = StringLoader::LoadLC( R_MPX_COLLECTION_PHONE_MEMORY_ROOT_PATH ); |
|
1722 RFs& fileSession( iCoeEnv->FsSession() ); |
|
1723 TVolumeInfo volInfo; |
|
1724 TDriveUnit driveUnit( *driveLetter ); // Get the drive |
|
1725 CleanupStack::PopAndDestroy( driveLetter ); |
|
1726 if ( KErrNone == fileSession.Volume( volInfo, ( TInt )driveUnit ) ) |
|
1727 { |
|
1728 dataToAppend = iCommonUiHelper->UnitConversionL( volInfo.iFree, ETrue ); |
|
1729 ptr.Set(dataToAppend->Des()); |
|
1730 AknTextUtils::LanguageSpecificNumberConversion( ptr); |
|
1731 } |
|
1732 else |
|
1733 { |
|
1734 dataToAppend = StringLoader::LoadL( |
|
1735 R_MPX_CUI_COLLECTION_DETAILS_CARD_UNAVAILABLE_ITEM ); |
|
1736 ptr.Set(dataToAppend->Des()); |
|
1737 } |
|
1738 CleanupStack::PushL( dataToAppend ); |
|
1739 dataArray->AppendL( ptr ); |
|
1740 CleanupStack::PopAndDestroy( dataToAppend ); |
|
1741 |
|
1742 // memory card |
|
1743 driveLetter = StringLoader::LoadLC( R_MPX_COLLECTION_MEMORY_CARD_ROOT_PATH ); |
|
1744 driveUnit = *driveLetter; // Get the drive |
|
1745 CleanupStack::PopAndDestroy( driveLetter ); |
|
1746 if ( fileSession.Volume( volInfo, ( TInt )driveUnit ) == KErrNone ) |
|
1747 { |
|
1748 dataToAppend = iCommonUiHelper->UnitConversionL( volInfo.iFree, ETrue ); |
|
1749 ptr.Set(dataToAppend->Des()); |
|
1750 AknTextUtils::LanguageSpecificNumberConversion( ptr); |
|
1751 } |
|
1752 else |
|
1753 { |
|
1754 dataToAppend = StringLoader::LoadL( |
|
1755 R_MPX_CUI_COLLECTION_DETAILS_CARD_UNAVAILABLE_ITEM ); |
|
1756 ptr.Set(dataToAppend->Des()); |
|
1757 } |
|
1758 CleanupStack::PushL( dataToAppend ); |
|
1759 dataArray->AppendL( ptr ); |
|
1760 CleanupStack::PopAndDestroy( dataToAppend ); |
|
1761 #endif // RD_MULTIPLE_DRIVE |
|
1762 |
|
1763 // last refreshed |
|
1764 TInt64 lastRefreshed( 0 ); |
|
1765 if ( aMedia.IsSupported( KMPXMediaColDetailLastRefreshed ) ) |
|
1766 { |
|
1767 lastRefreshed = aMedia.ValueTObjectL<TInt64>( KMPXMediaColDetailLastRefreshed ); |
|
1768 } |
|
1769 TTime time( lastRefreshed ); |
|
1770 dataToAppend = HBufC::NewLC( |
|
1771 KMPXMaxTimeLength + KMPXDurationDisplayResvLen ); |
|
1772 HBufC* format( StringLoader::LoadLC( R_QTN_DATE_USUAL_WITH_ZERO ) ); |
|
1773 TPtr modDatePtr( dataToAppend->Des() ); |
|
1774 time.FormatL( modDatePtr, *format ); |
|
1775 CleanupStack::PopAndDestroy( format ); |
|
1776 AknTextUtils::LanguageSpecificNumberConversion( modDatePtr ); |
|
1777 dataArray->AppendL( modDatePtr ); |
|
1778 CleanupStack::PopAndDestroy( dataToAppend ); |
|
1779 |
|
1780 DisplayDetailsDialogL( *dataArray, |
|
1781 R_MPX_CUI_COLLECTION_DETAILS_HEADINGS, |
|
1782 R_MPX_QTN_NMP_TITLE_COLLECTION_DETAILS ); |
|
1783 CleanupStack::PopAndDestroy( dataArray ); |
|
1784 } |
|
1785 |
|
1786 // ----------------------------------------------------------------------------- |
|
1787 // Display playlist details |
|
1788 // ----------------------------------------------------------------------------- |
|
1789 // |
|
1790 void CMPXCollectionViewHgImp::DoShowPlaylistDetailsL( const CMPXMedia& aMedia ) |
|
1791 { |
|
1792 MPX_FUNC( "CMPXCollectionViewHgImp::ShowPlaylistDetailsL" ); |
|
1793 CDesCArrayFlat* dataArray = |
|
1794 new ( ELeave ) CDesCArrayFlat( EMPXPlaylistDetailsCount ); |
|
1795 CleanupStack::PushL( dataArray ); |
|
1796 |
|
1797 // playlist name |
|
1798 if ( aMedia.IsSupported( KMPXMediaGeneralTitle ) ) |
|
1799 { |
|
1800 dataArray->AppendL( aMedia.ValueText( KMPXMediaGeneralTitle ) ); |
|
1801 } |
|
1802 else if ( aMedia.IsSupported( KMPXMediaGeneralUri ) ) |
|
1803 { |
|
1804 TParsePtrC fileDetail( aMedia.ValueText( KMPXMediaGeneralUri ) ); |
|
1805 dataArray->AppendL( fileDetail.Name() ); |
|
1806 } |
|
1807 else |
|
1808 { |
|
1809 dataArray->AppendL( KNullDesC ); |
|
1810 } |
|
1811 |
|
1812 // number of songs |
|
1813 TInt songsCount( 0 ); |
|
1814 if ( aMedia.IsSupported( KMPXMediaGeneralCount ) ) |
|
1815 { |
|
1816 songsCount = aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralCount ); |
|
1817 } |
|
1818 HBufC* dataToAppend = HBufC::NewLC( KMPXMaxBufferLength ); |
|
1819 TPtr ptr( dataToAppend->Des() ); |
|
1820 ptr.AppendNum( songsCount ); |
|
1821 AknTextUtils::LanguageSpecificNumberConversion( ptr ); |
|
1822 dataArray->AppendL( ptr ); |
|
1823 CleanupStack::PopAndDestroy( dataToAppend ); |
|
1824 |
|
1825 // Duration |
|
1826 TInt duration( 0 ); |
|
1827 if ( aMedia.IsSupported( KMPXMediaGeneralDuration ) ) |
|
1828 { |
|
1829 duration = aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralDuration ); |
|
1830 } |
|
1831 if ( duration > 0 ) |
|
1832 { |
|
1833 dataToAppend = iCommonUiHelper->DisplayableDurationInTextL( duration/KMilliSecondsToSeconds ); |
|
1834 CleanupStack::PushL( dataToAppend ); |
|
1835 ptr.Set( dataToAppend->Des() ); |
|
1836 AknTextUtils::LanguageSpecificNumberConversion( ptr ); |
|
1837 dataArray->AppendL( ptr ); |
|
1838 CleanupStack::PopAndDestroy( dataToAppend ); |
|
1839 } |
|
1840 else |
|
1841 { |
|
1842 dataArray->AppendL( KNullDesC ); |
|
1843 } |
|
1844 |
|
1845 // Location |
|
1846 TUint flags( aMedia.ValueTObjectL<TUint>( KMPXMediaGeneralFlags ) ); |
|
1847 TUint isVirtual( ( flags ) & ( KMPXMediaGeneralFlagsIsVirtual ) ); |
|
1848 if ( !isVirtual ) |
|
1849 { |
|
1850 if ( aMedia.IsSupported( KMPXMediaGeneralUri ) ) |
|
1851 { |
|
1852 dataArray->AppendL( aMedia.ValueText( KMPXMediaGeneralUri ) ); |
|
1853 } |
|
1854 else |
|
1855 { |
|
1856 dataArray->AppendL( KNullDesC ); |
|
1857 } |
|
1858 } |
|
1859 |
|
1860 // last refreshed |
|
1861 TInt64 lastMod( 0 ); |
|
1862 if ( aMedia.IsSupported( KMPXMediaGeneralDate ) ) |
|
1863 { |
|
1864 lastMod = aMedia.ValueTObjectL<TInt64>( KMPXMediaGeneralDate ); |
|
1865 } |
|
1866 TTime time( lastMod ); |
|
1867 dataToAppend = HBufC::NewLC( |
|
1868 KMPXMaxTimeLength + KMPXDurationDisplayResvLen ); |
|
1869 HBufC* format = StringLoader::LoadLC( R_QTN_DATE_USUAL_WITH_ZERO ); |
|
1870 ptr.Set( dataToAppend->Des() ); |
|
1871 time.FormatL( ptr, *format ); |
|
1872 CleanupStack::PopAndDestroy( format ); |
|
1873 AknTextUtils::LanguageSpecificNumberConversion( ptr ); |
|
1874 dataArray->AppendL( ptr ); |
|
1875 CleanupStack::PopAndDestroy( dataToAppend ); |
|
1876 |
|
1877 dataToAppend = HBufC::NewLC( |
|
1878 KMPXMaxTimeLength + KMPXDurationDisplayResvLen ); |
|
1879 format = StringLoader::LoadLC( R_QTN_TIME_USUAL ); |
|
1880 ptr.Set( dataToAppend->Des() ); |
|
1881 time.FormatL( ptr, *format ); |
|
1882 CleanupStack::PopAndDestroy( format ); |
|
1883 AknTextUtils::LanguageSpecificNumberConversion( ptr ); |
|
1884 dataArray->AppendL( ptr ); |
|
1885 CleanupStack::PopAndDestroy( dataToAppend ); |
|
1886 |
|
1887 TInt headingResource( isVirtual ? |
|
1888 R_MPX_CUI_PLAYLIST_DETAILS_HEADINGS_WITHOUT_URI : |
|
1889 R_MPX_CUI_PLAYLIST_DETAILS_HEADINGS_WITH_URI ); |
|
1890 DisplayDetailsDialogL( *dataArray, headingResource, |
|
1891 R_MPX_QTN_NMP_TITLE_PLAYLIST_DETAILS ); |
|
1892 CleanupStack::PopAndDestroy( dataArray ); |
|
1893 } |
|
1894 |
|
1895 |
|
1896 // --------------------------------------------------------------------------- |
|
1897 // Handles Upnp menus from DynInitMenuPaneL() |
|
1898 // --------------------------------------------------------------------------- |
|
1899 // |
|
1900 void CMPXCollectionViewHgImp::HandleDynInitUpnpL( |
|
1901 TInt aResourceId, |
|
1902 CEikMenuPane& aMenuPane ) |
|
1903 { |
|
1904 MPX_FUNC( "CMPXCollectionViewHgImp::HandleDynInitUpnpL()" ); |
|
1905 |
|
1906 if ( !IsUpnpVisible() ) |
|
1907 { |
|
1908 GetCurrentPlayerDetails(); |
|
1909 |
|
1910 if ( iCurrentPlayerType == EPbLocal ) |
|
1911 { |
|
1912 aMenuPane.SetItemDimmed( |
|
1913 EMPXCmdUpnpPlayVia, |
|
1914 ETrue); |
|
1915 } |
|
1916 aMenuPane.SetItemDimmed( |
|
1917 EMPXCmdUPnPAiwCmdCopyToExternalCriteria, |
|
1918 ETrue); |
|
1919 } |
|
1920 else |
|
1921 { |
|
1922 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleDynInitUpnpL(): UPnP visible and media" ); |
|
1923 TInt currentItem( iContainer->CurrentLbxItemIndex() ); |
|
1924 |
|
1925 const CMPXMedia& media = |
|
1926 (iContainer->ListBoxArray())->MediaL( currentItem ); |
|
1927 TMPXGeneralType type( EMPXNoType ); |
|
1928 if (media.IsSupported(KMPXMediaGeneralType)) |
|
1929 { |
|
1930 type = |
|
1931 media.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType); |
|
1932 } |
|
1933 |
|
1934 if ( ( type == EMPXItem ) || |
|
1935 ( type == EMPXGroup ) ) |
|
1936 { |
|
1937 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleDynInitUpnpL(): folder or song" ); |
|
1938 if ( iErrorAttachCopyMenu != KErrNone ) |
|
1939 { |
|
1940 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleDynInitUpnpL(): error, Dim Copy" ); |
|
1941 aMenuPane.SetItemDimmed( |
|
1942 EMPXCmdUPnPAiwCmdCopyToExternalCriteria, |
|
1943 ETrue); |
|
1944 } |
|
1945 else |
|
1946 { |
|
1947 if (iServiceHandler->HandleSubmenuL(aMenuPane)) |
|
1948 { |
|
1949 return; |
|
1950 } |
|
1951 |
|
1952 if ( iServiceHandler->IsAiwMenu(aResourceId)) |
|
1953 { |
|
1954 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleDynInitUpnpL(): Aiw menu" ); |
|
1955 CAiwGenericParamList& in = iServiceHandler->InParamListL(); |
|
1956 |
|
1957 iServiceHandler->InitializeMenuPaneL(aMenuPane, aResourceId, EMPXCmdUPnPAiwCmdCopyToExternalCriteria, in); |
|
1958 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleDynInitUpnpL(): after InitializeMenuPaneL" ); |
|
1959 } |
|
1960 } |
|
1961 } |
|
1962 else |
|
1963 { |
|
1964 aMenuPane.SetItemDimmed( |
|
1965 EMPXCmdUpnpPlayVia, |
|
1966 ETrue); |
|
1967 aMenuPane.SetItemDimmed( |
|
1968 EMPXCmdUPnPAiwCmdCopyToExternalCriteria, |
|
1969 ETrue); |
|
1970 } |
|
1971 } |
|
1972 } |
|
1973 |
|
1974 // ----------------------------------------------------------------------------- |
|
1975 // CMPXCollectionViewHgImp::IsUpnpVisible |
|
1976 // Checks if UPnP access point is defined |
|
1977 // ----------------------------------------------------------------------------- |
|
1978 // |
|
1979 TBool CMPXCollectionViewHgImp::IsUpnpVisible() |
|
1980 { |
|
1981 MPX_FUNC( "CMPXCollectionViewHgImp::IsUpnpVisible" ); |
|
1982 TBool returnValue = EFalse; |
|
1983 |
|
1984 if ( iUpnpCopyCommand && iUpnpFrameworkSupport) |
|
1985 { |
|
1986 returnValue = iUpnpCopyCommand->IsAvailableL(); |
|
1987 } |
|
1988 return returnValue; |
|
1989 } |
|
1990 |
|
1991 // ----------------------------------------------------------------------------- |
|
1992 // CMPXCollectionViewHgImp::AddPlayersNamesToMenuL |
|
1993 // Taken from Gallery upnp support implementation |
|
1994 // ----------------------------------------------------------------------------- |
|
1995 // |
|
1996 void CMPXCollectionViewHgImp::AddPlayersNamesToMenuL( CEikMenuPane& aMenuPane ) |
|
1997 { |
|
1998 RArray<TMPXPlaybackPlayerType> playerTypes; |
|
1999 CleanupClosePushL(playerTypes); |
|
2000 |
|
2001 MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager(); |
|
2002 manager.GetPlayerTypesL(playerTypes); |
|
2003 |
|
2004 GetCurrentPlayerDetails(); |
|
2005 |
|
2006 TInt countPlayersTypes( playerTypes.Count() ); |
|
2007 TInt countLocalType(0); |
|
2008 TInt countRemoteType(0); |
|
2009 |
|
2010 if ( countPlayersTypes >= 1 ) |
|
2011 { |
|
2012 iPlayersList.Close(); |
|
2013 |
|
2014 for ( TInt i = 0; i < countPlayersTypes; i++ ) |
|
2015 { |
|
2016 MPX_DEBUG3( "playerTypes[%d]: %d", i, playerTypes[i] ); |
|
2017 switch (playerTypes[i]) |
|
2018 { |
|
2019 case EPbLocal: |
|
2020 { |
|
2021 // we only show 1 specific type once in the menu |
|
2022 if ( countLocalType == 0 ) |
|
2023 { |
|
2024 AddPlayerNameToMenuL( aMenuPane, |
|
2025 EMPXCmdUpnpPlayViaLocal, |
|
2026 manager, |
|
2027 playerTypes[i] ); |
|
2028 |
|
2029 countLocalType++; |
|
2030 } |
|
2031 break; |
|
2032 } |
|
2033 case EPbRemote: |
|
2034 { |
|
2035 // we only show 1 specific type once in the menu |
|
2036 if ( countRemoteType == 0 ) |
|
2037 { |
|
2038 AddPlayerNameToMenuL( aMenuPane, |
|
2039 EMPXCmdUpnpPlayViaRemotePlayer, |
|
2040 manager, |
|
2041 playerTypes[i] ); |
|
2042 countRemoteType++; |
|
2043 } |
|
2044 break; |
|
2045 } |
|
2046 default: |
|
2047 { |
|
2048 // default case is handled in the next loop, we want |
|
2049 // to add any "other" player at the end of the list |
|
2050 break; |
|
2051 } |
|
2052 } |
|
2053 } // for loop |
|
2054 |
|
2055 for ( TInt i = 0; i < countPlayersTypes; i++ ) |
|
2056 { |
|
2057 MPX_DEBUG3( "playerTypes[%d]: %d", i, playerTypes[i] ); |
|
2058 // EPbLocal and EPbRemote were already added to the |
|
2059 // submenu in the previous loop |
|
2060 if ( playerTypes[i] != EPbLocal && |
|
2061 playerTypes[i] != EPbRemote ) |
|
2062 { |
|
2063 // EPbUnknown or else |
|
2064 TBool alreadyInTheList( EFalse ); |
|
2065 |
|
2066 for ( TInt j = 0; j < i; j++) |
|
2067 { |
|
2068 // if the new playertype is already in the list |
|
2069 if ( playerTypes[i] == playerTypes[j] ) |
|
2070 { |
|
2071 alreadyInTheList = ETrue; |
|
2072 break; |
|
2073 } |
|
2074 } |
|
2075 |
|
2076 if ( !alreadyInTheList ) |
|
2077 { |
|
2078 HBufC* buf = manager.PlayerTypeDisplayNameL(playerTypes[i]); |
|
2079 |
|
2080 if ( buf ) |
|
2081 { |
|
2082 CleanupStack::PushL(buf); |
|
2083 AddPlayerNameToMenuL( aMenuPane, |
|
2084 EMPXCmdUpnpPlayViaRemotePlayer, |
|
2085 manager, |
|
2086 playerTypes[i], |
|
2087 *buf ); |
|
2088 CleanupStack::PopAndDestroy(buf); |
|
2089 } |
|
2090 // else we don't do anything. other player type is not |
|
2091 // currently supported. Implementation will be finalized |
|
2092 // when the requirement is defined. |
|
2093 } |
|
2094 } |
|
2095 } |
|
2096 } |
|
2097 |
|
2098 CleanupStack::PopAndDestroy(&playerTypes); |
|
2099 |
|
2100 if ( iPlayersList.Count() <= 1 ) |
|
2101 { |
|
2102 aMenuPane.SetItemDimmed( EMPXCmdUpnpPlayViaRemotePlayer, |
|
2103 ETrue ); |
|
2104 } |
|
2105 } |
|
2106 |
|
2107 // ----------------------------------------------------------------------------- |
|
2108 // CMPXCollectionViewHgImp::AddPlayerNameToMenuL |
|
2109 // Taken from Gallery upnp support implementation |
|
2110 // ----------------------------------------------------------------------------- |
|
2111 // |
|
2112 void CMPXCollectionViewHgImp::AddPlayerNameToMenuL( CEikMenuPane& aMenuPane, |
|
2113 TInt aCommandId, |
|
2114 MMPXPlayerManager& aPlayerManager, |
|
2115 TMPXPlaybackPlayerType& aPlayerType, |
|
2116 const TDesC& aMenuText ) |
|
2117 { |
|
2118 RArray<TUid> players; |
|
2119 CleanupClosePushL(players); |
|
2120 aPlayerManager.GetPlayerListL(players, aPlayerType); |
|
2121 |
|
2122 // For now we only keep the first player we find |
|
2123 // Local player is always the first one in the list |
|
2124 // Ui spec limitation |
|
2125 MPX_DEBUG2( "players[0]: %d", players[0].iUid ); |
|
2126 if ( aCommandId == EMPXCmdUpnpPlayViaLocal ) |
|
2127 { |
|
2128 iPlayersList.Insert(players[0], 0); |
|
2129 } |
|
2130 else if ( ( aCommandId == EMPXCmdUpnpPlayViaRemotePlayer ) && |
|
2131 (iPlayersList.Count() > 1) ) |
|
2132 { |
|
2133 iPlayersList.Insert(players[0], 1); |
|
2134 } |
|
2135 else |
|
2136 { |
|
2137 iPlayersList.AppendL(players[0]); |
|
2138 } |
|
2139 CleanupStack::PopAndDestroy(&players); |
|
2140 |
|
2141 // if the player is of unknown type |
|
2142 if ( ( aCommandId != EMPXCmdUpnpPlayViaRemotePlayer ) && |
|
2143 ( aCommandId != EMPXCmdUpnpPlayViaLocal ) ) |
|
2144 { |
|
2145 CEikMenuPaneItem::SData menuItem; |
|
2146 menuItem.iText.Copy( aMenuText ); |
|
2147 menuItem.iCascadeId = 0; |
|
2148 menuItem.iFlags = EEikMenuItemRadioEnd; |
|
2149 |
|
2150 menuItem.iCommandId = aCommandId + (iPlayersList.Count() - 1); |
|
2151 aCommandId = menuItem.iCommandId; |
|
2152 |
|
2153 aMenuPane.AddMenuItemL( menuItem ); |
|
2154 } |
|
2155 |
|
2156 if ( iCurrentPlayerType == aPlayerType ) |
|
2157 { |
|
2158 aMenuPane.SetItemButtonState( aCommandId, EEikMenuItemSymbolOn ); |
|
2159 } |
|
2160 } |
|
2161 |
|
2162 // ----------------------------------------------------------------------------- |
|
2163 // CMPXCollectionViewHgImp::GetCurrentPlayerDetails |
|
2164 // Retrieves the current player name and type |
|
2165 // ----------------------------------------------------------------------------- |
|
2166 // |
|
2167 void CMPXCollectionViewHgImp::GetCurrentPlayerDetails() |
|
2168 { |
|
2169 MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager(); |
|
2170 TUid currentlyUsedPlayer; |
|
2171 TInt currentlyUsedSubPlayer; |
|
2172 iCurrentPlayerType = EPbLocal; |
|
2173 delete iSubPlayerName; |
|
2174 iSubPlayerName = NULL; |
|
2175 TRAP_IGNORE( manager.GetSelectionL( iCurrentPlayerType, |
|
2176 currentlyUsedPlayer, |
|
2177 currentlyUsedSubPlayer, |
|
2178 iSubPlayerName)); |
|
2179 } |
|
2180 |
|
2181 // ----------------------------------------------------------------------------- |
|
2182 // CMPXCollectionViewHgImp::SelectNewPlayerL |
|
2183 // Selects a new player for audio playback |
|
2184 // ----------------------------------------------------------------------------- |
|
2185 // |
|
2186 void CMPXCollectionViewHgImp::SelectNewPlayerL( TInt aCommand ) |
|
2187 { |
|
2188 MPX_FUNC( "CMPXCollectionViewHgImp::SelectNewPlayerL()" ); |
|
2189 MPX_DEBUG2( "CMPXCollectionViewHgImp::SelectNewPlayerL(%d)", aCommand ); |
|
2190 |
|
2191 TInt errorSelectPlayer( KErrCancel ); |
|
2192 |
|
2193 switch (aCommand) |
|
2194 { |
|
2195 case EMPXCmdUpnpPlayViaLocal: |
|
2196 { |
|
2197 // if Local is not already the current player, select it |
|
2198 if ( iCurrentPlayerType != EPbLocal ) |
|
2199 { |
|
2200 MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager(); |
|
2201 MPX_TRAP( errorSelectPlayer, manager.ClearSelectPlayersL() ); |
|
2202 } |
|
2203 else // no need to reselect it but always start playback |
|
2204 { |
|
2205 errorSelectPlayer = KErrNone; |
|
2206 } |
|
2207 break; |
|
2208 } |
|
2209 default: |
|
2210 { |
|
2211 if ( aCommand >= EMPXCmdUpnpPlayViaRemotePlayer ) |
|
2212 { |
|
2213 HBufC* buf = HBufC::NewLC( KMaxUidName ); |
|
2214 buf->Des().AppendNum( |
|
2215 (iPlayersList[aCommand - |
|
2216 EMPXCmdUpnpPlayViaLocal]).iUid ); |
|
2217 |
|
2218 // ActivateViewL leaves with KErrCancel if the dialog is |
|
2219 // cancelled |
|
2220 // ActivateViewL leaves with KErrInUse if the selected player |
|
2221 // is already the active player |
|
2222 MPX_TRAP(errorSelectPlayer, iViewUtility->ActivateViewL( |
|
2223 TUid::Uid( KMPXPluginTypeUPnPBrowseDialogUid ), |
|
2224 buf )); |
|
2225 CleanupStack::PopAndDestroy( buf ); |
|
2226 } |
|
2227 break; |
|
2228 } |
|
2229 } |
|
2230 |
|
2231 GetCurrentPlayerDetails(); |
|
2232 |
|
2233 // If InUse, the player selected is already the current one, we start playback anyway |
|
2234 // contrary to Playback view |
|
2235 if ( ( errorSelectPlayer == KErrNone ) || |
|
2236 ( errorSelectPlayer == KErrInUse ) ) |
|
2237 { |
|
2238 // Starts playback by calling OpenL() for the selected track |
|
2239 CMPXCommonListBoxArrayBase* array = iContainer->ListBoxArray(); |
|
2240 if ( array && ( iContainer->TotalListItemCount() > 0 ) ) |
|
2241 { |
|
2242 MPX_DEBUG1( "CMPXCollectionViewHgImp::SelectNewPlayerL() before MediaL()" ); |
|
2243 |
|
2244 TInt currentListBoxItemIndex( |
|
2245 iContainer->CurrentLbxItemIndex() ); |
|
2246 |
|
2247 if ( currentListBoxItemIndex >= 0 ) |
|
2248 { |
|
2249 const CMPXMedia& media = array->MediaL( currentListBoxItemIndex ); |
|
2250 |
|
2251 TMPXGeneralType type( EMPXNoType ); |
|
2252 TMPXGeneralCategory category( EMPXNoCategory ); |
|
2253 |
|
2254 if ( media.IsSupported( KMPXMediaGeneralType ) ) |
|
2255 { |
|
2256 type = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ); |
|
2257 } |
|
2258 |
|
2259 if ( media.IsSupported( KMPXMediaGeneralCategory ) ) |
|
2260 { |
|
2261 category = media.ValueTObjectL<TMPXGeneralCategory>( |
|
2262 KMPXMediaGeneralCategory ); |
|
2263 } |
|
2264 |
|
2265 MPX_DEBUG2( "CMPXCollectionViewHgImp::SelectNewPlayerL() currentIndex %d", currentListBoxItemIndex ); |
|
2266 |
|
2267 // Needed to reset the status of iPreservedState |
|
2268 iPlaybackUtility->CommandL(EPbCmdResetPreserveState); |
|
2269 |
|
2270 if ( ( type == EMPXItem ) && ( category == EMPXSong ) ) |
|
2271 { |
|
2272 MPX_DEBUG1( "CMPXCollectionViewHgImp::SelectNewPlayerL() type is EMPXItem" ); |
|
2273 if(iCollectionCacheReady) |
|
2274 { |
|
2275 iCollectionUtility->Collection().OpenL( currentListBoxItemIndex ); |
|
2276 iFirstIncrementalBatch = ETrue; |
|
2277 } |
|
2278 } |
|
2279 else if ( ( type == EMPXItem ) && ( category == EMPXPlaylist ) ) |
|
2280 { |
|
2281 MPX_DEBUG1( "CMPXCollectionViewHgImp::SelectNewPlayerL() category is EMPXPlaylist" ); |
|
2282 // if we want to play a playlist, we need to find out |
|
2283 // if it's empty first |
|
2284 ASSERT( iCurrentFindAllLOp == EMPXOpFindAllLIdle ); |
|
2285 |
|
2286 TMPXItemId id( |
|
2287 media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
2288 CMPXMedia* entry = CMPXMedia::NewL(); |
|
2289 CleanupStack::PushL( entry ); |
|
2290 entry->SetTObjectValueL<TMPXGeneralType>( |
|
2291 KMPXMediaGeneralType, EMPXGroup ); |
|
2292 entry->SetTObjectValueL<TMPXGeneralCategory>( |
|
2293 KMPXMediaGeneralCategory, EMPXSong ); |
|
2294 entry->SetTObjectValueL<TMPXItemId>( |
|
2295 KMPXMediaGeneralId, id ); |
|
2296 RArray<TMPXAttribute> attrs; |
|
2297 CleanupClosePushL( attrs ); |
|
2298 attrs.Append( KMPXMediaGeneralId ); |
|
2299 iCollectionUtility->Collection().FindAllL( |
|
2300 *entry, attrs.Array(), *this ); |
|
2301 iCurrentFindAllLOp = EMPXOpFindAllLUpnpPlayback; |
|
2302 |
|
2303 CleanupStack::PopAndDestroy( &attrs ); |
|
2304 CleanupStack::PopAndDestroy( entry ); |
|
2305 } |
|
2306 else // if a folder is selected |
|
2307 { |
|
2308 MPX_DEBUG1( "CMPXCollectionViewHgImp::SelectNewPlayerL() type is EMPXGroup" ); |
|
2309 if(iCollectionCacheReady) |
|
2310 { |
|
2311 iCollectionUtility->Collection().OpenL( currentListBoxItemIndex, |
|
2312 EMPXOpenPlaylistOnly); |
|
2313 iFirstIncrementalBatch = ETrue; |
|
2314 } |
|
2315 } |
|
2316 } |
|
2317 } |
|
2318 } |
|
2319 else if ( errorSelectPlayer != KErrCancel ) |
|
2320 { |
|
2321 User::LeaveIfError(errorSelectPlayer); |
|
2322 } |
|
2323 } |
|
2324 |
|
2325 // ----------------------------------------------------------------------------- |
|
2326 // CMPXCollectionViewHgImp::CopySelectedItemsToRemoteL |
|
2327 // Copies selected file(s) to remote player |
|
2328 // ----------------------------------------------------------------------------- |
|
2329 // |
|
2330 void CMPXCollectionViewHgImp::CopySelectedItemsToRemoteL() |
|
2331 { |
|
2332 MPX_FUNC( "CMPXCollectionViewHgImp::CopySelectedItemsToRemoteL()" ); |
|
2333 |
|
2334 TInt index( iContainer->CurrentLbxItemIndex() ); |
|
2335 if ( index >= 0 ) |
|
2336 { |
|
2337 CMPXCommonListBoxArrayBase* array = iContainer->ListBoxArray(); |
|
2338 const CMPXMedia& media = array->MediaL( index ); |
|
2339 |
|
2340 TMPXGeneralType type( EMPXNoType ); |
|
2341 TMPXGeneralCategory category( EMPXNoCategory ); |
|
2342 |
|
2343 if ( media.IsSupported( KMPXMediaGeneralType ) ) |
|
2344 { |
|
2345 type = |
|
2346 media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ); |
|
2347 } |
|
2348 if ( media.IsSupported( KMPXMediaGeneralCategory ) ) |
|
2349 { |
|
2350 category = |
|
2351 media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ); |
|
2352 } |
|
2353 |
|
2354 CMPXCollectionPath* cpath = |
|
2355 iCollectionUtility->Collection().PathL(); |
|
2356 CleanupStack::PushL( cpath ); |
|
2357 |
|
2358 if ( ( type == EMPXItem ) && ( category == EMPXSong ) ) |
|
2359 { |
|
2360 const CArrayFix<TInt>* arrayIndex = |
|
2361 iContainer->CurrentSelectionIndicesL(); |
|
2362 TInt arrayCount( arrayIndex->Count() ); |
|
2363 |
|
2364 cpath->ClearSelection(); |
|
2365 if ( arrayCount > 0 ) |
|
2366 { |
|
2367 for (TInt index=0; index < arrayCount; index++) |
|
2368 { |
|
2369 cpath->SelectL(arrayIndex->At(index)); |
|
2370 } |
|
2371 } |
|
2372 else |
|
2373 { |
|
2374 cpath->Set( index ); |
|
2375 } |
|
2376 |
|
2377 // Ask for the list of selected song paths: will return in HandleMedia() |
|
2378 ASSERT( iCurrentMediaLOp == EMPXOpMediaLIdle ); |
|
2379 RArray<TMPXAttribute> attrs; |
|
2380 CleanupClosePushL(attrs); |
|
2381 attrs.Append( KMPXMediaGeneralUri ); |
|
2382 iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() ); |
|
2383 iCurrentMediaLOp = EMPXOpMediaLCopyToRemote; |
|
2384 CleanupStack::PopAndDestroy( &attrs ); |
|
2385 } |
|
2386 else // if a folder is selected |
|
2387 { |
|
2388 TMPXItemId id(0); |
|
2389 if ( media.IsSupported( KMPXMediaGeneralId ) ) |
|
2390 { |
|
2391 id = media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ); |
|
2392 } |
|
2393 |
|
2394 RArray<TInt> supportedIds; |
|
2395 CleanupClosePushL(supportedIds); |
|
2396 supportedIds.AppendL(KMPXMediaIdGeneral); |
|
2397 |
|
2398 CMPXMedia* entry = CMPXMedia::NewL(supportedIds.Array()); |
|
2399 CleanupStack::PushL(entry); |
|
2400 entry->SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup ); |
|
2401 |
|
2402 entry->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong ); |
|
2403 |
|
2404 entry->SetTObjectValueL( KMPXMediaGeneralId, id ); |
|
2405 |
|
2406 if ( category == EMPXAlbum ) |
|
2407 { |
|
2408 const CMPXMedia& containerMedia = array->ContainerMedia(); |
|
2409 TMPXGeneralCategory containerCategory( EMPXNoCategory ); |
|
2410 if ( containerMedia.IsSupported( KMPXMediaGeneralCategory ) ) |
|
2411 { |
|
2412 containerCategory = containerMedia.ValueTObjectL<TMPXGeneralCategory>( |
|
2413 KMPXMediaGeneralCategory ); |
|
2414 } |
|
2415 |
|
2416 if ( containerCategory == EMPXArtist ) |
|
2417 { |
|
2418 // artist/album level, need to specify artist ID in container ID |
|
2419 TMPXItemId containerId = |
|
2420 containerMedia.ValueTObjectL<TMPXItemId>( |
|
2421 KMPXMediaGeneralId ); |
|
2422 entry->SetTObjectValueL<TMPXItemId>( |
|
2423 KMPXMediaGeneralContainerId, containerId ); |
|
2424 } |
|
2425 } |
|
2426 |
|
2427 RArray<TMPXAttribute> attrs; |
|
2428 CleanupClosePushL(attrs); |
|
2429 attrs.Append( KMPXMediaGeneralUri ); |
|
2430 |
|
2431 ASSERT( iCurrentFindAllLOp == EMPXOpFindAllLIdle ); |
|
2432 iCollectionUtility->Collection().FindAllL( *entry, |
|
2433 attrs.Array(), |
|
2434 *this ); |
|
2435 iCurrentFindAllLOp = EMPXOpFindAllLUpnp; |
|
2436 |
|
2437 CleanupStack::PopAndDestroy( &attrs ); |
|
2438 CleanupStack::PopAndDestroy( entry ); |
|
2439 CleanupStack::PopAndDestroy( &supportedIds ); |
|
2440 } |
|
2441 CleanupStack::PopAndDestroy( cpath ); |
|
2442 } |
|
2443 } |
|
2444 |
|
2445 // ----------------------------------------------------------------------------- |
|
2446 // CMPXCollectionViewHgImp::DoHandleCopyToRemoteL |
|
2447 // Handle call back from collectionframework for Copy to Remote command |
|
2448 // ----------------------------------------------------------------------------- |
|
2449 // |
|
2450 void CMPXCollectionViewHgImp::DoHandleCopyToRemoteL( |
|
2451 const CMPXMedia& aMedia, TBool aComplete ) |
|
2452 { |
|
2453 MPX_FUNC( "CMPXCollectionViewHgImp::DoHandleCopyToRemoteL()"); |
|
2454 |
|
2455 CMPXMediaArray* mediaArray( NULL ); |
|
2456 TInt fileCount( 0 ); |
|
2457 |
|
2458 if ( aMedia.IsSupported( KMPXMediaArrayContents ) ) |
|
2459 { |
|
2460 mediaArray = |
|
2461 aMedia.Value<CMPXMediaArray>( KMPXMediaArrayContents ); |
|
2462 if ( mediaArray ) |
|
2463 { |
|
2464 fileCount = mediaArray->Count(); |
|
2465 } |
|
2466 } |
|
2467 MPX_DEBUG2("CMPXCollectionViewHgImp::DoHandleCopyToRemoteL Entry count = %d", fileCount); |
|
2468 |
|
2469 // Change this to Global will be needed if FindAll() is called |
|
2470 // repeatedly until aComplete is ETrue (Inc9?) |
|
2471 CAiwGenericParamList* aiwCopyInParamList = CAiwGenericParamList::NewLC(); |
|
2472 |
|
2473 // multiple files or folder |
|
2474 if ( fileCount > 0 ) |
|
2475 { |
|
2476 if ( mediaArray ) |
|
2477 { |
|
2478 for ( TInt i = 0; i < fileCount; i++ ) |
|
2479 { |
|
2480 CMPXMedia* media( mediaArray->AtL( i ) ); |
|
2481 |
|
2482 const TDesC& location = |
|
2483 media->ValueText( KMPXMediaGeneralUri ); |
|
2484 MPX_DEBUG3( "CMPXCollectionViewHgImp::DoHandleCopyToRemote %d filePath = %S", i, &location ); |
|
2485 |
|
2486 TAiwVariant path( location ); |
|
2487 TAiwGenericParam fileParameter( EGenericParamFile, |
|
2488 path ); |
|
2489 aiwCopyInParamList->AppendL( fileParameter ); |
|
2490 } |
|
2491 } |
|
2492 } |
|
2493 else // single file |
|
2494 { |
|
2495 TMPXGeneralType type( EMPXNoType ); |
|
2496 |
|
2497 if ( aMedia.IsSupported( KMPXMediaGeneralType ) ) |
|
2498 { |
|
2499 type = aMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ); |
|
2500 } |
|
2501 |
|
2502 if ( type == EMPXItem ) |
|
2503 { |
|
2504 const TDesC& location = |
|
2505 aMedia.ValueText( KMPXMediaGeneralUri ); |
|
2506 TAiwVariant path( location ); |
|
2507 MPX_DEBUG2( "CMPXCollectionViewHgImp::DoHandleCopyToRemote filePath = %S", &location ); |
|
2508 |
|
2509 TAiwGenericParam fileParameter( EGenericParamFile, path ); |
|
2510 aiwCopyInParamList->AppendL( fileParameter ); |
|
2511 } |
|
2512 } |
|
2513 |
|
2514 if ( ( aiwCopyInParamList->Count() > 0 ) && |
|
2515 aComplete ) |
|
2516 { |
|
2517 CAiwGenericParamList* outParamList = CAiwGenericParamList::NewLC(); |
|
2518 // do not allow the copy dialog to be dismissed by external command |
|
2519 HandleCommandL( EMPXCmdIgnoreExternalCommand ); |
|
2520 iServiceHandler->ExecuteMenuCmdL( |
|
2521 EMPXCmdUPnPAiwCmdCopyToExternalCriteria, /* command id */ |
|
2522 *aiwCopyInParamList, /* in parameters */ |
|
2523 *outParamList, /* out parameters */ |
|
2524 0, /* options */ |
|
2525 NULL ); /* call back */ |
|
2526 HandleCommandL( EMPXCmdHandleExternalCommand ); |
|
2527 |
|
2528 CleanupStack::PopAndDestroy( outParamList ); |
|
2529 } |
|
2530 |
|
2531 // Clear selection |
|
2532 if( iContainer ) |
|
2533 { |
|
2534 iContainer->ClearLbxSelection(); |
|
2535 } |
|
2536 |
|
2537 CleanupStack::PopAndDestroy( aiwCopyInParamList ); |
|
2538 } |
|
2539 |
|
2540 // ----------------------------------------------------------------------------- |
|
2541 // Find playlists |
|
2542 // ----------------------------------------------------------------------------- |
|
2543 // |
|
2544 TInt CMPXCollectionViewHgImp::FindPlaylistsL() |
|
2545 { |
|
2546 MPX_FUNC( "CMPXCollectionViewHgImp::FindPlaylistsL" ); |
|
2547 TInt entriesCount( 0 ); |
|
2548 delete iUserPlaylists; |
|
2549 iUserPlaylists = NULL; |
|
2550 iUserPlaylists = iCommonUiHelper->FindPlaylistsL(); |
|
2551 |
|
2552 if ( iUserPlaylists ) |
|
2553 { |
|
2554 const CMPXMediaArray* mediaArray = |
|
2555 iUserPlaylists->Value<CMPXMediaArray>( KMPXMediaArrayContents ); |
|
2556 User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray)); |
|
2557 |
|
2558 entriesCount = mediaArray->Count(); |
|
2559 MPX_DEBUG2( "CMPXCollectionViewHgImp::FindPlaylistsL Entry count = %d", entriesCount ); |
|
2560 } |
|
2561 else |
|
2562 { |
|
2563 MPX_DEBUG1( "CMPXCollectionViewHgImp::FindPlaylistsL Error getting playlist" ); |
|
2564 User::Leave( KErrNotFound ); |
|
2565 } |
|
2566 return entriesCount; |
|
2567 } |
|
2568 |
|
2569 // ----------------------------------------------------------------------------- |
|
2570 // Save the playlist after reorder |
|
2571 // ----------------------------------------------------------------------------- |
|
2572 // |
|
2573 void CMPXCollectionViewHgImp::SaveCurrentPlaylistL() |
|
2574 { |
|
2575 MPX_FUNC( "CMPXCollectionViewHgImp::SaveCurrentPlaylistL" ); |
|
2576 CMPXCommonListBoxArrayBase* listboxArray = |
|
2577 iContainer->ListBoxArray(); |
|
2578 TInt currentIndex( iContainer->CurrentLbxItemIndex() ); |
|
2579 TInt origIndex( iContainer->GetOriginalIndex() ); |
|
2580 const CMPXMedia& media( listboxArray->MediaL( origIndex ) ); |
|
2581 TMPXItemId id( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
2582 const CMPXMedia& containerMedia = listboxArray->ContainerMedia(); |
|
2583 TMPXItemId playlistId( containerMedia.ValueTObjectL<TMPXItemId>( |
|
2584 KMPXMediaGeneralId ) ); |
|
2585 MPX_DEBUG4( "CMPXCollectionViewHgImp::SaveCurrentPlaylistL song 0x%x is moved from %d to %d", |
|
2586 id.iId1, origIndex, currentIndex ); |
|
2587 MPX_DEBUG2( "CMPXCollectionViewHgImp::SaveCurrentPlaylistL playlist ID 0x%x", playlistId.iId1 ); |
|
2588 iIsSavingReorderPlaylist = ETrue; |
|
2589 iCollectionUiHelper->ReorderPlaylistL( |
|
2590 playlistId, id, origIndex, currentIndex, this ); |
|
2591 iCurrentHighlightedIndex = currentIndex; |
|
2592 } |
|
2593 |
|
2594 // ----------------------------------------------------------------------------- |
|
2595 // Handles rename operation complete |
|
2596 // ----------------------------------------------------------------------------- |
|
2597 // |
|
2598 void CMPXCollectionViewHgImp::HandleRenameOpCompleteL() |
|
2599 { |
|
2600 MPX_FUNC( "CMPXCollectionViewHgImp::HandleRenameOpCompleteL" ); |
|
2601 iSetMediaLCount = KErrNotFound; |
|
2602 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleRenameOpCompleteL dismiss wait note" ); |
|
2603 iCommonUiHelper->DismissWaitNoteL(); |
|
2604 HandleCommandL( EMPXCmdHandleExternalCommand ); |
|
2605 if ( iInvalidFileExist ) |
|
2606 { |
|
2607 // there are invalid files, diplay info note |
|
2608 HBufC* string = StringLoader::LoadLC( |
|
2609 R_MPX_COLLECTION_NOTE_RENAME_WITH_INVALID, *iNewName ); |
|
2610 iCommonUiHelper->DisplayInfoNoteL( *string ); |
|
2611 CleanupStack::PopAndDestroy( string ); |
|
2612 } |
|
2613 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleRenameOpCompleteL calling OpenL" ); |
|
2614 // path changed messages were ignored during rename, need to |
|
2615 // manually refresh the screen |
|
2616 DoIncrementalOpenL(); |
|
2617 } |
|
2618 |
|
2619 // ----------------------------------------------------------------------------- |
|
2620 // checks if send option should be shown |
|
2621 // ----------------------------------------------------------------------------- |
|
2622 // |
|
2623 TBool CMPXCollectionViewHgImp::SendOptionVisibilityL() |
|
2624 { |
|
2625 MPX_FUNC( "CMPXCollectionViewHgImp::SendOptionVisibilityL" ); |
|
2626 TBool isHidden( iContainer->TotalListItemCount() < 1 ); |
|
2627 |
|
2628 if ( !isHidden ) |
|
2629 { |
|
2630 CMPXCommonListBoxArrayBase* baseArray = |
|
2631 iContainer->ListBoxArray(); |
|
2632 CMPXCollectionViewListBoxArray* array = |
|
2633 static_cast<CMPXCollectionViewListBoxArray*>( baseArray ); |
|
2634 TInt selectionCount( 0 ); |
|
2635 if ( iSelectionIndexCache) |
|
2636 { |
|
2637 selectionCount = iSelectionIndexCache->Count(); |
|
2638 } |
|
2639 |
|
2640 if ( selectionCount > 0 ) |
|
2641 { |
|
2642 TBool isValid( EFalse ); |
|
2643 for ( TInt i = 0; i < selectionCount && !isValid; i++ ) |
|
2644 { |
|
2645 // multiple selection |
|
2646 isValid = !array->IsItemBrokenLinkL( |
|
2647 iSelectionIndexCache->At( i ) ); |
|
2648 isValid = isValid && |
|
2649 !array->IsItemCorruptedL( |
|
2650 iSelectionIndexCache->At( i )); |
|
2651 } |
|
2652 // if anything is valid, display the item |
|
2653 isHidden = !isValid; |
|
2654 } |
|
2655 else |
|
2656 { |
|
2657 //single selection |
|
2658 isHidden = array->IsItemBrokenLinkL( |
|
2659 iContainer->CurrentLbxItemIndex() ); |
|
2660 isHidden = isHidden || |
|
2661 array->IsItemCorruptedL( |
|
2662 iContainer->CurrentLbxItemIndex() ); |
|
2663 } |
|
2664 } |
|
2665 |
|
2666 return isHidden; |
|
2667 } |
|
2668 |
|
2669 // ----------------------------------------------------------------------------- |
|
2670 // Checks if Set as ringtone option should be shown |
|
2671 // ----------------------------------------------------------------------------- |
|
2672 // |
|
2673 TBool CMPXCollectionViewHgImp::SetAsRingToneOptionVisibilityL() |
|
2674 { |
|
2675 MPX_FUNC( "CMPXCollectionViewHgImp::SetAsRingToneOptionVisibilityL" ); |
|
2676 TBool isHidden( iContainer->TotalListItemCount() < 1 ); |
|
2677 |
|
2678 if ( !isHidden ) |
|
2679 { |
|
2680 CMPXCollectionViewListBoxArray* array = |
|
2681 static_cast<CMPXCollectionViewListBoxArray*>( |
|
2682 iContainer->ListBoxArray() ); |
|
2683 const CMPXMedia& media = |
|
2684 array->MediaL( iContainer->CurrentLbxItemIndex() ); |
|
2685 |
|
2686 // if item is not yet fetched from database, assume that it's valid |
|
2687 if ( !( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == |
|
2688 KMPXInvalidItemId ) ) |
|
2689 { |
|
2690 CMPXMedia* criteria = CMPXMedia::NewL(); |
|
2691 CleanupStack::PushL( criteria ); |
|
2692 RArray<TMPXAttribute> attrs; |
|
2693 CleanupClosePushL( attrs ); |
|
2694 attrs.Append( KMPXMediaGeneralUri ); |
|
2695 attrs.Append( KMPXMediaDrmProtected ); |
|
2696 attrs.Append( KMPXMediaDrmCanSetAutomated ); |
|
2697 criteria->SetTObjectValueL<TMPXGeneralType>( |
|
2698 KMPXMediaGeneralType, |
|
2699 media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) ); |
|
2700 criteria->SetTObjectValueL<TMPXGeneralCategory>( |
|
2701 KMPXMediaGeneralCategory, |
|
2702 media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) ); |
|
2703 if ( media.IsSupported( KMPXMediaGeneralCollectionId ) ) |
|
2704 { |
|
2705 criteria->SetTObjectValueL<TUid>( |
|
2706 KMPXMediaGeneralCollectionId, |
|
2707 media.ValueTObjectL<TUid>( KMPXMediaGeneralCollectionId ) ); |
|
2708 } |
|
2709 else |
|
2710 { |
|
2711 CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() ); |
|
2712 CleanupStack::PushL( path ); |
|
2713 criteria->SetTObjectValueL<TUid>( |
|
2714 KMPXMediaGeneralCollectionId, |
|
2715 TUid::Uid( path->Id( 0 ) ) ); |
|
2716 CleanupStack::PopAndDestroy( path ); |
|
2717 } |
|
2718 criteria->SetTObjectValueL<TMPXItemId>( |
|
2719 KMPXMediaGeneralId, |
|
2720 media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
2721 |
|
2722 CMPXMedia* songInfo = iCollectionUtility->Collection().FindAllL( *criteria, |
|
2723 attrs.Array() ); |
|
2724 CleanupStack::PopAndDestroy( &attrs ); |
|
2725 CleanupStack::PushL( songInfo ); |
|
2726 |
|
2727 const CMPXMediaArray* mediaArray( |
|
2728 songInfo->Value<CMPXMediaArray>( KMPXMediaArrayContents ) ); |
|
2729 User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray)); |
|
2730 |
|
2731 if ( mediaArray->Count() > 0 ) |
|
2732 { |
|
2733 CMPXMedia* si( mediaArray->AtL( 0 ) ); |
|
2734 if ( si->IsSupported( KMPXMediaDrmProtected ) ) |
|
2735 { |
|
2736 if ( si->ValueTObjectL<TBool>( KMPXMediaDrmProtected ) && |
|
2737 si->IsSupported( KMPXMediaDrmCanSetAutomated ) ) |
|
2738 { |
|
2739 // if it's drm protected, check if |
|
2740 // KMPXMediaDrmCanSetAutomated |
|
2741 isHidden = !( si->ValueTObjectL<TBool>( KMPXMediaDrmCanSetAutomated ) ); |
|
2742 } |
|
2743 } |
|
2744 } |
|
2745 CleanupStack::PopAndDestroy( songInfo ); |
|
2746 CleanupStack::PopAndDestroy( criteria ); |
|
2747 } |
|
2748 } |
|
2749 return isHidden; |
|
2750 } |
|
2751 |
|
2752 // ----------------------------------------------------------------------------- |
|
2753 // Checks if file details option should be shown |
|
2754 // ----------------------------------------------------------------------------- |
|
2755 // |
|
2756 TBool CMPXCollectionViewHgImp::FileDetailsOptionVisibilityL() |
|
2757 { |
|
2758 MPX_FUNC( "CMPXCollectionViewHgImp::FileDetailsOptionVisibilityL" ); |
|
2759 TInt selectionCount( 0 ); |
|
2760 if ( iSelectionIndexCache) |
|
2761 { |
|
2762 selectionCount = iSelectionIndexCache->Count(); |
|
2763 } |
|
2764 TBool isHidden( iContainer->TotalListItemCount() < 1 || |
|
2765 selectionCount ); |
|
2766 if ( !isHidden ) |
|
2767 { |
|
2768 CMPXCollectionViewListBoxArray* array = |
|
2769 static_cast<CMPXCollectionViewListBoxArray*>( |
|
2770 iContainer->ListBoxArray() ); |
|
2771 const CMPXMedia& media = array->MediaL( |
|
2772 iContainer->CurrentLbxItemIndex() ); |
|
2773 |
|
2774 if ( media.IsSupported( KMPXMediaGeneralFlags ) ) |
|
2775 { |
|
2776 TUint flags( media.ValueTObjectL<TUint>( KMPXMediaGeneralFlags ) ); |
|
2777 if ( ( flags ) & ( KMPXMediaGeneralFlagsIsMissingDetails ) ) |
|
2778 { |
|
2779 isHidden = ETrue; |
|
2780 } |
|
2781 } |
|
2782 } |
|
2783 return isHidden; |
|
2784 } |
|
2785 |
|
2786 // ----------------------------------------------------------------------------- |
|
2787 // Handle send command. |
|
2788 // ----------------------------------------------------------------------------- |
|
2789 // |
|
2790 void CMPXCollectionViewHgImp::DoSendL() |
|
2791 { |
|
2792 MPX_FUNC( "CMPXCollectionViewHgImp::DoSendL" ); |
|
2793 |
|
2794 |
|
2795 CMPXCommonListBoxArrayBase* listboxArray( |
|
2796 iContainer->ListBoxArray() ); |
|
2797 TInt currentIndex( iContainer->CurrentLbxItemIndex() ); |
|
2798 const CMPXMedia& media( listboxArray->MediaL( |
|
2799 iContainer->CurrentLbxItemIndex() ) ); |
|
2800 |
|
2801 // Marked indicies |
|
2802 TInt arrayCount( iSelectionIndexCache->Count() ); |
|
2803 |
|
2804 if ( ( arrayCount == 0 || arrayCount == 1 ) && |
|
2805 ( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId ) ) |
|
2806 { |
|
2807 // not marked, or only 1 item is marked |
|
2808 // and the highlighted item is not yet available |
|
2809 MPX_DEBUG1( "CMPXCollectionViewHgImp::DoSendL item not yet fetched" ); |
|
2810 } |
|
2811 else |
|
2812 { |
|
2813 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
2814 CleanupStack::PushL( path ); |
|
2815 |
|
2816 MPX_DEBUG2( "CMPXCollectionViewHgImp::DoSendL array count = %d", arrayCount ); |
|
2817 if ( arrayCount > 1 ) |
|
2818 { |
|
2819 // if more than 1 selected |
|
2820 for ( TInt i = 0; i < arrayCount; i++ ) |
|
2821 { |
|
2822 MPX_DEBUG2( "CMPXCollectionViewHgImp::DoSendL array index = %d", iSelectionIndexCache->At( i ) ); |
|
2823 path->SelectL( iSelectionIndexCache->At(i) ); |
|
2824 } |
|
2825 } |
|
2826 else |
|
2827 { |
|
2828 // if only 1 item is marked, treat it as single selection |
|
2829 path->Set( ( arrayCount == 1 ) ? |
|
2830 iSelectionIndexCache->At( 0 ) : iContainer->CurrentLbxItemIndex() ); |
|
2831 } |
|
2832 |
|
2833 RArray<TMPXAttribute> attrs; |
|
2834 CleanupClosePushL(attrs); |
|
2835 attrs.Append( |
|
2836 TMPXAttribute( KMPXMediaIdGeneral, |
|
2837 EMPXMediaGeneralUri | EMPXMediaGeneralSize | |
|
2838 EMPXMediaGeneralCollectionId | |
|
2839 EMPXMediaGeneralFlags | EMPXMediaGeneralId | |
|
2840 EMPXMediaGeneralType | EMPXMediaGeneralCategory ) ); |
|
2841 iCurrentMediaLOp = EMPXOpMediaLSend; |
|
2842 iCollectionUtility->Collection().MediaL( *path, attrs.Array() ); |
|
2843 CleanupStack::PopAndDestroy( &attrs ); |
|
2844 CleanupStack::PopAndDestroy( path ); |
|
2845 } |
|
2846 } |
|
2847 |
|
2848 // ----------------------------------------------------------------------------- |
|
2849 // Handle send playlist command |
|
2850 // ----------------------------------------------------------------------------- |
|
2851 // |
|
2852 void CMPXCollectionViewHgImp::DoSendPlaylistL( TMPXItemId aItemId ) |
|
2853 { |
|
2854 MPX_FUNC( "CMPXCollectionViewHgImp::DoSendPlaylistL" ); |
|
2855 // export the playlist to file system, and send the playlist |
|
2856 // when the operation is completed |
|
2857 HBufC* defaultDrive = iCommonUiHelper->DefaultDriveLC(); |
|
2858 TFileName defaultPath; |
|
2859 defaultPath.Append( *defaultDrive ); |
|
2860 RFs& fileSession = iCoeEnv->FsSession(); |
|
2861 TBool folderExist = BaflUtils::FolderExists( fileSession, defaultPath ); |
|
2862 TInt count( 0 ); |
|
2863 // use time stamp as the directory name for export, so that |
|
2864 // it won't overwrite any existing files. It will search for the first |
|
2865 // available folder that is not currently in the file system |
|
2866 while ( folderExist ) |
|
2867 { |
|
2868 if ( count++ > KMPXPlaylistExportRetry ) |
|
2869 { |
|
2870 MPX_DEBUG1( "CMPXCollectionViewHgImp::DoSendPlaylistL maximum retry count reached, leaving" ); |
|
2871 User::Leave( KErrNotReady ); |
|
2872 } |
|
2873 defaultPath.Copy( *defaultDrive ); |
|
2874 TTime timeStamp; |
|
2875 timeStamp.UniversalTime(); |
|
2876 defaultPath.AppendNum( timeStamp.Int64() ); |
|
2877 defaultPath.Append( KPathDelimiter ); |
|
2878 folderExist = BaflUtils::FolderExists( fileSession, defaultPath ); |
|
2879 } |
|
2880 CleanupStack::PopAndDestroy( defaultDrive ); |
|
2881 MPX_DEBUG2( "CMPXCollectionViewHgImp::DoSendPlaylistL creating path = %S", &defaultPath ); |
|
2882 BaflUtils::EnsurePathExistsL( fileSession, defaultPath ); |
|
2883 // playlist is sent in the call back of this function |
|
2884 iCollectionUiHelper->ExportPlaylistL( aItemId, defaultPath, this ); |
|
2885 } |
|
2886 |
|
2887 // ----------------------------------------------------------------------------- |
|
2888 // Handle call back from collectionframework for send command |
|
2889 // ----------------------------------------------------------------------------- |
|
2890 // |
|
2891 void CMPXCollectionViewHgImp::DoHandleSendL( const CMPXMedia& aMedia ) |
|
2892 { |
|
2893 MPX_FUNC( "CMPXCollectionViewHgImp::DoHandleSendL" ); |
|
2894 TInt invalidFileCount( 0 ); |
|
2895 TInt maxSize( 0 ); |
|
2896 CMessageData* messageData = CMessageData::NewLC(); |
|
2897 |
|
2898 TInt fileCount( 0 ); |
|
2899 if( aMedia.IsSupported( KMPXMediaArrayContents ) ) |
|
2900 { |
|
2901 const CMPXMediaArray* mediaArray = |
|
2902 aMedia.Value<CMPXMediaArray>( KMPXMediaArrayContents ); |
|
2903 User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray)); |
|
2904 fileCount = mediaArray->Count(); |
|
2905 |
|
2906 } |
|
2907 MPX_DEBUG2( "CMPXCollectionViewHgImp::DoHandleSendL Entry count = %d", fileCount ); |
|
2908 |
|
2909 if ( fileCount > 0 ) |
|
2910 { |
|
2911 const CMPXMediaArray* mediaArray = |
|
2912 aMedia.Value<CMPXMediaArray>( KMPXMediaArrayContents ); |
|
2913 User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray)); |
|
2914 |
|
2915 CMPXMedia* media( NULL ); |
|
2916 for ( TInt i = 0; i < fileCount; i++ ) |
|
2917 { |
|
2918 media = mediaArray->AtL( i ); |
|
2919 TUint flags( media->ValueTObjectL<TUint>( KMPXMediaGeneralFlags ) ); |
|
2920 const TDesC& location = media->ValueText( KMPXMediaGeneralUri ); |
|
2921 |
|
2922 if ( !( flags & KMPXMediaGeneralFlagsIsInvalid ) && |
|
2923 ConeUtils::FileExists( location ) ) |
|
2924 { |
|
2925 TInt fileSize( 0 ); |
|
2926 if ( media->IsSupported( KMPXMediaGeneralSize ) ) |
|
2927 { |
|
2928 fileSize = media->ValueTObjectL<TInt>( KMPXMediaGeneralSize ); |
|
2929 } |
|
2930 else |
|
2931 { |
|
2932 RFs& fileSession = iCoeEnv->FsSession(); |
|
2933 TEntry pl; |
|
2934 fileSession.Entry( location, pl ); |
|
2935 fileSize = pl.iSize; |
|
2936 } |
|
2937 if ( fileSize > maxSize ) |
|
2938 { |
|
2939 maxSize = fileSize; |
|
2940 } |
|
2941 messageData->AppendAttachmentL( location ); |
|
2942 } |
|
2943 else |
|
2944 { |
|
2945 UpdateDatabaseFlagL( KErrNotFound, *media, |
|
2946 KMPXMediaGeneralFlagsIsInvalid, ETrue, EFalse ); |
|
2947 invalidFileCount++; |
|
2948 } |
|
2949 } |
|
2950 } |
|
2951 else |
|
2952 { |
|
2953 // single file |
|
2954 fileCount = 1; |
|
2955 TUint flags = aMedia.ValueTObjectL<TUint>( KMPXMediaGeneralFlags ); |
|
2956 const TDesC& location = aMedia.ValueText( KMPXMediaGeneralUri ); |
|
2957 |
|
2958 if ( !( flags & KMPXMediaGeneralFlagsIsInvalid ) && |
|
2959 ConeUtils::FileExists( location ) ) |
|
2960 { |
|
2961 TInt fileSize( 0 ); |
|
2962 if ( aMedia.IsSupported( KMPXMediaGeneralSize ) ) |
|
2963 { |
|
2964 fileSize = aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralSize ); |
|
2965 } |
|
2966 else |
|
2967 { |
|
2968 RFs& fileSession = iCoeEnv->FsSession(); |
|
2969 TEntry pl; |
|
2970 fileSession.Entry( location, pl ); |
|
2971 fileSize = pl.iSize; |
|
2972 } |
|
2973 if ( fileSize > maxSize ) |
|
2974 { |
|
2975 maxSize = fileSize; |
|
2976 } |
|
2977 messageData->AppendAttachmentL( location ); |
|
2978 } |
|
2979 else |
|
2980 { |
|
2981 UpdateDatabaseFlagL( KErrNotFound, aMedia, |
|
2982 KMPXMediaGeneralFlagsIsInvalid, ETrue, EFalse ); |
|
2983 invalidFileCount++; |
|
2984 } |
|
2985 } |
|
2986 TBool confirmOk( EFalse ); |
|
2987 MPX_DEBUG3( "CMPXCollectionViewHgImp::DoHandleSendL Invalid Count = %d, Total Count = %d", invalidFileCount, fileCount ); |
|
2988 if ( invalidFileCount ) |
|
2989 { |
|
2990 if ( invalidFileCount == fileCount ) |
|
2991 { |
|
2992 // all files are invalid |
|
2993 iCommonUiHelper->DisplayInfoNoteL( ( invalidFileCount == 1 ) ? |
|
2994 R_MPX_COLLECTION_INFO_FILE_NOT_FOUND : |
|
2995 R_MPX_COLLECTION_SEND_ALL_INVALID_SONGS_NOTE_TXT ); |
|
2996 } |
|
2997 else |
|
2998 { |
|
2999 // Show confirmation query if invalid file found |
|
3000 HBufC* queryTxt = StringLoader::LoadLC( |
|
3001 R_MPX_COLLECTION_QUERY_SEND_INVALID_SONGS_TXT ); |
|
3002 CAknQueryDialog* query = CAknQueryDialog::NewL( |
|
3003 CAknQueryDialog::EConfirmationTone ); |
|
3004 CleanupStack::PushL( query ); |
|
3005 query->PublishDialogL( EMPlayerNoteSendInvalidSongs, |
|
3006 KMPlayerNoteCategory); |
|
3007 CleanupStack::Pop( query ); |
|
3008 confirmOk = query->ExecuteLD( |
|
3009 R_MPX_COLLECTION_GENERIC_CONFIRMATION_QUERY, |
|
3010 *queryTxt ); |
|
3011 CleanupStack::PopAndDestroy( queryTxt ); |
|
3012 } |
|
3013 } |
|
3014 |
|
3015 if ( !invalidFileCount || confirmOk ) |
|
3016 { |
|
3017 if ( !iSendUi ) |
|
3018 { |
|
3019 iSendUi = CSendUi::NewL(); |
|
3020 } |
|
3021 TSendingCapabilities capabilities( |
|
3022 0, |
|
3023 maxSize, |
|
3024 TSendingCapabilities::ESupportsAttachments ); |
|
3025 // ignore commands from external clients so that the |
|
3026 // sending is not interrupted |
|
3027 HandleCommandL( EMPXCmdIgnoreExternalCommand ); |
|
3028 // send ui leaves with error 0 if canceled, have to be trapped |
|
3029 MPX_TRAPD( err, iSendUi->ShowQueryAndSendL( messageData, capabilities ) ); |
|
3030 if ( err != KErrNone ) |
|
3031 { |
|
3032 HandleError( err ); |
|
3033 } |
|
3034 HandleCommandL( EMPXCmdHandleExternalCommand ); |
|
3035 } |
|
3036 |
|
3037 // Clear selection |
|
3038 iContainer->ClearLbxSelection(); |
|
3039 CleanupStack::PopAndDestroy( messageData ); |
|
3040 } |
|
3041 |
|
3042 // ----------------------------------------------------------------------------- |
|
3043 // Handle rename command |
|
3044 // ----------------------------------------------------------------------------- |
|
3045 // |
|
3046 void CMPXCollectionViewHgImp::DoHandleRenameL() |
|
3047 { |
|
3048 MPX_FUNC( "CMPXCollectionViewHgImp::DoHandleRenameL" ); |
|
3049 CMPXCommonListBoxArrayBase* listboxArray( |
|
3050 iContainer->ListBoxArray() ); |
|
3051 TInt currentIndex( iContainer->CurrentLbxItemIndex() ); |
|
3052 const CMPXMedia& currentMedia( listboxArray->MediaL( currentIndex ) ); |
|
3053 TMPXGeneralCategory category( |
|
3054 currentMedia.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) ); |
|
3055 switch ( category ) |
|
3056 { |
|
3057 case EMPXPlaylist: |
|
3058 { |
|
3059 // rename playlist |
|
3060 iCurrentMediaLOp = EMPXOpMediaLRenamePlaylist; |
|
3061 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
3062 CleanupStack::PushL( path ); |
|
3063 path->Set( iContainer->CurrentLbxItemIndex() ); |
|
3064 RArray<TMPXAttribute> attrs; |
|
3065 CleanupClosePushL(attrs); |
|
3066 attrs.Append( |
|
3067 TMPXAttribute( KMPXMediaIdGeneral, |
|
3068 EMPXMediaGeneralUri | EMPXMediaGeneralId | |
|
3069 EMPXMediaGeneralTitle ) ); |
|
3070 iCollectionUtility->Collection().MediaL( *path, attrs.Array() ); |
|
3071 CleanupStack::PopAndDestroy( &attrs ); |
|
3072 CleanupStack::PopAndDestroy( path ); |
|
3073 break; |
|
3074 } |
|
3075 case EMPXAlbum: |
|
3076 case EMPXArtist: |
|
3077 case EMPXGenre: |
|
3078 case EMPXComposer: |
|
3079 { |
|
3080 delete iNewName; |
|
3081 iNewName = NULL; |
|
3082 iNewName = HBufC::NewL( KMaxFileName ); |
|
3083 TPtr ptr( iNewName->Des() ); |
|
3084 |
|
3085 // Set default text as current selected item text |
|
3086 const CMPXMediaArray& mediaAry = listboxArray->MediaArray(); |
|
3087 CMPXMedia* origMedia( mediaAry.AtL( currentIndex ) ); |
|
3088 const TDesC& title = origMedia->ValueText( KMPXMediaGeneralTitle ); |
|
3089 ptr.Append( title.Left(KMaxFileName) ); |
|
3090 |
|
3091 CAknTextQueryDialog* query = CAknTextQueryDialog::NewL( ptr ); |
|
3092 CleanupStack::PushL( query ); |
|
3093 query->SetMaxLength( KMaxFileName ); |
|
3094 HBufC* promptTxt = StringLoader::LoadLC( R_MPX_QTN_NMP_PRMPT_NEW_NAME ); |
|
3095 query->SetPromptL( *promptTxt ); |
|
3096 query->SetPredictiveTextInputPermitted( ETrue ); |
|
3097 CleanupStack::PopAndDestroy( promptTxt ); |
|
3098 query->PublishDialogL( |
|
3099 EMPlayerQueryPrmptNewName, |
|
3100 KMPlayerNoteCategory); |
|
3101 CleanupStack::Pop( query ); |
|
3102 if ( query->ExecuteLD( R_MPX_CUI_RENAME_QUERY ) ) |
|
3103 { |
|
3104 TMPXItemId id( |
|
3105 currentMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
3106 |
|
3107 CMPXMedia* media = CMPXMedia::NewL(); |
|
3108 CleanupStack::PushL( media ); |
|
3109 media->SetTObjectValueL<TMPXGeneralType>( |
|
3110 KMPXMediaGeneralType, EMPXGroup ); |
|
3111 media->SetTObjectValueL<TMPXGeneralCategory>( |
|
3112 KMPXMediaGeneralCategory, EMPXSong ); |
|
3113 media->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id ); |
|
3114 |
|
3115 switch ( category ) |
|
3116 { |
|
3117 case EMPXAlbum: |
|
3118 { |
|
3119 iCurrentFindAllLOp = EMPXOpFindAllLRenameAlbum; |
|
3120 // check if it's album or artist/album |
|
3121 const CMPXMedia& containerMedia = listboxArray->ContainerMedia(); |
|
3122 TMPXGeneralCategory containerCategory( |
|
3123 containerMedia.ValueTObjectL<TMPXGeneralCategory>( |
|
3124 KMPXMediaGeneralCategory ) ); |
|
3125 if ( containerCategory == EMPXArtist ) |
|
3126 { |
|
3127 // artist/album level, need to specify artist ID in container ID |
|
3128 TMPXItemId containerId( |
|
3129 containerMedia.ValueTObjectL<TMPXItemId>( |
|
3130 KMPXMediaGeneralId ) ); |
|
3131 media->SetTObjectValueL<TMPXItemId>( |
|
3132 KMPXMediaGeneralContainerId, containerId ); |
|
3133 } |
|
3134 break; |
|
3135 } |
|
3136 case EMPXArtist: |
|
3137 { |
|
3138 iCurrentFindAllLOp = EMPXOpFindAllLRenameArtist; |
|
3139 break; |
|
3140 } |
|
3141 case EMPXGenre: |
|
3142 { |
|
3143 iCurrentFindAllLOp = EMPXOpFindAllLRenameGenre; |
|
3144 break; |
|
3145 } |
|
3146 case EMPXComposer: |
|
3147 { |
|
3148 iCurrentFindAllLOp = EMPXOpFindAllLRenameComposer; |
|
3149 break; |
|
3150 } |
|
3151 default: |
|
3152 { |
|
3153 ASSERT( 0 ); |
|
3154 break; |
|
3155 } |
|
3156 } |
|
3157 RArray<TMPXAttribute> attrs; |
|
3158 CleanupClosePushL( attrs ); |
|
3159 attrs.Append( |
|
3160 TMPXAttribute( KMPXMediaIdGeneral, |
|
3161 EMPXMediaGeneralId | EMPXMediaGeneralUri | |
|
3162 EMPXMediaGeneralCollectionId | |
|
3163 EMPXMediaGeneralType | EMPXMediaGeneralCategory | EMPXMediaGeneralFlags ) ); |
|
3164 if ( category == EMPXAlbum || category == EMPXArtist ) |
|
3165 { |
|
3166 attrs.Append( TMPXAttribute( KMPXMediaIdMusic, |
|
3167 EMPXMediaMusicAlbumArtFileName ) ); |
|
3168 } |
|
3169 iCollectionUtility->Collection().FindAllL( *media, attrs.Array(), *this ); |
|
3170 CleanupStack::PopAndDestroy( &attrs ); |
|
3171 CleanupStack::PopAndDestroy( media ); |
|
3172 } |
|
3173 break; |
|
3174 } |
|
3175 default: |
|
3176 { |
|
3177 // shouldn't reach here |
|
3178 ASSERT( 0 ); |
|
3179 break; |
|
3180 } |
|
3181 } |
|
3182 } |
|
3183 |
|
3184 // ----------------------------------------------------------------------------- |
|
3185 // Prepares media object for selected items |
|
3186 // ----------------------------------------------------------------------------- |
|
3187 // |
|
3188 void CMPXCollectionViewHgImp::PrepareMediaForSelectedItemsL( CMPXMedia& aMedia ) |
|
3189 { |
|
3190 MPX_FUNC( "CMPXCollectionViewHgImp::PrepareMediaForSelectedItemsL" ); |
|
3191 CMPXMediaArray* mediaArray( CMPXMediaArray::NewL() ); |
|
3192 CleanupStack::PushL( mediaArray ); |
|
3193 CMPXCommonListBoxArrayBase* listBoxArray = |
|
3194 iContainer->ListBoxArray(); |
|
3195 TInt count( iSelectionIndexCache->Count() ); |
|
3196 |
|
3197 CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() ); |
|
3198 CleanupStack::PushL( path ); |
|
3199 TMPXItemId id( path->Id( 0 ) ); |
|
3200 MPX_DEBUG2( "CMPXCollectionViewHgImp::PrepareMediaForSelectedItemsL collection ID = 0x%x", id.iId1 ); |
|
3201 CleanupStack::PopAndDestroy( path ); |
|
3202 |
|
3203 if ( count > 0 ) |
|
3204 { |
|
3205 if ( count == 1 ) |
|
3206 { |
|
3207 // marked one item, if it's not valid, ignore the command |
|
3208 const CMPXMedia& listBoxMedia = listBoxArray->MediaL( iSelectionIndexCache->At(0) ); |
|
3209 if ( listBoxMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId ) |
|
3210 { |
|
3211 // leave with special error code, this error |
|
3212 // should not trigger any error message, the operation should |
|
3213 // be terminated silently |
|
3214 User::Leave( KMPXErrDataNotReady ); |
|
3215 } |
|
3216 } |
|
3217 for ( TInt i = 0; i < count; i++ ) |
|
3218 { |
|
3219 const CMPXMedia& listBoxMedia = listBoxArray->MediaL( iSelectionIndexCache->At(i) ); |
|
3220 if ( listBoxMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId ) |
|
3221 { |
|
3222 // item not ready, cache this command and execute |
|
3223 // it when the data becomes valid |
|
3224 User::Leave( KMPXErrDataNotReadyCacheCommand ); |
|
3225 } |
|
3226 CMPXMedia* entry( PopulateMediaLC( listBoxMedia, id ) ); |
|
3227 mediaArray->AppendL( entry ); |
|
3228 CleanupStack::Pop( entry ); |
|
3229 } |
|
3230 } |
|
3231 else |
|
3232 { |
|
3233 const CMPXMedia& listBoxMedia = listBoxArray->MediaL( |
|
3234 iContainer->CurrentLbxItemIndex() ); |
|
3235 if ( listBoxMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId ) |
|
3236 { |
|
3237 // leave with special error code, this error |
|
3238 // should not trigger any error message, the operation should |
|
3239 // be terminated silently |
|
3240 User::Leave( KMPXErrDataNotReady ); |
|
3241 } |
|
3242 else |
|
3243 { |
|
3244 CMPXMedia* entry( PopulateMediaLC( listBoxMedia, id ) ); |
|
3245 mediaArray->AppendL( entry ); |
|
3246 CleanupStack::Pop( entry ); |
|
3247 } |
|
3248 } |
|
3249 aMedia.SetTObjectValueL( KMPXMediaGeneralCollectionId, id ); |
|
3250 aMedia.SetCObjectValueL( KMPXMediaArrayContents, mediaArray ); |
|
3251 aMedia.SetTObjectValueL( KMPXMediaArrayCount, mediaArray->Count() ); |
|
3252 iNumSongAddedToPlaylist = mediaArray->Count(); |
|
3253 CleanupStack::PopAndDestroy( mediaArray ); |
|
3254 } |
|
3255 |
|
3256 // ----------------------------------------------------------------------------- |
|
3257 // Populates media object with information needed for save to |
|
3258 // existing playlist |
|
3259 // ----------------------------------------------------------------------------- |
|
3260 // |
|
3261 CMPXMedia* CMPXCollectionViewHgImp::PopulateMediaLC( |
|
3262 const CMPXMedia& aMedia, TMPXItemId aCollectionId ) |
|
3263 { |
|
3264 MPX_FUNC( "CMPXCollectionViewHgImp::PopulateMediaLC" ); |
|
3265 CMPXMedia* entry = CMPXMedia::NewL(); |
|
3266 CleanupStack::PushL( entry ); |
|
3267 entry->SetTextValueL( |
|
3268 KMPXMediaGeneralTitle, |
|
3269 aMedia.ValueText( KMPXMediaGeneralTitle ) ); |
|
3270 entry->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem); |
|
3271 entry->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong ); |
|
3272 entry->SetTObjectValueL( KMPXMediaGeneralId, |
|
3273 aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
3274 entry->SetTObjectValueL( KMPXMediaGeneralCollectionId, aCollectionId ); |
|
3275 return entry; |
|
3276 } |
|
3277 |
|
3278 // ----------------------------------------------------------------------------- |
|
3279 // Handle rename playlist command |
|
3280 // ----------------------------------------------------------------------------- |
|
3281 // |
|
3282 void CMPXCollectionViewHgImp::DoHandleRenamePlaylistL( const CMPXMedia& aMedia ) |
|
3283 { |
|
3284 MPX_FUNC( "CMPXCollectionViewHgImp::DoHandleRenamePlaylistL" ); |
|
3285 const TDesC& uri = aMedia.ValueText( KMPXMediaGeneralUri ); |
|
3286 TParsePtrC fn( uri ); |
|
3287 #ifdef _DEBUG |
|
3288 TPtrC ptr( fn.NameAndExt() ); |
|
3289 MPX_DEBUG2( "CMPXCollectionViewHgImp::DoHandleRenamePlaylistL Original Uri = %S", &ptr ); |
|
3290 #endif |
|
3291 HBufC* playlistName = HBufC::NewLC( KMaxFileName ); |
|
3292 TPtr playlistNamePtr = playlistName->Des(); |
|
3293 const TDesC& title = aMedia.ValueText( KMPXMediaGeneralTitle ); |
|
3294 TInt ret = iCommonUiHelper->LaunchRenameDialogL( |
|
3295 title, playlistNamePtr, fn.DriveAndPath() ); |
|
3296 if ( ret ) |
|
3297 { |
|
3298 CMPXMedia* media = CMPXMedia::NewL(); |
|
3299 CleanupStack::PushL( media ); |
|
3300 media->SetTObjectValueL<TMPXGeneralType>( |
|
3301 KMPXMediaGeneralType, EMPXItem ); |
|
3302 media->SetTObjectValueL<TMPXGeneralCategory>( |
|
3303 KMPXMediaGeneralCategory, EMPXPlaylist ); |
|
3304 TMPXItemId id( aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
3305 media->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id ); |
|
3306 TParsePtrC newFn( *playlistName ); |
|
3307 media->SetTextValueL( KMPXMediaGeneralTitle, newFn.NameAndExt() ); |
|
3308 iCollectionUiHelper->RenameL( *media, this ); |
|
3309 CleanupStack::PopAndDestroy( media ); |
|
3310 } |
|
3311 CleanupStack::PopAndDestroy( playlistName ); |
|
3312 } |
|
3313 |
|
3314 // --------------------------------------------------------------------------- |
|
3315 // Set/clears the flags for item in database |
|
3316 // --------------------------------------------------------------------------- |
|
3317 // |
|
3318 void CMPXCollectionViewHgImp::UpdateDatabaseFlagL( |
|
3319 TInt aIndex, const CMPXMedia& aMedia, TUint aFlag, |
|
3320 TBool aSet, TBool aEnableInfoDialog ) |
|
3321 { |
|
3322 MPX_FUNC( "CMPXCollectionViewHgImp::UpdateDatabaseFlagL" ); |
|
3323 MPX_DEBUG3( "CMPXCollectionViewHgImp::UpdateDatabaseFlagL aFlag = 0x%x, aSet = %d", aFlag, aSet ); |
|
3324 CMPXCommonListBoxArrayBase* array( iContainer->ListBoxArray() ); |
|
3325 ASSERT( array ); |
|
3326 |
|
3327 // set the item as invalid |
|
3328 TUint flags( 0 ); |
|
3329 if ( aSet ) |
|
3330 { |
|
3331 flags = KMPXMediaGeneralFlagsSetOrUnsetBit; |
|
3332 } |
|
3333 flags |= aFlag; |
|
3334 |
|
3335 MPX_DEBUG2( "CMPXCollectionViewHgImp::UpdateDatabaseFlagL flag after 0x%x", flags ); |
|
3336 CMPXMedia* entry = CMPXMedia::NewL(); |
|
3337 CleanupStack::PushL( entry ); |
|
3338 if ( aIndex > KErrNotFound ) |
|
3339 { |
|
3340 MPX_DEBUG2( "CMPXCollectionViewHgImp::UpdateDatabaseFlagL using aIndex = %d", aIndex ); |
|
3341 const CMPXMedia& media = array->MediaL( aIndex ); |
|
3342 TMPXItemId id( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
3343 TMPXGeneralType type( |
|
3344 media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) ); |
|
3345 TMPXGeneralCategory category( |
|
3346 media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) ); |
|
3347 entry->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id ); |
|
3348 entry->SetTObjectValueL<TMPXGeneralType>( |
|
3349 KMPXMediaGeneralType, type ); |
|
3350 entry->SetTObjectValueL<TMPXGeneralCategory>( |
|
3351 KMPXMediaGeneralCategory, category ); |
|
3352 } |
|
3353 else |
|
3354 { |
|
3355 // try to look for the info inside aMedia |
|
3356 if ( aMedia.IsSupported( KMPXMediaGeneralId ) ) |
|
3357 { |
|
3358 TMPXItemId id( aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
3359 entry->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id ); |
|
3360 } |
|
3361 if ( aMedia.IsSupported( KMPXMediaGeneralType ) ) |
|
3362 { |
|
3363 TMPXGeneralType type( |
|
3364 aMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) ); |
|
3365 entry->SetTObjectValueL<TMPXGeneralType>( |
|
3366 KMPXMediaGeneralType, type ); |
|
3367 } |
|
3368 if ( aMedia.IsSupported( KMPXMediaGeneralCategory ) ) |
|
3369 { |
|
3370 TMPXGeneralCategory category( |
|
3371 aMedia.ValueTObjectL<TMPXGeneralCategory>( |
|
3372 KMPXMediaGeneralCategory ) ); |
|
3373 entry->SetTObjectValueL<TMPXGeneralCategory>( |
|
3374 KMPXMediaGeneralCategory, category ); |
|
3375 } |
|
3376 } |
|
3377 TUid collectionId( aMedia.ValueTObjectL<TUid>( KMPXMediaGeneralCollectionId ) ); |
|
3378 entry->SetTObjectValueL<TUid>( |
|
3379 KMPXMediaGeneralCollectionId, collectionId ); |
|
3380 entry->SetTObjectValueL<TUint>( KMPXMediaGeneralFlags, flags ); |
|
3381 |
|
3382 // Update the collection via CommandL |
|
3383 CMPXCommand* cmd( CMPXCommand::NewL() ); |
|
3384 CleanupStack::PushL( cmd ); |
|
3385 cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet ); |
|
3386 cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue ); |
|
3387 TUid colId( entry->ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId) ); |
|
3388 cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, colId.iUid ); |
|
3389 cmd->SetCObjectValueL<CMPXMedia>( KMPXCommandColSetMedia, entry ); |
|
3390 iCollectionUtility->Collection().CommandL( *cmd ); |
|
3391 CleanupStack::PopAndDestroy( cmd ); |
|
3392 |
|
3393 CleanupStack::PopAndDestroy( entry ); |
|
3394 if ( aEnableInfoDialog && KMPXMediaGeneralFlagsIsInvalid == aFlag ) |
|
3395 { |
|
3396 iCommonUiHelper->DisplayInfoNoteL( R_MPX_COLLECTION_INFO_FILE_NOT_FOUND ); |
|
3397 } |
|
3398 } |
|
3399 |
|
3400 // --------------------------------------------------------------------------- |
|
3401 // Get duration of current view |
|
3402 // --------------------------------------------------------------------------- |
|
3403 // |
|
3404 void CMPXCollectionViewHgImp::GetDurationL() |
|
3405 { |
|
3406 MPX_FUNC( "CMPXCollectionViewHgImp::GetDurationL" ); |
|
3407 CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL(); |
|
3408 CleanupStack::PushL( cpath ); |
|
3409 cpath->Back(); // Container |
|
3410 RArray<TMPXAttribute> attrs; |
|
3411 CleanupClosePushL(attrs); |
|
3412 iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo; |
|
3413 attrs.Append( KMPXMediaGeneralDuration ); |
|
3414 iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() ); |
|
3415 CleanupStack::PopAndDestroy( &attrs ); |
|
3416 CleanupStack::PopAndDestroy( cpath ); |
|
3417 } |
|
3418 |
|
3419 // --------------------------------------------------------------------------- |
|
3420 // Handles file check result |
|
3421 // --------------------------------------------------------------------------- |
|
3422 // |
|
3423 void CMPXCollectionViewHgImp::DoHandleFileCheckResultL( |
|
3424 TUid aViewToActivate, const CMPXMedia& aMedia ) |
|
3425 { |
|
3426 MPX_FUNC( "CMPXCollectionViewHgImp::HandleFileCheckResultL" ); |
|
3427 const TDesC& location = aMedia.ValueText( KMPXMediaGeneralUri ); |
|
3428 if ( location.Length() == 0 || ConeUtils::FileExists( location ) ) |
|
3429 { |
|
3430 #ifdef SINGLE_CLICK_INCLUDED |
|
3431 HandleListBoxEventL( NULL, EEventItemSingleClicked ); |
|
3432 #else |
|
3433 HandleListBoxEventL( NULL, EEventItemClicked ); |
|
3434 #endif |
|
3435 HBufC* buf = HBufC::NewLC( 5 ); // magic number, array granularity |
|
3436 buf->Des().AppendNum( iContainer->CurrentLbxItemIndex() ); |
|
3437 // Activate view via View Framework |
|
3438 iViewUtility->ActivateViewL( aViewToActivate, buf ); |
|
3439 CleanupStack::PopAndDestroy( buf ); |
|
3440 } |
|
3441 else |
|
3442 { |
|
3443 // mark database entry for this item as invalid |
|
3444 UpdateDatabaseFlagL( iContainer->CurrentLbxItemIndex(), |
|
3445 aMedia, KMPXMediaGeneralFlagsIsInvalid, ETrue ); |
|
3446 } |
|
3447 } |
|
3448 |
|
3449 #ifdef __ENABLE_MSK |
|
3450 // --------------------------------------------------------------------------- |
|
3451 // Updates the middle softkey display |
|
3452 // --------------------------------------------------------------------------- |
|
3453 // |
|
3454 void CMPXCollectionViewHgImp::UpdateMiddleSoftKeyDisplayL( TInt aMskId ) |
|
3455 { |
|
3456 MPX_FUNC( "CMPXCollectionViewHgImp::UpdateMiddleSoftKeyDisplayL" ); |
|
3457 CEikButtonGroupContainer* cba = Cba(); |
|
3458 if ( cba ) |
|
3459 { |
|
3460 if ( !iContainer->CurrentListItemCount() ) // list is empty |
|
3461 { |
|
3462 // remove middle softkey label |
|
3463 iCommonUiHelper->RemoveMiddleSoftKeyLabel( *cba ); |
|
3464 MPX_DEBUG1( "CMPXCollectionViewHgImp::UpdateMiddleSoftKeyDisplayL - remove label, list is empty" ); |
|
3465 } |
|
3466 else if ( iContainer->CurrentSelectionIndicesL()->Count() ) // marked items |
|
3467 { |
|
3468 CFbsBitmap* bitmap = NULL; |
|
3469 CFbsBitmap* mask = NULL; |
|
3470 AknsUtils::CreateColorIconL( |
|
3471 AknsUtils::SkinInstance(), |
|
3472 KAknsIIDQgnPropMskMenu, |
|
3473 KAknsIIDQsnComponentColors, |
|
3474 EAknsCIQsnComponentColorsCG13, |
|
3475 bitmap, |
|
3476 mask, |
|
3477 AknIconUtils::AvkonIconFileName(), |
|
3478 EMbmAvkonQgn_prop_msk_menu, |
|
3479 EMbmAvkonQgn_prop_msk_menu_mask, |
|
3480 KRgbBlack); |
|
3481 |
|
3482 CleanupStack::PushL(bitmap); |
|
3483 CleanupStack::PushL(mask); |
|
3484 |
|
3485 // set middle softkey icon |
|
3486 iCommonUiHelper->SetMiddleSoftKeyIconL(*cba, bitmap, mask); |
|
3487 |
|
3488 CleanupStack::PopAndDestroy(2, bitmap); |
|
3489 MPX_DEBUG1("CMPXCollectionViewHgImp::UpdateMiddleSoftKeyDisplayL - items marked, show icon"); |
|
3490 } |
|
3491 else |
|
3492 { |
|
3493 // set middle softkey label |
|
3494 iCommonUiHelper->SetMiddleSoftKeyLabelL( |
|
3495 *cba, |
|
3496 aMskId, |
|
3497 EAknSoftkeyForwardKeyEvent ); |
|
3498 iCurrentMskId = aMskId; |
|
3499 MPX_DEBUG1( "CMPXCollectionViewHgImp::UpdateMiddleSoftKeyDisplayL - label displayed" ); |
|
3500 } |
|
3501 cba->DrawDeferred(); |
|
3502 } |
|
3503 } |
|
3504 #endif // __ENABLE_MSK |
|
3505 |
|
3506 |
|
3507 // --------------------------------------------------------------------------- |
|
3508 // Handles the completion of adding a playlist event |
|
3509 // --------------------------------------------------------------------------- |
|
3510 // |
|
3511 void CMPXCollectionViewHgImp::HandleAddCompletedL( |
|
3512 CMPXMedia* aPlaylist, TInt aError ) |
|
3513 { |
|
3514 MPX_FUNC( "CMPXCollectionViewHgImp::HandleAddCompletedL" ); |
|
3515 iAddingToNewPlaylist = EFalse; |
|
3516 iCommonUiHelper->DismissWaitNoteL(); |
|
3517 HandleCommandL( EMPXCmdHandleExternalCommand ); |
|
3518 if ( aError == KErrNone ) |
|
3519 { |
|
3520 // Show confirmation note |
|
3521 if( aPlaylist->IsSupported( KMPXMediaGeneralId ) ) |
|
3522 { |
|
3523 iPlaylistId = aPlaylist->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ); |
|
3524 } |
|
3525 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleAddCompletedL iPlaylistId = 0x%x", iPlaylistId.iId1 ); |
|
3526 if ( iCurrentPlaylistOp != EMPXOpPLCreating ) |
|
3527 { |
|
3528 HBufC* confirmTxt( NULL ); |
|
3529 const TDesC& title( aPlaylist->ValueText( KMPXMediaGeneralTitle ) ); |
|
3530 TMPlayerSecondaryDisplayNote noteId( EMPlayerNoteNone ); |
|
3531 if ( iNumSongAddedToPlaylist > 1 ) |
|
3532 { |
|
3533 confirmTxt = StringLoader::LoadLC( |
|
3534 R_MPX_QTN_MUS_MULTIPLE_TRACKS_ADDED_TO_PL, |
|
3535 title, iNumSongAddedToPlaylist ); |
|
3536 noteId = EMPlayerNoteAddManySongToPlaylist; |
|
3537 } |
|
3538 else |
|
3539 { |
|
3540 confirmTxt = StringLoader::LoadLC( |
|
3541 R_MPX_QTN_MUS_NOTE_TRACK_ADDED_TO_PL, title ); |
|
3542 noteId = EMPlayerNoteAddSongToPlaylist; |
|
3543 } |
|
3544 |
|
3545 CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote(); |
|
3546 |
|
3547 note->PublishDialogL( |
|
3548 noteId, |
|
3549 KMPlayerNoteCategory ); |
|
3550 |
|
3551 if ( iCoverDisplay ) |
|
3552 { |
|
3553 CAknMediatorFacade* covercl = AknMediatorFacade( note ); |
|
3554 if ( covercl ) |
|
3555 { |
|
3556 covercl->BufStream() << title; |
|
3557 if ( iNumSongAddedToPlaylist > 1 ) |
|
3558 { |
|
3559 covercl->BufStream().WriteInt32L( iNumSongAddedToPlaylist ); |
|
3560 } |
|
3561 } |
|
3562 } |
|
3563 |
|
3564 note->ExecuteLD( *confirmTxt ); |
|
3565 CleanupStack::PopAndDestroy( confirmTxt ); |
|
3566 |
|
3567 } |
|
3568 else // iCurrentPlaylistOp == EMPXOpPLCreating |
|
3569 { |
|
3570 // Re-open the collection, because we cannot |
|
3571 // depend on the change events that could be a race condition |
|
3572 // against this HandleAddCompleteL() callback! |
|
3573 // |
|
3574 DoIncrementalOpenL(); |
|
3575 } |
|
3576 } |
|
3577 else |
|
3578 { |
|
3579 HandleError( aError ); |
|
3580 } |
|
3581 |
|
3582 delete aPlaylist; |
|
3583 if ( iContainer ) |
|
3584 { |
|
3585 iContainer->ClearLbxSelection(); |
|
3586 } |
|
3587 } |
|
3588 |
|
3589 // ----------------------------------------------------------------------------- |
|
3590 // Handles the completion of setting a media event. |
|
3591 // ----------------------------------------------------------------------------- |
|
3592 // |
|
3593 void CMPXCollectionViewHgImp::HandleSetCompletedL( CMPXMedia* aMedia, TInt aError ) |
|
3594 { |
|
3595 MPX_FUNC( "CMPXCollectionViewHgImp::HandleSetCompletedL" ); |
|
3596 delete aMedia; |
|
3597 if ( aError == KErrNone ) |
|
3598 { |
|
3599 // save successful, set flag so that it can't be saved again |
|
3600 MPXTlsHelper::SetNeedSave( EFalse ); |
|
3601 } |
|
3602 else |
|
3603 { |
|
3604 if (iContainer->IsInReorderMode()) |
|
3605 { |
|
3606 DeactivateReorderGrabbedModeL(ETrue); |
|
3607 } |
|
3608 HandleError( aError ); |
|
3609 } |
|
3610 if ( iIsSavingReorderPlaylist ) |
|
3611 { |
|
3612 // change messages are ignored during save command, |
|
3613 // when save is complete, it should open the collection again to refresh |
|
3614 // display data |
|
3615 DoIncrementalOpenL(); |
|
3616 iIsSavingReorderPlaylist = EFalse; |
|
3617 } |
|
3618 } |
|
3619 |
|
3620 // ----------------------------------------------------------------------------- |
|
3621 // Handle playback message |
|
3622 // ----------------------------------------------------------------------------- |
|
3623 // |
|
3624 void CMPXCollectionViewHgImp::DoHandlePlaybackMessageL( const CMPXMessage& aMessage ) |
|
3625 { |
|
3626 MPX_FUNC( "CMPXCollectionViewHgImp::DoHandlePlaybackMessageL" ); |
|
3627 TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) ); |
|
3628 if ( KMPXMessageGeneral == id ) |
|
3629 { |
|
3630 TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) ); |
|
3631 TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) ); |
|
3632 TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) ); |
|
3633 switch ( event ) |
|
3634 { |
|
3635 case TMPXPlaybackMessage::EActivePlayerChanged: |
|
3636 case TMPXPlaybackMessage::EStateChanged: |
|
3637 { |
|
3638 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandlePlaybackMessageL - EStateChanged(%d)", type ); |
|
3639 UpdatePlaybackStatusL(); |
|
3640 break; |
|
3641 } |
|
3642 case TMPXPlaybackMessage::EError: |
|
3643 { |
|
3644 if ( iCommonUiHelper ) |
|
3645 { |
|
3646 iCommonUiHelper->DismissWaitNoteL(); |
|
3647 HandleCommandL( EMPXCmdHandleExternalCommand ); |
|
3648 } |
|
3649 if ( iIsDeleting ) |
|
3650 { |
|
3651 iCollectionUiHelper->Cancel(); |
|
3652 iIsDeleting = EFalse; |
|
3653 // if delete is interrupted, reopen |
|
3654 DoIncrementalOpenL(); |
|
3655 } |
|
3656 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandlePlaybackMessageL Error = %d", data ); |
|
3657 break; |
|
3658 } |
|
3659 case TMPXPlaybackMessage::EPlayerUnavailable: |
|
3660 { |
|
3661 if ( iUpnpFrameworkSupport ) |
|
3662 { |
|
3663 if ( data == KErrNotFound ) |
|
3664 { |
|
3665 if ( iViewUtility->ActiveViewType() == |
|
3666 TUid::Uid( KMPXPluginTypeCollectionUid ) ) |
|
3667 { |
|
3668 if ( iSubPlayerName ) |
|
3669 { |
|
3670 HBufC* dialogText = StringLoader::LoadLC( R_MPX_COLLECTION_NOTE_REMOTE_CONNECTION_FAILED, |
|
3671 *iSubPlayerName ); |
|
3672 CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue); |
|
3673 errNote->SetTimeout(CAknNoteDialog::ELongTimeout); |
|
3674 errNote->ExecuteLD( *dialogText ); |
|
3675 CleanupStack::PopAndDestroy( dialogText ); |
|
3676 } |
|
3677 } |
|
3678 } |
|
3679 } |
|
3680 // else we don't show any error note |
|
3681 break; |
|
3682 } |
|
3683 default: |
|
3684 { |
|
3685 // ignore other messages |
|
3686 break; |
|
3687 } |
|
3688 } |
|
3689 // Fix EBLI-7CFE4D press select key very quick cause System Error KErrArgument |
|
3690 if (event != TMPXPlaybackMessage::ECommandReceived) |
|
3691 { |
|
3692 iHandlingKeyEvent = EFalse; |
|
3693 } |
|
3694 } |
|
3695 else |
|
3696 { |
|
3697 iHandlingKeyEvent = EFalse; |
|
3698 } |
|
3699 } |
|
3700 |
|
3701 // ----------------------------------------------------------------------------- |
|
3702 // Handle collection message |
|
3703 // ----------------------------------------------------------------------------- |
|
3704 // |
|
3705 void CMPXCollectionViewHgImp::DoHandleCollectionMessageL( const CMPXMessage& aMessage ) |
|
3706 { |
|
3707 MPX_FUNC( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL" ); |
|
3708 TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) ); |
|
3709 if ( KMPXMessageGeneral == id ) |
|
3710 { |
|
3711 TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) ); |
|
3712 TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) ); |
|
3713 TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) ); |
|
3714 MPX_DEBUG4( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL Event = %d, Type() = %d, data = %d", |
|
3715 event, type, data ); |
|
3716 |
|
3717 // Only handle collection messages while collection view is in focus |
|
3718 // and not transitioning views |
|
3719 if( iContainer ) |
|
3720 { |
|
3721 |
|
3722 if ( event == TMPXCollectionMessage::EPathChanged && |
|
3723 type == EMcPathChangedByOpen && |
|
3724 data == EMcContainerOpened |
|
3725 ) |
|
3726 { // Open new entries |
|
3727 MPX_DEBUG1( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL calling OpenL EMcPathChangedByOpen" ); |
|
3728 if ( iContainer->IsInReorderMode() ) |
|
3729 { |
|
3730 MPX_DEBUG1( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL canceling reorder mode" ); |
|
3731 // cancel reorder mode if path has changed |
|
3732 ProcessCommandL( EMPXCmdReorderDone ); |
|
3733 } |
|
3734 if( iContainer->CurrentSelectionIndicesL()->Count() ) |
|
3735 { |
|
3736 HandleCommandL( EAknUnmarkAll ); |
|
3737 } |
|
3738 |
|
3739 // Incremental Open when browsing to the next level |
|
3740 DoIncrementalOpenL(); |
|
3741 } |
|
3742 else if ( event == TMPXCollectionMessage::EPathChanged && |
|
3743 type == EMcPathChangedByCollectionChange ) |
|
3744 { |
|
3745 // Re-Fetch entries only if we are in playlist |
|
3746 // creation idle stage. Ignore change messages during playlist op |
|
3747 // because there are race conditions and we don't know |
|
3748 // which handle open is actually opening the playlist! |
|
3749 // |
|
3750 // don't call openL if it's currently deleting |
|
3751 // don't call openL if saving after reorder |
|
3752 // don't call openL if renaming |
|
3753 if( iCurrentPlaylistOp == EMPXOpPLIdle && !iIsDeleting |
|
3754 && !iIsSavingReorderPlaylist && iSetMediaLCount == KErrNotFound ) |
|
3755 { |
|
3756 MPX_DEBUG1( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL calling OpenL EMcPathChangedByCollectionChange" ); |
|
3757 if( iContainer->CurrentSelectionIndicesL()->Count() ) |
|
3758 { |
|
3759 HandleCommandL( EAknUnmarkAll ); |
|
3760 } |
|
3761 // dismiss find pane if it's visible |
|
3762 if( iContainer->FindBoxVisibility() ) |
|
3763 { |
|
3764 iContainer->EnableFindBox( EFalse ); |
|
3765 } |
|
3766 DoIncrementalOpenL(); |
|
3767 } |
|
3768 else |
|
3769 { |
|
3770 MPX_DEBUG4( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL PathChange Message Ignored iIsDeleting = %d, iCurrentPlaylistOp = %d, iIsSavingReorderPlaylist = %d", iIsDeleting, iCurrentPlaylistOp, iIsSavingReorderPlaylist ); |
|
3771 MPX_DEBUG2( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL PathChange Message Ignored iSetMediaLCount = %d", iSetMediaLCount ); |
|
3772 } |
|
3773 } |
|
3774 else if ( event == TMPXCollectionMessage::EPathChanged && |
|
3775 type == EMcPathChangedByOpen && |
|
3776 data == EMcItemOpened) |
|
3777 { |
|
3778 // opened a song, revert back one level when collection view |
|
3779 // is activated again |
|
3780 iIncrementalOpenUtil->Stop(); |
|
3781 iBackOneLevel = ETrue; |
|
3782 } |
|
3783 else if( event == TMPXCollectionMessage::EBroadcastEvent ) |
|
3784 { |
|
3785 MPX_DEBUG2( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL - broadcast type = %d", type ); |
|
3786 if ( type == EMcMsgDiskRemoved && |
|
3787 iViewUtility->ActiveViewType() != TUid::Uid(KMPXPluginTypeWaitNoteDialogUid) ) |
|
3788 { |
|
3789 AknDialogShutter::ShutDialogsL( *CEikonEnv::Static() ); |
|
3790 } |
|
3791 if ( iConfirmationDlg && ( type == EMcMsgUSBMTPStart || type == EMcMsgUSBMassStorageStart ) ) |
|
3792 { |
|
3793 TKeyEvent kEvent; |
|
3794 kEvent.iCode = EKeyEscape; |
|
3795 kEvent.iScanCode = EStdKeyEscape; |
|
3796 iConfirmationDlg->OfferKeyEventL( kEvent, EEventKey ); |
|
3797 } |
|
3798 |
|
3799 } |
|
3800 else if ( event == TMPXCollectionMessage::EFocusChanged && iContainer && iCoverDisplay ) |
|
3801 { |
|
3802 if ( data != KErrNotFound && |
|
3803 data < iContainer->CurrentListItemCount() && |
|
3804 !iIgnoreNextFocusChangedMessage ) |
|
3805 { |
|
3806 MPX_DEBUG2( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL - EFocusChanged to %d", data ); |
|
3807 iContainer->SetLbxCurrentItemIndexAndDraw( data ); |
|
3808 } |
|
3809 iIgnoreNextFocusChangedMessage = EFalse; |
|
3810 } |
|
3811 } // if iContainer |
|
3812 |
|
3813 // System events need to be checked regardless of iContainer |
|
3814 // |
|
3815 if( event == TMPXCollectionMessage::EBroadcastEvent ) |
|
3816 { |
|
3817 if((type == EMcMsgUSBMassStorageStart ) || (type == EMcMsgUSBMTPEnd) || (type == EMcMsgRefreshEnd)) |
|
3818 { |
|
3819 iCollectionCacheReady = EFalse; |
|
3820 } |
|
3821 // USB flags |
|
3822 // |
|
3823 if( type == EMcMsgUSBMassStorageStart || type == EMcMsgUSBMTPStart ) |
|
3824 { |
|
3825 iUSBOnGoing = ETrue; |
|
3826 } |
|
3827 else if( type == EMcMsgUSBMassStorageEnd || type == EMcMsgUSBMTPEnd ) |
|
3828 { |
|
3829 iUSBOnGoing = EFalse; |
|
3830 RProperty::Set( KMPXViewPSUid, |
|
3831 KMPXUSBUnblockingPSStatus, |
|
3832 EMPXUSBUnblockingPSStatusUninitialized ); |
|
3833 } |
|
3834 else if( type == EMcMsgUSBMTPNotActive ) |
|
3835 { |
|
3836 RProperty::Set( KMPXViewPSUid, |
|
3837 KMPXUSBUnblockingPSStatus, |
|
3838 EMPXUSBUnblockingPSStatusActive ); |
|
3839 } |
|
3840 |
|
3841 if ( iIsEmbedded && type == EMcMsgUSBMassStorageEnd ) |
|
3842 { |
|
3843 DoIncrementalOpenL(); |
|
3844 } |
|
3845 } // if event == EBroadcastEvent |
|
3846 } // if ( KMPXMessageGeneral == id ) |
|
3847 } |
|
3848 |
|
3849 // --------------------------------------------------------------------------- |
|
3850 // CMPXCollectionViewHgImp::DoIncrementalOpenL |
|
3851 // Start the incremental fetching algorithm |
|
3852 // --------------------------------------------------------------------------- |
|
3853 // |
|
3854 void CMPXCollectionViewHgImp::DoIncrementalOpenL( TBool aShowWaitDlg ) |
|
3855 { |
|
3856 MPX_FUNC( "CMPXCollectionViewHgImp::DoIncrementalOpenL" ); |
|
3857 // Show the opening note if > 1.5 seconds |
|
3858 if( aShowWaitDlg ) |
|
3859 { |
|
3860 //StartWaitNoteL( EMPXOpeningNote ); |
|
3861 } |
|
3862 |
|
3863 // Cancel any reads |
|
3864 iIncrementalOpenUtil->Stop(); |
|
3865 |
|
3866 // Start the read |
|
3867 RArray<TMPXAttribute> attrs; |
|
3868 CleanupClosePushL( attrs ); |
|
3869 TArray<TMPXAttribute> ary = attrs.Array(); |
|
3870 iIncrementalOpenUtil->SetDelay( KIncrementalDelayNone ); |
|
3871 iIncrementalOpenUtil->StartL( ary, KIncrementalFetchBlockSize, |
|
3872 KErrNotFound, CMPXCollectionOpenUtility::EFetchNormal ); |
|
3873 iIncrementalOpenUtil->SetDelay( KIncrementalDelayHalfSecond ); |
|
3874 CleanupStack::PopAndDestroy( &attrs ); |
|
3875 |
|
3876 // Default empty text |
|
3877 iContainer->SetLbxEmptyTextL( KNullDesC ); |
|
3878 iContainer->DrawDeferred(); |
|
3879 iFirstIncrementalBatch = ETrue; |
|
3880 } |
|
3881 |
|
3882 // ----------------------------------------------------------------------------- |
|
3883 // Start wait note for delayed action due to the items not ready |
|
3884 // ----------------------------------------------------------------------------- |
|
3885 // |
|
3886 void CMPXCollectionViewHgImp::StartDelayedActionL( |
|
3887 TInt aCommand, TDesC& aNote,TBool aSkipDisplay ) |
|
3888 { |
|
3889 MPX_FUNC( "CMPXCollectionViewHgImp::StartDelayedActionL" ); |
|
3890 HandleCommandL( EMPXCmdIgnoreExternalCommand ); |
|
3891 if(!aSkipDisplay) |
|
3892 { |
|
3893 iCommonUiHelper->ShowWaitNoteL( aNote, R_AVKON_SOFTKEYS_EMPTY, ETrue, this ); |
|
3894 } |
|
3895 |
|
3896 iCachedCommand = aCommand; |
|
3897 const CArrayFix<TInt>* array ( |
|
3898 iContainer->CurrentSelectionIndicesL() ); // not owned |
|
3899 TInt arrayCount( array->Count() ); |
|
3900 iCachedSelectionIndex->Reset(); |
|
3901 for ( TInt i = 0; i < arrayCount; i++ ) |
|
3902 { |
|
3903 iCachedSelectionIndex->AppendL( array->At( i ) ); |
|
3904 } |
|
3905 } |
|
3906 |
|
3907 // --------------------------------------------------------------------------- |
|
3908 // From MProgressDialogCallback |
|
3909 // Callback method. Get's called when a dialog is dismissed |
|
3910 // --------------------------------------------------------------------------- |
|
3911 // |
|
3912 void CMPXCollectionViewHgImp::DialogDismissedL( TInt aButtonId ) |
|
3913 { |
|
3914 MPX_FUNC( "CMPXCollectionViewHgImp::DialogDismissedL" ); |
|
3915 if ( iCommandInitiator ) |
|
3916 { |
|
3917 iCommandInitiator->CancelCommand( KMediatorSecondaryDisplayDomain, |
|
3918 KMPlayerNoteCategory, |
|
3919 iWaitNoteId ); |
|
3920 } |
|
3921 |
|
3922 switch ( aButtonId ) |
|
3923 { |
|
3924 case EAknSoftkeyCancel: |
|
3925 { |
|
3926 iIsWaitNoteCanceled = ETrue; |
|
3927 if( iIsDeleting ) |
|
3928 { |
|
3929 iCollectionUiHelper->Cancel(); |
|
3930 iIsDeleting = EFalse; |
|
3931 // if delete is interrupted, reopen |
|
3932 } |
|
3933 else if ( iSetMediaLCount > 0 ) |
|
3934 { |
|
3935 // cancel the async request |
|
3936 iCollectionUtility->Collection().CancelRequest(); |
|
3937 iSetMediaLCount = KErrNotFound; |
|
3938 |
|
3939 DoIncrementalOpenL(); |
|
3940 } |
|
3941 else if ( iIsAddingToPlaylist ) |
|
3942 { |
|
3943 // cancel incremental adding of songs |
|
3944 iCommonUiHelper->CancelCollectionOperation(); |
|
3945 iIsAddingToPlaylist = EFalse; |
|
3946 } |
|
3947 break; |
|
3948 } |
|
3949 default: |
|
3950 { |
|
3951 // no special handling for other cases |
|
3952 break; |
|
3953 } |
|
3954 } |
|
3955 } |
|
3956 |
|
3957 // --------------------------------------------------------------------------- |
|
3958 // From MMPXCollectionObserver |
|
3959 // Handle collection message |
|
3960 // --------------------------------------------------------------------------- |
|
3961 // |
|
3962 void CMPXCollectionViewHgImp::HandleCollectionMessage( |
|
3963 CMPXMessage* aMessage, TInt aError ) |
|
3964 { |
|
3965 if ( aError == KErrNone && aMessage ) |
|
3966 { |
|
3967 TRAP_IGNORE( DoHandleCollectionMessageL( *aMessage ) ); |
|
3968 } |
|
3969 } |
|
3970 |
|
3971 // --------------------------------------------------------------------------- |
|
3972 // From MMPXCollectionObserver |
|
3973 // Handles the collection entries being opened. Typically called |
|
3974 // when client has Open()'d a folder |
|
3975 // --------------------------------------------------------------------------- |
|
3976 // |
|
3977 void CMPXCollectionViewHgImp::HandleOpenL( |
|
3978 const CMPXMedia& aEntries, |
|
3979 TInt aIndex, |
|
3980 TBool aComplete, |
|
3981 TInt aError ) |
|
3982 { |
|
3983 MPX_FUNC( "CMPXCollectionViewHgImp::HandleOpenL 4" ); |
|
3984 iHandlingKeyEvent = EFalse; |
|
3985 if( aError == KErrNone ) |
|
3986 { |
|
3987 if ( !iContainer ) |
|
3988 { |
|
3989 // View is not active. Ignore. |
|
3990 return; |
|
3991 } |
|
3992 // handle deferred notification when view is in focus but not for view transitions |
|
3993 if ( iActivateBackStepping ) |
|
3994 { |
|
3995 HandleBacksteppingActivation(); |
|
3996 } |
|
3997 |
|
3998 iCollectionReady = aComplete; |
|
3999 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
4000 if( iPodcast && !iDisablePodcasting ) |
|
4001 { |
|
4002 iPodcast = EFalse; |
|
4003 UpdateListBoxL( aEntries, KMusicMenuPodcastMenuItemIndex, aComplete ); |
|
4004 ( void ) aIndex; |
|
4005 } |
|
4006 else |
|
4007 { |
|
4008 UpdateListBoxL( aEntries, aIndex, aComplete ); |
|
4009 } |
|
4010 #else |
|
4011 UpdateListBoxL( aEntries, aIndex, aComplete ); |
|
4012 #endif // __ENABLE_PODCAST_IN_MUSIC_MENU |
|
4013 if ( iContainer ) |
|
4014 { |
|
4015 iContainer->ContentIsReady( ETrue ); |
|
4016 // this has to be done after the list box media is properly |
|
4017 // updated |
|
4018 if ( !iContainer->FindBoxVisibility() ) |
|
4019 { |
|
4020 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleOpenL find box not visible" ); |
|
4021 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
4022 CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() ); |
|
4023 CleanupStack::PushL( cpath ); |
|
4024 |
|
4025 CMPXCommonListBoxArrayBase* listboxArray( |
|
4026 iContainer->ListBoxArray() ); |
|
4027 const CMPXMedia& media( listboxArray->ContainerMedia() ); |
|
4028 |
|
4029 TMPXGeneralType containerType( EMPXNoType ); |
|
4030 if ( media.IsSupported( KMPXMediaGeneralType ) ) |
|
4031 { |
|
4032 containerType = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ); |
|
4033 } |
|
4034 |
|
4035 TMPXGeneralCategory containerCategory( EMPXNoCategory ); |
|
4036 if ( media.IsSupported( KMPXMediaGeneralCategory ) ) |
|
4037 { |
|
4038 containerCategory = media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ); |
|
4039 } |
|
4040 TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation(); |
|
4041 CEikButtonGroupContainer* cba = Cba(); |
|
4042 if ( cba && containerType == EMPXGroup && containerCategory == EMPXAlbum && landscapeOrientation ) |
|
4043 { |
|
4044 cba->SetCommandSetL( R_MPX_COLLECTION_TRANSPARENT_CBA ); |
|
4045 cba->MakeVisible( EFalse ); |
|
4046 cba->DrawDeferred(); |
|
4047 } |
|
4048 else if ( cba ) |
|
4049 { |
|
4050 cba->SetCommandSetL( |
|
4051 ( cpath->Levels() == 3 && !iIsEmbedded ) ? |
|
4052 R_MPX_OPTIONS_HIDE_CBA : R_AVKON_SOFTKEYS_OPTIONS_BACK ); |
|
4053 cba->MakeVisible( ETrue ); |
|
4054 cba->DrawDeferred(); |
|
4055 } |
|
4056 |
|
4057 CleanupStack::PopAndDestroy(cpath); |
|
4058 #else |
|
4059 CEikButtonGroupContainer* cba = Cba(); |
|
4060 if ( cba ) |
|
4061 { |
|
4062 cba->SetCommandSetL( |
|
4063 ( iViewUtility->ViewHistoryDepth() == 1 && !iIsEmbedded ) ? |
|
4064 R_AVKON_SOFTKEYS_OPTIONS_EXIT : R_AVKON_SOFTKEYS_OPTIONS_BACK ); |
|
4065 cba->DrawDeferred(); |
|
4066 } |
|
4067 #endif |
|
4068 } |
|
4069 else |
|
4070 { |
|
4071 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleOpenL find box visible" ); |
|
4072 } |
|
4073 |
|
4074 CMPXCommonListBoxArrayBase* array( |
|
4075 iContainer->ListBoxArray() ); |
|
4076 const CMPXMedia& containerMedia = array->ContainerMedia(); |
|
4077 if ( containerMedia.IsSupported( KMPXMediaGeneralTitle ) ) |
|
4078 { |
|
4079 delete iTitle; |
|
4080 iTitle = NULL; |
|
4081 iTitle = containerMedia.ValueText( KMPXMediaGeneralTitle ).AllocL(); |
|
4082 } |
|
4083 if ( !iContainer->IsInReorderMode() && |
|
4084 !iAddingSong && |
|
4085 !iInAlbumArtDialog && |
|
4086 !iInSongDetails ) |
|
4087 { |
|
4088 UpdateTitlePaneL(); |
|
4089 } |
|
4090 |
|
4091 TMPXGeneralType containerType( EMPXNoType ); |
|
4092 if( containerMedia.IsSupported( KMPXMediaGeneralType ) ) |
|
4093 { |
|
4094 containerType = containerMedia.ValueTObjectL<TMPXGeneralType>( |
|
4095 KMPXMediaGeneralType ); |
|
4096 } |
|
4097 |
|
4098 TMPXGeneralCategory containerCategory( EMPXNoCategory ); |
|
4099 if( containerMedia.IsSupported( KMPXMediaGeneralCategory ) ) |
|
4100 { |
|
4101 containerCategory = containerMedia.ValueTObjectL<TMPXGeneralCategory>( |
|
4102 KMPXMediaGeneralCategory ); |
|
4103 } |
|
4104 MPX_DEBUG3( "CMPXCollectionViewHgImp::HandleOpenL container type = %d, category = %d", containerType, containerCategory ); |
|
4105 |
|
4106 CEikMenuBar* menuBar( MenuBar() ); |
|
4107 TInt resId( KErrNotFound ); |
|
4108 #ifdef __ENABLE_MSK |
|
4109 TInt mskId( R_QTN_MSK_OPEN ); |
|
4110 #endif // __ENABLE_MSK |
|
4111 if ( iIsEmbedded ) |
|
4112 { |
|
4113 // embedded playlist view |
|
4114 iContainer->EnableMarking( ETrue ); |
|
4115 menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR_EMBEDDED_PLAYLIST_VIEW ); |
|
4116 resId = R_MPX_COLLECTION_SONG_LBX_EMPTYTEXT; |
|
4117 #ifdef __ENABLE_MSK |
|
4118 mskId = R_QTN_MSK_PLAY; |
|
4119 #endif // __ENABLE_MSK |
|
4120 } |
|
4121 else |
|
4122 { |
|
4123 if ( containerType == EMPXGroup && containerCategory == EMPXCollection ) |
|
4124 { |
|
4125 // music menu view |
|
4126 iContainer->EnableMarking( EFalse ); |
|
4127 menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR_MUSIC_MENU ); |
|
4128 } |
|
4129 else if ( ( containerType == EMPXGroup && containerCategory == EMPXPlaylist ) || // playlist view |
|
4130 ( containerType == EMPXGroup && containerCategory == EMPXArtist ) || // artist view |
|
4131 ( containerType == EMPXItem && containerCategory == EMPXArtist ) || // artist/album view |
|
4132 ( containerType == EMPXGroup && containerCategory == EMPXAlbum ) || // album view |
|
4133 ( containerType == EMPXGroup && containerCategory == EMPXGenre ) || // genre view |
|
4134 ( containerType == EMPXGroup && containerCategory == EMPXComposer ) ) // composer view |
|
4135 { |
|
4136 iContainer->EnableMarking( EFalse ); |
|
4137 menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR_NO_MARKING ); |
|
4138 switch ( containerCategory ) |
|
4139 { |
|
4140 case EMPXArtist: |
|
4141 { |
|
4142 if ( containerType == EMPXGroup ) |
|
4143 { |
|
4144 // artist view |
|
4145 resId = R_MPX_COLLECTION_ARTIST_LBX_EMPTYTEXT; |
|
4146 } |
|
4147 else if ( containerType == EMPXItem ) |
|
4148 { |
|
4149 // artist/album view |
|
4150 resId = R_MPX_COLLECTION_ALBUM_LBX_EMPTYTEXT; |
|
4151 } |
|
4152 else |
|
4153 { |
|
4154 // should not reach here |
|
4155 ASSERT( 0 ); |
|
4156 } |
|
4157 break; |
|
4158 } |
|
4159 case EMPXAlbum: |
|
4160 { |
|
4161 // album view |
|
4162 resId = R_MPX_COLLECTION_ALBUM_LBX_EMPTYTEXT; |
|
4163 break; |
|
4164 } |
|
4165 case EMPXGenre: |
|
4166 { |
|
4167 // genre view |
|
4168 resId = R_MPX_COLLECTION_GENRE_LBX_EMPTYTEXT; |
|
4169 break; |
|
4170 } |
|
4171 case EMPXComposer: |
|
4172 { |
|
4173 // composer view |
|
4174 resId = R_MPX_COLLECTION_COMPOSER_LBX_EMPTYTEXT; |
|
4175 break; |
|
4176 } |
|
4177 case EMPXPlaylist: |
|
4178 { |
|
4179 // no special handling for playlist |
|
4180 break; |
|
4181 } |
|
4182 default: |
|
4183 { |
|
4184 // should not reach here |
|
4185 ASSERT( 0 ); |
|
4186 break; |
|
4187 } |
|
4188 } |
|
4189 } |
|
4190 else |
|
4191 { |
|
4192 // tracks view |
|
4193 #ifdef SINGLE_CLICK_INCLUDED |
|
4194 iContainer->EnableMarking( EFalse ); |
|
4195 menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR_NO_MARKING ); |
|
4196 #else |
|
4197 iContainer->EnableMarking( ETrue ); |
|
4198 menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR ); |
|
4199 #endif |
|
4200 resId = R_MPX_COLLECTION_SONG_LBX_EMPTYTEXT; |
|
4201 #ifdef __ENABLE_MSK |
|
4202 mskId = R_QTN_MSK_PLAY; |
|
4203 #endif // __ENABLE_MSK |
|
4204 } |
|
4205 } |
|
4206 |
|
4207 if ( resId != KErrNotFound ) |
|
4208 { |
|
4209 HBufC* emptyText = StringLoader::LoadLC( resId ); |
|
4210 iContainer->SetLbxEmptyTextL( *emptyText ); |
|
4211 CleanupStack::PopAndDestroy( emptyText ); |
|
4212 iContainer->DrawDeferred(); |
|
4213 } |
|
4214 |
|
4215 #ifdef __ENABLE_MSK |
|
4216 // set middle softkey label display |
|
4217 UpdateMiddleSoftKeyDisplayL( mskId ); |
|
4218 #endif // __ENABLE_MSK |
|
4219 |
|
4220 switch ( iCurrentPlaylistOp ) |
|
4221 { |
|
4222 case EMPXOpPLCreating: |
|
4223 { |
|
4224 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleOpenL searching for playlist" ); |
|
4225 // after creating a new playlist |
|
4226 // playlist created callback will always come before this |
|
4227 // iPlaylistId should have already been set, check to see if |
|
4228 // we're in playlist view |
|
4229 if ( iPlaylistId != 0 && |
|
4230 containerType == EMPXGroup && containerCategory == EMPXPlaylist ) |
|
4231 { |
|
4232 const CMPXMediaArray& mediaArray = array->MediaArray(); |
|
4233 TInt arrayCount( mediaArray.Count() ); |
|
4234 for ( TInt i = 0; i < arrayCount; i++ ) |
|
4235 { |
|
4236 CMPXMedia* origMedia( mediaArray.AtL( i ) ); |
|
4237 TMPXItemId plId = origMedia->ValueTObjectL<TMPXItemId>( |
|
4238 KMPXMediaGeneralId ); |
|
4239 if ( plId == iPlaylistId ) |
|
4240 { |
|
4241 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleOpenL Playlist match found 0x%x", iPlaylistId.iId1 ); |
|
4242 iCurrentPlaylistOp = EMPXOpPlOpening; |
|
4243 iContainer->SetLbxCurrentItemIndex( i ); |
|
4244 HandleListBoxEventL( NULL, // not used |
|
4245 EEventEnterKeyPressed ); |
|
4246 break; |
|
4247 } |
|
4248 |
|
4249 // Stay in Creating state as every OpenL() |
|
4250 // will be called back with a HandleOpenL() |
|
4251 // During playlist creation, there is a race condition |
|
4252 // between HandleCollectionMessage() -> Collection change -> OpenL() |
|
4253 // and playlist added's OpenL() |
|
4254 } |
|
4255 } |
|
4256 break; |
|
4257 } |
|
4258 case EMPXOpPlOpening: |
|
4259 { |
|
4260 // check how many songs are stored in collection |
|
4261 iCurrentMediaLOp = EMPXOpMediaLNewPlaylistCollectionSongCount; |
|
4262 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
4263 CleanupStack::PushL( path ); |
|
4264 path->Back(); |
|
4265 RArray<TMPXAttribute> attrs; |
|
4266 CleanupClosePushL( attrs ); |
|
4267 attrs.Append( KMPXMediaColDetailNumberOfItems ); |
|
4268 iCollectionUtility->Collection().MediaL( *path, attrs.Array() ); |
|
4269 CleanupStack::PopAndDestroy( &attrs ); |
|
4270 CleanupStack::PopAndDestroy( path ); |
|
4271 iCurrentPlaylistOp = EMPXOpPLIdle; |
|
4272 break; |
|
4273 } |
|
4274 case EMPXOpPLIdle: // fall through |
|
4275 default: |
|
4276 { |
|
4277 // Update Duration |
|
4278 // |
|
4279 if ( !iContainer->IsInReorderMode() && !iAddingSong ) |
|
4280 { |
|
4281 GetDurationL(); |
|
4282 } |
|
4283 break; |
|
4284 } |
|
4285 } |
|
4286 iPlaylistId = 0; |
|
4287 } |
|
4288 } |
|
4289 else |
|
4290 { |
|
4291 if ( iContainer ) |
|
4292 { |
|
4293 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
4294 CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() ); |
|
4295 CleanupStack::PushL( cpath ); |
|
4296 |
|
4297 // media is not valid until the first HandleOpenL call |
|
4298 CEikButtonGroupContainer* cba = Cba(); |
|
4299 if ( cba ) |
|
4300 { |
|
4301 cba->SetCommandSetL( |
|
4302 ( cpath->Levels() == 2 && !iIsEmbedded ) ? |
|
4303 R_AVKON_SOFTKEYS_OPTIONS_BACK : R_AVKON_SOFTKEYS_OPTIONS_BACK ); |
|
4304 cba->DrawDeferred(); |
|
4305 } |
|
4306 |
|
4307 CleanupStack::PopAndDestroy(cpath); |
|
4308 #else |
|
4309 CEikButtonGroupContainer* cba = Cba(); |
|
4310 if ( cba ) |
|
4311 { |
|
4312 cba->SetCommandSetL( |
|
4313 ( iViewUtility->ViewHistoryDepth() == 1 && !iIsEmbedded ) ? |
|
4314 R_AVKON_SOFTKEYS_OPTIONS_EXIT : R_AVKON_SOFTKEYS_OPTIONS_BACK ); |
|
4315 cba->DrawDeferred(); |
|
4316 } |
|
4317 |
|
4318 #endif |
|
4319 } |
|
4320 if (aError == KErrNotFound) |
|
4321 { |
|
4322 HandleCommandL(EAknSoftkeyBack); |
|
4323 } |
|
4324 else |
|
4325 { |
|
4326 HandleError( aError ); |
|
4327 } |
|
4328 } |
|
4329 if ( iIsDeleting ) |
|
4330 { |
|
4331 // nothing else to delete |
|
4332 iIsDeleting = EFalse; |
|
4333 if ( iProgressDialog ) |
|
4334 { |
|
4335 iProgressDialog->ProcessFinishedL(); |
|
4336 } |
|
4337 HandleCommandL( EMPXCmdHandleExternalCommand ); |
|
4338 } |
|
4339 if ( iPlayIndex > KErrNotFound ) |
|
4340 { |
|
4341 CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() ); |
|
4342 CleanupStack::PushL( cpath ); |
|
4343 cpath->Set( iPlayIndex ); |
|
4344 iPlayIndex = KErrNotFound; |
|
4345 iCollectionUtility->Collection().OpenL( *cpath, EMPXOpenPlaylistOnly ); |
|
4346 iFirstIncrementalBatch = ETrue; |
|
4347 CleanupStack::PopAndDestroy( cpath ); |
|
4348 } |
|
4349 if ( ( iCachedCommand != KErrNotFound ) && iCollectionReady ) |
|
4350 { |
|
4351 if((iCachedCommand != EMPXCmdRemove) && (iCachedCommand != EMPXCmdCommonDelete) && (iCachedCommand != EMPXCmdDelete) ) |
|
4352 { |
|
4353 iCommonUiHelper->DismissWaitNoteL(); |
|
4354 HandleCommandL( EMPXCmdHandleExternalCommand ); |
|
4355 } |
|
4356 else |
|
4357 { |
|
4358 iCachedCommand = EMPXCmdRemove; |
|
4359 } |
|
4360 if( iContainer ) |
|
4361 { |
|
4362 iContainer->SetCurrentSelectionIndicesL( iCachedSelectionIndex ); |
|
4363 } |
|
4364 HandleCommandL( iCachedCommand ); |
|
4365 iCachedSelectionIndex->Reset(); |
|
4366 iCachedCommand = KErrNotFound; |
|
4367 } |
|
4368 |
|
4369 // Close the opening wait note, if the current item is valid or all open completes |
|
4370 if ( iContainer && !aComplete ) |
|
4371 { |
|
4372 // if the list is empty, it shouldn't go in this path as aComplete should be ETrue |
|
4373 CMPXCommonListBoxArrayBase* listboxArray( |
|
4374 iContainer->ListBoxArray() ); |
|
4375 const CMPXMedia& currentMedia( listboxArray->MediaL( aIndex ) ); |
|
4376 } |
|
4377 else |
|
4378 { |
|
4379 if ( EMPXOpeningNote == iNoteType || EMPXImmediatelyOpeningNote == iNoteType ) |
|
4380 { |
|
4381 CloseWaitNoteL(); |
|
4382 } |
|
4383 } |
|
4384 |
|
4385 MPX_PERF_CHECKPT("Collection View opened"); |
|
4386 } |
|
4387 |
|
4388 // --------------------------------------------------------------------------- |
|
4389 // From MMPXCollectionObserver |
|
4390 // Handles the collection entries being opened. |
|
4391 // --------------------------------------------------------------------------- |
|
4392 // |
|
4393 void CMPXCollectionViewHgImp::HandleOpenL( |
|
4394 const CMPXCollectionPlaylist& /*aPlaylist*/, |
|
4395 TInt /*aError*/ ) |
|
4396 { |
|
4397 MPX_FUNC( "CMPXCollectionViewHgImp::HandleOpenL 2" ); |
|
4398 iHandlingKeyEvent = EFalse; |
|
4399 // Do Nothing: playback/fetch client should handle this stage |
|
4400 } |
|
4401 |
|
4402 // --------------------------------------------------------------------------- |
|
4403 // From MMPXCollectionObserver |
|
4404 // Handle media properties |
|
4405 // --------------------------------------------------------------------------- |
|
4406 // |
|
4407 void CMPXCollectionViewHgImp::HandleCollectionMediaL( |
|
4408 const CMPXMedia& aMedia, |
|
4409 TInt aError) |
|
4410 { |
|
4411 MPX_FUNC( "CMPXCollectionViewHgImp::HandleCollectionMediaL" ); |
|
4412 |
|
4413 TInt nextMediaLOp( EMPXOpMediaLIdle ); |
|
4414 if ( aError == KErrNone ) |
|
4415 { |
|
4416 switch ( iCurrentMediaLOp ) |
|
4417 { |
|
4418 case EMPXOpMediaLGetContainerInfo: |
|
4419 { |
|
4420 delete iDuration; |
|
4421 iDuration = NULL; |
|
4422 if ( aMedia.IsSupported( KMPXMediaGeneralDuration ) ) |
|
4423 { |
|
4424 TInt duration( |
|
4425 aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralDuration ) ); |
|
4426 if ( duration > 0 ) |
|
4427 { |
|
4428 // only display duration when the list contains something |
|
4429 iDuration = iCommonUiHelper->DisplayableDurationInTextL( duration/KMilliSecondsToSeconds ); |
|
4430 } |
|
4431 } |
|
4432 UpdateNaviPaneL(); |
|
4433 break; |
|
4434 } |
|
4435 case EMPXOpMediaLSend: |
|
4436 { |
|
4437 DoHandleSendL( aMedia ); |
|
4438 if ( !iContainer->FindBoxVisibility() ) |
|
4439 { |
|
4440 iContainer->RestoreFindBoxPopupCBA(); |
|
4441 } |
|
4442 break; |
|
4443 } |
|
4444 case EMPXOpMediaLSongDetailsFileCheck: |
|
4445 { |
|
4446 if ( iContainer ) |
|
4447 { |
|
4448 DoHandleFileCheckResultL( |
|
4449 TUid::Uid( KMPXPluginTypeMetadataEditorUid ), aMedia ); |
|
4450 if ( !iContainer->FindBoxVisibility() ) |
|
4451 { |
|
4452 iContainer->RestoreFindBoxPopupCBA(); |
|
4453 } |
|
4454 } |
|
4455 break; |
|
4456 } |
|
4457 case EMPXOpMediaLAlbumArtFileCheck: |
|
4458 { |
|
4459 if ( iContainer ) |
|
4460 { |
|
4461 DoHandleFileCheckResultL( |
|
4462 TUid::Uid( KMPXPluginTypeAlbumArtEditorUid ), aMedia ); |
|
4463 |
|
4464 if ( !iContainer->FindBoxVisibility() ) |
|
4465 { |
|
4466 iContainer->RestoreFindBoxPopupCBA(); |
|
4467 } |
|
4468 } |
|
4469 break; |
|
4470 } |
|
4471 case EMPXOpMediaLCollectionDetails: |
|
4472 { |
|
4473 DoShowCollectionDetailsL( aMedia ); |
|
4474 break; |
|
4475 } |
|
4476 case EMPXOpMediaLPlaylistDetails: |
|
4477 { |
|
4478 DoShowPlaylistDetailsL( aMedia ); |
|
4479 break; |
|
4480 } |
|
4481 case EMPXOpMediaLRenamePlaylist: |
|
4482 { |
|
4483 DoHandleRenamePlaylistL( aMedia ); |
|
4484 break; |
|
4485 } |
|
4486 case EMPXOpMediaLNewPlaylistCollectionSongCount: |
|
4487 { |
|
4488 TInt songsCount( 0 ); |
|
4489 if ( aMedia.IsSupported( KMPXMediaColDetailNumberOfItems ) ) |
|
4490 { |
|
4491 songsCount = |
|
4492 aMedia.ValueTObjectL<TInt>( KMPXMediaColDetailNumberOfItems ); |
|
4493 } |
|
4494 if ( songsCount > 0 ) |
|
4495 { |
|
4496 // show add songs prompt only if collection contains |
|
4497 // at least one song |
|
4498 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleCollectionMediaL openning add songs view, collection contains %d songs", songsCount ); |
|
4499 CAknQueryDialog* confirmationDlg = CAknQueryDialog::NewL( |
|
4500 CAknQueryDialog::EConfirmationTone ); |
|
4501 CleanupStack::PushL( confirmationDlg ); |
|
4502 HBufC* promptTxt = StringLoader::LoadLC( |
|
4503 R_MPX_QTN_NMP_QUERY_ADD_SONGS ); |
|
4504 confirmationDlg->SetPromptL( *promptTxt ); |
|
4505 CleanupStack::PopAndDestroy( promptTxt ); |
|
4506 confirmationDlg->PublishDialogL( |
|
4507 EMPlayerQueryAddSongsToPlaylist, |
|
4508 KMPlayerNoteCategory); |
|
4509 CleanupStack::Pop( confirmationDlg ); |
|
4510 AppUi()->StopDisplayingMenuBar(); |
|
4511 if ( confirmationDlg->ExecuteLD( R_MPX_CUI_ADD_SONGS_CONFIRMATION_QUERY ) ) |
|
4512 { |
|
4513 HandleCommandL( EMPXCmdAddSongs ); |
|
4514 iCurrentMediaLOp = EMPXOpMediaLNewPlaylistCollectionSongCount; |
|
4515 } |
|
4516 } |
|
4517 #ifdef _DEBUG |
|
4518 else |
|
4519 { |
|
4520 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleCollectionMediaL collection empty, not opening add songs view" ); |
|
4521 } |
|
4522 #endif // _DEBUG |
|
4523 break; |
|
4524 } |
|
4525 case EMPXOpMediaLCopyToRemote: |
|
4526 { |
|
4527 if ( iUpnpFrameworkSupport ) |
|
4528 { |
|
4529 DoHandleCopyToRemoteL( aMedia ); |
|
4530 } |
|
4531 break; |
|
4532 } |
|
4533 |
|
4534 case EMPXOpMediaLFindInMusicShopSongDetails: |
|
4535 { |
|
4536 const TDesC& location = aMedia.ValueText( KMPXMediaGeneralUri ); |
|
4537 if ( location != KNullDesC && ConeUtils::FileExists( location ) ) |
|
4538 { |
|
4539 HBufC* buf = HBufC::NewLC( 5 ); // magic number to hold index value |
|
4540 buf->Des().AppendNum( |
|
4541 iContainer->CurrentLbxItemIndex() ); |
|
4542 // set current list box index |
|
4543 SetParamL( buf ); |
|
4544 CleanupStack::PopAndDestroy( buf ); |
|
4545 |
|
4546 DoGetSongMediaPropertyL(); |
|
4547 // Set the next operation to handle MediaL completed. |
|
4548 nextMediaLOp = EMPXOpMediaLFindInMusicShopMediaLCompleted; |
|
4549 } |
|
4550 else |
|
4551 { |
|
4552 CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL(); |
|
4553 CleanupStack::PushL( cpath ); |
|
4554 TInt currentDepth( cpath->Levels() ); |
|
4555 CleanupStack::PopAndDestroy( cpath ); |
|
4556 CMPXCommonListBoxArrayBase* listboxArray = |
|
4557 iContainer->ListBoxArray(); |
|
4558 TInt currentIndex = |
|
4559 iContainer->CurrentLbxItemIndex(); |
|
4560 const CMPXMedia& currentMedia = listboxArray->MediaL( currentIndex ); |
|
4561 TMPXGeneralCategory category( |
|
4562 currentMedia.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) ); |
|
4563 const CMPXMediaArray& mediaAry( listboxArray->MediaArray() ); |
|
4564 CMPXMedia* origMedia( mediaAry.AtL( currentIndex ) ); |
|
4565 const TDesC& title( origMedia->ValueText( KMPXMediaGeneralTitle ) ); |
|
4566 if ( ( title.Length() > 0 ) && ( title.Length() < KMaxFileName ) ) |
|
4567 { |
|
4568 switch ( category ) |
|
4569 { |
|
4570 case EMPXAlbum: |
|
4571 { |
|
4572 const CMPXMedia& containerMedia = listboxArray->ContainerMedia(); |
|
4573 // The Artist/Album View Title shows the Artist name |
|
4574 const TDesC& titleArtist = |
|
4575 containerMedia.ValueText( KMPXMediaGeneralTitle ); |
|
4576 HBufC* unknownArtistText = |
|
4577 StringLoader::LoadLC( R_MPX_QTN_NMP_UNKNOWN_ARTIST ); |
|
4578 // 4 is the level of Artist and Album View |
|
4579 if ( currentDepth == 4 && titleArtist != unknownArtistText->Des() ) |
|
4580 { |
|
4581 DoFindInMusicShopL(KCategoryEmpty, titleArtist, title); // Artist and Album View |
|
4582 } |
|
4583 else |
|
4584 { |
|
4585 DoFindInMusicShopL(KCategoryEmpty, KCategoryEmpty, title); // Album View |
|
4586 } |
|
4587 CleanupStack::PopAndDestroy( unknownArtistText ); |
|
4588 break; |
|
4589 } |
|
4590 case EMPXArtist: |
|
4591 { |
|
4592 DoFindInMusicShopL(KCategoryEmpty, title, KCategoryEmpty); // Artist only |
|
4593 break; |
|
4594 } |
|
4595 case EMPXSong: |
|
4596 { |
|
4597 DoFindInMusicShopL(title, KCategoryEmpty, KCategoryEmpty); // Song only |
|
4598 break; |
|
4599 } |
|
4600 default: |
|
4601 { |
|
4602 break; |
|
4603 } |
|
4604 } // switch |
|
4605 } // if |
|
4606 } // else |
|
4607 break; |
|
4608 } |
|
4609 case EMPXOpMediaLFindInMusicShopMediaLCompleted: |
|
4610 { |
|
4611 // call DoFindInMusicShop when SongName, AlbumName, and ArtistName are |
|
4612 // available at this point |
|
4613 DoFindInMusicShopL( |
|
4614 aMedia.ValueText( KMPXMediaGeneralTitle ), |
|
4615 aMedia.ValueText( KMPXMediaMusicArtist ), |
|
4616 aMedia.ValueText( KMPXMediaMusicAlbum ) ); |
|
4617 break; |
|
4618 } |
|
4619 |
|
4620 default: |
|
4621 { |
|
4622 break; |
|
4623 } |
|
4624 } |
|
4625 } |
|
4626 else |
|
4627 { |
|
4628 /* If a Composer,Artist or Album consists single song. |
|
4629 * On changing the song details(composer+genre or album name+genre) |
|
4630 * No more record exist corresponding to previous data. |
|
4631 * In this case no need to show Error Message. */ |
|
4632 if( aError != KErrNotFound) |
|
4633 { |
|
4634 HandleError( aError ); |
|
4635 } |
|
4636 else |
|
4637 { |
|
4638 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleCollectionMediaL ERROR: %d",aError); |
|
4639 } |
|
4640 } |
|
4641 if ( iCurrentMediaLOp == EMPXOpMediaLNewPlaylistCollectionSongCount ) |
|
4642 { |
|
4643 iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo; |
|
4644 } |
|
4645 else |
|
4646 { |
|
4647 iCurrentMediaLOp = nextMediaLOp; |
|
4648 } |
|
4649 } |
|
4650 |
|
4651 // --------------------------------------------------------------------------- |
|
4652 // From MMPXCollectionHelperObserver |
|
4653 // Callback function after executing a command |
|
4654 // --------------------------------------------------------------------------- |
|
4655 // |
|
4656 void CMPXCollectionViewHgImp::HandleCommandComplete(CMPXCommand* /*aCommandResult*/, |
|
4657 TInt /*aError*/) |
|
4658 { |
|
4659 // Make sure we are doing the right operation |
|
4660 if( iSetMediaLCount ) |
|
4661 { |
|
4662 iSetMediaLCount--; |
|
4663 if ( iSetMediaLCount < 1 ) |
|
4664 { |
|
4665 TRAP_IGNORE( HandleRenameOpCompleteL() ); |
|
4666 } |
|
4667 } |
|
4668 } |
|
4669 // --------------------------------------------------------------------------- |
|
4670 // From MMPXCollectionHelperObserver |
|
4671 // Callback function to signal that adding a file is complete |
|
4672 // --------------------------------------------------------------------------- |
|
4673 // |
|
4674 void CMPXCollectionViewHgImp::HandleAddFileCompleteL( TInt aErr ) |
|
4675 { |
|
4676 MPX_FUNC( "CMPXCollectionViewHgImp::HandleAddFileCompleteL" ); |
|
4677 if ( aErr != KErrNone ) |
|
4678 { |
|
4679 HandleError( aErr ); |
|
4680 } |
|
4681 } |
|
4682 |
|
4683 // --------------------------------------------------------------------------- |
|
4684 // From MMPXCHelperObserver |
|
4685 // Handles the completion of helper events |
|
4686 // --------------------------------------------------------------------------- |
|
4687 // |
|
4688 |
|
4689 void CMPXCollectionViewHgImp::HandleOperationCompleteL( TCHelperOperation aOperation, |
|
4690 TInt aErr, |
|
4691 void* aArgument ) |
|
4692 { |
|
4693 MPX_FUNC( "CMPXCollectionViewHgImp::HandleOperationCompleteL" ); |
|
4694 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleOperationCompleteL aErr = %d", aErr ); |
|
4695 switch( aOperation ) |
|
4696 { |
|
4697 case EDeleteOp: |
|
4698 { |
|
4699 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleOperationCompleteL Delete operation" ); |
|
4700 // do not dismiss the wait note until HandleOpenL is called, |
|
4701 // unless it's error case |
|
4702 delete iCurrentCba; |
|
4703 iCurrentCba = NULL; |
|
4704 if( aErr == KErrInUse ) |
|
4705 { |
|
4706 if ( !iIsWaitNoteCanceled ) |
|
4707 { |
|
4708 // only dismiss wait note if the wait note is not |
|
4709 // canceled |
|
4710 if ( iProgressDialog ) |
|
4711 { |
|
4712 iProgressDialog->ProcessFinishedL(); |
|
4713 } |
|
4714 HandleCommandL( EMPXCmdHandleExternalCommand ); |
|
4715 iIsWaitNoteCanceled = EFalse; |
|
4716 } |
|
4717 if ( iIsDeleting ) |
|
4718 { |
|
4719 HBufC* text = StringLoader::LoadLC( |
|
4720 ( iContainer->CurrentSelectionIndicesL()->Count() == 0 ) ? |
|
4721 R_MPX_COLLECTION_NOTE_DELETE_FAIL : // Single selection |
|
4722 R_MPX_COLLECTION_NOTE_DELETE_FAIL_MULTI_SELECTION ); // Multi selection |
|
4723 |
|
4724 CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue ); |
|
4725 dlg->ExecuteLD( *text ); |
|
4726 CleanupStack::PopAndDestroy( text ); |
|
4727 } |
|
4728 iIsDeleting = EFalse; |
|
4729 } |
|
4730 else if ( aErr != KErrNone ) |
|
4731 { |
|
4732 iIsDeleting = EFalse; |
|
4733 if ( !iIsWaitNoteCanceled ) |
|
4734 { |
|
4735 if ( iProgressDialog ) |
|
4736 { |
|
4737 iProgressDialog->ProcessFinishedL(); |
|
4738 } |
|
4739 HandleCommandL( EMPXCmdHandleExternalCommand ); |
|
4740 iIsWaitNoteCanceled = EFalse; |
|
4741 } |
|
4742 HandleError( aErr ); |
|
4743 } |
|
4744 if ( iContainer ) |
|
4745 { |
|
4746 iContainer->ClearLbxSelection(); |
|
4747 } |
|
4748 MPX_PERF_END_EX( MPX_PERF_SHOW_WAITNOTE ); |
|
4749 // reopen collection |
|
4750 DoIncrementalOpenL( !iIsDeleting ); |
|
4751 break; |
|
4752 } |
|
4753 case EExportPlaylistOp: |
|
4754 { |
|
4755 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleOperationCompleteL Export playlist operation" ); |
|
4756 if ( aErr == KErrNone ) |
|
4757 { |
|
4758 HBufC* uri = static_cast<HBufC*>( aArgument ); |
|
4759 CleanupStack::PushL(uri); |
|
4760 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleOperationCompleteL playlist exported as %S", uri ); |
|
4761 |
|
4762 CMessageData* messageData = CMessageData::NewLC(); |
|
4763 messageData->AppendAttachmentL( *uri ); |
|
4764 RFs& fileSession = iCoeEnv->FsSession(); |
|
4765 TEntry pl; |
|
4766 TInt err( fileSession.Entry( *uri, pl ) ); |
|
4767 if ( err == KErrNone ) |
|
4768 { |
|
4769 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleOperationCompleteL playlist size = %d", pl.iSize ); |
|
4770 if ( !iSendUi ) |
|
4771 { |
|
4772 iSendUi = CSendUi::NewL(); |
|
4773 } |
|
4774 TSendingCapabilities capabilities( |
|
4775 0, |
|
4776 pl.iSize, |
|
4777 TSendingCapabilities::ESupportsAttachments ); |
|
4778 |
|
4779 // sendui leaves with error code 0 when canceling sending |
|
4780 // via bluetooth, this should be trapped |
|
4781 MPX_TRAP( err, iSendUi->ShowQueryAndSendL( messageData, capabilities ) ); |
|
4782 if ( err != KErrNone ) |
|
4783 { |
|
4784 HandleError( err ); |
|
4785 } |
|
4786 // remove the file then remove the directory |
|
4787 err = fileSession.Delete( *uri ); |
|
4788 if ( err != KErrNone ) |
|
4789 { |
|
4790 HandleError( err ); |
|
4791 } |
|
4792 err = fileSession.RmDir( *uri ); |
|
4793 if ( err != KErrNone ) |
|
4794 { |
|
4795 HandleError( err ); |
|
4796 } |
|
4797 } |
|
4798 else |
|
4799 { |
|
4800 HandleError( err ); |
|
4801 } |
|
4802 CleanupStack::PopAndDestroy( 2, uri ); // messageData & uri |
|
4803 aArgument = NULL; |
|
4804 } |
|
4805 else |
|
4806 { |
|
4807 HandleError( aErr ); |
|
4808 } |
|
4809 break; |
|
4810 } |
|
4811 case EAddOp: |
|
4812 { |
|
4813 HandleAddCompletedL( (CMPXMedia*)aArgument, aErr ); |
|
4814 aArgument = NULL; // ownership transferred |
|
4815 iIsAddingToPlaylist = EFalse; // reset flag once incremental adding is finished |
|
4816 break; |
|
4817 } |
|
4818 case ESetOp: |
|
4819 { |
|
4820 if ( iAddingToNewPlaylist ) |
|
4821 { |
|
4822 // if user selects overwrite existing playlist, |
|
4823 // the OP will be set, and is handled here |
|
4824 HandleAddCompletedL( (CMPXMedia*)aArgument, aErr ); |
|
4825 } |
|
4826 else |
|
4827 { |
|
4828 HandleSetCompletedL( (CMPXMedia*)aArgument, aErr ); |
|
4829 } |
|
4830 aArgument = NULL; // ownership transferred |
|
4831 break; |
|
4832 } |
|
4833 case EReorderPlaylistOp: |
|
4834 { |
|
4835 HandleSetCompletedL( (CMPXMedia*)aArgument, aErr ); |
|
4836 aArgument = NULL; // ownership transferred |
|
4837 break; |
|
4838 } |
|
4839 case ERenameOp: |
|
4840 { |
|
4841 if ( aErr != KErrNone ) |
|
4842 { |
|
4843 iCommonUiHelper->HandleErrorL( aErr ); |
|
4844 } |
|
4845 break; |
|
4846 } |
|
4847 case EDeleteStatusOp: |
|
4848 { |
|
4849 if ( aArgument ) |
|
4850 { |
|
4851 CMPXMedia* media = (CMPXMedia*)aArgument; |
|
4852 CleanupStack::PushL( media ); |
|
4853 if ( media->IsSupported( KMPXMediaGeneralCount ) ) |
|
4854 { |
|
4855 TInt deletePercent = media->ValueTObjectL<TInt>( KMPXMediaGeneralCount ); |
|
4856 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleOperationCompleteL % Files Deleted: %d", deletePercent ); |
|
4857 // update WaitNote dialog. |
|
4858 HBufC* string = StringLoader::LoadLC(R_MPX_QTN_NMP_DEL_BATCH_SONGS_WAIT_NOTE, deletePercent); |
|
4859 TPtr buf = string->Des(); |
|
4860 UpdateProcessL(deletePercent, buf); |
|
4861 CleanupStack::PopAndDestroy( string ); |
|
4862 } |
|
4863 CleanupStack::PopAndDestroy( media ); |
|
4864 aArgument = NULL; |
|
4865 } |
|
4866 break; |
|
4867 } |
|
4868 default: |
|
4869 { |
|
4870 break; |
|
4871 } |
|
4872 } |
|
4873 |
|
4874 if( aArgument ) |
|
4875 { |
|
4876 delete ( CBase* )aArgument; |
|
4877 } |
|
4878 } |
|
4879 |
|
4880 // --------------------------------------------------------------------------- |
|
4881 // From MMPXPlaybackObserver |
|
4882 // Handle playback message. |
|
4883 // --------------------------------------------------------------------------- |
|
4884 // |
|
4885 void CMPXCollectionViewHgImp::HandlePlaybackMessage( |
|
4886 CMPXMessage* aMessage, TInt aError ) |
|
4887 { |
|
4888 MPX_FUNC( "CMPXCollectionViewHgImp::HandlePlaybackMessage" ); |
|
4889 if ( aError == KErrNone && aMessage ) |
|
4890 { |
|
4891 TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) ); |
|
4892 } |
|
4893 // Fix EBLI-7CFE4D press select key very quick cause System Error KErrArgument |
|
4894 else |
|
4895 { |
|
4896 // Fix for EJDI-77WCRF Low memory cause MP not resp. |
|
4897 iHandlingKeyEvent = EFalse; |
|
4898 } |
|
4899 } |
|
4900 |
|
4901 // --------------------------------------------------------------------------- |
|
4902 // From MMPXPlaybackCallback |
|
4903 // Handle playback property. |
|
4904 // --------------------------------------------------------------------------- |
|
4905 // |
|
4906 void CMPXCollectionViewHgImp::HandlePropertyL( |
|
4907 TMPXPlaybackProperty /*aProperty*/, |
|
4908 TInt /*aValue*/, |
|
4909 TInt /*aError*/ ) |
|
4910 { |
|
4911 // do nothing |
|
4912 } |
|
4913 |
|
4914 // --------------------------------------------------------------------------- |
|
4915 // From MMPXPlaybackCallback |
|
4916 // Method is called continously until aComplete=ETrue, signifying that |
|
4917 // it is done and there will be no more callbacks |
|
4918 // Only new items are passed each time |
|
4919 // --------------------------------------------------------------------------- |
|
4920 // |
|
4921 void CMPXCollectionViewHgImp::HandleSubPlayerNamesL( |
|
4922 TUid /* aPlayer */, |
|
4923 const MDesCArray* /* aSubPlayers */, |
|
4924 TBool /* aComplete */, |
|
4925 TInt /* aError */ ) |
|
4926 { |
|
4927 // do nothing |
|
4928 } |
|
4929 |
|
4930 // --------------------------------------------------------------------------- |
|
4931 // From MMPXPlaybackCallback |
|
4932 // Handle media event. |
|
4933 // --------------------------------------------------------------------------- |
|
4934 // |
|
4935 void CMPXCollectionViewHgImp::HandleMediaL( |
|
4936 const CMPXMedia& /*aMedia*/, |
|
4937 TInt /*aError*/ ) |
|
4938 { |
|
4939 // do nothing |
|
4940 } |
|
4941 |
|
4942 // --------------------------------------------------------------------------- |
|
4943 // From CAknView |
|
4944 // Returns views id. |
|
4945 // --------------------------------------------------------------------------- |
|
4946 // |
|
4947 TUid CMPXCollectionViewHgImp::Id() const |
|
4948 { |
|
4949 return TUid::Uid( KMPXCollectionViewHgId ); |
|
4950 } |
|
4951 |
|
4952 // --------------------------------------------------------------------------- |
|
4953 // From CAknView |
|
4954 // Command handling function. |
|
4955 // --------------------------------------------------------------------------- |
|
4956 // |
|
4957 void CMPXCollectionViewHgImp::HandleCommandL( TInt aCommand ) |
|
4958 { |
|
4959 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleCommandL(0x%x) entering", aCommand ); |
|
4960 |
|
4961 switch (aCommand) |
|
4962 { |
|
4963 case EAknCmdMark: |
|
4964 case EAknCmdUnmark: |
|
4965 case EAknMarkAll: |
|
4966 case EAknUnmarkAll: |
|
4967 { |
|
4968 // Custom handling of markable lists |
|
4969 iContainer->HandleMarkableListProcessCommandL( |
|
4970 aCommand ); |
|
4971 #ifdef __ENABLE_MSK |
|
4972 // Determine middle soft key labeling |
|
4973 UpdateMiddleSoftKeyDisplayL( iCurrentMskId ); |
|
4974 #endif // __ENABLE_MSK |
|
4975 if (aCommand == EAknMarkAll && !iCollectionReady) |
|
4976 { |
|
4977 iMarkedAll = ETrue; |
|
4978 } |
|
4979 if (aCommand == EAknUnmarkAll || aCommand == EAknCmdUnmark) |
|
4980 { |
|
4981 iMarkedAll = EFalse; |
|
4982 } |
|
4983 break; |
|
4984 } |
|
4985 case EMPXCmdGoToNowPlaying: |
|
4986 { |
|
4987 AppUi()->HandleCommandL( aCommand ); |
|
4988 break; |
|
4989 } |
|
4990 case EMPXCmdGoToAllSongs: |
|
4991 { |
|
4992 OpenAllSongsL(); |
|
4993 break; |
|
4994 } |
|
4995 case EMPXCmdGoToArtistAlbums: |
|
4996 { |
|
4997 OpenArtistAlbumsL(); |
|
4998 break; |
|
4999 } |
|
5000 case EMPXCmdGoToPlaylists: |
|
5001 { |
|
5002 OpenPlaylistsL(); |
|
5003 break; |
|
5004 } |
|
5005 case EMPXCmdGoToGenre: |
|
5006 { |
|
5007 OpenGenreL(); |
|
5008 break; |
|
5009 } |
|
5010 case EMPXCmdGoToPodcasts: |
|
5011 { |
|
5012 OpenPodcastsL(); |
|
5013 break; |
|
5014 } |
|
5015 #ifdef SINGLE_CLICK_INCLUDED |
|
5016 case EMPXCmdPlayItem: |
|
5017 { |
|
5018 iContainer->HandleItemCommandL(EMPXCmdPlay); |
|
5019 break; |
|
5020 } |
|
5021 #endif |
|
5022 case EMPXCmdCreatePlaylist: |
|
5023 { |
|
5024 iCurrentPlaylistOp = EMPXOpPLCreating; |
|
5025 CMPXMediaArray* mediaArray = CMPXMediaArray::NewL(); |
|
5026 CleanupStack::PushL( mediaArray ); |
|
5027 CMPXMedia* media = CMPXMedia::NewL(); |
|
5028 CleanupStack::PushL( media ); |
|
5029 media->SetCObjectValueL( KMPXMediaArrayContents, mediaArray ); |
|
5030 media->SetTObjectValueL( KMPXMediaArrayCount, 0 ); |
|
5031 TInt ret( iCommonUiHelper->CreatePlaylistL( *media, this, this ) ); |
|
5032 if ( !ret ) |
|
5033 { |
|
5034 // create playlist failed, |
|
5035 iCurrentPlaylistOp = EMPXOpPLIdle; |
|
5036 } |
|
5037 CleanupStack::PopAndDestroy( media ); |
|
5038 CleanupStack::PopAndDestroy( mediaArray ); |
|
5039 break; |
|
5040 } |
|
5041 case EMPXCmdAddToNewPlaylist: |
|
5042 case EMPXCmdAddToSavedPlaylist: |
|
5043 { |
|
5044 // flag used only in the case when songs are added incrementally |
|
5045 iIsAddingToPlaylist = ETrue; |
|
5046 iNumSongAddedToPlaylist = -1; |
|
5047 TMPXGeneralCategory category( EMPXNoCategory ); |
|
5048 CMPXCommonListBoxArrayBase* array( |
|
5049 iContainer->ListBoxArray() ); |
|
5050 const CMPXMedia& media = array->MediaL( |
|
5051 iContainer->CurrentLbxItemIndex() ); |
|
5052 category = media.ValueTObjectL<TMPXGeneralCategory>( |
|
5053 KMPXMediaGeneralCategory ); |
|
5054 if ( category == EMPXSong ) |
|
5055 { |
|
5056 CMPXMedia* tracks = CMPXMedia::NewL(); |
|
5057 CleanupStack::PushL( tracks ); |
|
5058 |
|
5059 MPX_TRAPD( err, PrepareMediaForSelectedItemsL( *tracks ) ); |
|
5060 if ( err == KErrNone ) |
|
5061 { |
|
5062 TBool ret = EFalse; |
|
5063 if ( aCommand == EMPXCmdAddToNewPlaylist ) |
|
5064 { |
|
5065 iAddingToNewPlaylist = ETrue; |
|
5066 MPX_TRAP( err,ret = iCommonUiHelper->CreatePlaylistL( |
|
5067 *tracks, this, this ) ); |
|
5068 if ( err != KErrNone ) |
|
5069 { |
|
5070 HandleError( err ); |
|
5071 } |
|
5072 if ( !ret ) |
|
5073 { |
|
5074 iAddingToNewPlaylist = EFalse; |
|
5075 } |
|
5076 } |
|
5077 else |
|
5078 { |
|
5079 MPX_TRAP( err, ret = iCommonUiHelper->AddToSavedPlaylistL( |
|
5080 *iUserPlaylists, *tracks, this, this ) ); |
|
5081 if ( err != KErrNone ) |
|
5082 { |
|
5083 HandleError( err ); |
|
5084 } |
|
5085 } |
|
5086 #ifdef __ENABLE_MSK |
|
5087 // If Save play list or create play list return True (OK) |
|
5088 // 1 - Unselect marks |
|
5089 // 2 - Force to refresh the MSK with title "Play" |
|
5090 // If Save play list or create play list return False (Cancel) |
|
5091 // 1 - let the marks |
|
5092 // 2 - let the MSK with the "context menu" |
|
5093 if (ret) |
|
5094 { |
|
5095 iContainer->ClearLbxSelection(); |
|
5096 UpdateMiddleSoftKeyDisplayL( iCurrentMskId ); |
|
5097 } |
|
5098 #endif // __ENABLE_MSK |
|
5099 } |
|
5100 else if ( err == KMPXErrDataNotReadyCacheCommand ) |
|
5101 { |
|
5102 // cache this command |
|
5103 HBufC* text = StringLoader::LoadLC( |
|
5104 R_MPX_QTN_MUS_NOTE_ADDING_TRACKS ); |
|
5105 StartDelayedActionL( aCommand, *text ); |
|
5106 CleanupStack::PopAndDestroy( text ); |
|
5107 } |
|
5108 else if ( err != KMPXErrDataNotReady ) |
|
5109 { |
|
5110 HandleError( err ); |
|
5111 } |
|
5112 else |
|
5113 { |
|
5114 // KMPXErrDataNotReady, ignore |
|
5115 } |
|
5116 CleanupStack::PopAndDestroy( tracks ); |
|
5117 } |
|
5118 else |
|
5119 { |
|
5120 // on artist/album level |
|
5121 if ( aCommand == EMPXCmdAddToNewPlaylist ) |
|
5122 { |
|
5123 iAddingToNewPlaylist = ETrue; |
|
5124 iCurrentFindAllLOp = EMPXOpFindAllLAlbumArtistAddToNewPlaylist; |
|
5125 } |
|
5126 else |
|
5127 { |
|
5128 iCurrentFindAllLOp = EMPXOpFindAllLAlbumArtistAddToSavedPlaylist; |
|
5129 } |
|
5130 RArray<TMPXAttribute> attrs; |
|
5131 CleanupClosePushL( attrs ); |
|
5132 attrs.Append( |
|
5133 TMPXAttribute( KMPXMediaIdGeneral, |
|
5134 EMPXMediaGeneralTitle | EMPXMediaGeneralId | |
|
5135 EMPXMediaGeneralType | EMPXMediaGeneralCategory ) ); |
|
5136 CMPXMedia* criteria = CMPXMedia::NewL(); |
|
5137 CleanupStack::PushL( criteria ); |
|
5138 CMPXCommonListBoxArrayBase* listboxArray = |
|
5139 iContainer->ListBoxArray(); |
|
5140 const CMPXMedia& containerMedia = |
|
5141 listboxArray->ContainerMedia(); |
|
5142 TMPXGeneralCategory containerCategory( |
|
5143 containerMedia.ValueTObjectL<TMPXGeneralCategory>( |
|
5144 KMPXMediaGeneralCategory ) ); |
|
5145 if ( containerCategory == EMPXArtist ) |
|
5146 { |
|
5147 // artist/album level, need to specify artist ID in container ID |
|
5148 TMPXItemId containerId( |
|
5149 containerMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
5150 criteria->SetTObjectValueL<TMPXItemId>( |
|
5151 KMPXMediaGeneralContainerId, containerId ); |
|
5152 } |
|
5153 const CMPXMedia& currentMedia = listboxArray->MediaL( |
|
5154 iContainer->CurrentLbxItemIndex() ); |
|
5155 TMPXItemId id( |
|
5156 currentMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
5157 criteria->SetTObjectValueL<TMPXGeneralType>( |
|
5158 KMPXMediaGeneralType, EMPXGroup ); |
|
5159 criteria->SetTObjectValueL<TMPXGeneralCategory>( |
|
5160 KMPXMediaGeneralCategory, EMPXSong ); |
|
5161 criteria->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id ); |
|
5162 iCollectionUtility->Collection().FindAllL( |
|
5163 *criteria, attrs.Array(), *this ); |
|
5164 CleanupStack::PopAndDestroy( criteria ); |
|
5165 CleanupStack::PopAndDestroy( &attrs ); |
|
5166 } |
|
5167 break; |
|
5168 } |
|
5169 case EMPXCmdAddSongs: |
|
5170 { |
|
5171 iAddingSong = ETrue; |
|
5172 iViewUtility->ActivateViewL( |
|
5173 TUid::Uid( KMPXPluginTypeAddSongsEditorUid ) ); |
|
5174 break; |
|
5175 } |
|
5176 case EMPXCmdReorder: |
|
5177 { |
|
5178 ActivateReorderGrabbedModeL(); |
|
5179 break; |
|
5180 } |
|
5181 case EMPXCmdDelete: // fall through |
|
5182 case EMPXCmdRemove: |
|
5183 { |
|
5184 StoreListboxItemIndexL(); |
|
5185 DeleteSelectedItemsL(aCommand); |
|
5186 break; |
|
5187 } |
|
5188 case EMPXCmdSend: |
|
5189 { |
|
5190 const CMPXMedia& media = |
|
5191 iContainer->ListBoxArray()->MediaL( |
|
5192 iContainer->CurrentLbxItemIndex() ); |
|
5193 |
|
5194 TMPXGeneralType type( |
|
5195 media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) ); |
|
5196 TMPXGeneralCategory category( |
|
5197 media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) ); |
|
5198 |
|
5199 if ( iContainer->CurrentSelectionIndicesL()->Count() == 0 && |
|
5200 type == EMPXItem && |
|
5201 category == EMPXPlaylist ) |
|
5202 { |
|
5203 // sending a playlist |
|
5204 DoSendPlaylistL( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
5205 } |
|
5206 else |
|
5207 { |
|
5208 DoSendL(); |
|
5209 } |
|
5210 break; |
|
5211 } |
|
5212 case EMPXCmdSongDetails: // fall through |
|
5213 case EMPXCmdAlbumArt: // fall through |
|
5214 case EMPXCmdFindInMusicShop: |
|
5215 { |
|
5216 StoreListboxItemIndexL(); |
|
5217 |
|
5218 CMPXCommonListBoxArrayBase* listboxArray( |
|
5219 iContainer->ListBoxArray() ); |
|
5220 const CMPXMedia& media( listboxArray->MediaL( |
|
5221 iContainer->CurrentLbxItemIndex() ) ); |
|
5222 if ( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId ) |
|
5223 { |
|
5224 // highlighted item is not yet available |
|
5225 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleCommandL item not yet fetched" ); |
|
5226 } |
|
5227 else |
|
5228 { |
|
5229 // need to check if the file exists. if the file doesn't exist |
|
5230 // and mediaL is called with drm status, it'll leave |
|
5231 if ( aCommand == EMPXCmdSongDetails ) |
|
5232 { |
|
5233 iCurrentMediaLOp = EMPXOpMediaLSongDetailsFileCheck; |
|
5234 iInSongDetails = ETrue; |
|
5235 } |
|
5236 else if ( aCommand == EMPXCmdAlbumArt ) |
|
5237 { |
|
5238 iInAlbumArtDialog = ETrue; |
|
5239 iCurrentMediaLOp = EMPXOpMediaLAlbumArtFileCheck; |
|
5240 } |
|
5241 else if ( aCommand == EMPXCmdFindInMusicShop ) |
|
5242 { |
|
5243 iCurrentMediaLOp = EMPXOpMediaLFindInMusicShopSongDetails; |
|
5244 } |
|
5245 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
5246 CleanupStack::PushL( path ); |
|
5247 path->Set( iContainer->CurrentLbxItemIndex() ); |
|
5248 RArray<TMPXAttribute> attrs; |
|
5249 CleanupClosePushL( attrs ); |
|
5250 attrs.Append( |
|
5251 TMPXAttribute( KMPXMediaIdGeneral, |
|
5252 EMPXMediaGeneralUri | EMPXMediaGeneralCollectionId ) ); |
|
5253 iCollectionUtility->Collection().MediaL( *path, attrs.Array() ); |
|
5254 CleanupStack::PopAndDestroy( &attrs ); |
|
5255 CleanupStack::PopAndDestroy( path ); |
|
5256 } |
|
5257 break; |
|
5258 } |
|
5259 case EMPXCmdGoToMusicShop: |
|
5260 { |
|
5261 LaunchMusicShopL(); |
|
5262 break; |
|
5263 } |
|
5264 case EMPXCmdGoToNokiaMusicShop: |
|
5265 { |
|
5266 LaunchMusicShopL(); |
|
5267 break; |
|
5268 } |
|
5269 case EMPXCmdGoToOperatorMusicShop: |
|
5270 { |
|
5271 if(iMusicStoreWebPage) |
|
5272 { |
|
5273 LaunchOperatorURLMusicShopL(); |
|
5274 } |
|
5275 else |
|
5276 { |
|
5277 if(iOperatorMusicStoreType) |
|
5278 { |
|
5279 LaunchOperatorJavaMusicShopL(iOperatorMusicStoreUID); |
|
5280 } |
|
5281 else |
|
5282 { |
|
5283 LaunchOperatorNativeMusicShopL(); |
|
5284 } |
|
5285 } |
|
5286 break; |
|
5287 } |
|
5288 case EMPXCmdMusicLibraryDetails: |
|
5289 { |
|
5290 iCurrentMediaLOp = EMPXOpMediaLCollectionDetails; |
|
5291 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
5292 CleanupStack::PushL( path ); |
|
5293 RArray<TMPXAttribute> attrs; |
|
5294 CleanupClosePushL( attrs ); |
|
5295 attrs.Append( KMPXMediaColDetailAll ); |
|
5296 iCollectionUtility->Collection().MediaL( *path, attrs.Array() ); |
|
5297 CleanupStack::PopAndDestroy( &attrs ); |
|
5298 CleanupStack::PopAndDestroy( path ); |
|
5299 break; |
|
5300 } |
|
5301 case EMPXCmdRename: |
|
5302 { |
|
5303 DoHandleRenameL(); |
|
5304 break; |
|
5305 } |
|
5306 case EMPXCmdPlaylistDetails: |
|
5307 { |
|
5308 iCurrentMediaLOp = EMPXOpMediaLPlaylistDetails; |
|
5309 CMPXCollectionPath* path = iCollectionUtility->Collection().PathL(); |
|
5310 CleanupStack::PushL( path ); |
|
5311 path->Set( iContainer->CurrentLbxItemIndex() ); |
|
5312 RArray<TMPXAttribute> attrs; |
|
5313 CleanupClosePushL( attrs ); |
|
5314 attrs.Append( TMPXAttribute( KMPXMediaIdGeneral, |
|
5315 EMPXMediaGeneralCount | EMPXMediaGeneralTitle | |
|
5316 EMPXMediaGeneralUri | EMPXMediaGeneralDate | |
|
5317 EMPXMediaGeneralDuration | EMPXMediaGeneralFlags ) ); |
|
5318 iCollectionUtility->Collection().MediaL( *path, attrs.Array() ); |
|
5319 CleanupStack::PopAndDestroy( &attrs ); |
|
5320 CleanupStack::PopAndDestroy( path ); |
|
5321 break; |
|
5322 } |
|
5323 case EAknSoftkeyBack: |
|
5324 { |
|
5325 iMarkedAll = EFalse; |
|
5326 if( iIsDeleting ) |
|
5327 { |
|
5328 break; |
|
5329 } |
|
5330 |
|
5331 if ( iIsEmbedded ) |
|
5332 { |
|
5333 AppUi()->HandleCommandL( |
|
5334 ( MPXTlsHelper::NeedSave() && iCommonUiHelper->IsHostMessagingBrowserL() ) |
|
5335 ? EMPXCmdSaveAndExit : EEikCmdExit ); |
|
5336 } |
|
5337 else |
|
5338 { |
|
5339 if ( !iHandlingKeyEvent ) |
|
5340 { |
|
5341 CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL(); |
|
5342 CleanupStack::PushL( cpath ); |
|
5343 TInt currentDepth( cpath->Levels() ); |
|
5344 if ( currentDepth == 2 ) // 2 is the level of music main view |
|
5345 { |
|
5346 // let Back Stepping Service handle the event |
|
5347 TInt statusInfo( KMPXBackSteppingNotConsumed ); |
|
5348 if( iViewUtility && |
|
5349 ( iViewUtility->ActiveViewImplementationUid() != KNullUid ) ) |
|
5350 { |
|
5351 TInt viewId( iViewUtility->ActiveViewType().iUid ); |
|
5352 TBuf8<KMVPrefixLen + KMaxIntLen> buf; |
|
5353 buf.Copy( KMVPrefix ); |
|
5354 buf.AppendNum( viewId ); |
|
5355 statusInfo = iBackSteppingUtility->HandleBackCommandL( buf ); |
|
5356 MPX_DEBUG3("CMPXCollectionViewHgImp::HandleCommandL - viewid=0x%x, statusInfo=%d", |
|
5357 viewId, statusInfo ); |
|
5358 } |
|
5359 if ( statusInfo == KMPXBackSteppingNotConsumed ) |
|
5360 // event not consumed by Back Stepping utility, handle here |
|
5361 // |
|
5362 { |
|
5363 AppUi()->HandleCommandL( aCommand ); |
|
5364 } |
|
5365 } |
|
5366 else |
|
5367 { |
|
5368 if ( currentDepth > 2 && !iBackOneLevel ) |
|
5369 { |
|
5370 iContainer->ClearLbxSelection(); |
|
5371 iCollectionUtility->Collection().BackL(); |
|
5372 iFirstIncrementalBatch = ETrue; |
|
5373 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleCommandL Getting container media, currentDepth = %d", currentDepth ); |
|
5374 cpath->Back(); |
|
5375 cpath->Back(); |
|
5376 RArray<TMPXAttribute> attrs; |
|
5377 CleanupClosePushL(attrs); |
|
5378 iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo; |
|
5379 attrs.Append( KMPXMediaGeneralDuration ); |
|
5380 iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() ); |
|
5381 CleanupStack::PopAndDestroy( &attrs ); |
|
5382 iBackOneLevel = ETrue; |
|
5383 } |
|
5384 else |
|
5385 { |
|
5386 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleCommandL Not getting container media" ); |
|
5387 } |
|
5388 |
|
5389 iHandlingKeyEvent = ETrue; |
|
5390 } |
|
5391 CleanupStack::PopAndDestroy( cpath ); |
|
5392 } |
|
5393 else |
|
5394 { |
|
5395 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleCommandL Busy, ignoring command" ); |
|
5396 } |
|
5397 } |
|
5398 break; |
|
5399 } |
|
5400 case EMPXCmdSavePlaylist: |
|
5401 { |
|
5402 AppUi()->HandleCommandL( EMPXCmdSaveAndReopen ); |
|
5403 break; |
|
5404 } |
|
5405 case EAknCmdExit: |
|
5406 case EAknSoftkeyExit: |
|
5407 { |
|
5408 AppUi()->HandleCommandL( aCommand ); |
|
5409 break; |
|
5410 } |
|
5411 case EMPXCmdCancelReorder: |
|
5412 { |
|
5413 if ( iContainer && iContainer->IsInReorderMode() ) |
|
5414 { |
|
5415 TRAP_IGNORE( ProcessCommandL( EMPXCmdReorderCancel ) ); |
|
5416 iCurrentHighlightedIndex = KErrNotFound; |
|
5417 } |
|
5418 break; |
|
5419 } |
|
5420 case EMPXCmdUpnpPlayViaLocal: |
|
5421 { |
|
5422 if ( iUpnpFrameworkSupport ) |
|
5423 { |
|
5424 SelectNewPlayerL( aCommand ); |
|
5425 } |
|
5426 break; |
|
5427 } |
|
5428 case EMPXCmdUPnPAiwCmdCopyToExternalCriteria: |
|
5429 { |
|
5430 if ( iUpnpFrameworkSupport ) |
|
5431 { |
|
5432 CopySelectedItemsToRemoteL(); |
|
5433 } |
|
5434 break; |
|
5435 } |
|
5436 |
|
5437 case EMPXCmdPlay: |
|
5438 case EMPXCmdForcePlay: |
|
5439 case EMPXCmdPlayPause: |
|
5440 { |
|
5441 TBool isReady( ETrue ); |
|
5442 TMPXPlaybackState state( iPlaybackUtility->StateL() ); |
|
5443 |
|
5444 // if it's in paused state, resume playback, no need |
|
5445 // to check if current highlight is a playlist |
|
5446 if ( iContainer && |
|
5447 aCommand != EMPXCmdForcePlay && |
|
5448 state != EPbStatePaused && state != EPbStatePlaying ) |
|
5449 { |
|
5450 CMPXCommonListBoxArrayBase* listboxArray = |
|
5451 iContainer->ListBoxArray(); |
|
5452 if ( iContainer->CurrentListItemCount() > 0 ) |
|
5453 { |
|
5454 TInt currentItem( |
|
5455 iContainer->CurrentLbxItemIndex() ); |
|
5456 const CMPXMedia& media = listboxArray->MediaL( currentItem ); |
|
5457 TMPXGeneralType type( |
|
5458 media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) ); |
|
5459 TMPXGeneralCategory category( |
|
5460 media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) ); |
|
5461 if ( category == EMPXPlaylist && type == EMPXItem ) |
|
5462 { |
|
5463 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleCommandL checking item count in playlist" ); |
|
5464 isReady = EFalse; |
|
5465 TMPXItemId id( |
|
5466 media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
5467 CMPXMedia* entry = CMPXMedia::NewL(); |
|
5468 CleanupStack::PushL( entry ); |
|
5469 entry->SetTObjectValueL<TMPXGeneralType>( |
|
5470 KMPXMediaGeneralType, EMPXGroup ); |
|
5471 entry->SetTObjectValueL<TMPXGeneralCategory>( |
|
5472 KMPXMediaGeneralCategory, EMPXSong ); |
|
5473 entry->SetTObjectValueL<TMPXItemId>( |
|
5474 KMPXMediaGeneralId, id ); |
|
5475 iCurrentFindAllLOp = EMPXOpFindAllLPlaylistTracksCount; |
|
5476 RArray<TMPXAttribute> attrs; |
|
5477 CleanupClosePushL( attrs ); |
|
5478 attrs.Append( KMPXMediaGeneralId ); |
|
5479 iCollectionUtility->Collection().FindAllL( |
|
5480 *entry, attrs.Array(), *this ); |
|
5481 CleanupStack::PopAndDestroy( &attrs ); |
|
5482 CleanupStack::PopAndDestroy( entry ); |
|
5483 } |
|
5484 } |
|
5485 else |
|
5486 { |
|
5487 // current list view is empty, and no song currently playing |
|
5488 // ignore the command |
|
5489 isReady = EFalse; |
|
5490 } |
|
5491 } |
|
5492 if ( isReady ) |
|
5493 { |
|
5494 if ( aCommand == EMPXCmdForcePlay ) |
|
5495 { |
|
5496 aCommand = EMPXCmdPlay; |
|
5497 } |
|
5498 if ( EPbStateNotInitialised == state || |
|
5499 EPbStateStopped == state ) |
|
5500 { |
|
5501 // Needed to reset the status of iPreservedState |
|
5502 if ( EPbStateStopped == state ) |
|
5503 { |
|
5504 iPlaybackUtility->CommandL(EPbCmdResetPreserveState); |
|
5505 } |
|
5506 TInt currentItem( |
|
5507 iContainer->CurrentLbxItemIndex() ); |
|
5508 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleCommandL playing index %d", currentItem ); |
|
5509 if ( iContainer->IsInReorderMode() ) |
|
5510 { |
|
5511 // if in reorder mode, and in not playing state |
|
5512 // drop the reorder target and start playing |
|
5513 if ( iIsGrabbed ) |
|
5514 { |
|
5515 ProcessCommandL( EMPXCmdReorderDrop ); |
|
5516 } |
|
5517 ProcessCommandL( EMPXCmdReorderDone ); |
|
5518 iPlayIndex = currentItem; |
|
5519 } |
|
5520 else if ( currentItem != KErrNotFound ) |
|
5521 { |
|
5522 if ( iContainer && !AppUi()->IsDisplayingDialog() ) |
|
5523 { |
|
5524 StopDisplayingMenuBar(); |
|
5525 } |
|
5526 iPlayIndex = KErrNotFound; |
|
5527 if(iCollectionCacheReady) |
|
5528 { |
|
5529 iCollectionUtility->Collection().OpenL( currentItem, EMPXOpenPlaylistOnly ); |
|
5530 iFirstIncrementalBatch = ETrue; |
|
5531 } |
|
5532 } |
|
5533 } |
|
5534 else |
|
5535 { |
|
5536 AppUi()->HandleCommandL( aCommand ); |
|
5537 } |
|
5538 } |
|
5539 break; |
|
5540 } |
|
5541 case EMPXCmdSaveComplete: |
|
5542 { |
|
5543 MPXTlsHelper::SetNeedSave( EFalse ); |
|
5544 break; |
|
5545 } |
|
5546 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
5547 case EMPXCmdRefreshLibrary: |
|
5548 { |
|
5549 MPX_PERF_CHECKPT("Refresh collection library"); |
|
5550 // Package the argument from 8bit to 16bit then activate view |
|
5551 // |
|
5552 StartWaitNoteL( EMPXRefreshingNote ); |
|
5553 iPlaybackUtility->CommandL( EPbCmdStop ); |
|
5554 break; |
|
5555 } |
|
5556 #endif |
|
5557 default: |
|
5558 { |
|
5559 MPX_PERF_CHECKPT("Handle Collection view unknown command"); |
|
5560 if ( iUpnpFrameworkSupport ) |
|
5561 { |
|
5562 if ( aCommand >= EMPXCmdUpnpPlayViaRemotePlayer && |
|
5563 aCommand < EMPXCmdUpnpLastCommandId ) |
|
5564 { |
|
5565 SelectNewPlayerL( aCommand ); |
|
5566 } |
|
5567 else |
|
5568 { |
|
5569 if ( iServiceHandler->ServiceCmdByMenuCmd(aCommand) != KAiwCmdNone ) |
|
5570 { |
|
5571 CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
5572 FillAiwParametersL(paramList); |
|
5573 iServiceHandler->ExecuteMenuCmdL(aCommand, paramList, |
|
5574 iServiceHandler->OutParamListL()); |
|
5575 } |
|
5576 AppUi()->HandleCommandL( aCommand ); |
|
5577 } |
|
5578 } |
|
5579 else |
|
5580 { |
|
5581 if ( iServiceHandler->ServiceCmdByMenuCmd(aCommand) != KAiwCmdNone ) |
|
5582 { |
|
5583 CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
5584 FillAiwParametersL(paramList); |
|
5585 iServiceHandler->ExecuteMenuCmdL(aCommand, paramList, |
|
5586 iServiceHandler->OutParamListL()); |
|
5587 } |
|
5588 AppUi()->HandleCommandL( aCommand ); |
|
5589 } |
|
5590 break; |
|
5591 } |
|
5592 } |
|
5593 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleCommandL() exiting" ); |
|
5594 } |
|
5595 |
|
5596 // --------------------------------------------------------------------------- |
|
5597 // From CAknView |
|
5598 // Handles a view activation. |
|
5599 // --------------------------------------------------------------------------- |
|
5600 // |
|
5601 void CMPXCollectionViewHgImp::DoActivateL( |
|
5602 const TVwsViewId& /* aPrevViewId */, |
|
5603 TUid /* aCustomMessageId */, |
|
5604 const TDesC8& /* aCustomMessage */ ) |
|
5605 { |
|
5606 MPX_FUNC( "CMPXCollectionViewHgImp::DoActivateL()" ); |
|
5607 |
|
5608 // Add view deactivation observer |
|
5609 AppUi()->AddViewDeactivationObserverL( this ); |
|
5610 |
|
5611 // Set status pane layout if switched here directly from another view, |
|
5612 // such as when using the AnyKey |
|
5613 StatusPane()->MakeVisible( ETrue ); |
|
5614 StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT); |
|
5615 |
|
5616 if ( !iContainer ) |
|
5617 { |
|
5618 iContainer = CMPXCollectionViewHgContainer::NewL( this, this, iIsEmbedded ); |
|
5619 iContainer->SetCbaHandler( this ); |
|
5620 } |
|
5621 iContainer->SetMopParent( this ); |
|
5622 AppUi()->AddToStackL( *this, iContainer ); |
|
5623 iContainer->SetRect( ClientRect() ); |
|
5624 |
|
5625 CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() ); |
|
5626 CleanupStack::PushL( cpath ); |
|
5627 |
|
5628 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
5629 // media is not valid until the first HandleOpenL call |
|
5630 CEikButtonGroupContainer* cba = Cba(); |
|
5631 if ( cba ) |
|
5632 { |
|
5633 cba->SetCommandSetL( |
|
5634 ( cpath->Levels() == 2 && !iIsEmbedded ) ? |
|
5635 R_MPX_OPTIONS_BACK_CBA_NO_ACTION : R_MPX_OPTIONS_BACK_CBA_NO_ACTION ); |
|
5636 cba->DrawDeferred(); |
|
5637 } |
|
5638 #else |
|
5639 // media is not valid until the first HandleOpenL call |
|
5640 CEikButtonGroupContainer* cba = Cba(); |
|
5641 if ( cba ) |
|
5642 { |
|
5643 cba->SetCommandSetL( |
|
5644 ( iViewUtility->ViewHistoryDepth() == 1 && !iIsEmbedded ) ? |
|
5645 R_MPX_OPTIONS_EXIT_CBA_NO_ACTION : R_MPX_OPTIONS_BACK_CBA_NO_ACTION ); |
|
5646 cba->DrawDeferred(); |
|
5647 } |
|
5648 #endif |
|
5649 |
|
5650 UpdateTitlePaneL(); |
|
5651 UpdateNaviPaneL(); |
|
5652 |
|
5653 |
|
5654 if ( iViewUtility->PreviousViewType().iUid == KMPXPluginTypePlaybackUid ) |
|
5655 { |
|
5656 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
5657 // If previous view is Playback view, it can only be normal playback view |
|
5658 // Podcast shouldn't be highlighted in any case. |
|
5659 iPodcast = EFalse; |
|
5660 #endif |
|
5661 |
|
5662 // return back from playback view and in songs level, |
|
5663 // highlight the new playing song |
|
5664 MMPXSource* source( iPlaybackUtility->Source() ); |
|
5665 |
|
5666 if ( source ) |
|
5667 { |
|
5668 CMPXCollectionPlaylist* playlist( source->PlaylistL() ); |
|
5669 if ( playlist ) |
|
5670 { |
|
5671 // Going from Now Playing View -> Collection, same collection level |
|
5672 iPossibleJump = ( playlist->Path().Levels() == cpath->Levels() ); |
|
5673 delete playlist; |
|
5674 } |
|
5675 } |
|
5676 |
|
5677 if ( cpath->Levels() > 1 ) |
|
5678 { |
|
5679 // valid path in collection |
|
5680 GetDurationL(); |
|
5681 MPX_DEBUG_PATH(*cpath); |
|
5682 |
|
5683 DoIncrementalOpenL(); |
|
5684 } |
|
5685 else |
|
5686 { |
|
5687 TUid defaultView( iViewUtility->DefaultViewUid() ); |
|
5688 iViewUtility->ActivateViewL( ( defaultView != KNullUid ) ? |
|
5689 defaultView : TUid::Uid( KMPXPluginTypeMainUid ) ); |
|
5690 } |
|
5691 } |
|
5692 else |
|
5693 { |
|
5694 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
5695 // If previous view is Collection view, it can only be podcast view |
|
5696 if ( iViewUtility->PreviousViewType().iUid == KMPXPluginTypeCollectionUid ) |
|
5697 { |
|
5698 iPodcast = ETrue; |
|
5699 } |
|
5700 // don't bother getting duration if at plugin list |
|
5701 if ( cpath->Levels() > 1 ) |
|
5702 #endif |
|
5703 { |
|
5704 GetDurationL(); |
|
5705 } |
|
5706 MPX_DEBUG_PATH(*cpath); |
|
5707 |
|
5708 DoIncrementalOpenL( cpath->Levels()>KMusicCollectionMenuLevel ? ETrue:EFalse ); |
|
5709 |
|
5710 iUpCount = 0; |
|
5711 iDownCount = 0; |
|
5712 } |
|
5713 CleanupStack::PopAndDestroy( cpath ); |
|
5714 } |
|
5715 |
|
5716 // --------------------------------------------------------------------------- |
|
5717 // From CAknView |
|
5718 // View deactivation function. |
|
5719 // --------------------------------------------------------------------------- |
|
5720 // |
|
5721 void CMPXCollectionViewHgImp::DoDeactivate() |
|
5722 { |
|
5723 MPX_FUNC( "CMPXCollectionViewHgImp::DoDeactivate" ); |
|
5724 if ( iContainer && iContainer->IsInReorderMode() ) |
|
5725 { |
|
5726 TRAP_IGNORE( ProcessCommandL( EMPXCmdReorderDone ) ); |
|
5727 iCurrentHighlightedIndex = KErrNotFound; |
|
5728 } |
|
5729 |
|
5730 if ( iContainer ) |
|
5731 { |
|
5732 iContainer->ContentIsReady( EFalse ); |
|
5733 AppUi()->RemoveFromStack( iContainer ); |
|
5734 delete iContainer; |
|
5735 iContainer = NULL; |
|
5736 } |
|
5737 |
|
5738 if (iDuration) |
|
5739 { |
|
5740 delete iDuration; |
|
5741 iDuration = NULL; |
|
5742 TRAP_IGNORE(UpdateNaviPaneL()); |
|
5743 } |
|
5744 |
|
5745 // Cleanup view deactivation observer |
|
5746 AppUi()->RemoveViewDeactivationObserver( this ); |
|
5747 } |
|
5748 |
|
5749 // --------------------------------------------------------------------------- |
|
5750 // From CAknView |
|
5751 // Foreground event handling function. |
|
5752 // --------------------------------------------------------------------------- |
|
5753 // |
|
5754 void CMPXCollectionViewHgImp::HandleForegroundEventL( TBool aForeground ) |
|
5755 { |
|
5756 MPX_FUNC( "CMPXCollectionViewHgImp::HandleForegroundEventL" ); |
|
5757 if ( aForeground && iOpeningNote ) |
|
5758 { |
|
5759 CloseWaitNoteL(); |
|
5760 iOpeningNote = EFalse; |
|
5761 } |
|
5762 iActivateBackStepping = EFalse; |
|
5763 MPX_DEBUG3("CMPXCollectionViewHgImp::HandleForegroundEventL - is in foreground=%d, this view=0x%x", |
|
5764 aForeground, Id().iUid ); |
|
5765 if( aForeground && |
|
5766 iViewUtility && |
|
5767 ( iViewUtility->ActiveViewImplementationUid() != KNullUid ) ) |
|
5768 { |
|
5769 iActivateBackStepping = ETrue; |
|
5770 } |
|
5771 { |
|
5772 CAknView::HandleForegroundEventL( aForeground ); |
|
5773 } |
|
5774 } |
|
5775 |
|
5776 // ----------------------------------------------------------------------------- |
|
5777 // CMPXCollectionViewHgImp::HandleBacksteppingActivation |
|
5778 // Handle backstepping activation |
|
5779 // ----------------------------------------------------------------------------- |
|
5780 // |
|
5781 void CMPXCollectionViewHgImp::HandleBacksteppingActivation() |
|
5782 { |
|
5783 TInt viewId( iViewUtility->ActiveViewType().iUid ); |
|
5784 TBuf8<KMVPrefixLen + KMaxIntLen> buf; |
|
5785 buf.Copy( KMVPrefix ); |
|
5786 buf.AppendNum( viewId ); |
|
5787 TInt statusInfo( KMPXBackSteppingNotConsumed ); |
|
5788 TRAP_IGNORE( |
|
5789 statusInfo = |
|
5790 iBackSteppingUtility->ForwardActivationEventL( buf, ETrue ); |
|
5791 ); |
|
5792 MPX_DEBUG3("CMPXCollectionViewHgImp::HandleBacksteppingActivation - viewId=0x%x, statusInfo=%d", viewId, statusInfo ); |
|
5793 iActivateBackStepping = EFalse; |
|
5794 } |
|
5795 |
|
5796 // --------------------------------------------------------------------------- |
|
5797 // Handle initialing a music menu pane. |
|
5798 // --------------------------------------------------------------------------- |
|
5799 // |
|
5800 void CMPXCollectionViewHgImp::HandleInitMusicMenuPaneL( |
|
5801 CEikMenuPane* aMenuPane ) |
|
5802 { |
|
5803 CMPXCollectionViewListBoxArray* array = |
|
5804 static_cast<CMPXCollectionViewListBoxArray*>( |
|
5805 iContainer->ListBoxArray() ); |
|
5806 const CMPXMedia& containerMedia = array->ContainerMedia(); |
|
5807 |
|
5808 TMPXGeneralCategory containerCategory( |
|
5809 containerMedia.ValueTObjectL<TMPXGeneralCategory>( |
|
5810 KMPXMediaGeneralCategory ) ); |
|
5811 |
|
5812 switch ( containerCategory ) |
|
5813 { |
|
5814 case EMPXPlaylist: |
|
5815 { |
|
5816 // playlist view |
|
5817 aMenuPane->SetItemDimmed( EMPXCmdGoToPlaylists, ETrue ); |
|
5818 aMenuPane->SetItemDimmed( EMPXCmdGoToGenre, ETrue ); |
|
5819 aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue ); |
|
5820 break; |
|
5821 } |
|
5822 case EMPXAlbum: |
|
5823 case EMPXArtist: |
|
5824 { |
|
5825 // Album & Artist view |
|
5826 aMenuPane->SetItemDimmed( EMPXCmdGoToArtistAlbums, ETrue ); |
|
5827 aMenuPane->SetItemDimmed( EMPXCmdGoToGenre, ETrue ); |
|
5828 break; |
|
5829 } |
|
5830 case EMPXGenre: |
|
5831 { |
|
5832 // Genre view |
|
5833 aMenuPane->SetItemDimmed( EMPXCmdGoToGenre, ETrue ); |
|
5834 aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue ); |
|
5835 break; |
|
5836 } |
|
5837 case EMPXSong: |
|
5838 { |
|
5839 aMenuPane->SetItemDimmed( EMPXCmdGoToAllSongs, ETrue ); |
|
5840 aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue ); |
|
5841 break; |
|
5842 } |
|
5843 default: |
|
5844 { |
|
5845 break; |
|
5846 } |
|
5847 } |
|
5848 } |
|
5849 // --------------------------------------------------------------------------- |
|
5850 // From MEikMenuObserver |
|
5851 // Dynamically initialises a menu pane. |
|
5852 // --------------------------------------------------------------------------- |
|
5853 // |
|
5854 void CMPXCollectionViewHgImp::DynInitMenuPaneL( |
|
5855 TInt aResourceId, |
|
5856 CEikMenuPane* aMenuPane ) |
|
5857 { |
|
5858 MPX_FUNC( "CMPXCollectionViewHgImp::DynInitMenuPaneL" ); |
|
5859 CMPXCollectionViewListBoxArray* array = |
|
5860 static_cast<CMPXCollectionViewListBoxArray*>( |
|
5861 iContainer->ListBoxArray() ); |
|
5862 TInt currentItem( iContainer->CurrentLbxItemIndex() ); |
|
5863 TBool isListEmpty( currentItem < 0 ); |
|
5864 TInt selectionCount( 0 ); |
|
5865 if ( iSelectionIndexCache) |
|
5866 { |
|
5867 selectionCount = iSelectionIndexCache->Count(); |
|
5868 } |
|
5869 |
|
5870 TInt usbUnblockingStatus; |
|
5871 RProperty::Get( KMPXViewPSUid, |
|
5872 KMPXUSBUnblockingPSStatus, |
|
5873 usbUnblockingStatus); |
|
5874 |
|
5875 switch ( aResourceId ) |
|
5876 { |
|
5877 case R_MPX_COLLECTION_VIEW_MENU_1: |
|
5878 { |
|
5879 const CMPXMedia& containerMedia = array->ContainerMedia(); |
|
5880 TMPXGeneralType containerType( |
|
5881 containerMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) ); |
|
5882 TMPXGeneralCategory containerCategory( |
|
5883 containerMedia.ValueTObjectL<TMPXGeneralCategory>( |
|
5884 KMPXMediaGeneralCategory ) ); |
|
5885 |
|
5886 HandleInitMusicMenuPaneL(aMenuPane); |
|
5887 |
|
5888 MPX_DEBUG3( "CMPXCollectionViewHgImp::DynInitMenuPaneL container type = %d, category = %d", containerType, containerCategory ); |
|
5889 |
|
5890 // Always dim the find in hg implementation |
|
5891 aMenuPane->SetItemDimmed( EMPXCmdFind, ETrue ); |
|
5892 MMPXPlaybackUtility* pdPlaybackUtility; |
|
5893 pdPlaybackUtility = MMPXPlaybackUtility::UtilityL( TUid::Uid( KProgressDownloadUid ) ); |
|
5894 MMPXSource* pdsource( pdPlaybackUtility->Source() ); |
|
5895 MMPXSource* source( iPlaybackUtility->Source() ); |
|
5896 TBool hideNowPlaying; |
|
5897 hideNowPlaying = ( (pdsource == 0) |
|
5898 && (source == 0)); |
|
5899 pdPlaybackUtility->Close(); |
|
5900 if ( hideNowPlaying ) |
|
5901 { |
|
5902 aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue ); |
|
5903 } |
|
5904 if ( !isListEmpty ) |
|
5905 { |
|
5906 const CMPXMedia& media = array->MediaL( currentItem ); |
|
5907 TMPXGeneralType type( |
|
5908 media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) ); |
|
5909 TMPXGeneralCategory category( |
|
5910 media.ValueTObjectL<TMPXGeneralCategory>( |
|
5911 KMPXMediaGeneralCategory ) ); |
|
5912 MPX_DEBUG3( "CMPXCollectionViewHgImp::DynInitMenuPaneL item type = %d, category = %d", type, category ); |
|
5913 #ifdef SINGLE_CLICK_INCLUDED |
|
5914 if ( containerType == EMPXGroup && containerCategory == EMPXAlbum ) |
|
5915 { |
|
5916 // album view |
|
5917 switch ( category ) |
|
5918 { |
|
5919 case EMPXAlbum: |
|
5920 { |
|
5921 if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive ) |
|
5922 { |
|
5923 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue ); |
|
5924 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue ); |
|
5925 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
5926 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
5927 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue ); |
|
5928 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue ); |
|
5929 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
5930 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, EFalse ); |
|
5931 } |
|
5932 else |
|
5933 { |
|
5934 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue ); |
|
5935 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse ); |
|
5936 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
5937 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
5938 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue ); |
|
5939 aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse ); |
|
5940 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
5941 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, EFalse ); |
|
5942 } |
|
5943 break; |
|
5944 } |
|
5945 case EMPXCommand: |
|
5946 { |
|
5947 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue ); |
|
5948 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue ); |
|
5949 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
5950 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
5951 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue ); |
|
5952 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue ); |
|
5953 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
5954 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue ); |
|
5955 break; |
|
5956 } |
|
5957 } |
|
5958 } |
|
5959 else |
|
5960 #endif |
|
5961 if ( containerType == EMPXItem && containerCategory == EMPXPlaylist ) |
|
5962 { |
|
5963 // in playlist tracks view |
|
5964 // enable reordering and add songs in playlist view |
|
5965 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue ); |
|
5966 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue ); |
|
5967 if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive ) |
|
5968 { |
|
5969 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
5970 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
5971 aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() ); |
|
5972 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue ); |
|
5973 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
5974 #ifdef SINGLE_CLICK_INCLUDED |
|
5975 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue ); |
|
5976 #endif |
|
5977 |
|
5978 } |
|
5979 else |
|
5980 { |
|
5981 // do not display add songs option when marking is on |
|
5982 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, selectionCount > 0 ); |
|
5983 TInt totalItemCount( iContainer->TotalListItemCount() ); |
|
5984 // display reorder option only when more than 1 item is visible |
|
5985 // do not display reorder option when marking is on |
|
5986 #ifdef SINGLE_CLICK_INCLUDED |
|
5987 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
5988 #else |
|
5989 aMenuPane->SetItemDimmed( EMPXCmdReorder, |
|
5990 ( totalItemCount > 1 && selectionCount == 0 ) ? |
|
5991 EFalse : ETrue ); |
|
5992 #endif |
|
5993 aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() ); |
|
5994 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue ); |
|
5995 aMenuPane->SetItemDimmed( EMPXCmdRemove, EFalse ); |
|
5996 #ifdef SINGLE_CLICK_INCLUDED |
|
5997 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue ); |
|
5998 #endif |
|
5999 } |
|
6000 |
|
6001 if ( containerMedia.IsSupported( |
|
6002 KMPXMediaGeneralNonPermissibleActions ) ) |
|
6003 { |
|
6004 // check for auto playlist, disable add, remove and reorder |
|
6005 TMPXGeneralNonPermissibleActions attr( |
|
6006 containerMedia.ValueTObjectL<TMPXGeneralNonPermissibleActions>( |
|
6007 KMPXMediaGeneralNonPermissibleActions ) ); |
|
6008 if ( attr & EMPXWrite ) |
|
6009 { |
|
6010 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
6011 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
6012 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
6013 } |
|
6014 } |
|
6015 } |
|
6016 else if ( type == EMPXItem ) |
|
6017 { |
|
6018 switch ( category ) |
|
6019 { |
|
6020 case EMPXPlaylist: |
|
6021 { |
|
6022 // playlist view |
|
6023 if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive ) |
|
6024 { |
|
6025 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue ); |
|
6026 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue ); |
|
6027 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
6028 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
6029 aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() ); |
|
6030 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue ); |
|
6031 } |
|
6032 else |
|
6033 { |
|
6034 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, EFalse ); |
|
6035 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue ); |
|
6036 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
6037 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
6038 aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() ); |
|
6039 aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse ); |
|
6040 } |
|
6041 if ( media.IsSupported( |
|
6042 KMPXMediaGeneralNonPermissibleActions ) ) |
|
6043 { |
|
6044 // check for auto playlist, disable delete |
|
6045 TMPXGeneralNonPermissibleActions attr( |
|
6046 media.ValueTObjectL<TMPXGeneralNonPermissibleActions>( |
|
6047 KMPXMediaGeneralNonPermissibleActions ) ); |
|
6048 if ( attr & EMPXWrite ) |
|
6049 { |
|
6050 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue ); |
|
6051 } |
|
6052 } |
|
6053 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
6054 break; |
|
6055 } |
|
6056 #ifdef SINGLE_CLICK_INCLUDED |
|
6057 case EMPXAlbum: |
|
6058 { |
|
6059 // album contents view |
|
6060 if ( iContainer->IsSelectedItemASong() ) |
|
6061 { |
|
6062 if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive ) |
|
6063 { |
|
6064 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue ); |
|
6065 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue ); |
|
6066 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
6067 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
6068 aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() ); |
|
6069 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue ); |
|
6070 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
6071 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue ); |
|
6072 } |
|
6073 else |
|
6074 { |
|
6075 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue ); |
|
6076 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse ); |
|
6077 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
6078 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
6079 aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() ); |
|
6080 aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse ); |
|
6081 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
6082 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue ); |
|
6083 } |
|
6084 } |
|
6085 else |
|
6086 { |
|
6087 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue ); |
|
6088 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue ); |
|
6089 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
6090 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
6091 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue ); |
|
6092 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue ); |
|
6093 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
6094 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue ); |
|
6095 } |
|
6096 break; |
|
6097 } |
|
6098 case EMPXGenre: |
|
6099 { |
|
6100 // genre view |
|
6101 if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive ) |
|
6102 { |
|
6103 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue ); |
|
6104 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue ); |
|
6105 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
6106 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
6107 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue ); |
|
6108 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue ); |
|
6109 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
6110 } |
|
6111 else |
|
6112 { |
|
6113 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue ); |
|
6114 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse ); |
|
6115 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
6116 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
6117 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue ); |
|
6118 aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse ); |
|
6119 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
6120 } |
|
6121 break; |
|
6122 } |
|
6123 #endif |
|
6124 |
|
6125 #ifdef SINGLE_CLICK_INCLUDED |
|
6126 case EMPXArtist: |
|
6127 case EMPXComposer: |
|
6128 #else |
|
6129 case EMPXAlbum: |
|
6130 case EMPXArtist: |
|
6131 case EMPXGenre: |
|
6132 case EMPXComposer: |
|
6133 #endif |
|
6134 { |
|
6135 // artist, album, genre, composer view |
|
6136 if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive ) |
|
6137 { |
|
6138 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue ); |
|
6139 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue ); |
|
6140 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
6141 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
6142 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue ); |
|
6143 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue ); |
|
6144 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
6145 } |
|
6146 else |
|
6147 { |
|
6148 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue ); |
|
6149 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse ); |
|
6150 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
6151 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
6152 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue ); |
|
6153 aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse ); |
|
6154 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
6155 } |
|
6156 break; |
|
6157 } |
|
6158 case EMPXSong: |
|
6159 { |
|
6160 // any tracks view except playlist tracks |
|
6161 if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive ) |
|
6162 { |
|
6163 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue ); |
|
6164 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue ); |
|
6165 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
6166 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
6167 aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() ); |
|
6168 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue ); |
|
6169 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
6170 #ifdef SINGLE_CLICK_INCLUDED |
|
6171 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue ); |
|
6172 #endif |
|
6173 } |
|
6174 else |
|
6175 { |
|
6176 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue ); |
|
6177 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse ); |
|
6178 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
6179 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
6180 aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() ); |
|
6181 aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse ); |
|
6182 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
6183 #ifdef SINGLE_CLICK_INCLUDED |
|
6184 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue ); |
|
6185 #endif |
|
6186 } |
|
6187 break; |
|
6188 } |
|
6189 case EMPXCommand: |
|
6190 { |
|
6191 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue ); |
|
6192 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue ); |
|
6193 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
6194 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
6195 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue ); |
|
6196 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue ); |
|
6197 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
6198 #ifdef SINGLE_CLICK_INCLUDED |
|
6199 aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue ); |
|
6200 #endif |
|
6201 |
|
6202 } |
|
6203 break; |
|
6204 default: |
|
6205 { |
|
6206 ASSERT( 0 ); |
|
6207 break; |
|
6208 } |
|
6209 } |
|
6210 } |
|
6211 |
|
6212 if ( iUpnpFrameworkSupport ) |
|
6213 { |
|
6214 HandleDynInitUpnpL( aResourceId, *aMenuPane ); |
|
6215 } |
|
6216 else |
|
6217 { |
|
6218 aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue ); |
|
6219 aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue ); |
|
6220 } |
|
6221 } |
|
6222 else |
|
6223 { |
|
6224 // list empty |
|
6225 |
|
6226 aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, |
|
6227 ( containerType == EMPXGroup && containerCategory == EMPXPlaylist) ? // in playlist view? |
|
6228 EFalse : ETrue ); |
|
6229 if ( containerType == EMPXItem && containerCategory == EMPXPlaylist) |
|
6230 { |
|
6231 // in playlist tracks view |
|
6232 if ( containerMedia.IsSupported( |
|
6233 KMPXMediaGeneralNonPermissibleActions ) ) |
|
6234 { |
|
6235 // check for auto playlist, disable add songs |
|
6236 TMPXGeneralNonPermissibleActions attr( |
|
6237 containerMedia.ValueTObjectL<TMPXGeneralNonPermissibleActions>( |
|
6238 KMPXMediaGeneralNonPermissibleActions ) ); |
|
6239 if ( attr & EMPXWrite ) |
|
6240 { |
|
6241 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
6242 } |
|
6243 } |
|
6244 } |
|
6245 else |
|
6246 { |
|
6247 aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue ); |
|
6248 } |
|
6249 aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue ); |
|
6250 aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue ); |
|
6251 aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue ); |
|
6252 aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue ); |
|
6253 aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue ); |
|
6254 aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue ); |
|
6255 aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue ); |
|
6256 } |
|
6257 break; |
|
6258 } |
|
6259 case R_MPX_COLLECTION_VIEW_MENU_2: |
|
6260 { |
|
6261 if ( !isListEmpty ) |
|
6262 { |
|
6263 const CMPXMedia& media = array->MediaL( currentItem ); |
|
6264 TMPXGeneralType type( |
|
6265 media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) ); |
|
6266 TMPXGeneralCategory category( |
|
6267 media.ValueTObjectL<TMPXGeneralCategory>( |
|
6268 KMPXMediaGeneralCategory ) ); |
|
6269 const CMPXMedia& containerMedia = array->ContainerMedia(); |
|
6270 TMPXGeneralType containerType( |
|
6271 containerMedia.ValueTObjectL<TMPXGeneralType>( |
|
6272 KMPXMediaGeneralType ) ); |
|
6273 TMPXGeneralCategory containerCategory( |
|
6274 containerMedia.ValueTObjectL<TMPXGeneralCategory>( |
|
6275 KMPXMediaGeneralCategory ) ); |
|
6276 MPX_DEBUG3( "CMPXCollectionViewHgImp::DynInitMenuPaneL container type = %d, category = %d", containerType, containerCategory ); |
|
6277 MPX_DEBUG3( "CMPXCollectionViewHgImp::DynInitMenuPaneL item type = %d, category = %d", type, category ); |
|
6278 if ( type == EMPXItem) |
|
6279 { |
|
6280 switch ( category ) |
|
6281 { |
|
6282 case EMPXPlaylist: |
|
6283 { |
|
6284 // playlist view |
|
6285 aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue ); |
|
6286 aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue ); |
|
6287 if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive ) |
|
6288 { |
|
6289 aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue ); |
|
6290 } |
|
6291 else |
|
6292 { |
|
6293 aMenuPane->SetItemDimmed( EMPXCmdRename, EFalse ); |
|
6294 } |
|
6295 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue ); |
|
6296 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue ); |
|
6297 aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, EFalse ); |
|
6298 if ( media.IsSupported( |
|
6299 KMPXMediaGeneralNonPermissibleActions ) ) |
|
6300 { |
|
6301 // check for auto playlist, disable delete |
|
6302 TMPXGeneralNonPermissibleActions attr( |
|
6303 media.ValueTObjectL<TMPXGeneralNonPermissibleActions>( |
|
6304 KMPXMediaGeneralNonPermissibleActions ) ); |
|
6305 if ( attr & EMPXWrite ) |
|
6306 { |
|
6307 aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue ); |
|
6308 aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue ); |
|
6309 } |
|
6310 } |
|
6311 if ( array->IsItemBrokenLinkL( currentItem ) || |
|
6312 array->IsItemCorruptedL( currentItem ) ) |
|
6313 { |
|
6314 aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue ); |
|
6315 aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue ); |
|
6316 } |
|
6317 break; |
|
6318 } |
|
6319 case EMPXAlbum: |
|
6320 case EMPXArtist: |
|
6321 case EMPXGenre: |
|
6322 case EMPXComposer: |
|
6323 { |
|
6324 // artist, album, genre, composer view |
|
6325 aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue ); |
|
6326 aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue ); |
|
6327 if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive ) |
|
6328 { |
|
6329 aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue ); |
|
6330 } |
|
6331 else |
|
6332 { |
|
6333 #ifdef SINGLE_CLICK_INCLUDED |
|
6334 aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue ); |
|
6335 #else |
|
6336 aMenuPane->SetItemDimmed( EMPXCmdRename, EFalse ); |
|
6337 #endif |
|
6338 } |
|
6339 #ifndef SINGLE_CLICK_INCLUDED |
|
6340 if ( category == EMPXAlbum ) |
|
6341 { |
|
6342 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, EFalse ); |
|
6343 // if unknown entry exist in album level, disable album art |
|
6344 // for last item, if unknown exist it'll be at this |
|
6345 // location |
|
6346 if ( array->IsCategoryUnknownExist() && |
|
6347 category == EMPXAlbum && |
|
6348 currentItem == iContainer->TotalListItemCount() - 1 ) |
|
6349 { |
|
6350 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue ); |
|
6351 } |
|
6352 if ( containerCategory == EMPXArtist ) |
|
6353 { |
|
6354 // in artist/album view, do not display album art/rename |
|
6355 // option on All ( first item in list ) |
|
6356 if ( currentItem == 0 ) |
|
6357 { |
|
6358 aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue ); |
|
6359 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue ); |
|
6360 } |
|
6361 } |
|
6362 } |
|
6363 else |
|
6364 #endif |
|
6365 { |
|
6366 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue ); |
|
6367 } |
|
6368 #ifdef SINGLE_CLICK_INCLUDED |
|
6369 if ( category == EMPXComposer ) |
|
6370 #else |
|
6371 if ( ( category == EMPXGenre ) || ( category == EMPXComposer ) ) |
|
6372 #endif |
|
6373 { |
|
6374 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue ); |
|
6375 } |
|
6376 #ifdef SINGLE_CLICK_INCLUDED |
|
6377 else if ( category == EMPXGenre ) |
|
6378 { |
|
6379 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, EFalse ); |
|
6380 } |
|
6381 #endif |
|
6382 else |
|
6383 { |
|
6384 if ( array->IsCategoryUnknownExist() && |
|
6385 ( category == EMPXAlbum || category == EMPXArtist ) && |
|
6386 currentItem == iContainer->TotalListItemCount() - 1 ) |
|
6387 { |
|
6388 // if unknown entry exist in artist or album level |
|
6389 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue ); |
|
6390 } |
|
6391 else |
|
6392 { |
|
6393 #ifdef SINGLE_CLICK_INCLUDED |
|
6394 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue ); |
|
6395 #else |
|
6396 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, EFalse ); |
|
6397 #endif |
|
6398 } |
|
6399 } |
|
6400 aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue ); |
|
6401 |
|
6402 if ( !iUsingNokiaService ) |
|
6403 { |
|
6404 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue ); |
|
6405 } |
|
6406 break; |
|
6407 } |
|
6408 case EMPXSong: |
|
6409 { |
|
6410 // any tracks view |
|
6411 #ifdef __ENABLE_MSK |
|
6412 // show context menu if MSK selected and there are |
|
6413 // multiple selections; otherwise, show options menu |
|
6414 if ( ( selectionCount > 0 ) && iShowContextMenu ) |
|
6415 { |
|
6416 MenuBar()->SetMenuType(CEikMenuBar::EMenuContext); |
|
6417 iShowContextMenu = EFalse; |
|
6418 } |
|
6419 else |
|
6420 { |
|
6421 MenuBar()->SetMenuType(CEikMenuBar::EMenuOptions); |
|
6422 } |
|
6423 #endif //__ENABLE_MSK |
|
6424 |
|
6425 if ( selectionCount > 0 ) |
|
6426 { |
|
6427 // multiple selection |
|
6428 aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue ); |
|
6429 aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue ); |
|
6430 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue ); |
|
6431 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue ); |
|
6432 } |
|
6433 else |
|
6434 { |
|
6435 TBool fileDetailVisibility( FileDetailsOptionVisibilityL() ); |
|
6436 // use the same criteria for showing/hiding song details |
|
6437 // and album art |
|
6438 aMenuPane->SetItemDimmed( EMPXCmdSongDetails, |
|
6439 fileDetailVisibility ); |
|
6440 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, |
|
6441 fileDetailVisibility ); |
|
6442 #ifdef SINGLE_CLICK_INCLUDED |
|
6443 aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue ); |
|
6444 #else |
|
6445 TBool vis = ETrue; |
|
6446 TRAPD( err, vis = SetAsRingToneOptionVisibilityL() ); |
|
6447 |
|
6448 if ( err ) |
|
6449 { |
|
6450 aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, |
|
6451 ETrue); // dim the option if any sql error. |
|
6452 } |
|
6453 else |
|
6454 { |
|
6455 aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, |
|
6456 vis); |
|
6457 } |
|
6458 #endif |
|
6459 |
|
6460 if ( array->IsItemBrokenLinkL( currentItem ) || |
|
6461 array->IsItemCorruptedL( currentItem ) ) |
|
6462 { |
|
6463 aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue ); |
|
6464 aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue ); |
|
6465 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue ); |
|
6466 } |
|
6467 else // Show this option even when song is DRM protected |
|
6468 { |
|
6469 #ifdef SINGLE_CLICK_INCLUDED |
|
6470 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue ); |
|
6471 #else |
|
6472 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, EFalse ); |
|
6473 #endif |
|
6474 } |
|
6475 } |
|
6476 aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue ); |
|
6477 aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue ); |
|
6478 if ( !iUsingNokiaService ) |
|
6479 { |
|
6480 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue ); |
|
6481 } |
|
6482 if (iServiceHandler->HandleSubmenuL(*aMenuPane)) |
|
6483 { |
|
6484 return; |
|
6485 } |
|
6486 break; |
|
6487 } |
|
6488 case EMPXCommand: |
|
6489 { |
|
6490 aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue ); |
|
6491 aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue ); |
|
6492 aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue ); |
|
6493 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue ); |
|
6494 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue ); |
|
6495 aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue ); |
|
6496 |
|
6497 } |
|
6498 break; |
|
6499 default: |
|
6500 { |
|
6501 // other types, not handled |
|
6502 break; |
|
6503 } |
|
6504 } |
|
6505 } |
|
6506 } |
|
6507 else |
|
6508 { |
|
6509 // list empty |
|
6510 aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue ); |
|
6511 aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue ); |
|
6512 aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue ); |
|
6513 aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue ); |
|
6514 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue ); |
|
6515 aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue ); |
|
6516 } |
|
6517 aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden ); |
|
6518 break; |
|
6519 } |
|
6520 case R_MPX_ADD_TO_PL_SUB_MENU: |
|
6521 { |
|
6522 aMenuPane->SetItemDimmed( EMPXCmdAddToSavedPlaylist, !FindPlaylistsL() ); |
|
6523 break; |
|
6524 } |
|
6525 case R_MPX_COLLECTION_PLAY_VIA_SUB_MENU: |
|
6526 { |
|
6527 if ( iUpnpFrameworkSupport ) |
|
6528 { |
|
6529 AddPlayersNamesToMenuL( *aMenuPane ); |
|
6530 } |
|
6531 break; |
|
6532 } |
|
6533 case R_MPX_COLLECTION_VIEW_MUSIC_MENU: |
|
6534 { |
|
6535 MMPXPlaybackUtility* pdPlaybackUtility; |
|
6536 pdPlaybackUtility = MMPXPlaybackUtility::UtilityL( TUid::Uid( KProgressDownloadUid ) ); |
|
6537 MMPXSource* pdsource( pdPlaybackUtility->Source() ); |
|
6538 MMPXSource* source( iPlaybackUtility->Source() ); |
|
6539 TBool hideNowPlaying; |
|
6540 hideNowPlaying = ( (pdsource == 0) |
|
6541 && (source == 0)); |
|
6542 pdPlaybackUtility->Close(); |
|
6543 if ( hideNowPlaying ) |
|
6544 { |
|
6545 aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue ); |
|
6546 } |
|
6547 if (usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive) |
|
6548 { |
|
6549 aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue ); |
|
6550 } |
|
6551 aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden ); |
|
6552 aMenuPane->SetItemDimmed( |
|
6553 EMPXCmdGoToMusicShop, iGoToMusicShopOptionHidden ); |
|
6554 if (iOperatorMusicStore) |
|
6555 { |
|
6556 aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue); |
|
6557 } |
|
6558 else |
|
6559 { |
|
6560 aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue); |
|
6561 } |
|
6562 break; |
|
6563 } |
|
6564 case R_MPX_COLLECTION_VIEW_EMBEDDED_PLAYLIST_VIEW: |
|
6565 { |
|
6566 // if it's from browser/messaging, display save option if |
|
6567 // it has not been saved |
|
6568 aMenuPane->SetItemDimmed( EMPXCmdSavePlaylist, |
|
6569 ( !iCommonUiHelper->IsHostMessagingBrowserL() || !MPXTlsHelper::NeedSave() ) ); |
|
6570 aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, isListEmpty ); |
|
6571 |
|
6572 break; |
|
6573 } |
|
6574 case R_MPX_PLAYBACK_COLLECTION_MUSICSHOP_SUB_MENU: |
|
6575 { |
|
6576 aMenuPane->SetItemTextL(EMPXCmdGoToOperatorMusicShop, iOperatorMusicStoreName->Des() ); |
|
6577 break; |
|
6578 } |
|
6579 case R_AVKON_MENUPANE_MARKABLE_LIST: |
|
6580 { |
|
6581 // Mark/Unmark submenu is displayed only if USB is on going |
|
6582 if (usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive) |
|
6583 { |
|
6584 MPX_DEBUG1("CMPXCollectionViewHgImp::DynInitMenuPaneL() dimmed Mark/Unmark submenu"); |
|
6585 aMenuPane->SetItemDimmed(EAknCmdEditListMenu, ETrue); |
|
6586 } |
|
6587 break; |
|
6588 } |
|
6589 default: |
|
6590 { |
|
6591 // Do nothing |
|
6592 break; |
|
6593 } |
|
6594 } |
|
6595 |
|
6596 #ifndef SINGLE_CLICK_INCLUDED |
|
6597 if ( iServiceHandler->IsAiwMenu(aResourceId) && aResourceId == R_MPX_USE_AS_CASCADE ) |
|
6598 { |
|
6599 MPX_DEBUG1( "CMPXCollectionViewHgImp::DynInitMenuPaneL(): Aiw menu for assign" ); |
|
6600 CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
6601 FillAiwParametersL(paramList); |
|
6602 iServiceHandler->InitializeMenuPaneL(*aMenuPane, |
|
6603 aResourceId, |
|
6604 EMPXCmdAiwCmdAssign, |
|
6605 paramList); |
|
6606 MPX_DEBUG1( "CMPXCollectionViewHgImp::DynInitMenuPaneL(): Aiw menu for assign end" ); |
|
6607 } |
|
6608 #endif |
|
6609 |
|
6610 if (!(aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST && usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive)) |
|
6611 { |
|
6612 // Custom handling of menu pane for markable lists |
|
6613 iContainer->HandleMarkableListDynInitMenuPane( |
|
6614 aResourceId, |
|
6615 aMenuPane ); |
|
6616 } |
|
6617 } |
|
6618 |
|
6619 // --------------------------------------------------------------------------- |
|
6620 // From MEikListBoxObserver |
|
6621 // Handles listbox events. |
|
6622 // --------------------------------------------------------------------------- |
|
6623 // |
|
6624 void CMPXCollectionViewHgImp::HandleListBoxEventL( |
|
6625 CEikListBox* /*aListBox*/, |
|
6626 TListBoxEvent aEventType) |
|
6627 { |
|
6628 MPX_FUNC( "CMPXCollectionViewHgImp::HandleListBoxEventL" ); |
|
6629 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleListBoxEventL iLastDepth = %d", iLastDepth ); |
|
6630 MPX_PERF_CHECKPT( "Select collection item to open" ); |
|
6631 if ( iContainer ) |
|
6632 { |
|
6633 //to keep/change focus on right song in rename/remove |
|
6634 #ifdef SINGLE_CLICK_INCLUDED |
|
6635 if ( aEventType == EEventItemSingleClicked ) |
|
6636 #else |
|
6637 if ( aEventType == EEventItemClicked ) |
|
6638 #endif |
|
6639 { |
|
6640 if ( !iHandlingKeyEvent && iCollectionCacheReady ) |
|
6641 { |
|
6642 CMPXCommonListBoxArrayBase* listboxArray( iContainer->ListBoxArray() ); |
|
6643 TInt currentIndex( iContainer->CurrentLbxItemIndex() ); |
|
6644 |
|
6645 CMPXCommand* command = CMPXCommand::NewL(); |
|
6646 CleanupStack::PushL( command ); |
|
6647 command->SetTObjectValueL<TMPXCommandId>( KMPXCommandGeneralId, |
|
6648 KMPXCommandIdCollectionSelect ); |
|
6649 command->SetTObjectValueL( KMPXCommandCollectionSelectIndex, currentIndex ); |
|
6650 command->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
6651 iCollectionUtility->Collection().CommandL( *command ); |
|
6652 CleanupStack::PopAndDestroy( command ); |
|
6653 } |
|
6654 } |
|
6655 |
|
6656 if ( aEventType == EEventEnterKeyPressed || aEventType == EEventItemDoubleClicked |
|
6657 #ifdef SINGLE_CLICK_INCLUDED |
|
6658 || aEventType == EEventItemSingleClicked |
|
6659 #endif |
|
6660 ) |
|
6661 { |
|
6662 if ( iContainer->IsInReorderMode() ) |
|
6663 { |
|
6664 ProcessCommandL( iContainer->IsInReorderMode() ? |
|
6665 EMPXCmdReorderDrop : EMPXCmdReorderGrab ); |
|
6666 iIsGrabbed = !iIsGrabbed; |
|
6667 } |
|
6668 else if ( !iHandlingKeyEvent ) |
|
6669 { |
|
6670 TMPXPlaybackState pbState( iPlaybackUtility->StateL() ); |
|
6671 TBool isEqual( EFalse ); |
|
6672 if ( pbState == EPbStatePlaying || pbState == EPbStatePaused ) |
|
6673 { |
|
6674 // in currently playing view, check if current item is playing |
|
6675 if ( iContainer->CurrentLbxItemIndex() == |
|
6676 iContainer->PlaybackIndex() ) |
|
6677 { |
|
6678 isEqual = ETrue; |
|
6679 } |
|
6680 } |
|
6681 |
|
6682 if ( isEqual ) |
|
6683 { |
|
6684 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleListBoxEventL going to now playing view" ); |
|
6685 if ( pbState == EPbStatePaused ) |
|
6686 { |
|
6687 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleListBoxEventL resuming playback" ); |
|
6688 iPlaybackUtility->CommandL( EPbCmdPlay ); |
|
6689 } |
|
6690 HandleCommandL( EMPXCmdGoToNowPlaying ); |
|
6691 } |
|
6692 else |
|
6693 { |
|
6694 CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL(); |
|
6695 CleanupStack::PushL( cpath ); |
|
6696 if ( cpath->Levels() == ( iLastDepth + 1 ) ) |
|
6697 { |
|
6698 // navigated in one level |
|
6699 iLastDepth++; |
|
6700 iBottomIndex->AppendL( |
|
6701 iContainer->BottomLbxItemIndex() ); |
|
6702 } |
|
6703 else |
|
6704 { |
|
6705 // invalid path, rebuild with all 0 |
|
6706 iBottomIndex->Reset(); |
|
6707 iLastDepth = cpath->Levels(); |
|
6708 for ( TInt i = 0; i < iLastDepth; i++ ) |
|
6709 { |
|
6710 iBottomIndex->AppendL( 0 ); |
|
6711 } |
|
6712 } |
|
6713 CleanupStack::PopAndDestroy( cpath ); |
|
6714 TInt currentItem( iContainer->CurrentLbxItemIndex() ); |
|
6715 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleListBoxEventL Opening Item: %d", currentItem ); |
|
6716 |
|
6717 iHandlingKeyEvent = ETrue; |
|
6718 |
|
6719 // Needed to reset the status of iPreservedState |
|
6720 if ( EPbStateStopped == pbState ) |
|
6721 { |
|
6722 iPlaybackUtility->CommandL(EPbCmdResetPreserveState); |
|
6723 } |
|
6724 |
|
6725 #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU |
|
6726 // check to see if user has selected podcast item |
|
6727 if ( (iLastDepth == KMusicCollectionMenuLevel) && |
|
6728 (currentItem == KMusicMenuPodcastMenuItemIndex) && |
|
6729 !iDisablePodcasting ) |
|
6730 { |
|
6731 // open the podcast collection db plugin |
|
6732 iPodcast = ETrue; |
|
6733 CMPXCollectionPath* mainPodcastMenu = CMPXCollectionPath::NewL(); |
|
6734 CleanupStack::PushL( mainPodcastMenu ); |
|
6735 mainPodcastMenu->AppendL(KPodcastCollectionUid); |
|
6736 iCollectionUtility->Collection().OpenL( *mainPodcastMenu ); |
|
6737 iFirstIncrementalBatch = ETrue; |
|
6738 CleanupStack::PopAndDestroy( mainPodcastMenu ); |
|
6739 |
|
6740 // activate the podcast collection view |
|
6741 RArray<TUid> uids; |
|
6742 CleanupClosePushL( uids ); |
|
6743 uids.AppendL( TUid::Uid( KMPXPluginTypeCollectionUid ) ); |
|
6744 uids.AppendL( TUid::Uid( KPodcastCollectionUid )); |
|
6745 iViewUtility->ActivateViewL(uids); |
|
6746 |
|
6747 CleanupStack::PopAndDestroy( &uids ); |
|
6748 } |
|
6749 else |
|
6750 #endif |
|
6751 { |
|
6752 if(iCollectionCacheReady) |
|
6753 { |
|
6754 CMPXCommonListBoxArrayBase* listboxArray( iContainer->ListBoxArray() ); |
|
6755 TInt currentIndex( iContainer->CurrentLbxItemIndex() ); |
|
6756 const CMPXMedia& media( listboxArray->MediaL( currentIndex ) ); |
|
6757 TMPXGeneralType type( |
|
6758 media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) ); |
|
6759 TMPXGeneralCategory category( |
|
6760 media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) ); |
|
6761 if ( type != EMPXItem || category != EMPXSong ) |
|
6762 { |
|
6763 if ( type == EMPXGroup && category== EMPXSong ) |
|
6764 { |
|
6765 // dismiss for HGList |
|
6766 //StartWaitNoteL( EMPXImmediatelyOpeningNote ); |
|
6767 } |
|
6768 else |
|
6769 { |
|
6770 //do not show wait note if opening a song |
|
6771 // dismiss for HGList |
|
6772 //StartWaitNoteL( EMPXOpeningNote ); |
|
6773 } |
|
6774 } |
|
6775 iCollectionUtility->Collection().OpenL( currentItem ); |
|
6776 iFirstIncrementalBatch = ETrue; |
|
6777 } |
|
6778 } |
|
6779 |
|
6780 } |
|
6781 } |
|
6782 else |
|
6783 { |
|
6784 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleListBoxEventL Busy, ignoring command" ); |
|
6785 } |
|
6786 } |
|
6787 } |
|
6788 } |
|
6789 |
|
6790 // --------------------------------------------------------------------------- |
|
6791 // From MEikCommandObserver |
|
6792 // Processes user commands. |
|
6793 // --------------------------------------------------------------------------- |
|
6794 // |
|
6795 void CMPXCollectionViewHgImp::ProcessCommandL(TInt aCommandId) |
|
6796 { |
|
6797 MPX_FUNC( "CMPXCollectionViewHgImp::ProcessCommandL" ); |
|
6798 |
|
6799 switch( aCommandId ) |
|
6800 { |
|
6801 case EMPXCmdReorderDrop: |
|
6802 { |
|
6803 SaveCurrentPlaylistL(); |
|
6804 iContainer->ConfirmReorderL(); |
|
6805 DeactivateReorderGrabbedModeL( EFalse ); |
|
6806 SetNewCbaL( R_MPX_CUI_REORDER_GRAB_DONE_CBA ); |
|
6807 break; |
|
6808 } |
|
6809 case EMPXCmdReorderGrab: |
|
6810 { |
|
6811 SetNewCbaL( R_MPX_CUI_REORDER_DROP_CANCEL_CBA ); |
|
6812 ActivateReorderGrabbedModeL(); |
|
6813 break; |
|
6814 } |
|
6815 case EMPXCmdReorderCancel: |
|
6816 { |
|
6817 iCurrentHighlightedIndex = iContainer->GetOriginalIndex(); |
|
6818 MPX_DEBUG2( "CMPXCollectionViewHgImp::ProcessCommandL Setting iCurrentHighlightedIndex = %d", iCurrentHighlightedIndex ); |
|
6819 iContainer->CancelReorder(); |
|
6820 } // Fall through on purpose |
|
6821 case EMPXCmdReorderDone: |
|
6822 { |
|
6823 DeactivateReorderGrabbedModeL( ETrue ); |
|
6824 break; |
|
6825 } |
|
6826 case EMPXCmdUpArrow: |
|
6827 { |
|
6828 iIgnoreNextFocusChangedMessage = ETrue; |
|
6829 if ( iContainer->IsInReorderMode() ) |
|
6830 { |
|
6831 iContainer->MoveReorderIndex( KMPXDirectionUp ); |
|
6832 } |
|
6833 else |
|
6834 { |
|
6835 iDownCount = 0; |
|
6836 |
|
6837 if( iUpCount != KErrNotFound ) |
|
6838 { |
|
6839 if( iUpCount++ > KIncrementalDirectionCount ) |
|
6840 { |
|
6841 iIncrementalOpenUtil->SetDirection( CMPXCollectionOpenUtility::EFetchUp ); |
|
6842 iUpCount = KErrNotFound; |
|
6843 } |
|
6844 } |
|
6845 } |
|
6846 break; |
|
6847 } |
|
6848 case EMPXCmdDownArrow: |
|
6849 { |
|
6850 iIgnoreNextFocusChangedMessage = ETrue; |
|
6851 if ( iContainer->IsInReorderMode() ) |
|
6852 { |
|
6853 iContainer->MoveReorderIndex( KMPXDirectionDown ); |
|
6854 } |
|
6855 else |
|
6856 { |
|
6857 iUpCount = 0; |
|
6858 |
|
6859 if( iDownCount != KErrNotFound ) |
|
6860 { |
|
6861 if( iDownCount++ > KIncrementalDirectionCount ) |
|
6862 { |
|
6863 iIncrementalOpenUtil->SetDirection( CMPXCollectionOpenUtility::EFetchDown ); |
|
6864 iDownCount = KErrNotFound; |
|
6865 } |
|
6866 |
|
6867 } |
|
6868 } |
|
6869 break; |
|
6870 } |
|
6871 case EMPXCmdCommonEnterKey: |
|
6872 { |
|
6873 // Handle list box event for enter key pressed |
|
6874 TInt index( iContainer->CurrentLbxItemIndex() ); |
|
6875 if( index >= 0 ) |
|
6876 { |
|
6877 HandleListBoxEventL( |
|
6878 NULL, // ignore |
|
6879 EEventEnterKeyPressed ); |
|
6880 } |
|
6881 break; |
|
6882 } |
|
6883 |
|
6884 case EMPXCmdGoToNowPlaying: |
|
6885 { |
|
6886 HandleCommandL( aCommandId ); |
|
6887 break; |
|
6888 } |
|
6889 case EMPXCmdUpArrowAfterListboxHandled: |
|
6890 { |
|
6891 if ( iContainer->IsInReorderMode() ) |
|
6892 { |
|
6893 TInt index( iContainer->CurrentLbxItemIndex() ); |
|
6894 if ( index == iContainer->CurrentListItemCount() - 1 ) |
|
6895 { |
|
6896 // if after up arrow is pressed, and end up at the |
|
6897 // lowest index. list box looped, sync with listboxarray needed |
|
6898 iContainer->SetReorderIndex( index ); |
|
6899 iContainer->HandleLbxItemAdditionL(); |
|
6900 // need to set index and redraw |
|
6901 iContainer->SetLbxCurrentItemIndexAndDraw( index ); |
|
6902 } |
|
6903 UpdateReorderNaviPaneL(); |
|
6904 } |
|
6905 break; |
|
6906 } |
|
6907 case EMPXCmdDownArrowAfterListboxHandled: |
|
6908 { |
|
6909 if ( iContainer->IsInReorderMode() ) |
|
6910 { |
|
6911 TInt index( iContainer->CurrentLbxItemIndex() ); |
|
6912 if ( index == 0 ) |
|
6913 { |
|
6914 // if after down arrow is pressed, and end up at the |
|
6915 // top index. list box looped, sync with listboxarray needed |
|
6916 iContainer->SetReorderIndex( index ); |
|
6917 iContainer->HandleLbxItemAdditionL(); |
|
6918 } |
|
6919 UpdateReorderNaviPaneL(); |
|
6920 } |
|
6921 break; |
|
6922 } |
|
6923 case EMPXCmdCommonDelete: |
|
6924 { |
|
6925 if ( !iIsEmbedded ) |
|
6926 { |
|
6927 StoreListboxItemIndexL(); |
|
6928 // embedded mode doesn't support delete key |
|
6929 DeleteSelectedItemsL(aCommandId); |
|
6930 } |
|
6931 break; |
|
6932 } |
|
6933 case EMPXCmdCommonResourceChange: |
|
6934 { |
|
6935 iContainer->SetRect( ClientRect() ); |
|
6936 break; |
|
6937 } |
|
6938 case EAknSoftkeyEmpty: |
|
6939 { |
|
6940 // do nothing. handled to avoid "unsupported" message |
|
6941 break; |
|
6942 } |
|
6943 #ifdef __ENABLE_MSK |
|
6944 case EMPXCmdCommonUpdateMiddleSoftKey: |
|
6945 { |
|
6946 // Determine middle soft key labeling |
|
6947 UpdateMiddleSoftKeyDisplayL( iCurrentMskId ); |
|
6948 break; |
|
6949 } |
|
6950 case EAknSoftkeyContextOptions : |
|
6951 { |
|
6952 // set context menu flag |
|
6953 iShowContextMenu = ETrue; |
|
6954 // open context menu (by processing "Options" command) |
|
6955 if ( iContainer ) |
|
6956 { |
|
6957 iSelectionIndexCache = iContainer->CurrentSelectionIndicesL(); // not owned |
|
6958 MPX_DEBUG2( "CMPXCollectionViewHgImp::ProcessCommandL count = %d", iSelectionIndexCache->Count() ); |
|
6959 } |
|
6960 CAknView::ProcessCommandL( EAknSoftkeyOptions ); |
|
6961 break; |
|
6962 } |
|
6963 #endif // __ENABLE_MSK |
|
6964 case EAknCmdExit: |
|
6965 { |
|
6966 HandleCommandL( aCommandId ); |
|
6967 CAknView::ProcessCommandL( aCommandId ); |
|
6968 break; |
|
6969 } |
|
6970 case EAknSoftkeyOptions: |
|
6971 { |
|
6972 if ( iContainer ) |
|
6973 { |
|
6974 iSelectionIndexCache = iContainer->CurrentSelectionIndicesL(); // not owned |
|
6975 MPX_DEBUG2( "CMPXCollectionViewHgImp::ProcessCommandL count = %d", iSelectionIndexCache->Count() ); |
|
6976 } |
|
6977 } |
|
6978 default: |
|
6979 { |
|
6980 CAknView::ProcessCommandL( aCommandId ); |
|
6981 break; |
|
6982 } |
|
6983 } |
|
6984 } |
|
6985 |
|
6986 // ----------------------------------------------------------------------------- |
|
6987 // CMPXCollectionViewHgImp::LaunchMusicShopL |
|
6988 // Launch music shop application |
|
6989 // ----------------------------------------------------------------------------- |
|
6990 // |
|
6991 void CMPXCollectionViewHgImp::LaunchMusicShopL() |
|
6992 { |
|
6993 MPX_FUNC( "CMPXCollectionViewHgImp::LaunchMusicShopL" ); |
|
6994 |
|
6995 if ( iMusicStoreUID != 0) |
|
6996 { |
|
6997 TApaTaskList tasList( iCoeEnv->WsSession() ); |
|
6998 TApaTask task = tasList.FindApp( TUid::Uid(iMusicStoreUID) ); |
|
6999 |
|
7000 if ( task.Exists() ) |
|
7001 { |
|
7002 task.BringToForeground(); |
|
7003 } |
|
7004 else |
|
7005 { |
|
7006 RApaLsSession session; |
|
7007 if ( KErrNone == session.Connect() ) |
|
7008 { |
|
7009 CleanupClosePushL( session ); |
|
7010 TThreadId threadId; |
|
7011 session.CreateDocument( KNullDesC, TUid::Uid(iMusicStoreUID), threadId ); |
|
7012 CleanupStack::PopAndDestroy(&session); |
|
7013 } |
|
7014 } |
|
7015 } |
|
7016 } |
|
7017 |
|
7018 |
|
7019 // ----------------------------------------------------------------------------- |
|
7020 // CMPlayerCategoryView::DoFindInMusicShopL |
|
7021 // Handle find in music shop event |
|
7022 // ----------------------------------------------------------------------------- |
|
7023 // |
|
7024 void CMPXCollectionViewHgImp::DoFindInMusicShopL( const TDesC& aSongName, |
|
7025 const TDesC& aArtistName, |
|
7026 const TDesC& aAlbumName ) |
|
7027 { |
|
7028 MPX_FUNC( "CMPXCollectionViewHgImp::DoFindInMusicShopL" ); |
|
7029 CMPXFindInMShop* finder = CMPXFindInMShop::NewL(); |
|
7030 CleanupStack::PushL( finder ); |
|
7031 HBufC* url = NULL; |
|
7032 url = finder->CreateSearchURLL( aSongName, |
|
7033 aArtistName, |
|
7034 aAlbumName, |
|
7035 KNullDesC, // Composer - Not used |
|
7036 KNullDesC ); // Genre - Not used |
|
7037 CleanupStack::PushL(url); // the pointer will be poped |
|
7038 RProperty::Set( TUid::Uid(iMusicStoreUID), |
|
7039 KMShopCategoryId, |
|
7040 KFindInMShopKeyValid ); // Set Key to Valid |
|
7041 |
|
7042 RProperty::Set( TUid::Uid(iMusicStoreUID), |
|
7043 KMShopCategoryName, |
|
7044 *url ); |
|
7045 |
|
7046 LaunchMusicShopL(); |
|
7047 |
|
7048 |
|
7049 if(url) |
|
7050 { |
|
7051 CleanupStack::PopAndDestroy(url); |
|
7052 } |
|
7053 |
|
7054 CleanupStack::PopAndDestroy( finder ); // finder |
|
7055 REComSession::FinalClose(); |
|
7056 } |
|
7057 |
|
7058 |
|
7059 // ---------------------------------------------------------------------------- |
|
7060 // CMPXCollectionViewHgImp::SetParamL |
|
7061 // Set the parameter passed in from viewframework to the current select index |
|
7062 // ---------------------------------------------------------------------------- |
|
7063 // |
|
7064 void CMPXCollectionViewHgImp::SetParamL( const TDesC* aParam ) |
|
7065 { |
|
7066 MPX_FUNC( "CMPXCollectionViewHgImp::SetParamL" ); |
|
7067 delete iCurrentSelectedIndex; |
|
7068 iCurrentSelectedIndex = NULL; |
|
7069 iCurrentSelectedIndex = aParam->AllocL(); // aParam = L"0" for 1st item |
|
7070 } |
|
7071 |
|
7072 |
|
7073 // ----------------------------------------------------------------------------- |
|
7074 // CMPlayerCategoryView::DoGetSongMediaPropertyL |
|
7075 // Handle find in music shop event |
|
7076 // ----------------------------------------------------------------------------- |
|
7077 // |
|
7078 void CMPXCollectionViewHgImp::DoGetSongMediaPropertyL() |
|
7079 { |
|
7080 MPX_FUNC( "CMPXCollectionViewHgImp::DoGetSongMediaPropertyL" ); |
|
7081 |
|
7082 if ( iCurrentSelectedIndex ) |
|
7083 { |
|
7084 TLex currentSelectedIndexLex( iCurrentSelectedIndex->Des() ); |
|
7085 TInt lexToInt = NULL; |
|
7086 if ( currentSelectedIndexLex.Val( lexToInt ) == KErrNone ) |
|
7087 { |
|
7088 // Get media property for the current song |
|
7089 CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL(); |
|
7090 CleanupStack::PushL( cpath ); |
|
7091 |
|
7092 cpath->Set( lexToInt ); |
|
7093 RArray<TMPXAttribute> attrs; |
|
7094 CleanupClosePushL(attrs); |
|
7095 // to get EMPXMediaGeneralTitle |
|
7096 attrs.Append( KMPXMediaGeneralTitle ); |
|
7097 // to get EMPXMediaMusicArtist and EMPXMediaMusicAlbum |
|
7098 attrs.Append( KMPXMediaMusicArtist ); |
|
7099 attrs.Append( KMPXMediaMusicAlbum ); |
|
7100 |
|
7101 // Call MediaL and handle callback at HandleCollectionMediaL |
|
7102 iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() ); |
|
7103 CleanupStack::PopAndDestroy( &attrs ); |
|
7104 CleanupStack::PopAndDestroy( cpath ); |
|
7105 } |
|
7106 } |
|
7107 |
|
7108 } |
|
7109 |
|
7110 // ----------------------------------------------------------------------------- |
|
7111 // CMPXCollectionViewHgImp::HandleFindAllL |
|
7112 // Handle callback for "find" operation |
|
7113 // ----------------------------------------------------------------------------- |
|
7114 // |
|
7115 void CMPXCollectionViewHgImp::HandleFindAllL( |
|
7116 const CMPXMedia& aResults, |
|
7117 TBool aComplete, |
|
7118 TInt aError ) |
|
7119 { |
|
7120 MPX_FUNC( "CMPXCollectionViewHgImp::HandleFindAllL" ); |
|
7121 if ( aError == KErrNone ) |
|
7122 { |
|
7123 switch ( iCurrentFindAllLOp ) |
|
7124 { |
|
7125 case EMPXOpFindAllLAlbumArtistAddToNewPlaylist: |
|
7126 { |
|
7127 iNumSongAddedToPlaylist = aResults.ValueTObjectL<TInt>( |
|
7128 KMPXMediaArrayCount ); |
|
7129 TBool ret = iCommonUiHelper->CreatePlaylistL( |
|
7130 aResults, this, this ); |
|
7131 if ( !ret ) |
|
7132 { |
|
7133 iAddingToNewPlaylist = EFalse; |
|
7134 } |
|
7135 break; |
|
7136 } |
|
7137 case EMPXOpFindAllLAlbumArtistAddToSavedPlaylist: |
|
7138 { |
|
7139 if ( !iUserPlaylists ) |
|
7140 { |
|
7141 MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleFindAllL Null iUserPlaylists" ); |
|
7142 User::Leave( KErrArgument ); |
|
7143 } |
|
7144 iNumSongAddedToPlaylist = aResults.ValueTObjectL<TInt>( |
|
7145 KMPXMediaArrayCount ); |
|
7146 MPX_TRAPD( err, iCommonUiHelper->AddToSavedPlaylistL( |
|
7147 *iUserPlaylists, aResults, this, this ) ); |
|
7148 if ( err != KErrNone ) |
|
7149 { |
|
7150 HandleError( err ); |
|
7151 } |
|
7152 break; |
|
7153 } |
|
7154 case EMPXOpFindAllLRenameAlbum: |
|
7155 case EMPXOpFindAllLRenameArtist: |
|
7156 case EMPXOpFindAllLRenameGenre: |
|
7157 case EMPXOpFindAllLRenameComposer: |
|
7158 { |
|
7159 const CMPXMediaArray* mediaArray = |
|
7160 aResults.Value<CMPXMediaArray>( KMPXMediaArrayContents ); |
|
7161 User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray)); |
|
7162 |
|
7163 iSetMediaLCount = mediaArray->Count(); |
|
7164 iInvalidFileExist = EFalse; |
|
7165 TInt invalidItemCount( 0 ); |
|
7166 MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleFindAllL Rename song count = %d", iSetMediaLCount ); |
|
7167 iIsWaitNoteCanceled = EFalse; |
|
7168 HBufC* waitNoteString( NULL ); |
|
7169 if ( iSetMediaLCount > 1 ) |
|
7170 { |
|
7171 // multiple item |
|
7172 waitNoteString = StringLoader::LoadLC( |
|
7173 R_MPX_COLLECTION_NOTE_UPDATING_MULTIPLE_ITEMS, |
|
7174 iSetMediaLCount ); |
|
7175 } |
|
7176 else |
|
7177 { |
|
7178 // single item |
|
7179 waitNoteString = StringLoader::LoadLC( |
|
7180 R_MPX_COLLECTION_NOTE_UPDATING_ITEM ); |
|
7181 } |
|
7182 HandleCommandL( EMPXCmdIgnoreExternalCommand ); |
|
7183 iCommonUiHelper->ShowWaitNoteL( *waitNoteString, |
|
7184 R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP, EFalse, this ); |
|
7185 CleanupStack::PopAndDestroy( waitNoteString ); |
|
7186 |
|
7187 TPtrC art( KNullDesC ); |
|
7188 if ( (iCurrentFindAllLOp == EMPXOpFindAllLRenameAlbum || iCurrentFindAllLOp == EMPXOpFindAllLRenameArtist )&& |
|
7189 iContainer ) |
|
7190 { |
|
7191 CMPXCommonListBoxArrayBase* listboxArray( |
|
7192 iContainer->ListBoxArray() ); |
|
7193 TInt currentIndex( iContainer->CurrentLbxItemIndex() ); |
|
7194 const CMPXMedia& currentMedia( listboxArray->MediaL( currentIndex ) ); |
|
7195 if ( currentMedia.IsSupported( KMPXMediaMusicAlbumArtFileName ) ) |
|
7196 { |
|
7197 art.Set( currentMedia.ValueText( KMPXMediaMusicAlbumArtFileName ) ); |
|
7198 } |
|
7199 } |
|
7200 |
|
7201 CMPXMediaArray* entryArray = CMPXMediaArray::NewL(); |
|
7202 CleanupStack::PushL( entryArray ); |
|
7203 TUid collectionId( KNullUid ); |
|
7204 for ( TInt i = 0; i < iSetMediaLCount && !iIsWaitNoteCanceled; i++ ) |
|
7205 { |
|
7206 CMPXMedia* media( mediaArray->AtL( i ) ); |
|
7207 TUint flags( 0 ); |
|
7208 if( media->IsSupported( KMPXMediaGeneralFlags ) ) |
|
7209 { |
|
7210 flags = media->ValueTObjectL<TUint>( KMPXMediaGeneralFlags ); |
|
7211 } |
|
7212 const TDesC& songUri = |
|
7213 media->ValueText( KMPXMediaGeneralUri ); |
|
7214 TBool fileExist( ConeUtils::FileExists( songUri ) ); |
|
7215 if (!(flags & KMPXMediaGeneralFlagsIsInvalid) |
|
7216 && !(flags & KMPXMediaGeneralFlagsIsCorrupted) |
|
7217 && fileExist ) |
|
7218 { |
|
7219 CMPXMedia* entry = CMPXMedia::NewL(); |
|
7220 CleanupStack::PushL( entry ); |
|
7221 entry->SetTextValueL( KMPXMediaGeneralUri, songUri ); |
|
7222 TMPXItemId id( media->ValueTObjectL<TMPXItemId>( |
|
7223 KMPXMediaGeneralId ) ); |
|
7224 collectionId = media->ValueTObjectL<TUid>( |
|
7225 KMPXMediaGeneralCollectionId ); |
|
7226 entry->SetTObjectValueL<TMPXItemId>( |
|
7227 KMPXMediaGeneralId, id ); |
|
7228 entry->SetTObjectValueL<TUid>( |
|
7229 KMPXMediaGeneralCollectionId, collectionId ); |
|
7230 entry->SetTObjectValueL<TMPXGeneralType>( |
|
7231 KMPXMediaGeneralType, EMPXItem ); |
|
7232 entry->SetTObjectValueL<TMPXGeneralCategory>( |
|
7233 KMPXMediaGeneralCategory, EMPXSong ); |
|
7234 |
|
7235 TPtrC ptr( songUri ); |
|
7236 MPX_DEBUG3( "CMPXCollectionViewHgImp::HandleFindAllL setting item id 0x%x, uri %S", id.iId1, &ptr ); |
|
7237 switch ( iCurrentFindAllLOp ) |
|
7238 { |
|
7239 case EMPXOpFindAllLRenameAlbum: |
|
7240 { |
|
7241 if ( art.Compare( KNullDesC ) != 0 && |
|
7242 art.Compare( |
|
7243 media->ValueText( KMPXMediaMusicAlbumArtFileName ) ) == 0 ) |
|
7244 { |
|
7245 entry->SetTextValueL( |
|
7246 KMPXMediaMusicAlbumArtFileName, |
|
7247 art ); |
|
7248 } |
|
7249 entry->SetTextValueL( |
|
7250 KMPXMediaMusicAlbum, *iNewName ); |
|
7251 break; |
|
7252 } |
|
7253 case EMPXOpFindAllLRenameArtist: |
|
7254 { |
|
7255 if ( art.Compare( KNullDesC ) != 0 && |
|
7256 art.Compare( |
|
7257 media->ValueText( KMPXMediaMusicAlbumArtFileName ) ) == 0 ) |
|
7258 { |
|
7259 entry->SetTextValueL( |
|
7260 KMPXMediaMusicAlbumArtFileName, |
|
7261 art ); |
|
7262 } |
|
7263 entry->SetTextValueL( |
|
7264 KMPXMediaMusicArtist, *iNewName ); |
|
7265 break; |
|
7266 } |
|
7267 case EMPXOpFindAllLRenameGenre: |
|
7268 { |
|
7269 entry->SetTextValueL( |
|
7270 KMPXMediaMusicGenre, *iNewName ); |
|
7271 break; |
|
7272 } |
|
7273 case EMPXOpFindAllLRenameComposer: |
|
7274 { |
|
7275 entry->SetTextValueL( |
|
7276 KMPXMediaMusicComposer, *iNewName ); |
|
7277 break; |
|
7278 } |
|
7279 default: |
|
7280 { |
|
7281 // should not reach here |
|
7282 ASSERT( 0 ); |
|
7283 break; |
|
7284 } |
|
7285 } |
|
7286 if ( (iCurrentFindAllLOp == EMPXOpFindAllLRenameAlbum || iCurrentFindAllLOp == EMPXOpFindAllLRenameArtist) && |
|
7287 art.Compare( KNullDesC ) != 0 && |
|
7288 art.Compare( |
|
7289 media->ValueText( KMPXMediaMusicAlbumArtFileName ) ) == 0 ) |
|
7290 { |
|
7291 entryArray->InsertL( entry, 0 ); // ownership xfer |
|
7292 } |
|
7293 else |
|
7294 { |
|
7295 entryArray->AppendL( entry ); // ownership xfer |
|
7296 } |
|
7297 CleanupStack::Pop( entry ); |
|
7298 } |
|
7299 else |
|
7300 { |
|
7301 iInvalidFileExist = ETrue; |
|
7302 invalidItemCount++; |
|
7303 if ( !fileExist ) |
|
7304 { |
|
7305 UpdateDatabaseFlagL( KErrNotFound, *media, |
|
7306 KMPXMediaGeneralFlagsIsInvalid, ETrue, EFalse ); |
|
7307 } |
|
7308 } |
|
7309 } |
|
7310 // Package array of items to set |
|
7311 // |
|
7312 CMPXMedia* setData = CMPXMedia::NewL(); |
|
7313 CleanupStack::PushL( setData ); |
|
7314 setData->SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup ); |
|
7315 setData->SetCObjectValueL( KMPXMediaArrayContents, entryArray ); |
|
7316 |
|
7317 // Generate the command |
|
7318 // |
|
7319 CMPXCommand* command = CMPXCommand::NewL(); |
|
7320 CleanupStack::PushL( command ); |
|
7321 command->SetTObjectValueL<TMPXCommandId>( KMPXCommandGeneralId, |
|
7322 KMPXCommandIdCollectionSet ); |
|
7323 command->SetTObjectValueL<TInt>( KMPXCommandGeneralCollectionId, |
|
7324 collectionId.iUid); |
|
7325 command->SetCObjectValueL( KMPXCommandColSetMedia, setData ); |
|
7326 |
|
7327 iCollectionUtility->Collection().CommandL( *command ); |
|
7328 |
|
7329 // Cleanup |
|
7330 CleanupStack::PopAndDestroy( command ); |
|
7331 CleanupStack::PopAndDestroy( setData ); |
|
7332 CleanupStack::PopAndDestroy( entryArray ); |
|
7333 |
|
7334 iSetMediaLCount = 1; // 1 async set |
|
7335 MPX_DEBUG3( "CMPXCollectionViewHgImp::HandleFindAllL valid items = %d, invalid items = %d", iSetMediaLCount, invalidItemCount ); |
|
7336 if ( iSetMediaLCount == 0 ) |
|
7337 { |
|
7338 // if all items are invalid, display note |
|
7339 // now instead of waiting for callback |
|
7340 HandleRenameOpCompleteL(); |
|
7341 } |
|
7342 break; |
|
7343 } |
|
7344 case EMPXOpFindAllLPlaylistTracksCount: |
|
7345 { |
|
7346 TInt trackCount = aResults.ValueTObjectL<TInt>( KMPXMediaArrayCount ); |
|
7347 MPX_DEBUG2( "CMPXCollectionViewHgImp:: playlist tracks count = %d", trackCount ); |
|
7348 if ( trackCount == 0 ) |
|
7349 { |
|
7350 // empty playlist, display info note |
|
7351 HBufC* string = StringLoader::LoadLC( |
|
7352 R_MPX_COLLECTION_NOTE_EMPTY_PLAYLIST ); |
|
7353 iCommonUiHelper->DisplayInfoNoteL( *string ); |
|
7354 CleanupStack::PopAndDestroy( string ); |
|
7355 } |
|
7356 else |
|
7357 { |
|
7358 HandleCommandL( EMPXCmdForcePlay ); |
|
7359 } |
|
7360 break; |
|
7361 } |
|
7362 case EMPXOpFindAllLUpnp: |
|
7363 { |
|
7364 if ( iUpnpFrameworkSupport ) |
|
7365 { |
|
7366 DoHandleCopyToRemoteL( aResults, aComplete ); |
|
7367 } |
|
7368 break; |
|
7369 } |
|
7370 case EMPXOpFindAllLUpnpPlayback: |
|
7371 { |
|
7372 if ( iUpnpFrameworkSupport ) |
|
7373 { |
|
7374 TInt trackCount = aResults.ValueTObjectL<TInt>( KMPXMediaArrayCount ); |
|
7375 MPX_DEBUG2( "CMPXCollectionViewHgImp:: playlist tracks count = %d", trackCount ); |
|
7376 if ( trackCount > 0 ) |
|
7377 { |
|
7378 TInt currentListBoxItemIndex( |
|
7379 iContainer->CurrentLbxItemIndex() ); |
|
7380 if ( currentListBoxItemIndex >= 0 ) |
|
7381 { |
|
7382 GetCurrentPlayerDetails(); |
|
7383 |
|
7384 // Needed to reset the status of iPreservedState |
|
7385 if ( EPbStateStopped == iPlaybackUtility->StateL() ) |
|
7386 { |
|
7387 iPlaybackUtility->CommandL(EPbCmdResetPreserveState); |
|
7388 } |
|
7389 if(iCollectionCacheReady) |
|
7390 { |
|
7391 iCollectionUtility->Collection().OpenL( |
|
7392 currentListBoxItemIndex, |
|
7393 EMPXOpenPlaylistOnly); |
|
7394 iFirstIncrementalBatch = ETrue; |
|
7395 } |
|
7396 } |
|
7397 } |
|
7398 else |
|
7399 { |
|
7400 // empty playlist, display info note |
|
7401 HBufC* string = StringLoader::LoadLC( |
|
7402 R_MPX_COLLECTION_NOTE_EMPTY_PLAYLIST ); |
|
7403 iCommonUiHelper->DisplayInfoNoteL( *string ); |
|
7404 CleanupStack::PopAndDestroy( string ); |
|
7405 } |
|
7406 } |
|
7407 break; |
|
7408 } |
|
7409 default: |
|
7410 { |
|
7411 // should not reach here |
|
7412 break; |
|
7413 } |
|
7414 } |
|
7415 } |
|
7416 else |
|
7417 { |
|
7418 HandleError( aError ); |
|
7419 } |
|
7420 iCurrentFindAllLOp = EMPXOpFindAllLIdle; |
|
7421 |
|
7422 if ( !iUpnpFrameworkSupport ) |
|
7423 { |
|
7424 // Remove compilation warnings |
|
7425 (void)aComplete; |
|
7426 } |
|
7427 } |
|
7428 |
|
7429 // ----------------------------------------------------------------------------- |
|
7430 // CMPXCollectionViewHgImp::HandleViewActivation |
|
7431 // Handle view activation |
|
7432 // ----------------------------------------------------------------------------- |
|
7433 // |
|
7434 void CMPXCollectionViewHgImp::HandleViewActivation( |
|
7435 const TUid& aCurrentViewType, |
|
7436 const TUid& /*aPreviousViewType*/ ) |
|
7437 { |
|
7438 MPX_FUNC( "CMPXCollectionViewHgImp::HandleViewActivation" ); |
|
7439 |
|
7440 if ( aCurrentViewType.iUid == KMPXPluginTypeCollectionUid ) |
|
7441 { |
|
7442 if( iAddingSong ) |
|
7443 { |
|
7444 iAddingSong = EFalse; |
|
7445 TRAP_IGNORE( GetDurationL() ); |
|
7446 TRAP_IGNORE( UpdateNaviPaneL() ); |
|
7447 } |
|
7448 if( iInAlbumArtDialog ) |
|
7449 { |
|
7450 iInAlbumArtDialog = EFalse; |
|
7451 TRAP_IGNORE( UpdateTitlePaneL() ); |
|
7452 } |
|
7453 if( iInSongDetails ) |
|
7454 { |
|
7455 iInSongDetails = EFalse; |
|
7456 } |
|
7457 } |
|
7458 } |
|
7459 |
|
7460 // ----------------------------------------------------------------------------- |
|
7461 // CMPXCollectionViewHgImp::HandleViewUpdate |
|
7462 // ----------------------------------------------------------------------------- |
|
7463 // |
|
7464 void CMPXCollectionViewHgImp::HandleViewUpdate( |
|
7465 TUid /* aViewUid */, |
|
7466 MMPXViewActivationObserver::TViewUpdateEvent /* aUpdateEvent */, |
|
7467 TBool /* aLoaded */, |
|
7468 TInt /* aData */) |
|
7469 { |
|
7470 // Do nothing, this should be handled by the AppUI |
|
7471 } |
|
7472 |
|
7473 // ----------------------------------------------------------------------------- |
|
7474 // CMPXCollectionViewHgImp::HandleViewActivation |
|
7475 // ----------------------------------------------------------------------------- |
|
7476 // |
|
7477 void CMPXCollectionViewHgImp::HandleViewActivation(const TVwsViewId& aNewlyActivatedViewId, |
|
7478 const TVwsViewId& /*aViewIdToBeDeactivated */) |
|
7479 { |
|
7480 if( aNewlyActivatedViewId.iAppUid == TUid::Uid(KMusicPlayerAppUidConstant) && |
|
7481 aNewlyActivatedViewId.iViewUid == Id() ) |
|
7482 { |
|
7483 TRAP_IGNORE( UpdateNaviPaneL() ); |
|
7484 } |
|
7485 } |
|
7486 |
|
7487 // ----------------------------------------------------------------------------- |
|
7488 // CMPXCollectionViewHgImp::HandleViewDeactivation |
|
7489 // ----------------------------------------------------------------------------- |
|
7490 // |
|
7491 void CMPXCollectionViewHgImp::HandleViewDeactivation(const TVwsViewId& aViewIdToBeDeactivated, |
|
7492 const TVwsViewId& /*aNewlyActivatedViewId*/) |
|
7493 { |
|
7494 if( aViewIdToBeDeactivated.iAppUid == TUid::Uid(KMusicPlayerAppUidConstant) && |
|
7495 aViewIdToBeDeactivated.iViewUid == Id() ) |
|
7496 { |
|
7497 if( iContainer ) |
|
7498 { |
|
7499 if ( iNaviPane && iNaviDecorator ) |
|
7500 { |
|
7501 if (iNaviPane->Top() == iNaviDecorator) // Only pop if it's the top, don't pop when it's behind a dialog |
|
7502 iNaviPane->Pop( iNaviDecorator ); |
|
7503 } |
|
7504 } |
|
7505 } |
|
7506 } |
|
7507 |
|
7508 // ----------------------------------------------------------------------------- |
|
7509 // CMPXCollectionViewHgImp::FillAiwParameters |
|
7510 // ----------------------------------------------------------------------------- |
|
7511 // |
|
7512 void CMPXCollectionViewHgImp::FillAiwParametersL( |
|
7513 CAiwGenericParamList& aParamList ) |
|
7514 { |
|
7515 CMPXCommonListBoxArrayBase* array( iContainer->ListBoxArray() ); |
|
7516 const CMPXMedia& media = array->MediaL( |
|
7517 iContainer->CurrentLbxItemIndex() ); |
|
7518 TPtrC location( media.ValueText(KMPXMediaGeneralUri) ); |
|
7519 TPtrC mimeType( media.ValueText(KMPXMediaGeneralMimeType) ); |
|
7520 |
|
7521 if ( !location.Length() ) |
|
7522 { |
|
7523 if ( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId ) |
|
7524 { |
|
7525 // highlighted item is not yet available |
|
7526 MPX_DEBUG1( "CMPXCollectionViewHgImp::FillAiwParametersL item not yet fetched" ); |
|
7527 User::Leave( KMPXErrDataNotReady ); |
|
7528 } |
|
7529 else |
|
7530 { |
|
7531 TMPXItemId id( |
|
7532 media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
7533 CMPXMedia* criteria = CMPXMedia::NewL(); |
|
7534 CleanupStack::PushL( criteria ); |
|
7535 criteria->SetTObjectValueL<TMPXGeneralType>( |
|
7536 KMPXMediaGeneralType, EMPXItem ); |
|
7537 criteria->SetTObjectValueL<TMPXGeneralCategory>( |
|
7538 KMPXMediaGeneralCategory, EMPXSong ); |
|
7539 criteria->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id ); |
|
7540 |
|
7541 RArray<TMPXAttribute> attrs; |
|
7542 CleanupClosePushL( attrs ); |
|
7543 attrs.Append( KMPXMediaGeneralUri ); |
|
7544 attrs.Append( KMPXMediaGeneralMimeType ); |
|
7545 |
|
7546 CMPXMedia* songInfo = iCollectionUtility->Collection().FindAllL( *criteria, |
|
7547 attrs.Array() ); |
|
7548 CleanupStack::PopAndDestroy( &attrs ); |
|
7549 CleanupStack::PushL( songInfo ); |
|
7550 |
|
7551 const CMPXMediaArray* mediaArray( |
|
7552 songInfo->Value<CMPXMediaArray>( KMPXMediaArrayContents ) ); |
|
7553 User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray)); |
|
7554 |
|
7555 if ( mediaArray->Count() > 0 ) |
|
7556 { |
|
7557 CMPXMedia* si( mediaArray->AtL( 0 ) ); |
|
7558 location.Set( si->ValueText(KMPXMediaGeneralUri) ); |
|
7559 mimeType.Set( si->ValueText(KMPXMediaGeneralMimeType) ); |
|
7560 } |
|
7561 CleanupStack::PopAndDestroy( songInfo ); |
|
7562 CleanupStack::PopAndDestroy( criteria ); |
|
7563 } |
|
7564 } |
|
7565 |
|
7566 TAiwVariant varMime(mimeType); |
|
7567 if ( !mimeType.Length() && ( iMediaRecognizer ) ) |
|
7568 { |
|
7569 varMime.Set(iMediaRecognizer->MimeTypeL(location)); |
|
7570 } |
|
7571 TAiwGenericParam paramMime(EGenericParamMIMEType, varMime); |
|
7572 aParamList.Reset(); |
|
7573 aParamList.AppendL(paramMime); |
|
7574 TAiwVariant varFile(location); |
|
7575 TAiwGenericParam paramFile(EGenericParamFile, varFile); |
|
7576 aParamList.AppendL(paramFile); |
|
7577 } |
|
7578 |
|
7579 // ----------------------------------------------------------------------------- |
|
7580 // CMPXCollectionViewHgImp::GetUint32Presentation |
|
7581 // |
|
7582 // (other items were commented in a header). |
|
7583 // ----------------------------------------------------------------------------- |
|
7584 // |
|
7585 void CMPXCollectionViewHgImp::GetUint32Presentation( TUint32& aResult, |
|
7586 const TDesC8& aBuf, |
|
7587 TInt aOffset ) |
|
7588 { |
|
7589 aResult = 0; |
|
7590 const TInt KProEngByteLength( 8 ); |
|
7591 const TInt length( aBuf.Length() ); |
|
7592 const TInt maxBitShift( KProEngByteLength * ( length - 1 ) ); |
|
7593 |
|
7594 for( TInt i( 0 ); i<length; ++i ) |
|
7595 { |
|
7596 aResult |= ( aBuf[aOffset + i] << |
|
7597 ( maxBitShift - ( KProEngByteLength * i ) ) ); |
|
7598 } |
|
7599 } |
|
7600 |
|
7601 // ----------------------------------------------------------------------------- |
|
7602 // CMPXCollectionViewHgImp::LaunchMusicShopL |
|
7603 // Launch music shop application |
|
7604 // ----------------------------------------------------------------------------- |
|
7605 // |
|
7606 void CMPXCollectionViewHgImp::LaunchOperatorJavaMusicShopL(TUid aUid) |
|
7607 { |
|
7608 MPX_FUNC( "CMPXCollectionViewHgImp::LaunchOperatorMusicShopL" ); |
|
7609 TThreadId threadId; |
|
7610 RApaLsSession apaSession; |
|
7611 User::LeaveIfError( apaSession.Connect() ); |
|
7612 CleanupClosePushL( apaSession ); |
|
7613 apaSession.StartDocument(_L(""), aUid, threadId); |
|
7614 CleanupStack::PopAndDestroy( &apaSession ); // close apaSession |
|
7615 } |
|
7616 |
|
7617 // ----------------------------------------------------------------------------- |
|
7618 // CMPXCollectionViewHgImp::LaunchMusicShopL |
|
7619 // Launch music shop application |
|
7620 // ----------------------------------------------------------------------------- |
|
7621 // |
|
7622 void CMPXCollectionViewHgImp::LaunchOperatorNativeMusicShopL() |
|
7623 { |
|
7624 MPX_FUNC( "CMPXCollectionViewHgImp::LaunchMusicShopL" ); |
|
7625 |
|
7626 TApaTaskList tasList( iCoeEnv->WsSession() ); |
|
7627 TApaTask task = tasList.FindApp( TUid::Uid(iOperatorNativeMusicStoreUID) ); |
|
7628 |
|
7629 if ( task.Exists() ) |
|
7630 { |
|
7631 task.BringToForeground(); |
|
7632 } |
|
7633 else |
|
7634 { |
|
7635 RApaLsSession session; |
|
7636 if ( KErrNone == session.Connect() ) |
|
7637 { |
|
7638 CleanupClosePushL( session ); |
|
7639 TThreadId threadId; |
|
7640 session.CreateDocument( KNullDesC, TUid::Uid(iOperatorNativeMusicStoreUID), threadId ); |
|
7641 CleanupStack::PopAndDestroy(&session); |
|
7642 } |
|
7643 } |
|
7644 } |
|
7645 // ----------------------------------------------------------------------------- |
|
7646 // CMPXCollectionViewHgImp::LaunchOperatorURLMusicShopL |
|
7647 // Launch music shop URL application |
|
7648 // ----------------------------------------------------------------------------- |
|
7649 // |
|
7650 void CMPXCollectionViewHgImp::LaunchOperatorURLMusicShopL() |
|
7651 { |
|
7652 MPX_FUNC( "CMPXCollectionViewHgImp::LaunchOperatorURLMusicShopL" ); |
|
7653 const TUid KOSSBrowserUidValue = {0x10008D39}; // 0x1020724D for S60 3rd Ed |
|
7654 TUid id(KOSSBrowserUidValue); |
|
7655 TApaTaskList taskList(CEikonEnv::Static()->WsSession()); |
|
7656 TApaTask task = taskList.FindApp(id); |
|
7657 |
|
7658 if ( task.Exists() ) |
|
7659 { |
|
7660 task.BringToForeground(); |
|
7661 if ( iOperatorMusicStoreURI->Length() != NULL ) |
|
7662 { |
|
7663 TBuf8<KMPXMaxHistoryLength> tempUrl; |
|
7664 tempUrl.Copy(iOperatorMusicStoreURI->Des()); |
|
7665 task.SendMessage(TUid::Uid(0), tempUrl); |
|
7666 } |
|
7667 } |
|
7668 else |
|
7669 { |
|
7670 RApaLsSession apaLsSession; |
|
7671 if ( KErrNone == apaLsSession.Connect() ) |
|
7672 { |
|
7673 CleanupClosePushL( apaLsSession ); |
|
7674 TThreadId threadId; |
|
7675 |
|
7676 apaLsSession.StartDocument(*iOperatorMusicStoreURI, KOSSBrowserUidValue, threadId); |
|
7677 CleanupStack::PopAndDestroy(&apaLsSession); |
|
7678 } |
|
7679 } |
|
7680 } |
|
7681 |
|
7682 // ----------------------------------------------------------------------------- |
|
7683 // CMPXCollectionViewHgImp::StoreListboxItemIndexL |
|
7684 // Stores the current list box item index. |
|
7685 // ----------------------------------------------------------------------------- |
|
7686 // |
|
7687 void CMPXCollectionViewHgImp::StoreListboxItemIndexL() |
|
7688 { |
|
7689 TInt currentIndex( iContainer->CurrentLbxItemIndex() ); |
|
7690 |
|
7691 CMPXCommand* command = CMPXCommand::NewL(); |
|
7692 CleanupStack::PushL( command ); |
|
7693 command->SetTObjectValueL<TMPXCommandId>( KMPXCommandGeneralId, |
|
7694 KMPXCommandIdCollectionSelect ); |
|
7695 command->SetTObjectValueL( KMPXCommandCollectionSelectIndex, currentIndex ); |
|
7696 command->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
7697 iCollectionUtility->Collection().CommandL( *command ); |
|
7698 CleanupStack::PopAndDestroy( command ); |
|
7699 } |
|
7700 |
|
7701 |
|
7702 // ----------------------------------------------------------------------------- |
|
7703 // CMPXCollectionViewHgImp::ChangeCbaVisibility |
|
7704 // ----------------------------------------------------------------------------- |
|
7705 // |
|
7706 void CMPXCollectionViewHgImp::ChangeCbaVisibility( TBool aVisible ) |
|
7707 { |
|
7708 CEikButtonGroupContainer* cba = Cba(); |
|
7709 if( cba ) |
|
7710 { |
|
7711 cba->MakeVisible( aVisible ); |
|
7712 cba->DrawDeferred(); |
|
7713 } |
|
7714 } |
|
7715 |
|
7716 |
|
7717 // ----------------------------------------------------------------------------- |
|
7718 // CMPXCollectionViewHgImp::OpenAllSongsL |
|
7719 // Open the collection at all songs level. |
|
7720 // ----------------------------------------------------------------------------- |
|
7721 // |
|
7722 void CMPXCollectionViewHgImp::OpenAllSongsL() |
|
7723 { |
|
7724 CMPXCollectionPath* path = iCollectionUiHelper->MusicAllSongsPathL(); |
|
7725 CleanupStack::PushL( path ); |
|
7726 iCollectionUtility->Collection().OpenL( *path ); |
|
7727 CleanupStack::PopAndDestroy( path ); |
|
7728 } |
|
7729 |
|
7730 |
|
7731 // ----------------------------------------------------------------------------- |
|
7732 // CMPXCollectionViewHgImp::OpenArtistAlbumsL |
|
7733 // Open the collection at artist & albums level. |
|
7734 // ----------------------------------------------------------------------------- |
|
7735 // |
|
7736 void CMPXCollectionViewHgImp::OpenArtistAlbumsL() |
|
7737 { |
|
7738 CMPXCollectionPath* path = iCollectionUiHelper->MusicMenuPathL(); |
|
7739 CleanupStack::PushL( path ); |
|
7740 path->AppendL(KMPXCollectionArtistAlbum); |
|
7741 iCollectionUtility->Collection().OpenL( *path ); |
|
7742 CleanupStack::PopAndDestroy( path ); |
|
7743 } |
|
7744 |
|
7745 // ----------------------------------------------------------------------------- |
|
7746 // CMPXCollectionViewHgImp::OpenPlaylistsL |
|
7747 // Open the collection at playlists level. |
|
7748 // ----------------------------------------------------------------------------- |
|
7749 // |
|
7750 void CMPXCollectionViewHgImp::OpenPlaylistsL() |
|
7751 { |
|
7752 CMPXCollectionPath* path = iCollectionUiHelper->MusicPlaylistPathL(); |
|
7753 CleanupStack::PushL( path ); |
|
7754 iCollectionUtility->Collection().OpenL( *path ); |
|
7755 CleanupStack::PopAndDestroy( path ); |
|
7756 } |
|
7757 |
|
7758 // ----------------------------------------------------------------------------- |
|
7759 // CMPXCollectionViewHgImp::OpenGenreL |
|
7760 // Open the collection at genre level. |
|
7761 // ----------------------------------------------------------------------------- |
|
7762 // |
|
7763 void CMPXCollectionViewHgImp::OpenGenreL() |
|
7764 { |
|
7765 CMPXCollectionPath* path = iCollectionUiHelper->MusicMenuPathL(); |
|
7766 CleanupStack::PushL( path ); |
|
7767 path->AppendL(KMPXCollectionGenre); // Genre |
|
7768 iCollectionUtility->Collection().OpenL( *path ); |
|
7769 CleanupStack::PopAndDestroy( path ); |
|
7770 } |
|
7771 |
|
7772 // ----------------------------------------------------------------------------- |
|
7773 // CMPXCollectionViewHgImp::OpenPodcastsL |
|
7774 // Open the collection at podcasts level. |
|
7775 // ----------------------------------------------------------------------------- |
|
7776 // |
|
7777 void CMPXCollectionViewHgImp::OpenPodcastsL() |
|
7778 { |
|
7779 CMPXCollectionPath* path = iCollectionUiHelper->PodCastMenuPathL(); |
|
7780 CleanupStack::PushL( path ); |
|
7781 iCollectionUtility->Collection().OpenL( *path ); |
|
7782 CleanupStack::PopAndDestroy( path ); |
|
7783 } |
|
7784 |
|
7785 // End of File |