2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file PhnActiveCallForm.cpp
19 * @brief Active Call Form class
26 #include "CallActiveCallForm.h"
27 #include "CallButtonsPanel.h"
29 #include "CallAppUtility.h"
30 #include "CallDtmfKeypadPanel.h"
31 #include "CallPresentationModel.h"
32 #include "CallSceneRegister.h"
33 #include "CallTypes.h"
36 using namespace Tizen::App;
37 using namespace Tizen::Base;
38 using namespace Tizen::Base::Collection;
39 using namespace Tizen::Base::Utility;
40 using namespace Tizen::Graphics;
41 using namespace Tizen::Media;
42 using namespace Tizen::Social;
43 using namespace Tizen::System;
44 using namespace Tizen::Ui;
45 using namespace Tizen::Ui::Controls;
46 using namespace Tizen::Ui::Scenes;
47 using namespace Tizen::Shell;
50 const int IDI_MAX_SECONDS = 60;
51 const int IDI_MAX_MINS = 60;
52 const int W_HOLD_BITMAP = 78;
53 const int H_HOLD_BITMAP = 78;
54 //for Options menu list
55 const int IDI_POPUP_TEXT_SIZE = 33;
56 const unsigned int COLOR_POPUP_TEXT = Color32<255, 255, 255, 255>::Value;
57 const int IDI_MOREOPTIONS_LIST_ITEMS = 1;
58 const int W_OPTION_ANCHOR = 72;
59 const int H_OPTION_ANCHOR = 22;
60 const int W_MGR_CONFCALL_BITMAP = 64;
61 const int H_MGR_CONFCALL_BITMAP = 64;
62 const int X_POPUP_ANCHOR = 632;
63 const int Y_POPUP_ANCHOR = 140;
64 const int W_POPUP_ANCHOR = 72;
65 const int H_POPUP_ANCHOR = 22;
66 const int IDI_OPTIONMENU_ITEM_SPACING = 16;
67 const Point IDI_OPTIONMENU_POS(238, 162);
68 const Dimension IDI_OPTIONMENU_DIMEN(466, 99);
69 const int X_PHOTO_LBL = 166;
70 const int Y_PHOTO_LBL = 232;
71 const int W_PHOTO_LBL = 388;
72 const int H_PHOTO_LBL = 388;
73 const int W_PHOTO_LABEL = 720;
74 const int H_PHOTO_LABEL = 720;
75 const int W_RIGHT_MORE_ICON_MARGIN = 24;
76 const int W_MORE_LABEL = 466;
77 const int H_MORE_LABEL = 162;
78 const int W_MORE_ICON = 70;
80 static const wchar_t* IDC_CONF_CALL_MORE_BUTTON = L"IDC_CONF_CALL_MORE_BUTTON";
81 static const wchar_t* IDC_HOLD_BUTTON = L"IDC_HOLD_BUTTON";
82 static const wchar_t* IDC_SWAP_BUTTON = L"IDC_SWAP_BUTTON";
83 static const wchar_t* IDC_HOLD_LABEL = L"IDC_HOLD_LABEL";
84 static const wchar_t* IDC_TEXTBOX = L"IDC_NUM_EDITFIELD";
85 static const wchar_t* IDC_CALLER1_LABEL = L"IDC_CALLER1_LABEL";
86 static const wchar_t* IDC_BACKGROUND_LABEL = L"IDC_BACKGROUND_LABEL";
87 static const wchar_t* IDC_CALLER1_TIME_LABEL = L"IDC_CALLER1_TIME_LABEL";
88 static const wchar_t* IDC_NUMBER1_LABEL = L"IDC_NUMBER1_LABEL";
89 static const wchar_t* IDC_VOICE_CALL_ICON_LABEL = L"IDC_VOICE_CALL_ICON_LABEL";
90 static const wchar_t* IDC_CALLER2_LABEL = L"IDC_CALLER2_LABEL";
91 static const wchar_t* IDC_NUMBER2_LABEL = L"IDC_NUMBER2_LABEL";
92 static const wchar_t* IDC_CALLER2_TIME_LABEL = L"IDC_CALLER2_TIME_LABEL";
93 static const wchar_t* IDC_SWAP_LABEL = L"IDC_SWAP_LABEL";
94 static const wchar_t* IDC_BACKGROUND_LABEL2 = L"IDC_BACKGROUND_LABEL2";
95 static const wchar_t* IDC_PARTICIPANTS_LABEL = L"IDC_PARTICIPANTS_LABEL";
96 static const wchar_t* IDC_CALLER1_BIGPHOTO_LABEL = L"IDC_CALLER1_BIGPHOTO_LABEL";
97 static const wchar_t* IDC_CALLER2_PHOTO_LABEL = L"IDC_CALLER2_PHOTO_LABEL";
98 static const wchar_t* IDC_CALLER1_PHOTO_LABEL = L"IDC_CALLER1_PHOTO_LABEL";
99 static const wchar_t* IDC_KEY_BG_LABEL = L"IDC_KEY_BG_LABEL";
101 ActiveCallForm::ActiveCallForm(FormType formType)
104 __pActiveCallTimer = null;
105 __pCallButtonsPanel = null;
106 __pDTMFKeypad = null;
107 __pMoreOptionsList = null;
108 __pMoreOptionsListAnchor = null;
109 __pSmallPhotoLabel = null;
110 __pActiveCallInfo = null;
111 __pHeldCallInfo = null;
112 __isSwapInProgress = false;
115 ActiveCallForm::~ActiveCallForm(void)
117 if (__pActiveCallTimer != null)
119 __pActiveCallTimer->Cancel();
120 delete __pActiveCallTimer;
122 if (__pMoreOptionsList != null)
124 __pMoreOptionsList = null;
126 if (__pMoreOptionsListAnchor != null)
128 __pMoreOptionsListAnchor = null;
130 if (__pSmallPhotoLabel != null)
132 __pSmallPhotoLabel = null;
134 if (__pActiveCallInfo != null)
136 delete __pActiveCallInfo;
138 if (__pHeldCallInfo != null)
140 delete __pHeldCallInfo;
142 if(__pDTMFKeypad != null)
144 __pDTMFKeypad = null;
149 ActiveCallForm::Initialize(void)
153 case FORMTYPE_OUTGOINGCALL:
154 Construct(IDL_OUTCALL_FORM);
157 case FORMTYPE_EMERGENCYOUTGOINGCALL:
158 Construct(IDL_OUT_EMERGENCYCALL_FORM);
161 case FORMTYPE_ACTIVECALL:
162 Construct(IDL_CALL_FORM);
165 case FORMTYPE_EMERGENCYACTIVECALL:
166 Construct(IDL_EMERGENCY_CALL_FORM);
169 case FORMTYPE_MULTIPLECALLS:
170 Construct(IDL_MULTIPLE_CALL_FORM);
173 case FORMTYPE_ACTIVECONFCALL:
174 Construct(IDL_CONFCALL_FORM);
183 ActiveCallForm::OnInitializing(void)
185 result r = E_SUCCESS;
187 //Hold Button - Shown on single active/conf call scene
188 InitializeHoldButton();
189 //Swap button for multiple call screen
190 InitializeSwapButton();
191 //Initialize manage conf. call list form
192 InitializeManageConfCallButton();
194 __pCallPresentor = CallPresentationModel::GetInstance();
199 ActiveCallForm::ShowDTMFKeypad(void)
201 if(__pDTMFKeypad == null)
203 //update rect according to client screen area
204 Rectangle rect(0, 0, 0, 0);
205 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
207 rect.width = GetClientAreaBounds().width;
208 rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight();
210 else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
212 rect.height = GetClientAreaBounds().height;
213 rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth();
216 AppLog("DTMF Keypad rect(%d,%d,%d,%d)",rect.x,rect.y,rect.width,rect.height);
217 __pDTMFKeypad = new (std::nothrow) DtmfKeyPadPanel();
218 __pDTMFKeypad->Initialize(this, rect);
219 AddControl(__pDTMFKeypad);
221 //set layout relation w.r.t call buttons panel
222 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
223 if (pRelativeLayout != null)
225 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
226 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
229 __pDTMFKeypad->SetShowState(true);
230 if(__DtmfString.IsEmpty() == false)
232 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
233 pTextBox->SetText(__DtmfString);
235 __pDTMFKeypad->Draw(true);
236 __pDTMFKeypad->Show();
240 ActiveCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
244 if (__pCallButtonsPanel != null)
246 //update position of call buttons panel
247 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
248 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
250 //bring button on top
251 __pCallButtonsPanel->SetButtonPosition();
253 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
254 if (pRelativeLayout != null)
256 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
259 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
260 if (pRelativeLayout != null)
262 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
263 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
266 //change orientation of DTMF Keypad, if it is visible.
267 if (__pDTMFKeypad != null)
269 if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
271 //in landscape mode, caller info is visible.
272 SetShowStateOnKeypad(true);
273 SetHoldButtonShowState(false);
275 else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
277 //in Portrait mode it is hidden beneath DTMF Keypad.
278 SetShowStateOnKeypad(false);
280 if(__pDTMFKeypad->GetShowState() == true)
282 String dtmfText = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
288 //More option is displayed recreate it
289 if(__pMoreOptionsListAnchor != null)
291 CreateMoreOptionsMenuList();
292 CreateMoreOptionsMenuList();
297 ActiveCallForm::HideDTMFKeypad(void)
299 if(__pDTMFKeypad != null)
301 __DtmfString = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
303 RemoveControl(__pDTMFKeypad);
304 __pDTMFKeypad = null;
309 ActiveCallForm::InitializeCallButtonsPanel(void)
311 result r = E_SUCCESS;
312 //Set background bitmap for call keypad
313 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
314 Bitmap* pBgBitmap = AppUtility::GetBitmapFromResourcesN(IDB_BACKGROUND_BITMAP, pKeysBgLbl->GetWidth(), pKeysBgLbl->GetHeight());
315 if (pBgBitmap != null)
317 pKeysBgLbl->SetBackgroundBitmap(*pBgBitmap);
320 if (__pCallButtonsPanel == null)
322 __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
323 __pCallButtonsPanel->ConstructPanel(this, __formType);
324 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
325 r = AddControl(__pCallButtonsPanel);
328 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
329 if (pRelativeLayout != null)
331 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
333 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
334 if (pRelativeLayout != null)
336 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
337 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
338 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
339 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_TOP_TO_TOP);
346 ActiveCallForm::InitializeSwapButton(void)
348 Button* pSwapBtn = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
351 Bitmap* pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_NORMAL,
352 W_HOLD_BITMAP, H_HOLD_BITMAP);
355 pSwapBtn->SetNormalBitmap(Point(0, 0), *pSwapBmp);
360 pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_PRESS,
361 W_HOLD_BITMAP, H_HOLD_BITMAP);
364 pSwapBtn->SetPressedBitmap(Point(0, 0), *pSwapBmp);
368 pSwapBtn->SetActionId(IDA_SWAP_CALLS);
369 pSwapBtn->AddActionEventListener(*this);
374 ActiveCallForm::InitializeManageConfCallButton(void)
376 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
377 if (pMoreBtn != null)
379 pMoreBtn->SetActionId(IDA_MORE_OPTIONS_MENU);
380 pMoreBtn->AddActionEventListener(*this);
381 if (__formType == FORMTYPE_MULTIPLECALLS)
383 //Correct state will be set in OnSceneActivated based on the call
384 pMoreBtn->SetShowState(false);
386 else if (__formType == FORMTYPE_ACTIVECONFCALL)
388 pMoreBtn->SetShowState(true);
394 ActiveCallForm::InitializeHoldButton(void)
396 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
397 if (pHoldBtn != null)
399 //set status of Hold Button
400 SetHoldButtonStatus(true);
401 pHoldBtn->AddActionEventListener(*this);
406 ActiveCallForm::SetHoldButtonStatus(bool toHoldCall)
408 //background bitmap & button name
410 Bitmap* normalImg = null;
411 Bitmap* pressImg = null;
414 btnName.Append(AppUtility::GetResourceString(IDS_HOLD_BTN_NAME));
415 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_NORMAL_BUTTON_ICON,
416 W_HOLD_BITMAP, H_HOLD_BITMAP);
417 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_PRESS_BUTTON_ICON,
418 W_HOLD_BITMAP, H_HOLD_BITMAP);
422 btnName.Append(AppUtility::GetResourceString(IDS_UNHOLD_BTN_NAME));
423 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_NORMAL_BUTTON_ICON,
424 W_HOLD_BITMAP, H_HOLD_BITMAP);
425 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_PRESS_BUTTON_ICON,
426 W_HOLD_BITMAP, H_HOLD_BITMAP);
430 CommandIds cmdId = IDA_HOLD_CALL;
433 case FORMTYPE_ACTIVECALL:
435 cmdId = toHoldCall ? IDA_HOLD_CALL : IDA_UNHOLD_CALL;
439 case FORMTYPE_ACTIVECONFCALL:
441 cmdId = toHoldCall ? IDA_HOLD_CONF_CALL : IDA_UNHOLD_CONF_CALL;
449 //set background bitmap, button name & action id
450 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
451 Label* pHoldLbl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
454 pHoldBtn->SetActionId(cmdId);
455 pHoldBtn->SetNormalBitmap(Point(0, 0),*normalImg);
456 pHoldBtn->SetPressedBitmap(Point(0, 0),*pressImg);
460 pHoldLbl->SetText(btnName);
461 pHoldLbl->Invalidate(true);
472 ActiveCallForm::CreateMoreOptionsMenuList(void)
474 //create option list anchor
475 if (__pMoreOptionsListAnchor == null)
477 Bitmap* pBgPopupArwBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_ARROW_ICON, W_OPTION_ANCHOR,
479 __pMoreOptionsListAnchor = new (std::nothrow) Label();
480 __pMoreOptionsListAnchor->Construct(Rectangle(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_ICON, Y_POPUP_ANCHOR, W_POPUP_ANCHOR, H_POPUP_ANCHOR), L"");
481 __pMoreOptionsListAnchor->SetBackgroundBitmap(*pBgPopupArwBmp);
483 delete pBgPopupArwBmp;
484 pBgPopupArwBmp = null;
486 // Adds a Label to the Form
487 AddControl(__pMoreOptionsListAnchor);
490 //create options menu list
491 if (__pMoreOptionsList == null)
493 __pMoreOptionsList = new (std::nothrow) ListView();
494 __pMoreOptionsList->Construct(Rectangle(Point(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_LABEL,H_MORE_LABEL), IDI_OPTIONMENU_DIMEN), false, SCROLL_STYLE_FADE_OUT);
495 __pMoreOptionsList->SetItemProvider(*this);
496 __pMoreOptionsList->AddListViewItemEventListener(*this);
497 //Add option list to the form
498 AddControl(__pMoreOptionsList);
502 //Hide option menu list
503 DestroyMoreOptionsMenuList();
508 ActiveCallForm::DestroyMoreOptionsMenuList(void)
510 if (__pMoreOptionsListAnchor != null)
512 //removes and delete the child control
513 RemoveControl(__pMoreOptionsListAnchor);
514 __pMoreOptionsListAnchor = null;
517 if (__pMoreOptionsList != null)
519 //removes and delete the child control
520 RemoveControl(__pMoreOptionsList);
521 __pMoreOptionsList = null;
526 ActiveCallForm::OnTerminating(void)
528 result r = E_SUCCESS;
529 if (__pCallPresentor != null)
531 __pCallPresentor = null;
537 ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
545 //End the currently active / dialing call
546 if (__pActiveCallInfo->IsConferenceCall() == false)
548 String activeContactNo;
549 activeContactNo.Append(__pActiveCallInfo->GetContactNumber());
550 //Check if it is call is in dialing state, then
551 if (__formType == FORMTYPE_EMERGENCYOUTGOINGCALL || __formType == FORMTYPE_OUTGOINGCALL)
553 __pCallPresentor->EndDialingCall(activeContactNo);
558 __pCallPresentor->EndActiveCall(*__pActiveCallInfo->GetCallHandle());
563 __pCallPresentor->EndConferenceCall();
568 case IDA_END_CONF_CALL:
570 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
571 __pCallPresentor->EndConferenceCall();
575 case IDA_OPEN_NUMKEYPAD:
577 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
579 //hide only in portrait mode.
580 SetShowStateOnKeypad(false);
582 //Hide the hold button as it goes behind DTMF keypad
583 SetHoldButtonShowState(false);
585 __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
589 case IDA_CLOSE_NUMKEYPAD:
591 SetShowStateOnKeypad(true);
593 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
599 //switch to Dialer Form to make an call
600 if(__pCallPresentor->GetCurrentCallCount() == 1)
602 __pCallPresentor->LaunchDialAppControl();
610 if (__pActiveCallInfo->IsConferenceCall() == false)
612 if(__pActiveCallInfo->GetCallHandle() != null)
614 success = __pCallPresentor->HoldCall(*__pActiveCallInfo->GetCallHandle());
619 success = __pCallPresentor->HoldConferenceCall();
621 //reset hold status and "OnHold" text
622 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
623 if(__pActiveCallTimer != null)
625 __pActiveCallTimer->Cancel();
627 SetHoldButtonStatus(!success);
631 case IDA_UNHOLD_CALL:
633 bool success = false;
634 if (__pActiveCallInfo->IsConferenceCall() == false)
636 if(__pActiveCallInfo->GetCallHandle() != null)
638 success = __pCallPresentor->UnHoldCall(*__pActiveCallInfo->GetCallHandle());
643 success = __pCallPresentor->ActivateConferenceCall();
645 //reset hold status and show call timer
646 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
647 SetHoldButtonStatus(success);
651 case IDA_HOLD_CONF_CALL:
653 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
654 bool success = __pCallPresentor->HoldConferenceCall();
655 //reset hold status and "OnHold" text
656 SetHoldButtonStatus(!success);
657 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
658 if(__pActiveCallTimer != null)
660 __pActiveCallTimer->Cancel();
665 case IDA_UNHOLD_CONF_CALL:
667 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
668 bool success = __pCallPresentor->ActivateConferenceCall();
669 //reset hold status and show call timer
670 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
671 SetHoldButtonStatus(success);
675 case IDA_OPEN_CONTACTS:
678 //Launch call application
679 AppManager* pAppManager = AppManager::GetInstance();
680 pAppManager->LaunchApplication(PROVIDER_ID_CONTACTS);
686 bool success = __pCallPresentor->SetMuteStatus(true);
689 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
696 bool success = __pCallPresentor->SetMuteStatus(false);
699 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
706 bool success = __pCallPresentor->SetSpeakerStatus(true);
709 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
714 case IDA_SPEAKER_OFF:
716 bool success = __pCallPresentor->SetSpeakerStatus(false);
719 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
726 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
727 __pCallPresentor->JoinCall();
733 if(IsSwapInProgress() == false)
735 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
736 __pCallPresentor->SwapCalls();
737 SetSwapInProgress(true);
742 case IDA_MORE_OPTIONS_MENU:
744 //Show 'more' options menu
745 CreateMoreOptionsMenuList();
751 dtmfString.Append(L"0");
752 SetTextToDTMFTextField(dtmfString);
753 __pCallPresentor->SendDTMFSignal(dtmfString);
759 dtmfString.Append(L"1");
760 SetTextToDTMFTextField(dtmfString);
761 __pCallPresentor->SendDTMFSignal(dtmfString);
767 dtmfString.Append(L"2");
768 SetTextToDTMFTextField(dtmfString);
769 __pCallPresentor->SendDTMFSignal(dtmfString);
775 dtmfString.Append(L"3");
776 SetTextToDTMFTextField(dtmfString);
777 __pCallPresentor->SendDTMFSignal(dtmfString);
783 dtmfString.Append(L"4");
784 SetTextToDTMFTextField(dtmfString);
785 __pCallPresentor->SendDTMFSignal(dtmfString);
791 dtmfString.Append(L"5");
792 SetTextToDTMFTextField(dtmfString);
793 __pCallPresentor->SendDTMFSignal(dtmfString);
799 dtmfString.Append(L"6");
800 SetTextToDTMFTextField(dtmfString);
801 __pCallPresentor->SendDTMFSignal(dtmfString);
807 dtmfString.Append(L"7");
808 SetTextToDTMFTextField(dtmfString);
809 __pCallPresentor->SendDTMFSignal(dtmfString);
815 dtmfString.Append(L"8");
816 SetTextToDTMFTextField(dtmfString);
817 __pCallPresentor->SendDTMFSignal(dtmfString);
823 dtmfString.Append(L"9");
824 SetTextToDTMFTextField(dtmfString);
825 __pCallPresentor->SendDTMFSignal(dtmfString);
831 dtmfString.Append(L"*");
832 SetTextToDTMFTextField(dtmfString);
833 __pCallPresentor->SendDTMFSignal(dtmfString);
839 dtmfString.Append(L"#");
840 SetTextToDTMFTextField(dtmfString);
841 __pCallPresentor->SendDTMFSignal(dtmfString);
851 ActiveCallForm::IsSwapInProgress(void)
853 return __isSwapInProgress;
857 ActiveCallForm::SetSwapInProgress(bool progress)
859 __isSwapInProgress = progress;
863 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
865 if(__pDTMFKeypad != null)
867 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
869 int startpos=-1,endpos=-1;
870 pTextBox->GetBlockRange(startpos,endpos);
874 pTextBox->ReleaseBlock();
877 pTextBox->InsertTextAtCursorPosition(dtmfStr);
878 //pTextBox->AppendText(dtmfStr);
879 pTextBox->SetFocus();
880 pTextBox->Invalidate(true);
885 ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
888 //set itself as listener
889 __pCallPresentor->SetTelEventListener(this);
890 AddOrientationEventListener(*this);
892 CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
893 pPhoneApp->AddAppStateChangeListener(*this);
895 //Initialize keypad and buttons
896 InitializeCallButtonsPanel();
898 if (__pActiveCallInfo != null)
900 delete __pActiveCallInfo;
901 __pActiveCallInfo = null;
903 if (__pHeldCallInfo != null)
905 delete __pHeldCallInfo;
906 __pHeldCallInfo = null;
908 DestroyMoreOptionsMenuList();
912 case FORMTYPE_OUTGOINGCALL:
915 contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
916 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
917 __pActiveCallInfo->SetContactNumber(contactNo);
918 Contact* pContact = __pCallPresentor->GetContactN(contactNo);
919 if (pContact != null)
921 __pActiveCallInfo->SetContactInfo(*pContact);
924 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
925 //make an normal outgoing call
926 __pCallPresentor->DialCall(contactNo, false);
930 case FORMTYPE_EMERGENCYOUTGOINGCALL:
932 String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
933 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
934 long long phNumber = 0;
935 LongLong::Parse(*pContactNo, phNumber);
936 __pActiveCallInfo->SetContactNumber(*pContactNo);
937 //make an emergency call
938 __pCallPresentor->DialCall(*pContactNo, true);
942 case FORMTYPE_ACTIVECALL:
945 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
947 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
948 *__pActiveCallInfo = *pCall;
949 String activeContactNo;
950 if(pCall->GetContactNumber().IsEmpty() == false)
952 activeContactNo.Append(pCall->GetContactNumber());
956 activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
958 ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
960 //show call active time using Timer
961 __activeCallStartTime = pCall->GetCallConnectTime();
962 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
966 case FORMTYPE_EMERGENCYACTIVECALL:
969 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
971 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
972 *__pActiveCallInfo = *pCall;
974 //show call active time using Timer
975 __activeCallStartTime = pCall->GetCallConnectTime();
976 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
980 case FORMTYPE_MULTIPLECALLS:
982 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
984 UpdateMultipleCallScreen(*pCallsList);
990 case FORMTYPE_ACTIVECONFCALL:
993 AppCallInfo* pConfInfo = static_cast<AppCallInfo*>(pArgs->GetAt(0));
994 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
995 *__pActiveCallInfo = *pConfInfo;
997 int participantsCount = __pActiveCallInfo->GetCallerListCount();
999 // show participant count on name Label
1000 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1001 if (pPeopleCountLbl)
1004 count.Append(participantsCount);
1006 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1007 pPeopleCountLbl->SetText(count);
1010 if(participantsCount >= IDI_MAX_CONF_CALL_PARTICIPANTS)
1012 __pCallButtonsPanel->EnableAddCallButton(false);
1016 __pCallButtonsPanel->EnableAddCallButton(true);
1019 //show call active time using Timer
1020 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1021 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime);
1029 if(__formType == FORMTYPE_ACTIVECALL || __formType == FORMTYPE_EMERGENCYACTIVECALL ||
1030 __formType == FORMTYPE_MULTIPLECALLS || __formType == FORMTYPE_ACTIVECONFCALL)
1032 //Unlock the phone if its locked
1033 if(LockManager::GetInstance()->IsLocked())
1035 AppLogDebug("Phone Locked");
1036 LockManager::GetInstance()->Unlock();
1040 //Hide DTMFKeypad, if visible and show caller info
1042 SetShowStateOnKeypad(true);
1043 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
1045 //Set the correct speaker status
1046 if(__pCallPresentor->IsSpeakerOn() == true)
1048 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
1052 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
1055 //Set the correct Mute status
1056 if (__pCallPresentor->IsCallMuted() == true)
1058 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
1062 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
1072 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1073 pCallApp->SetTopMostWindow(false);
1077 ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1079 RemoveOrientationEventListener(*this);
1080 if (__pCallButtonsPanel != null)
1082 RemoveControl(__pCallButtonsPanel);
1083 __pCallButtonsPanel = null;
1085 if (__pActiveCallTimer != null)
1087 __pActiveCallTimer->Cancel();
1088 delete __pActiveCallTimer;
1089 __pActiveCallTimer = null;
1091 if (__pSmallPhotoLabel != null)
1093 __pSmallPhotoLabel->SetShowState(false);
1095 //Hide "Manage conf. Call" Context menu
1096 if (__pMoreOptionsListAnchor != null)
1098 __pMoreOptionsListAnchor->SetShowState(false);
1100 if (__pMoreOptionsList != null)
1102 __pMoreOptionsList->SetShowState(false);
1104 __DtmfString.Clear();
1105 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1106 pCallApp->RemoveAppStateChangeListener(*this);
1110 ActiveCallForm::HandleConfCallChanged(void)
1113 AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
1114 //fetch changed conference call info
1115 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1116 if (pConfCallInfo == null)
1122 //fetch participant count in conf call
1123 int participantsCount = pConfCallInfo->GetCallerListCount();
1124 //update status of join and Add call
1125 bool isEnableAddCall = false;
1126 bool isEnableJoinCall = false;
1127 if(participantsCount < IDI_MAX_CONF_CALL_PARTICIPANTS)
1129 //available only at Active conf. call or active call screen
1130 isEnableAddCall = true;
1131 //join button is available only at multiple call screen
1132 isEnableJoinCall = true;
1135 Label* pPeopleCountLbl = null;
1136 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == true)
1138 //Active call is conference call
1139 delete __pActiveCallInfo;
1140 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1141 *__pActiveCallInfo = *pConfCallInfo;
1143 if (__formType == FORMTYPE_MULTIPLECALLS)
1145 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1147 else if (__formType == FORMTYPE_ACTIVECONFCALL)
1149 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1150 AppLog("Active conf call...(%d)", pPeopleCountLbl);
1153 else if(__pHeldCallInfo != null && __pHeldCallInfo->IsConferenceCall() == true)
1155 //Held call is conference call - this is definitely multiple call screen.
1156 delete __pHeldCallInfo;
1157 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1158 *__pHeldCallInfo = *pConfCallInfo;
1159 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1162 // update participant count on name Label
1163 if (pPeopleCountLbl != null)
1166 count.Append(participantsCount);
1168 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1169 pPeopleCountLbl->SetText(count);
1170 pPeopleCountLbl->Invalidate(true);
1172 //change AddCall Button status
1173 __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
1174 //change JoinCall Button status
1175 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1180 ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
1183 if(__pActiveCallInfo != null)
1185 delete __pActiveCallInfo;
1186 __pActiveCallInfo = null;
1188 if(__pHeldCallInfo != null)
1190 delete __pHeldCallInfo;
1191 __pHeldCallInfo = null;
1194 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1195 if (pMoreBtn != null)
1197 pMoreBtn->SetShowState(false);
1200 //show caller's info.
1201 for (int index = 0; index < activeCallsList.GetCount(); index++)
1204 AppCallInfo callInfo;
1205 activeCallsList.GetAt(index, callInfo);
1208 if(callInfo.GetContactNumber().IsEmpty() == false)
1210 contactNo.Append(callInfo.GetContactNumber());
1214 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1217 if (callInfo.IsOnHold() == false)
1219 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1220 *__pActiveCallInfo = callInfo;
1222 if (__pActiveCallInfo->IsConferenceCall() == false)
1224 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1227 pVoiceIconLbl->SetShowState(true);
1229 if (pMoreBtn != null)
1231 pMoreBtn->SetShowState(false);
1233 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1234 if(__pMoreOptionsListAnchor != null && __pMoreOptionsListAnchor->GetShowState() == true)
1236 CreateMoreOptionsMenuList();
1241 // show participant count on name Label
1242 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1243 if (pPeopleCountLbl)
1246 count.Append(__pActiveCallInfo->GetCallerListCount());
1248 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1249 pPeopleCountLbl->SetText(count);
1251 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1252 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1255 pNameLbl->SetText(nameStr);
1257 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1260 pVoiceIconLbl->SetShowState(false);
1262 if (pMoreBtn != null)
1264 pMoreBtn->SetShowState(true);
1266 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1267 if (pPhotoBitmap != null)
1269 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER1_PHOTO_LABEL));
1272 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1273 pPhotoLbl->Invalidate(true);
1275 delete pPhotoBitmap;
1278 //show call active time using Timer
1279 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1280 ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime);
1284 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1285 *__pHeldCallInfo = callInfo;
1287 if (__pHeldCallInfo->IsConferenceCall() == false)
1289 ShowPersonDetails(contactNo, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pHeldCallInfo);
1293 // show participant count on name Label
1294 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1295 if (pPeopleCountLbl)
1298 count.Append(__pHeldCallInfo->GetCallerListCount());
1300 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1301 pPeopleCountLbl->SetText(count);
1303 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1304 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1307 pNameLbl->SetText(nameStr);
1309 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1310 if (pPhotoBitmap != null)
1312 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER2_PHOTO_LABEL));
1315 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1316 pPhotoLbl->Invalidate(true);
1318 delete pPhotoBitmap;
1322 ShowTimerInfo(IDC_CALLER2_TIME_LABEL, true);
1326 //update JoinCall button status
1327 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1333 ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
1335 //call individual methods to show contact number, caller name & photo
1336 ShowPhoneNumber(phoneNumber, contactLblName);
1338 //fetch contact details based on phone number
1339 String* pDisplayName = pCallInfo->FetchCallerNameN();
1340 ShowCallerName(*pDisplayName, nameLblName);
1342 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1343 ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
1348 delete pDisplayName;
1349 pDisplayName = null;
1353 delete pPhotoBitmap;
1354 pPhotoBitmap = null;
1359 ActiveCallForm::ShowPhoneNumber(const String& phoneNumber, const String& contactLblName)
1361 String formattedNumber = phoneNumber;
1363 Label* pContactLbl = static_cast<Label*>(GetControl(contactLblName));
1366 pContactLbl->SetText(formattedNumber);
1367 pContactLbl->Invalidate(true);
1372 ActiveCallForm::ShowCallerName(const String& callerName, const String& nameLblName)
1374 // show display name on name Label
1375 Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
1378 //passing an empty string to SetText fails in label,
1379 //if previously valid text has been set
1380 if (callerName.IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
1382 String stringToBeSet(L" ");
1383 pNameLbl->SetText(stringToBeSet);
1387 pNameLbl->SetText(callerName);
1389 pNameLbl->Invalidate(true);
1394 ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
1396 //to check if default image is to be shown
1397 bool showDefaultPhoto = false;
1398 bool showSmallPhoto = false;
1399 String photoLabel("");
1403 case FORMTYPE_OUTGOINGCALL:
1404 case FORMTYPE_ACTIVECALL:
1406 if (pPhotoId == null)
1408 //show default caller image
1409 showDefaultPhoto = true;
1413 //Check the size of photo
1414 // Now checking the condition with && but actually it should be ||
1415 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1416 // height 270 and width = 480 . So all images set thru gallery is show as small image
1417 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1418 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1420 showSmallPhoto = true;
1424 photoLabel.Append(IDC_CALLER1_BIGPHOTO_LABEL);
1428 case FORMTYPE_MULTIPLECALLS:
1432 photoLabel.Append(IDC_CALLER2_PHOTO_LABEL);
1436 photoLabel.Append(IDC_CALLER1_PHOTO_LABEL);
1439 if (pPhotoId == null)
1441 showDefaultPhoto = true;
1445 if (pPhotoId->GetHeight() <= H_SMALL_PHOTO
1446 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1448 //pPhotoId->Scale(Dimension(W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO));
1449 showSmallPhoto = true;
1459 //Remove small photo label
1460 if (__pSmallPhotoLabel != null)
1462 RemoveControl(__pSmallPhotoLabel);
1463 __pSmallPhotoLabel = null;
1466 //show photo - for Big Photo Id, Animated Call Image
1467 if (!showDefaultPhoto)
1469 if(showSmallPhoto == true)
1471 ShowThumbnailImage(pPhotoId,photoLabel);
1475 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1478 Canvas* pCanvas = new (std::nothrow) Canvas;
1479 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1480 pCanvas->Construct(canvasRect);
1481 //draw the contact bitmap
1482 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1483 Bitmap* pNewPhotoId = new Bitmap();
1484 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1487 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1488 pPhotoLbl->Invalidate(true);
1495 Bitmap* pDefaultPhoto = null;
1498 case FORMTYPE_OUTGOINGCALL:
1499 case FORMTYPE_ACTIVECALL:
1500 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1503 case FORMTYPE_MULTIPLECALLS:
1504 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_MULTIPLE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1507 case FORMTYPE_ACTIVECONFCALL:
1508 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BIG_BG_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1514 if (pDefaultPhoto != null)
1516 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1519 pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
1521 delete pDefaultPhoto;
1527 ActiveCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,String& photoLabel)
1529 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1531 if (pPhotoLbl != null && pPhotoId != null)
1533 Canvas* pCanvas = new (std::nothrow) Canvas;
1534 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1535 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1536 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1537 pCanvas->Construct(canvasRect);
1538 //draw the back ground
1539 pCanvas->DrawBitmap(canvasRect,*pBackground);
1540 //draw shadow (to be enabled after correct shadow image is provided )
1541 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1542 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1543 //draw the contact bitmap
1544 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1545 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1546 Bitmap* pNewPhotoId = new Bitmap();
1547 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1550 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1551 pPhotoLbl->Invalidate(true);
1560 ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1562 if (__pSmallPhotoLabel != null)
1564 RemoveControl(__pSmallPhotoLabel);
1565 __pSmallPhotoLabel = null;
1567 //Draw Small Photo and show on small photo label
1568 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1569 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1570 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1571 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1572 // Add a Label to the Form
1573 AddControl(__pSmallPhotoLabel);
1574 __pSmallPhotoLabel->Invalidate(true);
1578 ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long long startTime)
1580 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1582 if (__pActiveCallTimer == null)
1584 __pActiveCallTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
1585 __pActiveCallTimer->Construct(*this);
1588 if (pTimerLbl != null)
1590 if (isOnHold == true)
1592 pTimerLbl->SetText(AppUtility::GetResourceString(IDS_TIMER_ON_HOLD));
1593 //update Hold button status
1594 SetHoldButtonStatus(false);
1598 //update Hold button status
1599 SetHoldButtonStatus(true);
1600 //current system time
1601 long long currTime = 0;
1602 SystemTime::GetTicks(currTime);
1604 TimeSpan diffSpan(abs(startTime - currTime));
1606 String activeCallTime(L"");
1608 long long hr = diffSpan.GetHours();
1611 activeCallTime.Append("0");
1613 activeCallTime.Append(hr);
1614 activeCallTime.Append(L":");
1616 long long min = diffSpan.GetMinutes();
1619 activeCallTime.Append("0");
1621 activeCallTime.Append(min);
1622 activeCallTime.Append(L":");
1624 long long sec = diffSpan.GetSeconds();
1627 activeCallTime.Append("0");
1629 activeCallTime.Append(sec);
1631 pTimerLbl->SetText(activeCallTime);
1632 __pActiveCallTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
1634 pTimerLbl->Invalidate(true);
1639 ActiveCallForm::SetHoldButtonShowState(bool showState)
1641 Label* pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1642 if(pLblControl != null)
1644 pLblControl->SetShowState(showState);
1646 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1647 if(pButtonControl != null)
1649 pButtonControl->SetShowState(showState);
1654 ActiveCallForm::SetShowStateOnKeypad(bool showState)
1656 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1657 pLblControl->SetShowState(showState);
1658 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL));
1659 pLblControl->SetShowState(showState);
1660 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1661 pLblControl->SetShowState(showState);
1662 if (__pSmallPhotoLabel != null)
1664 __pSmallPhotoLabel->SetShowState(showState);
1669 case FORMTYPE_ACTIVECALL:
1671 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1672 pLblControl->SetShowState(showState);
1673 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1674 pLblControl->SetShowState(showState);
1675 SetHoldButtonShowState(showState);
1679 case FORMTYPE_MULTIPLECALLS:
1681 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1682 pLblControl->SetShowState(showState);
1683 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1684 pLblControl->SetShowState(showState);
1685 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1686 pLblControl->SetShowState(showState);
1687 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1688 pLblControl->SetShowState(showState);
1689 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1690 pLblControl->SetShowState(showState);
1691 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1692 pLblControl->SetShowState(showState);
1693 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == false)
1695 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1696 pLblControl->SetShowState(showState);
1700 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1701 pButtonControl->SetShowState(showState);
1703 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1704 pButtonControl->SetShowState(showState);
1708 case FORMTYPE_ACTIVECONFCALL:
1710 pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1711 pLblControl->SetShowState(showState);
1712 SetHoldButtonShowState(showState);
1713 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1714 pButtonControl->SetShowState(showState);
1724 ActiveCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1726 //Call default implementation of "Object.Equals()"
1727 //returns true, if they are pointing to same address.
1728 if (__pActiveCallTimer->Equals(timer))
1730 Label* pTimerLbl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1733 String activeCallTime = pTimerLbl->GetText();
1734 // Create a StringTokenizer instance
1735 StringTokenizer strTokens(activeCallTime, L":");
1737 int count = strTokens.GetTokenCount(); // count == 3
1742 for (int index = 0; index < count; index++)
1747 strTokens.GetNextToken(token);
1748 Integer::Parse(token, hr);
1752 strTokens.GetNextToken(token);
1753 Integer::Parse(token, min);
1757 strTokens.GetNextToken(token);
1758 Integer::Parse(token, sec);
1764 if (sec == IDI_MAX_SECONDS)
1769 if (min == IDI_MAX_MINS)
1776 activeCallTime.Clear();
1779 activeCallTime.Append("0");
1781 activeCallTime.Append(hr);
1782 activeCallTime.Append(":");
1785 activeCallTime.Append("0");
1787 activeCallTime.Append(min);
1788 activeCallTime.Append(":");
1791 activeCallTime.Append("0");
1793 activeCallTime.Append(sec);
1794 //update timer label
1795 pTimerLbl->SetText(activeCallTime);
1796 pTimerLbl->Invalidate(true);
1801 ///////////////////////////////////////////////////////////
1802 /////////// Options Menu List Functionality /////////
1803 ///////////////////////////////////////////////////////////
1805 ActiveCallForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
1810 ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
1812 //Goto conference call list form
1813 SceneManager* pSceneManager = SceneManager::GetInstance();
1814 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
1815 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY), null);
1819 ActiveCallForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
1824 ActiveCallForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
1829 ActiveCallForm::GetItemCount(void)
1831 return IDI_MOREOPTIONS_LIST_ITEMS;
1835 ActiveCallForm::CreateItem(int index, int itemWidth)
1837 //create 1st Menu option
1838 CustomItem* pItem = new (std::nothrow) CustomItem();
1839 pItem->Construct(IDI_OPTIONMENU_DIMEN, LIST_ANNEX_STYLE_NORMAL);
1841 //Set background 9-patch bitmap to option menu
1842 Bitmap* pBgBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_BG_ICON);
1843 if (pBgBmp != null && pBgBmp->IsNinePatchedBitmap())
1846 bgCanvas.Construct(Rectangle(IDI_OPTIONMENU_POS, IDI_OPTIONMENU_DIMEN));
1847 bgCanvas.DrawNinePatchedBitmap(bgCanvas.GetBounds(), *pBgBmp);
1851 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color(40, 45, 48));
1856 //Set bitmap to option menu
1857 Bitmap* pNormalConfCallBmp = AppUtility::GetBitmapFromResourcesN(IDB_MORE_MANAGE_CONFERENCE_ICON ,
1858 W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP);
1859 pItem->AddElement(Rectangle(16, 17, W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP), 1, *pNormalConfCallBmp, null, null);
1860 // Deallocate bitmaps
1861 delete pNormalConfCallBmp;
1862 pNormalConfCallBmp = null;
1864 //Set text to menu option
1865 String confCallName = AppUtility::GetResourceString(IDS_MGR_CONF_CALL_LIST_STR);
1867 TextElement* pTextElement = new (std::nothrow) TextElement();
1868 pTextElement->Construct(confCallName);
1869 pTextElement->SetTextColor(COLOR_POPUP_TEXT);
1872 font.Construct(FONT_STYLE_PLAIN, IDI_POPUP_TEXT_SIZE);
1873 pTextElement->SetFont(font);
1874 //construct Enriched text
1875 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1876 FloatDimension textDimension;
1877 font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
1878 textDimension.height = textDimension.height + font.GetDescender();
1879 pEnrichedText->Construct(textDimension);
1880 //add text element to enriched text
1881 pEnrichedText->Add(*pTextElement);
1883 //Add Enriched text to pItem
1884 FloatPoint textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
1885 pItem->AddElement(FloatRectangle(textPos, textDimension), 2, *pEnrichedText);
1887 pEnrichedText->RemoveAll(true);
1888 delete pEnrichedText;
1893 ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
1900 ActiveCallForm::OnForeground(void)
1902 AppLogDebug("Enter");
1903 __pCallPresentor->OnAppForeground();