X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FCallIncomingCallForm.cpp;h=fa067b7309c4f45c3adc867396ce12380ac00c06;hb=5c6c572623ac3701dd9c4eaed1be657bc70a21b1;hp=85b0e36a9b95a4cbc504525fb3342248717f016b;hpb=09d56b2439506159bd80c63e2a19be25fcaf310e;p=apps%2Fosp%2FCall.git diff --git a/src/CallIncomingCallForm.cpp b/src/CallIncomingCallForm.cpp index 85b0e36..fa067b7 100644 --- a/src/CallIncomingCallForm.cpp +++ b/src/CallIncomingCallForm.cpp @@ -83,6 +83,7 @@ const int H_LIST_TEXT_ITEM = 111; const int X_SEND_TEXT_ITEM = 484; const int Y_SEND_TEXT_ITEM = 20; const int W_SEND_TEXT_ITEM = 220; +const int W_SEND_BUTTON_MARGIN = 14; const int H_SEND_TEXT_ITEM = 72; const int X_PHOTO_LBL = 166; const int Y_PHOTO_LBL = 232; @@ -217,17 +218,6 @@ IncomingCallForm::OnInitializing(void) } HideRejectPanel(); - Button* pButtonRejectMessage = static_cast(GetControl(IDC_REJECT_MESSAGE_BUTTON)); - if (pButtonRejectMessage) - { - SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG, - IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false); - SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG, - IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true); - pButtonRejectMessage->SetActionId(IDA_SHOW_REJECT_CALL_MESSAGE_PANEL); - pButtonRejectMessage->AddActionEventListener(*this); - } - //Get Reject list from Settings Manager IMapT* pMsgMap = SettingsManager::GetInstance()->GetRejectMessageListN(); if(pMsgMap != null) @@ -582,11 +572,7 @@ IncomingCallForm::OnTerminating(void) } void -IncomingCallForm::OnActionPerformed(const Control& source, int actionId) -{ - switch (actionId) - { - case IDA_SHOW_REJECT_CALL_MESSAGE_PANEL: // applicable in all form states +IncomingCallForm::ShowRejectMessagePanel(void) { Panel* pKeysPanel = static_cast(GetControl(IDC_REJECT_PANEL)); if (pKeysPanel) @@ -608,6 +594,7 @@ IncomingCallForm::OnActionPerformed(const Control& source, int actionId) } pMessageList->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, listHeight); + pMessageList->UpdateTableView(); tmpRect = pKeysPanel->GetBounds(); pKeysPanel->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, H_MESSAGE_BG_BITMAP /*+ H_REJECT_VIEW_FOOTER*/ + listHeight); @@ -619,17 +606,6 @@ IncomingCallForm::OnActionPerformed(const Control& source, int actionId) ShowRejectMessageFooter(); - /* pButtonReject = static_cast(pKeysPanel->GetControl(IDC_BACK_BUTTON)); - pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL); - pButtonReject->AddActionEventListener(*this); - pButtonReject->SetEnabled(true); - pButtonReject->SetFocus(); - - Button* pButtonCreate = static_cast(pKeysPanel->GetControl(IDC_CREATE_BUTTON)); - pButtonCreate->SetActionId(IDA_CREATE_REJECT_CALL_MESSAGE); - pButtonCreate->AddActionEventListener(*this); - pButtonCreate->SetEnabled(true); - pButtonCreate->SetFocus();*/ pKeysPanel->SetFocus(); pKeysPanel->Draw(); @@ -642,6 +618,33 @@ IncomingCallForm::OnActionPerformed(const Control& source, int actionId) pButtonRejectMessage->Draw(); } } +void +IncomingCallForm::HideRejectMessagePanel(void) +{ + HideRejectPanel(); + Button* pButtonRejectMessage = static_cast(GetControl(IDC_REJECT_MESSAGE_BUTTON)); + if (pButtonRejectMessage) + { + pButtonRejectMessage->SetShowState(true); + RelativeLayout* pRelativeLayout = dynamic_cast(GetLandscapeLayoutN()); + if (pRelativeLayout != null) + { + pRelativeLayout->SetRelation(*pButtonRejectMessage,*this,RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM); + pRelativeLayout->Update(); + delete pRelativeLayout; + } + } +} + +void +IncomingCallForm::OnActionPerformed(const Control& source, int actionId) +{ + switch (actionId) + { + case IDA_SHOW_REJECT_CALL_MESSAGE_PANEL: // applicable in all form states + { + ShowRejectMessagePanel(); + } break; case IDA_CREATE_REJECT_CALL_MESSAGE: @@ -658,21 +661,7 @@ IncomingCallForm::OnActionPerformed(const Control& source, int actionId) case IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL: { - HideRejectPanel(); - SetFocus(); - Button* pButtonRejectMessage = static_cast(GetControl(IDC_REJECT_MESSAGE_BUTTON)); - if (pButtonRejectMessage) - { - pButtonRejectMessage->SetShowState(true); - RelativeLayout* pRelativeLayout = dynamic_cast(GetLandscapeLayoutN()); - if (pRelativeLayout != null) - { - pRelativeLayout->SetRelation(*pButtonRejectMessage,*this,RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM); - pRelativeLayout->Update(); - delete pRelativeLayout; - } - } - + HideRejectMessagePanel(); } break; @@ -826,7 +815,16 @@ IncomingCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneI } CallApp* pCallApp = static_cast(CallApp::GetInstance()); pCallApp->SetTopMostWindow(true); - + Button* pButtonRejectMessage = static_cast(GetControl(IDC_REJECT_MESSAGE_BUTTON)); + if (pButtonRejectMessage) + { + SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG, + IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false); + SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG, + IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true); + pButtonRejectMessage->SetActionId(IDA_SHOW_REJECT_CALL_MESSAGE_PANEL); + pButtonRejectMessage->AddActionEventListener(*this); + } } @@ -980,7 +978,7 @@ IncomingCallForm::CreateItem(int itemIndex, int itemWidth) { String sendText = AppUtility::GetResourceString(IDS_LIST_SEND_BUTTON); Button* pSendButton = new (std::nothrow) Button(); - pSendButton->Construct(Rectangle(X_SEND_TEXT_ITEM, Y_SEND_TEXT_ITEM, W_SEND_TEXT_ITEM, H_SEND_TEXT_ITEM), sendText); + pSendButton->Construct(Rectangle(GetClientAreaBounds().width - W_SEND_BUTTON_MARGIN -W_SEND_TEXT_ITEM, Y_SEND_TEXT_ITEM, W_SEND_TEXT_ITEM, H_SEND_TEXT_ITEM), sendText); //set action id and listener int actionId = IDA_SEND_REJECT_MSG1; switch(itemIndex) @@ -1223,7 +1221,7 @@ IncomingCallForm::SetBitmapToRejectMessageButton(const String& btnName, const St //set button name String holdBtnName = AppUtility::GetResourceString(btnName); - Dimension textDimension; + FloatDimension textDimension; if (!holdBtnName.IsEmpty()) { Font font; @@ -1324,12 +1322,12 @@ IncomingCallForm::OnTouchReleased(const Control& source, const Point& currentPos if(__pRejectFinalVisElem == null) { __pRejectFinalVisElem = new (std::nothrow) VisualElement(); + __pRejectFinalVisElem->Construct(); + __pRejectFinalVisElem->SetName(IDI_REJECT_FINAL_VISUAL_ELE_NAME); } - __pRejectFinalVisElem->Construct(); __pRejectFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL)); __pRejectFinalVisElem->SetShowState(true); __pRejectFinalVisElem->SetOpacity(1.00f); - __pRejectFinalVisElem->SetName(IDI_REJECT_FINAL_VISUAL_ELE_NAME); if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) == null) { AppLogDebug("AttachChild __pRejectFinalVisElem"); @@ -1399,12 +1397,13 @@ IncomingCallForm::OnTouchReleased(const Control& source, const Point& currentPos if(__pAcceptFinalVisElem == null) { __pAcceptFinalVisElem = new (std::nothrow) VisualElement(); + __pAcceptFinalVisElem->Construct(); + __pAcceptFinalVisElem->SetName(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME); } - __pAcceptFinalVisElem->Construct(); __pAcceptFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL)); - __pAcceptFinalVisElem->SetShowState(true); __pAcceptFinalVisElem->SetOpacity(1.0f); - __pAcceptFinalVisElem->SetName(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME); + + if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) == null) { AppLogDebug("AttachChild __pAcceptFinalVisElem"); @@ -1477,7 +1476,6 @@ IncomingCallForm::OnTouchMoved(const Control& source, const Point& currentPositi void IncomingCallForm::OnItemSelected(int itemIndex) { - ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter); pArgs->Construct(); @@ -1485,7 +1483,6 @@ IncomingCallForm::OnItemSelected(int itemIndex) Integer* argIndex = new (std::nothrow) Integer(itemIndex); pArgs->Add(argIndex); SendUserEvent(REQUEST_ITEM_SELECTED,pArgs); - } void @@ -1503,37 +1500,27 @@ IncomingCallForm::HandleMultipleCallSelection(int itemIndex) __pAcceptVisElem->SetOpacity(1.0f); __pRejectVisElem->SetOpacity(1.00f); - for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++) - { - __pRejectArrowLabel = static_cast(__pRejectArrowLabelsList->GetAt(i)); - String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME); - RejectVisualEleName.Append(i); - __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true); - __pRejectArrowVisElem->SetOpacity(0.0f); - __pAcceptArrowLabel = static_cast(__pAcceptArrowLabelsList->GetAt(i)); - String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME); - AcceptVisualEleName.Append(i); - __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true); - __pAcceptArrowVisElem->SetOpacity(0.0f); - } if (__pRejectFinalVisElem != null) { __pRejectFinalVisElem->Destroy(); __pRejectFinalVisElem = null; } - if (__pAcceptFinalVisElem != null) { __pAcceptFinalVisElem->Destroy(); __pAcceptFinalVisElem = null; } + if (__pOptionPopup) { delete __pOptionPopup; __pOptionPopup = null; } //accept call - __pCallPresentor->AcceptIncomingCall(CallAnsweringOptions(itemIndex),__incomingCallHandle); + if(itemIndex != IDA_BUTTON_CANCEL_OPTIONS_POPUP) + { + __pCallPresentor->AcceptIncomingCall(CallAnsweringOptions(itemIndex),__incomingCallHandle); + } } void @@ -1576,15 +1563,32 @@ IncomingCallForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source) void IncomingCallForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus) { + Panel* pKeysPanel = static_cast(GetControl(IDC_REJECT_PANEL)); + if(pKeysPanel->GetShowState() == true) + { + HideRejectMessagePanel(); + ShowRejectMessagePanel(); + } + Button* pButtonRejectMessage = static_cast(GetControl(IDC_REJECT_MESSAGE_BUTTON)); - if (pButtonRejectMessage) + if (pButtonRejectMessage != null) { SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG, IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false); SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG, IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true); + pButtonRejectMessage->Invalidate(true); } + Button* pButtonReject = static_cast(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON)); + if (pButtonReject != null) + { + SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG, + IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false); + SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG, + IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true); + pButtonReject->Invalidate(true); + } } void @@ -1592,3 +1596,52 @@ IncomingCallForm::OnForeground(void) { __pCallPresentor->OnAppForeground(); } + +void +IncomingCallForm::CallDisconnected(void) +{ + //check if no call option popup is shown, then remain on incoming call screen. + //As user has neither accepted nor rejected incoming call. + if (__pOptionPopup == null) + { + return; + } + + //fetch already active call list and show updated option popup + ArrayListT* pCallList = static_cast*>(__pCallPresentor->GetCallListN()); + if (pCallList != null && pCallList->GetCount() > 0) + { + //then atleast 1 active call exist. + AppCallInfo phnCallInfo; + pCallList->GetAt(0,phnCallInfo); + //Check if only 1 call exist and it is on Hold + if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold()) + { + //directly accept call + __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle); + } + else + { + //Either 1 call exist and not "on Hold". + //Or 2 calls exist. + if(__pOptionPopup != null) + { + delete __pOptionPopup; + __pOptionPopup = null; + } + __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor)); + __pOptionPopup->Initialize(); + __pOptionPopup->SetShowState(true); + __pOptionPopup->Draw(); + __pOptionPopup->Show(); + } + pCallList->RemoveAll(); + } + else + { + //no active call - Accept the incoming call + __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle); + } + delete pCallList; + pCallList = null; +}