2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (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
25 #include "CallActiveCallForm.h"
26 #include "CallButtonsPanel.h"
28 #include "CallAppUtility.h"
29 #include "CallDtmfKeypadPanel.h"
30 #include "CallPresentationModel.h"
31 #include "CallSceneRegister.h"
32 #include "CallTypes.h"
34 using namespace Tizen::App;
35 using namespace Tizen::Base;
36 using namespace Tizen::Base::Collection;
37 using namespace Tizen::Base::Utility;
38 using namespace Tizen::Graphics;
39 using namespace Tizen::Media;
40 using namespace Tizen::Social;
41 using namespace Tizen::System;
42 using namespace Tizen::Ui;
43 using namespace Tizen::Ui::Controls;
44 using namespace Tizen::Ui::Scenes;
47 const int IDI_MAX_SECONDS = 60;
48 const int IDI_MAX_MINS = 60;
49 const int W_HOLD_BITMAP = 78;
50 const int H_HOLD_BITMAP = 78;
51 //for Options menu list
52 const int IDI_POPUP_TEXT_SIZE = 33;
53 const unsigned int COLOR_POPUP_TEXT = Color32<255, 255, 255, 255>::Value;
54 const int IDI_MOREOPTIONS_LIST_ITEMS = 1;
55 const int W_OPTION_ANCHOR = 72;
56 const int H_OPTION_ANCHOR = 22;
57 const int W_MGR_CONFCALL_BITMAP = 64;
58 const int H_MGR_CONFCALL_BITMAP = 64;
59 const int X_POPUP_ANCHOR = 632;
60 const int Y_POPUP_ANCHOR = 140;
61 const int W_POPUP_ANCHOR = 72;
62 const int H_POPUP_ANCHOR = 22;
63 const int IDI_OPTIONMENU_ITEM_SPACING = 16;
64 const Point IDI_OPTIONMENU_POS(238, 162);
65 const Dimension IDI_OPTIONMENU_DIMEN(466, 99);
66 const int X_PHOTO_LBL = 166;
67 const int Y_PHOTO_LBL = 232;
68 const int W_PHOTO_LBL = 388;
69 const int H_PHOTO_LBL = 388;
70 const int W_PHOTO_LABEL = 720;
71 const int H_PHOTO_LABEL = 720;
72 const int W_RIGHT_MORE_ICON_MARGIN = 24;
73 const int W_MORE_LABEL = 466;
74 const int H_MORE_LABEL = 162;
75 const int W_MORE_ICON = 70;
77 static const wchar_t* IDC_CONF_CALL_MORE_BUTTON = L"IDC_CONF_CALL_MORE_BUTTON";
78 static const wchar_t* IDC_HOLD_BUTTON = L"IDC_HOLD_BUTTON";
79 static const wchar_t* IDC_SWAP_BUTTON = L"IDC_SWAP_BUTTON";
80 static const wchar_t* IDC_HOLD_LABEL = L"IDC_HOLD_LABEL";
81 static const wchar_t* IDC_TEXTBOX = L"IDC_NUM_EDITFIELD";
82 static const wchar_t* IDC_CALLER1_LABEL = L"IDC_CALLER1_LABEL";
83 static const wchar_t* IDC_BACKGROUND_LABEL = L"IDC_BACKGROUND_LABEL";
84 static const wchar_t* IDC_CALLER1_TIME_LABEL = L"IDC_CALLER1_TIME_LABEL";
85 static const wchar_t* IDC_NUMBER1_LABEL = L"IDC_NUMBER1_LABEL";
86 static const wchar_t* IDC_VOICE_CALL_ICON_LABEL = L"IDC_VOICE_CALL_ICON_LABEL";
87 static const wchar_t* IDC_CALLER2_LABEL = L"IDC_CALLER2_LABEL";
88 static const wchar_t* IDC_NUMBER2_LABEL = L"IDC_NUMBER2_LABEL";
89 static const wchar_t* IDC_CALLER2_TIME_LABEL = L"IDC_CALLER2_TIME_LABEL";
90 static const wchar_t* IDC_SWAP_LABEL = L"IDC_SWAP_LABEL";
91 static const wchar_t* IDC_BACKGROUND_LABEL2 = L"IDC_BACKGROUND_LABEL2";
92 static const wchar_t* IDC_PARTICIPANTS_LABEL = L"IDC_PARTICIPANTS_LABEL";
93 static const wchar_t* IDC_CALLER1_BIGPHOTO_LABEL = L"IDC_CALLER1_BIGPHOTO_LABEL";
94 static const wchar_t* IDC_CALLER2_PHOTO_LABEL = L"IDC_CALLER2_PHOTO_LABEL";
95 static const wchar_t* IDC_CALLER1_PHOTO_LABEL = L"IDC_CALLER1_PHOTO_LABEL";
96 static const wchar_t* IDC_KEY_BG_LABEL = L"IDC_KEY_BG_LABEL";
98 ActiveCallForm::ActiveCallForm(FormType formType)
101 __pActiveCallTimer = null;
102 __pCallButtonsPanel = null;
103 __pDTMFKeypad = null;
104 __pMoreOptionsList = null;
105 __pMoreOptionsListAnchor = null;
106 __pSmallPhotoLabel = null;
107 __pActiveCallInfo = null;
108 __pHeldCallInfo = null;
111 ActiveCallForm::~ActiveCallForm(void)
113 if (__pActiveCallTimer != null)
115 __pActiveCallTimer->Cancel();
116 delete __pActiveCallTimer;
118 if (__pMoreOptionsList != null)
120 __pMoreOptionsList = null;
122 if (__pMoreOptionsListAnchor != null)
124 __pMoreOptionsListAnchor = null;
126 if (__pSmallPhotoLabel != null)
128 __pSmallPhotoLabel = null;
130 if (__pActiveCallInfo != null)
132 delete __pActiveCallInfo;
134 if (__pHeldCallInfo != null)
136 delete __pHeldCallInfo;
138 if(__pDTMFKeypad != null)
140 __pDTMFKeypad = null;
145 ActiveCallForm::Initialize(void)
149 case FORMTYPE_OUTGOINGCALL:
150 Construct(IDL_OUTCALL_FORM);
153 case FORMTYPE_EMERGENCYOUTGOINGCALL:
154 Construct(IDL_OUT_EMERGENCYCALL_FORM);
157 case FORMTYPE_ACTIVECALL:
158 Construct(IDL_CALL_FORM);
161 case FORMTYPE_EMERGENCYACTIVECALL:
162 Construct(IDL_EMERGENCY_CALL_FORM);
165 case FORMTYPE_MULTIPLECALLS:
166 Construct(IDL_MULTIPLE_CALL_FORM);
169 case FORMTYPE_ACTIVECONFCALL:
170 Construct(IDL_CONFCALL_FORM);
179 ActiveCallForm::OnInitializing(void)
181 result r = E_SUCCESS;
183 //Hold Button - Shown on single active/conf call scene
184 InitializeHoldButton();
185 //Swap button for multiple call screen
186 InitializeSwapButton();
187 //Initialize manage conf. call list form
188 InitializeManageConfCallButton();
190 __pCallPresentor = CallPresentationModel::GetInstance();
195 ActiveCallForm::ShowDTMFKeypad(void)
197 if(__pDTMFKeypad == null)
199 //update rect according to client screen area
200 Rectangle rect(0, 0, 0, 0);
201 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT)
203 rect.width = GetClientAreaBounds().width;
204 rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight();
206 else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE)
208 rect.height = GetClientAreaBounds().height;
209 rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth();
212 AppLog("DTMF Keypad rect(%d,%d,%d,%d)",rect.x,rect.y,rect.width,rect.height);
213 __pDTMFKeypad = new (std::nothrow) DtmfKeyPadPanel();
214 __pDTMFKeypad->Initialize(this, rect);
215 AddControl(*__pDTMFKeypad);
217 //set layout relation w.r.t call buttons panel
218 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
219 if (pRelativeLayout != null)
221 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
222 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
225 __pDTMFKeypad->SetShowState(true);
226 if(__DtmfString.IsEmpty() == false)
228 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
229 pTextBox->SetText(__DtmfString);
231 __pDTMFKeypad->Draw(true);
232 __pDTMFKeypad->Show();
236 ActiveCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
240 if (__pCallButtonsPanel != null)
242 //update position of call buttons panel
243 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
244 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
246 //bring button on top
247 __pCallButtonsPanel->SetButtonPosition();
249 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
250 if (pRelativeLayout != null)
252 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
255 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
256 if (pRelativeLayout != null)
258 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
259 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
262 //change orientation of DTMF Keypad, if it is visible.
263 if (__pDTMFKeypad != null)
265 if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE)
267 //in landscape mode, caller info is visible.
268 SetShowStateOnKeypad(true);
270 else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT)
272 //in Portrait mode it is hidden beneath DTMF Keypad.
273 SetShowStateOnKeypad(false);
275 if(__pDTMFKeypad->GetShowState() == true)
277 String dtmfText = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
283 //More option is displayed recreate it
284 if(__pMoreOptionsListAnchor != null)
286 CreateMoreOptionsMenuList();
287 CreateMoreOptionsMenuList();
292 ActiveCallForm::HideDTMFKeypad(void)
294 if(__pDTMFKeypad != null)
296 __DtmfString = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
298 RemoveControl(*__pDTMFKeypad);
299 __pDTMFKeypad = null;
304 ActiveCallForm::InitializeCallButtonsPanel(void)
306 result r = E_SUCCESS;
307 //Set background bitmap for call keypad
308 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
309 Bitmap* pBgBitmap = AppUtility::GetBitmapFromResourcesN(IDB_BACKGROUND_BITMAP, pKeysBgLbl->GetWidth(), pKeysBgLbl->GetHeight());
310 if (pBgBitmap != null)
312 pKeysBgLbl->SetBackgroundBitmap(*pBgBitmap);
315 if (__pCallButtonsPanel == null)
317 __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
318 __pCallButtonsPanel->ConstructPanel(this, __formType);
319 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
320 r = AddControl(*__pCallButtonsPanel);
323 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
324 if (pRelativeLayout != null)
326 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
328 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
329 if (pRelativeLayout != null)
331 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
332 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
339 ActiveCallForm::InitializeSwapButton(void)
341 Button* pSwapBtn = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
344 Bitmap* pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_NORMAL,
345 W_HOLD_BITMAP, H_HOLD_BITMAP);
348 pSwapBtn->SetNormalBitmap(Point(0, 0), *pSwapBmp);
353 pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_PRESS,
354 W_HOLD_BITMAP, H_HOLD_BITMAP);
357 pSwapBtn->SetPressedBitmap(Point(0, 0), *pSwapBmp);
361 pSwapBtn->SetActionId(IDA_SWAP_CALLS);
362 pSwapBtn->AddActionEventListener(*this);
367 ActiveCallForm::InitializeManageConfCallButton(void)
369 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
370 if (pMoreBtn != null)
372 pMoreBtn->SetActionId(IDA_MORE_OPTIONS_MENU);
373 pMoreBtn->AddActionEventListener(*this);
374 if (__formType == FORMTYPE_MULTIPLECALLS)
376 //Correct state will be set in OnSceneActivated based on the call
377 pMoreBtn->SetShowState(false);
379 else if (__formType == FORMTYPE_ACTIVECONFCALL)
381 pMoreBtn->SetShowState(true);
387 ActiveCallForm::InitializeHoldButton(void)
389 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
390 if (pHoldBtn != null)
392 //set status of Hold Button
393 SetHoldButtonStatus(true);
394 pHoldBtn->AddActionEventListener(*this);
399 ActiveCallForm::SetHoldButtonStatus(bool toHoldCall)
401 //background bitmap & button name
403 Bitmap* normalImg = null;
404 Bitmap* pressImg = null;
407 btnName.Append(AppUtility::GetResourceString(IDS_HOLD_BTN_NAME));
408 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_NORMAL_BUTTON_ICON,
409 W_HOLD_BITMAP, H_HOLD_BITMAP);
410 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_PRESS_BUTTON_ICON,
411 W_HOLD_BITMAP, H_HOLD_BITMAP);
415 btnName.Append(AppUtility::GetResourceString(IDS_UNHOLD_BTN_NAME));
416 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_NORMAL_BUTTON_ICON,
417 W_HOLD_BITMAP, H_HOLD_BITMAP);
418 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_PRESS_BUTTON_ICON,
419 W_HOLD_BITMAP, H_HOLD_BITMAP);
423 CommandIds cmdId = IDA_HOLD_CALL;
426 case FORMTYPE_ACTIVECALL:
428 cmdId = toHoldCall ? IDA_HOLD_CALL : IDA_UNHOLD_CALL;
432 case FORMTYPE_ACTIVECONFCALL:
434 cmdId = toHoldCall ? IDA_HOLD_CONF_CALL : IDA_UNHOLD_CONF_CALL;
442 //set background bitmap, button name & action id
443 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
444 Label* pHoldLbl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
447 pHoldBtn->SetActionId(cmdId);
448 pHoldBtn->SetNormalBitmap(Point(0, 0),*normalImg);
449 pHoldBtn->SetPressedBitmap(Point(0, 0),*pressImg);
453 pHoldLbl->SetText(btnName);
454 pHoldLbl->Invalidate(true);
465 ActiveCallForm::CreateMoreOptionsMenuList(void)
467 //create option list anchor
468 if (__pMoreOptionsListAnchor == null)
470 Bitmap* pBgPopupArwBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_ARROW_ICON, W_OPTION_ANCHOR,
472 __pMoreOptionsListAnchor = new (std::nothrow) Label();
473 __pMoreOptionsListAnchor->Construct(Rectangle(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_ICON, Y_POPUP_ANCHOR, W_POPUP_ANCHOR, H_POPUP_ANCHOR), L"");
474 __pMoreOptionsListAnchor->SetBackgroundBitmap(*pBgPopupArwBmp);
476 delete pBgPopupArwBmp;
477 pBgPopupArwBmp = null;
479 // Adds a Label to the Form
480 AddControl(*__pMoreOptionsListAnchor);
483 //create options menu list
484 if (__pMoreOptionsList == null)
486 __pMoreOptionsList = new (std::nothrow) ListView();
487 __pMoreOptionsList->Construct(Rectangle(Point(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_LABEL,H_MORE_LABEL), IDI_OPTIONMENU_DIMEN), false, SCROLL_STYLE_FADE_OUT);
488 __pMoreOptionsList->SetItemProvider(*this);
489 __pMoreOptionsList->AddListViewItemEventListener(*this);
490 //Add option list to the form
491 AddControl(*__pMoreOptionsList);
495 //Hide option menu list
496 DestroyMoreOptionsMenuList();
501 ActiveCallForm::DestroyMoreOptionsMenuList(void)
503 if (__pMoreOptionsListAnchor != null)
505 //removes and delete the child control
506 RemoveControl(*__pMoreOptionsListAnchor);
507 __pMoreOptionsListAnchor = null;
510 if (__pMoreOptionsList != null)
512 //removes and delete the child control
513 RemoveControl(*__pMoreOptionsList);
514 __pMoreOptionsList = null;
519 ActiveCallForm::OnTerminating(void)
521 result r = E_SUCCESS;
522 if (__pCallPresentor != null)
524 __pCallPresentor = null;
530 ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
538 //End the currently active / dialing call
539 if (__pActiveCallInfo->IsConferenceCall() == false)
541 String activeContactNo;
542 activeContactNo.Append(__pActiveCallInfo->GetContactNumber());
543 //Check if it is call is in dialing state, then
544 if (__formType == FORMTYPE_EMERGENCYOUTGOINGCALL || __formType == FORMTYPE_OUTGOINGCALL)
546 __pCallPresentor->EndDialingCall(activeContactNo);
551 __pCallPresentor->EndActiveCall(*__pActiveCallInfo->GetCallHandle());
556 __pCallPresentor->EndConferenceCall();
561 case IDA_END_CONF_CALL:
563 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
564 __pCallPresentor->EndConferenceCall();
568 case IDA_OPEN_NUMKEYPAD:
570 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT)
572 //hide only in portrait mode.
573 SetShowStateOnKeypad(false);
576 __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
580 case IDA_CLOSE_NUMKEYPAD:
582 SetShowStateOnKeypad(true);
584 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
590 //switch to Dialer Form to make an call
591 if(__pCallPresentor->GetCurrentCallCount() == 1)
593 /* ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
595 String* formType = new (std::nothrow) String();
596 formType->Append(__formType);
597 pArgs->Add(formType);
598 pSceneManager->GoForward( ForwardSceneTransition(IDSCN_DIALER, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
599 SCENE_HISTORY_OPTION_NO_HISTORY), pArgs);*/
600 __pCallPresentor->LaunchDialAppControl();
609 if (__pActiveCallInfo->IsConferenceCall() == false)
611 if(__pActiveCallInfo->GetCallHandle() != null)
613 success = __pCallPresentor->HoldCall(*__pActiveCallInfo->GetCallHandle());
618 success = __pCallPresentor->HoldConferenceCall();
620 //reset hold status and "OnHold" text
621 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
622 if(__pActiveCallTimer != null)
624 __pActiveCallTimer->Cancel();
626 SetHoldButtonStatus(!success);
630 case IDA_UNHOLD_CALL:
632 bool success = false;
633 if (__pActiveCallInfo->IsConferenceCall() == false)
635 if(__pActiveCallInfo->GetCallHandle() != null)
637 success = __pCallPresentor->UnHoldCall(*__pActiveCallInfo->GetCallHandle());
642 success = __pCallPresentor->ActivateConferenceCall();
644 //reset hold status and show call timer
645 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
646 SetHoldButtonStatus(success);
650 case IDA_HOLD_CONF_CALL:
652 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
653 bool success = __pCallPresentor->HoldConferenceCall();
654 //reset hold status and "OnHold" text
655 SetHoldButtonStatus(!success);
656 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
657 if(__pActiveCallTimer != null)
659 __pActiveCallTimer->Cancel();
664 case IDA_UNHOLD_CONF_CALL:
666 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
667 bool success = __pCallPresentor->ActivateConferenceCall();
668 //reset hold status and show call timer
669 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
670 SetHoldButtonStatus(success);
674 case IDA_OPEN_CONTACTS:
677 //Launch call application
678 AppManager* pAppManager = AppManager::GetInstance();
679 pAppManager->LaunchApplication(PROVIDER_ID_CONTACTS);
685 bool success = __pCallPresentor->SetMuteStatus(true);
688 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
695 bool success = __pCallPresentor->SetMuteStatus(false);
698 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
705 bool success = __pCallPresentor->SetSpeakerStatus(true);
708 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
713 case IDA_SPEAKER_OFF:
715 bool success = __pCallPresentor->SetSpeakerStatus(false);
718 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
725 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
726 __pCallPresentor->JoinCall();
732 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
733 __pCallPresentor->SwapCalls();
737 case IDA_MORE_OPTIONS_MENU:
739 //Show 'more' options menu
740 CreateMoreOptionsMenuList();
746 dtmfString.Append(L"0");
747 SetTextToDTMFTextField(dtmfString);
748 __pCallPresentor->SendDTMFSignal(dtmfString);
754 dtmfString.Append(L"1");
755 SetTextToDTMFTextField(dtmfString);
756 __pCallPresentor->SendDTMFSignal(dtmfString);
762 dtmfString.Append(L"2");
763 SetTextToDTMFTextField(dtmfString);
764 __pCallPresentor->SendDTMFSignal(dtmfString);
770 dtmfString.Append(L"3");
771 SetTextToDTMFTextField(dtmfString);
772 __pCallPresentor->SendDTMFSignal(dtmfString);
778 dtmfString.Append(L"4");
779 SetTextToDTMFTextField(dtmfString);
780 __pCallPresentor->SendDTMFSignal(dtmfString);
786 dtmfString.Append(L"5");
787 SetTextToDTMFTextField(dtmfString);
788 __pCallPresentor->SendDTMFSignal(dtmfString);
794 dtmfString.Append(L"6");
795 SetTextToDTMFTextField(dtmfString);
796 __pCallPresentor->SendDTMFSignal(dtmfString);
802 dtmfString.Append(L"7");
803 SetTextToDTMFTextField(dtmfString);
804 __pCallPresentor->SendDTMFSignal(dtmfString);
810 dtmfString.Append(L"8");
811 SetTextToDTMFTextField(dtmfString);
812 __pCallPresentor->SendDTMFSignal(dtmfString);
818 dtmfString.Append(L"9");
819 SetTextToDTMFTextField(dtmfString);
820 __pCallPresentor->SendDTMFSignal(dtmfString);
826 dtmfString.Append(L"*");
827 SetTextToDTMFTextField(dtmfString);
828 __pCallPresentor->SendDTMFSignal(dtmfString);
834 dtmfString.Append(L"#");
835 SetTextToDTMFTextField(dtmfString);
836 __pCallPresentor->SendDTMFSignal(dtmfString);
846 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
848 if(__pDTMFKeypad != null)
850 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
852 int startpos=-1,endpos=-1;
853 pTextBox->GetBlockRange(startpos,endpos);
857 pTextBox->ReleaseBlock();
860 pTextBox->InsertTextAtCursorPosition(dtmfStr);
861 //pTextBox->AppendText(dtmfStr);
862 pTextBox->SetFocus();
863 pTextBox->Invalidate(true);
868 ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
871 //set itself as listener
872 __pCallPresentor->SetTelEventListener(this);
873 AddOrientationEventListener(*this);
875 //Initialize keypad and buttons
876 InitializeCallButtonsPanel();
878 if (__pActiveCallInfo != null)
880 delete __pActiveCallInfo;
881 __pActiveCallInfo = null;
883 if (__pHeldCallInfo != null)
885 delete __pHeldCallInfo;
886 __pHeldCallInfo = null;
888 DestroyMoreOptionsMenuList();
892 case FORMTYPE_OUTGOINGCALL:
895 contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
896 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
897 __pActiveCallInfo->SetContactNumber(contactNo);
898 Contact* pContact = __pCallPresentor->GetContactN(contactNo);
899 if (pContact != null)
901 __pActiveCallInfo->SetContactInfo(*pContact);
904 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
905 //make an normal outgoing call
906 __pCallPresentor->DialCall(contactNo, false);
910 case FORMTYPE_EMERGENCYOUTGOINGCALL:
912 String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
913 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
914 long long phNumber = 0;
915 LongLong::Parse(*pContactNo, phNumber);
916 __pActiveCallInfo->SetContactNumber(*pContactNo);
917 //make an emergency call
918 __pCallPresentor->DialCall(*pContactNo, true);
922 case FORMTYPE_ACTIVECALL:
925 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
927 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
928 *__pActiveCallInfo = *pCall;
929 String activeContactNo;
930 if(pCall->GetContactNumber().IsEmpty() == false)
932 activeContactNo.Append(pCall->GetContactNumber());
936 activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
938 ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
940 //show call active time using Timer
941 __activeCallStartTime = pCall->GetCallConnectTime();
942 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
946 case FORMTYPE_EMERGENCYACTIVECALL:
949 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
951 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
952 *__pActiveCallInfo = *pCall;
954 //show call active time using Timer
955 __activeCallStartTime = pCall->GetCallConnectTime();
956 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
960 case FORMTYPE_MULTIPLECALLS:
962 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
964 UpdateMultipleCallScreen(*pCallsList);
970 case FORMTYPE_ACTIVECONFCALL:
973 AppCallInfo* pConfInfo = static_cast<AppCallInfo*>(pArgs->GetAt(0));
974 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
975 *__pActiveCallInfo = *pConfInfo;
977 int participantsCount = __pActiveCallInfo->GetCallerListCount();
979 // show participant count on name Label
980 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
984 count.Append(participantsCount);
986 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
987 pPeopleCountLbl->SetText(count);
990 if(participantsCount >= IDI_MAX_CONF_CALL_PARTICIPANTS)
992 __pCallButtonsPanel->EnableAddCallButton(false);
996 __pCallButtonsPanel->EnableAddCallButton(true);
999 //show call active time using Timer
1000 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1001 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime);
1009 //Hide DTMFKeypad, if visible and show caller info
1011 SetShowStateOnKeypad(true);
1012 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
1014 //Set the correct speaker status
1015 if(__pCallPresentor->IsSpeakerOn() == true)
1017 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
1021 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
1024 //Set the correct Mute status
1025 if (__pCallPresentor->IsCallMuted() == true)
1027 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
1031 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
1043 ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1045 RemoveOrientationEventListener(*this);
1046 if (__pCallButtonsPanel != null)
1048 RemoveControl(*__pCallButtonsPanel);
1049 __pCallButtonsPanel = null;
1051 if (__pActiveCallTimer != null)
1053 __pActiveCallTimer->Cancel();
1054 delete __pActiveCallTimer;
1055 __pActiveCallTimer = null;
1057 if (__pSmallPhotoLabel != null)
1059 __pSmallPhotoLabel->SetShowState(false);
1061 //Hide "Manage conf. Call" Context menu
1062 if (__pMoreOptionsListAnchor != null)
1064 __pMoreOptionsListAnchor->SetShowState(false);
1066 if (__pMoreOptionsList != null)
1068 __pMoreOptionsList->SetShowState(false);
1070 __DtmfString.Clear();
1074 ActiveCallForm::HandleConfCallChanged(void)
1077 AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
1078 //fetch changed conference call info
1079 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1080 if (pConfCallInfo == null)
1086 //fetch participant count in conf call
1087 int participantsCount = pConfCallInfo->GetCallerListCount();
1088 //update status of join and Add call
1089 bool isEnableAddCall = false;
1090 bool isEnableJoinCall = false;
1091 if(participantsCount < IDI_MAX_CONF_CALL_PARTICIPANTS)
1093 //available only at Active conf. call or active call screen
1094 isEnableAddCall = true;
1095 //join button is available only at multiple call screen
1096 isEnableJoinCall = true;
1099 Label* pPeopleCountLbl = null;
1100 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == true)
1102 //Active call is conference call
1103 delete __pActiveCallInfo;
1104 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1105 *__pActiveCallInfo = *pConfCallInfo;
1107 if (__formType == FORMTYPE_MULTIPLECALLS)
1109 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1111 else if (__formType == FORMTYPE_ACTIVECONFCALL)
1113 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1114 AppLog("Active conf call...(%d)", pPeopleCountLbl);
1117 else if(__pHeldCallInfo != null && __pHeldCallInfo->IsConferenceCall() == true)
1119 //Held call is conference call - this is definitely multiple call screen.
1120 delete __pHeldCallInfo;
1121 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1122 *__pHeldCallInfo = *pConfCallInfo;
1123 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1126 // update participant count on name Label
1127 if (pPeopleCountLbl != null)
1130 count.Append(participantsCount);
1132 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1133 pPeopleCountLbl->SetText(count);
1134 pPeopleCountLbl->Invalidate(true);
1136 //change AddCall Button status
1137 __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
1138 //change JoinCall Button status
1139 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1144 ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
1147 if(__pActiveCallInfo != null)
1149 delete __pActiveCallInfo;
1150 __pActiveCallInfo = null;
1152 if(__pHeldCallInfo != null)
1154 delete __pHeldCallInfo;
1155 __pHeldCallInfo = null;
1158 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1159 if (pMoreBtn != null)
1161 pMoreBtn->SetShowState(false);
1164 //show caller's info.
1165 for (int index = 0; index < activeCallsList.GetCount(); index++)
1168 AppCallInfo callInfo;
1169 activeCallsList.GetAt(index, callInfo);
1172 if(callInfo.GetContactNumber().IsEmpty() == false)
1174 contactNo.Append(callInfo.GetContactNumber());
1178 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1181 if (callInfo.IsOnHold() == false)
1183 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1184 *__pActiveCallInfo = callInfo;
1186 if (__pActiveCallInfo->IsConferenceCall() == false)
1188 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1191 pVoiceIconLbl->SetShowState(true);
1193 if (pMoreBtn != null)
1195 pMoreBtn->SetShowState(false);
1197 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1198 if(__pMoreOptionsListAnchor != null && __pMoreOptionsListAnchor->GetShowState() == true)
1200 CreateMoreOptionsMenuList();
1205 // show participant count on name Label
1206 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1207 if (pPeopleCountLbl)
1210 count.Append(__pActiveCallInfo->GetCallerListCount());
1212 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1213 pPeopleCountLbl->SetText(count);
1215 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1216 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1219 pNameLbl->SetText(nameStr);
1221 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1224 pVoiceIconLbl->SetShowState(false);
1226 if (pMoreBtn != null)
1228 pMoreBtn->SetShowState(true);
1230 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1231 if (pPhotoBitmap != null)
1233 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER1_PHOTO_LABEL));
1236 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1237 pPhotoLbl->Invalidate(true);
1239 delete pPhotoBitmap;
1242 //show call active time using Timer
1243 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1244 ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime);
1248 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1249 *__pHeldCallInfo = callInfo;
1251 if (__pHeldCallInfo->IsConferenceCall() == false)
1253 ShowPersonDetails(contactNo, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pHeldCallInfo);
1257 // show participant count on name Label
1258 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1259 if (pPeopleCountLbl)
1262 count.Append(__pHeldCallInfo->GetCallerListCount());
1264 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1265 pPeopleCountLbl->SetText(count);
1267 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1268 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1271 pNameLbl->SetText(nameStr);
1273 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1274 if (pPhotoBitmap != null)
1276 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER2_PHOTO_LABEL));
1279 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1280 pPhotoLbl->Invalidate(true);
1282 delete pPhotoBitmap;
1286 ShowTimerInfo(IDC_CALLER2_TIME_LABEL, true);
1290 //update JoinCall button status
1291 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1297 ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
1299 //call individual methods to show contact number, caller name & photo
1300 ShowPhoneNumber(phoneNumber, contactLblName);
1302 //fetch contact details based on phone number
1303 String* pDisplayName = pCallInfo->FetchCallerNameN();
1304 ShowCallerName(*pDisplayName, nameLblName);
1306 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1307 ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
1312 delete pDisplayName;
1313 pDisplayName = null;
1317 delete pPhotoBitmap;
1318 pPhotoBitmap = null;
1323 ActiveCallForm::ShowPhoneNumber(const String& phoneNumber, const String& contactLblName)
1325 String formattedNumber = phoneNumber;
1327 Label* pContactLbl = static_cast<Label*>(GetControl(contactLblName));
1330 pContactLbl->SetText(formattedNumber);
1331 pContactLbl->Invalidate(true);
1336 ActiveCallForm::ShowCallerName(const String& callerName, const String& nameLblName)
1338 // show display name on name Label
1339 Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
1342 //passing an empty string to SetText fails in label,
1343 //if previously valid text has been set
1344 if (callerName.IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
1346 String stringToBeSet(L" ");
1347 pNameLbl->SetText(stringToBeSet);
1351 pNameLbl->SetText(callerName);
1353 pNameLbl->Invalidate(true);
1358 ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
1360 //to check if default image is to be shown
1361 bool showDefaultPhoto = false;
1362 bool showSmallPhoto = false;
1363 String photoLabel("");
1367 case FORMTYPE_OUTGOINGCALL:
1368 case FORMTYPE_ACTIVECALL:
1370 if (pPhotoId == null)
1372 //show default caller image
1373 showDefaultPhoto = true;
1377 //Check the size of photo
1378 // Now checking the condition with && but actually it should be ||
1379 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1380 // height 270 and width = 480 . So all images set thru gallery is show as small image
1381 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1382 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1384 showSmallPhoto = true;
1388 photoLabel.Append(IDC_CALLER1_BIGPHOTO_LABEL);
1392 case FORMTYPE_MULTIPLECALLS:
1396 photoLabel.Append(IDC_CALLER2_PHOTO_LABEL);
1400 photoLabel.Append(IDC_CALLER1_PHOTO_LABEL);
1403 if (pPhotoId == null)
1405 showDefaultPhoto = true;
1409 if (pPhotoId->GetHeight() <= H_SMALL_PHOTO
1410 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1412 //pPhotoId->Scale(Dimension(W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO));
1413 showSmallPhoto = true;
1423 //Remove small photo label
1424 if (__pSmallPhotoLabel != null)
1426 RemoveControl(*__pSmallPhotoLabel);
1427 __pSmallPhotoLabel = null;
1430 //show photo - for Big Photo Id, Animated Call Image
1431 if (!showDefaultPhoto)
1433 if(showSmallPhoto == true)
1435 ShowThumbnailImage(pPhotoId,photoLabel);
1439 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1442 Canvas* pCanvas = new (std::nothrow) Canvas;
1443 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1444 pCanvas->Construct(canvasRect);
1445 //draw the contact bitmap
1446 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1447 Bitmap* pNewPhotoId = new Bitmap();
1448 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1451 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1452 pPhotoLbl->Invalidate(true);
1459 Bitmap* pDefaultPhoto = null;
1462 case FORMTYPE_OUTGOINGCALL:
1463 case FORMTYPE_ACTIVECALL:
1464 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1467 case FORMTYPE_MULTIPLECALLS:
1468 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_MULTIPLE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1471 case FORMTYPE_ACTIVECONFCALL:
1472 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BIG_BG_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1478 if (pDefaultPhoto != null)
1480 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1483 pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
1485 delete pDefaultPhoto;
1491 ActiveCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,String& photoLabel)
1493 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1495 if (pPhotoLbl != null && pPhotoId != null)
1497 Canvas* pCanvas = new (std::nothrow) Canvas;
1498 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1499 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1500 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1501 pCanvas->Construct(canvasRect);
1502 //draw the back ground
1503 pCanvas->DrawBitmap(canvasRect,*pBackground);
1504 //draw shadow (to be enabled after correct shadow image is provided )
1505 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1506 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1507 //draw the contact bitmap
1508 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1509 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1510 Bitmap* pNewPhotoId = new Bitmap();
1511 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1514 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1515 pPhotoLbl->Invalidate(true);
1524 ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1526 if (__pSmallPhotoLabel != null)
1528 RemoveControl(*__pSmallPhotoLabel);
1529 __pSmallPhotoLabel = null;
1531 //Draw Small Photo and show on small photo label
1532 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1533 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1534 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1535 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1536 // Add a Label to the Form
1537 AddControl(*__pSmallPhotoLabel);
1538 __pSmallPhotoLabel->Invalidate(true);
1542 ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long long startTime)
1544 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1546 if (__pActiveCallTimer == null)
1548 __pActiveCallTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
1549 __pActiveCallTimer->Construct(*this);
1552 if (pTimerLbl != null)
1554 if (isOnHold == true)
1556 pTimerLbl->SetText(AppUtility::GetResourceString(IDS_TIMER_ON_HOLD));
1557 //update Hold button status
1558 SetHoldButtonStatus(false);
1562 //update Hold button status
1563 SetHoldButtonStatus(true);
1564 //current system time
1565 long long currTime = 0;
1566 SystemTime::GetTicks(currTime);
1568 TimeSpan diffSpan(abs(startTime - currTime));
1570 String activeCallTime(L"");
1572 long long hr = diffSpan.GetHours();
1575 activeCallTime.Append("0");
1577 activeCallTime.Append(hr);
1578 activeCallTime.Append(L":");
1580 long long min = diffSpan.GetMinutes();
1583 activeCallTime.Append("0");
1585 activeCallTime.Append(min);
1586 activeCallTime.Append(L":");
1588 long long sec = diffSpan.GetSeconds();
1591 activeCallTime.Append("0");
1593 activeCallTime.Append(sec);
1595 pTimerLbl->SetText(activeCallTime);
1596 __pActiveCallTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
1598 pTimerLbl->Invalidate(true);
1603 ActiveCallForm::SetShowStateOnKeypad(bool showState)
1605 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1606 pLblControl->SetShowState(showState);
1607 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL));
1608 pLblControl->SetShowState(showState);
1609 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1610 pLblControl->SetShowState(showState);
1611 if (__pSmallPhotoLabel != null)
1613 __pSmallPhotoLabel->SetShowState(showState);
1618 case FORMTYPE_ACTIVECALL:
1620 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1621 pLblControl->SetShowState(showState);
1622 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1623 pLblControl->SetShowState(showState);
1624 pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1625 pLblControl->SetShowState(showState);
1626 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1627 pButtonControl->SetShowState(showState);
1631 case FORMTYPE_MULTIPLECALLS:
1633 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1634 pLblControl->SetShowState(showState);
1635 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1636 pLblControl->SetShowState(showState);
1637 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1638 pLblControl->SetShowState(showState);
1639 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1640 pLblControl->SetShowState(showState);
1641 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1642 pLblControl->SetShowState(showState);
1643 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1644 pLblControl->SetShowState(showState);
1645 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == false)
1647 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1648 pLblControl->SetShowState(showState);
1652 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1653 pButtonControl->SetShowState(showState);
1655 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1656 pButtonControl->SetShowState(showState);
1660 case FORMTYPE_ACTIVECONFCALL:
1662 pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1663 pLblControl->SetShowState(showState);
1664 pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1665 pLblControl->SetShowState(showState);
1666 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1667 pButtonControl->SetShowState(showState);
1668 pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1669 pButtonControl->SetShowState(showState);
1679 ActiveCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1681 //Call default implementation of "Object.Equals()"
1682 //returns true, if they are pointing to same address.
1683 if (__pActiveCallTimer->Equals(timer))
1685 Label* pTimerLbl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1688 String activeCallTime = pTimerLbl->GetText();
1689 // Create a StringTokenizer instance
1690 StringTokenizer strTokens(activeCallTime, L":");
1692 int count = strTokens.GetTokenCount(); // count == 3
1697 for (int index = 0; index < count; index++)
1702 strTokens.GetNextToken(token);
1703 Integer::Parse(token, hr);
1707 strTokens.GetNextToken(token);
1708 Integer::Parse(token, min);
1712 strTokens.GetNextToken(token);
1713 Integer::Parse(token, sec);
1719 if (sec == IDI_MAX_SECONDS)
1724 if (min == IDI_MAX_MINS)
1731 activeCallTime.Clear();
1734 activeCallTime.Append("0");
1736 activeCallTime.Append(hr);
1737 activeCallTime.Append(":");
1740 activeCallTime.Append("0");
1742 activeCallTime.Append(min);
1743 activeCallTime.Append(":");
1746 activeCallTime.Append("0");
1748 activeCallTime.Append(sec);
1749 //update timer label
1750 pTimerLbl->SetText(activeCallTime);
1751 pTimerLbl->Invalidate(true);
1756 ///////////////////////////////////////////////////////////
1757 /////////// Options Menu List Functionality /////////
1758 ///////////////////////////////////////////////////////////
1760 ActiveCallForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
1765 ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
1767 //Goto conference call list form
1768 SceneManager* pSceneManager = SceneManager::GetInstance();
1769 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST), null);
1773 ActiveCallForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
1778 ActiveCallForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
1783 ActiveCallForm::GetItemCount(void)
1785 return IDI_MOREOPTIONS_LIST_ITEMS;
1789 ActiveCallForm::CreateItem(int index, int itemWidth)
1791 //create 1st Menu option
1792 CustomItem* pItem = new (std::nothrow) CustomItem();
1793 pItem->Construct(IDI_OPTIONMENU_DIMEN, LIST_ANNEX_STYLE_NORMAL);
1795 //Set background 9-patch bitmap to option menu
1796 Bitmap* pBgBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_BG_ICON);
1797 if (pBgBmp != null && pBgBmp->IsNinePatchedBitmap())
1800 bgCanvas.Construct(Rectangle(IDI_OPTIONMENU_POS, IDI_OPTIONMENU_DIMEN));
1801 bgCanvas.DrawNinePatchedBitmap(bgCanvas.GetBounds(), *pBgBmp);
1805 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color(40, 45, 48));
1810 //Set bitmap to option menu
1811 Bitmap* pNormalConfCallBmp = AppUtility::GetBitmapFromResourcesN(IDB_MORE_MANAGE_CONFERENCE_ICON ,
1812 W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP);
1813 pItem->AddElement(Rectangle(16, 17, W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP), 1, *pNormalConfCallBmp, null, null);
1814 // Deallocate bitmaps
1815 delete pNormalConfCallBmp;
1816 pNormalConfCallBmp = null;
1818 //Set text to menu option
1819 String confCallName = AppUtility::GetResourceString(IDS_MGR_CONF_CALL_LIST_STR);
1821 TextElement* pTextElement = new (std::nothrow) TextElement();
1822 pTextElement->Construct(confCallName);
1823 pTextElement->SetTextColor(COLOR_POPUP_TEXT);
1826 font.Construct(FONT_STYLE_PLAIN, IDI_POPUP_TEXT_SIZE);
1827 pTextElement->SetFont(font);
1828 //construct Enriched text
1829 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1830 FloatDimension textDimension;
1831 font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
1832 textDimension.height = textDimension.height + font.GetDescender();
1833 pEnrichedText->Construct(textDimension);
1834 //add text element to enriched text
1835 pEnrichedText->Add(*pTextElement);
1837 //Add Enriched text to pItem
1838 FloatPoint textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
1839 pItem->AddElement(FloatRectangle(textPos, textDimension), 2, *pEnrichedText);
1841 pEnrichedText->RemoveAll(true);
1842 delete pEnrichedText;
1847 ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)