2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file PhnActiveCallForm.cpp
19 * @brief Active Call Form class
26 #include "CallActiveCallForm.h"
27 #include "CallButtonsPanel.h"
29 #include "CallAppUtility.h"
30 #include "CallDtmfKeypadPanel.h"
31 #include "CallPresentationModel.h"
32 #include "CallSceneRegister.h"
33 #include "CallTypes.h"
36 using namespace Tizen::App;
37 using namespace Tizen::Base;
38 using namespace Tizen::Base::Collection;
39 using namespace Tizen::Base::Utility;
40 using namespace Tizen::Graphics;
41 using namespace Tizen::Media;
42 using namespace Tizen::Social;
43 using namespace Tizen::System;
44 using namespace Tizen::Ui;
45 using namespace Tizen::Ui::Controls;
46 using namespace Tizen::Ui::Scenes;
47 using namespace Tizen::Shell;
50 const int IDI_MAX_SECONDS = 60;
51 const int IDI_MAX_MINS = 60;
52 const int W_HOLD_BITMAP = 78;
53 const int H_HOLD_BITMAP = 78;
54 //for Options menu list
55 const int IDI_POPUP_TEXT_SIZE = 33;
56 const unsigned int COLOR_POPUP_TEXT = Color32<255, 255, 255, 255>::Value;
57 const int IDI_MOREOPTIONS_LIST_ITEMS = 1;
58 const int W_OPTION_ANCHOR = 72;
59 const int H_OPTION_ANCHOR = 22;
60 const int W_MGR_CONFCALL_BITMAP = 64;
61 const int H_MGR_CONFCALL_BITMAP = 64;
62 const int X_POPUP_ANCHOR = 632;
63 const int Y_POPUP_ANCHOR = 140;
64 const int W_POPUP_ANCHOR = 72;
65 const int H_POPUP_ANCHOR = 22;
66 const int IDI_OPTIONMENU_ITEM_SPACING = 16;
67 const Point IDI_OPTIONMENU_POS(238, 162);
68 const Dimension IDI_OPTIONMENU_DIMEN(466, 99);
69 const int X_PHOTO_LBL = 166;
70 const int Y_PHOTO_LBL = 232;
71 const int W_PHOTO_LBL = 388;
72 const int H_PHOTO_LBL = 388;
73 const int W_PHOTO_LABEL = 720;
74 const int H_PHOTO_LABEL = 720;
75 const int W_RIGHT_MORE_ICON_MARGIN = 24;
76 const int W_MORE_LABEL = 466;
77 const int H_MORE_LABEL = 162;
78 const int W_MORE_ICON = 70;
80 static const wchar_t* IDC_CONF_CALL_MORE_BUTTON = L"IDC_CONF_CALL_MORE_BUTTON";
81 static const wchar_t* IDC_HOLD_BUTTON = L"IDC_HOLD_BUTTON";
82 static const wchar_t* IDC_SWAP_BUTTON = L"IDC_SWAP_BUTTON";
83 static const wchar_t* IDC_HOLD_LABEL = L"IDC_HOLD_LABEL";
84 static const wchar_t* IDC_TEXTBOX = L"IDC_NUM_EDITFIELD";
85 static const wchar_t* IDC_CALLER1_LABEL = L"IDC_CALLER1_LABEL";
86 static const wchar_t* IDC_BACKGROUND_LABEL = L"IDC_BACKGROUND_LABEL";
87 static const wchar_t* IDC_CALLER1_TIME_LABEL = L"IDC_CALLER1_TIME_LABEL";
88 static const wchar_t* IDC_NUMBER1_LABEL = L"IDC_NUMBER1_LABEL";
89 static const wchar_t* IDC_VOICE_CALL_ICON_LABEL = L"IDC_VOICE_CALL_ICON_LABEL";
90 static const wchar_t* IDC_CALLER2_LABEL = L"IDC_CALLER2_LABEL";
91 static const wchar_t* IDC_NUMBER2_LABEL = L"IDC_NUMBER2_LABEL";
92 static const wchar_t* IDC_CALLER2_TIME_LABEL = L"IDC_CALLER2_TIME_LABEL";
93 static const wchar_t* IDC_SWAP_LABEL = L"IDC_SWAP_LABEL";
94 static const wchar_t* IDC_BACKGROUND_LABEL2 = L"IDC_BACKGROUND_LABEL2";
95 static const wchar_t* IDC_PARTICIPANTS_LABEL = L"IDC_PARTICIPANTS_LABEL";
96 static const wchar_t* IDC_CALLER1_BIGPHOTO_LABEL = L"IDC_CALLER1_BIGPHOTO_LABEL";
97 static const wchar_t* IDC_CALLER2_PHOTO_LABEL = L"IDC_CALLER2_PHOTO_LABEL";
98 static const wchar_t* IDC_CALLER1_PHOTO_LABEL = L"IDC_CALLER1_PHOTO_LABEL";
99 static const wchar_t* IDC_KEY_BG_LABEL = L"IDC_KEY_BG_LABEL";
101 ActiveCallForm::ActiveCallForm(FormType formType)
104 __pActiveCallTimer = null;
105 __pCallButtonsPanel = null;
106 __pDTMFKeypad = null;
107 __pMoreOptionsList = null;
108 __pMoreOptionsListAnchor = null;
109 __pSmallPhotoLabel = null;
110 __pActiveCallInfo = null;
111 __pHeldCallInfo = null;
114 ActiveCallForm::~ActiveCallForm(void)
116 if (__pActiveCallTimer != null)
118 __pActiveCallTimer->Cancel();
119 delete __pActiveCallTimer;
121 if (__pMoreOptionsList != null)
123 __pMoreOptionsList = null;
125 if (__pMoreOptionsListAnchor != null)
127 __pMoreOptionsListAnchor = null;
129 if (__pSmallPhotoLabel != null)
131 __pSmallPhotoLabel = null;
133 if (__pActiveCallInfo != null)
135 delete __pActiveCallInfo;
137 if (__pHeldCallInfo != null)
139 delete __pHeldCallInfo;
141 if(__pDTMFKeypad != null)
143 __pDTMFKeypad = null;
148 ActiveCallForm::Initialize(void)
152 case FORMTYPE_OUTGOINGCALL:
153 Construct(IDL_OUTCALL_FORM);
156 case FORMTYPE_EMERGENCYOUTGOINGCALL:
157 Construct(IDL_OUT_EMERGENCYCALL_FORM);
160 case FORMTYPE_ACTIVECALL:
161 Construct(IDL_CALL_FORM);
164 case FORMTYPE_EMERGENCYACTIVECALL:
165 Construct(IDL_EMERGENCY_CALL_FORM);
168 case FORMTYPE_MULTIPLECALLS:
169 Construct(IDL_MULTIPLE_CALL_FORM);
172 case FORMTYPE_ACTIVECONFCALL:
173 Construct(IDL_CONFCALL_FORM);
182 ActiveCallForm::OnInitializing(void)
184 result r = E_SUCCESS;
186 //Hold Button - Shown on single active/conf call scene
187 InitializeHoldButton();
188 //Swap button for multiple call screen
189 InitializeSwapButton();
190 //Initialize manage conf. call list form
191 InitializeManageConfCallButton();
193 __pCallPresentor = CallPresentationModel::GetInstance();
198 ActiveCallForm::ShowDTMFKeypad(void)
200 if(__pDTMFKeypad == null)
202 //update rect according to client screen area
203 Rectangle rect(0, 0, 0, 0);
204 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
206 rect.width = GetClientAreaBounds().width;
207 rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight();
209 else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
211 rect.height = GetClientAreaBounds().height;
212 rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth();
215 AppLog("DTMF Keypad rect(%d,%d,%d,%d)",rect.x,rect.y,rect.width,rect.height);
216 __pDTMFKeypad = new (std::nothrow) DtmfKeyPadPanel();
217 __pDTMFKeypad->Initialize(this, rect);
218 AddControl(*__pDTMFKeypad);
220 //set layout relation w.r.t call buttons panel
221 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
222 if (pRelativeLayout != null)
224 pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
225 pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
228 __pDTMFKeypad->SetShowState(true);
229 if(__DtmfString.IsEmpty() == false)
231 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
232 pTextBox->SetText(__DtmfString);
234 __pDTMFKeypad->Draw(true);
235 __pDTMFKeypad->Show();
239 ActiveCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
243 if (__pCallButtonsPanel != null)
245 //update position of call buttons panel
246 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
247 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
249 //bring button on top
250 __pCallButtonsPanel->SetButtonPosition();
252 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
253 if (pRelativeLayout != null)
255 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
258 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
259 if (pRelativeLayout != null)
261 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
262 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
265 //change orientation of DTMF Keypad, if it is visible.
266 if (__pDTMFKeypad != null)
268 if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
270 //in landscape mode, caller info is visible.
271 SetShowStateOnKeypad(true);
272 SetHoldButtonShowState(false);
274 else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
276 //in Portrait mode it is hidden beneath DTMF Keypad.
277 SetShowStateOnKeypad(false);
279 if(__pDTMFKeypad->GetShowState() == true)
281 String dtmfText = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
287 //More option is displayed recreate it
288 if(__pMoreOptionsListAnchor != null)
290 CreateMoreOptionsMenuList();
291 CreateMoreOptionsMenuList();
296 ActiveCallForm::HideDTMFKeypad(void)
298 if(__pDTMFKeypad != null)
300 __DtmfString = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
302 RemoveControl(*__pDTMFKeypad);
303 __pDTMFKeypad = null;
308 ActiveCallForm::InitializeCallButtonsPanel(void)
310 result r = E_SUCCESS;
311 //Set background bitmap for call keypad
312 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
313 Bitmap* pBgBitmap = AppUtility::GetBitmapFromResourcesN(IDB_BACKGROUND_BITMAP, pKeysBgLbl->GetWidth(), pKeysBgLbl->GetHeight());
314 if (pBgBitmap != null)
316 pKeysBgLbl->SetBackgroundBitmap(*pBgBitmap);
319 if (__pCallButtonsPanel == null)
321 __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
322 __pCallButtonsPanel->ConstructPanel(this, __formType);
323 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
324 r = AddControl(*__pCallButtonsPanel);
327 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
328 if (pRelativeLayout != null)
330 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
332 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
333 if (pRelativeLayout != null)
335 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
336 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
337 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
338 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_TOP_TO_TOP);
345 ActiveCallForm::InitializeSwapButton(void)
347 Button* pSwapBtn = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
350 Bitmap* pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_NORMAL,
351 W_HOLD_BITMAP, H_HOLD_BITMAP);
354 pSwapBtn->SetNormalBitmap(Point(0, 0), *pSwapBmp);
359 pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_PRESS,
360 W_HOLD_BITMAP, H_HOLD_BITMAP);
363 pSwapBtn->SetPressedBitmap(Point(0, 0), *pSwapBmp);
367 pSwapBtn->SetActionId(IDA_SWAP_CALLS);
368 pSwapBtn->AddActionEventListener(*this);
373 ActiveCallForm::InitializeManageConfCallButton(void)
375 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
376 if (pMoreBtn != null)
378 pMoreBtn->SetActionId(IDA_MORE_OPTIONS_MENU);
379 pMoreBtn->AddActionEventListener(*this);
380 if (__formType == FORMTYPE_MULTIPLECALLS)
382 //Correct state will be set in OnSceneActivated based on the call
383 pMoreBtn->SetShowState(false);
385 else if (__formType == FORMTYPE_ACTIVECONFCALL)
387 pMoreBtn->SetShowState(true);
393 ActiveCallForm::InitializeHoldButton(void)
395 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
396 if (pHoldBtn != null)
398 //set status of Hold Button
399 SetHoldButtonStatus(true);
400 pHoldBtn->AddActionEventListener(*this);
405 ActiveCallForm::SetHoldButtonStatus(bool toHoldCall)
407 //background bitmap & button name
409 Bitmap* normalImg = null;
410 Bitmap* pressImg = null;
413 btnName.Append(AppUtility::GetResourceString(IDS_HOLD_BTN_NAME));
414 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_NORMAL_BUTTON_ICON,
415 W_HOLD_BITMAP, H_HOLD_BITMAP);
416 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_PRESS_BUTTON_ICON,
417 W_HOLD_BITMAP, H_HOLD_BITMAP);
421 btnName.Append(AppUtility::GetResourceString(IDS_UNHOLD_BTN_NAME));
422 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_NORMAL_BUTTON_ICON,
423 W_HOLD_BITMAP, H_HOLD_BITMAP);
424 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_PRESS_BUTTON_ICON,
425 W_HOLD_BITMAP, H_HOLD_BITMAP);
429 CommandIds cmdId = IDA_HOLD_CALL;
432 case FORMTYPE_ACTIVECALL:
434 cmdId = toHoldCall ? IDA_HOLD_CALL : IDA_UNHOLD_CALL;
438 case FORMTYPE_ACTIVECONFCALL:
440 cmdId = toHoldCall ? IDA_HOLD_CONF_CALL : IDA_UNHOLD_CONF_CALL;
448 //set background bitmap, button name & action id
449 Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
450 Label* pHoldLbl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
453 pHoldBtn->SetActionId(cmdId);
454 pHoldBtn->SetNormalBitmap(Point(0, 0),*normalImg);
455 pHoldBtn->SetPressedBitmap(Point(0, 0),*pressImg);
459 pHoldLbl->SetText(btnName);
460 pHoldLbl->Invalidate(true);
471 ActiveCallForm::CreateMoreOptionsMenuList(void)
473 //create option list anchor
474 if (__pMoreOptionsListAnchor == null)
476 Bitmap* pBgPopupArwBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_ARROW_ICON, W_OPTION_ANCHOR,
478 __pMoreOptionsListAnchor = new (std::nothrow) Label();
479 __pMoreOptionsListAnchor->Construct(Rectangle(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_ICON, Y_POPUP_ANCHOR, W_POPUP_ANCHOR, H_POPUP_ANCHOR), L"");
480 __pMoreOptionsListAnchor->SetBackgroundBitmap(*pBgPopupArwBmp);
482 delete pBgPopupArwBmp;
483 pBgPopupArwBmp = null;
485 // Adds a Label to the Form
486 AddControl(*__pMoreOptionsListAnchor);
489 //create options menu list
490 if (__pMoreOptionsList == null)
492 __pMoreOptionsList = new (std::nothrow) ListView();
493 __pMoreOptionsList->Construct(Rectangle(Point(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_LABEL,H_MORE_LABEL), IDI_OPTIONMENU_DIMEN), false, SCROLL_STYLE_FADE_OUT);
494 __pMoreOptionsList->SetItemProvider(*this);
495 __pMoreOptionsList->AddListViewItemEventListener(*this);
496 //Add option list to the form
497 AddControl(*__pMoreOptionsList);
501 //Hide option menu list
502 DestroyMoreOptionsMenuList();
507 ActiveCallForm::DestroyMoreOptionsMenuList(void)
509 if (__pMoreOptionsListAnchor != null)
511 //removes and delete the child control
512 RemoveControl(*__pMoreOptionsListAnchor);
513 __pMoreOptionsListAnchor = null;
516 if (__pMoreOptionsList != null)
518 //removes and delete the child control
519 RemoveControl(*__pMoreOptionsList);
520 __pMoreOptionsList = null;
525 ActiveCallForm::OnTerminating(void)
527 result r = E_SUCCESS;
528 if (__pCallPresentor != null)
530 __pCallPresentor = null;
536 ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
544 //End the currently active / dialing call
545 if (__pActiveCallInfo->IsConferenceCall() == false)
547 String activeContactNo;
548 activeContactNo.Append(__pActiveCallInfo->GetContactNumber());
549 //Check if it is call is in dialing state, then
550 if (__formType == FORMTYPE_EMERGENCYOUTGOINGCALL || __formType == FORMTYPE_OUTGOINGCALL)
552 __pCallPresentor->EndDialingCall(activeContactNo);
557 __pCallPresentor->EndActiveCall(*__pActiveCallInfo->GetCallHandle());
562 __pCallPresentor->EndConferenceCall();
567 case IDA_END_CONF_CALL:
569 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
570 __pCallPresentor->EndConferenceCall();
574 case IDA_OPEN_NUMKEYPAD:
576 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
578 //hide only in portrait mode.
579 SetShowStateOnKeypad(false);
581 //Hide the hold button as it goes behind DTMF keypad
582 SetHoldButtonShowState(false);
584 __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
588 case IDA_CLOSE_NUMKEYPAD:
590 SetShowStateOnKeypad(true);
592 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
598 //switch to Dialer Form to make an call
599 if(__pCallPresentor->GetCurrentCallCount() == 1)
601 __pCallPresentor->LaunchDialAppControl();
609 if (__pActiveCallInfo->IsConferenceCall() == false)
611 if(__pActiveCallInfo->GetCallHandle() != null)
613 success = __pCallPresentor->HoldCall(*__pActiveCallInfo->GetCallHandle());
618 success = __pCallPresentor->HoldConferenceCall();
620 //reset hold status and "OnHold" text
621 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
622 if(__pActiveCallTimer != null)
624 __pActiveCallTimer->Cancel();
626 SetHoldButtonStatus(!success);
630 case IDA_UNHOLD_CALL:
632 bool success = false;
633 if (__pActiveCallInfo->IsConferenceCall() == false)
635 if(__pActiveCallInfo->GetCallHandle() != null)
637 success = __pCallPresentor->UnHoldCall(*__pActiveCallInfo->GetCallHandle());
642 success = __pCallPresentor->ActivateConferenceCall();
644 //reset hold status and show call timer
645 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
646 SetHoldButtonStatus(success);
650 case IDA_HOLD_CONF_CALL:
652 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
653 bool success = __pCallPresentor->HoldConferenceCall();
654 //reset hold status and "OnHold" text
655 SetHoldButtonStatus(!success);
656 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
657 if(__pActiveCallTimer != null)
659 __pActiveCallTimer->Cancel();
664 case IDA_UNHOLD_CONF_CALL:
666 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
667 bool success = __pCallPresentor->ActivateConferenceCall();
668 //reset hold status and show call timer
669 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
670 SetHoldButtonStatus(success);
674 case IDA_OPEN_CONTACTS:
677 //Launch call application
678 AppManager* pAppManager = AppManager::GetInstance();
679 pAppManager->LaunchApplication(PROVIDER_ID_CONTACTS);
685 bool success = __pCallPresentor->SetMuteStatus(true);
688 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
695 bool success = __pCallPresentor->SetMuteStatus(false);
698 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
705 bool success = __pCallPresentor->SetSpeakerStatus(true);
708 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
713 case IDA_SPEAKER_OFF:
715 bool success = __pCallPresentor->SetSpeakerStatus(false);
718 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
725 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
726 __pCallPresentor->JoinCall();
732 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
733 __pCallPresentor->SwapCalls();
737 case IDA_MORE_OPTIONS_MENU:
739 //Show 'more' options menu
740 CreateMoreOptionsMenuList();
746 dtmfString.Append(L"0");
747 SetTextToDTMFTextField(dtmfString);
748 __pCallPresentor->SendDTMFSignal(dtmfString);
754 dtmfString.Append(L"1");
755 SetTextToDTMFTextField(dtmfString);
756 __pCallPresentor->SendDTMFSignal(dtmfString);
762 dtmfString.Append(L"2");
763 SetTextToDTMFTextField(dtmfString);
764 __pCallPresentor->SendDTMFSignal(dtmfString);
770 dtmfString.Append(L"3");
771 SetTextToDTMFTextField(dtmfString);
772 __pCallPresentor->SendDTMFSignal(dtmfString);
778 dtmfString.Append(L"4");
779 SetTextToDTMFTextField(dtmfString);
780 __pCallPresentor->SendDTMFSignal(dtmfString);
786 dtmfString.Append(L"5");
787 SetTextToDTMFTextField(dtmfString);
788 __pCallPresentor->SendDTMFSignal(dtmfString);
794 dtmfString.Append(L"6");
795 SetTextToDTMFTextField(dtmfString);
796 __pCallPresentor->SendDTMFSignal(dtmfString);
802 dtmfString.Append(L"7");
803 SetTextToDTMFTextField(dtmfString);
804 __pCallPresentor->SendDTMFSignal(dtmfString);
810 dtmfString.Append(L"8");
811 SetTextToDTMFTextField(dtmfString);
812 __pCallPresentor->SendDTMFSignal(dtmfString);
818 dtmfString.Append(L"9");
819 SetTextToDTMFTextField(dtmfString);
820 __pCallPresentor->SendDTMFSignal(dtmfString);
826 dtmfString.Append(L"*");
827 SetTextToDTMFTextField(dtmfString);
828 __pCallPresentor->SendDTMFSignal(dtmfString);
834 dtmfString.Append(L"#");
835 SetTextToDTMFTextField(dtmfString);
836 __pCallPresentor->SendDTMFSignal(dtmfString);
846 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
848 if(__pDTMFKeypad != null)
850 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
852 int startpos=-1,endpos=-1;
853 pTextBox->GetBlockRange(startpos,endpos);
857 pTextBox->ReleaseBlock();
860 pTextBox->InsertTextAtCursorPosition(dtmfStr);
861 //pTextBox->AppendText(dtmfStr);
862 pTextBox->SetFocus();
863 pTextBox->Invalidate(true);
868 ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
871 //set itself as listener
872 __pCallPresentor->SetTelEventListener(this);
873 AddOrientationEventListener(*this);
875 CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
876 pPhoneApp->AddAppStateChangeListener(*this);
878 //Initialize keypad and buttons
879 InitializeCallButtonsPanel();
881 if (__pActiveCallInfo != null)
883 delete __pActiveCallInfo;
884 __pActiveCallInfo = null;
886 if (__pHeldCallInfo != null)
888 delete __pHeldCallInfo;
889 __pHeldCallInfo = null;
891 DestroyMoreOptionsMenuList();
895 case FORMTYPE_OUTGOINGCALL:
898 contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
899 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
900 __pActiveCallInfo->SetContactNumber(contactNo);
901 Contact* pContact = __pCallPresentor->GetContactN(contactNo);
902 if (pContact != null)
904 __pActiveCallInfo->SetContactInfo(*pContact);
907 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
908 //make an normal outgoing call
909 __pCallPresentor->DialCall(contactNo, false);
913 case FORMTYPE_EMERGENCYOUTGOINGCALL:
915 String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
916 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
917 long long phNumber = 0;
918 LongLong::Parse(*pContactNo, phNumber);
919 __pActiveCallInfo->SetContactNumber(*pContactNo);
920 //make an emergency call
921 __pCallPresentor->DialCall(*pContactNo, true);
925 case FORMTYPE_ACTIVECALL:
928 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
930 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
931 *__pActiveCallInfo = *pCall;
932 String activeContactNo;
933 if(pCall->GetContactNumber().IsEmpty() == false)
935 activeContactNo.Append(pCall->GetContactNumber());
939 activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
941 ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
943 //show call active time using Timer
944 __activeCallStartTime = pCall->GetCallConnectTime();
945 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
949 case FORMTYPE_EMERGENCYACTIVECALL:
952 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
954 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
955 *__pActiveCallInfo = *pCall;
957 //show call active time using Timer
958 __activeCallStartTime = pCall->GetCallConnectTime();
959 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
963 case FORMTYPE_MULTIPLECALLS:
965 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
967 UpdateMultipleCallScreen(*pCallsList);
973 case FORMTYPE_ACTIVECONFCALL:
976 AppCallInfo* pConfInfo = static_cast<AppCallInfo*>(pArgs->GetAt(0));
977 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
978 *__pActiveCallInfo = *pConfInfo;
980 int participantsCount = __pActiveCallInfo->GetCallerListCount();
982 // show participant count on name Label
983 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
987 count.Append(participantsCount);
989 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
990 pPeopleCountLbl->SetText(count);
993 if(participantsCount >= IDI_MAX_CONF_CALL_PARTICIPANTS)
995 __pCallButtonsPanel->EnableAddCallButton(false);
999 __pCallButtonsPanel->EnableAddCallButton(true);
1002 //show call active time using Timer
1003 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1004 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime);
1012 if(__formType == FORMTYPE_ACTIVECALL || __formType == FORMTYPE_EMERGENCYACTIVECALL ||
1013 __formType == FORMTYPE_MULTIPLECALLS || __formType == FORMTYPE_ACTIVECONFCALL)
1015 //Unlock the phone if its locked
1016 if(LockManager::GetInstance()->IsLocked())
1018 AppLogDebug("Phone Locked");
1019 LockManager::GetInstance()->Unlock();
1023 //Hide DTMFKeypad, if visible and show caller info
1025 SetShowStateOnKeypad(true);
1026 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
1028 //Set the correct speaker status
1029 if(__pCallPresentor->IsSpeakerOn() == true)
1031 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
1035 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
1038 //Set the correct Mute status
1039 if (__pCallPresentor->IsCallMuted() == true)
1041 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
1045 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
1055 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1056 pCallApp->SetTopMostWindow(false);
1060 ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1062 RemoveOrientationEventListener(*this);
1063 if (__pCallButtonsPanel != null)
1065 RemoveControl(*__pCallButtonsPanel);
1066 __pCallButtonsPanel = null;
1068 if (__pActiveCallTimer != null)
1070 __pActiveCallTimer->Cancel();
1071 delete __pActiveCallTimer;
1072 __pActiveCallTimer = null;
1074 if (__pSmallPhotoLabel != null)
1076 __pSmallPhotoLabel->SetShowState(false);
1078 //Hide "Manage conf. Call" Context menu
1079 if (__pMoreOptionsListAnchor != null)
1081 __pMoreOptionsListAnchor->SetShowState(false);
1083 if (__pMoreOptionsList != null)
1085 __pMoreOptionsList->SetShowState(false);
1087 __DtmfString.Clear();
1088 CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1089 pCallApp->RemoveAppStateChangeListener(*this);
1093 ActiveCallForm::HandleConfCallChanged(void)
1096 AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
1097 //fetch changed conference call info
1098 AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1099 if (pConfCallInfo == null)
1105 //fetch participant count in conf call
1106 int participantsCount = pConfCallInfo->GetCallerListCount();
1107 //update status of join and Add call
1108 bool isEnableAddCall = false;
1109 bool isEnableJoinCall = false;
1110 if(participantsCount < IDI_MAX_CONF_CALL_PARTICIPANTS)
1112 //available only at Active conf. call or active call screen
1113 isEnableAddCall = true;
1114 //join button is available only at multiple call screen
1115 isEnableJoinCall = true;
1118 Label* pPeopleCountLbl = null;
1119 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == true)
1121 //Active call is conference call
1122 delete __pActiveCallInfo;
1123 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1124 *__pActiveCallInfo = *pConfCallInfo;
1126 if (__formType == FORMTYPE_MULTIPLECALLS)
1128 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1130 else if (__formType == FORMTYPE_ACTIVECONFCALL)
1132 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1133 AppLog("Active conf call...(%d)", pPeopleCountLbl);
1136 else if(__pHeldCallInfo != null && __pHeldCallInfo->IsConferenceCall() == true)
1138 //Held call is conference call - this is definitely multiple call screen.
1139 delete __pHeldCallInfo;
1140 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1141 *__pHeldCallInfo = *pConfCallInfo;
1142 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1145 // update participant count on name Label
1146 if (pPeopleCountLbl != null)
1149 count.Append(participantsCount);
1151 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1152 pPeopleCountLbl->SetText(count);
1153 pPeopleCountLbl->Invalidate(true);
1155 //change AddCall Button status
1156 __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
1157 //change JoinCall Button status
1158 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1163 ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
1166 if(__pActiveCallInfo != null)
1168 delete __pActiveCallInfo;
1169 __pActiveCallInfo = null;
1171 if(__pHeldCallInfo != null)
1173 delete __pHeldCallInfo;
1174 __pHeldCallInfo = null;
1177 Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1178 if (pMoreBtn != null)
1180 pMoreBtn->SetShowState(false);
1183 //show caller's info.
1184 for (int index = 0; index < activeCallsList.GetCount(); index++)
1187 AppCallInfo callInfo;
1188 activeCallsList.GetAt(index, callInfo);
1191 if(callInfo.GetContactNumber().IsEmpty() == false)
1193 contactNo.Append(callInfo.GetContactNumber());
1197 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1200 if (callInfo.IsOnHold() == false)
1202 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1203 *__pActiveCallInfo = callInfo;
1205 if (__pActiveCallInfo->IsConferenceCall() == false)
1207 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1210 pVoiceIconLbl->SetShowState(true);
1212 if (pMoreBtn != null)
1214 pMoreBtn->SetShowState(false);
1216 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1217 if(__pMoreOptionsListAnchor != null && __pMoreOptionsListAnchor->GetShowState() == true)
1219 CreateMoreOptionsMenuList();
1224 // show participant count on name Label
1225 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1226 if (pPeopleCountLbl)
1229 count.Append(__pActiveCallInfo->GetCallerListCount());
1231 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1232 pPeopleCountLbl->SetText(count);
1234 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1235 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1238 pNameLbl->SetText(nameStr);
1240 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1243 pVoiceIconLbl->SetShowState(false);
1245 if (pMoreBtn != null)
1247 pMoreBtn->SetShowState(true);
1249 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1250 if (pPhotoBitmap != null)
1252 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER1_PHOTO_LABEL));
1255 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1256 pPhotoLbl->Invalidate(true);
1258 delete pPhotoBitmap;
1261 //show call active time using Timer
1262 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1263 ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime);
1267 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1268 *__pHeldCallInfo = callInfo;
1270 if (__pHeldCallInfo->IsConferenceCall() == false)
1272 ShowPersonDetails(contactNo, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pHeldCallInfo);
1276 // show participant count on name Label
1277 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1278 if (pPeopleCountLbl)
1281 count.Append(__pHeldCallInfo->GetCallerListCount());
1283 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1284 pPeopleCountLbl->SetText(count);
1286 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1287 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1290 pNameLbl->SetText(nameStr);
1292 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1293 if (pPhotoBitmap != null)
1295 Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER2_PHOTO_LABEL));
1298 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1299 pPhotoLbl->Invalidate(true);
1301 delete pPhotoBitmap;
1305 ShowTimerInfo(IDC_CALLER2_TIME_LABEL, true);
1309 //update JoinCall button status
1310 __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1316 ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
1318 //call individual methods to show contact number, caller name & photo
1319 ShowPhoneNumber(phoneNumber, contactLblName);
1321 //fetch contact details based on phone number
1322 String* pDisplayName = pCallInfo->FetchCallerNameN();
1323 ShowCallerName(*pDisplayName, nameLblName);
1325 Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1326 ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
1331 delete pDisplayName;
1332 pDisplayName = null;
1336 delete pPhotoBitmap;
1337 pPhotoBitmap = null;
1342 ActiveCallForm::ShowPhoneNumber(const String& phoneNumber, const String& contactLblName)
1344 String formattedNumber = phoneNumber;
1346 Label* pContactLbl = static_cast<Label*>(GetControl(contactLblName));
1349 pContactLbl->SetText(formattedNumber);
1350 pContactLbl->Invalidate(true);
1355 ActiveCallForm::ShowCallerName(const String& callerName, const String& nameLblName)
1357 // show display name on name Label
1358 Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
1361 //passing an empty string to SetText fails in label,
1362 //if previously valid text has been set
1363 if (callerName.IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
1365 String stringToBeSet(L" ");
1366 pNameLbl->SetText(stringToBeSet);
1370 pNameLbl->SetText(callerName);
1372 pNameLbl->Invalidate(true);
1377 ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
1379 //to check if default image is to be shown
1380 bool showDefaultPhoto = false;
1381 bool showSmallPhoto = false;
1382 String photoLabel("");
1386 case FORMTYPE_OUTGOINGCALL:
1387 case FORMTYPE_ACTIVECALL:
1389 if (pPhotoId == null)
1391 //show default caller image
1392 showDefaultPhoto = true;
1396 //Check the size of photo
1397 // Now checking the condition with && but actually it should be ||
1398 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1399 // height 270 and width = 480 . So all images set thru gallery is show as small image
1400 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1401 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1403 showSmallPhoto = true;
1407 photoLabel.Append(IDC_CALLER1_BIGPHOTO_LABEL);
1411 case FORMTYPE_MULTIPLECALLS:
1415 photoLabel.Append(IDC_CALLER2_PHOTO_LABEL);
1419 photoLabel.Append(IDC_CALLER1_PHOTO_LABEL);
1422 if (pPhotoId == null)
1424 showDefaultPhoto = true;
1428 if (pPhotoId->GetHeight() <= H_SMALL_PHOTO
1429 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1431 //pPhotoId->Scale(Dimension(W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO));
1432 showSmallPhoto = true;
1442 //Remove small photo label
1443 if (__pSmallPhotoLabel != null)
1445 RemoveControl(*__pSmallPhotoLabel);
1446 __pSmallPhotoLabel = null;
1449 //show photo - for Big Photo Id, Animated Call Image
1450 if (!showDefaultPhoto)
1452 if(showSmallPhoto == true)
1454 ShowThumbnailImage(pPhotoId,photoLabel);
1458 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1461 Canvas* pCanvas = new (std::nothrow) Canvas;
1462 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1463 pCanvas->Construct(canvasRect);
1464 //draw the contact bitmap
1465 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1466 Bitmap* pNewPhotoId = new Bitmap();
1467 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1470 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1471 pPhotoLbl->Invalidate(true);
1478 Bitmap* pDefaultPhoto = null;
1481 case FORMTYPE_OUTGOINGCALL:
1482 case FORMTYPE_ACTIVECALL:
1483 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1486 case FORMTYPE_MULTIPLECALLS:
1487 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_MULTIPLE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1490 case FORMTYPE_ACTIVECONFCALL:
1491 pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BIG_BG_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1497 if (pDefaultPhoto != null)
1499 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1502 pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
1504 delete pDefaultPhoto;
1510 ActiveCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,String& photoLabel)
1512 Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1514 if (pPhotoLbl != null && pPhotoId != null)
1516 Canvas* pCanvas = new (std::nothrow) Canvas;
1517 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1518 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1519 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1520 pCanvas->Construct(canvasRect);
1521 //draw the back ground
1522 pCanvas->DrawBitmap(canvasRect,*pBackground);
1523 //draw shadow (to be enabled after correct shadow image is provided )
1524 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1525 // (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1526 //draw the contact bitmap
1527 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1528 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1529 Bitmap* pNewPhotoId = new Bitmap();
1530 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1533 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1534 pPhotoLbl->Invalidate(true);
1543 ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1545 if (__pSmallPhotoLabel != null)
1547 RemoveControl(*__pSmallPhotoLabel);
1548 __pSmallPhotoLabel = null;
1550 //Draw Small Photo and show on small photo label
1551 __pSmallPhotoLabel = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1552 __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1553 __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1554 __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1555 // Add a Label to the Form
1556 AddControl(*__pSmallPhotoLabel);
1557 __pSmallPhotoLabel->Invalidate(true);
1561 ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long long startTime)
1563 Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1565 if (__pActiveCallTimer == null)
1567 __pActiveCallTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
1568 __pActiveCallTimer->Construct(*this);
1571 if (pTimerLbl != null)
1573 if (isOnHold == true)
1575 pTimerLbl->SetText(AppUtility::GetResourceString(IDS_TIMER_ON_HOLD));
1576 //update Hold button status
1577 SetHoldButtonStatus(false);
1581 //update Hold button status
1582 SetHoldButtonStatus(true);
1583 //current system time
1584 long long currTime = 0;
1585 SystemTime::GetTicks(currTime);
1587 TimeSpan diffSpan(abs(startTime - currTime));
1589 String activeCallTime(L"");
1591 long long hr = diffSpan.GetHours();
1594 activeCallTime.Append("0");
1596 activeCallTime.Append(hr);
1597 activeCallTime.Append(L":");
1599 long long min = diffSpan.GetMinutes();
1602 activeCallTime.Append("0");
1604 activeCallTime.Append(min);
1605 activeCallTime.Append(L":");
1607 long long sec = diffSpan.GetSeconds();
1610 activeCallTime.Append("0");
1612 activeCallTime.Append(sec);
1614 pTimerLbl->SetText(activeCallTime);
1615 __pActiveCallTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
1617 pTimerLbl->Invalidate(true);
1622 ActiveCallForm::SetHoldButtonShowState(bool showState)
1624 Label* pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1625 pLblControl->SetShowState(showState);
1626 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1627 pButtonControl->SetShowState(showState);
1631 ActiveCallForm::SetShowStateOnKeypad(bool showState)
1633 Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1634 pLblControl->SetShowState(showState);
1635 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL));
1636 pLblControl->SetShowState(showState);
1637 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1638 pLblControl->SetShowState(showState);
1639 if (__pSmallPhotoLabel != null)
1641 __pSmallPhotoLabel->SetShowState(showState);
1646 case FORMTYPE_ACTIVECALL:
1648 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1649 pLblControl->SetShowState(showState);
1650 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1651 pLblControl->SetShowState(showState);
1652 SetHoldButtonShowState(showState);
1656 case FORMTYPE_MULTIPLECALLS:
1658 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1659 pLblControl->SetShowState(showState);
1660 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1661 pLblControl->SetShowState(showState);
1662 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1663 pLblControl->SetShowState(showState);
1664 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1665 pLblControl->SetShowState(showState);
1666 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1667 pLblControl->SetShowState(showState);
1668 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1669 pLblControl->SetShowState(showState);
1670 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == false)
1672 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1673 pLblControl->SetShowState(showState);
1677 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1678 pButtonControl->SetShowState(showState);
1680 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1681 pButtonControl->SetShowState(showState);
1685 case FORMTYPE_ACTIVECONFCALL:
1687 pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1688 pLblControl->SetShowState(showState);
1689 SetHoldButtonShowState(showState);
1690 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1691 pButtonControl->SetShowState(showState);
1701 ActiveCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1703 //Call default implementation of "Object.Equals()"
1704 //returns true, if they are pointing to same address.
1705 if (__pActiveCallTimer->Equals(timer))
1707 Label* pTimerLbl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1710 String activeCallTime = pTimerLbl->GetText();
1711 // Create a StringTokenizer instance
1712 StringTokenizer strTokens(activeCallTime, L":");
1714 int count = strTokens.GetTokenCount(); // count == 3
1719 for (int index = 0; index < count; index++)
1724 strTokens.GetNextToken(token);
1725 Integer::Parse(token, hr);
1729 strTokens.GetNextToken(token);
1730 Integer::Parse(token, min);
1734 strTokens.GetNextToken(token);
1735 Integer::Parse(token, sec);
1741 if (sec == IDI_MAX_SECONDS)
1746 if (min == IDI_MAX_MINS)
1753 activeCallTime.Clear();
1756 activeCallTime.Append("0");
1758 activeCallTime.Append(hr);
1759 activeCallTime.Append(":");
1762 activeCallTime.Append("0");
1764 activeCallTime.Append(min);
1765 activeCallTime.Append(":");
1768 activeCallTime.Append("0");
1770 activeCallTime.Append(sec);
1771 //update timer label
1772 pTimerLbl->SetText(activeCallTime);
1773 pTimerLbl->Invalidate(true);
1778 ///////////////////////////////////////////////////////////
1779 /////////// Options Menu List Functionality /////////
1780 ///////////////////////////////////////////////////////////
1782 ActiveCallForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
1787 ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
1789 //Goto conference call list form
1790 SceneManager* pSceneManager = SceneManager::GetInstance();
1791 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST), null);
1795 ActiveCallForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
1800 ActiveCallForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
1805 ActiveCallForm::GetItemCount(void)
1807 return IDI_MOREOPTIONS_LIST_ITEMS;
1811 ActiveCallForm::CreateItem(int index, int itemWidth)
1813 //create 1st Menu option
1814 CustomItem* pItem = new (std::nothrow) CustomItem();
1815 pItem->Construct(IDI_OPTIONMENU_DIMEN, LIST_ANNEX_STYLE_NORMAL);
1817 //Set background 9-patch bitmap to option menu
1818 Bitmap* pBgBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_BG_ICON);
1819 if (pBgBmp != null && pBgBmp->IsNinePatchedBitmap())
1822 bgCanvas.Construct(Rectangle(IDI_OPTIONMENU_POS, IDI_OPTIONMENU_DIMEN));
1823 bgCanvas.DrawNinePatchedBitmap(bgCanvas.GetBounds(), *pBgBmp);
1827 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color(40, 45, 48));
1832 //Set bitmap to option menu
1833 Bitmap* pNormalConfCallBmp = AppUtility::GetBitmapFromResourcesN(IDB_MORE_MANAGE_CONFERENCE_ICON ,
1834 W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP);
1835 pItem->AddElement(Rectangle(16, 17, W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP), 1, *pNormalConfCallBmp, null, null);
1836 // Deallocate bitmaps
1837 delete pNormalConfCallBmp;
1838 pNormalConfCallBmp = null;
1840 //Set text to menu option
1841 String confCallName = AppUtility::GetResourceString(IDS_MGR_CONF_CALL_LIST_STR);
1843 TextElement* pTextElement = new (std::nothrow) TextElement();
1844 pTextElement->Construct(confCallName);
1845 pTextElement->SetTextColor(COLOR_POPUP_TEXT);
1848 font.Construct(FONT_STYLE_PLAIN, IDI_POPUP_TEXT_SIZE);
1849 pTextElement->SetFont(font);
1850 //construct Enriched text
1851 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1852 FloatDimension textDimension;
1853 font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
1854 textDimension.height = textDimension.height + font.GetDescender();
1855 pEnrichedText->Construct(textDimension);
1856 //add text element to enriched text
1857 pEnrichedText->Add(*pTextElement);
1859 //Add Enriched text to pItem
1860 FloatPoint textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
1861 pItem->AddElement(FloatRectangle(textPos, textDimension), 2, *pEnrichedText);
1863 pEnrichedText->RemoveAll(true);
1864 delete pEnrichedText;
1869 ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
1876 ActiveCallForm::OnForeground(void)
1878 AppLogDebug("Enter");
1879 __pCallPresentor->OnAppForeground();