videocollection/hgmyvideos/src/vcxhgmyvideosindicatorhelper.cpp
changeset 0 96612d01cf9f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   TVcxHgMyVideosIndicatorHelper implementation*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <AknsUtils.h>
       
    22 #include <AknIconUtils.h>
       
    23 #include <ganes/HgItem.h>
       
    24 #include "CIptvDriveMonitor.h"
       
    25 #include <vcxhgmyvideos.mbg>
       
    26 #include "vcxhgmyvideosmainview.h"
       
    27 #include "vcxhgmyvideosmodel.h"
       
    28 #include "vcxhgmyvideosindicatorhelper.h"
       
    29 
       
    30 // ============================ MEMBER FUNCTIONS ===============================
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 TVcxHgMyVideosIndicatorHelper::TVcxHgMyVideosIndicatorHelper()
       
    37     {
       
    38     // No implementation needed.
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 TVcxHgMyVideosIndicatorHelper::~TVcxHgMyVideosIndicatorHelper()
       
    46     {
       
    47     // No implementation needed.
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // Sorts indicators to correct location based on indicator priorities, caller
       
    52 // supplies all the necessary data for knowing which indicators to show. 
       
    53 // -----------------------------------------------------------------------------
       
    54 //
       
    55 void TVcxHgMyVideosIndicatorHelper::GetIndicatorsForVideoL( CVcxHgMyVideosModel& aModel,
       
    56                                                             TBool aNewVideo,
       
    57                                                             TBool /*aRecordingOngoing*/,
       
    58                                                             const TDesC& aPath,
       
    59                                                             TIndicatorDrmStatus aDrmStatus,
       
    60                                                             TInt& aIndicator1,
       
    61                                                             TInt& aIndicator2 )
       
    62     {
       
    63     RArray<TInt> indicators;
       
    64 
       
    65     if ( aNewVideo )
       
    66         {
       
    67         indicators.AppendL( CHgItem::EHgItemFlagsNewVideoIndicator );
       
    68         }
       
    69 
       
    70     if ( aPath.Length() > 0 )
       
    71         {
       
    72         TInt drive = 0;
       
    73 
       
    74         if ( aModel.FileServerSessionL().CharToDrive( aPath[0], drive ) == KErrNone )
       
    75             {
       
    76             if ( drive == aModel.DriveMonitorL().SystemDrive() )
       
    77                 {
       
    78                 indicators.AppendL( CHgItem::EHgItemFlagsPhoneStorageIndicator );
       
    79                 }
       
    80             else if ( aModel.DriveMonitorL().IsMemoryCardDriveL( drive ) )
       
    81                 {
       
    82                 indicators.AppendL( CHgItem::EHgItemFlagsMmc );
       
    83                 }
       
    84             else
       
    85                 {           
       
    86                 indicators.AppendL( CHgItem::EHgItemFlagsMassStorageIndicator );
       
    87                 }
       
    88             }
       
    89         }
       
    90 
       
    91     if ( aDrmStatus == EIndicatorDrmStatusValid )
       
    92         {
       
    93         indicators.AppendL( CHgItem::EHgItemFlagsDrmRightsValid );
       
    94         }
       
    95     else if ( aDrmStatus == EIndicatorDrmStatusExpired )
       
    96         {
       
    97         indicators.AppendL( CHgItem::EHgItemFlagsDrmRightsExpired );
       
    98         }
       
    99 
       
   100     if ( indicators.Count() >= 2 )
       
   101         {
       
   102         aIndicator1 = indicators[1];
       
   103         aIndicator2 = indicators[0];
       
   104         }
       
   105     else if ( indicators.Count() == 1 )
       
   106         {
       
   107         aIndicator1 = indicators[0];
       
   108         }
       
   109 
       
   110     indicators.Reset();
       
   111     }