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 RemoveControl(*__pMoreOptionsList);
121 __pMoreOptionsList = null;
123 if (__pMoreOptionsListAnchor != null)
125 RemoveControl(*__pMoreOptionsListAnchor);
126 __pMoreOptionsListAnchor = null;
128 if (__pSmallPhotoLabel != null)
130 RemoveControl(*__pSmallPhotoLabel);
131 __pSmallPhotoLabel = null;
133 if (__pActiveCallInfo != null)
135 delete __pActiveCallInfo;
137 if (__pHeldCallInfo != null)
139 delete __pHeldCallInfo;
141 if(__pDTMFKeypad != null)
143 RemoveControl(*__pDTMFKeypad);
144 __pDTMFKeypad = null;
149 ActiveCallForm::Initialize(void)
153 case FORMTYPE_OUTGOINGCALL:
154 Construct(IDL_OUTCALL_FORM);
157 case FORMTYPE_EMERGENCYOUTGOINGCALL:
158 Construct(IDL_OUT_EMERGENCYCALL_FORM);
161 case FORMTYPE_ACTIVECALL:
162 Construct(IDL_CALL_FORM);
165 case FORMTYPE_EMERGENCYACTIVECALL:
166 Construct(IDL_EMERGENCY_CALL_FORM);
169 case FORMTYPE_MULTIPLECALLS:
170 Construct(IDL_MULTIPLE_CALL_FORM);
173 case FORMTYPE_ACTIVECONFCALL:
174 Construct(IDL_CONFCALL_FORM);
183 ActiveCallForm::OnInitializing(void)
185 result r = E_SUCCESS;
187 //Hold Button - Shown on single active/conf call scene
188 InitializeHoldButton();
189 //Swap button for multiple call screen
190 InitializeSwapButton();
191 //Initialize manage conf. call list form
192 InitializeManageConfCallButton();
194 __pCallPresentor = CallPresentationModel::GetInstance();
199 ActiveCallForm::ShowDTMFKeypad(void)
201 if(__pDTMFKeypad != null)
203 RemoveControl(*__pDTMFKeypad);
204 __pDTMFKeypad = null;
207 if(__pDTMFKeypad == null)
209 //update rect according to client screen area
210 Rectangle rect(0, 0, 0, 0);
211 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT)
213 rect.width = GetClientAreaBounds().width;
214 rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight();
216 else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE)
218 rect.height = GetClientAreaBounds().height;
219 rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth();
222 AppLog("rect(%d,%d,%d,%d)",rect.x,rect.y,rect.width,rect.height);
223 __pDTMFKeypad = new (std::nothrow) DtmfKeyPadPanel();
224 __pDTMFKeypad->Initialize(this, rect);
225 AddControl(*__pDTMFKeypad);
227 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
228 pTextBox->SetText(L"");
229 __pDTMFKeypad->SetShowState(true);
230 __pDTMFKeypad->Draw(true);
231 __pDTMFKeypad->Show();
235 ActiveCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
239 if (__pCallButtonsPanel != null)
241 //update position of call buttons panel
242 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
243 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
245 //bring button on top
246 __pCallButtonsPanel->SetButtonPosition();
248 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
249 if (pRelativeLayout != null)
251 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
254 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
255 if (pRelativeLayout != null)
257 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
258 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
261 //change orientation of DTMF Keypad, if it is visible.
262 if (__pDTMFKeypad != null)
264 if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE)
266 //in landscape mode, caller info is visible.
267 SetShowStateOnKeypad(true);
269 else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT)
271 //in Portrait mode it is hidden beneath DTMF Keypad.
272 SetShowStateOnKeypad(false);
274 String dtmfText = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
277 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
278 pTextBox->SetText(dtmfText);
284 ActiveCallForm::HideDTMFKeypad(void)
286 if(__pDTMFKeypad != null)
288 RemoveControl(*__pDTMFKeypad);
289 __pDTMFKeypad = null;
294 ActiveCallForm::InitializeCallButtonsPanel(void)
296 result r = E_SUCCESS;
297 //Set background bitmap for call keypad
298 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
299 Bitmap* pBgBitmap = AppUtility::GetBitmapFromResourcesN(IDB_BACKGROUND_BITMAP, pKeysBgLbl->GetWidth(), pKeysBgLbl->GetHeight());
300 if (pBgBitmap != null)
302 pKeysBgLbl->SetBackgroundBitmap(*pBgBitmap);
305 if (__pCallButtonsPanel == null)
307 __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
308 __pCallButtonsPanel->ConstructPanel(this, __formType);
309 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
310 r = AddControl(*__pCallButtonsPanel);
313 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
314 if (pRelativeLayout != null)
316 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
318 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
319 if (pRelativeLayout != null)
321 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
322 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
329 ActiveCallForm::InitializeSwapButton(void)
331 Button* pSwapBtn = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
334 Bitmap* pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_NORMAL,
335 W_HOLD_BITMAP, H_HOLD_BITMAP);
338 pSwapBtn->SetNormalBitmap(Point(0, 0), *pSwapBmp);
343 pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_PRESS,
344 W_HOLD_BITMAP, H_HOLD_BITMAP);
347 pSwapBtn->SetPressedBitmap(Point(0, 0), *pSwapBmp);
351 pSwapBtn->SetActionId(IDA_SWAP_CALLS);
352 pSwapBtn->AddActionEventListener(*this);
357 ActiveCallForm::InitializeManageConfCallButton(void)
359 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
360 if (pMoreBtn != null)
362 pMoreBtn->SetActionId(IDA_MORE_OPTIONS_MENU);
363 pMoreBtn->AddActionEventListener(*this);
364 if (__formType == FORMTYPE_MULTIPLECALLS)
366 //Correct state will be set in OnSceneActivated based on the call
367 pMoreBtn->SetShowState(false);
369 else if (__formType == FORMTYPE_ACTIVECONFCALL)
371 pMoreBtn->SetShowState(true);
377 ActiveCallForm::InitializeHoldButton(void)
379 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
380 if (pHoldBtn != null)
382 //set status of Hold Button
383 SetHoldButtonStatus(true);
384 pHoldBtn->AddActionEventListener(*this);
389 ActiveCallForm::SetHoldButtonStatus(bool toHoldCall)
391 //background bitmap & button name
393 Bitmap* normalImg = null;
394 Bitmap* pressImg = null;
397 btnName.Append(AppUtility::GetResourceString(IDS_HOLD_BTN_NAME));
398 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_NORMAL_BUTTON_ICON,
399 W_HOLD_BITMAP, H_HOLD_BITMAP);
400 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_PRESS_BUTTON_ICON,
401 W_HOLD_BITMAP, H_HOLD_BITMAP);
405 btnName.Append(AppUtility::GetResourceString(IDS_UNHOLD_BTN_NAME));
406 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_NORMAL_BUTTON_ICON,
407 W_HOLD_BITMAP, H_HOLD_BITMAP);
408 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_PRESS_BUTTON_ICON,
409 W_HOLD_BITMAP, H_HOLD_BITMAP);
413 CommandIds cmdId = IDA_HOLD_CALL;
416 case FORMTYPE_ACTIVECALL:
418 cmdId = toHoldCall ? IDA_HOLD_CALL : IDA_UNHOLD_CALL;
422 case FORMTYPE_ACTIVECONFCALL:
424 cmdId = toHoldCall ? IDA_HOLD_CONF_CALL : IDA_UNHOLD_CONF_CALL;
432 //set background bitmap, button name & action id
433 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
434 Label* pHoldLbl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
437 pHoldBtn->SetActionId(cmdId);
438 pHoldBtn->SetNormalBitmap(Point(0, 0),*normalImg);
439 pHoldBtn->SetPressedBitmap(Point(0, 0),*pressImg);
443 pHoldLbl->SetText(btnName);
444 pHoldLbl->Invalidate(true);
455 ActiveCallForm::CreateMoreOptionsMenuList(void)
457 //create option list anchor
458 if (__pMoreOptionsListAnchor == null)
460 Bitmap* pBgPopupArwBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_ARROW_ICON, W_OPTION_ANCHOR,
462 __pMoreOptionsListAnchor = new (std::nothrow) Label();
463 __pMoreOptionsListAnchor->Construct(Rectangle(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_ICON, Y_POPUP_ANCHOR, W_POPUP_ANCHOR, H_POPUP_ANCHOR), L"");
464 __pMoreOptionsListAnchor->SetBackgroundBitmap(*pBgPopupArwBmp);
466 delete pBgPopupArwBmp;
467 pBgPopupArwBmp = null;
469 // Adds a Label to the Form
470 AddControl(*__pMoreOptionsListAnchor);
473 //create options menu list
474 if (__pMoreOptionsList == null)
476 __pMoreOptionsList = new (std::nothrow) ListView();
477 __pMoreOptionsList->Construct(Rectangle(Point(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_LABEL,H_MORE_LABEL), IDI_OPTIONMENU_DIMEN), false, SCROLL_STYLE_FADE_OUT);
478 __pMoreOptionsList->SetItemProvider(*this);
479 __pMoreOptionsList->AddListViewItemEventListener(*this);
480 //Add option list to the form
481 AddControl(*__pMoreOptionsList);
485 //Hide option menu list
486 DestroyMoreOptionsMenuList();
491 ActiveCallForm::DestroyMoreOptionsMenuList(void)
493 if (__pMoreOptionsListAnchor != null)
495 //removes and delete the child control
496 RemoveControl(*__pMoreOptionsListAnchor);
497 __pMoreOptionsListAnchor = null;
500 if (__pMoreOptionsList != null)
502 //removes and delete the child control
503 RemoveControl(*__pMoreOptionsList);
504 __pMoreOptionsList = null;
509 ActiveCallForm::OnTerminating(void)
511 result r = E_SUCCESS;
512 if (__pCallPresentor != null)
514 __pCallPresentor = null;
520 ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
528 //End the currently active / dialing call
529 if (__pActiveCallInfo->IsConferenceCall() == false)
531 String activeContactNo;
532 activeContactNo.Append(__pActiveCallInfo->GetContactNumber());
533 //Check if it is call is in dialing state, then
534 if (__formType == FORMTYPE_EMERGENCYOUTGOINGCALL || __formType == FORMTYPE_OUTGOINGCALL)
536 __pCallPresentor->EndDialingCall(activeContactNo);
541 __pCallPresentor->EndActiveCall(*__pActiveCallInfo->GetCallHandle());
546 __pCallPresentor->EndConferenceCall();
551 case IDA_END_CONF_CALL:
553 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
554 __pCallPresentor->EndConferenceCall();
558 case IDA_OPEN_NUMKEYPAD:
560 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT)
562 //hide only in portrait mode.
563 SetShowStateOnKeypad(false);
566 SetTextToDTMFTextField(L"");
567 __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
571 case IDA_CLOSE_NUMKEYPAD:
573 SetShowStateOnKeypad(true);
575 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
581 //switch to Dialer Form to make an call
582 if(__pCallPresentor->GetCurrentCallCount() == 1)
584 /* ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
586 String* formType = new (std::nothrow) String();
587 formType->Append(__formType);
588 pArgs->Add(formType);
589 pSceneManager->GoForward( ForwardSceneTransition(IDSCN_DIALER, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
590 SCENE_HISTORY_OPTION_NO_HISTORY), pArgs);*/
591 __pCallPresentor->LaunchDialAppControl();
600 if (__pActiveCallInfo->IsConferenceCall() == false)
602 if(__pActiveCallInfo->GetCallHandle() != null)
604 success = __pCallPresentor->HoldCall(*__pActiveCallInfo->GetCallHandle());
609 success = __pCallPresentor->HoldConferenceCall();
611 //reset hold status and "OnHold" text
612 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
613 if(__pActiveCallTimer != null)
615 __pActiveCallTimer->Cancel();
617 SetHoldButtonStatus(!success);
621 case IDA_UNHOLD_CALL:
623 bool success = false;
624 if (__pActiveCallInfo->IsConferenceCall() == false)
626 if(__pActiveCallInfo->GetCallHandle() != null)
628 success = __pCallPresentor->UnHoldCall(*__pActiveCallInfo->GetCallHandle());
633 success = __pCallPresentor->ActivateConferenceCall();
635 //reset hold status and show call timer
636 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
637 SetHoldButtonStatus(success);
641 case IDA_HOLD_CONF_CALL:
643 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
644 bool success = __pCallPresentor->HoldConferenceCall();
645 //reset hold status and "OnHold" text
646 SetHoldButtonStatus(!success);
647 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
648 if(__pActiveCallTimer != null)
650 __pActiveCallTimer->Cancel();
655 case IDA_UNHOLD_CONF_CALL:
657 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
658 bool success = __pCallPresentor->ActivateConferenceCall();
659 //reset hold status and show call timer
660 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
661 SetHoldButtonStatus(success);
665 case IDA_OPEN_CONTACTS:
668 //Launch call application
669 AppManager* pAppManager = AppManager::GetInstance();
670 pAppManager->LaunchApplication(PROVIDER_ID_CONTACTS);
676 bool success = __pCallPresentor->SetMuteStatus(true);
679 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
686 bool success = __pCallPresentor->SetMuteStatus(false);
689 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
696 bool success = __pCallPresentor->SetSpeakerStatus(true);
699 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
704 case IDA_SPEAKER_OFF:
706 bool success = __pCallPresentor->SetSpeakerStatus(false);
709 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
716 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
717 __pCallPresentor->JoinCall();
723 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
724 __pCallPresentor->SwapCalls();
728 case IDA_MORE_OPTIONS_MENU:
730 //Show 'more' options menu
731 CreateMoreOptionsMenuList();
737 dtmfString.Append(L"0");
738 SetTextToDTMFTextField(dtmfString);
739 __pCallPresentor->SendDTMFSignal(dtmfString);
745 dtmfString.Append(L"1");
746 SetTextToDTMFTextField(dtmfString);
747 __pCallPresentor->SendDTMFSignal(dtmfString);
753 dtmfString.Append(L"2");
754 SetTextToDTMFTextField(dtmfString);
755 __pCallPresentor->SendDTMFSignal(dtmfString);
761 dtmfString.Append(L"3");
762 SetTextToDTMFTextField(dtmfString);
763 __pCallPresentor->SendDTMFSignal(dtmfString);
769 dtmfString.Append(L"4");
770 SetTextToDTMFTextField(dtmfString);
771 __pCallPresentor->SendDTMFSignal(dtmfString);
777 dtmfString.Append(L"5");
778 SetTextToDTMFTextField(dtmfString);
779 __pCallPresentor->SendDTMFSignal(dtmfString);
785 dtmfString.Append(L"6");
786 SetTextToDTMFTextField(dtmfString);
787 __pCallPresentor->SendDTMFSignal(dtmfString);
793 dtmfString.Append(L"7");
794 SetTextToDTMFTextField(dtmfString);
795 __pCallPresentor->SendDTMFSignal(dtmfString);
801 dtmfString.Append(L"8");
802 SetTextToDTMFTextField(dtmfString);
803 __pCallPresentor->SendDTMFSignal(dtmfString);
809 dtmfString.Append(L"9");
810 SetTextToDTMFTextField(dtmfString);
811 __pCallPresentor->SendDTMFSignal(dtmfString);
817 dtmfString.Append(L"*");
818 SetTextToDTMFTextField(dtmfString);
819 __pCallPresentor->SendDTMFSignal(dtmfString);
825 dtmfString.Append(L"#");
826 SetTextToDTMFTextField(dtmfString);
827 __pCallPresentor->SendDTMFSignal(dtmfString);
837 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
839 if(__pDTMFKeypad != null)
841 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
842 pTextBox->AppendText(dtmfStr);
843 pTextBox->SetFocus();
844 pTextBox->Invalidate(true);
849 ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
852 //set itself as listener
853 __pCallPresentor->SetTelEventListener(this);
854 AddOrientationEventListener(*this);
856 //Initialize keypad and buttons
857 InitializeCallButtonsPanel();
859 if (__pActiveCallInfo != null)
861 delete __pActiveCallInfo;
862 __pActiveCallInfo = null;
864 if (__pHeldCallInfo != null)
866 delete __pHeldCallInfo;
867 __pHeldCallInfo = null;
869 DestroyMoreOptionsMenuList();
873 case FORMTYPE_OUTGOINGCALL:
876 contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
877 __pActiveCallInfo = new (std::nothrow) CallInfo();
878 __pActiveCallInfo->SetContactNumber(contactNo);
879 Contact* pContact = __pCallPresentor->GetContactN(contactNo);
880 if (pContact != null)
882 __pActiveCallInfo->SetContactInfo(*pContact);
885 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
886 //make an normal outgoing call
887 __pCallPresentor->DialCall(contactNo, false);
891 case FORMTYPE_EMERGENCYOUTGOINGCALL:
893 String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
894 __pActiveCallInfo = new (std::nothrow) CallInfo();
895 long long phNumber = 0;
896 LongLong::Parse(*pContactNo, phNumber);
897 __pActiveCallInfo->SetContactNumber(*pContactNo);
898 //make an emergency call
899 __pCallPresentor->DialCall(*pContactNo, true);
903 case FORMTYPE_ACTIVECALL:
906 CallInfo* pCall = static_cast<CallInfo*>(pArgs->GetAt(0));
908 __pActiveCallInfo = new (std::nothrow) CallInfo();
909 *__pActiveCallInfo = *pCall;
910 String activeContactNo;
911 if(pCall->GetContactNumber().IsEmpty() == false)
913 activeContactNo.Append(pCall->GetContactNumber());
917 activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
919 ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
921 //show call active time using Timer
922 __activeCallStartTime = pCall->GetCallConnectTime();
923 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
927 case FORMTYPE_EMERGENCYACTIVECALL:
930 CallInfo* pCall = static_cast<CallInfo*>(pArgs->GetAt(0));
932 __pActiveCallInfo = new (std::nothrow) CallInfo();
933 *__pActiveCallInfo = *pCall;
935 //show call active time using Timer
936 __activeCallStartTime = pCall->GetCallConnectTime();
937 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
941 case FORMTYPE_MULTIPLECALLS:
943 IListT<CallInfo>* pCallsList = __pCallPresentor->GetCallListN();
945 UpdateMultipleCallScreen(*pCallsList);
951 case FORMTYPE_ACTIVECONFCALL:
954 CallInfo* pConfInfo = static_cast<CallInfo*>(pArgs->GetAt(0));
955 __pActiveCallInfo = new (std::nothrow) CallInfo();
956 *__pActiveCallInfo = *pConfInfo;
958 int participantsCount = __pActiveCallInfo->GetCallerListCount();
960 // show participant count on name Label
961 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
965 count.Append(participantsCount);
967 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
968 pPeopleCountLbl->SetText(count);
971 if(participantsCount >= IDI_MAX_CONF_CALL_PARTICIPANTS)
973 __pCallButtonsPanel->EnableAddCallButton(false);
977 __pCallButtonsPanel->EnableAddCallButton(true);
980 //show call active time using Timer
981 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
982 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime);
990 //Hide DTMFKeypad, if visible and show caller info
992 SetShowStateOnKeypad(true);
993 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
995 //Set the correct speaker status
996 if(__pCallPresentor->IsSpeakerOn() == true)
998 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
1002 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
1005 //Set the correct Mute status
1006 if (__pCallPresentor->IsCallMuted() == true)
1008 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
1012 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
1024 ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1026 RemoveOrientationEventListener(*this);
1027 if (__pCallButtonsPanel != null)
1029 RemoveControl(*__pCallButtonsPanel);
1030 __pCallButtonsPanel = null;
1032 if (__pActiveCallTimer != null)
1034 __pActiveCallTimer->Cancel();
1035 delete __pActiveCallTimer;
1036 __pActiveCallTimer = null;
1038 if (__pSmallPhotoLabel != null)
1040 __pSmallPhotoLabel->SetShowState(false);
1042 //Hide "Manage conf. Call" Context menu
1043 if (__pMoreOptionsListAnchor != null)
1045 __pMoreOptionsListAnchor->SetShowState(false);
1047 if (__pMoreOptionsList != null)
1049 __pMoreOptionsList->SetShowState(false);
1054 ActiveCallForm::HandleConfCallChanged(void)
1057 AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
1058 //fetch changed conference call info
1059 CallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1060 if (pConfCallInfo == null)
1066 //fetch participant count in conf call
1067 int participantsCount = pConfCallInfo->GetCallerListCount();
1068 //update status of join and Add call
1069 bool isEnableAddCall = false;
1070 bool isEnableJoinCall = false;
1071 if(participantsCount < IDI_MAX_CONF_CALL_PARTICIPANTS)
1073 //available only at Active conf. call or active call screen
1074 isEnableAddCall = true;
1075 //join button is available only at multiple call screen
1076 isEnableJoinCall = true;
1079 Label* pPeopleCountLbl = null;
1080 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == true)
1082 //Active call is conference call
1083 delete __pActiveCallInfo;
1084 __pActiveCallInfo = new (std::nothrow) CallInfo();
1085 *__pActiveCallInfo = *pConfCallInfo;
1087 if (__formType == FORMTYPE_MULTIPLECALLS)
1089 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1091 else if (__formType == FORMTYPE_ACTIVECONFCALL)
1093 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1094 AppLog("Active conf call...(%d)", pPeopleCountLbl);
1097 else if(__pHeldCallInfo != null && __pHeldCallInfo->IsConferenceCall() == true)
1099 //Held call is conference call - this is definitely multiple call screen.
1100 delete __pHeldCallInfo;
1101 __pHeldCallInfo = new (std::nothrow) CallInfo();
1102 *__pHeldCallInfo = *pConfCallInfo;
1103 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1106 // update participant count on name Label
1107 if (pPeopleCountLbl != null)
1110 count.Append(participantsCount);
1112 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1113 pPeopleCountLbl->SetText(count);
1114 pPeopleCountLbl->Invalidate(true);
1116 //change AddCall Button status
1117 __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
1118 //change JoinCall Button status
1119 __pCallButtonsPanel->EnableJoinCallButton(isEnableJoinCall);
1124 ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<CallInfo>& activeCallsList)
1127 if(__pActiveCallInfo != null)
1129 delete __pActiveCallInfo;
1130 __pActiveCallInfo = null;
1132 if(__pHeldCallInfo != null)
1134 delete __pHeldCallInfo;
1135 __pHeldCallInfo = null;
1138 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1139 if (pMoreBtn != null)
1141 pMoreBtn->SetShowState(false);
1144 //show caller's info.
1145 for (int index = 0; index < activeCallsList.GetCount(); index++)
1149 activeCallsList.GetAt(index, callInfo);
1152 if(callInfo.GetContactNumber().IsEmpty() == false)
1154 contactNo.Append(callInfo.GetContactNumber());
1158 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1161 if (callInfo.IsOnHold() == false)
1163 __pActiveCallInfo = new (std::nothrow) CallInfo();
1164 *__pActiveCallInfo = callInfo;
1166 if (__pActiveCallInfo->IsConferenceCall() == false)
1168 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1171 pVoiceIconLbl->SetShowState(true);
1173 if (pMoreBtn != null)
1175 pMoreBtn->SetShowState(false);
1177 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1181 // show participant count on name Label
1182 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1183 if (pPeopleCountLbl)
1186 count.Append(__pActiveCallInfo->GetCallerListCount());
1188 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1189 pPeopleCountLbl->SetText(count);
1191 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1192 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1195 pNameLbl->SetText(nameStr);
1197 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1200 pVoiceIconLbl->SetShowState(false);
1202 if (pMoreBtn != null)
1204 pMoreBtn->SetShowState(true);
1206 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1207 if (pPhotoBitmap != null)
1209 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER1_PHOTO_LABEL));
1212 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1213 pPhotoLbl->Invalidate(true);
1215 delete pPhotoBitmap;
1218 //show call active time using Timer
1219 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1220 ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime);
1224 __pHeldCallInfo = new (std::nothrow) CallInfo();
1225 *__pHeldCallInfo = callInfo;
1227 if (__pHeldCallInfo->IsConferenceCall() == false)
1229 ShowPersonDetails(contactNo, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pHeldCallInfo);
1233 // show participant count on name Label
1234 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1235 if (pPeopleCountLbl)
1238 count.Append(__pHeldCallInfo->GetCallerListCount());
1240 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1241 pPeopleCountLbl->SetText(count);
1243 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1244 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1247 pNameLbl->SetText(nameStr);
1249 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1250 if (pPhotoBitmap != null)
1252 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER2_PHOTO_LABEL));
1255 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1256 pPhotoLbl->Invalidate(true);
1258 delete pPhotoBitmap;
1262 ShowTimerInfo(IDC_CALLER2_TIME_LABEL, true);
1266 //update JoinCall button status
1267 bool isEnableJoinCall = true;
1268 CallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1269 if(pConfCallInfo != null && pConfCallInfo->GetCallerListCount() >= IDI_MAX_CONF_CALL_PARTICIPANTS)
1271 isEnableJoinCall = false;
1273 __pCallButtonsPanel->EnableJoinCallButton(isEnableJoinCall);
1274 delete pConfCallInfo;
1275 pConfCallInfo = null;
1281 ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, CallInfo* pCallInfo)
1283 //call individual methods to show contact number, caller name & photo
1284 ShowPhoneNumber(phoneNumber, contactLblName);
1286 //fetch contact details based on phone number
1287 String* pDisplayName = pCallInfo->FetchCallerNameN();
1288 ShowCallerName(*pDisplayName, nameLblName);
1290 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1291 ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
1296 delete pDisplayName;
1297 pDisplayName = null;
1301 delete pPhotoBitmap;
1302 pPhotoBitmap = null;
1307 ActiveCallForm::ShowPhoneNumber(const String& phoneNumber, const String& contactLblName)
1309 String formattedNumber = phoneNumber;
1311 Label* pContactLbl = static_cast<Label*>(GetControl(contactLblName));
1314 pContactLbl->SetText(formattedNumber);
1315 pContactLbl->Invalidate(true);
1320 ActiveCallForm::ShowCallerName(const String& callerName, const String& nameLblName)
1322 // show display name on name Label
1323 Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
1326 //passing an empty string to SetText fails in label,
1327 //if previously valid text has been set
1328 if (callerName.IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
1330 String stringToBeSet(L" ");
1331 pNameLbl->SetText(stringToBeSet);
1335 pNameLbl->SetText(callerName);
1337 pNameLbl->Invalidate(true);
1342 ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
1344 //to check if default image is to be shown
1345 bool showDefaultPhoto = false;
1346 bool showSmallPhoto = false;
1347 String photoLabel("");
1351 case FORMTYPE_OUTGOINGCALL:
1352 case FORMTYPE_ACTIVECALL:
1354 if (pPhotoId == null)
1356 //show default caller image
1357 showDefaultPhoto = true;
1361 //Check the size of photo
1362 // Now checking the condition with && but actually it should be ||
1363 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1364 // height 270 and width = 480 . So all images set thru gallery is show as small image
1365 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1366 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1368 showSmallPhoto = true;
1372 photoLabel.Append(IDC_CALLER1_BIGPHOTO_LABEL);
1376 case FORMTYPE_MULTIPLECALLS:
1380 photoLabel.Append(IDC_CALLER2_PHOTO_LABEL);
1384 photoLabel.Append(IDC_CALLER1_PHOTO_LABEL);
1387 if (pPhotoId == null)
1389 showDefaultPhoto = true;
1393 if (pPhotoId->GetHeight() <= H_SMALL_PHOTO
1394 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1396 //pPhotoId->Scale(Dimension(W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO));
1397 showSmallPhoto = true;
1407 //Remove small photo label
1408 if (__pSmallPhotoLabel != null)
1410 RemoveControl(*__pSmallPhotoLabel);
1411 __pSmallPhotoLabel = null;
1414 //show photo - for Big Photo Id, Animated Call Image
1415 if (!showDefaultPhoto)
1417 if(showSmallPhoto == true)
1419 ShowThumbnailImage(pPhotoId,photoLabel);
1423 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1426 Canvas* pCanvas = new (std::nothrow) Canvas;
1427 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1428 pCanvas->Construct(canvasRect);
1429 //draw the contact bitmap
1430 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1431 Bitmap* pNewPhotoId = new Bitmap();
1432 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1435 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1436 pPhotoLbl->Invalidate(true);
1443 Bitmap* pDefaultPhoto = null;
1446 case FORMTYPE_OUTGOINGCALL:
1447 case FORMTYPE_ACTIVECALL:
1448 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1451 case FORMTYPE_MULTIPLECALLS:
1452 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_MULTIPLE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1455 case FORMTYPE_ACTIVECONFCALL:
1456 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BIG_BG_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1462 if (pDefaultPhoto != null)
1464 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1467 pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
1469 delete pDefaultPhoto;
1475 ActiveCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,String& photoLabel)
1477 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1479 if (pPhotoLbl != null && pPhotoId != null)
1481 Canvas* pCanvas = new (std::nothrow) Canvas;
1482 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1483 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1484 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1485 pCanvas->Construct(canvasRect);
1486 //draw the back ground
1487 pCanvas->DrawBitmap(canvasRect,*pBackground);
1488 //draw shadow (to be enabled after correct shadow image is provided )
1489 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1490 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1491 //draw the contact bitmap
1492 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1493 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1494 Bitmap* pNewPhotoId = new Bitmap();
1495 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1498 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1499 pPhotoLbl->Invalidate(true);
1508 ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1510 if (__pSmallPhotoLabel != null)
1512 RemoveControl(*__pSmallPhotoLabel);
1513 __pSmallPhotoLabel = null;
1515 //Draw Small Photo and show on small photo label
1516 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1517 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1518 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1519 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1520 // Add a Label to the Form
1521 AddControl(*__pSmallPhotoLabel);
1522 __pSmallPhotoLabel->Invalidate(true);
1526 ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long long startTime)
1528 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1530 if (__pActiveCallTimer == null)
1532 __pActiveCallTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
1533 __pActiveCallTimer->Construct(*this);
1536 if (pTimerLbl != null)
1538 if (isOnHold == true)
1540 pTimerLbl->SetText(AppUtility::GetResourceString(IDS_TIMER_ON_HOLD));
1541 //update Hold button status
1542 SetHoldButtonStatus(false);
1546 //update Hold button status
1547 SetHoldButtonStatus(true);
1548 //current system time
1549 long long currTime = 0;
1550 SystemTime::GetTicks(currTime);
1552 TimeSpan diffSpan(abs(startTime - currTime));
1554 String activeCallTime(L"");
1556 long long hr = diffSpan.GetHours();
1559 activeCallTime.Append("0");
1561 activeCallTime.Append(hr);
1562 activeCallTime.Append(L":");
1564 long long min = diffSpan.GetMinutes();
1567 activeCallTime.Append("0");
1569 activeCallTime.Append(min);
1570 activeCallTime.Append(L":");
1572 long long sec = diffSpan.GetSeconds();
1575 activeCallTime.Append("0");
1577 activeCallTime.Append(sec);
1579 pTimerLbl->SetText(activeCallTime);
1580 __pActiveCallTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
1582 pTimerLbl->Invalidate(true);
1587 ActiveCallForm::SetShowStateOnKeypad(bool showState)
1589 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1590 pLblControl->SetShowState(showState);
1591 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL));
1592 pLblControl->SetShowState(showState);
1593 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1594 pLblControl->SetShowState(showState);
1595 if (__pSmallPhotoLabel != null)
1597 __pSmallPhotoLabel->SetShowState(showState);
1602 case FORMTYPE_ACTIVECALL:
1604 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1605 pLblControl->SetShowState(showState);
1606 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1607 pLblControl->SetShowState(showState);
1608 pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1609 pLblControl->SetShowState(showState);
1610 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1611 pButtonControl->SetShowState(showState);
1615 case FORMTYPE_MULTIPLECALLS:
1617 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1618 pLblControl->SetShowState(showState);
1619 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1620 pLblControl->SetShowState(showState);
1621 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1622 pLblControl->SetShowState(showState);
1623 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1624 pLblControl->SetShowState(showState);
1625 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1626 pLblControl->SetShowState(showState);
1627 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1628 pLblControl->SetShowState(showState);
1629 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == false)
1631 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1632 pLblControl->SetShowState(showState);
1636 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1637 pButtonControl->SetShowState(showState);
1639 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1640 pButtonControl->SetShowState(showState);
1644 case FORMTYPE_ACTIVECONFCALL:
1646 pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1647 pLblControl->SetShowState(showState);
1648 pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1649 pLblControl->SetShowState(showState);
1650 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1651 pButtonControl->SetShowState(showState);
1652 pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1653 pButtonControl->SetShowState(showState);
1663 ActiveCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1665 //Call default implementation of "Object.Equals()"
1666 //returns true, if they are pointing to same address.
1667 if (__pActiveCallTimer->Equals(timer))
1669 Label* pTimerLbl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1672 String activeCallTime = pTimerLbl->GetText();
1673 // Create a StringTokenizer instance
1674 StringTokenizer strTokens(activeCallTime, L":");
1676 int count = strTokens.GetTokenCount(); // count == 3
1681 for (int index = 0; index < count; index++)
1686 strTokens.GetNextToken(token);
1687 Integer::Parse(token, hr);
1691 strTokens.GetNextToken(token);
1692 Integer::Parse(token, min);
1696 strTokens.GetNextToken(token);
1697 Integer::Parse(token, sec);
1703 if (sec == IDI_MAX_SECONDS)
1708 if (min == IDI_MAX_MINS)
1715 activeCallTime.Clear();
1718 activeCallTime.Append("0");
1720 activeCallTime.Append(hr);
1721 activeCallTime.Append(":");
1724 activeCallTime.Append("0");
1726 activeCallTime.Append(min);
1727 activeCallTime.Append(":");
1730 activeCallTime.Append("0");
1732 activeCallTime.Append(sec);
1733 //update timer label
1734 pTimerLbl->SetText(activeCallTime);
1735 pTimerLbl->Invalidate(true);
1740 ///////////////////////////////////////////////////////////
1741 /////////// Options Menu List Functionality /////////
1742 ///////////////////////////////////////////////////////////
1744 ActiveCallForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
1749 ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
1751 //Goto conference call list form
1752 SceneManager* pSceneManager = SceneManager::GetInstance();
1753 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST), null);
1757 ActiveCallForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
1762 ActiveCallForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
1767 ActiveCallForm::GetItemCount(void)
1769 return IDI_MOREOPTIONS_LIST_ITEMS;
1773 ActiveCallForm::CreateItem(int index, int itemWidth)
1775 //create 1st Menu option
1776 CustomItem* pItem = new (std::nothrow) CustomItem();
1777 pItem->Construct(IDI_OPTIONMENU_DIMEN, LIST_ANNEX_STYLE_NORMAL);
1779 //Set background 9-patch bitmap to option menu
1780 Bitmap* pBgBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_BG_ICON);
1781 if (pBgBmp != null && pBgBmp->IsNinePatchedBitmap())
1784 bgCanvas.Construct(Rectangle(IDI_OPTIONMENU_POS, IDI_OPTIONMENU_DIMEN));
1785 bgCanvas.DrawNinePatchedBitmap(bgCanvas.GetBounds(), *pBgBmp);
1789 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color(40, 45, 48));
1794 //Set bitmap to option menu
1795 Bitmap* pNormalConfCallBmp = AppUtility::GetBitmapFromResourcesN(IDB_MORE_MANAGE_CONFERENCE_ICON ,
1796 W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP);
1797 pItem->AddElement(Rectangle(16, 17, W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP), 1, *pNormalConfCallBmp, null, null);
1798 // Deallocate bitmaps
1799 delete pNormalConfCallBmp;
1800 pNormalConfCallBmp = null;
1802 //Set text to menu option
1803 String confCallName = AppUtility::GetResourceString(IDS_MGR_CONF_CALL_LIST_STR);
1805 TextElement* pTextElement = new (std::nothrow) TextElement();
1806 pTextElement->Construct(confCallName);
1807 pTextElement->SetTextColor(COLOR_POPUP_TEXT);
1810 font.Construct(FONT_STYLE_PLAIN, IDI_POPUP_TEXT_SIZE);
1811 pTextElement->SetFont(font);
1812 //construct Enriched text
1813 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1814 Dimension textDimension;
1815 font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
1816 textDimension.height = textDimension.height + font.GetDescender();
1817 pEnrichedText->Construct(textDimension);
1818 //add text element to enriched text
1819 pEnrichedText->Add(*pTextElement);
1821 //Add Enriched text to pItem
1822 Point textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
1823 pItem->AddElement(Rectangle(textPos, textDimension), 2, *pEnrichedText);
1825 pEnrichedText->RemoveAll(true);
1826 delete pEnrichedText;
1831 ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)