}
}
delete pPhoneEnum;
- pPhoneNumberList->RemoveAll(true);
- delete pPhoneNumberList;
- }
+ pPhoneNumberList->RemoveAll(true);
+ delete pPhoneNumberList;
+ }
+ if(pFoundContact != null)
+ {
+ break;
}
- delete pContactEnum;
- pContactList->RemoveAll(true);
- delete pContactList;
+ }
+ delete pContactEnum;
+ pContactList->RemoveAll(true);
+ delete pContactList;
if(pFoundContact == null)
{
res = __pPlayer->OpenFile(ringTonePath,false);
if(res != E_SUCCESS)
{
- AppLogDebug("__pPlayer Construct failed with %d",res);
+ AppLogDebug("__pPlayer OpenFile failed with %d",res);
return;
}
res = __pPlayer->SetLooping(true);
if(res != E_SUCCESS)
{
- AppLogDebug("__pPlayer Construct failed with %d",res);
+ AppLogDebug("__pPlayer SetLooping failed with %d",res);
return;
}
res = __pPlayer->SetVolume(80);
if(res != E_SUCCESS)
{
- AppLogDebug("__pPlayer Construct failed with %d",res);
+ AppLogDebug("__pPlayer SetVolume failed with %d",res);
return;
}
res = SetSoundMode(SOUND_MODE_RINGTONE);
res = __pPlayer->Play();
if(res != E_SUCCESS)
{
- AppLogDebug("__pPlayer Construct failed with %d",res);
+ AppLogDebug("__pPlayer Play failed with %d",res);
return;
}
}
if(res != E_SUCCESS)
{
AppLogDebug("__pPlayer Stop failed with %d",res);
- return;
+
}
res = __pPlayer->Close();
if(res != E_SUCCESS)
{
AppLogDebug("__pPlayer Close failed with %d",res);
- return;
+
}
SetSoundMode(SOUND_MODE_VOICE);
__isSoundStatusOn = false;
int
CallLogManager::GetPersonId(Tizen::Base::String& phoneNumber)
{
+ AppLogDebug("Enter");
int personId = -1;
+ bool bContactFound = false;
if (pAddressBook != null)
{
IList* pNumberContactsList = pAddressBook->SearchContactsByPhoneNumberN(phoneNumber);
+ if (pNumberContactsList == null || IsFailed(GetLastResult()))
+ {
+ return -1;
+ }
+
+ //Fetch the contact's info to be displayed
+ IEnumerator* pContactEnum = pNumberContactsList->GetEnumeratorN();
if(pNumberContactsList != null)
{
- Contact* pContact = static_cast<Contact*>(pNumberContactsList->GetAt(0));
- if(pContact != null)
+ while (E_SUCCESS == pContactEnum->MoveNext())
{
- personId = pContact->GetPersonId();
+ Contact* pContact = static_cast<Contact*>(pContactEnum->GetCurrent());
+
+ IList* pPhoneNumberList = pContact->GetValuesN(CONTACT_MPROPERTY_ID_PHONE_NUMBERS);
+ if (pPhoneNumberList != null)
+ {
+ IEnumerator* pPhoneEnum = pPhoneNumberList->GetEnumeratorN();
+ while (E_SUCCESS == pPhoneEnum->MoveNext())
+ {
+ PhoneNumber* pPhoneNumber = (PhoneNumber*) pPhoneEnum->GetCurrent();
+ //Check if this is the correct contact
+ if (pPhoneNumber->GetPhoneNumber().Equals(phoneNumber))
+ {
+ //save newly fetched contact info.
+ bContactFound = true;
+ personId = pContact->GetPersonId();
+ break;
+ }
+ }
+ delete pPhoneEnum;
+ pPhoneNumberList->RemoveAll(true);
+ delete pPhoneNumberList;
+ }
+ if(bContactFound == true)
+ {
+ break;
+ }
}
}
+ delete pContactEnum;
+ pNumberContactsList->RemoveAll(true);
+ delete pNumberContactsList;
}
return personId;
}