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