equal
deleted
inserted
replaced
21 #include <mtp/mmtpobjectmgr.h> |
21 #include <mtp/mmtpobjectmgr.h> |
22 #include <mtp/mtpprotocolconstants.h> |
22 #include <mtp/mtpprotocolconstants.h> |
23 #include <mtp/mmtpstoragemgr.h> |
23 #include <mtp/mmtpstoragemgr.h> |
24 #include <mtp/tmtptyperequest.h> |
24 #include <mtp/tmtptyperequest.h> |
25 |
25 |
|
26 #include "cmtpstoragemgr.h" |
26 #include "cmtpdeleteobject.h" |
27 #include "cmtpdeleteobject.h" |
27 #include "mtpdpconst.h" |
28 #include "mtpdpconst.h" |
28 #include "mtpdppanic.h" |
29 #include "mtpdppanic.h" |
29 |
30 |
30 |
31 |
44 Standard c++ constructor |
45 Standard c++ constructor |
45 */ |
46 */ |
46 CMTPDeleteObject::CMTPDeleteObject(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) : |
47 CMTPDeleteObject::CMTPDeleteObject(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) : |
47 CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPDeleteObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPDeleteObjectPolicy) |
48 CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPDeleteObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPDeleteObjectPolicy) |
48 { |
49 { |
49 __FLOG_OPEN(KMTPSubsystem, KComponent); |
|
50 __FLOG(_L8("CMTPDeleteObject - Entry")); |
|
51 __FLOG(_L8("CMTPDeleteObject - Exit")); |
|
52 } |
50 } |
53 |
51 |
54 |
52 |
55 /** |
53 /** |
56 Two-phase construction method |
54 Two-phase construction method |
60 */ |
58 */ |
61 EXPORT_C MMTPRequestProcessor* CMTPDeleteObject::NewL(MMTPDataProviderFramework& aFramework, |
59 EXPORT_C MMTPRequestProcessor* CMTPDeleteObject::NewL(MMTPDataProviderFramework& aFramework, |
62 MMTPConnection& aConnection) |
60 MMTPConnection& aConnection) |
63 { |
61 { |
64 CMTPDeleteObject* self = new (ELeave) CMTPDeleteObject(aFramework, aConnection); |
62 CMTPDeleteObject* self = new (ELeave) CMTPDeleteObject(aFramework, aConnection); |
|
63 CleanupStack::PushL(self); |
|
64 self->ConstructL(); |
|
65 CleanupStack::Pop(self); |
65 return self; |
66 return self; |
66 } |
67 } |
|
68 |
|
69 void CMTPDeleteObject::ConstructL() |
|
70 { |
|
71 __FLOG_OPEN(KMTPSubsystem, KComponent); |
|
72 __FLOG(_L8("ConstructL - Entry")); |
|
73 iSingletons.OpenL(); |
|
74 __FLOG(_L8("ConstructL - Exit")); |
|
75 } |
67 |
76 |
68 /** |
77 /** |
69 Destructor |
78 Destructor |
70 */ |
79 */ |
71 EXPORT_C CMTPDeleteObject::~CMTPDeleteObject() |
80 EXPORT_C CMTPDeleteObject::~CMTPDeleteObject() |
72 { |
81 { |
73 __FLOG(_L8("~CMTPDeleteObject - Entry")); |
82 __FLOG(_L8("~CMTPDeleteObject - Entry")); |
|
83 iSingletons.Close(); |
74 __FLOG(_L8("~CMTPDeleteObject - Exit")); |
84 __FLOG(_L8("~CMTPDeleteObject - Exit")); |
75 __FLOG_CLOSE; |
85 __FLOG_CLOSE; |
76 } |
86 } |
77 |
87 |
78 /** |
88 /** |
82 |
92 |
83 |
93 |
84 TMTPResponseCode CMTPDeleteObject::CheckRequestL() |
94 TMTPResponseCode CMTPDeleteObject::CheckRequestL() |
85 { |
95 { |
86 __FLOG(_L8("CheckRequestL - Entry")); |
96 __FLOG(_L8("CheckRequestL - Entry")); |
87 TMTPResponseCode result(EMTPRespCodeOK); |
97 TMTPResponseCode result = CMTPRequestProcessor::CheckRequestL(); |
88 if (IsStoreReadOnlyL(Request().Uint32(TMTPTypeRequest::ERequestParameter1))) |
98 const TUint32 KObjectHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
|
99 if ((EMTPRespCodeOK == result) && (IsStoreReadOnlyL(KObjectHandle)) ) |
89 { |
100 { |
90 result = EMTPRespCodeStoreReadOnly; |
101 result = EMTPRespCodeStoreReadOnly; |
91 } |
102 } |
92 else |
103 |
93 { |
|
94 result = CMTPRequestProcessor::CheckRequestL(); |
|
95 } |
|
96 __FLOG(_L8("CheckRequestL - Exit")); |
104 __FLOG(_L8("CheckRequestL - Exit")); |
97 return result; |
105 return result; |
98 } |
106 } |
99 |
107 |
100 void CMTPDeleteObject::DeleteFolderOrFileL(CMTPObjectMetaData* aMeta) |
108 void CMTPDeleteObject::DeleteFolderOrFileL(CMTPObjectMetaData* aMeta) |
231 __FLOG(_L8("IsStoreReadOnlyL - Entry")); |
239 __FLOG(_L8("IsStoreReadOnlyL - Entry")); |
232 TBool result(EFalse); |
240 TBool result(EFalse); |
233 CMTPObjectMetaData *info(CMTPObjectMetaData::NewLC()); |
241 CMTPObjectMetaData *info(CMTPObjectMetaData::NewLC()); |
234 if (iFramework.ObjectMgr().ObjectL(aObjectHandle, *info)) |
242 if (iFramework.ObjectMgr().ObjectL(aObjectHandle, *info)) |
235 { |
243 { |
236 TInt drive(iFramework.StorageMgr().DriveNumber(info->Uint(CMTPObjectMetaData::EStorageId))); |
244 result = !iSingletons.StorageMgr().IsReadWriteStorage(info->Uint(CMTPObjectMetaData::EStorageId)); |
237 User::LeaveIfError(drive); |
|
238 TVolumeInfo volumeInfo; |
|
239 User::LeaveIfError(iFramework.Fs().Volume(volumeInfo, drive)); |
|
240 if (volumeInfo.iDrive.iMediaAtt == KMediaAttWriteProtected) |
|
241 { |
|
242 result = ETrue; |
|
243 } |
|
244 } |
245 } |
245 CleanupStack::PopAndDestroy(info); |
246 CleanupStack::PopAndDestroy(info); |
246 __FLOG(_L8("IsStoreReadOnlyL - Exit")); |
247 __FLOG(_L8("IsStoreReadOnlyL - Exit")); |
247 return result; |
248 return result; |
248 } |
249 } |