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)
199 if(__pDTMFKeypad == null)
201 //update rect according to client screen area
202 Rectangle rect(0, 0, 0, 0);
203 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT)
205 rect.width = GetClientAreaBounds().width;
206 rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight();
208 else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE)
210 rect.height = GetClientAreaBounds().height;
211 rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth();
214 AppLog("DTMF Keypad rect(%d,%d,%d,%d)",rect.x,rect.y,rect.width,rect.height);
215 __pDTMFKeypad = new (std::nothrow) DtmfKeyPadPanel();
216 __pDTMFKeypad->Initialize(this, rect);
217 AddControl(*__pDTMFKeypad);
219 //set layout relation w.r.t call buttons panel
220 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
221 if (pRelativeLayout != null)
223 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
224 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
227 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
228 __pDTMFKeypad->SetShowState(true);
229 __pDTMFKeypad->Draw(true);
230 __pDTMFKeypad->Show();
234 ActiveCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
238 if (__pCallButtonsPanel != null)
240 //update position of call buttons panel
241 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
242 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
244 //bring button on top
245 __pCallButtonsPanel->SetButtonPosition();
247 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
248 if (pRelativeLayout != null)
250 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
253 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
254 if (pRelativeLayout != null)
256 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
257 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
260 //change orientation of DTMF Keypad, if it is visible.
261 if (__pDTMFKeypad != null)
263 if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE)
265 //in landscape mode, caller info is visible.
266 SetShowStateOnKeypad(true);
268 else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT)
270 //in Portrait mode it is hidden beneath DTMF Keypad.
271 SetShowStateOnKeypad(false);
273 String dtmfText = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
276 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
277 pTextBox->SetText(dtmfText);
280 //More option is displayed recreate it
281 if(__pMoreOptionsListAnchor != null)
283 CreateMoreOptionsMenuList();
284 CreateMoreOptionsMenuList();
289 ActiveCallForm::HideDTMFKeypad(void)
291 if(__pDTMFKeypad != null)
293 __pDTMFKeypad->SetShowState(false);
294 __pDTMFKeypad->Draw(true);
295 __pDTMFKeypad->Show();
300 ActiveCallForm::InitializeCallButtonsPanel(void)
302 result r = E_SUCCESS;
303 //Set background bitmap for call keypad
304 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
305 Bitmap* pBgBitmap = AppUtility::GetBitmapFromResourcesN(IDB_BACKGROUND_BITMAP, pKeysBgLbl->GetWidth(), pKeysBgLbl->GetHeight());
306 if (pBgBitmap != null)
308 pKeysBgLbl->SetBackgroundBitmap(*pBgBitmap);
311 if (__pCallButtonsPanel == null)
313 __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
314 __pCallButtonsPanel->ConstructPanel(this, __formType);
315 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
316 r = AddControl(*__pCallButtonsPanel);
319 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
320 if (pRelativeLayout != null)
322 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
324 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
325 if (pRelativeLayout != null)
327 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
328 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
335 ActiveCallForm::InitializeSwapButton(void)
337 Button* pSwapBtn = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
340 Bitmap* pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_NORMAL,
341 W_HOLD_BITMAP, H_HOLD_BITMAP);
344 pSwapBtn->SetNormalBitmap(Point(0, 0), *pSwapBmp);
349 pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_PRESS,
350 W_HOLD_BITMAP, H_HOLD_BITMAP);
353 pSwapBtn->SetPressedBitmap(Point(0, 0), *pSwapBmp);
357 pSwapBtn->SetActionId(IDA_SWAP_CALLS);
358 pSwapBtn->AddActionEventListener(*this);
363 ActiveCallForm::InitializeManageConfCallButton(void)
365 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
366 if (pMoreBtn != null)
368 pMoreBtn->SetActionId(IDA_MORE_OPTIONS_MENU);
369 pMoreBtn->AddActionEventListener(*this);
370 if (__formType == FORMTYPE_MULTIPLECALLS)
372 //Correct state will be set in OnSceneActivated based on the call
373 pMoreBtn->SetShowState(false);
375 else if (__formType == FORMTYPE_ACTIVECONFCALL)
377 pMoreBtn->SetShowState(true);
383 ActiveCallForm::InitializeHoldButton(void)
385 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
386 if (pHoldBtn != null)
388 //set status of Hold Button
389 SetHoldButtonStatus(true);
390 pHoldBtn->AddActionEventListener(*this);
395 ActiveCallForm::SetHoldButtonStatus(bool toHoldCall)
397 //background bitmap & button name
399 Bitmap* normalImg = null;
400 Bitmap* pressImg = null;
403 btnName.Append(AppUtility::GetResourceString(IDS_HOLD_BTN_NAME));
404 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_NORMAL_BUTTON_ICON,
405 W_HOLD_BITMAP, H_HOLD_BITMAP);
406 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_PRESS_BUTTON_ICON,
407 W_HOLD_BITMAP, H_HOLD_BITMAP);
411 btnName.Append(AppUtility::GetResourceString(IDS_UNHOLD_BTN_NAME));
412 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_NORMAL_BUTTON_ICON,
413 W_HOLD_BITMAP, H_HOLD_BITMAP);
414 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_PRESS_BUTTON_ICON,
415 W_HOLD_BITMAP, H_HOLD_BITMAP);
419 CommandIds cmdId = IDA_HOLD_CALL;
422 case FORMTYPE_ACTIVECALL:
424 cmdId = toHoldCall ? IDA_HOLD_CALL : IDA_UNHOLD_CALL;
428 case FORMTYPE_ACTIVECONFCALL:
430 cmdId = toHoldCall ? IDA_HOLD_CONF_CALL : IDA_UNHOLD_CONF_CALL;
438 //set background bitmap, button name & action id
439 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
440 Label* pHoldLbl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
443 pHoldBtn->SetActionId(cmdId);
444 pHoldBtn->SetNormalBitmap(Point(0, 0),*normalImg);
445 pHoldBtn->SetPressedBitmap(Point(0, 0),*pressImg);
449 pHoldLbl->SetText(btnName);
450 pHoldLbl->Invalidate(true);
461 ActiveCallForm::CreateMoreOptionsMenuList(void)
463 //create option list anchor
464 if (__pMoreOptionsListAnchor == null)
466 Bitmap* pBgPopupArwBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_ARROW_ICON, W_OPTION_ANCHOR,
468 __pMoreOptionsListAnchor = new (std::nothrow) Label();
469 __pMoreOptionsListAnchor->Construct(Rectangle(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_ICON, Y_POPUP_ANCHOR, W_POPUP_ANCHOR, H_POPUP_ANCHOR), L"");
470 __pMoreOptionsListAnchor->SetBackgroundBitmap(*pBgPopupArwBmp);
472 delete pBgPopupArwBmp;
473 pBgPopupArwBmp = null;
475 // Adds a Label to the Form
476 AddControl(*__pMoreOptionsListAnchor);
479 //create options menu list
480 if (__pMoreOptionsList == null)
482 __pMoreOptionsList = new (std::nothrow) ListView();
483 __pMoreOptionsList->Construct(Rectangle(Point(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_LABEL,H_MORE_LABEL), IDI_OPTIONMENU_DIMEN), false, SCROLL_STYLE_FADE_OUT);
484 __pMoreOptionsList->SetItemProvider(*this);
485 __pMoreOptionsList->AddListViewItemEventListener(*this);
486 //Add option list to the form
487 AddControl(*__pMoreOptionsList);
491 //Hide option menu list
492 DestroyMoreOptionsMenuList();
497 ActiveCallForm::DestroyMoreOptionsMenuList(void)
499 if (__pMoreOptionsListAnchor != null)
501 //removes and delete the child control
502 RemoveControl(*__pMoreOptionsListAnchor);
503 __pMoreOptionsListAnchor = null;
506 if (__pMoreOptionsList != null)
508 //removes and delete the child control
509 RemoveControl(*__pMoreOptionsList);
510 __pMoreOptionsList = null;
515 ActiveCallForm::OnTerminating(void)
517 result r = E_SUCCESS;
518 if (__pCallPresentor != null)
520 __pCallPresentor = null;
526 ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
534 //End the currently active / dialing call
535 if (__pActiveCallInfo->IsConferenceCall() == false)
537 String activeContactNo;
538 activeContactNo.Append(__pActiveCallInfo->GetContactNumber());
539 //Check if it is call is in dialing state, then
540 if (__formType == FORMTYPE_EMERGENCYOUTGOINGCALL || __formType == FORMTYPE_OUTGOINGCALL)
542 __pCallPresentor->EndDialingCall(activeContactNo);
547 __pCallPresentor->EndActiveCall(*__pActiveCallInfo->GetCallHandle());
552 __pCallPresentor->EndConferenceCall();
557 case IDA_END_CONF_CALL:
559 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
560 __pCallPresentor->EndConferenceCall();
564 case IDA_OPEN_NUMKEYPAD:
566 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT)
568 //hide only in portrait mode.
569 SetShowStateOnKeypad(false);
572 __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
576 case IDA_CLOSE_NUMKEYPAD:
578 SetShowStateOnKeypad(true);
580 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
586 //switch to Dialer Form to make an call
587 if(__pCallPresentor->GetCurrentCallCount() == 1)
589 /* ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
591 String* formType = new (std::nothrow) String();
592 formType->Append(__formType);
593 pArgs->Add(formType);
594 pSceneManager->GoForward( ForwardSceneTransition(IDSCN_DIALER, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
595 SCENE_HISTORY_OPTION_NO_HISTORY), pArgs);*/
596 __pCallPresentor->LaunchDialAppControl();
605 if (__pActiveCallInfo->IsConferenceCall() == false)
607 if(__pActiveCallInfo->GetCallHandle() != null)
609 success = __pCallPresentor->HoldCall(*__pActiveCallInfo->GetCallHandle());
614 success = __pCallPresentor->HoldConferenceCall();
616 //reset hold status and "OnHold" text
617 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
618 if(__pActiveCallTimer != null)
620 __pActiveCallTimer->Cancel();
622 SetHoldButtonStatus(!success);
626 case IDA_UNHOLD_CALL:
628 bool success = false;
629 if (__pActiveCallInfo->IsConferenceCall() == false)
631 if(__pActiveCallInfo->GetCallHandle() != null)
633 success = __pCallPresentor->UnHoldCall(*__pActiveCallInfo->GetCallHandle());
638 success = __pCallPresentor->ActivateConferenceCall();
640 //reset hold status and show call timer
641 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
642 SetHoldButtonStatus(success);
646 case IDA_HOLD_CONF_CALL:
648 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
649 bool success = __pCallPresentor->HoldConferenceCall();
650 //reset hold status and "OnHold" text
651 SetHoldButtonStatus(!success);
652 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
653 if(__pActiveCallTimer != null)
655 __pActiveCallTimer->Cancel();
660 case IDA_UNHOLD_CONF_CALL:
662 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
663 bool success = __pCallPresentor->ActivateConferenceCall();
664 //reset hold status and show call timer
665 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
666 SetHoldButtonStatus(success);
670 case IDA_OPEN_CONTACTS:
673 //Launch call application
674 AppManager* pAppManager = AppManager::GetInstance();
675 pAppManager->LaunchApplication(PROVIDER_ID_CONTACTS);
681 bool success = __pCallPresentor->SetMuteStatus(true);
684 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
691 bool success = __pCallPresentor->SetMuteStatus(false);
694 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
701 bool success = __pCallPresentor->SetSpeakerStatus(true);
704 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
709 case IDA_SPEAKER_OFF:
711 bool success = __pCallPresentor->SetSpeakerStatus(false);
714 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
721 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
722 __pCallPresentor->JoinCall();
728 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
729 __pCallPresentor->SwapCalls();
733 case IDA_MORE_OPTIONS_MENU:
735 //Show 'more' options menu
736 CreateMoreOptionsMenuList();
742 dtmfString.Append(L"0");
743 SetTextToDTMFTextField(dtmfString);
744 __pCallPresentor->SendDTMFSignal(dtmfString);
750 dtmfString.Append(L"1");
751 SetTextToDTMFTextField(dtmfString);
752 __pCallPresentor->SendDTMFSignal(dtmfString);
758 dtmfString.Append(L"2");
759 SetTextToDTMFTextField(dtmfString);
760 __pCallPresentor->SendDTMFSignal(dtmfString);
766 dtmfString.Append(L"3");
767 SetTextToDTMFTextField(dtmfString);
768 __pCallPresentor->SendDTMFSignal(dtmfString);
774 dtmfString.Append(L"4");
775 SetTextToDTMFTextField(dtmfString);
776 __pCallPresentor->SendDTMFSignal(dtmfString);
782 dtmfString.Append(L"5");
783 SetTextToDTMFTextField(dtmfString);
784 __pCallPresentor->SendDTMFSignal(dtmfString);
790 dtmfString.Append(L"6");
791 SetTextToDTMFTextField(dtmfString);
792 __pCallPresentor->SendDTMFSignal(dtmfString);
798 dtmfString.Append(L"7");
799 SetTextToDTMFTextField(dtmfString);
800 __pCallPresentor->SendDTMFSignal(dtmfString);
806 dtmfString.Append(L"8");
807 SetTextToDTMFTextField(dtmfString);
808 __pCallPresentor->SendDTMFSignal(dtmfString);
814 dtmfString.Append(L"9");
815 SetTextToDTMFTextField(dtmfString);
816 __pCallPresentor->SendDTMFSignal(dtmfString);
822 dtmfString.Append(L"*");
823 SetTextToDTMFTextField(dtmfString);
824 __pCallPresentor->SendDTMFSignal(dtmfString);
830 dtmfString.Append(L"#");
831 SetTextToDTMFTextField(dtmfString);
832 __pCallPresentor->SendDTMFSignal(dtmfString);
842 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
844 if(__pDTMFKeypad != null)
846 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
848 int startpos=-1,endpos=-1;
849 pTextBox->GetBlockRange(startpos,endpos);
853 pTextBox->ReleaseBlock();
856 pTextBox->InsertTextAtCursorPosition(dtmfStr);
857 //pTextBox->AppendText(dtmfStr);
858 pTextBox->SetFocus();
859 pTextBox->Invalidate(true);
864 ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
867 //set itself as listener
868 __pCallPresentor->SetTelEventListener(this);
869 AddOrientationEventListener(*this);
871 //Initialize keypad and buttons
872 InitializeCallButtonsPanel();
874 if (__pActiveCallInfo != null)
876 delete __pActiveCallInfo;
877 __pActiveCallInfo = null;
879 if (__pHeldCallInfo != null)
881 delete __pHeldCallInfo;
882 __pHeldCallInfo = null;
884 DestroyMoreOptionsMenuList();
888 case FORMTYPE_OUTGOINGCALL:
891 contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
892 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
893 __pActiveCallInfo->SetContactNumber(contactNo);
894 Contact* pContact = __pCallPresentor->GetContactN(contactNo);
895 if (pContact != null)
897 __pActiveCallInfo->SetContactInfo(*pContact);
900 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
901 //make an normal outgoing call
902 __pCallPresentor->DialCall(contactNo, false);
906 case FORMTYPE_EMERGENCYOUTGOINGCALL:
908 String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
909 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
910 long long phNumber = 0;
911 LongLong::Parse(*pContactNo, phNumber);
912 __pActiveCallInfo->SetContactNumber(*pContactNo);
913 //make an emergency call
914 __pCallPresentor->DialCall(*pContactNo, true);
918 case FORMTYPE_ACTIVECALL:
921 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
923 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
924 *__pActiveCallInfo = *pCall;
925 String activeContactNo;
926 if(pCall->GetContactNumber().IsEmpty() == false)
928 activeContactNo.Append(pCall->GetContactNumber());
932 activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
934 ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
936 //show call active time using Timer
937 __activeCallStartTime = pCall->GetCallConnectTime();
938 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
942 case FORMTYPE_EMERGENCYACTIVECALL:
945 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
947 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
948 *__pActiveCallInfo = *pCall;
950 //show call active time using Timer
951 __activeCallStartTime = pCall->GetCallConnectTime();
952 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
956 case FORMTYPE_MULTIPLECALLS:
958 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
960 UpdateMultipleCallScreen(*pCallsList);
966 case FORMTYPE_ACTIVECONFCALL:
969 AppCallInfo* pConfInfo = static_cast<AppCallInfo*>(pArgs->GetAt(0));
970 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
971 *__pActiveCallInfo = *pConfInfo;
973 int participantsCount = __pActiveCallInfo->GetCallerListCount();
975 // show participant count on name Label
976 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
980 count.Append(participantsCount);
982 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
983 pPeopleCountLbl->SetText(count);
986 if(participantsCount >= IDI_MAX_CONF_CALL_PARTICIPANTS)
988 __pCallButtonsPanel->EnableAddCallButton(false);
992 __pCallButtonsPanel->EnableAddCallButton(true);
995 //show call active time using Timer
996 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
997 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime);
1005 //Hide DTMFKeypad, if visible and show caller info
1007 SetShowStateOnKeypad(true);
1008 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
1010 //Set the correct speaker status
1011 if(__pCallPresentor->IsSpeakerOn() == true)
1013 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
1017 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
1020 //Set the correct Mute status
1021 if (__pCallPresentor->IsCallMuted() == true)
1023 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
1027 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
1039 ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1041 RemoveOrientationEventListener(*this);
1042 if (__pCallButtonsPanel != null)
1044 RemoveControl(*__pCallButtonsPanel);
1045 __pCallButtonsPanel = null;
1047 if (__pActiveCallTimer != null)
1049 __pActiveCallTimer->Cancel();
1050 delete __pActiveCallTimer;
1051 __pActiveCallTimer = null;
1053 if (__pSmallPhotoLabel != null)
1055 __pSmallPhotoLabel->SetShowState(false);
1057 //Hide "Manage conf. Call" Context menu
1058 if (__pMoreOptionsListAnchor != null)
1060 __pMoreOptionsListAnchor->SetShowState(false);
1062 if (__pMoreOptionsList != null)
1064 __pMoreOptionsList->SetShowState(false);
1069 ActiveCallForm::HandleConfCallChanged(void)
1072 AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
1073 //fetch changed conference call info
1074 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1075 if (pConfCallInfo == null)
1081 //fetch participant count in conf call
1082 int participantsCount = pConfCallInfo->GetCallerListCount();
1083 //update status of join and Add call
1084 bool isEnableAddCall = false;
1085 bool isEnableJoinCall = false;
1086 if(participantsCount < IDI_MAX_CONF_CALL_PARTICIPANTS)
1088 //available only at Active conf. call or active call screen
1089 isEnableAddCall = true;
1090 //join button is available only at multiple call screen
1091 isEnableJoinCall = true;
1094 Label* pPeopleCountLbl = null;
1095 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == true)
1097 //Active call is conference call
1098 delete __pActiveCallInfo;
1099 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1100 *__pActiveCallInfo = *pConfCallInfo;
1102 if (__formType == FORMTYPE_MULTIPLECALLS)
1104 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1106 else if (__formType == FORMTYPE_ACTIVECONFCALL)
1108 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1109 AppLog("Active conf call...(%d)", pPeopleCountLbl);
1112 else if(__pHeldCallInfo != null && __pHeldCallInfo->IsConferenceCall() == true)
1114 //Held call is conference call - this is definitely multiple call screen.
1115 delete __pHeldCallInfo;
1116 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1117 *__pHeldCallInfo = *pConfCallInfo;
1118 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1121 // update participant count on name Label
1122 if (pPeopleCountLbl != null)
1125 count.Append(participantsCount);
1127 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1128 pPeopleCountLbl->SetText(count);
1129 pPeopleCountLbl->Invalidate(true);
1131 //change AddCall Button status
1132 __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
1133 //change JoinCall Button status
1134 __pCallButtonsPanel->EnableJoinCallButton(isEnableJoinCall);
1139 ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
1142 if(__pActiveCallInfo != null)
1144 delete __pActiveCallInfo;
1145 __pActiveCallInfo = null;
1147 if(__pHeldCallInfo != null)
1149 delete __pHeldCallInfo;
1150 __pHeldCallInfo = null;
1153 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1154 if (pMoreBtn != null)
1156 pMoreBtn->SetShowState(false);
1159 //show caller's info.
1160 for (int index = 0; index < activeCallsList.GetCount(); index++)
1163 AppCallInfo callInfo;
1164 activeCallsList.GetAt(index, callInfo);
1167 if(callInfo.GetContactNumber().IsEmpty() == false)
1169 contactNo.Append(callInfo.GetContactNumber());
1173 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1176 if (callInfo.IsOnHold() == false)
1178 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1179 *__pActiveCallInfo = callInfo;
1181 if (__pActiveCallInfo->IsConferenceCall() == false)
1183 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1186 pVoiceIconLbl->SetShowState(true);
1188 if (pMoreBtn != null)
1190 pMoreBtn->SetShowState(false);
1192 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1196 // show participant count on name Label
1197 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1198 if (pPeopleCountLbl)
1201 count.Append(__pActiveCallInfo->GetCallerListCount());
1203 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1204 pPeopleCountLbl->SetText(count);
1206 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1207 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1210 pNameLbl->SetText(nameStr);
1212 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1215 pVoiceIconLbl->SetShowState(false);
1217 if (pMoreBtn != null)
1219 pMoreBtn->SetShowState(true);
1221 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1222 if (pPhotoBitmap != null)
1224 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER1_PHOTO_LABEL));
1227 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1228 pPhotoLbl->Invalidate(true);
1230 delete pPhotoBitmap;
1233 //show call active time using Timer
1234 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1235 ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime);
1239 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1240 *__pHeldCallInfo = callInfo;
1242 if (__pHeldCallInfo->IsConferenceCall() == false)
1244 ShowPersonDetails(contactNo, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pHeldCallInfo);
1248 // show participant count on name Label
1249 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1250 if (pPeopleCountLbl)
1253 count.Append(__pHeldCallInfo->GetCallerListCount());
1255 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1256 pPeopleCountLbl->SetText(count);
1258 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1259 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1262 pNameLbl->SetText(nameStr);
1264 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1265 if (pPhotoBitmap != null)
1267 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER2_PHOTO_LABEL));
1270 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1271 pPhotoLbl->Invalidate(true);
1273 delete pPhotoBitmap;
1277 ShowTimerInfo(IDC_CALLER2_TIME_LABEL, true);
1281 //update JoinCall button status
1282 bool isEnableJoinCall = true;
1283 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1284 if(pConfCallInfo != null && pConfCallInfo->GetCallerListCount() >= IDI_MAX_CONF_CALL_PARTICIPANTS)
1286 isEnableJoinCall = false;
1288 __pCallButtonsPanel->EnableJoinCallButton(isEnableJoinCall);
1289 delete pConfCallInfo;
1290 pConfCallInfo = null;
1296 ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
1298 //call individual methods to show contact number, caller name & photo
1299 ShowPhoneNumber(phoneNumber, contactLblName);
1301 //fetch contact details based on phone number
1302 String* pDisplayName = pCallInfo->FetchCallerNameN();
1303 ShowCallerName(*pDisplayName, nameLblName);
1305 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1306 ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
1311 delete pDisplayName;
1312 pDisplayName = null;
1316 delete pPhotoBitmap;
1317 pPhotoBitmap = null;
1322 ActiveCallForm::ShowPhoneNumber(const String& phoneNumber, const String& contactLblName)
1324 String formattedNumber = phoneNumber;
1326 Label* pContactLbl = static_cast<Label*>(GetControl(contactLblName));
1329 pContactLbl->SetText(formattedNumber);
1330 pContactLbl->Invalidate(true);
1335 ActiveCallForm::ShowCallerName(const String& callerName, const String& nameLblName)
1337 // show display name on name Label
1338 Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
1341 //passing an empty string to SetText fails in label,
1342 //if previously valid text has been set
1343 if (callerName.IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
1345 String stringToBeSet(L" ");
1346 pNameLbl->SetText(stringToBeSet);
1350 pNameLbl->SetText(callerName);
1352 pNameLbl->Invalidate(true);
1357 ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
1359 //to check if default image is to be shown
1360 bool showDefaultPhoto = false;
1361 bool showSmallPhoto = false;
1362 String photoLabel("");
1366 case FORMTYPE_OUTGOINGCALL:
1367 case FORMTYPE_ACTIVECALL:
1369 if (pPhotoId == null)
1371 //show default caller image
1372 showDefaultPhoto = true;
1376 //Check the size of photo
1377 // Now checking the condition with && but actually it should be ||
1378 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1379 // height 270 and width = 480 . So all images set thru gallery is show as small image
1380 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1381 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1383 showSmallPhoto = true;
1387 photoLabel.Append(IDC_CALLER1_BIGPHOTO_LABEL);
1391 case FORMTYPE_MULTIPLECALLS:
1395 photoLabel.Append(IDC_CALLER2_PHOTO_LABEL);
1399 photoLabel.Append(IDC_CALLER1_PHOTO_LABEL);
1402 if (pPhotoId == null)
1404 showDefaultPhoto = true;
1408 if (pPhotoId->GetHeight() <= H_SMALL_PHOTO
1409 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1411 //pPhotoId->Scale(Dimension(W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO));
1412 showSmallPhoto = true;
1422 //Remove small photo label
1423 if (__pSmallPhotoLabel != null)
1425 RemoveControl(*__pSmallPhotoLabel);
1426 __pSmallPhotoLabel = null;
1429 //show photo - for Big Photo Id, Animated Call Image
1430 if (!showDefaultPhoto)
1432 if(showSmallPhoto == true)
1434 ShowThumbnailImage(pPhotoId,photoLabel);
1438 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1441 Canvas* pCanvas = new (std::nothrow) Canvas;
1442 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1443 pCanvas->Construct(canvasRect);
1444 //draw the contact bitmap
1445 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1446 Bitmap* pNewPhotoId = new Bitmap();
1447 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1450 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1451 pPhotoLbl->Invalidate(true);
1458 Bitmap* pDefaultPhoto = null;
1461 case FORMTYPE_OUTGOINGCALL:
1462 case FORMTYPE_ACTIVECALL:
1463 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1466 case FORMTYPE_MULTIPLECALLS:
1467 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_MULTIPLE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1470 case FORMTYPE_ACTIVECONFCALL:
1471 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BIG_BG_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1477 if (pDefaultPhoto != null)
1479 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1482 pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
1484 delete pDefaultPhoto;
1490 ActiveCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,String& photoLabel)
1492 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1494 if (pPhotoLbl != null && pPhotoId != null)
1496 Canvas* pCanvas = new (std::nothrow) Canvas;
1497 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1498 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1499 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1500 pCanvas->Construct(canvasRect);
1501 //draw the back ground
1502 pCanvas->DrawBitmap(canvasRect,*pBackground);
1503 //draw shadow (to be enabled after correct shadow image is provided )
1504 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1505 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1506 //draw the contact bitmap
1507 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1508 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1509 Bitmap* pNewPhotoId = new Bitmap();
1510 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1513 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1514 pPhotoLbl->Invalidate(true);
1523 ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1525 if (__pSmallPhotoLabel != null)
1527 RemoveControl(*__pSmallPhotoLabel);
1528 __pSmallPhotoLabel = null;
1530 //Draw Small Photo and show on small photo label
1531 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1532 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1533 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1534 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1535 // Add a Label to the Form
1536 AddControl(*__pSmallPhotoLabel);
1537 __pSmallPhotoLabel->Invalidate(true);
1541 ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long long startTime)
1543 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1545 if (__pActiveCallTimer == null)
1547 __pActiveCallTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
1548 __pActiveCallTimer->Construct(*this);
1551 if (pTimerLbl != null)
1553 if (isOnHold == true)
1555 pTimerLbl->SetText(AppUtility::GetResourceString(IDS_TIMER_ON_HOLD));
1556 //update Hold button status
1557 SetHoldButtonStatus(false);
1561 //update Hold button status
1562 SetHoldButtonStatus(true);
1563 //current system time
1564 long long currTime = 0;
1565 SystemTime::GetTicks(currTime);
1567 TimeSpan diffSpan(abs(startTime - currTime));
1569 String activeCallTime(L"");
1571 long long hr = diffSpan.GetHours();
1574 activeCallTime.Append("0");
1576 activeCallTime.Append(hr);
1577 activeCallTime.Append(L":");
1579 long long min = diffSpan.GetMinutes();
1582 activeCallTime.Append("0");
1584 activeCallTime.Append(min);
1585 activeCallTime.Append(L":");
1587 long long sec = diffSpan.GetSeconds();
1590 activeCallTime.Append("0");
1592 activeCallTime.Append(sec);
1594 pTimerLbl->SetText(activeCallTime);
1595 __pActiveCallTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
1597 pTimerLbl->Invalidate(true);
1602 ActiveCallForm::SetShowStateOnKeypad(bool showState)
1604 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1605 pLblControl->SetShowState(showState);
1606 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL));
1607 pLblControl->SetShowState(showState);
1608 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1609 pLblControl->SetShowState(showState);
1610 if (__pSmallPhotoLabel != null)
1612 __pSmallPhotoLabel->SetShowState(showState);
1617 case FORMTYPE_ACTIVECALL:
1619 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1620 pLblControl->SetShowState(showState);
1621 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1622 pLblControl->SetShowState(showState);
1623 pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1624 pLblControl->SetShowState(showState);
1625 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1626 pButtonControl->SetShowState(showState);
1630 case FORMTYPE_MULTIPLECALLS:
1632 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1633 pLblControl->SetShowState(showState);
1634 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1635 pLblControl->SetShowState(showState);
1636 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1637 pLblControl->SetShowState(showState);
1638 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1639 pLblControl->SetShowState(showState);
1640 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1641 pLblControl->SetShowState(showState);
1642 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1643 pLblControl->SetShowState(showState);
1644 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == false)
1646 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1647 pLblControl->SetShowState(showState);
1651 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1652 pButtonControl->SetShowState(showState);
1654 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1655 pButtonControl->SetShowState(showState);
1659 case FORMTYPE_ACTIVECONFCALL:
1661 pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1662 pLblControl->SetShowState(showState);
1663 pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1664 pLblControl->SetShowState(showState);
1665 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1666 pButtonControl->SetShowState(showState);
1667 pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1668 pButtonControl->SetShowState(showState);
1678 ActiveCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1680 //Call default implementation of "Object.Equals()"
1681 //returns true, if they are pointing to same address.
1682 if (__pActiveCallTimer->Equals(timer))
1684 Label* pTimerLbl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1687 String activeCallTime = pTimerLbl->GetText();
1688 // Create a StringTokenizer instance
1689 StringTokenizer strTokens(activeCallTime, L":");
1691 int count = strTokens.GetTokenCount(); // count == 3
1696 for (int index = 0; index < count; index++)
1701 strTokens.GetNextToken(token);
1702 Integer::Parse(token, hr);
1706 strTokens.GetNextToken(token);
1707 Integer::Parse(token, min);
1711 strTokens.GetNextToken(token);
1712 Integer::Parse(token, sec);
1718 if (sec == IDI_MAX_SECONDS)
1723 if (min == IDI_MAX_MINS)
1730 activeCallTime.Clear();
1733 activeCallTime.Append("0");
1735 activeCallTime.Append(hr);
1736 activeCallTime.Append(":");
1739 activeCallTime.Append("0");
1741 activeCallTime.Append(min);
1742 activeCallTime.Append(":");
1745 activeCallTime.Append("0");
1747 activeCallTime.Append(sec);
1748 //update timer label
1749 pTimerLbl->SetText(activeCallTime);
1750 pTimerLbl->Invalidate(true);
1755 ///////////////////////////////////////////////////////////
1756 /////////// Options Menu List Functionality /////////
1757 ///////////////////////////////////////////////////////////
1759 ActiveCallForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
1764 ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
1766 //Goto conference call list form
1767 SceneManager* pSceneManager = SceneManager::GetInstance();
1768 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST), null);
1772 ActiveCallForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
1777 ActiveCallForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
1782 ActiveCallForm::GetItemCount(void)
1784 return IDI_MOREOPTIONS_LIST_ITEMS;
1788 ActiveCallForm::CreateItem(int index, int itemWidth)
1790 //create 1st Menu option
1791 CustomItem* pItem = new (std::nothrow) CustomItem();
1792 pItem->Construct(IDI_OPTIONMENU_DIMEN, LIST_ANNEX_STYLE_NORMAL);
1794 //Set background 9-patch bitmap to option menu
1795 Bitmap* pBgBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_BG_ICON);
1796 if (pBgBmp != null && pBgBmp->IsNinePatchedBitmap())
1799 bgCanvas.Construct(Rectangle(IDI_OPTIONMENU_POS, IDI_OPTIONMENU_DIMEN));
1800 bgCanvas.DrawNinePatchedBitmap(bgCanvas.GetBounds(), *pBgBmp);
1804 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color(40, 45, 48));
1809 //Set bitmap to option menu
1810 Bitmap* pNormalConfCallBmp = AppUtility::GetBitmapFromResourcesN(IDB_MORE_MANAGE_CONFERENCE_ICON ,
1811 W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP);
1812 pItem->AddElement(Rectangle(16, 17, W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP), 1, *pNormalConfCallBmp, null, null);
1813 // Deallocate bitmaps
1814 delete pNormalConfCallBmp;
1815 pNormalConfCallBmp = null;
1817 //Set text to menu option
1818 String confCallName = AppUtility::GetResourceString(IDS_MGR_CONF_CALL_LIST_STR);
1820 TextElement* pTextElement = new (std::nothrow) TextElement();
1821 pTextElement->Construct(confCallName);
1822 pTextElement->SetTextColor(COLOR_POPUP_TEXT);
1825 font.Construct(FONT_STYLE_PLAIN, IDI_POPUP_TEXT_SIZE);
1826 pTextElement->SetFont(font);
1827 //construct Enriched text
1828 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1829 Dimension textDimension;
1830 font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
1831 textDimension.height = textDimension.height + font.GetDescender();
1832 pEnrichedText->Construct(textDimension);
1833 //add text element to enriched text
1834 pEnrichedText->Add(*pTextElement);
1836 //Add Enriched text to pItem
1837 Point textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
1838 pItem->AddElement(Rectangle(textPos, textDimension), 2, *pEnrichedText);
1840 pEnrichedText->RemoveAll(true);
1841 delete pEnrichedText;
1846 ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)