1.Soundmanger checkes added for Media Palyer return 2.Diabling join call if the membe...
[apps/osp/Call.git] / src / CallActiveCallForm.cpp
index 3d2bed6..df2a4f3 100644 (file)
@@ -117,17 +117,14 @@ ActiveCallForm::~ActiveCallForm(void)
        }
        if (__pMoreOptionsList != null)
        {
-               RemoveControl(*__pMoreOptionsList);
                __pMoreOptionsList = null;
        }
        if (__pMoreOptionsListAnchor != null)
        {
-               RemoveControl(*__pMoreOptionsListAnchor);
                __pMoreOptionsListAnchor = null;
        }
        if (__pSmallPhotoLabel != null)
        {
-               RemoveControl(*__pSmallPhotoLabel);
                __pSmallPhotoLabel = null;
        }
        if (__pActiveCallInfo != null)
@@ -140,7 +137,6 @@ ActiveCallForm::~ActiveCallForm(void)
        }
        if(__pDTMFKeypad != null)
        {
-               RemoveControl(*__pDTMFKeypad);
                __pDTMFKeypad = null;
        }
 }
@@ -198,12 +194,6 @@ ActiveCallForm::OnInitializing(void)
 void
 ActiveCallForm::ShowDTMFKeypad(void)
 {
-       if(__pDTMFKeypad != null)
-       {
-               RemoveControl(*__pDTMFKeypad);
-               __pDTMFKeypad = null;
-       }
-
        if(__pDTMFKeypad == null)
        {
                //update rect according to client screen area
@@ -232,9 +222,12 @@ ActiveCallForm::ShowDTMFKeypad(void)
                        pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
                }
        }
-       EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
-       pTextBox->SetText(L"");
        __pDTMFKeypad->SetShowState(true);
+       if(__DtmfString.IsEmpty() == false)
+       {
+               EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
+               pTextBox->SetText(__DtmfString);
+       }
        __pDTMFKeypad->Draw(true);
        __pDTMFKeypad->Show();
 }
@@ -279,13 +272,20 @@ ActiveCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui
                                //in Portrait mode it is hidden beneath DTMF Keypad.
                                SetShowStateOnKeypad(false);
                        }
-                       String dtmfText = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
-                       ShowDTMFKeypad();
-                       //get new text box.
-                       EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
-                       pTextBox->SetText(dtmfText);
+                       if(__pDTMFKeypad->GetShowState() == true)
+                       {
+                               String dtmfText = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
+                               HideDTMFKeypad();
+                               ShowDTMFKeypad();
+                       }
                }
        }
+       //More option is displayed recreate it
+       if(__pMoreOptionsListAnchor != null)
+       {
+               CreateMoreOptionsMenuList();
+               CreateMoreOptionsMenuList();
+       }
 }
 
 void
@@ -293,6 +293,8 @@ ActiveCallForm::HideDTMFKeypad(void)
 {
        if(__pDTMFKeypad != null)
        {
+               __DtmfString = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
+
                RemoveControl(*__pDTMFKeypad);
                __pDTMFKeypad = null;
        }
@@ -571,7 +573,6 @@ ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
                SetShowStateOnKeypad(false);
                }
                ShowDTMFKeypad();
-               SetTextToDTMFTextField(L"");
                __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
        }
        break;
@@ -892,7 +893,7 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId&
        {
                String contactNo;
                contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
-               __pActiveCallInfo = new (std::nothrow) CallInfo();
+               __pActiveCallInfo = new (std::nothrow) AppCallInfo();
                __pActiveCallInfo->SetContactNumber(contactNo);
                Contact* pContact = __pCallPresentor->GetContactN(contactNo);
                if (pContact != null)
@@ -909,7 +910,7 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId&
        case FORMTYPE_EMERGENCYOUTGOINGCALL:
        {
                String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
-               __pActiveCallInfo = new (std::nothrow) CallInfo();
+               __pActiveCallInfo = new (std::nothrow) AppCallInfo();
                long long phNumber = 0;
                LongLong::Parse(*pContactNo, phNumber);
                __pActiveCallInfo->SetContactNumber(*pContactNo);
@@ -921,9 +922,9 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId&
        case FORMTYPE_ACTIVECALL:
        {
                //get contact number
-               CallInfo* pCall = static_cast<CallInfo*>(pArgs->GetAt(0));
+               AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
 
-               __pActiveCallInfo = new (std::nothrow) CallInfo();
+               __pActiveCallInfo = new (std::nothrow) AppCallInfo();
                *__pActiveCallInfo =  *pCall;
                String activeContactNo;
                if(pCall->GetContactNumber().IsEmpty() == false)
@@ -945,9 +946,9 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId&
        case FORMTYPE_EMERGENCYACTIVECALL:
        {
                //get contact number
-               CallInfo* pCall = static_cast<CallInfo*>(pArgs->GetAt(0));
+               AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
 
-               __pActiveCallInfo = new (std::nothrow) CallInfo();
+               __pActiveCallInfo = new (std::nothrow) AppCallInfo();
                *__pActiveCallInfo =  *pCall;
 
                //show call active time using Timer
@@ -958,7 +959,7 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId&
 
        case FORMTYPE_MULTIPLECALLS:
        {
-               IListT<CallInfo>* pCallsList = __pCallPresentor->GetCallListN();
+               IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
                //update calls state
                UpdateMultipleCallScreen(*pCallsList);
                delete pCallsList;
@@ -969,8 +970,8 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId&
        case FORMTYPE_ACTIVECONFCALL:
        {
                //get Conf call
-               CallInfo* pConfInfo = static_cast<CallInfo*>(pArgs->GetAt(0));
-               __pActiveCallInfo = new (std::nothrow) CallInfo();
+               AppCallInfo* pConfInfo = static_cast<AppCallInfo*>(pArgs->GetAt(0));
+               __pActiveCallInfo = new (std::nothrow) AppCallInfo();
                *__pActiveCallInfo =  *pConfInfo;
 
                int participantsCount = __pActiveCallInfo->GetCallerListCount();
@@ -1066,6 +1067,7 @@ ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId&
        {
                __pMoreOptionsList->SetShowState(false);
        }
+       __DtmfString.Clear();
 }
 
 void
@@ -1074,7 +1076,7 @@ ActiveCallForm::HandleConfCallChanged(void)
        AppLog("ENTER");
        AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
        //fetch changed conference call info
-       CallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
+       AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
        if (pConfCallInfo == null)
        {
                AppLog("EXIT");
@@ -1099,7 +1101,7 @@ ActiveCallForm::HandleConfCallChanged(void)
        {
                //Active call is conference call
                delete __pActiveCallInfo;
-               __pActiveCallInfo = new (std::nothrow) CallInfo();
+               __pActiveCallInfo = new (std::nothrow) AppCallInfo();
                *__pActiveCallInfo = *pConfCallInfo;
 
                if (__formType == FORMTYPE_MULTIPLECALLS)
@@ -1116,7 +1118,7 @@ ActiveCallForm::HandleConfCallChanged(void)
        {
                //Held call is conference call - this is definitely multiple call screen.
                delete __pHeldCallInfo;
-               __pHeldCallInfo = new (std::nothrow) CallInfo();
+               __pHeldCallInfo = new (std::nothrow) AppCallInfo();
                *__pHeldCallInfo = *pConfCallInfo;
                pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
        }
@@ -1134,12 +1136,12 @@ ActiveCallForm::HandleConfCallChanged(void)
        //change AddCall Button status
        __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
        //change JoinCall Button status
-       __pCallButtonsPanel->EnableJoinCallButton(isEnableJoinCall);
+       __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
        AppLog("EXIT");
 }
 
 void
-ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<CallInfo>& activeCallsList)
+ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
 {
        AppLog("ENTER");
        if(__pActiveCallInfo != null)
@@ -1163,7 +1165,7 @@ ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<CallInf
        for (int index = 0; index < activeCallsList.GetCount(); index++)
        {
                //Fetch call info
-               CallInfo callInfo;
+               AppCallInfo callInfo;
                activeCallsList.GetAt(index, callInfo);
 
                String contactNo;
@@ -1178,7 +1180,7 @@ ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<CallInf
 
                if (callInfo.IsOnHold() == false)
                {
-                       __pActiveCallInfo = new (std::nothrow) CallInfo();
+                       __pActiveCallInfo = new (std::nothrow) AppCallInfo();
                        *__pActiveCallInfo =  callInfo;
 
                        if (__pActiveCallInfo->IsConferenceCall() == false)
@@ -1193,6 +1195,10 @@ ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<CallInf
                                        pMoreBtn->SetShowState(false);
                                }
                                ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
+                               if(__pMoreOptionsListAnchor != null && __pMoreOptionsListAnchor->GetShowState() == true)
+                               {
+                                       CreateMoreOptionsMenuList();
+                               }
                        }
                        else
                        {
@@ -1239,7 +1245,7 @@ ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<CallInf
                }
                else
                {
-                       __pHeldCallInfo = new (std::nothrow) CallInfo();
+                       __pHeldCallInfo = new (std::nothrow) AppCallInfo();
                        *__pHeldCallInfo = callInfo;
 
                        if (__pHeldCallInfo->IsConferenceCall() == false)
@@ -1282,21 +1288,13 @@ ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<CallInf
        }
 
        //update JoinCall button status
-       bool isEnableJoinCall = true;
-       CallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
-       if(pConfCallInfo != null && pConfCallInfo->GetCallerListCount() >= IDI_MAX_CONF_CALL_PARTICIPANTS)
-       {
-               isEnableJoinCall = false;
-       }
-       __pCallButtonsPanel->EnableJoinCallButton(isEnableJoinCall);
-       delete pConfCallInfo;
-       pConfCallInfo = null;
+       __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
        Invalidate(true);
        AppLog("EXIT");
 }
 
 void
-ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, CallInfo* pCallInfo)
+ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
 {
        //call individual methods to show contact number, caller name & photo
        ShowPhoneNumber(phoneNumber, contactLblName);
@@ -1829,7 +1827,7 @@ ActiveCallForm::CreateItem(int index, int itemWidth)
        pTextElement->SetFont(font);
        //construct Enriched text
        EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
-       Dimension textDimension;
+       FloatDimension textDimension;
        font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
        textDimension.height = textDimension.height + font.GetDescender();
        pEnrichedText->Construct(textDimension);
@@ -1837,8 +1835,8 @@ ActiveCallForm::CreateItem(int index, int itemWidth)
        pEnrichedText->Add(*pTextElement);
 
        //Add Enriched text to pItem
-       Point textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
-       pItem->AddElement(Rectangle(textPos, textDimension), 2, *pEnrichedText);
+       FloatPoint textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
+       pItem->AddElement(FloatRectangle(textPos, textDimension), 2, *pEnrichedText);
        // Cleans up
        pEnrichedText->RemoveAll(true);
        delete pEnrichedText;