|
1 /* |
|
2 * Copyright (c) 2005 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 "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: Container for the Data sub-folder |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "GSDataCallPluginContainer.h" |
|
21 #include "GSDataCallPluginModel.h" |
|
22 #include "GsDataCallPlugin.hrh" |
|
23 |
|
24 #include <bldvariant.hrh> |
|
25 #include <GsDataCallPluginRsc.rsg> |
|
26 #include <aknlists.h> |
|
27 #include <StringLoader.h> |
|
28 #include <AknUtils.h> |
|
29 #include <conset.hlp.hrh> |
|
30 #include <gsfwviewuids.h> |
|
31 #include <gslistbox.h> |
|
32 |
|
33 // ========================= MEMBER FUNCTIONS ================================ |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // CGSDataCallPluginContainer::ConstructL() |
|
37 // |
|
38 // Symbian OS two phased constructor |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 void CGSDataCallPluginContainer::ConstructL( const TRect& aRect ) |
|
42 { |
|
43 iListBox = new( ELeave ) CAknSettingStyleListBox; |
|
44 |
|
45 BaseConstructL( aRect, R_GS_CSD_VIEW_TITLE, R_DCALL_LBX ); |
|
46 } |
|
47 |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // CGSDataCallPluginContainer::~CGSDataCallPluginContainer() |
|
51 // |
|
52 // Destructor |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 CGSDataCallPluginContainer::~CGSDataCallPluginContainer() |
|
56 { |
|
57 delete iAutodisconValue; |
|
58 delete iListboxItemArray; |
|
59 } |
|
60 |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // CGSDataCallPluginContainer::ConstructListBoxL() |
|
64 // |
|
65 // Construct the listbox from resource array. |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 void CGSDataCallPluginContainer::ConstructListBoxL( TInt aResLbxId ) |
|
69 { |
|
70 iListBox->ConstructL( this, EAknListBoxSelectionList ); |
|
71 |
|
72 iListboxItemArray = CGSListBoxItemTextArray::NewL( aResLbxId, |
|
73 *iListBox, *iCoeEnv ); |
|
74 iListBox->Model()->SetItemTextArray( iListboxItemArray ); |
|
75 iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
76 |
|
77 |
|
78 CreateListBoxItemsL(); |
|
79 } |
|
80 |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // CGSDataCallPluginContainer::CreateListBoxItemsL() |
|
84 // |
|
85 // Create listbox items. |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 void CGSDataCallPluginContainer::CreateListBoxItemsL() |
|
89 { |
|
90 MakeAutodisconItemL(); |
|
91 } |
|
92 |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // CGSDataCallPluginContainer::UpdateListBoxL() |
|
96 // |
|
97 // Update listbox item. |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 void CGSDataCallPluginContainer::UpdateListBoxL( TInt aFeatureId ) |
|
101 { |
|
102 switch( aFeatureId ) |
|
103 { |
|
104 case KGSSettIdAutodiscon: |
|
105 MakeAutodisconItemL(); |
|
106 break; |
|
107 default: |
|
108 break; |
|
109 } |
|
110 |
|
111 iListBox->HandleItemAdditionL(); |
|
112 } |
|
113 |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // CGSDataCallPluginContainer::MakeAutodisconItemL() |
|
117 // |
|
118 // Create auto disconnect list item |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 void CGSDataCallPluginContainer::MakeAutodisconItemL() |
|
122 { |
|
123 CGSDataCallPluginModel* model = CGSDataCallPluginModel::NewL(); |
|
124 |
|
125 TInt time = model->AutodisconnectTimeL(); |
|
126 delete model; |
|
127 |
|
128 HBufC* buf = NULL; |
|
129 |
|
130 switch( time ) |
|
131 { |
|
132 case KGSTimeUnlimited: |
|
133 buf = iEikonEnv->AllocReadResourceL( R_AUTODISCON_VALUE_NO ); |
|
134 break; |
|
135 case KGSOneMinute: |
|
136 { |
|
137 buf = iEikonEnv->AllocReadResourceL( R_AUTODISCON_VALUE_1MIN ); |
|
138 // for A&H number conversion |
|
139 TPtr bufPtr( buf->Des() ); |
|
140 if( AknTextUtils::DigitModeQuery( |
|
141 AknTextUtils::EDigitModeShownToUser ) ) |
|
142 { |
|
143 AknTextUtils::LanguageSpecificNumberConversion( bufPtr ); |
|
144 } |
|
145 } |
|
146 break; |
|
147 default: |
|
148 buf = StringLoader::LoadL( R_AUTODISCON_VALUE_MIN, |
|
149 time, iEikonEnv ); |
|
150 break; |
|
151 } |
|
152 |
|
153 TPtr bufPtr( buf->Des() ); |
|
154 iListboxItemArray->SetDynamicTextL( KGSSettIdAutodiscon, bufPtr ); |
|
155 |
|
156 // And add to listbox |
|
157 iListboxItemArray->SetItemVisibilityL( KGSSettIdAutodiscon, |
|
158 CGSListBoxItemTextArray::EVisible ); |
|
159 |
|
160 |
|
161 delete buf; |
|
162 } |
|
163 |
|
164 |
|
165 // --------------------------------------------------------------------------- |
|
166 // CGSDataCallPluginContainer::GetHelpContext() const |
|
167 // |
|
168 // Gets Help |
|
169 // --------------------------------------------------------------------------- |
|
170 // |
|
171 void CGSDataCallPluginContainer::GetHelpContext( |
|
172 TCoeHelpContext& aContext ) const |
|
173 { |
|
174 aContext.iMajor = KUidGS; |
|
175 aContext.iContext = KSET_HLP_CONNEC_DATA; |
|
176 } |
|
177 |
|
178 |
|
179 // --------------------------------------------------------------------------- |
|
180 // CGSDataCallPluginContainer::CurrentFeatureId() |
|
181 // |
|
182 // Return the feature id of selected listitem |
|
183 // --------------------------------------------------------------------------- |
|
184 // |
|
185 TInt CGSDataCallPluginContainer::CurrentFeatureId( ) const |
|
186 { |
|
187 return iListboxItemArray->CurrentFeature( ); |
|
188 } |
|
189 |
|
190 |
|
191 // End of File |