_LIT(KName, "Internet access point");
_LIT(NameID, "%S/%d");
void CIAPSetting::LoadSettingValuesL()
{
// load values into iSettings

TFileName iapName,iapNameID;
TUint32 iapID;
TInt err;
HBufC* text;


TBool isNumberedStyle = IsNumberedStyle();
CArrayPtr<CGulIcon>* icons = ListBox()->ItemDrawer()->FormattedCellData()->IconArray();

CAknEnumeratedTextPopupSettingItem* item = new (ELeave) CAknEnumeratedTextPopupSettingItem(1, iEnumText);
CleanupStack::PushL(item);
// The same resource id can be used for multiple enumerated text setting pages.
item->ConstructL(isNumberedStyle, 1, KName, icons, R_ENUMERATEDTEXT_SETTING_PAGE, -1, 0, R_POPUP_SETTING_TEXTS);


// Load texts dynamically.
CArrayPtr<CAknEnumeratedText>* texts = item->EnumeratedTextArray();
texts->ResetAndDestroy();
CAknEnumeratedText* enumText;



// open the IAP communications database
CCommsDatabase* commDB = CCommsDatabase::NewL();
CleanupStack::PushL(commDB);

// Open the IAP table
CCommsDbTableView* view = commDB->OpenTableLC(TPtrC(IAP));
TUint32 SavedIapID = iCamViewDocument->IapId();
TUint32 MaxID=0;
//print_log("\nget from data(%d)",TempIapID);
// Point to the first entry
if (view->GotoFirstRecord() == KErrNone)
{
do
{
view->ReadTextL(TPtrC(COMMDB_NAME), iapName);
view->ReadUintL(TPtrC(COMMDB_ID), iapID);
//iapNameID.Format(NameID,&iapName,iapID);
//text = iapNameID.AllocLC();
text = iapName.AllocLC();
enumText = new (ELeave) CAknEnumeratedText(iapID, text);
CleanupStack::Pop(text);
CleanupStack::PushL(enumText);

if( SavedIapID == iapID)
texts->InsertL(0,enumText);
else
texts->AppendL(enumText);

if(iapID > MaxID)
MaxID = iapID;

CleanupStack::Pop(enumText);
// Store name and ID to where you want to
} while (err = view->GotoNextRecord(), err == KErrNone);
}

CleanupStack::PopAndDestroy(); // view
CleanupStack::PopAndDestroy(); // commDB

SettingItemArray()->AppendL(item);

CleanupStack::Pop(item);

SettingItemArray()->RecalculateVisibleIndicesL();
HandleChangeInItemArrayOrVisibilityL();

if((SavedIapID > 0) && (SavedIapID <= MaxID))
iEnumText = SavedIapID;
else
iEnumText = 1;

}

    全站熱搜

    NatPixnet 發表在 痞客邦 留言(0) 人氣()