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