167 iFramework(aFramework), |
169 iFramework(aFramework), |
168 iDataProvider(aDataProvider), |
170 iDataProvider(aDataProvider), |
169 iFs(aFramework.Fs()), |
171 iFs(aFramework.Fs()), |
170 iObjectMgr(aFramework.ObjectMgr()) |
172 iObjectMgr(aFramework.ObjectMgr()) |
171 { |
173 { |
172 __FLOG_OPEN(KMTPSubsystem, KComponent); |
|
173 } |
174 } |
174 |
175 |
175 void CMTPImageDpObjectPropertyMgr::ConstructL(MMTPDataProviderFramework& /*aFramework*/) |
176 void CMTPImageDpObjectPropertyMgr::ConstructL(MMTPDataProviderFramework& /*aFramework*/) |
176 { |
177 { |
177 __FLOG(_L8("CMTPImageDpObjectPropertyMgr::ConstructL - Entry")); |
|
178 iMetaDataSession = CMdESession::NewL(*this); |
178 iMetaDataSession = CMdESession::NewL(*this); |
179 __FLOG(_L8("CMTPImageDpObjectPropertyMgr::ConstructL - Exit")); |
|
180 } |
179 } |
181 |
180 |
182 CMTPImageDpObjectPropertyMgr::~CMTPImageDpObjectPropertyMgr() |
181 CMTPImageDpObjectPropertyMgr::~CMTPImageDpObjectPropertyMgr() |
183 { |
182 { |
184 __FLOG(_L8("CMTPImageDpObjectPropertyMgr::~CMTPImageDpObjectPropertyMgr - Entry")); |
183 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_CMTPIMAGEDPOBJECTPROPERTYMGR_DES_ENTRY ); |
185 delete iObject; |
184 delete iObject; |
186 delete iMetaDataSession; |
185 delete iMetaDataSession; |
187 delete iThumbnailCache.iThumbnailData; |
186 delete iThumbnailCache.iThumbnailData; |
188 |
187 |
189 //Clear propreties cache map |
188 //Clear propreties cache map |
190 ClearAllCache(); |
189 ClearAllCache(); |
191 iPropretiesCacheMap.Close(); |
190 iPropretiesCacheMap.Close(); |
192 __FLOG(_L8("CMTPImageDpObjectPropertyMgr::~CMTPImageDpObjectPropertyMgr - Exit")); |
191 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_CMTPIMAGEDPOBJECTPROPERTYMGR_DES_EXIT ); |
193 __FLOG_CLOSE; |
|
194 } |
192 } |
195 |
193 |
196 void CMTPImageDpObjectPropertyMgr::SetCurrentObjectL(CMTPObjectMetaData& aObjectInfo, TBool aRequireForModify, TBool aSaveToCache) |
194 void CMTPImageDpObjectPropertyMgr::SetCurrentObjectL(CMTPObjectMetaData& aObjectInfo, TBool aRequireForModify, TBool aSaveToCache) |
197 { |
195 { |
198 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::SetCurrentObjectL")); |
196 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_SETCURRENTOBJECTL_ENTRY ); |
199 iObjectInfo = &aObjectInfo; |
197 iObjectInfo = &aObjectInfo; |
200 |
198 |
201 /** |
199 /** |
202 * Image DP property manager will not directly modify properties which stored in the MdS |
200 * Image DP property manager will not directly modify properties which stored in the MdS |
203 */ |
201 */ |
223 if (aSaveToCache) |
221 if (aSaveToCache) |
224 { |
222 { |
225 TUint objectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle); |
223 TUint objectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle); |
226 if (FindPropertiesCache(objectHandle)) |
224 if (FindPropertiesCache(objectHandle)) |
227 { |
225 { |
228 __FLOG_VA((_L16("SetCurrentObjectL - find object in cache:%u"), objectHandle)); |
226 OstTrace1( TRACE_NORMAL, CMTPIMAGEDPOBJECTPROPERTYMGR_SETCURRENTOBJECTL, |
|
227 "SetCurrentObjectL - find object in cache:%u", objectHandle ); |
229 iCurrentPropertiesCache->ResetL(); |
228 iCurrentPropertiesCache->ResetL(); |
230 } |
229 } |
231 else |
230 else |
232 { |
231 { |
233 if (iPropretiesCacheMap.Count() > KCacheThreshold) |
232 if (iPropretiesCacheMap.Count() > KCacheThreshold) |
234 { |
233 { |
235 // Find the first object handle from cache map and then destory it |
234 // Find the first object handle from cache map and then destory it |
236 RHashMap<TUint, CMTPImagePropertiesCache*>::TIter iter(iPropretiesCacheMap); |
235 RHashMap<TUint, CMTPImagePropertiesCache*>::TIter iter(iPropretiesCacheMap); |
237 DestroyPropertiesCahce(*iter.NextKey()); |
236 DestroyPropertiesCahce(*iter.NextKey()); |
238 __FLOG_VA((_L16("SetCurrentObjectL - destory object:%u"), objectHandle)); |
237 OstTrace1( TRACE_NORMAL, DUP1_CMTPIMAGEDPOBJECTPROPERTYMGR_SETCURRENTOBJECTL, |
|
238 "SetCurrentObjectL - destory object:%u", objectHandle ); |
239 } |
239 } |
240 |
240 |
241 iCurrentPropertiesCache = CMTPImagePropertiesCache::NewL(); |
241 iCurrentPropertiesCache = CMTPImagePropertiesCache::NewL(); |
242 iPropretiesCacheMap.Insert(objectHandle, iCurrentPropertiesCache); |
242 iPropretiesCacheMap.Insert(objectHandle, iCurrentPropertiesCache); |
243 __FLOG_VA((_L16("SetCurrentObjectL - create new object:%u"), objectHandle)); |
243 OstTrace1( TRACE_NORMAL, DUP2_CMTPIMAGEDPOBJECTPROPERTYMGR_SETCURRENTOBJECTL, |
244 } |
244 "SetCurrentObjectL - create new object:%u", objectHandle ); |
245 } |
245 } |
246 } |
246 } |
247 |
247 } |
248 __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::SetCurrentObjectL")); |
248 |
|
249 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_SETCURRENTOBJECTL_EXIT ); |
249 } |
250 } |
250 |
251 |
251 void CMTPImageDpObjectPropertyMgr::SetPropertyL(TMTPObjectPropertyCode aProperty, const TUint8 aValue) |
252 void CMTPImageDpObjectPropertyMgr::SetPropertyL(TMTPObjectPropertyCode aProperty, const TUint8 aValue) |
252 { |
253 { |
253 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::SetPropertyL")); |
254 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_SETPROPERTYL_TUINT8_ENTRY ); |
254 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
255 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
255 |
256 |
256 if (aProperty == EMTPObjectPropCodeNonConsumable) |
257 if (aProperty == EMTPObjectPropCodeNonConsumable) |
257 { |
258 { |
258 iObjectInfo->SetUint(CMTPObjectMetaData::ENonConsumable, aValue); |
259 iObjectInfo->SetUint(CMTPObjectMetaData::ENonConsumable, aValue); |
259 } |
260 } |
260 else |
261 else |
261 { |
262 { |
|
263 OstTrace1( TRACE_ERROR, CMTPIMAGEDPOBJECTPROPERTYMGR_SETPROPERTYL, |
|
264 "property code %d not equal to EMTPObjectPropCodeNonConsumable", aProperty ); |
262 User::Leave(EMTPRespCodeObjectPropNotSupported); |
265 User::Leave(EMTPRespCodeObjectPropNotSupported); |
263 } |
266 } |
264 __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::SetPropertyL")); |
267 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_SETPROPERTYL_TUINT8_EXIT ); |
265 } |
268 } |
266 |
269 |
267 void CMTPImageDpObjectPropertyMgr::SetPropertyL(TMTPObjectPropertyCode aProperty, const TUint16 aValue) |
270 void CMTPImageDpObjectPropertyMgr::SetPropertyL(TMTPObjectPropertyCode aProperty, const TUint16 aValue) |
268 { |
271 { |
269 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::SetPropertyL")); |
272 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_SETPROPERTYL_TUINT16_ENTRY ); |
270 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
273 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
271 |
274 |
272 switch(aProperty) |
275 switch(aProperty) |
273 { |
276 { |
274 case EMTPObjectPropCodeObjectFormat: |
277 case EMTPObjectPropCodeObjectFormat: |
275 iObjectInfo->SetUint(CMTPObjectMetaData::EFormatCode, aValue); |
278 iObjectInfo->SetUint(CMTPObjectMetaData::EFormatCode, aValue); |
276 break; |
279 break; |
277 case EMTPObjectPropCodeProtectionStatus://this property does not supported by image dp |
280 case EMTPObjectPropCodeProtectionStatus://this property does not supported by image dp |
278 //nothing to do |
281 //nothing to do |
279 break; |
282 break; |
|
283 case EMTPObjectPropCodeHidden: |
|
284 { |
|
285 __ASSERT_ALWAYS(( EMTPHidden == aValue )||( EMTPVisible == aValue ), User::Leave(KErrArgument)); |
|
286 TEntry entry; |
|
287 User::LeaveIfError(iFramework.Fs().Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), entry)); |
|
288 if (( EMTPHidden == aValue ) && ( !entry.IsHidden())) |
|
289 { |
|
290 entry.iAtt &= ~KEntryAttHidden; |
|
291 entry.iAtt |= KEntryAttHidden; |
|
292 User::LeaveIfError(iFramework.Fs().SetAtt(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), entry.iAtt, ~entry.iAtt)); |
|
293 } |
|
294 else if (( EMTPVisible == aValue )&&( entry.IsHidden())) |
|
295 { |
|
296 entry.iAtt &= ~KEntryAttHidden; |
|
297 User::LeaveIfError(iFramework.Fs().SetAtt(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), entry.iAtt, ~entry.iAtt)); |
|
298 } |
|
299 } |
|
300 break; |
280 default: |
301 default: |
281 //nothing to do |
302 //nothing to do |
282 break; |
303 break; |
283 } |
304 } |
284 __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::SetPropertyL")); |
305 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_SETPROPERTYL_TUINT16_EXIT ); |
285 } |
306 } |
286 |
307 |
287 void CMTPImageDpObjectPropertyMgr::SetPropertyL(TMTPObjectPropertyCode aProperty, const TUint32 aValue) |
308 void CMTPImageDpObjectPropertyMgr::SetPropertyL(TMTPObjectPropertyCode aProperty, const TUint32 aValue) |
288 { |
309 { |
289 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::SetPropertyL")); |
310 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_SETPROPERTYL_TUINT32_ENTRY ); |
290 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
311 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
291 |
312 |
292 switch(aProperty) |
313 switch(aProperty) |
293 { |
314 { |
294 case EMTPObjectPropCodeStorageID: |
315 case EMTPObjectPropCodeStorageID: |
374 |
397 |
375 default: |
398 default: |
376 //nothing to do |
399 //nothing to do |
377 break; |
400 break; |
378 } |
401 } |
379 __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::SetPropertyL")); |
402 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_SETPROPERTYL_TDESC_EXIT ); |
380 } |
403 } |
381 |
404 |
382 void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, TUint8 &aValue) |
405 void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, TUint8 &aValue) |
383 { |
406 { |
384 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetPropertyL")); |
407 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETPROPERTYL_TUINT8_ENTRY ); |
385 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
408 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
386 |
409 |
387 if (aProperty == EMTPObjectPropCodeNonConsumable) |
410 if (aProperty == EMTPObjectPropCodeNonConsumable) |
388 { |
411 { |
389 aValue = iObjectInfo->Uint(CMTPObjectMetaData::ENonConsumable); |
412 aValue = iObjectInfo->Uint(CMTPObjectMetaData::ENonConsumable); |
390 } |
413 } |
391 else |
414 else |
392 { |
415 { |
|
416 OstTrace1( TRACE_ERROR, CMTPIMAGEDPOBJECTPROPERTYMGR_TUINT8_GETPROPERTYL, |
|
417 "property code %d not equal to EMTPObjectPropCodeNonConsumable", aProperty ); |
393 User::Leave(EMTPRespCodeObjectPropNotSupported); |
418 User::Leave(EMTPRespCodeObjectPropNotSupported); |
394 } |
419 } |
395 __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetPropertyL")); |
420 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETPROPERTYL_TUINT8_EXIT ); |
396 } |
421 } |
397 |
422 |
398 void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, TUint16 &aValue) |
423 void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, TUint16 &aValue) |
399 { |
424 { |
400 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetPropertyL")); |
425 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETPROPERTYL_TUINT16_ENTRY ); |
401 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
426 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
402 TEntry entry; |
427 TEntry entry; |
403 switch(aProperty) |
428 switch(aProperty) |
404 { |
429 { |
405 case EMTPObjectPropCodeObjectFormat: |
430 case EMTPObjectPropCodeObjectFormat: |
418 else |
443 else |
419 { |
444 { |
420 aValue = EMTPProtectionNoProtection; |
445 aValue = EMTPProtectionNoProtection; |
421 } |
446 } |
422 } |
447 } |
423 break; |
448 break; |
|
449 case EMTPObjectPropCodeHidden: |
|
450 { |
|
451 TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), entry); |
|
452 if ( err == KErrNone && entry.IsHidden()) |
|
453 { |
|
454 aValue = EMTPHidden; |
|
455 } |
|
456 else |
|
457 { |
|
458 aValue = EMTPVisible; |
|
459 } |
|
460 } |
|
461 break; |
424 default: |
462 default: |
425 aValue = 0;//initialization |
463 aValue = 0;//initialization |
426 //ingore the failure if we can't get properties form MdS |
464 //ingore the failure if we can't get properties form MdS |
427 TRAP_IGNORE(GetPropertyFromMdsL(aProperty, &aValue)); |
465 TRAP_IGNORE(GetPropertyFromMdsL(aProperty, &aValue)); |
428 break; |
466 break; |
429 } |
467 } |
430 __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetPropertyL")); |
468 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETPROPERTYL_TUINT16_EXIT ); |
431 } |
469 } |
432 |
470 |
433 void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, TUint32 &aValue, TBool alwaysCreate/* = ETrue*/) |
471 void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, TUint32 &aValue, TBool alwaysCreate/* = ETrue*/) |
434 { |
472 { |
435 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetPropertyL")); |
473 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETPROPERTYL_TUINT32_ENTRY ); |
436 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
474 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
437 |
475 |
438 switch(aProperty) |
476 switch(aProperty) |
439 { |
477 { |
440 case EMTPObjectPropCodeStorageID: |
478 case EMTPObjectPropCodeStorageID: |
505 aValue = 0;//initialization |
544 aValue = 0;//initialization |
506 //ingore the failure if we can't get properties form MdS |
545 //ingore the failure if we can't get properties form MdS |
507 TRAP_IGNORE(GetPropertyFromMdsL(aProperty, &aValue)); |
546 TRAP_IGNORE(GetPropertyFromMdsL(aProperty, &aValue)); |
508 break; |
547 break; |
509 } |
548 } |
510 __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetPropertyL")); |
549 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETPROPERTYL_TUINT32_EXIT ); |
511 } |
550 } |
512 |
551 |
513 void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, TUint64& aValue) |
552 void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, TUint64& aValue) |
514 { |
553 { |
515 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetPropertyL")); |
554 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETPROPERTYL_TUINT64_ENTRY ); |
516 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
555 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
517 |
556 |
518 if (aProperty == EMTPObjectPropCodeObjectSize) |
557 if (aProperty == EMTPObjectPropCodeObjectSize) |
519 { |
558 { |
520 TEntry entry; |
559 TEntry entry; |
521 iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), entry); |
560 iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), entry); |
522 aValue = entry.FileSize(); |
561 aValue = entry.FileSize(); |
523 } |
562 } |
524 else |
563 else |
525 { |
564 { |
|
565 OstTrace1( TRACE_ERROR, CMTPIMAGEDPOBJECTPROPERTYMGR_GETPROPERTYL_TUINT64, |
|
566 "property code %d not equal to EMTPObjectPropCodeObjectSize", aProperty ); |
526 User::Leave(EMTPRespCodeObjectPropNotSupported); |
567 User::Leave(EMTPRespCodeObjectPropNotSupported); |
527 } |
568 } |
528 __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetPropertyL")); |
569 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETPROPERTYL_TUINT64_EXIT ); |
529 } |
570 } |
530 |
571 |
531 void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, TMTPTypeUint128& aValue) |
572 void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, TMTPTypeUint128& aValue) |
532 { |
573 { |
533 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetPropertyL")); |
574 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETPROPERTYL_TMTPTYPEUINT128_ENTRY ); |
534 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
575 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
535 |
576 |
536 if (aProperty == EMTPObjectPropCodePersistentUniqueObjectIdentifier) |
577 if (aProperty == EMTPObjectPropCodePersistentUniqueObjectIdentifier) |
537 { |
578 { |
538 TUint32 handle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle); |
579 TUint32 handle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle); |
539 aValue = iObjectMgr.PuidL(handle); |
580 aValue = iObjectMgr.PuidL(handle); |
540 } |
581 } |
541 else |
582 else |
542 { |
583 { |
|
584 OstTrace1( TRACE_ERROR, CMTPIMAGEDPOBJECTPROPERTYMGR_GETPROPERTYL_TMTPTYPEUINT128, |
|
585 "property code %d not equal to EMTPObjectPropCodeObjectSize", aProperty ); |
543 User::Leave(EMTPRespCodeObjectPropNotSupported); |
586 User::Leave(EMTPRespCodeObjectPropNotSupported); |
544 } |
587 } |
545 __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetPropertyL")); |
588 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETPROPERTYL_TMTPTYPEUINT128_EXIT ); |
546 } |
589 } |
547 |
590 |
548 void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, CMTPTypeString& aValue) |
591 void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, CMTPTypeString& aValue) |
549 { |
592 { |
550 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetPropertyL")); |
593 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETPROPERTYL_CMTPTYPESTRING_ENTRY ); |
551 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
594 __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull)); |
552 |
595 |
553 switch(aProperty) |
596 switch(aProperty) |
554 { |
597 { |
555 case EMTPObjectPropCodeObjectFileName: |
598 case EMTPObjectPropCodeObjectFileName: |
556 { |
599 { |
557 TFileName name; |
600 TFileName name; |
558 User::LeaveIfError(BaflUtils::MostSignificantPartOfFullName(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), name)); |
601 LEAVEIFERROR(BaflUtils::MostSignificantPartOfFullName(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), name), |
|
602 OstTraceExt2( TRACE_ERROR, DUP1_CMTPIMAGEDPOBJECTPROPERTYMGR_GETPROPERTYL, |
|
603 "Can't get most significant part of %S! error code %d", iObjectInfo->DesC(CMTPObjectMetaData::ESuid), munged_err)); |
|
604 |
559 aValue.SetL(name); |
605 aValue.SetL(name); |
560 } |
606 } |
561 break; |
607 break; |
562 |
608 |
563 case EMTPObjectPropCodeName: |
609 case EMTPObjectPropCodeName: |
775 default: |
826 default: |
776 //nothing to do |
827 //nothing to do |
777 break; |
828 break; |
778 } |
829 } |
779 } |
830 } |
780 __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetPropertyFromMdsL")); |
831 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETPROPERTYFROMMDSL_EXIT ); |
781 } |
832 } |
782 |
833 |
783 TBool CMTPImageDpObjectPropertyMgr::GetYear(const TDesC& aDateString, TInt& aYear) const |
834 TBool CMTPImageDpObjectPropertyMgr::GetYear(const TDesC& aDateString, TInt& aYear) const |
784 { |
835 { |
785 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetYear")); |
836 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETYEAR_ENTRY ); |
786 aYear = 0; |
837 aYear = 0; |
787 TLex dateBuf(aDateString.Left(4)); |
838 TLex dateBuf(aDateString.Left(4)); |
788 __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetYear")); |
839 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETYEAR_EXIT ); |
789 return dateBuf.Val(aYear) == KErrNone; |
840 return dateBuf.Val(aYear) == KErrNone; |
790 } |
841 } |
791 |
842 |
792 TBool CMTPImageDpObjectPropertyMgr::GetMonth(const TDesC& aDateString, TMonth& aMonth) const |
843 TBool CMTPImageDpObjectPropertyMgr::GetMonth(const TDesC& aDateString, TMonth& aMonth) const |
793 { |
844 { |
794 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetMonth")); |
845 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETMONTH_ENTRY ); |
795 TBool result = EFalse; |
846 TBool result = EFalse; |
796 aMonth = EJanuary; |
847 aMonth = EJanuary; |
797 TInt month = 0; |
848 TInt month = 0; |
798 TLex dateBuf(aDateString.Mid(4, 2)); |
849 TLex dateBuf(aDateString.Mid(4, 2)); |
799 if(dateBuf.Val(month) == KErrNone && month > 0 && month < 13) |
850 if(dateBuf.Val(month) == KErrNone && month > 0 && month < 13) |
800 { |
851 { |
801 month--; |
852 month--; |
802 aMonth = (TMonth)month; |
853 aMonth = (TMonth)month; |
803 result = ETrue; |
854 result = ETrue; |
804 } |
855 } |
805 __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetMonth")); |
856 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETMONTH_EXIT ); |
806 return result; |
857 return result; |
807 } |
858 } |
808 |
859 |
809 TBool CMTPImageDpObjectPropertyMgr::GetDay(const TDesC& aDateString, TInt& aDay) const |
860 TBool CMTPImageDpObjectPropertyMgr::GetDay(const TDesC& aDateString, TInt& aDay) const |
810 { |
861 { |
811 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetDay")); |
862 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETDAY_ENTRY ); |
812 TBool result = EFalse; |
863 TBool result = EFalse; |
813 aDay = 0; |
864 aDay = 0; |
814 TLex dateBuf(aDateString.Mid(6, 2)); |
865 TLex dateBuf(aDateString.Mid(6, 2)); |
815 if(dateBuf.Val(aDay) == KErrNone && aDay > 0 && aDay < 32) |
866 if(dateBuf.Val(aDay) == KErrNone && aDay > 0 && aDay < 32) |
816 { |
867 { |
817 aDay--; |
868 aDay--; |
818 result = ETrue; |
869 result = ETrue; |
819 } |
870 } |
820 __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetDay")); |
871 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETDAY_EXIT ); |
821 return result; |
872 return result; |
822 } |
873 } |
823 |
874 |
824 TBool CMTPImageDpObjectPropertyMgr::GetHour(const TDesC& aDateString, TInt& aHour) const |
875 TBool CMTPImageDpObjectPropertyMgr::GetHour(const TDesC& aDateString, TInt& aHour) const |
825 { |
876 { |
826 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetHour")); |
877 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETHOUR_ENTRY ); |
827 aHour = 0; |
878 aHour = 0; |
828 TLex dateBuf(aDateString.Mid(9, 2)); |
879 TLex dateBuf(aDateString.Mid(9, 2)); |
829 __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetHour")); |
880 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETHOUR_EXIT ); |
830 return (dateBuf.Val(aHour) == KErrNone && aHour >=0 && aHour < 60); |
881 return (dateBuf.Val(aHour) == KErrNone && aHour >=0 && aHour < 60); |
831 } |
882 } |
832 |
883 |
833 TBool CMTPImageDpObjectPropertyMgr::GetMinute(const TDesC& aDateString, TInt& aMinute) const |
884 TBool CMTPImageDpObjectPropertyMgr::GetMinute(const TDesC& aDateString, TInt& aMinute) const |
834 { |
885 { |
835 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetMinute")); |
886 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETMINUTE_ENTRY ); |
836 aMinute = 0; |
887 aMinute = 0; |
837 TLex dateBuf(aDateString.Mid(11, 2)); |
888 TLex dateBuf(aDateString.Mid(11, 2)); |
838 __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetMinute")); |
889 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETMINUTE_EXIT ); |
839 return (dateBuf.Val(aMinute) == KErrNone && aMinute >=0 && aMinute < 60); |
890 return (dateBuf.Val(aMinute) == KErrNone && aMinute >=0 && aMinute < 60); |
840 } |
891 } |
841 |
892 |
842 TBool CMTPImageDpObjectPropertyMgr::GetSecond(const TDesC& aDateString, TInt& aSecond) const |
893 TBool CMTPImageDpObjectPropertyMgr::GetSecond(const TDesC& aDateString, TInt& aSecond) const |
843 { |
894 { |
844 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetSecond")); |
895 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETSECOND_ENTRY ); |
845 aSecond = 0; |
896 aSecond = 0; |
846 TLex dateBuf(aDateString.Mid(13, 2)); |
897 TLex dateBuf(aDateString.Mid(13, 2)); |
847 __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetSecond")); |
898 OstTraceFunctionExit0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETSECOND_EXIT ); |
848 return (dateBuf.Val(aSecond) == KErrNone && aSecond >= 0 && aSecond < 60); |
899 return (dateBuf.Val(aSecond) == KErrNone && aSecond >= 0 && aSecond < 60); |
849 } |
900 } |
850 |
901 |
851 TBool CMTPImageDpObjectPropertyMgr::GetTenthSecond(const TDesC& aDateString, TInt& aTenthSecond) const |
902 TBool CMTPImageDpObjectPropertyMgr::GetTenthSecond(const TDesC& aDateString, TInt& aTenthSecond) const |
852 { |
903 { |
853 __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetTenthSecond")); |
904 OstTraceFunctionEntry0( CMTPIMAGEDPOBJECTPROPERTYMGR_GETTENTHSECOND_ENTRY ); |
854 TBool result = EFalse; |
905 TBool result = EFalse; |
855 aTenthSecond = 0; |
906 aTenthSecond = 0; |
856 TInt dotPos = aDateString.Find(_L(".")); |
907 TInt dotPos = aDateString.Find(_L(".")); |
857 if(dotPos != KErrNotFound && dotPos < aDateString.Length() - 1) |
908 if(dotPos != KErrNotFound && dotPos < aDateString.Length() - 1) |
858 { |
909 { |
891 ||!GetHour(aTimeString,hour) |
942 ||!GetHour(aTimeString,hour) |
892 ||!GetMinute(aTimeString,minute) |
943 ||!GetMinute(aTimeString,minute) |
893 ||!GetSecond(aTimeString,second) |
944 ||!GetSecond(aTimeString,second) |
894 ||!GetTenthSecond(aTimeString,tenthSecond)) |
945 ||!GetTenthSecond(aTimeString,tenthSecond)) |
895 { |
946 { |
|
947 OstTrace0( TRACE_ERROR, CMTPIMAGEDPOBJECTPROPERTYMGR_CONVERTMTPTIMESTR2TTIMEL, "Failed to extract date/time details!"); |
896 User::Leave(KErrArgument); |
948 User::Leave(KErrArgument); |
897 } |
949 } |
898 else |
950 else |
899 { |
951 { |
900 TDateTime dateTime(year, month, day, hour, minute, second, tenthSecond); |
952 TDateTime dateTime(year, month, day, hour, minute, second, tenthSecond); |