132 if(drm) |
132 if(drm) |
133 { |
133 { |
134 expired = iDrmUtility->CheckOpenRightsL(uri, (cat == EMPXImage)); |
134 expired = iDrmUtility->CheckOpenRightsL(uri, (cat == EMPXImage)); |
135 if( expired ) |
135 if( expired ) |
136 { |
136 { |
137 // 200 is to Consume rights only while opening DRM items |
137 if ( isValid ) |
138 // in Cover Flow Widget |
|
139 if ( aSize.iWidth > 200 && aIsFocused) |
|
140 { |
|
141 ConsumeDRMRightsL( aMedia ); |
|
142 } |
|
143 if ( isValid ) |
|
144 { |
138 { |
145 // Fix for EABI-7RL9DD |
139 // Fix for EABI-7RL9DD |
146 // Replaced defaultSize with aSize |
140 // Replaced defaultSize with aSize |
147 TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateThumbnailTextureL( |
141 TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateThumbnailTextureL( |
148 aMedia, aMedia.IdSpaceId(), aSize, this ).Id() ); |
142 aMedia, aMedia.IdSpaceId(), aSize, this ).Id() ); |
164 { |
158 { |
165 GLX_DEBUG1("GlxThumbnailVariantType::CreateIconTextureL"); |
159 GLX_DEBUG1("GlxThumbnailVariantType::CreateIconTextureL"); |
166 TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateIconTextureL( |
160 TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateIconTextureL( |
167 icon.bitmapId, resFile, defaultSize ).Id() ); |
161 icon.bitmapId, resFile, defaultSize ).Id() ); |
168 } |
162 } |
169 else if ( KErrNone == thumbnailError || KErrArgument == thumbnailError || ( drm && isValid == EGlxDrmRightsInvalid ) ) |
163 else if ( (KErrNone == thumbnailError) || (KErrArgument == thumbnailError) |
170 |
164 || (KErrDiskFull == thumbnailError) || ( drm && isValid == EGlxDrmRightsInvalid ) ) |
171 { |
165 { |
172 //Try and see if we can scale and show the grid tnm else show the default |
166 //Try and see if we can scale and show the grid tnm else show the default |
173 TBool isGridTnmShown = EFalse; |
167 TBool isGridTnmShown = EFalse; |
174 if(HasRelevantThumbnail(aMedia,defaultSize)) |
168 if(HasRelevantThumbnail(aMedia,defaultSize)) |
175 { |
169 { |
176 TSize origSize; |
170 TSize origSize; |
208 { |
202 { |
209 GLX_DEBUG2("GlxThumbnailVariantType::ConstructL() ERROR err=%d", err); |
203 GLX_DEBUG2("GlxThumbnailVariantType::ConstructL() ERROR err=%d", err); |
210 throw std::bad_alloc(); |
204 throw std::bad_alloc(); |
211 } |
205 } |
212 } |
206 } |
213 |
|
214 void GlxThumbnailVariantType::ConsumeDRMRightsL( const TGlxMedia& aMedia ) |
|
215 { |
|
216 TRACER("GlxThumbnailVariantType::ConsumeDRMRightsL"); |
|
217 |
|
218 const CGlxMedia* media = aMedia.Properties(); |
|
219 |
|
220 if(media) |
|
221 { |
|
222 if(aMedia.IsDrmProtected()) |
|
223 { |
|
224 |
|
225 TMPXGeneralCategory cat = aMedia.Category(); |
|
226 const TDesC& uri = aMedia.Uri(); |
|
227 if( cat != EMPXNoCategory && uri.Length() > 0 ) |
|
228 { |
|
229 |
|
230 // check if rights have expired |
|
231 TBool expired = !iDrmUtility->CheckOpenRightsL(uri, (cat == EMPXImage)); |
|
232 |
|
233 if(expired) |
|
234 { |
|
235 return; |
|
236 } |
|
237 |
|
238 TSize size; |
|
239 if(EMPXImage == cat && aMedia.GetDimensions(size)) |
|
240 { |
|
241 // check size |
|
242 TSize bmpSize = ThumbnailSize(media); |
|
243 |
|
244 if(ConsumeRightsBasedOnSize(size, bmpSize)) |
|
245 { |
|
246 // pass URI to DRM utility |
|
247 iDrmUtility->ConsumeRightsL(uri); |
|
248 } |
|
249 } |
|
250 } |
|
251 } |
|
252 else |
|
253 { |
|
254 // not an DRM'd item no need to check again |
|
255 } |
|
256 } |
|
257 |
|
258 } |
|
259 |
207 |
260 // ----------------------------------------------------------------------------- |
208 // ----------------------------------------------------------------------------- |
261 // ConsumeRightsBasedOnSize - check if DRM rights should be consumed |
209 // ConsumeRightsBasedOnSize - check if DRM rights should be consumed |
262 // ----------------------------------------------------------------------------- |
210 // ----------------------------------------------------------------------------- |
263 // |
211 // |
324 // ThumbnailSizeAndQuality - search for largest available thumbnail |
272 // ThumbnailSizeAndQuality - search for largest available thumbnail |
325 // ----------------------------------------------------------------------------- |
273 // ----------------------------------------------------------------------------- |
326 // |
274 // |
327 TSize GlxThumbnailVariantType::ThumbnailSize(const CGlxMedia* aMedia) |
275 TSize GlxThumbnailVariantType::ThumbnailSize(const CGlxMedia* aMedia) |
328 { |
276 { |
329 TRACER("CGlxCommandHandlerDrm::ThumbnailSize"); |
277 TRACER("GlxThumbnailVariantType::ThumbnailSize"); |
330 TSize bmpSize(0,0); |
278 TSize bmpSize(0,0); |
331 |
279 |
332 TArray<TMPXAttribute> attr = aMedia->Attributes(); |
280 TArray<TMPXAttribute> attr = aMedia->Attributes(); |
333 |
281 |
334 TInt selectedHeight = 0; |
282 TInt selectedHeight = 0; |