Phone Book need help ASP
| Mon, 2005-08-01 11:44 | |
|
Hi need some help i want to get name and phone number od a user and store in a Tbuf8 what am i doing worng i only get junk stored
RPbkViewResourceFile phonebookResource( *(CEikonEnv::Static()) ); if ( !phonebookResource.IsOpen()) { phonebookResource.OpenL(); } iPbkContactEngine = CPbkContactEngine::NewL(); // Add searching array to parameters CContactDatabase::TContactViewFilter filter(CContactDatabase::EPhonable); CPbkMultipleEntryFetchDlg::TParams params; params.iContactView = &iPbkContactEngine->FilteredContactsViewL( filter ); // Launch fetching dialog CPbkMultipleEntryFetchDlg* fetchDlg = CPbkMultipleEntryFetchDlg::NewL( params, * iPbkContactEngine); fetchDlg->SetMopParent( this ); TInt okPressed = fetchDlg->ExecuteLD(); CleanupStack::PushL( params.iMarkedEntries ); HBufC *infoText2; TBuf8<50> InfoBuf; TBuf8<50> addrBuf; if ( okPressed ) { TInt paramCount = params.iMarkedEntries->Count(); // Get the selected contacts id array for ( TInt i = 0; i < paramCount; ++i ) { const TContactItemId cid = ( *params.iMarkedEntries )[i]; // Open the selected contact using Phonebook engine, // choose correct number (launch list query if needed) CPbkContactItem* pbkItem = iPbkContactEngine->ReadContactLC( cid ); TPtrC tempAddress; CPbkPhoneNumberSelect* selectDlg = new (ELeave) CPbkPhoneNumberSelect( ); // tempAddress.Set( selectDlg->ExecuteLD(*pbkItem, pbkItem->DefaultSmsField() , ETrue) ); infoText2 = pbkItem->GetContactTitleL(); HBufC* infoText = StringLoader::LoadLC(R_INFO_TEXT); CEikonEnv::Static()->InfoWinL(*pbkItem->GetContactTitleL(), selectDlg->ExecuteLD(*pbkItem, pbkItem->DefaultSmsField() , ETrue)) ; iClient->IssueWrite((TDesC8&)*pbkItem->GetContactTitleL()); // iClient->IssueWrite((TDesC8)(selectDlg->ExecuteLD(*pbkItem, pbkItem->DefaultSmsField() , ETrue))); // CEikonEnv::Static()->InfoWinL(*infoText2, tempAddress ); // addrBuf.FillZ(); // addrBuf.SetLength(0); // InfoBuf.FillZ(); // InfoBuf.SetLength(0); /* for(int i = 0 ; i < infoText2->Length() ; i++) { InfoBuf.Append(infoText2[i]); }*/ /*for(int i = 0 ; i < tempAddress.Length() ; i++) { addrBuf.Append(infoText2[i]); }*/ //infoText2; //iClient->IssueWrite(InfoBuf); //iClient->PhoneInfoSend(_L8("InfoBuf"), _L8("addrBuf")); // addrBuf.FillZ(); addrBuf.SetLength(0); InfoBuf.FillZ(); InfoBuf.SetLength(0); CleanupStack::PopAndDestroy(2); // pbkItem, infoText |
|






Forum posts: 36
if ( !phonebookResource.IsOpen())
{
phonebookResource.OpenL();
}
CPbkContactEngine* iPbkContactEngine = CPbkContactEngine::NewL();
// Add searching array to parameters
CContactDatabase::TContactViewFilter filter(CContactDatabase::ESmsable);
CPbkMultipleEntryFetchDlg::TParams params;
params.iContactView = &iPbkContactEngine->FilteredContactsViewL( filter );
// Launch fetching dialog
CPbkMultipleEntryFetchDlg* fetchDlg = CPbkMultipleEntryFetchDlg::NewL( params, * iPbkContactEngine);
fetchDlg->SetMopParent( this );
TInt okPressed = fetchDlg->ExecuteLD();
if ( okPressed )
{
TBuf<30> firstName;
TBuf<30> lastName;
TBuf<30> phoneNumber;
TInt paramCount = params.iMarkedEntries->Count();
// Get the selected contacts id array
for ( TInt i = 0; i < paramCount; ++i )
{
const TContactItemId cid = ( *params.iMarkedEntries )[i];
// Open the selected contact using Phonebook engine,
// choose correct number (launch list query if needed)
CPbkContactItem* pbkItem = iPbkContactEngine->ReadContactLC( cid );
TPbkContactItemField* tmp;
if ((tmp = pbkItem->FindField(EPbkFieldIdFirstName)) != NULL)
{
firstName = tmp->Text();
}
if ((tmp = pbkItem->FindField(EPbkFieldIdLastName)) != NULL)
{
lastName = tmp->Text();
}
if ((tmp = pbkItem->FindField(EPbkFieldIdPhoneNumberMobile)) != NULL)
{
phoneNumber = tmp->Text();
}
else if ((tmp = pbkItem->FindField(EPbkFieldIdPhoneNumberGeneral)) != NULL)
{
phoneNumber = tmp->Text();
}
}
}
Forum posts: 45
"If we knew what it was we were doing, it would not be called research, would it?" - Albert Einstein
Forum posts: 34
Nice piece of code.
It helped me a lot.
Thanks.
Regards
Shilpa K
Forum posts: 52
Excellent code
It helped me a lot
thank u very much....
Thanx&Regards
vijay
ready to face