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"
35 using namespace Tizen::App;
36 using namespace Tizen::Base;
37 using namespace Tizen::Base::Collection;
38 using namespace Tizen::Base::Utility;
39 using namespace Tizen::Graphics;
40 using namespace Tizen::Media;
41 using namespace Tizen::Social;
42 using namespace Tizen::System;
43 using namespace Tizen::Ui;
44 using namespace Tizen::Ui::Controls;
45 using namespace Tizen::Ui::Scenes;
48 const int IDI_MAX_SECONDS = 60;
49 const int IDI_MAX_MINS = 60;
50 const int W_HOLD_BITMAP = 78;
51 const int H_HOLD_BITMAP = 78;
52 //for Options menu list
53 const int IDI_POPUP_TEXT_SIZE = 33;
54 const unsigned int COLOR_POPUP_TEXT = Color32<255, 255, 255, 255>::Value;
55 const int IDI_MOREOPTIONS_LIST_ITEMS = 1;
56 const int W_OPTION_ANCHOR = 72;
57 const int H_OPTION_ANCHOR = 22;
58 const int W_MGR_CONFCALL_BITMAP = 64;
59 const int H_MGR_CONFCALL_BITMAP = 64;
60 const int X_POPUP_ANCHOR = 632;
61 const int Y_POPUP_ANCHOR = 140;
62 const int W_POPUP_ANCHOR = 72;
63 const int H_POPUP_ANCHOR = 22;
64 const int IDI_OPTIONMENU_ITEM_SPACING = 16;
65 const Point IDI_OPTIONMENU_POS(238, 162);
66 const Dimension IDI_OPTIONMENU_DIMEN(466, 99);
67 const int X_PHOTO_LBL = 166;
68 const int Y_PHOTO_LBL = 232;
69 const int W_PHOTO_LBL = 388;
70 const int H_PHOTO_LBL = 388;
71 const int W_PHOTO_LABEL = 720;
72 const int H_PHOTO_LABEL = 720;
73 const int W_RIGHT_MORE_ICON_MARGIN = 24;
74 const int W_MORE_LABEL = 466;
75 const int H_MORE_LABEL = 162;
76 const int W_MORE_ICON = 70;
78 static const wchar_t* IDC_CONF_CALL_MORE_BUTTON = L"IDC_CONF_CALL_MORE_BUTTON";
79 static const wchar_t* IDC_HOLD_BUTTON = L"IDC_HOLD_BUTTON";
80 static const wchar_t* IDC_SWAP_BUTTON = L"IDC_SWAP_BUTTON";
81 static const wchar_t* IDC_HOLD_LABEL = L"IDC_HOLD_LABEL";
82 static const wchar_t* IDC_TEXTBOX = L"IDC_NUM_EDITFIELD";
83 static const wchar_t* IDC_CALLER1_LABEL = L"IDC_CALLER1_LABEL";
84 static const wchar_t* IDC_BACKGROUND_LABEL = L"IDC_BACKGROUND_LABEL";
85 static const wchar_t* IDC_CALLER1_TIME_LABEL = L"IDC_CALLER1_TIME_LABEL";
86 static const wchar_t* IDC_NUMBER1_LABEL = L"IDC_NUMBER1_LABEL";
87 static const wchar_t* IDC_VOICE_CALL_ICON_LABEL = L"IDC_VOICE_CALL_ICON_LABEL";
88 static const wchar_t* IDC_CALLER2_LABEL = L"IDC_CALLER2_LABEL";
89 static const wchar_t* IDC_NUMBER2_LABEL = L"IDC_NUMBER2_LABEL";
90 static const wchar_t* IDC_CALLER2_TIME_LABEL = L"IDC_CALLER2_TIME_LABEL";
91 static const wchar_t* IDC_SWAP_LABEL = L"IDC_SWAP_LABEL";
92 static const wchar_t* IDC_BACKGROUND_LABEL2 = L"IDC_BACKGROUND_LABEL2";
93 static const wchar_t* IDC_PARTICIPANTS_LABEL = L"IDC_PARTICIPANTS_LABEL";
94 static const wchar_t* IDC_CALLER1_BIGPHOTO_LABEL = L"IDC_CALLER1_BIGPHOTO_LABEL";
95 static const wchar_t* IDC_CALLER2_PHOTO_LABEL = L"IDC_CALLER2_PHOTO_LABEL";
96 static const wchar_t* IDC_CALLER1_PHOTO_LABEL = L"IDC_CALLER1_PHOTO_LABEL";
97 static const wchar_t* IDC_KEY_BG_LABEL = L"IDC_KEY_BG_LABEL";
99 ActiveCallForm::ActiveCallForm(FormType formType)
102 __pActiveCallTimer = null;
103 __pCallButtonsPanel = null;
104 __pDTMFKeypad = null;
105 __pMoreOptionsList = null;
106 __pMoreOptionsListAnchor = null;
107 __pSmallPhotoLabel = null;
108 __pActiveCallInfo = null;
109 __pHeldCallInfo = null;
112 ActiveCallForm::~ActiveCallForm(void)
114 if (__pActiveCallTimer != null)
116 __pActiveCallTimer->Cancel();
117 delete __pActiveCallTimer;
119 if (__pMoreOptionsList != null)
121 __pMoreOptionsList = null;
123 if (__pMoreOptionsListAnchor != null)
125 __pMoreOptionsListAnchor = null;
127 if (__pSmallPhotoLabel != null)
129 __pSmallPhotoLabel = null;
131 if (__pActiveCallInfo != null)
133 delete __pActiveCallInfo;
135 if (__pHeldCallInfo != null)
137 delete __pHeldCallInfo;
139 if(__pDTMFKeypad != null)
141 __pDTMFKeypad = null;
146 ActiveCallForm::Initialize(void)
150 case FORMTYPE_OUTGOINGCALL:
151 Construct(IDL_OUTCALL_FORM);
154 case FORMTYPE_EMERGENCYOUTGOINGCALL:
155 Construct(IDL_OUT_EMERGENCYCALL_FORM);
158 case FORMTYPE_ACTIVECALL:
159 Construct(IDL_CALL_FORM);
162 case FORMTYPE_EMERGENCYACTIVECALL:
163 Construct(IDL_EMERGENCY_CALL_FORM);
166 case FORMTYPE_MULTIPLECALLS:
167 Construct(IDL_MULTIPLE_CALL_FORM);
170 case FORMTYPE_ACTIVECONFCALL:
171 Construct(IDL_CONFCALL_FORM);
180 ActiveCallForm::OnInitializing(void)
182 result r = E_SUCCESS;
184 //Hold Button - Shown on single active/conf call scene
185 InitializeHoldButton();
186 //Swap button for multiple call screen
187 InitializeSwapButton();
188 //Initialize manage conf. call list form
189 InitializeManageConfCallButton();
191 __pCallPresentor = CallPresentationModel::GetInstance();
196 ActiveCallForm::ShowDTMFKeypad(void)
198 if(__pDTMFKeypad == null)
200 //update rect according to client screen area
201 Rectangle rect(0, 0, 0, 0);
202 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
204 rect.width = GetClientAreaBounds().width;
205 rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight();
207 else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
209 rect.height = GetClientAreaBounds().height;
210 rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth();
213 AppLog("DTMF Keypad rect(%d,%d,%d,%d)",rect.x,rect.y,rect.width,rect.height);
214 __pDTMFKeypad = new (std::nothrow) DtmfKeyPadPanel();
215 __pDTMFKeypad->Initialize(this, rect);
216 AddControl(*__pDTMFKeypad);
218 //set layout relation w.r.t call buttons panel
219 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
220 if (pRelativeLayout != null)
222 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
223 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
226 __pDTMFKeypad->SetShowState(true);
227 if(__DtmfString.IsEmpty() == false)
229 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
230 pTextBox->SetText(__DtmfString);
232 __pDTMFKeypad->Draw(true);
233 __pDTMFKeypad->Show();
237 ActiveCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
241 if (__pCallButtonsPanel != null)
243 //update position of call buttons panel
244 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
245 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
247 //bring button on top
248 __pCallButtonsPanel->SetButtonPosition();
250 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
251 if (pRelativeLayout != null)
253 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
256 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
257 if (pRelativeLayout != null)
259 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
260 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
263 //change orientation of DTMF Keypad, if it is visible.
264 if (__pDTMFKeypad != null)
266 if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
268 //in landscape mode, caller info is visible.
269 SetShowStateOnKeypad(true);
271 else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
273 //in Portrait mode it is hidden beneath DTMF Keypad.
274 SetShowStateOnKeypad(false);
276 if(__pDTMFKeypad->GetShowState() == true)
278 String dtmfText = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
284 //More option is displayed recreate it
285 if(__pMoreOptionsListAnchor != null)
287 CreateMoreOptionsMenuList();
288 CreateMoreOptionsMenuList();
293 ActiveCallForm::HideDTMFKeypad(void)
295 if(__pDTMFKeypad != null)
297 __DtmfString = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
299 RemoveControl(*__pDTMFKeypad);
300 __pDTMFKeypad = null;
305 ActiveCallForm::InitializeCallButtonsPanel(void)
307 result r = E_SUCCESS;
308 //Set background bitmap for call keypad
309 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
310 Bitmap* pBgBitmap = AppUtility::GetBitmapFromResourcesN(IDB_BACKGROUND_BITMAP, pKeysBgLbl->GetWidth(), pKeysBgLbl->GetHeight());
311 if (pBgBitmap != null)
313 pKeysBgLbl->SetBackgroundBitmap(*pBgBitmap);
316 if (__pCallButtonsPanel == null)
318 __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
319 __pCallButtonsPanel->ConstructPanel(this, __formType);
320 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
321 r = AddControl(*__pCallButtonsPanel);
324 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
325 if (pRelativeLayout != null)
327 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
329 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
330 if (pRelativeLayout != null)
332 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
333 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
334 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
335 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_TOP_TO_TOP);
342 ActiveCallForm::InitializeSwapButton(void)
344 Button* pSwapBtn = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
347 Bitmap* pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_NORMAL,
348 W_HOLD_BITMAP, H_HOLD_BITMAP);
351 pSwapBtn->SetNormalBitmap(Point(0, 0), *pSwapBmp);
356 pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_PRESS,
357 W_HOLD_BITMAP, H_HOLD_BITMAP);
360 pSwapBtn->SetPressedBitmap(Point(0, 0), *pSwapBmp);
364 pSwapBtn->SetActionId(IDA_SWAP_CALLS);
365 pSwapBtn->AddActionEventListener(*this);
370 ActiveCallForm::InitializeManageConfCallButton(void)
372 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
373 if (pMoreBtn != null)
375 pMoreBtn->SetActionId(IDA_MORE_OPTIONS_MENU);
376 pMoreBtn->AddActionEventListener(*this);
377 if (__formType == FORMTYPE_MULTIPLECALLS)
379 //Correct state will be set in OnSceneActivated based on the call
380 pMoreBtn->SetShowState(false);
382 else if (__formType == FORMTYPE_ACTIVECONFCALL)
384 pMoreBtn->SetShowState(true);
390 ActiveCallForm::InitializeHoldButton(void)
392 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
393 if (pHoldBtn != null)
395 //set status of Hold Button
396 SetHoldButtonStatus(true);
397 pHoldBtn->AddActionEventListener(*this);
402 ActiveCallForm::SetHoldButtonStatus(bool toHoldCall)
404 //background bitmap & button name
406 Bitmap* normalImg = null;
407 Bitmap* pressImg = null;
410 btnName.Append(AppUtility::GetResourceString(IDS_HOLD_BTN_NAME));
411 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_NORMAL_BUTTON_ICON,
412 W_HOLD_BITMAP, H_HOLD_BITMAP);
413 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_PRESS_BUTTON_ICON,
414 W_HOLD_BITMAP, H_HOLD_BITMAP);
418 btnName.Append(AppUtility::GetResourceString(IDS_UNHOLD_BTN_NAME));
419 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_NORMAL_BUTTON_ICON,
420 W_HOLD_BITMAP, H_HOLD_BITMAP);
421 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_PRESS_BUTTON_ICON,
422 W_HOLD_BITMAP, H_HOLD_BITMAP);
426 CommandIds cmdId = IDA_HOLD_CALL;
429 case FORMTYPE_ACTIVECALL:
431 cmdId = toHoldCall ? IDA_HOLD_CALL : IDA_UNHOLD_CALL;
435 case FORMTYPE_ACTIVECONFCALL:
437 cmdId = toHoldCall ? IDA_HOLD_CONF_CALL : IDA_UNHOLD_CONF_CALL;
445 //set background bitmap, button name & action id
446 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
447 Label* pHoldLbl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
450 pHoldBtn->SetActionId(cmdId);
451 pHoldBtn->SetNormalBitmap(Point(0, 0),*normalImg);
452 pHoldBtn->SetPressedBitmap(Point(0, 0),*pressImg);
456 pHoldLbl->SetText(btnName);
457 pHoldLbl->Invalidate(true);
468 ActiveCallForm::CreateMoreOptionsMenuList(void)
470 //create option list anchor
471 if (__pMoreOptionsListAnchor == null)
473 Bitmap* pBgPopupArwBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_ARROW_ICON, W_OPTION_ANCHOR,
475 __pMoreOptionsListAnchor = new (std::nothrow) Label();
476 __pMoreOptionsListAnchor->Construct(Rectangle(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_ICON, Y_POPUP_ANCHOR, W_POPUP_ANCHOR, H_POPUP_ANCHOR), L"");
477 __pMoreOptionsListAnchor->SetBackgroundBitmap(*pBgPopupArwBmp);
479 delete pBgPopupArwBmp;
480 pBgPopupArwBmp = null;
482 // Adds a Label to the Form
483 AddControl(*__pMoreOptionsListAnchor);
486 //create options menu list
487 if (__pMoreOptionsList == null)
489 __pMoreOptionsList = new (std::nothrow) ListView();
490 __pMoreOptionsList->Construct(Rectangle(Point(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_LABEL,H_MORE_LABEL), IDI_OPTIONMENU_DIMEN), false, SCROLL_STYLE_FADE_OUT);
491 __pMoreOptionsList->SetItemProvider(*this);
492 __pMoreOptionsList->AddListViewItemEventListener(*this);
493 //Add option list to the form
494 AddControl(*__pMoreOptionsList);
498 //Hide option menu list
499 DestroyMoreOptionsMenuList();
504 ActiveCallForm::DestroyMoreOptionsMenuList(void)
506 if (__pMoreOptionsListAnchor != null)
508 //removes and delete the child control
509 RemoveControl(*__pMoreOptionsListAnchor);
510 __pMoreOptionsListAnchor = null;
513 if (__pMoreOptionsList != null)
515 //removes and delete the child control
516 RemoveControl(*__pMoreOptionsList);
517 __pMoreOptionsList = null;
522 ActiveCallForm::OnTerminating(void)
524 result r = E_SUCCESS;
525 if (__pCallPresentor != null)
527 __pCallPresentor = null;
533 ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
541 //End the currently active / dialing call
542 if (__pActiveCallInfo->IsConferenceCall() == false)
544 String activeContactNo;
545 activeContactNo.Append(__pActiveCallInfo->GetContactNumber());
546 //Check if it is call is in dialing state, then
547 if (__formType == FORMTYPE_EMERGENCYOUTGOINGCALL || __formType == FORMTYPE_OUTGOINGCALL)
549 __pCallPresentor->EndDialingCall(activeContactNo);
554 __pCallPresentor->EndActiveCall(*__pActiveCallInfo->GetCallHandle());
559 __pCallPresentor->EndConferenceCall();
564 case IDA_END_CONF_CALL:
566 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
567 __pCallPresentor->EndConferenceCall();
571 case IDA_OPEN_NUMKEYPAD:
573 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
575 //hide only in portrait mode.
576 SetShowStateOnKeypad(false);
579 __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
583 case IDA_CLOSE_NUMKEYPAD:
585 SetShowStateOnKeypad(true);
587 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
593 //switch to Dialer Form to make an call
594 if(__pCallPresentor->GetCurrentCallCount() == 1)
596 __pCallPresentor->LaunchDialAppControl();
604 if (__pActiveCallInfo->IsConferenceCall() == false)
606 if(__pActiveCallInfo->GetCallHandle() != null)
608 success = __pCallPresentor->HoldCall(*__pActiveCallInfo->GetCallHandle());
613 success = __pCallPresentor->HoldConferenceCall();
615 //reset hold status and "OnHold" text
616 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
617 if(__pActiveCallTimer != null)
619 __pActiveCallTimer->Cancel();
621 SetHoldButtonStatus(!success);
625 case IDA_UNHOLD_CALL:
627 bool success = false;
628 if (__pActiveCallInfo->IsConferenceCall() == false)
630 if(__pActiveCallInfo->GetCallHandle() != null)
632 success = __pCallPresentor->UnHoldCall(*__pActiveCallInfo->GetCallHandle());
637 success = __pCallPresentor->ActivateConferenceCall();
639 //reset hold status and show call timer
640 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
641 SetHoldButtonStatus(success);
645 case IDA_HOLD_CONF_CALL:
647 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
648 bool success = __pCallPresentor->HoldConferenceCall();
649 //reset hold status and "OnHold" text
650 SetHoldButtonStatus(!success);
651 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
652 if(__pActiveCallTimer != null)
654 __pActiveCallTimer->Cancel();
659 case IDA_UNHOLD_CONF_CALL:
661 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
662 bool success = __pCallPresentor->ActivateConferenceCall();
663 //reset hold status and show call timer
664 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
665 SetHoldButtonStatus(success);
669 case IDA_OPEN_CONTACTS:
672 //Launch call application
673 AppManager* pAppManager = AppManager::GetInstance();
674 pAppManager->LaunchApplication(PROVIDER_ID_CONTACTS);
680 bool success = __pCallPresentor->SetMuteStatus(true);
683 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
690 bool success = __pCallPresentor->SetMuteStatus(false);
693 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
700 bool success = __pCallPresentor->SetSpeakerStatus(true);
703 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
708 case IDA_SPEAKER_OFF:
710 bool success = __pCallPresentor->SetSpeakerStatus(false);
713 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
720 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
721 __pCallPresentor->JoinCall();
727 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
728 __pCallPresentor->SwapCalls();
732 case IDA_MORE_OPTIONS_MENU:
734 //Show 'more' options menu
735 CreateMoreOptionsMenuList();
741 dtmfString.Append(L"0");
742 SetTextToDTMFTextField(dtmfString);
743 __pCallPresentor->SendDTMFSignal(dtmfString);
749 dtmfString.Append(L"1");
750 SetTextToDTMFTextField(dtmfString);
751 __pCallPresentor->SendDTMFSignal(dtmfString);
757 dtmfString.Append(L"2");
758 SetTextToDTMFTextField(dtmfString);
759 __pCallPresentor->SendDTMFSignal(dtmfString);
765 dtmfString.Append(L"3");
766 SetTextToDTMFTextField(dtmfString);
767 __pCallPresentor->SendDTMFSignal(dtmfString);
773 dtmfString.Append(L"4");
774 SetTextToDTMFTextField(dtmfString);
775 __pCallPresentor->SendDTMFSignal(dtmfString);
781 dtmfString.Append(L"5");
782 SetTextToDTMFTextField(dtmfString);
783 __pCallPresentor->SendDTMFSignal(dtmfString);
789 dtmfString.Append(L"6");
790 SetTextToDTMFTextField(dtmfString);
791 __pCallPresentor->SendDTMFSignal(dtmfString);
797 dtmfString.Append(L"7");
798 SetTextToDTMFTextField(dtmfString);
799 __pCallPresentor->SendDTMFSignal(dtmfString);
805 dtmfString.Append(L"8");
806 SetTextToDTMFTextField(dtmfString);
807 __pCallPresentor->SendDTMFSignal(dtmfString);
813 dtmfString.Append(L"9");
814 SetTextToDTMFTextField(dtmfString);
815 __pCallPresentor->SendDTMFSignal(dtmfString);
821 dtmfString.Append(L"*");
822 SetTextToDTMFTextField(dtmfString);
823 __pCallPresentor->SendDTMFSignal(dtmfString);
829 dtmfString.Append(L"#");
830 SetTextToDTMFTextField(dtmfString);
831 __pCallPresentor->SendDTMFSignal(dtmfString);
841 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
843 if(__pDTMFKeypad != null)
845 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
847 int startpos=-1,endpos=-1;
848 pTextBox->GetBlockRange(startpos,endpos);
852 pTextBox->ReleaseBlock();
855 pTextBox->InsertTextAtCursorPosition(dtmfStr);
856 //pTextBox->AppendText(dtmfStr);
857 pTextBox->SetFocus();
858 pTextBox->Invalidate(true);
863 ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
866 //set itself as listener
867 __pCallPresentor->SetTelEventListener(this);
868 AddOrientationEventListener(*this);
870 CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
871 pPhoneApp->AddAppStateChangeListener(*this);
873 //Initialize keypad and buttons
874 InitializeCallButtonsPanel();
876 if (__pActiveCallInfo != null)
878 delete __pActiveCallInfo;
879 __pActiveCallInfo = null;
881 if (__pHeldCallInfo != null)
883 delete __pHeldCallInfo;
884 __pHeldCallInfo = null;
886 DestroyMoreOptionsMenuList();
890 case FORMTYPE_OUTGOINGCALL:
893 contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
894 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
895 __pActiveCallInfo->SetContactNumber(contactNo);
896 Contact* pContact = __pCallPresentor->GetContactN(contactNo);
897 if (pContact != null)
899 __pActiveCallInfo->SetContactInfo(*pContact);
902 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
903 //make an normal outgoing call
904 __pCallPresentor->DialCall(contactNo, false);
908 case FORMTYPE_EMERGENCYOUTGOINGCALL:
910 String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
911 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
912 long long phNumber = 0;
913 LongLong::Parse(*pContactNo, phNumber);
914 __pActiveCallInfo->SetContactNumber(*pContactNo);
915 //make an emergency call
916 __pCallPresentor->DialCall(*pContactNo, true);
920 case FORMTYPE_ACTIVECALL:
923 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
925 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
926 *__pActiveCallInfo = *pCall;
927 String activeContactNo;
928 if(pCall->GetContactNumber().IsEmpty() == false)
930 activeContactNo.Append(pCall->GetContactNumber());
934 activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
936 ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
938 //show call active time using Timer
939 __activeCallStartTime = pCall->GetCallConnectTime();
940 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
944 case FORMTYPE_EMERGENCYACTIVECALL:
947 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
949 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
950 *__pActiveCallInfo = *pCall;
952 //show call active time using Timer
953 __activeCallStartTime = pCall->GetCallConnectTime();
954 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
958 case FORMTYPE_MULTIPLECALLS:
960 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
962 UpdateMultipleCallScreen(*pCallsList);
968 case FORMTYPE_ACTIVECONFCALL:
971 AppCallInfo* pConfInfo = static_cast<AppCallInfo*>(pArgs->GetAt(0));
972 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
973 *__pActiveCallInfo = *pConfInfo;
975 int participantsCount = __pActiveCallInfo->GetCallerListCount();
977 // show participant count on name Label
978 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
982 count.Append(participantsCount);
984 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
985 pPeopleCountLbl->SetText(count);
988 if(participantsCount >= IDI_MAX_CONF_CALL_PARTICIPANTS)
990 __pCallButtonsPanel->EnableAddCallButton(false);
994 __pCallButtonsPanel->EnableAddCallButton(true);
997 //show call active time using Timer
998 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
999 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime);
1007 //Hide DTMFKeypad, if visible and show caller info
1009 SetShowStateOnKeypad(true);
1010 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
1012 //Set the correct speaker status
1013 if(__pCallPresentor->IsSpeakerOn() == true)
1015 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
1019 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
1022 //Set the correct Mute status
1023 if (__pCallPresentor->IsCallMuted() == true)
1025 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
1029 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
1041 ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1043 RemoveOrientationEventListener(*this);
1044 if (__pCallButtonsPanel != null)
1046 RemoveControl(*__pCallButtonsPanel);
1047 __pCallButtonsPanel = null;
1049 if (__pActiveCallTimer != null)
1051 __pActiveCallTimer->Cancel();
1052 delete __pActiveCallTimer;
1053 __pActiveCallTimer = null;
1055 if (__pSmallPhotoLabel != null)
1057 __pSmallPhotoLabel->SetShowState(false);
1059 //Hide "Manage conf. Call" Context menu
1060 if (__pMoreOptionsListAnchor != null)
1062 __pMoreOptionsListAnchor->SetShowState(false);
1064 if (__pMoreOptionsList != null)
1066 __pMoreOptionsList->SetShowState(false);
1068 __DtmfString.Clear();
1069 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1070 pCallApp->RemoveAppStateChangeListener(*this);
1074 ActiveCallForm::HandleConfCallChanged(void)
1077 AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
1078 //fetch changed conference call info
1079 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1080 if (pConfCallInfo == null)
1086 //fetch participant count in conf call
1087 int participantsCount = pConfCallInfo->GetCallerListCount();
1088 //update status of join and Add call
1089 bool isEnableAddCall = false;
1090 bool isEnableJoinCall = false;
1091 if(participantsCount < IDI_MAX_CONF_CALL_PARTICIPANTS)
1093 //available only at Active conf. call or active call screen
1094 isEnableAddCall = true;
1095 //join button is available only at multiple call screen
1096 isEnableJoinCall = true;
1099 Label* pPeopleCountLbl = null;
1100 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == true)
1102 //Active call is conference call
1103 delete __pActiveCallInfo;
1104 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1105 *__pActiveCallInfo = *pConfCallInfo;
1107 if (__formType == FORMTYPE_MULTIPLECALLS)
1109 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1111 else if (__formType == FORMTYPE_ACTIVECONFCALL)
1113 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1114 AppLog("Active conf call...(%d)", pPeopleCountLbl);
1117 else if(__pHeldCallInfo != null && __pHeldCallInfo->IsConferenceCall() == true)
1119 //Held call is conference call - this is definitely multiple call screen.
1120 delete __pHeldCallInfo;
1121 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1122 *__pHeldCallInfo = *pConfCallInfo;
1123 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1126 // update participant count on name Label
1127 if (pPeopleCountLbl != null)
1130 count.Append(participantsCount);
1132 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1133 pPeopleCountLbl->SetText(count);
1134 pPeopleCountLbl->Invalidate(true);
1136 //change AddCall Button status
1137 __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
1138 //change JoinCall Button status
1139 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1144 ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
1147 if(__pActiveCallInfo != null)
1149 delete __pActiveCallInfo;
1150 __pActiveCallInfo = null;
1152 if(__pHeldCallInfo != null)
1154 delete __pHeldCallInfo;
1155 __pHeldCallInfo = null;
1158 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1159 if (pMoreBtn != null)
1161 pMoreBtn->SetShowState(false);
1164 //show caller's info.
1165 for (int index = 0; index < activeCallsList.GetCount(); index++)
1168 AppCallInfo callInfo;
1169 activeCallsList.GetAt(index, callInfo);
1172 if(callInfo.GetContactNumber().IsEmpty() == false)
1174 contactNo.Append(callInfo.GetContactNumber());
1178 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1181 if (callInfo.IsOnHold() == false)
1183 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1184 *__pActiveCallInfo = callInfo;
1186 if (__pActiveCallInfo->IsConferenceCall() == false)
1188 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1191 pVoiceIconLbl->SetShowState(true);
1193 if (pMoreBtn != null)
1195 pMoreBtn->SetShowState(false);
1197 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1198 if(__pMoreOptionsListAnchor != null && __pMoreOptionsListAnchor->GetShowState() == true)
1200 CreateMoreOptionsMenuList();
1205 // show participant count on name Label
1206 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1207 if (pPeopleCountLbl)
1210 count.Append(__pActiveCallInfo->GetCallerListCount());
1212 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1213 pPeopleCountLbl->SetText(count);
1215 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1216 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1219 pNameLbl->SetText(nameStr);
1221 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1224 pVoiceIconLbl->SetShowState(false);
1226 if (pMoreBtn != null)
1228 pMoreBtn->SetShowState(true);
1230 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1231 if (pPhotoBitmap != null)
1233 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER1_PHOTO_LABEL));
1236 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1237 pPhotoLbl->Invalidate(true);
1239 delete pPhotoBitmap;
1242 //show call active time using Timer
1243 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1244 ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime);
1248 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1249 *__pHeldCallInfo = callInfo;
1251 if (__pHeldCallInfo->IsConferenceCall() == false)
1253 ShowPersonDetails(contactNo, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pHeldCallInfo);
1257 // show participant count on name Label
1258 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1259 if (pPeopleCountLbl)
1262 count.Append(__pHeldCallInfo->GetCallerListCount());
1264 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1265 pPeopleCountLbl->SetText(count);
1267 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1268 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1271 pNameLbl->SetText(nameStr);
1273 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1274 if (pPhotoBitmap != null)
1276 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER2_PHOTO_LABEL));
1279 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1280 pPhotoLbl->Invalidate(true);
1282 delete pPhotoBitmap;
1286 ShowTimerInfo(IDC_CALLER2_TIME_LABEL, true);
1290 //update JoinCall button status
1291 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1297 ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
1299 //call individual methods to show contact number, caller name & photo
1300 ShowPhoneNumber(phoneNumber, contactLblName);
1302 //fetch contact details based on phone number
1303 String* pDisplayName = pCallInfo->FetchCallerNameN();
1304 ShowCallerName(*pDisplayName, nameLblName);
1306 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1307 ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
1312 delete pDisplayName;
1313 pDisplayName = null;
1317 delete pPhotoBitmap;
1318 pPhotoBitmap = null;
1323 ActiveCallForm::ShowPhoneNumber(const String& phoneNumber, const String& contactLblName)
1325 String formattedNumber = phoneNumber;
1327 Label* pContactLbl = static_cast<Label*>(GetControl(contactLblName));
1330 pContactLbl->SetText(formattedNumber);
1331 pContactLbl->Invalidate(true);
1336 ActiveCallForm::ShowCallerName(const String& callerName, const String& nameLblName)
1338 // show display name on name Label
1339 Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
1342 //passing an empty string to SetText fails in label,
1343 //if previously valid text has been set
1344 if (callerName.IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
1346 String stringToBeSet(L" ");
1347 pNameLbl->SetText(stringToBeSet);
1351 pNameLbl->SetText(callerName);
1353 pNameLbl->Invalidate(true);
1358 ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
1360 //to check if default image is to be shown
1361 bool showDefaultPhoto = false;
1362 bool showSmallPhoto = false;
1363 String photoLabel("");
1367 case FORMTYPE_OUTGOINGCALL:
1368 case FORMTYPE_ACTIVECALL:
1370 if (pPhotoId == null)
1372 //show default caller image
1373 showDefaultPhoto = true;
1377 //Check the size of photo
1378 // Now checking the condition with && but actually it should be ||
1379 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1380 // height 270 and width = 480 . So all images set thru gallery is show as small image
1381 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1382 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1384 showSmallPhoto = true;
1388 photoLabel.Append(IDC_CALLER1_BIGPHOTO_LABEL);
1392 case FORMTYPE_MULTIPLECALLS:
1396 photoLabel.Append(IDC_CALLER2_PHOTO_LABEL);
1400 photoLabel.Append(IDC_CALLER1_PHOTO_LABEL);
1403 if (pPhotoId == null)
1405 showDefaultPhoto = true;
1409 if (pPhotoId->GetHeight() <= H_SMALL_PHOTO
1410 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1412 //pPhotoId->Scale(Dimension(W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO));
1413 showSmallPhoto = true;
1423 //Remove small photo label
1424 if (__pSmallPhotoLabel != null)
1426 RemoveControl(*__pSmallPhotoLabel);
1427 __pSmallPhotoLabel = null;
1430 //show photo - for Big Photo Id, Animated Call Image
1431 if (!showDefaultPhoto)
1433 if(showSmallPhoto == true)
1435 ShowThumbnailImage(pPhotoId,photoLabel);
1439 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1442 Canvas* pCanvas = new (std::nothrow) Canvas;
1443 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1444 pCanvas->Construct(canvasRect);
1445 //draw the contact bitmap
1446 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1447 Bitmap* pNewPhotoId = new Bitmap();
1448 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1451 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1452 pPhotoLbl->Invalidate(true);
1459 Bitmap* pDefaultPhoto = null;
1462 case FORMTYPE_OUTGOINGCALL:
1463 case FORMTYPE_ACTIVECALL:
1464 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1467 case FORMTYPE_MULTIPLECALLS:
1468 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_MULTIPLE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1471 case FORMTYPE_ACTIVECONFCALL:
1472 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BIG_BG_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1478 if (pDefaultPhoto != null)
1480 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1483 pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
1485 delete pDefaultPhoto;
1491 ActiveCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,String& photoLabel)
1493 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1495 if (pPhotoLbl != null && pPhotoId != null)
1497 Canvas* pCanvas = new (std::nothrow) Canvas;
1498 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1499 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1500 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1501 pCanvas->Construct(canvasRect);
1502 //draw the back ground
1503 pCanvas->DrawBitmap(canvasRect,*pBackground);
1504 //draw shadow (to be enabled after correct shadow image is provided )
1505 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1506 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1507 //draw the contact bitmap
1508 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1509 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1510 Bitmap* pNewPhotoId = new Bitmap();
1511 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1514 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1515 pPhotoLbl->Invalidate(true);
1524 ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1526 if (__pSmallPhotoLabel != null)
1528 RemoveControl(*__pSmallPhotoLabel);
1529 __pSmallPhotoLabel = null;
1531 //Draw Small Photo and show on small photo label
1532 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1533 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1534 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1535 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1536 // Add a Label to the Form
1537 AddControl(*__pSmallPhotoLabel);
1538 __pSmallPhotoLabel->Invalidate(true);
1542 ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long long startTime)
1544 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1546 if (__pActiveCallTimer == null)
1548 __pActiveCallTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
1549 __pActiveCallTimer->Construct(*this);
1552 if (pTimerLbl != null)
1554 if (isOnHold == true)
1556 pTimerLbl->SetText(AppUtility::GetResourceString(IDS_TIMER_ON_HOLD));
1557 //update Hold button status
1558 SetHoldButtonStatus(false);
1562 //update Hold button status
1563 SetHoldButtonStatus(true);
1564 //current system time
1565 long long currTime = 0;
1566 SystemTime::GetTicks(currTime);
1568 TimeSpan diffSpan(abs(startTime - currTime));
1570 String activeCallTime(L"");
1572 long long hr = diffSpan.GetHours();
1575 activeCallTime.Append("0");
1577 activeCallTime.Append(hr);
1578 activeCallTime.Append(L":");
1580 long long min = diffSpan.GetMinutes();
1583 activeCallTime.Append("0");
1585 activeCallTime.Append(min);
1586 activeCallTime.Append(L":");
1588 long long sec = diffSpan.GetSeconds();
1591 activeCallTime.Append("0");
1593 activeCallTime.Append(sec);
1595 pTimerLbl->SetText(activeCallTime);
1596 __pActiveCallTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
1598 pTimerLbl->Invalidate(true);
1603 ActiveCallForm::SetShowStateOnKeypad(bool showState)
1605 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1606 pLblControl->SetShowState(showState);
1607 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL));
1608 pLblControl->SetShowState(showState);
1609 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1610 pLblControl->SetShowState(showState);
1611 if (__pSmallPhotoLabel != null)
1613 __pSmallPhotoLabel->SetShowState(showState);
1618 case FORMTYPE_ACTIVECALL:
1620 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1621 pLblControl->SetShowState(showState);
1622 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1623 pLblControl->SetShowState(showState);
1624 pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1625 pLblControl->SetShowState(showState);
1626 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1627 pButtonControl->SetShowState(showState);
1631 case FORMTYPE_MULTIPLECALLS:
1633 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1634 pLblControl->SetShowState(showState);
1635 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1636 pLblControl->SetShowState(showState);
1637 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1638 pLblControl->SetShowState(showState);
1639 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1640 pLblControl->SetShowState(showState);
1641 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1642 pLblControl->SetShowState(showState);
1643 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1644 pLblControl->SetShowState(showState);
1645 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == false)
1647 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1648 pLblControl->SetShowState(showState);
1652 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1653 pButtonControl->SetShowState(showState);
1655 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1656 pButtonControl->SetShowState(showState);
1660 case FORMTYPE_ACTIVECONFCALL:
1662 pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1663 pLblControl->SetShowState(showState);
1664 pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1665 pLblControl->SetShowState(showState);
1666 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1667 pButtonControl->SetShowState(showState);
1668 pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1669 pButtonControl->SetShowState(showState);
1679 ActiveCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1681 //Call default implementation of "Object.Equals()"
1682 //returns true, if they are pointing to same address.
1683 if (__pActiveCallTimer->Equals(timer))
1685 Label* pTimerLbl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1688 String activeCallTime = pTimerLbl->GetText();
1689 // Create a StringTokenizer instance
1690 StringTokenizer strTokens(activeCallTime, L":");
1692 int count = strTokens.GetTokenCount(); // count == 3
1697 for (int index = 0; index < count; index++)
1702 strTokens.GetNextToken(token);
1703 Integer::Parse(token, hr);
1707 strTokens.GetNextToken(token);
1708 Integer::Parse(token, min);
1712 strTokens.GetNextToken(token);
1713 Integer::Parse(token, sec);
1719 if (sec == IDI_MAX_SECONDS)
1724 if (min == IDI_MAX_MINS)
1731 activeCallTime.Clear();
1734 activeCallTime.Append("0");
1736 activeCallTime.Append(hr);
1737 activeCallTime.Append(":");
1740 activeCallTime.Append("0");
1742 activeCallTime.Append(min);
1743 activeCallTime.Append(":");
1746 activeCallTime.Append("0");
1748 activeCallTime.Append(sec);
1749 //update timer label
1750 pTimerLbl->SetText(activeCallTime);
1751 pTimerLbl->Invalidate(true);
1756 ///////////////////////////////////////////////////////////
1757 /////////// Options Menu List Functionality /////////
1758 ///////////////////////////////////////////////////////////
1760 ActiveCallForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
1765 ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
1767 //Goto conference call list form
1768 SceneManager* pSceneManager = SceneManager::GetInstance();
1769 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST), null);
1773 ActiveCallForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
1778 ActiveCallForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
1783 ActiveCallForm::GetItemCount(void)
1785 return IDI_MOREOPTIONS_LIST_ITEMS;
1789 ActiveCallForm::CreateItem(int index, int itemWidth)
1791 //create 1st Menu option
1792 CustomItem* pItem = new (std::nothrow) CustomItem();
1793 pItem->Construct(IDI_OPTIONMENU_DIMEN, LIST_ANNEX_STYLE_NORMAL);
1795 //Set background 9-patch bitmap to option menu
1796 Bitmap* pBgBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_BG_ICON);
1797 if (pBgBmp != null && pBgBmp->IsNinePatchedBitmap())
1800 bgCanvas.Construct(Rectangle(IDI_OPTIONMENU_POS, IDI_OPTIONMENU_DIMEN));
1801 bgCanvas.DrawNinePatchedBitmap(bgCanvas.GetBounds(), *pBgBmp);
1805 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color(40, 45, 48));
1810 //Set bitmap to option menu
1811 Bitmap* pNormalConfCallBmp = AppUtility::GetBitmapFromResourcesN(IDB_MORE_MANAGE_CONFERENCE_ICON ,
1812 W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP);
1813 pItem->AddElement(Rectangle(16, 17, W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP), 1, *pNormalConfCallBmp, null, null);
1814 // Deallocate bitmaps
1815 delete pNormalConfCallBmp;
1816 pNormalConfCallBmp = null;
1818 //Set text to menu option
1819 String confCallName = AppUtility::GetResourceString(IDS_MGR_CONF_CALL_LIST_STR);
1821 TextElement* pTextElement = new (std::nothrow) TextElement();
1822 pTextElement->Construct(confCallName);
1823 pTextElement->SetTextColor(COLOR_POPUP_TEXT);
1826 font.Construct(FONT_STYLE_PLAIN, IDI_POPUP_TEXT_SIZE);
1827 pTextElement->SetFont(font);
1828 //construct Enriched text
1829 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1830 FloatDimension textDimension;
1831 font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
1832 textDimension.height = textDimension.height + font.GetDescender();
1833 pEnrichedText->Construct(textDimension);
1834 //add text element to enriched text
1835 pEnrichedText->Add(*pTextElement);
1837 //Add Enriched text to pItem
1838 FloatPoint textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
1839 pItem->AddElement(FloatRectangle(textPos, textDimension), 2, *pEnrichedText);
1841 pEnrichedText->RemoveAll(true);
1842 delete pEnrichedText;
1847 ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
1854 ActiveCallForm::OnForeground(void)
1856 __pCallPresentor->OnAppForeground();