mtpdataproviders/mtpimagedp/src/mtpimagedputilits.cpp
changeset 22 a5c0bb5018eb
parent 17 aabe5387f5ce
equal deleted inserted replaced
20:6e82ae192c3a 22:a5c0bb5018eb
    62     aFramework.Fs().CharToDrive(drive[0], driveNumber);
    62     aFramework.Fs().CharToDrive(drive[0], driveNumber);
    63     
    63     
    64     return aFramework.StorageMgr().FrameworkStorageId(static_cast<TDriveNumber>(driveNumber));
    64     return aFramework.StorageMgr().FrameworkStorageId(static_cast<TDriveNumber>(driveNumber));
    65     }
    65     }
    66 
    66 
    67 TUint32 MTPImageDpUtilits::FindParentHandleL(MMTPDataProviderFramework& aFramework, CMTPImageDataProvider& aDataProvider, const TDesC& aFullPath)
    67 TUint32 MTPImageDpUtilits::FindParentHandleL(MMTPDataProviderFramework& aFramework, CMTPImageDataProvider& /*aDataProvider*/, const TDesC& aFullPath)
    68     {
    68     {
    69     TUint32 parentHandle = KMTPHandleNoParent;
    69     TUint32 parentHandle = KMTPHandleNoParent;
    70     TParsePtrC parse(aFullPath);
    70     TParsePtrC parse(aFullPath);
    71     
    71     
    72     if(!parse.IsRoot())
    72     if(!parse.IsRoot())
    73         {   
    73         {
    74         if (!aDataProvider.GetCacheParentHandle(parse.DriveAndPath(), parentHandle))
    74         parentHandle = aFramework.ObjectMgr().HandleL(parse.DriveAndPath());
    75             {
       
    76             parentHandle = aFramework.ObjectMgr().HandleL(parse.DriveAndPath());
       
    77             if (parentHandle != KMTPHandleNone)
       
    78                 {
       
    79                 aDataProvider.SetCacheParentHandle(parse.DriveAndPath(), parentHandle);                
       
    80                 }
       
    81             }
       
    82         }
    75         }
    83     
    76     
    84     return parentHandle;    
    77     return parentHandle;
    85     }
    78     }
    86 
    79 
    87 TBool MTPImageDpUtilits::IsNewPicture(const CMTPObjectMetaData& aMetadata)
    80 TBool MTPImageDpUtilits::IsNewPicture(const CMTPObjectMetaData& aMetadata)
    88     {
    81     {
    89     /**
    82     /**
    98     {
    91     {
    99     TInt status = aMetadata.Uint(CMTPObjectMetaData::EFormatSubCode) | IMAGE_OBJECT_STATUS_BITMASK;
    92     TInt status = aMetadata.Uint(CMTPObjectMetaData::EFormatSubCode) | IMAGE_OBJECT_STATUS_BITMASK;
   100     aMetadata.SetUint(CMTPObjectMetaData::EFormatSubCode, status);
    93     aMetadata.SetUint(CMTPObjectMetaData::EFormatSubCode, status);
   101     aFramework.ObjectMgr().ModifyObjectL(aMetadata);
    94     aFramework.ObjectMgr().ModifyObjectL(aMetadata);
   102     }
    95     }
   103 
       
   104 TInt MTPImageDpUtilits::GetThumbnailSize(const CMTPObjectMetaData& aMetadata)
       
   105     {    
       
   106     /**
       
   107      * query thumbnail size from EFormatSubCode column
       
   108      */
       
   109     return (aMetadata.Uint(CMTPObjectMetaData::EFormatSubCode) & IMAGE_OBJECT_THUMBNAIL_SIZE_BITMASK);
       
   110     }
       
   111 
       
   112 void MTPImageDpUtilits::UpdateObjectThumbnailSizeL(MMTPDataProviderFramework& aFramework, CMTPObjectMetaData& aMetadata, TInt aThumbnailSize)
       
   113     {
       
   114     //check thumbnail size whether it is overflow
       
   115     if (aThumbnailSize <= IMAGE_OBJECT_THUMBNAIL_SIZE_BITMASK)
       
   116         {
       
   117         TBool newPic = MTPImageDpUtilits::IsNewPicture(aMetadata);
       
   118         if (newPic)
       
   119             {
       
   120             aMetadata.SetUint(CMTPObjectMetaData::EFormatSubCode, aThumbnailSize);
       
   121             }
       
   122         else
       
   123             {
       
   124             aThumbnailSize |= IMAGE_OBJECT_STATUS_BITMASK;
       
   125             aMetadata.SetUint(CMTPObjectMetaData::EFormatSubCode, aThumbnailSize);
       
   126             }
       
   127         aFramework.ObjectMgr().ModifyObjectL(aMetadata);
       
   128         }
       
   129     }