41 // CDrmUtilityGlobalNoteWrapper::CDrmUtilityGlobalNoteWrapper |
41 // CDrmUtilityGlobalNoteWrapper::CDrmUtilityGlobalNoteWrapper |
42 // C++ default constructor can NOT contain any code, that |
42 // C++ default constructor can NOT contain any code, that |
43 // might leave. |
43 // might leave. |
44 // ----------------------------------------------------------------------------- |
44 // ----------------------------------------------------------------------------- |
45 // |
45 // |
46 DRM::CDrmUtilityGlobalNoteWrapper::CDrmUtilityGlobalNoteWrapper() |
46 DRM::CDrmUtilityGlobalNoteWrapper::CDrmUtilityGlobalNoteWrapper() |
47 : CActive( EPriorityStandard ) |
47 : CActive( EPriorityStandard ) |
48 { |
48 { |
49 CActiveScheduler::Add( this ); |
49 CActiveScheduler::Add( this ); |
50 } |
50 } |
51 |
51 |
52 // ----------------------------------------------------------------------------- |
52 // ----------------------------------------------------------------------------- |
53 // CDrmUtilityGlobalNoteWrapper::ConstructL |
53 // CDrmUtilityGlobalNoteWrapper::ConstructL |
54 // Symbian 2nd phase constructor can leave. |
54 // Symbian 2nd phase constructor can leave. |
55 // ----------------------------------------------------------------------------- |
55 // ----------------------------------------------------------------------------- |
56 // |
56 // |
57 void DRM::CDrmUtilityGlobalNoteWrapper::ConstructL( |
57 void DRM::CDrmUtilityGlobalNoteWrapper::ConstructL( |
58 CStringResourceReader* aResourceReader ) |
58 CStringResourceReader* aResourceReader ) |
59 { |
59 { |
60 iResourceReader = aResourceReader; |
60 iResourceReader = aResourceReader; |
61 iButtonsId = R_AVKON_SOFTKEYS_YES_NO__YES; |
61 iButtonsId = R_AVKON_SOFTKEYS_YES_NO__YES; |
62 } |
62 } |
82 DRM::CDrmUtilityGlobalNoteWrapper* self( NewLC( aResourceReader ) ); |
82 DRM::CDrmUtilityGlobalNoteWrapper* self( NewLC( aResourceReader ) ); |
83 CleanupStack::Pop( self ); |
83 CleanupStack::Pop( self ); |
84 return self; |
84 return self; |
85 } |
85 } |
86 |
86 |
87 |
87 |
88 // Destructor |
88 // Destructor |
89 DRM::CDrmUtilityGlobalNoteWrapper::~CDrmUtilityGlobalNoteWrapper() |
89 DRM::CDrmUtilityGlobalNoteWrapper::~CDrmUtilityGlobalNoteWrapper() |
90 { |
90 { |
91 Cancel(); // Cancel active object |
91 Cancel(); // Cancel active object |
92 } |
92 } |
93 |
93 |
94 // ----------------------------------------------------------------------------- |
94 // ----------------------------------------------------------------------------- |
95 // CDrmUtilityGlobalNoteWrapper::ShowNoteL |
95 // CDrmUtilityGlobalNoteWrapper::ShowNoteL |
96 // ----------------------------------------------------------------------------- |
96 // ----------------------------------------------------------------------------- |
97 // |
97 // |
98 TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteWithButtonsL( |
98 TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteWithButtonsL( |
99 TInt aResourceId, |
99 TInt aResourceId, |
100 TInt aButtonsId ) |
100 TInt aButtonsId ) |
101 { |
101 { |
102 TInt ret( 0 ); |
102 TInt ret( 0 ); |
103 |
103 |
104 iTextBuffer = iResourceReader->ReadResourceString( aResourceId ); |
104 iTextBuffer = iResourceReader->ReadResourceString( aResourceId ); |
105 |
105 |
106 iButtonsId = aButtonsId; |
106 iButtonsId = aButtonsId; |
107 ret = DoShowNoteL( aResourceId ); |
107 ret = DoShowNoteL( aResourceId ); |
108 iButtonsId = R_AVKON_SOFTKEYS_YES_NO__YES; |
108 iButtonsId = R_AVKON_SOFTKEYS_YES_NO__YES; |
109 return ret; |
109 return ret; |
110 } |
110 } |
111 |
111 |
112 // ----------------------------------------------------------------------------- |
112 // ----------------------------------------------------------------------------- |
113 // CDrmUtilityGlobalNoteWrapper::ShowNoteWithButtonsL |
113 // CDrmUtilityGlobalNoteWrapper::ShowNoteWithButtonsL |
114 // ----------------------------------------------------------------------------- |
114 // ----------------------------------------------------------------------------- |
115 // |
115 // |
116 TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteWithButtonsL( |
116 TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteWithButtonsL( |
117 TInt aResourceId, |
117 TInt aResourceId, |
118 TInt aButtonsId, |
118 TInt aButtonsId, |
119 const TDesC& aString ) |
119 const TDesC& aString ) |
120 { |
120 { |
121 TInt ret( 0 ); |
121 TInt ret( 0 ); |
122 |
122 |
123 TBuf<DRM::KDRMNoteBufferMaxSize> srcBuffer( |
123 TBuf<DRM::KDRMNoteBufferMaxSize> srcBuffer( |
124 iResourceReader->ReadResourceString( aResourceId ) ); |
124 iResourceReader->ReadResourceString( aResourceId ) ); |
125 |
125 |
126 StringLoader::Format( iTextBuffer, srcBuffer, -1, aString ); |
126 StringLoader::Format( iTextBuffer, srcBuffer, -1, aString ); |
127 |
127 |
128 iButtonsId = aButtonsId; |
128 iButtonsId = aButtonsId; |
129 ret = DoShowNoteL( aResourceId, aString ); |
129 ret = DoShowNoteL( aResourceId, aString ); |
130 iButtonsId = R_AVKON_SOFTKEYS_YES_NO__YES; |
130 iButtonsId = R_AVKON_SOFTKEYS_YES_NO__YES; |
131 return ret; |
131 return ret; |
132 } |
132 } |
133 |
133 |
134 // ----------------------------------------------------------------------------- |
134 // ----------------------------------------------------------------------------- |
135 // CDrmUtilityGlobalNoteWrapper::ShowNoteL |
135 // CDrmUtilityGlobalNoteWrapper::ShowNoteL |
136 // ----------------------------------------------------------------------------- |
136 // ----------------------------------------------------------------------------- |
137 // |
137 // |
138 TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL( |
138 TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL( |
139 TInt aResourceId, |
139 TInt aResourceId, |
140 TInt aValue ) |
140 TInt aValue ) |
141 { |
141 { |
142 TBuf<DRM::KDRMNoteBufferMaxSize> srcBuffer( |
142 TBuf<DRM::KDRMNoteBufferMaxSize> srcBuffer( |
143 iResourceReader->ReadResourceString( aResourceId ) ); |
143 iResourceReader->ReadResourceString( aResourceId ) ); |
144 |
144 |
145 StringLoader::Format( iTextBuffer, srcBuffer, -1, aValue ); |
145 StringLoader::Format( iTextBuffer, srcBuffer, -1, aValue ); |
146 return DoShowNoteL( aResourceId, KNullDesC, aValue ); |
146 return DoShowNoteL( aResourceId, KNullDesC, aValue ); |
147 } |
147 } |
148 |
148 |
149 // ----------------------------------------------------------------------------- |
149 // ----------------------------------------------------------------------------- |
150 // CDrmUtilityGlobalNoteWrapper::ShowNoteL |
150 // CDrmUtilityGlobalNoteWrapper::ShowNoteL |
151 // ----------------------------------------------------------------------------- |
151 // ----------------------------------------------------------------------------- |
152 // |
152 // |
153 TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL( |
153 TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL( |
154 TInt aResourceId, |
154 TInt aResourceId, |
155 const TDesC& aString ) |
155 const TDesC& aString ) |
156 { |
156 { |
157 TBuf<DRM::KDRMNoteBufferMaxSize> srcBuffer( |
157 TBuf<DRM::KDRMNoteBufferMaxSize> srcBuffer( |
158 iResourceReader->ReadResourceString( aResourceId ) ); |
158 iResourceReader->ReadResourceString( aResourceId ) ); |
159 |
159 |
160 StringLoader::Format( iTextBuffer, srcBuffer, -1, aString ); |
160 StringLoader::Format( iTextBuffer, srcBuffer, -1, aString ); |
161 return DoShowNoteL( aResourceId, aString ); |
161 return DoShowNoteL( aResourceId, aString ); |
162 } |
162 } |
163 |
163 |
164 // ----------------------------------------------------------------------------- |
164 // ----------------------------------------------------------------------------- |
165 // CDrmUtilityGlobalNoteWrapper::ShowNoteL |
165 // CDrmUtilityGlobalNoteWrapper::ShowNoteL |
166 // ----------------------------------------------------------------------------- |
166 // ----------------------------------------------------------------------------- |
167 // |
167 // |
168 TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL( |
168 TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowNoteL( |
169 TInt aResourceId, |
169 TInt aResourceId, |
170 const TDesC& aString, |
170 const TDesC& aString, |
171 TInt aValue, |
171 TInt aValue, |
172 TInt aStringPos, |
172 TInt aStringPos, |
173 TInt aValuePos) |
173 TInt aValuePos) |
174 { |
174 { |
175 TBuf<DRM::KDRMNoteBufferMaxSize> srcBuffer( |
175 TBuf<DRM::KDRMNoteBufferMaxSize> srcBuffer( |
176 iResourceReader->ReadResourceString( aResourceId ) ); |
176 iResourceReader->ReadResourceString( aResourceId ) ); |
177 |
177 |
178 StringLoader::Format( iTextBuffer, srcBuffer, aValuePos, aValue ); |
178 StringLoader::Format( iTextBuffer, srcBuffer, aValuePos, aValue ); |
179 srcBuffer = iTextBuffer; |
179 srcBuffer = iTextBuffer; |
180 StringLoader::Format( iTextBuffer, srcBuffer, aStringPos, aString ); |
180 StringLoader::Format( iTextBuffer, srcBuffer, aStringPos, aString ); |
181 return DoShowNoteL( aResourceId, aString, aValue ); |
181 return DoShowNoteL( aResourceId, aString, aValue ); |
182 } |
182 } |
185 // CDrmUtilityGlobalNoteWrapper::ShowPreviewListQueryL |
185 // CDrmUtilityGlobalNoteWrapper::ShowPreviewListQueryL |
186 // ----------------------------------------------------------------------------- |
186 // ----------------------------------------------------------------------------- |
187 // |
187 // |
188 #ifdef RD_DRM_PREVIEW_RIGHT_FOR_AUDIO |
188 #ifdef RD_DRM_PREVIEW_RIGHT_FOR_AUDIO |
189 |
189 |
190 TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowPreviewListQueryL( |
190 TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowPreviewListQueryL( |
191 TInt aResourceId ) |
191 TInt aResourceId ) |
192 { |
192 { |
193 TInt index( 0 ); |
193 TInt index( 0 ); |
194 CAknGlobalListQuery* listQuery( CAknGlobalListQuery::NewLC() ); |
194 CAknGlobalListQuery* listQuery( CAknGlobalListQuery::NewLC() ); |
195 HBufC* buffer( HBufC::NewLC( DRM::KDRMNoteBufferMaxSize ) ); |
195 HBufC* buffer( HBufC::NewLC( DRM::KDRMNoteBufferMaxSize ) ); |
196 TPtr bufPtr( buffer->Des() ); |
196 TPtr bufPtr( buffer->Des() ); |
197 |
197 |
198 bufPtr = iResourceReader->ReadResourceString( R_DRMUTILITY_ACTIVATE_PREVIEW ); |
198 bufPtr = iResourceReader->ReadResourceString( R_DRMUTILITY_ACTIVATE_PREVIEW ); |
199 listQuery->SetHeadingL( bufPtr ); |
199 listQuery->SetHeadingL( bufPtr ); |
200 |
200 |
201 CDesCArray* listArray( new( ELeave ) CDesCArrayFlat( 2 ) ); |
201 CDesCArray* listArray( new( ELeave ) CDesCArrayFlat( 2 ) ); |
202 CleanupStack::PushL( listArray ); |
202 CleanupStack::PushL( listArray ); |
203 |
203 |
204 bufPtr = iResourceReader->ReadResourceString( R_DRMUTILITY_ACTIVATE ); |
204 bufPtr = iResourceReader->ReadResourceString( R_DRMUTILITY_ACTIVATE ); |
205 listArray->AppendL( bufPtr ); |
205 listArray->AppendL( bufPtr ); |
206 |
206 |
207 switch( aResourceId ) |
207 switch( aResourceId ) |
208 { |
208 { |
209 case R_DRMUTILITY_PREV_AUDIO_GET_LIST_QUERY: |
209 case R_DRMUTILITY_PREV_AUDIO_GET_LIST_QUERY: |
210 |
210 |
211 bufPtr = iResourceReader->ReadResourceString( |
211 bufPtr = iResourceReader->ReadResourceString( |
212 R_DRMUTILITY_GET_PREVIEW ); |
212 R_DRMUTILITY_GET_PREVIEW ); |
213 |
213 |
214 |
214 |
215 break; |
215 break; |
216 |
216 |
217 case R_DRMUTILITY_PREV_VIDEO_GET_LIST_QUERY: |
217 case R_DRMUTILITY_PREV_VIDEO_GET_LIST_QUERY: |
218 |
218 |
219 bufPtr = iResourceReader->ReadResourceString( |
219 bufPtr = iResourceReader->ReadResourceString( |
220 R_DRMUTILITY_GET_PREVIEW_VIDEO ); |
220 R_DRMUTILITY_GET_PREVIEW_VIDEO ); |
221 |
221 |
222 break; |
222 break; |
223 |
223 |
224 case R_DRMUTILITY_PREV_AUDIO_PLAY_LIST_QUERY: |
224 case R_DRMUTILITY_PREV_AUDIO_PLAY_LIST_QUERY: |
225 |
225 |
226 bufPtr = iResourceReader->ReadResourceString( |
226 bufPtr = iResourceReader->ReadResourceString( |
227 R_DRMUTILITY_PLAY_PREVIEW ); |
227 R_DRMUTILITY_PLAY_PREVIEW ); |
228 |
228 |
229 break; |
229 break; |
230 |
230 |
231 case R_DRMUTILITY_PREV_VIDEO_PLAY_LIST_QUERY: |
231 case R_DRMUTILITY_PREV_VIDEO_PLAY_LIST_QUERY: |
232 |
232 |
233 bufPtr = iResourceReader->ReadResourceString( |
233 bufPtr = iResourceReader->ReadResourceString( |
234 R_DRMUTILITY_PLAY_PREVIEW_VIDEO ); |
234 R_DRMUTILITY_PLAY_PREVIEW_VIDEO ); |
235 |
235 |
236 break; |
236 break; |
237 |
237 |
238 default: |
238 default: |
239 |
239 |
240 return 0; |
240 return 0; |
241 |
241 |
242 } |
242 } |
243 |
243 |
244 listArray->AppendL( bufPtr ); |
244 listArray->AppendL( bufPtr ); |
245 |
245 |
246 if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) && |
246 if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) && |
247 DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( aResourceId ) ) |
247 DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( aResourceId ) ) |
248 { |
248 { |
249 RProcess myProcess; |
249 RProcess myProcess; |
250 TUid myProcessUid( KNullUid ); |
250 TUid myProcessUid( KNullUid ); |
251 RThread().Process( myProcess ); |
251 RThread().Process( myProcess ); |
252 myProcessUid = myProcess.Identity(); |
252 myProcessUid = myProcess.Identity(); |
253 |
253 |
254 TUtilitySDData utilityData; |
254 TUtilitySDData utilityData; |
255 // First field is DrmUtility's Uid |
255 // First field is DrmUtility's Uid |
256 utilityData.iUtilityUid = KUidCoverUiCategoryDrmUtility; |
256 utilityData.iUtilityUid = KUidCoverUiCategoryDrmUtility; |
257 // ProcessId which uses DrmUtility |
257 // ProcessId which uses DrmUtility |
258 utilityData.iHandlerProcessId = myProcessUid; |
258 utilityData.iHandlerProcessId = myProcessUid; |
259 TUtilitySDDataPckg pckg( utilityData ); |
259 TUtilitySDDataPckg pckg( utilityData ); |
260 CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility, |
260 CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility, |
261 aResourceId, |
261 aResourceId, |
262 pckg ) ); |
262 pckg ) ); |
263 |
263 |
264 // ownership to notifier client |
264 // ownership to notifier client |
265 listQuery->SetSecondaryDisplayData( sd ); |
265 listQuery->SetSecondaryDisplayData( sd ); |
266 } |
266 } |
267 |
267 |
268 iStatus = KRequestPending; |
268 iStatus = KRequestPending; |
269 listQuery->ShowListQueryL( listArray, iStatus ); |
269 listQuery->ShowListQueryL( listArray, iStatus ); |
270 SetActive(); |
270 SetActive(); |
271 iWait.Start(); |
271 iWait.Start(); |
272 |
272 |
273 CleanupStack::PopAndDestroy( 3, listQuery ); //listArray, buffer, listQuery |
273 CleanupStack::PopAndDestroy( 3, listQuery ); //listArray, buffer, listQuery |
274 |
274 |
275 if ( iStatus.Int() != EAknSoftkeyNo ) |
275 if ( iStatus.Int() != EAknSoftkeyNo ) |
276 { |
276 { |
277 index = iStatus.Int() + 1; |
277 index = iStatus.Int() + 1; |
278 } |
278 } |
279 |
279 |
280 return index; |
280 return index; |
281 } |
281 } |
282 |
282 |
283 #else |
283 #else |
284 |
284 |
285 TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowPreviewListQueryL( |
285 TInt DRM::CDrmUtilityGlobalNoteWrapper::ShowPreviewListQueryL( |
286 TInt /*aResourceId*/ ) |
286 TInt /*aResourceId*/ ) |
287 { |
287 { |
288 return 0; |
288 return 0; |
289 } |
289 } |
290 |
290 |
309 |
309 |
310 // ----------------------------------------------------------------------------- |
310 // ----------------------------------------------------------------------------- |
311 // CDrmUtilityGlobalNoteWrapper::DoShowNoteL |
311 // CDrmUtilityGlobalNoteWrapper::DoShowNoteL |
312 // ----------------------------------------------------------------------------- |
312 // ----------------------------------------------------------------------------- |
313 // |
313 // |
314 TInt DRM::CDrmUtilityGlobalNoteWrapper::DoShowNoteL( |
314 TInt DRM::CDrmUtilityGlobalNoteWrapper::DoShowNoteL( |
315 TInt aResourceId, |
315 TInt aResourceId, |
316 const TDesC& aString, |
316 const TDesC& aString, |
317 TInt aValue ) |
317 TInt aValue ) |
318 { |
318 { |
319 TPtr bufPtr( NULL, 0 ); |
319 TPtr bufPtr( NULL, 0 ); |
320 TInt animation( iButtonsId == R_AVKON_SOFTKEYS_YES_NO__YES ? |
320 TInt animation( iButtonsId == R_AVKON_SOFTKEYS_YES_NO__YES ? |
321 0 : R_QGN_NOTE_INFO_ANIM ); |
321 0 : R_QGN_NOTE_INFO_ANIM ); |
322 |
322 |
323 CAknGlobalConfirmationQuery* globalNote( |
323 CAknGlobalConfirmationQuery* globalNote( |
324 CAknGlobalConfirmationQuery::NewLC() ); |
324 CAknGlobalConfirmationQuery::NewLC() ); |
325 |
325 |
326 bufPtr.Set( const_cast <TUint16*>( iTextBuffer.Ptr() ), |
326 bufPtr.Set( const_cast <TUint16*>( iTextBuffer.Ptr() ), |
327 iTextBuffer.Length(), |
327 iTextBuffer.Length(), |
328 iTextBuffer.Length() ); |
328 iTextBuffer.Length() ); |
329 |
329 |
330 AknTextUtils::LanguageSpecificNumberConversion( bufPtr ); |
330 AknTextUtils::LanguageSpecificNumberConversion( bufPtr ); |
331 |
331 |
332 |
332 |
333 if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) && |
333 if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) && |
334 DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( aResourceId ) ) |
334 DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( aResourceId ) ) |
335 { |
335 { |
336 RProcess myProcess; |
336 RProcess myProcess; |
337 TUid myProcessUid( KNullUid ); |
337 TUid myProcessUid( KNullUid ); |
338 RThread().Process( myProcess ); |
338 RThread().Process( myProcess ); |
339 myProcessUid = myProcess.Identity(); |
339 myProcessUid = myProcess.Identity(); |
340 |
340 |
341 TUtilitySDData utilityData; |
341 TUtilitySDData utilityData; |
342 // First field is DrmUtility's Uid |
342 // First field is DrmUtility's Uid |
343 utilityData.iUtilityUid = KUidCoverUiCategoryDrmUtility; |
343 utilityData.iUtilityUid = KUidCoverUiCategoryDrmUtility; |
344 // ProcessId which uses DrmUtility |
344 // ProcessId which uses DrmUtility |
345 utilityData.iHandlerProcessId = myProcessUid; |
345 utilityData.iHandlerProcessId = myProcessUid; |
346 if ( aString.Compare( KNullDesC ) ) |
346 if ( aString.Compare( KNullDesC ) ) |
347 { |
347 { |
348 // If there is filename given, it's always in the PrimaryString |
348 // If there is filename given, it's always in the PrimaryString |
349 utilityData.iStringParam.Append( aString ); |
349 utilityData.iStringParam.Append( aString ); |
350 } |
350 } |