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