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 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
203 __pDTMFKeypad->SetShowState(true);
204 __pDTMFKeypad->Draw(true);
205 __pDTMFKeypad->Show();
206 pTextBox->SetFocus();
210 ActiveCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
214 if (__pCallButtonsPanel != null)
216 //update position of call buttons panel
217 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
218 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
220 //bring button on top
221 __pCallButtonsPanel->SetButtonPosition();
223 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
224 if (pRelativeLayout != null)
226 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
229 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
230 if (pRelativeLayout != null)
232 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
233 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
236 //change orientation of DTMF Keypad, if it is visible.
237 if(__pDTMFKeypad != null)
239 Rectangle rect(0, 0, 0, 0);
240 if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
242 rect.height = GetClientAreaBounds().height;
243 rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth();
245 else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
247 rect.width = GetClientAreaBounds().width;
248 rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight();
250 __pDTMFKeypad->SetBounds(rect);
251 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
252 if (pRelativeLayout != null)
254 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
255 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
256 pRelativeLayout->Update();
257 delete pRelativeLayout;
259 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
260 if (pRelativeLayout != null)
262 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
263 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_BOTTOM_TO_TOP);
264 pRelativeLayout->Update();
265 delete pRelativeLayout;
267 __pDTMFKeypad->setKeysPanelBounds();
268 __pDTMFKeypad->InvalidateBounds(rect);
269 __pDTMFKeypad->Invalidate(true);
275 //change orientation of DTMF Keypad, if it is visible.
276 if (__pDTMFKeypad != null && __pDTMFKeypad->GetShowState() == true)
278 if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
280 //in landscape mode, caller info is visible.
281 SetShowStateOnKeypad(true);
282 //Hide few labels and buttons in landscape mode when DTMF keypad is shown
283 SetShowStateOnKeypadLandscape(false);
284 SetHoldButtonShowState(false);
286 else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
288 //in Portrait mode it is hidden beneath DTMF Keypad.
289 SetShowStateOnKeypad(false);
290 DestroyMoreOptionsMenuList();
294 //More option is displayed recreate it
295 if(__pMoreOptionsListAnchor != null)
297 CreateMoreOptionsMenuList();
298 CreateMoreOptionsMenuList();
303 ActiveCallForm::HideDTMFKeypad(void)
305 if(__pDTMFKeypad != null)
307 __DtmfString = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
308 __pDTMFKeypad->SetShowState(false);
313 ActiveCallForm::InitializeCallButtonsPanel(void)
315 result r = E_SUCCESS;
316 //Set background bitmap for call keypad
317 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
318 Bitmap* pBgBitmap = AppUtility::GetBitmapFromResourcesN(IDB_BACKGROUND_BITMAP, pKeysBgLbl->GetWidth(), pKeysBgLbl->GetHeight());
319 if (pBgBitmap != null)
321 pKeysBgLbl->SetBackgroundBitmap(*pBgBitmap);
324 if (__pCallButtonsPanel == null)
326 __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
327 __pCallButtonsPanel->ConstructPanel(this, __formType);
328 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
329 r = AddControl(__pCallButtonsPanel);
332 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
333 if (pRelativeLayout != null)
335 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
337 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
338 if (pRelativeLayout != null)
340 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
341 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
342 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
343 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_TOP_TO_TOP);
350 ActiveCallForm::InitializeSwapButton(void)
352 Button* pSwapBtn = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
355 Bitmap* pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_NORMAL,
356 W_HOLD_BITMAP, H_HOLD_BITMAP);
359 pSwapBtn->SetNormalBitmap(Point(0, 0), *pSwapBmp);
364 pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_PRESS,
365 W_HOLD_BITMAP, H_HOLD_BITMAP);
368 pSwapBtn->SetPressedBitmap(Point(0, 0), *pSwapBmp);
372 pSwapBtn->SetActionId(IDA_SWAP_CALLS);
373 pSwapBtn->AddActionEventListener(*this);
378 ActiveCallForm::InitializeManageConfCallButton(void)
380 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
381 if (pMoreBtn != null)
383 pMoreBtn->SetActionId(IDA_MORE_OPTIONS_MENU);
384 pMoreBtn->AddActionEventListener(*this);
385 if (__formType == FORMTYPE_MULTIPLECALLS)
387 //Correct state will be set in OnSceneActivated based on the call
388 pMoreBtn->SetShowState(false);
390 else if (__formType == FORMTYPE_ACTIVECONFCALL)
392 pMoreBtn->SetShowState(true);
398 ActiveCallForm::InitializeHoldButton(void)
400 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
401 if (pHoldBtn != null)
403 //set status of Hold Button
404 SetHoldButtonStatus(true);
405 pHoldBtn->AddActionEventListener(*this);
410 ActiveCallForm::SetHoldButtonStatus(bool toHoldCall)
412 //background bitmap & button name
414 Bitmap* normalImg = null;
415 Bitmap* pressImg = null;
418 btnName.Append(AppUtility::GetResourceString(IDS_HOLD_BTN_NAME));
419 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_NORMAL_BUTTON_ICON,
420 W_HOLD_BITMAP, H_HOLD_BITMAP);
421 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_PRESS_BUTTON_ICON,
422 W_HOLD_BITMAP, H_HOLD_BITMAP);
426 btnName.Append(AppUtility::GetResourceString(IDS_UNHOLD_BTN_NAME));
427 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_NORMAL_BUTTON_ICON,
428 W_HOLD_BITMAP, H_HOLD_BITMAP);
429 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_PRESS_BUTTON_ICON,
430 W_HOLD_BITMAP, H_HOLD_BITMAP);
434 CommandIds cmdId = IDA_HOLD_CALL;
437 case FORMTYPE_ACTIVECALL:
439 cmdId = toHoldCall ? IDA_HOLD_CALL : IDA_UNHOLD_CALL;
443 case FORMTYPE_ACTIVECONFCALL:
445 cmdId = toHoldCall ? IDA_HOLD_CONF_CALL : IDA_UNHOLD_CONF_CALL;
453 //set background bitmap, button name & action id
454 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
455 Label* pHoldLbl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
458 pHoldBtn->SetActionId(cmdId);
459 pHoldBtn->SetNormalBitmap(Point(0, 0),*normalImg);
460 pHoldBtn->SetPressedBitmap(Point(0, 0),*pressImg);
461 pHoldBtn->Invalidate(true);
465 pHoldLbl->SetText(btnName);
466 pHoldLbl->Invalidate(true);
477 ActiveCallForm::CreateMoreOptionsMenuList(void)
479 //create option list anchor
480 if (__pMoreOptionsListAnchor == null)
482 Bitmap* pBgPopupArwBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_ARROW_ICON, W_OPTION_ANCHOR,
484 __pMoreOptionsListAnchor = new (std::nothrow) Label();
485 __pMoreOptionsListAnchor->Construct(Rectangle(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_ICON, Y_POPUP_ANCHOR, W_POPUP_ANCHOR, H_POPUP_ANCHOR), L"");
486 __pMoreOptionsListAnchor->SetBackgroundBitmap(*pBgPopupArwBmp);
488 delete pBgPopupArwBmp;
489 pBgPopupArwBmp = null;
491 // Adds a Label to the Form
492 AddControl(__pMoreOptionsListAnchor);
495 //create options menu list
496 if (__pMoreOptionsList == null)
498 __pMoreOptionsList = new (std::nothrow) ListView();
499 __pMoreOptionsList->Construct(Rectangle(Point(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_LABEL,H_MORE_LABEL), IDI_OPTIONMENU_DIMEN), false, SCROLL_STYLE_FADE_OUT);
500 __pMoreOptionsList->SetItemProvider(*this);
501 __pMoreOptionsList->AddListViewItemEventListener(*this);
502 //Add option list to the form
503 AddControl(__pMoreOptionsList);
507 //Hide option menu list
508 DestroyMoreOptionsMenuList();
513 ActiveCallForm::DestroyMoreOptionsMenuList(void)
515 if (__pMoreOptionsListAnchor != null)
517 //removes and delete the child control
518 RemoveControl(__pMoreOptionsListAnchor);
519 __pMoreOptionsListAnchor = null;
522 if (__pMoreOptionsList != null)
524 //removes and delete the child control
525 RemoveControl(__pMoreOptionsList);
526 __pMoreOptionsList = null;
531 ActiveCallForm::OnTerminating(void)
533 result r = E_SUCCESS;
534 if (__pCallPresentor != null)
536 __pCallPresentor = null;
538 if(__pDTMFKeypad != null)
540 __pDTMFKeypad = null;
546 ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
554 //End the currently active / dialing call
555 if (__pActiveCallInfo->IsConferenceCall() == false)
557 String activeContactNo;
558 activeContactNo.Append(__pActiveCallInfo->GetContactNumber());
559 //Check if it is call is in dialing state, then
560 if (__formType == FORMTYPE_EMERGENCYOUTGOINGCALL || __formType == FORMTYPE_OUTGOINGCALL)
562 __pCallPresentor->EndDialingCall(activeContactNo);
567 __pCallPresentor->EndActiveCall(*__pActiveCallInfo->GetCallHandle());
572 __pCallPresentor->EndConferenceCall();
577 case IDA_END_CONF_CALL:
579 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
580 __pCallPresentor->EndConferenceCall();
584 case IDA_OPEN_NUMKEYPAD:
586 if(__pDTMFKeypad != null)
588 Rectangle rect(0, 0, 0, 0);
589 if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
591 rect.height = GetClientAreaBounds().height;
592 rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth();
594 else if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
596 rect.width = GetClientAreaBounds().width;
597 rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight();
599 __pDTMFKeypad->SetBounds(rect);
600 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
601 if (pRelativeLayout != null)
603 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
604 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
605 pRelativeLayout->Update();
606 delete pRelativeLayout;
608 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
609 if (pRelativeLayout != null)
611 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
612 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_BOTTOM_TO_TOP);
613 pRelativeLayout->Update();
614 delete pRelativeLayout;
616 __pDTMFKeypad->setKeysPanelBounds();
617 __pDTMFKeypad->InvalidateBounds(rect);
618 __pDTMFKeypad->Invalidate(true);
624 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
626 //hide only in portrait mode.
627 SetShowStateOnKeypad(false);
628 DestroyMoreOptionsMenuList();
630 if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
632 SetShowStateOnKeypadLandscape(false);
635 //Hide the hold button as it goes behind DTMF keypad
636 SetHoldButtonShowState(false);
638 __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
642 case IDA_CLOSE_NUMKEYPAD:
644 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
646 SetShowStateOnKeypad(true);
648 if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
650 SetShowStateOnKeypadLandscape(true);
653 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
659 //switch to Dialer Form to make an call
660 if(__pCallPresentor->GetCurrentCallCount() == 1)
662 __pCallPresentor->LaunchDialAppControl();
670 if (__pActiveCallInfo->IsConferenceCall() == false)
672 if(__pActiveCallInfo->GetCallHandle() != null)
674 success = __pCallPresentor->HoldCall(*__pActiveCallInfo->GetCallHandle());
679 success = __pCallPresentor->HoldConferenceCall();
681 //reset hold status and "OnHold" text
682 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
683 if(__pActiveCallTimer != null)
685 __pActiveCallTimer->Cancel();
687 SetHoldButtonStatus(!success);
691 case IDA_UNHOLD_CALL:
693 bool success = false;
694 if (__pActiveCallInfo->IsConferenceCall() == false)
696 if(__pActiveCallInfo->GetCallHandle() != null)
698 success = __pCallPresentor->UnHoldCall(*__pActiveCallInfo->GetCallHandle());
703 success = __pCallPresentor->ActivateConferenceCall();
705 //reset hold status and show call timer
706 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
707 SetHoldButtonStatus(success);
711 case IDA_HOLD_CONF_CALL:
713 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
714 bool success = __pCallPresentor->HoldConferenceCall();
715 //reset hold status and "OnHold" text
716 SetHoldButtonStatus(!success);
717 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
718 if(__pActiveCallTimer != null)
720 __pActiveCallTimer->Cancel();
725 case IDA_UNHOLD_CONF_CALL:
727 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
728 bool success = __pCallPresentor->ActivateConferenceCall();
729 //reset hold status and show call timer
730 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
731 SetHoldButtonStatus(success);
735 case IDA_OPEN_CONTACTS:
738 //Launch call application
739 AppManager* pAppManager = AppManager::GetInstance();
740 pAppManager->LaunchApplication(PROVIDER_ID_CONTACTS);
746 bool success = __pCallPresentor->SetMuteStatus(true);
749 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
756 bool success = __pCallPresentor->SetMuteStatus(false);
759 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
766 bool success = __pCallPresentor->SetSpeakerStatus(true);
769 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
774 case IDA_SPEAKER_OFF:
776 bool success = __pCallPresentor->SetSpeakerStatus(false);
779 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
786 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
787 __pCallPresentor->JoinCall();
793 if(IsSwapInProgress() == false)
795 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
796 __pCallPresentor->SwapCalls();
797 SetSwapInProgress(true);
802 case IDA_MORE_OPTIONS_MENU:
804 //Show 'more' options menu
805 CreateMoreOptionsMenuList();
811 dtmfString.Append(L"0");
812 SetTextToDTMFTextField(dtmfString);
813 __pCallPresentor->SendDTMFSignal(dtmfString);
819 dtmfString.Append(L"1");
820 SetTextToDTMFTextField(dtmfString);
821 __pCallPresentor->SendDTMFSignal(dtmfString);
827 dtmfString.Append(L"2");
828 SetTextToDTMFTextField(dtmfString);
829 __pCallPresentor->SendDTMFSignal(dtmfString);
835 dtmfString.Append(L"3");
836 SetTextToDTMFTextField(dtmfString);
837 __pCallPresentor->SendDTMFSignal(dtmfString);
843 dtmfString.Append(L"4");
844 SetTextToDTMFTextField(dtmfString);
845 __pCallPresentor->SendDTMFSignal(dtmfString);
851 dtmfString.Append(L"5");
852 SetTextToDTMFTextField(dtmfString);
853 __pCallPresentor->SendDTMFSignal(dtmfString);
859 dtmfString.Append(L"6");
860 SetTextToDTMFTextField(dtmfString);
861 __pCallPresentor->SendDTMFSignal(dtmfString);
867 dtmfString.Append(L"7");
868 SetTextToDTMFTextField(dtmfString);
869 __pCallPresentor->SendDTMFSignal(dtmfString);
875 dtmfString.Append(L"8");
876 SetTextToDTMFTextField(dtmfString);
877 __pCallPresentor->SendDTMFSignal(dtmfString);
883 dtmfString.Append(L"9");
884 SetTextToDTMFTextField(dtmfString);
885 __pCallPresentor->SendDTMFSignal(dtmfString);
891 dtmfString.Append(L"*");
892 SetTextToDTMFTextField(dtmfString);
893 __pCallPresentor->SendDTMFSignal(dtmfString);
899 dtmfString.Append(L"#");
900 SetTextToDTMFTextField(dtmfString);
901 __pCallPresentor->SendDTMFSignal(dtmfString);
911 ActiveCallForm::IsSwapInProgress(void)
913 return __isSwapInProgress;
917 ActiveCallForm::SetSwapInProgress(bool progress)
919 __isSwapInProgress = progress;
923 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
925 if(__pDTMFKeypad != null)
927 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
929 int startpos=-1,endpos=-1;
930 pTextBox->GetBlockRange(startpos,endpos);
934 pTextBox->ReleaseBlock();
937 pTextBox->InsertTextAtCursorPosition(dtmfStr);
938 //pTextBox->AppendText(dtmfStr);
939 // pTextBox->SetFocus();
940 pTextBox->Invalidate(true);
945 ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
948 //set itself as listener
949 __pCallPresentor->SetTelEventListener(this);
950 AddOrientationEventListener(*this);
952 CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
953 pPhoneApp->AddAppStateChangeListener(*this);
955 //Initialize keypad and buttons
956 InitializeCallButtonsPanel();
958 if(__pDTMFKeypad == null)
960 Rectangle rect(0, 0, 0, 0);
961 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
963 rect.width = GetClientAreaBounds().width;
964 rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight();
966 else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
968 rect.height = GetClientAreaBounds().height;
969 rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth();
972 AppLog("DTMF Keypad rect(%d,%d,%d,%d)",rect.x,rect.y,rect.width,rect.height);
973 __pDTMFKeypad = new (std::nothrow) DtmfKeyPadPanel();
974 __pDTMFKeypad->Initialize(this, rect);
975 //set layout relation w.r.t call buttons panel
976 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
977 if (pRelativeLayout != null)
979 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
980 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
982 AddControl(__pDTMFKeypad);
985 AddressbookManager* pAddressbookManager = AddressbookManager::GetInstance();
986 __pAddressbook = pAddressbookManager->GetAddressbookN(DEFAULT_ADDRESSBOOK_ID);
987 if(__pAddressbook != null)
989 __pAddressbook->SetAddressbookChangeEventListener(this);
993 if (__pActiveCallInfo != null)
995 delete __pActiveCallInfo;
996 __pActiveCallInfo = null;
998 if (__pHeldCallInfo != null)
1000 delete __pHeldCallInfo;
1001 __pHeldCallInfo = null;
1003 DestroyMoreOptionsMenuList();
1007 case FORMTYPE_OUTGOINGCALL:
1010 contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
1011 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1012 __pActiveCallInfo->SetContactNumber(contactNo);
1013 Contact* pContact = __pCallPresentor->GetContactN(contactNo);
1014 if (pContact != null)
1016 __pActiveCallInfo->SetContactInfo(*pContact);
1019 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1020 //make an normal outgoing call
1021 __pCallPresentor->DialCall(contactNo, false);
1025 case FORMTYPE_EMERGENCYOUTGOINGCALL:
1027 String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
1028 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1029 long long phNumber = 0;
1030 LongLong::Parse(*pContactNo, phNumber);
1031 __pActiveCallInfo->SetContactNumber(*pContactNo);
1032 //make an emergency call
1033 __pCallPresentor->DialCall(*pContactNo, true);
1037 case FORMTYPE_ACTIVECALL:
1039 //get contact number
1040 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
1042 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1043 *__pActiveCallInfo = *pCall;
1044 String activeContactNo;
1045 if(pCall->GetContactNumber().IsEmpty() == false)
1047 activeContactNo.Append(pCall->GetContactNumber());
1051 activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1053 ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1054 //show call active time using Timer
1055 //__activeCallStartTime = pCall->GetCallConnectTime();
1056 __activeCallStartTime = pCall->GetDurationTime();
1057 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
1061 case FORMTYPE_EMERGENCYACTIVECALL:
1063 //get contact number
1064 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
1066 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1067 *__pActiveCallInfo = *pCall;
1069 //show call active time using Timer
1070 //__activeCallStartTime = pCall->GetCallConnectTime();
1071 __activeCallStartTime = pCall->GetDurationTime();
1072 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
1076 case FORMTYPE_MULTIPLECALLS:
1078 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
1079 //update calls state
1080 UpdateMultipleCallScreen(*pCallsList);
1086 case FORMTYPE_ACTIVECONFCALL:
1089 AppCallInfo* pConfInfo = static_cast<AppCallInfo*>(pArgs->GetAt(0));
1090 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1091 *__pActiveCallInfo = *pConfInfo;
1093 int participantsCount = __pActiveCallInfo->GetCallerListCount();
1095 // show participant count on name Label
1096 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1097 if (pPeopleCountLbl)
1100 count.Append(participantsCount);
1102 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1103 pPeopleCountLbl->SetText(count);
1106 if(participantsCount >= IDI_MAX_CONF_CALL_PARTICIPANTS)
1108 __pCallButtonsPanel->EnableAddCallButton(false);
1112 __pCallButtonsPanel->EnableAddCallButton(true);
1116 //bring button on top
1117 __pCallButtonsPanel->SetButtonPosition();
1120 //show call active time using Timer
1121 //__activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1122 __activeCallStartTime = __pActiveCallInfo->GetDurationTime();
1123 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime);
1131 if(__formType == FORMTYPE_ACTIVECALL || __formType == FORMTYPE_EMERGENCYACTIVECALL ||
1132 __formType == FORMTYPE_MULTIPLECALLS || __formType == FORMTYPE_ACTIVECONFCALL)
1134 //Unlock the phone if its locked
1135 if(LockManager::GetInstance()->IsLocked())
1137 AppLogDebug("Phone Locked");
1138 LockManager::GetInstance()->Unlock();
1142 //Hide DTMFKeypad, if visible and show caller info
1144 SetShowStateOnKeypad(true);
1145 SetShowStateOnKeypadLandscape(true);
1146 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
1148 //Set the correct speaker status
1149 if(__pCallPresentor->IsSpeakerOn() == true)
1151 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
1155 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
1158 //Set the correct Mute status
1159 if (__pCallPresentor->IsCallMuted() == true)
1161 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
1165 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
1175 //update position of call buttons panel
1176 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
1177 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
1179 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1180 pCallApp->SetTopMostWindow(false);
1184 ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1186 RemoveOrientationEventListener(*this);
1187 if (__pActiveCallTimer != null)
1189 __pActiveCallTimer->Cancel();
1190 delete __pActiveCallTimer;
1191 __pActiveCallTimer = null;
1193 if (__pSmallPhotoLabel != null)
1195 __pSmallPhotoLabel->SetShowState(false);
1197 //Hide "Manage conf. Call" Context menu
1198 if (__pMoreOptionsListAnchor != null)
1200 __pMoreOptionsListAnchor->SetShowState(false);
1202 if (__pMoreOptionsList != null)
1204 __pMoreOptionsList->SetShowState(false);
1206 __DtmfString.Clear();
1208 if(__pDTMFKeypad != null)
1210 __pDTMFKeypad->SetShowState(false);
1213 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1214 pCallApp->RemoveAppStateChangeListener(*this);
1215 if(__pAddressbook != null)
1217 __pAddressbook->SetAddressbookChangeEventListener(null);
1222 ActiveCallForm::HandleConfCallChanged(void)
1225 AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
1226 //fetch changed conference call info
1227 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1228 if (pConfCallInfo == null)
1234 //fetch participant count in conf call
1235 int participantsCount = pConfCallInfo->GetCallerListCount();
1236 //update status of join and Add call
1237 bool isEnableAddCall = false;
1238 bool isEnableJoinCall = false;
1239 if(participantsCount < IDI_MAX_CONF_CALL_PARTICIPANTS)
1241 //available only at Active conf. call or active call screen
1242 isEnableAddCall = true;
1243 //join button is available only at multiple call screen
1244 isEnableJoinCall = true;
1247 Label* pPeopleCountLbl = null;
1248 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == true)
1250 //Active call is conference call
1251 delete __pActiveCallInfo;
1252 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1253 *__pActiveCallInfo = *pConfCallInfo;
1255 if (__formType == FORMTYPE_MULTIPLECALLS)
1257 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1259 else if (__formType == FORMTYPE_ACTIVECONFCALL)
1261 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1262 AppLog("Active conf call...(%d)", pPeopleCountLbl);
1265 else if(__pHeldCallInfo != null && __pHeldCallInfo->IsConferenceCall() == true)
1267 //Held call is conference call - this is definitely multiple call screen.
1268 delete __pHeldCallInfo;
1269 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1270 *__pHeldCallInfo = *pConfCallInfo;
1271 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1274 // update participant count on name Label
1275 if (pPeopleCountLbl != null)
1278 count.Append(participantsCount);
1280 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1281 pPeopleCountLbl->SetText(count);
1282 pPeopleCountLbl->Invalidate(true);
1284 //change AddCall Button status
1285 __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
1286 //change JoinCall Button status
1287 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1292 ActiveCallForm::OnContactsChanged(const Tizen::Base::Collection::IList& contactChangeInfoList)
1298 case FORMTYPE_OUTGOINGCALL:
1299 case FORMTYPE_ACTIVECALL:
1301 String pContactNumber;
1302 pContactNumber.Append(__pActiveCallInfo->GetContactNumber());
1303 Contact* pContact = __pCallPresentor->GetContactN(__pActiveCallInfo->GetContactNumber());
1304 if(pContact == null)
1306 __pActiveCallInfo->ResetContactNumber(null);
1307 __pActiveCallInfo->ResetContactInfo(null);
1312 __pActiveCallInfo->SetContactNumber(pContactNumber);
1313 __pActiveCallInfo->SetContactInfo(*pContact);
1315 if(pContact != null)
1320 ShowPersonDetails(pContactNumber, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1324 case FORMTYPE_EMERGENCYACTIVECALL:
1329 case FORMTYPE_MULTIPLECALLS:
1332 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
1333 if(pCallsList != null)
1335 int listCount = pCallsList->GetCount();
1336 for(int index = 0; index < listCount; index++)
1338 AppCallInfo callInfo;
1340 pCallsList->GetAt(index, callInfo);
1341 if(__pActiveCallInfo == null)
1343 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1345 *__pActiveCallInfo = callInfo;
1346 String contactNumber;
1347 contactNumber.Append(__pActiveCallInfo->GetContactNumber());
1348 pContact = __pCallPresentor->GetContactN(__pActiveCallInfo->GetContactNumber());
1349 if(pContact == null)
1351 __pActiveCallInfo->ResetContactNumber(null);
1352 __pActiveCallInfo->ResetContactInfo(null);
1357 __pActiveCallInfo->SetContactNumber(contactNumber);
1358 __pActiveCallInfo->SetContactInfo(*pContact);
1360 if(pContact != null)
1365 if(callInfo.IsConferenceCall() == true)
1369 if(callInfo.IsOnHold() == false)
1371 ShowPersonDetails(contactNumber, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1375 ShowPersonDetails(contactNumber, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pActiveCallInfo);
1392 ActiveCallForm::OnCategoriesChanged(const Tizen::Base::Collection::IList& categoryChangeInfoList)
1399 ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
1402 if(__pActiveCallInfo != null)
1404 delete __pActiveCallInfo;
1405 __pActiveCallInfo = null;
1407 if(__pHeldCallInfo != null)
1409 delete __pHeldCallInfo;
1410 __pHeldCallInfo = null;
1413 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1414 if (pMoreBtn != null)
1416 pMoreBtn->SetShowState(false);
1419 //show caller's info.
1420 for (int index = 0; index < activeCallsList.GetCount(); index++)
1423 AppCallInfo callInfo;
1424 activeCallsList.GetAt(index, callInfo);
1427 if(callInfo.GetContactNumber().IsEmpty() == false)
1429 contactNo.Append(callInfo.GetContactNumber());
1433 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1436 if (callInfo.IsOnHold() == false)
1438 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1439 *__pActiveCallInfo = callInfo;
1441 if (__pActiveCallInfo->IsConferenceCall() == false)
1443 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1446 pVoiceIconLbl->SetShowState(true);
1448 if (pMoreBtn != null)
1450 pMoreBtn->SetShowState(false);
1452 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1453 if(__pMoreOptionsListAnchor != null && __pMoreOptionsListAnchor->GetShowState() == true)
1455 CreateMoreOptionsMenuList();
1460 // show participant count on name Label
1461 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1462 if (pPeopleCountLbl)
1465 count.Append(__pActiveCallInfo->GetCallerListCount());
1467 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1468 pPeopleCountLbl->SetText(count);
1470 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1471 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1474 pNameLbl->SetText(nameStr);
1476 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1479 pVoiceIconLbl->SetShowState(false);
1481 if (pMoreBtn != null)
1483 pMoreBtn->SetShowState(true);
1485 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1486 if (pPhotoBitmap != null)
1488 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER1_PHOTO_LABEL));
1491 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1492 pPhotoLbl->Invalidate(true);
1494 delete pPhotoBitmap;
1497 //show call active time using Timer
1498 //__activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1499 __activeCallStartTime = __pActiveCallInfo->GetDurationTime();
1500 ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime);
1504 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1505 *__pHeldCallInfo = callInfo;
1507 if (__pHeldCallInfo->IsConferenceCall() == false)
1509 ShowPersonDetails(contactNo, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pHeldCallInfo);
1513 // show participant count on name Label
1514 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1515 if (pPeopleCountLbl)
1518 count.Append(__pHeldCallInfo->GetCallerListCount());
1520 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1521 pPeopleCountLbl->SetText(count);
1523 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1524 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1527 pNameLbl->SetText(nameStr);
1529 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1530 if (pPhotoBitmap != null)
1532 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER2_PHOTO_LABEL));
1535 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1536 pPhotoLbl->Invalidate(true);
1538 delete pPhotoBitmap;
1542 ShowTimerInfo(IDC_CALLER2_TIME_LABEL, true);
1546 //update JoinCall button status
1547 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1553 ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
1555 result r = E_FAILURE;
1557 //call individual methods to show contact number, caller name & photo
1558 ShowPhoneNumber(phoneNumber, contactLblName);
1560 //fetch contact details based on phone number
1561 String* pDisplayName = pCallInfo->FetchLatestCallerNameN(phoneNumber);
1562 ShowCallerName(*pDisplayName, nameLblName);
1564 Bitmap* pPhotoBitmap = pCallInfo->FetchLatestCallerPhotoN(phoneNumber);
1565 ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
1570 delete pDisplayName;
1571 pDisplayName = null;
1575 delete pPhotoBitmap;
1576 pPhotoBitmap = null;
1581 ActiveCallForm::ShowPhoneNumber(const String& phoneNumber, const String& contactLblName)
1583 String formattedNumber = phoneNumber;
1585 Label* pContactLbl = static_cast<Label*>(GetControl(contactLblName));
1588 pContactLbl->SetText(formattedNumber);
1589 pContactLbl->Invalidate(true);
1594 ActiveCallForm::ShowCallerName(const String& callerName, const String& nameLblName)
1596 // show display name on name Label
1597 Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
1600 //passing an empty string to SetText fails in label,
1601 //if previously valid text has been set
1602 if (callerName.IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
1604 String stringToBeSet(L" ");
1605 pNameLbl->SetText(stringToBeSet);
1609 pNameLbl->SetText(callerName);
1611 pNameLbl->Invalidate(true);
1616 ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
1618 //to check if default image is to be shown
1619 bool showDefaultPhoto = false;
1620 bool showSmallPhoto = false;
1621 String photoLabel("");
1625 case FORMTYPE_OUTGOINGCALL:
1626 case FORMTYPE_ACTIVECALL:
1628 if (pPhotoId == null)
1630 //show default caller image
1631 showDefaultPhoto = true;
1635 //Check the size of photo
1636 // Now checking the condition with && but actually it should be ||
1637 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1638 // height 270 and width = 480 . So all images set thru gallery is show as small image
1639 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1640 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1642 showSmallPhoto = true;
1646 photoLabel.Append(IDC_CALLER1_BIGPHOTO_LABEL);
1650 case FORMTYPE_MULTIPLECALLS:
1654 photoLabel.Append(IDC_CALLER2_PHOTO_LABEL);
1658 photoLabel.Append(IDC_CALLER1_PHOTO_LABEL);
1661 if (pPhotoId == null)
1663 showDefaultPhoto = true;
1667 if (pPhotoId->GetHeight() <= H_SMALL_PHOTO
1668 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1670 //pPhotoId->Scale(Dimension(W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO));
1671 showSmallPhoto = true;
1681 //Remove small photo label
1682 if (__pSmallPhotoLabel != null)
1684 RemoveControl(__pSmallPhotoLabel);
1685 __pSmallPhotoLabel = null;
1688 //show photo - for Big Photo Id, Animated Call Image
1689 if (!showDefaultPhoto)
1691 if(showSmallPhoto == true)
1693 ShowThumbnailImage(pPhotoId,photoLabel);
1697 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1700 Canvas* pCanvas = new (std::nothrow) Canvas;
1701 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1702 pCanvas->Construct(canvasRect);
1703 //draw the contact bitmap
1704 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1705 Bitmap* pNewPhotoId = new Bitmap();
1706 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1709 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1710 pPhotoLbl->Invalidate(true);
1717 Bitmap* pDefaultPhoto = null;
1720 case FORMTYPE_OUTGOINGCALL:
1721 case FORMTYPE_ACTIVECALL:
1722 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1725 case FORMTYPE_MULTIPLECALLS:
1726 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_MULTIPLE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1729 case FORMTYPE_ACTIVECONFCALL:
1730 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BIG_BG_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1736 if (pDefaultPhoto != null)
1738 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1741 pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
1742 pPhotoLbl->Invalidate(true);
1744 delete pDefaultPhoto;
1750 ActiveCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,String& photoLabel)
1752 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1754 if (pPhotoLbl != null && pPhotoId != null)
1756 Canvas* pCanvas = new (std::nothrow) Canvas;
1757 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1758 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1759 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1760 pCanvas->Construct(canvasRect);
1761 //draw the back ground
1762 pCanvas->DrawBitmap(canvasRect,*pBackground);
1763 //draw shadow (to be enabled after correct shadow image is provided )
1764 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1765 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1766 //draw the contact bitmap
1767 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1768 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1769 Bitmap* pNewPhotoId = new Bitmap();
1770 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1773 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1774 pPhotoLbl->Invalidate(true);
1783 ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1785 if (__pSmallPhotoLabel != null)
1787 RemoveControl(__pSmallPhotoLabel);
1788 __pSmallPhotoLabel = null;
1790 //Draw Small Photo and show on small photo label
1791 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1792 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1793 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1794 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1795 // Add a Label to the Form
1796 AddControl(__pSmallPhotoLabel);
1797 __pSmallPhotoLabel->Invalidate(true);
1801 ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long long startTime)
1803 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1805 if (__pActiveCallTimer == null)
1807 __pActiveCallTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
1808 __pActiveCallTimer->Construct(*this);
1811 if (pTimerLbl != null)
1813 if (isOnHold == true)
1815 pTimerLbl->SetText(AppUtility::GetResourceString(IDS_TIMER_ON_HOLD));
1816 //update Hold button status
1817 SetHoldButtonStatus(false);
1821 //update Hold button status
1822 SetHoldButtonStatus(true);
1823 //current system time
1824 long long currTime = 0;
1825 //SystemTime::GetTicks(currTime);
1826 CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
1827 currTime = pPhoneApp->GetCallAppTicks();
1829 TimeSpan diffSpan(abs(startTime - currTime));
1831 String activeCallTime(L"");
1833 long long hr = diffSpan.GetHours();
1836 activeCallTime.Append("0");
1838 activeCallTime.Append(hr);
1839 activeCallTime.Append(L":");
1841 long long min = diffSpan.GetMinutes();
1844 activeCallTime.Append("0");
1846 activeCallTime.Append(min);
1847 activeCallTime.Append(L":");
1849 long long sec = diffSpan.GetSeconds();
1852 activeCallTime.Append("0");
1854 activeCallTime.Append(sec);
1856 pTimerLbl->SetText(activeCallTime);
1857 __pActiveCallTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
1859 pTimerLbl->Invalidate(true);
1864 ActiveCallForm::SetHoldButtonShowState(bool showState)
1866 Label* pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1867 if(pLblControl != null)
1869 pLblControl->SetShowState(showState);
1871 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1872 if(pButtonControl != null)
1874 pButtonControl->SetShowState(showState);
1879 ActiveCallForm::SetShowStateOnKeypadLandscape(bool showState)
1883 case FORMTYPE_ACTIVECONFCALL:
1884 case FORMTYPE_ACTIVECALL:
1886 SetHoldButtonShowState(showState);
1890 case FORMTYPE_MULTIPLECALLS:
1892 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1893 pLblControl->SetShowState(showState);
1894 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1895 pLblControl->SetShowState(showState);
1896 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1897 pLblControl->SetShowState(showState);
1898 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1899 pLblControl->SetShowState(showState);
1900 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1901 pLblControl->SetShowState(showState);
1902 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1903 pButtonControl->SetShowState(showState);
1913 ActiveCallForm::SetShowStateOnKeypad(bool showState)
1915 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1916 pLblControl->SetShowState(showState);
1917 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL));
1918 pLblControl->SetShowState(showState);
1919 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1920 pLblControl->SetShowState(showState);
1921 if (__pSmallPhotoLabel != null)
1923 __pSmallPhotoLabel->SetShowState(showState);
1928 case FORMTYPE_ACTIVECALL:
1930 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1931 pLblControl->SetShowState(showState);
1932 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1933 pLblControl->SetShowState(showState);
1934 SetHoldButtonShowState(showState);
1938 case FORMTYPE_MULTIPLECALLS:
1940 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1941 pLblControl->SetShowState(showState);
1942 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1943 pLblControl->SetShowState(showState);
1944 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1945 pLblControl->SetShowState(showState);
1946 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1947 pLblControl->SetShowState(showState);
1948 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1949 pLblControl->SetShowState(showState);
1950 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1951 pLblControl->SetShowState(showState);
1952 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == false)
1954 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1955 pLblControl->SetShowState(showState);
1959 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1960 pButtonControl->SetShowState(showState);
1962 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1963 pButtonControl->SetShowState(showState);
1967 case FORMTYPE_ACTIVECONFCALL:
1969 pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1970 pLblControl->SetShowState(showState);
1971 SetHoldButtonShowState(showState);
1972 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1973 pButtonControl->SetShowState(showState);
1983 ActiveCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1985 //Call default implementation of "Object.Equals()"
1986 //returns true, if they are pointing to same address.
1987 if (__pActiveCallTimer->Equals(timer))
1989 Label* pTimerLbl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1992 String activeCallTime = pTimerLbl->GetText();
1993 // Create a StringTokenizer instance
1994 StringTokenizer strTokens(activeCallTime, L":");
1996 int count = strTokens.GetTokenCount(); // count == 3
2001 for (int index = 0; index < count; index++)
2006 strTokens.GetNextToken(token);
2007 Integer::Parse(token, hr);
2011 strTokens.GetNextToken(token);
2012 Integer::Parse(token, min);
2016 strTokens.GetNextToken(token);
2017 Integer::Parse(token, sec);
2023 if (sec == IDI_MAX_SECONDS)
2028 if (min == IDI_MAX_MINS)
2035 activeCallTime.Clear();
2038 activeCallTime.Append("0");
2040 activeCallTime.Append(hr);
2041 activeCallTime.Append(":");
2044 activeCallTime.Append("0");
2046 activeCallTime.Append(min);
2047 activeCallTime.Append(":");
2050 activeCallTime.Append("0");
2052 activeCallTime.Append(sec);
2053 //update timer label
2054 pTimerLbl->SetText(activeCallTime);
2055 pTimerLbl->Invalidate(true);
2060 ///////////////////////////////////////////////////////////
2061 /////////// Options Menu List Functionality /////////
2062 ///////////////////////////////////////////////////////////
2064 ActiveCallForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
2069 ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
2071 //Goto conference call list form
2072 SceneManager* pSceneManager = SceneManager::GetInstance();
2073 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
2074 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_KEEP), null);
2078 ActiveCallForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
2083 ActiveCallForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
2088 ActiveCallForm::GetItemCount(void)
2090 return IDI_MOREOPTIONS_LIST_ITEMS;
2094 ActiveCallForm::CreateItem(int index, int itemWidth)
2096 //create 1st Menu option
2097 CustomItem* pItem = new (std::nothrow) CustomItem();
2098 pItem->Construct(IDI_OPTIONMENU_DIMEN, LIST_ANNEX_STYLE_NORMAL);
2100 //Set background 9-patch bitmap to option menu
2101 Bitmap* pBgBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_BG_ICON);
2102 if (pBgBmp != null && pBgBmp->IsNinePatchedBitmap())
2105 bgCanvas.Construct(Rectangle(IDI_OPTIONMENU_POS, IDI_OPTIONMENU_DIMEN));
2106 bgCanvas.DrawNinePatchedBitmap(bgCanvas.GetBounds(), *pBgBmp);
2110 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color(40, 45, 48));
2115 //Set bitmap to option menu
2116 Bitmap* pNormalConfCallBmp = AppUtility::GetBitmapFromResourcesN(IDB_MORE_MANAGE_CONFERENCE_ICON ,
2117 W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP);
2118 pItem->AddElement(Rectangle(16, 17, W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP), 1, *pNormalConfCallBmp, null, null);
2119 // Deallocate bitmaps
2120 delete pNormalConfCallBmp;
2121 pNormalConfCallBmp = null;
2123 //Set text to menu option
2124 String confCallName = AppUtility::GetResourceString(IDS_MGR_CONF_CALL_LIST_STR);
2126 TextElement* pTextElement = new (std::nothrow) TextElement();
2127 pTextElement->Construct(confCallName);
2128 pTextElement->SetTextColor(COLOR_POPUP_TEXT);
2131 font.Construct(FONT_STYLE_PLAIN, IDI_POPUP_TEXT_SIZE);
2132 pTextElement->SetFont(font);
2133 //construct Enriched text
2134 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
2135 FloatDimension textDimension;
2136 font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
2137 textDimension.height = textDimension.height + font.GetDescender();
2138 pEnrichedText->Construct(textDimension);
2139 //add text element to enriched text
2140 pEnrichedText->Add(*pTextElement);
2142 //Add Enriched text to pItem
2143 FloatPoint textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
2144 pItem->AddElement(FloatRectangle(textPos, textDimension), 2, *pEnrichedText);
2146 pEnrichedText->RemoveAll(true);
2147 delete pEnrichedText;
2152 ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
2159 ActiveCallForm::OnForeground(void)
2161 AppLogDebug("Enter");
2162 __pCallPresentor->OnAppForeground();