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