Fix for 37272 37208 37254
[apps/osp/Call.git] / src / CallEndCallForm.cpp
index 9ce5742..41f5852 100644 (file)
@@ -64,7 +64,6 @@ EndCallForm::EndCallForm(void)
        __pSmallPhotoLabel = null;
        __isMsgAppControlLaunched = false;
        __isContactAppControlLaunched = false;
-       __isContactPresent = false;
 }
 
 EndCallForm::~EndCallForm(void)
@@ -301,24 +300,26 @@ EndCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& cu
                ShowPersonDetails(*__pContactNumber, IDC_CALLER1_LABEL, IDC_CALLER1_BIGPHOTO_LABEL,pEndCall);
                //If call is hidden means contact number is empty,
                //or if call is from known number(i.e present in contacts db), Then do NOT show "Add to Contact" button.
-               if (pEndCall->GetContactInfo() != null || pEndCall->GetContactNumber().IsEmpty() == true)
+               if (pEndCall->GetContactInfo() != null)
                {
+                       //Check if contact is deleted in mean time.
                        Contact* pContact = __pCallPresentor->GetContactN(pEndCall->GetContactNumber());
                        //before setting check if the contact is deleted
                        if(pContact != null)
                        {
-                               SetContactButtonState(false);
+                               ShowViewContactButton();
                                delete pContact;
                                pContact = null;
                        }
                        else
                        {
-                               SetContactButtonState(true);
+                               ShowAddContactButton();
                        }
                }
                else
                {
-                       SetContactButtonState(true);
+                       //Show AddToContact
+                       ShowAddContactButton();
                }
 
                //Check if call is Emergency call or Hidden call,
@@ -331,6 +332,17 @@ EndCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& cu
                {
                        __pCallButtonsPanel->SetEndCallPanelState(true);
                }
+
+               //check if we reached the end call form of an outgoing call then don't show add to contacts
+               if(pEndCall->GetCalllogType() == CALL_LOG_TYPE_VOICE_OUTGOING)
+               {
+                       __pCallButtonsPanel->ShowOrHideAddtoContactsButton(false);
+               }
+               else if(pEndCall->GetCalllogType() == CALL_LOG_TYPE_VOICE_INCOMING)
+               {
+                       __pCallButtonsPanel->ShowOrHideAddtoContactsButton(true);
+               }
+
        }
        break;
 
@@ -338,7 +350,8 @@ EndCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& cu
                break;
        }
 
-       if (__pEndCallEventTimer)
+       //Before starting end call timer check if messaging appcontrol was launched during incoming call
+       if (__pEndCallEventTimer && __pCallPresentor->IsAppControlRunning() == false)
        {
                __pEndCallEventTimer->Start(IDI_APP_END_TIMER);
        }
@@ -349,6 +362,8 @@ EndCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& cu
                delete pArgs;
                pArgs = null;
        }
+       CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
+       pCallApp->SetTopMostWindow(false);
        AddOrientationEventListener(*this);
 }
 
@@ -381,19 +396,17 @@ EndCallForm::OnDraw(void)
 }
 
 void
-EndCallForm::SetContactButtonState(bool showState)
+EndCallForm::ShowViewContactButton(void)
 {
-       __pCallButtonsPanel->SetViewContactButtonStatus(showState);
-       __isContactPresent = !showState;
+       __pCallButtonsPanel->ShowViewContactButton();
 }
 
-bool
-EndCallForm::IsContactPresent(void)
+void
+EndCallForm::ShowAddContactButton(void)
 {
-       return __isContactPresent;
+       __pCallButtonsPanel->ShowAddContactButton();
 }
 
-
 void
 EndCallForm::ShowPhoneNumber(const String& phoneNumber, const String& lblName)
 {
@@ -545,6 +558,12 @@ EndCallForm::OnAppControlCompleteResponseReceived(const AppId& appId, const Stri
                __isMsgAppControlLaunched = false;
                __pCallPresentor->AppControlRequestCompleted();
        }
+       if(__isContactAppControlLaunched == true)
+       {
+               //notify app control completed
+               __isContactAppControlLaunched = false;
+               __pCallPresentor->AppControlRequestCompleted();
+       }
        //AppControl completed, goto initial scene if present
        //else exit.
        HandleLastCallCompletion();
@@ -571,26 +590,34 @@ EndCallForm::OnForeground(void)
                }
                if (__pContactNumber != null && __pContactNumber->IsEmpty() == false)
                {
+                       AppCallInfo* ActiveCallInfo = new (std::nothrow) AppCallInfo();
+                       ActiveCallInfo->SetContactNumber(*__pContactNumber);
                        Contact* pContact = __pCallPresentor->GetContactN(*__pContactNumber);
+                       if (pContact != null)
+                       {
+                               ActiveCallInfo->SetContactInfo(*pContact);
+                       }
                        //before setting check if the contact is deleted
                        if(pContact != null)
                        {
-                               SetContactButtonState(false);
+
+                               ShowViewContactButton();
                                delete pContact;
                                pContact = null;
                        }
                        else
                        {
-                               SetContactButtonState(true);
+                               ShowAddContactButton();
                        }
+                       ShowPersonDetails(*__pContactNumber, IDC_CALLER1_LABEL, IDC_CALLER1_BIGPHOTO_LABEL,ActiveCallInfo);
+                       delete ActiveCallInfo;
                }
 
                //notify app control completed
                __isContactAppControlLaunched = false;
                __pCallPresentor->AppControlRequestCompleted();
        }
-
-       if (__isMsgAppControlLaunched == true)
+       else if (__isMsgAppControlLaunched == true)
        {
                //Message AppControl request completed.
                if(__pEndCallEventTimer != null)
@@ -600,6 +627,14 @@ EndCallForm::OnForeground(void)
                __isMsgAppControlLaunched = false;
                __pCallPresentor->AppControlRequestCompleted();
        }
+       else if(__pCallPresentor->IsAppControlRunning() == true)
+       {
+               if(__pEndCallEventTimer != null)
+               {
+                       __pEndCallEventTimer->Start(2000);
+               }
+               __pCallPresentor->AppControlRequestCompleted();
+       }
        AppLogDebug("Exit");
 }