wlansecuritysettings/wlaneapsettingsui/EapGtc/ConfigUi/src/EapGtcUiSettingArray.cpp
branchRCL_3
changeset 46 c74b3d9f6b9e
equal deleted inserted replaced
45:bad0cc58d154 46:c74b3d9f6b9e
       
     1 /*
       
     2 * Copyright (c) 2001-2009 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: Implementation of EAP GTC UI settings array
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 11 %
       
    20 */
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include "EapGtcUiSettingArray.h"
       
    24 #include "EapGtcUi.hrh"
       
    25 #include <aknsettingitemlist.h>
       
    26 #include <akntextsettingpage.h>
       
    27 
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS ===============================
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CEapGtcSettingItemArray::CEapGtcSettingItemArray
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CEapGtcSettingItemArray::CEapGtcSettingItemArray()
       
    36     {
       
    37     }
       
    38 
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CEapGtcSettingItemArray::NewL
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 CEapGtcSettingItemArray* CEapGtcSettingItemArray::NewL() 
       
    45     {
       
    46     CEapGtcSettingItemArray* self = new (ELeave) CEapGtcSettingItemArray();
       
    47     CleanupStack::PushL(self);
       
    48     self->ConstructL();
       
    49     CleanupStack::Pop( self ); 
       
    50     return self;
       
    51     }
       
    52 
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CEapGtcSettingItemArray::~CEapGtcSettingItemArray
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CEapGtcSettingItemArray::~CEapGtcSettingItemArray()
       
    59     {
       
    60     if( iArray ) 
       
    61         {
       
    62         // ResetAndDestroy()
       
    63         iArray->ResetAndDestroy();
       
    64         }    
       
    65     delete iArray;   
       
    66     iArray = NULL;
       
    67     }
       
    68 
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // CEapGtcSettingItemArray::Item
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 CAknSettingItem* CEapGtcSettingItemArray::Item( TEapGtcUiSettingPageIds aId )
       
    75     {
       
    76     for( TInt i = 0; i < iArray->Count(); i++ )
       
    77         {
       
    78         if( iArray->At( i )->Identifier() == aId )
       
    79             {
       
    80             return iArray->At( i );
       
    81             }
       
    82         }
       
    83 
       
    84     __ASSERT_DEBUG( EFalse, User::Invariant() );
       
    85     return NULL;
       
    86     }
       
    87 
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 // CEapGtcSettingItemArray::Array
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 CAknSettingItemArray* CEapGtcSettingItemArray::Array() 
       
    94     {
       
    95     return iArray;
       
    96     }
       
    97 
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // CEapGtcSettingItemArray::StoreSettingsL
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 void CEapGtcSettingItemArray::StoreSettingsL()
       
   104     {
       
   105     // Do what SettingItemList::StoreSettings would do. 
       
   106     for( TInt i(0); i < iArray->Count(); ++i )
       
   107         {
       
   108         iArray->At(i)->StoreL();
       
   109        }
       
   110     }
       
   111 
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // CEapGtcSettingItemArray::ConstructL
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 void CEapGtcSettingItemArray::ConstructL() 
       
   118     {
       
   119     iArray = new ( ELeave ) CAknSettingItemArray( 2, EFalse, 0 );
       
   120     }
       
   121 
       
   122 
       
   123 // -----------------------------------------------------------------------------
       
   124 // CEapGtcSettingItemArray::AddTextItemL
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 void CEapGtcSettingItemArray::AddTextItemL( TDes& aBuffer, 
       
   128                                             TInt aId, 
       
   129                                             TInt aTitleResource, 
       
   130                                             TInt aSettingPageResource,
       
   131                                             TInt aAssociatedResource, 
       
   132                                             TInt aOrdinal)
       
   133     {
       
   134     // Create new setting item
       
   135     CAknTextSettingItem* settingItem = new ( ELeave ) CAknTextSettingItem( aId,
       
   136                                                                     aBuffer );
       
   137     CleanupStack::PushL( settingItem );
       
   138     settingItem->SetEmptyItemTextL( KNullDesC );
       
   139     settingItem->SetSettingPageFlags( 
       
   140                                     CAknTextSettingPage::EZeroLengthAllowed );
       
   141 
       
   142     // Construct setting item with parametrized values
       
   143     HBufC* itemTitle = CEikonEnv::Static()->AllocReadResourceLC( 
       
   144                                                             aTitleResource );
       
   145     settingItem->ConstructL( EFalse, aOrdinal, *itemTitle, NULL, 
       
   146                              aSettingPageResource, EAknCtPopupSettingList,
       
   147                              NULL, aAssociatedResource );
       
   148     
       
   149     // Append item to settingitem-array
       
   150     iArray->InsertL( aOrdinal, settingItem );
       
   151     
       
   152     CleanupStack::PopAndDestroy( itemTitle );
       
   153 
       
   154     // Items are destroyed in destructor when resetting array
       
   155     CleanupStack::Pop( settingItem ); 
       
   156     }
       
   157 
       
   158 
       
   159 //  End of File