|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Provides functionality for DRM file protection analyzing |
|
15 * and content MMS compatibility resolving. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef SENDUIFILERIGHTSENGINE_H |
|
23 #define SENDUIFILERIGHTSENGINE_H |
|
24 |
|
25 // INCLUDES |
|
26 #include <e32base.h> |
|
27 #include <f32file.h> // FileSession |
|
28 #include <badesca.h> |
|
29 |
|
30 |
|
31 // DATA TYPES |
|
32 enum TFREErrorNoteType |
|
33 { |
|
34 EErrorNote = 0, |
|
35 EInformationNote, |
|
36 EConfirmationQuery |
|
37 }; |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 class CMsgMediaResolver; |
|
41 class CMmsConformance; |
|
42 class CFileProtectionResolver; |
|
43 class CSendUiAttachment; |
|
44 // CLASS DECLARATION |
|
45 |
|
46 /** |
|
47 * Provides functionality for DRM file protection analyzing |
|
48 * and content MMS compatibility resolving. |
|
49 * |
|
50 * @lib SenduiDataUtils.lib |
|
51 * @since Series 60 3.0 |
|
52 */ |
|
53 NONSHARABLE_CLASS (CSendUiFileRightsEngine) : public CBase |
|
54 { |
|
55 public: // Constructors and destructor |
|
56 |
|
57 /** |
|
58 * Two-phased constructor. |
|
59 */ |
|
60 IMPORT_C static CSendUiFileRightsEngine* NewL( RFs& aFs ); |
|
61 |
|
62 /** |
|
63 * Two-phased constructor. |
|
64 */ |
|
65 IMPORT_C static CSendUiFileRightsEngine* NewLC( RFs& aFs ); |
|
66 |
|
67 /** |
|
68 * Destructor. |
|
69 */ |
|
70 virtual ~CSendUiFileRightsEngine(); |
|
71 |
|
72 public: // New functions |
|
73 |
|
74 /** |
|
75 * ValidateFiles |
|
76 * |
|
77 * This functions stores file sizes for all validated files. |
|
78 * |
|
79 * @since S60 3.0 |
|
80 * @param aAttachments Attachents to be validated. |
|
81 * Return value contains valid attachments, |
|
82 * invalid attachments are filtered away from array. |
|
83 * @return None. |
|
84 */ |
|
85 IMPORT_C void ValidateFiles( CArrayPtrFlat<CSendUiAttachment>* aAttachments ); |
|
86 |
|
87 /** |
|
88 * Confirms DRM rights of files |
|
89 * |
|
90 * Note: files must be validated before DRM analyze. This functions also |
|
91 * stores mimetypes of files for later use. Mimetypes are stored into |
|
92 * the given array. |
|
93 * |
|
94 * @since S60 3.0 |
|
95 * @param aAttachments Attachments (Path and handle) to be validated. |
|
96 * Return value contains valid attachments, |
|
97 * invalid attachments are filtered away from array. |
|
98 * @return None. |
|
99 */ |
|
100 IMPORT_C void ConfirmDrmFileRightsL( CArrayPtrFlat<CSendUiAttachment>* aAttachments ); |
|
101 |
|
102 /** |
|
103 * Validates files for sending via MMS |
|
104 * |
|
105 * Note: files must be validated before MMS validation. |
|
106 * |
|
107 * @since S60 3.0 |
|
108 * @param aAttachments Attachments to be validated. |
|
109 * Return value contains valid attachments, |
|
110 * invalid attachments are filtered away from array. |
|
111 * @param aServiceId Identifies the type of MMS service (MMS/MMS upload..) |
|
112 * @return None. |
|
113 */ |
|
114 |
|
115 IMPORT_C void ConfirmMmsValidityL( CArrayPtrFlat<CSendUiAttachment>* aAttachments, TUid aServiceId = KNullUid ); |
|
116 |
|
117 /** |
|
118 * Shows DRM confirmation query and/or error note, if needed. |
|
119 * Returns EFalse if user cancels sending. |
|
120 * @since S60 v.3.0 |
|
121 * @param aServiceId Different services get different notes. |
|
122 * @return EFalse if user cancels sending, otherwise ETrue. |
|
123 */ |
|
124 IMPORT_C TBool ShowDrmAndMmsInfoL( TUid aServiceId = KNullUid ); |
|
125 |
|
126 /** |
|
127 * CalculateTotalSizeOfFiles |
|
128 * |
|
129 * File sizes saved by ValidateFiles are used. If cached file sizes |
|
130 * do not exist, then file sizes are solved. |
|
131 * |
|
132 * @aAttachments Attachments |
|
133 * @aLinksSupported If ETrue, then only attachments type of file handles are calculated |
|
134 * total size of files. Otherwise filesize of all attachments is returned. |
|
135 * @return Size of files in aAttachments |
|
136 */ |
|
137 IMPORT_C TInt CalculateTotalSizeOfFiles( |
|
138 CArrayPtrFlat<CSendUiAttachment>* aAttachments, |
|
139 TBool aLinksSupported ); |
|
140 |
|
141 /** |
|
142 * Clears all validation counter |
|
143 * |
|
144 * @since S60 v3.0 |
|
145 * @return None. |
|
146 */ |
|
147 IMPORT_C void ClearValidationCounters(); |
|
148 |
|
149 /** |
|
150 * Shows an information note |
|
151 * @since S60 v.3.0 |
|
152 * @param aTextResourceId Resource id of the note |
|
153 * @return None. |
|
154 */ |
|
155 IMPORT_C void ShowInformationNoteL( TUint aTextResourceId ) const; |
|
156 |
|
157 /** |
|
158 * Cleanup ECOM Implementation info array |
|
159 * @param aAny The array |
|
160 * @return None. |
|
161 */ |
|
162 static void CleanupImplArray( TAny* aAny ); |
|
163 |
|
164 private: |
|
165 |
|
166 /** |
|
167 * C++ default constructor. |
|
168 */ |
|
169 CSendUiFileRightsEngine( RFs& aFS ); |
|
170 |
|
171 /** |
|
172 * By default Symbian 2nd phase constructor is private. |
|
173 */ |
|
174 void ConstructL(); |
|
175 |
|
176 private: // New functions |
|
177 |
|
178 /** |
|
179 * Validates that the given file usable |
|
180 * |
|
181 * @since S60 v3.0 |
|
182 * @param aFileName file path |
|
183 * @param aFileSize file size |
|
184 * @return ETrue, if the file can be opened for reading. Otherwise EFalse |
|
185 */ |
|
186 TBool ValidateFile( const TDesC& aFileName, TInt& aFileSize ); |
|
187 |
|
188 /** |
|
189 * AnalyzeMmsValidationResult |
|
190 * @since S60 v.3.0 |
|
191 * @param aAttachment Attachment to be analyzed |
|
192 * @return ETrue, if attachment is valid. Otherwise EFalse. |
|
193 */ |
|
194 TBool AnalyzeMmsValidationResultL( CSendUiAttachment& aAttachment, TInt& aAttachmentsSize ); |
|
195 |
|
196 /** |
|
197 * Resolves a proper DRM query for the given service |
|
198 * @since S60 v.3.0 |
|
199 * @param aServiceId Service Uid |
|
200 * @param aResourceId Id for a proper query in resources. |
|
201 * @return None. |
|
202 */ |
|
203 void ResolveDrmQuery( TUid aServiceId, TUint& aResourceId ); |
|
204 |
|
205 /** |
|
206 * Resolves a proper error note for the given service |
|
207 * @since S60 v.3.0 |
|
208 * @param aServiceId Service Uid |
|
209 * @param aResourceId Id for a proper note in resources. |
|
210 * @param aNoteType Type of the note (query/info) |
|
211 * @param aValueForNote Value for the variable in the note |
|
212 * @return None. |
|
213 */ |
|
214 void ResolveErrorNoteL( |
|
215 TUid aServiceId, |
|
216 TUint& aResourceId, |
|
217 TFREErrorNoteType& aNoteType, |
|
218 TUint& aValueForNote ); |
|
219 |
|
220 /** |
|
221 * Resolves a proper error note for the MMS Upload services |
|
222 * @since S60 v.3.0 |
|
223 * @param aResourceId Id for a proper note in resources. |
|
224 * @param aNoteType Type of the note (query/info) |
|
225 * @param aValueForNote Value for the variable in the note |
|
226 * @return None. |
|
227 */ |
|
228 void ResolveMmsUploadErrorNoteL( |
|
229 TUint& aResourceId, |
|
230 TFREErrorNoteType& aNoteType, |
|
231 TUint& aValueForNote ); |
|
232 |
|
233 /** |
|
234 * Resolves a proper note |
|
235 * @since S60 v.3.0 |
|
236 * @param aResourceId Id for a proper note in resources. |
|
237 * @param aNoteType Type of the note |
|
238 * @param aValueForNote Value for the variable in the note |
|
239 * @return None. |
|
240 */ |
|
241 void ShowErrorNotificationL( |
|
242 TUint aResourceId, |
|
243 TFREErrorNoteType aNoteType, |
|
244 TUint aValueForNote ) const; |
|
245 |
|
246 /** |
|
247 * Shows an error note |
|
248 * @since S60 v.3.0 |
|
249 * @param aTextResourceId Resource id of the note |
|
250 * @return None. |
|
251 */ |
|
252 void ShowErrorNoteL( TUint aTextResourceId ) const; |
|
253 |
|
254 /** |
|
255 * Shows a confirmation query |
|
256 * @since S60 v.3.0 |
|
257 * @param aTextResourceId Text id for the note |
|
258 * @param aNoteResourceId Resource id for the note |
|
259 * @param aValueForNote Variable value for the note |
|
260 * @return None. |
|
261 */ |
|
262 TBool ShowConfirmationQueryL( |
|
263 TUint aTextResourceId, |
|
264 TUint aNoteResourceId, |
|
265 TUint aValueForNote = NULL ) const; |
|
266 |
|
267 |
|
268 private: // Data |
|
269 |
|
270 // Validation results. |
|
271 enum TFREValidationResults |
|
272 { |
|
273 ESenduiIndexTotalCount = 0, |
|
274 ESenduiIndexDeleted, |
|
275 ESenduiIndexDrmSD, // SuperDistributable |
|
276 ESenduiIndexLastResult |
|
277 }; |
|
278 |
|
279 // Reasons for invalidation. |
|
280 enum TFREInvalidTypes |
|
281 { |
|
282 ESenduiIndexDrmFLOrCCL = 0, |
|
283 ESenduiIndexAlreadyInUse, |
|
284 ESenduiIndexMmsTooBig, |
|
285 ESenduiIndexMmsNotSupported, |
|
286 ESenduiIndexBadHandle, |
|
287 ESenduiIndexLastInvalid |
|
288 }; |
|
289 |
|
290 // File protection resolver. Owned. |
|
291 CFileProtectionResolver* iProtectionResolver; |
|
292 |
|
293 CMsgMediaResolver* iMediaResolver; |
|
294 CMmsConformance* iMmsConformance; |
|
295 |
|
296 // File session. |
|
297 RFs iFileSession; |
|
298 |
|
299 // Results of file validations, DRM analyses and MMS validations. |
|
300 TUint iValidationResults[ESenduiIndexLastResult]; |
|
301 |
|
302 TUint iInvalidationReason[ESenduiIndexLastInvalid]; |
|
303 }; |
|
304 |
|
305 #endif // SENDUIFILERIGHTSENGINE_H |
|
306 |
|
307 // End of File |