harvesterplugins/media/image/src/cpixmediaimagedoc.cpp
author hgs
Mon, 09 Aug 2010 12:23:41 +0530
changeset 16 e918432ddd92
parent 13 0a2ec6860a93
child 18 1edf350003c5
permissions -rw-r--r--
201031
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 Image 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 "cpixmediaimagedoc.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 "cpixmediaimagedocTraces.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
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
9
hgs
parents: 7
diff changeset
    33
_LIT( KFormatDateTime, "%04d %02d %02d %02d %02d");    // yyyy mm dd hh mm
hgs
parents: 7
diff changeset
    34
_LIT( KExcerptFormat, "%04d/%02d/%02d %02d:%02d");   //yyyy/mm/dd hh:mm
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
// CCPIXDocFetcher::NewL()
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
//
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
CCPIXMediaImageDoc* CCPIXMediaImageDoc::NewL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
    CCPIXMediaImageDoc* self = CCPIXMediaImageDoc::NewLC();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
    CleanupStack::Pop(self);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
    return self;
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
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
// CCPIXDocFetcher::NewLC()
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
//
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
CCPIXMediaImageDoc* CCPIXMediaImageDoc::NewLC()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
    CCPIXMediaImageDoc* self = new (ELeave) CCPIXMediaImageDoc();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
    CleanupStack::PushL(self);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
    self->ConstructL();
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
    return self;
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
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
// CCPIXDocFetcher::~CCPIXMediaImageDoc()
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
//
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
CCPIXMediaImageDoc::~CCPIXMediaImageDoc()
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
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
// CCPIXDocFetcher::CCPIXMediaImageDoc()
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
//
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
CCPIXMediaImageDoc::CCPIXMediaImageDoc()
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
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
// CCPIXDocFetcher::ConstructL()
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
//
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
void CCPIXMediaImageDoc::ConstructL()
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
    {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
    CCPIXDocFetcher::ConstructL();//Must have
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
// -----------------------------------------------------------------------------
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
// CCPIXDocFetcher::GetCpixDocumentL()
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
//
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
CSearchDocument* CCPIXMediaImageDoc::GetCpixDocumentL(const CMdEObject& aObject, 
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
                                              const TDesC& aAppClass,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
                                              CMdEObjectDef& aObjectDef)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
    {
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
    94
    OstTraceFunctionEntry0( CCPIXMEDIAIMAGEDOC_GETCPIXDOCUMENTL_ENTRY );
0
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
    CPIXLOGSTRING("START CCPIXMediaImageDoc::GetCpixDocumentL");
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
    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
    98
    ResetExcerpt(); //Reset excerpt initially
9
hgs
parents: 7
diff changeset
    99
    //URI and Excerpt is done add additional properties here
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
    CMdEProperty* property(NULL);
9
hgs
parents: 7
diff changeset
   101
    
5
3bc31ad99ee7 Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   102
    CMdEPropertyDef& titlePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty );
9
hgs
parents: 7
diff changeset
   103
       if(aObject.Property( titlePropDef, property ) != KErrNotFound)
hgs
parents: 7
diff changeset
   104
          {
hgs
parents: 7
diff changeset
   105
          //Add field to document excerpt.
hgs
parents: 7
diff changeset
   106
          CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
hgs
parents: 7
diff changeset
   107
          AddToFieldExcerptL(textProperty->Value());
hgs
parents: 7
diff changeset
   108
          }
hgs
parents: 7
diff changeset
   109
    
16
hgs
parents: 13
diff changeset
   110
#ifdef USE_HIGHLIGHTER
hgs
parents: 13
diff changeset
   111
    //Get the media file extension and store
hgs
parents: 13
diff changeset
   112
    TBuf<KMaxExtLength> extension;        
hgs
parents: 13
diff changeset
   113
    GetExtension(aObject.Uri(),extension);
hgs
parents: 13
diff changeset
   114
    AddToFieldExcerptL(extension);
hgs
parents: 13
diff changeset
   115
#endif   
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
    //Get user comment field
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
    CMdEPropertyDef& commentPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCommentProperty );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
    if(aObject.Property( commentPropDef, property )!= KErrNotFound)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
       {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
       //Add field to document
9
hgs
parents: 7
diff changeset
   121
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
       AddFiledtoDocumentL(*index_item,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
                           MdeConstants::MediaObject::KCommentProperty,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
                           textProperty->Value());
5
3bc31ad99ee7 Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 2
diff changeset
   125
       AddToFieldExcerptL(textProperty->Value());
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
       }
9
hgs
parents: 7
diff changeset
   127
    
hgs
parents: 7
diff changeset
   128
    //Get user description field
hgs
parents: 7
diff changeset
   129
    CMdEPropertyDef& descriptionPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDescriptionProperty );
hgs
parents: 7
diff changeset
   130
    if(aObject.Property( descriptionPropDef, property )!= KErrNotFound)
hgs
parents: 7
diff changeset
   131
       {
hgs
parents: 7
diff changeset
   132
       //Add field to document
hgs
parents: 7
diff changeset
   133
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 7
diff changeset
   134
       AddFiledtoDocumentL(*index_item,
hgs
parents: 7
diff changeset
   135
                           MdeConstants::MediaObject::KDescriptionProperty,
hgs
parents: 7
diff changeset
   136
                           textProperty->Value());
hgs
parents: 7
diff changeset
   137
       AddToFieldExcerptL(textProperty->Value());
hgs
parents: 7
diff changeset
   138
       }
hgs
parents: 7
diff changeset
   139
    
hgs
parents: 7
diff changeset
   140
    //Get user copyright field
hgs
parents: 7
diff changeset
   141
    CMdEPropertyDef& copyRightPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCopyrightProperty );
hgs
parents: 7
diff changeset
   142
    if(aObject.Property( copyRightPropDef, property )!= KErrNotFound)
hgs
parents: 7
diff changeset
   143
       {
hgs
parents: 7
diff changeset
   144
       //Add field to document
hgs
parents: 7
diff changeset
   145
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 7
diff changeset
   146
       AddFiledtoDocumentL(*index_item,
hgs
parents: 7
diff changeset
   147
                           MdeConstants::MediaObject::KCopyrightProperty,
hgs
parents: 7
diff changeset
   148
                           textProperty->Value());
hgs
parents: 7
diff changeset
   149
       AddToFieldExcerptL(textProperty->Value());
hgs
parents: 7
diff changeset
   150
       }
hgs
parents: 7
diff changeset
   151
hgs
parents: 7
diff changeset
   152
    //Get user genre field
hgs
parents: 7
diff changeset
   153
    CMdEPropertyDef& genrePropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KGenreProperty );
hgs
parents: 7
diff changeset
   154
    if(aObject.Property( genrePropDef, property )!= KErrNotFound)
hgs
parents: 7
diff changeset
   155
       {
hgs
parents: 7
diff changeset
   156
       //Add field to document
hgs
parents: 7
diff changeset
   157
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 7
diff changeset
   158
       AddFiledtoDocumentL(*index_item,
hgs
parents: 7
diff changeset
   159
                           MdeConstants::MediaObject::KGenreProperty,
hgs
parents: 7
diff changeset
   160
                           textProperty->Value()); 
hgs
parents: 7
diff changeset
   161
       AddToFieldExcerptL(textProperty->Value());
hgs
parents: 7
diff changeset
   162
       }
hgs
parents: 7
diff changeset
   163
hgs
parents: 7
diff changeset
   164
    //Get legal property field
hgs
parents: 7
diff changeset
   165
    CMdEPropertyDef& legalPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KLegalProperty );
hgs
parents: 7
diff changeset
   166
    if(aObject.Property( legalPropDef, property )!= KErrNotFound)
hgs
parents: 7
diff changeset
   167
       {
hgs
parents: 7
diff changeset
   168
       //Add field to document
hgs
parents: 7
diff changeset
   169
       CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
hgs
parents: 7
diff changeset
   170
       AddFiledtoDocumentL(*index_item,
hgs
parents: 7
diff changeset
   171
                           MdeConstants::MediaObject::KLegalProperty,
hgs
parents: 7
diff changeset
   172
                           textProperty->Value());
hgs
parents: 7
diff changeset
   173
       AddToFieldExcerptL(textProperty->Value());
hgs
parents: 7
diff changeset
   174
       }
hgs
parents: 7
diff changeset
   175
    //Size property
hgs
parents: 7
diff changeset
   176
    CMdEPropertyDef& sizePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KSizeProperty);
hgs
parents: 7
diff changeset
   177
    if(aObject.Property( sizePropDef, property )!= KErrNotFound)
hgs
parents: 7
diff changeset
   178
       {
13
hgs
parents: 9
diff changeset
   179
       //Add field to document       
hgs
parents: 9
diff changeset
   180
       CMdEUint32Property& sizeProperty = static_cast < CMdEUint32Property& > (*property );
hgs
parents: 9
diff changeset
   181
       TBuf<32> buf;
hgs
parents: 9
diff changeset
   182
       buf.Format(_L("%u"), sizeProperty.Value());
hgs
parents: 9
diff changeset
   183
       AddFiledtoDocumentL(*index_item,
hgs
parents: 9
diff changeset
   184
                       MdeConstants::Object::KSizeProperty,
hgs
parents: 9
diff changeset
   185
                       buf,
hgs
parents: 9
diff changeset
   186
                       CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
hgs
parents: 9
diff changeset
   187
       AddToFieldExcerptL(buf);
9
hgs
parents: 7
diff changeset
   188
       }
hgs
parents: 7
diff changeset
   189
    //Get DateTimeOrginal property
hgs
parents: 7
diff changeset
   190
    CMdEPropertyDef& dateTimeOrgPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Image::KDateTimeOriginalProperty);
hgs
parents: 7
diff changeset
   191
    if(aObject.Property( dateTimeOrgPropDef, property ) != KErrNotFound)
hgs
parents: 7
diff changeset
   192
      {
13
hgs
parents: 9
diff changeset
   193
      //Add field to document      
hgs
parents: 9
diff changeset
   194
      CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
hgs
parents: 9
diff changeset
   195
      TDateTime time = timeProperty.Value().DateTime();
hgs
parents: 9
diff changeset
   196
      TBuf<32> buf;
hgs
parents: 9
diff changeset
   197
      buf.Format( KFormatDateTime, time.Year(),
hgs
parents: 9
diff changeset
   198
                                   time.Month() + 1,
hgs
parents: 9
diff changeset
   199
                                   time.Day() + 1,
hgs
parents: 9
diff changeset
   200
                                   time.Hour(),
9
hgs
parents: 7
diff changeset
   201
                                   time.Minute());
13
hgs
parents: 9
diff changeset
   202
      AddFiledtoDocumentL(*index_item,
hgs
parents: 9
diff changeset
   203
                         MdeConstants::Image::KDateTimeOriginalProperty,
hgs
parents: 9
diff changeset
   204
                         buf,
hgs
parents: 9
diff changeset
   205
                         CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
hgs
parents: 9
diff changeset
   206
      //Format for excerpt field
hgs
parents: 9
diff changeset
   207
      buf.Format( KExcerptFormat, time.Year(), 
hgs
parents: 9
diff changeset
   208
                               time.Month() + 1, 
hgs
parents: 9
diff changeset
   209
                               time.Day() + 1, 
hgs
parents: 9
diff changeset
   210
                               time.Hour(), 
hgs
parents: 9
diff changeset
   211
                               time.Minute());
hgs
parents: 9
diff changeset
   212
9
hgs
parents: 7
diff changeset
   213
      }
hgs
parents: 7
diff changeset
   214
    //Get LastModifiedDate property
hgs
parents: 7
diff changeset
   215
    CMdEPropertyDef& dateTimePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KLastModifiedDateProperty);
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
    if(aObject.Property( dateTimePropDef, property ) != KErrNotFound)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
      {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
      //Add field to document
13
hgs
parents: 9
diff changeset
   219
      CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
hgs
parents: 9
diff changeset
   220
      TDateTime time = timeProperty.Value().DateTime();
hgs
parents: 9
diff changeset
   221
      TBuf<32> buf;
hgs
parents: 9
diff changeset
   222
      buf.Format( KFormatDateTime, time.Year(),
hgs
parents: 9
diff changeset
   223
                                   time.Month() + 1,
hgs
parents: 9
diff changeset
   224
                                   time.Day() + 1,
hgs
parents: 9
diff changeset
   225
                                   time.Hour(),
9
hgs
parents: 7
diff changeset
   226
                                   time.Minute());
13
hgs
parents: 9
diff changeset
   227
      
hgs
parents: 9
diff changeset
   228
      AddFiledtoDocumentL(*index_item,
hgs
parents: 9
diff changeset
   229
                         MdeConstants::Object::KLastModifiedDateProperty,
hgs
parents: 9
diff changeset
   230
                         buf,
hgs
parents: 9
diff changeset
   231
                         CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
hgs
parents: 9
diff changeset
   232
      //Format for excerpt field
hgs
parents: 9
diff changeset
   233
      buf.Format( KExcerptFormat, time.Year(), 
hgs
parents: 9
diff changeset
   234
                               time.Month() + 1, 
hgs
parents: 9
diff changeset
   235
                               time.Day() + 1, 
hgs
parents: 9
diff changeset
   236
                               time.Hour(), 
hgs
parents: 9
diff changeset
   237
                               time.Minute());
hgs
parents: 9
diff changeset
   238
      AddToFieldExcerptL(buf);
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
      }
9
hgs
parents: 7
diff changeset
   240
    if( iExcerpt )
hgs
parents: 7
diff changeset
   241
        {
hgs
parents: 7
diff changeset
   242
        index_item->AddExcerptL(*iExcerpt);
hgs
parents: 7
diff changeset
   243
        }
hgs
parents: 7
diff changeset
   244
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
    //Latitude error currently 
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
    /* TODO- Bhuvi Location is a seperate object for each image object if any such relation
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
     * exist it has to be searched from Relation table and from there we have to open 
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
     * location object and query Longitude and Latitudes
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
     */
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
    /*
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
    CMdEPropertyDef& latitudePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Location::KLatitudeProperty);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
    if(aObject.Property( latitudePropDef, property ) != KErrNotFound)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
      {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
      TBuf<32> buf;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
      TRealFormat format(32,16); //Real format
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
      format.iTriLen = 0;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
      //Add field to document
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   258
      if(EPropertyReal32 == property->Def().PropertyType())
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
          {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
          CMdEReal32Property& real32Property = (CMdEReal32Property&) property;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
          buf.Num( real32Property.Value(), format );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   262
          }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
      else
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
          if(EPropertyReal64 == property->Def().PropertyType())
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
          {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
          CMdEReal64Property& real64Property = (CMdEReal64Property&) property;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
          buf.Num( real64Property.Value(), format );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   268
          }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
      AddFiledtoDocumentL(*index_item,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
                         MdeConstants::Location::KLatitudeProperty,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
                         buf,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
                         CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
      }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
    //Longitude
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
    CMdEPropertyDef& longitudePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Location::KLongitudeProperty);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
    if(aObject.Property( longitudePropDef, property ) != KErrNotFound)
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   277
      {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   278
      TBuf<32> buf;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
      TRealFormat format(32,16); //Real format
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
      format.iTriLen = 0;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   281
      //Add field to document
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   282
      if(EPropertyReal32 == property->Def().PropertyType())
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   283
          {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
          CMdEReal32Property& real32Property = (CMdEReal32Property&) property;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   285
          buf.Num( real32Property.Value(), format );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   286
          }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
      else
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   288
          if(EPropertyReal64 == property->Def().PropertyType())
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   289
          {
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   290
          CMdEReal64Property& real64Property = (CMdEReal64Property&) property;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   291
          buf.Num( real64Property.Value(), format );
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   292
          }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   293
      AddFiledtoDocumentL(*index_item,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   294
                         MdeConstants::Location::KLongitudeProperty,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   295
                         buf,
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   296
                         CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   297
      }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   298
      */
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   299
    CPIXLOGSTRING("END CCPIXMediaImageDoc::GetCpixDocumentL");
2
208a4ba3894c Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   300
    OstTraceFunctionExit0( CCPIXMEDIAIMAGEDOC_GETCPIXDOCUMENTL_EXIT );
0
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   301
    return index_item;
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   302
    }
ccd0fd43f247 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   303
//End of life