harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp
author hgs
Mon, 12 Jul 2010 00:27:06 +0530
changeset 13 0a2ec6860a93
parent 9 4a2987baf8f7
child 16 e918432ddd92
permissions -rw-r--r--
201027
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
       }
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
    CMdEPropertyDef& albumPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumProperty );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
    if(aObject.Property( albumPropDef, property )!= KErrNotFound)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
       {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
       //Add field to document
9
hgs
parents: 5
diff changeset
   119
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property);
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
       AddFiledtoDocumentL(*index_item,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
                           MdeConstants::Audio::KAlbumProperty,
9
hgs
parents: 5
diff changeset
   122
                           textProperty->Value(),
hgs
parents: 5
diff changeset
   123
                           CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
5
3bc31ad99ee7 Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   124
       AddToFieldExcerptL(textProperty->Value());//Add Album to excerpt
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
       }
9
hgs
parents: 5
diff changeset
   126
    
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
    CMdEPropertyDef& artistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumArtistProperty );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
    if(aObject.Property( artistPropDef, property ) != KErrNotFound)
9
hgs
parents: 5
diff changeset
   129
       {
hgs
parents: 5
diff changeset
   130
       //Add field to document
hgs
parents: 5
diff changeset
   131
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 5
diff changeset
   132
       AddFiledtoDocumentL(*index_item,
hgs
parents: 5
diff changeset
   133
                     MdeConstants::Audio::KAlbumArtistProperty,
hgs
parents: 5
diff changeset
   134
                     textProperty->Value(),
hgs
parents: 5
diff changeset
   135
                     CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
hgs
parents: 5
diff changeset
   136
       AddToFieldExcerptL(textProperty->Value());//Add Albumartist to excerpt
hgs
parents: 5
diff changeset
   137
       }
hgs
parents: 5
diff changeset
   138
    //orginal artist property
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
    CMdEPropertyDef& origartistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KOriginalArtistProperty );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
    if(aObject.Property( origartistPropDef, property ) != KErrNotFound)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
     {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
     //Add field to document
9
hgs
parents: 5
diff changeset
   143
     CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
     AddFiledtoDocumentL(*index_item,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
                      MdeConstants::Audio::KOriginalArtistProperty,
9
hgs
parents: 5
diff changeset
   146
                      textProperty->Value(),
hgs
parents: 5
diff changeset
   147
                      CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
5
3bc31ad99ee7 Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   148
     AddToFieldExcerptL(textProperty->Value());//Add Original to excerpt
9
hgs
parents: 5
diff changeset
   149
     }
hgs
parents: 5
diff changeset
   150
    //Get composer property
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
    CMdEPropertyDef& composerPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KComposerProperty );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
    if(aObject.Property( composerPropDef, property ) != KErrNotFound)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
    //Add field to document
9
hgs
parents: 5
diff changeset
   155
    CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
    AddFiledtoDocumentL(*index_item,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
                  MdeConstants::Audio::KComposerProperty,
9
hgs
parents: 5
diff changeset
   158
                  textProperty->Value(),
hgs
parents: 5
diff changeset
   159
                  CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
5
3bc31ad99ee7 Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   160
    AddToFieldExcerptL(textProperty->Value());//Add composer to excerpt
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
    }
9
hgs
parents: 5
diff changeset
   162
    //Get author property
hgs
parents: 5
diff changeset
   163
    CMdEPropertyDef& authorPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KAuthorProperty );
hgs
parents: 5
diff changeset
   164
    if(aObject.Property( authorPropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   165
       {
hgs
parents: 5
diff changeset
   166
       //Add field to document
hgs
parents: 5
diff changeset
   167
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 5
diff changeset
   168
       AddFiledtoDocumentL(*index_item,
hgs
parents: 5
diff changeset
   169
                         MdeConstants::MediaObject::KAuthorProperty,
hgs
parents: 5
diff changeset
   170
                         textProperty->Value(),
hgs
parents: 5
diff changeset
   171
                         CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
hgs
parents: 5
diff changeset
   172
       AddToFieldExcerptL(textProperty->Value());
hgs
parents: 5
diff changeset
   173
       }    
hgs
parents: 5
diff changeset
   174
     //Get comment property   
hgs
parents: 5
diff changeset
   175
    CMdEPropertyDef& commentPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCommentProperty );
hgs
parents: 5
diff changeset
   176
    if(aObject.Property( commentPropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   177
       {
hgs
parents: 5
diff changeset
   178
       //Add field to document
hgs
parents: 5
diff changeset
   179
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 5
diff changeset
   180
       AddFiledtoDocumentL(*index_item,
hgs
parents: 5
diff changeset
   181
                   MdeConstants::MediaObject::KCommentProperty,
hgs
parents: 5
diff changeset
   182
                   textProperty->Value());
hgs
parents: 5
diff changeset
   183
       AddToFieldExcerptL(textProperty->Value());
hgs
parents: 5
diff changeset
   184
       }
hgs
parents: 5
diff changeset
   185
        
hgs
parents: 5
diff changeset
   186
    //Get description property
hgs
parents: 5
diff changeset
   187
    CMdEPropertyDef& descriprionPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDescriptionProperty );
hgs
parents: 5
diff changeset
   188
    if(aObject.Property( descriprionPropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   189
       {
hgs
parents: 5
diff changeset
   190
       //Add field to document
hgs
parents: 5
diff changeset
   191
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 5
diff changeset
   192
       AddFiledtoDocumentL(*index_item,
hgs
parents: 5
diff changeset
   193
                   MdeConstants::MediaObject::KDescriptionProperty,
hgs
parents: 5
diff changeset
   194
                   textProperty->Value());
hgs
parents: 5
diff changeset
   195
       AddToFieldExcerptL(textProperty->Value());
hgs
parents: 5
diff changeset
   196
       }
hgs
parents: 5
diff changeset
   197
    //Copyright property    
hgs
parents: 5
diff changeset
   198
    CMdEPropertyDef& copyrightPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCopyrightProperty );
hgs
parents: 5
diff changeset
   199
    if(aObject.Property( copyrightPropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   200
       {
hgs
parents: 5
diff changeset
   201
       //Add field to document
hgs
parents: 5
diff changeset
   202
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 5
diff changeset
   203
       AddFiledtoDocumentL(*index_item,
hgs
parents: 5
diff changeset
   204
                      MdeConstants::MediaObject::KCopyrightProperty,
hgs
parents: 5
diff changeset
   205
                      textProperty->Value());
hgs
parents: 5
diff changeset
   206
       AddToFieldExcerptL(textProperty->Value());
hgs
parents: 5
diff changeset
   207
       } 
hgs
parents: 5
diff changeset
   208
    //Get genre property
hgs
parents: 5
diff changeset
   209
    CMdEPropertyDef& genrePropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KGenreProperty );
hgs
parents: 5
diff changeset
   210
    if(aObject.Property( genrePropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   211
       {
hgs
parents: 5
diff changeset
   212
       //Add field to document
hgs
parents: 5
diff changeset
   213
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 5
diff changeset
   214
       AddFiledtoDocumentL(*index_item,
hgs
parents: 5
diff changeset
   215
                   MdeConstants::MediaObject::KGenreProperty,
hgs
parents: 5
diff changeset
   216
                   textProperty->Value());
hgs
parents: 5
diff changeset
   217
       AddToFieldExcerptL(textProperty->Value());
hgs
parents: 5
diff changeset
   218
       }
hgs
parents: 5
diff changeset
   219
    
hgs
parents: 5
diff changeset
   220
    //Size property
hgs
parents: 5
diff changeset
   221
    CMdEPropertyDef& sizePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KSizeProperty);
hgs
parents: 5
diff changeset
   222
    if(aObject.Property( sizePropDef, property )!= KErrNotFound)
hgs
parents: 5
diff changeset
   223
       {
13
hgs
parents: 9
diff changeset
   224
       //Add field to document       
hgs
parents: 9
diff changeset
   225
       CMdEUint32Property& sizeProperty = static_cast < CMdEUint32Property& > (*property );
hgs
parents: 9
diff changeset
   226
       TBuf<32> buf;
hgs
parents: 9
diff changeset
   227
       buf.Format(_L("%u"), sizeProperty.Value());
hgs
parents: 9
diff changeset
   228
       AddFiledtoDocumentL(*index_item,
hgs
parents: 9
diff changeset
   229
                       MdeConstants::Object::KSizeProperty,
hgs
parents: 9
diff changeset
   230
                       buf,
hgs
parents: 9
diff changeset
   231
                       CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
hgs
parents: 9
diff changeset
   232
       AddToFieldExcerptL(buf);       
9
hgs
parents: 5
diff changeset
   233
       }
hgs
parents: 5
diff changeset
   234
    
hgs
parents: 5
diff changeset
   235
    //Get legal property
hgs
parents: 5
diff changeset
   236
    CMdEPropertyDef& legalPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KLegalProperty );
hgs
parents: 5
diff changeset
   237
    if(aObject.Property( legalPropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   238
       {
hgs
parents: 5
diff changeset
   239
       //Add field to document
hgs
parents: 5
diff changeset
   240
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 5
diff changeset
   241
       AddFiledtoDocumentL(*index_item,
hgs
parents: 5
diff changeset
   242
                   MdeConstants::MediaObject::KLegalProperty,
hgs
parents: 5
diff changeset
   243
                   textProperty->Value());
hgs
parents: 5
diff changeset
   244
       AddToFieldExcerptL(textProperty->Value());
hgs
parents: 5
diff changeset
   245
       }
hgs
parents: 5
diff changeset
   246
    //Get track property
hgs
parents: 5
diff changeset
   247
    CMdEPropertyDef& trackPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KTrackProperty );
hgs
parents: 5
diff changeset
   248
    if(aObject.Property( trackPropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   249
       {
hgs
parents: 5
diff changeset
   250
       //Add field to document       
13
hgs
parents: 9
diff changeset
   251
       CMdEUint16Property& trackProperty = static_cast < CMdEUint16Property& > (*property );               
hgs
parents: 9
diff changeset
   252
       TBuf<32> buf;
hgs
parents: 9
diff changeset
   253
       buf.Format(_L("%d"), trackProperty.Value());
hgs
parents: 9
diff changeset
   254
       AddFiledtoDocumentL(*index_item,
hgs
parents: 9
diff changeset
   255
                          MdeConstants::MediaObject::KTrackProperty,
hgs
parents: 9
diff changeset
   256
                          buf);
hgs
parents: 9
diff changeset
   257
       
9
hgs
parents: 5
diff changeset
   258
       }
hgs
parents: 5
diff changeset
   259
    // Capturedate property
hgs
parents: 5
diff changeset
   260
    CMdEPropertyDef& captureDatePropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCaptureDateProperty);
hgs
parents: 5
diff changeset
   261
    if(aObject.Property( captureDatePropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   262
      {
13
hgs
parents: 9
diff changeset
   263
      //Add field to document      
hgs
parents: 9
diff changeset
   264
      CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
hgs
parents: 9
diff changeset
   265
      TDateTime time = timeProperty.Value().DateTime();
hgs
parents: 9
diff changeset
   266
      TBuf<32> buf;
hgs
parents: 9
diff changeset
   267
      buf.Format( KFormatDateTime, time.Year(), 
hgs
parents: 9
diff changeset
   268
                                   time.Month() + 1, 
hgs
parents: 9
diff changeset
   269
                                   time.Day() + 1, 
hgs
parents: 9
diff changeset
   270
                                   time.Hour(), 
hgs
parents: 9
diff changeset
   271
                                   time.Minute());
hgs
parents: 9
diff changeset
   272
      
hgs
parents: 9
diff changeset
   273
      AddFiledtoDocumentL(*index_item,
hgs
parents: 9
diff changeset
   274
                         MdeConstants::MediaObject::KCaptureDateProperty,
hgs
parents: 9
diff changeset
   275
                         buf,
hgs
parents: 9
diff changeset
   276
                         CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
hgs
parents: 9
diff changeset
   277
      
hgs
parents: 9
diff changeset
   278
      //Format for excerpt field
hgs
parents: 9
diff changeset
   279
      buf.Format( KExcerptFormat, time.Year(), 
hgs
parents: 9
diff changeset
   280
                                 time.Month() + 1, 
hgs
parents: 9
diff changeset
   281
                                 time.Day() + 1, 
hgs
parents: 9
diff changeset
   282
                                 time.Hour(), 
hgs
parents: 9
diff changeset
   283
                                 time.Minute());
hgs
parents: 9
diff changeset
   284
      AddToFieldExcerptL(buf);         
9
hgs
parents: 5
diff changeset
   285
      }
hgs
parents: 5
diff changeset
   286
    //Get LastModifiedDate property
hgs
parents: 5
diff changeset
   287
    CMdEPropertyDef& dateTimePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KLastModifiedDateProperty);
hgs
parents: 5
diff changeset
   288
    if(aObject.Property( dateTimePropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   289
      {
13
hgs
parents: 9
diff changeset
   290
      //Add field to document      
hgs
parents: 9
diff changeset
   291
      CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
hgs
parents: 9
diff changeset
   292
      TDateTime time = timeProperty.Value().DateTime();
hgs
parents: 9
diff changeset
   293
      TBuf<32> buf;
hgs
parents: 9
diff changeset
   294
      buf.Format( KFormatDateTime, time.Year(),
hgs
parents: 9
diff changeset
   295
                                   time.Month() + 1,
hgs
parents: 9
diff changeset
   296
                                   time.Day() + 1,
hgs
parents: 9
diff changeset
   297
                                   time.Hour(),
9
hgs
parents: 5
diff changeset
   298
                                   time.Minute());
13
hgs
parents: 9
diff changeset
   299
      
hgs
parents: 9
diff changeset
   300
      AddFiledtoDocumentL(*index_item,
hgs
parents: 9
diff changeset
   301
                         MdeConstants::Object::KLastModifiedDateProperty,
hgs
parents: 9
diff changeset
   302
                         buf,
hgs
parents: 9
diff changeset
   303
                         CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
hgs
parents: 9
diff changeset
   304
      //Format for excerpt field
hgs
parents: 9
diff changeset
   305
      buf.Format( KExcerptFormat, time.Year(), 
hgs
parents: 9
diff changeset
   306
                               time.Month() + 1, 
hgs
parents: 9
diff changeset
   307
                               time.Day() + 1, 
hgs
parents: 9
diff changeset
   308
                               time.Hour(), 
hgs
parents: 9
diff changeset
   309
                               time.Minute());
hgs
parents: 9
diff changeset
   310
      AddToFieldExcerptL(buf);
9
hgs
parents: 5
diff changeset
   311
      }
hgs
parents: 5
diff changeset
   312
    //Get duration property
hgs
parents: 5
diff changeset
   313
    CMdEPropertyDef& durationPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDurationProperty );
hgs
parents: 5
diff changeset
   314
    if(aObject.Property( durationPropDef, property ) != KErrNotFound)
hgs
parents: 5
diff changeset
   315
       {        
13
hgs
parents: 9
diff changeset
   316
       //Add field to document       
hgs
parents: 9
diff changeset
   317
       CMdEReal32Property& durationProperty = static_cast < CMdEReal32Property& > (*property );               
hgs
parents: 9
diff changeset
   318
       TBuf<32> buf;
hgs
parents: 9
diff changeset
   319
       buf.Format(_L("%f"), durationProperty.Value());
hgs
parents: 9
diff changeset
   320
       AddFiledtoDocumentL(*index_item,
hgs
parents: 9
diff changeset
   321
                      MdeConstants::MediaObject::KDurationProperty,
hgs
parents: 9
diff changeset
   322
                      buf );
hgs
parents: 9
diff changeset
   323
       
9
hgs
parents: 5
diff changeset
   324
       }
13
hgs
parents: 9
diff changeset
   325
    
hgs
parents: 9
diff changeset
   326
    index_item->AddExcerptL(*iExcerpt);
hgs
parents: 9
diff changeset
   327
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   328
    CPIXLOGSTRING("END CCPIXMediaAudioDoc::GetCpixDocumentL");
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   329
    OstTraceFunctionExit0( CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_EXIT );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   330
    return index_item;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   331
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   332
//End of life