tizen2.1 code merge
[apps/osp/Call.git] / src / CallActiveCallForm.cpp
index b00089d..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());
@@ -299,7 +300,7 @@ ActiveCallForm::HideDTMFKeypad(void)
        {
                __DtmfString = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
 
-               RemoveControl(*__pDTMFKeypad);
+               RemoveControl(__pDTMFKeypad);
                __pDTMFKeypad = null;
        }
 }
@@ -321,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());
@@ -483,7 +484,7 @@ ActiveCallForm::CreateMoreOptionsMenuList(void)
                pBgPopupArwBmp = null;
 
                // Adds a Label to the Form
-               AddControl(*__pMoreOptionsListAnchor);
+               AddControl(__pMoreOptionsListAnchor);
        }
 
        //create options menu list
@@ -494,7 +495,7 @@ ActiveCallForm::CreateMoreOptionsMenuList(void)
                __pMoreOptionsList->SetItemProvider(*this);
                __pMoreOptionsList->AddListViewItemEventListener(*this);
                //Add option list to the form
-               AddControl(*__pMoreOptionsList);
+               AddControl(__pMoreOptionsList);
        }
        else
        {
@@ -509,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;
        }
 }
@@ -729,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;
 
@@ -842,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)
 {
@@ -1062,7 +1079,7 @@ ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId&
        RemoveOrientationEventListener(*this);
        if (__pCallButtonsPanel != null)
        {
-               RemoveControl(*__pCallButtonsPanel);
+               RemoveControl(__pCallButtonsPanel);
                __pCallButtonsPanel = null;
        }
        if (__pActiveCallTimer != null)
@@ -1442,7 +1459,7 @@ ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
        //Remove small photo label
        if (__pSmallPhotoLabel != null)
        {
-               RemoveControl(*__pSmallPhotoLabel);
+               RemoveControl(__pSmallPhotoLabel);
                __pSmallPhotoLabel = null;
        }
 
@@ -1544,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
@@ -1553,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);
 }
 
@@ -1622,9 +1639,15 @@ void
 ActiveCallForm::SetHoldButtonShowState(bool showState)
 {
        Label* pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
-       pLblControl->SetShowState(showState);
+       if(pLblControl != null)
+       {
+               pLblControl->SetShowState(showState);
+       }
        Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
-       pButtonControl->SetShowState(showState);
+       if(pButtonControl != null)
+       {
+               pButtonControl->SetShowState(showState);
+       }
 }
 
 void
@@ -1788,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