diff -r a36b1e19a461 -r 989d2f495d90 serviceproviders/sapi_mediamanagement/src/mgmediaitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_mediamanagement/src/mgmediaitem.cpp Fri Jul 03 15:51:24 2009 +0100 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Holds information common to all media types +* +*/ + + +#include +#include +#include + + +#include "mgmediaitem.h" + +// Keys // used by service class and iterator +_LIT8( KMgFileName, "FileName" ); +_LIT8( KMgFileExtension, "FileExtension" ); +_LIT8( KMgDrive, "Drive" ); +_LIT8( KMgFileSize, "FileSize" ); +_LIT8( KMgFileDate, "FileDate" ); +_LIT8( KMgMediaType, "MediaType" ); +_LIT8( KMgMimeType, "MimeType" ); +_LIT8( KType, "Type"); + +_LIT( EMgPhoneMemory,"C:" ); +_LIT( EMgMmc,"E:" ); +_LIT( KMediaType, "Media"); +const TInt KMemoryNameLength = 2; + +// --------------------------------------------------------------------------- +// CMgMediaItem::FillCommonAttributesL +// Fills the attributes common to all media types +// --------------------------------------------------------------------------- +// + +void CMgMediaItem::FillCommonAttributesL(CLiwDefaultMap* aOutputMap, const MCLFItem& aClfItem) + { + + TPtrC fullName; + TPtrC name; + TPtrC ext; + TTime time; + TBuf memory; + TInt32 size; + TPtrC mimeType; + TInt32 mediaType; + + if( KErrNone == aClfItem.GetField( ECLFFieldIdFileNameAndPath, fullName ) ) + + { + name.Set( TParsePtrC( fullName ).Name() ); + ext.Set( TParsePtrC( fullName ).Ext() ); + if( fullName.Length() > 0 ) + { + TCharF mmcMemory( PathInfo::MemoryCardRootPath()[0] ); + TCharF itemPath( fullName[0] ); + if( mmcMemory == itemPath ) + { // by default phone memory + memory = EMgMmc; + } + else + { + memory = EMgPhoneMemory; + } + } + } + + aClfItem.GetField( ECLFFieldIdMimeType, mimeType ); + aClfItem.GetField( ECLFFieldIdFileSize, size ); + aClfItem.GetField( ECLFFieldIdFileDate, time ); + aClfItem.GetField( ECLFFieldIdMediaType, mediaType ); + + // insert all above attribute in map + aOutputMap->InsertL( KType, TLiwVariant( KMediaType ) ); + aOutputMap->InsertL( KMgFileName, TLiwVariant( name ) ); + aOutputMap->InsertL( KMgFileExtension, TLiwVariant( ext ) ); + aOutputMap->InsertL( KMgDrive,TLiwVariant( memory ) ); + aOutputMap->InsertL( KMgMimeType,TLiwVariant( mimeType ) ); + aOutputMap->InsertL( KMgMediaType,TLiwVariant( mediaType ) ); + aOutputMap->InsertL( KMgFileDate,TLiwVariant( time ) ); + aOutputMap->InsertL( KMgFileSize,TLiwVariant( size ) ); + + } + + + + +