Fix for 37272 37208 37254
[apps/osp/Call.git] / src / CallIncomingCallForm.cpp
index 4f88752..2adcc58 100644 (file)
@@ -218,17 +218,6 @@ IncomingCallForm::OnInitializing(void)
        }
        HideRejectPanel();
 
-       Button* pButtonRejectMessage = static_cast<Button*>(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<int,String>* pMsgMap = SettingsManager::GetInstance()->GetRejectMessageListN();
        if(pMsgMap != null)
@@ -605,6 +594,7 @@ IncomingCallForm::ShowRejectMessagePanel(void)
                        }
 
                        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);
 
@@ -672,7 +662,6 @@ IncomingCallForm::OnActionPerformed(const Control& source, int actionId)
        case IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL:
        {
                HideRejectMessagePanel();
-
        }
        break;
 
@@ -826,7 +815,16 @@ IncomingCallForm::OnSceneActivatedN(const SceneId& previousSceneId,        const SceneI
        }
        CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
        pCallApp->SetTopMostWindow(true);
-
+       Button* pButtonRejectMessage = static_cast<Button*>(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);
+       }
 
 }
 
@@ -870,7 +868,6 @@ IncomingCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneI
 
        }
        CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
-       pCallApp->SetTopMostWindow(false);
        pCallApp->RemoveAppStateChangeListener(*this);
 }
 
@@ -1223,7 +1220,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 +1321,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 +1396,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 +1475,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 +1482,6 @@ IncomingCallForm::OnItemSelected(int itemIndex)
        Integer* argIndex = new (std::nothrow) Integer(itemIndex);
        pArgs->Add(argIndex);
        SendUserEvent(REQUEST_ITEM_SELECTED,pArgs);
-
 }
 
 void
@@ -1503,37 +1499,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<Label*>(__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<Label*>(__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
@@ -1609,3 +1595,58 @@ IncomingCallForm::OnForeground(void)
 {
        __pCallPresentor->OnAppForeground();
 }
+
+void
+IncomingCallForm::OnScreenOff(void)
+{
+       __pCallPresentor->StopAlert();
+}
+
+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<AppCallInfo>* pCallList  = static_cast<ArrayListT<AppCallInfo>*>(__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;
+}