tizen2.1 code merge
[apps/osp/Call.git] / src / CallActiveCallForm.cpp
index a11ea22..5e40ede 100644 (file)
@@ -1,7 +1,7 @@
 //
 // 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
 //
@@ -109,6 +109,7 @@ ActiveCallForm::ActiveCallForm(FormType formType)
        __pSmallPhotoLabel = null;
        __pActiveCallInfo = null;
        __pHeldCallInfo = null;
+       __isSwapInProgress = false;
 }
 
 ActiveCallForm::~ActiveCallForm(void)
@@ -215,7 +216,7 @@ ActiveCallForm::ShowDTMFKeypad(void)
                AppLog("DTMF Keypad rect(%d,%d,%d,%d)",rect.x,rect.y,rect.width,rect.height);
                __pDTMFKeypad = new (std::nothrow) DtmfKeyPadPanel();
                __pDTMFKeypad->Initialize(this, rect);
-               AddControl(*__pDTMFKeypad);
+               AddControl(__pDTMFKeypad);
 
                //set layout relation w.r.t call buttons panel
                RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
@@ -269,6 +270,7 @@ ActiveCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui
                        {
                                //in landscape mode, caller info is visible.
                                SetShowStateOnKeypad(true);
+                               SetHoldButtonShowState(false);
                        }
                        else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
                        {
@@ -298,7 +300,7 @@ ActiveCallForm::HideDTMFKeypad(void)
        {
                __DtmfString = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
 
-               RemoveControl(*__pDTMFKeypad);
+               RemoveControl(__pDTMFKeypad);
                __pDTMFKeypad = null;
        }
 }
@@ -320,7 +322,7 @@ ActiveCallForm::InitializeCallButtonsPanel(void)
                __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
                __pCallButtonsPanel->ConstructPanel(this, __formType);
                __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
-               r = AddControl(*__pCallButtonsPanel);
+               r = AddControl(__pCallButtonsPanel);
        }
 
        RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
@@ -482,7 +484,7 @@ ActiveCallForm::CreateMoreOptionsMenuList(void)
                pBgPopupArwBmp = null;
 
                // Adds a Label to the Form
-               AddControl(*__pMoreOptionsListAnchor);
+               AddControl(__pMoreOptionsListAnchor);
        }
 
        //create options menu list
@@ -493,7 +495,7 @@ ActiveCallForm::CreateMoreOptionsMenuList(void)
                __pMoreOptionsList->SetItemProvider(*this);
                __pMoreOptionsList->AddListViewItemEventListener(*this);
                //Add option list to the form
-               AddControl(*__pMoreOptionsList);
+               AddControl(__pMoreOptionsList);
        }
        else
        {
@@ -508,14 +510,14 @@ ActiveCallForm::DestroyMoreOptionsMenuList(void)
        if (__pMoreOptionsListAnchor != null)
        {
                //removes and delete the child control
-               RemoveControl(*__pMoreOptionsListAnchor);
+               RemoveControl(__pMoreOptionsListAnchor);
                __pMoreOptionsListAnchor = null;
        }
 
        if (__pMoreOptionsList != null)
        {
                //removes and delete the child control
-               RemoveControl(*__pMoreOptionsList);
+               RemoveControl(__pMoreOptionsList);
                __pMoreOptionsList = null;
        }
 }
@@ -577,6 +579,8 @@ ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
                        //hide only in portrait mode.
                        SetShowStateOnKeypad(false);
                }
+               //Hide the hold button as it goes behind DTMF keypad
+               SetHoldButtonShowState(false);
                ShowDTMFKeypad();
                __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
        }
@@ -726,8 +730,12 @@ ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
 
        case IDA_SWAP_CALLS:
        {
-               AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
-               __pCallPresentor->SwapCalls();
+               if(IsSwapInProgress() == false)
+               {
+                       AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
+                       __pCallPresentor->SwapCalls();
+                       SetSwapInProgress(true);
+               }
        }
        break;
 
@@ -839,6 +847,18 @@ ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
        }
 }
 
+bool
+ActiveCallForm::IsSwapInProgress(void)
+{
+       return __isSwapInProgress;
+}
+
+void
+ActiveCallForm::SetSwapInProgress(bool progress)
+{
+       __isSwapInProgress = progress;
+}
+
 void
 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
 {
@@ -1048,6 +1068,9 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId&
                delete pArgs;
                pArgs = null;
        }
+
+       CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
+       pCallApp->SetTopMostWindow(false);
 }
 
 void
@@ -1056,7 +1079,7 @@ ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId&
        RemoveOrientationEventListener(*this);
        if (__pCallButtonsPanel != null)
        {
-               RemoveControl(*__pCallButtonsPanel);
+               RemoveControl(__pCallButtonsPanel);
                __pCallButtonsPanel = null;
        }
        if (__pActiveCallTimer != null)
@@ -1436,7 +1459,7 @@ ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
        //Remove small photo label
        if (__pSmallPhotoLabel != null)
        {
-               RemoveControl(*__pSmallPhotoLabel);
+               RemoveControl(__pSmallPhotoLabel);
                __pSmallPhotoLabel = null;
        }
 
@@ -1538,7 +1561,7 @@ ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
 {
        if (__pSmallPhotoLabel != null)
        {
-               RemoveControl(*__pSmallPhotoLabel);
+               RemoveControl(__pSmallPhotoLabel);
                __pSmallPhotoLabel = null;
        }
        //Draw Small Photo and show on small photo label
@@ -1547,7 +1570,7 @@ ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
        __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
        __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
        // Add a Label to the Form
-       AddControl(*__pSmallPhotoLabel);
+       AddControl(__pSmallPhotoLabel);
        __pSmallPhotoLabel->Invalidate(true);
 }
 
@@ -1613,6 +1636,21 @@ ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long lo
 }
 
 void
+ActiveCallForm::SetHoldButtonShowState(bool showState)
+{
+       Label* pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
+       if(pLblControl != null)
+       {
+               pLblControl->SetShowState(showState);
+       }
+       Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
+       if(pButtonControl != null)
+       {
+               pButtonControl->SetShowState(showState);
+       }
+}
+
+void
 ActiveCallForm::SetShowStateOnKeypad(bool showState)
 {
        Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
@@ -1634,10 +1672,7 @@ ActiveCallForm::SetShowStateOnKeypad(bool showState)
                pLblControl->SetShowState(showState);
                pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
                pLblControl->SetShowState(showState);
-               pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
-               pLblControl->SetShowState(showState);
-               Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
-               pButtonControl->SetShowState(showState);
+               SetHoldButtonShowState(showState);
        }
        break;
 
@@ -1674,11 +1709,8 @@ ActiveCallForm::SetShowStateOnKeypad(bool showState)
        {
                pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
                pLblControl->SetShowState(showState);
-               pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
-               pLblControl->SetShowState(showState);
-               Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
-               pButtonControl->SetShowState(showState);
-               pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
+               SetHoldButtonShowState(showState);
+               Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
                pButtonControl->SetShowState(showState);
        }
        break;
@@ -1779,7 +1811,8 @@ ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int el
 {
        //Goto conference call list form
        SceneManager* pSceneManager = SceneManager::GetInstance();
-       pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST), null);
+       pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
+                        SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY), null);
 }
 
 void
@@ -1866,5 +1899,6 @@ ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
 void
 ActiveCallForm::OnForeground(void)
 {
+       AppLogDebug("Enter");
        __pCallPresentor->OnAppForeground();
 }