videofeeds/vcnsscheduleview/src/CVcxNsScheduleSettingsDlConditionItem.cpp
changeset 0 96612d01cf9f
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2007 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:    Video on Demand setting item class for download condition*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDES
       
    21 #include <StringLoader.h>
       
    22 #include <vcxnsscheduleview.rsg>
       
    23 
       
    24 #include "vcxnsservicesettings.h"
       
    25 #include "CVcxNsScheduleSettingsDlConditionItem.h"
       
    26 
       
    27 // CONSTANTS
       
    28 const TInt KEnumTextArraySize = 4;
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // Constructor
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CVcxNsScheduleSettingsDlConditionItem::CVcxNsScheduleSettingsDlConditionItem(
       
    35         TInt aResourceId, 
       
    36         TInt& aValue,
       
    37         TBool aWlanSupported )
       
    38     : CAknEnumeratedTextPopupSettingItem( aResourceId, aValue ), 
       
    39       iWlanSupported(aWlanSupported)
       
    40     {
       
    41     
       
    42     }
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // Destructor
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 CVcxNsScheduleSettingsDlConditionItem::~CVcxNsScheduleSettingsDlConditionItem()
       
    49     {
       
    50 
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CVcxNsScheduleSettingsDlConditionItem::CompleteConstructionL
       
    55 // -----------------------------------------------------------------------------
       
    56 //    
       
    57 void CVcxNsScheduleSettingsDlConditionItem::CompleteConstructionL()
       
    58     {
       
    59     CAknEnumeratedTextPopupSettingItem::CompleteConstructionL();    
       
    60     
       
    61     // Note: More elegant way of creating the setting item would be
       
    62     // reading enumerated text items from resource file and dynamically
       
    63     // remove the WLAN-item if necessary.
       
    64     // 
       
    65     // Current implementation creates just empty array from resource file
       
    66     // and text items are dynamically added to text array.
       
    67    
       
    68     CArrayPtrFlat<CAknEnumeratedText>* enumTextArray =
       
    69         new (ELeave) CArrayPtrFlat<CAknEnumeratedText>( KEnumTextArraySize );
       
    70     CleanupStack::PushL( enumTextArray );
       
    71         
       
    72     CArrayPtr<HBufC>* popupTextArray = 
       
    73         new (ELeave) CArrayPtrFlat<HBufC>( KEnumTextArraySize );
       
    74     CleanupStack::PushL( popupTextArray );
       
    75     
       
    76     HBufC* manualConditionString = 
       
    77         StringLoader::LoadLC( R_VCXNS_SCHEDULE_MANUAL_DOWNLOAD );
       
    78     HBufC* autohomeConditionString = 
       
    79         StringLoader::LoadLC( R_VCXNS_SCHEDULE_AUTO_HOME_CELL );
       
    80     HBufC* autoalwaysConditionString = 
       
    81         StringLoader::LoadLC( R_VCXNS_SCHEDULE_AUTO_ALWAYS );
       
    82     HBufC* wlanConditionString = NULL;
       
    83     if ( iWlanSupported )
       
    84         {    
       
    85         wlanConditionString = StringLoader::LoadLC( R_VCXNS_SCHEDULE_AUTO_WLAN );
       
    86         }
       
    87                   
       
    88     CAknEnumeratedText* enumeratedText1 = new (ELeave) CAknEnumeratedText(
       
    89             EManual,
       
    90             manualConditionString);
       
    91     CleanupStack::PushL( enumeratedText1 );
       
    92     enumTextArray->AppendL( enumeratedText1 );
       
    93     CleanupStack::Pop( enumeratedText1 );
       
    94     
       
    95     if ( iWlanSupported ) 
       
    96         {  
       
    97         CAknEnumeratedText* enumeratedText2 = new (ELeave) CAknEnumeratedText(
       
    98                 EWLAN,
       
    99                 wlanConditionString);
       
   100         CleanupStack::PushL( enumeratedText2 );
       
   101         enumTextArray->AppendL( enumeratedText2 );
       
   102         CleanupStack::Pop( enumeratedText2 );
       
   103         }
       
   104 
       
   105     CAknEnumeratedText* enumeratedText3 = new (ELeave) CAknEnumeratedText(
       
   106             EHomeCellular,
       
   107             autohomeConditionString);
       
   108     CleanupStack::PushL( enumeratedText3 );
       
   109     enumTextArray->AppendL( enumeratedText3 );
       
   110     CleanupStack::Pop( enumeratedText3 );
       
   111 
       
   112     CAknEnumeratedText* enumeratedText4 = new (ELeave) CAknEnumeratedText(
       
   113             EAlways,
       
   114             autoalwaysConditionString);
       
   115     CleanupStack::PushL( enumeratedText4 );
       
   116     enumTextArray->AppendL( enumeratedText4 );
       
   117     CleanupStack::Pop( enumeratedText4 );
       
   118         
       
   119     SetEnumeratedTextArrays( enumTextArray, popupTextArray );
       
   120     HandleTextArrayUpdateL(); 
       
   121   
       
   122     if ( iWlanSupported )
       
   123         {
       
   124         CleanupStack::Pop( wlanConditionString );
       
   125         }
       
   126     CleanupStack::Pop( autoalwaysConditionString );
       
   127     CleanupStack::Pop( autohomeConditionString );
       
   128     CleanupStack::Pop( manualConditionString );
       
   129     CleanupStack::Pop( popupTextArray );
       
   130     CleanupStack::Pop( enumTextArray );
       
   131     }
       
   132 
       
   133 // End of file