|
1 /* |
|
2 * Copyright (c) 2002-2006 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: A helper class for making correctness and DRM checkups to the |
|
15 * tones to be used as alert tones. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CPROENGTONEHANDLER_H |
|
22 #define CPROENGTONEHANDLER_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <f32file.h> // CBase, RFs |
|
26 #include <apmstd.h> // KMaxDataTypeLength |
|
27 #include <data_caging_path_literals.hrh> |
|
28 #include "ProfileEng.hrh" // TProfileSettingId |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class DRMCommon; |
|
32 class CDRMHelper; |
|
33 class CProEngMediaVariation; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 |
|
37 /** |
|
38 * A helper class for making correctness and DRM checkups to the |
|
39 * tones to be used as alert tones. |
|
40 * Registers DRM protected tones as automated content |
|
41 * and removes old content from automated content list. |
|
42 * Shows a content activation query and other DRM related |
|
43 * notes if necessary. |
|
44 |
|
45 * |
|
46 * @lib ProfileEngine.lib |
|
47 * @since Series 60 3.1 |
|
48 */ |
|
49 NONSHARABLE_CLASS( CProEngToneHandler ) : public CBase |
|
50 { |
|
51 public: // Constructors and destructor |
|
52 |
|
53 // Two-phased constructors. |
|
54 static CProEngToneHandler* NewL(); |
|
55 static CProEngToneHandler* NewLC(); |
|
56 |
|
57 // Destructor. |
|
58 ~CProEngToneHandler(); |
|
59 |
|
60 public: // New functions |
|
61 |
|
62 /** |
|
63 * Checks that the given tone file exists and that it is |
|
64 * a legal file to be used as a ringing or alert tone. |
|
65 * @since 3.1 |
|
66 * @param aFileName Full path and filename of the file to be checked. |
|
67 * @param aToneType Type of tone to check, see: ProfileEng.hrh |
|
68 * @return KErrNone if the file can be used as a ringing or alert tone, |
|
69 * KErrNotFound if the file cannot be found, |
|
70 * KErrNotSupported if a file is of an unsupported type or |
|
71 * KErrPermissionDenied if the file is not allowed |
|
72 * to be used as a ringing or alert tone. |
|
73 * KErrGeneral if DRM rights are insufficient. |
|
74 * KErrArgument if the file is DRM protected |
|
75 * audio/mp4 and those are not allowed as ringingtones. |
|
76 * KErrTooBig if file size exceeded file size limit. |
|
77 */ |
|
78 TInt CheckToneFileL( const TDesC& aFileName, TInt aToneType ); |
|
79 |
|
80 /** |
|
81 * Adds the file to automated content list and removes the old file |
|
82 * from automated content list. |
|
83 * Called by CProEngProfileImpl::CommitChangeL after the changes has |
|
84 * been committed in the underlying Profiles Engine. |
|
85 * @since 3.1 |
|
86 * @param aSettingId setting id which identifies which tone (ringing |
|
87 * tone, sms tone etc.) this automated content |
|
88 * handling operation concerns. |
|
89 * @param aFileName Full path and filename of the tone to be used |
|
90 * as the new ringing or alert tone. |
|
91 * @param aOldFileName Full path and filename of the previous tone used |
|
92 * as the ringing or alert tone. |
|
93 * @return KErrNone, if succesful, otherwise a system-wide error code. |
|
94 */ |
|
95 TInt HandleAutomatedContent( TProfileSettingId aSettingId, |
|
96 const TDesC& aFileName, |
|
97 const TDesC& aOldFileName); |
|
98 |
|
99 protected: // New functions |
|
100 |
|
101 /** |
|
102 * Helper function for CheckToneFileL. This function does most of the |
|
103 * actual checking. |
|
104 * @since 3.1 |
|
105 * @param aFileName Full path and filename of the file to be checked. |
|
106 * @param aToneType Type of tone to check, see: ProfileEng.hrh |
|
107 * @return KErrNone if the file can be used as a ringing or alert tone, |
|
108 * KErrNotFound if the file cannot be found, |
|
109 * KErrNotSupported if a file is of an unsupported type or |
|
110 * KErrPermissionDenied if the file is not allowed |
|
111 * to be used as a ringing or alert tone. |
|
112 * KErrGeneral if DRM rights are insufficient. |
|
113 * KErrArgument if the file is DRM protected |
|
114 * audio/mp4 and those are not allowed as ringingtones. |
|
115 * KErrTooBig if file size exceeded file size limit. |
|
116 */ |
|
117 TInt DoCheckToneFileL( const TDesC& aFileName, TInt aToneType ); |
|
118 |
|
119 /** |
|
120 * Checks if a DRM protected file can be used as a ringing or alert tone. |
|
121 * @since 3.1 |
|
122 * @param aFileName Full path and filename of the file to be checked. |
|
123 * @return KErrNone if the file can be used as a ringing or alert tone or |
|
124 * KErrGeneral if DRM rights are insufficient. |
|
125 */ |
|
126 TInt CheckProtectedFileL( const TDesC& aFileName ); |
|
127 |
|
128 /** |
|
129 * Tells whether a file can be registered as automated content or not. |
|
130 * If DRM is not supported, returns always EFalse. |
|
131 * @since 3.1 |
|
132 * @param aFileName File to be registered as automated content. |
|
133 * @return Returns ETrue if aFileName can be set as automated content. |
|
134 * Returns EFalse if can't or DRM is not supported. |
|
135 */ |
|
136 TBool CanSetAutomated( const TDesC& aFileName ); |
|
137 |
|
138 /** |
|
139 * Asks user if he/she wants to activate unactivated content. |
|
140 * Shows a query. Does nothing if DRM is not supported. |
|
141 * @since 3.1 |
|
142 * @param aFileName File to be registered as automated content. |
|
143 * @return Returns KErrCancel if user cancels the query. |
|
144 */ |
|
145 TInt AskAutomated( const TDesC& aFileName ); |
|
146 |
|
147 /** |
|
148 * Registers a file to automated content list without any queries. |
|
149 * Errors are omitted. Does nothing if DRM is not supported. |
|
150 * @since 3.1 |
|
151 * @param aSettingId setting id which identifies which tone (ringing |
|
152 * tone, sms tone etc.) this automated content |
|
153 * setting operation concerns. |
|
154 * @param aFileName File to be registered as automated content. |
|
155 * @return KErrNone, if succesful, otherwise a system-wide error code. |
|
156 */ |
|
157 TInt SetAutomated( TProfileSettingId aSettingId, |
|
158 const TDesC& aFileName ); |
|
159 |
|
160 /** |
|
161 * Removes a file from automated content list. |
|
162 * Errors are omitted. Does nothing if DRM is not supported. |
|
163 * @since 3.1 |
|
164 * @param aFileName File to be removed from automated content list. |
|
165 */ |
|
166 void RemoveAutomated( const TDesC& aFileName ); |
|
167 |
|
168 /** |
|
169 * Returns whether a file is protected content or not. |
|
170 * Returns always EFalse if DRM is not supported. |
|
171 * @since 3.1 |
|
172 * @param aFileName The file name. |
|
173 * @return Returns whether the file is protected content or not. |
|
174 */ |
|
175 TBool IsProtected( const TDesC& aFileName ) const; |
|
176 |
|
177 /** |
|
178 * Returns whether a file is protected content or not. |
|
179 * Returns always EFalse if DRM is not supported. |
|
180 * @since 3.1 |
|
181 * @param aFileName The file name. |
|
182 * @return Returns whether the file is protected content or not. |
|
183 */ |
|
184 TBool IsProtectedL( const TDesC& aFileName ) const; |
|
185 |
|
186 /** |
|
187 * Displays an error note. |
|
188 * @since 3.1 |
|
189 * @param aResourceId Resource ID to a TBUF resource. |
|
190 */ |
|
191 void ShowErrorNoteL( TInt aResourceId ); |
|
192 |
|
193 /** |
|
194 * Checks if tone file's size is larger than the size limit. |
|
195 * @since 3.1 |
|
196 * @param aFileName The path to the file. |
|
197 * @return KErrNone if the file can be used as a ringing tone. |
|
198 * KErrTooBig if the file size limit is exceeded. |
|
199 */ |
|
200 TInt CheckFileSizeLimit( const TDesC& aFileName ) const; |
|
201 /** |
|
202 * Checks if tone file's size is larger than the size limit. |
|
203 * @since 3.1 |
|
204 * @return KErrNone if the file can be used as a ringing tone. |
|
205 * KErrTooBig if the file size limit is exceeded. |
|
206 */ |
|
207 TInt CheckToneFileSize( const TDesC& aFile, TInt aSizeLimitKB ) const; |
|
208 /** |
|
209 * Reads tone file size limit from cenrep. |
|
210 * @since 3.1 |
|
211 * @return leaves on error |
|
212 */ |
|
213 void GetMaxToneFileSizeL( TInt& aMaxSizeKB ) const; |
|
214 |
|
215 private: |
|
216 |
|
217 /// Default constructor |
|
218 CProEngToneHandler(); |
|
219 |
|
220 /// 2nd phase constructor |
|
221 void ConstructL(); |
|
222 |
|
223 /// Constructor for the DRM objects |
|
224 void DrmConstructL(); |
|
225 |
|
226 /// Destructor for the DRM objects |
|
227 void ReleaseDrm(); |
|
228 |
|
229 /// Called by SetAutomated |
|
230 TInt SetAutomatedL( TProfileSettingId aSettingId, |
|
231 const TDesC& aFileName ); |
|
232 |
|
233 private: // Data |
|
234 |
|
235 /// Owns: DRM Helper client. |
|
236 CDRMHelper* iDrmHelper; |
|
237 |
|
238 /// Owns: DRM Common client |
|
239 DRMCommon* iDrmCommon; |
|
240 |
|
241 /// File Server client. |
|
242 RFs iFs; |
|
243 |
|
244 /// Mime-type handling: |
|
245 CProEngMediaVariation* iMediaVariation; |
|
246 |
|
247 /// voice call file size limit |
|
248 TInt iToneFileSizeLimitKB; |
|
249 }; |
|
250 |
|
251 #endif // CPROENGTONEHANDLER_H |
|
252 |
|
253 // End of File |