serviceproviders/sapi_mediamanagement/src/mgmediaitem.cpp
changeset 10 fc9cf246af83
parent 5 989d2f495d90
child 23 50974a8b132e
equal deleted inserted replaced
5:989d2f495d90 10:fc9cf246af83
    17 
    17 
    18 
    18 
    19 #include <mclfitem.h>
    19 #include <mclfitem.h>
    20 #include <pathinfo.h>
    20 #include <pathinfo.h>
    21 #include <liwvariant.h>
    21 #include <liwvariant.h>
    22 
    22 #include "mgmresolution.h"
    23 
    23 
    24 #include "mgmediaitem.h"
    24 #include "mgmediaitem.h"
    25 
    25 
    26 // Keys // used by service class and iterator
    26 // Keys // used by service class and iterator
    27 _LIT8( KMgFileName, "FileName" );
    27 _LIT8( KMgFileName, "FileName" );
    30 _LIT8( KMgFileSize, "FileSize" );
    30 _LIT8( KMgFileSize, "FileSize" );
    31 _LIT8( KMgFileDate, "FileDate" );
    31 _LIT8( KMgFileDate, "FileDate" );
    32 _LIT8( KMgMediaType, "MediaType" );
    32 _LIT8( KMgMediaType, "MediaType" );
    33 _LIT8( KMgMimeType, "MimeType" ); 
    33 _LIT8( KMgMimeType, "MimeType" ); 
    34 _LIT8( KType, "Type");
    34 _LIT8( KType, "Type");
       
    35 _LIT8(KXPixels, "XPixels");
       
    36 _LIT8(KYPixels, "YPixels");
    35 
    37 
    36 _LIT( EMgPhoneMemory,"C:" );
    38 _LIT( EMgPhoneMemory,"C:" );
    37 _LIT( EMgMmc,"E:" );
    39 _LIT( EMgMmc,"E:" );
    38 _LIT( KMediaType, "Media");
    40 _LIT( KMediaType, "Media");
       
    41 _LIT( KImageType, "image");
    39 const TInt KMemoryNameLength = 2;
    42 const TInt KMemoryNameLength = 2;
       
    43 const TInt KImgLen = 20;
    40 
    44 
    41 // ---------------------------------------------------------------------------
    45 // ---------------------------------------------------------------------------
    42 // CMgMediaItem::FillCommonAttributesL
    46 // CMgMediaItem::FillCommonAttributesL
    43 // Fills the attributes common to all media types
    47 // Fills the attributes common to all media types
    44 // ---------------------------------------------------------------------------
    48 // ---------------------------------------------------------------------------
    53     TTime time;
    57     TTime time;
    54     TBuf<KMemoryNameLength> memory;
    58     TBuf<KMemoryNameLength> memory;
    55     TInt32 size;
    59     TInt32 size;
    56     TPtrC mimeType;
    60     TPtrC mimeType;
    57     TInt32 mediaType;
    61     TInt32 mediaType;
       
    62     TBuf<KImgLen> mediaImage;
       
    63     mediaImage.Append( KImageType );
    58     
    64     
    59     if( KErrNone == aClfItem.GetField( ECLFFieldIdFileNameAndPath, fullName ) )
    65     if( KErrNone == aClfItem.GetField( ECLFFieldIdFileNameAndPath, fullName ) )
    60                                                         
    66                                                         
    61         {
    67         {
    62         name.Set( TParsePtrC( fullName ).Name() );
    68         name.Set( TParsePtrC( fullName ).Name() );
    89     aOutputMap->InsertL( KMgMimeType,TLiwVariant( mimeType ) );
    95     aOutputMap->InsertL( KMgMimeType,TLiwVariant( mimeType ) );
    90     aOutputMap->InsertL( KMgMediaType,TLiwVariant( mediaType ) );
    96     aOutputMap->InsertL( KMgMediaType,TLiwVariant( mediaType ) );
    91     aOutputMap->InsertL( KMgFileDate,TLiwVariant( time ) );
    97     aOutputMap->InsertL( KMgFileDate,TLiwVariant( time ) );
    92     aOutputMap->InsertL( KMgFileSize,TLiwVariant( size ) );
    98     aOutputMap->InsertL( KMgFileSize,TLiwVariant( size ) );
    93     
    99     
       
   100     if ( mediaType == ECLFMediaTypeImage )
       
   101         {
       
   102         TSize imageRes( 0,0 );
       
   103         MResolution* mediaResObj = MediaResolutionFactory::CreateMediaResolutionobjL( mediaImage,fullName );
       
   104         CleanupStack::PushL( mediaResObj );
       
   105         mediaResObj->GetresolutionL( imageRes );        
       
   106         aOutputMap->InsertL( KXPixels,(TInt32)imageRes.iWidth );
       
   107         aOutputMap->InsertL( KYPixels,(TInt32)imageRes.iHeight );
       
   108         CleanupStack::Pop( mediaResObj );
       
   109         delete mediaResObj;
       
   110         }         
    94     }
   111     }
    95 
   112 
    96 
   113 
    97 
   114 
    98 
   115 
    99