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