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);
280 DestroyMoreOptionsMenuList();
282 if(__pDTMFKeypad->GetShowState() == true)
284 String dtmfText = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
290 //More option is displayed recreate it
291 if(__pMoreOptionsListAnchor != null)
293 CreateMoreOptionsMenuList();
294 CreateMoreOptionsMenuList();
299 ActiveCallForm::HideDTMFKeypad(void)
301 if(__pDTMFKeypad != null)
303 __DtmfString = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
305 RemoveControl(__pDTMFKeypad);
306 __pDTMFKeypad = null;
311 ActiveCallForm::InitializeCallButtonsPanel(void)
313 result r = E_SUCCESS;
314 //Set background bitmap for call keypad
315 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
316 Bitmap* pBgBitmap = AppUtility::GetBitmapFromResourcesN(IDB_BACKGROUND_BITMAP, pKeysBgLbl->GetWidth(), pKeysBgLbl->GetHeight());
317 if (pBgBitmap != null)
319 pKeysBgLbl->SetBackgroundBitmap(*pBgBitmap);
322 if (__pCallButtonsPanel == null)
324 __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
325 __pCallButtonsPanel->ConstructPanel(this, __formType);
326 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
327 r = AddControl(__pCallButtonsPanel);
330 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
331 if (pRelativeLayout != null)
333 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
335 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
336 if (pRelativeLayout != null)
338 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
339 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
340 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
341 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_TOP_TO_TOP);
348 ActiveCallForm::InitializeSwapButton(void)
350 Button* pSwapBtn = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
353 Bitmap* pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_NORMAL,
354 W_HOLD_BITMAP, H_HOLD_BITMAP);
357 pSwapBtn->SetNormalBitmap(Point(0, 0), *pSwapBmp);
362 pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_PRESS,
363 W_HOLD_BITMAP, H_HOLD_BITMAP);
366 pSwapBtn->SetPressedBitmap(Point(0, 0), *pSwapBmp);
370 pSwapBtn->SetActionId(IDA_SWAP_CALLS);
371 pSwapBtn->AddActionEventListener(*this);
376 ActiveCallForm::InitializeManageConfCallButton(void)
378 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
379 if (pMoreBtn != null)
381 pMoreBtn->SetActionId(IDA_MORE_OPTIONS_MENU);
382 pMoreBtn->AddActionEventListener(*this);
383 if (__formType == FORMTYPE_MULTIPLECALLS)
385 //Correct state will be set in OnSceneActivated based on the call
386 pMoreBtn->SetShowState(false);
388 else if (__formType == FORMTYPE_ACTIVECONFCALL)
390 pMoreBtn->SetShowState(true);
396 ActiveCallForm::InitializeHoldButton(void)
398 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
399 if (pHoldBtn != null)
401 //set status of Hold Button
402 SetHoldButtonStatus(true);
403 pHoldBtn->AddActionEventListener(*this);
408 ActiveCallForm::SetHoldButtonStatus(bool toHoldCall)
410 //background bitmap & button name
412 Bitmap* normalImg = null;
413 Bitmap* pressImg = null;
416 btnName.Append(AppUtility::GetResourceString(IDS_HOLD_BTN_NAME));
417 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_NORMAL_BUTTON_ICON,
418 W_HOLD_BITMAP, H_HOLD_BITMAP);
419 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_PRESS_BUTTON_ICON,
420 W_HOLD_BITMAP, H_HOLD_BITMAP);
424 btnName.Append(AppUtility::GetResourceString(IDS_UNHOLD_BTN_NAME));
425 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_NORMAL_BUTTON_ICON,
426 W_HOLD_BITMAP, H_HOLD_BITMAP);
427 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_PRESS_BUTTON_ICON,
428 W_HOLD_BITMAP, H_HOLD_BITMAP);
432 CommandIds cmdId = IDA_HOLD_CALL;
435 case FORMTYPE_ACTIVECALL:
437 cmdId = toHoldCall ? IDA_HOLD_CALL : IDA_UNHOLD_CALL;
441 case FORMTYPE_ACTIVECONFCALL:
443 cmdId = toHoldCall ? IDA_HOLD_CONF_CALL : IDA_UNHOLD_CONF_CALL;
451 //set background bitmap, button name & action id
452 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
453 Label* pHoldLbl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
456 pHoldBtn->SetActionId(cmdId);
457 pHoldBtn->SetNormalBitmap(Point(0, 0),*normalImg);
458 pHoldBtn->SetPressedBitmap(Point(0, 0),*pressImg);
459 pHoldBtn->Invalidate(true);
463 pHoldLbl->SetText(btnName);
464 pHoldLbl->Invalidate(true);
475 ActiveCallForm::CreateMoreOptionsMenuList(void)
477 //create option list anchor
478 if (__pMoreOptionsListAnchor == null)
480 Bitmap* pBgPopupArwBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_ARROW_ICON, W_OPTION_ANCHOR,
482 __pMoreOptionsListAnchor = new (std::nothrow) Label();
483 __pMoreOptionsListAnchor->Construct(Rectangle(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_ICON, Y_POPUP_ANCHOR, W_POPUP_ANCHOR, H_POPUP_ANCHOR), L"");
484 __pMoreOptionsListAnchor->SetBackgroundBitmap(*pBgPopupArwBmp);
486 delete pBgPopupArwBmp;
487 pBgPopupArwBmp = null;
489 // Adds a Label to the Form
490 AddControl(__pMoreOptionsListAnchor);
493 //create options menu list
494 if (__pMoreOptionsList == null)
496 __pMoreOptionsList = new (std::nothrow) ListView();
497 __pMoreOptionsList->Construct(Rectangle(Point(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_LABEL,H_MORE_LABEL), IDI_OPTIONMENU_DIMEN), false, SCROLL_STYLE_FADE_OUT);
498 __pMoreOptionsList->SetItemProvider(*this);
499 __pMoreOptionsList->AddListViewItemEventListener(*this);
500 //Add option list to the form
501 AddControl(__pMoreOptionsList);
505 //Hide option menu list
506 DestroyMoreOptionsMenuList();
511 ActiveCallForm::DestroyMoreOptionsMenuList(void)
513 if (__pMoreOptionsListAnchor != null)
515 //removes and delete the child control
516 RemoveControl(__pMoreOptionsListAnchor);
517 __pMoreOptionsListAnchor = null;
520 if (__pMoreOptionsList != null)
522 //removes and delete the child control
523 RemoveControl(__pMoreOptionsList);
524 __pMoreOptionsList = null;
529 ActiveCallForm::OnTerminating(void)
531 result r = E_SUCCESS;
532 if (__pCallPresentor != null)
534 __pCallPresentor = null;
540 ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
548 //End the currently active / dialing call
549 if (__pActiveCallInfo->IsConferenceCall() == false)
551 String activeContactNo;
552 activeContactNo.Append(__pActiveCallInfo->GetContactNumber());
553 //Check if it is call is in dialing state, then
554 if (__formType == FORMTYPE_EMERGENCYOUTGOINGCALL || __formType == FORMTYPE_OUTGOINGCALL)
556 __pCallPresentor->EndDialingCall(activeContactNo);
561 __pCallPresentor->EndActiveCall(*__pActiveCallInfo->GetCallHandle());
566 __pCallPresentor->EndConferenceCall();
571 case IDA_END_CONF_CALL:
573 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
574 __pCallPresentor->EndConferenceCall();
578 case IDA_OPEN_NUMKEYPAD:
580 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
582 //hide only in portrait mode.
583 SetShowStateOnKeypad(false);
584 DestroyMoreOptionsMenuList();
586 //Hide the hold button as it goes behind DTMF keypad
587 SetHoldButtonShowState(false);
589 __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
593 case IDA_CLOSE_NUMKEYPAD:
595 SetShowStateOnKeypad(true);
597 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
603 //switch to Dialer Form to make an call
604 if(__pCallPresentor->GetCurrentCallCount() == 1)
606 __pCallPresentor->LaunchDialAppControl();
614 if (__pActiveCallInfo->IsConferenceCall() == false)
616 if(__pActiveCallInfo->GetCallHandle() != null)
618 success = __pCallPresentor->HoldCall(*__pActiveCallInfo->GetCallHandle());
623 success = __pCallPresentor->HoldConferenceCall();
625 //reset hold status and "OnHold" text
626 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
627 if(__pActiveCallTimer != null)
629 __pActiveCallTimer->Cancel();
631 SetHoldButtonStatus(!success);
635 case IDA_UNHOLD_CALL:
637 bool success = false;
638 if (__pActiveCallInfo->IsConferenceCall() == false)
640 if(__pActiveCallInfo->GetCallHandle() != null)
642 success = __pCallPresentor->UnHoldCall(*__pActiveCallInfo->GetCallHandle());
647 success = __pCallPresentor->ActivateConferenceCall();
649 //reset hold status and show call timer
650 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
651 SetHoldButtonStatus(success);
655 case IDA_HOLD_CONF_CALL:
657 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
658 bool success = __pCallPresentor->HoldConferenceCall();
659 //reset hold status and "OnHold" text
660 SetHoldButtonStatus(!success);
661 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
662 if(__pActiveCallTimer != null)
664 __pActiveCallTimer->Cancel();
669 case IDA_UNHOLD_CONF_CALL:
671 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
672 bool success = __pCallPresentor->ActivateConferenceCall();
673 //reset hold status and show call timer
674 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
675 SetHoldButtonStatus(success);
679 case IDA_OPEN_CONTACTS:
682 //Launch call application
683 AppManager* pAppManager = AppManager::GetInstance();
684 pAppManager->LaunchApplication(PROVIDER_ID_CONTACTS);
690 bool success = __pCallPresentor->SetMuteStatus(true);
693 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
700 bool success = __pCallPresentor->SetMuteStatus(false);
703 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
710 bool success = __pCallPresentor->SetSpeakerStatus(true);
713 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
718 case IDA_SPEAKER_OFF:
720 bool success = __pCallPresentor->SetSpeakerStatus(false);
723 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
730 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
731 __pCallPresentor->JoinCall();
737 if(IsSwapInProgress() == false)
739 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
740 __pCallPresentor->SwapCalls();
741 SetSwapInProgress(true);
746 case IDA_MORE_OPTIONS_MENU:
748 //Show 'more' options menu
749 CreateMoreOptionsMenuList();
755 dtmfString.Append(L"0");
756 SetTextToDTMFTextField(dtmfString);
757 __pCallPresentor->SendDTMFSignal(dtmfString);
763 dtmfString.Append(L"1");
764 SetTextToDTMFTextField(dtmfString);
765 __pCallPresentor->SendDTMFSignal(dtmfString);
771 dtmfString.Append(L"2");
772 SetTextToDTMFTextField(dtmfString);
773 __pCallPresentor->SendDTMFSignal(dtmfString);
779 dtmfString.Append(L"3");
780 SetTextToDTMFTextField(dtmfString);
781 __pCallPresentor->SendDTMFSignal(dtmfString);
787 dtmfString.Append(L"4");
788 SetTextToDTMFTextField(dtmfString);
789 __pCallPresentor->SendDTMFSignal(dtmfString);
795 dtmfString.Append(L"5");
796 SetTextToDTMFTextField(dtmfString);
797 __pCallPresentor->SendDTMFSignal(dtmfString);
803 dtmfString.Append(L"6");
804 SetTextToDTMFTextField(dtmfString);
805 __pCallPresentor->SendDTMFSignal(dtmfString);
811 dtmfString.Append(L"7");
812 SetTextToDTMFTextField(dtmfString);
813 __pCallPresentor->SendDTMFSignal(dtmfString);
819 dtmfString.Append(L"8");
820 SetTextToDTMFTextField(dtmfString);
821 __pCallPresentor->SendDTMFSignal(dtmfString);
827 dtmfString.Append(L"9");
828 SetTextToDTMFTextField(dtmfString);
829 __pCallPresentor->SendDTMFSignal(dtmfString);
835 dtmfString.Append(L"*");
836 SetTextToDTMFTextField(dtmfString);
837 __pCallPresentor->SendDTMFSignal(dtmfString);
843 dtmfString.Append(L"#");
844 SetTextToDTMFTextField(dtmfString);
845 __pCallPresentor->SendDTMFSignal(dtmfString);
855 ActiveCallForm::IsSwapInProgress(void)
857 return __isSwapInProgress;
861 ActiveCallForm::SetSwapInProgress(bool progress)
863 __isSwapInProgress = progress;
867 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
869 if(__pDTMFKeypad != null)
871 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
873 int startpos=-1,endpos=-1;
874 pTextBox->GetBlockRange(startpos,endpos);
878 pTextBox->ReleaseBlock();
881 pTextBox->InsertTextAtCursorPosition(dtmfStr);
882 //pTextBox->AppendText(dtmfStr);
883 pTextBox->SetFocus();
884 pTextBox->Invalidate(true);
889 ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
892 //set itself as listener
893 __pCallPresentor->SetTelEventListener(this);
894 AddOrientationEventListener(*this);
896 CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
897 pPhoneApp->AddAppStateChangeListener(*this);
899 //Initialize keypad and buttons
900 InitializeCallButtonsPanel();
902 AddressbookManager* pAddressbookManager = AddressbookManager::GetInstance();
903 __pAddressbook = pAddressbookManager->GetAddressbookN(DEFAULT_ADDRESSBOOK_ID);
904 if(__pAddressbook != null)
906 __pAddressbook->SetAddressbookChangeEventListener(this);
910 if (__pActiveCallInfo != null)
912 delete __pActiveCallInfo;
913 __pActiveCallInfo = null;
915 if (__pHeldCallInfo != null)
917 delete __pHeldCallInfo;
918 __pHeldCallInfo = null;
920 DestroyMoreOptionsMenuList();
924 case FORMTYPE_OUTGOINGCALL:
927 contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
928 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
929 __pActiveCallInfo->SetContactNumber(contactNo);
930 Contact* pContact = __pCallPresentor->GetContactN(contactNo);
931 if (pContact != null)
933 __pActiveCallInfo->SetContactInfo(*pContact);
936 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
937 //make an normal outgoing call
938 __pCallPresentor->DialCall(contactNo, false);
942 case FORMTYPE_EMERGENCYOUTGOINGCALL:
944 String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
945 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
946 long long phNumber = 0;
947 LongLong::Parse(*pContactNo, phNumber);
948 __pActiveCallInfo->SetContactNumber(*pContactNo);
949 //make an emergency call
950 __pCallPresentor->DialCall(*pContactNo, true);
954 case FORMTYPE_ACTIVECALL:
957 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
959 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
960 *__pActiveCallInfo = *pCall;
961 String activeContactNo;
962 if(pCall->GetContactNumber().IsEmpty() == false)
964 activeContactNo.Append(pCall->GetContactNumber());
968 activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
970 ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
972 //show call active time using Timer
973 __activeCallStartTime = pCall->GetCallConnectTime();
974 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
978 case FORMTYPE_EMERGENCYACTIVECALL:
981 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
983 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
984 *__pActiveCallInfo = *pCall;
986 //show call active time using Timer
987 __activeCallStartTime = pCall->GetCallConnectTime();
988 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
992 case FORMTYPE_MULTIPLECALLS:
994 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
996 UpdateMultipleCallScreen(*pCallsList);
1002 case FORMTYPE_ACTIVECONFCALL:
1005 AppCallInfo* pConfInfo = static_cast<AppCallInfo*>(pArgs->GetAt(0));
1006 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1007 *__pActiveCallInfo = *pConfInfo;
1009 int participantsCount = __pActiveCallInfo->GetCallerListCount();
1011 // show participant count on name Label
1012 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1013 if (pPeopleCountLbl)
1016 count.Append(participantsCount);
1018 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1019 pPeopleCountLbl->SetText(count);
1022 if(participantsCount >= IDI_MAX_CONF_CALL_PARTICIPANTS)
1024 __pCallButtonsPanel->EnableAddCallButton(false);
1028 __pCallButtonsPanel->EnableAddCallButton(true);
1032 //bring button on top
1033 __pCallButtonsPanel->SetButtonPosition();
1036 //show call active time using Timer
1037 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1038 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime);
1046 if(__formType == FORMTYPE_ACTIVECALL || __formType == FORMTYPE_EMERGENCYACTIVECALL ||
1047 __formType == FORMTYPE_MULTIPLECALLS || __formType == FORMTYPE_ACTIVECONFCALL)
1049 //Unlock the phone if its locked
1050 if(LockManager::GetInstance()->IsLocked())
1052 AppLogDebug("Phone Locked");
1053 LockManager::GetInstance()->Unlock();
1057 //Hide DTMFKeypad, if visible and show caller info
1059 SetShowStateOnKeypad(true);
1060 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
1062 //Set the correct speaker status
1063 if(__pCallPresentor->IsSpeakerOn() == true)
1065 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
1069 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
1072 //Set the correct Mute status
1073 if (__pCallPresentor->IsCallMuted() == true)
1075 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
1079 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
1089 //update position of call buttons panel
1090 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
1091 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
1093 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1094 pCallApp->SetTopMostWindow(false);
1098 ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1100 RemoveOrientationEventListener(*this);
1101 if (__pActiveCallTimer != null)
1103 __pActiveCallTimer->Cancel();
1104 delete __pActiveCallTimer;
1105 __pActiveCallTimer = null;
1107 if (__pSmallPhotoLabel != null)
1109 __pSmallPhotoLabel->SetShowState(false);
1111 //Hide "Manage conf. Call" Context menu
1112 if (__pMoreOptionsListAnchor != null)
1114 __pMoreOptionsListAnchor->SetShowState(false);
1116 if (__pMoreOptionsList != null)
1118 __pMoreOptionsList->SetShowState(false);
1120 __DtmfString.Clear();
1121 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1122 pCallApp->RemoveAppStateChangeListener(*this);
1123 if(__pAddressbook != null)
1125 __pAddressbook->SetAddressbookChangeEventListener(null);
1130 ActiveCallForm::HandleConfCallChanged(void)
1133 AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
1134 //fetch changed conference call info
1135 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1136 if (pConfCallInfo == null)
1142 //fetch participant count in conf call
1143 int participantsCount = pConfCallInfo->GetCallerListCount();
1144 //update status of join and Add call
1145 bool isEnableAddCall = false;
1146 bool isEnableJoinCall = false;
1147 if(participantsCount < IDI_MAX_CONF_CALL_PARTICIPANTS)
1149 //available only at Active conf. call or active call screen
1150 isEnableAddCall = true;
1151 //join button is available only at multiple call screen
1152 isEnableJoinCall = true;
1155 Label* pPeopleCountLbl = null;
1156 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == true)
1158 //Active call is conference call
1159 delete __pActiveCallInfo;
1160 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1161 *__pActiveCallInfo = *pConfCallInfo;
1163 if (__formType == FORMTYPE_MULTIPLECALLS)
1165 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1167 else if (__formType == FORMTYPE_ACTIVECONFCALL)
1169 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1170 AppLog("Active conf call...(%d)", pPeopleCountLbl);
1173 else if(__pHeldCallInfo != null && __pHeldCallInfo->IsConferenceCall() == true)
1175 //Held call is conference call - this is definitely multiple call screen.
1176 delete __pHeldCallInfo;
1177 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1178 *__pHeldCallInfo = *pConfCallInfo;
1179 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1182 // update participant count on name Label
1183 if (pPeopleCountLbl != null)
1186 count.Append(participantsCount);
1188 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1189 pPeopleCountLbl->SetText(count);
1190 pPeopleCountLbl->Invalidate(true);
1192 //change AddCall Button status
1193 __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
1194 //change JoinCall Button status
1195 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1200 ActiveCallForm::OnContactsChanged(const Tizen::Base::Collection::IList& contactChangeInfoList)
1206 case FORMTYPE_OUTGOINGCALL:
1207 case FORMTYPE_ACTIVECALL:
1209 String pContactNumber;
1210 pContactNumber.Append(__pActiveCallInfo->GetContactNumber());
1211 Contact* pContact = __pCallPresentor->GetContactN(__pActiveCallInfo->GetContactNumber());
1212 if(pContact == null)
1214 __pActiveCallInfo->ResetContactNumber(null);
1215 __pActiveCallInfo->ResetContactInfo(null);
1220 __pActiveCallInfo->SetContactNumber(pContactNumber);
1221 __pActiveCallInfo->SetContactInfo(*pContact);
1223 if(pContact != null)
1228 ShowPersonDetails(pContactNumber, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1232 case FORMTYPE_EMERGENCYACTIVECALL:
1237 case FORMTYPE_MULTIPLECALLS:
1240 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
1241 if(pCallsList != null)
1243 int listCount = pCallsList->GetCount();
1244 for(int index = 0; index < listCount; index++)
1246 AppCallInfo callInfo;
1248 pCallsList->GetAt(index, callInfo);
1249 if(__pActiveCallInfo == null)
1251 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1253 *__pActiveCallInfo = callInfo;
1254 String contactNumber;
1255 contactNumber.Append(__pActiveCallInfo->GetContactNumber());
1256 pContact = __pCallPresentor->GetContactN(__pActiveCallInfo->GetContactNumber());
1257 if(pContact == null)
1259 __pActiveCallInfo->ResetContactNumber(null);
1260 __pActiveCallInfo->ResetContactInfo(null);
1265 __pActiveCallInfo->SetContactNumber(contactNumber);
1266 __pActiveCallInfo->SetContactInfo(*pContact);
1268 if(pContact != null)
1273 if(callInfo.IsConferenceCall() == true)
1277 if(callInfo.IsOnHold() == false)
1279 ShowPersonDetails(contactNumber, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1283 ShowPersonDetails(contactNumber, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pActiveCallInfo);
1300 ActiveCallForm::OnCategoriesChanged(const Tizen::Base::Collection::IList& categoryChangeInfoList)
1307 ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
1310 if(__pActiveCallInfo != null)
1312 delete __pActiveCallInfo;
1313 __pActiveCallInfo = null;
1315 if(__pHeldCallInfo != null)
1317 delete __pHeldCallInfo;
1318 __pHeldCallInfo = null;
1321 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1322 if (pMoreBtn != null)
1324 pMoreBtn->SetShowState(false);
1327 //show caller's info.
1328 for (int index = 0; index < activeCallsList.GetCount(); index++)
1331 AppCallInfo callInfo;
1332 activeCallsList.GetAt(index, callInfo);
1335 if(callInfo.GetContactNumber().IsEmpty() == false)
1337 contactNo.Append(callInfo.GetContactNumber());
1341 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1344 if (callInfo.IsOnHold() == false)
1346 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1347 *__pActiveCallInfo = callInfo;
1349 if (__pActiveCallInfo->IsConferenceCall() == false)
1351 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1354 pVoiceIconLbl->SetShowState(true);
1356 if (pMoreBtn != null)
1358 pMoreBtn->SetShowState(false);
1360 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1361 if(__pMoreOptionsListAnchor != null && __pMoreOptionsListAnchor->GetShowState() == true)
1363 CreateMoreOptionsMenuList();
1368 // show participant count on name Label
1369 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1370 if (pPeopleCountLbl)
1373 count.Append(__pActiveCallInfo->GetCallerListCount());
1375 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1376 pPeopleCountLbl->SetText(count);
1378 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1379 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1382 pNameLbl->SetText(nameStr);
1384 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1387 pVoiceIconLbl->SetShowState(false);
1389 if (pMoreBtn != null)
1391 pMoreBtn->SetShowState(true);
1393 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1394 if (pPhotoBitmap != null)
1396 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER1_PHOTO_LABEL));
1399 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1400 pPhotoLbl->Invalidate(true);
1402 delete pPhotoBitmap;
1405 //show call active time using Timer
1406 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1407 ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime);
1411 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1412 *__pHeldCallInfo = callInfo;
1414 if (__pHeldCallInfo->IsConferenceCall() == false)
1416 ShowPersonDetails(contactNo, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pHeldCallInfo);
1420 // show participant count on name Label
1421 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1422 if (pPeopleCountLbl)
1425 count.Append(__pHeldCallInfo->GetCallerListCount());
1427 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1428 pPeopleCountLbl->SetText(count);
1430 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1431 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1434 pNameLbl->SetText(nameStr);
1436 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1437 if (pPhotoBitmap != null)
1439 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER2_PHOTO_LABEL));
1442 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1443 pPhotoLbl->Invalidate(true);
1445 delete pPhotoBitmap;
1449 ShowTimerInfo(IDC_CALLER2_TIME_LABEL, true);
1453 //update JoinCall button status
1454 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1460 ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
1462 result r = E_FAILURE;
1464 //call individual methods to show contact number, caller name & photo
1465 ShowPhoneNumber(phoneNumber, contactLblName);
1467 //fetch contact details based on phone number
1468 String* pDisplayName = pCallInfo->FetchLatestCallerNameN(phoneNumber);
1469 ShowCallerName(*pDisplayName, nameLblName);
1471 Bitmap* pPhotoBitmap = pCallInfo->FetchLatestCallerPhotoN(phoneNumber);
1472 ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
1477 delete pDisplayName;
1478 pDisplayName = null;
1482 delete pPhotoBitmap;
1483 pPhotoBitmap = null;
1488 ActiveCallForm::ShowPhoneNumber(const String& phoneNumber, const String& contactLblName)
1490 String formattedNumber = phoneNumber;
1492 Label* pContactLbl = static_cast<Label*>(GetControl(contactLblName));
1495 pContactLbl->SetText(formattedNumber);
1496 pContactLbl->Invalidate(true);
1501 ActiveCallForm::ShowCallerName(const String& callerName, const String& nameLblName)
1503 // show display name on name Label
1504 Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
1507 //passing an empty string to SetText fails in label,
1508 //if previously valid text has been set
1509 if (callerName.IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
1511 String stringToBeSet(L" ");
1512 pNameLbl->SetText(stringToBeSet);
1516 pNameLbl->SetText(callerName);
1518 pNameLbl->Invalidate(true);
1523 ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
1525 //to check if default image is to be shown
1526 bool showDefaultPhoto = false;
1527 bool showSmallPhoto = false;
1528 String photoLabel("");
1532 case FORMTYPE_OUTGOINGCALL:
1533 case FORMTYPE_ACTIVECALL:
1535 if (pPhotoId == null)
1537 //show default caller image
1538 showDefaultPhoto = true;
1542 //Check the size of photo
1543 // Now checking the condition with && but actually it should be ||
1544 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1545 // height 270 and width = 480 . So all images set thru gallery is show as small image
1546 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1547 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1549 showSmallPhoto = true;
1553 photoLabel.Append(IDC_CALLER1_BIGPHOTO_LABEL);
1557 case FORMTYPE_MULTIPLECALLS:
1561 photoLabel.Append(IDC_CALLER2_PHOTO_LABEL);
1565 photoLabel.Append(IDC_CALLER1_PHOTO_LABEL);
1568 if (pPhotoId == null)
1570 showDefaultPhoto = true;
1574 if (pPhotoId->GetHeight() <= H_SMALL_PHOTO
1575 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1577 //pPhotoId->Scale(Dimension(W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO));
1578 showSmallPhoto = true;
1588 //Remove small photo label
1589 if (__pSmallPhotoLabel != null)
1591 RemoveControl(__pSmallPhotoLabel);
1592 __pSmallPhotoLabel = null;
1595 //show photo - for Big Photo Id, Animated Call Image
1596 if (!showDefaultPhoto)
1598 if(showSmallPhoto == true)
1600 ShowThumbnailImage(pPhotoId,photoLabel);
1604 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1607 Canvas* pCanvas = new (std::nothrow) Canvas;
1608 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1609 pCanvas->Construct(canvasRect);
1610 //draw the contact bitmap
1611 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1612 Bitmap* pNewPhotoId = new Bitmap();
1613 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1616 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1617 pPhotoLbl->Invalidate(true);
1624 Bitmap* pDefaultPhoto = null;
1627 case FORMTYPE_OUTGOINGCALL:
1628 case FORMTYPE_ACTIVECALL:
1629 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1632 case FORMTYPE_MULTIPLECALLS:
1633 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_MULTIPLE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1636 case FORMTYPE_ACTIVECONFCALL:
1637 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BIG_BG_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1643 if (pDefaultPhoto != null)
1645 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1648 pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
1649 pPhotoLbl->Invalidate(true);
1651 delete pDefaultPhoto;
1657 ActiveCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,String& photoLabel)
1659 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1661 if (pPhotoLbl != null && pPhotoId != null)
1663 Canvas* pCanvas = new (std::nothrow) Canvas;
1664 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1665 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1666 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1667 pCanvas->Construct(canvasRect);
1668 //draw the back ground
1669 pCanvas->DrawBitmap(canvasRect,*pBackground);
1670 //draw shadow (to be enabled after correct shadow image is provided )
1671 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1672 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1673 //draw the contact bitmap
1674 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1675 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1676 Bitmap* pNewPhotoId = new Bitmap();
1677 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1680 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1681 pPhotoLbl->Invalidate(true);
1690 ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1692 if (__pSmallPhotoLabel != null)
1694 RemoveControl(__pSmallPhotoLabel);
1695 __pSmallPhotoLabel = null;
1697 //Draw Small Photo and show on small photo label
1698 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1699 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1700 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1701 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1702 // Add a Label to the Form
1703 AddControl(__pSmallPhotoLabel);
1704 __pSmallPhotoLabel->Invalidate(true);
1708 ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long long startTime)
1710 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1712 if (__pActiveCallTimer == null)
1714 __pActiveCallTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
1715 __pActiveCallTimer->Construct(*this);
1718 if (pTimerLbl != null)
1720 if (isOnHold == true)
1722 pTimerLbl->SetText(AppUtility::GetResourceString(IDS_TIMER_ON_HOLD));
1723 //update Hold button status
1724 SetHoldButtonStatus(false);
1728 //update Hold button status
1729 SetHoldButtonStatus(true);
1730 //current system time
1731 long long currTime = 0;
1732 SystemTime::GetTicks(currTime);
1734 TimeSpan diffSpan(abs(startTime - currTime));
1736 String activeCallTime(L"");
1738 long long hr = diffSpan.GetHours();
1741 activeCallTime.Append("0");
1743 activeCallTime.Append(hr);
1744 activeCallTime.Append(L":");
1746 long long min = diffSpan.GetMinutes();
1749 activeCallTime.Append("0");
1751 activeCallTime.Append(min);
1752 activeCallTime.Append(L":");
1754 long long sec = diffSpan.GetSeconds();
1757 activeCallTime.Append("0");
1759 activeCallTime.Append(sec);
1761 pTimerLbl->SetText(activeCallTime);
1762 __pActiveCallTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
1764 pTimerLbl->Invalidate(true);
1769 ActiveCallForm::SetHoldButtonShowState(bool showState)
1771 Label* pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1772 if(pLblControl != null)
1774 pLblControl->SetShowState(showState);
1776 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1777 if(pButtonControl != null)
1779 pButtonControl->SetShowState(showState);
1784 ActiveCallForm::SetShowStateOnKeypad(bool showState)
1786 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1787 pLblControl->SetShowState(showState);
1788 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL));
1789 pLblControl->SetShowState(showState);
1790 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1791 pLblControl->SetShowState(showState);
1792 if (__pSmallPhotoLabel != null)
1794 __pSmallPhotoLabel->SetShowState(showState);
1799 case FORMTYPE_ACTIVECALL:
1801 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1802 pLblControl->SetShowState(showState);
1803 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1804 pLblControl->SetShowState(showState);
1805 SetHoldButtonShowState(showState);
1809 case FORMTYPE_MULTIPLECALLS:
1811 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1812 pLblControl->SetShowState(showState);
1813 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1814 pLblControl->SetShowState(showState);
1815 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1816 pLblControl->SetShowState(showState);
1817 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1818 pLblControl->SetShowState(showState);
1819 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1820 pLblControl->SetShowState(showState);
1821 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1822 pLblControl->SetShowState(showState);
1823 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == false)
1825 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1826 pLblControl->SetShowState(showState);
1830 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1831 pButtonControl->SetShowState(showState);
1833 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1834 pButtonControl->SetShowState(showState);
1838 case FORMTYPE_ACTIVECONFCALL:
1840 pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1841 pLblControl->SetShowState(showState);
1842 SetHoldButtonShowState(showState);
1843 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1844 pButtonControl->SetShowState(showState);
1854 ActiveCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1856 //Call default implementation of "Object.Equals()"
1857 //returns true, if they are pointing to same address.
1858 if (__pActiveCallTimer->Equals(timer))
1860 Label* pTimerLbl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1863 String activeCallTime = pTimerLbl->GetText();
1864 // Create a StringTokenizer instance
1865 StringTokenizer strTokens(activeCallTime, L":");
1867 int count = strTokens.GetTokenCount(); // count == 3
1872 for (int index = 0; index < count; index++)
1877 strTokens.GetNextToken(token);
1878 Integer::Parse(token, hr);
1882 strTokens.GetNextToken(token);
1883 Integer::Parse(token, min);
1887 strTokens.GetNextToken(token);
1888 Integer::Parse(token, sec);
1894 if (sec == IDI_MAX_SECONDS)
1899 if (min == IDI_MAX_MINS)
1906 activeCallTime.Clear();
1909 activeCallTime.Append("0");
1911 activeCallTime.Append(hr);
1912 activeCallTime.Append(":");
1915 activeCallTime.Append("0");
1917 activeCallTime.Append(min);
1918 activeCallTime.Append(":");
1921 activeCallTime.Append("0");
1923 activeCallTime.Append(sec);
1924 //update timer label
1925 pTimerLbl->SetText(activeCallTime);
1926 pTimerLbl->Invalidate(true);
1931 ///////////////////////////////////////////////////////////
1932 /////////// Options Menu List Functionality /////////
1933 ///////////////////////////////////////////////////////////
1935 ActiveCallForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
1940 ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
1942 //Goto conference call list form
1943 SceneManager* pSceneManager = SceneManager::GetInstance();
1944 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
1945 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_KEEP), null);
1949 ActiveCallForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
1954 ActiveCallForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
1959 ActiveCallForm::GetItemCount(void)
1961 return IDI_MOREOPTIONS_LIST_ITEMS;
1965 ActiveCallForm::CreateItem(int index, int itemWidth)
1967 //create 1st Menu option
1968 CustomItem* pItem = new (std::nothrow) CustomItem();
1969 pItem->Construct(IDI_OPTIONMENU_DIMEN, LIST_ANNEX_STYLE_NORMAL);
1971 //Set background 9-patch bitmap to option menu
1972 Bitmap* pBgBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_BG_ICON);
1973 if (pBgBmp != null && pBgBmp->IsNinePatchedBitmap())
1976 bgCanvas.Construct(Rectangle(IDI_OPTIONMENU_POS, IDI_OPTIONMENU_DIMEN));
1977 bgCanvas.DrawNinePatchedBitmap(bgCanvas.GetBounds(), *pBgBmp);
1981 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color(40, 45, 48));
1986 //Set bitmap to option menu
1987 Bitmap* pNormalConfCallBmp = AppUtility::GetBitmapFromResourcesN(IDB_MORE_MANAGE_CONFERENCE_ICON ,
1988 W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP);
1989 pItem->AddElement(Rectangle(16, 17, W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP), 1, *pNormalConfCallBmp, null, null);
1990 // Deallocate bitmaps
1991 delete pNormalConfCallBmp;
1992 pNormalConfCallBmp = null;
1994 //Set text to menu option
1995 String confCallName = AppUtility::GetResourceString(IDS_MGR_CONF_CALL_LIST_STR);
1997 TextElement* pTextElement = new (std::nothrow) TextElement();
1998 pTextElement->Construct(confCallName);
1999 pTextElement->SetTextColor(COLOR_POPUP_TEXT);
2002 font.Construct(FONT_STYLE_PLAIN, IDI_POPUP_TEXT_SIZE);
2003 pTextElement->SetFont(font);
2004 //construct Enriched text
2005 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
2006 FloatDimension textDimension;
2007 font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
2008 textDimension.height = textDimension.height + font.GetDescender();
2009 pEnrichedText->Construct(textDimension);
2010 //add text element to enriched text
2011 pEnrichedText->Add(*pTextElement);
2013 //Add Enriched text to pItem
2014 FloatPoint textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
2015 pItem->AddElement(FloatRectangle(textPos, textDimension), 2, *pEnrichedText);
2017 pEnrichedText->RemoveAll(true);
2018 delete pEnrichedText;
2023 ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
2030 ActiveCallForm::OnForeground(void)
2032 AppLogDebug("Enter");
2033 __pCallPresentor->OnAppForeground();