Prevent issue fix. Nabi issues fixed
[apps/osp/Call.git] / src / CallEndCallForm.cpp
index e257438..33fbefa 100644 (file)
@@ -77,7 +77,6 @@ EndCallForm::~EndCallForm(void)
        }
        if (__pSmallPhotoLabel != null)
        {
-               RemoveControl(*__pSmallPhotoLabel);
                __pSmallPhotoLabel = null;
        }
 }
@@ -278,7 +277,10 @@ EndCallForm::HandleAddToContacts(void)
                String idVal;
                idVal.Append(pContact->GetRecordId());
                extraData.Add(new (std::nothrow) String(CONTACTS_VIEW_TYPE), new (std::nothrow) String(CONTACTS_VIEW_TYPE_CONTACT));
+               extraData.Add(new (std::nothrow) String(CONTACTS_VIEW_TYPE_CONTACT), new (std::nothrow) String(CONTACTS_VIEW_TYPE_CONTACT));
+               extraData.Add(new (std::nothrow) String(CONTACT_KEY_ITEM_ID), new (std::nothrow) String(idVal));
                extraData.Add(new (std::nothrow) String(CONTACTS_ID_KEY), new (std::nothrow) String(idVal));
+               extraData.Add(new (std::nothrow) String(CONTACT_KEY_ITEM_TYPE), new (std::nothrow) String(ITEM_TYPE_PERSON));
                 pAc = AppManager::FindAppControlN(PROVIDER_ID_CONTACTS, OPERATION_ID_VIEW);
 
        }
@@ -286,6 +288,7 @@ EndCallForm::HandleAddToContacts(void)
        {
                AppLogDebug("Add Contact");
                extraData.Add(new (std::nothrow) String(INPUT_TYPE_PHONE), new (std::nothrow) String(*__pContactNumber));
+               extraData.Add(new (std::nothrow) String(CONTACT_KEY_ITEM_TYPE), new (std::nothrow) String(ITEM_TYPE_CONTACT));
                pAc = AppManager::FindAppControlN(PROVIDER_ID_CONTACTS, OPERATION_ID_ADD);
 
        }
@@ -309,6 +312,11 @@ EndCallForm::HandleAddToContacts(void)
                __isContactAppControlLaunched = false;
        }
        extraData.RemoveAll(true);
+       if(pContact != null)
+       {
+               delete pContact;
+               pContact = null;
+       }
 }
 
 void
@@ -346,7 +354,18 @@ EndCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& cu
                //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)
                {
-                       SetContactButtonState(false);
+                       Contact* pContact = __pCallPresentor->GetContactN(pEndCall->GetContactNumber());
+                       //before setting check if the contact is deleted
+                       if(pContact != null)
+                       {
+                               SetContactButtonState(false);
+                               delete pContact;
+                               pContact = null;
+                       }
+                       else
+                       {
+                               SetContactButtonState(true);
+                       }
                }
                else
                {
@@ -381,6 +400,7 @@ EndCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& cu
                delete pArgs;
                pArgs = null;
        }
+       AddOrientationEventListener(*this);
 }
 
 void
@@ -402,6 +422,7 @@ EndCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& ne
        //remove itself as listener
        CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
        pPhoneApp->RemoveAppStateChangeListener(*this);
+       RemoveOrientationEventListener(*this);
 }
 
 result
@@ -569,6 +590,7 @@ EndCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
 void
 EndCallForm::OnAppControlCompleteResponseReceived(const AppId& appId, const String& operationId, AppCtrlResult appControlResult, const IMap* pExtraData)
 {
+       AppLogDebug("Enter");
        if (__isMsgAppControlLaunched == true)
        {
                //Message AppControl request completed.
@@ -596,10 +618,26 @@ EndCallForm::OnForeground(void)
        //as we do not know if it success or failed.
        if(__isContactAppControlLaunched == true)
        {
-               CallApp* pPhoneApp = (static_cast<CallApp*>(UiApp::GetInstance()));
-               pPhoneApp->Terminate();
+               //CallApp* pPhoneApp = (static_cast<CallApp*>(UiApp::GetInstance()));
+               //pPhoneApp->Terminate();
+               if(__pEndCallEventTimer != null)
+               {
+                       __pEndCallEventTimer->Start(2000);
+               }
        }
        __isContactAppControlLaunched = false;
+
+       if (__isMsgAppControlLaunched == true)
+       {
+               //Message AppControl request completed.
+               //CallApp* pPhoneApp = (static_cast<CallApp*>(UiApp::GetInstance()));
+               //pPhoneApp->Terminate();
+               if(__pEndCallEventTimer != null)
+               {
+                       __pEndCallEventTimer->Start(2000);
+               }
+               __isMsgAppControlLaunched = false;
+       }
        AppLogDebug("Exit");
 }
 
@@ -612,6 +650,7 @@ EndCallForm::OnBackground(void)
 void
 EndCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
 {
+       AppLogDebug("Enter");
        if (__pCallButtonsPanel != null)
        {
                //update position of call buttons panel
@@ -622,7 +661,7 @@ EndCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::O
                RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
                if (pRelativeLayout != null)
                {
-                       pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_TOP_TO_TOP);
+                       //pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_TOP_TO_TOP);
                }
                pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
                if (pRelativeLayout != null)