harvesterplugins/media/video/src/cpixmediavideodoc.cpp
changeset 0 ccd0fd43f247
child 2 208a4ba3894c
equal deleted inserted replaced
-1:000000000000 0:ccd0fd43f247
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  MDS to CPIX Audio Document fetcher 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "cpixmediavideodoc.h"
       
    20 #include <mdeobject.h>
       
    21 #include <mdccommon.h>
       
    22 #include <mdeitem.h>
       
    23 #include <mdeconstants.h>
       
    24 #include <mdeobjectdef.h>
       
    25 #include "harvesterserverlogger.h"
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CCPIXDocFetcher::NewL()
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 CCPIXMediaVideoDoc* CCPIXMediaVideoDoc::NewL()
       
    32     {
       
    33     CCPIXMediaVideoDoc* self = CCPIXMediaVideoDoc::NewLC();
       
    34     CleanupStack::Pop(self);
       
    35     return self;
       
    36     }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CCPIXDocFetcher::NewLC()
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 CCPIXMediaVideoDoc* CCPIXMediaVideoDoc::NewLC()
       
    43     {
       
    44     CCPIXMediaVideoDoc* self = new (ELeave) CCPIXMediaVideoDoc();
       
    45     CleanupStack::PushL(self);
       
    46     self->ConstructL();
       
    47     return self;
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CCPIXDocFetcher::~CCPIXMediaAudioDoc()
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CCPIXMediaVideoDoc::~CCPIXMediaVideoDoc()
       
    55     {
       
    56     
       
    57     }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // CCPIXDocFetcher::CCPIXMediaAudioDoc()
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 CCPIXMediaVideoDoc::CCPIXMediaVideoDoc()
       
    64     {
       
    65     
       
    66     }
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CCPIXDocFetcher::ConstructL()
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 void CCPIXMediaVideoDoc::ConstructL()
       
    73     {
       
    74     CCPIXDocFetcher::ConstructL();//Must have
       
    75     
       
    76     }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CCPIXDocFetcher::GetCpixDocumentL()
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 CSearchDocument* CCPIXMediaVideoDoc::GetCpixDocumentL(const CMdEObject& aObject, 
       
    83                                               const TDesC& aAppClass,
       
    84                                               CMdEObjectDef& aObjectDef)
       
    85     {
       
    86     //Get basic document
       
    87     CPIXLOGSTRING("CCPIXMediaVideoDoc::GetCpixDocumentL()");
       
    88     CSearchDocument* index_item = CCPIXDocFetcher::GetCpixDocumentL(aObject,aAppClass,aObjectDef);
       
    89     //URI and Excerpt is done add additional properties here 
       
    90     CMdEProperty* property(NULL);
       
    91     CMdEPropertyDef& artistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KArtistProperty );
       
    92     if(aObject.Property( artistPropDef, property )!= KErrNotFound)
       
    93        {
       
    94        //Add field to document
       
    95        CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
       
    96        AddFiledtoDocumentL(*index_item,
       
    97                            MdeConstants::MediaObject::KArtistProperty,
       
    98                            textProperty->Value());
       
    99        }
       
   100     CMdEPropertyDef& authorPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KAuthorProperty );
       
   101     if(aObject.Property( authorPropDef, property ) != KErrNotFound)
       
   102        {
       
   103       //Add field to document
       
   104       CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
       
   105       AddFiledtoDocumentL(*index_item,
       
   106                          MdeConstants::MediaObject::KAuthorProperty,
       
   107                          textProperty->Value());
       
   108        }
       
   109     CMdEPropertyDef& copyrightPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCopyrightProperty );
       
   110     if(aObject.Property( copyrightPropDef, property ) != KErrNotFound)
       
   111        {
       
   112      //Add field to document
       
   113      CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
       
   114      AddFiledtoDocumentL(*index_item,
       
   115                       MdeConstants::MediaObject::KCopyrightProperty,
       
   116                       textProperty->Value());
       
   117        }   
       
   118     CMdEPropertyDef& descriptionPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDescriptionProperty );
       
   119     if(aObject.Property( descriptionPropDef, property ) != KErrNotFound)
       
   120        {
       
   121     //Add field to document
       
   122     CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
       
   123     AddFiledtoDocumentL(*index_item,
       
   124                   MdeConstants::MediaObject::KDescriptionProperty,
       
   125                   textProperty->Value());
       
   126        }
       
   127     CMdEPropertyDef& commentPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCommentProperty );
       
   128     if(aObject.Property( commentPropDef, property ) != KErrNotFound)
       
   129        {
       
   130     //Add field to document
       
   131     CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
       
   132     AddFiledtoDocumentL(*index_item,
       
   133                    MdeConstants::MediaObject::KCommentProperty,
       
   134                    textProperty->Value());
       
   135        }
       
   136     return index_item;
       
   137     }
       
   138