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