2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (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;
112 __isSwapInProgress = false;
113 __pAddressbook = null;
116 ActiveCallForm::~ActiveCallForm(void)
118 if (__pActiveCallTimer != null)
120 __pActiveCallTimer->Cancel();
121 delete __pActiveCallTimer;
123 if (__pMoreOptionsList != null)
125 __pMoreOptionsList = null;
127 if (__pMoreOptionsListAnchor != null)
129 __pMoreOptionsListAnchor = null;
131 if (__pSmallPhotoLabel != null)
133 __pSmallPhotoLabel = null;
135 if (__pActiveCallInfo != null)
137 delete __pActiveCallInfo;
139 if (__pHeldCallInfo != null)
141 delete __pHeldCallInfo;
143 if(__pDTMFKeypad != null)
145 __pDTMFKeypad = null;
150 ActiveCallForm::Initialize(void)
154 case FORMTYPE_OUTGOINGCALL:
155 Construct(IDL_OUTCALL_FORM);
158 case FORMTYPE_EMERGENCYOUTGOINGCALL:
159 Construct(IDL_OUT_EMERGENCYCALL_FORM);
162 case FORMTYPE_ACTIVECALL:
163 Construct(IDL_CALL_FORM);
166 case FORMTYPE_EMERGENCYACTIVECALL:
167 Construct(IDL_EMERGENCY_CALL_FORM);
170 case FORMTYPE_MULTIPLECALLS:
171 Construct(IDL_MULTIPLE_CALL_FORM);
174 case FORMTYPE_ACTIVECONFCALL:
175 Construct(IDL_CONFCALL_FORM);
184 ActiveCallForm::OnInitializing(void)
186 result r = E_SUCCESS;
188 //Hold Button - Shown on single active/conf call scene
189 InitializeHoldButton();
190 //Swap button for multiple call screen
191 InitializeSwapButton();
192 //Initialize manage conf. call list form
193 InitializeManageConfCallButton();
195 __pCallPresentor = CallPresentationModel::GetInstance();
200 ActiveCallForm::ShowDTMFKeypad(void)
202 if(__pDTMFKeypad == null)
204 //update rect according to client screen area
205 Rectangle rect(0, 0, 0, 0);
206 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
208 rect.width = GetClientAreaBounds().width;
209 rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight();
211 else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
213 rect.height = GetClientAreaBounds().height;
214 rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth();
217 AppLog("DTMF Keypad rect(%d,%d,%d,%d)",rect.x,rect.y,rect.width,rect.height);
218 __pDTMFKeypad = new (std::nothrow) DtmfKeyPadPanel();
219 __pDTMFKeypad->Initialize(this, rect);
220 AddControl(__pDTMFKeypad);
222 //set layout relation w.r.t call buttons panel
223 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
224 if (pRelativeLayout != null)
226 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
227 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
230 __pDTMFKeypad->SetShowState(true);
231 if(__DtmfString.IsEmpty() == false)
233 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
234 pTextBox->SetText(__DtmfString);
236 __pDTMFKeypad->Draw(true);
237 __pDTMFKeypad->Show();
241 ActiveCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
245 if (__pCallButtonsPanel != null)
247 //update position of call buttons panel
248 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
249 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
251 //bring button on top
252 __pCallButtonsPanel->SetButtonPosition();
254 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
255 if (pRelativeLayout != null)
257 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
260 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
261 if (pRelativeLayout != null)
263 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
264 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
267 //change orientation of DTMF Keypad, if it is visible.
268 if (__pDTMFKeypad != null)
270 if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
272 //in landscape mode, caller info is visible.
273 SetShowStateOnKeypad(true);
274 SetHoldButtonShowState(false);
276 else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
278 //in Portrait mode it is hidden beneath DTMF Keypad.
279 SetShowStateOnKeypad(false);
281 if(__pDTMFKeypad->GetShowState() == true)
283 String dtmfText = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
289 //More option is displayed recreate it
290 if(__pMoreOptionsListAnchor != null)
292 CreateMoreOptionsMenuList();
293 CreateMoreOptionsMenuList();
298 ActiveCallForm::HideDTMFKeypad(void)
300 if(__pDTMFKeypad != null)
302 __DtmfString = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
304 RemoveControl(__pDTMFKeypad);
305 __pDTMFKeypad = null;
310 ActiveCallForm::InitializeCallButtonsPanel(void)
312 result r = E_SUCCESS;
313 //Set background bitmap for call keypad
314 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
315 Bitmap* pBgBitmap = AppUtility::GetBitmapFromResourcesN(IDB_BACKGROUND_BITMAP, pKeysBgLbl->GetWidth(), pKeysBgLbl->GetHeight());
316 if (pBgBitmap != null)
318 pKeysBgLbl->SetBackgroundBitmap(*pBgBitmap);
321 if (__pCallButtonsPanel == null)
323 __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
324 __pCallButtonsPanel->ConstructPanel(this, __formType);
325 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
326 r = AddControl(__pCallButtonsPanel);
329 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
330 if (pRelativeLayout != null)
332 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
334 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
335 if (pRelativeLayout != null)
337 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
338 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
339 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
340 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_TOP_TO_TOP);
347 ActiveCallForm::InitializeSwapButton(void)
349 Button* pSwapBtn = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
352 Bitmap* pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_NORMAL,
353 W_HOLD_BITMAP, H_HOLD_BITMAP);
356 pSwapBtn->SetNormalBitmap(Point(0, 0), *pSwapBmp);
361 pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_PRESS,
362 W_HOLD_BITMAP, H_HOLD_BITMAP);
365 pSwapBtn->SetPressedBitmap(Point(0, 0), *pSwapBmp);
369 pSwapBtn->SetActionId(IDA_SWAP_CALLS);
370 pSwapBtn->AddActionEventListener(*this);
375 ActiveCallForm::InitializeManageConfCallButton(void)
377 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
378 if (pMoreBtn != null)
380 pMoreBtn->SetActionId(IDA_MORE_OPTIONS_MENU);
381 pMoreBtn->AddActionEventListener(*this);
382 if (__formType == FORMTYPE_MULTIPLECALLS)
384 //Correct state will be set in OnSceneActivated based on the call
385 pMoreBtn->SetShowState(false);
387 else if (__formType == FORMTYPE_ACTIVECONFCALL)
389 pMoreBtn->SetShowState(true);
395 ActiveCallForm::InitializeHoldButton(void)
397 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
398 if (pHoldBtn != null)
400 //set status of Hold Button
401 SetHoldButtonStatus(true);
402 pHoldBtn->AddActionEventListener(*this);
407 ActiveCallForm::SetHoldButtonStatus(bool toHoldCall)
409 //background bitmap & button name
411 Bitmap* normalImg = null;
412 Bitmap* pressImg = null;
415 btnName.Append(AppUtility::GetResourceString(IDS_HOLD_BTN_NAME));
416 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_NORMAL_BUTTON_ICON,
417 W_HOLD_BITMAP, H_HOLD_BITMAP);
418 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_PRESS_BUTTON_ICON,
419 W_HOLD_BITMAP, H_HOLD_BITMAP);
423 btnName.Append(AppUtility::GetResourceString(IDS_UNHOLD_BTN_NAME));
424 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_NORMAL_BUTTON_ICON,
425 W_HOLD_BITMAP, H_HOLD_BITMAP);
426 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_PRESS_BUTTON_ICON,
427 W_HOLD_BITMAP, H_HOLD_BITMAP);
431 CommandIds cmdId = IDA_HOLD_CALL;
434 case FORMTYPE_ACTIVECALL:
436 cmdId = toHoldCall ? IDA_HOLD_CALL : IDA_UNHOLD_CALL;
440 case FORMTYPE_ACTIVECONFCALL:
442 cmdId = toHoldCall ? IDA_HOLD_CONF_CALL : IDA_UNHOLD_CONF_CALL;
450 //set background bitmap, button name & action id
451 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
452 Label* pHoldLbl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
455 pHoldBtn->SetActionId(cmdId);
456 pHoldBtn->SetNormalBitmap(Point(0, 0),*normalImg);
457 pHoldBtn->SetPressedBitmap(Point(0, 0),*pressImg);
461 pHoldLbl->SetText(btnName);
462 pHoldLbl->Invalidate(true);
473 ActiveCallForm::CreateMoreOptionsMenuList(void)
475 //create option list anchor
476 if (__pMoreOptionsListAnchor == null)
478 Bitmap* pBgPopupArwBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_ARROW_ICON, W_OPTION_ANCHOR,
480 __pMoreOptionsListAnchor = new (std::nothrow) Label();
481 __pMoreOptionsListAnchor->Construct(Rectangle(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_ICON, Y_POPUP_ANCHOR, W_POPUP_ANCHOR, H_POPUP_ANCHOR), L"");
482 __pMoreOptionsListAnchor->SetBackgroundBitmap(*pBgPopupArwBmp);
484 delete pBgPopupArwBmp;
485 pBgPopupArwBmp = null;
487 // Adds a Label to the Form
488 AddControl(__pMoreOptionsListAnchor);
491 //create options menu list
492 if (__pMoreOptionsList == null)
494 __pMoreOptionsList = new (std::nothrow) ListView();
495 __pMoreOptionsList->Construct(Rectangle(Point(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_LABEL,H_MORE_LABEL), IDI_OPTIONMENU_DIMEN), false, SCROLL_STYLE_FADE_OUT);
496 __pMoreOptionsList->SetItemProvider(*this);
497 __pMoreOptionsList->AddListViewItemEventListener(*this);
498 //Add option list to the form
499 AddControl(__pMoreOptionsList);
503 //Hide option menu list
504 DestroyMoreOptionsMenuList();
509 ActiveCallForm::DestroyMoreOptionsMenuList(void)
511 if (__pMoreOptionsListAnchor != null)
513 //removes and delete the child control
514 RemoveControl(__pMoreOptionsListAnchor);
515 __pMoreOptionsListAnchor = null;
518 if (__pMoreOptionsList != null)
520 //removes and delete the child control
521 RemoveControl(__pMoreOptionsList);
522 __pMoreOptionsList = null;
527 ActiveCallForm::OnTerminating(void)
529 result r = E_SUCCESS;
530 if (__pCallPresentor != null)
532 __pCallPresentor = null;
538 ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
546 //End the currently active / dialing call
547 if (__pActiveCallInfo->IsConferenceCall() == false)
549 String activeContactNo;
550 activeContactNo.Append(__pActiveCallInfo->GetContactNumber());
551 //Check if it is call is in dialing state, then
552 if (__formType == FORMTYPE_EMERGENCYOUTGOINGCALL || __formType == FORMTYPE_OUTGOINGCALL)
554 __pCallPresentor->EndDialingCall(activeContactNo);
559 __pCallPresentor->EndActiveCall(*__pActiveCallInfo->GetCallHandle());
564 __pCallPresentor->EndConferenceCall();
569 case IDA_END_CONF_CALL:
571 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
572 __pCallPresentor->EndConferenceCall();
576 case IDA_OPEN_NUMKEYPAD:
578 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
580 //hide only in portrait mode.
581 SetShowStateOnKeypad(false);
583 //Hide the hold button as it goes behind DTMF keypad
584 SetHoldButtonShowState(false);
586 __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
590 case IDA_CLOSE_NUMKEYPAD:
592 SetShowStateOnKeypad(true);
594 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
600 //switch to Dialer Form to make an call
601 if(__pCallPresentor->GetCurrentCallCount() == 1)
603 __pCallPresentor->LaunchDialAppControl();
611 if (__pActiveCallInfo->IsConferenceCall() == false)
613 if(__pActiveCallInfo->GetCallHandle() != null)
615 success = __pCallPresentor->HoldCall(*__pActiveCallInfo->GetCallHandle());
620 success = __pCallPresentor->HoldConferenceCall();
622 //reset hold status and "OnHold" text
623 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
624 if(__pActiveCallTimer != null)
626 __pActiveCallTimer->Cancel();
628 SetHoldButtonStatus(!success);
632 case IDA_UNHOLD_CALL:
634 bool success = false;
635 if (__pActiveCallInfo->IsConferenceCall() == false)
637 if(__pActiveCallInfo->GetCallHandle() != null)
639 success = __pCallPresentor->UnHoldCall(*__pActiveCallInfo->GetCallHandle());
644 success = __pCallPresentor->ActivateConferenceCall();
646 //reset hold status and show call timer
647 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
648 SetHoldButtonStatus(success);
652 case IDA_HOLD_CONF_CALL:
654 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
655 bool success = __pCallPresentor->HoldConferenceCall();
656 //reset hold status and "OnHold" text
657 SetHoldButtonStatus(!success);
658 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
659 if(__pActiveCallTimer != null)
661 __pActiveCallTimer->Cancel();
666 case IDA_UNHOLD_CONF_CALL:
668 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
669 bool success = __pCallPresentor->ActivateConferenceCall();
670 //reset hold status and show call timer
671 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
672 SetHoldButtonStatus(success);
676 case IDA_OPEN_CONTACTS:
679 //Launch call application
680 AppManager* pAppManager = AppManager::GetInstance();
681 pAppManager->LaunchApplication(PROVIDER_ID_CONTACTS);
687 bool success = __pCallPresentor->SetMuteStatus(true);
690 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
697 bool success = __pCallPresentor->SetMuteStatus(false);
700 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
707 bool success = __pCallPresentor->SetSpeakerStatus(true);
710 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
715 case IDA_SPEAKER_OFF:
717 bool success = __pCallPresentor->SetSpeakerStatus(false);
720 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
727 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
728 __pCallPresentor->JoinCall();
734 if(IsSwapInProgress() == false)
736 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
737 __pCallPresentor->SwapCalls();
738 SetSwapInProgress(true);
743 case IDA_MORE_OPTIONS_MENU:
745 //Show 'more' options menu
746 CreateMoreOptionsMenuList();
752 dtmfString.Append(L"0");
753 SetTextToDTMFTextField(dtmfString);
754 __pCallPresentor->SendDTMFSignal(dtmfString);
760 dtmfString.Append(L"1");
761 SetTextToDTMFTextField(dtmfString);
762 __pCallPresentor->SendDTMFSignal(dtmfString);
768 dtmfString.Append(L"2");
769 SetTextToDTMFTextField(dtmfString);
770 __pCallPresentor->SendDTMFSignal(dtmfString);
776 dtmfString.Append(L"3");
777 SetTextToDTMFTextField(dtmfString);
778 __pCallPresentor->SendDTMFSignal(dtmfString);
784 dtmfString.Append(L"4");
785 SetTextToDTMFTextField(dtmfString);
786 __pCallPresentor->SendDTMFSignal(dtmfString);
792 dtmfString.Append(L"5");
793 SetTextToDTMFTextField(dtmfString);
794 __pCallPresentor->SendDTMFSignal(dtmfString);
800 dtmfString.Append(L"6");
801 SetTextToDTMFTextField(dtmfString);
802 __pCallPresentor->SendDTMFSignal(dtmfString);
808 dtmfString.Append(L"7");
809 SetTextToDTMFTextField(dtmfString);
810 __pCallPresentor->SendDTMFSignal(dtmfString);
816 dtmfString.Append(L"8");
817 SetTextToDTMFTextField(dtmfString);
818 __pCallPresentor->SendDTMFSignal(dtmfString);
824 dtmfString.Append(L"9");
825 SetTextToDTMFTextField(dtmfString);
826 __pCallPresentor->SendDTMFSignal(dtmfString);
832 dtmfString.Append(L"*");
833 SetTextToDTMFTextField(dtmfString);
834 __pCallPresentor->SendDTMFSignal(dtmfString);
840 dtmfString.Append(L"#");
841 SetTextToDTMFTextField(dtmfString);
842 __pCallPresentor->SendDTMFSignal(dtmfString);
852 ActiveCallForm::IsSwapInProgress(void)
854 return __isSwapInProgress;
858 ActiveCallForm::SetSwapInProgress(bool progress)
860 __isSwapInProgress = progress;
864 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
866 if(__pDTMFKeypad != null)
868 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
870 int startpos=-1,endpos=-1;
871 pTextBox->GetBlockRange(startpos,endpos);
875 pTextBox->ReleaseBlock();
878 pTextBox->InsertTextAtCursorPosition(dtmfStr);
879 //pTextBox->AppendText(dtmfStr);
880 pTextBox->SetFocus();
881 pTextBox->Invalidate(true);
886 ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
889 //set itself as listener
890 __pCallPresentor->SetTelEventListener(this);
891 AddOrientationEventListener(*this);
893 CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
894 pPhoneApp->AddAppStateChangeListener(*this);
896 //Initialize keypad and buttons
897 InitializeCallButtonsPanel();
899 AddressbookManager* pAddressbookManager = AddressbookManager::GetInstance();
900 __pAddressbook = pAddressbookManager->GetAddressbookN(DEFAULT_ADDRESSBOOK_ID);
901 if(__pAddressbook != null)
903 __pAddressbook->SetAddressbookChangeEventListener(this);
907 if (__pActiveCallInfo != null)
909 delete __pActiveCallInfo;
910 __pActiveCallInfo = null;
912 if (__pHeldCallInfo != null)
914 delete __pHeldCallInfo;
915 __pHeldCallInfo = null;
917 DestroyMoreOptionsMenuList();
921 case FORMTYPE_OUTGOINGCALL:
924 contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
925 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
926 __pActiveCallInfo->SetContactNumber(contactNo);
927 Contact* pContact = __pCallPresentor->GetContactN(contactNo);
928 if (pContact != null)
930 __pActiveCallInfo->SetContactInfo(*pContact);
933 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
934 //make an normal outgoing call
935 __pCallPresentor->DialCall(contactNo, false);
939 case FORMTYPE_EMERGENCYOUTGOINGCALL:
941 String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
942 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
943 long long phNumber = 0;
944 LongLong::Parse(*pContactNo, phNumber);
945 __pActiveCallInfo->SetContactNumber(*pContactNo);
946 //make an emergency call
947 __pCallPresentor->DialCall(*pContactNo, true);
951 case FORMTYPE_ACTIVECALL:
954 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
956 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
957 *__pActiveCallInfo = *pCall;
958 String activeContactNo;
959 if(pCall->GetContactNumber().IsEmpty() == false)
961 activeContactNo.Append(pCall->GetContactNumber());
965 activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
967 ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
969 //show call active time using Timer
970 __activeCallStartTime = pCall->GetCallConnectTime();
971 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
975 case FORMTYPE_EMERGENCYACTIVECALL:
978 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
980 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
981 *__pActiveCallInfo = *pCall;
983 //show call active time using Timer
984 __activeCallStartTime = pCall->GetCallConnectTime();
985 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
989 case FORMTYPE_MULTIPLECALLS:
991 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
993 UpdateMultipleCallScreen(*pCallsList);
999 case FORMTYPE_ACTIVECONFCALL:
1002 AppCallInfo* pConfInfo = static_cast<AppCallInfo*>(pArgs->GetAt(0));
1003 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1004 *__pActiveCallInfo = *pConfInfo;
1006 int participantsCount = __pActiveCallInfo->GetCallerListCount();
1008 // show participant count on name Label
1009 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1010 if (pPeopleCountLbl)
1013 count.Append(participantsCount);
1015 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1016 pPeopleCountLbl->SetText(count);
1019 if(participantsCount >= IDI_MAX_CONF_CALL_PARTICIPANTS)
1021 __pCallButtonsPanel->EnableAddCallButton(false);
1025 __pCallButtonsPanel->EnableAddCallButton(true);
1028 //show call active time using Timer
1029 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1030 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime);
1038 if(__formType == FORMTYPE_ACTIVECALL || __formType == FORMTYPE_EMERGENCYACTIVECALL ||
1039 __formType == FORMTYPE_MULTIPLECALLS || __formType == FORMTYPE_ACTIVECONFCALL)
1041 //Unlock the phone if its locked
1042 if(LockManager::GetInstance()->IsLocked())
1044 AppLogDebug("Phone Locked");
1045 LockManager::GetInstance()->Unlock();
1049 //Hide DTMFKeypad, if visible and show caller info
1051 SetShowStateOnKeypad(true);
1052 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
1054 //Set the correct speaker status
1055 if(__pCallPresentor->IsSpeakerOn() == true)
1057 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
1061 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
1064 //Set the correct Mute status
1065 if (__pCallPresentor->IsCallMuted() == true)
1067 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
1071 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
1081 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1082 pCallApp->SetTopMostWindow(false);
1086 ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1088 RemoveOrientationEventListener(*this);
1089 if (__pActiveCallTimer != null)
1091 __pActiveCallTimer->Cancel();
1092 delete __pActiveCallTimer;
1093 __pActiveCallTimer = null;
1095 if (__pSmallPhotoLabel != null)
1097 __pSmallPhotoLabel->SetShowState(false);
1099 //Hide "Manage conf. Call" Context menu
1100 if (__pMoreOptionsListAnchor != null)
1102 __pMoreOptionsListAnchor->SetShowState(false);
1104 if (__pMoreOptionsList != null)
1106 __pMoreOptionsList->SetShowState(false);
1108 __DtmfString.Clear();
1109 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1110 pCallApp->RemoveAppStateChangeListener(*this);
1111 if(__pAddressbook != null)
1113 __pAddressbook->SetAddressbookChangeEventListener(null);
1118 ActiveCallForm::HandleConfCallChanged(void)
1121 AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
1122 //fetch changed conference call info
1123 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1124 if (pConfCallInfo == null)
1130 //fetch participant count in conf call
1131 int participantsCount = pConfCallInfo->GetCallerListCount();
1132 //update status of join and Add call
1133 bool isEnableAddCall = false;
1134 bool isEnableJoinCall = false;
1135 if(participantsCount < IDI_MAX_CONF_CALL_PARTICIPANTS)
1137 //available only at Active conf. call or active call screen
1138 isEnableAddCall = true;
1139 //join button is available only at multiple call screen
1140 isEnableJoinCall = true;
1143 Label* pPeopleCountLbl = null;
1144 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == true)
1146 //Active call is conference call
1147 delete __pActiveCallInfo;
1148 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1149 *__pActiveCallInfo = *pConfCallInfo;
1151 if (__formType == FORMTYPE_MULTIPLECALLS)
1153 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1155 else if (__formType == FORMTYPE_ACTIVECONFCALL)
1157 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1158 AppLog("Active conf call...(%d)", pPeopleCountLbl);
1161 else if(__pHeldCallInfo != null && __pHeldCallInfo->IsConferenceCall() == true)
1163 //Held call is conference call - this is definitely multiple call screen.
1164 delete __pHeldCallInfo;
1165 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1166 *__pHeldCallInfo = *pConfCallInfo;
1167 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1170 // update participant count on name Label
1171 if (pPeopleCountLbl != null)
1174 count.Append(participantsCount);
1176 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1177 pPeopleCountLbl->SetText(count);
1178 pPeopleCountLbl->Invalidate(true);
1180 //change AddCall Button status
1181 __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
1182 //change JoinCall Button status
1183 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1188 ActiveCallForm::OnContactsChanged(const Tizen::Base::Collection::IList& contactChangeInfoList)
1194 case FORMTYPE_OUTGOINGCALL:
1195 case FORMTYPE_ACTIVECALL:
1197 String pContactNumber;
1198 pContactNumber.Append(__pActiveCallInfo->GetContactNumber());
1199 Contact* pContact = __pCallPresentor->GetContactN(__pActiveCallInfo->GetContactNumber());
1200 if(pContact == null)
1202 __pActiveCallInfo->ResetContactNumber(null);
1203 __pActiveCallInfo->ResetContactInfo(null);
1208 __pActiveCallInfo->SetContactNumber(pContactNumber);
1209 __pActiveCallInfo->SetContactInfo(*pContact);
1211 if(pContact != null)
1216 ShowPersonDetails(pContactNumber, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1220 case FORMTYPE_EMERGENCYACTIVECALL:
1225 case FORMTYPE_MULTIPLECALLS:
1228 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
1229 if(pCallsList != null)
1231 int listCount = pCallsList->GetCount();
1232 for(int index = 0; index < listCount; index++)
1234 AppCallInfo callInfo;
1236 pCallsList->GetAt(index, callInfo);
1237 if(__pActiveCallInfo == null)
1239 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1241 *__pActiveCallInfo = callInfo;
1242 String contactNumber;
1243 contactNumber.Append(__pActiveCallInfo->GetContactNumber());
1244 pContact = __pCallPresentor->GetContactN(__pActiveCallInfo->GetContactNumber());
1245 if(pContact == null)
1247 __pActiveCallInfo->ResetContactNumber(null);
1248 __pActiveCallInfo->ResetContactInfo(null);
1253 __pActiveCallInfo->SetContactNumber(contactNumber);
1254 __pActiveCallInfo->SetContactInfo(*pContact);
1256 if(pContact != null)
1261 if(callInfo.IsOnHold() == false)
1263 ShowPersonDetails(contactNumber, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1267 ShowPersonDetails(contactNumber, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pActiveCallInfo);
1284 ActiveCallForm::OnCategoriesChanged(const Tizen::Base::Collection::IList& categoryChangeInfoList)
1291 ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
1294 if(__pActiveCallInfo != null)
1296 delete __pActiveCallInfo;
1297 __pActiveCallInfo = null;
1299 if(__pHeldCallInfo != null)
1301 delete __pHeldCallInfo;
1302 __pHeldCallInfo = null;
1305 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1306 if (pMoreBtn != null)
1308 pMoreBtn->SetShowState(false);
1311 //show caller's info.
1312 for (int index = 0; index < activeCallsList.GetCount(); index++)
1315 AppCallInfo callInfo;
1316 activeCallsList.GetAt(index, callInfo);
1319 if(callInfo.GetContactNumber().IsEmpty() == false)
1321 contactNo.Append(callInfo.GetContactNumber());
1325 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1328 if (callInfo.IsOnHold() == false)
1330 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1331 *__pActiveCallInfo = callInfo;
1333 if (__pActiveCallInfo->IsConferenceCall() == false)
1335 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1338 pVoiceIconLbl->SetShowState(true);
1340 if (pMoreBtn != null)
1342 pMoreBtn->SetShowState(false);
1344 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1345 if(__pMoreOptionsListAnchor != null && __pMoreOptionsListAnchor->GetShowState() == true)
1347 CreateMoreOptionsMenuList();
1352 // show participant count on name Label
1353 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1354 if (pPeopleCountLbl)
1357 count.Append(__pActiveCallInfo->GetCallerListCount());
1359 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1360 pPeopleCountLbl->SetText(count);
1362 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1363 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1366 pNameLbl->SetText(nameStr);
1368 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1371 pVoiceIconLbl->SetShowState(false);
1373 if (pMoreBtn != null)
1375 pMoreBtn->SetShowState(true);
1377 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1378 if (pPhotoBitmap != null)
1380 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER1_PHOTO_LABEL));
1383 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1384 pPhotoLbl->Invalidate(true);
1386 delete pPhotoBitmap;
1389 //show call active time using Timer
1390 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1391 ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime);
1395 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1396 *__pHeldCallInfo = callInfo;
1398 if (__pHeldCallInfo->IsConferenceCall() == false)
1400 ShowPersonDetails(contactNo, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pHeldCallInfo);
1404 // show participant count on name Label
1405 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1406 if (pPeopleCountLbl)
1409 count.Append(__pHeldCallInfo->GetCallerListCount());
1411 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1412 pPeopleCountLbl->SetText(count);
1414 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1415 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1418 pNameLbl->SetText(nameStr);
1420 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1421 if (pPhotoBitmap != null)
1423 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER2_PHOTO_LABEL));
1426 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1427 pPhotoLbl->Invalidate(true);
1429 delete pPhotoBitmap;
1433 ShowTimerInfo(IDC_CALLER2_TIME_LABEL, true);
1437 //update JoinCall button status
1438 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1444 ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
1446 result r = E_FAILURE;
1448 //call individual methods to show contact number, caller name & photo
1449 ShowPhoneNumber(phoneNumber, contactLblName);
1451 //fetch contact details based on phone number
1452 String* pDisplayName = pCallInfo->FetchLatestCallerNameN(phoneNumber);
1453 ShowCallerName(*pDisplayName, nameLblName);
1455 Bitmap* pPhotoBitmap = pCallInfo->FetchLatestCallerPhotoN(phoneNumber);
1456 ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
1461 delete pDisplayName;
1462 pDisplayName = null;
1466 delete pPhotoBitmap;
1467 pPhotoBitmap = null;
1472 ActiveCallForm::ShowPhoneNumber(const String& phoneNumber, const String& contactLblName)
1474 String formattedNumber = phoneNumber;
1476 Label* pContactLbl = static_cast<Label*>(GetControl(contactLblName));
1479 pContactLbl->SetText(formattedNumber);
1480 pContactLbl->Invalidate(true);
1485 ActiveCallForm::ShowCallerName(const String& callerName, const String& nameLblName)
1487 // show display name on name Label
1488 Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
1491 //passing an empty string to SetText fails in label,
1492 //if previously valid text has been set
1493 if (callerName.IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
1495 String stringToBeSet(L" ");
1496 pNameLbl->SetText(stringToBeSet);
1500 pNameLbl->SetText(callerName);
1502 pNameLbl->Invalidate(true);
1507 ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
1509 //to check if default image is to be shown
1510 bool showDefaultPhoto = false;
1511 bool showSmallPhoto = false;
1512 String photoLabel("");
1516 case FORMTYPE_OUTGOINGCALL:
1517 case FORMTYPE_ACTIVECALL:
1519 if (pPhotoId == null)
1521 //show default caller image
1522 showDefaultPhoto = true;
1526 //Check the size of photo
1527 // Now checking the condition with && but actually it should be ||
1528 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1529 // height 270 and width = 480 . So all images set thru gallery is show as small image
1530 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1531 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1533 showSmallPhoto = true;
1537 photoLabel.Append(IDC_CALLER1_BIGPHOTO_LABEL);
1541 case FORMTYPE_MULTIPLECALLS:
1545 photoLabel.Append(IDC_CALLER2_PHOTO_LABEL);
1549 photoLabel.Append(IDC_CALLER1_PHOTO_LABEL);
1552 if (pPhotoId == null)
1554 showDefaultPhoto = true;
1558 if (pPhotoId->GetHeight() <= H_SMALL_PHOTO
1559 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1561 //pPhotoId->Scale(Dimension(W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO));
1562 showSmallPhoto = true;
1572 //Remove small photo label
1573 if (__pSmallPhotoLabel != null)
1575 RemoveControl(__pSmallPhotoLabel);
1576 __pSmallPhotoLabel = null;
1579 //show photo - for Big Photo Id, Animated Call Image
1580 if (!showDefaultPhoto)
1582 if(showSmallPhoto == true)
1584 ShowThumbnailImage(pPhotoId,photoLabel);
1588 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1591 Canvas* pCanvas = new (std::nothrow) Canvas;
1592 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1593 pCanvas->Construct(canvasRect);
1594 //draw the contact bitmap
1595 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1596 Bitmap* pNewPhotoId = new Bitmap();
1597 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1600 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1601 pPhotoLbl->Invalidate(true);
1608 Bitmap* pDefaultPhoto = null;
1611 case FORMTYPE_OUTGOINGCALL:
1612 case FORMTYPE_ACTIVECALL:
1613 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1616 case FORMTYPE_MULTIPLECALLS:
1617 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_MULTIPLE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1620 case FORMTYPE_ACTIVECONFCALL:
1621 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BIG_BG_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1627 if (pDefaultPhoto != null)
1629 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1632 pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
1633 pPhotoLbl->Invalidate(true);
1635 delete pDefaultPhoto;
1641 ActiveCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,String& photoLabel)
1643 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1645 if (pPhotoLbl != null && pPhotoId != null)
1647 Canvas* pCanvas = new (std::nothrow) Canvas;
1648 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1649 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1650 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1651 pCanvas->Construct(canvasRect);
1652 //draw the back ground
1653 pCanvas->DrawBitmap(canvasRect,*pBackground);
1654 //draw shadow (to be enabled after correct shadow image is provided )
1655 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1656 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1657 //draw the contact bitmap
1658 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1659 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1660 Bitmap* pNewPhotoId = new Bitmap();
1661 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1664 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1665 pPhotoLbl->Invalidate(true);
1674 ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1676 if (__pSmallPhotoLabel != null)
1678 RemoveControl(__pSmallPhotoLabel);
1679 __pSmallPhotoLabel = null;
1681 //Draw Small Photo and show on small photo label
1682 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1683 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1684 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1685 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1686 // Add a Label to the Form
1687 AddControl(__pSmallPhotoLabel);
1688 __pSmallPhotoLabel->Invalidate(true);
1692 ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long long startTime)
1694 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1696 if (__pActiveCallTimer == null)
1698 __pActiveCallTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
1699 __pActiveCallTimer->Construct(*this);
1702 if (pTimerLbl != null)
1704 if (isOnHold == true)
1706 pTimerLbl->SetText(AppUtility::GetResourceString(IDS_TIMER_ON_HOLD));
1707 //update Hold button status
1708 SetHoldButtonStatus(false);
1712 //update Hold button status
1713 SetHoldButtonStatus(true);
1714 //current system time
1715 long long currTime = 0;
1716 SystemTime::GetTicks(currTime);
1718 TimeSpan diffSpan(abs(startTime - currTime));
1720 String activeCallTime(L"");
1722 long long hr = diffSpan.GetHours();
1725 activeCallTime.Append("0");
1727 activeCallTime.Append(hr);
1728 activeCallTime.Append(L":");
1730 long long min = diffSpan.GetMinutes();
1733 activeCallTime.Append("0");
1735 activeCallTime.Append(min);
1736 activeCallTime.Append(L":");
1738 long long sec = diffSpan.GetSeconds();
1741 activeCallTime.Append("0");
1743 activeCallTime.Append(sec);
1745 pTimerLbl->SetText(activeCallTime);
1746 __pActiveCallTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
1748 pTimerLbl->Invalidate(true);
1753 ActiveCallForm::SetHoldButtonShowState(bool showState)
1755 Label* pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1756 if(pLblControl != null)
1758 pLblControl->SetShowState(showState);
1760 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1761 if(pButtonControl != null)
1763 pButtonControl->SetShowState(showState);
1768 ActiveCallForm::SetShowStateOnKeypad(bool showState)
1770 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1771 pLblControl->SetShowState(showState);
1772 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL));
1773 pLblControl->SetShowState(showState);
1774 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1775 pLblControl->SetShowState(showState);
1776 if (__pSmallPhotoLabel != null)
1778 __pSmallPhotoLabel->SetShowState(showState);
1783 case FORMTYPE_ACTIVECALL:
1785 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1786 pLblControl->SetShowState(showState);
1787 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1788 pLblControl->SetShowState(showState);
1789 SetHoldButtonShowState(showState);
1793 case FORMTYPE_MULTIPLECALLS:
1795 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1796 pLblControl->SetShowState(showState);
1797 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1798 pLblControl->SetShowState(showState);
1799 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1800 pLblControl->SetShowState(showState);
1801 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1802 pLblControl->SetShowState(showState);
1803 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1804 pLblControl->SetShowState(showState);
1805 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1806 pLblControl->SetShowState(showState);
1807 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == false)
1809 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1810 pLblControl->SetShowState(showState);
1814 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1815 pButtonControl->SetShowState(showState);
1817 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1818 pButtonControl->SetShowState(showState);
1822 case FORMTYPE_ACTIVECONFCALL:
1824 pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1825 pLblControl->SetShowState(showState);
1826 SetHoldButtonShowState(showState);
1827 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1828 pButtonControl->SetShowState(showState);
1838 ActiveCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1840 //Call default implementation of "Object.Equals()"
1841 //returns true, if they are pointing to same address.
1842 if (__pActiveCallTimer->Equals(timer))
1844 Label* pTimerLbl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1847 String activeCallTime = pTimerLbl->GetText();
1848 // Create a StringTokenizer instance
1849 StringTokenizer strTokens(activeCallTime, L":");
1851 int count = strTokens.GetTokenCount(); // count == 3
1856 for (int index = 0; index < count; index++)
1861 strTokens.GetNextToken(token);
1862 Integer::Parse(token, hr);
1866 strTokens.GetNextToken(token);
1867 Integer::Parse(token, min);
1871 strTokens.GetNextToken(token);
1872 Integer::Parse(token, sec);
1878 if (sec == IDI_MAX_SECONDS)
1883 if (min == IDI_MAX_MINS)
1890 activeCallTime.Clear();
1893 activeCallTime.Append("0");
1895 activeCallTime.Append(hr);
1896 activeCallTime.Append(":");
1899 activeCallTime.Append("0");
1901 activeCallTime.Append(min);
1902 activeCallTime.Append(":");
1905 activeCallTime.Append("0");
1907 activeCallTime.Append(sec);
1908 //update timer label
1909 pTimerLbl->SetText(activeCallTime);
1910 pTimerLbl->Invalidate(true);
1915 ///////////////////////////////////////////////////////////
1916 /////////// Options Menu List Functionality /////////
1917 ///////////////////////////////////////////////////////////
1919 ActiveCallForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
1924 ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
1926 //Goto conference call list form
1927 SceneManager* pSceneManager = SceneManager::GetInstance();
1928 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
1929 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_KEEP), null);
1933 ActiveCallForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
1938 ActiveCallForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
1943 ActiveCallForm::GetItemCount(void)
1945 return IDI_MOREOPTIONS_LIST_ITEMS;
1949 ActiveCallForm::CreateItem(int index, int itemWidth)
1951 //create 1st Menu option
1952 CustomItem* pItem = new (std::nothrow) CustomItem();
1953 pItem->Construct(IDI_OPTIONMENU_DIMEN, LIST_ANNEX_STYLE_NORMAL);
1955 //Set background 9-patch bitmap to option menu
1956 Bitmap* pBgBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_BG_ICON);
1957 if (pBgBmp != null && pBgBmp->IsNinePatchedBitmap())
1960 bgCanvas.Construct(Rectangle(IDI_OPTIONMENU_POS, IDI_OPTIONMENU_DIMEN));
1961 bgCanvas.DrawNinePatchedBitmap(bgCanvas.GetBounds(), *pBgBmp);
1965 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color(40, 45, 48));
1970 //Set bitmap to option menu
1971 Bitmap* pNormalConfCallBmp = AppUtility::GetBitmapFromResourcesN(IDB_MORE_MANAGE_CONFERENCE_ICON ,
1972 W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP);
1973 pItem->AddElement(Rectangle(16, 17, W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP), 1, *pNormalConfCallBmp, null, null);
1974 // Deallocate bitmaps
1975 delete pNormalConfCallBmp;
1976 pNormalConfCallBmp = null;
1978 //Set text to menu option
1979 String confCallName = AppUtility::GetResourceString(IDS_MGR_CONF_CALL_LIST_STR);
1981 TextElement* pTextElement = new (std::nothrow) TextElement();
1982 pTextElement->Construct(confCallName);
1983 pTextElement->SetTextColor(COLOR_POPUP_TEXT);
1986 font.Construct(FONT_STYLE_PLAIN, IDI_POPUP_TEXT_SIZE);
1987 pTextElement->SetFont(font);
1988 //construct Enriched text
1989 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1990 FloatDimension textDimension;
1991 font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
1992 textDimension.height = textDimension.height + font.GetDescender();
1993 pEnrichedText->Construct(textDimension);
1994 //add text element to enriched text
1995 pEnrichedText->Add(*pTextElement);
1997 //Add Enriched text to pItem
1998 FloatPoint textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
1999 pItem->AddElement(FloatRectangle(textPos, textDimension), 2, *pEnrichedText);
2001 pEnrichedText->RemoveAll(true);
2002 delete pEnrichedText;
2007 ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
2014 ActiveCallForm::OnForeground(void)
2016 AppLogDebug("Enter");
2017 __pCallPresentor->OnAppForeground();