harvesterplugins/media/video/src/cpixmediavideodoc.cpp
changeset 17 7d8c8d8f5eab
parent 12 993ab30e92fc
child 20 68cdadcf169e
--- a/harvesterplugins/media/video/src/cpixmediavideodoc.cpp	Tue Jul 06 14:17:22 2010 +0300
+++ b/harvesterplugins/media/video/src/cpixmediavideodoc.cpp	Wed Aug 18 09:49:49 2010 +0300
@@ -106,18 +106,15 @@
         CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
         if( textProperty->Value().Compare(KNullDesC) > 0 )AddToFieldExcerptL(name); //Add name to excerpt field
         }
+#ifdef USE_HIGHLIGHTER
+    //Get the media file extension and store
+    TBuf<KMaxExtLength> extension;        
+    GetExtension(aObject.Uri(),extension);
+    AddToFieldExcerptL(extension);
+#endif 
 
     //URI and Excerpt is done add additional properties here 
-    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());
-       }
+    
     CMdEPropertyDef& artistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KArtistProperty );
     if(aObject.Property( artistPropDef, property )!= KErrNotFound)
        {
@@ -189,34 +186,29 @@
     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);
-           }
+       //Add field to document       
+       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 resolution property
     CMdEPropertyDef& resolutionPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KResolutionUnitProperty );
     if(aObject.Property( resolutionPropDef, property ) != KErrNotFound)
        {
-       //Add field to document
-       if( property->Def().PropertyType() == EPropertyUint16 )
-           {
-           CMdEUint16Property& resolutionProperty = static_cast < CMdEUint16Property& > (*property );               
-           TBuf<32> buf;
-           buf.Format(_L("%d"), resolutionProperty.Value());
-           AddFiledtoDocumentL(*index_item,
-                              MdeConstants::MediaObject::KResolutionUnitProperty,
-                              buf,
-                              CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
-           }       
+       //Add field to document       
+       CMdEUint16Property& resolutionProperty = static_cast < CMdEUint16Property& > (*property );               
+       TBuf<32> buf;
+       buf.Format(_L("%d"), resolutionProperty.Value());
+       AddFiledtoDocumentL(*index_item,
+                          MdeConstants::MediaObject::KResolutionUnitProperty,
+                          buf,
+                          CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
+       
        }    
     //Get legal property
     CMdEPropertyDef& legalPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KLegalProperty );
@@ -226,96 +218,86 @@
        CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
        AddFiledtoDocumentL(*index_item,
                    MdeConstants::MediaObject::KLegalProperty,
-                   textProperty->Value());       
+                   textProperty->Value());
+       AddToFieldExcerptL(textProperty->Value());
        }
     //Get track property
     CMdEPropertyDef& trackPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KTrackProperty );
     if(aObject.Property( trackPropDef, property ) != KErrNotFound)
        {
        //Add field to document       
-       if( property->Def().PropertyType() == EPropertyUint16 )
-           {
-           CMdEUint16Property& trackProperty = static_cast < CMdEUint16Property& > (*property );               
-           TBuf<32> buf;
-           buf.Format(_L("%d"), trackProperty.Value());
-           AddFiledtoDocumentL(*index_item,
-                              MdeConstants::MediaObject::KTrackProperty,
-                              buf);
-           }       
+       CMdEUint16Property& trackProperty = static_cast < CMdEUint16Property& > (*property );               
+       TBuf<32> buf;
+       buf.Format(_L("%d"), trackProperty.Value());
+       AddFiledtoDocumentL(*index_item,
+                          MdeConstants::MediaObject::KTrackProperty,
+                          buf);
+       
        }
     // Capturedate property
     CMdEPropertyDef& captureDatePropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCaptureDateProperty);
     if(aObject.Property( captureDatePropDef, 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::MediaObject::KCaptureDateProperty,
-                             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);
-          }
+      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::MediaObject::KCaptureDateProperty,
+                         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
-      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::Object::KLastModifiedDateProperty,
-                             buf,
-                             CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
-          //Format for excerpt field
-          buf.Format( KExcerptFormat, time.Year(), 
-                                   time.Month() + 1, 
-                                   time.Day() + 1, 
-                                   time.Hour(), 
+      //Add field to document      
+      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());
-          AddToFieldExcerptL(buf);
-          }
+      
+      AddFiledtoDocumentL(*index_item,
+                         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);
       }
     //Get duration property
     CMdEPropertyDef& durationPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDurationProperty );
     if(aObject.Property( durationPropDef, property ) != KErrNotFound)
        {
        //Add field to document       
-       if( property->Def().PropertyType() == EPropertyReal32 )
-           {
-           CMdEReal32Property& durationProperty = static_cast < CMdEReal32Property& > (*property );               
-           TBuf<32> buf;
-           buf.Format(_L("%f"), durationProperty.Value());
-           AddFiledtoDocumentL(*index_item,
-                              MdeConstants::MediaObject::KDurationProperty,
-                              buf,
-                              CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
-           }       
+       CMdEReal32Property& durationProperty = static_cast < CMdEReal32Property& > (*property );               
+       TBuf<32> buf;
+       buf.Format(_L("%f"), durationProperty.Value());
+       AddFiledtoDocumentL(*index_item,
+                          MdeConstants::MediaObject::KDurationProperty,
+                          buf,
+                          CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
        }
     if( iExcerpt )
         {