143 // -------------------------------------------------------------------------- |
143 // -------------------------------------------------------------------------- |
144 // |
144 // |
145 CDesCArrayFlat* CWsfAiModel::FormatWlanListL( CWsfWlanInfoArray* aWlanList, const TBool aUIPrioritySort ) |
145 CDesCArrayFlat* CWsfAiModel::FormatWlanListL( CWsfWlanInfoArray* aWlanList, const TBool aUIPrioritySort ) |
146 { |
146 { |
147 LOG_ENTERFN( "CWsfAiModel::FormatWlanListL" ); |
147 LOG_ENTERFN( "CWsfAiModel::FormatWlanListL" ); |
|
148 HBufC* item = HBufC::NewLC( KListBoxItemMaxLength ); |
|
149 TPtr ptr( item->Des() ); |
|
150 iFormattedWlanList->Reset(); |
148 |
151 |
149 // Function expects that items in list are already in proper order |
152 // Function expects that items in list are already in proper order |
150 iWlanInfoArray = aWlanList; |
153 iWlanInfoArray = aWlanList; |
151 |
154 |
152 if ( aUIPrioritySort ) |
155 if ( iWlanInfoArray ) |
153 { |
156 { |
154 iWlanInfoArray->SetUIPrioritySort( ETrue ); |
157 if ( aUIPrioritySort ) |
155 iWlanInfoArray->SortArrayL( *iWlanInfoBranding ); |
158 { |
156 // Sort Array with default sort |
159 iWlanInfoArray->SetUIPrioritySort( ETrue ); |
157 // this sets the highest UI priority networks on top |
160 iWlanInfoArray->SortArrayL( *iWlanInfoBranding ); |
158 iWlanInfoArray->SortArrayL( ); |
161 // Sort Array with default sort |
159 iWlanInfoArray->SetUIPrioritySort( EFalse ); |
162 // this sets the highest UI priority networks on top |
160 } |
163 iWlanInfoArray->SortArrayL( ); |
161 else |
164 iWlanInfoArray->SetUIPrioritySort( EFalse ); |
162 { |
165 } |
163 iWlanInfoArray->SortArrayL( *iWlanInfoBranding ); |
166 else |
164 } |
167 { |
165 |
168 iWlanInfoArray->SortArrayL( *iWlanInfoBranding ); |
166 iFormattedWlanList->Reset(); |
169 } |
167 HBufC* item = HBufC::NewLC( KListBoxItemMaxLength ); |
170 |
168 TPtr ptr( item->Des() ); |
171 for (TInt i = 0; i < iWlanInfoArray->Count(); ++i ) |
169 for (TInt i = 0; i < aWlanList->Count(); ++i ) |
172 { |
170 { |
173 TWsfWlanInfo* wlanInfo = iWlanInfoArray->At(i); |
171 TWsfWlanInfo* wlanInfo = aWlanList->At(i); |
174 |
172 |
175 // Hidden WLAN item is appended later for unknown hidden networks |
173 // Hidden WLAN item is appended later for unknown hidden networks |
176 if ( !wlanInfo || ( wlanInfo->Hidden() && !wlanInfo->iIapId ) ) |
174 if ( wlanInfo->Hidden() && !wlanInfo->iIapId ) |
177 { |
175 { |
178 continue; |
176 continue; |
179 } |
177 } |
180 |
178 |
181 // known hidden wlans are also "visible" |
179 // known hidden wlans are also "visible" |
182 ptr.Zero(); |
180 ptr.Zero(); |
183 FormatWlanSingleLineL( *wlanInfo, ptr, EFalse ); |
181 FormatWlanSingleLineL( *wlanInfo, ptr, EFalse ); |
184 iFormattedWlanList->AppendL( ptr ); |
182 iFormattedWlanList->AppendL( ptr ); |
185 } |
183 } |
186 } |
184 |
187 |
185 // now add "Other (unlisted)..." for hidden networks (always visible) |
188 // now add "Other (unlisted)..." for hidden networks (always visible) |
186 // make up a dummy wlaninfo |
189 // make up a dummy wlaninfo |
187 TWsfWlanInfo dummy; |
190 TWsfWlanInfo dummy; |
224 CDesCArrayFlat* CWsfAiModel::FormatSingleLineWlanListL( |
227 CDesCArrayFlat* CWsfAiModel::FormatSingleLineWlanListL( |
225 CWsfWlanInfoArray* aWlanList ) |
228 CWsfWlanInfoArray* aWlanList ) |
226 { |
229 { |
227 LOG_ENTERFN( "CWsfAiModel::FormatSingleLineWlanListL" ); |
230 LOG_ENTERFN( "CWsfAiModel::FormatSingleLineWlanListL" ); |
228 iWlanInfoArray = aWlanList; |
231 iWlanInfoArray = aWlanList; |
229 iWlanInfoArray->SetUIPrioritySort( ETrue ); |
232 |
230 iWlanInfoArray->SortArrayL( *iWlanInfoBranding ); |
233 if ( iWlanInfoArray ) |
231 |
234 { |
232 // Sort Array with default sort |
235 iWlanInfoArray->SetUIPrioritySort( ETrue ); |
233 // this sets the highest UI priority networks on top |
236 iWlanInfoArray->SortArrayL( *iWlanInfoBranding ); |
234 iWlanInfoArray->SortArrayL(); |
237 |
235 iWlanInfoArray->SetUIPrioritySort( EFalse ); |
238 // Sort Array with default sort |
|
239 // this sets the highest UI priority networks on top |
|
240 iWlanInfoArray->SortArrayL(); |
|
241 iWlanInfoArray->SetUIPrioritySort( EFalse ); |
|
242 } |
236 |
243 |
237 iFormattedWlanList->Reset(); |
244 iFormattedWlanList->Reset(); |
238 |
245 |
239 HBufC* item = HBufC::NewLC( KListBoxItemMaxLength ); |
246 HBufC* item = HBufC::NewLC( KListBoxItemMaxLength ); |
240 TPtr ptr( item->Des() ); |
247 TPtr ptr( item->Des() ); |
254 iFormattedWlanList->AppendL( ptr ); |
261 iFormattedWlanList->AppendL( ptr ); |
255 } |
262 } |
256 // if there's wlans avail |
263 // if there's wlans avail |
257 else if ( iWlanInfoArray && iWlanInfoArray->Count() ) |
264 else if ( iWlanInfoArray && iWlanInfoArray->Count() ) |
258 { |
265 { |
259 CheckWlansL( aWlanList, ptr ); |
266 CheckWlansL( iWlanInfoArray, ptr ); |
260 iFormattedWlanList->AppendL( ptr ); |
267 iFormattedWlanList->AppendL( ptr ); |
261 } |
268 } |
262 else |
269 else |
263 { |
270 { |
264 // no wlans available |
271 // no wlans available |
373 { |
380 { |
374 iStatusScanningOff = StringLoader::LoadL( |
381 iStatusScanningOff = StringLoader::LoadL( |
375 R_QTN_SNIFFER_PLUG_IN_SCANNING_OFF ); |
382 R_QTN_SNIFFER_PLUG_IN_SCANNING_OFF ); |
376 } |
383 } |
377 |
384 |
378 aItem.Format( KListItemFormat, EWlanOffIcon, |
385 aItem.Format( KListItemFormat, |
379 iStatusScanningOff, |
386 EWlanOffIcon, |
380 ETransparentIcon, |
387 iStatusScanningOff, |
381 ETransparentIcon ); |
388 ETransparentIcon, |
|
389 ETransparentIcon ); |
382 } |
390 } |
383 |
391 |
384 |
392 |
385 // -------------------------------------------------------------------------- |
393 // -------------------------------------------------------------------------- |
386 // CWsfAiModel::FormatNoWlansAvailableL |
394 // CWsfAiModel::FormatNoWlansAvailableL |
394 { |
402 { |
395 iNoWLANsAvailable = StringLoader::LoadL( |
403 iNoWLANsAvailable = StringLoader::LoadL( |
396 R_QTN_STATUS_NO_WLANS_AVAILABLE ); |
404 R_QTN_STATUS_NO_WLANS_AVAILABLE ); |
397 } |
405 } |
398 |
406 |
399 aItem.Format( KListItemFormat, ScanningOn()? |
407 aItem.Format( KListItemFormat, |
400 EWlanOnIcon: EWlanOffIcon, |
408 ScanningOn()? EWlanOnIcon: EWlanOffIcon, |
401 iNoWLANsAvailable, |
409 iNoWLANsAvailable, |
402 ETransparentIcon, |
410 ETransparentIcon, |
403 ETransparentIcon ); |
411 ETransparentIcon ); |
404 } |
412 } |
405 |
413 |
406 |
414 |
407 // -------------------------------------------------------------------------- |
415 // -------------------------------------------------------------------------- |
408 // CWsfAiModel::FormatWlanSingleLineL |
416 // CWsfAiModel::FormatWlanSingleLineL |