|
1 /* |
|
2 * Copyright (c) 2004,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: DRM helper for svg files. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef SVGTDRMHELPER_H |
|
21 #define SVGTDRMHELPER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32std.h> |
|
25 |
|
26 // DATA TYPES |
|
27 enum TSVGTRightsStatus |
|
28 { |
|
29 ESVGTFull, |
|
30 ESVGTMissing, |
|
31 ESVGTRestricted, |
|
32 ESVGTExpired, |
|
33 ESVGTPreview |
|
34 }; |
|
35 |
|
36 enum TSVGTExpireConstraint |
|
37 { |
|
38 ESVGTNone, |
|
39 ESVGTCount, |
|
40 ESVGTTime, |
|
41 ESVGTCountAndTime |
|
42 }; |
|
43 |
|
44 // CONSTANTS |
|
45 const TInt KSVGTRightsAboutToExpire = -40000; |
|
46 |
|
47 // FORWARD DECLARATIONS |
|
48 class CDRMHelper; |
|
49 class CDRMHelperRightsConstraints; |
|
50 class MDesCArray; |
|
51 class CCoeEnv; |
|
52 |
|
53 // CLASS DECLARATION |
|
54 |
|
55 /** |
|
56 * DRM helper for SVG files. |
|
57 * |
|
58 * @lib SVGTUIControl.dll |
|
59 * @since 3.0 |
|
60 */ |
|
61 class CSVGTDrmHelper : public CBase |
|
62 { |
|
63 public: // Constructors and destructor |
|
64 |
|
65 /** |
|
66 * Two-phased constructor. |
|
67 */ |
|
68 static CSVGTDrmHelper* NewL(); |
|
69 |
|
70 /** |
|
71 * Two-phased constructor. |
|
72 */ |
|
73 static CSVGTDrmHelper* NewLC(); |
|
74 |
|
75 /** |
|
76 * Destructor. |
|
77 */ |
|
78 virtual ~CSVGTDrmHelper(); |
|
79 |
|
80 public: // New functions |
|
81 |
|
82 |
|
83 /** |
|
84 * This Function checks whether the file has preview rights. |
|
85 * @since 3.0 |
|
86 * @param aFileHandle File handle for which usage rights info is loaded. |
|
87 * @return True if the file has only preview rights |
|
88 * False if not. |
|
89 */ |
|
90 TBool IsPreviewL( RFile& aFileHandle ); |
|
91 |
|
92 /** |
|
93 * This Function checks the rights associated with the file. |
|
94 * @since 3.0 |
|
95 * @param aFileHandle File handle for which usage rights is checked. |
|
96 * @return Button code |
|
97 */ |
|
98 TInt CheckRightsAmountL( RFile& aFileHandle ); |
|
99 |
|
100 |
|
101 /** |
|
102 * This Function gets the drm details needed for thumbnail generation. |
|
103 * @since 3.0 |
|
104 * @param aFileHandle File handle for which usage rights info is loaded. |
|
105 * @param aRightsValid True if the rights are valid |
|
106 * @param aIsSeparateDeliveryNS True if the file is a separate delivery |
|
107 * drm file non-supersitributable |
|
108 * @param aIsProtected True if the file is protected |
|
109 */ |
|
110 void GetDrmDetailsL( RFile& aFileHandle, |
|
111 TBool& aRightsValid, |
|
112 TBool& aIsSeparateDeliveryNS, |
|
113 TBool& aIsProtected ); |
|
114 |
|
115 |
|
116 /** |
|
117 * Loads usage rights information for a svg file using |
|
118 * CDRMHelper. The loaded constraint is CContentAccess::EPlay. |
|
119 * @since 3.0 |
|
120 * @param aFileHandle File handle for which usage rights info is loaded. |
|
121 */ |
|
122 void LoadUsageRigthsInfoL( RFile& aFileHandle ); |
|
123 |
|
124 |
|
125 /** |
|
126 * Gets usage rigths status. |
|
127 * @since 3.0 |
|
128 * @param aStatus: |
|
129 * ESVGTFull: Full rights |
|
130 * ESVGTMissing: Rights missing |
|
131 * ESVGTRestricted: Restricted rights |
|
132 * ESVGTExpired: Expired rights (could be also future rights) |
|
133 * ESVGTPreview: Preview rights |
|
134 */ |
|
135 void GetUsageRightsStatus( TSVGTRightsStatus& aStatus ); |
|
136 |
|
137 /** |
|
138 * Checks if the usage rigths are about to expire. If they are, returns |
|
139 * info about the rights contraints that are about to expire. |
|
140 * @since 3.0 |
|
141 * @param aAboutToExpire Boolean telling if the rigths are about to |
|
142 * expire or not. |
|
143 * @param aConstraint Constraint that is about to expire: |
|
144 * ESVGTCount: Usage count about to expire |
|
145 * ESVGTTime: Usage time about to expire |
|
146 * ESVGTCountAndTime: Usage count and time about to |
|
147 * expire |
|
148 * @param aCountLeft Usage counts left (only if count is about to expire) |
|
149 * @param aDaysLeft Usage days left (only if time is about to expire) |
|
150 */ |
|
151 void GetExpireStatus( TBool& aAboutToExpire, |
|
152 TSVGTExpireConstraint& aConstraint, |
|
153 TInt& aCountLeft, |
|
154 TInt& aDaysLeft ); |
|
155 |
|
156 /** |
|
157 * Checks if sending of the file is allowed. |
|
158 * @since 3.0 |
|
159 * @return ETrue: Sending is allowed. |
|
160 * EFalse: Sending is not allowed. |
|
161 */ |
|
162 TBool SendingAllowed() const; |
|
163 |
|
164 /** |
|
165 * Gets usage count. |
|
166 * @since 3.0 |
|
167 * @param aCount Counts left. |
|
168 * @return Error code: |
|
169 * KErrNone: Count returned. |
|
170 * KErrNotFound: Object doesn't have count based rights. |
|
171 * KErrNotReady: Usage rights info not loaded. |
|
172 */ |
|
173 TInt GetCount( TUint32& aCount ); |
|
174 |
|
175 /** |
|
176 * Gets start time of time based rights. |
|
177 * @since 3.0 |
|
178 * @param aStartTime Start time. |
|
179 * @return Error code: |
|
180 * KErrNone: Start time returned. |
|
181 * KErrNotFound: Object doesn't have time based rights. |
|
182 * KErrNotReady: Usage rights info not loaded. |
|
183 */ |
|
184 TInt GetStartTime( TTime& aStartTime ); |
|
185 |
|
186 /** |
|
187 * Gets end time of time based rights. |
|
188 * @since 3.0 |
|
189 * @param aEndTime End time. |
|
190 * @return Error code: |
|
191 * KErrNone: End time returned. |
|
192 * KErrNotFound: Object doesn't have time based rights. |
|
193 * KErrNotReady: Usage rights info not loaded. |
|
194 */ |
|
195 TInt GetEndTime( TTime& aEndTime ); |
|
196 |
|
197 /** |
|
198 * Gets interval time constraint. |
|
199 * @since 3.0 |
|
200 * @param aInterval Interval. |
|
201 * @return Error code: |
|
202 * KErrNone: Interval returned. |
|
203 * KErrNotFound: Object doesn't have interval constraint. |
|
204 * KErrNotReady: Usage rights info not loaded. |
|
205 */ |
|
206 TInt GetInterval( TTimeIntervalSeconds& aInterval ); |
|
207 |
|
208 /** |
|
209 * Gets start time of activated interval constraint. |
|
210 * @since 3.0 |
|
211 * @param aStartTime Start time. |
|
212 * @return Error code: |
|
213 * KErrNone: Start time returned. |
|
214 * KErrNotFound: Interval has not been started yet. |
|
215 * KErrNotReady: Usage rights info not loaded. |
|
216 */ |
|
217 TInt GetIntervalStart( TTime& aStartTime ); |
|
218 |
|
219 /** |
|
220 * Provides info about files DRM protection status. |
|
221 * @since 3.0 |
|
222 * @return ETrue: The file is DRM protected. |
|
223 * EFalse: The file is not DRM protected. |
|
224 */ |
|
225 TBool IsProtected() const; |
|
226 |
|
227 /** |
|
228 * Checks if given content can be set as an automated content. |
|
229 * @since 3.0 |
|
230 * @return Boolean. |
|
231 */ |
|
232 TBool CanSetAutomated() const; |
|
233 |
|
234 private: // Private contructors |
|
235 |
|
236 /** |
|
237 * C++ default constructor. |
|
238 */ |
|
239 CSVGTDrmHelper(); |
|
240 |
|
241 /** |
|
242 * By default Symbian 2nd phase constructor is private. |
|
243 */ |
|
244 void ConstructL(); |
|
245 |
|
246 private: // Data |
|
247 CDRMHelper* iDrmHelper; |
|
248 CDRMHelperRightsConstraints* iRightsConstraints; |
|
249 CCoeEnv* iEnv; |
|
250 |
|
251 TBool iProtected; |
|
252 TBool iExpired; |
|
253 TBool iSendingAllowed; |
|
254 TBool iCanSetAutomated; |
|
255 //flag to check for SD protection |
|
256 TInt iIsSeparateDelivery; |
|
257 }; |
|
258 |
|
259 #endif // SVGTDRMHELPER_H |
|
260 |
|
261 // End of File |