author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 22 | fc9cf246af83 |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Holds information common to all media types |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
19 |
#include <MCLFItem.h> |
19 | 20 |
#include <pathinfo.h> |
21 |
#include <liwvariant.h> |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
22 |
#include "mgmresolution.h" |
19 | 23 |
|
24 |
#include "mgmediaitem.h" |
|
25 |
||
26 |
// Keys // used by service class and iterator |
|
27 |
_LIT8( KMgFileName, "FileName" ); |
|
28 |
_LIT8( KMgFileExtension, "FileExtension" ); |
|
29 |
_LIT8( KMgDrive, "Drive" ); |
|
30 |
_LIT8( KMgFileSize, "FileSize" ); |
|
31 |
_LIT8( KMgFileDate, "FileDate" ); |
|
32 |
_LIT8( KMgMediaType, "MediaType" ); |
|
33 |
_LIT8( KMgMimeType, "MimeType" ); |
|
34 |
_LIT8( KType, "Type"); |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
35 |
_LIT8(KXPixels, "XPixels"); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
36 |
_LIT8(KYPixels, "YPixels"); |
19 | 37 |
|
38 |
_LIT( EMgPhoneMemory,"C:" ); |
|
39 |
_LIT( EMgMmc,"E:" ); |
|
40 |
_LIT( KMediaType, "Media"); |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
41 |
_LIT( KImageType, "image"); |
19 | 42 |
const TInt KMemoryNameLength = 2; |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
43 |
const TInt KImgLen = 20; |
19 | 44 |
|
45 |
// --------------------------------------------------------------------------- |
|
46 |
// CMgMediaItem::FillCommonAttributesL |
|
47 |
// Fills the attributes common to all media types |
|
48 |
// --------------------------------------------------------------------------- |
|
49 |
// |
|
50 |
||
51 |
void CMgMediaItem::FillCommonAttributesL(CLiwDefaultMap* aOutputMap, const MCLFItem& aClfItem) |
|
52 |
{ |
|
53 |
||
54 |
TPtrC fullName; |
|
55 |
TPtrC name; |
|
56 |
TPtrC ext; |
|
57 |
TTime time; |
|
58 |
TBuf<KMemoryNameLength> memory; |
|
59 |
TInt32 size; |
|
60 |
TPtrC mimeType; |
|
61 |
TInt32 mediaType; |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
62 |
TBuf<KImgLen> mediaImage; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
63 |
mediaImage.Append( KImageType ); |
19 | 64 |
|
65 |
if( KErrNone == aClfItem.GetField( ECLFFieldIdFileNameAndPath, fullName ) ) |
|
66 |
||
67 |
{ |
|
68 |
name.Set( TParsePtrC( fullName ).Name() ); |
|
69 |
ext.Set( TParsePtrC( fullName ).Ext() ); |
|
70 |
if( fullName.Length() > 0 ) |
|
71 |
{ |
|
72 |
TCharF mmcMemory( PathInfo::MemoryCardRootPath()[0] ); |
|
73 |
TCharF itemPath( fullName[0] ); |
|
74 |
if( mmcMemory == itemPath ) |
|
75 |
{ // by default phone memory |
|
76 |
memory = EMgMmc; |
|
77 |
} |
|
78 |
else |
|
79 |
{ |
|
80 |
memory = EMgPhoneMemory; |
|
81 |
} |
|
82 |
} |
|
83 |
} |
|
84 |
||
85 |
aClfItem.GetField( ECLFFieldIdMimeType, mimeType ); |
|
86 |
aClfItem.GetField( ECLFFieldIdFileSize, size ); |
|
87 |
aClfItem.GetField( ECLFFieldIdFileDate, time ); |
|
88 |
aClfItem.GetField( ECLFFieldIdMediaType, mediaType ); |
|
89 |
||
90 |
// insert all above attribute in map |
|
91 |
aOutputMap->InsertL( KType, TLiwVariant( KMediaType ) ); |
|
92 |
aOutputMap->InsertL( KMgFileName, TLiwVariant( name ) ); |
|
93 |
aOutputMap->InsertL( KMgFileExtension, TLiwVariant( ext ) ); |
|
94 |
aOutputMap->InsertL( KMgDrive,TLiwVariant( memory ) ); |
|
95 |
aOutputMap->InsertL( KMgMimeType,TLiwVariant( mimeType ) ); |
|
96 |
aOutputMap->InsertL( KMgMediaType,TLiwVariant( mediaType ) ); |
|
97 |
aOutputMap->InsertL( KMgFileDate,TLiwVariant( time ) ); |
|
98 |
aOutputMap->InsertL( KMgFileSize,TLiwVariant( size ) ); |
|
99 |
||
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
100 |
if ( mediaType == ECLFMediaTypeImage ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
101 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
102 |
TSize imageRes( 0,0 ); |
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
103 |
MResolution* mediaResObj=NULL; |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
104 |
TInt err =KErrNone; |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
105 |
TRAP(err,mediaResObj = MediaResolutionFactory::CreateMediaResolutionobjL( mediaImage,fullName )); |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
106 |
|
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
107 |
if(err == KErrNone){ |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
108 |
CleanupStack::PushL( mediaResObj ); |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
109 |
mediaResObj->GetresolutionL( imageRes ); |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
110 |
aOutputMap->InsertL( KXPixels,(TInt32)imageRes.iWidth ); |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
111 |
aOutputMap->InsertL( KYPixels,(TInt32)imageRes.iHeight ); |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
112 |
CleanupStack::Pop( mediaResObj ); |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
113 |
delete mediaResObj; |
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
114 |
} |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
115 |
} |
19 | 116 |
} |
117 |
||
118 |
||
119 |
||
120 |