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 AKA UI settings array |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 11 % |
|
20 */ |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include "EapAkaUiSettingArray.h" |
|
24 #include "EapAkaUi.hrh" |
|
25 #include <aknsettingitemlist.h> |
|
26 #include <akntextsettingpage.h> |
|
27 |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS =============================== |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // CEapAkaSettingItemArray::CEapAkaSettingItemArray |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 CEapAkaSettingItemArray::CEapAkaSettingItemArray() |
|
36 { |
|
37 } |
|
38 |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // CEapAkaSettingItemArray::NewL |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 CEapAkaSettingItemArray* CEapAkaSettingItemArray::NewL() |
|
45 { |
|
46 CEapAkaSettingItemArray* self = new( ELeave ) CEapAkaSettingItemArray(); |
|
47 CleanupStack::PushL( self ); |
|
48 self->ConstructL(); |
|
49 CleanupStack::Pop( self ); |
|
50 return self; |
|
51 } |
|
52 |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CEapAkaSettingItemArray::~CEapAkaSettingItemArray |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CEapAkaSettingItemArray::~CEapAkaSettingItemArray() |
|
59 { |
|
60 if( iArray ) |
|
61 { |
|
62 // ResetAndDestroy() |
|
63 iArray->ResetAndDestroy(); |
|
64 } |
|
65 delete iArray; |
|
66 iArray = NULL; |
|
67 } |
|
68 |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CEapAkaSettingItemArray::Item |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 CAknSettingItem* CEapAkaSettingItemArray::Item( TEapAkaUiSettingPageIds 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 // CEapAkaSettingItemArray::Array |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 CAknSettingItemArray* CEapAkaSettingItemArray::Array() |
|
94 { |
|
95 return iArray; |
|
96 } |
|
97 |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CEapAkaSettingItemArray::StoreSettingsL |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 void CEapAkaSettingItemArray::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 // CEapAkaSettingItemArray::ConstructL |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 void CEapAkaSettingItemArray::ConstructL() |
|
118 { |
|
119 iArray = new( ELeave ) CAknSettingItemArray( 2, EFalse, 0 ); |
|
120 } |
|
121 |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // CEapAkaSettingItemArray::AddTextItemL |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 void CEapAkaSettingItemArray::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 // ----------------------------------------------------------------------------- |
|
160 // CEapAkaSettingItemArray::AddBinarySettingItemL |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 void CEapAkaSettingItemArray::AddBinarySettingItemL( |
|
164 TInt aSettingPageResourceId, |
|
165 TInt aTitleResourceId, |
|
166 TInt aAssociatedResourceId, |
|
167 TInt aOrdinal, |
|
168 TBool& aModifiedValue ) |
|
169 { |
|
170 CAknSettingItem* settingItem = new ( ELeave ) |
|
171 CAknBinaryPopupSettingItem( 0, aModifiedValue ); |
|
172 CleanupStack::PushL( settingItem ); |
|
173 HBufC* itemTitle = CEikonEnv::Static()->AllocReadResourceLC( |
|
174 aTitleResourceId ); |
|
175 settingItem->ConstructL( EFalse, aOrdinal, *itemTitle, NULL, |
|
176 aSettingPageResourceId, EAknCtPopupSettingList, |
|
177 NULL, aAssociatedResourceId ); |
|
178 |
|
179 iArray->AppendL( settingItem ); |
|
180 CleanupStack::PopAndDestroy( itemTitle ); |
|
181 CleanupStack::Pop( settingItem ); |
|
182 } |
|
183 |
|
184 |
|
185 // End of File |
|