17 |
17 |
18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 |
20 |
21 #include <txtrich.h>//CRichText |
21 #include <txtrich.h>//CRichText |
22 #include <eikrted.h> // CEikRichTextEditor |
22 #include <eikrted.h> // CEikRichTextEditor |
23 #include <eikenv.h>//CEikonEnv |
23 #include <eikenv.h>//CEikonEnv |
24 |
24 |
25 #include <AiwGenericParam.h> |
25 #include <AiwGenericParam.h> |
26 #include <AknLaunchAppService.h> |
26 #include <AknLaunchAppService.h> |
27 |
27 |
28 #include <eikon.rsg> |
28 #include <eikon.rsg> |
29 // Messaging includes |
29 // Messaging includes |
30 #include <MSVUIDS.H> |
30 #include <msvuids.h> |
31 #include <msvids.h> |
31 #include <msvids.h> |
32 |
32 |
33 #ifdef RD_MULTIPLE_DRIVE |
33 #ifdef RD_MULTIPLE_DRIVE |
34 #include <DriveInfo.h> |
34 #include <driveinfo.h> |
35 #endif |
35 #endif |
36 |
36 |
37 #include <eikproc.h> |
37 #include <eikproc.h> |
38 #include <eikdoc.h> |
38 #include <eikdoc.h> |
39 #include <akndialog.h> |
39 #include <AknDialog.h> |
40 #include "RoMtmUi.h" |
40 #include "RoMtmUi.h" |
41 #include "RoMtmUiC.h" |
41 #include "RoMTMUiC.h" |
42 |
42 |
43 |
43 |
44 #include <DocumentHandler.h> // document handler |
44 #include <DocumentHandler.h> // document handler |
45 #include <apaid.h> //TApaAppInfo |
45 #include <apaid.h> //TApaAppInfo |
46 #include <apgcli.h> //RApaLsSession |
46 #include <apgcli.h> //RApaLsSession |
47 #include <RoapEng.h> // CRoapEng |
47 #include <RoapEng.h> // CRoapEng |
48 #include <data_caging_path_literals.hrh> // KDC_RESOURCE_FILES_DIR |
48 #include <data_caging_path_literals.hrh> // KDC_RESOURCE_FILES_DIR |
49 #include <AknQueryDialog.h> // CAknQueryDialog |
49 #include <AknQueryDialog.h> // CAknQueryDialog |
50 #include <StringLoader.h> //StringLoader |
50 #include <StringLoader.h> //StringLoader |
51 #include <coneresloader.h> //rconeresloader |
51 #include <ConeResLoader.h> //rconeresloader |
52 #include <RoMtmUi.rsg> // test |
52 #include <RoMtmUi.rsg> // test |
53 // EXTERNAL DATA STRUCTURES |
53 // EXTERNAL DATA STRUCTURES |
54 // EXTERNAL FUNCTION PROTOTYPES |
54 // EXTERNAL FUNCTION PROTOTYPES |
55 // CONSTANTS |
55 // CONSTANTS |
56 _LIT(KRoAcquisitionPrefix, "ROA:"); |
56 _LIT(KRoAcquisitionPrefix, "ROA:"); |
57 _LIT(KTriggerPrefix, "TRI:"); |
57 _LIT(KTriggerPrefix, "TRI:"); |
58 |
58 |
59 #ifndef RD_MULTIPLE_DRIVE |
59 #ifndef RD_MULTIPLE_DRIVE |
60 _LIT( KDriveZ, "z:" ); |
60 _LIT( KDriveZ, "z:" ); |
61 #endif |
61 #endif |
62 |
62 |
63 _LIT( KRoMtmUiResFileName,"RoMtmUi.rsc" ); |
63 _LIT( KRoMtmUiResFileName,"RoMtmUi.rsc" ); |
64 // MACROS |
64 // MACROS |
65 // LOCAL CONSTANTS AND MACROS |
65 // LOCAL CONSTANTS AND MACROS |
66 // MODULE DATA STRUCTURES |
66 // MODULE DATA STRUCTURES |
67 // LOCAL FUNCTION PROTOTYPES |
67 // LOCAL FUNCTION PROTOTYPES |
198 CleanupStack::PopAndDestroy(); //fs |
198 CleanupStack::PopAndDestroy(); //fs |
199 } |
199 } |
200 #endif |
200 #endif |
201 /************************************* |
201 /************************************* |
202 * |
202 * |
203 * Global function declarations |
203 * Global function declarations |
204 * |
204 * |
205 **************************************/ |
205 **************************************/ |
206 |
206 |
207 EXPORT_C CBaseMtmUi* NewMtmUiL( CBaseMtm& aMtm , CRegisteredMtmDll& aRegisteredDll ) |
207 EXPORT_C CBaseMtmUi* NewMtmUiL( CBaseMtm& aMtm , CRegisteredMtmDll& aRegisteredDll ) |
208 // Factory function |
208 // Factory function |
209 { |
209 { |
210 return CRightsObjectMtmUi::NewL( aMtm , aRegisteredDll ); |
210 return CRightsObjectMtmUi::NewL( aMtm , aRegisteredDll ); |
211 } |
211 } |
212 // |
212 // |
213 // CRightsObjectMtmUi: User Interface MTM |
213 // CRightsObjectMtmUi: User Interface MTM |
214 // |
214 // |
215 |
215 |
216 // ============================ MEMBER FUNCTIONS =============================== |
216 // ============================ MEMBER FUNCTIONS =============================== |
217 |
217 |
218 /************************************* |
218 /************************************* |
219 * |
219 * |
220 * Construction and destruction |
220 * Construction and destruction |
221 * |
221 * |
222 **************************************/ |
222 **************************************/ |
223 |
223 |
224 // ----------------------------------------------------------------------------- |
224 // ----------------------------------------------------------------------------- |
225 // CRightsObjectMtmUi::CRightsObjectMtmUi |
225 // CRightsObjectMtmUi::CRightsObjectMtmUi |
226 // C++ default constructor can NOT contain any code, that |
226 // C++ default constructor can NOT contain any code, that |
227 // might leave. |
227 // might leave. |
228 // ----------------------------------------------------------------------------- |
228 // ----------------------------------------------------------------------------- |
229 // |
229 // |
230 CRightsObjectMtmUi::CRightsObjectMtmUi( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll ) |
230 CRightsObjectMtmUi::CRightsObjectMtmUi( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll ) |
231 : CBaseMtmUi( aBaseMtm , aRegisteredMtmDll ) |
231 : CBaseMtmUi( aBaseMtm , aRegisteredMtmDll ) |
232 { |
232 { |
233 iOpenService = NULL; |
233 iOpenService = NULL; |
234 iDocHandler = NULL; |
234 iDocHandler = NULL; |
235 iHostProcess = NULL; |
235 iHostProcess = NULL; |
236 iType = ERo; |
236 iType = ERo; |
237 } |
237 } |
238 |
238 |
239 // ----------------------------------------------------------------------------- |
239 // ----------------------------------------------------------------------------- |
240 // CRightsObjectMtmUi::ConstructL |
240 // CRightsObjectMtmUi::ConstructL |
241 // Symbian 2nd phase constructor can leave. |
241 // Symbian 2nd phase constructor can leave. |
242 // ----------------------------------------------------------------------------- |
242 // ----------------------------------------------------------------------------- |
243 // |
243 // |
244 void CRightsObjectMtmUi::ConstructL() |
244 void CRightsObjectMtmUi::ConstructL() |
245 { |
245 { |
246 #ifdef _DRM_TESTING |
246 #ifdef _DRM_TESTING |
247 CreateLogL(); |
247 CreateLogL(); |
248 WriteL(_L8("ConstructL")); |
248 WriteL(_L8("ConstructL")); |
249 #endif |
249 #endif |
250 CBaseMtmUi::ConstructL(); |
250 CBaseMtmUi::ConstructL(); |
251 User::LeaveIfError(iFs.Connect()); |
251 User::LeaveIfError(iFs.Connect()); |
252 } |
252 } |
253 |
253 |
254 // ----------------------------------------------------------------------------- |
254 // ----------------------------------------------------------------------------- |
255 // CRightsObjectMtmUi::NewL |
255 // CRightsObjectMtmUi::NewL |
256 // Two-phased constructor. |
256 // Two-phased constructor. |
257 // ----------------------------------------------------------------------------- |
257 // ----------------------------------------------------------------------------- |
258 // |
258 // |
259 CRightsObjectMtmUi* CRightsObjectMtmUi::NewL( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll ) |
259 CRightsObjectMtmUi* CRightsObjectMtmUi::NewL( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll ) |
260 { |
260 { |
261 CRightsObjectMtmUi* self=new ( ELeave ) CRightsObjectMtmUi( aBaseMtm , aRegisteredMtmDll ); |
261 CRightsObjectMtmUi* self=new ( ELeave ) CRightsObjectMtmUi( aBaseMtm , aRegisteredMtmDll ); |
262 CleanupStack::PushL( self ); |
262 CleanupStack::PushL( self ); |
263 self->ConstructL(); |
263 self->ConstructL(); |
264 CleanupStack::Pop(); |
264 CleanupStack::Pop(); |
265 return self; |
265 return self; |
266 } |
266 } |
267 |
267 |
268 // Destructor |
268 // Destructor |
269 CRightsObjectMtmUi::~CRightsObjectMtmUi() |
269 CRightsObjectMtmUi::~CRightsObjectMtmUi() |
270 { |
270 { |
271 #ifdef _DRM_TESTING |
271 #ifdef _DRM_TESTING |
272 TRAP(err,WriteL(_L8("~CRightsObjectMtmUi"))); |
272 TRAP(err,WriteL(_L8("~CRightsObjectMtmUi"))); |
273 #endif |
273 #endif |
274 iFs.Close(); |
274 iFs.Close(); |
275 |
275 |
276 delete iOpenService; |
276 delete iOpenService; |
277 delete iDocHandler; |
277 delete iDocHandler; |
278 } |
278 } |
279 |
279 |
280 |
280 |
281 |
281 |
282 |
282 |
283 /************************************* |
283 /************************************* |
284 * |
284 * |
285 * from CBaseMtm |
285 * from CBaseMtm |
286 * |
286 * |
287 **************************************/ |
287 **************************************/ |
288 |
288 |
289 // ----------------------------------------------------------------------------- |
289 // ----------------------------------------------------------------------------- |
290 // CRightsObjectMtmUi::CancelL |
290 // CRightsObjectMtmUi::CancelL |
292 // Not supported |
292 // Not supported |
293 // |
293 // |
294 // ----------------------------------------------------------------------------- |
294 // ----------------------------------------------------------------------------- |
295 // |
295 // |
296 CMsvOperation* CRightsObjectMtmUi::CancelL( TRequestStatus& /*aStatus*/ , const CMsvEntrySelection& /*aSelection*/ ) |
296 CMsvOperation* CRightsObjectMtmUi::CancelL( TRequestStatus& /*aStatus*/ , const CMsvEntrySelection& /*aSelection*/ ) |
297 { |
297 { |
298 #ifdef _DRM_TESTING |
298 #ifdef _DRM_TESTING |
299 WriteL(_L8("CancelL")); |
299 WriteL(_L8("CancelL")); |
300 #endif |
300 #endif |
301 |
301 |
302 User::Leave( KErrNotSupported ); // no cancelling |
302 User::Leave( KErrNotSupported ); // no cancelling |
303 return NULL; |
303 return NULL; |
304 } |
304 } |
305 |
305 |
306 // ----------------------------------------------------------------------------- |
306 // ----------------------------------------------------------------------------- |
307 // CRightsObjectMtmUi::GetResourceFileName |
307 // CRightsObjectMtmUi::GetResourceFileName |
308 // |
308 // |
309 // Implementations provide this function to set the full path |
309 // Implementations provide this function to set the full path |
310 // and name of the resource file associated with the User Interface MTM. |
310 // and name of the resource file associated with the User Interface MTM. |
311 // |
311 // |
312 // ----------------------------------------------------------------------------- |
312 // ----------------------------------------------------------------------------- |
313 // |
313 // |
314 void CRightsObjectMtmUi::GetResourceFileName( TFileName& aFileName ) const |
314 void CRightsObjectMtmUi::GetResourceFileName( TFileName& aFileName ) const |
315 // Resource file loading |
315 // Resource file loading |
316 { |
316 { |
317 #ifdef _DRM_TESTING |
317 #ifdef _DRM_TESTING |
318 TRAPD(err,WriteL(_L8("GetResourceFileName"))); |
318 TRAPD(err,WriteL(_L8("GetResourceFileName"))); |
319 #endif |
319 #endif |
320 aFileName = KRoMtmResourceFile; |
320 aFileName = KRoMtmResourceFile; |
321 } |
321 } |
322 |
322 |
323 // |
323 // |
324 // Entry manipulation |
324 // Entry manipulation |
325 // |
325 // |
326 |
326 |
327 // ----------------------------------------------------------------------------- |
327 // ----------------------------------------------------------------------------- |
328 // CRightsObjectMtmUi::OpenL |
328 // CRightsObjectMtmUi::OpenL |
329 // |
329 // |
330 // Opens an entry. |
330 // Opens an entry. |
331 // |
331 // |
332 // ----------------------------------------------------------------------------- |
332 // ----------------------------------------------------------------------------- |
333 // |
333 // |
334 CMsvOperation* CRightsObjectMtmUi::OpenL( TRequestStatus& aStatus ) |
334 CMsvOperation* CRightsObjectMtmUi::OpenL( TRequestStatus& aStatus ) |
335 // Open |
335 // Open |
336 { |
336 { |
337 #ifdef _DRM_TESTING |
337 #ifdef _DRM_TESTING |
338 WriteL(_L8("OpenL(1)")); |
338 WriteL(_L8("OpenL(1)")); |
339 #endif |
339 #endif |
340 |
340 |
341 TMsvEntry tEntry = BaseMtm().Entry().Entry(); |
341 TMsvEntry tEntry = BaseMtm().Entry().Entry(); |
342 TMsvEntry newEntry( tEntry ); |
342 TMsvEntry newEntry( tEntry ); |
343 |
343 |
344 const TUid type( tEntry.iType ); |
344 const TUid type( tEntry.iType ); |
345 CMsvOperation* operation = NULL; |
345 CMsvOperation* operation = NULL; |
346 if ( type == KUidMsvMessageEntry ) |
346 if ( type == KUidMsvMessageEntry ) |
347 { |
347 { |
348 operation = ViewL( aStatus ); |
348 operation = ViewL( aStatus ); |
349 newEntry.SetUnread( EFalse ); |
349 newEntry.SetUnread( EFalse ); |
350 BaseMtm().Entry().ChangeL( newEntry ); |
350 BaseMtm().Entry().ChangeL( newEntry ); |
351 } |
351 } |
352 else |
352 else |
353 { |
353 { |
354 User::Leave( KErrNotSupported ); |
354 User::Leave( KErrNotSupported ); |
355 } |
355 } |
356 return operation; |
356 return operation; |
357 } |
357 } |
358 |
358 |
359 // ----------------------------------------------------------------------------- |
359 // ----------------------------------------------------------------------------- |
360 // CRightsObjectMtmUi::OpenL |
360 // CRightsObjectMtmUi::OpenL |
361 // |
361 // |
362 // Opens the first entry in the selections. |
362 // Opens the first entry in the selections. |
363 // |
363 // |
364 // ----------------------------------------------------------------------------- |
364 // ----------------------------------------------------------------------------- |
365 // |
365 // |
366 CMsvOperation* CRightsObjectMtmUi::OpenL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ) |
366 CMsvOperation* CRightsObjectMtmUi::OpenL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ) |
367 // Open selection |
367 // Open selection |
368 { |
368 { |
369 #ifdef _DRM_TESTING |
369 #ifdef _DRM_TESTING |
370 WriteL(_L8("OpenL(2)")); |
370 WriteL(_L8("OpenL(2)")); |
371 #endif |
371 #endif |
372 BaseMtm().SwitchCurrentEntryL( aSelection.At( 0 ) ); |
372 BaseMtm().SwitchCurrentEntryL( aSelection.At( 0 ) ); |
373 return OpenL( aStatus ); |
373 return OpenL( aStatus ); |
374 } |
374 } |
375 |
375 |
376 // ----------------------------------------------------------------------------- |
376 // ----------------------------------------------------------------------------- |
377 // CRightsObjectMtmUi::CloseL |
377 // CRightsObjectMtmUi::CloseL |
378 // |
378 // |
379 // Not supported |
379 // Not supported |
380 // |
380 // |
381 // ----------------------------------------------------------------------------- |
381 // ----------------------------------------------------------------------------- |
382 // |
382 // |
383 CMsvOperation* CRightsObjectMtmUi::CloseL( TRequestStatus& /*aStatus*/ ) |
383 CMsvOperation* CRightsObjectMtmUi::CloseL( TRequestStatus& /*aStatus*/ ) |
384 { |
384 { |
385 // Close |
385 // Close |
386 #ifdef _DRM_TESTING |
386 #ifdef _DRM_TESTING |
387 WriteL(_L8("CloseL(1)")); |
387 WriteL(_L8("CloseL(1)")); |
388 #endif |
388 #endif |
389 User::Leave( KErrNotSupported ); |
389 User::Leave( KErrNotSupported ); |
390 return NULL; |
390 return NULL; |
391 } |
391 } |
392 |
392 |
393 // ----------------------------------------------------------------------------- |
393 // ----------------------------------------------------------------------------- |
394 // CRightsObjectMtmUi::CloseL |
394 // CRightsObjectMtmUi::CloseL |
395 // |
395 // |
396 // Not supported |
396 // Not supported |
397 // |
397 // |
398 // ----------------------------------------------------------------------------- |
398 // ----------------------------------------------------------------------------- |
399 // |
399 // |
400 CMsvOperation* CRightsObjectMtmUi::CloseL( TRequestStatus& /*aStatus*/ , const CMsvEntrySelection& /*aSelection*/ ) |
400 CMsvOperation* CRightsObjectMtmUi::CloseL( TRequestStatus& /*aStatus*/ , const CMsvEntrySelection& /*aSelection*/ ) |
401 { |
401 { |
402 // Close selection |
402 // Close selection |
403 #ifdef _DRM_TESTING |
403 #ifdef _DRM_TESTING |
404 WriteL(_L8("CloseL(2)")); |
404 WriteL(_L8("CloseL(2)")); |
405 #endif |
405 #endif |
406 |
406 |
407 User::Leave( KErrNotSupported ); |
407 User::Leave( KErrNotSupported ); |
408 return NULL; |
408 return NULL; |
409 } |
409 } |
410 |
410 |
411 // ----------------------------------------------------------------------------- |
411 // ----------------------------------------------------------------------------- |
412 // CRightsObjectMtmUi::EditL |
412 // CRightsObjectMtmUi::EditL |
413 // |
413 // |
414 // Not supported |
414 // Not supported |
415 // |
415 // |
416 // ----------------------------------------------------------------------------- |
416 // ----------------------------------------------------------------------------- |
417 // |
417 // |
418 CMsvOperation* CRightsObjectMtmUi::EditL( TRequestStatus& /*aStatus*/ ) |
418 CMsvOperation* CRightsObjectMtmUi::EditL( TRequestStatus& /*aStatus*/ ) |
419 // Edit |
419 // Edit |
420 { |
420 { |
421 #ifdef _DRM_TESTING |
421 #ifdef _DRM_TESTING |
422 WriteL(_L8("EditL(1)")); |
422 WriteL(_L8("EditL(1)")); |
423 #endif |
423 #endif |
424 User::Leave( KErrNotSupported ); |
424 User::Leave( KErrNotSupported ); |
425 return NULL; |
425 return NULL; |
426 } |
426 } |
427 |
427 |
428 // ----------------------------------------------------------------------------- |
428 // ----------------------------------------------------------------------------- |
429 // CRightsObjectMtmUi::EditL |
429 // CRightsObjectMtmUi::EditL |
430 // |
430 // |
431 // Not supported |
431 // Not supported |
432 // |
432 // |
433 // ----------------------------------------------------------------------------- |
433 // ----------------------------------------------------------------------------- |
434 // |
434 // |
435 CMsvOperation* CRightsObjectMtmUi::EditL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ) |
435 CMsvOperation* CRightsObjectMtmUi::EditL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ) |
436 // Edit selection |
436 // Edit selection |
437 { |
437 { |
438 #ifdef _DRM_TESTING |
438 #ifdef _DRM_TESTING |
439 WriteL(_L8("EditL(2)")); |
439 WriteL(_L8("EditL(2)")); |
440 #endif |
440 #endif |
441 iBaseMtm.SwitchCurrentEntryL( aSelection.At( 0 ) ); |
441 iBaseMtm.SwitchCurrentEntryL( aSelection.At( 0 ) ); |
442 return EditL( aStatus ); |
442 return EditL( aStatus ); |
443 } |
443 } |
444 |
444 |
445 // ----------------------------------------------------------------------------- |
445 // ----------------------------------------------------------------------------- |
446 // CRightsObjectMtmUi::ViewL |
446 // CRightsObjectMtmUi::ViewL |
447 // |
447 // |
448 // Views an entry. |
448 // Views an entry. |
449 // |
449 // |
450 // ----------------------------------------------------------------------------- |
450 // ----------------------------------------------------------------------------- |
451 // |
451 // |
452 CMsvOperation* CRightsObjectMtmUi::ViewL( TRequestStatus& aStatus ) |
452 CMsvOperation* CRightsObjectMtmUi::ViewL( TRequestStatus& aStatus ) |
453 // View |
453 // View |
454 { |
454 { |
455 #ifdef _DRM_TESTING |
455 #ifdef _DRM_TESTING |
456 WriteL(_L8("ViewL(1)")); |
456 WriteL(_L8("ViewL(1)")); |
457 #endif |
457 #endif |
458 |
458 |
459 CheckMessageTypeL(); |
459 CheckMessageTypeL(); |
460 return LaunchEditorApplicationL( aStatus , iBaseMtm.Entry().Entry().Id() , ETrue ); |
460 return LaunchEditorApplicationL( aStatus , iBaseMtm.Entry().Entry().Id() , ETrue ); |
461 } |
461 } |
462 |
462 |
463 // ----------------------------------------------------------------------------- |
463 // ----------------------------------------------------------------------------- |
464 // CRightsObjectMtmUi::ViewL |
464 // CRightsObjectMtmUi::ViewL |
465 // |
465 // |
466 // Views the first entry in the selection. |
466 // Views the first entry in the selection. |
467 // |
467 // |
468 // ----------------------------------------------------------------------------- |
468 // ----------------------------------------------------------------------------- |
469 // |
469 // |
470 CMsvOperation* CRightsObjectMtmUi::ViewL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ) |
470 CMsvOperation* CRightsObjectMtmUi::ViewL( TRequestStatus& aStatus , const CMsvEntrySelection& aSelection ) |
471 // View selection |
471 // View selection |
472 { |
472 { |
473 #ifdef _DRM_TESTING |
473 #ifdef _DRM_TESTING |
474 WriteL(_L8("ViewL(2)")); |
474 WriteL(_L8("ViewL(2)")); |
475 #endif |
475 #endif |
476 |
476 |
477 iBaseMtm.SwitchCurrentEntryL( aSelection.At( 0 ) ); |
477 iBaseMtm.SwitchCurrentEntryL( aSelection.At( 0 ) ); |
478 return ViewL( aStatus ); |
478 return ViewL( aStatus ); |
479 } |
479 } |
480 |
480 |
481 |
481 |
482 // |
482 // |
483 // Message responding |
483 // Message responding |
484 // |
484 // |
485 |
485 |
486 // ----------------------------------------------------------------------------- |
486 // ----------------------------------------------------------------------------- |
487 // CRightsObjectMtmUi::ReplyL |
487 // CRightsObjectMtmUi::ReplyL |
488 // |
488 // |
523 // Check the type of the message |
523 // Check the type of the message |
524 // |
524 // |
525 // ----------------------------------------------------------------------------- |
525 // ----------------------------------------------------------------------------- |
526 // |
526 // |
527 void CRightsObjectMtmUi::CheckMessageTypeL() |
527 void CRightsObjectMtmUi::CheckMessageTypeL() |
528 { |
528 { |
529 #ifdef _DRM_TESTING |
529 #ifdef _DRM_TESTING |
530 WriteL(_L8("CheckMessageTypeL")); |
530 WriteL(_L8("CheckMessageTypeL")); |
531 #endif |
531 #endif |
532 BaseMtm().LoadMessageL(); |
532 BaseMtm().LoadMessageL(); |
533 CRichText& body = BaseMtm().Body(); |
533 CRichText& body = BaseMtm().Body(); |
534 TPtrC ptr16( body.Read(0) ); |
534 TPtrC ptr16( body.Read(0) ); |
535 |
535 |
536 #ifdef _DRM_TESTING |
536 #ifdef _DRM_TESTING |
537 WriteL(ptr16); |
537 WriteL(ptr16); |
538 #endif |
538 #endif |
539 if ( ptr16.Length()>4 && ptr16.Left(4).Compare(KRoAcquisitionPrefix())==0 ) |
539 if ( ptr16.Length()>4 && ptr16.Left(4).Compare(KRoAcquisitionPrefix())==0 ) |
540 { |
540 { |
541 iType = ERoapTriggerRoAcquisition; |
541 iType = ERoapTriggerRoAcquisition; |
542 } |
542 } |
543 else if ( ptr16.Length()>4 && ptr16.Left(4).Compare(KTriggerPrefix())==0 ) |
543 else if ( ptr16.Length()>4 && ptr16.Left(4).Compare(KTriggerPrefix())==0 ) |
544 { |
544 { |
545 iType = ERoapTrigger; |
545 iType = ERoapTrigger; |
546 } |
546 } |
547 else |
547 else |
548 { |
548 { |
549 iType = ERo; |
549 iType = ERo; |
550 } |
550 } |
551 |
551 |
552 } |
552 } |
553 |
553 |
554 // ----------------------------------------------------------------------------- |
554 // ----------------------------------------------------------------------------- |
555 // CRightsObjectMtmUi::LaunchEditorApplicationL |
555 // CRightsObjectMtmUi::LaunchEditorApplicationL |
556 // |
556 // |
557 // Launch RO Manager to get information for rights corresponding to the message. |
557 // Launch RO Manager to get information for rights corresponding to the message. |
558 // |
558 // |
559 // ----------------------------------------------------------------------------- |
559 // ----------------------------------------------------------------------------- |
560 // |
560 // |
561 CMsvOperation* CRightsObjectMtmUi::LaunchEditorApplicationL( TRequestStatus& aStatus , TMsvId /*aId*/ , |
561 CMsvOperation* CRightsObjectMtmUi::LaunchEditorApplicationL( TRequestStatus& aStatus , TMsvId /*aId*/ , |
562 TBool /*aReadOnly*/ ) |
562 TBool /*aReadOnly*/ ) |
563 { |
563 { |
564 #ifdef _DRM_TESTING |
564 #ifdef _DRM_TESTING |
565 WriteL(_L8("LaunchEditorApplicationL-Start")); |
565 WriteL(_L8("LaunchEditorApplicationL-Start")); |
566 #endif |
566 #endif |
567 // get message context |
567 // get message context |
568 BaseMtm().LoadMessageL(); |
568 BaseMtm().LoadMessageL(); |
569 CRichText& body = BaseMtm().Body(); |
569 CRichText& body = BaseMtm().Body(); |
570 TPtrC ptr16( body.Read(0) ); |
570 TPtrC ptr16( body.Read(0) ); |
571 const TUid KUidDRMUI = { 0x101f85c7 }; |
571 const TUid KUidDRMUI = { 0x101f85c7 }; |
572 |
572 |
573 if ( iType == ERoapTrigger || iType == ERoapTriggerRoAcquisition ) |
573 if ( iType == ERoapTrigger || iType == ERoapTriggerRoAcquisition ) |
574 { |
574 { |
575 |
575 |
576 #ifdef _DRM_TESTING |
576 #ifdef _DRM_TESTING |
577 WriteL(_L8("LaunchEditorApplicationL-iDocHandler")); |
577 WriteL(_L8("LaunchEditorApplicationL-iDocHandler")); |
578 #endif |
578 #endif |
579 |
579 |
580 _LIT8( KRoapTriggerMimeType, "application/vnd.oma.drm.roap-trigger+xml" ); |
580 _LIT8( KRoapTriggerMimeType, "application/vnd.oma.drm.roap-trigger+xml" ); |
581 TDataType type = TDataType( KRoapTriggerMimeType ); |
581 TDataType type = TDataType( KRoapTriggerMimeType ); |
582 HBufC* filename = NULL; |
582 HBufC* filename = NULL; |
583 TPtr ptr(NULL,0); |
583 TPtr ptr(NULL,0); |
584 TBool show; |
584 TBool show; |
585 filename = HBufC::NewLC(ptr16.Length()-4); |
585 filename = HBufC::NewLC(ptr16.Length()-4); |
586 ptr.Set(filename->Des()); |
586 ptr.Set(filename->Des()); |
587 ptr.Append(ptr16.Right(ptr16.Length()-4)); |
587 ptr.Append(ptr16.Right(ptr16.Length()-4)); |
588 |
588 |
589 show = ShowQueryL(ptr); |
589 show = ShowQueryL(ptr); |
590 if (!show) |
590 if (!show) |
591 { |
591 { |
592 CleanupStack::PopAndDestroy(filename); |
592 CleanupStack::PopAndDestroy(filename); |
593 return CompletedOperationL( aStatus ); |
593 return CompletedOperationL( aStatus ); |
594 } |
594 } |
595 |
595 |
596 #ifdef _DRM_TESTING |
596 #ifdef _DRM_TESTING |
597 WriteL(ptr,ptr.Length()); |
597 WriteL(ptr,ptr.Length()); |
598 #endif |
598 #endif |
599 if (iDocHandler) |
599 if (iDocHandler) |
600 { |
600 { |
601 delete iDocHandler; |
601 delete iDocHandler; |
602 iDocHandler = NULL; |
602 iDocHandler = NULL; |
603 } |
603 } |
604 #ifdef _DRM_TESTING |
604 #ifdef _DRM_TESTING |
605 WriteL(_L8("LaunchEditorApplicationL-iDocHandler-NewL")); |
605 WriteL(_L8("LaunchEditorApplicationL-iDocHandler-NewL")); |
606 #endif |
606 #endif |
607 iDocHandler = CDocumentHandler::NewL(); |
607 iDocHandler = CDocumentHandler::NewL(); |
608 #ifdef _DRM_TESTING |
608 #ifdef _DRM_TESTING |
609 WriteL(_L8("LaunchEditorApplicationL-iDocHandler-SetExitObserver")); |
609 WriteL(_L8("LaunchEditorApplicationL-iDocHandler-SetExitObserver")); |
610 #endif |
610 #endif |
611 iDocHandler->SetExitObserver(this); |
611 iDocHandler->SetExitObserver(this); |
612 #ifdef _DRM_TESTING |
612 #ifdef _DRM_TESTING |
613 WriteL(_L8("LaunchEditorApplicationL-iDocHandler-OpenFileEmbeddedL")); |
613 WriteL(_L8("LaunchEditorApplicationL-iDocHandler-OpenFileEmbeddedL")); |
614 #endif |
614 #endif |
615 iDocHandler->OpenFileEmbeddedL(ptr,type); |
615 iDocHandler->OpenFileEmbeddedL(ptr,type); |
616 CleanupStack::PopAndDestroy(filename); |
616 CleanupStack::PopAndDestroy(filename); |
617 #ifdef _DRM_TESTING |
617 #ifdef _DRM_TESTING |
618 WriteL(_L8("LaunchEditorApplicationL-iDocHandler-End")); |
618 WriteL(_L8("LaunchEditorApplicationL-iDocHandler-End")); |
619 #endif |
619 #endif |
620 } |
620 } |
621 else |
621 else |
622 { |
622 { |
623 if ( iOpenService ) |
623 if ( iOpenService ) |
624 { |
624 { |
625 delete iOpenService; |
625 delete iOpenService; |
626 iOpenService = NULL; |
626 iOpenService = NULL; |
627 } |
627 } |
628 #ifdef _DRM_TESTING |
628 #ifdef _DRM_TESTING |
629 WriteL(_L8("LaunchEditorApplicationL-CAknOpenFileService::NewL")); |
629 WriteL(_L8("LaunchEditorApplicationL-CAknOpenFileService::NewL")); |
630 #endif |
630 #endif |
631 |
631 |
632 CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(); |
632 CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(); |
633 TAiwVariant variantObject( ptr16 ); |
633 TAiwVariant variantObject( ptr16 ); |
634 TAiwGenericParam param( EGenericParamFile, variantObject ); |
634 TAiwGenericParam param( EGenericParamFile, variantObject ); |
635 paramList->AppendL( param ); |
635 paramList->AppendL( param ); |
636 |
636 |
637 TRAPD( err, iOpenService = CAknLaunchAppService::NewL( KUidDRMUI, this, paramList ) ); |
637 TRAPD( err, iOpenService = CAknLaunchAppService::NewL( KUidDRMUI, this, paramList ) ); |
638 if (err != KErrNone) |
638 if (err != KErrNone) |
639 { |
639 { |
640 // just return to Inbox |
640 // just return to Inbox |
641 } |
641 } |
642 |
642 |
643 CleanupStack::PopAndDestroy( paramList ); // paramList |
643 CleanupStack::PopAndDestroy( paramList ); // paramList |
644 } |
644 } |
645 |
645 |
646 #ifdef _DRM_TESTING |
646 #ifdef _DRM_TESTING |
647 WriteL(_L8("LaunchEditorApplicationL-End")); |
647 WriteL(_L8("LaunchEditorApplicationL-End")); |
648 #endif |
648 #endif |
649 return CompletedOperationL( aStatus ); |
649 return CompletedOperationL( aStatus ); |
650 } |
650 } |
651 |
651 |
652 |
652 |
653 void CRightsObjectMtmUi::HandleServerAppExit(TInt aReason) |
653 void CRightsObjectMtmUi::HandleServerAppExit(TInt aReason) |
654 { |
654 { |
655 #ifdef _DRM_TESTING |
655 #ifdef _DRM_TESTING |
656 TRAP(err,WriteL(_L8("HandleServerAppExit"))); |
656 TRAP(err,WriteL(_L8("HandleServerAppExit"))); |
657 #endif |
657 #endif |
658 MAknServerAppExitObserver::HandleServerAppExit(aReason); |
658 MAknServerAppExitObserver::HandleServerAppExit(aReason); |
659 } |
659 } |
660 |
660 |
661 // ----------------------------------------------------------------------------- |
661 // ----------------------------------------------------------------------------- |
662 // CRightsObjectMtmUi::CompletedOperationL |
662 // CRightsObjectMtmUi::CompletedOperationL |
663 // |
663 // |
664 // return completed operation to UI |
664 // return completed operation to UI |
665 // |
665 // |
666 // ----------------------------------------------------------------------------- |
666 // ----------------------------------------------------------------------------- |
667 // |
667 // |
668 CMsvOperation* CRightsObjectMtmUi::CompletedOperationL( TRequestStatus& aObserverStatus ) |
668 CMsvOperation* CRightsObjectMtmUi::CompletedOperationL( TRequestStatus& aObserverStatus ) |
669 { |
669 { |
670 #ifdef _DRM_TESTING |
670 #ifdef _DRM_TESTING |
671 WriteL(_L8("CompletedOperationL")); |
671 WriteL(_L8("CompletedOperationL")); |
672 #endif |
672 #endif |
673 //return completed operation pointer |
673 //return completed operation pointer |
674 TPckgBuf<TMsvLocalOperationProgress> progress; |
674 TPckgBuf<TMsvLocalOperationProgress> progress; |
675 SetProgressSuccess( progress, BaseMtm().Entry().Entry().Id() ); |
675 SetProgressSuccess( progress, BaseMtm().Entry().Entry().Id() ); |
676 CMsvCompletedOperation* operation = |
676 CMsvCompletedOperation* operation = |
677 CMsvCompletedOperation::NewL( Session() , Type() , progress , |
677 CMsvCompletedOperation::NewL( Session() , Type() , progress , |
678 KMsvLocalServiceIndexEntryId , aObserverStatus ); |
678 KMsvLocalServiceIndexEntryId , aObserverStatus ); |
679 return operation; |
679 return operation; |
680 } |
680 } |
681 |
681 |
682 void CRightsObjectMtmUi::SetProgressSuccess |
682 void CRightsObjectMtmUi::SetProgressSuccess |
688 } |
688 } |
689 |
689 |
690 TBool CRightsObjectMtmUi::ShowQueryL( TDesC16& aFile ) |
690 TBool CRightsObjectMtmUi::ShowQueryL( TDesC16& aFile ) |
691 { |
691 { |
692 #ifdef _DRM_TESTING |
692 #ifdef _DRM_TESTING |
693 WriteL(_L8("ShowQueryL")); |
693 WriteL(_L8("ShowQueryL")); |
694 #endif |
694 #endif |
695 TBool show = ETrue; |
695 TBool show = ETrue; |
696 TInt type = 0; |
696 TInt type = 0; |
697 HBufC* msgText = NULL; |
697 HBufC* msgText = NULL; |
698 type = CheckTriggerTypeL(aFile); |
698 type = CheckTriggerTypeL(aFile); |
699 |
699 |
700 #ifndef RD_MULTIPLE_DRIVE |
700 #ifndef RD_MULTIPLE_DRIVE |
701 |
701 |
702 TFileName fileName( KDriveZ ); |
702 TFileName fileName( KDriveZ ); |
703 |
703 |
704 #else //RD_MULTIPLE_DRIVE |
704 #else //RD_MULTIPLE_DRIVE |
705 |
705 |
706 _LIT( KDrive, "%c:"); |
706 _LIT( KDrive, "%c:"); |
707 TInt driveNumber( -1 ); |
707 TInt driveNumber( -1 ); |
708 TChar driveLetter; |
708 TChar driveLetter; |
709 DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ); |
709 DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRom, driveNumber ); |
710 iFs.DriveToChar( driveNumber, driveLetter ); |
710 iFs.DriveToChar( driveNumber, driveLetter ); |
711 |
711 |
712 TFileName fileName; |
712 TFileName fileName; |
713 |
713 |
714 fileName.Format( KDrive, (TUint)driveLetter ); |
714 fileName.Format( KDrive, (TUint)driveLetter ); |
715 |
715 |
716 #endif |
716 #endif |
717 |
717 |
718 fileName.Append( KDC_MTM_RESOURCE_DIR ); |
718 fileName.Append( KDC_MTM_RESOURCE_DIR ); |
719 fileName.Append( KRoMtmUiResFileName ); |
719 fileName.Append( KRoMtmUiResFileName ); |
720 RConeResourceLoader loader( *iCoeEnv ); |
720 RConeResourceLoader loader( *iCoeEnv ); |
721 loader.OpenL( fileName ); |
721 loader.OpenL( fileName ); |
722 switch(type) |
722 switch(type) |
723 { |
723 { |
724 case Roap::ERegistrationTrigger: |
724 case Roap::ERegistrationTrigger: |
725 { |
725 { |
726 #ifdef _DRM_TESTING |
726 #ifdef _DRM_TESTING |
727 WriteL(_L8("ShowQueryL->ERegistrationTrigger")); |
727 WriteL(_L8("ShowQueryL->ERegistrationTrigger")); |
728 #endif |
728 #endif |
729 loader.Close(); |
729 loader.Close(); |
730 return ETrue; |
730 return ETrue; |
731 } |
731 } |
732 case Roap::ERoAcquisitionTrigger: |
732 case Roap::ERoAcquisitionTrigger: |
733 { |
733 { |
734 #ifdef _DRM_TESTING |
734 #ifdef _DRM_TESTING |
735 WriteL(_L8("ShowQueryL->ERoAcquisitionTrigger")); |
735 WriteL(_L8("ShowQueryL->ERoAcquisitionTrigger")); |
736 #endif |
736 #endif |
737 msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_RIGHTS_ACQ_MSG , iCoeEnv ); |
737 msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_RIGHTS_ACQ_MSG , iCoeEnv ); |
738 }break; |
738 }break; |
739 case Roap::EJoinDomainTrigger: |
739 case Roap::EJoinDomainTrigger: |
740 { |
740 { |
741 #ifdef _DRM_TESTING |
741 #ifdef _DRM_TESTING |
742 WriteL(_L8("ShowQueryL->EJoinDomainTrigger")); |
742 WriteL(_L8("ShowQueryL->EJoinDomainTrigger")); |
743 #endif |
743 #endif |
744 msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_JOIN_DOMAIN_MSG , iCoeEnv ); |
744 msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_JOIN_DOMAIN_MSG , iCoeEnv ); |
745 }break; |
745 }break; |
746 case Roap::ELeaveDomainTrigger: |
746 case Roap::ELeaveDomainTrigger: |
747 { |
747 { |
748 #ifdef _DRM_TESTING |
748 #ifdef _DRM_TESTING |
749 WriteL(_L8("ShowQueryL->ELeaveDomainTrigger")); |
749 WriteL(_L8("ShowQueryL->ELeaveDomainTrigger")); |
750 #endif |
750 #endif |
751 msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_LEAVE_DOMAIN_MSG , iCoeEnv ); |
751 msgText = StringLoader::LoadLC( R_ROMTMUI_QUERY_LEAVE_DOMAIN_MSG , iCoeEnv ); |
752 }break; |
752 }break; |
753 default: |
753 default: |
754 { |
754 { |
755 #ifdef _DRM_TESTING |
755 #ifdef _DRM_TESTING |
756 WriteL(_L8("ShowQueryL->default")); |
756 WriteL(_L8("ShowQueryL->default")); |
757 #endif |
757 #endif |
758 loader.Close(); |
758 loader.Close(); |
759 return EFalse; |
759 return EFalse; |
760 } |
760 } |
761 } |
761 } |
762 #ifdef _DRM_TESTING |
762 #ifdef _DRM_TESTING |
763 WriteL(*msgText); |
763 WriteL(*msgText); |
764 #endif |
764 #endif |
765 loader.Close(); |
765 loader.Close(); |
766 CAknQueryDialog* dlg = new (ELeave) CAknQueryDialog( *msgText, |
766 CAknQueryDialog* dlg = new (ELeave) CAknQueryDialog( *msgText, |
767 CAknQueryDialog::ENoTone ); |
767 CAknQueryDialog::ENoTone ); |
768 show = dlg->ExecuteLD( R_ROMTMUI_TRIGGER_CONFIRMATION_QUERY ); |
768 show = dlg->ExecuteLD( R_ROMTMUI_TRIGGER_CONFIRMATION_QUERY ); |
769 CleanupStack::PopAndDestroy( msgText ); |
769 CleanupStack::PopAndDestroy( msgText ); |
770 #ifdef _DRM_TESTING |
770 #ifdef _DRM_TESTING |
771 WriteL(_L8("ShowQueryL->End"),show); |
771 WriteL(_L8("ShowQueryL->End"),show); |
772 #endif |
772 #endif |
773 return show; |
773 return show; |
774 } |
774 } |
775 |
775 |
776 TInt CRightsObjectMtmUi::CheckTriggerTypeL( TDesC16& aFile ) |
776 TInt CRightsObjectMtmUi::CheckTriggerTypeL( TDesC16& aFile ) |
777 { |
777 { |
778 #ifdef _DRM_TESTING |
778 #ifdef _DRM_TESTING |
779 WriteL(_L8("CheckTriggerTypeL")); |
779 WriteL(_L8("CheckTriggerTypeL")); |
780 #endif |
780 #endif |
781 Roap::CRoapEng* roap = NULL; |
781 Roap::CRoapEng* roap = NULL; |
782 RFile file; |
782 RFile file; |
783 TInt size = 0; |
783 TInt size = 0; |
784 Roap::TTriggerType type; |
784 Roap::TTriggerType type; |
785 Roap::TRiContextStatus status; |
785 Roap::TRiContextStatus status; |
786 Roap::TDomainOperation op; |
786 Roap::TDomainOperation op; |
787 RPointerArray<HBufC8> array; |
787 RPointerArray<HBufC8> array; |
788 |
788 |
789 HBufC8* buf =NULL; |
789 HBufC8* buf =NULL; |
790 TPtr8 ptr(NULL,0); |
790 TPtr8 ptr(NULL,0); |
791 User::LeaveIfError(file.Open(iFs, aFile, EFileShareReadersOrWriters)); |
791 User::LeaveIfError(file.Open(iFs, aFile, EFileShareReadersOrWriters)); |
792 CleanupClosePushL(file); |
792 CleanupClosePushL(file); |
793 User::LeaveIfError(file.Size(size)); |
793 User::LeaveIfError(file.Size(size)); |