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 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
232 if(__DtmfString.IsEmpty() == false)
234 pTextBox->SetText(__DtmfString);
236 pTextBox->SetFocus();
237 __pDTMFKeypad->Draw(true);
238 __pDTMFKeypad->Show();
242 ActiveCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
246 if (__pCallButtonsPanel != null)
248 //update position of call buttons panel
249 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
250 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
252 //bring button on top
253 __pCallButtonsPanel->SetButtonPosition();
255 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
256 if (pRelativeLayout != null)
258 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
261 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
262 if (pRelativeLayout != null)
264 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
265 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
268 //change orientation of DTMF Keypad, if it is visible.
269 if (__pDTMFKeypad != null)
271 if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
273 //in landscape mode, caller info is visible.
274 SetShowStateOnKeypad(true);
275 SetHoldButtonShowState(false);
277 else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
279 //in Portrait mode it is hidden beneath DTMF Keypad.
280 SetShowStateOnKeypad(false);
281 DestroyMoreOptionsMenuList();
283 if(__pDTMFKeypad->GetShowState() == true)
285 String dtmfText = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
291 //More option is displayed recreate it
292 if(__pMoreOptionsListAnchor != null)
294 CreateMoreOptionsMenuList();
295 CreateMoreOptionsMenuList();
300 ActiveCallForm::HideDTMFKeypad(void)
302 if(__pDTMFKeypad != null)
304 __DtmfString = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
306 RemoveControl(__pDTMFKeypad);
307 __pDTMFKeypad = null;
312 ActiveCallForm::InitializeCallButtonsPanel(void)
314 result r = E_SUCCESS;
315 //Set background bitmap for call keypad
316 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
317 Bitmap* pBgBitmap = AppUtility::GetBitmapFromResourcesN(IDB_BACKGROUND_BITMAP, pKeysBgLbl->GetWidth(), pKeysBgLbl->GetHeight());
318 if (pBgBitmap != null)
320 pKeysBgLbl->SetBackgroundBitmap(*pBgBitmap);
323 if (__pCallButtonsPanel == null)
325 __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
326 __pCallButtonsPanel->ConstructPanel(this, __formType);
327 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
328 r = AddControl(__pCallButtonsPanel);
331 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
332 if (pRelativeLayout != null)
334 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
336 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
337 if (pRelativeLayout != null)
339 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
340 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
341 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
342 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_TOP_TO_TOP);
349 ActiveCallForm::InitializeSwapButton(void)
351 Button* pSwapBtn = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
354 Bitmap* pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_NORMAL,
355 W_HOLD_BITMAP, H_HOLD_BITMAP);
358 pSwapBtn->SetNormalBitmap(Point(0, 0), *pSwapBmp);
363 pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_PRESS,
364 W_HOLD_BITMAP, H_HOLD_BITMAP);
367 pSwapBtn->SetPressedBitmap(Point(0, 0), *pSwapBmp);
371 pSwapBtn->SetActionId(IDA_SWAP_CALLS);
372 pSwapBtn->AddActionEventListener(*this);
377 ActiveCallForm::InitializeManageConfCallButton(void)
379 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
380 if (pMoreBtn != null)
382 pMoreBtn->SetActionId(IDA_MORE_OPTIONS_MENU);
383 pMoreBtn->AddActionEventListener(*this);
384 if (__formType == FORMTYPE_MULTIPLECALLS)
386 //Correct state will be set in OnSceneActivated based on the call
387 pMoreBtn->SetShowState(false);
389 else if (__formType == FORMTYPE_ACTIVECONFCALL)
391 pMoreBtn->SetShowState(true);
397 ActiveCallForm::InitializeHoldButton(void)
399 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
400 if (pHoldBtn != null)
402 //set status of Hold Button
403 SetHoldButtonStatus(true);
404 pHoldBtn->AddActionEventListener(*this);
409 ActiveCallForm::SetHoldButtonStatus(bool toHoldCall)
411 //background bitmap & button name
413 Bitmap* normalImg = null;
414 Bitmap* pressImg = null;
417 btnName.Append(AppUtility::GetResourceString(IDS_HOLD_BTN_NAME));
418 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_NORMAL_BUTTON_ICON,
419 W_HOLD_BITMAP, H_HOLD_BITMAP);
420 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_PRESS_BUTTON_ICON,
421 W_HOLD_BITMAP, H_HOLD_BITMAP);
425 btnName.Append(AppUtility::GetResourceString(IDS_UNHOLD_BTN_NAME));
426 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_NORMAL_BUTTON_ICON,
427 W_HOLD_BITMAP, H_HOLD_BITMAP);
428 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_PRESS_BUTTON_ICON,
429 W_HOLD_BITMAP, H_HOLD_BITMAP);
433 CommandIds cmdId = IDA_HOLD_CALL;
436 case FORMTYPE_ACTIVECALL:
438 cmdId = toHoldCall ? IDA_HOLD_CALL : IDA_UNHOLD_CALL;
442 case FORMTYPE_ACTIVECONFCALL:
444 cmdId = toHoldCall ? IDA_HOLD_CONF_CALL : IDA_UNHOLD_CONF_CALL;
452 //set background bitmap, button name & action id
453 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
454 Label* pHoldLbl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
457 pHoldBtn->SetActionId(cmdId);
458 pHoldBtn->SetNormalBitmap(Point(0, 0),*normalImg);
459 pHoldBtn->SetPressedBitmap(Point(0, 0),*pressImg);
460 pHoldBtn->Invalidate(true);
464 pHoldLbl->SetText(btnName);
465 pHoldLbl->Invalidate(true);
476 ActiveCallForm::CreateMoreOptionsMenuList(void)
478 //create option list anchor
479 if (__pMoreOptionsListAnchor == null)
481 Bitmap* pBgPopupArwBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_ARROW_ICON, W_OPTION_ANCHOR,
483 __pMoreOptionsListAnchor = new (std::nothrow) Label();
484 __pMoreOptionsListAnchor->Construct(Rectangle(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_ICON, Y_POPUP_ANCHOR, W_POPUP_ANCHOR, H_POPUP_ANCHOR), L"");
485 __pMoreOptionsListAnchor->SetBackgroundBitmap(*pBgPopupArwBmp);
487 delete pBgPopupArwBmp;
488 pBgPopupArwBmp = null;
490 // Adds a Label to the Form
491 AddControl(__pMoreOptionsListAnchor);
494 //create options menu list
495 if (__pMoreOptionsList == null)
497 __pMoreOptionsList = new (std::nothrow) ListView();
498 __pMoreOptionsList->Construct(Rectangle(Point(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_LABEL,H_MORE_LABEL), IDI_OPTIONMENU_DIMEN), false, SCROLL_STYLE_FADE_OUT);
499 __pMoreOptionsList->SetItemProvider(*this);
500 __pMoreOptionsList->AddListViewItemEventListener(*this);
501 //Add option list to the form
502 AddControl(__pMoreOptionsList);
506 //Hide option menu list
507 DestroyMoreOptionsMenuList();
512 ActiveCallForm::DestroyMoreOptionsMenuList(void)
514 if (__pMoreOptionsListAnchor != null)
516 //removes and delete the child control
517 RemoveControl(__pMoreOptionsListAnchor);
518 __pMoreOptionsListAnchor = null;
521 if (__pMoreOptionsList != null)
523 //removes and delete the child control
524 RemoveControl(__pMoreOptionsList);
525 __pMoreOptionsList = null;
530 ActiveCallForm::OnTerminating(void)
532 result r = E_SUCCESS;
533 if (__pCallPresentor != null)
535 __pCallPresentor = null;
541 ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
549 //End the currently active / dialing call
550 if (__pActiveCallInfo->IsConferenceCall() == false)
552 String activeContactNo;
553 activeContactNo.Append(__pActiveCallInfo->GetContactNumber());
554 //Check if it is call is in dialing state, then
555 if (__formType == FORMTYPE_EMERGENCYOUTGOINGCALL || __formType == FORMTYPE_OUTGOINGCALL)
557 __pCallPresentor->EndDialingCall(activeContactNo);
562 __pCallPresentor->EndActiveCall(*__pActiveCallInfo->GetCallHandle());
567 __pCallPresentor->EndConferenceCall();
572 case IDA_END_CONF_CALL:
574 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
575 __pCallPresentor->EndConferenceCall();
579 case IDA_OPEN_NUMKEYPAD:
581 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
583 //hide only in portrait mode.
584 SetShowStateOnKeypad(false);
585 DestroyMoreOptionsMenuList();
587 //Hide the hold button as it goes behind DTMF keypad
588 SetHoldButtonShowState(false);
590 __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
594 case IDA_CLOSE_NUMKEYPAD:
596 SetShowStateOnKeypad(true);
598 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
604 //switch to Dialer Form to make an call
605 if(__pCallPresentor->GetCurrentCallCount() == 1)
607 __pCallPresentor->LaunchDialAppControl();
615 if (__pActiveCallInfo->IsConferenceCall() == false)
617 if(__pActiveCallInfo->GetCallHandle() != null)
619 success = __pCallPresentor->HoldCall(*__pActiveCallInfo->GetCallHandle());
624 success = __pCallPresentor->HoldConferenceCall();
626 //reset hold status and "OnHold" text
627 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
628 if(__pActiveCallTimer != null)
630 __pActiveCallTimer->Cancel();
632 SetHoldButtonStatus(!success);
636 case IDA_UNHOLD_CALL:
638 bool success = false;
639 if (__pActiveCallInfo->IsConferenceCall() == false)
641 if(__pActiveCallInfo->GetCallHandle() != null)
643 success = __pCallPresentor->UnHoldCall(*__pActiveCallInfo->GetCallHandle());
648 success = __pCallPresentor->ActivateConferenceCall();
650 //reset hold status and show call timer
651 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
652 SetHoldButtonStatus(success);
656 case IDA_HOLD_CONF_CALL:
658 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
659 bool success = __pCallPresentor->HoldConferenceCall();
660 //reset hold status and "OnHold" text
661 SetHoldButtonStatus(!success);
662 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
663 if(__pActiveCallTimer != null)
665 __pActiveCallTimer->Cancel();
670 case IDA_UNHOLD_CONF_CALL:
672 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
673 bool success = __pCallPresentor->ActivateConferenceCall();
674 //reset hold status and show call timer
675 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
676 SetHoldButtonStatus(success);
680 case IDA_OPEN_CONTACTS:
683 //Launch call application
684 AppManager* pAppManager = AppManager::GetInstance();
685 pAppManager->LaunchApplication(PROVIDER_ID_CONTACTS);
691 bool success = __pCallPresentor->SetMuteStatus(true);
694 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
701 bool success = __pCallPresentor->SetMuteStatus(false);
704 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
711 bool success = __pCallPresentor->SetSpeakerStatus(true);
714 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
719 case IDA_SPEAKER_OFF:
721 bool success = __pCallPresentor->SetSpeakerStatus(false);
724 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
731 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
732 __pCallPresentor->JoinCall();
738 if(IsSwapInProgress() == false)
740 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
741 __pCallPresentor->SwapCalls();
742 SetSwapInProgress(true);
747 case IDA_MORE_OPTIONS_MENU:
749 //Show 'more' options menu
750 CreateMoreOptionsMenuList();
756 dtmfString.Append(L"0");
757 SetTextToDTMFTextField(dtmfString);
758 __pCallPresentor->SendDTMFSignal(dtmfString);
764 dtmfString.Append(L"1");
765 SetTextToDTMFTextField(dtmfString);
766 __pCallPresentor->SendDTMFSignal(dtmfString);
772 dtmfString.Append(L"2");
773 SetTextToDTMFTextField(dtmfString);
774 __pCallPresentor->SendDTMFSignal(dtmfString);
780 dtmfString.Append(L"3");
781 SetTextToDTMFTextField(dtmfString);
782 __pCallPresentor->SendDTMFSignal(dtmfString);
788 dtmfString.Append(L"4");
789 SetTextToDTMFTextField(dtmfString);
790 __pCallPresentor->SendDTMFSignal(dtmfString);
796 dtmfString.Append(L"5");
797 SetTextToDTMFTextField(dtmfString);
798 __pCallPresentor->SendDTMFSignal(dtmfString);
804 dtmfString.Append(L"6");
805 SetTextToDTMFTextField(dtmfString);
806 __pCallPresentor->SendDTMFSignal(dtmfString);
812 dtmfString.Append(L"7");
813 SetTextToDTMFTextField(dtmfString);
814 __pCallPresentor->SendDTMFSignal(dtmfString);
820 dtmfString.Append(L"8");
821 SetTextToDTMFTextField(dtmfString);
822 __pCallPresentor->SendDTMFSignal(dtmfString);
828 dtmfString.Append(L"9");
829 SetTextToDTMFTextField(dtmfString);
830 __pCallPresentor->SendDTMFSignal(dtmfString);
836 dtmfString.Append(L"*");
837 SetTextToDTMFTextField(dtmfString);
838 __pCallPresentor->SendDTMFSignal(dtmfString);
844 dtmfString.Append(L"#");
845 SetTextToDTMFTextField(dtmfString);
846 __pCallPresentor->SendDTMFSignal(dtmfString);
856 ActiveCallForm::IsSwapInProgress(void)
858 return __isSwapInProgress;
862 ActiveCallForm::SetSwapInProgress(bool progress)
864 __isSwapInProgress = progress;
868 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
870 if(__pDTMFKeypad != null)
872 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
874 int startpos=-1,endpos=-1;
875 pTextBox->GetBlockRange(startpos,endpos);
879 pTextBox->ReleaseBlock();
882 pTextBox->InsertTextAtCursorPosition(dtmfStr);
883 //pTextBox->AppendText(dtmfStr);
884 // pTextBox->SetFocus();
885 pTextBox->Invalidate(true);
890 ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
893 //set itself as listener
894 __pCallPresentor->SetTelEventListener(this);
895 AddOrientationEventListener(*this);
897 CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
898 pPhoneApp->AddAppStateChangeListener(*this);
900 //Initialize keypad and buttons
901 InitializeCallButtonsPanel();
903 AddressbookManager* pAddressbookManager = AddressbookManager::GetInstance();
904 __pAddressbook = pAddressbookManager->GetAddressbookN(DEFAULT_ADDRESSBOOK_ID);
905 if(__pAddressbook != null)
907 __pAddressbook->SetAddressbookChangeEventListener(this);
911 if (__pActiveCallInfo != null)
913 delete __pActiveCallInfo;
914 __pActiveCallInfo = null;
916 if (__pHeldCallInfo != null)
918 delete __pHeldCallInfo;
919 __pHeldCallInfo = null;
921 DestroyMoreOptionsMenuList();
925 case FORMTYPE_OUTGOINGCALL:
928 contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
929 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
930 __pActiveCallInfo->SetContactNumber(contactNo);
931 Contact* pContact = __pCallPresentor->GetContactN(contactNo);
932 if (pContact != null)
934 __pActiveCallInfo->SetContactInfo(*pContact);
937 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
938 //make an normal outgoing call
939 __pCallPresentor->DialCall(contactNo, false);
943 case FORMTYPE_EMERGENCYOUTGOINGCALL:
945 String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
946 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
947 long long phNumber = 0;
948 LongLong::Parse(*pContactNo, phNumber);
949 __pActiveCallInfo->SetContactNumber(*pContactNo);
950 //make an emergency call
951 __pCallPresentor->DialCall(*pContactNo, true);
955 case FORMTYPE_ACTIVECALL:
958 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
960 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
961 *__pActiveCallInfo = *pCall;
962 String activeContactNo;
963 if(pCall->GetContactNumber().IsEmpty() == false)
965 activeContactNo.Append(pCall->GetContactNumber());
969 activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
971 ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
972 //show call active time using Timer
973 //__activeCallStartTime = pCall->GetCallConnectTime();
974 __activeCallStartTime = pCall->GetDurationTime();
975 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
979 case FORMTYPE_EMERGENCYACTIVECALL:
982 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
984 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
985 *__pActiveCallInfo = *pCall;
987 //show call active time using Timer
988 //__activeCallStartTime = pCall->GetCallConnectTime();
989 __activeCallStartTime = pCall->GetDurationTime();
990 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
994 case FORMTYPE_MULTIPLECALLS:
996 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
998 UpdateMultipleCallScreen(*pCallsList);
1004 case FORMTYPE_ACTIVECONFCALL:
1007 AppCallInfo* pConfInfo = static_cast<AppCallInfo*>(pArgs->GetAt(0));
1008 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1009 *__pActiveCallInfo = *pConfInfo;
1011 int participantsCount = __pActiveCallInfo->GetCallerListCount();
1013 // show participant count on name Label
1014 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1015 if (pPeopleCountLbl)
1018 count.Append(participantsCount);
1020 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1021 pPeopleCountLbl->SetText(count);
1024 if(participantsCount >= IDI_MAX_CONF_CALL_PARTICIPANTS)
1026 __pCallButtonsPanel->EnableAddCallButton(false);
1030 __pCallButtonsPanel->EnableAddCallButton(true);
1034 //bring button on top
1035 __pCallButtonsPanel->SetButtonPosition();
1038 //show call active time using Timer
1039 //__activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1040 __activeCallStartTime = __pActiveCallInfo->GetDurationTime();
1041 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime);
1049 if(__formType == FORMTYPE_ACTIVECALL || __formType == FORMTYPE_EMERGENCYACTIVECALL ||
1050 __formType == FORMTYPE_MULTIPLECALLS || __formType == FORMTYPE_ACTIVECONFCALL)
1052 //Unlock the phone if its locked
1053 if(LockManager::GetInstance()->IsLocked())
1055 AppLogDebug("Phone Locked");
1056 LockManager::GetInstance()->Unlock();
1060 //Hide DTMFKeypad, if visible and show caller info
1062 SetShowStateOnKeypad(true);
1063 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
1065 //Set the correct speaker status
1066 if(__pCallPresentor->IsSpeakerOn() == true)
1068 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
1072 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
1075 //Set the correct Mute status
1076 if (__pCallPresentor->IsCallMuted() == true)
1078 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
1082 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
1092 //update position of call buttons panel
1093 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
1094 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
1096 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1097 pCallApp->SetTopMostWindow(false);
1101 ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1103 RemoveOrientationEventListener(*this);
1104 if (__pActiveCallTimer != null)
1106 __pActiveCallTimer->Cancel();
1107 delete __pActiveCallTimer;
1108 __pActiveCallTimer = null;
1110 if (__pSmallPhotoLabel != null)
1112 __pSmallPhotoLabel->SetShowState(false);
1114 //Hide "Manage conf. Call" Context menu
1115 if (__pMoreOptionsListAnchor != null)
1117 __pMoreOptionsListAnchor->SetShowState(false);
1119 if (__pMoreOptionsList != null)
1121 __pMoreOptionsList->SetShowState(false);
1123 __DtmfString.Clear();
1124 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1125 pCallApp->RemoveAppStateChangeListener(*this);
1126 if(__pAddressbook != null)
1128 __pAddressbook->SetAddressbookChangeEventListener(null);
1133 ActiveCallForm::HandleConfCallChanged(void)
1136 AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
1137 //fetch changed conference call info
1138 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1139 if (pConfCallInfo == null)
1145 //fetch participant count in conf call
1146 int participantsCount = pConfCallInfo->GetCallerListCount();
1147 //update status of join and Add call
1148 bool isEnableAddCall = false;
1149 bool isEnableJoinCall = false;
1150 if(participantsCount < IDI_MAX_CONF_CALL_PARTICIPANTS)
1152 //available only at Active conf. call or active call screen
1153 isEnableAddCall = true;
1154 //join button is available only at multiple call screen
1155 isEnableJoinCall = true;
1158 Label* pPeopleCountLbl = null;
1159 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == true)
1161 //Active call is conference call
1162 delete __pActiveCallInfo;
1163 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1164 *__pActiveCallInfo = *pConfCallInfo;
1166 if (__formType == FORMTYPE_MULTIPLECALLS)
1168 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1170 else if (__formType == FORMTYPE_ACTIVECONFCALL)
1172 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1173 AppLog("Active conf call...(%d)", pPeopleCountLbl);
1176 else if(__pHeldCallInfo != null && __pHeldCallInfo->IsConferenceCall() == true)
1178 //Held call is conference call - this is definitely multiple call screen.
1179 delete __pHeldCallInfo;
1180 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1181 *__pHeldCallInfo = *pConfCallInfo;
1182 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1185 // update participant count on name Label
1186 if (pPeopleCountLbl != null)
1189 count.Append(participantsCount);
1191 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1192 pPeopleCountLbl->SetText(count);
1193 pPeopleCountLbl->Invalidate(true);
1195 //change AddCall Button status
1196 __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
1197 //change JoinCall Button status
1198 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1203 ActiveCallForm::OnContactsChanged(const Tizen::Base::Collection::IList& contactChangeInfoList)
1209 case FORMTYPE_OUTGOINGCALL:
1210 case FORMTYPE_ACTIVECALL:
1212 String pContactNumber;
1213 pContactNumber.Append(__pActiveCallInfo->GetContactNumber());
1214 Contact* pContact = __pCallPresentor->GetContactN(__pActiveCallInfo->GetContactNumber());
1215 if(pContact == null)
1217 __pActiveCallInfo->ResetContactNumber(null);
1218 __pActiveCallInfo->ResetContactInfo(null);
1223 __pActiveCallInfo->SetContactNumber(pContactNumber);
1224 __pActiveCallInfo->SetContactInfo(*pContact);
1226 if(pContact != null)
1231 ShowPersonDetails(pContactNumber, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1235 case FORMTYPE_EMERGENCYACTIVECALL:
1240 case FORMTYPE_MULTIPLECALLS:
1243 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
1244 if(pCallsList != null)
1246 int listCount = pCallsList->GetCount();
1247 for(int index = 0; index < listCount; index++)
1249 AppCallInfo callInfo;
1251 pCallsList->GetAt(index, callInfo);
1252 if(__pActiveCallInfo == null)
1254 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1256 *__pActiveCallInfo = callInfo;
1257 String contactNumber;
1258 contactNumber.Append(__pActiveCallInfo->GetContactNumber());
1259 pContact = __pCallPresentor->GetContactN(__pActiveCallInfo->GetContactNumber());
1260 if(pContact == null)
1262 __pActiveCallInfo->ResetContactNumber(null);
1263 __pActiveCallInfo->ResetContactInfo(null);
1268 __pActiveCallInfo->SetContactNumber(contactNumber);
1269 __pActiveCallInfo->SetContactInfo(*pContact);
1271 if(pContact != null)
1276 if(callInfo.IsConferenceCall() == true)
1280 if(callInfo.IsOnHold() == false)
1282 ShowPersonDetails(contactNumber, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1286 ShowPersonDetails(contactNumber, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pActiveCallInfo);
1303 ActiveCallForm::OnCategoriesChanged(const Tizen::Base::Collection::IList& categoryChangeInfoList)
1310 ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
1313 if(__pActiveCallInfo != null)
1315 delete __pActiveCallInfo;
1316 __pActiveCallInfo = null;
1318 if(__pHeldCallInfo != null)
1320 delete __pHeldCallInfo;
1321 __pHeldCallInfo = null;
1324 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1325 if (pMoreBtn != null)
1327 pMoreBtn->SetShowState(false);
1330 //show caller's info.
1331 for (int index = 0; index < activeCallsList.GetCount(); index++)
1334 AppCallInfo callInfo;
1335 activeCallsList.GetAt(index, callInfo);
1338 if(callInfo.GetContactNumber().IsEmpty() == false)
1340 contactNo.Append(callInfo.GetContactNumber());
1344 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1347 if (callInfo.IsOnHold() == false)
1349 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1350 *__pActiveCallInfo = callInfo;
1352 if (__pActiveCallInfo->IsConferenceCall() == false)
1354 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1357 pVoiceIconLbl->SetShowState(true);
1359 if (pMoreBtn != null)
1361 pMoreBtn->SetShowState(false);
1363 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1364 if(__pMoreOptionsListAnchor != null && __pMoreOptionsListAnchor->GetShowState() == true)
1366 CreateMoreOptionsMenuList();
1371 // show participant count on name Label
1372 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1373 if (pPeopleCountLbl)
1376 count.Append(__pActiveCallInfo->GetCallerListCount());
1378 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1379 pPeopleCountLbl->SetText(count);
1381 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1382 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1385 pNameLbl->SetText(nameStr);
1387 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1390 pVoiceIconLbl->SetShowState(false);
1392 if (pMoreBtn != null)
1394 pMoreBtn->SetShowState(true);
1396 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1397 if (pPhotoBitmap != null)
1399 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER1_PHOTO_LABEL));
1402 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1403 pPhotoLbl->Invalidate(true);
1405 delete pPhotoBitmap;
1408 //show call active time using Timer
1409 //__activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1410 __activeCallStartTime = __pActiveCallInfo->GetDurationTime();
1411 ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime);
1415 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1416 *__pHeldCallInfo = callInfo;
1418 if (__pHeldCallInfo->IsConferenceCall() == false)
1420 ShowPersonDetails(contactNo, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pHeldCallInfo);
1424 // show participant count on name Label
1425 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1426 if (pPeopleCountLbl)
1429 count.Append(__pHeldCallInfo->GetCallerListCount());
1431 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1432 pPeopleCountLbl->SetText(count);
1434 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1435 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1438 pNameLbl->SetText(nameStr);
1440 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1441 if (pPhotoBitmap != null)
1443 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER2_PHOTO_LABEL));
1446 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1447 pPhotoLbl->Invalidate(true);
1449 delete pPhotoBitmap;
1453 ShowTimerInfo(IDC_CALLER2_TIME_LABEL, true);
1457 //update JoinCall button status
1458 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1464 ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
1466 result r = E_FAILURE;
1468 //call individual methods to show contact number, caller name & photo
1469 ShowPhoneNumber(phoneNumber, contactLblName);
1471 //fetch contact details based on phone number
1472 String* pDisplayName = pCallInfo->FetchLatestCallerNameN(phoneNumber);
1473 ShowCallerName(*pDisplayName, nameLblName);
1475 Bitmap* pPhotoBitmap = pCallInfo->FetchLatestCallerPhotoN(phoneNumber);
1476 ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
1481 delete pDisplayName;
1482 pDisplayName = null;
1486 delete pPhotoBitmap;
1487 pPhotoBitmap = null;
1492 ActiveCallForm::ShowPhoneNumber(const String& phoneNumber, const String& contactLblName)
1494 String formattedNumber = phoneNumber;
1496 Label* pContactLbl = static_cast<Label*>(GetControl(contactLblName));
1499 pContactLbl->SetText(formattedNumber);
1500 pContactLbl->Invalidate(true);
1505 ActiveCallForm::ShowCallerName(const String& callerName, const String& nameLblName)
1507 // show display name on name Label
1508 Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
1511 //passing an empty string to SetText fails in label,
1512 //if previously valid text has been set
1513 if (callerName.IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
1515 String stringToBeSet(L" ");
1516 pNameLbl->SetText(stringToBeSet);
1520 pNameLbl->SetText(callerName);
1522 pNameLbl->Invalidate(true);
1527 ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
1529 //to check if default image is to be shown
1530 bool showDefaultPhoto = false;
1531 bool showSmallPhoto = false;
1532 String photoLabel("");
1536 case FORMTYPE_OUTGOINGCALL:
1537 case FORMTYPE_ACTIVECALL:
1539 if (pPhotoId == null)
1541 //show default caller image
1542 showDefaultPhoto = true;
1546 //Check the size of photo
1547 // Now checking the condition with && but actually it should be ||
1548 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1549 // height 270 and width = 480 . So all images set thru gallery is show as small image
1550 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1551 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1553 showSmallPhoto = true;
1557 photoLabel.Append(IDC_CALLER1_BIGPHOTO_LABEL);
1561 case FORMTYPE_MULTIPLECALLS:
1565 photoLabel.Append(IDC_CALLER2_PHOTO_LABEL);
1569 photoLabel.Append(IDC_CALLER1_PHOTO_LABEL);
1572 if (pPhotoId == null)
1574 showDefaultPhoto = true;
1578 if (pPhotoId->GetHeight() <= H_SMALL_PHOTO
1579 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1581 //pPhotoId->Scale(Dimension(W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO));
1582 showSmallPhoto = true;
1592 //Remove small photo label
1593 if (__pSmallPhotoLabel != null)
1595 RemoveControl(__pSmallPhotoLabel);
1596 __pSmallPhotoLabel = null;
1599 //show photo - for Big Photo Id, Animated Call Image
1600 if (!showDefaultPhoto)
1602 if(showSmallPhoto == true)
1604 ShowThumbnailImage(pPhotoId,photoLabel);
1608 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1611 Canvas* pCanvas = new (std::nothrow) Canvas;
1612 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1613 pCanvas->Construct(canvasRect);
1614 //draw the contact bitmap
1615 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1616 Bitmap* pNewPhotoId = new Bitmap();
1617 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1620 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1621 pPhotoLbl->Invalidate(true);
1628 Bitmap* pDefaultPhoto = null;
1631 case FORMTYPE_OUTGOINGCALL:
1632 case FORMTYPE_ACTIVECALL:
1633 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1636 case FORMTYPE_MULTIPLECALLS:
1637 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_MULTIPLE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1640 case FORMTYPE_ACTIVECONFCALL:
1641 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BIG_BG_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1647 if (pDefaultPhoto != null)
1649 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1652 pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
1653 pPhotoLbl->Invalidate(true);
1655 delete pDefaultPhoto;
1661 ActiveCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,String& photoLabel)
1663 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1665 if (pPhotoLbl != null && pPhotoId != null)
1667 Canvas* pCanvas = new (std::nothrow) Canvas;
1668 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1669 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1670 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1671 pCanvas->Construct(canvasRect);
1672 //draw the back ground
1673 pCanvas->DrawBitmap(canvasRect,*pBackground);
1674 //draw shadow (to be enabled after correct shadow image is provided )
1675 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1676 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1677 //draw the contact bitmap
1678 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1679 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1680 Bitmap* pNewPhotoId = new Bitmap();
1681 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1684 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1685 pPhotoLbl->Invalidate(true);
1694 ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1696 if (__pSmallPhotoLabel != null)
1698 RemoveControl(__pSmallPhotoLabel);
1699 __pSmallPhotoLabel = null;
1701 //Draw Small Photo and show on small photo label
1702 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1703 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1704 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1705 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1706 // Add a Label to the Form
1707 AddControl(__pSmallPhotoLabel);
1708 __pSmallPhotoLabel->Invalidate(true);
1712 ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long long startTime)
1714 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1716 if (__pActiveCallTimer == null)
1718 __pActiveCallTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
1719 __pActiveCallTimer->Construct(*this);
1722 if (pTimerLbl != null)
1724 if (isOnHold == true)
1726 pTimerLbl->SetText(AppUtility::GetResourceString(IDS_TIMER_ON_HOLD));
1727 //update Hold button status
1728 SetHoldButtonStatus(false);
1732 //update Hold button status
1733 SetHoldButtonStatus(true);
1734 //current system time
1735 long long currTime = 0;
1736 //SystemTime::GetTicks(currTime);
1737 CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
1738 currTime = pPhoneApp->GetCallAppTicks();
1740 TimeSpan diffSpan(abs(startTime - currTime));
1742 String activeCallTime(L"");
1744 long long hr = diffSpan.GetHours();
1747 activeCallTime.Append("0");
1749 activeCallTime.Append(hr);
1750 activeCallTime.Append(L":");
1752 long long min = diffSpan.GetMinutes();
1755 activeCallTime.Append("0");
1757 activeCallTime.Append(min);
1758 activeCallTime.Append(L":");
1760 long long sec = diffSpan.GetSeconds();
1763 activeCallTime.Append("0");
1765 activeCallTime.Append(sec);
1767 pTimerLbl->SetText(activeCallTime);
1768 __pActiveCallTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
1770 pTimerLbl->Invalidate(true);
1775 ActiveCallForm::SetHoldButtonShowState(bool showState)
1777 Label* pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1778 if(pLblControl != null)
1780 pLblControl->SetShowState(showState);
1782 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1783 if(pButtonControl != null)
1785 pButtonControl->SetShowState(showState);
1790 ActiveCallForm::SetShowStateOnKeypad(bool showState)
1792 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1793 pLblControl->SetShowState(showState);
1794 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL));
1795 pLblControl->SetShowState(showState);
1796 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1797 pLblControl->SetShowState(showState);
1798 if (__pSmallPhotoLabel != null)
1800 __pSmallPhotoLabel->SetShowState(showState);
1805 case FORMTYPE_ACTIVECALL:
1807 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1808 pLblControl->SetShowState(showState);
1809 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1810 pLblControl->SetShowState(showState);
1811 SetHoldButtonShowState(showState);
1815 case FORMTYPE_MULTIPLECALLS:
1817 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1818 pLblControl->SetShowState(showState);
1819 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1820 pLblControl->SetShowState(showState);
1821 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1822 pLblControl->SetShowState(showState);
1823 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1824 pLblControl->SetShowState(showState);
1825 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1826 pLblControl->SetShowState(showState);
1827 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1828 pLblControl->SetShowState(showState);
1829 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == false)
1831 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1832 pLblControl->SetShowState(showState);
1836 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1837 pButtonControl->SetShowState(showState);
1839 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1840 pButtonControl->SetShowState(showState);
1844 case FORMTYPE_ACTIVECONFCALL:
1846 pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1847 pLblControl->SetShowState(showState);
1848 SetHoldButtonShowState(showState);
1849 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1850 pButtonControl->SetShowState(showState);
1860 ActiveCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1862 //Call default implementation of "Object.Equals()"
1863 //returns true, if they are pointing to same address.
1864 if (__pActiveCallTimer->Equals(timer))
1866 Label* pTimerLbl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1869 String activeCallTime = pTimerLbl->GetText();
1870 // Create a StringTokenizer instance
1871 StringTokenizer strTokens(activeCallTime, L":");
1873 int count = strTokens.GetTokenCount(); // count == 3
1878 for (int index = 0; index < count; index++)
1883 strTokens.GetNextToken(token);
1884 Integer::Parse(token, hr);
1888 strTokens.GetNextToken(token);
1889 Integer::Parse(token, min);
1893 strTokens.GetNextToken(token);
1894 Integer::Parse(token, sec);
1900 if (sec == IDI_MAX_SECONDS)
1905 if (min == IDI_MAX_MINS)
1912 activeCallTime.Clear();
1915 activeCallTime.Append("0");
1917 activeCallTime.Append(hr);
1918 activeCallTime.Append(":");
1921 activeCallTime.Append("0");
1923 activeCallTime.Append(min);
1924 activeCallTime.Append(":");
1927 activeCallTime.Append("0");
1929 activeCallTime.Append(sec);
1930 //update timer label
1931 pTimerLbl->SetText(activeCallTime);
1932 pTimerLbl->Invalidate(true);
1937 ///////////////////////////////////////////////////////////
1938 /////////// Options Menu List Functionality /////////
1939 ///////////////////////////////////////////////////////////
1941 ActiveCallForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
1946 ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
1948 //Goto conference call list form
1949 SceneManager* pSceneManager = SceneManager::GetInstance();
1950 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
1951 SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_KEEP), null);
1955 ActiveCallForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
1960 ActiveCallForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
1965 ActiveCallForm::GetItemCount(void)
1967 return IDI_MOREOPTIONS_LIST_ITEMS;
1971 ActiveCallForm::CreateItem(int index, int itemWidth)
1973 //create 1st Menu option
1974 CustomItem* pItem = new (std::nothrow) CustomItem();
1975 pItem->Construct(IDI_OPTIONMENU_DIMEN, LIST_ANNEX_STYLE_NORMAL);
1977 //Set background 9-patch bitmap to option menu
1978 Bitmap* pBgBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_BG_ICON);
1979 if (pBgBmp != null && pBgBmp->IsNinePatchedBitmap())
1982 bgCanvas.Construct(Rectangle(IDI_OPTIONMENU_POS, IDI_OPTIONMENU_DIMEN));
1983 bgCanvas.DrawNinePatchedBitmap(bgCanvas.GetBounds(), *pBgBmp);
1987 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color(40, 45, 48));
1992 //Set bitmap to option menu
1993 Bitmap* pNormalConfCallBmp = AppUtility::GetBitmapFromResourcesN(IDB_MORE_MANAGE_CONFERENCE_ICON ,
1994 W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP);
1995 pItem->AddElement(Rectangle(16, 17, W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP), 1, *pNormalConfCallBmp, null, null);
1996 // Deallocate bitmaps
1997 delete pNormalConfCallBmp;
1998 pNormalConfCallBmp = null;
2000 //Set text to menu option
2001 String confCallName = AppUtility::GetResourceString(IDS_MGR_CONF_CALL_LIST_STR);
2003 TextElement* pTextElement = new (std::nothrow) TextElement();
2004 pTextElement->Construct(confCallName);
2005 pTextElement->SetTextColor(COLOR_POPUP_TEXT);
2008 font.Construct(FONT_STYLE_PLAIN, IDI_POPUP_TEXT_SIZE);
2009 pTextElement->SetFont(font);
2010 //construct Enriched text
2011 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
2012 FloatDimension textDimension;
2013 font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
2014 textDimension.height = textDimension.height + font.GetDescender();
2015 pEnrichedText->Construct(textDimension);
2016 //add text element to enriched text
2017 pEnrichedText->Add(*pTextElement);
2019 //Add Enriched text to pItem
2020 FloatPoint textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
2021 pItem->AddElement(FloatRectangle(textPos, textDimension), 2, *pEnrichedText);
2023 pEnrichedText->RemoveAll(true);
2024 delete pEnrichedText;
2029 ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
2036 ActiveCallForm::OnForeground(void)
2038 AppLogDebug("Enter");
2039 __pCallPresentor->OnAppForeground();