harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp
changeset 5 3bc31ad99ee7
parent 2 208a4ba3894c
child 9 4a2987baf8f7
--- a/harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp	Fri May 14 15:53:17 2010 +0300
+++ b/harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp	Thu May 27 12:52:35 2010 +0300
@@ -24,6 +24,7 @@
 #include <mdeobjectdef.h>
 #include "harvesterserverlogger.h"
 #include "OstTraceDefinitions.h"
+#include "csearchdocument.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "cpixmediaaudiodocTraces.h"
 #endif
@@ -92,8 +93,23 @@
     CPIXLOGSTRING("START CCPIXMediaAudioDoc::GetCpixDocumentL");
     //Get basic document
     CSearchDocument* index_item = CCPIXDocFetcher::GetCpixDocumentL(aObject,aAppClass,aObjectDef);
-    //URI and Excerpt is done add additional properties here 
+    //Reset Excerpt and append
+    ResetExcerpt();
+    TInt slashpos = GetUri().LocateReverse('\\');
+    TPtrC name = GetUri().Mid( (slashpos+1) );
+    AddToFieldExcerptL(name); //Add name to excerpt field
+    //additional properties here 
     CMdEProperty* property(NULL);
+    CMdEPropertyDef& artistPropDef1 = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KArtistProperty );
+        if(aObject.Property( artistPropDef1, property ) != KErrNotFound)
+           {
+           //Add field to document
+           CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
+           AddFiledtoDocumentL(*index_item,
+                                 MdeConstants::MediaObject::KArtistProperty,
+                                 textProperty->Value());
+           AddToFieldExcerptL(textProperty->Value());//Add artist to excerpt
+           }
     CMdEPropertyDef& albumPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumProperty );
     if(aObject.Property( albumPropDef, property )!= KErrNotFound)
        {
@@ -102,6 +118,7 @@
        AddFiledtoDocumentL(*index_item,
                            MdeConstants::Audio::KAlbumProperty,
                            textProperty->Value());
+       AddToFieldExcerptL(textProperty->Value());//Add Album to excerpt
        }
     CMdEPropertyDef& artistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumArtistProperty );
     if(aObject.Property( artistPropDef, property ) != KErrNotFound)
@@ -111,6 +128,7 @@
       AddFiledtoDocumentL(*index_item,
                          MdeConstants::Audio::KAlbumArtistProperty,
                          textProperty->Value());
+      AddToFieldExcerptL(textProperty->Value());//Add Albumartist to excerpt
       }
     CMdEPropertyDef& origartistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KOriginalArtistProperty );
     if(aObject.Property( origartistPropDef, property ) != KErrNotFound)
@@ -120,6 +138,7 @@
      AddFiledtoDocumentL(*index_item,
                       MdeConstants::Audio::KOriginalArtistProperty,
                       textProperty->Value());
+     AddToFieldExcerptL(textProperty->Value());//Add Original to excerpt
      }   
     CMdEPropertyDef& composerPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KComposerProperty );
     if(aObject.Property( composerPropDef, property ) != KErrNotFound)
@@ -129,16 +148,9 @@
     AddFiledtoDocumentL(*index_item,
                   MdeConstants::Audio::KComposerProperty,
                   textProperty->Value());
+    AddToFieldExcerptL(textProperty->Value());//Add composer to excerpt
     }
-    CMdEPropertyDef& artistPropDef1 = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KArtistProperty );
-    if(aObject.Property( artistPropDef1, property ) != KErrNotFound)
-       {
-       //Add field to document
-       CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
-       AddFiledtoDocumentL(*index_item,
-                             MdeConstants::MediaObject::KArtistProperty,
-                             textProperty->Value());
-       }   
+    index_item->AddExcerptL(*iExcerpt);   
     CPIXLOGSTRING("END CCPIXMediaAudioDoc::GetCpixDocumentL");
     OstTraceFunctionExit0( CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_EXIT );
     return index_item;