harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp
author hgs
Tue, 31 Aug 2010 17:25:42 +0530
changeset 19 08315a312857
parent 18 1edf350003c5
child 26 367228f82b66
permissions -rw-r--r--
201033_03
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:  MDS to CPIX Audio Document fetcher 
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include "cpixmediaaudiodoc.h"
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <mdeobject.h>
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <mdccommon.h>
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include <mdeitem.h>
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include <mdeconstants.h>
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include <mdeobjectdef.h>
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include "harvesterserverlogger.h"
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    26
#include "OstTraceDefinitions.h"
5
3bc31ad99ee7 Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
    27
#include "csearchdocument.h"
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    28
#ifdef OST_TRACE_COMPILER_IN_USE
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    29
#include "cpixmediaaudiodocTraces.h"
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    30
#endif
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    31
9
hgs
parents: 5
diff changeset
    32
_LIT( KFormatDateTime, "%04d %02d %02d %02d %02d");    // yyyy mm dd hh mm
hgs
parents: 5
diff changeset
    33
_LIT( KExcerptFormat, "%04d/%02d/%02d %02d:%02d");
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
// CCPIXDocFetcher::NewL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
//
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
CCPIXMediaAudioDoc* CCPIXMediaAudioDoc::NewL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
    CCPIXMediaAudioDoc* self = CCPIXMediaAudioDoc::NewLC();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
    CleanupStack::Pop(self);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
    return self;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
// CCPIXDocFetcher::NewLC()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
//
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
CCPIXMediaAudioDoc* CCPIXMediaAudioDoc::NewLC()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
    CCPIXMediaAudioDoc* self = new (ELeave) CCPIXMediaAudioDoc();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
    CleanupStack::PushL(self);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
    self->ConstructL();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
    return self;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
// CCPIXDocFetcher::~CCPIXMediaAudioDoc()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
//
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
CCPIXMediaAudioDoc::~CCPIXMediaAudioDoc()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
// CCPIXDocFetcher::CCPIXMediaAudioDoc()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
//
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
CCPIXMediaAudioDoc::CCPIXMediaAudioDoc()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
// CCPIXDocFetcher::ConstructL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
//
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
void CCPIXMediaAudioDoc::ConstructL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
    CCPIXDocFetcher::ConstructL();//Must have
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
    
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
// CCPIXDocFetcher::GetCpixDocumentL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
//
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
CSearchDocument* CCPIXMediaAudioDoc::GetCpixDocumentL(const CMdEObject& aObject, 
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
                                              const TDesC& aAppClass,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
                                              CMdEObjectDef& aObjectDef)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
    {
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    93
    OstTraceFunctionEntry0( CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_ENTRY );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
    CPIXLOGSTRING("START CCPIXMediaAudioDoc::GetCpixDocumentL");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
    //Get basic document
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
    CSearchDocument* index_item = CCPIXDocFetcher::GetCpixDocumentL(aObject,aAppClass,aObjectDef);
5
3bc31ad99ee7 Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
    97
    //Reset Excerpt and append
3bc31ad99ee7 Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
    98
    ResetExcerpt();
3bc31ad99ee7 Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
    99
    TInt slashpos = GetUri().LocateReverse('\\');
3bc31ad99ee7 Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   100
    TPtrC name = GetUri().Mid( (slashpos+1) );
3bc31ad99ee7 Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   101
    AddToFieldExcerptL(name); //Add name to excerpt field
3bc31ad99ee7 Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   102
    //additional properties here 
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
    CMdEProperty* property(NULL);
5
3bc31ad99ee7 Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   104
    CMdEPropertyDef& artistPropDef1 = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KArtistProperty );
9
hgs
parents: 5
diff changeset
   105
    if(aObject.Property( artistPropDef1, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   106
       {
hgs
parents: 5
diff changeset
   107
       //Add field to document
hgs
parents: 5
diff changeset
   108
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 5
diff changeset
   109
       AddFiledtoDocumentL(*index_item,
hgs
parents: 5
diff changeset
   110
                             MdeConstants::MediaObject::KArtistProperty,
hgs
parents: 5
diff changeset
   111
                             textProperty->Value(),
hgs
parents: 5
diff changeset
   112
                             CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
hgs
parents: 5
diff changeset
   113
       AddToFieldExcerptL(textProperty->Value());//Add artist to excerpt
hgs
parents: 5
diff changeset
   114
       }
16
hgs
parents: 13
diff changeset
   115
#ifdef USE_HIGHLIGHTER
18
hgs
parents: 16
diff changeset
   116
    /*//Get the media file extension and store
16
hgs
parents: 13
diff changeset
   117
    TBuf<KMaxExtLength> extension;        
hgs
parents: 13
diff changeset
   118
    GetExtension(aObject.Uri(),extension);
18
hgs
parents: 16
diff changeset
   119
    AddToFieldExcerptL(extension);*/
hgs
parents: 16
diff changeset
   120
    //Adding title to first line of highlighter
hgs
parents: 16
diff changeset
   121
    CMdEPropertyDef& titlePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty );
hgs
parents: 16
diff changeset
   122
    if(aObject.Property( titlePropDef, property ) != KErrNotFound)
hgs
parents: 16
diff changeset
   123
       {
hgs
parents: 16
diff changeset
   124
       //Add field to document
hgs
parents: 16
diff changeset
   125
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 16
diff changeset
   126
       if(textProperty->Value() != KNullDesC)
hgs
parents: 16
diff changeset
   127
           {
hgs
parents: 16
diff changeset
   128
           index_item->AddHLDisplayFieldL(textProperty->Value());
hgs
parents: 16
diff changeset
   129
           }
hgs
parents: 16
diff changeset
   130
       }
16
hgs
parents: 13
diff changeset
   131
#endif  
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
    CMdEPropertyDef& albumPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumProperty );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
    if(aObject.Property( albumPropDef, property )!= KErrNotFound)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
       {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
       //Add field to document
9
hgs
parents: 5
diff changeset
   136
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property);
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
       AddFiledtoDocumentL(*index_item,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
                           MdeConstants::Audio::KAlbumProperty,
9
hgs
parents: 5
diff changeset
   139
                           textProperty->Value(),
hgs
parents: 5
diff changeset
   140
                           CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
5
3bc31ad99ee7 Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   141
       AddToFieldExcerptL(textProperty->Value());//Add Album to excerpt
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
       }
9
hgs
parents: 5
diff changeset
   143
    
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
    CMdEPropertyDef& artistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumArtistProperty );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
    if(aObject.Property( artistPropDef, property ) != KErrNotFound)
9
hgs
parents: 5
diff changeset
   146
       {
hgs
parents: 5
diff changeset
   147
       //Add field to document
hgs
parents: 5
diff changeset
   148
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 5
diff changeset
   149
       AddFiledtoDocumentL(*index_item,
hgs
parents: 5
diff changeset
   150
                     MdeConstants::Audio::KAlbumArtistProperty,
hgs
parents: 5
diff changeset
   151
                     textProperty->Value(),
hgs
parents: 5
diff changeset
   152
                     CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
hgs
parents: 5
diff changeset
   153
       AddToFieldExcerptL(textProperty->Value());//Add Albumartist to excerpt
hgs
parents: 5
diff changeset
   154
       }
hgs
parents: 5
diff changeset
   155
    //orginal artist property
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
    CMdEPropertyDef& origartistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KOriginalArtistProperty );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
    if(aObject.Property( origartistPropDef, property ) != KErrNotFound)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
     {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
     //Add field to document
9
hgs
parents: 5
diff changeset
   160
     CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
     AddFiledtoDocumentL(*index_item,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
                      MdeConstants::Audio::KOriginalArtistProperty,
9
hgs
parents: 5
diff changeset
   163
                      textProperty->Value(),
hgs
parents: 5
diff changeset
   164
                      CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
5
3bc31ad99ee7 Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   165
     AddToFieldExcerptL(textProperty->Value());//Add Original to excerpt
9
hgs
parents: 5
diff changeset
   166
     }
hgs
parents: 5
diff changeset
   167
    //Get composer property
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
    CMdEPropertyDef& composerPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KComposerProperty );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
    if(aObject.Property( composerPropDef, property ) != KErrNotFound)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   170
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
    //Add field to document
9
hgs
parents: 5
diff changeset
   172
    CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
    AddFiledtoDocumentL(*index_item,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
                  MdeConstants::Audio::KComposerProperty,
9
hgs
parents: 5
diff changeset
   175
                  textProperty->Value(),
hgs
parents: 5
diff changeset
   176
                  CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
5
3bc31ad99ee7 Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   177
    AddToFieldExcerptL(textProperty->Value());//Add composer to excerpt
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   178
    }
9
hgs
parents: 5
diff changeset
   179
    //Get author property
hgs
parents: 5
diff changeset
   180
    CMdEPropertyDef& authorPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KAuthorProperty );
hgs
parents: 5
diff changeset
   181
    if(aObject.Property( authorPropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   182
       {
hgs
parents: 5
diff changeset
   183
       //Add field to document
hgs
parents: 5
diff changeset
   184
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 5
diff changeset
   185
       AddFiledtoDocumentL(*index_item,
hgs
parents: 5
diff changeset
   186
                         MdeConstants::MediaObject::KAuthorProperty,
hgs
parents: 5
diff changeset
   187
                         textProperty->Value(),
hgs
parents: 5
diff changeset
   188
                         CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
hgs
parents: 5
diff changeset
   189
       AddToFieldExcerptL(textProperty->Value());
hgs
parents: 5
diff changeset
   190
       }    
hgs
parents: 5
diff changeset
   191
     //Get comment property   
hgs
parents: 5
diff changeset
   192
    CMdEPropertyDef& commentPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCommentProperty );
hgs
parents: 5
diff changeset
   193
    if(aObject.Property( commentPropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   194
       {
hgs
parents: 5
diff changeset
   195
       //Add field to document
hgs
parents: 5
diff changeset
   196
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 5
diff changeset
   197
       AddFiledtoDocumentL(*index_item,
hgs
parents: 5
diff changeset
   198
                   MdeConstants::MediaObject::KCommentProperty,
hgs
parents: 5
diff changeset
   199
                   textProperty->Value());
hgs
parents: 5
diff changeset
   200
       AddToFieldExcerptL(textProperty->Value());
hgs
parents: 5
diff changeset
   201
       }
hgs
parents: 5
diff changeset
   202
        
hgs
parents: 5
diff changeset
   203
    //Get description property
hgs
parents: 5
diff changeset
   204
    CMdEPropertyDef& descriprionPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDescriptionProperty );
hgs
parents: 5
diff changeset
   205
    if(aObject.Property( descriprionPropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   206
       {
hgs
parents: 5
diff changeset
   207
       //Add field to document
hgs
parents: 5
diff changeset
   208
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 5
diff changeset
   209
       AddFiledtoDocumentL(*index_item,
hgs
parents: 5
diff changeset
   210
                   MdeConstants::MediaObject::KDescriptionProperty,
hgs
parents: 5
diff changeset
   211
                   textProperty->Value());
hgs
parents: 5
diff changeset
   212
       AddToFieldExcerptL(textProperty->Value());
hgs
parents: 5
diff changeset
   213
       }
hgs
parents: 5
diff changeset
   214
    //Copyright property    
hgs
parents: 5
diff changeset
   215
    CMdEPropertyDef& copyrightPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCopyrightProperty );
hgs
parents: 5
diff changeset
   216
    if(aObject.Property( copyrightPropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   217
       {
hgs
parents: 5
diff changeset
   218
       //Add field to document
hgs
parents: 5
diff changeset
   219
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 5
diff changeset
   220
       AddFiledtoDocumentL(*index_item,
hgs
parents: 5
diff changeset
   221
                      MdeConstants::MediaObject::KCopyrightProperty,
hgs
parents: 5
diff changeset
   222
                      textProperty->Value());
hgs
parents: 5
diff changeset
   223
       AddToFieldExcerptL(textProperty->Value());
hgs
parents: 5
diff changeset
   224
       } 
hgs
parents: 5
diff changeset
   225
    //Get genre property
hgs
parents: 5
diff changeset
   226
    CMdEPropertyDef& genrePropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KGenreProperty );
hgs
parents: 5
diff changeset
   227
    if(aObject.Property( genrePropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   228
       {
hgs
parents: 5
diff changeset
   229
       //Add field to document
hgs
parents: 5
diff changeset
   230
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 5
diff changeset
   231
       AddFiledtoDocumentL(*index_item,
hgs
parents: 5
diff changeset
   232
                   MdeConstants::MediaObject::KGenreProperty,
hgs
parents: 5
diff changeset
   233
                   textProperty->Value());
hgs
parents: 5
diff changeset
   234
       AddToFieldExcerptL(textProperty->Value());
hgs
parents: 5
diff changeset
   235
       }
hgs
parents: 5
diff changeset
   236
    
hgs
parents: 5
diff changeset
   237
    //Size property
hgs
parents: 5
diff changeset
   238
    CMdEPropertyDef& sizePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KSizeProperty);
hgs
parents: 5
diff changeset
   239
    if(aObject.Property( sizePropDef, property )!= KErrNotFound)
hgs
parents: 5
diff changeset
   240
       {
13
hgs
parents: 9
diff changeset
   241
       //Add field to document       
hgs
parents: 9
diff changeset
   242
       CMdEUint32Property& sizeProperty = static_cast < CMdEUint32Property& > (*property );
hgs
parents: 9
diff changeset
   243
       TBuf<32> buf;
hgs
parents: 9
diff changeset
   244
       buf.Format(_L("%u"), sizeProperty.Value());
hgs
parents: 9
diff changeset
   245
       AddFiledtoDocumentL(*index_item,
hgs
parents: 9
diff changeset
   246
                       MdeConstants::Object::KSizeProperty,
hgs
parents: 9
diff changeset
   247
                       buf,
hgs
parents: 9
diff changeset
   248
                       CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
hgs
parents: 9
diff changeset
   249
       AddToFieldExcerptL(buf);       
9
hgs
parents: 5
diff changeset
   250
       }
hgs
parents: 5
diff changeset
   251
    
hgs
parents: 5
diff changeset
   252
    //Get legal property
hgs
parents: 5
diff changeset
   253
    CMdEPropertyDef& legalPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KLegalProperty );
hgs
parents: 5
diff changeset
   254
    if(aObject.Property( legalPropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   255
       {
hgs
parents: 5
diff changeset
   256
       //Add field to document
hgs
parents: 5
diff changeset
   257
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 5
diff changeset
   258
       AddFiledtoDocumentL(*index_item,
hgs
parents: 5
diff changeset
   259
                   MdeConstants::MediaObject::KLegalProperty,
hgs
parents: 5
diff changeset
   260
                   textProperty->Value());
hgs
parents: 5
diff changeset
   261
       AddToFieldExcerptL(textProperty->Value());
hgs
parents: 5
diff changeset
   262
       }
hgs
parents: 5
diff changeset
   263
    //Get track property
hgs
parents: 5
diff changeset
   264
    CMdEPropertyDef& trackPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KTrackProperty );
hgs
parents: 5
diff changeset
   265
    if(aObject.Property( trackPropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   266
       {
hgs
parents: 5
diff changeset
   267
       //Add field to document       
13
hgs
parents: 9
diff changeset
   268
       CMdEUint16Property& trackProperty = static_cast < CMdEUint16Property& > (*property );               
hgs
parents: 9
diff changeset
   269
       TBuf<32> buf;
hgs
parents: 9
diff changeset
   270
       buf.Format(_L("%d"), trackProperty.Value());
hgs
parents: 9
diff changeset
   271
       AddFiledtoDocumentL(*index_item,
hgs
parents: 9
diff changeset
   272
                          MdeConstants::MediaObject::KTrackProperty,
hgs
parents: 9
diff changeset
   273
                          buf);
hgs
parents: 9
diff changeset
   274
       
9
hgs
parents: 5
diff changeset
   275
       }
hgs
parents: 5
diff changeset
   276
    // Capturedate property
hgs
parents: 5
diff changeset
   277
    CMdEPropertyDef& captureDatePropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCaptureDateProperty);
hgs
parents: 5
diff changeset
   278
    if(aObject.Property( captureDatePropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   279
      {
13
hgs
parents: 9
diff changeset
   280
      //Add field to document      
hgs
parents: 9
diff changeset
   281
      CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
hgs
parents: 9
diff changeset
   282
      TDateTime time = timeProperty.Value().DateTime();
hgs
parents: 9
diff changeset
   283
      TBuf<32> buf;
hgs
parents: 9
diff changeset
   284
      buf.Format( KFormatDateTime, time.Year(), 
hgs
parents: 9
diff changeset
   285
                                   time.Month() + 1, 
hgs
parents: 9
diff changeset
   286
                                   time.Day() + 1, 
hgs
parents: 9
diff changeset
   287
                                   time.Hour(), 
hgs
parents: 9
diff changeset
   288
                                   time.Minute());
hgs
parents: 9
diff changeset
   289
      
hgs
parents: 9
diff changeset
   290
      AddFiledtoDocumentL(*index_item,
hgs
parents: 9
diff changeset
   291
                         MdeConstants::MediaObject::KCaptureDateProperty,
hgs
parents: 9
diff changeset
   292
                         buf,
hgs
parents: 9
diff changeset
   293
                         CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
hgs
parents: 9
diff changeset
   294
      
hgs
parents: 9
diff changeset
   295
      //Format for excerpt field
hgs
parents: 9
diff changeset
   296
      buf.Format( KExcerptFormat, time.Year(), 
hgs
parents: 9
diff changeset
   297
                                 time.Month() + 1, 
hgs
parents: 9
diff changeset
   298
                                 time.Day() + 1, 
hgs
parents: 9
diff changeset
   299
                                 time.Hour(), 
hgs
parents: 9
diff changeset
   300
                                 time.Minute());
hgs
parents: 9
diff changeset
   301
      AddToFieldExcerptL(buf);         
9
hgs
parents: 5
diff changeset
   302
      }
hgs
parents: 5
diff changeset
   303
    //Get LastModifiedDate property
hgs
parents: 5
diff changeset
   304
    CMdEPropertyDef& dateTimePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KLastModifiedDateProperty);
hgs
parents: 5
diff changeset
   305
    if(aObject.Property( dateTimePropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   306
      {
13
hgs
parents: 9
diff changeset
   307
      //Add field to document      
hgs
parents: 9
diff changeset
   308
      CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
hgs
parents: 9
diff changeset
   309
      TDateTime time = timeProperty.Value().DateTime();
hgs
parents: 9
diff changeset
   310
      TBuf<32> buf;
hgs
parents: 9
diff changeset
   311
      buf.Format( KFormatDateTime, time.Year(),
hgs
parents: 9
diff changeset
   312
                                   time.Month() + 1,
hgs
parents: 9
diff changeset
   313
                                   time.Day() + 1,
hgs
parents: 9
diff changeset
   314
                                   time.Hour(),
9
hgs
parents: 5
diff changeset
   315
                                   time.Minute());
13
hgs
parents: 9
diff changeset
   316
      
hgs
parents: 9
diff changeset
   317
      AddFiledtoDocumentL(*index_item,
hgs
parents: 9
diff changeset
   318
                         MdeConstants::Object::KLastModifiedDateProperty,
hgs
parents: 9
diff changeset
   319
                         buf,
hgs
parents: 9
diff changeset
   320
                         CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
hgs
parents: 9
diff changeset
   321
      //Format for excerpt field
hgs
parents: 9
diff changeset
   322
      buf.Format( KExcerptFormat, time.Year(), 
hgs
parents: 9
diff changeset
   323
                               time.Month() + 1, 
hgs
parents: 9
diff changeset
   324
                               time.Day() + 1, 
hgs
parents: 9
diff changeset
   325
                               time.Hour(), 
hgs
parents: 9
diff changeset
   326
                               time.Minute());
hgs
parents: 9
diff changeset
   327
      AddToFieldExcerptL(buf);
9
hgs
parents: 5
diff changeset
   328
      }
hgs
parents: 5
diff changeset
   329
    //Get duration property
hgs
parents: 5
diff changeset
   330
    CMdEPropertyDef& durationPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDurationProperty );
hgs
parents: 5
diff changeset
   331
    if(aObject.Property( durationPropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   332
       {        
13
hgs
parents: 9
diff changeset
   333
       //Add field to document       
hgs
parents: 9
diff changeset
   334
       CMdEReal32Property& durationProperty = static_cast < CMdEReal32Property& > (*property );               
hgs
parents: 9
diff changeset
   335
       TBuf<32> buf;
hgs
parents: 9
diff changeset
   336
       buf.Format(_L("%f"), durationProperty.Value());
hgs
parents: 9
diff changeset
   337
       AddFiledtoDocumentL(*index_item,
hgs
parents: 9
diff changeset
   338
                      MdeConstants::MediaObject::KDurationProperty,
hgs
parents: 9
diff changeset
   339
                      buf );
hgs
parents: 9
diff changeset
   340
       
9
hgs
parents: 5
diff changeset
   341
       }
13
hgs
parents: 9
diff changeset
   342
    
hgs
parents: 9
diff changeset
   343
    index_item->AddExcerptL(*iExcerpt);
hgs
parents: 9
diff changeset
   344
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   345
    CPIXLOGSTRING("END CCPIXMediaAudioDoc::GetCpixDocumentL");
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   346
    OstTraceFunctionExit0( CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_EXIT );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   347
    return index_item;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   348
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   349
//End of life