78 */ |
78 */ |
79 void CMTPImageDpGetThumb::ConstructL() |
79 void CMTPImageDpGetThumb::ConstructL() |
80 { |
80 { |
81 __FLOG_OPEN(KMTPSubsystem, KComponent); |
81 __FLOG_OPEN(KMTPSubsystem, KComponent); |
82 __FLOG(_L8("CMTPImageDpGetThumb::ConstructL")); |
82 __FLOG(_L8("CMTPImageDpGetThumb::ConstructL")); |
83 iThumb = CMTPTypeOpaqueData::NewL(); |
83 iThumb = CMTPTypeOpaqueData::NewL(); |
84 iObjectMeta = CMTPObjectMetaData::NewL(); |
84 iObjectMeta = CMTPObjectMetaData::NewL(); |
85 __FLOG(_L8("CMTPImageDpGetThumb::ConstructL")); |
85 __FLOG(_L8("CMTPImageDpGetThumb::ConstructL")); |
86 } |
86 } |
87 |
87 |
88 |
88 |
100 */ |
100 */ |
101 void CMTPImageDpGetThumb::ServiceL() |
101 void CMTPImageDpGetThumb::ServiceL() |
102 { |
102 { |
103 __FLOG(_L8(">> CMTPImageDpGetThumb::ServiceL")); |
103 __FLOG(_L8(">> CMTPImageDpGetThumb::ServiceL")); |
104 TInt err = KErrNone; |
104 TInt err = KErrNone; |
105 TEntry fileEntry; |
|
106 |
105 |
107 User::LeaveIfError(iFramework.Fs().Entry(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), fileEntry)); |
106 //at first, try to query thumbnail from property manager |
108 imgDp.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags); |
107 HBufC8* thumbnailData = imgDp.PropertyMgr().Thumbnail(iObjectMeta->Uint(CMTPObjectMetaData::EHandle)); |
109 if(fileEntry.iSize > KFileSizeMax) |
108 if (thumbnailData == NULL) |
110 { |
109 { |
111 __FLOG(_L8(">> CMTPImageDpGetThumb::ServiceL, fileEntry.iSize > KFileSizeMax")); |
110 __FLOG(_L8("CMTPImageDpGetThumb::ServiceL- fail to query thumbnail from cache")); |
112 imgDp.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate); |
111 TEntry fileEntry; |
|
112 |
|
113 User::LeaveIfError(iFramework.Fs().Entry(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), fileEntry)); |
|
114 imgDp.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags); |
|
115 if(fileEntry.FileSize() > KFileSizeMax) |
|
116 { |
|
117 __FLOG(_L8(">> CMTPImageDpGetThumb::ServiceL, fileEntry.FileSize() > KFileSizeMax")); |
|
118 imgDp.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate); |
|
119 } |
|
120 |
|
121 imgDp.ThumbnailManager().GetThumbnailL(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), thumbnailData, err); |
|
122 User::LeaveIfError(err); |
|
123 User::LeaveIfNull(thumbnailData); |
|
124 |
|
125 //Transfer ownership of thumbnailData to Property Manager |
|
126 imgDp.PropertyMgr().StoreThunmnail(iObjectMeta->Uint(CMTPObjectMetaData::EHandle), thumbnailData); |
113 } |
127 } |
114 imgDp.ThumbnailManager().GetThumbnailL(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), *iThumb, err); |
128 iThumb->Write(*thumbnailData); |
115 User::LeaveIfError(err); |
|
116 SendDataL(*iThumb); |
129 SendDataL(*iThumb); |
117 __FLOG(_L8("<< CMTPImageDpGetThumb::ServiceL")); |
130 __FLOG(_L8("<< CMTPImageDpGetThumb::ServiceL")); |
118 } |
131 } |
119 |
132 |
120 TBool CMTPImageDpGetThumb::DoHandleCompletingPhaseL() |
133 TBool CMTPImageDpGetThumb::DoHandleCompletingPhaseL() |