X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FCallActiveCallForm.cpp;h=4c378c5a520a02bedef463fa912e61f5d2ca678a;hb=ab1c3e7e1e383a26cc9166f945c8e21581d44aab;hp=1bdc61ff600a280097a816141b0d5f64067a5bf6;hpb=5ec4aa503ad9a195c9faa6aed1fc70408c885492;p=apps%2Fosp%2FCall.git diff --git a/src/CallActiveCallForm.cpp b/src/CallActiveCallForm.cpp index 1bdc61f..4c378c5 100644 --- a/src/CallActiveCallForm.cpp +++ b/src/CallActiveCallForm.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include "CallActiveCallForm.h" #include "CallButtonsPanel.h" #include "CallInfo.h" @@ -30,6 +31,7 @@ #include "CallPresentationModel.h" #include "CallSceneRegister.h" #include "CallTypes.h" +#include "CallApp.h" using namespace Tizen::App; using namespace Tizen::Base; @@ -42,6 +44,7 @@ using namespace Tizen::System; using namespace Tizen::Ui; using namespace Tizen::Ui::Controls; using namespace Tizen::Ui::Scenes; +using namespace Tizen::Shell; //constants const int IDI_MAX_SECONDS = 60; @@ -78,7 +81,7 @@ static const wchar_t* IDC_CONF_CALL_MORE_BUTTON = L"IDC_CONF_CALL_MORE_BUTTON"; static const wchar_t* IDC_HOLD_BUTTON = L"IDC_HOLD_BUTTON"; static const wchar_t* IDC_SWAP_BUTTON = L"IDC_SWAP_BUTTON"; static const wchar_t* IDC_HOLD_LABEL = L"IDC_HOLD_LABEL"; -static const wchar_t* IDC_TEXTBOX = L"IDC_TEXTBOX"; +static const wchar_t* IDC_TEXTBOX = L"IDC_NUM_EDITFIELD"; static const wchar_t* IDC_CALLER1_LABEL = L"IDC_CALLER1_LABEL"; static const wchar_t* IDC_BACKGROUND_LABEL = L"IDC_BACKGROUND_LABEL"; static const wchar_t* IDC_CALLER1_TIME_LABEL = L"IDC_CALLER1_TIME_LABEL"; @@ -117,17 +120,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 +140,6 @@ ActiveCallForm::~ActiveCallForm(void) } if(__pDTMFKeypad != null) { - RemoveControl(*__pDTMFKeypad); __pDTMFKeypad = null; } } @@ -198,35 +197,40 @@ ActiveCallForm::OnInitializing(void) void ActiveCallForm::ShowDTMFKeypad(void) { - if(__pDTMFKeypad != null) - { - RemoveControl(*__pDTMFKeypad); - __pDTMFKeypad = null; - } - if(__pDTMFKeypad == null) { //update rect according to client screen area Rectangle rect(0, 0, 0, 0); - if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT) + if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE) { rect.width = GetClientAreaBounds().width; rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight(); } - else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE) + else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE) { rect.height = GetClientAreaBounds().height; rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth(); } - AppLog("rect(%d,%d,%d,%d)",rect.x,rect.y,rect.width,rect.height); + 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); + + //set layout relation w.r.t call buttons panel + RelativeLayout* pRelativeLayout = dynamic_cast(GetLandscapeLayoutN()); + if (pRelativeLayout != null) + { + pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT); + pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT); + } } - TextBox* pTextBox = static_cast(__pDTMFKeypad->GetControl(IDC_TEXTBOX)); - pTextBox->SetText(L""); __pDTMFKeypad->SetShowState(true); + if(__DtmfString.IsEmpty() == false) + { + EditField* pTextBox = static_cast(__pDTMFKeypad->GetControl(IDC_TEXTBOX)); + pTextBox->SetText(__DtmfString); + } __pDTMFKeypad->Draw(true); __pDTMFKeypad->Show(); } @@ -261,23 +265,31 @@ ActiveCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui //change orientation of DTMF Keypad, if it is visible. if (__pDTMFKeypad != null) { - if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE) + if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE) { //in landscape mode, caller info is visible. SetShowStateOnKeypad(true); + SetHoldButtonShowState(false); } - else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT) + else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE) { //in Portrait mode it is hidden beneath DTMF Keypad. SetShowStateOnKeypad(false); } - String dtmfText = static_cast(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText(); - ShowDTMFKeypad(); - //get new text box. - TextBox* pTextBox = static_cast(__pDTMFKeypad->GetControl(IDC_TEXTBOX)); - pTextBox->SetText(dtmfText); + if(__pDTMFKeypad->GetShowState() == true) + { + String dtmfText = static_cast(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText(); + HideDTMFKeypad(); + ShowDTMFKeypad(); + } } } + //More option is displayed recreate it + if(__pMoreOptionsListAnchor != null) + { + CreateMoreOptionsMenuList(); + CreateMoreOptionsMenuList(); + } } void @@ -285,6 +297,8 @@ ActiveCallForm::HideDTMFKeypad(void) { if(__pDTMFKeypad != null) { + __DtmfString = static_cast(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText(); + RemoveControl(*__pDTMFKeypad); __pDTMFKeypad = null; } @@ -320,6 +334,8 @@ ActiveCallForm::InitializeCallButtonsPanel(void) { pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT); pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT); + pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM); + pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_TOP_TO_TOP); } return r; @@ -557,13 +573,14 @@ ActiveCallForm::OnActionPerformed(const Control& source, int actionId) case IDA_OPEN_NUMKEYPAD: { - if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT) + if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE) { //hide only in portrait mode. - SetShowStateOnKeypad(false); + SetShowStateOnKeypad(false); } + //Hide the hold button as it goes behind DTMF keypad + SetHoldButtonShowState(false); ShowDTMFKeypad(); - SetTextToDTMFTextField(L""); __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD); } break; @@ -581,15 +598,7 @@ ActiveCallForm::OnActionPerformed(const Control& source, int actionId) //switch to Dialer Form to make an call if(__pCallPresentor->GetCurrentCallCount() == 1) { -/* ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter); - pArgs->Construct(); - String* formType = new (std::nothrow) String(); - formType->Append(__formType); - pArgs->Add(formType); - pSceneManager->GoForward( ForwardSceneTransition(IDSCN_DIALER, SCENE_TRANSITION_ANIMATION_TYPE_NONE, - SCENE_HISTORY_OPTION_NO_HISTORY), pArgs);*/ - __pCallPresentor->LaunchDialAppControl(); - + __pCallPresentor->LaunchDialAppControl(); } } break; @@ -838,8 +847,19 @@ ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr) { if(__pDTMFKeypad != null) { - TextBox* pTextBox = static_cast(__pDTMFKeypad->GetControl(IDC_TEXTBOX)); - pTextBox->AppendText(dtmfStr); + EditField* pTextBox = static_cast(__pDTMFKeypad->GetControl(IDC_TEXTBOX)); + + int startpos=-1,endpos=-1; + pTextBox->GetBlockRange(startpos,endpos); + if(startpos != -1) + { + pTextBox->Remove(); + pTextBox->ReleaseBlock(); + } + + pTextBox->InsertTextAtCursorPosition(dtmfStr); + //pTextBox->AppendText(dtmfStr); + pTextBox->SetFocus(); pTextBox->Invalidate(true); } } @@ -852,6 +872,9 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& __pCallPresentor->SetTelEventListener(this); AddOrientationEventListener(*this); + CallApp* pPhoneApp = static_cast(CallApp::GetInstance()); + pPhoneApp->AddAppStateChangeListener(*this); + //Initialize keypad and buttons InitializeCallButtonsPanel(); @@ -873,7 +896,7 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& { String contactNo; contactNo.Append(*(static_cast(pArgs->GetAt(0)))); - __pActiveCallInfo = new (std::nothrow) CallInfo(); + __pActiveCallInfo = new (std::nothrow) AppCallInfo(); __pActiveCallInfo->SetContactNumber(contactNo); Contact* pContact = __pCallPresentor->GetContactN(contactNo); if (pContact != null) @@ -890,7 +913,7 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& case FORMTYPE_EMERGENCYOUTGOINGCALL: { String* pContactNo = static_cast(pArgs->GetAt(0)); - __pActiveCallInfo = new (std::nothrow) CallInfo(); + __pActiveCallInfo = new (std::nothrow) AppCallInfo(); long long phNumber = 0; LongLong::Parse(*pContactNo, phNumber); __pActiveCallInfo->SetContactNumber(*pContactNo); @@ -902,9 +925,9 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& case FORMTYPE_ACTIVECALL: { //get contact number - CallInfo* pCall = static_cast(pArgs->GetAt(0)); + AppCallInfo* pCall = static_cast(pArgs->GetAt(0)); - __pActiveCallInfo = new (std::nothrow) CallInfo(); + __pActiveCallInfo = new (std::nothrow) AppCallInfo(); *__pActiveCallInfo = *pCall; String activeContactNo; if(pCall->GetContactNumber().IsEmpty() == false) @@ -926,9 +949,9 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& case FORMTYPE_EMERGENCYACTIVECALL: { //get contact number - CallInfo* pCall = static_cast(pArgs->GetAt(0)); + AppCallInfo* pCall = static_cast(pArgs->GetAt(0)); - __pActiveCallInfo = new (std::nothrow) CallInfo(); + __pActiveCallInfo = new (std::nothrow) AppCallInfo(); *__pActiveCallInfo = *pCall; //show call active time using Timer @@ -939,7 +962,7 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& case FORMTYPE_MULTIPLECALLS: { - IListT* pCallsList = __pCallPresentor->GetCallListN(); + IListT* pCallsList = __pCallPresentor->GetCallListN(); //update calls state UpdateMultipleCallScreen(*pCallsList); delete pCallsList; @@ -950,8 +973,8 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& case FORMTYPE_ACTIVECONFCALL: { //get Conf call - CallInfo* pConfInfo = static_cast(pArgs->GetAt(0)); - __pActiveCallInfo = new (std::nothrow) CallInfo(); + AppCallInfo* pConfInfo = static_cast(pArgs->GetAt(0)); + __pActiveCallInfo = new (std::nothrow) AppCallInfo(); *__pActiveCallInfo = *pConfInfo; int participantsCount = __pActiveCallInfo->GetCallerListCount(); @@ -986,6 +1009,17 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& break; } + if(__formType == FORMTYPE_ACTIVECALL || __formType == FORMTYPE_EMERGENCYACTIVECALL || + __formType == FORMTYPE_MULTIPLECALLS || __formType == FORMTYPE_ACTIVECONFCALL) + { + //Unlock the phone if its locked + if(LockManager::GetInstance()->IsLocked()) + { + AppLogDebug("Phone Locked"); + LockManager::GetInstance()->Unlock(); + } + } + //Hide DTMFKeypad, if visible and show caller info HideDTMFKeypad(); SetShowStateOnKeypad(true); @@ -1017,6 +1051,9 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& delete pArgs; pArgs = null; } + + CallApp* pCallApp = static_cast(CallApp::GetInstance()); + pCallApp->SetTopMostWindow(false); } void @@ -1047,6 +1084,9 @@ ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& { __pMoreOptionsList->SetShowState(false); } + __DtmfString.Clear(); + CallApp* pCallApp = static_cast(CallApp::GetInstance()); + pCallApp->RemoveAppStateChangeListener(*this); } void @@ -1055,7 +1095,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"); @@ -1080,7 +1120,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) @@ -1097,7 +1137,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(GetControl(IDC_NUMBER2_LABEL)); } @@ -1115,12 +1155,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& activeCallsList) +ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT& activeCallsList) { AppLog("ENTER"); if(__pActiveCallInfo != null) @@ -1144,7 +1184,7 @@ ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListTIsConferenceCall() == false) @@ -1174,6 +1214,10 @@ ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListTSetShowState(false); } ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo); + if(__pMoreOptionsListAnchor != null && __pMoreOptionsListAnchor->GetShowState() == true) + { + CreateMoreOptionsMenuList(); + } } else { @@ -1220,7 +1264,7 @@ ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListTIsConferenceCall() == false) @@ -1263,21 +1307,13 @@ ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListTGetConferenceCallInfoN(); - 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); @@ -1583,6 +1619,21 @@ ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long lo } void +ActiveCallForm::SetHoldButtonShowState(bool showState) +{ + Label* pLblControl = static_cast(GetControl(IDC_HOLD_LABEL)); + if(pLblControl != null) + { + pLblControl->SetShowState(showState); + } + Button* pButtonControl = static_cast(GetControl(IDC_HOLD_BUTTON)); + if(pButtonControl != null) + { + pButtonControl->SetShowState(showState); + } +} + +void ActiveCallForm::SetShowStateOnKeypad(bool showState) { Label* pLblControl = static_cast(GetControl(IDC_CALLER1_LABEL)); @@ -1604,10 +1655,7 @@ ActiveCallForm::SetShowStateOnKeypad(bool showState) pLblControl->SetShowState(showState); pLblControl = static_cast(GetControl(IDC_VOICE_CALL_ICON_LABEL)); pLblControl->SetShowState(showState); - pLblControl = static_cast(GetControl(IDC_HOLD_LABEL)); - pLblControl->SetShowState(showState); - Button* pButtonControl = static_cast(GetControl(IDC_HOLD_BUTTON)); - pButtonControl->SetShowState(showState); + SetHoldButtonShowState(showState); } break; @@ -1644,11 +1692,8 @@ ActiveCallForm::SetShowStateOnKeypad(bool showState) { pLblControl = static_cast(GetControl(IDC_PARTICIPANTS_LABEL)); pLblControl->SetShowState(showState); - pLblControl = static_cast(GetControl(IDC_HOLD_LABEL)); - pLblControl->SetShowState(showState); - Button* pButtonControl = static_cast(GetControl(IDC_HOLD_BUTTON)); - pButtonControl->SetShowState(showState); - pButtonControl = static_cast(GetControl(IDC_CONF_CALL_MORE_BUTTON)); + SetHoldButtonShowState(showState); + Button* pButtonControl = static_cast(GetControl(IDC_CONF_CALL_MORE_BUTTON)); pButtonControl->SetShowState(showState); } break; @@ -1810,7 +1855,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); @@ -1818,8 +1863,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; @@ -1832,3 +1877,10 @@ ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth) delete pItem; return true; } + +void +ActiveCallForm::OnForeground(void) +{ + AppLogDebug("Enter"); + __pCallPresentor->OnAppForeground(); +}