14 * Description: Meta data access wrapper |
14 * Description: Meta data access wrapper |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
|
19 #include <mtp/mmtpdataproviderframework.h> |
|
20 #include <mtp/mmtpobjectmgr.h> |
19 #include <bautils.h> |
21 #include <bautils.h> |
20 #include <e32math.h> |
22 #include <e32math.h> |
21 #include <mtp/mmtpdataproviderframework.h> |
|
22 #include <e32property.h> |
23 #include <e32property.h> |
23 #include <MtpPrivatePSKeys.h> |
24 #include <mtpprivatepskeys.h> |
24 |
25 |
25 #include "cmmmtpdpmetadataaccesswrapper.h" |
26 #include "cmmmtpdpmetadataaccesswrapper.h" |
26 #include "cmmmtpdpmetadatampxaccess.h" |
27 #include "cmmmtpdpmetadatampxaccess.h" |
27 #include "cmmmtpdpmetadatavideoaccess.h" |
28 #include "cmmmtpdpmetadatavideoaccess.h" |
28 #include "mmmtpdputility.h" |
29 #include "mmmtpdputility.h" |
29 #include "mmmtpdplogger.h" |
30 #include "mmmtpdplogger.h" |
30 |
31 |
31 const TInt KMMMTPDummyFileArrayGranularity = 5; |
32 const TInt KMMMTPDummyFileArrayGranularity = 5; |
32 |
33 |
33 CMmMtpDpMetadataAccessWrapper* CMmMtpDpMetadataAccessWrapper::NewL( RFs& aRfs, |
34 CMmMtpDpMetadataAccessWrapper* CMmMtpDpMetadataAccessWrapper::NewL( RFs& aRfs, |
34 MMTPDataProviderFramework& aFramework ) |
35 MMTPDataProviderFramework& aFramework ) |
35 { |
36 { |
36 CMmMtpDpMetadataAccessWrapper* me = new (ELeave) CMmMtpDpMetadataAccessWrapper( aRfs, aFramework ); |
37 CMmMtpDpMetadataAccessWrapper* me = new (ELeave) CMmMtpDpMetadataAccessWrapper( aRfs, aFramework ); |
37 CleanupStack::PushL( me ); |
38 CleanupStack::PushL( me ); |
38 me->ConstructL(); |
39 me->ConstructL(); |
39 CleanupStack::Pop( me ); |
40 CleanupStack::Pop( me ); |
40 |
41 |
41 return me; |
42 return me; |
42 } |
43 } |
43 |
44 |
44 CMmMtpDpMetadataAccessWrapper::CMmMtpDpMetadataAccessWrapper( RFs& aRfs, |
45 CMmMtpDpMetadataAccessWrapper::CMmMtpDpMetadataAccessWrapper( RFs& aRfs, |
45 MMTPDataProviderFramework& aFramework ) : |
46 MMTPDataProviderFramework& aFramework ) : |
46 iRfs( aRfs ), |
47 iRfs( aRfs ), |
47 iFramework( aFramework ) |
48 iFramework( aFramework ) |
48 { |
49 { |
49 |
50 // Do nothing |
50 } |
51 } |
51 |
52 |
52 // --------------------------------------------------------------------------- |
53 // --------------------------------------------------------------------------- |
53 // CMmMtpDpMetadataAccessWrapper::ConstructL |
54 // CMmMtpDpMetadataAccessWrapper::ConstructL |
54 // Second-phase |
55 // Second-phase |
59 PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::ConstructL" ) ); |
60 PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::ConstructL" ) ); |
60 |
61 |
61 iMmMtpDpMetadataMpxAccess = CMmMtpDpMetadataMpxAccess::NewL( iRfs, iFramework ); |
62 iMmMtpDpMetadataMpxAccess = CMmMtpDpMetadataMpxAccess::NewL( iRfs, iFramework ); |
62 |
63 |
63 iMmMtpDpMetadataVideoAccess = CMmMtpDpMetadataVideoAccess::NewL( iRfs ); |
64 iMmMtpDpMetadataVideoAccess = CMmMtpDpMetadataVideoAccess::NewL( iRfs ); |
64 |
65 |
65 iPlaylistArray = new ( ELeave ) CDesCArrayFlat( KMMMTPDummyFileArrayGranularity ); |
66 iAbstractMediaArray = new ( ELeave ) CDesCArrayFlat( KMMMTPDummyFileArrayGranularity ); |
66 |
67 |
67 // Create the PS key to notify subscribers that MTP mode is activated |
68 // Create the PS key to notify subscribers that MTP mode is activated |
68 _LIT_SECURITY_POLICY_C1(KKeyReadPolicy, ECapabilityReadUserData); |
69 _LIT_SECURITY_POLICY_C1(KKeyReadPolicy, ECapabilityReadUserData); |
69 _LIT_SECURITY_POLICY_C1(KKeyWritePolicy, ECapabilityWriteUserData); |
70 _LIT_SECURITY_POLICY_C1(KKeyWritePolicy, ECapabilityWriteUserData); |
70 RProperty::Define( KMtpPSUid, |
71 RProperty::Define( KMtpPSUid, |
71 KMtpPSStatus, |
72 KMtpPSStatus, |
72 RProperty::EInt, |
73 RProperty::EInt, |
73 KKeyReadPolicy, |
74 KKeyReadPolicy, |
74 KKeyWritePolicy); |
75 KKeyWritePolicy); |
75 |
76 |
76 PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::ConstructL" ) ); |
77 PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::ConstructL" ) ); |
77 } |
78 } |
78 |
79 |
84 CMmMtpDpMetadataAccessWrapper::~CMmMtpDpMetadataAccessWrapper() |
85 CMmMtpDpMetadataAccessWrapper::~CMmMtpDpMetadataAccessWrapper() |
85 { |
86 { |
86 PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::~CMmMtpDpMetadataAccessWrapper" ) ); |
87 PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::~CMmMtpDpMetadataAccessWrapper" ) ); |
87 RemoveDummyFiles(); |
88 RemoveDummyFiles(); |
88 |
89 |
89 delete iPlaylistArray; |
90 delete iAbstractMediaArray; |
90 |
91 |
91 delete iMmMtpDpMetadataVideoAccess; |
92 delete iMmMtpDpMetadataVideoAccess; |
92 delete iMmMtpDpMetadataMpxAccess; |
93 delete iMmMtpDpMetadataMpxAccess; |
93 |
94 |
94 // unblock MPX |
95 // unblock MPX |
95 RProperty::Set( KMtpPSUid, |
96 RProperty::Set( KMtpPSUid, |
96 KMtpPSStatus, |
97 KMtpPSStatus, |
97 EMtpPSStatusUninitialized); |
98 EMtpPSStatusUninitialized ); |
98 PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::~CMmMtpDpMetadataAccessWrapper" ) ); |
99 PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::~CMmMtpDpMetadataAccessWrapper" ) ); |
99 } |
100 } |
100 |
101 |
101 // ----------------------------------------------------------------------------- |
102 // ----------------------------------------------------------------------------- |
102 // CMmMtpDpMetadataAccessWrapper::SetPlaylist |
103 // CMmMtpDpMetadataAccessWrapper::SetAbstractMediaL |
103 // Set playlist to DB |
104 // Set abstract media to DB |
104 // ----------------------------------------------------------------------------- |
105 // ----------------------------------------------------------------------------- |
105 // |
106 // |
106 EXPORT_C void CMmMtpDpMetadataAccessWrapper::SetPlaylistL( const TDesC& aPlaylistFileName, CDesCArray& aRefFileArray ) |
107 EXPORT_C void CMmMtpDpMetadataAccessWrapper::SetAbstractMediaL( const TDesC& aAbstractMediaFileName, |
107 { |
108 CDesCArray& aRefFileArray, |
108 PRINT1( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::SetPlaylistL aPlaylistFileName = %S" ), &aPlaylistFileName ); |
109 TMPXGeneralCategory aCategory ) |
109 |
110 { |
110 if ( !MmMtpDpUtility::IsVideoL( aPlaylistFileName, iFramework ) ) |
111 PRINT1( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::SetAbstractMediaL aAbstractMediaFileName = %S" ), &aAbstractMediaFileName ); |
111 { |
112 |
112 iMmMtpDpMetadataMpxAccess->SetPlaylistL( aPlaylistFileName, aRefFileArray ); |
113 if ( !MmMtpDpUtility::IsVideoL( aAbstractMediaFileName, iFramework ) ) |
113 } |
114 { |
114 |
115 iMmMtpDpMetadataMpxAccess->SetAbstractMediaL( aAbstractMediaFileName, aRefFileArray, aCategory ); |
115 PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::SetPlaylistL" ) ); |
116 } |
116 } |
117 |
117 |
118 PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::SetAbstractMediaL" ) ); |
118 // --------------------------------------------------------------------------- |
119 } |
119 // CMmMtpDpMetadataAccessWrapper::AddMediaL |
120 |
|
121 // --------------------------------------------------------------------------- |
|
122 // CMmMtpDpMetadataAccessWrapper::GetObjectMetadataValueL |
120 // Gets a piece of metadata from the collection |
123 // Gets a piece of metadata from the collection |
121 // --------------------------------------------------------------------------- |
124 // --------------------------------------------------------------------------- |
122 // |
125 // |
123 EXPORT_C void CMmMtpDpMetadataAccessWrapper::GetObjectMetadataValueL( const TUint16 aPropCode, |
126 EXPORT_C void CMmMtpDpMetadataAccessWrapper::GetObjectMetadataValueL( const TUint16 aPropCode, |
124 MMTPType& aNewData, |
127 MMTPType& aNewData, |
152 const MMTPType& aNewData, |
155 const MMTPType& aNewData, |
153 const CMTPObjectMetaData& aObjectMetaData ) |
156 const CMTPObjectMetaData& aObjectMetaData ) |
154 { |
157 { |
155 PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::SetObjectMetadataValueL" ) ); |
158 PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::SetObjectMetadataValueL" ) ); |
156 |
159 |
157 TPtrC fullFileName( aObjectMetaData.DesC( CMTPObjectMetaData::ESuid ) ); |
160 // In SendObjectPropList, formatCode has already know, but object handle has not been committed into db |
158 if ( MmMtpDpUtility::IsVideoL( fullFileName, iFramework ) ) |
161 // In that case, format couldn't be get from object manager |
|
162 TUint formatCode = aObjectMetaData.Uint( CMTPObjectMetaData::EFormatCode ); |
|
163 TUint formatSubCode = aObjectMetaData.Uint( CMTPObjectMetaData::EFormatSubCode ); |
|
164 |
|
165 TBool isVideo = EFalse; |
|
166 isVideo = MmMtpDpUtility::IsVideoL( formatCode, formatSubCode ); |
|
167 |
|
168 if ( isVideo ) |
159 { |
169 { |
160 iMmMtpDpMetadataVideoAccess->SetObjectMetadataValueL( aPropCode, |
170 iMmMtpDpMetadataVideoAccess->SetObjectMetadataValueL( aPropCode, |
161 aNewData, |
171 aNewData, |
162 aObjectMetaData ); |
172 aObjectMetaData ); |
163 } |
173 } |
181 const TDesC& aNewFileName ) |
190 const TDesC& aNewFileName ) |
182 { |
191 { |
183 PRINT2( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::RenameObjectL old = %S, new = %S" ), |
192 PRINT2( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::RenameObjectL old = %S, new = %S" ), |
184 &aOldFileName, |
193 &aOldFileName, |
185 &aNewFileName ); |
194 &aNewFileName ); |
186 |
195 |
187 TMTPFormatCode formatCode = MmMtpDpUtility::FormatFromFilename( aOldFileName ); |
196 if ( MmMtpDpUtility::IsVideoL( aOldFileName, iFramework ) ) |
188 if ( formatCode == EMTPFormatCodeWMV ) |
|
189 { |
197 { |
190 iMmMtpDpMetadataVideoAccess->RenameRecordL( aOldFileName, aNewFileName ); |
198 iMmMtpDpMetadataVideoAccess->RenameRecordL( aOldFileName, aNewFileName ); |
191 } |
199 } |
192 else |
200 else |
193 { |
201 { |
194 if ( !MmMtpDpUtility::IsVideoL( aNewFileName , iFramework ) ) |
202 CMTPObjectMetaData* object = CMTPObjectMetaData::NewLC(); |
195 { |
203 iFramework.ObjectMgr().ObjectL( aOldFileName, *object ); |
196 iMmMtpDpMetadataMpxAccess->RenameObjectL( aOldFileName, aNewFileName, formatCode ); |
204 iMmMtpDpMetadataMpxAccess->RenameObjectL( aOldFileName, |
197 } |
205 aNewFileName, |
198 else |
206 object->Uint( CMTPObjectMetaData::EFormatCode ) ); |
199 { |
207 CleanupStack::PopAndDestroy( object ); |
200 iMmMtpDpMetadataVideoAccess->RenameRecordL( aOldFileName, aNewFileName ); |
|
201 } |
|
202 } |
208 } |
203 |
209 |
204 PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::RenameObjectL" ) ); |
210 PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::RenameObjectL" ) ); |
205 } |
211 } |
206 |
212 |
368 } |
374 } |
369 return category; |
375 return category; |
370 } |
376 } |
371 |
377 |
372 // --------------------------------------------------------------------------- |
378 // --------------------------------------------------------------------------- |
373 // CMmMtpDpMetadataAccessWrapper::GetAllPlaylistL |
379 // CMmMtpDpMetadataAccessWrapper::GetAllAbstractMediaL |
374 // |
380 // |
375 // --------------------------------------------------------------------------- |
381 // --------------------------------------------------------------------------- |
376 EXPORT_C void CMmMtpDpMetadataAccessWrapper::GetAllPlaylistL( const TDesC& aStoreRoot, CMPXMediaArray** aPlaylists ) |
382 EXPORT_C void CMmMtpDpMetadataAccessWrapper::GetAllAbstractMediaL( const TDesC& aStoreRoot, CMPXMediaArray** aAbstractMedias, TMPXGeneralCategory aCategory ) |
377 { |
383 { |
378 iMmMtpDpMetadataMpxAccess->GetAllPlaylistL( aStoreRoot, aPlaylists ); |
384 iMmMtpDpMetadataMpxAccess->GetAllAbstractMediaL( aStoreRoot, aAbstractMedias, aCategory ); |
379 } |
385 } |
380 |
386 |
381 // --------------------------------------------------------------------------- |
387 // --------------------------------------------------------------------------- |
382 // CMmMtpDpMetadataAccessWrapper::GetAllReferenceL |
388 // CMmMtpDpMetadataAccessWrapper::GetAllReferenceL |
383 // |
389 // |
384 // --------------------------------------------------------------------------- |
390 // --------------------------------------------------------------------------- |
385 //s |
391 // |
386 EXPORT_C void CMmMtpDpMetadataAccessWrapper::GetAllReferenceL( CMPXMedia* aPlaylist, CDesCArray& aReferences ) |
392 EXPORT_C void CMmMtpDpMetadataAccessWrapper::GetAllReferenceL( CMPXMedia* aAbstractMedia, CDesCArray& aReferences ) |
387 { |
393 { |
388 iMmMtpDpMetadataMpxAccess->GetAllReferenceL( aPlaylist, aReferences ); |
394 iMmMtpDpMetadataMpxAccess->GetAllReferenceL( aAbstractMedia, aReferences ); |
389 } |
395 } |
390 |
396 |
391 // --------------------------------------------------------------------------- |
397 // --------------------------------------------------------------------------- |
392 // CMmMtpDpMetadataAccessWrapper::GetPlaylistNameL |
398 // CMmMtpDpMetadataAccessWrapper::GetAbstractMediaNameL |
393 // |
399 // |
394 // --------------------------------------------------------------------------- |
400 // --------------------------------------------------------------------------- |
395 // |
401 // |
396 EXPORT_C void CMmMtpDpMetadataAccessWrapper::GetPlaylistNameL( CMPXMedia* aPlaylist, TDes& aPlaylistName ) |
402 EXPORT_C HBufC* CMmMtpDpMetadataAccessWrapper::GetAbstractMediaNameL( CMPXMedia* aAbstractMedia, TMPXGeneralCategory aCategory ) |
397 { |
403 { |
398 iMmMtpDpMetadataMpxAccess->GetPlaylistNameL( aPlaylist, aPlaylistName ); |
404 return iMmMtpDpMetadataMpxAccess->GetAbstractMediaNameL( aAbstractMedia, aCategory ); |
399 } |
405 } |
400 |
406 |
401 // ----------------------------------------------------------------------------- |
407 // ----------------------------------------------------------------------------- |
402 // CMmMtpDpMetadataAccessWrapper::AddObjectL |
408 // CMmMtpDpMetadataAccessWrapper::AddObjectL |
403 // Add object (music, video and playlist) info to DB |
409 // Add object (music, video, playlist and abstract media) info to DB |
404 // ----------------------------------------------------------------------------- |
410 // ----------------------------------------------------------------------------- |
405 // |
411 // |
406 void CMmMtpDpMetadataAccessWrapper::AddObjectL( const TDesC& aFullFileName, TBool aIsVideo /*= EFalse */ ) |
412 void CMmMtpDpMetadataAccessWrapper::AddObjectL( const TDesC& aFullFileName, TUint aFormatCode, TUint aSubFormatCode ) |
407 { |
413 { |
408 PRINT1( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL aFullFileName = %S" ), &aFullFileName ); |
414 PRINT1( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL aFullFileName = %S" ), &aFullFileName ); |
409 |
415 |
410 if ( aFullFileName.Length() <= 0) |
416 if ( aFullFileName.Length() <= 0 ) |
411 { |
417 { |
412 User::Leave( KErrArgument ); |
418 User::Leave( KErrArgument ); |
413 } |
419 } |
414 if ( aIsVideo ) |
420 if ( MmMtpDpUtility::IsVideoL( aFormatCode, aSubFormatCode ) ) |
415 { |
421 { |
416 PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL Addvideo" ) ); |
422 PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL Addvideo" ) ); |
417 iMmMtpDpMetadataVideoAccess->AddVideoL( aFullFileName ); |
423 iMmMtpDpMetadataVideoAccess->AddVideoL( aFullFileName ); |
418 } |
424 } |
419 else |
425 else |
420 { |
426 { |
421 if ( MmMtpDpUtility::IsVideoL( aFullFileName, iFramework ) ) |
427 if ( aFormatCode == EMTPFormatCodeM3UPlaylist |
422 { |
428 || aFormatCode == EMTPFormatCodeMPLPlaylist |
423 PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL Addvideo" ) ); |
429 || aFormatCode == EMTPFormatCodeAbstractAudioVideoPlaylist |
424 iMmMtpDpMetadataVideoAccess->AddVideoL( aFullFileName ); |
430 || aFormatCode == EMTPFormatCodeAbstractAudioPlaylist |
|
431 || aFormatCode == EMTPFormatCodeAbstractVideoPlaylist |
|
432 || aFormatCode == EMTPFormatCodeASXPlaylist |
|
433 || aFormatCode == EMTPFormatCodePLSPlaylist ) |
|
434 { |
|
435 PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL AddPlaylist" ) ); |
|
436 iMmMtpDpMetadataMpxAccess->AddAbstractMediaL( aFullFileName, |
|
437 EMPXPlaylist ); |
425 } |
438 } |
426 else |
439 else |
427 { |
440 { |
428 TMTPFormatCode formatCode = MmMtpDpUtility::FormatFromFilename( aFullFileName ); |
441 PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL AddSong" ) ); |
429 |
442 iMmMtpDpMetadataMpxAccess->AddSongL( aFullFileName ); |
430 if ( formatCode == EMTPFormatCodeM3UPlaylist |
|
431 || formatCode == EMTPFormatCodeMPLPlaylist |
|
432 || formatCode == EMTPFormatCodeAbstractAudioVideoPlaylist |
|
433 || formatCode == EMTPFormatCodeAbstractAudioPlaylist |
|
434 || formatCode == EMTPFormatCodeAbstractVideoPlaylist |
|
435 || formatCode == EMTPFormatCodeASXPlaylist |
|
436 || formatCode == EMTPFormatCodePLSPlaylist ) |
|
437 { |
|
438 PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL AddPlaylist" ) ); |
|
439 iMmMtpDpMetadataMpxAccess->AddPlaylistL( aFullFileName ); |
|
440 } |
|
441 else |
|
442 { |
|
443 PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::AddObjectL AddSong" ) ); |
|
444 iMmMtpDpMetadataMpxAccess->AddSongL( aFullFileName ); |
|
445 } |
|
446 } |
443 } |
447 } |
444 } |
448 |
445 |
449 PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::AddObjectL" ) ); |
446 PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::AddObjectL" ) ); |
450 } |
447 } |
477 TParsePtrC parse( aSuid ); |
474 TParsePtrC parse( aSuid ); |
478 iMmMtpDpMetadataMpxAccess->SetStorageRootL( parse.Drive() ); |
475 iMmMtpDpMetadataMpxAccess->SetStorageRootL( parse.Drive() ); |
479 return iMmMtpDpMetadataMpxAccess->IsExistL( aSuid ); |
476 return iMmMtpDpMetadataMpxAccess->IsExistL( aSuid ); |
480 } |
477 } |
481 |
478 |
482 // ----------------------------------------------------------------------------- |
479 // ----------------------------------------------------------------------------- |
483 // CMmMtpDpMetadataAccessWrapper::AddDummyFile |
480 // CMmMtpDpMetadataAccessWrapper::AddDummyFile |
484 // Add one dummy file to dummy files array |
481 // Add one dummy file to dummy files array |
485 // ----------------------------------------------------------------------------- |
482 // ----------------------------------------------------------------------------- |
486 // |
483 // |
487 EXPORT_C void CMmMtpDpMetadataAccessWrapper::AddDummyFileL( const TDesC& aDummyFileName ) |
484 EXPORT_C void CMmMtpDpMetadataAccessWrapper::AddDummyFileL( const TDesC& aDummyFileName ) |
488 { |
485 { |
489 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::AddDummyFile aDummyFileName(%S)" ), &aDummyFileName ); |
486 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::AddDummyFile aDummyFileName(%S)" ), &aDummyFileName ); |
490 iPlaylistArray->AppendL( aDummyFileName ); |
487 iAbstractMediaArray->AppendL( aDummyFileName ); |
491 } |
488 } |
492 |
489 |
493 // ----------------------------------------------------------------------------- |
490 // ----------------------------------------------------------------------------- |
494 // CMmMtpDpMetadataAccessWrapper::DeleteDummyFile |
491 // CMmMtpDpMetadataAccessWrapper::DeleteDummyFile |
495 // Delete one dummy file from dummy files array |
492 // Delete one dummy file from dummy files array |
496 // ----------------------------------------------------------------------------- |
493 // ----------------------------------------------------------------------------- |
497 // |
494 // |
498 EXPORT_C void CMmMtpDpMetadataAccessWrapper::DeleteDummyFile( const TDesC& aDummyFileName ) |
495 EXPORT_C void CMmMtpDpMetadataAccessWrapper::DeleteDummyFile( const TDesC& aDummyFileName ) |
499 { |
496 { |
500 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::DeleteDummyFile aDummyFileName(%S)" ), &aDummyFileName ); |
497 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::DeleteDummyFile aDummyFileName(%S)" ), &aDummyFileName ); |
501 TInt pos = 0; |
498 TInt pos = 0; |
502 if ( iPlaylistArray->Count() > 0 ) |
499 if ( iAbstractMediaArray->Count() > 0 ) |
503 { |
500 { |
504 if ( 0 == iPlaylistArray->Find( aDummyFileName, pos ) ) |
501 if ( 0 == iAbstractMediaArray->Find( aDummyFileName, pos ) ) |
505 { |
502 { |
506 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::DeleteDummyFile pos = %d" ), pos ); |
503 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::DeleteDummyFile pos = %d" ), pos ); |
507 iPlaylistArray->Delete( pos ); |
504 iAbstractMediaArray->Delete( pos ); |
508 } |
505 } |
509 } |
506 } |
510 } |
507 } |
511 |
508 |
512 // ----------------------------------------------------------------------------- |
509 // ----------------------------------------------------------------------------- |
547 // ----------------------------------------------------------------------------- |
544 // ----------------------------------------------------------------------------- |
548 // |
545 // |
549 void CMmMtpDpMetadataAccessWrapper::RemoveDummyFiles() |
546 void CMmMtpDpMetadataAccessWrapper::RemoveDummyFiles() |
550 { |
547 { |
551 PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::RemoveDummyFiles" ) ); |
548 PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::RemoveDummyFiles" ) ); |
552 |
549 |
553 TInt count = iPlaylistArray->Count(); |
550 TInt count = iAbstractMediaArray->Count(); |
554 // Check if playlist file is a dummy file or an imported file |
551 // Check if playlist file is a dummy file or an imported file |
555 for ( TInt i = 0; i < count; i++ ) |
552 for ( TInt i = 0; i < count; i++ ) |
556 { |
553 { |
557 if ( MmMtpDpUtility::FormatFromFilename( (*iPlaylistArray)[i] ) != |
554 if ( MmMtpDpUtility::FormatFromFilename( (*iAbstractMediaArray)[i] ) != |
558 EMTPFormatCodeM3UPlaylist ) |
555 EMTPFormatCodeM3UPlaylist ) |
559 { |
556 { |
560 // delete the virtual playlist |
557 // delete the virtual playlist |
561 // iFramework has release don't use iFramework.FS() |
558 // iFramework has release don't use iFramework.FS() |
562 TInt err = iRfs.Delete( (*iPlaylistArray)[i] ); |
559 TInt err = iRfs.Delete( ( *iAbstractMediaArray )[i] ); |
563 |
560 |
564 PRINT2( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::RemoveDummyFile filename = %S, err %d" ), |
561 PRINT2( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::RemoveDummyFile filename = %S, err %d" ), |
565 &( (*iPlaylistArray)[i] ), |
562 &( (*iAbstractMediaArray)[i] ), |
566 err ); |
563 err ); |
567 } |
564 } |
568 else |
565 else |
569 { |
566 { |
570 // leave the Imported playlist in the file system |
567 // leave the Imported playlist in the file system |
571 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::RemoveDummyFile, Don't delete m3u file [%S]" ), &( (*iPlaylistArray)[i] ) ); |
568 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::RemoveDummyFile, Don't delete m3u file [%S]" ), &( (*iAbstractMediaArray)[i] ) ); |
572 } |
569 } |
573 } |
570 } |
574 PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::RemoveDummyFiles" ) ); |
571 PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::RemoveDummyFiles" ) ); |
575 } |
572 } |
576 |
573 |
577 // --------------------------------------------------------------------------- |
574 // --------------------------------------------------------------------------- |
578 // CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL |
575 // CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL |
579 // Update Music collection |
576 // Update Music collection |
580 // --------------------------------------------------------------------------- |
577 // --------------------------------------------------------------------------- |
581 // |
578 // |
582 EXPORT_C void CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL() |
579 EXPORT_C void CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL() |
583 { |
580 { |
584 iMmMtpDpMetadataMpxAccess->UpdateMusicCollectionL( ); |
581 iMmMtpDpMetadataMpxAccess->UpdateMusicCollectionL( ); |
585 } |
582 } |
586 |
583 |
587 // end of file |
584 // end of file |