mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp
branchRCL_3
changeset 42 0aa8cc770c8a
parent 40 453dfc402455
child 43 4a793f564d72
equal deleted inserted replaced
40:453dfc402455 42:0aa8cc770c8a
   452         /**
   452         /**
   453          * try to query thumbnail from TNM, and then store thumbnail to cache
   453          * try to query thumbnail from TNM, and then store thumbnail to cache
   454          */
   454          */
   455         TEntry fileEntry;
   455         TEntry fileEntry;
   456         TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry);
   456         TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry);
   457         if (err == KErrNone)
   457         CMTPImageDpThumbnailCreator* tnc = iDataProvider.ThumbnailManager();
   458             {
   458         if (err == KErrNone && tnc != NULL)
       
   459             {
       
   460             
   459             if(fileEntry.FileSize() > KFileSizeMax || !alwaysCreate)
   461             if(fileEntry.FileSize() > KFileSizeMax || !alwaysCreate)
   460                 {
   462                 {
   461                 iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
   463                 tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
   462                 }
   464                 }
   463             else
   465             else
   464                 {
   466                 {
   465                 iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
   467                 tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
   466                 }
   468                 }
   467             
   469             
   468             /**
   470             /**
   469              * trap the leave to avoid return general error when PC get object property list
   471              * trap the leave to avoid return general error when PC get object property list
   470              */
   472              */
   471             TRAP(err, iDataProvider.ThumbnailManager().GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err));
   473             TRAP(err, tnc->GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err));
   472             if (err == KErrNone)
   474             if (err == KErrNone)
   473                 {
   475                 {
   474                 iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle);                        
   476                 iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle);                        
   475                 if (iThumbnailCache.iThumbnailData != NULL)
   477                 if (iThumbnailCache.iThumbnailData != NULL)
   476                     {
   478                     {
   481                     {
   483                     {
   482                     //trigger initiator to re-query thumbnail again if the thumbnail size of response is zero
   484                     //trigger initiator to re-query thumbnail again if the thumbnail size of response is zero
   483                     aValue = KThumbCompressedSize;
   485                     aValue = KThumbCompressedSize;
   484                     }
   486                     }
   485                 }
   487                 }
       
   488             }
       
   489         else
       
   490             {
       
   491             aValue = KThumbCompressedSize;
   486             }
   492             }
   487         }
   493         }
   488         break;       
   494         break;       
   489        
   495        
   490     case EMTPObjectPropCodeRepresentativeSampleHeight:
   496     case EMTPObjectPropCodeRepresentativeSampleHeight:
   597             /**
   603             /**
   598              * try to query thumbnail from TNM, and then store thumbnail to cache
   604              * try to query thumbnail from TNM, and then store thumbnail to cache
   599              */
   605              */
   600             TEntry fileEntry;
   606             TEntry fileEntry;
   601             TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry);
   607             TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry);
   602             if (err == KErrNone)
   608             CMTPImageDpThumbnailCreator* tnc = iDataProvider.ThumbnailManager();
       
   609             if (err == KErrNone && tnc != NULL)
   603                 {
   610                 {
   604                 
   611                 
   605                 if(fileEntry.FileSize() > KFileSizeMax || !alwaysCreate)
   612                 if(fileEntry.FileSize() > KFileSizeMax || !alwaysCreate)
   606                     {
   613                     {
   607                     iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
   614                     tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
   608                     }
   615                     }
   609                 else
   616                 else
   610                     {
   617                     {
   611                     iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
   618                     tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
   612                     }
   619                     }
   613                 
   620                 
   614                 /**
   621                 /**
   615                  * trap the leave to avoid return general error when PC get object property list
   622                  * trap the leave to avoid return general error when PC get object property list
   616                  */
   623                  */
   617                 TRAP(err, iDataProvider.ThumbnailManager().GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err));
   624                 TRAP(err, tnc->GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err));
   618                 if (err == KErrNone)
   625                 if (err == KErrNone)
   619                     {
   626                     {
   620                     iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle);                        
   627                     iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle);                        
   621                     if (iThumbnailCache.iThumbnailData != NULL)
   628                     if (iThumbnailCache.iThumbnailData != NULL)
   622                         {
   629                         {