156 // |
129 // |
157 EXPORT_C void CApSelect::SetFiltersL( TInt aIspFilter, |
130 EXPORT_C void CApSelect::SetFiltersL( TInt aIspFilter, |
158 TInt aBearerFilter, |
131 TInt aBearerFilter, |
159 TInt aSortType ) |
132 TInt aSortType ) |
160 { |
133 { |
161 SetFiltersL( aIspFilter, aBearerFilter, aSortType, |
|
162 iExt->iReqIpvType, iExt->iVpnFilterType ); |
|
163 |
|
164 } |
134 } |
165 |
135 |
166 |
136 |
167 // --------------------------------------------------------- |
137 // --------------------------------------------------------- |
168 // CApSelect::IspTypeFilter |
138 // CApSelect::IspTypeFilter |
169 // --------------------------------------------------------- |
139 // --------------------------------------------------------- |
170 // |
140 // |
171 EXPORT_C TInt CApSelect::IspTypeFilter() |
141 EXPORT_C TInt CApSelect::IspTypeFilter() |
172 { |
142 { |
173 CLOG( ( ESelect, 0, _L( "<-> CApSelect::IspTypeFilter" ) ) ); |
143 return 0; |
174 |
|
175 return iIsp; |
|
176 } |
144 } |
177 |
145 |
178 |
146 |
179 // --------------------------------------------------------- |
147 // --------------------------------------------------------- |
180 // CApSelect::BearerFilter |
148 // CApSelect::BearerFilter |
181 // --------------------------------------------------------- |
149 // --------------------------------------------------------- |
182 // |
150 // |
183 EXPORT_C TInt CApSelect::BearerFilter() |
151 EXPORT_C TInt CApSelect::BearerFilter() |
184 { |
152 { |
185 CLOG( ( ESelect, 0, _L( "<-> CApSelect::BearerFilter" ) ) ); |
153 return 0; |
186 |
|
187 return iBearer; |
|
188 } |
154 } |
189 |
155 |
190 |
156 |
191 // --------------------------------------------------------- |
157 // --------------------------------------------------------- |
192 // CApSelect::SortOrder |
158 // CApSelect::SortOrder |
193 // --------------------------------------------------------- |
159 // --------------------------------------------------------- |
194 // |
160 // |
195 EXPORT_C TInt CApSelect::SortOrder() |
161 EXPORT_C TInt CApSelect::SortOrder() |
196 { |
162 { |
197 CLOG( ( ESelect, 0, _L( "<-> CApSelect::SortOrder" ) ) ); |
163 return 0; |
198 |
|
199 return iSort; |
|
200 } |
164 } |
201 |
165 |
202 |
166 |
203 |
167 |
204 // --------------------------------------------------------- |
168 // --------------------------------------------------------- |
205 // CApSelect::MoveToFirst |
169 // CApSelect::MoveToFirst |
206 // --------------------------------------------------------- |
170 // --------------------------------------------------------- |
207 // |
171 // |
208 EXPORT_C TBool CApSelect::MoveToFirst() |
172 EXPORT_C TBool CApSelect::MoveToFirst() |
209 { |
173 { |
210 CLOG( ( ESelect, 0, _L( "<-> CApSelect::MoveToFirst" ) ) ); |
174 return EFalse; |
211 |
|
212 iCursor = 0; |
|
213 return ( iExt->iMaxIndex >= 0 ); |
|
214 } |
175 } |
215 |
176 |
216 |
177 |
217 // --------------------------------------------------------- |
178 // --------------------------------------------------------- |
218 // CApSelect::MoveNext |
179 // CApSelect::MoveNext |
219 // --------------------------------------------------------- |
180 // --------------------------------------------------------- |
220 // |
181 // |
221 EXPORT_C TBool CApSelect::MoveNext() |
182 EXPORT_C TBool CApSelect::MoveNext() |
222 { |
183 { |
223 CLOG( ( ESelect, 0, _L( "<-> CApSelect::MoveNext" ) ) ); |
|
224 |
|
225 if ( iCursor < iExt->iMaxIndex ) |
|
226 { |
|
227 iCursor++; |
|
228 return ETrue; |
|
229 } |
|
230 return EFalse; |
184 return EFalse; |
231 } |
185 } |
232 |
186 |
233 |
187 |
234 // --------------------------------------------------------- |
188 // --------------------------------------------------------- |
235 // CApSelect::MoveLast |
189 // CApSelect::MoveLast |
236 // --------------------------------------------------------- |
190 // --------------------------------------------------------- |
237 // |
191 // |
238 EXPORT_C TBool CApSelect::MoveLast() |
192 EXPORT_C TBool CApSelect::MoveLast() |
239 { |
193 { |
240 CLOG( ( ESelect, 0, _L( "<-> CApSelect::MoveLast" ) ) ); |
194 return EFalse; |
241 |
|
242 iCursor = iExt->iMaxIndex; |
|
243 return ( iCursor >= 0 ); |
|
244 } |
195 } |
245 |
196 |
246 |
197 |
247 // --------------------------------------------------------- |
198 // --------------------------------------------------------- |
248 // CApSelect::MovePrev |
199 // CApSelect::MovePrev |
249 // --------------------------------------------------------- |
200 // --------------------------------------------------------- |
250 // |
201 // |
251 EXPORT_C TBool CApSelect::MovePrev() |
202 EXPORT_C TBool CApSelect::MovePrev() |
252 { |
203 { |
253 CLOG( ( ESelect, 0, _L( "<-> CApSelect::MovePrev" ) ) ); |
|
254 |
|
255 if ( iCursor>0 ) |
|
256 { |
|
257 iCursor--; |
|
258 return ETrue; |
|
259 } |
|
260 return EFalse; |
204 return EFalse; |
261 } |
205 } |
262 |
206 |
263 |
207 |
264 // --------------------------------------------------------- |
208 // --------------------------------------------------------- |
265 // CApSelect::Count |
209 // CApSelect::Count |
266 // --------------------------------------------------------- |
210 // --------------------------------------------------------- |
267 // |
211 // |
268 EXPORT_C TUint32 CApSelect::Count() |
212 EXPORT_C TUint32 CApSelect::Count() |
269 { |
213 { |
270 CLOG( ( ESelect, 0, _L( "<-> CApSelect::Count" ) ) ); |
214 return 0; |
271 |
|
272 return iApList->Count( ); |
|
273 } |
215 } |
274 |
216 |
275 |
217 |
276 // --------------------------------------------------------- |
218 // --------------------------------------------------------- |
277 // CApSelect::Name |
219 // CApSelect::Name |
278 // --------------------------------------------------------- |
220 // --------------------------------------------------------- |
279 // |
221 // |
280 EXPORT_C const TDesC& CApSelect::Name() |
222 EXPORT_C const TDesC& CApSelect::Name() |
281 { |
223 { |
282 CLOG( ( ESelect, 0, _L( "<-> CApSelect::Name" ) ) ); |
224 User::Leave( KErrNotSupported ); |
283 |
|
284 return *iApList->At( iCursor )->iName; |
|
285 } |
225 } |
286 |
226 |
287 |
227 |
288 // --------------------------------------------------------- |
228 // --------------------------------------------------------- |
289 // CApSelect::Uid |
229 // CApSelect::Uid |
290 // --------------------------------------------------------- |
230 // --------------------------------------------------------- |
291 // |
231 // |
292 EXPORT_C TUint32 CApSelect::Uid() |
232 EXPORT_C TUint32 CApSelect::Uid() |
293 { |
233 { |
294 CLOG( ( ESelect, 0, _L( "<-> CApSelect::Uid" ) ) ); |
234 return 0; |
295 |
|
296 return iApList->At( iCursor )->iUid; |
|
297 } |
235 } |
298 |
236 |
299 |
237 |
300 // --------------------------------------------------------- |
238 // --------------------------------------------------------- |
301 // CApSelect::Type |
239 // CApSelect::Type |
302 // --------------------------------------------------------- |
240 // --------------------------------------------------------- |
303 // |
241 // |
304 EXPORT_C TCommsDbIspType CApSelect::Type() |
242 EXPORT_C TCommsDbIspType CApSelect::Type() |
305 { |
243 { |
306 CLOG( ( ESelect, 0, _L( "<-> CApSelect::Type" ) ) ); |
244 User::Leave( KErrNotSupported ); |
307 |
|
308 return iApList->At( iCursor )->iIspType; |
|
309 } |
245 } |
310 |
246 |
311 |
247 |
312 // --------------------------------------------------------- |
248 // --------------------------------------------------------- |
313 // CApSelect::BearerType |
249 // CApSelect::BearerType |
314 // --------------------------------------------------------- |
250 // --------------------------------------------------------- |
315 // |
251 // |
316 EXPORT_C TApBearerType CApSelect::BearerType() |
252 EXPORT_C TApBearerType CApSelect::BearerType() |
317 { |
253 { |
318 CLOG( ( ESelect, 0, _L( "<-> CApSelect::BearerType" ) ) ); |
254 User::Leave( KErrNotSupported ); |
319 |
|
320 return iApList->At( iCursor )->iBearerType; |
|
321 } |
255 } |
322 |
256 |
323 |
257 |
324 |
258 |
325 |
259 |
373 // CApSelect::DoUpdate |
289 // CApSelect::DoUpdate |
374 // --------------------------------------------------------- |
290 // --------------------------------------------------------- |
375 // |
291 // |
376 TInt CApSelect::DoUpdateL() |
292 TInt CApSelect::DoUpdateL() |
377 { |
293 { |
378 CLOG( ( ESelect, 0, _L( "-> CApSelect::DoUpdateL" ) ) ); |
294 return KErrNotSupported; |
379 |
|
380 // filtering criteria: |
|
381 // Bearer type |
|
382 // Isp type |
|
383 // HasMandatory |
|
384 // + ordering (name or UID...) |
|
385 // first filter WAP_ACCESS_POINT table and order it |
|
386 TBool OwnTransaction = ApCommons::StartPushedTransactionLC( *iDb ); |
|
387 if ( !OwnTransaction ) |
|
388 { |
|
389 __ASSERT_DEBUG( EFalse, ApCommons::Panic( ENotSupported ) ); |
|
390 User::Leave( KErrNotSupported ); |
|
391 } |
|
392 |
|
393 CCommsDbTableView* wapt = NULL; |
|
394 CCommsDbTableView* ipbearert = NULL; |
|
395 |
|
396 CCommsDbTableView* iapt = NULL; |
|
397 // csdOut, GprsIn, gprsOut, cdma, VPN |
|
398 CCommsDbTableView* isptables[5] = { NULL, NULL, NULL, NULL, NULL}; |
|
399 |
|
400 |
|
401 wapt = GetFilteredSortedWapTableViewLC(); |
|
402 TInt err = wapt->GotoFirstRecord(); // OK. |
|
403 if ( ( err == KErrNone ) || ( err == KErrNotFound ) ) |
|
404 { // even if it is empty, we must clear the list. |
|
405 // otherwise, Leave |
|
406 // fill up list. First empty it |
|
407 iApList->ResetAndDestroy(); |
|
408 iCount = 0; |
|
409 if ( err == KErrNone ) |
|
410 { // have some, we can go on... |
|
411 // First get ip_bearer table, then iap, then isp & gprs, if needed |
|
412 if ( ( iBearer & EApBearerTypeCSD ) || |
|
413 ( iBearer & EApBearerTypeHSCSD ) || |
|
414 ( iBearer & EApBearerTypeGPRS ) || |
|
415 ( iExt->iCdma && ( iBearer & EApBearerTypeCDMA ) ) ) |
|
416 { |
|
417 ipbearert = GetFilteredSortedIpBearerTableViewLC(); |
|
418 if ( ipbearert ) |
|
419 { |
|
420 err = ipbearert->GotoFirstRecord(); |
|
421 if ( err == KErrNone ) |
|
422 { |
|
423 if ( ( iBearer & EApBearerTypeCSD ) || |
|
424 ( iBearer & EApBearerTypeHSCSD ) ) |
|
425 { |
|
426 isptables[KDIALOUT] = |
|
427 GetFilteredSortedIspOutTableViewLC(); |
|
428 } |
|
429 if ( ( iBearer & EApBearerTypeGPRS ) ) |
|
430 { |
|
431 isptables[KGPRSIN] = |
|
432 GetFilteredSortedGprsTableViewLC( ETrue ); |
|
433 isptables[KGPRSOUT] = |
|
434 GetFilteredSortedGprsTableViewLC( EFalse ); |
|
435 } |
|
436 } |
|
437 else |
|
438 { |
|
439 if ( err != KErrNotFound ) |
|
440 { |
|
441 User::LeaveIfError( err ); |
|
442 } |
|
443 } |
|
444 } |
|
445 } |
|
446 // get wapapids |
|
447 // get smsapids, if defined |
|
448 // get ipapids with iap ids |
|
449 // get only those iap ids from filtered database |
|
450 CArrayFixFlat<TUint32>* wapapid = |
|
451 new ( ELeave ) CArrayFixFlat<TUint32>( 10 ); |
|
452 CleanupStack::PushL( wapapid ); |
|
453 GetUintValuesL( wapt, TPtrC(COMMDB_ID), *wapapid ); |
|
454 |
|
455 // read up access point names, too, just to be as fast as we can... |
|
456 CArrayPtrFlat<HBufC>* wapapname = |
|
457 new ( ELeave ) CArrayPtrFlat<HBufC>( 10 ); |
|
458 CleanupStack::PushL( wapapname ); |
|
459 GetTextValuesL( wapt, TPtrC(COMMDB_NAME), *wapapname ); |
|
460 |
|
461 |
|
462 // read up start page, too, just to be as fast as we can... |
|
463 CArrayPtrFlat<HBufC>* wapstartpage = |
|
464 new ( ELeave ) CArrayPtrFlat<HBufC>( 10 ); |
|
465 CleanupStack::PushL( wapstartpage ); |
|
466 // as it is LONG text... |
|
467 GetLongTextValuesL( wapt, TPtrC(WAP_START_PAGE), *wapstartpage ); |
|
468 |
|
469 //read up Read-only flags |
|
470 CArrayFixFlat<TUint32>* protflags = |
|
471 new ( ELeave ) CArrayFixFlat<TUint32>( 10 ); |
|
472 CleanupStack::PushL( protflags ); |
|
473 GetProtValuesL( wapt, *protflags ); |
|
474 |
|
475 |
|
476 CArrayFixFlat<TUint32>* ipapid = |
|
477 new ( ELeave ) CArrayFixFlat<TUint32>( 10 ); |
|
478 CleanupStack::PushL( ipapid ); |
|
479 GetUintValuesL( ipbearert, TPtrC(WAP_ACCESS_POINT_ID), *ipapid ); |
|
480 |
|
481 CArrayFixFlat<TUint32>* ipiapid = |
|
482 new ( ELeave ) CArrayFixFlat<TUint32>( 10 ); |
|
483 CleanupStack::PushL( ipiapid ); |
|
484 GetUintValuesL( ipbearert, TPtrC(WAP_IAP), *ipiapid ); |
|
485 |
|
486 |
|
487 |
|
488 |
|
489 // What comes next::::: |
|
490 // for each table: |
|
491 // filter separately for different bearers -> |
|
492 // we know the bearer type... |
|
493 // filter separately for different ISP types -> |
|
494 // we know the ISP type... |
|
495 // now all we have to do is to 'simply' check filtered IAP with |
|
496 // the separate arrays, leave only those that present in |
|
497 // both bearer & isp array |
|
498 // fill up an array of id & an array of bearer type & |
|
499 // an array of isp type |
|
500 // after it, narrow down wap with wapbearer, |
|
501 // create items in order, |
|
502 // check items against remained iap array |
|
503 // fill up values in list. |
|
504 // bearer arrays : 0: csd, 1:hscsd, 2: gprs, 3: cdma |
|
505 |
|
506 TInt i( 0 ); |
|
507 |
|
508 // an array Isp[CSDOut/GPRSIn/GPRSOut/CDMA/VPN] |
|
509 // [COMMDB_ID, ISP_TYPE, Bearer_type] |
|
510 CArrayFixFlat<TUint32[3]>* ispArray[5]; |
|
511 for (i=0; i<5; i++) |
|
512 { |
|
513 ispArray[i] = new ( ELeave ) CArrayFixFlat<TUint32[3]>( 10 ); |
|
514 CleanupStack::PushL( ispArray[i] ); |
|
515 } |
|
516 |
|
517 if ( isptables[KDIALOUT] ) |
|
518 { |
|
519 GetIspValuesL( isptables[KDIALOUT], ispArray[KDIALOUT], |
|
520 TPtrC(ISP_TYPE) ); |
|
521 } |
|
522 if ( isptables[KGPRSIN] ) |
|
523 { |
|
524 GetIspValuesL( isptables[KGPRSIN], ispArray[KGPRSIN], |
|
525 TPtrC(GPRS_AP_TYPE) ); |
|
526 } |
|
527 if ( isptables[KGPRSOUT] ) |
|
528 { |
|
529 GetIspValuesL( isptables[KGPRSOUT], ispArray[KGPRSOUT], |
|
530 TPtrC(GPRS_AP_TYPE) ); |
|
531 } |
|
532 if ( isptables[KCDMA_ISP] ) // NULL if iExt->iCdma==EFalse. |
|
533 { |
|
534 GetIspValuesL( isptables[KCDMA_ISP], ispArray[KCDMA_ISP], |
|
535 TPtrC(CDMA_AP_TYPE) ); |
|
536 } |
|
537 |
|
538 |
|
539 // iap arrays, 5 table, needs UID & linked ID for both |
|
540 CArrayFixFlat<TUint32>* iapArrays[5][2]; |
|
541 for (i=0; i<5; i++) |
|
542 { |
|
543 iapArrays[i][0] = new ( ELeave ) CArrayFixFlat<TUint32>( 10 ); |
|
544 CleanupStack::PushL( iapArrays[i][0] ); |
|
545 |
|
546 iapArrays[i][1] = new ( ELeave ) CArrayFixFlat<TUint32>( 10 ); |
|
547 CleanupStack::PushL( iapArrays[i][1] ); |
|
548 } |
|
549 // get iap table data... |
|
550 // needs IAP UID & Iap_service |
|
551 if ( ( iBearer & EApBearerTypeCSD ) || |
|
552 ( iBearer & EApBearerTypeHSCSD ) ) |
|
553 { |
|
554 iapt = OpenViewMatchingTextL( TPtrC(IAP), |
|
555 TPtrC(IAP_SERVICE_TYPE), |
|
556 TPtrC(DIAL_OUT_ISP) ); |
|
557 CleanupStack::PushL( iapt ); |
|
558 GetUintValuesL( iapt, TPtrC(COMMDB_ID), |
|
559 *iapArrays[KDIALOUT][0] ); |
|
560 GetUintValuesL( iapt, TPtrC(IAP_SERVICE), |
|
561 *iapArrays[KDIALOUT][1] ); |
|
562 CleanupStack::PopAndDestroy( iapt ); // iapt; |
|
563 iapt = NULL; |
|
564 } |
|
565 |
|
566 |
|
567 if ( iBearer & EApBearerTypeGPRS ) |
|
568 { |
|
569 iapt = OpenViewMatchingTextL( TPtrC(IAP), |
|
570 TPtrC(IAP_SERVICE_TYPE), |
|
571 TPtrC(INCOMING_WCDMA) ); |
|
572 CleanupStack::PushL( iapt ); |
|
573 GetUintValuesL( iapt, TPtrC(COMMDB_ID), |
|
574 *iapArrays[KGPRSIN][0] ); |
|
575 GetUintValuesL( iapt, TPtrC(IAP_SERVICE), |
|
576 *iapArrays[KGPRSIN][1] ); |
|
577 CleanupStack::PopAndDestroy( iapt ); // iapt; |
|
578 iapt = NULL; |
|
579 |
|
580 iapt = OpenViewMatchingTextL( TPtrC(IAP), |
|
581 TPtrC(IAP_SERVICE_TYPE), |
|
582 TPtrC(OUTGOING_WCDMA) ); |
|
583 CleanupStack::PushL( iapt ); |
|
584 GetUintValuesL( iapt, TPtrC(COMMDB_ID), |
|
585 *iapArrays[KGPRSOUT][0] ); |
|
586 GetUintValuesL( iapt, TPtrC(IAP_SERVICE), |
|
587 *iapArrays[KGPRSOUT][1] ); |
|
588 CleanupStack::PopAndDestroy( iapt ); // iapt; |
|
589 iapt = NULL; |
|
590 } |
|
591 |
|
592 if ( ( iExt->iVpnFilterType == EVpnFilterVpnOnly ) || |
|
593 ( iExt->iVpnFilterType == EVpnFilterBoth ) ) |
|
594 { |
|
595 iapt = OpenViewMatchingTextL( TPtrC(IAP), |
|
596 TPtrC(IAP_SERVICE_TYPE), |
|
597 TPtrC(VPN_SERVICE) ); |
|
598 CleanupStack::PushL( iapt ); |
|
599 GetUintValuesL( iapt, TPtrC(COMMDB_ID), |
|
600 *iapArrays[KVPN][0] ); |
|
601 GetUintValuesL( iapt, TPtrC(IAP_SERVICE), |
|
602 *iapArrays[KVPN][1] ); |
|
603 CleanupStack::PopAndDestroy( iapt ); // iapt; |
|
604 iapt = NULL; |
|
605 } |
|
606 |
|
607 |
|
608 |
|
609 CArrayFixFlat<TVpnData>* vpnArray = NULL; |
|
610 |
|
611 if ( ( iExt->iVpnFilterType == EVpnFilterVpnOnly ) || |
|
612 ( iExt->iVpnFilterType == EVpnFilterBoth ) ) |
|
613 { // get VPN related data, namely Home IAP and name |
|
614 isptables[KVPN] = GetVpnTableViewLC(); |
|
615 |
|
616 if ( isptables[KVPN] ) |
|
617 { |
|
618 |
|
619 vpnArray = new ( ELeave ) CArrayFixFlat<TVpnData>( 10 ); |
|
620 CleanupStack::PushL( vpnArray ); |
|
621 |
|
622 GetVpnValuesL( isptables[KVPN], vpnArray ); |
|
623 } |
|
624 } |
|
625 |
|
626 |
|
627 |
|
628 |
|
629 // till this point, we have done what we can. |
|
630 // now we narrow down arrays. |
|
631 // start with iap vs isp arrays, leave what we can in iap array. |
|
632 |
|
633 CApListItem* item = NULL; |
|
634 CApListItemList* tmpApList = new( ELeave )CApListItemList(); |
|
635 CleanupStack::PushL( tmpApList ); |
|
636 TApBearerType bearer (EApBearerTypeAllBearers); |
|
637 |
|
638 // iapArrays[5][2]: |
|
639 // 5 table (DialOut, GprsIn, Out, Cdma, VPN),2 id's(Uid,ServiceId) |
|
640 // iapArrays[0] : Dial In service |
|
641 // ispinbearerArrays: 0: csd, 1:hscsd, 2: gprs. 3: cdma |
|
642 |
|
643 // 'Merge' iap with isp, create temp. items with bearer types |
|
644 // iap/DialIn/ServiceID : iapArrays[0][1] |
|
645 |
|
646 // check all iap/DialIn/ServiceID if it is in isparray -> |
|
647 // array Gives bearer type & isp type |
|
648 TInt j, iappos; |
|
649 // check all iap/DialOut/ServiceID if it is |
|
650 // in ispoutbearerarray[0,1] |
|
651 if ( iapArrays[KDIALOUT][1] ) |
|
652 { |
|
653 for (j=0; j<iapArrays[KDIALOUT][1]->Count(); j++) |
|
654 { |
|
655 bearer = EApBearerTypeAllBearers; |
|
656 // check all iap/DialOut/ServiceID if it is in isparray |
|
657 // check if it is in ispArray[UID, ISP, Bearer] |
|
658 // & return pos. |
|
659 iappos = GetIapPos( ispArray[KDIALOUT], |
|
660 iapArrays[KDIALOUT][1]->At( j ) ); |
|
661 if ( iappos != KErrNotFound ) |
|
662 { // DialOut, Isp, Bearer... |
|
663 // create temp. item WITH IAP ID, Bearer type |
|
664 if ( ispArray[KDIALOUT]->At( iappos )[KBEARERTYPE] == |
|
665 EBearerTypeCSD ) |
|
666 { |
|
667 bearer = EApBearerTypeCSD; |
|
668 } |
|
669 else |
|
670 { // HSCSD bearer |
|
671 bearer = EApBearerTypeHSCSD; |
|
672 } |
|
673 // create temp. item WITH IAP ID, Bearer type |
|
674 item = CApListItem::NewLC |
|
675 ( |
|
676 (TCommsDbIspType) |
|
677 ispArray[KDIALOUT]->At( iappos )[KISPTYPE], |
|
678 iapArrays[KDIALOUT][0]->At( j ), |
|
679 KEmpty, |
|
680 bearer |
|
681 ); |
|
682 tmpApList->AppendL( item ); |
|
683 CleanupStack::Pop( item ); // item owned by list ! |
|
684 } |
|
685 } |
|
686 } |
|
687 |
|
688 |
|
689 |
|
690 // check all iap/GprsIn/ServiceID if it is in ispinbearerarray[2] |
|
691 if ( iapArrays[KGPRSIN][1] ) |
|
692 { |
|
693 bearer = EApBearerTypeGPRS; |
|
694 for (j=0; j<iapArrays[KGPRSIN][1]->Count(); j++) |
|
695 { |
|
696 iappos = GetIapPos( ispArray[KGPRSIN], |
|
697 iapArrays[KGPRSIN][1]->At( j ) ); |
|
698 if ( iappos != KErrNotFound ) |
|
699 { // GprsIn, Isp, Bearer... |
|
700 // create temp. item WITH IAP ID, Bearer type |
|
701 item = CApListItem::NewLC |
|
702 ( |
|
703 (TCommsDbIspType) |
|
704 ispArray[KGPRSIN]->At( iappos )[KISPTYPE], |
|
705 iapArrays[KGPRSIN][0]->At( j ), |
|
706 KEmpty, |
|
707 bearer |
|
708 ); |
|
709 tmpApList->AppendL( item ); |
|
710 CleanupStack::Pop( item ); // item owned by list ! |
|
711 } |
|
712 } |
|
713 } |
|
714 |
|
715 |
|
716 // check all iap/GprsOut/ServiceID if it is in isparray |
|
717 if ( iapArrays[KGPRSOUT][1] ) |
|
718 { |
|
719 bearer = EApBearerTypeGPRS; |
|
720 for (j=0; j<iapArrays[KGPRSOUT][1]->Count(); j++) |
|
721 { |
|
722 iappos = GetIapPos( ispArray[KGPRSOUT], |
|
723 iapArrays[KGPRSOUT][1]->At( j ) ); |
|
724 if ( iappos != KErrNotFound ) |
|
725 { // GprsIn, Isp, Bearer... |
|
726 // create temp. item WITH IAP ID, Bearer type |
|
727 item = CApListItem::NewLC |
|
728 ( |
|
729 (TCommsDbIspType) |
|
730 ispArray[KGPRSOUT]->At( iappos )[KISPTYPE], |
|
731 iapArrays[KGPRSOUT][0]->At( j ), |
|
732 KEmpty, |
|
733 bearer |
|
734 ); |
|
735 tmpApList->AppendL( item ); |
|
736 CleanupStack::Pop( item ); // item owned by list ! |
|
737 } |
|
738 } |
|
739 } |
|
740 |
|
741 |
|
742 // check all iap/cdma/ServiceID if it is in ispinbearerarray[2] |
|
743 if ( iapArrays[KCDMA_ISP][1] ) // NULL if iExt->iCdma==EFalse. |
|
744 { |
|
745 bearer = EApBearerTypeCDMA; |
|
746 for (j=0; j<iapArrays[KCDMA_ISP][1]->Count(); j++) |
|
747 { |
|
748 iappos = GetIapPos( ispArray[KCDMA_ISP], |
|
749 iapArrays[KCDMA_ISP][1]->At( j ) ); |
|
750 if ( iappos != KErrNotFound ) |
|
751 { // Cdma, Isp, Bearer... |
|
752 // create temp. item WITH IAP ID, Bearer type |
|
753 item = CApListItem::NewLC |
|
754 ( |
|
755 (TCommsDbIspType) |
|
756 ispArray[KCDMA_ISP]->At( iappos )[KISPTYPE], |
|
757 iapArrays[KCDMA_ISP][0]->At( j ), |
|
758 KEmpty, |
|
759 bearer |
|
760 ); |
|
761 tmpApList->AppendL( item ); |
|
762 CleanupStack::Pop( item ); // item owned by list ! |
|
763 } |
|
764 } |
|
765 } |
|
766 |
|
767 |
|
768 // Now we have the temporary list filled with |
|
769 // IAP UID, bearer type, ISP type, |
|
770 // So compare it to WAP part and create the REAL list... |
|
771 TInt pos( KErrNotFound ); |
|
772 TInt itempos( KErrNotFound ); |
|
773 TBool protsupported = FeatureManager::FeatureSupported( |
|
774 KFeatureIdSettingsProtection ); |
|
775 for (i=0; i< wapapid->Count(); i++) |
|
776 { // as wapapid is sorted, resulting list will be sorted, too ! |
|
777 // is it in IP bearer ? |
|
778 if ( IsInArray( ipapid, wapapid->At( i ) ) ) |
|
779 { |
|
780 // now need to get bearer type & isp type |
|
781 // |
|
782 pos = PosInArray(ipapid, wapapid->At( i ) ); |
|
783 if (pos!= KErrNotFound ) |
|
784 { // now we have the index in the |
|
785 // ipiapid as they are synchronized... |
|
786 // iapUid = ipiapid[ pos ]; |
|
787 // now have to find a CApListItem in tmpApList |
|
788 itempos = GetItemPos( tmpApList, |
|
789 ipiapid->At( pos ) ); |
|
790 if (itempos != KErrNotFound ) |
|
791 { |
|
792 TBool prot(EFalse); |
|
793 if (protsupported) |
|
794 { |
|
795 prot = protflags->At( i ); |
|
796 } |
|
797 item = CApListItem::NewLC |
|
798 ( |
|
799 (TCommsDbIspType) |
|
800 tmpApList->At( itempos )->Type(), |
|
801 wapapid->At( i ), |
|
802 *wapapname->At( i ), |
|
803 tmpApList->At( itempos )->BearerType(), |
|
804 *wapstartpage->At( i ), |
|
805 prot ); |
|
806 |
|
807 iApList->AppendL( item ); |
|
808 CleanupStack::Pop( item ); // item owned by aList ! |
|
809 } |
|
810 } |
|
811 } |
|
812 } |
|
813 |
|
814 #ifdef __TEST_LAN_BEARER |
|
815 // enable LAN: |
|
816 // ADD THEM AFTER NORMAL QUERYING... |
|
817 if ( ( iBearer & EApBearerTypeLAN ) |
|
818 || ( iBearer & EApBearerTypeLANModem ) ) |
|
819 { |
|
820 AddLanL( EFalse ); |
|
821 } |
|
822 #else |
|
823 // enable LAN: |
|
824 // ADD THEM AFTER NORMAL QUERYING... |
|
825 if ( iBearer & EApBearerTypeLANModem ) |
|
826 { |
|
827 AddLanL( EFalse ); |
|
828 } |
|
829 #endif // __TEST_LAN_BEARER |
|
830 if ( iBearer & EApBearerTypeWLAN ) |
|
831 { |
|
832 if ( iExt->iWlanSupported ) |
|
833 { |
|
834 // enable WLAN: |
|
835 // ADD THEM AFTER NORMAL QUERYING... |
|
836 AddLanL( ETrue ); |
|
837 } |
|
838 } |
|
839 |
|
840 // now it has only elements which are OK. |
|
841 // from ALL CSD/GPRS/CDMA tables, still in sorted order... |
|
842 // now it is time to check VPN related stuff, if any |
|
843 if ( ( iExt->iVpnFilterType == EVpnFilterVpnOnly ) || |
|
844 ( iExt->iVpnFilterType == EVpnFilterBoth ) ) |
|
845 { // Add VPN access points if needed |
|
846 // Add ALL VPN access points if needed as requested by |
|
847 // Nokia, thus incomplete access points to be listed. |
|
848 TUint32 wapid( 0 ); |
|
849 TInt count = vpnArray->Count(); |
|
850 |
|
851 CApUtils* util = CApUtils::NewLC( *iDb ); |
|
852 for ( i = 0; i < count; i++ ) |
|
853 { |
|
854 if ( vpnArray->At( i ).iHomeIapId != 0 ) |
|
855 { |
|
856 // get home wap id first |
|
857 pos = PosInArray( ipiapid, |
|
858 vpnArray->At( i ).iHomeIapId ); |
|
859 |
|
860 } |
|
861 else if ( vpnArray->At( i ).iHomeSnapId != 0 ) |
|
862 { |
|
863 // VPN IAP points to a SNAP. Just mark it available. |
|
864 pos = PosInArray( iapArrays[KVPN][1], vpnArray->At( i ).iVpnIapId ); |
|
865 if ( pos != KErrNotFound ) |
|
866 { // now get VPN IAP ID |
|
867 TUint32 tempvpniapid = iapArrays[KVPN][0]->At( pos ); |
|
868 TUint32 tempvpnwapid ( 0 ); |
|
869 TRAP( err, tempvpnwapid = |
|
870 util->WapIdFromIapIdL( |
|
871 tempvpniapid ) ); |
|
872 |
|
873 item = CApListItem::NewLC |
|
874 ( |
|
875 EIspTypeInternetAndWAP, |
|
876 tempvpnwapid, |
|
877 *vpnArray->At( i ).iName, |
|
878 EApBearerTypeAllBearers |
|
879 ); |
|
880 item->SetVpnFlag( ETrue ); |
|
881 iApList->AppendL( item ); |
|
882 CleanupStack::Pop( item ); |
|
883 continue; |
|
884 } |
|
885 } |
|
886 |
|
887 TInt foundpos( KErrNotFound ); |
|
888 if ( pos!= KErrNotFound ) |
|
889 { // now we have the index in the |
|
890 // ipiapid and as they are synchronized... |
|
891 wapid = ipapid->At( pos ); |
|
892 // now check if we do have it in array... |
|
893 TInt jcount = iApList->Count(); |
|
894 for ( j = 0; j < jcount; j++ ) |
|
895 { |
|
896 if ( iApList->At( j )->Uid() == wapid ) |
|
897 { |
|
898 foundpos = j; |
|
899 break; |
|
900 } |
|
901 } |
|
902 } |
|
903 // should add VPN |
|
904 // check if VPN-table COMMDB_ID is |
|
905 // in iapArrays[VPN][1] |
|
906 pos = PosInArray( |
|
907 iapArrays[KVPN][1], |
|
908 vpnArray->At( i ).iVpnIapId ); |
|
909 if ( pos != KErrNotFound ) |
|
910 { // now get VPN IAP ID |
|
911 TUint32 tempvpniapid = |
|
912 iapArrays[KVPN][0]->At( pos ); |
|
913 TUint32 tempvpnwapid ( 0 ); |
|
914 TRAP( err, tempvpnwapid = |
|
915 util->WapIdFromIapIdL( |
|
916 tempvpniapid ) ); |
|
917 |
|
918 if ( err == KErrNone ) |
|
919 { |
|
920 if ( foundpos != KErrNotFound ) |
|
921 { |
|
922 // if not found, it is either an unknown |
|
923 // bearer type, for which we can nto show |
|
924 // icon and UI at all, or it does not |
|
925 // fulfill the filtering criteria, so we |
|
926 // ignore them. |
|
927 item = CApListItem::NewLC |
|
928 ( |
|
929 iApList->At( foundpos )->Type(), |
|
930 tempvpnwapid, |
|
931 *vpnArray->At( i ).iName, |
|
932 iApList->At( foundpos ) |
|
933 ->BearerType() |
|
934 ); |
|
935 item->SetVpnFlag( ETrue ); |
|
936 iApList->AppendL( item ); |
|
937 // item owned by aList ! |
|
938 CleanupStack::Pop( item ); |
|
939 } |
|
940 } |
|
941 } |
|
942 } |
|
943 CleanupStack::PopAndDestroy( util ); |
|
944 } |
|
945 |
|
946 if ( iExt->iVpnFilterType == EVpnFilterVpnOnly ) |
|
947 { // remove non-vpn access points if needed |
|
948 TInt count = iApList->Count(); |
|
949 for ( i = 0; i < count; i++ ) |
|
950 { |
|
951 if ( !iApList->At( i )->IsVpnAp() ) |
|
952 { |
|
953 delete iApList->At( i ); |
|
954 iApList->Delete( i ); |
|
955 count--; |
|
956 i--; // 'cause it is cycled... |
|
957 } |
|
958 } |
|
959 } |
|
960 |
|
961 |
|
962 /* |
|
963 #ifdef __WINS__ |
|
964 //============================================================= |
|
965 // Support for ethernet in emulator, change 1/2 |
|
966 // |
|
967 |
|
968 iapt = OpenViewMatchingTextL( TPtrC(IAP), |
|
969 TPtrC(IAP_SERVICE_TYPE), |
|
970 TPtrC(LAN_SERVICE) ); |
|
971 CleanupStack::PushL( iapt ); |
|
972 |
|
973 |
|
974 TBuf<40> name; |
|
975 TUint32 id; |
|
976 TInt err = iapt->GotoFirstRecord(); |
|
977 TInt err2; |
|
978 CCommsDbTableView* tmpView = NULL; |
|
979 |
|
980 while(err == KErrNone) |
|
981 { |
|
982 iapt->ReadTextL(TPtrC(COMMDB_NAME), name); |
|
983 iapt->ReadUintL(TPtrC(COMMDB_ID), id); |
|
984 |
|
985 tmpView = iDb->OpenViewMatchingUintLC( |
|
986 TPtrC(WAP_IP_BEARER), TPtrC(WAP_IAP), id); |
|
987 err2 = tmpView->GotoFirstRecord(); |
|
988 if(err2 == KErrNone) |
|
989 { |
|
990 tmpView->ReadUintL(TPtrC(WAP_ACCESS_POINT_ID), id); |
|
991 CleanupStack::PopAndDestroy( tmpView ); |
|
992 |
|
993 tmpView = iDb->OpenViewMatchingUintLC( |
|
994 TPtrC(WAP_ACCESS_POINT), TPtrC(COMMDB_ID), id); |
|
995 err2 = tmpView->GotoFirstRecord(); |
|
996 if ( err2 == KErrNone ) |
|
997 { |
|
998 item = CApListItem::NewLC |
|
999 ( |
|
1000 EIspTypeInternetAndWAP, |
|
1001 id, |
|
1002 name, |
|
1003 EApBearerTypeGPRS |
|
1004 ); |
|
1005 iApList->AppendL( item ); |
|
1006 |
|
1007 CleanupStack::Pop( item ); |
|
1008 } |
|
1009 } |
|
1010 |
|
1011 CleanupStack::PopAndDestroy( tmpView ); |
|
1012 |
|
1013 err = iapt->GotoNextRecord(); |
|
1014 } |
|
1015 |
|
1016 |
|
1017 CleanupStack::PopAndDestroy( iapt ); // iapt; |
|
1018 iapt = NULL; |
|
1019 |
|
1020 // End of change 1/2 |
|
1021 //============================================================= |
|
1022 |
|
1023 #endif // __WINS__ |
|
1024 */ |
|
1025 |
|
1026 |
|
1027 iCount = iApList->Count(); |
|
1028 |
|
1029 CleanupStack::PopAndDestroy( tmpApList ); // tmpApList |
|
1030 |
|
1031 if ( vpnArray ) |
|
1032 { |
|
1033 CleanupStack::PopAndDestroy( vpnArray->Count() ); |
|
1034 CleanupStack::PopAndDestroy( vpnArray ); |
|
1035 } |
|
1036 if ( isptables[KVPN] ) |
|
1037 { |
|
1038 CleanupStack::PopAndDestroy( isptables[KVPN] ); |
|
1039 } |
|
1040 |
|
1041 CleanupStack::PopAndDestroy( 10, iapArrays[0][0] ); // iap arrays |
|
1042 |
|
1043 CleanupStack::PopAndDestroy( 5, ispArray[0] ); // isp arrays |
|
1044 |
|
1045 CleanupStack::Pop( 2, ipapid ); // ipiapid, ipapid |
|
1046 CleanupStack::Pop( protflags ); // protflags |
|
1047 delete protflags; |
|
1048 delete ipiapid; |
|
1049 delete ipapid; |
|
1050 |
|
1051 // Note: SMS bearer had been dropped. |
|
1052 CleanupStack::PopAndDestroy( wapstartpage->Count() );//wapstartpage |
|
1053 CleanupStack::PopAndDestroy( wapstartpage ); // wapstartpage |
|
1054 CleanupStack::PopAndDestroy( wapapname->Count() ); // wapapname |
|
1055 CleanupStack::PopAndDestroy( wapapname ); // wapapname |
|
1056 CleanupStack::Pop(); // wapapid |
|
1057 delete wapapid; |
|
1058 |
|
1059 if ( isptables[KCDMA_ISP] ) |
|
1060 { |
|
1061 CleanupStack::PopAndDestroy( isptables[KCDMA_ISP] ); |
|
1062 } |
|
1063 |
|
1064 if ( isptables[KGPRSOUT] ) |
|
1065 { |
|
1066 CleanupStack::PopAndDestroy( isptables[KGPRSOUT] ); |
|
1067 } |
|
1068 |
|
1069 if ( isptables[KGPRSIN] ) |
|
1070 { |
|
1071 CleanupStack::PopAndDestroy( isptables[KGPRSIN] ); |
|
1072 } |
|
1073 |
|
1074 if ( isptables[KDIALOUT] ) |
|
1075 { |
|
1076 CleanupStack::PopAndDestroy( isptables[KDIALOUT] ); |
|
1077 } |
|
1078 |
|
1079 if ( ipbearert ) |
|
1080 { |
|
1081 CleanupStack::PopAndDestroy( ipbearert ); |
|
1082 } |
|
1083 } |
|
1084 else |
|
1085 { |
|
1086 if ( err != KErrNotFound ) |
|
1087 { |
|
1088 User::LeaveIfError( err ); |
|
1089 } |
|
1090 } |
|
1091 } |
|
1092 else |
|
1093 { |
|
1094 if ( err != KErrNotFound ) |
|
1095 { |
|
1096 User::Leave( err ); |
|
1097 } |
|
1098 } |
|
1099 CleanupStack::PopAndDestroy( wapt ); // wapt |
|
1100 iExt->iMaxIndex = iCount-1; |
|
1101 if ( OwnTransaction ) |
|
1102 { |
|
1103 ApCommons::RollbackTransactionOnLeave( iDb ); |
|
1104 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
1105 } |
|
1106 CLOG( ( ESelect, 1, _L( "<- CApSelect::DoUpdateL" ) ) ); |
|
1107 |
|
1108 return err; |
|
1109 } |
295 } |
1110 |
296 |
1111 |
297 |
1112 |
298 |
1113 |
299 |
1191 // CApSelect::GetFilteredSortedIpBearerTableViewLC() |
315 // CApSelect::GetFilteredSortedIpBearerTableViewLC() |
1192 // --------------------------------------------------------- |
316 // --------------------------------------------------------- |
1193 // |
317 // |
1194 CCommsDbTableView* CApSelect::GetFilteredSortedIpBearerTableViewLC() |
318 CCommsDbTableView* CApSelect::GetFilteredSortedIpBearerTableViewLC() |
1195 { |
319 { |
1196 CLOG( ( ESelect, 0, |
320 return NULL; |
1197 _L( "-> CApSelect::GetFilteredSortedIpBearerTableViewLC" ) ) ); |
|
1198 |
|
1199 CCommsDbTableView* table = NULL; |
|
1200 |
|
1201 table = iDb->OpenTableLC( TPtrC(WAP_IP_BEARER) ); |
|
1202 TInt err; |
|
1203 err = table->GotoFirstRecord(); |
|
1204 |
|
1205 if ( ( iBearer & EApBearerTypeCSD ) || |
|
1206 ( iBearer & EApBearerTypeHSCSD ) || |
|
1207 ( iBearer & EApBearerTypeGPRS ) || |
|
1208 ( iExt->iCdma && ( iBearer & EApBearerTypeCDMA ) ) ) |
|
1209 { |
|
1210 // needs ipbearer table |
|
1211 // only filtering we can do is about Mandatory |
|
1212 // because Isptype & Bearertype are up to |
|
1213 // ISP & GPRS tables... |
|
1214 if ( iIsp & KEApIspTypeWAPMandatory ) |
|
1215 { // Hasmandatory.. |
|
1216 // SELECT * from WAP_IP_BEARER WHERE |
|
1217 // WAP_GATEWAY_ADDRESS <> '' |
|
1218 // AND WAP_GATEWAY_ADDRESS != "0.0.0.0" ) |
|
1219 // AND HIDDEN... |
|
1220 |
|
1221 if ( err != KErrNotFound ) |
|
1222 { |
|
1223 User::LeaveIfError( err ); |
|
1224 |
|
1225 HBufC* buf; |
|
1226 do |
|
1227 { |
|
1228 buf = table->ReadLongTextLC( TPtrC(WAP_GATEWAY_ADDRESS) ); |
|
1229 if ( ( buf->Compare( KEmpty ) == 0 ) |
|
1230 || ( buf->Compare( KDynIpAddress ) == 0 ) ) |
|
1231 { |
|
1232 err = table->DeleteRecord(); |
|
1233 } |
|
1234 CleanupStack::PopAndDestroy( buf ); |
|
1235 err = table->GotoNextRecord(); |
|
1236 } while ( !err ); |
|
1237 } |
|
1238 } |
|
1239 } |
|
1240 |
|
1241 CLOG( ( ESelect, 1, |
|
1242 _L( "<- CApSelect::GetFilteredSortedIpBearerTableViewLC" ) ) ); |
|
1243 |
|
1244 return table; |
|
1245 } |
321 } |
1246 |
322 |
1247 |
323 |
1248 |
324 |
1249 // --------------------------------------------------------- |
325 // --------------------------------------------------------- |
1250 // CApSelect::GetFilteredSortedIspOutTableViewLC() |
326 // CApSelect::GetFilteredSortedIspOutTableViewLC() |
1251 // --------------------------------------------------------- |
327 // --------------------------------------------------------- |
1252 // |
328 // |
1253 CCommsDbTableView* CApSelect::GetFilteredSortedIspOutTableViewLC() |
329 CCommsDbTableView* CApSelect::GetFilteredSortedIspOutTableViewLC() |
1254 { |
330 { |
1255 CLOG( ( ESelect, 0, |
331 return NULL; |
1256 _L( "-> CApSelect::GetFilteredSortedIspOutTableViewLC" ) ) ); |
|
1257 |
|
1258 CCommsDbTableView* table = NULL; |
|
1259 // ISP-type & bearer type... |
|
1260 if ( ( iBearer & EApBearerTypeCSD ) || |
|
1261 ( iBearer & EApBearerTypeHSCSD ) ) |
|
1262 { |
|
1263 // only needed if CSD or HSCSD |
|
1264 if ( ( iBearer & EApBearerTypeCSD ) && |
|
1265 (!( iBearer & EApBearerTypeHSCSD )) ) |
|
1266 { // needs only CSD |
|
1267 // WHERE ISP_BEARER_TYPE = EBearerTypeCSD |
|
1268 table = iDb->OpenViewMatchingUintLC( TPtrC(DIAL_OUT_ISP), |
|
1269 TPtrC(ISP_BEARER_TYPE), |
|
1270 EBearerTypeCSD |
|
1271 ); |
|
1272 } |
|
1273 else |
|
1274 { |
|
1275 if ( ( iBearer & EApBearerTypeHSCSD ) && |
|
1276 (!( iBearer & EApBearerTypeCSD )) ) |
|
1277 { // needs only HSCSD |
|
1278 // WHERE ISP_BEARER_TYPE = EBearerTypeHSCSD |
|
1279 table = iDb->OpenViewMatchingUintLC( TPtrC(DIAL_OUT_ISP), |
|
1280 TPtrC(ISP_BEARER_TYPE), |
|
1281 EBearerTypeHSCSD |
|
1282 ); |
|
1283 } |
|
1284 else |
|
1285 { |
|
1286 table = iDb->OpenTableLC( TPtrC(DIAL_OUT_ISP) ); |
|
1287 } |
|
1288 } |
|
1289 TInt err; |
|
1290 err = table->GotoFirstRecord(); |
|
1291 |
|
1292 if ( err != KErrNotFound ) |
|
1293 { |
|
1294 User::LeaveIfError( err ); |
|
1295 // now add isp-type filtering |
|
1296 // if Added = ETrue : AND ( ), else : WHERE |
|
1297 // KEApIspTypeInternetOnly, |
|
1298 // KEApIspTypeWAPOnly, |
|
1299 // KEApIspTypeInternetAndWAP, |
|
1300 // KEApIspTypeWAPMandatory, KEApIspTypeAll |
|
1301 TUint32 isp( 0 ); |
|
1302 do |
|
1303 { |
|
1304 table->ReadUintL( TPtrC(ISP_TYPE), isp ); |
|
1305 if ( ( iIsp & KEApIspTypeInternetOnly ) |
|
1306 && ( !( iIsp & KEApIspTypeAll ) ) |
|
1307 ) |
|
1308 {// ( ( ISP_TYPE == EIspTypeInternetOnly ) |
|
1309 if ( isp != EIspTypeInternetOnly ) |
|
1310 { |
|
1311 err = table->DeleteRecord(); |
|
1312 } |
|
1313 } |
|
1314 if ( ( iIsp & KEApIspTypeWAPOnly ) |
|
1315 && ( !( iIsp & KEApIspTypeAll ) ) |
|
1316 ) |
|
1317 { |
|
1318 if ( isp != EIspTypeWAPOnly ) |
|
1319 { |
|
1320 err = table->DeleteRecord(); |
|
1321 } |
|
1322 } |
|
1323 if ( ( iIsp & KEApIspTypeInternetAndWAP ) |
|
1324 && ( !( iIsp & KEApIspTypeAll ) ) |
|
1325 ) |
|
1326 { |
|
1327 if ( isp != EIspTypeInternetAndWAP ) |
|
1328 { |
|
1329 err = table->DeleteRecord(); |
|
1330 } |
|
1331 } |
|
1332 err = table->GotoNextRecord(); |
|
1333 } while ( !err ); |
|
1334 } |
|
1335 } |
|
1336 |
|
1337 CLOG( ( ESelect, 1, |
|
1338 _L( "<- CApSelect::GetFilteredSortedIspOutTableViewLC" ) ) ); |
|
1339 |
|
1340 return table; |
|
1341 } |
332 } |
1342 |
333 |
1343 |
334 |
1344 |
335 |
1345 // --------------------------------------------------------- |
336 // --------------------------------------------------------- |
1346 // CApSelect::GetFilteredSortedGprsTableViewLC() |
337 // CApSelect::GetFilteredSortedGprsTableViewLC() |
1347 // --------------------------------------------------------- |
338 // --------------------------------------------------------- |
1348 // |
339 // |
1349 CCommsDbTableView* CApSelect::GetFilteredSortedGprsTableViewLC( TBool aIn ) |
340 CCommsDbTableView* CApSelect::GetFilteredSortedGprsTableViewLC( TBool aIn ) |
1350 { |
341 { |
1351 CLOG( ( ESelect, 0, |
342 return NULL; |
1352 _L( "-> CApSelect::GetFilteredSortedGprsTableViewLC" ) ) ); |
|
1353 |
|
1354 CCommsDbTableView* table = NULL; |
|
1355 // ISP-type & bearer type... |
|
1356 if ( iBearer & EApBearerTypeGPRS ) |
|
1357 { |
|
1358 // as all other criteria has more than 2 possible values |
|
1359 // and all their combinations should be taken into account, |
|
1360 // I ask the whole table and then narrow it down |
|
1361 // myself with removing the unneded records temporarily |
|
1362 if ( aIn ) |
|
1363 { |
|
1364 table = iDb->OpenTableLC( TPtrC( INCOMING_WCDMA ) ); |
|
1365 } |
|
1366 else |
|
1367 { |
|
1368 table = iDb->OpenTableLC( TPtrC( OUTGOING_WCDMA ) ); |
|
1369 } |
|
1370 TInt err; |
|
1371 err = table->GotoFirstRecord(); |
|
1372 |
|
1373 if ( err != KErrNotFound ) |
|
1374 { |
|
1375 User::LeaveIfError( err ); |
|
1376 // only needed if GPRS |
|
1377 // now add isp-type filtering |
|
1378 // KEApIspTypeInternetOnly, |
|
1379 // KEApIspTypeWAPOnly, |
|
1380 // KEApIspTypeInternetAndWAP, |
|
1381 // KEApIspTypeWAPMandatory, KEApIspTypeAll |
|
1382 TUint32 isp( 0 ); |
|
1383 TUint32 pdptype( 0 ); |
|
1384 TBool deleted(EFalse); |
|
1385 do |
|
1386 { |
|
1387 deleted = EFalse; |
|
1388 // first check if it fits our isp type criteria |
|
1389 TRAPD( res, table->ReadUintL( TPtrC(GPRS_AP_TYPE), isp ) ); |
|
1390 if ( res != KErrUnknown ) |
|
1391 { |
|
1392 if ( ( iIsp & KEApIspTypeInternetOnly ) |
|
1393 && ( !( iIsp & KEApIspTypeAll ) ) |
|
1394 ) |
|
1395 {// ( ( ISP_TYPE == EIspTypeInternetOnly ) |
|
1396 if ( isp != EIspTypeInternetOnly ) |
|
1397 { |
|
1398 err = table->DeleteRecord(); |
|
1399 deleted = ETrue; |
|
1400 } |
|
1401 } |
|
1402 if ( ( iIsp & KEApIspTypeWAPOnly ) |
|
1403 && ( !( iIsp & KEApIspTypeAll ) ) |
|
1404 ) |
|
1405 { |
|
1406 if ( isp != EIspTypeWAPOnly ) |
|
1407 { |
|
1408 err = table->DeleteRecord(); |
|
1409 deleted = ETrue; |
|
1410 } |
|
1411 } |
|
1412 if ( ( iIsp & KEApIspTypeInternetAndWAP ) |
|
1413 && ( !( iIsp & KEApIspTypeAll ) ) |
|
1414 ) |
|
1415 { |
|
1416 if ( isp != EIspTypeInternetAndWAP ) |
|
1417 { |
|
1418 err = table->DeleteRecord(); |
|
1419 deleted = ETrue; |
|
1420 } |
|
1421 } |
|
1422 } |
|
1423 // now check if it fits IPv4 or IPv6 criteria |
|
1424 // Add IPv4 or IPv6 query ONLY if it is supported!!! |
|
1425 if ( ( !deleted ) && ( iExt->iIsIpv6Supported ) ) |
|
1426 { |
|
1427 // if ONLY IPv4 is requested, |
|
1428 // filter out where PDP_type IS IPv6 |
|
1429 // if both is requested, do nothing |
|
1430 // if IPv6 only is requested, filter IN |
|
1431 // where PDP_type IS IPv6 |
|
1432 if ( ( iExt->iReqIpvType == EIPv4 ) || |
|
1433 ( iExt->iReqIpvType == EIPv6 ) ) |
|
1434 { // not both, needs filtering |
|
1435 table->ReadUintL( TPtrC(GPRS_PDP_TYPE), pdptype ); |
|
1436 if ( ( iExt->iReqIpvType == EIPv4 ) |
|
1437 && ( pdptype == RPacketContext::EPdpTypeIPv6 ) |
|
1438 ) |
|
1439 { |
|
1440 err = table->DeleteRecord(); |
|
1441 deleted = ETrue; |
|
1442 } |
|
1443 if ( ( iExt->iReqIpvType == EIPv6 ) |
|
1444 && ( pdptype == RPacketContext::EPdpTypeIPv4 ) |
|
1445 ) |
|
1446 { |
|
1447 err = table->DeleteRecord(); |
|
1448 deleted = ETrue; |
|
1449 } |
|
1450 } |
|
1451 } |
|
1452 err = table->GotoNextRecord(); |
|
1453 } while ( !err ); |
|
1454 } |
|
1455 } |
|
1456 CLOG( ( ESelect, 1, |
|
1457 _L( "<- CApSelect::GetFilteredSortedGprsTableViewLC" ) ) ); |
|
1458 |
|
1459 return table; |
|
1460 } |
343 } |
1461 |
344 |
1462 |
345 |
1463 |
346 |
1464 // --------------------------------------------------------- |
347 // --------------------------------------------------------- |
2319 // CApSelect::AddLanL |
619 // CApSelect::AddLanL |
2320 // --------------------------------------------------------- |
620 // --------------------------------------------------------- |
2321 // |
621 // |
2322 void CApSelect::AddLanL( TBool aWlan ) |
622 void CApSelect::AddLanL( TBool aWlan ) |
2323 { |
623 { |
2324 CLOG( ( ESelect, 0, _L( "-> CApSelect::AddLanL" ) ) ); |
|
2325 |
|
2326 // First get the list of all VPN-s |
|
2327 // get their WAP-ID, IAPID, |
|
2328 // Also ask their RealIApID, bearertype and filter for it... |
|
2329 |
|
2330 CCommsDbTableView* lant = NULL; |
|
2331 |
|
2332 lant = iDb->OpenViewMatchingTextLC( TPtrC(IAP), |
|
2333 TPtrC(IAP_SERVICE_TYPE), |
|
2334 TPtrC(LAN_SERVICE) ); |
|
2335 TInt err = lant->GotoFirstRecord(); |
|
2336 if ( err != KErrNotFound) |
|
2337 { |
|
2338 User::LeaveIfError( err ); |
|
2339 |
|
2340 CArrayFixFlat<TUint32>* laniapid = |
|
2341 new ( ELeave ) CArrayFixFlat<TUint32>( 10 ); |
|
2342 CleanupStack::PushL( laniapid ); |
|
2343 GetUintValuesL( lant, TPtrC(COMMDB_ID), *laniapid ); |
|
2344 |
|
2345 CArrayFixFlat<TUint32>* lanserviceid = |
|
2346 new ( ELeave ) CArrayFixFlat<TUint32>( 10 ); |
|
2347 CleanupStack::PushL( lanserviceid ); |
|
2348 GetUintValuesL( lant, TPtrC(IAP_SERVICE), *lanserviceid ); |
|
2349 |
|
2350 CArrayFixFlat<TUint32>* iapbearerid = |
|
2351 new ( ELeave ) CArrayFixFlat<TUint32>( 10 ); |
|
2352 CleanupStack::PushL( iapbearerid ); |
|
2353 GetUintValuesL( lant, TPtrC(IAP_BEARER), *iapbearerid ); |
|
2354 |
|
2355 // read up access point names, too, just to be as fast as we can... |
|
2356 CArrayPtrFlat<HBufC>* lanapname = |
|
2357 new ( ELeave ) CArrayPtrFlat<HBufC>( 10 ); |
|
2358 CleanupStack::PushL( lanapname ); |
|
2359 GetTextValuesL( lant, TPtrC(COMMDB_NAME), *lanapname ); |
|
2360 |
|
2361 // now get WAP ID's |
|
2362 // CArrayFixFlat<TUint32>* lanwapapid = |
|
2363 // new ( ELeave ) CArrayFixFlat<TUint32>( 10 ); |
|
2364 // CleanupStack::PushL( lanwapapid ); |
|
2365 CApUtils* utils = CApUtils::NewLC( *iDb ); |
|
2366 |
|
2367 TUint32 count( laniapid->Count() ); |
|
2368 TUint32 currlaniapid; |
|
2369 TUint32 currwapapid( 0 ); |
|
2370 CApListItem* item = NULL; |
|
2371 |
|
2372 for ( TUint32 i = 0; i < count; i++) |
|
2373 { |
|
2374 currlaniapid = laniapid->At( i ); |
|
2375 TRAP( err, currwapapid = utils->WapIdFromIapIdL( currlaniapid )); |
|
2376 if ( !err ) |
|
2377 { // get protection for the given record |
|
2378 TInt prot( EFalse ); |
|
2379 CCommsDbTableView* wt = NULL; |
|
2380 |
|
2381 wt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT), |
|
2382 TPtrC(COMMDB_ID), |
|
2383 currwapapid ); |
|
2384 CCommsDbProtectTableView* protview = |
|
2385 (CCommsDbProtectTableView*)wt; |
|
2386 |
|
2387 User::LeaveIfError( wt->GotoFirstRecord() ); |
|
2388 err = protview->GetRecordAccess( prot ); |
|
2389 HBufC* wspage = wt->ReadLongTextLC( TPtrC(WAP_START_PAGE) ); |
|
2390 if ( aWlan ) |
|
2391 { |
|
2392 if ( iExt->iWlanSupported ) |
|
2393 { |
|
2394 // check if it is a WLAN, add ONLY if it IS |
|
2395 TUint32 lanid = lanserviceid->At( i ); |
|
2396 TBool iswlan( EFalse ); |
|
2397 TRAP( err, iswlan = utils->IsWlanL( lanid ) ); |
|
2398 if ( !err && iswlan ) |
|
2399 { |
|
2400 TBool hasssid( EFalse ); |
|
2401 err = KErrNone; |
|
2402 TRAP( err, |
|
2403 hasssid = utils->HasWlanSSIDL( lanid )); |
|
2404 if ( iExt->iIncludeEasyWlan ) |
|
2405 { |
|
2406 hasssid = ETrue; |
|
2407 } |
|
2408 if ( (err == KErrNone) && hasssid ) |
|
2409 { |
|
2410 item = CApListItem::NewLC( |
|
2411 EIspTypeInternetAndWAP, |
|
2412 currwapapid, |
|
2413 *lanapname->At( i ), |
|
2414 EApBearerTypeWLAN, |
|
2415 *wspage, |
|
2416 prot ); |
|
2417 iApList->AppendL( item ); |
|
2418 CleanupStack::Pop( item ); // owned by list |
|
2419 } |
|
2420 } |
|
2421 } |
|
2422 } |
|
2423 else |
|
2424 { |
|
2425 // first check if it is a WLAN, add ONLY if it IS NOT |
|
2426 // then check if it is LANModem, |
|
2427 // then check for LAN, if supported |
|
2428 // check if it is a WLAN, add ONLY if it IS NOT |
|
2429 TUint32 lanid = lanserviceid->At( i ); |
|
2430 TBool iswlan( EFalse ); |
|
2431 TRAP( err, iswlan = utils->IsWlanL( lanid ) ); |
|
2432 if ( !err && !iswlan ) |
|
2433 { |
|
2434 // then check if it is LANModem, |
|
2435 CCommsDbTableView* lanbearer; |
|
2436 lanbearer = |
|
2437 iDb->OpenViewMatchingUintLC( |
|
2438 TPtrC(LAN_BEARER), |
|
2439 TPtrC(COMMDB_ID), |
|
2440 iapbearerid->At(i ) ); |
|
2441 User::LeaveIfError( |
|
2442 lanbearer->GotoFirstRecord() ); |
|
2443 // LANMODEM? check commdb_name |
|
2444 HBufC* lbuf; |
|
2445 lbuf = ApCommons::ReadText16ValueLC( lanbearer, |
|
2446 TPtrC(COMMDB_NAME) ); |
|
2447 // if it is KModemBearerLanModem, it is LANModem |
|
2448 if ( *lbuf == KModemBearerLANModem ) |
|
2449 { |
|
2450 item = CApListItem::NewLC( EIspTypeInternetAndWAP, |
|
2451 currwapapid, |
|
2452 *lanapname->At( i ), |
|
2453 EApBearerTypeLANModem ); |
|
2454 iApList->AppendL( item ); |
|
2455 CleanupStack::Pop( item ); // item owned by list ! |
|
2456 } |
|
2457 else |
|
2458 { |
|
2459 |
|
2460 #ifdef __TEST_LAN_BEARER |
|
2461 // Check for sure it is LAN |
|
2462 // we now it is not WLAN, say it is LAN |
|
2463 item = CApListItem::NewLC( EIspTypeInternetAndWAP, |
|
2464 currwapapid, |
|
2465 *lanapname->At( i ), |
|
2466 EApBearerTypeLAN, |
|
2467 *wspage, |
|
2468 prot ); |
|
2469 iApList->AppendL( item ); |
|
2470 CleanupStack::Pop( item ); // item owned by list ! |
|
2471 #endif // __TEST_LAN_BEARER |
|
2472 } |
|
2473 CleanupStack::PopAndDestroy( lbuf ); |
|
2474 CleanupStack::PopAndDestroy( lanbearer ); |
|
2475 } |
|
2476 } |
|
2477 CleanupStack::PopAndDestroy( wspage ); |
|
2478 CleanupStack::PopAndDestroy( wt ); |
|
2479 } |
|
2480 } |
|
2481 |
|
2482 iCount = iApList->Count(); |
|
2483 iExt->iMaxIndex = iCount-1; |
|
2484 |
|
2485 CleanupStack::PopAndDestroy( utils ); |
|
2486 // CleanupStack::PopAndDestroy( lanwapapid ); |
|
2487 // ResetAndDestroy the array: |
|
2488 CleanupStack::PopAndDestroy( lanapname->Count() ); // lanapname |
|
2489 CleanupStack::PopAndDestroy( lanapname ); // lanapname |
|
2490 CleanupStack::PopAndDestroy( iapbearerid ); |
|
2491 CleanupStack::PopAndDestroy( lanserviceid ); |
|
2492 CleanupStack::PopAndDestroy( laniapid ); |
|
2493 } |
|
2494 |
|
2495 CleanupStack::PopAndDestroy( lant ); |
|
2496 CLOG( ( ESelect, 1, _L( "<- CApSelect::AddLanL" ) ) ); |
|
2497 } |
624 } |
2498 |
625 |
2499 |
626 |
2500 // --------------------------------------------------------- |
627 // --------------------------------------------------------- |
2501 // CApSelect::GetSupportedBearerSet |
628 // CApSelect::GetSupportedBearerSet |
2502 // --------------------------------------------------------- |
629 // --------------------------------------------------------- |
2503 // |
630 // |
2504 TInt CApSelect::GetSupportedBearerSet( TInt aBearerFilter ) |
631 TInt CApSelect::GetSupportedBearerSet( TInt aBearerFilter ) |
2505 { |
632 { |
2506 TInt retval = aBearerFilter; |
633 return 0; |
2507 |
|
2508 TBool isCsdSupported = |
|
2509 FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport ); |
|
2510 #ifdef __TEST_CSD_SUPPORT |
|
2511 isCsdSupported = ETrue; |
|
2512 #endif // __TEST_CSD_SUPPORT |
|
2513 |
|
2514 |
|
2515 #ifdef __TEST_USE_SHARED_DATA |
|
2516 TInt isHscsdSupported = ETrue; |
|
2517 /* |
|
2518 ApCommons::IsGivenSharedDataSupportL( KGeneralSettingsUid, |
|
2519 KGSHSCSDAccessPoints ); |
|
2520 */ |
|
2521 #else |
|
2522 TInt isHscsdSupported = ETrue; |
|
2523 #endif // __TEST_USE_SHARED_DATA |
|
2524 |
|
2525 #ifdef __TEST_HSCSD_SUPPORT |
|
2526 isHscsdSupported = ETrue; |
|
2527 #endif // __TEST_HSCSD_SUPPORT |
|
2528 |
|
2529 if ( !isCsdSupported ) |
|
2530 { // remove CSD, HSCSD, do not allow ALL |
|
2531 if ( aBearerFilter & EApBearerTypeAll ) |
|
2532 { |
|
2533 retval &= ~EApBearerTypeCSD; |
|
2534 retval &= ~EApBearerTypeHSCSD; |
|
2535 } |
|
2536 else |
|
2537 { |
|
2538 if ( aBearerFilter & EApBearerTypeCSD ) |
|
2539 { |
|
2540 retval &= ~EApBearerTypeCSD; |
|
2541 } |
|
2542 if ( aBearerFilter & EApBearerTypeHSCSD ) |
|
2543 { |
|
2544 retval &= ~EApBearerTypeHSCSD; |
|
2545 } |
|
2546 } |
|
2547 } |
|
2548 |
|
2549 if ( !isHscsdSupported ) |
|
2550 { // HSCSD |
|
2551 if ( ( aBearerFilter & EApBearerTypeAll ) |
|
2552 || ( aBearerFilter & EApBearerTypeHSCSD ) ) |
|
2553 { |
|
2554 retval &= ~EApBearerTypeHSCSD; |
|
2555 } |
|
2556 } |
|
2557 return retval; |
|
2558 } |
634 } |
2559 |
635 |
2560 |
636 |
2561 // End of File |
637 // End of File |