mtpdataproviders/mtpimagedp/src/cmtpimagedpcopyobject.cpp
branchRCL_3
changeset 11 4843bb5893b6
parent 0 d0791faffa3f
child 29 3ae5cb0b4c02
child 32 f85613f12947
equal deleted inserted replaced
6:f8e15b44d440 11:4843bb5893b6
    83 /**
    83 /**
    84 Standard c++ constructor
    84 Standard c++ constructor
    85 */	
    85 */	
    86 CMTPImageDpCopyObject::CMTPImageDpCopyObject(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection,CMTPImageDataProvider& aDataProvider) :
    86 CMTPImageDpCopyObject::CMTPImageDpCopyObject(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection,CMTPImageDataProvider& aDataProvider) :
    87     CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPCopyObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPCopyObjectPolicy),
    87     CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPCopyObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPCopyObjectPolicy),
       
    88     iFramework(aFramework),
    88     iDataProvider(aDataProvider)
    89     iDataProvider(aDataProvider)
    89     {
    90     {
    90     __FLOG_OPEN(KMTPSubsystem, KComponent);
    91     __FLOG_OPEN(KMTPSubsystem, KComponent);
    91     }
    92     }
    92     
    93     
   191     User::LeaveIfError(iFileMan->Copy(aOldFileName, *iDest));
   192     User::LeaveIfError(iFileMan->Copy(aOldFileName, *iDest));
   192     iRollbackActionL.Append(RollBackFromFsL);
   193     iRollbackActionL.Append(RollBackFromFsL);
   193     SetPreviousPropertiesL(aNewFileName);
   194     SetPreviousPropertiesL(aNewFileName);
   194     
   195     
   195     iFramework.ObjectMgr().InsertObjectL(*iTargetObjectInfo);
   196     iFramework.ObjectMgr().InsertObjectL(*iTargetObjectInfo);
       
   197     //check object whether it is a new image object
       
   198     if (MTPImageDpUtilits::IsNewPicture(*iTargetObjectInfo))
       
   199         {
       
   200         //increate new pictures count
       
   201         iDataProvider.IncreaseNewPictures(1);
       
   202         }    
       
   203     
   196     __FLOG(_L8("<< CMTPImageDpCopyObject::CopyFileL"));
   204     __FLOG(_L8("<< CMTPImageDpCopyObject::CopyFileL"));
   197     CleanupStack::Pop(this);
   205     CleanupStack::Pop(this);
   198     return iTargetObjectInfo->Uint(CMTPObjectMetaData::EHandle);
   206     return iTargetObjectInfo->Uint(CMTPObjectMetaData::EHandle);
   199     }
   207     }
   200 
   208 
   259     TDriveNumber drive(static_cast<TDriveNumber>(iFramework.StorageMgr().DriveNumber(iStorageId)));
   267     TDriveNumber drive(static_cast<TDriveNumber>(iFramework.StorageMgr().DriveNumber(iStorageId)));
   260     User::LeaveIfError(drive);
   268     User::LeaveIfError(drive);
   261     TVolumeInfo volumeInfo;
   269     TVolumeInfo volumeInfo;
   262     User::LeaveIfError(iFramework.Fs().Volume(volumeInfo, drive));
   270     User::LeaveIfError(iFramework.Fs().Volume(volumeInfo, drive));
   263     
   271     
   264     if(volumeInfo.iFree < fileEntry.iSize)
   272     if(volumeInfo.iFree < fileEntry.FileSize())
   265         {
   273         {
   266         result = EMTPRespCodeStoreFull;
   274         result = EMTPRespCodeStoreFull;
   267         }
   275         }
   268     else if (BaflUtils::FileExists(iFramework.Fs(), aNewName))			
   276     else if (BaflUtils::FileExists(iFramework.Fs(), aNewName))			
   269         {
   277         {
   293     User::LeaveIfError(iFramework.Fs().SetModified(aNewFileName, iDateModified));
   301     User::LeaveIfError(iFramework.Fs().SetModified(aNewFileName, iDateModified));
   294     
   302     
   295     iTargetObjectInfo = CMTPObjectMetaData::NewL();
   303     iTargetObjectInfo = CMTPObjectMetaData::NewL();
   296     iTargetObjectInfo->SetUint(CMTPObjectMetaData::EDataProviderId, iSrcObjectInfo->Uint(CMTPObjectMetaData::EDataProviderId));
   304     iTargetObjectInfo->SetUint(CMTPObjectMetaData::EDataProviderId, iSrcObjectInfo->Uint(CMTPObjectMetaData::EDataProviderId));
   297     iTargetObjectInfo->SetUint(CMTPObjectMetaData::EFormatCode, iSrcObjectInfo->Uint(CMTPObjectMetaData::EFormatCode));
   305     iTargetObjectInfo->SetUint(CMTPObjectMetaData::EFormatCode, iSrcObjectInfo->Uint(CMTPObjectMetaData::EFormatCode));
       
   306     iTargetObjectInfo->SetUint(CMTPObjectMetaData::EFormatSubCode, iSrcObjectInfo->Uint(CMTPObjectMetaData::EFormatSubCode));
   298     iTargetObjectInfo->SetDesCL(CMTPObjectMetaData::EName, iSrcObjectInfo->DesC(CMTPObjectMetaData::EName));
   307     iTargetObjectInfo->SetDesCL(CMTPObjectMetaData::EName, iSrcObjectInfo->DesC(CMTPObjectMetaData::EName));
   299     iTargetObjectInfo->SetUint(CMTPObjectMetaData::ENonConsumable, iSrcObjectInfo->Uint(CMTPObjectMetaData::ENonConsumable));
   308     iTargetObjectInfo->SetUint(CMTPObjectMetaData::ENonConsumable, iSrcObjectInfo->Uint(CMTPObjectMetaData::ENonConsumable));
   300     iTargetObjectInfo->SetUint(CMTPObjectMetaData::EParentHandle, iNewParentHandle);
   309     iTargetObjectInfo->SetUint(CMTPObjectMetaData::EParentHandle, iNewParentHandle);
   301     iTargetObjectInfo->SetUint(CMTPObjectMetaData::EStorageId, iStorageId);
   310     iTargetObjectInfo->SetUint(CMTPObjectMetaData::EStorageId, iStorageId);
   302     iTargetObjectInfo->SetDesCL(CMTPObjectMetaData::ESuid, aNewFileName);
   311     iTargetObjectInfo->SetDesCL(CMTPObjectMetaData::ESuid, aNewFileName);