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