315 // |
314 // |
316 EXPORT_C TInt DRM::CDrmUtilityUI::DisplayQueryL( |
315 EXPORT_C TInt DRM::CDrmUtilityUI::DisplayQueryL( |
317 TInt aTextResourceId, |
316 TInt aTextResourceId, |
318 TInt aValue ) |
317 TInt aValue ) |
319 { |
318 { |
320 TInt resultCode( ECancelled ); |
319 TInt buttonCode( 0 ); |
321 |
320 |
322 CDrmUIDialogs* drmUiDialog( CDrmUIDialogs::NewLC() ); |
321 if ( iCoeEnv ) |
323 resultCode = drmUiDialog->ShowNoteL( aTextResourceId, KNullDesC, aValue ); |
322 { |
324 CleanupStack::PopAndDestroy( drmUiDialog ); |
323 TPtr bufPtr( NULL, 0 ); |
325 return resultCode; |
324 |
|
325 HBufC* stringholder( StringLoader::LoadLC( aTextResourceId, |
|
326 aValue, |
|
327 iCoeEnv ) ); |
|
328 CAknQueryDialog* dlg( |
|
329 CAknQueryDialog::NewL( CAknQueryDialog::ENoTone ) ); |
|
330 |
|
331 bufPtr.Set( stringholder->Des() ); |
|
332 AknTextUtils::LanguageSpecificNumberConversion( bufPtr ); |
|
333 PrepareSecondaryDisplayL( *dlg, aTextResourceId, KNullDesC, aValue ); |
|
334 |
|
335 buttonCode = dlg->ExecuteLD( R_DRMUTILITY_CONFIRMATION_QUERY, |
|
336 *stringholder ); |
|
337 |
|
338 CancelSecondaryDisplayL( aTextResourceId ); |
|
339 CleanupStack::PopAndDestroy( stringholder ); |
|
340 } |
|
341 else |
|
342 { |
|
343 DRM::CDrmUtilityGlobalNoteWrapper* noteWrapper( |
|
344 DRM::CDrmUtilityGlobalNoteWrapper::NewLC( iUtilityStringResourceReader ) ); |
|
345 |
|
346 buttonCode = noteWrapper->ShowNoteL( aTextResourceId, aValue ); |
|
347 |
|
348 CleanupStack::PopAndDestroy( noteWrapper ); |
|
349 } |
|
350 return buttonCode; |
326 } |
351 } |
327 |
352 |
328 // ----------------------------------------------------------------------------- |
353 // ----------------------------------------------------------------------------- |
329 // CDrmUtilityUI::DisplayQueryL |
354 // CDrmUtilityUI::DisplayQueryL |
330 // ----------------------------------------------------------------------------- |
355 // ----------------------------------------------------------------------------- |
331 // |
356 // |
332 EXPORT_C TInt DRM::CDrmUtilityUI::DisplayQueryL( |
357 EXPORT_C TInt DRM::CDrmUtilityUI::DisplayQueryL( |
333 TInt aTextResourceId, |
358 TInt aTextResourceId, |
334 const TDesC& aString ) |
359 const TDesC& aString ) |
335 { |
360 { |
336 TInt resultCode( ECancelled ); |
361 TInt buttonCode( 0 ); |
337 |
362 |
338 CDrmUIDialogs* drmUiDialog( CDrmUIDialogs::NewLC() ); |
363 if ( iCoeEnv ) |
339 resultCode = drmUiDialog->ShowNoteL( aTextResourceId, aString, KNoValue ); |
364 { |
340 CleanupStack::PopAndDestroy( drmUiDialog ); |
365 TPtr bufPtr( NULL, 0 ); |
341 return resultCode; |
366 |
|
367 HBufC* stringholder( StringLoader::LoadLC( aTextResourceId, |
|
368 aString, |
|
369 iCoeEnv ) ); |
|
370 CAknQueryDialog* dlg( |
|
371 CAknQueryDialog::NewL( CAknQueryDialog::ENoTone ) ); |
|
372 |
|
373 bufPtr.Set( stringholder->Des() ); |
|
374 AknTextUtils::LanguageSpecificNumberConversion( bufPtr ); |
|
375 PrepareSecondaryDisplayL( *dlg, aTextResourceId, aString, -1 ); |
|
376 |
|
377 buttonCode = dlg->ExecuteLD( R_DRMUTILITY_CONFIRMATION_QUERY, |
|
378 *stringholder ); |
|
379 |
|
380 CancelSecondaryDisplayL( aTextResourceId ); |
|
381 CleanupStack::PopAndDestroy( stringholder ); |
|
382 } |
|
383 else |
|
384 { |
|
385 DRM::CDrmUtilityGlobalNoteWrapper* noteWrapper( |
|
386 DRM::CDrmUtilityGlobalNoteWrapper::NewLC( iUtilityStringResourceReader ) ); |
|
387 |
|
388 buttonCode = noteWrapper->ShowNoteL( aTextResourceId, aString ); |
|
389 |
|
390 CleanupStack::PopAndDestroy( noteWrapper ); |
|
391 } |
|
392 |
|
393 return buttonCode; |
342 } |
394 } |
343 |
395 |
344 // ----------------------------------------------------------------------------- |
396 // ----------------------------------------------------------------------------- |
345 // CDrmUtilityUI::DisplayQueryL |
397 // CDrmUtilityUI::DisplayQueryL |
346 // ----------------------------------------------------------------------------- |
398 // ----------------------------------------------------------------------------- |
455 dateFormat = iAvkonStringResourceReader->ReadResourceString( |
507 dateFormat = iAvkonStringResourceReader->ReadResourceString( |
456 R_QTN_DATE_USUAL_WITH_ZERO ); |
508 R_QTN_DATE_USUAL_WITH_ZERO ); |
457 } |
509 } |
458 |
510 |
459 endTime.FormatL( endDate, dateFormat ); |
511 endTime.FormatL( endDate, dateFormat ); |
460 |
512 buttonCode = DisplayQueryL(R_DRM_QUERY_SET_AUTOMATED, endDate ); |
461 // Qt dialog not implmented yet. |
|
462 buttonCode = DisplayQueryL( EQueryLicenceValidUntil, endDate ); |
|
463 } |
513 } |
464 else if ( aConstraint->iActiveConstraints & EConstraintInterval ) |
514 else if ( aConstraint->iActiveConstraints & EConstraintInterval ) |
465 { |
515 { |
466 // Qt dialog not implemented yet. |
516 buttonCode = DisplayQueryWithIdL( R_DRM_QUERY_SET_AUTO_INTERVAL, |
467 buttonCode = DisplayQueryL( EQueryValidForLimitedTime, KNoValue ); |
517 R_DRMUTILITY_CONFIRMATION_QUERY ); |
|
518 |
468 } |
519 } |
469 return buttonCode; |
520 return buttonCode; |
470 } |
521 } |
471 |
522 |
472 // ----------------------------------------------------------------------------- |
523 // ----------------------------------------------------------------------------- |
506 startTime.FormatL( startTimeBuf, timeFormat ); |
557 startTime.FormatL( startTimeBuf, timeFormat ); |
507 startDateBuf.Append( KSpace ); |
558 startDateBuf.Append( KSpace ); |
508 startDateBuf.Append( startTimeBuf ); |
559 startDateBuf.Append( startTimeBuf ); |
509 |
560 |
510 // display note with start date |
561 // display note with start date |
511 // Qt dialog not implemented yet |
562 DisplayNoteL( R_DRMUTILITY_USAGE_RIGHTS_IN_FUTURE, startDateBuf ); |
512 DisplayNoteL( EConfUnableToUse, startDateBuf ); |
|
513 } |
563 } |
514 |
564 |
515 // ----------------------------------------------------------------------------- |
565 // ----------------------------------------------------------------------------- |
516 // CDrmUtilityUI::DisplayNoteL |
566 // CDrmUtilityUI::DisplayNoteL |
517 // ----------------------------------------------------------------------------- |
567 // ----------------------------------------------------------------------------- |
518 // |
568 // |
519 EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( TInt aTextResourceId ) |
569 EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( TInt aTextResourceId ) |
520 { |
570 { |
521 CDrmUIDialogs* drmUiDialog( CDrmUIDialogs::NewLC() ); |
571 if ( iCoeEnv ) |
522 drmUiDialog->ShowNoteL( aTextResourceId, KNullDesC, KNoValue ); |
572 { |
523 CleanupStack::PopAndDestroy( drmUiDialog ); |
573 HBufC* msgText( StringLoader::LoadLC( aTextResourceId, iCoeEnv ) ); |
|
574 DisplayNoteL( *msgText, aTextResourceId ); |
|
575 CleanupStack::PopAndDestroy( msgText ); |
|
576 } |
|
577 |
|
578 else |
|
579 { |
|
580 TBuf<KDRMUtilityNoteMaxSize> buffer( |
|
581 iUtilityStringResourceReader->ReadResourceString( aTextResourceId ) ); |
|
582 |
|
583 DisplayNoteL( buffer, aTextResourceId ); |
|
584 } |
524 } |
585 } |
525 |
586 |
526 // ----------------------------------------------------------------------------- |
587 // ----------------------------------------------------------------------------- |
527 // CDrmUtilityUI::DisplayNoteL |
588 // CDrmUtilityUI::DisplayNoteL |
528 // ----------------------------------------------------------------------------- |
589 // ----------------------------------------------------------------------------- |
529 // |
590 // |
530 EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( |
591 EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( |
531 TInt aTextResourceId, |
592 TInt aTextResourceId, |
532 const TDesC& aString ) |
593 const TDesC& aString ) |
533 { |
594 { |
534 CDrmUIDialogs* drmUiDialog( CDrmUIDialogs::NewLC() ); |
595 if ( iCoeEnv ) |
535 drmUiDialog->ShowNoteL( aTextResourceId, aString, KNoValue ); |
596 { |
536 CleanupStack::PopAndDestroy( drmUiDialog ); |
597 HBufC* msgText( StringLoader::LoadLC( aTextResourceId, |
|
598 aString, |
|
599 iCoeEnv ) ); |
|
600 DisplayNoteL( *msgText, aTextResourceId ); |
|
601 CleanupStack::PopAndDestroy( msgText ); |
|
602 } |
|
603 else |
|
604 { |
|
605 TBuf<KDRMUtilityNoteMaxSize + KMaxFileName> destBuffer; |
|
606 |
|
607 |
|
608 TBuf<KDRMUtilityNoteMaxSize> buffer( |
|
609 iUtilityStringResourceReader->ReadResourceString( aTextResourceId ) ); |
|
610 |
|
611 |
|
612 StringLoader::Format( destBuffer, buffer, -1, aString ); |
|
613 DisplayNoteL( destBuffer, aTextResourceId, aString, -1 ); |
|
614 } |
537 } |
615 } |
538 |
616 |
539 // ----------------------------------------------------------------------------- |
617 // ----------------------------------------------------------------------------- |
540 // CDrmUtilityUI::DisplayNoteL |
618 // CDrmUtilityUI::DisplayNoteL |
541 // ----------------------------------------------------------------------------- |
619 // ----------------------------------------------------------------------------- |
542 // |
620 // |
543 EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( |
621 EXPORT_C void DRM::CDrmUtilityUI::DisplayNoteL( |
544 TInt aTextResourceId, |
622 TInt aTextResourceId, |
545 TInt aValue ) |
623 TInt aValue ) |
546 { |
624 { |
547 CDrmUIDialogs* drmUiDialog( CDrmUIDialogs::NewLC() ); |
625 if ( iCoeEnv ) |
548 drmUiDialog->ShowNoteL( aTextResourceId, KNullDesC, aValue ); |
626 { |
549 CleanupStack::PopAndDestroy( drmUiDialog ); |
627 HBufC* msgText( StringLoader::LoadLC( aTextResourceId, |
|
628 aValue, |
|
629 iCoeEnv ) ); |
|
630 |
|
631 DisplayNoteL( *msgText, aTextResourceId, KNullDesC, aValue ); |
|
632 CleanupStack::PopAndDestroy( msgText ); |
|
633 } |
|
634 else |
|
635 { |
|
636 TBuf<KDRMUtilityNoteMaxSize + KMaxFileName> destBuffer; |
|
637 |
|
638 TBuf<KDRMUtilityNoteMaxSize> buffer( |
|
639 iUtilityStringResourceReader->ReadResourceString( aTextResourceId ) ); |
|
640 |
|
641 |
|
642 StringLoader::Format( destBuffer, buffer, -1, aValue ); |
|
643 DisplayNoteL( destBuffer, aTextResourceId, KNullDesC, aValue ); |
|
644 } |
550 } |
645 } |
551 |
646 |
552 // ----------------------------------------------------------------------------- |
647 // ----------------------------------------------------------------------------- |
553 // CDrmUtilityUI::DisplayNoteL |
648 // CDrmUtilityUI::DisplayNoteL |
554 // ----------------------------------------------------------------------------- |
649 // ----------------------------------------------------------------------------- |
674 { |
769 { |
675 return 0; |
770 return 0; |
676 } |
771 } |
677 |
772 |
678 #endif // RD_DRM_PREVIEW_RIGHT_FOR_AUDIO |
773 #endif // RD_DRM_PREVIEW_RIGHT_FOR_AUDIO |
|
774 |
|
775 EXPORT_C TInt DRM::CDrmUtilityUI::DisplayMessageQueryL( TInt aMessage, TInt aHeader, const TDesC& aString) |
|
776 { |
|
777 TInt buttonCode = 0; |
|
778 if ( iCoeEnv ) |
|
779 { |
|
780 CAknMessageQueryDialog* messageQuery = new (ELeave) CAknMessageQueryDialog(); |
|
781 messageQuery->PrepareLC(R_DRMUTILITY_SYNC_DIALOG); |
|
782 |
|
783 HBufC* headerStringholder ( StringLoader::LoadLC( aHeader, iCoeEnv ) ); |
|
784 |
|
785 messageQuery->QueryHeading()->SetTextL(*headerStringholder); |
|
786 CleanupStack::PopAndDestroy(); // headerStringholder |
|
787 |
|
788 HBufC* messageStringholder ( StringLoader::LoadLC( aMessage, aString, iCoeEnv ) ); |
|
789 |
|
790 messageQuery->SetMessageTextL(*messageStringholder); |
|
791 CleanupStack::PopAndDestroy(); // messageStringholder |
|
792 |
|
793 buttonCode = messageQuery->RunLD(); |
|
794 } |
|
795 else |
|
796 { |
|
797 if(!iNoteWrapper) |
|
798 { |
|
799 iNoteWrapper = DRM::CDrmUtilityGlobalNoteWrapper::NewL( iUtilityStringResourceReader ); |
|
800 } |
|
801 |
|
802 iNoteWrapper->ShowMessageQueryL(aMessage, aHeader, aString); |
|
803 } |
|
804 return buttonCode; |
|
805 } |
|
806 |
679 |
807 |
680 // ----------------------------------------------------------------------------- |
808 // ----------------------------------------------------------------------------- |
681 // CDrmUtilityUI::CreateNoteForResourceL |
809 // CDrmUtilityUI::CreateNoteForResourceL |
682 // ----------------------------------------------------------------------------- |
810 // ----------------------------------------------------------------------------- |
683 // |
811 // |