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
26 #include "CallActiveCallForm.h"
27 #include "CallButtonsPanel.h"
29 #include "CallAppUtility.h"
30 #include "CallDtmfKeypadPanel.h"
31 #include "CallPresentationModel.h"
32 #include "CallSceneRegister.h"
33 #include "CallTypes.h"
36 using namespace Tizen::App;
37 using namespace Tizen::Base;
38 using namespace Tizen::Base::Collection;
39 using namespace Tizen::Base::Utility;
40 using namespace Tizen::Graphics;
41 using namespace Tizen::Media;
42 using namespace Tizen::Social;
43 using namespace Tizen::System;
44 using namespace Tizen::Ui;
45 using namespace Tizen::Ui::Controls;
46 using namespace Tizen::Ui::Scenes;
47 using namespace Tizen::Shell;
50 const int IDI_MAX_SECONDS = 60;
51 const int IDI_MAX_MINS = 60;
52 const int W_HOLD_BITMAP = 78;
53 const int H_HOLD_BITMAP = 78;
54 //for Options menu list
55 const int IDI_POPUP_TEXT_SIZE = 33;
56 const unsigned int COLOR_POPUP_TEXT = Color32<255, 255, 255, 255>::Value;
57 const int IDI_MOREOPTIONS_LIST_ITEMS = 1;
58 const int W_OPTION_ANCHOR = 72;
59 const int H_OPTION_ANCHOR = 22;
60 const int W_MGR_CONFCALL_BITMAP = 64;
61 const int H_MGR_CONFCALL_BITMAP = 64;
62 const int X_POPUP_ANCHOR = 632;
63 const int Y_POPUP_ANCHOR = 140;
64 const int W_POPUP_ANCHOR = 72;
65 const int H_POPUP_ANCHOR = 22;
66 const int IDI_OPTIONMENU_ITEM_SPACING = 16;
67 const Point IDI_OPTIONMENU_POS(238, 162);
68 const Dimension IDI_OPTIONMENU_DIMEN(466, 99);
69 const int X_PHOTO_LBL = 166;
70 const int Y_PHOTO_LBL = 232;
71 const int W_PHOTO_LBL = 388;
72 const int H_PHOTO_LBL = 388;
73 const int W_PHOTO_LABEL = 720;
74 const int H_PHOTO_LABEL = 720;
75 const int W_RIGHT_MORE_ICON_MARGIN = 24;
76 const int W_MORE_LABEL = 466;
77 const int H_MORE_LABEL = 162;
78 const int W_MORE_ICON = 70;
80 static const wchar_t* IDC_CONF_CALL_MORE_BUTTON = L"IDC_CONF_CALL_MORE_BUTTON";
81 static const wchar_t* IDC_HOLD_BUTTON = L"IDC_HOLD_BUTTON";
82 static const wchar_t* IDC_SWAP_BUTTON = L"IDC_SWAP_BUTTON";
83 static const wchar_t* IDC_HOLD_LABEL = L"IDC_HOLD_LABEL";
84 static const wchar_t* IDC_TEXTBOX = L"IDC_NUM_EDITFIELD";
85 static const wchar_t* IDC_CALLER1_LABEL = L"IDC_CALLER1_LABEL";
86 static const wchar_t* IDC_BACKGROUND_LABEL = L"IDC_BACKGROUND_LABEL";
87 static const wchar_t* IDC_CALLER1_TIME_LABEL = L"IDC_CALLER1_TIME_LABEL";
88 static const wchar_t* IDC_NUMBER1_LABEL = L"IDC_NUMBER1_LABEL";
89 static const wchar_t* IDC_VOICE_CALL_ICON_LABEL = L"IDC_VOICE_CALL_ICON_LABEL";
90 static const wchar_t* IDC_CALLER2_LABEL = L"IDC_CALLER2_LABEL";
91 static const wchar_t* IDC_NUMBER2_LABEL = L"IDC_NUMBER2_LABEL";
92 static const wchar_t* IDC_CALLER2_TIME_LABEL = L"IDC_CALLER2_TIME_LABEL";
93 static const wchar_t* IDC_SWAP_LABEL = L"IDC_SWAP_LABEL";
94 static const wchar_t* IDC_BACKGROUND_LABEL2 = L"IDC_BACKGROUND_LABEL2";
95 static const wchar_t* IDC_PARTICIPANTS_LABEL = L"IDC_PARTICIPANTS_LABEL";
96 static const wchar_t* IDC_CALLER1_BIGPHOTO_LABEL = L"IDC_CALLER1_BIGPHOTO_LABEL";
97 static const wchar_t* IDC_CALLER2_PHOTO_LABEL = L"IDC_CALLER2_PHOTO_LABEL";
98 static const wchar_t* IDC_CALLER1_PHOTO_LABEL = L"IDC_CALLER1_PHOTO_LABEL";
99 static const wchar_t* IDC_KEY_BG_LABEL = L"IDC_KEY_BG_LABEL";
101 ActiveCallForm::ActiveCallForm(FormType formType)
104 __pActiveCallTimer = null;
105 __pCallButtonsPanel = null;
106 __pDTMFKeypad = null;
107 __pMoreOptionsList = null;
108 __pMoreOptionsListAnchor = null;
109 __pSmallPhotoLabel = null;
110 __pActiveCallInfo = null;
111 __pHeldCallInfo = null;
114 ActiveCallForm::~ActiveCallForm(void)
116 if (__pActiveCallTimer != null)
118 __pActiveCallTimer->Cancel();
119 delete __pActiveCallTimer;
121 if (__pMoreOptionsList != null)
123 __pMoreOptionsList = null;
125 if (__pMoreOptionsListAnchor != null)
127 __pMoreOptionsListAnchor = null;
129 if (__pSmallPhotoLabel != null)
131 __pSmallPhotoLabel = null;
133 if (__pActiveCallInfo != null)
135 delete __pActiveCallInfo;
137 if (__pHeldCallInfo != null)
139 delete __pHeldCallInfo;
141 if(__pDTMFKeypad != null)
143 __pDTMFKeypad = null;
148 ActiveCallForm::Initialize(void)
152 case FORMTYPE_OUTGOINGCALL:
153 Construct(IDL_OUTCALL_FORM);
156 case FORMTYPE_EMERGENCYOUTGOINGCALL:
157 Construct(IDL_OUT_EMERGENCYCALL_FORM);
160 case FORMTYPE_ACTIVECALL:
161 Construct(IDL_CALL_FORM);
164 case FORMTYPE_EMERGENCYACTIVECALL:
165 Construct(IDL_EMERGENCY_CALL_FORM);
168 case FORMTYPE_MULTIPLECALLS:
169 Construct(IDL_MULTIPLE_CALL_FORM);
172 case FORMTYPE_ACTIVECONFCALL:
173 Construct(IDL_CONFCALL_FORM);
182 ActiveCallForm::OnInitializing(void)
184 result r = E_SUCCESS;
186 //Hold Button - Shown on single active/conf call scene
187 InitializeHoldButton();
188 //Swap button for multiple call screen
189 InitializeSwapButton();
190 //Initialize manage conf. call list form
191 InitializeManageConfCallButton();
193 __pCallPresentor = CallPresentationModel::GetInstance();
198 ActiveCallForm::ShowDTMFKeypad(void)
200 if(__pDTMFKeypad == null)
202 //update rect according to client screen area
203 Rectangle rect(0, 0, 0, 0);
204 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
206 rect.width = GetClientAreaBounds().width;
207 rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight();
209 else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
211 rect.height = GetClientAreaBounds().height;
212 rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth();
215 AppLog("DTMF Keypad rect(%d,%d,%d,%d)",rect.x,rect.y,rect.width,rect.height);
216 __pDTMFKeypad = new (std::nothrow) DtmfKeyPadPanel();
217 __pDTMFKeypad->Initialize(this, rect);
218 AddControl(*__pDTMFKeypad);
220 //set layout relation w.r.t call buttons panel
221 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
222 if (pRelativeLayout != null)
224 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
225 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
228 __pDTMFKeypad->SetShowState(true);
229 if(__DtmfString.IsEmpty() == false)
231 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
232 pTextBox->SetText(__DtmfString);
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 || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
270 //in landscape mode, caller info is visible.
271 SetShowStateOnKeypad(true);
273 else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
275 //in Portrait mode it is hidden beneath DTMF Keypad.
276 SetShowStateOnKeypad(false);
278 if(__pDTMFKeypad->GetShowState() == true)
280 String dtmfText = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
286 //More option is displayed recreate it
287 if(__pMoreOptionsListAnchor != null)
289 CreateMoreOptionsMenuList();
290 CreateMoreOptionsMenuList();
295 ActiveCallForm::HideDTMFKeypad(void)
297 if(__pDTMFKeypad != null)
299 __DtmfString = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
301 RemoveControl(*__pDTMFKeypad);
302 __pDTMFKeypad = null;
307 ActiveCallForm::InitializeCallButtonsPanel(void)
309 result r = E_SUCCESS;
310 //Set background bitmap for call keypad
311 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
312 Bitmap* pBgBitmap = AppUtility::GetBitmapFromResourcesN(IDB_BACKGROUND_BITMAP, pKeysBgLbl->GetWidth(), pKeysBgLbl->GetHeight());
313 if (pBgBitmap != null)
315 pKeysBgLbl->SetBackgroundBitmap(*pBgBitmap);
318 if (__pCallButtonsPanel == null)
320 __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
321 __pCallButtonsPanel->ConstructPanel(this, __formType);
322 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
323 r = AddControl(*__pCallButtonsPanel);
326 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
327 if (pRelativeLayout != null)
329 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
331 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
332 if (pRelativeLayout != null)
334 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
335 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
336 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
337 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_TOP_TO_TOP);
344 ActiveCallForm::InitializeSwapButton(void)
346 Button* pSwapBtn = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
349 Bitmap* pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_NORMAL,
350 W_HOLD_BITMAP, H_HOLD_BITMAP);
353 pSwapBtn->SetNormalBitmap(Point(0, 0), *pSwapBmp);
358 pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_PRESS,
359 W_HOLD_BITMAP, H_HOLD_BITMAP);
362 pSwapBtn->SetPressedBitmap(Point(0, 0), *pSwapBmp);
366 pSwapBtn->SetActionId(IDA_SWAP_CALLS);
367 pSwapBtn->AddActionEventListener(*this);
372 ActiveCallForm::InitializeManageConfCallButton(void)
374 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
375 if (pMoreBtn != null)
377 pMoreBtn->SetActionId(IDA_MORE_OPTIONS_MENU);
378 pMoreBtn->AddActionEventListener(*this);
379 if (__formType == FORMTYPE_MULTIPLECALLS)
381 //Correct state will be set in OnSceneActivated based on the call
382 pMoreBtn->SetShowState(false);
384 else if (__formType == FORMTYPE_ACTIVECONFCALL)
386 pMoreBtn->SetShowState(true);
392 ActiveCallForm::InitializeHoldButton(void)
394 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
395 if (pHoldBtn != null)
397 //set status of Hold Button
398 SetHoldButtonStatus(true);
399 pHoldBtn->AddActionEventListener(*this);
404 ActiveCallForm::SetHoldButtonStatus(bool toHoldCall)
406 //background bitmap & button name
408 Bitmap* normalImg = null;
409 Bitmap* pressImg = null;
412 btnName.Append(AppUtility::GetResourceString(IDS_HOLD_BTN_NAME));
413 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_NORMAL_BUTTON_ICON,
414 W_HOLD_BITMAP, H_HOLD_BITMAP);
415 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_PRESS_BUTTON_ICON,
416 W_HOLD_BITMAP, H_HOLD_BITMAP);
420 btnName.Append(AppUtility::GetResourceString(IDS_UNHOLD_BTN_NAME));
421 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_NORMAL_BUTTON_ICON,
422 W_HOLD_BITMAP, H_HOLD_BITMAP);
423 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_PRESS_BUTTON_ICON,
424 W_HOLD_BITMAP, H_HOLD_BITMAP);
428 CommandIds cmdId = IDA_HOLD_CALL;
431 case FORMTYPE_ACTIVECALL:
433 cmdId = toHoldCall ? IDA_HOLD_CALL : IDA_UNHOLD_CALL;
437 case FORMTYPE_ACTIVECONFCALL:
439 cmdId = toHoldCall ? IDA_HOLD_CONF_CALL : IDA_UNHOLD_CONF_CALL;
447 //set background bitmap, button name & action id
448 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
449 Label* pHoldLbl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
452 pHoldBtn->SetActionId(cmdId);
453 pHoldBtn->SetNormalBitmap(Point(0, 0),*normalImg);
454 pHoldBtn->SetPressedBitmap(Point(0, 0),*pressImg);
458 pHoldLbl->SetText(btnName);
459 pHoldLbl->Invalidate(true);
470 ActiveCallForm::CreateMoreOptionsMenuList(void)
472 //create option list anchor
473 if (__pMoreOptionsListAnchor == null)
475 Bitmap* pBgPopupArwBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_ARROW_ICON, W_OPTION_ANCHOR,
477 __pMoreOptionsListAnchor = new (std::nothrow) Label();
478 __pMoreOptionsListAnchor->Construct(Rectangle(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_ICON, Y_POPUP_ANCHOR, W_POPUP_ANCHOR, H_POPUP_ANCHOR), L"");
479 __pMoreOptionsListAnchor->SetBackgroundBitmap(*pBgPopupArwBmp);
481 delete pBgPopupArwBmp;
482 pBgPopupArwBmp = null;
484 // Adds a Label to the Form
485 AddControl(*__pMoreOptionsListAnchor);
488 //create options menu list
489 if (__pMoreOptionsList == null)
491 __pMoreOptionsList = new (std::nothrow) ListView();
492 __pMoreOptionsList->Construct(Rectangle(Point(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_LABEL,H_MORE_LABEL), IDI_OPTIONMENU_DIMEN), false, SCROLL_STYLE_FADE_OUT);
493 __pMoreOptionsList->SetItemProvider(*this);
494 __pMoreOptionsList->AddListViewItemEventListener(*this);
495 //Add option list to the form
496 AddControl(*__pMoreOptionsList);
500 //Hide option menu list
501 DestroyMoreOptionsMenuList();
506 ActiveCallForm::DestroyMoreOptionsMenuList(void)
508 if (__pMoreOptionsListAnchor != null)
510 //removes and delete the child control
511 RemoveControl(*__pMoreOptionsListAnchor);
512 __pMoreOptionsListAnchor = null;
515 if (__pMoreOptionsList != null)
517 //removes and delete the child control
518 RemoveControl(*__pMoreOptionsList);
519 __pMoreOptionsList = null;
524 ActiveCallForm::OnTerminating(void)
526 result r = E_SUCCESS;
527 if (__pCallPresentor != null)
529 __pCallPresentor = null;
535 ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
543 //End the currently active / dialing call
544 if (__pActiveCallInfo->IsConferenceCall() == false)
546 String activeContactNo;
547 activeContactNo.Append(__pActiveCallInfo->GetContactNumber());
548 //Check if it is call is in dialing state, then
549 if (__formType == FORMTYPE_EMERGENCYOUTGOINGCALL || __formType == FORMTYPE_OUTGOINGCALL)
551 __pCallPresentor->EndDialingCall(activeContactNo);
556 __pCallPresentor->EndActiveCall(*__pActiveCallInfo->GetCallHandle());
561 __pCallPresentor->EndConferenceCall();
566 case IDA_END_CONF_CALL:
568 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
569 __pCallPresentor->EndConferenceCall();
573 case IDA_OPEN_NUMKEYPAD:
575 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
577 //hide only in portrait mode.
578 SetShowStateOnKeypad(false);
581 __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
585 case IDA_CLOSE_NUMKEYPAD:
587 SetShowStateOnKeypad(true);
589 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
595 //switch to Dialer Form to make an call
596 if(__pCallPresentor->GetCurrentCallCount() == 1)
598 __pCallPresentor->LaunchDialAppControl();
606 if (__pActiveCallInfo->IsConferenceCall() == false)
608 if(__pActiveCallInfo->GetCallHandle() != null)
610 success = __pCallPresentor->HoldCall(*__pActiveCallInfo->GetCallHandle());
615 success = __pCallPresentor->HoldConferenceCall();
617 //reset hold status and "OnHold" text
618 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
619 if(__pActiveCallTimer != null)
621 __pActiveCallTimer->Cancel();
623 SetHoldButtonStatus(!success);
627 case IDA_UNHOLD_CALL:
629 bool success = false;
630 if (__pActiveCallInfo->IsConferenceCall() == false)
632 if(__pActiveCallInfo->GetCallHandle() != null)
634 success = __pCallPresentor->UnHoldCall(*__pActiveCallInfo->GetCallHandle());
639 success = __pCallPresentor->ActivateConferenceCall();
641 //reset hold status and show call timer
642 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
643 SetHoldButtonStatus(success);
647 case IDA_HOLD_CONF_CALL:
649 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
650 bool success = __pCallPresentor->HoldConferenceCall();
651 //reset hold status and "OnHold" text
652 SetHoldButtonStatus(!success);
653 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
654 if(__pActiveCallTimer != null)
656 __pActiveCallTimer->Cancel();
661 case IDA_UNHOLD_CONF_CALL:
663 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
664 bool success = __pCallPresentor->ActivateConferenceCall();
665 //reset hold status and show call timer
666 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
667 SetHoldButtonStatus(success);
671 case IDA_OPEN_CONTACTS:
674 //Launch call application
675 AppManager* pAppManager = AppManager::GetInstance();
676 pAppManager->LaunchApplication(PROVIDER_ID_CONTACTS);
682 bool success = __pCallPresentor->SetMuteStatus(true);
685 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
692 bool success = __pCallPresentor->SetMuteStatus(false);
695 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
702 bool success = __pCallPresentor->SetSpeakerStatus(true);
705 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
710 case IDA_SPEAKER_OFF:
712 bool success = __pCallPresentor->SetSpeakerStatus(false);
715 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
722 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
723 __pCallPresentor->JoinCall();
729 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
730 __pCallPresentor->SwapCalls();
734 case IDA_MORE_OPTIONS_MENU:
736 //Show 'more' options menu
737 CreateMoreOptionsMenuList();
743 dtmfString.Append(L"0");
744 SetTextToDTMFTextField(dtmfString);
745 __pCallPresentor->SendDTMFSignal(dtmfString);
751 dtmfString.Append(L"1");
752 SetTextToDTMFTextField(dtmfString);
753 __pCallPresentor->SendDTMFSignal(dtmfString);
759 dtmfString.Append(L"2");
760 SetTextToDTMFTextField(dtmfString);
761 __pCallPresentor->SendDTMFSignal(dtmfString);
767 dtmfString.Append(L"3");
768 SetTextToDTMFTextField(dtmfString);
769 __pCallPresentor->SendDTMFSignal(dtmfString);
775 dtmfString.Append(L"4");
776 SetTextToDTMFTextField(dtmfString);
777 __pCallPresentor->SendDTMFSignal(dtmfString);
783 dtmfString.Append(L"5");
784 SetTextToDTMFTextField(dtmfString);
785 __pCallPresentor->SendDTMFSignal(dtmfString);
791 dtmfString.Append(L"6");
792 SetTextToDTMFTextField(dtmfString);
793 __pCallPresentor->SendDTMFSignal(dtmfString);
799 dtmfString.Append(L"7");
800 SetTextToDTMFTextField(dtmfString);
801 __pCallPresentor->SendDTMFSignal(dtmfString);
807 dtmfString.Append(L"8");
808 SetTextToDTMFTextField(dtmfString);
809 __pCallPresentor->SendDTMFSignal(dtmfString);
815 dtmfString.Append(L"9");
816 SetTextToDTMFTextField(dtmfString);
817 __pCallPresentor->SendDTMFSignal(dtmfString);
823 dtmfString.Append(L"*");
824 SetTextToDTMFTextField(dtmfString);
825 __pCallPresentor->SendDTMFSignal(dtmfString);
831 dtmfString.Append(L"#");
832 SetTextToDTMFTextField(dtmfString);
833 __pCallPresentor->SendDTMFSignal(dtmfString);
843 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
845 if(__pDTMFKeypad != null)
847 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
849 int startpos=-1,endpos=-1;
850 pTextBox->GetBlockRange(startpos,endpos);
854 pTextBox->ReleaseBlock();
857 pTextBox->InsertTextAtCursorPosition(dtmfStr);
858 //pTextBox->AppendText(dtmfStr);
859 pTextBox->SetFocus();
860 pTextBox->Invalidate(true);
865 ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
868 //set itself as listener
869 __pCallPresentor->SetTelEventListener(this);
870 AddOrientationEventListener(*this);
872 CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
873 pPhoneApp->AddAppStateChangeListener(*this);
875 //Initialize keypad and buttons
876 InitializeCallButtonsPanel();
878 if (__pActiveCallInfo != null)
880 delete __pActiveCallInfo;
881 __pActiveCallInfo = null;
883 if (__pHeldCallInfo != null)
885 delete __pHeldCallInfo;
886 __pHeldCallInfo = null;
888 DestroyMoreOptionsMenuList();
892 case FORMTYPE_OUTGOINGCALL:
895 contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
896 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
897 __pActiveCallInfo->SetContactNumber(contactNo);
898 Contact* pContact = __pCallPresentor->GetContactN(contactNo);
899 if (pContact != null)
901 __pActiveCallInfo->SetContactInfo(*pContact);
904 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
905 //make an normal outgoing call
906 __pCallPresentor->DialCall(contactNo, false);
910 case FORMTYPE_EMERGENCYOUTGOINGCALL:
912 String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
913 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
914 long long phNumber = 0;
915 LongLong::Parse(*pContactNo, phNumber);
916 __pActiveCallInfo->SetContactNumber(*pContactNo);
917 //make an emergency call
918 __pCallPresentor->DialCall(*pContactNo, true);
922 case FORMTYPE_ACTIVECALL:
925 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
927 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
928 *__pActiveCallInfo = *pCall;
929 String activeContactNo;
930 if(pCall->GetContactNumber().IsEmpty() == false)
932 activeContactNo.Append(pCall->GetContactNumber());
936 activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
938 ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
940 //show call active time using Timer
941 __activeCallStartTime = pCall->GetCallConnectTime();
942 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
946 case FORMTYPE_EMERGENCYACTIVECALL:
949 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
951 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
952 *__pActiveCallInfo = *pCall;
954 //show call active time using Timer
955 __activeCallStartTime = pCall->GetCallConnectTime();
956 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
960 case FORMTYPE_MULTIPLECALLS:
962 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
964 UpdateMultipleCallScreen(*pCallsList);
970 case FORMTYPE_ACTIVECONFCALL:
973 AppCallInfo* pConfInfo = static_cast<AppCallInfo*>(pArgs->GetAt(0));
974 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
975 *__pActiveCallInfo = *pConfInfo;
977 int participantsCount = __pActiveCallInfo->GetCallerListCount();
979 // show participant count on name Label
980 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
984 count.Append(participantsCount);
986 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
987 pPeopleCountLbl->SetText(count);
990 if(participantsCount >= IDI_MAX_CONF_CALL_PARTICIPANTS)
992 __pCallButtonsPanel->EnableAddCallButton(false);
996 __pCallButtonsPanel->EnableAddCallButton(true);
999 //show call active time using Timer
1000 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1001 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime);
1009 if(__formType == FORMTYPE_ACTIVECALL || __formType == FORMTYPE_EMERGENCYACTIVECALL ||
1010 __formType == FORMTYPE_MULTIPLECALLS || __formType == FORMTYPE_ACTIVECONFCALL)
1012 //Unlock the phone if its locked
1013 if(LockManager::GetInstance()->IsLocked())
1015 AppLogDebug("Phone Locked");
1016 LockManager::GetInstance()->Unlock();
1020 //Hide DTMFKeypad, if visible and show caller info
1022 SetShowStateOnKeypad(true);
1023 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
1025 //Set the correct speaker status
1026 if(__pCallPresentor->IsSpeakerOn() == true)
1028 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
1032 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
1035 //Set the correct Mute status
1036 if (__pCallPresentor->IsCallMuted() == true)
1038 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
1042 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
1054 ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1056 RemoveOrientationEventListener(*this);
1057 if (__pCallButtonsPanel != null)
1059 RemoveControl(*__pCallButtonsPanel);
1060 __pCallButtonsPanel = null;
1062 if (__pActiveCallTimer != null)
1064 __pActiveCallTimer->Cancel();
1065 delete __pActiveCallTimer;
1066 __pActiveCallTimer = null;
1068 if (__pSmallPhotoLabel != null)
1070 __pSmallPhotoLabel->SetShowState(false);
1072 //Hide "Manage conf. Call" Context menu
1073 if (__pMoreOptionsListAnchor != null)
1075 __pMoreOptionsListAnchor->SetShowState(false);
1077 if (__pMoreOptionsList != null)
1079 __pMoreOptionsList->SetShowState(false);
1081 __DtmfString.Clear();
1082 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1083 pCallApp->RemoveAppStateChangeListener(*this);
1087 ActiveCallForm::HandleConfCallChanged(void)
1090 AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
1091 //fetch changed conference call info
1092 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1093 if (pConfCallInfo == null)
1099 //fetch participant count in conf call
1100 int participantsCount = pConfCallInfo->GetCallerListCount();
1101 //update status of join and Add call
1102 bool isEnableAddCall = false;
1103 bool isEnableJoinCall = false;
1104 if(participantsCount < IDI_MAX_CONF_CALL_PARTICIPANTS)
1106 //available only at Active conf. call or active call screen
1107 isEnableAddCall = true;
1108 //join button is available only at multiple call screen
1109 isEnableJoinCall = true;
1112 Label* pPeopleCountLbl = null;
1113 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == true)
1115 //Active call is conference call
1116 delete __pActiveCallInfo;
1117 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1118 *__pActiveCallInfo = *pConfCallInfo;
1120 if (__formType == FORMTYPE_MULTIPLECALLS)
1122 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1124 else if (__formType == FORMTYPE_ACTIVECONFCALL)
1126 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1127 AppLog("Active conf call...(%d)", pPeopleCountLbl);
1130 else if(__pHeldCallInfo != null && __pHeldCallInfo->IsConferenceCall() == true)
1132 //Held call is conference call - this is definitely multiple call screen.
1133 delete __pHeldCallInfo;
1134 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1135 *__pHeldCallInfo = *pConfCallInfo;
1136 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1139 // update participant count on name Label
1140 if (pPeopleCountLbl != null)
1143 count.Append(participantsCount);
1145 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1146 pPeopleCountLbl->SetText(count);
1147 pPeopleCountLbl->Invalidate(true);
1149 //change AddCall Button status
1150 __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
1151 //change JoinCall Button status
1152 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1157 ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
1160 if(__pActiveCallInfo != null)
1162 delete __pActiveCallInfo;
1163 __pActiveCallInfo = null;
1165 if(__pHeldCallInfo != null)
1167 delete __pHeldCallInfo;
1168 __pHeldCallInfo = null;
1171 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1172 if (pMoreBtn != null)
1174 pMoreBtn->SetShowState(false);
1177 //show caller's info.
1178 for (int index = 0; index < activeCallsList.GetCount(); index++)
1181 AppCallInfo callInfo;
1182 activeCallsList.GetAt(index, callInfo);
1185 if(callInfo.GetContactNumber().IsEmpty() == false)
1187 contactNo.Append(callInfo.GetContactNumber());
1191 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1194 if (callInfo.IsOnHold() == false)
1196 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1197 *__pActiveCallInfo = callInfo;
1199 if (__pActiveCallInfo->IsConferenceCall() == false)
1201 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1204 pVoiceIconLbl->SetShowState(true);
1206 if (pMoreBtn != null)
1208 pMoreBtn->SetShowState(false);
1210 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1211 if(__pMoreOptionsListAnchor != null && __pMoreOptionsListAnchor->GetShowState() == true)
1213 CreateMoreOptionsMenuList();
1218 // show participant count on name Label
1219 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1220 if (pPeopleCountLbl)
1223 count.Append(__pActiveCallInfo->GetCallerListCount());
1225 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1226 pPeopleCountLbl->SetText(count);
1228 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1229 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1232 pNameLbl->SetText(nameStr);
1234 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1237 pVoiceIconLbl->SetShowState(false);
1239 if (pMoreBtn != null)
1241 pMoreBtn->SetShowState(true);
1243 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1244 if (pPhotoBitmap != null)
1246 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER1_PHOTO_LABEL));
1249 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1250 pPhotoLbl->Invalidate(true);
1252 delete pPhotoBitmap;
1255 //show call active time using Timer
1256 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1257 ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime);
1261 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1262 *__pHeldCallInfo = callInfo;
1264 if (__pHeldCallInfo->IsConferenceCall() == false)
1266 ShowPersonDetails(contactNo, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pHeldCallInfo);
1270 // show participant count on name Label
1271 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1272 if (pPeopleCountLbl)
1275 count.Append(__pHeldCallInfo->GetCallerListCount());
1277 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1278 pPeopleCountLbl->SetText(count);
1280 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1281 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1284 pNameLbl->SetText(nameStr);
1286 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1287 if (pPhotoBitmap != null)
1289 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER2_PHOTO_LABEL));
1292 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1293 pPhotoLbl->Invalidate(true);
1295 delete pPhotoBitmap;
1299 ShowTimerInfo(IDC_CALLER2_TIME_LABEL, true);
1303 //update JoinCall button status
1304 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1310 ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
1312 //call individual methods to show contact number, caller name & photo
1313 ShowPhoneNumber(phoneNumber, contactLblName);
1315 //fetch contact details based on phone number
1316 String* pDisplayName = pCallInfo->FetchCallerNameN();
1317 ShowCallerName(*pDisplayName, nameLblName);
1319 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1320 ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
1325 delete pDisplayName;
1326 pDisplayName = null;
1330 delete pPhotoBitmap;
1331 pPhotoBitmap = null;
1336 ActiveCallForm::ShowPhoneNumber(const String& phoneNumber, const String& contactLblName)
1338 String formattedNumber = phoneNumber;
1340 Label* pContactLbl = static_cast<Label*>(GetControl(contactLblName));
1343 pContactLbl->SetText(formattedNumber);
1344 pContactLbl->Invalidate(true);
1349 ActiveCallForm::ShowCallerName(const String& callerName, const String& nameLblName)
1351 // show display name on name Label
1352 Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
1355 //passing an empty string to SetText fails in label,
1356 //if previously valid text has been set
1357 if (callerName.IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
1359 String stringToBeSet(L" ");
1360 pNameLbl->SetText(stringToBeSet);
1364 pNameLbl->SetText(callerName);
1366 pNameLbl->Invalidate(true);
1371 ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
1373 //to check if default image is to be shown
1374 bool showDefaultPhoto = false;
1375 bool showSmallPhoto = false;
1376 String photoLabel("");
1380 case FORMTYPE_OUTGOINGCALL:
1381 case FORMTYPE_ACTIVECALL:
1383 if (pPhotoId == null)
1385 //show default caller image
1386 showDefaultPhoto = true;
1390 //Check the size of photo
1391 // Now checking the condition with && but actually it should be ||
1392 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1393 // height 270 and width = 480 . So all images set thru gallery is show as small image
1394 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1395 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1397 showSmallPhoto = true;
1401 photoLabel.Append(IDC_CALLER1_BIGPHOTO_LABEL);
1405 case FORMTYPE_MULTIPLECALLS:
1409 photoLabel.Append(IDC_CALLER2_PHOTO_LABEL);
1413 photoLabel.Append(IDC_CALLER1_PHOTO_LABEL);
1416 if (pPhotoId == null)
1418 showDefaultPhoto = true;
1422 if (pPhotoId->GetHeight() <= H_SMALL_PHOTO
1423 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1425 //pPhotoId->Scale(Dimension(W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO));
1426 showSmallPhoto = true;
1436 //Remove small photo label
1437 if (__pSmallPhotoLabel != null)
1439 RemoveControl(*__pSmallPhotoLabel);
1440 __pSmallPhotoLabel = null;
1443 //show photo - for Big Photo Id, Animated Call Image
1444 if (!showDefaultPhoto)
1446 if(showSmallPhoto == true)
1448 ShowThumbnailImage(pPhotoId,photoLabel);
1452 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1455 Canvas* pCanvas = new (std::nothrow) Canvas;
1456 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1457 pCanvas->Construct(canvasRect);
1458 //draw the contact bitmap
1459 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1460 Bitmap* pNewPhotoId = new Bitmap();
1461 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1464 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1465 pPhotoLbl->Invalidate(true);
1472 Bitmap* pDefaultPhoto = null;
1475 case FORMTYPE_OUTGOINGCALL:
1476 case FORMTYPE_ACTIVECALL:
1477 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1480 case FORMTYPE_MULTIPLECALLS:
1481 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_MULTIPLE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1484 case FORMTYPE_ACTIVECONFCALL:
1485 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BIG_BG_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1491 if (pDefaultPhoto != null)
1493 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1496 pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
1498 delete pDefaultPhoto;
1504 ActiveCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,String& photoLabel)
1506 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1508 if (pPhotoLbl != null && pPhotoId != null)
1510 Canvas* pCanvas = new (std::nothrow) Canvas;
1511 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1512 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1513 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1514 pCanvas->Construct(canvasRect);
1515 //draw the back ground
1516 pCanvas->DrawBitmap(canvasRect,*pBackground);
1517 //draw shadow (to be enabled after correct shadow image is provided )
1518 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1519 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1520 //draw the contact bitmap
1521 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1522 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1523 Bitmap* pNewPhotoId = new Bitmap();
1524 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1527 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1528 pPhotoLbl->Invalidate(true);
1537 ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1539 if (__pSmallPhotoLabel != null)
1541 RemoveControl(*__pSmallPhotoLabel);
1542 __pSmallPhotoLabel = null;
1544 //Draw Small Photo and show on small photo label
1545 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1546 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1547 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1548 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1549 // Add a Label to the Form
1550 AddControl(*__pSmallPhotoLabel);
1551 __pSmallPhotoLabel->Invalidate(true);
1555 ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long long startTime)
1557 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1559 if (__pActiveCallTimer == null)
1561 __pActiveCallTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
1562 __pActiveCallTimer->Construct(*this);
1565 if (pTimerLbl != null)
1567 if (isOnHold == true)
1569 pTimerLbl->SetText(AppUtility::GetResourceString(IDS_TIMER_ON_HOLD));
1570 //update Hold button status
1571 SetHoldButtonStatus(false);
1575 //update Hold button status
1576 SetHoldButtonStatus(true);
1577 //current system time
1578 long long currTime = 0;
1579 SystemTime::GetTicks(currTime);
1581 TimeSpan diffSpan(abs(startTime - currTime));
1583 String activeCallTime(L"");
1585 long long hr = diffSpan.GetHours();
1588 activeCallTime.Append("0");
1590 activeCallTime.Append(hr);
1591 activeCallTime.Append(L":");
1593 long long min = diffSpan.GetMinutes();
1596 activeCallTime.Append("0");
1598 activeCallTime.Append(min);
1599 activeCallTime.Append(L":");
1601 long long sec = diffSpan.GetSeconds();
1604 activeCallTime.Append("0");
1606 activeCallTime.Append(sec);
1608 pTimerLbl->SetText(activeCallTime);
1609 __pActiveCallTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
1611 pTimerLbl->Invalidate(true);
1616 ActiveCallForm::SetShowStateOnKeypad(bool showState)
1618 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1619 pLblControl->SetShowState(showState);
1620 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL));
1621 pLblControl->SetShowState(showState);
1622 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1623 pLblControl->SetShowState(showState);
1624 if (__pSmallPhotoLabel != null)
1626 __pSmallPhotoLabel->SetShowState(showState);
1631 case FORMTYPE_ACTIVECALL:
1633 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1634 pLblControl->SetShowState(showState);
1635 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1636 pLblControl->SetShowState(showState);
1637 pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1638 pLblControl->SetShowState(showState);
1639 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1640 pButtonControl->SetShowState(showState);
1644 case FORMTYPE_MULTIPLECALLS:
1646 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1647 pLblControl->SetShowState(showState);
1648 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1649 pLblControl->SetShowState(showState);
1650 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1651 pLblControl->SetShowState(showState);
1652 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1653 pLblControl->SetShowState(showState);
1654 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1655 pLblControl->SetShowState(showState);
1656 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1657 pLblControl->SetShowState(showState);
1658 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == false)
1660 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1661 pLblControl->SetShowState(showState);
1665 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1666 pButtonControl->SetShowState(showState);
1668 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1669 pButtonControl->SetShowState(showState);
1673 case FORMTYPE_ACTIVECONFCALL:
1675 pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1676 pLblControl->SetShowState(showState);
1677 pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1678 pLblControl->SetShowState(showState);
1679 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1680 pButtonControl->SetShowState(showState);
1681 pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1682 pButtonControl->SetShowState(showState);
1692 ActiveCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1694 //Call default implementation of "Object.Equals()"
1695 //returns true, if they are pointing to same address.
1696 if (__pActiveCallTimer->Equals(timer))
1698 Label* pTimerLbl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1701 String activeCallTime = pTimerLbl->GetText();
1702 // Create a StringTokenizer instance
1703 StringTokenizer strTokens(activeCallTime, L":");
1705 int count = strTokens.GetTokenCount(); // count == 3
1710 for (int index = 0; index < count; index++)
1715 strTokens.GetNextToken(token);
1716 Integer::Parse(token, hr);
1720 strTokens.GetNextToken(token);
1721 Integer::Parse(token, min);
1725 strTokens.GetNextToken(token);
1726 Integer::Parse(token, sec);
1732 if (sec == IDI_MAX_SECONDS)
1737 if (min == IDI_MAX_MINS)
1744 activeCallTime.Clear();
1747 activeCallTime.Append("0");
1749 activeCallTime.Append(hr);
1750 activeCallTime.Append(":");
1753 activeCallTime.Append("0");
1755 activeCallTime.Append(min);
1756 activeCallTime.Append(":");
1759 activeCallTime.Append("0");
1761 activeCallTime.Append(sec);
1762 //update timer label
1763 pTimerLbl->SetText(activeCallTime);
1764 pTimerLbl->Invalidate(true);
1769 ///////////////////////////////////////////////////////////
1770 /////////// Options Menu List Functionality /////////
1771 ///////////////////////////////////////////////////////////
1773 ActiveCallForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
1778 ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
1780 //Goto conference call list form
1781 SceneManager* pSceneManager = SceneManager::GetInstance();
1782 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST), null);
1786 ActiveCallForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
1791 ActiveCallForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
1796 ActiveCallForm::GetItemCount(void)
1798 return IDI_MOREOPTIONS_LIST_ITEMS;
1802 ActiveCallForm::CreateItem(int index, int itemWidth)
1804 //create 1st Menu option
1805 CustomItem* pItem = new (std::nothrow) CustomItem();
1806 pItem->Construct(IDI_OPTIONMENU_DIMEN, LIST_ANNEX_STYLE_NORMAL);
1808 //Set background 9-patch bitmap to option menu
1809 Bitmap* pBgBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_BG_ICON);
1810 if (pBgBmp != null && pBgBmp->IsNinePatchedBitmap())
1813 bgCanvas.Construct(Rectangle(IDI_OPTIONMENU_POS, IDI_OPTIONMENU_DIMEN));
1814 bgCanvas.DrawNinePatchedBitmap(bgCanvas.GetBounds(), *pBgBmp);
1818 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color(40, 45, 48));
1823 //Set bitmap to option menu
1824 Bitmap* pNormalConfCallBmp = AppUtility::GetBitmapFromResourcesN(IDB_MORE_MANAGE_CONFERENCE_ICON ,
1825 W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP);
1826 pItem->AddElement(Rectangle(16, 17, W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP), 1, *pNormalConfCallBmp, null, null);
1827 // Deallocate bitmaps
1828 delete pNormalConfCallBmp;
1829 pNormalConfCallBmp = null;
1831 //Set text to menu option
1832 String confCallName = AppUtility::GetResourceString(IDS_MGR_CONF_CALL_LIST_STR);
1834 TextElement* pTextElement = new (std::nothrow) TextElement();
1835 pTextElement->Construct(confCallName);
1836 pTextElement->SetTextColor(COLOR_POPUP_TEXT);
1839 font.Construct(FONT_STYLE_PLAIN, IDI_POPUP_TEXT_SIZE);
1840 pTextElement->SetFont(font);
1841 //construct Enriched text
1842 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1843 FloatDimension textDimension;
1844 font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
1845 textDimension.height = textDimension.height + font.GetDescender();
1846 pEnrichedText->Construct(textDimension);
1847 //add text element to enriched text
1848 pEnrichedText->Add(*pTextElement);
1850 //Add Enriched text to pItem
1851 FloatPoint textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
1852 pItem->AddElement(FloatRectangle(textPos, textDimension), 2, *pEnrichedText);
1854 pEnrichedText->RemoveAll(true);
1855 delete pEnrichedText;
1860 ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
1867 ActiveCallForm::OnForeground(void)
1869 __pCallPresentor->OnAppForeground();