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(486, 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";
100 static const wchar_t* IDC_DTMF_KEY_BG_LABEL = L"IDC_DTMF_KEY_BG_LABEL";
102 ActiveCallForm::ActiveCallForm(FormType formType)
105 __pActiveCallTimer = null;
106 __pCallButtonsPanel = null;
107 __pDTMFKeypad = null;
108 __pMoreOptionsList = null;
109 __pMoreOptionsListAnchor = null;
110 __pSmallPhotoLabel = null;
111 __pActiveCallInfo = null;
112 __pHeldCallInfo = null;
113 __isSwapInProgress = false;
114 __pAddressbook = null;
117 ActiveCallForm::~ActiveCallForm(void)
119 if (__pActiveCallTimer != null)
121 __pActiveCallTimer->Cancel();
122 delete __pActiveCallTimer;
124 if (__pMoreOptionsList != null)
126 __pMoreOptionsList = null;
128 if (__pMoreOptionsListAnchor != null)
130 __pMoreOptionsListAnchor = null;
132 if (__pSmallPhotoLabel != null)
134 __pSmallPhotoLabel = null;
136 if (__pActiveCallInfo != null)
138 delete __pActiveCallInfo;
140 if (__pHeldCallInfo != null)
142 delete __pHeldCallInfo;
144 if(__pDTMFKeypad != null)
146 __pDTMFKeypad = null;
151 ActiveCallForm::Initialize(void)
155 case FORMTYPE_OUTGOINGCALL:
156 Construct(IDL_OUTCALL_FORM);
159 case FORMTYPE_EMERGENCYOUTGOINGCALL:
160 Construct(IDL_OUT_EMERGENCYCALL_FORM);
163 case FORMTYPE_ACTIVECALL:
164 Construct(IDL_CALL_FORM);
167 case FORMTYPE_EMERGENCYACTIVECALL:
168 Construct(IDL_EMERGENCY_CALL_FORM);
171 case FORMTYPE_MULTIPLECALLS:
172 Construct(IDL_MULTIPLE_CALL_FORM);
175 case FORMTYPE_ACTIVECONFCALL:
176 Construct(IDL_CONFCALL_FORM);
185 ActiveCallForm::OnInitializing(void)
187 result r = E_SUCCESS;
189 //Hold Button - Shown on single active/conf call scene
190 InitializeHoldButton();
191 //Swap button for multiple call screen
192 InitializeSwapButton();
193 //Initialize manage conf. call list form
194 InitializeManageConfCallButton();
195 __pCallPresentor = CallPresentationModel::GetInstance();
200 ActiveCallForm::ShowDTMFKeypad(void)
202 __pDTMFKeypad->SetShowState(true);
203 __pDTMFKeypad->Draw(true);
204 __pDTMFKeypad->Show();
208 ActiveCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
212 if (__pCallButtonsPanel != null)
214 //update position of call buttons panel
215 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
216 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
218 //bring button on top
219 __pCallButtonsPanel->SetButtonPosition();
221 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
222 if (pRelativeLayout != null)
224 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
227 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
228 if (pRelativeLayout != null)
230 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
231 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
234 //change orientation of DTMF Keypad, if it is visible.
235 if(__pDTMFKeypad != null)
237 Rectangle rect(0, 0, 0, 0);
238 if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
240 rect.height = GetClientAreaBounds().height;
241 rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth();
243 else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
245 rect.width = GetClientAreaBounds().width;
246 rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight();
248 __pDTMFKeypad->SetBounds(rect);
249 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
250 if (pRelativeLayout != null)
252 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
253 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
254 pRelativeLayout->Update();
255 delete pRelativeLayout;
257 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
258 if (pRelativeLayout != null)
260 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
261 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_BOTTOM_TO_TOP);
262 pRelativeLayout->Update();
263 delete pRelativeLayout;
265 __pDTMFKeypad->setKeysPanelBounds();
266 __pDTMFKeypad->InvalidateBounds(rect);
267 __pDTMFKeypad->Invalidate(true);
273 //change orientation of DTMF Keypad, if it is visible.
274 if (__pDTMFKeypad != null && __pDTMFKeypad->GetShowState() == true)
276 if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
278 //in landscape mode, caller info is visible.
279 SetShowStateOnKeypad(true);
280 //Hide few labels and buttons in landscape mode when DTMF keypad is shown
281 SetShowStateOnKeypadLandscape(false);
282 SetHoldButtonShowState(false);
284 else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
286 //in Portrait mode it is hidden beneath DTMF Keypad.
287 SetShowStateOnKeypad(false);
288 DestroyMoreOptionsMenuList();
292 //More option is displayed recreate it
293 if(__pMoreOptionsListAnchor != null)
295 CreateMoreOptionsMenuList();
296 CreateMoreOptionsMenuList();
301 ActiveCallForm::HideDTMFKeypad(void)
303 if(__pDTMFKeypad != null)
305 __DtmfString = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
306 __pDTMFKeypad->SetShowState(false);
311 ActiveCallForm::InitializeCallButtonsPanel(void)
313 result r = E_SUCCESS;
314 //Set background bitmap for call keypad
315 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
316 Bitmap* pBgBitmap = AppUtility::GetBitmapFromResourcesN(IDB_BACKGROUND_BITMAP, pKeysBgLbl->GetWidth(), pKeysBgLbl->GetHeight());
317 if (pBgBitmap != null)
319 pKeysBgLbl->SetBackgroundBitmap(*pBgBitmap);
322 if (__pCallButtonsPanel == null)
324 __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
325 __pCallButtonsPanel->ConstructPanel(this, __formType);
326 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
327 r = AddControl(__pCallButtonsPanel);
330 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
331 if (pRelativeLayout != null)
333 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
335 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
336 if (pRelativeLayout != null)
338 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
339 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
340 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
341 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_TOP_TO_TOP);
348 ActiveCallForm::InitializeSwapButton(void)
350 Button* pSwapBtn = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
353 Bitmap* pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_NORMAL,
354 W_HOLD_BITMAP, H_HOLD_BITMAP);
357 pSwapBtn->SetNormalBitmap(Point(0, 0), *pSwapBmp);
362 pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_PRESS,
363 W_HOLD_BITMAP, H_HOLD_BITMAP);
366 pSwapBtn->SetPressedBitmap(Point(0, 0), *pSwapBmp);
370 pSwapBtn->SetActionId(IDA_SWAP_CALLS);
371 pSwapBtn->AddActionEventListener(*this);
376 ActiveCallForm::InitializeManageConfCallButton(void)
378 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
379 if (pMoreBtn != null)
381 pMoreBtn->SetActionId(IDA_MORE_OPTIONS_MENU);
382 pMoreBtn->AddActionEventListener(*this);
383 if (__formType == FORMTYPE_MULTIPLECALLS)
385 //Correct state will be set in OnSceneActivated based on the call
386 pMoreBtn->SetShowState(false);
388 else if (__formType == FORMTYPE_ACTIVECONFCALL)
390 pMoreBtn->SetShowState(true);
396 ActiveCallForm::InitializeHoldButton(void)
398 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
399 if (pHoldBtn != null)
401 //set status of Hold Button
402 SetHoldButtonStatus(true);
403 pHoldBtn->AddActionEventListener(*this);
408 ActiveCallForm::SetHoldButtonStatus(bool toHoldCall)
410 //background bitmap & button name
412 Bitmap* normalImg = null;
413 Bitmap* pressImg = null;
416 btnName.Append(AppUtility::GetResourceString(IDS_HOLD_BTN_NAME));
417 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_NORMAL_BUTTON_ICON,
418 W_HOLD_BITMAP, H_HOLD_BITMAP);
419 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_PRESS_BUTTON_ICON,
420 W_HOLD_BITMAP, H_HOLD_BITMAP);
424 btnName.Append(AppUtility::GetResourceString(IDS_UNHOLD_BTN_NAME));
425 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_NORMAL_BUTTON_ICON,
426 W_HOLD_BITMAP, H_HOLD_BITMAP);
427 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_PRESS_BUTTON_ICON,
428 W_HOLD_BITMAP, H_HOLD_BITMAP);
432 CommandIds cmdId = IDA_HOLD_CALL;
435 case FORMTYPE_ACTIVECALL:
437 cmdId = toHoldCall ? IDA_HOLD_CALL : IDA_UNHOLD_CALL;
441 case FORMTYPE_ACTIVECONFCALL:
443 cmdId = toHoldCall ? IDA_HOLD_CONF_CALL : IDA_UNHOLD_CONF_CALL;
451 //set background bitmap, button name & action id
452 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
453 Label* pHoldLbl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
456 pHoldBtn->SetActionId(cmdId);
457 pHoldBtn->SetNormalBitmap(Point(0, 0),*normalImg);
458 pHoldBtn->SetPressedBitmap(Point(0, 0),*pressImg);
459 pHoldBtn->Invalidate(true);
463 pHoldLbl->SetText(btnName);
464 pHoldLbl->Invalidate(true);
475 ActiveCallForm::CreateMoreOptionsMenuList(void)
477 //create option list anchor
478 if (__pMoreOptionsListAnchor == null)
480 Bitmap* pBgPopupArwBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_ARROW_ICON, W_OPTION_ANCHOR,
482 __pMoreOptionsListAnchor = new (std::nothrow) Label();
483 __pMoreOptionsListAnchor->Construct(Rectangle(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_ICON, Y_POPUP_ANCHOR, W_POPUP_ANCHOR, H_POPUP_ANCHOR), L"");
484 __pMoreOptionsListAnchor->SetBackgroundBitmap(*pBgPopupArwBmp);
486 delete pBgPopupArwBmp;
487 pBgPopupArwBmp = null;
489 // Adds a Label to the Form
490 AddControl(__pMoreOptionsListAnchor);
493 //create options menu list
494 if (__pMoreOptionsList == null)
496 __pMoreOptionsList = new (std::nothrow) ListView();
497 __pMoreOptionsList->Construct(Rectangle(Point(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_LABEL,H_MORE_LABEL), IDI_OPTIONMENU_DIMEN), false, SCROLL_STYLE_FADE_OUT);
498 __pMoreOptionsList->SetItemProvider(*this);
499 __pMoreOptionsList->AddListViewItemEventListener(*this);
500 //Add option list to the form
501 AddControl(__pMoreOptionsList);
505 //Hide option menu list
506 DestroyMoreOptionsMenuList();
511 ActiveCallForm::DestroyMoreOptionsMenuList(void)
513 if (__pMoreOptionsListAnchor != null)
515 //removes and delete the child control
516 RemoveControl(__pMoreOptionsListAnchor);
517 __pMoreOptionsListAnchor = null;
520 if (__pMoreOptionsList != null)
522 //removes and delete the child control
523 RemoveControl(__pMoreOptionsList);
524 __pMoreOptionsList = null;
529 ActiveCallForm::OnTerminating(void)
531 result r = E_SUCCESS;
532 if (__pCallPresentor != null)
534 __pCallPresentor = null;
536 if(__pDTMFKeypad != null)
538 __pDTMFKeypad = null;
544 ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
552 //End the currently active / dialing call
553 if (__pActiveCallInfo->IsConferenceCall() == false)
555 String activeContactNo;
556 activeContactNo.Append(__pActiveCallInfo->GetContactNumber());
557 //Check if it is call is in dialing state, then
558 if (__formType == FORMTYPE_EMERGENCYOUTGOINGCALL || __formType == FORMTYPE_OUTGOINGCALL)
560 __pCallPresentor->EndDialingCall(activeContactNo);
565 __pCallPresentor->EndActiveCall(*__pActiveCallInfo->GetCallHandle());
570 __pCallPresentor->EndConferenceCall();
575 case IDA_END_CONF_CALL:
577 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
578 __pCallPresentor->EndConferenceCall();
582 case IDA_OPEN_NUMKEYPAD:
584 if(__pDTMFKeypad != null)
586 Rectangle rect(0, 0, 0, 0);
587 if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
589 rect.height = GetClientAreaBounds().height;
590 rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth();
592 else if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
594 rect.width = GetClientAreaBounds().width;
595 rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight();
597 __pDTMFKeypad->SetBounds(rect);
598 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
599 if (pRelativeLayout != null)
601 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
602 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
603 pRelativeLayout->Update();
604 delete pRelativeLayout;
606 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
607 if (pRelativeLayout != null)
609 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
610 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_BOTTOM_TO_TOP);
611 pRelativeLayout->Update();
612 delete pRelativeLayout;
614 __pDTMFKeypad->setKeysPanelBounds();
615 __pDTMFKeypad->InvalidateBounds(rect);
616 __pDTMFKeypad->Invalidate(true);
622 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
624 //hide only in portrait mode.
625 SetShowStateOnKeypad(false);
626 DestroyMoreOptionsMenuList();
628 if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
630 SetShowStateOnKeypadLandscape(false);
633 //Hide the hold button as it goes behind DTMF keypad
634 SetHoldButtonShowState(false);
636 __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
640 case IDA_CLOSE_NUMKEYPAD:
642 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
644 SetShowStateOnKeypad(true);
646 if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
648 SetShowStateOnKeypadLandscape(true);
651 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
657 //switch to Dialer Form to make an call
658 if(__pCallPresentor->GetCurrentCallCount() == 1)
660 __pCallPresentor->LaunchDialAppControl();
668 if (__pActiveCallInfo->IsConferenceCall() == false)
670 if(__pActiveCallInfo->GetCallHandle() != null)
672 success = __pCallPresentor->HoldCall(*__pActiveCallInfo->GetCallHandle());
677 success = __pCallPresentor->HoldConferenceCall();
679 //reset hold status and "OnHold" text
680 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
681 if(__pActiveCallTimer != null)
683 __pActiveCallTimer->Cancel();
685 SetHoldButtonStatus(!success);
689 case IDA_UNHOLD_CALL:
691 bool success = false;
692 if (__pActiveCallInfo->IsConferenceCall() == false)
694 if(__pActiveCallInfo->GetCallHandle() != null)
696 success = __pCallPresentor->UnHoldCall(*__pActiveCallInfo->GetCallHandle());
701 success = __pCallPresentor->ActivateConferenceCall();
703 //reset hold status and show call timer
704 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
705 SetHoldButtonStatus(success);
709 case IDA_HOLD_CONF_CALL:
711 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
712 bool success = __pCallPresentor->HoldConferenceCall();
713 //reset hold status and "OnHold" text
714 SetHoldButtonStatus(!success);
715 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
716 if(__pActiveCallTimer != null)
718 __pActiveCallTimer->Cancel();
723 case IDA_UNHOLD_CONF_CALL:
725 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
726 bool success = __pCallPresentor->ActivateConferenceCall();
727 //reset hold status and show call timer
728 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
729 SetHoldButtonStatus(success);
733 case IDA_OPEN_CONTACTS:
736 //Launch call application
737 AppManager* pAppManager = AppManager::GetInstance();
738 pAppManager->LaunchApplication(PROVIDER_ID_CONTACTS);
744 bool success = __pCallPresentor->SetMuteStatus(true);
747 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
754 bool success = __pCallPresentor->SetMuteStatus(false);
757 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
764 bool success = __pCallPresentor->SetSpeakerStatus(true);
767 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
772 case IDA_SPEAKER_OFF:
774 bool success = __pCallPresentor->SetSpeakerStatus(false);
777 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
784 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
785 __pCallPresentor->JoinCall();
791 if(IsSwapInProgress() == false)
793 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
794 __pCallPresentor->SwapCalls();
795 SetSwapInProgress(true);
800 case IDA_MORE_OPTIONS_MENU:
802 //Show 'more' options menu
803 CreateMoreOptionsMenuList();
809 dtmfString.Append(L"0");
810 SetTextToDTMFTextField(dtmfString);
811 __pCallPresentor->SendDTMFSignal(dtmfString);
817 dtmfString.Append(L"1");
818 SetTextToDTMFTextField(dtmfString);
819 __pCallPresentor->SendDTMFSignal(dtmfString);
825 dtmfString.Append(L"2");
826 SetTextToDTMFTextField(dtmfString);
827 __pCallPresentor->SendDTMFSignal(dtmfString);
833 dtmfString.Append(L"3");
834 SetTextToDTMFTextField(dtmfString);
835 __pCallPresentor->SendDTMFSignal(dtmfString);
841 dtmfString.Append(L"4");
842 SetTextToDTMFTextField(dtmfString);
843 __pCallPresentor->SendDTMFSignal(dtmfString);
849 dtmfString.Append(L"5");
850 SetTextToDTMFTextField(dtmfString);
851 __pCallPresentor->SendDTMFSignal(dtmfString);
857 dtmfString.Append(L"6");
858 SetTextToDTMFTextField(dtmfString);
859 __pCallPresentor->SendDTMFSignal(dtmfString);
865 dtmfString.Append(L"7");
866 SetTextToDTMFTextField(dtmfString);
867 __pCallPresentor->SendDTMFSignal(dtmfString);
873 dtmfString.Append(L"8");
874 SetTextToDTMFTextField(dtmfString);
875 __pCallPresentor->SendDTMFSignal(dtmfString);
881 dtmfString.Append(L"9");
882 SetTextToDTMFTextField(dtmfString);
883 __pCallPresentor->SendDTMFSignal(dtmfString);
889 dtmfString.Append(L"*");
890 SetTextToDTMFTextField(dtmfString);
891 __pCallPresentor->SendDTMFSignal(dtmfString);
897 dtmfString.Append(L"#");
898 SetTextToDTMFTextField(dtmfString);
899 __pCallPresentor->SendDTMFSignal(dtmfString);
909 ActiveCallForm::IsSwapInProgress(void)
911 return __isSwapInProgress;
915 ActiveCallForm::SetSwapInProgress(bool progress)
917 __isSwapInProgress = progress;
921 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
923 if(__pDTMFKeypad != null)
925 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
927 int startpos=-1,endpos=-1;
928 pTextBox->GetBlockRange(startpos,endpos);
932 pTextBox->ReleaseBlock();
935 pTextBox->InsertTextAtCursorPosition(dtmfStr);
936 //pTextBox->AppendText(dtmfStr);
937 // pTextBox->SetFocus();
938 pTextBox->Invalidate(true);
943 ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
946 //set itself as listener
947 __pCallPresentor->SetTelEventListener(this);
948 AddOrientationEventListener(*this);
950 CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
951 pPhoneApp->AddAppStateChangeListener(*this);
953 //Initialize keypad and buttons
954 InitializeCallButtonsPanel();
956 if(__pDTMFKeypad == null)
958 Rectangle rect(0, 0, 0, 0);
959 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
961 rect.width = GetClientAreaBounds().width;
962 rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight();
964 else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
966 rect.height = GetClientAreaBounds().height;
967 rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth();
970 AppLog("DTMF Keypad rect(%d,%d,%d,%d)",rect.x,rect.y,rect.width,rect.height);
971 __pDTMFKeypad = new (std::nothrow) DtmfKeyPadPanel();
972 __pDTMFKeypad->Initialize(this, rect);
973 //set layout relation w.r.t call buttons panel
974 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
975 if (pRelativeLayout != null)
977 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
978 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
980 AddControl(__pDTMFKeypad);
983 AddressbookManager* pAddressbookManager = AddressbookManager::GetInstance();
984 __pAddressbook = pAddressbookManager->GetAddressbookN(DEFAULT_ADDRESSBOOK_ID);
985 if(__pAddressbook != null)
987 __pAddressbook->SetAddressbookChangeEventListener(this);
991 if (__pActiveCallInfo != null)
993 delete __pActiveCallInfo;
994 __pActiveCallInfo = null;
996 if (__pHeldCallInfo != null)
998 delete __pHeldCallInfo;
999 __pHeldCallInfo = null;
1001 DestroyMoreOptionsMenuList();
1005 case FORMTYPE_OUTGOINGCALL:
1008 contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
1009 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1010 __pActiveCallInfo->SetContactNumber(contactNo);
1011 Contact* pContact = __pCallPresentor->GetContactN(contactNo);
1012 if (pContact != null)
1014 __pActiveCallInfo->SetContactInfo(*pContact);
1017 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1018 //make an normal outgoing call
1019 __pCallPresentor->DialCall(contactNo, false);
1023 case FORMTYPE_EMERGENCYOUTGOINGCALL:
1025 String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
1026 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1027 long long phNumber = 0;
1028 LongLong::Parse(*pContactNo, phNumber);
1029 __pActiveCallInfo->SetContactNumber(*pContactNo);
1030 //make an emergency call
1031 __pCallPresentor->DialCall(*pContactNo, true);
1035 case FORMTYPE_ACTIVECALL:
1037 //get contact number
1038 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
1040 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1041 *__pActiveCallInfo = *pCall;
1042 String activeContactNo;
1043 if(pCall->GetContactNumber().IsEmpty() == false)
1045 activeContactNo.Append(pCall->GetContactNumber());
1049 activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1051 ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1052 //show call active time using Timer
1053 //__activeCallStartTime = pCall->GetCallConnectTime();
1054 __activeCallStartTime = pCall->GetDurationTime();
1055 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
1059 case FORMTYPE_EMERGENCYACTIVECALL:
1061 //get contact number
1062 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
1064 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1065 *__pActiveCallInfo = *pCall;
1067 //show call active time using Timer
1068 //__activeCallStartTime = pCall->GetCallConnectTime();
1069 __activeCallStartTime = pCall->GetDurationTime();
1070 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
1074 case FORMTYPE_MULTIPLECALLS:
1076 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
1077 //update calls state
1078 UpdateMultipleCallScreen(*pCallsList);
1084 case FORMTYPE_ACTIVECONFCALL:
1087 AppCallInfo* pConfInfo = static_cast<AppCallInfo*>(pArgs->GetAt(0));
1088 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1089 *__pActiveCallInfo = *pConfInfo;
1091 int participantsCount = __pActiveCallInfo->GetCallerListCount();
1093 // show participant count on name Label
1094 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1095 if (pPeopleCountLbl)
1098 count.Append(participantsCount);
1100 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1101 pPeopleCountLbl->SetText(count);
1104 if(participantsCount >= IDI_MAX_CONF_CALL_PARTICIPANTS)
1106 __pCallButtonsPanel->EnableAddCallButton(false);
1110 __pCallButtonsPanel->EnableAddCallButton(true);
1114 //bring button on top
1115 __pCallButtonsPanel->SetButtonPosition();
1118 //show call active time using Timer
1119 //__activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1120 __activeCallStartTime = __pActiveCallInfo->GetDurationTime();
1121 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime);
1129 if(__formType == FORMTYPE_ACTIVECALL || __formType == FORMTYPE_EMERGENCYACTIVECALL ||
1130 __formType == FORMTYPE_MULTIPLECALLS || __formType == FORMTYPE_ACTIVECONFCALL)
1132 //Unlock the phone if its locked
1133 if(LockManager::GetInstance()->IsLocked())
1135 AppLogDebug("Phone Locked");
1136 LockManager::GetInstance()->Unlock();
1140 //Hide DTMFKeypad, if visible and show caller info
1142 SetShowStateOnKeypad(true);
1143 SetShowStateOnKeypadLandscape(true);
1144 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
1146 //Set the correct speaker status
1147 if(__pCallPresentor->IsSpeakerOn() == true)
1149 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
1153 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
1156 //Set the correct Mute status
1157 if (__pCallPresentor->IsCallMuted() == true)
1159 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
1163 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
1173 //update position of call buttons panel
1174 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
1175 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
1177 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1178 pCallApp->SetTopMostWindow(false);
1182 ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1184 RemoveOrientationEventListener(*this);
1185 if (__pActiveCallTimer != null)
1187 __pActiveCallTimer->Cancel();
1188 delete __pActiveCallTimer;
1189 __pActiveCallTimer = null;
1191 if (__pSmallPhotoLabel != null)
1193 __pSmallPhotoLabel->SetShowState(false);
1195 //Hide "Manage conf. Call" Context menu
1196 if (__pMoreOptionsListAnchor != null)
1198 __pMoreOptionsListAnchor->SetShowState(false);
1200 if (__pMoreOptionsList != null)
1202 __pMoreOptionsList->SetShowState(false);
1204 __DtmfString.Clear();
1206 if(__pDTMFKeypad != null)
1208 __pDTMFKeypad->SetShowState(false);
1211 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1212 pCallApp->RemoveAppStateChangeListener(*this);
1213 if(__pAddressbook != null)
1215 __pAddressbook->SetAddressbookChangeEventListener(null);
1220 ActiveCallForm::HandleConfCallChanged(void)
1223 AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
1224 //fetch changed conference call info
1225 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1226 if (pConfCallInfo == null)
1232 //fetch participant count in conf call
1233 int participantsCount = pConfCallInfo->GetCallerListCount();
1234 //update status of join and Add call
1235 bool isEnableAddCall = false;
1236 bool isEnableJoinCall = false;
1237 if(participantsCount < IDI_MAX_CONF_CALL_PARTICIPANTS)
1239 //available only at Active conf. call or active call screen
1240 isEnableAddCall = true;
1241 //join button is available only at multiple call screen
1242 isEnableJoinCall = true;
1245 Label* pPeopleCountLbl = null;
1246 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == true)
1248 //Active call is conference call
1249 delete __pActiveCallInfo;
1250 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1251 *__pActiveCallInfo = *pConfCallInfo;
1253 if (__formType == FORMTYPE_MULTIPLECALLS)
1255 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1257 else if (__formType == FORMTYPE_ACTIVECONFCALL)
1259 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1260 AppLog("Active conf call...(%d)", pPeopleCountLbl);
1263 else if(__pHeldCallInfo != null && __pHeldCallInfo->IsConferenceCall() == true)
1265 //Held call is conference call - this is definitely multiple call screen.
1266 delete __pHeldCallInfo;
1267 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1268 *__pHeldCallInfo = *pConfCallInfo;
1269 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1272 // update participant count on name Label
1273 if (pPeopleCountLbl != null)
1276 count.Append(participantsCount);
1278 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1279 pPeopleCountLbl->SetText(count);
1280 pPeopleCountLbl->Invalidate(true);
1282 //change AddCall Button status
1283 __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
1284 //change JoinCall Button status
1285 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1290 ActiveCallForm::OnContactsChanged(const Tizen::Base::Collection::IList& contactChangeInfoList)
1296 case FORMTYPE_OUTGOINGCALL:
1297 case FORMTYPE_ACTIVECALL:
1299 String pContactNumber;
1300 pContactNumber.Append(__pActiveCallInfo->GetContactNumber());
1301 Contact* pContact = __pCallPresentor->GetContactN(__pActiveCallInfo->GetContactNumber());
1302 if(pContact == null)
1304 __pActiveCallInfo->ResetContactNumber(null);
1305 __pActiveCallInfo->ResetContactInfo(null);
1310 __pActiveCallInfo->SetContactNumber(pContactNumber);
1311 __pActiveCallInfo->SetContactInfo(*pContact);
1313 if(pContact != null)
1318 ShowPersonDetails(pContactNumber, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1322 case FORMTYPE_EMERGENCYACTIVECALL:
1327 case FORMTYPE_MULTIPLECALLS:
1330 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
1331 if(pCallsList != null)
1333 int listCount = pCallsList->GetCount();
1334 for(int index = 0; index < listCount; index++)
1336 AppCallInfo callInfo;
1338 pCallsList->GetAt(index, callInfo);
1339 if(__pActiveCallInfo == null)
1341 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1343 *__pActiveCallInfo = callInfo;
1344 String contactNumber;
1345 contactNumber.Append(__pActiveCallInfo->GetContactNumber());
1346 pContact = __pCallPresentor->GetContactN(__pActiveCallInfo->GetContactNumber());
1347 if(pContact == null)
1349 __pActiveCallInfo->ResetContactNumber(null);
1350 __pActiveCallInfo->ResetContactInfo(null);
1355 __pActiveCallInfo->SetContactNumber(contactNumber);
1356 __pActiveCallInfo->SetContactInfo(*pContact);
1358 if(pContact != null)
1363 if(callInfo.IsConferenceCall() == true)
1367 if(callInfo.IsOnHold() == false)
1369 ShowPersonDetails(contactNumber, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1373 ShowPersonDetails(contactNumber, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pActiveCallInfo);
1390 ActiveCallForm::OnCategoriesChanged(const Tizen::Base::Collection::IList& categoryChangeInfoList)
1397 ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
1400 if(__pActiveCallInfo != null)
1402 delete __pActiveCallInfo;
1403 __pActiveCallInfo = null;
1405 if(__pHeldCallInfo != null)
1407 delete __pHeldCallInfo;
1408 __pHeldCallInfo = null;
1411 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1412 if (pMoreBtn != null)
1414 pMoreBtn->SetShowState(false);
1417 //show caller's info.
1418 for (int index = 0; index < activeCallsList.GetCount(); index++)
1421 AppCallInfo callInfo;
1422 activeCallsList.GetAt(index, callInfo);
1425 if(callInfo.GetContactNumber().IsEmpty() == false)
1427 contactNo.Append(callInfo.GetContactNumber());
1431 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1434 if (callInfo.IsOnHold() == false)
1436 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1437 *__pActiveCallInfo = callInfo;
1439 if (__pActiveCallInfo->IsConferenceCall() == false)
1441 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1444 pVoiceIconLbl->SetShowState(true);
1446 if (pMoreBtn != null)
1448 pMoreBtn->SetShowState(false);
1450 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1451 if(__pMoreOptionsListAnchor != null && __pMoreOptionsListAnchor->GetShowState() == true)
1453 CreateMoreOptionsMenuList();
1458 // show participant count on name Label
1459 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1460 if (pPeopleCountLbl)
1463 count.Append(__pActiveCallInfo->GetCallerListCount());
1465 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1466 pPeopleCountLbl->SetText(count);
1468 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1469 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1472 pNameLbl->SetText(nameStr);
1474 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1477 pVoiceIconLbl->SetShowState(false);
1479 if (pMoreBtn != null)
1481 pMoreBtn->SetShowState(true);
1483 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1484 if (pPhotoBitmap != null)
1486 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER1_PHOTO_LABEL));
1489 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1490 pPhotoLbl->Invalidate(true);
1492 delete pPhotoBitmap;
1495 //show call active time using Timer
1496 //__activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1497 __activeCallStartTime = __pActiveCallInfo->GetDurationTime();
1498 ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime);
1502 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1503 *__pHeldCallInfo = callInfo;
1505 if (__pHeldCallInfo->IsConferenceCall() == false)
1507 ShowPersonDetails(contactNo, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pHeldCallInfo);
1511 // show participant count on name Label
1512 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1513 if (pPeopleCountLbl)
1516 count.Append(__pHeldCallInfo->GetCallerListCount());
1518 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1519 pPeopleCountLbl->SetText(count);
1521 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1522 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1525 pNameLbl->SetText(nameStr);
1527 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1528 if (pPhotoBitmap != null)
1530 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER2_PHOTO_LABEL));
1533 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1534 pPhotoLbl->Invalidate(true);
1536 delete pPhotoBitmap;
1540 ShowTimerInfo(IDC_CALLER2_TIME_LABEL, true);
1544 //update JoinCall button status
1545 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1551 ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
1553 result r = E_FAILURE;
1555 //call individual methods to show contact number, caller name & photo
1556 ShowPhoneNumber(phoneNumber, contactLblName);
1558 //fetch contact details based on phone number
1559 String* pDisplayName = pCallInfo->FetchLatestCallerNameN(phoneNumber);
1560 ShowCallerName(*pDisplayName, nameLblName);
1562 Bitmap* pPhotoBitmap = pCallInfo->FetchLatestCallerPhotoN(phoneNumber);
1563 ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
1568 delete pDisplayName;
1569 pDisplayName = null;
1573 delete pPhotoBitmap;
1574 pPhotoBitmap = null;
1579 ActiveCallForm::ShowPhoneNumber(const String& phoneNumber, const String& contactLblName)
1581 String formattedNumber = phoneNumber;
1583 Label* pContactLbl = static_cast<Label*>(GetControl(contactLblName));
1586 pContactLbl->SetText(formattedNumber);
1587 pContactLbl->Invalidate(true);
1592 ActiveCallForm::ShowCallerName(const String& callerName, const String& nameLblName)
1594 // show display name on name Label
1595 Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
1598 //passing an empty string to SetText fails in label,
1599 //if previously valid text has been set
1600 if (callerName.IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
1602 String stringToBeSet(L" ");
1603 pNameLbl->SetText(stringToBeSet);
1607 pNameLbl->SetText(callerName);
1609 pNameLbl->Invalidate(true);
1614 ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
1616 //to check if default image is to be shown
1617 bool showDefaultPhoto = false;
1618 bool showSmallPhoto = false;
1619 String photoLabel("");
1623 case FORMTYPE_OUTGOINGCALL:
1624 case FORMTYPE_ACTIVECALL:
1626 if (pPhotoId == null)
1628 //show default caller image
1629 showDefaultPhoto = true;
1633 //Check the size of photo
1634 // Now checking the condition with && but actually it should be ||
1635 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1636 // height 270 and width = 480 . So all images set thru gallery is show as small image
1637 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1638 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1640 showSmallPhoto = true;
1644 photoLabel.Append(IDC_CALLER1_BIGPHOTO_LABEL);
1648 case FORMTYPE_MULTIPLECALLS:
1652 photoLabel.Append(IDC_CALLER2_PHOTO_LABEL);
1656 photoLabel.Append(IDC_CALLER1_PHOTO_LABEL);
1659 if (pPhotoId == null)
1661 showDefaultPhoto = true;
1665 if (pPhotoId->GetHeight() <= H_SMALL_PHOTO
1666 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1668 //pPhotoId->Scale(Dimension(W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO));
1669 showSmallPhoto = true;
1679 //Remove small photo label
1680 if (__pSmallPhotoLabel != null)
1682 RemoveControl(__pSmallPhotoLabel);
1683 __pSmallPhotoLabel = null;
1686 //show photo - for Big Photo Id, Animated Call Image
1687 if (!showDefaultPhoto)
1689 if(showSmallPhoto == true)
1691 ShowThumbnailImage(pPhotoId,photoLabel);
1695 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1698 Canvas* pCanvas = new (std::nothrow) Canvas;
1699 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1700 pCanvas->Construct(canvasRect);
1701 //draw the contact bitmap
1702 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1703 Bitmap* pNewPhotoId = new Bitmap();
1704 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1707 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1708 pPhotoLbl->Invalidate(true);
1715 Bitmap* pDefaultPhoto = null;
1718 case FORMTYPE_OUTGOINGCALL:
1719 case FORMTYPE_ACTIVECALL:
1720 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1723 case FORMTYPE_MULTIPLECALLS:
1724 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_MULTIPLE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1727 case FORMTYPE_ACTIVECONFCALL:
1728 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BIG_BG_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1734 if (pDefaultPhoto != null)
1736 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1739 pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
1740 pPhotoLbl->Invalidate(true);
1742 delete pDefaultPhoto;
1748 ActiveCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,String& photoLabel)
1750 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1752 if (pPhotoLbl != null && pPhotoId != null)
1754 Canvas* pCanvas = new (std::nothrow) Canvas;
1755 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1756 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1757 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1758 pCanvas->Construct(canvasRect);
1759 //draw the back ground
1760 pCanvas->DrawBitmap(canvasRect,*pBackground);
1761 //draw shadow (to be enabled after correct shadow image is provided )
1762 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1763 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1764 //draw the contact bitmap
1765 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1766 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1767 Bitmap* pNewPhotoId = new Bitmap();
1768 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1771 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1772 pPhotoLbl->Invalidate(true);
1781 ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1783 if (__pSmallPhotoLabel != null)
1785 RemoveControl(__pSmallPhotoLabel);
1786 __pSmallPhotoLabel = null;
1788 //Draw Small Photo and show on small photo label
1789 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1790 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1791 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1792 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1793 // Add a Label to the Form
1794 AddControl(__pSmallPhotoLabel);
1795 __pSmallPhotoLabel->Invalidate(true);
1799 ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long long startTime)
1801 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1803 if (__pActiveCallTimer == null)
1805 __pActiveCallTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
1806 __pActiveCallTimer->Construct(*this);
1809 if (pTimerLbl != null)
1811 if (isOnHold == true)
1813 pTimerLbl->SetText(AppUtility::GetResourceString(IDS_TIMER_ON_HOLD));
1814 //update Hold button status
1815 SetHoldButtonStatus(false);
1819 //update Hold button status
1820 SetHoldButtonStatus(true);
1821 //current system time
1822 long long currTime = 0;
1823 //SystemTime::GetTicks(currTime);
1824 CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
1825 currTime = pPhoneApp->GetCallAppTicks();
1827 TimeSpan diffSpan(abs(startTime - currTime));
1829 String activeCallTime(L"");
1831 long long hr = diffSpan.GetHours();
1834 activeCallTime.Append("0");
1836 activeCallTime.Append(hr);
1837 activeCallTime.Append(L":");
1839 long long min = diffSpan.GetMinutes();
1842 activeCallTime.Append("0");
1844 activeCallTime.Append(min);
1845 activeCallTime.Append(L":");
1847 long long sec = diffSpan.GetSeconds();
1850 activeCallTime.Append("0");
1852 activeCallTime.Append(sec);
1854 pTimerLbl->SetText(activeCallTime);
1855 __pActiveCallTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
1857 pTimerLbl->Invalidate(true);
1862 ActiveCallForm::SetHoldButtonShowState(bool showState)
1864 Label* pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1865 if(pLblControl != null)
1867 pLblControl->SetShowState(showState);
1869 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1870 if(pButtonControl != null)
1872 pButtonControl->SetShowState(showState);
1877 ActiveCallForm::SetShowStateOnKeypadLandscape(bool showState)
1881 case FORMTYPE_ACTIVECONFCALL:
1882 case FORMTYPE_ACTIVECALL:
1884 SetHoldButtonShowState(showState);
1888 case FORMTYPE_MULTIPLECALLS:
1890 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1891 pLblControl->SetShowState(showState);
1892 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1893 pLblControl->SetShowState(showState);
1894 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1895 pLblControl->SetShowState(showState);
1896 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1897 pLblControl->SetShowState(showState);
1898 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1899 pLblControl->SetShowState(showState);
1900 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1901 pButtonControl->SetShowState(showState);
1911 ActiveCallForm::SetShowStateOnKeypad(bool showState)
1913 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1914 pLblControl->SetShowState(showState);
1915 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL));
1916 pLblControl->SetShowState(showState);
1917 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1918 pLblControl->SetShowState(showState);
1919 if (__pSmallPhotoLabel != null)
1921 __pSmallPhotoLabel->SetShowState(showState);
1926 case FORMTYPE_ACTIVECALL:
1928 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1929 pLblControl->SetShowState(showState);
1930 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1931 pLblControl->SetShowState(showState);
1932 SetHoldButtonShowState(showState);
1936 case FORMTYPE_MULTIPLECALLS:
1938 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1939 pLblControl->SetShowState(showState);
1940 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1941 pLblControl->SetShowState(showState);
1942 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1943 pLblControl->SetShowState(showState);
1944 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1945 pLblControl->SetShowState(showState);
1946 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1947 pLblControl->SetShowState(showState);
1948 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1949 pLblControl->SetShowState(showState);
1950 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == false)
1952 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1953 pLblControl->SetShowState(showState);
1957 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1958 pButtonControl->SetShowState(showState);
1960 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1961 pButtonControl->SetShowState(showState);
1965 case FORMTYPE_ACTIVECONFCALL:
1967 pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1968 pLblControl->SetShowState(showState);
1969 SetHoldButtonShowState(showState);
1970 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1971 pButtonControl->SetShowState(showState);
1981 ActiveCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1983 //Call default implementation of "Object.Equals()"
1984 //returns true, if they are pointing to same address.
1985 if (__pActiveCallTimer->Equals(timer))
1987 Label* pTimerLbl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1990 String activeCallTime = pTimerLbl->GetText();
1991 // Create a StringTokenizer instance
1992 StringTokenizer strTokens(activeCallTime, L":");
1994 int count = strTokens.GetTokenCount(); // count == 3
1999 for (int index = 0; index < count; index++)
2004 strTokens.GetNextToken(token);
2005 Integer::Parse(token, hr);
2009 strTokens.GetNextToken(token);
2010 Integer::Parse(token, min);
2014 strTokens.GetNextToken(token);
2015 Integer::Parse(token, sec);
2021 if (sec == IDI_MAX_SECONDS)
2026 if (min == IDI_MAX_MINS)
2033 activeCallTime.Clear();
2036 activeCallTime.Append("0");
2038 activeCallTime.Append(hr);
2039 activeCallTime.Append(":");
2042 activeCallTime.Append("0");
2044 activeCallTime.Append(min);
2045 activeCallTime.Append(":");
2048 activeCallTime.Append("0");
2050 activeCallTime.Append(sec);
2051 //update timer label
2052 pTimerLbl->SetText(activeCallTime);
2053 pTimerLbl->Invalidate(true);
2058 ///////////////////////////////////////////////////////////
2059 /////////// Options Menu List Functionality /////////
2060 ///////////////////////////////////////////////////////////
2062 ActiveCallForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
2067 ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
2069 //Goto conference call list form
2070 SceneManager* pSceneManager = SceneManager::GetInstance();
2071 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
2072 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_KEEP), null);
2076 ActiveCallForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
2081 ActiveCallForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
2086 ActiveCallForm::GetItemCount(void)
2088 return IDI_MOREOPTIONS_LIST_ITEMS;
2092 ActiveCallForm::CreateItem(int index, int itemWidth)
2094 //create 1st Menu option
2095 CustomItem* pItem = new (std::nothrow) CustomItem();
2096 pItem->Construct(IDI_OPTIONMENU_DIMEN, LIST_ANNEX_STYLE_NORMAL);
2098 //Set background 9-patch bitmap to option menu
2099 Bitmap* pBgBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_BG_ICON);
2100 if (pBgBmp != null && pBgBmp->IsNinePatchedBitmap())
2103 bgCanvas.Construct(Rectangle(IDI_OPTIONMENU_POS, IDI_OPTIONMENU_DIMEN));
2104 bgCanvas.DrawNinePatchedBitmap(bgCanvas.GetBounds(), *pBgBmp);
2108 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color(40, 45, 48));
2113 //Set bitmap to option menu
2114 Bitmap* pNormalConfCallBmp = AppUtility::GetBitmapFromResourcesN(IDB_MORE_MANAGE_CONFERENCE_ICON ,
2115 W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP);
2116 pItem->AddElement(Rectangle(16, 17, W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP), 1, *pNormalConfCallBmp, null, null);
2117 // Deallocate bitmaps
2118 delete pNormalConfCallBmp;
2119 pNormalConfCallBmp = null;
2121 //Set text to menu option
2122 String confCallName = AppUtility::GetResourceString(IDS_MGR_CONF_CALL_LIST_STR);
2124 TextElement* pTextElement = new (std::nothrow) TextElement();
2125 pTextElement->Construct(confCallName);
2126 pTextElement->SetTextColor(COLOR_POPUP_TEXT);
2129 font.Construct(FONT_STYLE_PLAIN, IDI_POPUP_TEXT_SIZE);
2130 pTextElement->SetFont(font);
2131 //construct Enriched text
2132 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
2133 FloatDimension textDimension;
2134 font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
2135 textDimension.height = textDimension.height + font.GetDescender();
2136 pEnrichedText->Construct(textDimension);
2137 //add text element to enriched text
2138 pEnrichedText->Add(*pTextElement);
2140 //Add Enriched text to pItem
2141 FloatPoint textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
2142 pItem->AddElement(FloatRectangle(textPos, textDimension), 2, *pEnrichedText);
2144 pEnrichedText->RemoveAll(true);
2145 delete pEnrichedText;
2150 ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
2157 ActiveCallForm::OnForeground(void)
2159 AppLogDebug("Enter");
2160 __pCallPresentor->OnAppForeground();