equal
deleted
inserted
replaced
169 { |
169 { |
170 TRACER("CGlxDRMUtility::ItemRightsValidityCheckL(RFile)"); |
170 TRACER("CGlxDRMUtility::ItemRightsValidityCheckL(RFile)"); |
171 #ifdef _DEBUG |
171 #ifdef _DEBUG |
172 TTime startTime; |
172 TTime startTime; |
173 startTime.HomeTime(); |
173 startTime.HomeTime(); |
174 #endif |
174 #endif |
|
175 TFileName fileName(KNullDesC); |
|
176 fileName.Append(aFileHandle.FullName(fileName)); |
|
177 if (iLastConsumedItemUri->Length() > 0) |
|
178 { |
|
179 if (fileName.CompareF(*iLastConsumedItemUri) == 0) |
|
180 { |
|
181 return ETrue; |
|
182 } |
|
183 } |
175 TBool rightsValid = EFalse; |
184 TBool rightsValid = EFalse; |
176 ContentAccess::TAttribute attrib = |
185 ContentAccess::TAttribute attrib = |
177 aCheckViewRights ? ContentAccess::ECanView : ContentAccess::ECanPlay; |
186 aCheckViewRights ? ContentAccess::ECanView : ContentAccess::ECanPlay; |
178 |
187 |
179 ContentAccess::CContent* content = ContentAccess::CContent::NewLC( |
188 ContentAccess::CContent* content = ContentAccess::CContent::NewLC( |
220 //============================================================================ |
229 //============================================================================ |
221 EXPORT_C TBool CGlxDRMUtility::DisplayItemRightsCheckL(RFile& aFileHandle, |
230 EXPORT_C TBool CGlxDRMUtility::DisplayItemRightsCheckL(RFile& aFileHandle, |
222 TBool aCheckViewRights) |
231 TBool aCheckViewRights) |
223 { |
232 { |
224 TRACER("CGlxDRMUtility::DisplayItemRightsCheckL(RFile)"); |
233 TRACER("CGlxDRMUtility::DisplayItemRightsCheckL(RFile)"); |
|
234 TFileName fileName(KNullDesC); |
|
235 fileName.Append(aFileHandle.FullName(fileName)); |
|
236 // Allow to display if rights for a URI was just consumed (i.e. same as stored URI) |
|
237 if (iLastConsumedItemUri->Length() > 0) |
|
238 { |
|
239 if (fileName.CompareF(*iLastConsumedItemUri) == 0) |
|
240 { |
|
241 return ETrue; |
|
242 } |
|
243 } |
|
244 |
|
245 //Clear the stored uri |
|
246 ClearLastConsumedItemUriL(); |
|
247 |
225 // Otherwise, check current rights for the URI of newly focused item |
248 // Otherwise, check current rights for the URI of newly focused item |
226 return ItemRightsValidityCheckL(aFileHandle, aCheckViewRights); |
249 return ItemRightsValidityCheckL(aFileHandle, aCheckViewRights); |
227 } |
250 } |
228 |
251 |
229 //============================================================================ |
252 //============================================================================ |
263 //============================================================================ |
286 //============================================================================ |
264 EXPORT_C TBool CGlxDRMUtility::ConsumeRightsL(RFile& aFileHandle) |
287 EXPORT_C TBool CGlxDRMUtility::ConsumeRightsL(RFile& aFileHandle) |
265 { |
288 { |
266 TRACER("CGlxDRMUtility::ConsumeRightsL(RFile)"); |
289 TRACER("CGlxDRMUtility::ConsumeRightsL(RFile)"); |
267 CData* data = CData::NewLC(aFileHandle, KDefaultContentObject(), EPeek); |
290 CData* data = CData::NewLC(aFileHandle, KDefaultContentObject(), EPeek); |
|
291 |
|
292 //When consuming rights for a URI, clear stored URI |
|
293 ClearLastConsumedItemUriL(); |
|
294 |
268 TInt err = data->ExecuteIntent(ContentAccess::EView); |
295 TInt err = data->ExecuteIntent(ContentAccess::EView); |
|
296 TFileName fileName(KNullDesC); |
|
297 fileName.Append(aFileHandle.FullName(fileName)); |
|
298 |
|
299 if (err == KErrNone) |
|
300 { |
|
301 //Update stored URI |
|
302 iLastConsumedItemUri = iLastConsumedItemUri->ReAllocL(fileName.Length()); |
|
303 TPtr newPtr = iLastConsumedItemUri->Des(); |
|
304 newPtr.Copy(fileName); |
|
305 } |
|
306 |
269 CleanupStack::PopAndDestroy(data); |
307 CleanupStack::PopAndDestroy(data); |
270 return (err == KErrNone); |
308 return (err == KErrNone); |
271 } |
309 } |
272 |
310 |
273 //============================================================================ |
311 //============================================================================ |