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