839 // |
839 // |
840 HBufC* CDRMRightsMgrDetailsContainer::AddPartsOfTimeL( |
840 HBufC* CDRMRightsMgrDetailsContainer::AddPartsOfTimeL( |
841 TInt aIntYrs, TInt aIntMon, TInt aIntDay, |
841 TInt aIntYrs, TInt aIntMon, TInt aIntDay, |
842 TInt aIntHrs, TInt aIntMin, TInt aIntSec ) |
842 TInt aIntHrs, TInt aIntMin, TInt aIntSec ) |
843 { |
843 { |
844 |
844 // Only the two most meaningful data will be showed |
845 CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( 1 ); |
845 TInt numOfData = 0; |
|
846 |
|
847 CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( 2 ); |
846 CleanupStack::PushL( strings ); |
848 CleanupStack::PushL( strings ); |
847 |
849 |
848 if ( aIntYrs > 0 ) |
850 if ( aIntYrs > 0 ) |
849 { |
851 { |
850 AddSinglePartOfTimeL( aIntYrs, |
852 AddSinglePartOfTimeL( aIntYrs, |
851 R_QTN_DRM_NBR_OF_YEARS_ONE, |
853 R_QTN_DRM_NBR_OF_YEARS_ONE, |
852 R_QTN_DRM_NBR_OF_YEARS_ONE_FINAL, |
854 R_QTN_DRM_NBR_OF_YEARS_ONE_FINAL, |
853 R_QTN_DRM_NBR_OF_YEARS_TWO_FOUR, |
855 R_QTN_DRM_NBR_OF_YEARS_TWO_FOUR, |
854 R_QTN_DRM_NBR_OF_YEARS_FIVE_ZERO, |
856 R_QTN_DRM_NBR_OF_YEARS_FIVE_ZERO, |
855 strings ); |
857 strings ); |
856 } |
858 numOfData++; |
857 else if ( aIntMon > 0 ) |
859 } |
|
860 |
|
861 if ( aIntMon > 0 ) |
858 { |
862 { |
859 // Second type not provided because 11 is the maximum |
863 // Second type not provided because 11 is the maximum |
860 AddSinglePartOfTimeL( aIntMon, |
864 AddSinglePartOfTimeL( aIntMon, |
861 R_QTN_DRM_NBR_OF_MONTHS_ONE, |
865 R_QTN_DRM_NBR_OF_MONTHS_ONE, |
862 0, |
866 0, |
863 R_QTN_DRM_NBR_OF_MONTHS_TWO_FOUR, |
867 R_QTN_DRM_NBR_OF_MONTHS_TWO_FOUR, |
864 R_QTN_DRM_NBR_OF_MONTHS_FIVE_ZERO, |
868 R_QTN_DRM_NBR_OF_MONTHS_FIVE_ZERO, |
865 strings ); |
869 strings ); |
866 } |
870 numOfData++; |
867 else if ( aIntDay > 0 ) |
871 } |
|
872 |
|
873 // Only if years or months were missing |
|
874 if ( aIntDay > 0 && numOfData < 2 ) |
868 { |
875 { |
869 AddSinglePartOfTimeL( aIntDay, |
876 AddSinglePartOfTimeL( aIntDay, |
870 R_QTN_DRM_NBR_OF_DAYS_ONE, |
877 R_QTN_DRM_NBR_OF_DAYS_ONE, |
871 R_QTN_DRM_NBR_OF_DAYS_ONE_FINAL, |
878 R_QTN_DRM_NBR_OF_DAYS_ONE_FINAL, |
872 R_QTN_DRM_NBR_OF_DAYS_TWO_FOUR, |
879 R_QTN_DRM_NBR_OF_DAYS_TWO_FOUR, |
873 R_QTN_DRM_NBR_OF_DAYS_FIVE_ZERO, |
880 R_QTN_DRM_NBR_OF_DAYS_FIVE_ZERO, |
874 strings ); |
881 strings ); |
875 } |
882 numOfData++; |
876 else if ( aIntHrs > 0 ) |
883 } |
|
884 |
|
885 if ( aIntHrs > 0 && numOfData < 2 ) |
877 { |
886 { |
878 AddSinglePartOfTimeL( aIntHrs, |
887 AddSinglePartOfTimeL( aIntHrs, |
879 R_QTN_DRM_NBR_OF_HOURS_ONE, |
888 R_QTN_DRM_NBR_OF_HOURS_ONE, |
880 R_QTN_DRM_NBR_OF_HOURS_ONE_FINAL, |
889 R_QTN_DRM_NBR_OF_HOURS_ONE_FINAL, |
881 R_QTN_DRM_NBR_OF_HOURS_TWO_FOUR, |
890 R_QTN_DRM_NBR_OF_HOURS_TWO_FOUR, |
882 R_QTN_DRM_NBR_OF_HOURS_FIVE_ZERO, |
891 R_QTN_DRM_NBR_OF_HOURS_FIVE_ZERO, |
883 strings ); |
892 strings ); |
884 } |
893 numOfData++; |
885 else if ( aIntMin > 0 ) |
894 } |
|
895 |
|
896 if ( aIntMin > 0 && numOfData < 2 ) |
886 { |
897 { |
887 AddSinglePartOfTimeL( aIntMin, |
898 AddSinglePartOfTimeL( aIntMin, |
888 R_QTN_DRM_NBR_OF_MINS_ONE, |
899 R_QTN_DRM_NBR_OF_MINS_ONE, |
889 R_QTN_DRM_NBR_OF_MINS_ONE_FINAL, |
900 R_QTN_DRM_NBR_OF_MINS_ONE_FINAL, |
890 R_QTN_DRM_NBR_OF_MINS_TWO_FOUR, |
901 R_QTN_DRM_NBR_OF_MINS_TWO_FOUR, |
891 R_QTN_DRM_NBR_OF_MINS_FIVE_ZERO, |
902 R_QTN_DRM_NBR_OF_MINS_FIVE_ZERO, |
892 strings ); |
903 strings ); |
893 } |
904 numOfData++; |
|
905 } |
|
906 |
894 // If interval is 0, then it shows "0 seconds" anyway |
907 // If interval is 0, then it shows "0 seconds" anyway |
895 else |
908 if ( ( aIntSec > 0 && numOfData < 2 ) || numOfData == 0 ) |
896 { |
909 { |
897 AddSinglePartOfTimeL( aIntSec, |
910 AddSinglePartOfTimeL( aIntSec, |
898 R_QTN_DRM_NBR_OF_SECS_ONE, |
911 R_QTN_DRM_NBR_OF_SECS_ONE, |
899 R_QTN_DRM_NBR_OF_SECS_ONE_FINAL, |
912 R_QTN_DRM_NBR_OF_SECS_ONE_FINAL, |
900 R_QTN_DRM_NBR_OF_SECS_TWO_FOUR, |
913 R_QTN_DRM_NBR_OF_SECS_TWO_FOUR, |
901 R_QTN_DRM_NBR_OF_SECS_FIVE_ZERO, |
914 R_QTN_DRM_NBR_OF_SECS_FIVE_ZERO, |
902 strings ); |
915 strings ); |
903 } |
916 numOfData++; |
904 |
917 } |
905 HBufC* stringHolder = StringLoader::LoadL( R_QTN_DRM_MGR_DET_INTER, |
918 |
|
919 HBufC* stringHolder; |
|
920 if ( numOfData == 1 ) |
|
921 { |
|
922 stringHolder = StringLoader::LoadL( R_QTN_DRM_MGR_DET_INTER, |
906 strings->MdcaPoint(0), iEikonEnv ); |
923 strings->MdcaPoint(0), iEikonEnv ); |
|
924 } |
|
925 else |
|
926 { |
|
927 stringHolder = StringLoader::LoadL( R_QTN_DRM_MGR_DET_INTER_TWO, |
|
928 *strings, iEikonEnv ); |
|
929 } |
|
930 |
907 CleanupStack::PopAndDestroy( strings ); |
931 CleanupStack::PopAndDestroy( strings ); |
908 |
932 |
909 return stringHolder; |
933 return stringHolder; |
910 } |
934 } |
911 |
935 |