5e40ede828e4d312dc856efe27e43dda8322eec2
[apps/osp/Call.git] / src / CallActiveCallForm.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 /**
18  * @file        PhnActiveCallForm.cpp
19  * @brief       Active Call Form class
20  */
21 #include <FApp.h>
22 #include <FUi.h>
23 #include <FMedia.h>
24 #include <FSystem.h>
25 #include <FShell.h>
26 #include "CallActiveCallForm.h"
27 #include "CallButtonsPanel.h"
28 #include "CallInfo.h"
29 #include "CallAppUtility.h"
30 #include "CallDtmfKeypadPanel.h"
31 #include "CallPresentationModel.h"
32 #include "CallSceneRegister.h"
33 #include "CallTypes.h"
34 #include "CallApp.h"
35
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;
48
49 //constants
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;
79
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";
100
101 ActiveCallForm::ActiveCallForm(FormType formType)
102         : BaseForm(formType)
103 {
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 }
114
115 ActiveCallForm::~ActiveCallForm(void)
116 {
117         if (__pActiveCallTimer != null)
118         {
119                 __pActiveCallTimer->Cancel();
120                 delete __pActiveCallTimer;
121         }
122         if (__pMoreOptionsList != null)
123         {
124                 __pMoreOptionsList = null;
125         }
126         if (__pMoreOptionsListAnchor != null)
127         {
128                 __pMoreOptionsListAnchor = null;
129         }
130         if (__pSmallPhotoLabel != null)
131         {
132                 __pSmallPhotoLabel = null;
133         }
134         if (__pActiveCallInfo != null)
135         {
136                 delete __pActiveCallInfo;
137         }
138         if (__pHeldCallInfo != null)
139         {
140                 delete __pHeldCallInfo;
141         }
142         if(__pDTMFKeypad != null)
143         {
144                 __pDTMFKeypad = null;
145         }
146 }
147
148 void
149 ActiveCallForm::Initialize(void)
150 {
151         switch (__formType)
152         {
153         case FORMTYPE_OUTGOINGCALL:
154                 Construct(IDL_OUTCALL_FORM);
155                 break;
156
157         case FORMTYPE_EMERGENCYOUTGOINGCALL:
158                 Construct(IDL_OUT_EMERGENCYCALL_FORM);
159                 break;
160
161         case FORMTYPE_ACTIVECALL:
162                 Construct(IDL_CALL_FORM);
163                 break;
164
165         case FORMTYPE_EMERGENCYACTIVECALL:
166                 Construct(IDL_EMERGENCY_CALL_FORM);
167                 break;
168
169         case FORMTYPE_MULTIPLECALLS:
170                 Construct(IDL_MULTIPLE_CALL_FORM);
171                 break;
172
173         case FORMTYPE_ACTIVECONFCALL:
174                 Construct(IDL_CONFCALL_FORM);
175                 break;
176
177         default:
178                 break;
179         }
180 }
181
182 result
183 ActiveCallForm::OnInitializing(void)
184 {
185         result r = E_SUCCESS;
186
187         //Hold Button - Shown on single active/conf call scene
188         InitializeHoldButton();
189         //Swap button for multiple call screen
190         InitializeSwapButton();
191         //Initialize manage conf. call list form
192         InitializeManageConfCallButton();
193
194         __pCallPresentor = CallPresentationModel::GetInstance();
195         return r;
196 }
197
198 void
199 ActiveCallForm::ShowDTMFKeypad(void)
200 {
201         if(__pDTMFKeypad == null)
202         {
203                 //update rect according to client screen area
204                 Rectangle rect(0, 0, 0, 0);
205                 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
206                 {
207                         rect.width = GetClientAreaBounds().width;
208                         rect.height = GetClientAreaBounds().height - __pCallButtonsPanel->GetHeight();
209                 }
210                 else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
211                 {
212                         rect.height = GetClientAreaBounds().height;
213                         rect.width = GetClientAreaBounds().width - __pCallButtonsPanel->GetWidth();
214                 }
215
216                 AppLog("DTMF Keypad rect(%d,%d,%d,%d)",rect.x,rect.y,rect.width,rect.height);
217                 __pDTMFKeypad = new (std::nothrow) DtmfKeyPadPanel();
218                 __pDTMFKeypad->Initialize(this, rect);
219                 AddControl(__pDTMFKeypad);
220
221                 //set layout relation w.r.t call buttons panel
222                 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
223                 if (pRelativeLayout != null)
224                 {
225                         pRelativeLayout->SetRelation(*__pDTMFKeypad, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
226                         pRelativeLayout->SetRelation(*__pDTMFKeypad, __pCallButtonsPanel, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
227                 }
228         }
229         __pDTMFKeypad->SetShowState(true);
230         if(__DtmfString.IsEmpty() == false)
231         {
232                 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
233                 pTextBox->SetText(__DtmfString);
234         }
235         __pDTMFKeypad->Draw(true);
236         __pDTMFKeypad->Show();
237 }
238
239 void
240 ActiveCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
241 {
242         AppLog("ENTER");
243
244         if (__pCallButtonsPanel != null)
245         {
246                 //update position of call buttons panel
247                 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
248                 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
249
250                 //bring button on top
251                 __pCallButtonsPanel->SetButtonPosition();
252
253                 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
254                 if (pRelativeLayout != null)
255                 {
256                         pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
257                 }
258
259                 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
260                 if (pRelativeLayout != null)
261                 {
262                         pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
263                         pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
264                 }
265
266                 //change orientation of DTMF Keypad, if it is visible.
267                 if (__pDTMFKeypad != null)
268                 {
269                         if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
270                         {
271                                 //in landscape mode, caller info is visible.
272                                 SetShowStateOnKeypad(true);
273                                 SetHoldButtonShowState(false);
274                         }
275                         else if (orientationStatus == ORIENTATION_STATUS_PORTRAIT || orientationStatus == ORIENTATION_STATUS_PORTRAIT_REVERSE)
276                         {
277                                 //in Portrait mode it is hidden beneath DTMF Keypad.
278                                 SetShowStateOnKeypad(false);
279                         }
280                         if(__pDTMFKeypad->GetShowState() == true)
281                         {
282                                 String dtmfText = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
283                                 HideDTMFKeypad();
284                                 ShowDTMFKeypad();
285                         }
286                 }
287         }
288         //More option is displayed recreate it
289         if(__pMoreOptionsListAnchor != null)
290         {
291                 CreateMoreOptionsMenuList();
292                 CreateMoreOptionsMenuList();
293         }
294 }
295
296 void
297 ActiveCallForm::HideDTMFKeypad(void)
298 {
299         if(__pDTMFKeypad != null)
300         {
301                 __DtmfString = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX))->GetText();
302
303                 RemoveControl(__pDTMFKeypad);
304                 __pDTMFKeypad = null;
305         }
306 }
307
308 result
309 ActiveCallForm::InitializeCallButtonsPanel(void)
310 {
311         result r = E_SUCCESS;
312         //Set background bitmap for call keypad
313         Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
314         Bitmap* pBgBitmap = AppUtility::GetBitmapFromResourcesN(IDB_BACKGROUND_BITMAP, pKeysBgLbl->GetWidth(), pKeysBgLbl->GetHeight());
315         if (pBgBitmap != null)
316         {
317                 pKeysBgLbl->SetBackgroundBitmap(*pBgBitmap);
318         }
319
320         if (__pCallButtonsPanel == null)
321         {
322                 __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
323                 __pCallButtonsPanel->ConstructPanel(this, __formType);
324                 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
325                 r = AddControl(__pCallButtonsPanel);
326         }
327
328         RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
329         if (pRelativeLayout != null)
330         {
331                 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
332         }
333         pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
334         if (pRelativeLayout != null)
335         {
336                 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
337                 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
338                 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
339                 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_TOP_TO_TOP);
340         }
341
342         return r;
343 }
344
345 void
346 ActiveCallForm::InitializeSwapButton(void)
347 {
348         Button* pSwapBtn = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
349         if (pSwapBtn)
350         {
351                 Bitmap* pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_NORMAL,
352                                                                                                                            W_HOLD_BITMAP, H_HOLD_BITMAP);
353                 if (pSwapBmp)
354                 {
355                         pSwapBtn->SetNormalBitmap(Point(0, 0), *pSwapBmp);
356                 }
357                 delete pSwapBmp;
358                 pSwapBmp = null;
359
360                 pSwapBmp = AppUtility::GetBitmapFromResourcesN(IDB_SWAP_ICON_PRESS,
361                                                                                                            W_HOLD_BITMAP, H_HOLD_BITMAP);
362                 if (pSwapBmp)
363                 {
364                         pSwapBtn->SetPressedBitmap(Point(0, 0), *pSwapBmp);
365                 }
366                 delete pSwapBmp;
367                 pSwapBmp = null;
368                 pSwapBtn->SetActionId(IDA_SWAP_CALLS);
369                 pSwapBtn->AddActionEventListener(*this);
370         }
371 }
372
373 void
374 ActiveCallForm::InitializeManageConfCallButton(void)
375 {
376         Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
377         if (pMoreBtn != null)
378         {
379                 pMoreBtn->SetActionId(IDA_MORE_OPTIONS_MENU);
380                 pMoreBtn->AddActionEventListener(*this);
381                 if (__formType == FORMTYPE_MULTIPLECALLS)
382                 {
383                         //Correct state will be set in OnSceneActivated based on the call
384                         pMoreBtn->SetShowState(false);
385                 }
386                 else if (__formType == FORMTYPE_ACTIVECONFCALL)
387                 {
388                         pMoreBtn->SetShowState(true);
389                 }
390         }
391 }
392
393 void
394 ActiveCallForm::InitializeHoldButton(void)
395 {
396         Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
397         if (pHoldBtn != null)
398         {
399                 //set status of Hold Button
400                 SetHoldButtonStatus(true);
401                 pHoldBtn->AddActionEventListener(*this);
402         }
403 }
404
405 void
406 ActiveCallForm::SetHoldButtonStatus(bool toHoldCall)
407 {
408         //background bitmap & button name
409         String btnName("");
410         Bitmap* normalImg = null;
411         Bitmap* pressImg = null;
412         if (toHoldCall)
413         {
414                 btnName.Append(AppUtility::GetResourceString(IDS_HOLD_BTN_NAME));
415                 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_NORMAL_BUTTON_ICON,
416                                                                                                                 W_HOLD_BITMAP, H_HOLD_BITMAP);
417                 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_HOLD_PRESS_BUTTON_ICON,
418                                                                                                            W_HOLD_BITMAP, H_HOLD_BITMAP);
419         }
420         else
421         {
422                 btnName.Append(AppUtility::GetResourceString(IDS_UNHOLD_BTN_NAME));
423                 normalImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_NORMAL_BUTTON_ICON,
424                                                                                                                 W_HOLD_BITMAP, H_HOLD_BITMAP);
425                 pressImg = AppUtility::GetBitmapFromResourcesN(IDB_UNHOLD_PRESS_BUTTON_ICON,
426                                                                                                            W_HOLD_BITMAP, H_HOLD_BITMAP);
427         }
428
429         //Action id
430         CommandIds cmdId = IDA_HOLD_CALL;
431         switch (__formType)
432         {
433         case FORMTYPE_ACTIVECALL:
434         {
435                 cmdId = toHoldCall ? IDA_HOLD_CALL : IDA_UNHOLD_CALL;
436         }
437         break;
438
439         case FORMTYPE_ACTIVECONFCALL:
440         {
441                 cmdId = toHoldCall ? IDA_HOLD_CONF_CALL : IDA_UNHOLD_CONF_CALL;
442         }
443         break;
444
445         default:
446                 break;
447         }
448
449         //set background bitmap, button name & action id
450         Button* pHoldBtn = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
451         Label* pHoldLbl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
452         if (pHoldBtn)
453         {
454                 pHoldBtn->SetActionId(cmdId);
455                 pHoldBtn->SetNormalBitmap(Point(0, 0),*normalImg);
456                 pHoldBtn->SetPressedBitmap(Point(0, 0),*pressImg);
457         }
458         if (pHoldLbl)
459         {
460                 pHoldLbl->SetText(btnName);
461                 pHoldLbl->Invalidate(true);
462         }
463
464         //free the resources
465         delete normalImg;
466         normalImg = null;
467         delete pressImg;
468         pressImg = null;
469 }
470
471 void
472 ActiveCallForm::CreateMoreOptionsMenuList(void)
473 {
474         //create option list anchor
475         if (__pMoreOptionsListAnchor == null)
476         {
477                 Bitmap* pBgPopupArwBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_ARROW_ICON, W_OPTION_ANCHOR,
478                                                                                                                                          H_OPTION_ANCHOR);
479                 __pMoreOptionsListAnchor = new (std::nothrow) Label();
480                 __pMoreOptionsListAnchor->Construct(Rectangle(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_ICON, Y_POPUP_ANCHOR, W_POPUP_ANCHOR, H_POPUP_ANCHOR), L"");
481                 __pMoreOptionsListAnchor->SetBackgroundBitmap(*pBgPopupArwBmp);
482
483                 delete pBgPopupArwBmp;
484                 pBgPopupArwBmp = null;
485
486                 // Adds a Label to the Form
487                 AddControl(__pMoreOptionsListAnchor);
488         }
489
490         //create options menu list
491         if (__pMoreOptionsList == null)
492         {
493                 __pMoreOptionsList = new (std::nothrow) ListView();
494                 __pMoreOptionsList->Construct(Rectangle(Point(GetWidth()-W_RIGHT_MORE_ICON_MARGIN - W_MORE_LABEL,H_MORE_LABEL), IDI_OPTIONMENU_DIMEN), false, SCROLL_STYLE_FADE_OUT);
495                 __pMoreOptionsList->SetItemProvider(*this);
496                 __pMoreOptionsList->AddListViewItemEventListener(*this);
497                 //Add option list to the form
498                 AddControl(__pMoreOptionsList);
499         }
500         else
501         {
502                 //Hide option menu list
503                 DestroyMoreOptionsMenuList();
504         }
505 }
506
507 void
508 ActiveCallForm::DestroyMoreOptionsMenuList(void)
509 {
510         if (__pMoreOptionsListAnchor != null)
511         {
512                 //removes and delete the child control
513                 RemoveControl(__pMoreOptionsListAnchor);
514                 __pMoreOptionsListAnchor = null;
515         }
516
517         if (__pMoreOptionsList != null)
518         {
519                 //removes and delete the child control
520                 RemoveControl(__pMoreOptionsList);
521                 __pMoreOptionsList = null;
522         }
523 }
524
525 result
526 ActiveCallForm::OnTerminating(void)
527 {
528         result r = E_SUCCESS;
529         if (__pCallPresentor != null)
530         {
531                 __pCallPresentor = null;
532         }
533         return r;
534 }
535
536 void
537 ActiveCallForm::OnActionPerformed(const Control& source, int actionId)
538 {
539
540         String dtmfString;
541         switch (actionId)
542         {
543         case IDA_END_CALL:
544         {
545                 //End the currently active / dialing call
546                 if (__pActiveCallInfo->IsConferenceCall() == false)
547                 {
548                         String activeContactNo;
549                         activeContactNo.Append(__pActiveCallInfo->GetContactNumber());
550                         //Check if it is call is in dialing state, then
551                         if (__formType == FORMTYPE_EMERGENCYOUTGOINGCALL || __formType == FORMTYPE_OUTGOINGCALL)
552                         {
553                                 __pCallPresentor->EndDialingCall(activeContactNo);
554                         }
555                         else
556                         {
557                                 //end active calls
558                                 __pCallPresentor->EndActiveCall(*__pActiveCallInfo->GetCallHandle());
559                         }
560                 }
561                 else
562                 {
563                         __pCallPresentor->EndConferenceCall();
564                 }
565         }
566         break;
567
568         case IDA_END_CONF_CALL:
569         {
570                 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
571                 __pCallPresentor->EndConferenceCall();
572         }
573         break;
574
575         case IDA_OPEN_NUMKEYPAD:
576         {
577                 if (GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT || GetOrientationStatus() == ORIENTATION_STATUS_PORTRAIT_REVERSE)
578                 {
579                         //hide only in portrait mode.
580                         SetShowStateOnKeypad(false);
581                 }
582                 //Hide the hold button as it goes behind DTMF keypad
583                 SetHoldButtonShowState(false);
584                 ShowDTMFKeypad();
585                 __pCallButtonsPanel->SetKeypadButtonState(IDA_CLOSE_NUMKEYPAD);
586         }
587         break;
588
589         case IDA_CLOSE_NUMKEYPAD:
590         {
591                 SetShowStateOnKeypad(true);
592                 HideDTMFKeypad();
593                 __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
594         }
595         break;
596
597         case IDA_ADD_CALL:
598         {
599                 //switch to Dialer Form to make an call
600                 if(__pCallPresentor->GetCurrentCallCount() == 1)
601                 {
602                 __pCallPresentor->LaunchDialAppControl();
603                 }
604         }
605         break;
606
607         case IDA_HOLD_CALL:
608         {
609                 bool success = true;
610                 if (__pActiveCallInfo->IsConferenceCall() == false)
611                 {
612                         if(__pActiveCallInfo->GetCallHandle() != null)
613                         {
614                                 success = __pCallPresentor->HoldCall(*__pActiveCallInfo->GetCallHandle());
615                         }
616                 }
617                 else
618                 {
619                         success = __pCallPresentor->HoldConferenceCall();
620                 }
621                 //reset hold status and "OnHold" text
622                 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
623                 if(__pActiveCallTimer != null)
624                 {
625                         __pActiveCallTimer->Cancel();
626                 }
627                 SetHoldButtonStatus(!success);
628         }
629         break;
630
631         case IDA_UNHOLD_CALL:
632         {
633                 bool success = false;
634                 if (__pActiveCallInfo->IsConferenceCall() == false)
635                 {
636                         if(__pActiveCallInfo->GetCallHandle() != null)
637                         {
638                                 success = __pCallPresentor->UnHoldCall(*__pActiveCallInfo->GetCallHandle());
639                         }
640                 }
641                 else
642                 {
643                         success = __pCallPresentor->ActivateConferenceCall();
644                 }
645                 //reset hold status and show call timer
646                 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
647                 SetHoldButtonStatus(success);
648         }
649         break;
650
651         case IDA_HOLD_CONF_CALL:
652         {
653                 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
654                 bool success = __pCallPresentor->HoldConferenceCall();
655                 //reset hold status and "OnHold" text
656                 SetHoldButtonStatus(!success);
657                 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, success);
658                 if(__pActiveCallTimer != null)
659                 {
660                         __pActiveCallTimer->Cancel();
661                 }
662         }
663         break;
664
665         case IDA_UNHOLD_CONF_CALL:
666         {
667                 AppAssert(__formType == FORMTYPE_ACTIVECONFCALL);
668                 bool success = __pCallPresentor->ActivateConferenceCall();
669                 //reset hold status and show call timer
670                 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, !success, __activeCallStartTime);
671                 SetHoldButtonStatus(success);
672         }
673         break;
674
675         case IDA_OPEN_CONTACTS:
676         {
677                 //Open Contacts APP
678                 //Launch call application
679                 AppManager* pAppManager = AppManager::GetInstance();
680                 pAppManager->LaunchApplication(PROVIDER_ID_CONTACTS);
681         }
682                 break;
683
684         case IDA_MUTE:
685         {
686                 bool success = __pCallPresentor->SetMuteStatus(true);
687                 if (success)
688                 {
689                         __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
690                 }
691         }
692         break;
693
694         case IDA_UNMUTE:
695         {
696                 bool success = __pCallPresentor->SetMuteStatus(false);
697                 if (success)
698                 {
699                         __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
700                 }
701         }
702         break;
703
704         case IDA_SPEAKER:
705         {
706                 bool success = __pCallPresentor->SetSpeakerStatus(true);
707                 if (success)
708                 {
709                         __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
710                 }
711         }
712         break;
713
714         case IDA_SPEAKER_OFF:
715         {
716                 bool success = __pCallPresentor->SetSpeakerStatus(false);
717                 if (success)
718                 {
719                         __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
720                 }
721         }
722         break;
723
724         case IDA_JOIN_CALL:
725         {
726                 AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
727                 __pCallPresentor->JoinCall();
728         }
729         break;
730
731         case IDA_SWAP_CALLS:
732         {
733                 if(IsSwapInProgress() == false)
734                 {
735                         AppAssert(__formType == FORMTYPE_MULTIPLECALLS);
736                         __pCallPresentor->SwapCalls();
737                         SetSwapInProgress(true);
738                 }
739         }
740         break;
741
742         case IDA_MORE_OPTIONS_MENU:
743         {
744                 //Show 'more' options menu
745                 CreateMoreOptionsMenuList();
746         }
747         break;
748
749         case NUM_KEY0:
750         {
751                 dtmfString.Append(L"0");
752                 SetTextToDTMFTextField(dtmfString);
753                 __pCallPresentor->SendDTMFSignal(dtmfString);
754         }
755         break;
756
757         case NUM_KEY1:
758         {
759                 dtmfString.Append(L"1");
760                 SetTextToDTMFTextField(dtmfString);
761                 __pCallPresentor->SendDTMFSignal(dtmfString);
762         }
763         break;
764
765         case NUM_KEY2:
766         {
767                 dtmfString.Append(L"2");
768                 SetTextToDTMFTextField(dtmfString);
769                 __pCallPresentor->SendDTMFSignal(dtmfString);
770         }
771         break;
772
773         case NUM_KEY3:
774         {
775                 dtmfString.Append(L"3");
776                 SetTextToDTMFTextField(dtmfString);
777                 __pCallPresentor->SendDTMFSignal(dtmfString);
778         }
779         break;
780
781         case NUM_KEY4:
782         {
783                 dtmfString.Append(L"4");
784                 SetTextToDTMFTextField(dtmfString);
785                 __pCallPresentor->SendDTMFSignal(dtmfString);
786         }
787         break;
788
789         case NUM_KEY5:
790         {
791                 dtmfString.Append(L"5");
792                 SetTextToDTMFTextField(dtmfString);
793                 __pCallPresentor->SendDTMFSignal(dtmfString);
794         }
795         break;
796
797         case NUM_KEY6:
798         {
799                 dtmfString.Append(L"6");
800                 SetTextToDTMFTextField(dtmfString);
801                 __pCallPresentor->SendDTMFSignal(dtmfString);
802         }
803         break;
804
805         case NUM_KEY7:
806         {
807                 dtmfString.Append(L"7");
808                 SetTextToDTMFTextField(dtmfString);
809                 __pCallPresentor->SendDTMFSignal(dtmfString);
810         }
811         break;
812
813         case NUM_KEY8:
814         {
815                 dtmfString.Append(L"8");
816                 SetTextToDTMFTextField(dtmfString);
817                 __pCallPresentor->SendDTMFSignal(dtmfString);
818         }
819         break;
820
821         case NUM_KEY9:
822         {
823                 dtmfString.Append(L"9");
824                 SetTextToDTMFTextField(dtmfString);
825                 __pCallPresentor->SendDTMFSignal(dtmfString);
826         }
827         break;
828
829         case PAUSE_KEY:
830         {
831                 dtmfString.Append(L"*");
832                 SetTextToDTMFTextField(dtmfString);
833                 __pCallPresentor->SendDTMFSignal(dtmfString);
834         }
835         break;
836
837         case HASH_KEY:
838         {
839                 dtmfString.Append(L"#");
840                 SetTextToDTMFTextField(dtmfString);
841                 __pCallPresentor->SendDTMFSignal(dtmfString);
842         }
843         break;
844
845         default:
846                 break;
847         }
848 }
849
850 bool
851 ActiveCallForm::IsSwapInProgress(void)
852 {
853         return __isSwapInProgress;
854 }
855
856 void
857 ActiveCallForm::SetSwapInProgress(bool progress)
858 {
859         __isSwapInProgress = progress;
860 }
861
862 void
863 ActiveCallForm::SetTextToDTMFTextField(const String& dtmfStr)
864 {
865         if(__pDTMFKeypad != null)
866         {
867                 EditField* pTextBox = static_cast<EditField*>(__pDTMFKeypad->GetControl(IDC_TEXTBOX));
868
869                 int startpos=-1,endpos=-1;
870                 pTextBox->GetBlockRange(startpos,endpos);
871                 if(startpos != -1)
872                 {
873                         pTextBox->Remove();
874                         pTextBox->ReleaseBlock();
875                 }
876
877                 pTextBox->InsertTextAtCursorPosition(dtmfStr);
878                 //pTextBox->AppendText(dtmfStr);
879                 pTextBox->SetFocus();
880                 pTextBox->Invalidate(true);
881         }
882 }
883
884 void
885 ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
886 {
887         AppLog("ENTER");
888         //set itself as listener
889         __pCallPresentor->SetTelEventListener(this);
890         AddOrientationEventListener(*this);
891
892         CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
893         pPhoneApp->AddAppStateChangeListener(*this);
894
895         //Initialize keypad and buttons
896         InitializeCallButtonsPanel();
897
898         if (__pActiveCallInfo != null)
899         {
900                 delete __pActiveCallInfo;
901                 __pActiveCallInfo = null;
902         }
903         if (__pHeldCallInfo != null)
904         {
905                 delete __pHeldCallInfo;
906                 __pHeldCallInfo = null;
907         }
908         DestroyMoreOptionsMenuList();
909
910         switch (__formType)
911         {
912         case FORMTYPE_OUTGOINGCALL:
913         {
914                 String contactNo;
915                 contactNo.Append(*(static_cast<String*>(pArgs->GetAt(0))));
916                 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
917                 __pActiveCallInfo->SetContactNumber(contactNo);
918                 Contact* pContact = __pCallPresentor->GetContactN(contactNo);
919                 if (pContact != null)
920                 {
921                         __pActiveCallInfo->SetContactInfo(*pContact);
922                         delete pContact;
923                 }
924                 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
925                 //make an normal outgoing call
926                 __pCallPresentor->DialCall(contactNo, false);
927         }
928         break;
929
930         case FORMTYPE_EMERGENCYOUTGOINGCALL:
931         {
932                 String* pContactNo = static_cast<String*>(pArgs->GetAt(0));
933                 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
934                 long long phNumber = 0;
935                 LongLong::Parse(*pContactNo, phNumber);
936                 __pActiveCallInfo->SetContactNumber(*pContactNo);
937                 //make an emergency call
938                 __pCallPresentor->DialCall(*pContactNo, true);
939         }
940         break;
941
942         case FORMTYPE_ACTIVECALL:
943         {
944                 //get contact number
945                 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
946
947                 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
948                 *__pActiveCallInfo =  *pCall;
949                 String activeContactNo;
950                 if(pCall->GetContactNumber().IsEmpty() == false)
951                 {
952                         activeContactNo.Append(pCall->GetContactNumber());
953                 }
954                 else
955                 {
956                         activeContactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
957                 }
958                 ShowPersonDetails(activeContactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
959
960                 //show call active time using Timer
961                 __activeCallStartTime = pCall->GetCallConnectTime();
962                 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
963         }
964         break;
965
966         case FORMTYPE_EMERGENCYACTIVECALL:
967         {
968                 //get contact number
969                 AppCallInfo* pCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
970
971                 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
972                 *__pActiveCallInfo =  *pCall;
973
974                 //show call active time using Timer
975                 __activeCallStartTime = pCall->GetCallConnectTime();
976                 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, pCall->IsOnHold(), __activeCallStartTime);
977         }
978         break;
979
980         case FORMTYPE_MULTIPLECALLS:
981         {
982                 IListT<AppCallInfo>* pCallsList = __pCallPresentor->GetCallListN();
983                 //update calls state
984                 UpdateMultipleCallScreen(*pCallsList);
985                 delete pCallsList;
986                 pCallsList = null;
987         }
988         break;
989
990         case FORMTYPE_ACTIVECONFCALL:
991         {
992                 //get Conf call
993                 AppCallInfo* pConfInfo = static_cast<AppCallInfo*>(pArgs->GetAt(0));
994                 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
995                 *__pActiveCallInfo =  *pConfInfo;
996
997                 int participantsCount = __pActiveCallInfo->GetCallerListCount();
998
999                 // show participant count on name Label
1000                 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1001                 if (pPeopleCountLbl)
1002                 {
1003                         String count;
1004                         count.Append(participantsCount);
1005                         count.Append(" ");
1006                         count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1007                         pPeopleCountLbl->SetText(count);
1008                 }
1009
1010                 if(participantsCount >= IDI_MAX_CONF_CALL_PARTICIPANTS)
1011                 {
1012                         __pCallButtonsPanel->EnableAddCallButton(false);
1013                 }
1014                 else
1015                 {
1016                         __pCallButtonsPanel->EnableAddCallButton(true);
1017                 }
1018
1019                 //show call active time using Timer
1020                 __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1021                 ShowTimerInfo(IDC_CALLER1_TIME_LABEL, __pActiveCallInfo->IsOnHold(),__activeCallStartTime);
1022         }
1023         break;
1024
1025         default:
1026                 break;
1027         }
1028
1029         if(__formType == FORMTYPE_ACTIVECALL || __formType == FORMTYPE_EMERGENCYACTIVECALL ||
1030                         __formType == FORMTYPE_MULTIPLECALLS || __formType == FORMTYPE_ACTIVECONFCALL)
1031         {
1032                 //Unlock the phone if its locked
1033                 if(LockManager::GetInstance()->IsLocked())
1034                 {
1035                         AppLogDebug("Phone Locked");
1036                         LockManager::GetInstance()->Unlock();
1037                 }
1038         }
1039
1040         //Hide DTMFKeypad, if visible and show caller info
1041         HideDTMFKeypad();
1042         SetShowStateOnKeypad(true);
1043         __pCallButtonsPanel->SetKeypadButtonState(IDA_OPEN_NUMKEYPAD);
1044
1045         //Set the correct speaker status
1046         if(__pCallPresentor->IsSpeakerOn() == true)
1047         {
1048                 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER_OFF);
1049         }
1050         else
1051         {
1052                 __pCallButtonsPanel->SetSpeakerButtonState(IDA_SPEAKER);
1053         }
1054
1055         //Set the correct Mute status
1056         if (__pCallPresentor->IsCallMuted() == true)
1057         {
1058                 __pCallButtonsPanel->SetMuteButtonState(IDA_UNMUTE);
1059         }
1060         else
1061         {
1062                 __pCallButtonsPanel->SetMuteButtonState(IDA_MUTE);
1063         }
1064
1065         if (pArgs)
1066         {
1067                 pArgs->RemoveAll();
1068                 delete pArgs;
1069                 pArgs = null;
1070         }
1071
1072         CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1073         pCallApp->SetTopMostWindow(false);
1074 }
1075
1076 void
1077 ActiveCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1078 {
1079         RemoveOrientationEventListener(*this);
1080         if (__pCallButtonsPanel != null)
1081         {
1082                 RemoveControl(__pCallButtonsPanel);
1083                 __pCallButtonsPanel = null;
1084         }
1085         if (__pActiveCallTimer != null)
1086         {
1087                 __pActiveCallTimer->Cancel();
1088                 delete __pActiveCallTimer;
1089                 __pActiveCallTimer = null;
1090         }
1091         if (__pSmallPhotoLabel != null)
1092         {
1093                 __pSmallPhotoLabel->SetShowState(false);
1094         }
1095         //Hide "Manage conf. Call" Context menu
1096         if (__pMoreOptionsListAnchor != null)
1097         {
1098                 __pMoreOptionsListAnchor->SetShowState(false);
1099         }
1100         if (__pMoreOptionsList != null)
1101         {
1102                 __pMoreOptionsList->SetShowState(false);
1103         }
1104         __DtmfString.Clear();
1105         CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
1106         pCallApp->RemoveAppStateChangeListener(*this);
1107 }
1108
1109 void
1110 ActiveCallForm::HandleConfCallChanged(void)
1111 {
1112         AppLog("ENTER");
1113         AppAssert((__formType == FORMTYPE_ACTIVECONFCALL) || (__formType == FORMTYPE_MULTIPLECALLS));
1114         //fetch changed conference call info
1115         AppCallInfo* pConfCallInfo = __pCallPresentor->GetConferenceCallInfoN();
1116         if (pConfCallInfo == null)
1117         {
1118                 AppLog("EXIT");
1119                 return;
1120         }
1121
1122         //fetch participant count in conf call
1123         int participantsCount = pConfCallInfo->GetCallerListCount();
1124         //update status of join and Add call
1125         bool isEnableAddCall = false;
1126         bool isEnableJoinCall = false;
1127         if(participantsCount < IDI_MAX_CONF_CALL_PARTICIPANTS)
1128         {
1129                 //available only at Active conf. call or active call screen
1130                 isEnableAddCall = true;
1131                 //join button is available only at multiple call screen
1132                 isEnableJoinCall = true;
1133         }
1134
1135         Label* pPeopleCountLbl = null;
1136         if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == true)
1137         {
1138                 //Active call is conference call
1139                 delete __pActiveCallInfo;
1140                 __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1141                 *__pActiveCallInfo = *pConfCallInfo;
1142
1143                 if (__formType == FORMTYPE_MULTIPLECALLS)
1144                 {
1145                         pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1146                 }
1147                 else if (__formType == FORMTYPE_ACTIVECONFCALL)
1148                 {
1149                         pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1150                         AppLog("Active conf call...(%d)", pPeopleCountLbl);
1151                 }
1152         }
1153         else if(__pHeldCallInfo != null && __pHeldCallInfo->IsConferenceCall() == true)
1154         {
1155                 //Held call is conference call - this is definitely multiple call screen.
1156                 delete __pHeldCallInfo;
1157                 __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1158                 *__pHeldCallInfo = *pConfCallInfo;
1159                 pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1160         }
1161
1162         // update participant count on name Label
1163         if (pPeopleCountLbl != null)
1164         {
1165                 String count;
1166                 count.Append(participantsCount);
1167                 count.Append(" ");
1168                 count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1169                 pPeopleCountLbl->SetText(count);
1170                 pPeopleCountLbl->Invalidate(true);
1171         }
1172         //change AddCall Button status
1173         __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall);
1174         //change JoinCall Button status
1175         __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1176         AppLog("EXIT");
1177 }
1178
1179 void
1180 ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListT<AppCallInfo>& activeCallsList)
1181 {
1182         AppLog("ENTER");
1183         if(__pActiveCallInfo != null)
1184         {
1185                 delete __pActiveCallInfo;
1186                 __pActiveCallInfo = null;
1187         }
1188         if(__pHeldCallInfo != null)
1189         {
1190                 delete __pHeldCallInfo;
1191                 __pHeldCallInfo = null;
1192         }
1193
1194         Button* pMoreBtn = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1195         if (pMoreBtn != null)
1196         {
1197                 pMoreBtn->SetShowState(false);
1198         }
1199
1200         //show caller's info.
1201         for (int index = 0; index < activeCallsList.GetCount(); index++)
1202         {
1203                 //Fetch call info
1204                 AppCallInfo callInfo;
1205                 activeCallsList.GetAt(index, callInfo);
1206
1207                 String contactNo;
1208                 if(callInfo.GetContactNumber().IsEmpty() == false)
1209                 {
1210                         contactNo.Append(callInfo.GetContactNumber());
1211                 }
1212                 else
1213                 {
1214                         contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
1215                 }
1216
1217                 if (callInfo.IsOnHold() == false)
1218                 {
1219                         __pActiveCallInfo = new (std::nothrow) AppCallInfo();
1220                         *__pActiveCallInfo =  callInfo;
1221
1222                         if (__pActiveCallInfo->IsConferenceCall() == false)
1223                         {
1224                                 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1225                                 if (pVoiceIconLbl)
1226                                 {
1227                                         pVoiceIconLbl->SetShowState(true);
1228                                 }
1229                                 if (pMoreBtn != null)
1230                                 {
1231                                         pMoreBtn->SetShowState(false);
1232                                 }
1233                                 ShowPersonDetails(contactNo, IDC_NUMBER1_LABEL, IDC_CALLER1_LABEL, false,__pActiveCallInfo);
1234                                 if(__pMoreOptionsListAnchor != null && __pMoreOptionsListAnchor->GetShowState() == true)
1235                                 {
1236                                         CreateMoreOptionsMenuList();
1237                                 }
1238                         }
1239                         else
1240                         {
1241                                 // show participant count on name Label
1242                                 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1243                                 if (pPeopleCountLbl)
1244                                 {
1245                                         String count;
1246                                         count.Append(__pActiveCallInfo->GetCallerListCount());
1247                                         count.Append(" ");
1248                                         count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1249                                         pPeopleCountLbl->SetText(count);
1250                                 }
1251                                 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1252                                 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1253                                 if (pNameLbl)
1254                                 {
1255                                         pNameLbl->SetText(nameStr);
1256                                 }
1257                                 Label* pVoiceIconLbl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1258                                 if (pVoiceIconLbl)
1259                                 {
1260                                         pVoiceIconLbl->SetShowState(false);
1261                                 }
1262                                 if (pMoreBtn != null)
1263                                 {
1264                                         pMoreBtn->SetShowState(true);
1265                                 }
1266                                 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1267                                 if (pPhotoBitmap != null)
1268                                 {
1269                                         Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER1_PHOTO_LABEL));
1270                                         if (pPhotoLbl)
1271                                         {
1272                                                 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1273                                                 pPhotoLbl->Invalidate(true);
1274                                         }
1275                                         delete pPhotoBitmap;
1276                                 }
1277                         }
1278                         //show call active time using Timer
1279                         __activeCallStartTime = __pActiveCallInfo->GetCallConnectTime();
1280                         ShowTimerInfo(IDC_CALLER1_TIME_LABEL,false,__activeCallStartTime);
1281                 }
1282                 else
1283                 {
1284                         __pHeldCallInfo = new (std::nothrow) AppCallInfo();
1285                         *__pHeldCallInfo = callInfo;
1286
1287                         if (__pHeldCallInfo->IsConferenceCall() == false)
1288                         {
1289                                 ShowPersonDetails(contactNo, IDC_NUMBER2_LABEL, IDC_CALLER2_LABEL, true,__pHeldCallInfo);
1290                         }
1291                         else
1292                         {
1293                                 // show participant count on name Label
1294                                 Label* pPeopleCountLbl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1295                                 if (pPeopleCountLbl)
1296                                 {
1297                                         String count;
1298                                         count.Append(__pHeldCallInfo->GetCallerListCount());
1299                                         count.Append(" ");
1300                                         count.Append(AppUtility::GetResourceString(IDS_PEOPLE_STR));
1301                                         pPeopleCountLbl->SetText(count);
1302                                 }
1303                                 String nameStr = AppUtility::GetResourceString(L"IDS_CONFERENCE_CALL_STRING");
1304                                 Label* pNameLbl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1305                                 if (pNameLbl)
1306                                 {
1307                                         pNameLbl->SetText(nameStr);
1308                                 }
1309                                 Bitmap* pPhotoBitmap = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BG_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1310                                 if (pPhotoBitmap != null)
1311                                 {
1312                                         Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_CALLER2_PHOTO_LABEL));
1313                                         if (pPhotoLbl)
1314                                         {
1315                                                 pPhotoLbl->SetBackgroundBitmap(*pPhotoBitmap);
1316                                                 pPhotoLbl->Invalidate(true);
1317                                         }
1318                                         delete pPhotoBitmap;
1319                                 }
1320                         }
1321                         //show "On Hold"
1322                         ShowTimerInfo(IDC_CALLER2_TIME_LABEL, true);
1323                 }
1324         }
1325
1326         //update JoinCall button status
1327         __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton());
1328         Invalidate(true);
1329         AppLog("EXIT");
1330 }
1331
1332 void
1333 ActiveCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, bool isSecondCaller, AppCallInfo* pCallInfo)
1334 {
1335         //call individual methods to show contact number, caller name & photo
1336         ShowPhoneNumber(phoneNumber, contactLblName);
1337
1338         //fetch contact details based on phone number
1339         String* pDisplayName = pCallInfo->FetchCallerNameN();
1340         ShowCallerName(*pDisplayName, nameLblName);
1341
1342         Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1343         ShowCallerPhoto(pPhotoBitmap, isSecondCaller);
1344
1345         //free resources
1346         if (pDisplayName)
1347         {
1348                 delete pDisplayName;
1349                 pDisplayName = null;
1350         }
1351         if (pPhotoBitmap)
1352         {
1353                 delete pPhotoBitmap;
1354                 pPhotoBitmap = null;
1355         }
1356 }
1357
1358 void
1359 ActiveCallForm::ShowPhoneNumber(const String& phoneNumber, const String& contactLblName)
1360 {
1361         String formattedNumber = phoneNumber;
1362
1363         Label* pContactLbl = static_cast<Label*>(GetControl(contactLblName));
1364         if (pContactLbl)
1365         {
1366                 pContactLbl->SetText(formattedNumber);
1367                 pContactLbl->Invalidate(true);
1368         }
1369 }
1370
1371 void
1372 ActiveCallForm::ShowCallerName(const String& callerName, const String& nameLblName)
1373 {
1374         // show display name on name Label
1375         Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
1376         if (pNameLbl)
1377         {
1378                 //passing an empty string to SetText fails in label,
1379                 //if previously valid text has been set
1380                 if (callerName.IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
1381                 {
1382                         String stringToBeSet(L" ");
1383                         pNameLbl->SetText(stringToBeSet);
1384                 }
1385                 else
1386                 {
1387                         pNameLbl->SetText(callerName);
1388                 }
1389                 pNameLbl->Invalidate(true);
1390         }
1391 }
1392
1393 void
1394 ActiveCallForm::ShowCallerPhoto(Bitmap* pPhotoId, bool isSecondCaller)
1395 {
1396         //to check if default image is to be shown
1397         bool showDefaultPhoto = false;
1398         bool showSmallPhoto = false;
1399         String photoLabel("");
1400
1401         switch (__formType)
1402         {
1403         case FORMTYPE_OUTGOINGCALL:
1404         case FORMTYPE_ACTIVECALL:
1405         {
1406                 if (pPhotoId == null)
1407                 {
1408                         //show default caller image
1409                         showDefaultPhoto = true;
1410                 }
1411                 else
1412                 {
1413                         //Check the size of photo
1414                         // Now checking the condition with && but actually it should be ||
1415                         //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1416                         // height 270 and width = 480 . So all images set thru gallery is show as small image
1417                         if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1418                                         && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1419                         {
1420                                 showSmallPhoto = true;
1421                         }
1422
1423                 }
1424                 photoLabel.Append(IDC_CALLER1_BIGPHOTO_LABEL);
1425         }
1426         break;
1427
1428         case FORMTYPE_MULTIPLECALLS:
1429         {
1430                 if (isSecondCaller)
1431                 {
1432                         photoLabel.Append(IDC_CALLER2_PHOTO_LABEL);
1433                 }
1434                 else
1435                 {
1436                         photoLabel.Append(IDC_CALLER1_PHOTO_LABEL);
1437                 }
1438
1439                 if (pPhotoId == null)
1440                 {
1441                         showDefaultPhoto = true;
1442                 }
1443                 else
1444                 {
1445                         if (pPhotoId->GetHeight() <= H_SMALL_PHOTO
1446                                 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1447                         {
1448                                 //pPhotoId->Scale(Dimension(W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO));
1449                                 showSmallPhoto = true;
1450                         }
1451                 }
1452         }
1453         break;
1454
1455         default:
1456                 break;
1457         }
1458
1459         //Remove small photo label
1460         if (__pSmallPhotoLabel != null)
1461         {
1462                 RemoveControl(__pSmallPhotoLabel);
1463                 __pSmallPhotoLabel = null;
1464         }
1465
1466         //show photo - for Big Photo Id, Animated Call Image
1467         if (!showDefaultPhoto)
1468         {
1469                 if(showSmallPhoto == true)
1470                 {
1471                         ShowThumbnailImage(pPhotoId,photoLabel);
1472                 }
1473                 else
1474                 {
1475                         Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1476                         if (pPhotoLbl)
1477                         {
1478                                 Canvas* pCanvas = new (std::nothrow) Canvas;
1479                                 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1480                                 pCanvas->Construct(canvasRect);
1481                                 //draw the contact bitmap
1482                                 pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1483                                 Bitmap* pNewPhotoId = new Bitmap();
1484                                 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1485                                 delete pCanvas;
1486
1487                                 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1488                                 pPhotoLbl->Invalidate(true);
1489                                 delete pNewPhotoId;
1490                         }
1491                 }
1492         }
1493         else
1494         {
1495                 Bitmap* pDefaultPhoto = null;
1496                 switch (__formType)
1497                 {
1498                 case FORMTYPE_OUTGOINGCALL:
1499                 case FORMTYPE_ACTIVECALL:
1500                         pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1501                         break;
1502
1503                 case FORMTYPE_MULTIPLECALLS:
1504                         pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_MULTIPLE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,H_CONFERENCE_PHOTO);
1505                         break;
1506
1507                 case FORMTYPE_ACTIVECONFCALL:
1508                         pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_CONFERENCE_BIG_BG_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1509                         break;
1510
1511                 default:
1512                         break;
1513                 }
1514                 if (pDefaultPhoto != null)
1515                 {
1516                         Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1517                         if (pPhotoLbl)
1518                         {
1519                                 pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
1520                         }
1521                         delete pDefaultPhoto;
1522                 }
1523         }
1524 }
1525
1526 void
1527 ActiveCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,String& photoLabel)
1528 {
1529         Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
1530
1531         if (pPhotoLbl != null && pPhotoId != null)
1532         {
1533                 Canvas* pCanvas = new (std::nothrow) Canvas;
1534                 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1535                 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1536                 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1537                 pCanvas->Construct(canvasRect);
1538                 //draw the back ground
1539                 pCanvas->DrawBitmap(canvasRect,*pBackground);
1540                 //draw shadow (to be enabled after correct shadow image is provided )
1541                 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1542                         //      (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1543                 //draw the contact bitmap
1544                 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1545                                 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1546                 Bitmap* pNewPhotoId = new Bitmap();
1547                 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1548                 delete pCanvas;
1549
1550                 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1551                 pPhotoLbl->Invalidate(true);
1552                 delete pNewPhotoId;
1553                 delete pBackground;
1554                 delete pShadow;
1555         }
1556
1557 }
1558
1559 void
1560 ActiveCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1561 {
1562         if (__pSmallPhotoLabel != null)
1563         {
1564                 RemoveControl(__pSmallPhotoLabel);
1565                 __pSmallPhotoLabel = null;
1566         }
1567         //Draw Small Photo and show on small photo label
1568         __pSmallPhotoLabel  = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1569         __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1570         __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1571         __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1572         // Add a Label to the Form
1573         AddControl(__pSmallPhotoLabel);
1574         __pSmallPhotoLabel->Invalidate(true);
1575 }
1576
1577 void
1578 ActiveCallForm::ShowTimerInfo(const String& timerLblName, bool isOnHold, long long startTime)
1579 {
1580         Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1581
1582         if (__pActiveCallTimer == null)
1583         {
1584                 __pActiveCallTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
1585                 __pActiveCallTimer->Construct(*this);
1586         }
1587
1588         if (pTimerLbl != null)
1589         {
1590                 if (isOnHold == true)
1591                 {
1592                         pTimerLbl->SetText(AppUtility::GetResourceString(IDS_TIMER_ON_HOLD));
1593                         //update Hold button status
1594                         SetHoldButtonStatus(false);
1595                 }
1596                 else
1597                 {
1598                         //update Hold button status
1599                         SetHoldButtonStatus(true);
1600                         //current system time
1601                         long long currTime = 0;
1602                         SystemTime::GetTicks(currTime);
1603                         //Set call duration
1604                         TimeSpan diffSpan(abs(startTime - currTime));
1605
1606                         String activeCallTime(L"");
1607
1608                         long long hr = diffSpan.GetHours();
1609                         if (hr <= 9)
1610                         {
1611                                 activeCallTime.Append("0");
1612                         }
1613                         activeCallTime.Append(hr);
1614                         activeCallTime.Append(L":");
1615
1616                         long long min = diffSpan.GetMinutes();
1617                         if (min <= 9)
1618                         {
1619                                 activeCallTime.Append("0");
1620                         }
1621                         activeCallTime.Append(min);
1622                         activeCallTime.Append(L":");
1623
1624                         long long sec = diffSpan.GetSeconds();
1625                         if (sec <= 9)
1626                         {
1627                                 activeCallTime.Append("0");
1628                         }
1629                         activeCallTime.Append(sec);
1630
1631                         pTimerLbl->SetText(activeCallTime);
1632                         __pActiveCallTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
1633                 }
1634                 pTimerLbl->Invalidate(true);
1635         }
1636 }
1637
1638 void
1639 ActiveCallForm::SetHoldButtonShowState(bool showState)
1640 {
1641         Label* pLblControl = static_cast<Label*>(GetControl(IDC_HOLD_LABEL));
1642         if(pLblControl != null)
1643         {
1644                 pLblControl->SetShowState(showState);
1645         }
1646         Button* pButtonControl = static_cast<Button*>(GetControl(IDC_HOLD_BUTTON));
1647         if(pButtonControl != null)
1648         {
1649                 pButtonControl->SetShowState(showState);
1650         }
1651 }
1652
1653 void
1654 ActiveCallForm::SetShowStateOnKeypad(bool showState)
1655 {
1656         Label* pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_LABEL));
1657         pLblControl->SetShowState(showState);
1658         pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL));
1659         pLblControl->SetShowState(showState);
1660         pLblControl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1661         pLblControl->SetShowState(showState);
1662         if (__pSmallPhotoLabel != null)
1663         {
1664                 __pSmallPhotoLabel->SetShowState(showState);
1665         }
1666
1667         switch (__formType)
1668         {
1669         case FORMTYPE_ACTIVECALL:
1670         {
1671                 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1672                 pLblControl->SetShowState(showState);
1673                 pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1674                 pLblControl->SetShowState(showState);
1675                 SetHoldButtonShowState(showState);
1676         }
1677         break;
1678
1679         case FORMTYPE_MULTIPLECALLS:
1680         {
1681                 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER1_LABEL));
1682                 pLblControl->SetShowState(showState);
1683                 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_LABEL));
1684                 pLblControl->SetShowState(showState);
1685                 pLblControl = static_cast<Label*>(GetControl(IDC_NUMBER2_LABEL));
1686                 pLblControl->SetShowState(showState);
1687                 pLblControl = static_cast<Label*>(GetControl(IDC_CALLER2_TIME_LABEL));
1688                 pLblControl->SetShowState(showState);
1689                 pLblControl = static_cast<Label*>(GetControl(IDC_SWAP_LABEL));
1690                 pLblControl->SetShowState(showState);
1691                 pLblControl = static_cast<Label*>(GetControl(IDC_BACKGROUND_LABEL2));
1692                 pLblControl->SetShowState(showState);
1693                 if (__pActiveCallInfo != null && __pActiveCallInfo->IsConferenceCall() == false)
1694                 {
1695                         pLblControl = static_cast<Label*>(GetControl(IDC_VOICE_CALL_ICON_LABEL));
1696                         pLblControl->SetShowState(showState);
1697                 }
1698                 else
1699                 {
1700                         Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1701                         pButtonControl->SetShowState(showState);
1702                 }
1703                 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_SWAP_BUTTON));
1704                 pButtonControl->SetShowState(showState);
1705         }
1706         break;
1707
1708         case FORMTYPE_ACTIVECONFCALL:
1709         {
1710                 pLblControl = static_cast<Label*>(GetControl(IDC_PARTICIPANTS_LABEL));
1711                 pLblControl->SetShowState(showState);
1712                 SetHoldButtonShowState(showState);
1713                 Button* pButtonControl = static_cast<Button*>(GetControl(IDC_CONF_CALL_MORE_BUTTON));
1714                 pButtonControl->SetShowState(showState);
1715         }
1716         break;
1717
1718         default:
1719                 break;
1720         }
1721 }
1722
1723 void
1724 ActiveCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
1725 {
1726         //Call default implementation of "Object.Equals()"
1727         //returns true, if they are pointing to same address.
1728         if (__pActiveCallTimer->Equals(timer))
1729         {
1730                 Label* pTimerLbl = static_cast<Label*>(GetControl(IDC_CALLER1_TIME_LABEL));
1731                 if (pTimerLbl)
1732                 {
1733                         String activeCallTime = pTimerLbl->GetText();
1734                         // Create a StringTokenizer instance
1735                         StringTokenizer strTokens(activeCallTime, L":");
1736
1737                         int count = strTokens.GetTokenCount(); // count == 3
1738                         String token;
1739                         int sec = 0;
1740                         int min = 0;
1741                         int hr = 0;
1742                         for (int index = 0; index < count; index++)
1743                         {
1744                                 switch (index)
1745                                 {
1746                                 case 0:
1747                                         strTokens.GetNextToken(token);
1748                                         Integer::Parse(token, hr);
1749                                         break;
1750
1751                                 case 1:
1752                                         strTokens.GetNextToken(token);
1753                                         Integer::Parse(token, min);
1754                                         break;
1755
1756                                 case 2:
1757                                         strTokens.GetNextToken(token);
1758                                         Integer::Parse(token, sec);
1759                                         break;
1760                                 }
1761                         }
1762                         //update all values
1763                         sec = sec + 1;
1764                         if (sec == IDI_MAX_SECONDS)
1765                         {
1766                                 sec = 0;
1767                                 min = min + 1;
1768                         }
1769                         if (min == IDI_MAX_MINS)
1770                         {
1771                                 min = 0;
1772                                 hr = hr + 1;
1773                         }
1774
1775                         //replace string
1776                         activeCallTime.Clear();
1777                         if (hr <= 9)
1778                         {
1779                                 activeCallTime.Append("0");
1780                         }
1781                         activeCallTime.Append(hr);
1782                         activeCallTime.Append(":");
1783                         if (min <= 9)
1784                         {
1785                                 activeCallTime.Append("0");
1786                         }
1787                         activeCallTime.Append(min);
1788                         activeCallTime.Append(":");
1789                         if (sec <= 9)
1790                         {
1791                                 activeCallTime.Append("0");
1792                         }
1793                         activeCallTime.Append(sec);
1794                         //update timer label
1795                         pTimerLbl->SetText(activeCallTime);
1796                         pTimerLbl->Invalidate(true);
1797                 }
1798         }
1799 }
1800
1801 ///////////////////////////////////////////////////////////
1802 ///////////     Options Menu List Functionality   /////////
1803 ///////////////////////////////////////////////////////////
1804 void
1805 ActiveCallForm::OnListViewContextItemStateChanged(ListView& listView, int index, int elementId, ListContextItemStatus state)
1806 {
1807 }
1808
1809 void
1810 ActiveCallForm::OnListViewItemStateChanged(ListView& listView, int index, int elementId, ListItemStatus status)
1811 {
1812         //Goto conference call list form
1813         SceneManager* pSceneManager = SceneManager::GetInstance();
1814         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_CONFCALLLIST, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
1815                          SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY), null);
1816 }
1817
1818 void
1819 ActiveCallForm::OnListViewItemSwept(ListView& listView, int index, SweepDirection direction)
1820 {
1821 }
1822
1823 void
1824 ActiveCallForm::OnListViewItemLongPressed(ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
1825 {
1826 }
1827
1828 int
1829 ActiveCallForm::GetItemCount(void)
1830 {
1831         return IDI_MOREOPTIONS_LIST_ITEMS;
1832 }
1833
1834 ListItemBase*
1835 ActiveCallForm::CreateItem(int index, int itemWidth)
1836 {
1837         //create 1st Menu option
1838         CustomItem* pItem = new (std::nothrow) CustomItem();
1839         pItem->Construct(IDI_OPTIONMENU_DIMEN, LIST_ANNEX_STYLE_NORMAL);
1840
1841         //Set background 9-patch bitmap to option menu
1842         Bitmap* pBgBmp = AppUtility::GetBitmapFromResourcesN(IDB_POPUP_BG_ICON);
1843         if (pBgBmp != null && pBgBmp->IsNinePatchedBitmap())
1844         {
1845                 Canvas bgCanvas;
1846                 bgCanvas.Construct(Rectangle(IDI_OPTIONMENU_POS, IDI_OPTIONMENU_DIMEN));
1847                 bgCanvas.DrawNinePatchedBitmap(bgCanvas.GetBounds(), *pBgBmp);
1848         }
1849         else
1850         {
1851                 pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, Color(40, 45, 48));
1852         }
1853         delete pBgBmp;
1854         pBgBmp = null;
1855
1856         //Set bitmap to option menu
1857         Bitmap* pNormalConfCallBmp = AppUtility::GetBitmapFromResourcesN(IDB_MORE_MANAGE_CONFERENCE_ICON ,
1858                                                                                                                                          W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP);
1859         pItem->AddElement(Rectangle(16, 17, W_MGR_CONFCALL_BITMAP, H_MGR_CONFCALL_BITMAP), 1, *pNormalConfCallBmp, null, null);
1860         // Deallocate bitmaps
1861         delete pNormalConfCallBmp;
1862         pNormalConfCallBmp = null;
1863
1864         //Set text to menu option
1865         String confCallName = AppUtility::GetResourceString(IDS_MGR_CONF_CALL_LIST_STR);
1866
1867         TextElement* pTextElement = new (std::nothrow) TextElement();
1868         pTextElement->Construct(confCallName);
1869         pTextElement->SetTextColor(COLOR_POPUP_TEXT);
1870         //create font
1871         Font font;
1872         font.Construct(FONT_STYLE_PLAIN, IDI_POPUP_TEXT_SIZE);
1873         pTextElement->SetFont(font);
1874         //construct Enriched text
1875         EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1876         FloatDimension textDimension;
1877         font.GetTextExtent(confCallName, confCallName.GetLength(), textDimension);
1878         textDimension.height = textDimension.height + font.GetDescender();
1879         pEnrichedText->Construct(textDimension);
1880         //add text element to enriched text
1881         pEnrichedText->Add(*pTextElement);
1882
1883         //Add Enriched text to pItem
1884         FloatPoint textPos(((2 * IDI_OPTIONMENU_ITEM_SPACING) + W_MGR_CONFCALL_BITMAP), ((IDI_OPTIONMENU_DIMEN.height - textDimension.height) / 2));
1885         pItem->AddElement(FloatRectangle(textPos, textDimension), 2, *pEnrichedText);
1886         // Cleans up
1887         pEnrichedText->RemoveAll(true);
1888         delete pEnrichedText;
1889         return pItem;
1890 }
1891
1892 bool
1893 ActiveCallForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
1894 {
1895         delete pItem;
1896         return true;
1897 }
1898
1899 void
1900 ActiveCallForm::OnForeground(void)
1901 {
1902         AppLogDebug("Enter");
1903         __pCallPresentor->OnAppForeground();
1904 }