Fix for Call sate not set properly when there is 1 waiting and 1 active call and...
[apps/osp/Call.git] / src / CallIncomingCallForm.cpp
index 0262de7..77274d1 100644 (file)
@@ -391,7 +391,6 @@ IncomingCallForm::InitializeFooter(void)
                footerItemCreate.Construct(IDA_CREATE_REJECT_CALL_MESSAGE);
                footerItemCreate.SetText(AppUtility::GetResourceString(IDS_REJECT_MESSAGE_CREATE));
                pFooter->AddItem(footerItemCreate);
-               pFooter->SetBackButton();
                pFooter->SetShowState(false);
        }
 }
@@ -583,7 +582,7 @@ IncomingCallForm::ShowRejectMessagePanel(void)
                        pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
                        pButtonReject->AddActionEventListener(*this);
                        pButtonReject->SetEnabled(true);
-                       pButtonReject->SetFocus();
+                       //pButtonReject->SetFocus();
 
                        ShowRejectMessageFooter();
 
@@ -630,13 +629,16 @@ IncomingCallForm::OnActionPerformed(const Control& source, int actionId)
 
        case IDA_CREATE_REJECT_CALL_MESSAGE:
        {
-               __pCallPresentor->RejectCall(__incomingCallHandle, true,*__pActiveContactNo);
-               ArrayListT<AppCallInfo>* pCallList  = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
-               if(pCallList != null && pCallList->GetCount() > 0)
+               if(__pCallPresentor->IsAppControlRunning() == false)
                {
-                       __pCallPresentor->HandleCallConnected(*pCallList);
+                       __pCallPresentor->RejectCall(__incomingCallHandle, true,*__pActiveContactNo);
+                       ArrayListT<AppCallInfo>* pCallList  = static_cast<ArrayListT<AppCallInfo>*>(__pCallPresentor->GetCallListN());
+                       if(pCallList != null && pCallList->GetCount() > 0)
+                       {
+                               __pCallPresentor->HandleCallConnected(*pCallList);
+                       }
+                       pCallList = null;
                }
-               pCallList = null;
        }
        break;
 
@@ -702,6 +704,12 @@ IncomingCallForm::OnSceneActivatedN(const SceneId& previousSceneId,        const SceneI
                __pCallPresentor = CallPresentationModel::GetInstance();
        }
        __pCallPresentor->SetTelEventListener(this);
+       //Abort any AppControl Request running already to show incoming call screen
+       if (__pCallPresentor->IsAppControlRunning() == true)
+       {
+               __pCallPresentor->AbortAppControlRequest();
+       }
+
        HideRejectPanel();
 
        if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
@@ -798,9 +806,10 @@ IncomingCallForm::OnSceneActivatedN(const SceneId& previousSceneId,        const SceneI
                pButtonRejectMessage->SetActionId(IDA_SHOW_REJECT_CALL_MESSAGE_PANEL);
                pButtonRejectMessage->AddActionEventListener(*this);
        }
+
        //This called here to handle the case when incoming call comes when
        // add call is in foreground.
-       __pCallPresentor->OnAppForeground();
+       //__pCallPresentor->OnAppForeground();
 
 }
 
@@ -898,7 +907,6 @@ void
 IncomingCallForm::InitializeTableView(void)
 {
        Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
-
        TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
        pMessageList->SetItemProvider(this);
        pMessageList->AddTableViewItemEventListener(*this);
@@ -1011,8 +1019,8 @@ IncomingCallForm::ShowPersonDetails(const String& phoneNumber, const String& con
        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
@@ -1523,7 +1531,7 @@ IncomingCallForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
 {
        AppLogDebug("Enter");
        HideRejectPanel();
-       SetFocus();
+       //SetFocus();
        Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
        if (pButtonRejectMessage)
        {
@@ -1570,7 +1578,13 @@ void
 IncomingCallForm::OnForeground(void)
 {
        AppLogDebug("Enter");
-       __pCallPresentor->OnAppForeground();
+       //This is done so that when in IncomingCallForm and calloptionpopup is shown , now if
+       // focus goes away from popup by pressing cancel key from the host keyboard the focus shouldnt get lost
+       // but should focus the Reject message button immediately.
+       Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
+       pButtonRejectMessage->SetFocus();
+       pButtonRejectMessage->Invalidate(true);
+//     __pCallPresentor->OnAppForeground();
 }
 
 void
@@ -1584,7 +1598,7 @@ IncomingCallForm::CallDisconnected(void)
 {
        //check if no call option popup is shown, then remain on incoming call screen.
        //As user has neither accepted nor rejected incoming call.
-       if (__pOptionPopup == null)
+       if ((__pOptionPopup == null) || (__pOptionPopup->GetShowState() == false))
        {
                return;
        }