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