harvesterplugins/media/video/src/cpixmediavideodoc.cpp
changeset 5 3bc31ad99ee7
parent 2 208a4ba3894c
child 9 4a2987baf8f7
child 11 773be20e0a25
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 "cpixmediavideodocTraces.h"
    29 #include "cpixmediavideodocTraces.h"
    29 #endif
    30 #endif
    30 
    31 
    31 
    32 
    90     {
    91     {
    91     OstTraceFunctionEntry0( CCPIXMEDIAVIDEODOC_GETCPIXDOCUMENTL_ENTRY );
    92     OstTraceFunctionEntry0( CCPIXMEDIAVIDEODOC_GETCPIXDOCUMENTL_ENTRY );
    92     //Get basic document
    93     //Get basic document
    93     CPIXLOGSTRING("CCPIXMediaVideoDoc::GetCpixDocumentL()");
    94     CPIXLOGSTRING("CCPIXMediaVideoDoc::GetCpixDocumentL()");
    94     CSearchDocument* index_item = CCPIXDocFetcher::GetCpixDocumentL(aObject,aAppClass,aObjectDef);
    95     CSearchDocument* index_item = CCPIXDocFetcher::GetCpixDocumentL(aObject,aAppClass,aObjectDef);
       
    96     ResetExcerpt(); //Reset excerpt initially
       
    97     TInt slashpos = GetUri().LocateReverse('\\');
       
    98     TPtrC name = GetUri().Mid( (slashpos+1) );
       
    99     AddToFieldExcerptL(name); //Add name to excerpt field
    95     //URI and Excerpt is done add additional properties here 
   100     //URI and Excerpt is done add additional properties here 
    96     CMdEProperty* property(NULL);
   101     CMdEProperty* property(NULL);
       
   102     CMdEPropertyDef& descriptionPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDescriptionProperty );
       
   103     if(aObject.Property( descriptionPropDef, property ) != KErrNotFound)
       
   104        {
       
   105        //Add field to document
       
   106        CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
       
   107        AddFiledtoDocumentL(*index_item,
       
   108                   MdeConstants::MediaObject::KDescriptionProperty,
       
   109                   textProperty->Value());
       
   110        AddToFieldExcerptL(textProperty->Value());
       
   111        }
    97     CMdEPropertyDef& artistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KArtistProperty );
   112     CMdEPropertyDef& artistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KArtistProperty );
    98     if(aObject.Property( artistPropDef, property )!= KErrNotFound)
   113     if(aObject.Property( artistPropDef, property )!= KErrNotFound)
    99        {
   114        {
   100        //Add field to document
   115        //Add field to document
   101        CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   116        CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   102        AddFiledtoDocumentL(*index_item,
   117        AddFiledtoDocumentL(*index_item,
   103                            MdeConstants::MediaObject::KArtistProperty,
   118                            MdeConstants::MediaObject::KArtistProperty,
   104                            textProperty->Value());
   119                            textProperty->Value());
       
   120        AddToFieldExcerptL(textProperty->Value());
   105        }
   121        }
   106     CMdEPropertyDef& authorPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KAuthorProperty );
   122     CMdEPropertyDef& authorPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KAuthorProperty );
   107     if(aObject.Property( authorPropDef, property ) != KErrNotFound)
   123     if(aObject.Property( authorPropDef, property ) != KErrNotFound)
   108        {
   124        {
   109       //Add field to document
   125        //Add field to document
   110       CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   126        CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   111       AddFiledtoDocumentL(*index_item,
   127        AddFiledtoDocumentL(*index_item,
   112                          MdeConstants::MediaObject::KAuthorProperty,
   128                          MdeConstants::MediaObject::KAuthorProperty,
   113                          textProperty->Value());
   129                          textProperty->Value());
       
   130        AddToFieldExcerptL(textProperty->Value());
   114        }
   131        }
   115     CMdEPropertyDef& copyrightPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCopyrightProperty );
   132     CMdEPropertyDef& copyrightPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCopyrightProperty );
   116     if(aObject.Property( copyrightPropDef, property ) != KErrNotFound)
   133     if(aObject.Property( copyrightPropDef, property ) != KErrNotFound)
   117        {
   134        {
   118      //Add field to document
   135        //Add field to document
   119      CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   136        CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   120      AddFiledtoDocumentL(*index_item,
   137        AddFiledtoDocumentL(*index_item,
   121                       MdeConstants::MediaObject::KCopyrightProperty,
   138                       MdeConstants::MediaObject::KCopyrightProperty,
   122                       textProperty->Value());
   139                       textProperty->Value());
       
   140        AddToFieldExcerptL(textProperty->Value());
   123        }   
   141        }   
   124     CMdEPropertyDef& descriptionPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDescriptionProperty );
   142     
   125     if(aObject.Property( descriptionPropDef, property ) != KErrNotFound)
       
   126        {
       
   127     //Add field to document
       
   128     CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
       
   129     AddFiledtoDocumentL(*index_item,
       
   130                   MdeConstants::MediaObject::KDescriptionProperty,
       
   131                   textProperty->Value());
       
   132        }
       
   133     CMdEPropertyDef& commentPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCommentProperty );
   143     CMdEPropertyDef& commentPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCommentProperty );
   134     if(aObject.Property( commentPropDef, property ) != KErrNotFound)
   144     if(aObject.Property( commentPropDef, property ) != KErrNotFound)
   135        {
   145        {
   136     //Add field to document
   146        //Add field to document
   137     CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   147        CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   138     AddFiledtoDocumentL(*index_item,
   148        AddFiledtoDocumentL(*index_item,
   139                    MdeConstants::MediaObject::KCommentProperty,
   149                    MdeConstants::MediaObject::KCommentProperty,
   140                    textProperty->Value());
   150                    textProperty->Value());
       
   151        AddToFieldExcerptL(textProperty->Value());
   141        }
   152        }
       
   153     index_item->AddExcerptL(*iExcerpt);
   142     OstTraceFunctionExit0( CCPIXMEDIAVIDEODOC_GETCPIXDOCUMENTL_EXIT );
   154     OstTraceFunctionExit0( CCPIXMEDIAVIDEODOC_GETCPIXDOCUMENTL_EXIT );
   143     return index_item;
   155     return index_item;
   144     }
   156     }
   145 
   157