mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp
branchRCL_3
changeset 6 ef55b168cedb
parent 4 60a94a45d437
child 12 523717cdb0ad
equal deleted inserted replaced
5:3673b591050c 6:ef55b168cedb
   218     iReceivedObject = CMTPObjectMetaData::NewL();
   218     iReceivedObject = CMTPObjectMetaData::NewL();
   219     iReceivedObject->SetUint(CMTPObjectMetaData::EDataProviderId, iFramework.DataProviderId());
   219     iReceivedObject->SetUint(CMTPObjectMetaData::EDataProviderId, iFramework.DataProviderId());
   220     iDpSingletons.OpenL(iFramework);
   220     iDpSingletons.OpenL(iFramework);
   221     iNoRollback = EFalse;
   221     iNoRollback = EFalse;
   222     iSingletons.OpenL();
   222     iSingletons.OpenL();
       
   223     _LIT(KM4A, ".m4a");
       
   224     _LIT(KODF, ".odf");
       
   225     iExceptionList.AppendL(KM4A());
       
   226     iExceptionList.AppendL(KODF());
   223     __FLOG(_L8("ConstructL - Exit"));
   227     __FLOG(_L8("ConstructL - Exit"));
   224     }
   228     }
   225 
   229 
   226 /**
   230 /**
   227 Override to match both the SendObjectInfo and SendObject requests
   231 Override to match both the SendObjectInfo and SendObject requests
   705         //on receiving the corresponding SendObject request.  With Associations however 
   709         //on receiving the corresponding SendObject request.  With Associations however 
   706         //we commit the object straight away as the SendObject phase is often absent 
   710         //we commit the object straight away as the SendObject phase is often absent 
   707         //with folder creation.
   711         //with folder creation.
   708 
   712 
   709         if(!iIsFolder)
   713         if(!iIsFolder)
   710         	{
   714             {
   711 			SetPropertiesL();    
   715             SetPropertiesL();    
   712         	iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObject);
   716             iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObject);
   713         	
   717             iFullPath.LowerCase();
   714         	TParsePtrC file( iFullPath );
   718             __FLOG_VA((_L8("File Name %S"), &iFullPath));
   715         	_LIT( KTxtExtensionODF, ".odf" );
   719             TParsePtrC file( iFullPath );
   716         	if ( file.ExtPresent() && file.Ext().CompareF(KTxtExtensionODF)==0 )
   720             if ( file.ExtPresent() && iExceptionList.Find(file.Ext()) != KErrNotFound)
   717         	    {
   721                 {
   718         	    TUint32 DpId = iFramework.DataProviderId();
   722                 TUint32 DpId = iFramework.DataProviderId();
   719         	    DpId = iDpSingletons.MTPUtility().GetDpId(file.Ext().Mid(1),KNullDesC);
   723                 HBufC* mime = iDpSingletons.MTPUtility().ContainerMimeType(iFullPath);
   720         	    //The data provider which owns all mimetypes of a file extension is not found 
   724                 CleanupStack::PushL(mime);
   721         	    if ( 255 == DpId )
   725                 if ( mime != NULL )
   722         	        {
   726                     {
   723         	        HBufC* mime = NULL;
   727                     DpId = iDpSingletons.MTPUtility().GetDpIdL(file.Ext().Mid(1),*mime);
   724         	        mime = iDpSingletons.MTPUtility().ContainerMimeType(iFullPath);
   728                     }
   725         	        if ( mime != NULL )
   729                 else
   726         	            {
   730                     {
   727         	            DpId = iDpSingletons.MTPUtility().GetDpId(file.Ext().Mid(1),*mime);
   731                     DpId = iDpSingletons.MTPUtility().GetDpIdL(file.Ext().Mid(1), KNullDesC);
   728         	            delete mime;
   732                     }
   729         	            mime = NULL;
   733                 if ( DpId!=iFramework.DataProviderId())
   730         	            }
   734                     {
   731         	        }
   735                     iReceivedObject->SetUint(CMTPObjectMetaData::EDataProviderId,DpId);
   732         	    if ( DpId!=iFramework.DataProviderId() && DpId!=255)
   736                     TUint32 format = EMTPFormatCodeUndefined;
   733         	        {
   737                     TUint16 subFormat = 0;
   734         	        iReceivedObject->SetUint(CMTPObjectMetaData::EDataProviderId,DpId);
   738                     if(mime != NULL)
   735         	        //iReceivedObject->SetUint(CMTPObjectMetaData::EFormatCode,format);
   739                         {
   736         	        iFramework.ObjectMgr().ModifyObjectL(*iReceivedObject);
   740                         format = iDpSingletons.MTPUtility().GetFormatCodeByMimeTypeL(file.Ext().Mid(1),*mime);
   737         	        TUint32 handle = iReceivedObject->Uint(CMTPObjectMetaData::EHandle);
   741                         subFormat = iDpSingletons.MTPUtility().GetSubFormatCodeL(file.Ext().Mid(1),*mime);
   738         	        iSingletons.DpController().NotifyDataProvidersL(DpId,EMTPObjectAdded,(TAny*)&handle);
   742                         }
   739         	        }
   743                     else
   740         	    }
   744                         {
   741         	}
   745                         format = iDpSingletons.MTPUtility().GetFormatByExtension(file.Ext().Mid(1));
       
   746                         }
       
   747                     iReceivedObject->SetUint(CMTPObjectMetaData::EFormatCode,format);
       
   748                     iReceivedObject->SetUint(CMTPObjectMetaData::EFormatSubCode,subFormat);
       
   749                     iFramework.ObjectMgr().ModifyObjectL(*iReceivedObject);
       
   750                     TUint32 handle = iReceivedObject->Uint(CMTPObjectMetaData::EHandle);
       
   751                     iSingletons.DpController().NotifyDataProvidersL(DpId,EMTPObjectAdded,(TAny*)&handle);
       
   752                     }
       
   753                 CleanupStack::PopAndDestroy(mime);
       
   754                 }
       
   755             }
   742         
   756         
   743         SendResponseL(EMTPRespCodeOK);
   757         SendResponseL(EMTPRespCodeOK);
   744 	    }
   758 	    }
   745     __FLOG(_L8("DoHandleSendObjectCompleteL - Exit"));
   759     __FLOG(_L8("DoHandleSendObjectCompleteL - Exit"));
   746     return result;
   760     return result;