commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsContainer.cpp
branchRCL_3
changeset 27 1481bf457703
parent 26 1221b68b8a5f
equal deleted inserted replaced
26:1221b68b8a5f 27:1481bf457703
     1 /*
     1 /*
     2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   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     // Only the two most meaningful data will be showed
   844     
   845     TInt numOfData = 0;
   845     CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( 1 );
   846 
       
   847     CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( 2 );
       
   848     CleanupStack::PushL( strings );
   846     CleanupStack::PushL( strings );
   849 
   847 
   850     if ( aIntYrs > 0 )
   848     if ( aIntYrs > 0 )
   851         {
   849         {
   852         AddSinglePartOfTimeL( aIntYrs,
   850         AddSinglePartOfTimeL( aIntYrs,
   853                               R_QTN_DRM_NBR_OF_YEARS_ONE,
   851                               R_QTN_DRM_NBR_OF_YEARS_ONE,
   854                               R_QTN_DRM_NBR_OF_YEARS_ONE_FINAL,
   852                               R_QTN_DRM_NBR_OF_YEARS_ONE_FINAL,
   855                               R_QTN_DRM_NBR_OF_YEARS_TWO_FOUR,
   853                               R_QTN_DRM_NBR_OF_YEARS_TWO_FOUR,
   856                               R_QTN_DRM_NBR_OF_YEARS_FIVE_ZERO,
   854                               R_QTN_DRM_NBR_OF_YEARS_FIVE_ZERO,
   857                               strings );
   855                               strings );
   858         numOfData++;
   856         }
   859         }
   857     else if ( aIntMon > 0 )
   860 
       
   861     if ( aIntMon > 0 )
       
   862         {
   858         {
   863         //  Second type not provided because 11 is the maximum
   859         //  Second type not provided because 11 is the maximum
   864         AddSinglePartOfTimeL( aIntMon,
   860         AddSinglePartOfTimeL( aIntMon,
   865                               R_QTN_DRM_NBR_OF_MONTHS_ONE,
   861                               R_QTN_DRM_NBR_OF_MONTHS_ONE,
   866                               0,
   862                               0,
   867                               R_QTN_DRM_NBR_OF_MONTHS_TWO_FOUR,
   863                               R_QTN_DRM_NBR_OF_MONTHS_TWO_FOUR,
   868                               R_QTN_DRM_NBR_OF_MONTHS_FIVE_ZERO,
   864                               R_QTN_DRM_NBR_OF_MONTHS_FIVE_ZERO,
   869                               strings );
   865                               strings );
   870         numOfData++;
   866         }
   871         }
   867     else if ( aIntDay > 0 )
   872 
       
   873     // Only if years or months were missing
       
   874     if ( aIntDay > 0 && numOfData < 2 )
       
   875         {
   868         {
   876         AddSinglePartOfTimeL( aIntDay,
   869         AddSinglePartOfTimeL( aIntDay,
   877                               R_QTN_DRM_NBR_OF_DAYS_ONE,
   870                               R_QTN_DRM_NBR_OF_DAYS_ONE,
   878                               R_QTN_DRM_NBR_OF_DAYS_ONE_FINAL,
   871                               R_QTN_DRM_NBR_OF_DAYS_ONE_FINAL,
   879                               R_QTN_DRM_NBR_OF_DAYS_TWO_FOUR,
   872                               R_QTN_DRM_NBR_OF_DAYS_TWO_FOUR,
   880                               R_QTN_DRM_NBR_OF_DAYS_FIVE_ZERO,
   873                               R_QTN_DRM_NBR_OF_DAYS_FIVE_ZERO,
   881                               strings );
   874                               strings );
   882         numOfData++;
   875         }
   883         }
   876     else if ( aIntHrs > 0 )
   884 
       
   885     if ( aIntHrs > 0 && numOfData < 2 )
       
   886         {
   877         {
   887         AddSinglePartOfTimeL( aIntHrs,
   878         AddSinglePartOfTimeL( aIntHrs,
   888                               R_QTN_DRM_NBR_OF_HOURS_ONE,
   879                               R_QTN_DRM_NBR_OF_HOURS_ONE,
   889                               R_QTN_DRM_NBR_OF_HOURS_ONE_FINAL,
   880                               R_QTN_DRM_NBR_OF_HOURS_ONE_FINAL,
   890                               R_QTN_DRM_NBR_OF_HOURS_TWO_FOUR,
   881                               R_QTN_DRM_NBR_OF_HOURS_TWO_FOUR,
   891                               R_QTN_DRM_NBR_OF_HOURS_FIVE_ZERO,
   882                               R_QTN_DRM_NBR_OF_HOURS_FIVE_ZERO,
   892                               strings );
   883                               strings );
   893         numOfData++;
   884         }
   894         }
   885     else if ( aIntMin > 0 )
   895 
       
   896     if ( aIntMin > 0 && numOfData < 2 )
       
   897         {
   886         {
   898         AddSinglePartOfTimeL( aIntMin,
   887         AddSinglePartOfTimeL( aIntMin,
   899                               R_QTN_DRM_NBR_OF_MINS_ONE,
   888                               R_QTN_DRM_NBR_OF_MINS_ONE,
   900                               R_QTN_DRM_NBR_OF_MINS_ONE_FINAL,
   889                               R_QTN_DRM_NBR_OF_MINS_ONE_FINAL,
   901                               R_QTN_DRM_NBR_OF_MINS_TWO_FOUR,
   890                               R_QTN_DRM_NBR_OF_MINS_TWO_FOUR,
   902                               R_QTN_DRM_NBR_OF_MINS_FIVE_ZERO,
   891                               R_QTN_DRM_NBR_OF_MINS_FIVE_ZERO,
   903                               strings );
   892                               strings );
   904         numOfData++;
   893         }
   905         }
       
   906 
       
   907     // If interval is 0, then it shows "0 seconds" anyway
   894     // If interval is 0, then it shows "0 seconds" anyway
   908     if ( ( aIntSec > 0 && numOfData < 2 ) || numOfData == 0 )
   895     else
   909         {
   896         {
   910         AddSinglePartOfTimeL( aIntSec,
   897         AddSinglePartOfTimeL( aIntSec,
   911                               R_QTN_DRM_NBR_OF_SECS_ONE,
   898                               R_QTN_DRM_NBR_OF_SECS_ONE,
   912                               R_QTN_DRM_NBR_OF_SECS_ONE_FINAL,
   899                               R_QTN_DRM_NBR_OF_SECS_ONE_FINAL,
   913                               R_QTN_DRM_NBR_OF_SECS_TWO_FOUR,
   900                               R_QTN_DRM_NBR_OF_SECS_TWO_FOUR,
   914                               R_QTN_DRM_NBR_OF_SECS_FIVE_ZERO,
   901                               R_QTN_DRM_NBR_OF_SECS_FIVE_ZERO,
   915                               strings );
   902                               strings );
   916         numOfData++;
   903         }
   917         }
   904 
   918 
   905     HBufC* stringHolder = StringLoader::LoadL( R_QTN_DRM_MGR_DET_INTER,
   919     HBufC* stringHolder;
       
   920     if ( numOfData == 1 )
       
   921         {
       
   922         stringHolder = StringLoader::LoadL( R_QTN_DRM_MGR_DET_INTER,
       
   923                                             strings->MdcaPoint(0), iEikonEnv );
   906                                             strings->MdcaPoint(0), iEikonEnv );
   924         }
       
   925     else
       
   926         {
       
   927         stringHolder = StringLoader::LoadL( R_QTN_DRM_MGR_DET_INTER_TWO,
       
   928                                             *strings, iEikonEnv );
       
   929         }
       
   930 
       
   931     CleanupStack::PopAndDestroy( strings );
   907     CleanupStack::PopAndDestroy( strings );
   932 
   908 
   933     return stringHolder;
   909     return stringHolder;
   934     }
   910     }
   935 
   911