TInt CConnectionManager::SelectIAP() { CArrayFixFlat<TIapData>* iEApList=new (ELeave) CArrayFixFlat<TIapData>(2) ; TInt stack=0; // Make listitems. and PUSH it CAknSinglePopupMenuStyleListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox; CleanupStack::PushL(list); stack++; // Create popup list and PUSH it. CAknPopupList* popupList = CAknPopupList::NewL(list, R_AVKON_SOFTKEYS_OK_CANCEL, AknPopupLayouts::EMenuWindow); CleanupStack::PushL(popupList);stack++; CDesCArrayFlat* items = new (ELeave) CDesCArrayFlat(5); CleanupStack::PushL(items);stack++; // initialize listbox. list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect); list->CreateScrollBarFrameL(ETrue); list->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); TBuf<52> iapfromtable; TInt err = KErrNone; CCommsDatabase* iCommsDB=CCommsDatabase::NewL(EDatabaseTypeIAP); CleanupStack::PushL(iCommsDB);stack++; #ifdef __SERIES60_3X__ CCommsDbTableView* gprsTable = iCommsDB->OpenIAPTableViewMatchingBearerSetLC( iBearerFilter == EApBearerTypeWLAN ? ECommDbBearerWLAN : ECommDbBearerGPRS|ECommDbBearerWLAN|ECommDbBearerVirtual, ECommDbConnectionDirectionOutgoing); #else CCommsDbTableView* gprsTable = iCommsDB->OpenIAPTableViewMatchingBearerSetLC( ECommDbBearerGPRS|ECommDbBearerVirtual, ECommDbConnectionDirectionOutgoing); #endif User::LeaveIfError(gprsTable->GotoFirstRecord()); TInt i=0; TUint32 id; TIapData eap; TInt cur =0; //current value do { gprsTable->ReadTextL(TPtrC(COMMDB_NAME), iapfromtable); gprsTable->ReadUintL(TPtrC(COMMDB_ID), id); items->AppendL(iapfromtable); eap.iIap = id; eap.iName.Copy(iapfromtable); iEApList->AppendL(eap); err = gprsTable->GotoNextRecord(); i++; } while (err == KErrNone); CleanupStack::PopAndDestroy(2); stack--; // Set listitems. CTextListBoxModel* model = list->Model(); model->SetItemTextArray(items); model->SetOwnershipType(ELbmOwnsItemArray); CleanupStack::Pop(); popupList->SetTitleL(_L("Access Point")); list->SetListBoxObserver(popupList); TInt popupOk = popupList->ExecuteLD(); CleanupStack::Pop(); TInt iap=0; if (popupOk) { TInt index = list->CurrentItemIndex(); iap=(*iEApList)[index].iIap; } CleanupStack::PopAndDestroy(); iEApList->Reset(); delete iEApList; return iap; }