harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp
changeset 5 3bc31ad99ee7
parent 2 208a4ba3894c
child 9 4a2987baf8f7
equal deleted inserted replaced
3:6832643895f7 5:3bc31ad99ee7
    22 #include <mdeitem.h>
    22 #include <mdeitem.h>
    23 #include <mdeconstants.h>
    23 #include <mdeconstants.h>
    24 #include <mdeobjectdef.h>
    24 #include <mdeobjectdef.h>
    25 #include "harvesterserverlogger.h"
    25 #include "harvesterserverlogger.h"
    26 #include "OstTraceDefinitions.h"
    26 #include "OstTraceDefinitions.h"
       
    27 #include "csearchdocument.h"
    27 #ifdef OST_TRACE_COMPILER_IN_USE
    28 #ifdef OST_TRACE_COMPILER_IN_USE
    28 #include "cpixmediaaudiodocTraces.h"
    29 #include "cpixmediaaudiodocTraces.h"
    29 #endif
    30 #endif
    30 
    31 
    31 
    32 
    90     {
    91     {
    91     OstTraceFunctionEntry0( CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_ENTRY );
    92     OstTraceFunctionEntry0( CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_ENTRY );
    92     CPIXLOGSTRING("START CCPIXMediaAudioDoc::GetCpixDocumentL");
    93     CPIXLOGSTRING("START CCPIXMediaAudioDoc::GetCpixDocumentL");
    93     //Get basic document
    94     //Get basic document
    94     CSearchDocument* index_item = CCPIXDocFetcher::GetCpixDocumentL(aObject,aAppClass,aObjectDef);
    95     CSearchDocument* index_item = CCPIXDocFetcher::GetCpixDocumentL(aObject,aAppClass,aObjectDef);
    95     //URI and Excerpt is done add additional properties here 
    96     //Reset Excerpt and append
       
    97     ResetExcerpt();
       
    98     TInt slashpos = GetUri().LocateReverse('\\');
       
    99     TPtrC name = GetUri().Mid( (slashpos+1) );
       
   100     AddToFieldExcerptL(name); //Add name to excerpt field
       
   101     //additional properties here 
    96     CMdEProperty* property(NULL);
   102     CMdEProperty* property(NULL);
       
   103     CMdEPropertyDef& artistPropDef1 = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KArtistProperty );
       
   104         if(aObject.Property( artistPropDef1, property ) != KErrNotFound)
       
   105            {
       
   106            //Add field to document
       
   107            CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
       
   108            AddFiledtoDocumentL(*index_item,
       
   109                                  MdeConstants::MediaObject::KArtistProperty,
       
   110                                  textProperty->Value());
       
   111            AddToFieldExcerptL(textProperty->Value());//Add artist to excerpt
       
   112            }
    97     CMdEPropertyDef& albumPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumProperty );
   113     CMdEPropertyDef& albumPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumProperty );
    98     if(aObject.Property( albumPropDef, property )!= KErrNotFound)
   114     if(aObject.Property( albumPropDef, property )!= KErrNotFound)
    99        {
   115        {
   100        //Add field to document
   116        //Add field to document
   101        CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   117        CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   102        AddFiledtoDocumentL(*index_item,
   118        AddFiledtoDocumentL(*index_item,
   103                            MdeConstants::Audio::KAlbumProperty,
   119                            MdeConstants::Audio::KAlbumProperty,
   104                            textProperty->Value());
   120                            textProperty->Value());
       
   121        AddToFieldExcerptL(textProperty->Value());//Add Album to excerpt
   105        }
   122        }
   106     CMdEPropertyDef& artistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumArtistProperty );
   123     CMdEPropertyDef& artistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumArtistProperty );
   107     if(aObject.Property( artistPropDef, property ) != KErrNotFound)
   124     if(aObject.Property( artistPropDef, property ) != KErrNotFound)
   108       {
   125       {
   109       //Add field to document
   126       //Add field to document
   110       CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   127       CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   111       AddFiledtoDocumentL(*index_item,
   128       AddFiledtoDocumentL(*index_item,
   112                          MdeConstants::Audio::KAlbumArtistProperty,
   129                          MdeConstants::Audio::KAlbumArtistProperty,
   113                          textProperty->Value());
   130                          textProperty->Value());
       
   131       AddToFieldExcerptL(textProperty->Value());//Add Albumartist to excerpt
   114       }
   132       }
   115     CMdEPropertyDef& origartistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KOriginalArtistProperty );
   133     CMdEPropertyDef& origartistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KOriginalArtistProperty );
   116     if(aObject.Property( origartistPropDef, property ) != KErrNotFound)
   134     if(aObject.Property( origartistPropDef, property ) != KErrNotFound)
   117      {
   135      {
   118      //Add field to document
   136      //Add field to document
   119      CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   137      CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   120      AddFiledtoDocumentL(*index_item,
   138      AddFiledtoDocumentL(*index_item,
   121                       MdeConstants::Audio::KOriginalArtistProperty,
   139                       MdeConstants::Audio::KOriginalArtistProperty,
   122                       textProperty->Value());
   140                       textProperty->Value());
       
   141      AddToFieldExcerptL(textProperty->Value());//Add Original to excerpt
   123      }   
   142      }   
   124     CMdEPropertyDef& composerPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KComposerProperty );
   143     CMdEPropertyDef& composerPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KComposerProperty );
   125     if(aObject.Property( composerPropDef, property ) != KErrNotFound)
   144     if(aObject.Property( composerPropDef, property ) != KErrNotFound)
   126     {
   145     {
   127     //Add field to document
   146     //Add field to document
   128     CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   147     CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   129     AddFiledtoDocumentL(*index_item,
   148     AddFiledtoDocumentL(*index_item,
   130                   MdeConstants::Audio::KComposerProperty,
   149                   MdeConstants::Audio::KComposerProperty,
   131                   textProperty->Value());
   150                   textProperty->Value());
       
   151     AddToFieldExcerptL(textProperty->Value());//Add composer to excerpt
   132     }
   152     }
   133     CMdEPropertyDef& artistPropDef1 = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KArtistProperty );
   153     index_item->AddExcerptL(*iExcerpt);   
   134     if(aObject.Property( artistPropDef1, property ) != KErrNotFound)
       
   135        {
       
   136        //Add field to document
       
   137        CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
       
   138        AddFiledtoDocumentL(*index_item,
       
   139                              MdeConstants::MediaObject::KArtistProperty,
       
   140                              textProperty->Value());
       
   141        }   
       
   142     CPIXLOGSTRING("END CCPIXMediaAudioDoc::GetCpixDocumentL");
   154     CPIXLOGSTRING("END CCPIXMediaAudioDoc::GetCpixDocumentL");
   143     OstTraceFunctionExit0( CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_EXIT );
   155     OstTraceFunctionExit0( CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_EXIT );
   144     return index_item;
   156     return index_item;
   145     }
   157     }
   146 //End of life
   158 //End of life