66 iBuffer = NULL; |
66 iBuffer = NULL; |
67 |
67 |
68 delete iServerDetailTitle; |
68 delete iServerDetailTitle; |
69 iServerDetailTitle = NULL; |
69 iServerDetailTitle = NULL; |
70 |
70 |
|
71 delete iSuplUsageTitle; |
|
72 iSuplUsageTitle = NULL; |
71 |
73 |
72 delete iSuplServerDetail; |
74 delete iSuplServerDetail; |
73 iSuplServerDetail = NULL; |
75 iSuplServerDetail = NULL; |
74 |
76 |
|
77 delete iDefaultSuplUsage; |
|
78 iDefaultSuplUsage = NULL; |
75 DEBUG( - CLocSUPLSettingsLBModel::~CLocSUPLSettingsLBModel ); |
79 DEBUG( - CLocSUPLSettingsLBModel::~CLocSUPLSettingsLBModel ); |
76 } |
80 } |
77 |
81 |
78 // --------------------------------------------------------------------------- |
82 // --------------------------------------------------------------------------- |
79 // CLocSUPLSettingsLBModel* CLocSUPLSettingsLBModel::NewL |
83 // CLocSUPLSettingsLBModel* CLocSUPLSettingsLBModel::NewL |
142 iSuplServerDetail = HBufC16::NewL( KDefaultServerIPAddress().Length() ); |
146 iSuplServerDetail = HBufC16::NewL( KDefaultServerIPAddress().Length() ); |
143 TPtr16 ptr( iSuplServerDetail->Des() ); |
147 TPtr16 ptr( iSuplServerDetail->Des() ); |
144 ptr.Copy( KDefaultServerIPAddress ); |
148 ptr.Copy( KDefaultServerIPAddress ); |
145 } |
149 } |
146 |
150 |
147 |
151 // Reinitializing the flag value |
|
152 flagValue = 0; |
|
153 TRAPD( error, repository = CRepository::NewL( KCRUidOMASuplConfiguration ) ); |
|
154 if ( !error ) |
|
155 { |
|
156 error = repository->Get( KOMASuplConfigurationSuplPermissionQueryUsage, flagValue ); |
|
157 if ( error || flagValue < 0 ) |
|
158 { |
|
159 flagValue = 0; |
|
160 } |
|
161 delete repository; |
|
162 repository = NULL; |
|
163 } |
|
164 |
|
165 // Check for SUPL Setting usage variationing. |
|
166 if( flagValue ) |
|
167 { |
|
168 iSuplUsagePresent = ETrue; |
|
169 |
|
170 // Allocate and set the server ip address title field |
|
171 iSuplUsageTitle = StringLoader::LoadL( R_LOC_SUPL_USE ); |
|
172 |
|
173 iDefaultSuplUsage = StringLoader::LoadL( R_AVKON_SELEC_SETT_VAL_FIELD_NONE ); |
|
174 // Default value can be used for this field as well |
|
175 // So no need to have another variable. |
|
176 } |
148 |
177 |
149 DEBUG( - CLocSUPLSettingsLBModel::ConstructL ); |
178 DEBUG( - CLocSUPLSettingsLBModel::ConstructL ); |
150 } |
179 } |
151 |
180 |
152 // --------------------------------------------------------------------------- |
181 // --------------------------------------------------------------------------- |
158 // |
187 // |
159 CLocSUPLSettingsLBModel::TSUPLSettingsItemId |
188 CLocSUPLSettingsLBModel::TSUPLSettingsItemId |
160 CLocSUPLSettingsLBModel::ResolveSettingsItem( TInt aListboxIndex ) const |
189 CLocSUPLSettingsLBModel::ResolveSettingsItem( TInt aListboxIndex ) const |
161 { |
190 { |
162 DEBUG( + CLocSUPLSettingsLBModel::ResolveSettingsItem ); |
191 DEBUG( + CLocSUPLSettingsLBModel::ResolveSettingsItem ); |
163 TSUPLSettingsItemId selectedItem = ESUPLSettingsServersDetail; |
192 TSUPLSettingsItemId selectedItem = ESUPLSettingsUsage; |
164 |
193 |
165 switch ( aListboxIndex ) |
194 switch ( aListboxIndex ) |
166 { |
195 { |
167 case 0: |
196 case 0: |
168 { |
197 { |
|
198 selectedItem = ESUPLSettingsUsage; |
|
199 break; |
|
200 } |
|
201 case 1: |
|
202 { |
169 selectedItem = ESUPLSettingsServersDetail; |
203 selectedItem = ESUPLSettingsServersDetail; |
170 break; |
204 break; |
171 } |
205 } |
172 case 1: |
206 case 2: |
173 { |
207 { |
174 selectedItem = ESUPLSettingsActiveSessions; |
208 selectedItem = ESUPLSettingsActiveSessions; |
175 break; |
209 break; |
176 } |
210 } |
177 default: |
211 default: |
191 // @return TInt The total number of elements in the Settings Description array |
225 // @return TInt The total number of elements in the Settings Description array |
192 // --------------------------------------------------------------------------- |
226 // --------------------------------------------------------------------------- |
193 // |
227 // |
194 TInt CLocSUPLSettingsLBModel::MdcaCount() const |
228 TInt CLocSUPLSettingsLBModel::MdcaCount() const |
195 { |
229 { |
196 DEBUG( + CLocSUPLSettingsLBModel::MdcaCount ); |
230 DEBUG( + CLocSUPLSettingsLBModel::MdcaCount ); |
197 // Initialize the count to 0 |
231 // Initialize the count to 0 |
198 TInt itemCount = 0; |
232 TInt itemCount = 0; |
199 |
233 |
200 // Check for Server address |
234 // Check for SUPL usage. |
201 iServerAddressPresent ? itemCount++ : itemCount; |
235 if ( iSuplUsagePresent ) |
202 itemCount++; // For the third entry "Active sessions" |
236 { |
203 DEBUG( - CLocSUPLSettingsLBModel::MdcaCount ); |
237 itemCount++; |
204 return itemCount; |
238 // Check if the usage value is disabled |
|
239 if ( iEngine.GetSuplUsage() == CSuplSettings::ESuplUsageDisabled ) |
|
240 { |
|
241 return itemCount; |
|
242 } |
|
243 // Check for Server address |
|
244 iServerAddressPresent ? itemCount++ : itemCount; |
|
245 } |
|
246 itemCount++; // For the third entry "Active sessions" |
|
247 // Check if the SUPL Usage value is Disabled |
|
248 // If that is the case then only SUPL usage will be displayed |
|
249 DEBUG( - CLocSUPLSettingsLBModel::MdcaCount ); |
|
250 return itemCount; |
205 } |
251 } |
206 |
252 |
207 // --------------------------------------------------------------------------- |
253 // --------------------------------------------------------------------------- |
208 // TPtrC16 CLocSUPLSettingsLBModel::MdcaPoint() const |
254 // TPtrC16 CLocSUPLSettingsLBModel::MdcaPoint() const |
209 // Inherited from MDesCArray. Returns the list box entry corresponding to the |
255 // Inherited from MDesCArray. Returns the list box entry corresponding to the |
227 ptr.Append( EKeyTab ); |
273 ptr.Append( EKeyTab ); |
228 |
274 |
229 TSUPLSettingsItemId index = ResolveSettingsItem( aIndex ); |
275 TSUPLSettingsItemId index = ResolveSettingsItem( aIndex ); |
230 switch( index ) |
276 switch( index ) |
231 { |
277 { |
|
278 case ESUPLSettingsUsage: |
|
279 { |
|
280 AppendSuplUsage( ptr ); |
|
281 break; |
|
282 } |
232 case ESUPLSettingsServersDetail: |
283 case ESUPLSettingsServersDetail: |
233 { |
284 { |
234 AppendSuplServerDetail( ptr ); |
285 AppendSuplServerDetail( ptr ); |
235 break; |
286 break; |
236 } |
287 } |
250 } |
301 } |
251 DEBUG( - CLocSUPLSettingsLBModel::MdcaPoint ); |
302 DEBUG( - CLocSUPLSettingsLBModel::MdcaPoint ); |
252 return iBuffer->Des(); |
303 return iBuffer->Des(); |
253 } |
304 } |
254 |
305 |
255 |
306 // --------------------------------------------------------------------------- |
|
307 // TPtrC16 CLocSUPLSettingsLBModel::AppendSuplServerDetail() |
|
308 // Packs the server address to the end of the buffer passed. |
|
309 // |
|
310 // @param aPtr Buffer to which the server address needs to be appended. |
|
311 // --------------------------------------------------------------------------- |
|
312 // |
|
313 void CLocSUPLSettingsLBModel::AppendSuplUsage( TDes& aPtr ) const |
|
314 { |
|
315 DEBUG( + CLocSUPLSettingsLBModel::AppendSuplUsage ); |
|
316 // Append the Title text |
|
317 aPtr.Append( iSuplUsageTitle->Des() ); |
|
318 |
|
319 // Append the second tab |
|
320 aPtr.Append( EKeyTab ); |
|
321 |
|
322 // Append the third tab |
|
323 aPtr.Append( EKeyTab ); |
|
324 |
|
325 // Obtain the SUPL usage from the SUPL Settings Engine. If |
|
326 // the settings is not set then a Not defined value would be |
|
327 // displayed to the user |
|
328 TPtr16 suplUsagePtr( NULL, 0 ); |
|
329 TRAPD( error, suplUsagePtr.Set( iEngine.GetSuplUsageL() ) ); |
|
330 if( error || !suplUsagePtr.Length() ) |
|
331 { |
|
332 // Using the same string as SUPL settings AP |
|
333 aPtr.Append( iDefaultSuplUsage->Des() ); |
|
334 } |
|
335 else |
|
336 { |
|
337 aPtr.Append( suplUsagePtr ); |
|
338 } |
|
339 DEBUG( - CLocSUPLSettingsLBModel::AppendSuplUsage ); |
|
340 } |
256 |
341 |
257 // --------------------------------------------------------------------------- |
342 // --------------------------------------------------------------------------- |
258 // TPtrC16 CLocSUPLSettingsLBModel::AppendSuplServerDetail() |
343 // TPtrC16 CLocSUPLSettingsLBModel::AppendSuplServerDetail() |
259 // Packs the server address to the end of the buffer passed. |
344 // Packs the server address to the end of the buffer passed. |
260 // |
345 // |