commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsContainer.cpp
branchRCL_3
changeset 17 e16d72588c28
parent 0 95b198f216e5
child 18 8a03a285ab14
equal deleted inserted replaced
9:89a1f2bd800d 17:e16d72588c28
     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     // Only the first meaningful data will be shown
   845     TInt numOfData = 0;
   845     TInt numOfData = 0;
   846 
   846 
   847     CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( 2 );
   847     CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( 1 );
   848     CleanupStack::PushL( strings );
   848     CleanupStack::PushL( strings );
   849 
   849 
   850     if ( aIntYrs > 0 )
   850     if ( aIntYrs > 0 )
   851         {
   851         {
   852         AddSinglePartOfTimeL( aIntYrs,
   852         AddSinglePartOfTimeL( aIntYrs,
   853                               R_QTN_DRM_NBR_OF_YEARS_ONE,
   853                               R_QTN_DRM_NBR_OF_YEARS_ONE,
   854                               R_QTN_DRM_NBR_OF_YEARS_ONE_FINAL,
   854                               R_QTN_DRM_NBR_OF_YEARS_ONE_FINAL,
   855                               R_QTN_DRM_NBR_OF_YEARS_TWO_FOUR,
   855                               R_QTN_DRM_NBR_OF_YEARS_TWO_FOUR,
   856                               R_QTN_DRM_NBR_OF_YEARS_FIVE_ZERO,
   856                               R_QTN_DRM_NBR_OF_YEARS_FIVE_ZERO,
   857                               strings );
   857                               strings );
   858         numOfData++;
   858         }
   859         }
   859     else if ( aIntMon > 0 )
   860 
       
   861     if ( aIntMon > 0 )
       
   862         {
   860         {
   863         //  Second type not provided because 11 is the maximum
   861         //  Second type not provided because 11 is the maximum
   864         AddSinglePartOfTimeL( aIntMon,
   862         AddSinglePartOfTimeL( aIntMon,
   865                               R_QTN_DRM_NBR_OF_MONTHS_ONE,
   863                               R_QTN_DRM_NBR_OF_MONTHS_ONE,
   866                               0,
   864                               0,
   867                               R_QTN_DRM_NBR_OF_MONTHS_TWO_FOUR,
   865                               R_QTN_DRM_NBR_OF_MONTHS_TWO_FOUR,
   868                               R_QTN_DRM_NBR_OF_MONTHS_FIVE_ZERO,
   866                               R_QTN_DRM_NBR_OF_MONTHS_FIVE_ZERO,
   869                               strings );
   867                               strings );
   870         numOfData++;
   868         }
   871         }
   869     else if ( aIntDay > 0 )
   872 
       
   873     // Only if years or months were missing
       
   874     if ( aIntDay > 0 && numOfData < 2 )
       
   875         {
   870         {
   876         AddSinglePartOfTimeL( aIntDay,
   871         AddSinglePartOfTimeL( aIntDay,
   877                               R_QTN_DRM_NBR_OF_DAYS_ONE,
   872                               R_QTN_DRM_NBR_OF_DAYS_ONE,
   878                               R_QTN_DRM_NBR_OF_DAYS_ONE_FINAL,
   873                               R_QTN_DRM_NBR_OF_DAYS_ONE_FINAL,
   879                               R_QTN_DRM_NBR_OF_DAYS_TWO_FOUR,
   874                               R_QTN_DRM_NBR_OF_DAYS_TWO_FOUR,
   880                               R_QTN_DRM_NBR_OF_DAYS_FIVE_ZERO,
   875                               R_QTN_DRM_NBR_OF_DAYS_FIVE_ZERO,
   881                               strings );
   876                               strings );
   882         numOfData++;
   877         }
   883         }
   878     else if ( aIntHrs > 0 )
   884 
       
   885     if ( aIntHrs > 0 && numOfData < 2 )
       
   886         {
   879         {
   887         AddSinglePartOfTimeL( aIntHrs,
   880         AddSinglePartOfTimeL( aIntHrs,
   888                               R_QTN_DRM_NBR_OF_HOURS_ONE,
   881                               R_QTN_DRM_NBR_OF_HOURS_ONE,
   889                               R_QTN_DRM_NBR_OF_HOURS_ONE_FINAL,
   882                               R_QTN_DRM_NBR_OF_HOURS_ONE_FINAL,
   890                               R_QTN_DRM_NBR_OF_HOURS_TWO_FOUR,
   883                               R_QTN_DRM_NBR_OF_HOURS_TWO_FOUR,
   891                               R_QTN_DRM_NBR_OF_HOURS_FIVE_ZERO,
   884                               R_QTN_DRM_NBR_OF_HOURS_FIVE_ZERO,
   892                               strings );
   885                               strings );
   893         numOfData++;
   886         }
   894         }
   887     else if ( aIntMin > 0 )
   895 
       
   896     if ( aIntMin > 0 && numOfData < 2 )
       
   897         {
   888         {
   898         AddSinglePartOfTimeL( aIntMin,
   889         AddSinglePartOfTimeL( aIntMin,
   899                               R_QTN_DRM_NBR_OF_MINS_ONE,
   890                               R_QTN_DRM_NBR_OF_MINS_ONE,
   900                               R_QTN_DRM_NBR_OF_MINS_ONE_FINAL,
   891                               R_QTN_DRM_NBR_OF_MINS_ONE_FINAL,
   901                               R_QTN_DRM_NBR_OF_MINS_TWO_FOUR,
   892                               R_QTN_DRM_NBR_OF_MINS_TWO_FOUR,
   902                               R_QTN_DRM_NBR_OF_MINS_FIVE_ZERO,
   893                               R_QTN_DRM_NBR_OF_MINS_FIVE_ZERO,
   903                               strings );
   894                               strings );
   904         numOfData++;
   895         }
   905         }
       
   906 
       
   907     // If interval is 0, then it shows "0 seconds" anyway
   896     // If interval is 0, then it shows "0 seconds" anyway
   908     if ( ( aIntSec > 0 && numOfData < 2 ) || numOfData == 0 )
   897     else
   909         {
   898         {
   910         AddSinglePartOfTimeL( aIntSec,
   899         AddSinglePartOfTimeL( aIntSec,
   911                               R_QTN_DRM_NBR_OF_SECS_ONE,
   900                               R_QTN_DRM_NBR_OF_SECS_ONE,
   912                               R_QTN_DRM_NBR_OF_SECS_ONE_FINAL,
   901                               R_QTN_DRM_NBR_OF_SECS_ONE_FINAL,
   913                               R_QTN_DRM_NBR_OF_SECS_TWO_FOUR,
   902                               R_QTN_DRM_NBR_OF_SECS_TWO_FOUR,
   914                               R_QTN_DRM_NBR_OF_SECS_FIVE_ZERO,
   903                               R_QTN_DRM_NBR_OF_SECS_FIVE_ZERO,
   915                               strings );
   904                               strings );
   916         numOfData++;
   905         }
   917         }
   906 
   918 
   907     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 );
   908                                             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 );
   909     CleanupStack::PopAndDestroy( strings );
   932 
   910 
   933     return stringHolder;
   911     return stringHolder;
   934     }
   912     }
   935 
   913