diff -r 2f67eb14d003 -r 4a2987baf8f7 harvesterplugins/media/image/src/cpixmediaimagedoc.cpp --- a/harvesterplugins/media/image/src/cpixmediaimagedoc.cpp Wed Jun 23 17:22:18 2010 +0100 +++ b/harvesterplugins/media/image/src/cpixmediaimagedoc.cpp Mon Jun 28 11:03:15 2010 +0530 @@ -30,8 +30,8 @@ #endif -_LIT( KFormatDateTime, "%04d %02d %02dT%02d:%02d:%02dZ"); // yyyy-mm-ddThh:mm:ssZ - +_LIT( KFormatDateTime, "%04d %02d %02d %02d %02d"); // yyyy mm dd hh mm +_LIT( KExcerptFormat, "%04d/%02d/%02d %02d:%02d"); //yyyy/mm/dd hh:mm // ----------------------------------------------------------------------------- // CCPIXDocFetcher::NewL() // ----------------------------------------------------------------------------- @@ -96,32 +96,123 @@ CPIXLOGSTRING("START CCPIXMediaImageDoc::GetCpixDocumentL"); CSearchDocument* index_item = CCPIXDocFetcher::GetCpixDocumentL(aObject,aAppClass,aObjectDef); ResetExcerpt(); //Reset excerpt initially - //URI and Excerpt is done add additional properties here + //URI and Excerpt is done add additional properties here CMdEProperty* property(NULL); - //Title property + CMdEPropertyDef& titlePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty ); - if(aObject.Property( titlePropDef, property ) != KErrNotFound) - { - //Add field to document - CMdETextProperty* textProperty = ( CMdETextProperty* ) property; - AddFiledtoDocumentL(*index_item, - MdeConstants::Object::KTitleProperty, - textProperty->Value()); - AddToFieldExcerptL(textProperty->Value()); - } - + if(aObject.Property( titlePropDef, property ) != KErrNotFound) + { + //Add field to document excerpt. + CMdETextProperty* textProperty = ( CMdETextProperty* ) property; + AddToFieldExcerptL(textProperty->Value()); + } + //Get user comment field CMdEPropertyDef& commentPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCommentProperty ); if(aObject.Property( commentPropDef, property )!= KErrNotFound) { //Add field to document - CMdETextProperty* textProperty = ( CMdETextProperty* ) property; + CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property ); AddFiledtoDocumentL(*index_item, MdeConstants::MediaObject::KCommentProperty, textProperty->Value()); AddToFieldExcerptL(textProperty->Value()); } - CMdEPropertyDef& dateTimePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Image::KDateTimeOriginalProperty); + + //Get user description field + CMdEPropertyDef& descriptionPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDescriptionProperty ); + if(aObject.Property( descriptionPropDef, property )!= KErrNotFound) + { + //Add field to document + CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property ); + AddFiledtoDocumentL(*index_item, + MdeConstants::MediaObject::KDescriptionProperty, + textProperty->Value()); + AddToFieldExcerptL(textProperty->Value()); + } + + //Get user copyright field + CMdEPropertyDef& copyRightPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCopyrightProperty ); + if(aObject.Property( copyRightPropDef, property )!= KErrNotFound) + { + //Add field to document + CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property ); + AddFiledtoDocumentL(*index_item, + MdeConstants::MediaObject::KCopyrightProperty, + textProperty->Value()); + AddToFieldExcerptL(textProperty->Value()); + } + + //Get user genre field + CMdEPropertyDef& genrePropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KGenreProperty ); + if(aObject.Property( genrePropDef, property )!= KErrNotFound) + { + //Add field to document + CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property ); + AddFiledtoDocumentL(*index_item, + MdeConstants::MediaObject::KGenreProperty, + textProperty->Value()); + AddToFieldExcerptL(textProperty->Value()); + } + + //Get legal property field + CMdEPropertyDef& legalPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KLegalProperty ); + if(aObject.Property( legalPropDef, property )!= KErrNotFound) + { + //Add field to document + CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property ); + AddFiledtoDocumentL(*index_item, + MdeConstants::MediaObject::KLegalProperty, + textProperty->Value()); + AddToFieldExcerptL(textProperty->Value()); + } + //Size property + CMdEPropertyDef& sizePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KSizeProperty); + if(aObject.Property( sizePropDef, property )!= KErrNotFound) + { + //Add field to document + if( property->Def().PropertyType() == EPropertyUint32 ) + { + CMdEUint32Property& sizeProperty = static_cast < CMdEUint32Property& > (*property ); + TBuf<32> buf; + buf.Format(_L("%u"), sizeProperty.Value()); + AddFiledtoDocumentL(*index_item, + MdeConstants::Object::KSizeProperty, + buf, + CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); + AddToFieldExcerptL(buf); + } + } + //Get DateTimeOrginal property + CMdEPropertyDef& dateTimeOrgPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Image::KDateTimeOriginalProperty); + if(aObject.Property( dateTimeOrgPropDef, property ) != KErrNotFound) + { + //Add field to document + if(EPropertyTime == property->Def().PropertyType()) + { + CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property); + TDateTime time = timeProperty.Value().DateTime(); + TBuf<32> buf; + buf.Format( KFormatDateTime, time.Year(), + time.Month() + 1, + time.Day() + 1, + time.Hour(), + time.Minute()); + AddFiledtoDocumentL(*index_item, + MdeConstants::Image::KDateTimeOriginalProperty, + buf, + CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); + //Format for excerpt field + buf.Format( KExcerptFormat, time.Year(), + time.Month() + 1, + time.Day() + 1, + time.Hour(), + time.Minute()); + AddToFieldExcerptL(buf); + } + } + //Get LastModifiedDate property + CMdEPropertyDef& dateTimePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KLastModifiedDateProperty); if(aObject.Property( dateTimePropDef, property ) != KErrNotFound) { //Add field to document @@ -130,19 +221,30 @@ CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property); TDateTime time = timeProperty.Value().DateTime(); TBuf<32> buf; - buf.Format( KFormatDateTime, time.Year(), - time.Month() + 1, - time.Day() + 1, - time.Hour(), - time.Minute(), - time.Second() ); + buf.Format( KFormatDateTime, time.Year(), + time.Month() + 1, + time.Day() + 1, + time.Hour(), + time.Minute()); + AddFiledtoDocumentL(*index_item, - MdeConstants::Image::KDateTimeOriginalProperty, + MdeConstants::Object::KLastModifiedDateProperty, buf, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); + //Format for excerpt field + buf.Format( KExcerptFormat, time.Year(), + time.Month() + 1, + time.Day() + 1, + time.Hour(), + time.Minute()); + AddToFieldExcerptL(buf); } } - index_item->AddExcerptL(*iExcerpt); + if( iExcerpt ) + { + index_item->AddExcerptL(*iExcerpt); + } + //Latitude error currently /* TODO- Bhuvi Location is a seperate object for each image object if any such relation * exist it has to be searched from Relation table and from there we have to open