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