harvesterplugins/media/image/src/cpixmediaimagedoc.cpp
changeset 17 7d8c8d8f5eab
parent 11 773be20e0a25
child 20 68cdadcf169e
equal deleted inserted replaced
12:993ab30e92fc 17:7d8c8d8f5eab
   105           //Add field to document excerpt.
   105           //Add field to document excerpt.
   106           CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   106           CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   107           AddToFieldExcerptL(textProperty->Value());
   107           AddToFieldExcerptL(textProperty->Value());
   108           }
   108           }
   109     
   109     
       
   110 #ifdef USE_HIGHLIGHTER
       
   111     //Get the media file extension and store
       
   112     TBuf<KMaxExtLength> extension;        
       
   113     GetExtension(aObject.Uri(),extension);
       
   114     AddToFieldExcerptL(extension);
       
   115 #endif   
   110     //Get user comment field
   116     //Get user comment field
   111     CMdEPropertyDef& commentPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCommentProperty );
   117     CMdEPropertyDef& commentPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCommentProperty );
   112     if(aObject.Property( commentPropDef, property )!= KErrNotFound)
   118     if(aObject.Property( commentPropDef, property )!= KErrNotFound)
   113        {
   119        {
   114        //Add field to document
   120        //Add field to document
   168        }
   174        }
   169     //Size property
   175     //Size property
   170     CMdEPropertyDef& sizePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KSizeProperty);
   176     CMdEPropertyDef& sizePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KSizeProperty);
   171     if(aObject.Property( sizePropDef, property )!= KErrNotFound)
   177     if(aObject.Property( sizePropDef, property )!= KErrNotFound)
   172        {
   178        {
   173        //Add field to document
   179        //Add field to document       
   174        if( property->Def().PropertyType() == EPropertyUint32 )
   180        CMdEUint32Property& sizeProperty = static_cast < CMdEUint32Property& > (*property );
   175            {
   181        TBuf<32> buf;
   176            CMdEUint32Property& sizeProperty = static_cast < CMdEUint32Property& > (*property );
   182        buf.Format(_L("%u"), sizeProperty.Value());
   177            TBuf<32> buf;
   183        AddFiledtoDocumentL(*index_item,
   178            buf.Format(_L("%u"), sizeProperty.Value());
   184                        MdeConstants::Object::KSizeProperty,
   179            AddFiledtoDocumentL(*index_item,
   185                        buf,
   180                            MdeConstants::Object::KSizeProperty,
   186                        CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   181                            buf,
   187        AddToFieldExcerptL(buf);
   182                            CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   183            AddToFieldExcerptL(buf);
       
   184            }
       
   185        }
   188        }
   186     //Get DateTimeOrginal property
   189     //Get DateTimeOrginal property
   187     CMdEPropertyDef& dateTimeOrgPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Image::KDateTimeOriginalProperty);
   190     CMdEPropertyDef& dateTimeOrgPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Image::KDateTimeOriginalProperty);
   188     if(aObject.Property( dateTimeOrgPropDef, property ) != KErrNotFound)
   191     if(aObject.Property( dateTimeOrgPropDef, property ) != KErrNotFound)
   189       {
   192       {
   190       //Add field to document
   193       //Add field to document      
   191       if(EPropertyTime == property->Def().PropertyType())
   194       CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
   192           {
   195       TDateTime time = timeProperty.Value().DateTime();
   193           CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
   196       TBuf<32> buf;
   194           TDateTime time = timeProperty.Value().DateTime();
   197       buf.Format( KFormatDateTime, time.Year(),
   195           TBuf<32> buf;
   198                                    time.Month() + 1,
   196           buf.Format( KFormatDateTime, time.Year(),
   199                                    time.Day() + 1,
   197                                        time.Month() + 1,
   200                                    time.Hour(),
   198                                        time.Day() + 1,
       
   199                                        time.Hour(),
       
   200                                        time.Minute());
       
   201           AddFiledtoDocumentL(*index_item,
       
   202                              MdeConstants::Image::KDateTimeOriginalProperty,
       
   203                              buf,
       
   204                              CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   205           //Format for excerpt field
       
   206           buf.Format( KExcerptFormat, time.Year(), 
       
   207                                    time.Month() + 1, 
       
   208                                    time.Day() + 1, 
       
   209                                    time.Hour(), 
       
   210                                    time.Minute());
   201                                    time.Minute());
   211           AddToFieldExcerptL(buf);
   202       AddFiledtoDocumentL(*index_item,
   212           }
   203                          MdeConstants::Image::KDateTimeOriginalProperty,
       
   204                          buf,
       
   205                          CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   206       //Format for excerpt field
       
   207       buf.Format( KExcerptFormat, time.Year(), 
       
   208                                time.Month() + 1, 
       
   209                                time.Day() + 1, 
       
   210                                time.Hour(), 
       
   211                                time.Minute());
       
   212 
   213       }
   213       }
   214     //Get LastModifiedDate property
   214     //Get LastModifiedDate property
   215     CMdEPropertyDef& dateTimePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KLastModifiedDateProperty);
   215     CMdEPropertyDef& dateTimePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KLastModifiedDateProperty);
   216     if(aObject.Property( dateTimePropDef, property ) != KErrNotFound)
   216     if(aObject.Property( dateTimePropDef, property ) != KErrNotFound)
   217       {
   217       {
   218       //Add field to document
   218       //Add field to document
   219       if(EPropertyTime == property->Def().PropertyType())
   219       CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
   220           {
   220       TDateTime time = timeProperty.Value().DateTime();
   221           CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
   221       TBuf<32> buf;
   222           TDateTime time = timeProperty.Value().DateTime();
   222       buf.Format( KFormatDateTime, time.Year(),
   223           TBuf<32> buf;
   223                                    time.Month() + 1,
   224           buf.Format( KFormatDateTime, time.Year(),
   224                                    time.Day() + 1,
   225                                        time.Month() + 1,
   225                                    time.Hour(),
   226                                        time.Day() + 1,
       
   227                                        time.Hour(),
       
   228                                        time.Minute());
       
   229           
       
   230           AddFiledtoDocumentL(*index_item,
       
   231                              MdeConstants::Object::KLastModifiedDateProperty,
       
   232                              buf,
       
   233                              CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   234           //Format for excerpt field
       
   235           buf.Format( KExcerptFormat, time.Year(), 
       
   236                                    time.Month() + 1, 
       
   237                                    time.Day() + 1, 
       
   238                                    time.Hour(), 
       
   239                                    time.Minute());
   226                                    time.Minute());
   240           AddToFieldExcerptL(buf);
   227       
   241           }
   228       AddFiledtoDocumentL(*index_item,
       
   229                          MdeConstants::Object::KLastModifiedDateProperty,
       
   230                          buf,
       
   231                          CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   232       //Format for excerpt field
       
   233       buf.Format( KExcerptFormat, time.Year(), 
       
   234                                time.Month() + 1, 
       
   235                                time.Day() + 1, 
       
   236                                time.Hour(), 
       
   237                                time.Minute());
       
   238       AddToFieldExcerptL(buf);
   242       }
   239       }
   243     if( iExcerpt )
   240     if( iExcerpt )
   244         {
   241         {
   245         index_item->AddExcerptL(*iExcerpt);
   242         index_item->AddExcerptL(*iExcerpt);
   246         }
   243         }