I wonder how the CPbkContact.. works. When running the following code the CAknMessageQueryDialog shows "first name: ", when it should be "first name: Some Name". What is wrong?
RDesReadStream iDesRead(aDes);
CPbkContactEngine* pbkEngine = CPbkContactEngine::NewL();
CleanupStack::PushL(pbkEngine);
CBCardEngine* bcardEngine = CBCardEngine::NewL(pbkEngine);
CleanupStack::PushL(bcardEngine);
CPbkContactItem* contac = pbkEngine->CreateEmptyContactL();
CleanupStack::PushL(contac);
bcardEngine->ImportBusinessCardL(*contac, iDesRead);
//This should be done after a question , e g "Do you want to store this vCard in your address book?
if (showInformationDialog(contac) == EAknSoftkeyYes)
pbkEngine->CommitContactL(*contac);
TInt
CTerminalAppAppUi::
showInformationDialog(CPbkContactItem* contact)
{
TBuf<100> bufStoring;
CCoeEnv::Static()->ReadResource(bufStoring, R_QUESTION_STORE_VCARD);
TBuf<30> bufTitle;
CCoeEnv::Static()->ReadResource(bufTitle, R_QUESTION_STORE_VCARD_TITLE);
HBufC* bodyText = NULL;
HBufC* titleText = NULL;
TInt iResourceId = 0;
bodyText = HBufC::NewL(150);
titleText = HBufC::NewL(30);
//THIS PART I AM NOT SURE ABOUT:
bodyText->Des().Append(bufStoring);
bodyText->Des().Append('\n'😉;
bodyText->Des().Append(contact->CardFields()[0].Label());
bodyText->Des().Append(':'😉;
bodyText->Des().Append(contact->CardFields()[0].PbkFieldText());
titleText->Des().Append(bufTitle);
iResourceId = R_DIALOG_POPUP_QUERY;
setPopupColors();
CAknMessageQueryDialog* dlg = NULL;
dlg = CAknMessageQueryDialog::NewL(bodyText->Des());
delete bodyText;
dlg->PrepareLC(iResourceId);
dlg->QueryHeading()->SetTextL(titleText->Des());
delete titleText;
TInt ret = dlg->RunLD();
resetPopupColors();
return ret;
}
Joachim