//
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Flora License, Version 1.1 (the License);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
* @file CalllogManager.cpp
* @brief This class provides call log APIs
*/
-#include "CalllogManager.h"
#include <FLocales.h>
+#include "CallApp.h"
+#include "CalllogManager.h"
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
}
result
-CallLogManager::AddCallogInfoToDatabase(CallInfo* calllogInfo)
+CallLogManager::AddCallogInfoToDatabase(AppCallInfo* calllogInfo)
{
AppLog(" AddVoiceCallInfo Entry");
int duration = 0;
case CALL_LOG_TYPE_VOICE_OUTGOING:
logType = CONTACTS_PLOG_TYPE_VOICE_OUTGOING;
break;
- case CALL_LOG_TYPE_VOICE_MISSED:
+ case CALL_LOG_TYPE_VOICE_MISSED_UNSEEN:
logType = CONTACTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN;
break;
case CALL_LOG_TYPE_VOICE_REJECTED:
else
{
//start time is in miliseconds . so convert to seconds and set it to time_t format.
- long long connectTime = calllogInfo->GetCallConnectTime();
+ long long connectTime = calllogInfo->GetDurationTime();
if(connectTime == 0 || connectTime < 0)
{
- connectTime = time(null);
+ //connectTime = time(null);
+ CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
+ connectTime = pPhoneApp->GetCallAppTicks();
+ connectTime /=1000;
}
else
{
- connectTime = calllogInfo->GetCallConnectTime()/ 1000;
+ connectTime = calllogInfo->GetDurationTime()/ 1000;
}
duration = (int)GetDuration(connectTime);
}
unsigned long
CallLogManager::GetDuration(long long start_time)
{
- time_t curr_time;
+ long long curr_time;
unsigned long call_duration_in_sec = 50;
- curr_time = time(0);
+// curr_time = time(0);
+ CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
+ curr_time = pPhoneApp->GetCallAppTicks();
+ curr_time /=1000;
/*if(start_time != 0)
{
start_time /= 1000;
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;
}