31
|
1 |
/*
|
|
2 |
* Copyright (c) 2005 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 "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:
|
|
15 |
* Utility class for resolving detailed (media) file information
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef __MSGMEDIARESOLVER_H
|
|
22 |
#define __MSGMEDIARESOLVER_H
|
|
23 |
|
|
24 |
// INCLUDES
|
|
25 |
|
|
26 |
#include <e32std.h>
|
|
27 |
#include <e32base.h> // CBase
|
|
28 |
#include <f32file.h>
|
|
29 |
#include <apgcli.h> // RApaLsSession
|
|
30 |
|
|
31 |
#include <MsgMedia.hrh>
|
|
32 |
#include <MsgMediaInfo.h>
|
|
33 |
|
|
34 |
// CONSTANTS
|
|
35 |
|
|
36 |
// MACROS
|
|
37 |
|
|
38 |
// FORWARD DECLARATIONS
|
|
39 |
class CMsgMediaInfo;
|
|
40 |
class RApaLsSession;
|
|
41 |
class CFileProtectionResolver;
|
|
42 |
class CDRMHelper;
|
|
43 |
class RFile;
|
|
44 |
class CMsgMediaTypeGroup;
|
|
45 |
|
|
46 |
// DATA TYPES
|
|
47 |
|
|
48 |
// FUNCTION PROTOTYPES
|
|
49 |
|
|
50 |
// CLASS DECLARATION
|
|
51 |
|
|
52 |
/**
|
|
53 |
* CMsgMediaResolver...
|
|
54 |
*
|
|
55 |
* @lib MsgMedia.lib
|
|
56 |
* @since 3.1
|
|
57 |
*/
|
|
58 |
NONSHARABLE_CLASS( CMsgMediaResolver ) : public CBase,
|
|
59 |
public MMediaInfoObserver
|
|
60 |
{
|
|
61 |
public: // New methods
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Factory method.
|
|
65 |
*
|
|
66 |
* @param aFs IN Fileserver session.
|
|
67 |
* @return Pointer to instance in CleanupStack
|
|
68 |
*/
|
|
69 |
IMPORT_C static CMsgMediaResolver* NewLC();
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Factory method.
|
|
73 |
*
|
|
74 |
* @param aFs IN Fileserver session.
|
|
75 |
* @return Pointer to instance
|
|
76 |
*/
|
|
77 |
IMPORT_C static CMsgMediaResolver* NewL();
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Destructor
|
|
81 |
*/
|
|
82 |
virtual ~CMsgMediaResolver();
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Opens a (sharable) file handle from a file path
|
|
86 |
*
|
|
87 |
* @param aFileName IN File path.
|
|
88 |
* @return Open file handle.
|
|
89 |
*/
|
|
90 |
IMPORT_C RFile FileHandleL( const TDesC& aFileName );
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Recognizes the MIME type of a file.
|
|
94 |
*
|
|
95 |
* @param aFile IN Open file handle
|
|
96 |
* @param aMimeType OUT Mime type of the file
|
|
97 |
*/
|
|
98 |
IMPORT_C void RecognizeL( RFile& aFile, TDataType& aMimeType );
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Returns the media type of the MIME type.
|
|
102 |
*
|
|
103 |
* @param aMimeType IN Mime type
|
|
104 |
* @return Media type
|
|
105 |
*/
|
|
106 |
IMPORT_C TMsgMediaType MediaType( const TDesC8& aMimeType ) const;
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Resolve the file information of the given file and
|
|
110 |
* return the media info instance to the caller.
|
|
111 |
*
|
|
112 |
* - Does the same as ResolveFileL except returns the
|
|
113 |
* media info class instead of boolean value.
|
|
114 |
*
|
|
115 |
* @param aFile IN Open file handle
|
|
116 |
* @return Pointer to CMsgMediaInfo (ownership transferred)
|
|
117 |
*/
|
|
118 |
IMPORT_C CMsgMediaInfo* CreateMediaInfoL( RFile& aFile );
|
|
119 |
|
|
120 |
/**
|
|
121 |
* Resolve the file information of the given file and
|
|
122 |
* return the media info instance to the caller.
|
|
123 |
*
|
|
124 |
* - Does the same as ResolveFileTransferInfoL except does not
|
|
125 |
* recognize the file (uses given mime type).
|
|
126 |
*
|
|
127 |
* @param aFile IN Open file handle
|
|
128 |
* @param aMimeType IN Mime type of the file.
|
|
129 |
* @return Pointer to CMsgMediaInfo (ownership transferred)
|
|
130 |
*/
|
|
131 |
IMPORT_C CMsgMediaInfo* CreateMediaInfoL( RFile& aFile, TDataType& aMimeType );
|
|
132 |
|
|
133 |
/**
|
|
134 |
* Parse media info details synchronously.
|
|
135 |
*
|
|
136 |
* The usage of this method is highly discouraged since it uses
|
|
137 |
* CActiveSchedulerWait for synchronizing the parsing. The
|
|
138 |
* preferred way is to use the asynchronous version of
|
|
139 |
* ParseInfoDetailsL provided by CMsgMediaInfo.
|
|
140 |
*
|
|
141 |
* @param aInfo IN Media info.
|
|
142 |
* @param aFile IN Open file handle. Must be the same from which
|
|
143 |
* the media info is created from.
|
|
144 |
*/
|
|
145 |
IMPORT_C void ParseInfoDetailsL( CMsgMediaInfo* aInfo, RFile& aFile );
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Get DRM Helper
|
|
149 |
*
|
|
150 |
* @return Pointer to CDRMHelper
|
|
151 |
*/
|
|
152 |
inline CDRMHelper* DRMHelper() const;
|
|
153 |
|
|
154 |
/**
|
|
155 |
* Get File Protection Resolver
|
|
156 |
*
|
|
157 |
* @return Pointer to CFileProtectionResolver
|
|
158 |
*/
|
|
159 |
inline CFileProtectionResolver* FileProtectionResolver() const;
|
|
160 |
|
|
161 |
/**
|
|
162 |
* Enable/disable character set recognition.
|
|
163 |
* If disabled it is assumed that the client knows and
|
|
164 |
* sets the character set to text info objects itself.
|
|
165 |
*
|
|
166 |
* @param aEnable ETrue, Set CharSet recognition on,
|
|
167 |
* EFalse, Set CharSet recognition off.
|
|
168 |
*/
|
|
169 |
inline void SetCharacterSetRecognition( TBool aEnable );
|
|
170 |
|
|
171 |
public:
|
|
172 |
|
|
173 |
/**
|
|
174 |
* From MMediaInfoObserver
|
|
175 |
*/
|
|
176 |
void MediaInfoParsed();
|
|
177 |
|
|
178 |
private:
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Constructor.
|
|
182 |
*
|
|
183 |
* @param aFs IN Fileserver session.
|
|
184 |
*/
|
|
185 |
CMsgMediaResolver();
|
|
186 |
|
|
187 |
/**
|
|
188 |
* 2nd phase constructor.
|
|
189 |
*/
|
|
190 |
void ConstructL();
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Reads media type group information from resources.
|
|
194 |
*/
|
|
195 |
void CreateMediaTypeGroupsL();
|
|
196 |
|
|
197 |
/**
|
|
198 |
* Factory method that creates object of proper kind.
|
|
199 |
*
|
|
200 |
* @param aFile IN File handle to create info class from.
|
|
201 |
* @param aMimeType IN Already recognized mime type.
|
|
202 |
*/
|
|
203 |
CMsgMediaInfo* DoCreateMediaInfoL(
|
|
204 |
RFile& aFile,
|
|
205 |
TDataType& aMimeType );
|
|
206 |
|
|
207 |
private: // data
|
|
208 |
|
|
209 |
RFs iFs;
|
|
210 |
RApaLsSession iApaLsSession;
|
|
211 |
|
|
212 |
RPointerArray<CMsgMediaTypeGroup> iMimeGroupArray;
|
|
213 |
|
|
214 |
CDRMHelper* iDRMHelper;
|
|
215 |
CFileProtectionResolver* iFileProt;
|
|
216 |
|
|
217 |
TBool iRecognizeCharSet;
|
|
218 |
CActiveSchedulerWait iWait;
|
|
219 |
};
|
|
220 |
|
|
221 |
#include <MsgMediaResolver.inl>
|
|
222 |
|
|
223 |
#endif // __MSGMEDIARESOLVER_H
|