|
1 /* |
|
2 * Copyright (c) 2009 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: Rename objects |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <badesca.h> |
|
20 #include <mtp/mmtpdataproviderframework.h> |
|
21 #include <mtp/mmtpobjectmgr.h> |
|
22 #include <mtp/cmtpobjectmetadata.h> |
|
23 #include <mtp/tmtptypeuint32.h> |
|
24 |
|
25 #include "cabstractmediamtpdataproviderrenameobject.h" |
|
26 #include "mmmtpdplogger.h" |
|
27 #include "cmmmtpdpmetadataaccesswrapper.h" |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CAbstractMediaMtpDataProviderRenameObject::NewL |
|
31 // Two phase constructor |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 CAbstractMediaMtpDataProviderRenameObject* CAbstractMediaMtpDataProviderRenameObject::NewL( MMTPDataProviderFramework& aFramework, |
|
35 CMmMtpDpMetadataAccessWrapper& aWrapper ) |
|
36 { |
|
37 PRINT( _L( "MM MTP => CAbstractMediaMtpDataProviderRenameObject::NewL" ) ); |
|
38 |
|
39 CAbstractMediaMtpDataProviderRenameObject* self = new ( ELeave ) CAbstractMediaMtpDataProviderRenameObject( aFramework, |
|
40 aWrapper ); |
|
41 CleanupStack::PushL( self ); |
|
42 self->ConstructL(); |
|
43 CleanupStack::Pop( self ); |
|
44 |
|
45 PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderRenameObject::NewL" ) ); |
|
46 return self; |
|
47 } |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // CAbstractMediaMtpDataProviderRenameObject::CAbstractMediaMtpDataProviderRenameObject |
|
51 // Standard C++ Constructor |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CAbstractMediaMtpDataProviderRenameObject::CAbstractMediaMtpDataProviderRenameObject( MMTPDataProviderFramework& aFramework, |
|
55 CMmMtpDpMetadataAccessWrapper& aWrapper ) : |
|
56 CRenameObject( aFramework, aWrapper ) |
|
57 { |
|
58 |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CAbstractMediaMtpDataProviderRenameObject::~CAbstractMediaMtpDataProviderRenameObject |
|
63 // destructor |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 CAbstractMediaMtpDataProviderRenameObject::~CAbstractMediaMtpDataProviderRenameObject() |
|
67 { |
|
68 |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // CAbstractMediaMtpDataProviderRenameObject::ConstructL |
|
73 // |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 void CAbstractMediaMtpDataProviderRenameObject::ConstructL() |
|
77 { |
|
78 CRenameObject::ConstructL(); |
|
79 } |
|
80 |
|
81 void CAbstractMediaMtpDataProviderRenameObject::PerformAdditionalActionL() |
|
82 { |
|
83 PRINT( _L( "MM MTP => CAbstractMediaMtpDataProviderRenameObject::PerformAdditionalActionL" ) ); |
|
84 |
|
85 // modified the dummy array |
|
86 if ( iObjectInfo->Uint( CMTPObjectMetaData::EFormatCode ) |
|
87 == EMTPFormatCodeAbstractAudioVideoPlaylist ) |
|
88 { |
|
89 iWrapper.DeleteDummyFile( iOldFileName ); |
|
90 iWrapper.AddDummyFileL( iFileName ); |
|
91 // Do not update MPX db to keep the same behavior in mass storage and device file manager. |
|
92 } |
|
93 else |
|
94 { |
|
95 TRAPD( err, iWrapper.RenameObjectL( iOldFileName, iFileName ) ); |
|
96 |
|
97 // should not fail for 1 file, keep it going, as folder already renamed |
|
98 if ( err != KErrNone ) |
|
99 PRINT1( _L( "MM MTP <> CRenameObject::PerformAdditionalActionL err = %d" ), err ); |
|
100 } |
|
101 |
|
102 // the reference DB use PUID |
|
103 // so we needn't to update the reference DB |
|
104 |
|
105 PRINT( _L( "MM MTP <= CAbstractMediaMtpDataProviderRenameObject::PerformAdditionalActionL" ) ); |
|
106 } |
|
107 |
|
108 //end of file |