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);
333 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
334 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_TOP_TO_TOP);
341 ActiveCallForm::InitializeSwapButton(void)
343 Button* pSwapBtn = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
346 Bitmap* pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_NORMAL,
347 W_HOLD_BITMAP, H_HOLD_BITMAP);
350 pSwapBtn->SetNormalBitmap(Point(0, 0), *pSwapBmp);
355 pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_PRESS,
356 W_HOLD_BITMAP, H_HOLD_BITMAP);
359 pSwapBtn->SetPressedBitmap(Point(0, 0), *pSwapBmp);
363 pSwapBtn->SetActionId(IDA_SWAP_CALLS);
364 pSwapBtn->AddActionEventListener(*this);
369 ActiveCallForm::InitializeManageConfCallButton(void)
371 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
372 if (pMoreBtn != null)
374 pMoreBtn->SetActionId(IDA_MORE_OPTIONS_MENU);
375 pMoreBtn->AddActionEventListener(*this);
376 if (__formType == FORMTYPE_MULTIPLECALLS)
378 //Correct state will be set in OnSceneActivated based on the call
379 pMoreBtn->SetShowState(false);
381 else if (__formType == FORMTYPE_ACTIVECONFCALL)
383 pMoreBtn->SetShowState(true);
389 ActiveCallForm::InitializeHoldButton(void)
391 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
392 if (pHoldBtn != null)
394 //set status of Hold Button
395 SetHoldButtonStatus(true);
396 pHoldBtn->AddActionEventListener(*this);
401 ActiveCallForm::SetHoldButtonStatus(bool toHoldCall)
403 //background bitmap & button name
405 Bitmap* normalImg = null;
406 Bitmap* pressImg = null;
409 btnName.Append(AppUtility::GetResourceString(IDS_HOLD_BTN_NAME));
410 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_NORMAL_BUTTON_ICON,
411 W_HOLD_BITMAP, H_HOLD_BITMAP);
412 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_PRESS_BUTTON_ICON,
413 W_HOLD_BITMAP, H_HOLD_BITMAP);
417 btnName.Append(AppUtility::GetResourceString(IDS_UNHOLD_BTN_NAME));
418 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_NORMAL_BUTTON_ICON,
419 W_HOLD_BITMAP, H_HOLD_BITMAP);
420 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_PRESS_BUTTON_ICON,
421 W_HOLD_BITMAP, H_HOLD_BITMAP);
425 CommandIds cmdId = IDA_HOLD_CALL;
428 case FORMTYPE_ACTIVECALL:
430 cmdId = toHoldCall ? IDA_HOLD_CALL : IDA_UNHOLD_CALL;
434 case FORMTYPE_ACTIVECONFCALL:
436 cmdId = toHoldCall ? IDA_HOLD_CONF_CALL : IDA_UNHOLD_CONF_CALL;
444 //set background bitmap, button name & action id
445 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
446 Label* pHoldLbl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
449 pHoldBtn->SetActionId(cmdId);
450 pHoldBtn->SetNormalBitmap(Point(0, 0),*normalImg);
451 pHoldBtn->SetPressedBitmap(Point(0, 0),*pressImg);
455 pHoldLbl->SetText(btnName);
456 pHoldLbl->Invalidate(true);
467 ActiveCallForm::CreateMoreOptionsMenuList(void)
469 //create option list anchor
470 if (__pMoreOptionsListAnchor == null)
472 Bitmap* pBgPopupArwBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_ARROW_ICON, W_OPTION_ANCHOR,
474 __pMoreOptionsListAnchor = new (std::nothrow) Label();
475 __pMoreOptionsListAnchor->Construct(Rectangle(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_ICON, Y_POPUP_ANCHOR, W_POPUP_ANCHOR, H_POPUP_ANCHOR), L"");
476 __pMoreOptionsListAnchor->SetBackgroundBitmap(*pBgPopupArwBmp);
478 delete pBgPopupArwBmp;
479 pBgPopupArwBmp = null;
481 // Adds a Label to the Form
482 AddControl(*__pMoreOptionsListAnchor);
485 //create options menu list
486 if (__pMoreOptionsList == null)
488 __pMoreOptionsList = new (std::nothrow) ListView();
489 __pMoreOptionsList->Construct(Rectangle(Point(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_LABEL,H_MORE_LABEL), IDI_OPTIONMENU_DIMEN), false, SCROLL_STYLE_FADE_OUT);
490 __pMoreOptionsList->SetItemProvider(*this);
491 __pMoreOptionsList->AddListViewItemEventListener(*this);
492 //Add option list to the form
493 AddControl(*__pMoreOptionsList);
497 //Hide option menu list
498 DestroyMoreOptionsMenuList();
503 ActiveCallForm::DestroyMoreOptionsMenuList(void)
505 if (__pMoreOptionsListAnchor != null)
507 //removes and delete the child control
508 RemoveControl(*__pMoreOptionsListAnchor);
509 __pMoreOptionsListAnchor = null;
512 if (__pMoreOptionsList != null)
514 //removes and delete the child control
515 RemoveControl(*__pMoreOptionsList);
516 __pMoreOptionsList = null;
521 ActiveCallForm::OnTerminating(void)
523 result r = E_SUCCESS;
524 if (__pCallPresentor != null)
526 __pCallPresentor = null;
532 ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
540 //End the currently active / dialing call
541 if (__pActiveCallInfo->IsConferenceCall() == false)
543 String activeContactNo;
544 activeContactNo.Append(__pActiveCallInfo->GetContactNumber());
545 //Check if it is call is in dialing state, then
546 if (__formType == FORMTYPE_EMERGENCYOUTGOINGCALL || __formType == FORMTYPE_OUTGOINGCALL)
548 __pCallPresentor->EndDialingCall(activeContactNo);
553 __pCallPresentor->EndActiveCall(*__pActiveCallInfo->GetCallHandle());
558 __pCallPresentor->EndConferenceCall();
563 case IDA_END_CONF_CALL:
565 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
566 __pCallPresentor->EndConferenceCall();
570 case IDA_OPEN_NUMKEYPAD:
572 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT)
574 //hide only in portrait mode.
575 SetShowStateOnKeypad(false);
578 __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
582 case IDA_CLOSE_NUMKEYPAD:
584 SetShowStateOnKeypad(true);
586 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
592 //switch to Dialer Form to make an call
593 if(__pCallPresentor->GetCurrentCallCount() == 1)
595 /* ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
597 String* formType = new (std::nothrow) String();
598 formType->Append(__formType);
599 pArgs->Add(formType);
600 pSceneManager->GoForward( ForwardSceneTransition(IDSCN_DIALER, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
601 SCENE_HISTORY_OPTION_NO_HISTORY), pArgs);*/
602 __pCallPresentor->LaunchDialAppControl();
611 if (__pActiveCallInfo->IsConferenceCall() == false)
613 if(__pActiveCallInfo->GetCallHandle() != null)
615 success = __pCallPresentor->HoldCall(*__pActiveCallInfo->GetCallHandle());
620 success = __pCallPresentor->HoldConferenceCall();
622 //reset hold status and "OnHold" text
623 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
624 if(__pActiveCallTimer != null)
626 __pActiveCallTimer->Cancel();
628 SetHoldButtonStatus(!success);
632 case IDA_UNHOLD_CALL:
634 bool success = false;
635 if (__pActiveCallInfo->IsConferenceCall() == false)
637 if(__pActiveCallInfo->GetCallHandle() != null)
639 success = __pCallPresentor->UnHoldCall(*__pActiveCallInfo->GetCallHandle());
644 success = __pCallPresentor->ActivateConferenceCall();
646 //reset hold status and show call timer
647 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
648 SetHoldButtonStatus(success);
652 case IDA_HOLD_CONF_CALL:
654 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
655 bool success = __pCallPresentor->HoldConferenceCall();
656 //reset hold status and "OnHold" text
657 SetHoldButtonStatus(!success);
658 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
659 if(__pActiveCallTimer != null)
661 __pActiveCallTimer->Cancel();
666 case IDA_UNHOLD_CONF_CALL:
668 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
669 bool success = __pCallPresentor->ActivateConferenceCall();
670 //reset hold status and show call timer
671 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
672 SetHoldButtonStatus(success);
676 case IDA_OPEN_CONTACTS:
679 //Launch call application
680 AppManager* pAppManager = AppManager::GetInstance();
681 pAppManager->LaunchApplication(PROVIDER_ID_CONTACTS);
687 bool success = __pCallPresentor->SetMuteStatus(true);
690 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
697 bool success = __pCallPresentor->SetMuteStatus(false);
700 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
707 bool success = __pCallPresentor->SetSpeakerStatus(true);
710 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
715 case IDA_SPEAKER_OFF:
717 bool success = __pCallPresentor->SetSpeakerStatus(false);
720 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
727 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
728 __pCallPresentor->JoinCall();
734 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
735 __pCallPresentor->SwapCalls();
739 case IDA_MORE_OPTIONS_MENU:
741 //Show 'more' options menu
742 CreateMoreOptionsMenuList();
748 dtmfString.Append(L"0");
749 SetTextToDTMFTextField(dtmfString);
750 __pCallPresentor->SendDTMFSignal(dtmfString);
756 dtmfString.Append(L"1");
757 SetTextToDTMFTextField(dtmfString);
758 __pCallPresentor->SendDTMFSignal(dtmfString);
764 dtmfString.Append(L"2");
765 SetTextToDTMFTextField(dtmfString);
766 __pCallPresentor->SendDTMFSignal(dtmfString);
772 dtmfString.Append(L"3");
773 SetTextToDTMFTextField(dtmfString);
774 __pCallPresentor->SendDTMFSignal(dtmfString);
780 dtmfString.Append(L"4");
781 SetTextToDTMFTextField(dtmfString);
782 __pCallPresentor->SendDTMFSignal(dtmfString);
788 dtmfString.Append(L"5");
789 SetTextToDTMFTextField(dtmfString);
790 __pCallPresentor->SendDTMFSignal(dtmfString);
796 dtmfString.Append(L"6");
797 SetTextToDTMFTextField(dtmfString);
798 __pCallPresentor->SendDTMFSignal(dtmfString);
804 dtmfString.Append(L"7");
805 SetTextToDTMFTextField(dtmfString);
806 __pCallPresentor->SendDTMFSignal(dtmfString);
812 dtmfString.Append(L"8");
813 SetTextToDTMFTextField(dtmfString);
814 __pCallPresentor->SendDTMFSignal(dtmfString);
820 dtmfString.Append(L"9");
821 SetTextToDTMFTextField(dtmfString);
822 __pCallPresentor->SendDTMFSignal(dtmfString);
828 dtmfString.Append(L"*");
829 SetTextToDTMFTextField(dtmfString);
830 __pCallPresentor->SendDTMFSignal(dtmfString);
836 dtmfString.Append(L"#");
837 SetTextToDTMFTextField(dtmfString);
838 __pCallPresentor->SendDTMFSignal(dtmfString);
848 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
850 if(__pDTMFKeypad != null)
852 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
854 int startpos=-1,endpos=-1;
855 pTextBox->GetBlockRange(startpos,endpos);
859 pTextBox->ReleaseBlock();
862 pTextBox->InsertTextAtCursorPosition(dtmfStr);
863 //pTextBox->AppendText(dtmfStr);
864 pTextBox->SetFocus();
865 pTextBox->Invalidate(true);
870 ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
873 //set itself as listener
874 __pCallPresentor->SetTelEventListener(this);
875 AddOrientationEventListener(*this);
877 //Initialize keypad and buttons
878 InitializeCallButtonsPanel();
880 if (__pActiveCallInfo != null)
882 delete __pActiveCallInfo;
883 __pActiveCallInfo = null;
885 if (__pHeldCallInfo != null)
887 delete __pHeldCallInfo;
888 __pHeldCallInfo = null;
890 DestroyMoreOptionsMenuList();
894 case FORMTYPE_OUTGOINGCALL:
897 contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
898 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
899 __pActiveCallInfo->SetContactNumber(contactNo);
900 Contact* pContact = __pCallPresentor->GetContactN(contactNo);
901 if (pContact != null)
903 __pActiveCallInfo->SetContactInfo(*pContact);
906 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
907 //make an normal outgoing call
908 __pCallPresentor->DialCall(contactNo, false);
912 case FORMTYPE_EMERGENCYOUTGOINGCALL:
914 String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
915 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
916 long long phNumber = 0;
917 LongLong::Parse(*pContactNo, phNumber);
918 __pActiveCallInfo->SetContactNumber(*pContactNo);
919 //make an emergency call
920 __pCallPresentor->DialCall(*pContactNo, true);
924 case FORMTYPE_ACTIVECALL:
927 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
929 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
930 *__pActiveCallInfo = *pCall;
931 String activeContactNo;
932 if(pCall->GetContactNumber().IsEmpty() == false)
934 activeContactNo.Append(pCall->GetContactNumber());
938 activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
940 ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
942 //show call active time using Timer
943 __activeCallStartTime = pCall->GetCallConnectTime();
944 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
948 case FORMTYPE_EMERGENCYACTIVECALL:
951 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
953 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
954 *__pActiveCallInfo = *pCall;
956 //show call active time using Timer
957 __activeCallStartTime = pCall->GetCallConnectTime();
958 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
962 case FORMTYPE_MULTIPLECALLS:
964 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
966 UpdateMultipleCallScreen(*pCallsList);
972 case FORMTYPE_ACTIVECONFCALL:
975 AppCallInfo* pConfInfo = static_cast<AppCallInfo*>(pArgs->GetAt(0));
976 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
977 *__pActiveCallInfo = *pConfInfo;
979 int participantsCount = __pActiveCallInfo->GetCallerListCount();
981 // show participant count on name Label
982 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
986 count.Append(participantsCount);
988 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
989 pPeopleCountLbl->SetText(count);
992 if(participantsCount >= IDI_MAX_CONF_CALL_PARTICIPANTS)
994 __pCallButtonsPanel->EnableAddCallButton(false);
998 __pCallButtonsPanel->EnableAddCallButton(true);
1001 //show call active time using Timer
1002 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1003 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime);
1011 //Hide DTMFKeypad, if visible and show caller info
1013 SetShowStateOnKeypad(true);
1014 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
1016 //Set the correct speaker status
1017 if(__pCallPresentor->IsSpeakerOn() == true)
1019 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
1023 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
1026 //Set the correct Mute status
1027 if (__pCallPresentor->IsCallMuted() == true)
1029 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
1033 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
1045 ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1047 RemoveOrientationEventListener(*this);
1048 if (__pCallButtonsPanel != null)
1050 RemoveControl(*__pCallButtonsPanel);
1051 __pCallButtonsPanel = null;
1053 if (__pActiveCallTimer != null)
1055 __pActiveCallTimer->Cancel();
1056 delete __pActiveCallTimer;
1057 __pActiveCallTimer = null;
1059 if (__pSmallPhotoLabel != null)
1061 __pSmallPhotoLabel->SetShowState(false);
1063 //Hide "Manage conf. Call" Context menu
1064 if (__pMoreOptionsListAnchor != null)
1066 __pMoreOptionsListAnchor->SetShowState(false);
1068 if (__pMoreOptionsList != null)
1070 __pMoreOptionsList->SetShowState(false);
1072 __DtmfString.Clear();
1076 ActiveCallForm::HandleConfCallChanged(void)
1079 AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
1080 //fetch changed conference call info
1081 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1082 if (pConfCallInfo == null)
1088 //fetch participant count in conf call
1089 int participantsCount = pConfCallInfo->GetCallerListCount();
1090 //update status of join and Add call
1091 bool isEnableAddCall = false;
1092 bool isEnableJoinCall = false;
1093 if(participantsCount < IDI_MAX_CONF_CALL_PARTICIPANTS)
1095 //available only at Active conf. call or active call screen
1096 isEnableAddCall = true;
1097 //join button is available only at multiple call screen
1098 isEnableJoinCall = true;
1101 Label* pPeopleCountLbl = null;
1102 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == true)
1104 //Active call is conference call
1105 delete __pActiveCallInfo;
1106 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1107 *__pActiveCallInfo = *pConfCallInfo;
1109 if (__formType == FORMTYPE_MULTIPLECALLS)
1111 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1113 else if (__formType == FORMTYPE_ACTIVECONFCALL)
1115 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1116 AppLog("Active conf call...(%d)", pPeopleCountLbl);
1119 else if(__pHeldCallInfo != null && __pHeldCallInfo->IsConferenceCall() == true)
1121 //Held call is conference call - this is definitely multiple call screen.
1122 delete __pHeldCallInfo;
1123 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1124 *__pHeldCallInfo = *pConfCallInfo;
1125 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1128 // update participant count on name Label
1129 if (pPeopleCountLbl != null)
1132 count.Append(participantsCount);
1134 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1135 pPeopleCountLbl->SetText(count);
1136 pPeopleCountLbl->Invalidate(true);
1138 //change AddCall Button status
1139 __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
1140 //change JoinCall Button status
1141 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1146 ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
1149 if(__pActiveCallInfo != null)
1151 delete __pActiveCallInfo;
1152 __pActiveCallInfo = null;
1154 if(__pHeldCallInfo != null)
1156 delete __pHeldCallInfo;
1157 __pHeldCallInfo = null;
1160 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1161 if (pMoreBtn != null)
1163 pMoreBtn->SetShowState(false);
1166 //show caller's info.
1167 for (int index = 0; index < activeCallsList.GetCount(); index++)
1170 AppCallInfo callInfo;
1171 activeCallsList.GetAt(index, callInfo);
1174 if(callInfo.GetContactNumber().IsEmpty() == false)
1176 contactNo.Append(callInfo.GetContactNumber());
1180 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1183 if (callInfo.IsOnHold() == false)
1185 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1186 *__pActiveCallInfo = callInfo;
1188 if (__pActiveCallInfo->IsConferenceCall() == false)
1190 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1193 pVoiceIconLbl->SetShowState(true);
1195 if (pMoreBtn != null)
1197 pMoreBtn->SetShowState(false);
1199 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1200 if(__pMoreOptionsListAnchor != null && __pMoreOptionsListAnchor->GetShowState() == true)
1202 CreateMoreOptionsMenuList();
1207 // show participant count on name Label
1208 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1209 if (pPeopleCountLbl)
1212 count.Append(__pActiveCallInfo->GetCallerListCount());
1214 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1215 pPeopleCountLbl->SetText(count);
1217 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1218 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1221 pNameLbl->SetText(nameStr);
1223 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1226 pVoiceIconLbl->SetShowState(false);
1228 if (pMoreBtn != null)
1230 pMoreBtn->SetShowState(true);
1232 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1233 if (pPhotoBitmap != null)
1235 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER1_PHOTO_LABEL));
1238 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1239 pPhotoLbl->Invalidate(true);
1241 delete pPhotoBitmap;
1244 //show call active time using Timer
1245 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1246 ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime);
1250 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1251 *__pHeldCallInfo = callInfo;
1253 if (__pHeldCallInfo->IsConferenceCall() == false)
1255 ShowPersonDetails(contactNo, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pHeldCallInfo);
1259 // show participant count on name Label
1260 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1261 if (pPeopleCountLbl)
1264 count.Append(__pHeldCallInfo->GetCallerListCount());
1266 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1267 pPeopleCountLbl->SetText(count);
1269 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1270 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1273 pNameLbl->SetText(nameStr);
1275 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1276 if (pPhotoBitmap != null)
1278 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER2_PHOTO_LABEL));
1281 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1282 pPhotoLbl->Invalidate(true);
1284 delete pPhotoBitmap;
1288 ShowTimerInfo(IDC_CALLER2_TIME_LABEL, true);
1292 //update JoinCall button status
1293 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1299 ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
1301 //call individual methods to show contact number, caller name & photo
1302 ShowPhoneNumber(phoneNumber, contactLblName);
1304 //fetch contact details based on phone number
1305 String* pDisplayName = pCallInfo->FetchCallerNameN();
1306 ShowCallerName(*pDisplayName, nameLblName);
1308 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1309 ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
1314 delete pDisplayName;
1315 pDisplayName = null;
1319 delete pPhotoBitmap;
1320 pPhotoBitmap = null;
1325 ActiveCallForm::ShowPhoneNumber(const String& phoneNumber, const String& contactLblName)
1327 String formattedNumber = phoneNumber;
1329 Label* pContactLbl = static_cast<Label*>(GetControl(contactLblName));
1332 pContactLbl->SetText(formattedNumber);
1333 pContactLbl->Invalidate(true);
1338 ActiveCallForm::ShowCallerName(const String& callerName, const String& nameLblName)
1340 // show display name on name Label
1341 Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
1344 //passing an empty string to SetText fails in label,
1345 //if previously valid text has been set
1346 if (callerName.IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
1348 String stringToBeSet(L" ");
1349 pNameLbl->SetText(stringToBeSet);
1353 pNameLbl->SetText(callerName);
1355 pNameLbl->Invalidate(true);
1360 ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
1362 //to check if default image is to be shown
1363 bool showDefaultPhoto = false;
1364 bool showSmallPhoto = false;
1365 String photoLabel("");
1369 case FORMTYPE_OUTGOINGCALL:
1370 case FORMTYPE_ACTIVECALL:
1372 if (pPhotoId == null)
1374 //show default caller image
1375 showDefaultPhoto = true;
1379 //Check the size of photo
1380 // Now checking the condition with && but actually it should be ||
1381 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1382 // height 270 and width = 480 . So all images set thru gallery is show as small image
1383 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1384 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1386 showSmallPhoto = true;
1390 photoLabel.Append(IDC_CALLER1_BIGPHOTO_LABEL);
1394 case FORMTYPE_MULTIPLECALLS:
1398 photoLabel.Append(IDC_CALLER2_PHOTO_LABEL);
1402 photoLabel.Append(IDC_CALLER1_PHOTO_LABEL);
1405 if (pPhotoId == null)
1407 showDefaultPhoto = true;
1411 if (pPhotoId->GetHeight() <= H_SMALL_PHOTO
1412 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1414 //pPhotoId->Scale(Dimension(W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO));
1415 showSmallPhoto = true;
1425 //Remove small photo label
1426 if (__pSmallPhotoLabel != null)
1428 RemoveControl(*__pSmallPhotoLabel);
1429 __pSmallPhotoLabel = null;
1432 //show photo - for Big Photo Id, Animated Call Image
1433 if (!showDefaultPhoto)
1435 if(showSmallPhoto == true)
1437 ShowThumbnailImage(pPhotoId,photoLabel);
1441 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1444 Canvas* pCanvas = new (std::nothrow) Canvas;
1445 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1446 pCanvas->Construct(canvasRect);
1447 //draw the contact bitmap
1448 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1449 Bitmap* pNewPhotoId = new Bitmap();
1450 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1453 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1454 pPhotoLbl->Invalidate(true);
1461 Bitmap* pDefaultPhoto = null;
1464 case FORMTYPE_OUTGOINGCALL:
1465 case FORMTYPE_ACTIVECALL:
1466 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1469 case FORMTYPE_MULTIPLECALLS:
1470 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_MULTIPLE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1473 case FORMTYPE_ACTIVECONFCALL:
1474 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BIG_BG_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1480 if (pDefaultPhoto != null)
1482 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1485 pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
1487 delete pDefaultPhoto;
1493 ActiveCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,String& photoLabel)
1495 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1497 if (pPhotoLbl != null && pPhotoId != null)
1499 Canvas* pCanvas = new (std::nothrow) Canvas;
1500 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1501 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1502 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1503 pCanvas->Construct(canvasRect);
1504 //draw the back ground
1505 pCanvas->DrawBitmap(canvasRect,*pBackground);
1506 //draw shadow (to be enabled after correct shadow image is provided )
1507 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1508 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1509 //draw the contact bitmap
1510 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1511 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1512 Bitmap* pNewPhotoId = new Bitmap();
1513 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1516 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1517 pPhotoLbl->Invalidate(true);
1526 ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1528 if (__pSmallPhotoLabel != null)
1530 RemoveControl(*__pSmallPhotoLabel);
1531 __pSmallPhotoLabel = null;
1533 //Draw Small Photo and show on small photo label
1534 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1535 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1536 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1537 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1538 // Add a Label to the Form
1539 AddControl(*__pSmallPhotoLabel);
1540 __pSmallPhotoLabel->Invalidate(true);
1544 ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long long startTime)
1546 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1548 if (__pActiveCallTimer == null)
1550 __pActiveCallTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
1551 __pActiveCallTimer->Construct(*this);
1554 if (pTimerLbl != null)
1556 if (isOnHold == true)
1558 pTimerLbl->SetText(AppUtility::GetResourceString(IDS_TIMER_ON_HOLD));
1559 //update Hold button status
1560 SetHoldButtonStatus(false);
1564 //update Hold button status
1565 SetHoldButtonStatus(true);
1566 //current system time
1567 long long currTime = 0;
1568 SystemTime::GetTicks(currTime);
1570 TimeSpan diffSpan(abs(startTime - currTime));
1572 String activeCallTime(L"");
1574 long long hr = diffSpan.GetHours();
1577 activeCallTime.Append("0");
1579 activeCallTime.Append(hr);
1580 activeCallTime.Append(L":");
1582 long long min = diffSpan.GetMinutes();
1585 activeCallTime.Append("0");
1587 activeCallTime.Append(min);
1588 activeCallTime.Append(L":");
1590 long long sec = diffSpan.GetSeconds();
1593 activeCallTime.Append("0");
1595 activeCallTime.Append(sec);
1597 pTimerLbl->SetText(activeCallTime);
1598 __pActiveCallTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
1600 pTimerLbl->Invalidate(true);
1605 ActiveCallForm::SetShowStateOnKeypad(bool showState)
1607 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1608 pLblControl->SetShowState(showState);
1609 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL));
1610 pLblControl->SetShowState(showState);
1611 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1612 pLblControl->SetShowState(showState);
1613 if (__pSmallPhotoLabel != null)
1615 __pSmallPhotoLabel->SetShowState(showState);
1620 case FORMTYPE_ACTIVECALL:
1622 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1623 pLblControl->SetShowState(showState);
1624 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1625 pLblControl->SetShowState(showState);
1626 pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1627 pLblControl->SetShowState(showState);
1628 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1629 pButtonControl->SetShowState(showState);
1633 case FORMTYPE_MULTIPLECALLS:
1635 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1636 pLblControl->SetShowState(showState);
1637 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1638 pLblControl->SetShowState(showState);
1639 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1640 pLblControl->SetShowState(showState);
1641 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1642 pLblControl->SetShowState(showState);
1643 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1644 pLblControl->SetShowState(showState);
1645 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1646 pLblControl->SetShowState(showState);
1647 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == false)
1649 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1650 pLblControl->SetShowState(showState);
1654 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1655 pButtonControl->SetShowState(showState);
1657 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1658 pButtonControl->SetShowState(showState);
1662 case FORMTYPE_ACTIVECONFCALL:
1664 pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1665 pLblControl->SetShowState(showState);
1666 pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1667 pLblControl->SetShowState(showState);
1668 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1669 pButtonControl->SetShowState(showState);
1670 pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1671 pButtonControl->SetShowState(showState);
1681 ActiveCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1683 //Call default implementation of "Object.Equals()"
1684 //returns true, if they are pointing to same address.
1685 if (__pActiveCallTimer->Equals(timer))
1687 Label* pTimerLbl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1690 String activeCallTime = pTimerLbl->GetText();
1691 // Create a StringTokenizer instance
1692 StringTokenizer strTokens(activeCallTime, L":");
1694 int count = strTokens.GetTokenCount(); // count == 3
1699 for (int index = 0; index < count; index++)
1704 strTokens.GetNextToken(token);
1705 Integer::Parse(token, hr);
1709 strTokens.GetNextToken(token);
1710 Integer::Parse(token, min);
1714 strTokens.GetNextToken(token);
1715 Integer::Parse(token, sec);
1721 if (sec == IDI_MAX_SECONDS)
1726 if (min == IDI_MAX_MINS)
1733 activeCallTime.Clear();
1736 activeCallTime.Append("0");
1738 activeCallTime.Append(hr);
1739 activeCallTime.Append(":");
1742 activeCallTime.Append("0");
1744 activeCallTime.Append(min);
1745 activeCallTime.Append(":");
1748 activeCallTime.Append("0");
1750 activeCallTime.Append(sec);
1751 //update timer label
1752 pTimerLbl->SetText(activeCallTime);
1753 pTimerLbl->Invalidate(true);
1758 ///////////////////////////////////////////////////////////
1759 /////////// Options Menu List Functionality /////////
1760 ///////////////////////////////////////////////////////////
1762 ActiveCallForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
1767 ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
1769 //Goto conference call list form
1770 SceneManager* pSceneManager = SceneManager::GetInstance();
1771 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST), null);
1775 ActiveCallForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
1780 ActiveCallForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
1785 ActiveCallForm::GetItemCount(void)
1787 return IDI_MOREOPTIONS_LIST_ITEMS;
1791 ActiveCallForm::CreateItem(int index, int itemWidth)
1793 //create 1st Menu option
1794 CustomItem* pItem = new (std::nothrow) CustomItem();
1795 pItem->Construct(IDI_OPTIONMENU_DIMEN, LIST_ANNEX_STYLE_NORMAL);
1797 //Set background 9-patch bitmap to option menu
1798 Bitmap* pBgBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_BG_ICON);
1799 if (pBgBmp != null && pBgBmp->IsNinePatchedBitmap())
1802 bgCanvas.Construct(Rectangle(IDI_OPTIONMENU_POS, IDI_OPTIONMENU_DIMEN));
1803 bgCanvas.DrawNinePatchedBitmap(bgCanvas.GetBounds(), *pBgBmp);
1807 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color(40, 45, 48));
1812 //Set bitmap to option menu
1813 Bitmap* pNormalConfCallBmp = AppUtility::GetBitmapFromResourcesN(IDB_MORE_MANAGE_CONFERENCE_ICON ,
1814 W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP);
1815 pItem->AddElement(Rectangle(16, 17, W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP), 1, *pNormalConfCallBmp, null, null);
1816 // Deallocate bitmaps
1817 delete pNormalConfCallBmp;
1818 pNormalConfCallBmp = null;
1820 //Set text to menu option
1821 String confCallName = AppUtility::GetResourceString(IDS_MGR_CONF_CALL_LIST_STR);
1823 TextElement* pTextElement = new (std::nothrow) TextElement();
1824 pTextElement->Construct(confCallName);
1825 pTextElement->SetTextColor(COLOR_POPUP_TEXT);
1828 font.Construct(FONT_STYLE_PLAIN, IDI_POPUP_TEXT_SIZE);
1829 pTextElement->SetFont(font);
1830 //construct Enriched text
1831 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1832 FloatDimension textDimension;
1833 font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
1834 textDimension.height = textDimension.height + font.GetDescender();
1835 pEnrichedText->Construct(textDimension);
1836 //add text element to enriched text
1837 pEnrichedText->Add(*pTextElement);
1839 //Add Enriched text to pItem
1840 FloatPoint textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
1841 pItem->AddElement(FloatRectangle(textPos, textDimension), 2, *pEnrichedText);
1843 pEnrichedText->RemoveAll(true);
1844 delete pEnrichedText;
1849 ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)