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