, public Tizen::Ui::Scenes::ISceneEventListener
, public Tizen::Base::Runtime::ITimerEventListener
, public Tizen::Ui::IOrientationEventListener
+ , public Tizen::Social::IAddressbookChangeEventListener
{
public:
ActiveCallForm(FormType formType);
void HandleConfCallChanged(void);
// Used to update multiple call screen
void UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList);
-
+ //IAddressbookChangeEventListener
+ virtual void OnContactsChanged(const Tizen::Base::Collection::IList& contactChangeInfoList);
+ virtual void OnCategoriesChanged(const Tizen::Base::Collection::IList& categoryChangeInfoList);
//From IOrientationEventListener
virtual void OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus);
//From IAppStateChangeListener
//Custom Buttons Panel
CallButtonsPanel* __pCallButtonsPanel;
DtmfKeyPadPanel* __pDTMFKeypad;
+ Tizen::Social::Addressbook* __pAddressbook;
//Option Menu List for conference call
Tizen::Ui::Controls::ListView* __pMoreOptionsList;
Tizen::Ui::Controls::Label* __pMoreOptionsListAnchor;
#include <FBase.h>
#include <FSocial.h>
+#include <FSclTypes.h>
#include "CallTypes.h"
/**
Tizen::Base::String& GetContactNumber(void);
//Set the contact number for the call
void SetContactNumber(Tizen::Base::String& contactNumber);
+ void ResetContactNumber(Tizen::Base::String* contactNumber);
+ void ResetContactInfo(const Tizen::Social::Contact* contact);
//Sets the contact info for the call
void SetContactInfo(const Tizen::Social::Contact& contact);
//returns contact info if present in contacts db
// this funtion fetches the contact person's name.
Tizen::Base::String* FetchCallerNameN(void);
+ //Returns the latest Caller Name for a Number from address book
+ Tizen::Base::String* FetchLatestCallerNameN(const Tizen::Base::String& phoneNumber);
// this funtion fetches the contact person's photo id, if present.
Tizen::Graphics::Bitmap* FetchCallerPhotoN(void);
+ //Returns the latest Caller Photo for a Number from address book
+ Tizen::Graphics::Bitmap* FetchLatestCallerPhotoN(const Tizen::Base::String& phoneNumber);
+ //Returns the Contact Matched for the PhoneNumber from address book
+ Tizen::Social::Contact* FetchContactN(const Tizen::Base::String& phoneNumber);
+
+
private:
bool __isConfCall;
__pActiveCallInfo = null;
__pHeldCallInfo = null;
__isSwapInProgress = false;
+ __pAddressbook == null;
}
ActiveCallForm::~ActiveCallForm(void)
//Initialize keypad and buttons
InitializeCallButtonsPanel();
+ AddressbookManager* pAddressbookManager = AddressbookManager::GetInstance();
+ __pAddressbook = pAddressbookManager->GetAddressbookN(DEFAULT_ADDRESSBOOK_ID);
+ if(__pAddressbook != null)
+ {
+ __pAddressbook->SetAddressbookChangeEventListener(this);
+ }
+
+
if (__pActiveCallInfo != null)
{
delete __pActiveCallInfo;
__DtmfString.Clear();
CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
pCallApp->RemoveAppStateChangeListener(*this);
+ if(__pAddressbook != null)
+ {
+ __pAddressbook->SetAddressbookChangeEventListener(null);
+ }
}
void
}
void
+ActiveCallForm::OnContactsChanged(const Tizen::Base::Collection::IList& contactChangeInfoList)
+{
+ AppLog("Enter");
+ switch (__formType)
+ {
+
+ case FORMTYPE_EMERGENCYOUTGOINGCALL:
+ {
+ }
+ break;
+
+ case FORMTYPE_OUTGOINGCALL:
+ case FORMTYPE_ACTIVECALL:
+ {
+ String pContactNumber;
+ pContactNumber.Append(__pActiveCallInfo->GetContactNumber());
+ Contact* pContact = __pCallPresentor->GetContactN(__pActiveCallInfo->GetContactNumber());
+ if(pContact == null)
+ {
+ __pActiveCallInfo->ResetContactNumber(null);
+ __pActiveCallInfo->ResetContactInfo(null);
+
+ }
+ else
+ {
+ __pActiveCallInfo->SetContactNumber(pContactNumber);
+ __pActiveCallInfo->SetContactInfo(*pContact);
+ }
+ if(pContact != null)
+ {
+ delete pContact;
+ pContact = null;
+ }
+ ShowPersonDetails(pContactNumber, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
+ }
+ break;
+
+ case FORMTYPE_EMERGENCYACTIVECALL:
+ {
+ }
+ break;
+
+ case FORMTYPE_MULTIPLECALLS:
+ {
+
+ IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
+ int listCount = pCallsList->GetCount();
+ for(int index = 0; index < listCount; index++)
+ {
+ AppCallInfo callInfo;
+ Contact* pContact;
+ pCallsList->GetAt(index, callInfo);
+ if(__pActiveCallInfo == null)
+ {
+ __pActiveCallInfo = new (std::nothrow) AppCallInfo();
+ }
+ *__pActiveCallInfo = callInfo;
+ String contactNumber;
+ contactNumber.Append(__pActiveCallInfo->GetContactNumber());
+ pContact = __pCallPresentor->GetContactN(__pActiveCallInfo->GetContactNumber());
+ if(pContact == null)
+ {
+ __pActiveCallInfo->ResetContactNumber(null);
+ __pActiveCallInfo->ResetContactInfo(null);
+
+ }
+ else
+ {
+ __pActiveCallInfo->SetContactNumber(contactNumber);
+ __pActiveCallInfo->SetContactInfo(*pContact);
+ }
+ if(pContact != null)
+ {
+ delete pContact;
+ pContact = null;
+ }
+ if(callInfo.IsOnHold() == false)
+ {
+ ShowPersonDetails(contactNumber, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
+ }
+ else
+ {
+ ShowPersonDetails(contactNumber, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pActiveCallInfo);
+ }
+
+ }
+ if(pCallsList != null)
+ {
+ delete pCallsList;
+ pCallsList = null;
+ }
+ //pCallsList = __pCallPresentor->GetCallListN();
+ //update calls state
+ //UpdateMultipleCallScreen(*pCallsList);
+ //delete pCallsList;
+ //pCallsList = null;
+ }
+ break;
+
+ case FORMTYPE_ACTIVECONFCALL:
+ {
+ int participantsCount = __pActiveCallInfo->GetCallerListCount();
+ IListT<AppCallInfo>* pParticipantListCallHandles = __pActiveCallInfo->GetCallerList();
+ for(int listCount = 0; listCount < participantsCount; listCount++)
+ {
+
+ }
+
+ }
+ break;
+
+ default:
+ break;
+ }
+
+
+
+
+ AppLog("Exit");
+}
+
+void
+ActiveCallForm::OnCategoriesChanged(const Tizen::Base::Collection::IList& categoryChangeInfoList)
+{
+ //No implementation
+}
+
+
+void
ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
{
AppLog("ENTER");
void
ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
{
+ result r = E_FAILURE;
+
//call individual methods to show contact number, caller name & photo
ShowPhoneNumber(phoneNumber, contactLblName);
//fetch contact details based on phone number
- String* pDisplayName = pCallInfo->FetchCallerNameN();
+ String* pDisplayName = pCallInfo->FetchLatestCallerNameN(phoneNumber);
ShowCallerName(*pDisplayName, nameLblName);
- Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
+ Bitmap* pPhotoBitmap = pCallInfo->FetchLatestCallerPhotoN(phoneNumber);
ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
//free resources
if (pPhotoLbl)
{
pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
+ pPhotoLbl->Invalidate(true);
}
delete pDefaultPhoto;
}
if(pCallInfo->IsConferenceCall() == false)
{
//fetch contact details based on phone number
- pDisplayName = pCallInfo->FetchCallerNameN();
+ pDisplayName = pCallInfo->FetchLatestCallerNameN(phoneNumber);
}
else
{
Bitmap* pPhotoBitmap = null;
if(pCallInfo->IsConferenceCall() == false)
{
- pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
+ pPhotoBitmap = pCallInfo->FetchLatestCallerPhotoN(phoneNumber);
}
//passing an empty string to SetText fails in label,
SetTextToLabel(phoneNumber, contactLblName);
//fetch contact details based on phone number
- String* pDisplayName = pCallInfo->FetchCallerNameN();
- Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
+ String* pDisplayName = pCallInfo->FetchLatestCallerNameN(phoneNumber);
+ Bitmap* pPhotoBitmap = pCallInfo->FetchLatestCallerPhotoN(phoneNumber);
ShowCallerPhoto(pPhotoBitmap);
//free resources
}
void
+AppCallInfo::ResetContactNumber(String* contactNumber)
+{
+ if(contactNumber == null)
+ {
+ if (__isConfCall == false)
+ {
+ __contactNumber = null;
+ }
+ }
+
+}
+
+void
+AppCallInfo::ResetContactInfo(const Contact* contact)
+{
+ if(contact == null)
+ {
+ if (__pContact != null)
+ {
+ delete __pContact;
+ __pContact = null;
+ }
+ }
+}
+void
AppCallInfo::SetContactNumber(String& contactNumber)
{
if (__isConfCall == false)
AppCallInfo::FetchCallerNameN(void)
{
String displayName(L"");
-
//get caller name from already fetched contact info
if (__pContact != null)
{
String firstName(L"");
String lastName(L"");
String middlename(L"");
- __pContact->GetValue(CONTACT_PROPERTY_ID_FIRST_NAME, firstName);
- __pContact->GetValue(CONTACT_PROPERTY_ID_LAST_NAME, lastName);
+ __pContact->GetValue(CONTACT_PROPERTY_ID_FIRST_NAME, firstName);
+ __pContact->GetValue(CONTACT_PROPERTY_ID_LAST_NAME, lastName);
__pContact->GetValue(CONTACT_PROPERTY_ID_MIDDLE_NAME, middlename);
displayName.Append(firstName + middlename + lastName);
return new (std::nothrow) String(displayName);
}
+Contact*
+AppCallInfo::FetchContactN(const Tizen::Base::String& phoneNumber)
+{
+ Tizen::Social::Contact* pFoundContact = null;
+ if(__pAddressBook == null)
+ {
+ __pAddressBook = AddressbookManager::GetInstance()->GetAddressbookN();
+ }
+ IList* pContactList = __pAddressBook->SearchContactsByPhoneNumberN(phoneNumber);
+ if (pContactList == null || IsFailed(GetLastResult()))
+ {
+ return null;
+ }
+
+ //Fetch the contact's info to be displayed
+ IEnumerator* pContactEnum = pContactList->GetEnumeratorN();
+ while (E_SUCCESS == pContactEnum->MoveNext())
+ {
+ 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.
+ pFoundContact = new (std::nothrow) Contact(*pContact);
+ break;
+ }
+ }
+ delete pPhoneEnum;
+ pPhoneNumberList->RemoveAll(true);
+ delete pPhoneNumberList;
+ }
+ }
+ delete pContactEnum;
+ pContactList->RemoveAll(true);
+ delete pContactList;
+
+ if(pFoundContact == null)
+ {
+ return null;
+ }
+
+ return pFoundContact;
+
+}
+
+
+String*
+AppCallInfo::FetchLatestCallerNameN(const Tizen::Base::String& phoneNumber)
+{
+ String displayName(L"");
+ Tizen::Social::Contact* pContact = null;
+ //Fetch the contact for a number from address book
+ pContact = FetchContactN(phoneNumber);
+ if(pContact != null)
+ {
+ String firstName(L"");
+ String lastName(L"");
+ String middlename(L"");
+ pContact->GetValue(CONTACT_PROPERTY_ID_FIRST_NAME, firstName);
+ pContact->GetValue(CONTACT_PROPERTY_ID_LAST_NAME, lastName);
+ pContact->GetValue(CONTACT_PROPERTY_ID_MIDDLE_NAME, middlename);
+ displayName.Append(firstName + middlename + lastName);
+
+ if (displayName.IsEmpty() == false)
+ {
+ pContact->GetValue(CONTACT_PROPERTY_ID_DISPLAY_NAME, displayName);
+ }
+ }
+
+ return new (std::nothrow) String(displayName);
+
+
+}
+Bitmap*
+AppCallInfo::FetchLatestCallerPhotoN(const Tizen::Base::String& phoneNumber)
+{
+ result r = E_FAILURE;
+ Tizen::Social::Contact* pContact = null;
+ String thumbnailPath;
+ Bitmap* pThumbnail = null;
+ pContact = FetchContactN(phoneNumber);
+ if(pContact != null)
+ {
+ pContact->GetValue(CONTACT_PROPERTY_ID_THUMBNAIL,thumbnailPath);
+ if(thumbnailPath.IsEmpty() == true)
+ {
+ IList* pCategoryList = __pAddressBook->GetCategoriesByContactN(pContact->GetRecordId());
+ if(pCategoryList != null && pCategoryList->GetCount() > 0)
+ {
+ AppLogDebug("Changes to get thumbnail group photo");
+ Category* pCategory = static_cast<Category*>(pCategoryList->GetAt(0));
+ thumbnailPath = pCategory->GetThumbnailPath();
+ }
+ }
+ ImageBuffer thumbnailImageBuffer;
+ r = thumbnailImageBuffer.Construct(thumbnailPath);
+ if (r == E_SUCCESS)
+ {
+ pThumbnail = thumbnailImageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_ARGB8888, BUFFER_SCALING_NONE);
+ }
+
+ if(pThumbnail != null)
+ {
+ return pThumbnail;
+ }
+ }
+
+ return null;
+
+}
+
Bitmap*
AppCallInfo::FetchCallerPhotoN(void)
{
TelephonyManager::EndActiveCall(Long callHandle)
{
result r = E_FAILURE;
-
//fetch ended callInfo from active call list
AppCallInfo endCall;
r = __pActiveCallList->GetValue(callHandle.ToLong(), endCall);
{
r = EndCall(endCall);
}
+
return r;
}
AppLog("ENTER");
//This callback comes only if a conference call is ended by user.
TelephonyManager* pTelManager = (TelephonyManager*) pUserData;
+ AppCallInfo heldCall;
if (callBackResult == TAPI_CAUSE_SUCCESS && pData != null)
{
//fetch ended confCall details
{
//fetch active calls to show appropriate scene
pCallList = static_cast<ArrayListT<AppCallInfo>*>(pTelManager->__pActiveCallList->GetValuesN());
+ r = pCallList->GetAt(0, heldCall);
+ if (r == E_SUCCESS)
+ {
+ //pTelManager->HoldActiveCall(&heldCall, false);
+ AppCallInfo* pHeldCallInfo = new (std::nothrow) AppCallInfo();
+ unsigned int callHandle = heldCall.GetCallHandle()->ToLong();
+ //copy state into new callinfo object
+ *pHeldCallInfo = heldCall;
+
+ //set call to hold state
+ pHeldCallInfo->SetOnHold(false);
+
+ pTelManager->__pActiveCallList->Remove(callHandle);
+ //replace old object with new
+ pTelManager->__pActiveCallList->Add(callHandle, *pHeldCallInfo);
+ delete pCallList;
+ pCallList = static_cast<ArrayListT<AppCallInfo>*>(pTelManager->__pActiveCallList->GetValuesN());
+ }
}
//notify listener that call is disconnected.
pTelManager->__pEventListener->HandleCallDisconnected(isLastCall, *pCallList);
TelephonyManager::HandleEndNormalActiveCall(AppCallInfo& endCallInfo)
{
AppLogDebug("Enter");
+ result r = E_FAILURE;
+ AppCallInfo heldCall;
// This function gets called only from HandleIdleCallback(),
// to handle disconnection of normal active calls.
if (endCallInfo.IsConferenceCall() == false)
{
//fetch active calls to show appropriate scene
pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pActiveCallList->GetValuesN());
+ //fetch the held call on disconnecting the active call and activate it.
+ r = pCallList->GetAt(0, heldCall);
+ if (r == E_SUCCESS)
+ {
+ HoldActiveCall(&heldCall, false);
+ delete pCallList;
+ pCallList = static_cast<ArrayListT<AppCallInfo>*>(__pActiveCallList->GetValuesN());
+ }
}
//Save "End" call info to call log database