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