|
1 /* |
|
2 * Copyright (c) 2006-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 "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 * CUniDrmInfo, Storage for single attachment in presentation. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef __UNIDRMINFO_H |
|
23 #define __UNIDRMINFO_H |
|
24 |
|
25 // INCLUDES |
|
26 |
|
27 #include <e32std.h> |
|
28 #include <cmsvattachment.h> |
|
29 |
|
30 #include <caf/caf.h> |
|
31 #include <DRMHelper.h> |
|
32 #include <DRMRights.h> |
|
33 |
|
34 #include <uniobject.h> |
|
35 |
|
36 // CONSTANTS |
|
37 |
|
38 // MACROS |
|
39 |
|
40 // FORWARD DECLARATIONS |
|
41 class CBaseMtm; |
|
42 class CMsgMediaInfo; |
|
43 class CDRMHelper; |
|
44 #ifndef DRMCOMMONIN_POISTO |
|
45 class DRMCommon; |
|
46 #endif |
|
47 |
|
48 // DATA TYPES |
|
49 |
|
50 // FUNCTION PROTOTYPES |
|
51 |
|
52 // CLASS DECLARATION |
|
53 |
|
54 /** |
|
55 * CUniDrmInfo - DRM information of an attachment. |
|
56 * |
|
57 * @lib UniDataModel.lib |
|
58 * @since 3.1 |
|
59 */ |
|
60 class CUniDrmInfo : public CBase |
|
61 { |
|
62 |
|
63 public: // New methods |
|
64 |
|
65 /** |
|
66 * Factory method that creates this object |
|
67 * from an attachment. |
|
68 * |
|
69 * @since 3.1 |
|
70 * @return Pointer to instance in cleanup stack |
|
71 */ |
|
72 IMPORT_C static CUniDrmInfo* NewLC( |
|
73 RFs& aFs, |
|
74 CBaseMtm& aMtm, |
|
75 TMsvAttachmentId& aId, |
|
76 CMsgMediaInfo& aMediaInfo ); |
|
77 |
|
78 /** |
|
79 * Factory method that creates this object |
|
80 * from an attachment. |
|
81 * |
|
82 * @since 3.1 |
|
83 * @return Pointer to instance |
|
84 */ |
|
85 IMPORT_C static CUniDrmInfo* NewL( |
|
86 RFs& aFs, |
|
87 CBaseMtm& aMtm, |
|
88 TMsvAttachmentId& aId, |
|
89 CMsgMediaInfo& aMediaInfo ); |
|
90 |
|
91 /** |
|
92 * Destructor |
|
93 * |
|
94 * @since 3.1 |
|
95 */ |
|
96 virtual ~CUniDrmInfo(); |
|
97 |
|
98 /** |
|
99 * Freezes and locks the DRM rights of the object if available. |
|
100 * -> No counts will be reduced |
|
101 * @return Error code from CDRMHelper::Consume2(). Some controls |
|
102 * may ignore the value but some don't |
|
103 * @since 3.1 |
|
104 */ |
|
105 IMPORT_C TInt FreezeRights(); |
|
106 |
|
107 /** |
|
108 * Consumes and locks the DRM rights of the object if available. |
|
109 * -> One count will be reduced |
|
110 * @return Error code from CDRMHelper::Consume2(). Some controls |
|
111 * may ignore the value but some don't |
|
112 * @since 3.1 |
|
113 */ |
|
114 IMPORT_C TInt ConsumeRights(); |
|
115 |
|
116 /** |
|
117 * Evaluates DRM rights of the object if available. |
|
118 * Use count is not changed. |
|
119 * @param aConsumed |
|
120 * return information whether DRM rights have already been consumed |
|
121 * @since 3.1 |
|
122 */ |
|
123 IMPORT_C TInt EvaluateRights( TBool& aConsumed ); |
|
124 |
|
125 /** |
|
126 * Releases the DRM rights of the object. |
|
127 * @return Error code from CDRMHelper::Consume2().Some controls |
|
128 * may ignore the value but some don't |
|
129 * @since 3.1 |
|
130 */ |
|
131 IMPORT_C TInt ReleaseRights(); |
|
132 |
|
133 /** |
|
134 * Convenience function to check whether DRM rights for |
|
135 * the object are valid. |
|
136 * @since 3.1 |
|
137 * @param aUpdate IN if ETrue, updates rights info, |
|
138 * otherwise returns rights as they were |
|
139 * when the object was constructed. |
|
140 */ |
|
141 IMPORT_C TBool RightsValidL( TBool aUpdate ); |
|
142 |
|
143 /** |
|
144 * Check whether this is combined delivery cobject with one |
|
145 * play count left. This information is needed to show note |
|
146 * "Message contains an object that can only be viewed once" |
|
147 * §qtn.drm.preview.msg§ |
|
148 * @return ETrue |
|
149 * EFalse |
|
150 */ |
|
151 IMPORT_C TBool IsDrmWithOnePreview(); |
|
152 |
|
153 /** |
|
154 * Handles DRM error ( taken place in an UI control). |
|
155 */ |
|
156 IMPORT_C void HandleDrmErrorL( TInt aError ); |
|
157 |
|
158 protected: |
|
159 |
|
160 enum TUniDRMConsumeStatus |
|
161 { |
|
162 EUniDRMNone, |
|
163 EUniDRMFrozen, |
|
164 EUniDRMConsumed |
|
165 }; |
|
166 |
|
167 /** |
|
168 * Constructor. |
|
169 * |
|
170 * @since 3.1 |
|
171 */ |
|
172 CUniDrmInfo( |
|
173 RFs& aFs, |
|
174 CBaseMtm& aMtm, |
|
175 TMsvAttachmentId& aId, |
|
176 CMsgMediaInfo& aMediaInfo ); |
|
177 |
|
178 /** |
|
179 * 2nd phase constructor. |
|
180 * |
|
181 * @since 3.1 |
|
182 */ |
|
183 void ConstructL(); |
|
184 |
|
185 /** |
|
186 * Gets rights info from a media object. |
|
187 * @param aRightsObj optionally returns CDRMRights of the object, if |
|
188 * Ownership is transferred to caller. |
|
189 * @since 3.1 |
|
190 */ |
|
191 void DoGetRightsInfoL(CDRMRights** aRightsObj = NULL); |
|
192 |
|
193 inline ContentAccess::TIntent ConsumeIntent(); |
|
194 |
|
195 /** |
|
196 * Check whether this is combined delivery cobject with one |
|
197 * play count left. This information is needed to show note |
|
198 * "Message contains an object that can only be viewed once" |
|
199 * §qtn.drm.preview.msg§. Value is saved iDrmOnePreview. |
|
200 */ |
|
201 void SetIsDrmWithOnePreviewL(); |
|
202 |
|
203 /** |
|
204 * Creates internal CData object. It cannot be created during construction. |
|
205 * @return If this object is not DRM protected returns NULL. |
|
206 */ |
|
207 CData* CreateCDataL(); |
|
208 |
|
209 protected: // data |
|
210 |
|
211 RFs& iFs; |
|
212 TInt iSupportedFeatures; |
|
213 |
|
214 CBaseMtm& iMtm; |
|
215 TMsvAttachmentId& iAttachmentId; |
|
216 CMsgMediaInfo& iMediaInfo; |
|
217 |
|
218 #ifdef DRMCOMMONIN_POISTO |
|
219 ContentAccess::CRightsManager* iRightsManager; |
|
220 #else |
|
221 DRMCommon* iDRMCommon; |
|
222 #endif |
|
223 |
|
224 CDRMHelper* iDRMHelper; |
|
225 TUniDRMConsumeStatus iDRMConsumeStatus; |
|
226 TInt iDRMConsumeCount; |
|
227 TBool iDRMRightsExist; |
|
228 CDRMRights::TExpiration iDRMExpiration; |
|
229 CDRMRights::TRestriction iDRMRestriction; |
|
230 TUint32 iDRMConstraintType; |
|
231 |
|
232 // DRm2 follows: |
|
233 TBool iOma2; |
|
234 // Indicates preview type |
|
235 CDRMHelper::TDRMHelperPreviewType iPreviewType; |
|
236 // content URI (unique id) of the embedded preview content |
|
237 TBool iHasInfoUri; |
|
238 HBufC* iSendContentUrl; |
|
239 TBool iCDataResolved; |
|
240 TPtrC8 iUsedContentUri; |
|
241 TBool iDrmOnePreview; |
|
242 }; |
|
243 |
|
244 #include <unidrminfo.inl> |
|
245 |
|
246 #endif // __UNIDRMINFO_H |