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);
283 ActiveCallForm::HideDTMFKeypad(void)
285 if(__pDTMFKeypad != null)
287 __pDTMFKeypad->SetShowState(false);
288 __pDTMFKeypad->Draw(true);
289 __pDTMFKeypad->Show();
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 __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
570 case IDA_CLOSE_NUMKEYPAD:
572 SetShowStateOnKeypad(true);
574 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
580 //switch to Dialer Form to make an call
581 if(__pCallPresentor->GetCurrentCallCount() == 1)
583 /* ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
585 String* formType = new (std::nothrow) String();
586 formType->Append(__formType);
587 pArgs->Add(formType);
588 pSceneManager->GoForward( ForwardSceneTransition(IDSCN_DIALER, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
589 SCENE_HISTORY_OPTION_NO_HISTORY), pArgs);*/
590 __pCallPresentor->LaunchDialAppControl();
599 if (__pActiveCallInfo->IsConferenceCall() == false)
601 if(__pActiveCallInfo->GetCallHandle() != null)
603 success = __pCallPresentor->HoldCall(*__pActiveCallInfo->GetCallHandle());
608 success = __pCallPresentor->HoldConferenceCall();
610 //reset hold status and "OnHold" text
611 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
612 if(__pActiveCallTimer != null)
614 __pActiveCallTimer->Cancel();
616 SetHoldButtonStatus(!success);
620 case IDA_UNHOLD_CALL:
622 bool success = false;
623 if (__pActiveCallInfo->IsConferenceCall() == false)
625 if(__pActiveCallInfo->GetCallHandle() != null)
627 success = __pCallPresentor->UnHoldCall(*__pActiveCallInfo->GetCallHandle());
632 success = __pCallPresentor->ActivateConferenceCall();
634 //reset hold status and show call timer
635 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
636 SetHoldButtonStatus(success);
640 case IDA_HOLD_CONF_CALL:
642 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
643 bool success = __pCallPresentor->HoldConferenceCall();
644 //reset hold status and "OnHold" text
645 SetHoldButtonStatus(!success);
646 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
647 if(__pActiveCallTimer != null)
649 __pActiveCallTimer->Cancel();
654 case IDA_UNHOLD_CONF_CALL:
656 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
657 bool success = __pCallPresentor->ActivateConferenceCall();
658 //reset hold status and show call timer
659 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
660 SetHoldButtonStatus(success);
664 case IDA_OPEN_CONTACTS:
667 //Launch call application
668 AppManager* pAppManager = AppManager::GetInstance();
669 pAppManager->LaunchApplication(PROVIDER_ID_CONTACTS);
675 bool success = __pCallPresentor->SetMuteStatus(true);
678 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
685 bool success = __pCallPresentor->SetMuteStatus(false);
688 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
695 bool success = __pCallPresentor->SetSpeakerStatus(true);
698 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
703 case IDA_SPEAKER_OFF:
705 bool success = __pCallPresentor->SetSpeakerStatus(false);
708 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
715 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
716 __pCallPresentor->JoinCall();
722 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
723 __pCallPresentor->SwapCalls();
727 case IDA_MORE_OPTIONS_MENU:
729 //Show 'more' options menu
730 CreateMoreOptionsMenuList();
736 dtmfString.Append(L"0");
737 SetTextToDTMFTextField(dtmfString);
738 __pCallPresentor->SendDTMFSignal(dtmfString);
744 dtmfString.Append(L"1");
745 SetTextToDTMFTextField(dtmfString);
746 __pCallPresentor->SendDTMFSignal(dtmfString);
752 dtmfString.Append(L"2");
753 SetTextToDTMFTextField(dtmfString);
754 __pCallPresentor->SendDTMFSignal(dtmfString);
760 dtmfString.Append(L"3");
761 SetTextToDTMFTextField(dtmfString);
762 __pCallPresentor->SendDTMFSignal(dtmfString);
768 dtmfString.Append(L"4");
769 SetTextToDTMFTextField(dtmfString);
770 __pCallPresentor->SendDTMFSignal(dtmfString);
776 dtmfString.Append(L"5");
777 SetTextToDTMFTextField(dtmfString);
778 __pCallPresentor->SendDTMFSignal(dtmfString);
784 dtmfString.Append(L"6");
785 SetTextToDTMFTextField(dtmfString);
786 __pCallPresentor->SendDTMFSignal(dtmfString);
792 dtmfString.Append(L"7");
793 SetTextToDTMFTextField(dtmfString);
794 __pCallPresentor->SendDTMFSignal(dtmfString);
800 dtmfString.Append(L"8");
801 SetTextToDTMFTextField(dtmfString);
802 __pCallPresentor->SendDTMFSignal(dtmfString);
808 dtmfString.Append(L"9");
809 SetTextToDTMFTextField(dtmfString);
810 __pCallPresentor->SendDTMFSignal(dtmfString);
816 dtmfString.Append(L"*");
817 SetTextToDTMFTextField(dtmfString);
818 __pCallPresentor->SendDTMFSignal(dtmfString);
824 dtmfString.Append(L"#");
825 SetTextToDTMFTextField(dtmfString);
826 __pCallPresentor->SendDTMFSignal(dtmfString);
836 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
838 if(__pDTMFKeypad != null)
840 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
842 int startpos=-1,endpos=-1;
843 pTextBox->GetBlockRange(startpos,endpos);
847 pTextBox->ReleaseBlock();
850 pTextBox->InsertTextAtCursorPosition(dtmfStr);
851 //pTextBox->AppendText(dtmfStr);
852 pTextBox->SetFocus();
853 pTextBox->Invalidate(true);
858 ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
861 //set itself as listener
862 __pCallPresentor->SetTelEventListener(this);
863 AddOrientationEventListener(*this);
865 //Initialize keypad and buttons
866 InitializeCallButtonsPanel();
868 if (__pActiveCallInfo != null)
870 delete __pActiveCallInfo;
871 __pActiveCallInfo = null;
873 if (__pHeldCallInfo != null)
875 delete __pHeldCallInfo;
876 __pHeldCallInfo = null;
878 DestroyMoreOptionsMenuList();
882 case FORMTYPE_OUTGOINGCALL:
885 contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
886 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
887 __pActiveCallInfo->SetContactNumber(contactNo);
888 Contact* pContact = __pCallPresentor->GetContactN(contactNo);
889 if (pContact != null)
891 __pActiveCallInfo->SetContactInfo(*pContact);
894 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
895 //make an normal outgoing call
896 __pCallPresentor->DialCall(contactNo, false);
900 case FORMTYPE_EMERGENCYOUTGOINGCALL:
902 String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
903 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
904 long long phNumber = 0;
905 LongLong::Parse(*pContactNo, phNumber);
906 __pActiveCallInfo->SetContactNumber(*pContactNo);
907 //make an emergency call
908 __pCallPresentor->DialCall(*pContactNo, true);
912 case FORMTYPE_ACTIVECALL:
915 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
917 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
918 *__pActiveCallInfo = *pCall;
919 String activeContactNo;
920 if(pCall->GetContactNumber().IsEmpty() == false)
922 activeContactNo.Append(pCall->GetContactNumber());
926 activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
928 ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
930 //show call active time using Timer
931 __activeCallStartTime = pCall->GetCallConnectTime();
932 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
936 case FORMTYPE_EMERGENCYACTIVECALL:
939 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
941 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
942 *__pActiveCallInfo = *pCall;
944 //show call active time using Timer
945 __activeCallStartTime = pCall->GetCallConnectTime();
946 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
950 case FORMTYPE_MULTIPLECALLS:
952 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
954 UpdateMultipleCallScreen(*pCallsList);
960 case FORMTYPE_ACTIVECONFCALL:
963 AppCallInfo* pConfInfo = static_cast<AppCallInfo*>(pArgs->GetAt(0));
964 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
965 *__pActiveCallInfo = *pConfInfo;
967 int participantsCount = __pActiveCallInfo->GetCallerListCount();
969 // show participant count on name Label
970 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
974 count.Append(participantsCount);
976 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
977 pPeopleCountLbl->SetText(count);
980 if(participantsCount >= IDI_MAX_CONF_CALL_PARTICIPANTS)
982 __pCallButtonsPanel->EnableAddCallButton(false);
986 __pCallButtonsPanel->EnableAddCallButton(true);
989 //show call active time using Timer
990 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
991 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime);
999 //Hide DTMFKeypad, if visible and show caller info
1001 SetShowStateOnKeypad(true);
1002 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
1004 //Set the correct speaker status
1005 if(__pCallPresentor->IsSpeakerOn() == true)
1007 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
1011 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
1014 //Set the correct Mute status
1015 if (__pCallPresentor->IsCallMuted() == true)
1017 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
1021 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
1033 ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1035 RemoveOrientationEventListener(*this);
1036 if (__pCallButtonsPanel != null)
1038 RemoveControl(*__pCallButtonsPanel);
1039 __pCallButtonsPanel = null;
1041 if (__pActiveCallTimer != null)
1043 __pActiveCallTimer->Cancel();
1044 delete __pActiveCallTimer;
1045 __pActiveCallTimer = null;
1047 if (__pSmallPhotoLabel != null)
1049 __pSmallPhotoLabel->SetShowState(false);
1051 //Hide "Manage conf. Call" Context menu
1052 if (__pMoreOptionsListAnchor != null)
1054 __pMoreOptionsListAnchor->SetShowState(false);
1056 if (__pMoreOptionsList != null)
1058 __pMoreOptionsList->SetShowState(false);
1063 ActiveCallForm::HandleConfCallChanged(void)
1066 AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
1067 //fetch changed conference call info
1068 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1069 if (pConfCallInfo == null)
1075 //fetch participant count in conf call
1076 int participantsCount = pConfCallInfo->GetCallerListCount();
1077 //update status of join and Add call
1078 bool isEnableAddCall = false;
1079 bool isEnableJoinCall = false;
1080 if(participantsCount < IDI_MAX_CONF_CALL_PARTICIPANTS)
1082 //available only at Active conf. call or active call screen
1083 isEnableAddCall = true;
1084 //join button is available only at multiple call screen
1085 isEnableJoinCall = true;
1088 Label* pPeopleCountLbl = null;
1089 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == true)
1091 //Active call is conference call
1092 delete __pActiveCallInfo;
1093 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1094 *__pActiveCallInfo = *pConfCallInfo;
1096 if (__formType == FORMTYPE_MULTIPLECALLS)
1098 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1100 else if (__formType == FORMTYPE_ACTIVECONFCALL)
1102 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1103 AppLog("Active conf call...(%d)", pPeopleCountLbl);
1106 else if(__pHeldCallInfo != null && __pHeldCallInfo->IsConferenceCall() == true)
1108 //Held call is conference call - this is definitely multiple call screen.
1109 delete __pHeldCallInfo;
1110 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1111 *__pHeldCallInfo = *pConfCallInfo;
1112 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1115 // update participant count on name Label
1116 if (pPeopleCountLbl != null)
1119 count.Append(participantsCount);
1121 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1122 pPeopleCountLbl->SetText(count);
1123 pPeopleCountLbl->Invalidate(true);
1125 //change AddCall Button status
1126 __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
1127 //change JoinCall Button status
1128 __pCallButtonsPanel->EnableJoinCallButton(isEnableJoinCall);
1133 ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
1136 if(__pActiveCallInfo != null)
1138 delete __pActiveCallInfo;
1139 __pActiveCallInfo = null;
1141 if(__pHeldCallInfo != null)
1143 delete __pHeldCallInfo;
1144 __pHeldCallInfo = null;
1147 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1148 if (pMoreBtn != null)
1150 pMoreBtn->SetShowState(false);
1153 //show caller's info.
1154 for (int index = 0; index < activeCallsList.GetCount(); index++)
1157 AppCallInfo callInfo;
1158 activeCallsList.GetAt(index, callInfo);
1161 if(callInfo.GetContactNumber().IsEmpty() == false)
1163 contactNo.Append(callInfo.GetContactNumber());
1167 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1170 if (callInfo.IsOnHold() == false)
1172 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1173 *__pActiveCallInfo = callInfo;
1175 if (__pActiveCallInfo->IsConferenceCall() == false)
1177 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1180 pVoiceIconLbl->SetShowState(true);
1182 if (pMoreBtn != null)
1184 pMoreBtn->SetShowState(false);
1186 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1190 // show participant count on name Label
1191 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1192 if (pPeopleCountLbl)
1195 count.Append(__pActiveCallInfo->GetCallerListCount());
1197 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1198 pPeopleCountLbl->SetText(count);
1200 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1201 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1204 pNameLbl->SetText(nameStr);
1206 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1209 pVoiceIconLbl->SetShowState(false);
1211 if (pMoreBtn != null)
1213 pMoreBtn->SetShowState(true);
1215 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1216 if (pPhotoBitmap != null)
1218 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER1_PHOTO_LABEL));
1221 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1222 pPhotoLbl->Invalidate(true);
1224 delete pPhotoBitmap;
1227 //show call active time using Timer
1228 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1229 ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime);
1233 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1234 *__pHeldCallInfo = callInfo;
1236 if (__pHeldCallInfo->IsConferenceCall() == false)
1238 ShowPersonDetails(contactNo, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pHeldCallInfo);
1242 // show participant count on name Label
1243 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1244 if (pPeopleCountLbl)
1247 count.Append(__pHeldCallInfo->GetCallerListCount());
1249 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1250 pPeopleCountLbl->SetText(count);
1252 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1253 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1256 pNameLbl->SetText(nameStr);
1258 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1259 if (pPhotoBitmap != null)
1261 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER2_PHOTO_LABEL));
1264 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1265 pPhotoLbl->Invalidate(true);
1267 delete pPhotoBitmap;
1271 ShowTimerInfo(IDC_CALLER2_TIME_LABEL, true);
1275 //update JoinCall button status
1276 bool isEnableJoinCall = true;
1277 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1278 if(pConfCallInfo != null && pConfCallInfo->GetCallerListCount() >= IDI_MAX_CONF_CALL_PARTICIPANTS)
1280 isEnableJoinCall = false;
1282 __pCallButtonsPanel->EnableJoinCallButton(isEnableJoinCall);
1283 delete pConfCallInfo;
1284 pConfCallInfo = null;
1290 ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
1292 //call individual methods to show contact number, caller name & photo
1293 ShowPhoneNumber(phoneNumber, contactLblName);
1295 //fetch contact details based on phone number
1296 String* pDisplayName = pCallInfo->FetchCallerNameN();
1297 ShowCallerName(*pDisplayName, nameLblName);
1299 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1300 ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
1305 delete pDisplayName;
1306 pDisplayName = null;
1310 delete pPhotoBitmap;
1311 pPhotoBitmap = null;
1316 ActiveCallForm::ShowPhoneNumber(const String& phoneNumber, const String& contactLblName)
1318 String formattedNumber = phoneNumber;
1320 Label* pContactLbl = static_cast<Label*>(GetControl(contactLblName));
1323 pContactLbl->SetText(formattedNumber);
1324 pContactLbl->Invalidate(true);
1329 ActiveCallForm::ShowCallerName(const String& callerName, const String& nameLblName)
1331 // show display name on name Label
1332 Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
1335 //passing an empty string to SetText fails in label,
1336 //if previously valid text has been set
1337 if (callerName.IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
1339 String stringToBeSet(L" ");
1340 pNameLbl->SetText(stringToBeSet);
1344 pNameLbl->SetText(callerName);
1346 pNameLbl->Invalidate(true);
1351 ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
1353 //to check if default image is to be shown
1354 bool showDefaultPhoto = false;
1355 bool showSmallPhoto = false;
1356 String photoLabel("");
1360 case FORMTYPE_OUTGOINGCALL:
1361 case FORMTYPE_ACTIVECALL:
1363 if (pPhotoId == null)
1365 //show default caller image
1366 showDefaultPhoto = true;
1370 //Check the size of photo
1371 // Now checking the condition with && but actually it should be ||
1372 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1373 // height 270 and width = 480 . So all images set thru gallery is show as small image
1374 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1375 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1377 showSmallPhoto = true;
1381 photoLabel.Append(IDC_CALLER1_BIGPHOTO_LABEL);
1385 case FORMTYPE_MULTIPLECALLS:
1389 photoLabel.Append(IDC_CALLER2_PHOTO_LABEL);
1393 photoLabel.Append(IDC_CALLER1_PHOTO_LABEL);
1396 if (pPhotoId == null)
1398 showDefaultPhoto = true;
1402 if (pPhotoId->GetHeight() <= H_SMALL_PHOTO
1403 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1405 //pPhotoId->Scale(Dimension(W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO));
1406 showSmallPhoto = true;
1416 //Remove small photo label
1417 if (__pSmallPhotoLabel != null)
1419 RemoveControl(*__pSmallPhotoLabel);
1420 __pSmallPhotoLabel = null;
1423 //show photo - for Big Photo Id, Animated Call Image
1424 if (!showDefaultPhoto)
1426 if(showSmallPhoto == true)
1428 ShowThumbnailImage(pPhotoId,photoLabel);
1432 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1435 Canvas* pCanvas = new (std::nothrow) Canvas;
1436 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1437 pCanvas->Construct(canvasRect);
1438 //draw the contact bitmap
1439 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1440 Bitmap* pNewPhotoId = new Bitmap();
1441 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1444 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1445 pPhotoLbl->Invalidate(true);
1452 Bitmap* pDefaultPhoto = null;
1455 case FORMTYPE_OUTGOINGCALL:
1456 case FORMTYPE_ACTIVECALL:
1457 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1460 case FORMTYPE_MULTIPLECALLS:
1461 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_MULTIPLE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1464 case FORMTYPE_ACTIVECONFCALL:
1465 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BIG_BG_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1471 if (pDefaultPhoto != null)
1473 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1476 pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
1478 delete pDefaultPhoto;
1484 ActiveCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,String& photoLabel)
1486 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1488 if (pPhotoLbl != null && pPhotoId != null)
1490 Canvas* pCanvas = new (std::nothrow) Canvas;
1491 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1492 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1493 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1494 pCanvas->Construct(canvasRect);
1495 //draw the back ground
1496 pCanvas->DrawBitmap(canvasRect,*pBackground);
1497 //draw shadow (to be enabled after correct shadow image is provided )
1498 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1499 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1500 //draw the contact bitmap
1501 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1502 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1503 Bitmap* pNewPhotoId = new Bitmap();
1504 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1507 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1508 pPhotoLbl->Invalidate(true);
1517 ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1519 if (__pSmallPhotoLabel != null)
1521 RemoveControl(*__pSmallPhotoLabel);
1522 __pSmallPhotoLabel = null;
1524 //Draw Small Photo and show on small photo label
1525 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1526 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1527 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1528 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1529 // Add a Label to the Form
1530 AddControl(*__pSmallPhotoLabel);
1531 __pSmallPhotoLabel->Invalidate(true);
1535 ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long long startTime)
1537 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1539 if (__pActiveCallTimer == null)
1541 __pActiveCallTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
1542 __pActiveCallTimer->Construct(*this);
1545 if (pTimerLbl != null)
1547 if (isOnHold == true)
1549 pTimerLbl->SetText(AppUtility::GetResourceString(IDS_TIMER_ON_HOLD));
1550 //update Hold button status
1551 SetHoldButtonStatus(false);
1555 //update Hold button status
1556 SetHoldButtonStatus(true);
1557 //current system time
1558 long long currTime = 0;
1559 SystemTime::GetTicks(currTime);
1561 TimeSpan diffSpan(abs(startTime - currTime));
1563 String activeCallTime(L"");
1565 long long hr = diffSpan.GetHours();
1568 activeCallTime.Append("0");
1570 activeCallTime.Append(hr);
1571 activeCallTime.Append(L":");
1573 long long min = diffSpan.GetMinutes();
1576 activeCallTime.Append("0");
1578 activeCallTime.Append(min);
1579 activeCallTime.Append(L":");
1581 long long sec = diffSpan.GetSeconds();
1584 activeCallTime.Append("0");
1586 activeCallTime.Append(sec);
1588 pTimerLbl->SetText(activeCallTime);
1589 __pActiveCallTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
1591 pTimerLbl->Invalidate(true);
1596 ActiveCallForm::SetShowStateOnKeypad(bool showState)
1598 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1599 pLblControl->SetShowState(showState);
1600 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL));
1601 pLblControl->SetShowState(showState);
1602 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1603 pLblControl->SetShowState(showState);
1604 if (__pSmallPhotoLabel != null)
1606 __pSmallPhotoLabel->SetShowState(showState);
1611 case FORMTYPE_ACTIVECALL:
1613 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1614 pLblControl->SetShowState(showState);
1615 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1616 pLblControl->SetShowState(showState);
1617 pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1618 pLblControl->SetShowState(showState);
1619 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1620 pButtonControl->SetShowState(showState);
1624 case FORMTYPE_MULTIPLECALLS:
1626 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1627 pLblControl->SetShowState(showState);
1628 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1629 pLblControl->SetShowState(showState);
1630 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1631 pLblControl->SetShowState(showState);
1632 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1633 pLblControl->SetShowState(showState);
1634 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1635 pLblControl->SetShowState(showState);
1636 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1637 pLblControl->SetShowState(showState);
1638 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == false)
1640 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1641 pLblControl->SetShowState(showState);
1645 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1646 pButtonControl->SetShowState(showState);
1648 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1649 pButtonControl->SetShowState(showState);
1653 case FORMTYPE_ACTIVECONFCALL:
1655 pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1656 pLblControl->SetShowState(showState);
1657 pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1658 pLblControl->SetShowState(showState);
1659 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1660 pButtonControl->SetShowState(showState);
1661 pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1662 pButtonControl->SetShowState(showState);
1672 ActiveCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1674 //Call default implementation of "Object.Equals()"
1675 //returns true, if they are pointing to same address.
1676 if (__pActiveCallTimer->Equals(timer))
1678 Label* pTimerLbl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1681 String activeCallTime = pTimerLbl->GetText();
1682 // Create a StringTokenizer instance
1683 StringTokenizer strTokens(activeCallTime, L":");
1685 int count = strTokens.GetTokenCount(); // count == 3
1690 for (int index = 0; index < count; index++)
1695 strTokens.GetNextToken(token);
1696 Integer::Parse(token, hr);
1700 strTokens.GetNextToken(token);
1701 Integer::Parse(token, min);
1705 strTokens.GetNextToken(token);
1706 Integer::Parse(token, sec);
1712 if (sec == IDI_MAX_SECONDS)
1717 if (min == IDI_MAX_MINS)
1724 activeCallTime.Clear();
1727 activeCallTime.Append("0");
1729 activeCallTime.Append(hr);
1730 activeCallTime.Append(":");
1733 activeCallTime.Append("0");
1735 activeCallTime.Append(min);
1736 activeCallTime.Append(":");
1739 activeCallTime.Append("0");
1741 activeCallTime.Append(sec);
1742 //update timer label
1743 pTimerLbl->SetText(activeCallTime);
1744 pTimerLbl->Invalidate(true);
1749 ///////////////////////////////////////////////////////////
1750 /////////// Options Menu List Functionality /////////
1751 ///////////////////////////////////////////////////////////
1753 ActiveCallForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
1758 ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
1760 //Goto conference call list form
1761 SceneManager* pSceneManager = SceneManager::GetInstance();
1762 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST), null);
1766 ActiveCallForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
1771 ActiveCallForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
1776 ActiveCallForm::GetItemCount(void)
1778 return IDI_MOREOPTIONS_LIST_ITEMS;
1782 ActiveCallForm::CreateItem(int index, int itemWidth)
1784 //create 1st Menu option
1785 CustomItem* pItem = new (std::nothrow) CustomItem();
1786 pItem->Construct(IDI_OPTIONMENU_DIMEN, LIST_ANNEX_STYLE_NORMAL);
1788 //Set background 9-patch bitmap to option menu
1789 Bitmap* pBgBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_BG_ICON);
1790 if (pBgBmp != null && pBgBmp->IsNinePatchedBitmap())
1793 bgCanvas.Construct(Rectangle(IDI_OPTIONMENU_POS, IDI_OPTIONMENU_DIMEN));
1794 bgCanvas.DrawNinePatchedBitmap(bgCanvas.GetBounds(), *pBgBmp);
1798 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color(40, 45, 48));
1803 //Set bitmap to option menu
1804 Bitmap* pNormalConfCallBmp = AppUtility::GetBitmapFromResourcesN(IDB_MORE_MANAGE_CONFERENCE_ICON ,
1805 W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP);
1806 pItem->AddElement(Rectangle(16, 17, W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP), 1, *pNormalConfCallBmp, null, null);
1807 // Deallocate bitmaps
1808 delete pNormalConfCallBmp;
1809 pNormalConfCallBmp = null;
1811 //Set text to menu option
1812 String confCallName = AppUtility::GetResourceString(IDS_MGR_CONF_CALL_LIST_STR);
1814 TextElement* pTextElement = new (std::nothrow) TextElement();
1815 pTextElement->Construct(confCallName);
1816 pTextElement->SetTextColor(COLOR_POPUP_TEXT);
1819 font.Construct(FONT_STYLE_PLAIN, IDI_POPUP_TEXT_SIZE);
1820 pTextElement->SetFont(font);
1821 //construct Enriched text
1822 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1823 Dimension textDimension;
1824 font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
1825 textDimension.height = textDimension.height + font.GetDescender();
1826 pEnrichedText->Construct(textDimension);
1827 //add text element to enriched text
1828 pEnrichedText->Add(*pTextElement);
1830 //Add Enriched text to pItem
1831 Point textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
1832 pItem->AddElement(Rectangle(textPos, textDimension), 2, *pEnrichedText);
1834 pEnrichedText->RemoveAll(true);
1835 delete pEnrichedText;
1840 ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)