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 RemoveControl(*__pDTMFKeypad);
200 __pDTMFKeypad = null;
203 if(__pDTMFKeypad == null)
205 //update rect according to client screen area
206 Rectangle rect(0, 0, 0, 0);
207 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT)
209 rect.width = GetClientAreaBounds().width;
210 rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight();
212 else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE)
214 rect.height = GetClientAreaBounds().height;
215 rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth();
218 AppLog("DTMF Keypad rect(%d,%d,%d,%d)",rect.x,rect.y,rect.width,rect.height);
219 __pDTMFKeypad = new (std::nothrow) DtmfKeyPadPanel();
220 __pDTMFKeypad->Initialize(this, rect);
221 AddControl(*__pDTMFKeypad);
223 //set layout relation w.r.t call buttons panel
224 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
225 if (pRelativeLayout != null)
227 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
228 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
231 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
232 pTextBox->SetText(L"");
233 __pDTMFKeypad->SetShowState(true);
234 __pDTMFKeypad->Draw(true);
235 __pDTMFKeypad->Show();
239 ActiveCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
243 if (__pCallButtonsPanel != null)
245 //update position of call buttons panel
246 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
247 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
249 //bring button on top
250 __pCallButtonsPanel->SetButtonPosition();
252 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
253 if (pRelativeLayout != null)
255 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
258 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
259 if (pRelativeLayout != null)
261 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
262 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
265 //change orientation of DTMF Keypad, if it is visible.
266 if (__pDTMFKeypad != null)
268 if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE)
270 //in landscape mode, caller info is visible.
271 SetShowStateOnKeypad(true);
273 else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT)
275 //in Portrait mode it is hidden beneath DTMF Keypad.
276 SetShowStateOnKeypad(false);
278 String dtmfText = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
281 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
282 pTextBox->SetText(dtmfText);
288 ActiveCallForm::HideDTMFKeypad(void)
290 if(__pDTMFKeypad != null)
292 RemoveControl(*__pDTMFKeypad);
293 __pDTMFKeypad = null;
298 ActiveCallForm::InitializeCallButtonsPanel(void)
300 result r = E_SUCCESS;
301 //Set background bitmap for call keypad
302 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
303 Bitmap* pBgBitmap = AppUtility::GetBitmapFromResourcesN(IDB_BACKGROUND_BITMAP, pKeysBgLbl->GetWidth(), pKeysBgLbl->GetHeight());
304 if (pBgBitmap != null)
306 pKeysBgLbl->SetBackgroundBitmap(*pBgBitmap);
309 if (__pCallButtonsPanel == null)
311 __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
312 __pCallButtonsPanel->ConstructPanel(this, __formType);
313 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
314 r = AddControl(*__pCallButtonsPanel);
317 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
318 if (pRelativeLayout != null)
320 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
322 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
323 if (pRelativeLayout != null)
325 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
326 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
333 ActiveCallForm::InitializeSwapButton(void)
335 Button* pSwapBtn = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
338 Bitmap* pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_NORMAL,
339 W_HOLD_BITMAP, H_HOLD_BITMAP);
342 pSwapBtn->SetNormalBitmap(Point(0, 0), *pSwapBmp);
347 pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_PRESS,
348 W_HOLD_BITMAP, H_HOLD_BITMAP);
351 pSwapBtn->SetPressedBitmap(Point(0, 0), *pSwapBmp);
355 pSwapBtn->SetActionId(IDA_SWAP_CALLS);
356 pSwapBtn->AddActionEventListener(*this);
361 ActiveCallForm::InitializeManageConfCallButton(void)
363 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
364 if (pMoreBtn != null)
366 pMoreBtn->SetActionId(IDA_MORE_OPTIONS_MENU);
367 pMoreBtn->AddActionEventListener(*this);
368 if (__formType == FORMTYPE_MULTIPLECALLS)
370 //Correct state will be set in OnSceneActivated based on the call
371 pMoreBtn->SetShowState(false);
373 else if (__formType == FORMTYPE_ACTIVECONFCALL)
375 pMoreBtn->SetShowState(true);
381 ActiveCallForm::InitializeHoldButton(void)
383 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
384 if (pHoldBtn != null)
386 //set status of Hold Button
387 SetHoldButtonStatus(true);
388 pHoldBtn->AddActionEventListener(*this);
393 ActiveCallForm::SetHoldButtonStatus(bool toHoldCall)
395 //background bitmap & button name
397 Bitmap* normalImg = null;
398 Bitmap* pressImg = null;
401 btnName.Append(AppUtility::GetResourceString(IDS_HOLD_BTN_NAME));
402 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_NORMAL_BUTTON_ICON,
403 W_HOLD_BITMAP, H_HOLD_BITMAP);
404 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_PRESS_BUTTON_ICON,
405 W_HOLD_BITMAP, H_HOLD_BITMAP);
409 btnName.Append(AppUtility::GetResourceString(IDS_UNHOLD_BTN_NAME));
410 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_NORMAL_BUTTON_ICON,
411 W_HOLD_BITMAP, H_HOLD_BITMAP);
412 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_PRESS_BUTTON_ICON,
413 W_HOLD_BITMAP, H_HOLD_BITMAP);
417 CommandIds cmdId = IDA_HOLD_CALL;
420 case FORMTYPE_ACTIVECALL:
422 cmdId = toHoldCall ? IDA_HOLD_CALL : IDA_UNHOLD_CALL;
426 case FORMTYPE_ACTIVECONFCALL:
428 cmdId = toHoldCall ? IDA_HOLD_CONF_CALL : IDA_UNHOLD_CONF_CALL;
436 //set background bitmap, button name & action id
437 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
438 Label* pHoldLbl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
441 pHoldBtn->SetActionId(cmdId);
442 pHoldBtn->SetNormalBitmap(Point(0, 0),*normalImg);
443 pHoldBtn->SetPressedBitmap(Point(0, 0),*pressImg);
447 pHoldLbl->SetText(btnName);
448 pHoldLbl->Invalidate(true);
459 ActiveCallForm::CreateMoreOptionsMenuList(void)
461 //create option list anchor
462 if (__pMoreOptionsListAnchor == null)
464 Bitmap* pBgPopupArwBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_ARROW_ICON, W_OPTION_ANCHOR,
466 __pMoreOptionsListAnchor = new (std::nothrow) Label();
467 __pMoreOptionsListAnchor->Construct(Rectangle(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_ICON, Y_POPUP_ANCHOR, W_POPUP_ANCHOR, H_POPUP_ANCHOR), L"");
468 __pMoreOptionsListAnchor->SetBackgroundBitmap(*pBgPopupArwBmp);
470 delete pBgPopupArwBmp;
471 pBgPopupArwBmp = null;
473 // Adds a Label to the Form
474 AddControl(*__pMoreOptionsListAnchor);
477 //create options menu list
478 if (__pMoreOptionsList == null)
480 __pMoreOptionsList = new (std::nothrow) ListView();
481 __pMoreOptionsList->Construct(Rectangle(Point(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_LABEL,H_MORE_LABEL), IDI_OPTIONMENU_DIMEN), false, SCROLL_STYLE_FADE_OUT);
482 __pMoreOptionsList->SetItemProvider(*this);
483 __pMoreOptionsList->AddListViewItemEventListener(*this);
484 //Add option list to the form
485 AddControl(*__pMoreOptionsList);
489 //Hide option menu list
490 DestroyMoreOptionsMenuList();
495 ActiveCallForm::DestroyMoreOptionsMenuList(void)
497 if (__pMoreOptionsListAnchor != null)
499 //removes and delete the child control
500 RemoveControl(*__pMoreOptionsListAnchor);
501 __pMoreOptionsListAnchor = null;
504 if (__pMoreOptionsList != null)
506 //removes and delete the child control
507 RemoveControl(*__pMoreOptionsList);
508 __pMoreOptionsList = null;
513 ActiveCallForm::OnTerminating(void)
515 result r = E_SUCCESS;
516 if (__pCallPresentor != null)
518 __pCallPresentor = null;
524 ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
532 //End the currently active / dialing call
533 if (__pActiveCallInfo->IsConferenceCall() == false)
535 String activeContactNo;
536 activeContactNo.Append(__pActiveCallInfo->GetContactNumber());
537 //Check if it is call is in dialing state, then
538 if (__formType == FORMTYPE_EMERGENCYOUTGOINGCALL || __formType == FORMTYPE_OUTGOINGCALL)
540 __pCallPresentor->EndDialingCall(activeContactNo);
545 __pCallPresentor->EndActiveCall(*__pActiveCallInfo->GetCallHandle());
550 __pCallPresentor->EndConferenceCall();
555 case IDA_END_CONF_CALL:
557 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
558 __pCallPresentor->EndConferenceCall();
562 case IDA_OPEN_NUMKEYPAD:
564 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT)
566 //hide only in portrait mode.
567 SetShowStateOnKeypad(false);
570 SetTextToDTMFTextField(L"");
571 __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
575 case IDA_CLOSE_NUMKEYPAD:
577 SetShowStateOnKeypad(true);
579 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
585 //switch to Dialer Form to make an call
586 if(__pCallPresentor->GetCurrentCallCount() == 1)
588 /* ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
590 String* formType = new (std::nothrow) String();
591 formType->Append(__formType);
592 pArgs->Add(formType);
593 pSceneManager->GoForward( ForwardSceneTransition(IDSCN_DIALER, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
594 SCENE_HISTORY_OPTION_NO_HISTORY), pArgs);*/
595 __pCallPresentor->LaunchDialAppControl();
604 if (__pActiveCallInfo->IsConferenceCall() == false)
606 if(__pActiveCallInfo->GetCallHandle() != null)
608 success = __pCallPresentor->HoldCall(*__pActiveCallInfo->GetCallHandle());
613 success = __pCallPresentor->HoldConferenceCall();
615 //reset hold status and "OnHold" text
616 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
617 if(__pActiveCallTimer != null)
619 __pActiveCallTimer->Cancel();
621 SetHoldButtonStatus(!success);
625 case IDA_UNHOLD_CALL:
627 bool success = false;
628 if (__pActiveCallInfo->IsConferenceCall() == false)
630 if(__pActiveCallInfo->GetCallHandle() != null)
632 success = __pCallPresentor->UnHoldCall(*__pActiveCallInfo->GetCallHandle());
637 success = __pCallPresentor->ActivateConferenceCall();
639 //reset hold status and show call timer
640 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
641 SetHoldButtonStatus(success);
645 case IDA_HOLD_CONF_CALL:
647 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
648 bool success = __pCallPresentor->HoldConferenceCall();
649 //reset hold status and "OnHold" text
650 SetHoldButtonStatus(!success);
651 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
652 if(__pActiveCallTimer != null)
654 __pActiveCallTimer->Cancel();
659 case IDA_UNHOLD_CONF_CALL:
661 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
662 bool success = __pCallPresentor->ActivateConferenceCall();
663 //reset hold status and show call timer
664 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
665 SetHoldButtonStatus(success);
669 case IDA_OPEN_CONTACTS:
672 //Launch call application
673 AppManager* pAppManager = AppManager::GetInstance();
674 pAppManager->LaunchApplication(PROVIDER_ID_CONTACTS);
680 bool success = __pCallPresentor->SetMuteStatus(true);
683 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
690 bool success = __pCallPresentor->SetMuteStatus(false);
693 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
700 bool success = __pCallPresentor->SetSpeakerStatus(true);
703 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
708 case IDA_SPEAKER_OFF:
710 bool success = __pCallPresentor->SetSpeakerStatus(false);
713 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
720 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
721 __pCallPresentor->JoinCall();
727 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
728 __pCallPresentor->SwapCalls();
732 case IDA_MORE_OPTIONS_MENU:
734 //Show 'more' options menu
735 CreateMoreOptionsMenuList();
741 dtmfString.Append(L"0");
742 SetTextToDTMFTextField(dtmfString);
743 __pCallPresentor->SendDTMFSignal(dtmfString);
749 dtmfString.Append(L"1");
750 SetTextToDTMFTextField(dtmfString);
751 __pCallPresentor->SendDTMFSignal(dtmfString);
757 dtmfString.Append(L"2");
758 SetTextToDTMFTextField(dtmfString);
759 __pCallPresentor->SendDTMFSignal(dtmfString);
765 dtmfString.Append(L"3");
766 SetTextToDTMFTextField(dtmfString);
767 __pCallPresentor->SendDTMFSignal(dtmfString);
773 dtmfString.Append(L"4");
774 SetTextToDTMFTextField(dtmfString);
775 __pCallPresentor->SendDTMFSignal(dtmfString);
781 dtmfString.Append(L"5");
782 SetTextToDTMFTextField(dtmfString);
783 __pCallPresentor->SendDTMFSignal(dtmfString);
789 dtmfString.Append(L"6");
790 SetTextToDTMFTextField(dtmfString);
791 __pCallPresentor->SendDTMFSignal(dtmfString);
797 dtmfString.Append(L"7");
798 SetTextToDTMFTextField(dtmfString);
799 __pCallPresentor->SendDTMFSignal(dtmfString);
805 dtmfString.Append(L"8");
806 SetTextToDTMFTextField(dtmfString);
807 __pCallPresentor->SendDTMFSignal(dtmfString);
813 dtmfString.Append(L"9");
814 SetTextToDTMFTextField(dtmfString);
815 __pCallPresentor->SendDTMFSignal(dtmfString);
821 dtmfString.Append(L"*");
822 SetTextToDTMFTextField(dtmfString);
823 __pCallPresentor->SendDTMFSignal(dtmfString);
829 dtmfString.Append(L"#");
830 SetTextToDTMFTextField(dtmfString);
831 __pCallPresentor->SendDTMFSignal(dtmfString);
841 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
843 if(__pDTMFKeypad != null)
845 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
847 int startpos=-1,endpos=-1;
848 pTextBox->GetBlockRange(startpos,endpos);
852 pTextBox->ReleaseBlock();
855 pTextBox->InsertTextAtCursorPosition(dtmfStr);
856 //pTextBox->AppendText(dtmfStr);
857 pTextBox->SetFocus();
858 pTextBox->Invalidate(true);
863 ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
866 //set itself as listener
867 __pCallPresentor->SetTelEventListener(this);
868 AddOrientationEventListener(*this);
870 //Initialize keypad and buttons
871 InitializeCallButtonsPanel();
873 if (__pActiveCallInfo != null)
875 delete __pActiveCallInfo;
876 __pActiveCallInfo = null;
878 if (__pHeldCallInfo != null)
880 delete __pHeldCallInfo;
881 __pHeldCallInfo = null;
883 DestroyMoreOptionsMenuList();
887 case FORMTYPE_OUTGOINGCALL:
890 contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
891 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
892 __pActiveCallInfo->SetContactNumber(contactNo);
893 Contact* pContact = __pCallPresentor->GetContactN(contactNo);
894 if (pContact != null)
896 __pActiveCallInfo->SetContactInfo(*pContact);
899 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
900 //make an normal outgoing call
901 __pCallPresentor->DialCall(contactNo, false);
905 case FORMTYPE_EMERGENCYOUTGOINGCALL:
907 String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
908 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
909 long long phNumber = 0;
910 LongLong::Parse(*pContactNo, phNumber);
911 __pActiveCallInfo->SetContactNumber(*pContactNo);
912 //make an emergency call
913 __pCallPresentor->DialCall(*pContactNo, true);
917 case FORMTYPE_ACTIVECALL:
920 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
922 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
923 *__pActiveCallInfo = *pCall;
924 String activeContactNo;
925 if(pCall->GetContactNumber().IsEmpty() == false)
927 activeContactNo.Append(pCall->GetContactNumber());
931 activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
933 ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
935 //show call active time using Timer
936 __activeCallStartTime = pCall->GetCallConnectTime();
937 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
941 case FORMTYPE_EMERGENCYACTIVECALL:
944 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
946 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
947 *__pActiveCallInfo = *pCall;
949 //show call active time using Timer
950 __activeCallStartTime = pCall->GetCallConnectTime();
951 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
955 case FORMTYPE_MULTIPLECALLS:
957 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
959 UpdateMultipleCallScreen(*pCallsList);
965 case FORMTYPE_ACTIVECONFCALL:
968 AppCallInfo* pConfInfo = static_cast<AppCallInfo*>(pArgs->GetAt(0));
969 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
970 *__pActiveCallInfo = *pConfInfo;
972 int participantsCount = __pActiveCallInfo->GetCallerListCount();
974 // show participant count on name Label
975 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
979 count.Append(participantsCount);
981 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
982 pPeopleCountLbl->SetText(count);
985 if(participantsCount >= IDI_MAX_CONF_CALL_PARTICIPANTS)
987 __pCallButtonsPanel->EnableAddCallButton(false);
991 __pCallButtonsPanel->EnableAddCallButton(true);
994 //show call active time using Timer
995 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
996 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime);
1004 //Hide DTMFKeypad, if visible and show caller info
1006 SetShowStateOnKeypad(true);
1007 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
1009 //Set the correct speaker status
1010 if(__pCallPresentor->IsSpeakerOn() == true)
1012 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
1016 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
1019 //Set the correct Mute status
1020 if (__pCallPresentor->IsCallMuted() == true)
1022 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
1026 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
1038 ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1040 RemoveOrientationEventListener(*this);
1041 if (__pCallButtonsPanel != null)
1043 RemoveControl(*__pCallButtonsPanel);
1044 __pCallButtonsPanel = null;
1046 if (__pActiveCallTimer != null)
1048 __pActiveCallTimer->Cancel();
1049 delete __pActiveCallTimer;
1050 __pActiveCallTimer = null;
1052 if (__pSmallPhotoLabel != null)
1054 __pSmallPhotoLabel->SetShowState(false);
1056 //Hide "Manage conf. Call" Context menu
1057 if (__pMoreOptionsListAnchor != null)
1059 __pMoreOptionsListAnchor->SetShowState(false);
1061 if (__pMoreOptionsList != null)
1063 __pMoreOptionsList->SetShowState(false);
1068 ActiveCallForm::HandleConfCallChanged(void)
1071 AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
1072 //fetch changed conference call info
1073 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1074 if (pConfCallInfo == null)
1080 //fetch participant count in conf call
1081 int participantsCount = pConfCallInfo->GetCallerListCount();
1082 //update status of join and Add call
1083 bool isEnableAddCall = false;
1084 bool isEnableJoinCall = false;
1085 if(participantsCount < IDI_MAX_CONF_CALL_PARTICIPANTS)
1087 //available only at Active conf. call or active call screen
1088 isEnableAddCall = true;
1089 //join button is available only at multiple call screen
1090 isEnableJoinCall = true;
1093 Label* pPeopleCountLbl = null;
1094 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == true)
1096 //Active call is conference call
1097 delete __pActiveCallInfo;
1098 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1099 *__pActiveCallInfo = *pConfCallInfo;
1101 if (__formType == FORMTYPE_MULTIPLECALLS)
1103 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1105 else if (__formType == FORMTYPE_ACTIVECONFCALL)
1107 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1108 AppLog("Active conf call...(%d)", pPeopleCountLbl);
1111 else if(__pHeldCallInfo != null && __pHeldCallInfo->IsConferenceCall() == true)
1113 //Held call is conference call - this is definitely multiple call screen.
1114 delete __pHeldCallInfo;
1115 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1116 *__pHeldCallInfo = *pConfCallInfo;
1117 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1120 // update participant count on name Label
1121 if (pPeopleCountLbl != null)
1124 count.Append(participantsCount);
1126 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1127 pPeopleCountLbl->SetText(count);
1128 pPeopleCountLbl->Invalidate(true);
1130 //change AddCall Button status
1131 __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
1132 //change JoinCall Button status
1133 __pCallButtonsPanel->EnableJoinCallButton(isEnableJoinCall);
1138 ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
1141 if(__pActiveCallInfo != null)
1143 delete __pActiveCallInfo;
1144 __pActiveCallInfo = null;
1146 if(__pHeldCallInfo != null)
1148 delete __pHeldCallInfo;
1149 __pHeldCallInfo = null;
1152 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1153 if (pMoreBtn != null)
1155 pMoreBtn->SetShowState(false);
1158 //show caller's info.
1159 for (int index = 0; index < activeCallsList.GetCount(); index++)
1162 AppCallInfo callInfo;
1163 activeCallsList.GetAt(index, callInfo);
1166 if(callInfo.GetContactNumber().IsEmpty() == false)
1168 contactNo.Append(callInfo.GetContactNumber());
1172 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1175 if (callInfo.IsOnHold() == false)
1177 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1178 *__pActiveCallInfo = callInfo;
1180 if (__pActiveCallInfo->IsConferenceCall() == false)
1182 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1185 pVoiceIconLbl->SetShowState(true);
1187 if (pMoreBtn != null)
1189 pMoreBtn->SetShowState(false);
1191 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1195 // show participant count on name Label
1196 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1197 if (pPeopleCountLbl)
1200 count.Append(__pActiveCallInfo->GetCallerListCount());
1202 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1203 pPeopleCountLbl->SetText(count);
1205 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1206 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1209 pNameLbl->SetText(nameStr);
1211 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1214 pVoiceIconLbl->SetShowState(false);
1216 if (pMoreBtn != null)
1218 pMoreBtn->SetShowState(true);
1220 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1221 if (pPhotoBitmap != null)
1223 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER1_PHOTO_LABEL));
1226 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1227 pPhotoLbl->Invalidate(true);
1229 delete pPhotoBitmap;
1232 //show call active time using Timer
1233 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1234 ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime);
1238 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1239 *__pHeldCallInfo = callInfo;
1241 if (__pHeldCallInfo->IsConferenceCall() == false)
1243 ShowPersonDetails(contactNo, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pHeldCallInfo);
1247 // show participant count on name Label
1248 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1249 if (pPeopleCountLbl)
1252 count.Append(__pHeldCallInfo->GetCallerListCount());
1254 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1255 pPeopleCountLbl->SetText(count);
1257 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1258 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1261 pNameLbl->SetText(nameStr);
1263 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1264 if (pPhotoBitmap != null)
1266 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER2_PHOTO_LABEL));
1269 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1270 pPhotoLbl->Invalidate(true);
1272 delete pPhotoBitmap;
1276 ShowTimerInfo(IDC_CALLER2_TIME_LABEL, true);
1280 //update JoinCall button status
1281 bool isEnableJoinCall = true;
1282 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1283 if(pConfCallInfo != null && pConfCallInfo->GetCallerListCount() >= IDI_MAX_CONF_CALL_PARTICIPANTS)
1285 isEnableJoinCall = false;
1287 __pCallButtonsPanel->EnableJoinCallButton(isEnableJoinCall);
1288 delete pConfCallInfo;
1289 pConfCallInfo = null;
1295 ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
1297 //call individual methods to show contact number, caller name & photo
1298 ShowPhoneNumber(phoneNumber, contactLblName);
1300 //fetch contact details based on phone number
1301 String* pDisplayName = pCallInfo->FetchCallerNameN();
1302 ShowCallerName(*pDisplayName, nameLblName);
1304 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1305 ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
1310 delete pDisplayName;
1311 pDisplayName = null;
1315 delete pPhotoBitmap;
1316 pPhotoBitmap = null;
1321 ActiveCallForm::ShowPhoneNumber(const String& phoneNumber, const String& contactLblName)
1323 String formattedNumber = phoneNumber;
1325 Label* pContactLbl = static_cast<Label*>(GetControl(contactLblName));
1328 pContactLbl->SetText(formattedNumber);
1329 pContactLbl->Invalidate(true);
1334 ActiveCallForm::ShowCallerName(const String& callerName, const String& nameLblName)
1336 // show display name on name Label
1337 Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
1340 //passing an empty string to SetText fails in label,
1341 //if previously valid text has been set
1342 if (callerName.IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
1344 String stringToBeSet(L" ");
1345 pNameLbl->SetText(stringToBeSet);
1349 pNameLbl->SetText(callerName);
1351 pNameLbl->Invalidate(true);
1356 ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
1358 //to check if default image is to be shown
1359 bool showDefaultPhoto = false;
1360 bool showSmallPhoto = false;
1361 String photoLabel("");
1365 case FORMTYPE_OUTGOINGCALL:
1366 case FORMTYPE_ACTIVECALL:
1368 if (pPhotoId == null)
1370 //show default caller image
1371 showDefaultPhoto = true;
1375 //Check the size of photo
1376 // Now checking the condition with && but actually it should be ||
1377 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1378 // height 270 and width = 480 . So all images set thru gallery is show as small image
1379 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1380 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1382 showSmallPhoto = true;
1386 photoLabel.Append(IDC_CALLER1_BIGPHOTO_LABEL);
1390 case FORMTYPE_MULTIPLECALLS:
1394 photoLabel.Append(IDC_CALLER2_PHOTO_LABEL);
1398 photoLabel.Append(IDC_CALLER1_PHOTO_LABEL);
1401 if (pPhotoId == null)
1403 showDefaultPhoto = true;
1407 if (pPhotoId->GetHeight() <= H_SMALL_PHOTO
1408 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1410 //pPhotoId->Scale(Dimension(W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO));
1411 showSmallPhoto = true;
1421 //Remove small photo label
1422 if (__pSmallPhotoLabel != null)
1424 RemoveControl(*__pSmallPhotoLabel);
1425 __pSmallPhotoLabel = null;
1428 //show photo - for Big Photo Id, Animated Call Image
1429 if (!showDefaultPhoto)
1431 if(showSmallPhoto == true)
1433 ShowThumbnailImage(pPhotoId,photoLabel);
1437 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1440 Canvas* pCanvas = new (std::nothrow) Canvas;
1441 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1442 pCanvas->Construct(canvasRect);
1443 //draw the contact bitmap
1444 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1445 Bitmap* pNewPhotoId = new Bitmap();
1446 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1449 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1450 pPhotoLbl->Invalidate(true);
1457 Bitmap* pDefaultPhoto = null;
1460 case FORMTYPE_OUTGOINGCALL:
1461 case FORMTYPE_ACTIVECALL:
1462 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1465 case FORMTYPE_MULTIPLECALLS:
1466 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_MULTIPLE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1469 case FORMTYPE_ACTIVECONFCALL:
1470 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BIG_BG_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1476 if (pDefaultPhoto != null)
1478 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1481 pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
1483 delete pDefaultPhoto;
1489 ActiveCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,String& photoLabel)
1491 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1493 if (pPhotoLbl != null && pPhotoId != null)
1495 Canvas* pCanvas = new (std::nothrow) Canvas;
1496 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1497 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1498 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1499 pCanvas->Construct(canvasRect);
1500 //draw the back ground
1501 pCanvas->DrawBitmap(canvasRect,*pBackground);
1502 //draw shadow (to be enabled after correct shadow image is provided )
1503 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1504 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1505 //draw the contact bitmap
1506 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1507 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1508 Bitmap* pNewPhotoId = new Bitmap();
1509 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1512 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1513 pPhotoLbl->Invalidate(true);
1522 ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1524 if (__pSmallPhotoLabel != null)
1526 RemoveControl(*__pSmallPhotoLabel);
1527 __pSmallPhotoLabel = null;
1529 //Draw Small Photo and show on small photo label
1530 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1531 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1532 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1533 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1534 // Add a Label to the Form
1535 AddControl(*__pSmallPhotoLabel);
1536 __pSmallPhotoLabel->Invalidate(true);
1540 ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long long startTime)
1542 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1544 if (__pActiveCallTimer == null)
1546 __pActiveCallTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
1547 __pActiveCallTimer->Construct(*this);
1550 if (pTimerLbl != null)
1552 if (isOnHold == true)
1554 pTimerLbl->SetText(AppUtility::GetResourceString(IDS_TIMER_ON_HOLD));
1555 //update Hold button status
1556 SetHoldButtonStatus(false);
1560 //update Hold button status
1561 SetHoldButtonStatus(true);
1562 //current system time
1563 long long currTime = 0;
1564 SystemTime::GetTicks(currTime);
1566 TimeSpan diffSpan(abs(startTime - currTime));
1568 String activeCallTime(L"");
1570 long long hr = diffSpan.GetHours();
1573 activeCallTime.Append("0");
1575 activeCallTime.Append(hr);
1576 activeCallTime.Append(L":");
1578 long long min = diffSpan.GetMinutes();
1581 activeCallTime.Append("0");
1583 activeCallTime.Append(min);
1584 activeCallTime.Append(L":");
1586 long long sec = diffSpan.GetSeconds();
1589 activeCallTime.Append("0");
1591 activeCallTime.Append(sec);
1593 pTimerLbl->SetText(activeCallTime);
1594 __pActiveCallTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
1596 pTimerLbl->Invalidate(true);
1601 ActiveCallForm::SetShowStateOnKeypad(bool showState)
1603 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1604 pLblControl->SetShowState(showState);
1605 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL));
1606 pLblControl->SetShowState(showState);
1607 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1608 pLblControl->SetShowState(showState);
1609 if (__pSmallPhotoLabel != null)
1611 __pSmallPhotoLabel->SetShowState(showState);
1616 case FORMTYPE_ACTIVECALL:
1618 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1619 pLblControl->SetShowState(showState);
1620 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1621 pLblControl->SetShowState(showState);
1622 pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1623 pLblControl->SetShowState(showState);
1624 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1625 pButtonControl->SetShowState(showState);
1629 case FORMTYPE_MULTIPLECALLS:
1631 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1632 pLblControl->SetShowState(showState);
1633 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1634 pLblControl->SetShowState(showState);
1635 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1636 pLblControl->SetShowState(showState);
1637 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1638 pLblControl->SetShowState(showState);
1639 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1640 pLblControl->SetShowState(showState);
1641 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1642 pLblControl->SetShowState(showState);
1643 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == false)
1645 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1646 pLblControl->SetShowState(showState);
1650 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1651 pButtonControl->SetShowState(showState);
1653 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1654 pButtonControl->SetShowState(showState);
1658 case FORMTYPE_ACTIVECONFCALL:
1660 pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1661 pLblControl->SetShowState(showState);
1662 pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1663 pLblControl->SetShowState(showState);
1664 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1665 pButtonControl->SetShowState(showState);
1666 pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1667 pButtonControl->SetShowState(showState);
1677 ActiveCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1679 //Call default implementation of "Object.Equals()"
1680 //returns true, if they are pointing to same address.
1681 if (__pActiveCallTimer->Equals(timer))
1683 Label* pTimerLbl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1686 String activeCallTime = pTimerLbl->GetText();
1687 // Create a StringTokenizer instance
1688 StringTokenizer strTokens(activeCallTime, L":");
1690 int count = strTokens.GetTokenCount(); // count == 3
1695 for (int index = 0; index < count; index++)
1700 strTokens.GetNextToken(token);
1701 Integer::Parse(token, hr);
1705 strTokens.GetNextToken(token);
1706 Integer::Parse(token, min);
1710 strTokens.GetNextToken(token);
1711 Integer::Parse(token, sec);
1717 if (sec == IDI_MAX_SECONDS)
1722 if (min == IDI_MAX_MINS)
1729 activeCallTime.Clear();
1732 activeCallTime.Append("0");
1734 activeCallTime.Append(hr);
1735 activeCallTime.Append(":");
1738 activeCallTime.Append("0");
1740 activeCallTime.Append(min);
1741 activeCallTime.Append(":");
1744 activeCallTime.Append("0");
1746 activeCallTime.Append(sec);
1747 //update timer label
1748 pTimerLbl->SetText(activeCallTime);
1749 pTimerLbl->Invalidate(true);
1754 ///////////////////////////////////////////////////////////
1755 /////////// Options Menu List Functionality /////////
1756 ///////////////////////////////////////////////////////////
1758 ActiveCallForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
1763 ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
1765 //Goto conference call list form
1766 SceneManager* pSceneManager = SceneManager::GetInstance();
1767 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST), null);
1771 ActiveCallForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
1776 ActiveCallForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
1781 ActiveCallForm::GetItemCount(void)
1783 return IDI_MOREOPTIONS_LIST_ITEMS;
1787 ActiveCallForm::CreateItem(int index, int itemWidth)
1789 //create 1st Menu option
1790 CustomItem* pItem = new (std::nothrow) CustomItem();
1791 pItem->Construct(IDI_OPTIONMENU_DIMEN, LIST_ANNEX_STYLE_NORMAL);
1793 //Set background 9-patch bitmap to option menu
1794 Bitmap* pBgBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_BG_ICON);
1795 if (pBgBmp != null && pBgBmp->IsNinePatchedBitmap())
1798 bgCanvas.Construct(Rectangle(IDI_OPTIONMENU_POS, IDI_OPTIONMENU_DIMEN));
1799 bgCanvas.DrawNinePatchedBitmap(bgCanvas.GetBounds(), *pBgBmp);
1803 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color(40, 45, 48));
1808 //Set bitmap to option menu
1809 Bitmap* pNormalConfCallBmp = AppUtility::GetBitmapFromResourcesN(IDB_MORE_MANAGE_CONFERENCE_ICON ,
1810 W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP);
1811 pItem->AddElement(Rectangle(16, 17, W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP), 1, *pNormalConfCallBmp, null, null);
1812 // Deallocate bitmaps
1813 delete pNormalConfCallBmp;
1814 pNormalConfCallBmp = null;
1816 //Set text to menu option
1817 String confCallName = AppUtility::GetResourceString(IDS_MGR_CONF_CALL_LIST_STR);
1819 TextElement* pTextElement = new (std::nothrow) TextElement();
1820 pTextElement->Construct(confCallName);
1821 pTextElement->SetTextColor(COLOR_POPUP_TEXT);
1824 font.Construct(FONT_STYLE_PLAIN, IDI_POPUP_TEXT_SIZE);
1825 pTextElement->SetFont(font);
1826 //construct Enriched text
1827 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1828 Dimension textDimension;
1829 font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
1830 textDimension.height = textDimension.height + font.GetDescender();
1831 pEnrichedText->Construct(textDimension);
1832 //add text element to enriched text
1833 pEnrichedText->Add(*pTextElement);
1835 //Add Enriched text to pItem
1836 Point textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
1837 pItem->AddElement(Rectangle(textPos, textDimension), 2, *pEnrichedText);
1839 pEnrichedText->RemoveAll(true);
1840 delete pEnrichedText;
1845 ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)