Fix for 37272 37208 37254
[apps/osp/Call.git] / src / CallEndCallForm.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    CallEndCallForm.cpp
19  * @brief       End Call form implementation
20  */
21 #include <FApp.h>
22 #include <FUi.h>
23 #include <FMedia.h>
24 #include "CallApp.h"
25 #include "CallAppUtility.h"
26 #include "CallEndCallForm.h"
27 #include "CallButtonsPanel.h"
28 #include "CallPresentationModel.h"
29 #include "CallSceneRegister.h"
30 #include "CallTypes.h"
31
32 using namespace Tizen::App;
33 using namespace Tizen::Base;
34 using namespace Tizen::Base::Collection;
35 using namespace Tizen::Graphics;
36 using namespace Tizen::Media;
37 using namespace Tizen::Ui;
38 using namespace Tizen::Ui::Controls;
39 using namespace Tizen::Ui::Scenes;
40 using namespace Tizen::Social;
41
42 //constants
43 const int IDI_APP_END_TIMER = 3000;
44 const int W_PHOTO_LABEL = 720;
45 const int H_PHOTO_LABEL = 720;
46 const int X_PHOTO_LBL = 166;
47 const int Y_PHOTO_LBL = 232;
48 const int W_PHOTO_LBL = 388;
49 const int H_PHOTO_LBL = 388;
50 static const wchar_t* IDL_END_CALL_FORM = L"IDL_END_CALL_FORM";
51 static const wchar_t* IDC_NUMBER1_LABEL = L"IDC_NUMBER1_LABEL";
52 static const wchar_t* IDC_CALLER1_LABEL = L"IDC_CALLER1_LABEL";
53 static const wchar_t* IDC_KEY_BG_LABEL = L"IDC_KEY_BG_LABEL";
54 static const wchar_t* IDC_CALLER1_BIGPHOTO_LABEL = L"IDC_CALLER1_BIGPHOTO_LABEL";
55 static const wchar_t* IDB_END_CALL_DEFAULT_ICON = L"C01-1_call_default_caller ID_720x720.png";
56
57
58 EndCallForm::EndCallForm(void)
59 : BaseForm(FORMTYPE_ENDCALL)
60 {
61         __pCallButtonsPanel = null;
62         __pContactNumber = null;
63         __pEndCallEventTimer = null;
64         __pSmallPhotoLabel = null;
65         __isMsgAppControlLaunched = false;
66         __isContactAppControlLaunched = false;
67 }
68
69 EndCallForm::~EndCallForm(void)
70 {
71         if (__pEndCallEventTimer != null)
72         {
73                 __pEndCallEventTimer->Cancel();
74                 delete __pEndCallEventTimer;
75                 __pEndCallEventTimer = null;
76         }
77         if (__pSmallPhotoLabel != null)
78         {
79                 __pSmallPhotoLabel = null;
80         }
81 }
82
83 void
84 EndCallForm::Initialize(void)
85 {
86         Construct(IDL_END_CALL_FORM);
87 }
88
89 result
90 EndCallForm::OnInitializing(void)
91 {
92         result r = E_SUCCESS;
93
94         //initialize keypad and buttons
95         InitializeCallButtonsPanel();
96
97         __pEndCallEventTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
98         r = __pEndCallEventTimer->Construct(*this);
99
100         __pCallPresentor = CallPresentationModel::GetInstance();
101         return r;
102 }
103
104 void
105 EndCallForm::InitializeCallButtonsPanel(void)
106 {
107         Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
108         Bitmap* pBgBitmap = AppUtility::GetBitmapFromResourcesN(IDB_BACKGROUND_BITMAP, pKeysBgLbl->GetWidth(), pKeysBgLbl->GetHeight());
109         if (pBgBitmap != null)
110         {
111                 pKeysBgLbl->SetBackgroundBitmap(*pBgBitmap);
112         }
113         if (__pCallButtonsPanel == null)
114         {
115                 __pCallButtonsPanel = new (std::nothrow) CallButtonsPanel();
116                 __pCallButtonsPanel->ConstructPanel(this, FORMTYPE_ENDCALL);
117                 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
118                 AddControl(*__pCallButtonsPanel);
119         }
120
121         RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
122         if (pRelativeLayout != null)
123         {
124                 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
125         }
126         pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
127         if (pRelativeLayout != null)
128         {
129                 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
130                 pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
131         }
132 }
133
134 void
135 EndCallForm::AddKeyPadActionListener(const String& keyName, CommandIds cmdId)
136 {
137         Button* pButton = static_cast<Button*>(GetControl(keyName));
138         if (pButton != null)
139         {
140                 pButton->SetActionId(cmdId);
141                 pButton->AddActionEventListener(*this);
142         }
143 }
144
145 result
146 EndCallForm::OnTerminating(void)
147 {
148         result r = E_SUCCESS;
149
150         if (__pCallPresentor)
151         {
152                 __pCallPresentor = null;
153         }
154         return r;
155 }
156
157 void
158 EndCallForm::OnActionPerformed(const Control& source, int actionId)
159 {
160         SceneManager* pSceneManager = SceneManager::GetInstance();
161         AppAssert(pSceneManager);
162
163         switch (actionId)
164         {
165         case IDA_VOICE_CALL:
166         {
167                 //check if EndCallTimer is running, then cancel it
168                 if(__pEndCallEventTimer != null)
169                 {
170                         __pEndCallEventTimer->Cancel();
171                 }
172                 //make an outgoing call with given number
173                 String* contactTxt = new (std::nothrow) String(*__pContactNumber);
174                 //switch to dialing outgoing call form
175                 ArrayList* pContact = new (std::nothrow) ArrayList(SingleObjectDeleter);
176                 pContact->Construct();
177                 pContact->Add(contactTxt);
178
179                 //Check if dialing a call is possible
180                 bool isSimInitialized = __pCallPresentor->CheckSimInitializationIsCompleted();
181                 if (isSimInitialized)
182                 {
183                         //Check if dialing an emergency call
184                         bool isEmergencyCall = __pCallPresentor->IsEmergencyNumber(*contactTxt, true);
185                         if (isEmergencyCall)
186                         {
187                                 pSceneManager->GoForward( ForwardSceneTransition( IDSCN_SCENE_OUT_EMERGENCYCALL), pContact);
188                         }
189                         else
190                         {
191                                 pSceneManager->GoForward( ForwardSceneTransition(IDSCN_SCENE_OUTCALL), pContact);
192                         }
193                 }
194                 else
195                 {
196                         //Show error message Popup
197                         HandleTelephonyError(ERROR_CODE_SIM_INITIALIZATION_FAILED);
198                 }
199         }
200         break;
201
202         case IDA_VIDEO_CALL:
203                 //Make Video Call
204                 break;
205
206         case IDA_MESSAGE:
207         {
208                 if (__isMsgAppControlLaunched == true)
209                 {
210                         //AppControl already launched.
211                         return;
212                 }
213                 //launch message AppControl
214                 __isMsgAppControlLaunched = __pCallPresentor->LaunchComposeMessageAppControl(*__pContactNumber, this);
215                 if (__isMsgAppControlLaunched == true && __pEndCallEventTimer != null)
216                 {
217                         //cancel EndCallTimer, if AppControl request was successful.
218                         __pEndCallEventTimer->Cancel();
219                 }
220         }
221         break;
222
223         case IDA_ADD_TO_CONTACTS:
224         {
225                 if(__isContactAppControlLaunched == true)
226                 {
227                         //AppControl already launched.
228                         AppLogDebug("__isContactAppControlLaunched == true");
229                         return;
230                 }
231                 HandleAddToContacts();
232         }
233         break;
234
235         default:
236                 break;
237         }
238 }
239
240 void
241 EndCallForm::HandleAddToContacts(void)
242 {
243         AppLogDebug("Enter");
244
245         Contact* pContact = __pCallPresentor->GetContactN(*__pContactNumber);
246         //Launch Contact AppControl
247         String requestParameter;
248         if (pContact != null)
249         {
250                 //View Contact
251                 requestParameter.Append(pContact->GetRecordId());
252                 __isContactAppControlLaunched = __pCallPresentor->LaunchViewContactAppControl(requestParameter, this);
253                 delete pContact;
254                 pContact = null;
255         }
256         else
257         {
258                 //Add To Contact
259                 requestParameter.Append(*__pContactNumber);
260                 __isContactAppControlLaunched = __pCallPresentor->LaunchAddContactAppControl(requestParameter, this);
261         }
262
263         if (__isContactAppControlLaunched == true && __pEndCallEventTimer != null)
264         {
265                 //cancel EndCallTimer, if AppControl request was success.
266                 __pEndCallEventTimer->Cancel();
267         }
268 }
269
270 void
271 EndCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
272 {
273         //set itself as listener
274         __pCallPresentor->SetTelEventListener(this);
275         //listen to Foreground events
276         CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
277         pPhoneApp->AddAppStateChangeListener(*this);
278         __isMsgAppControlLaunched = false;
279         __isContactAppControlLaunched = false;
280
281         switch (__formType)
282         {
283         case FORMTYPE_ENDCALL:
284         {
285                 //fetch ended call details
286                 AppCallInfo* pEndCall = static_cast<AppCallInfo*>(pArgs->GetAt(0));
287
288                 //contact number
289                 __pContactNumber = new (std::nothrow) String();
290                 if(pEndCall->GetContactNumber().IsEmpty() == false)
291                 {
292                         __pContactNumber->Append(pEndCall->GetContactNumber());
293                 }
294                 else
295                 {
296                         __pContactNumber->Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
297                 }
298
299                 //Fetch & show contact person details
300                 ShowPersonDetails(*__pContactNumber, IDC_CALLER1_LABEL, IDC_CALLER1_BIGPHOTO_LABEL,pEndCall);
301                 //If call is hidden means contact number is empty,
302                 //or if call is from known number(i.e present in contacts db), Then do NOT show "Add to Contact" button.
303                 if (pEndCall->GetContactInfo() != null)
304                 {
305                         //Check if contact is deleted in mean time.
306                         Contact* pContact = __pCallPresentor->GetContactN(pEndCall->GetContactNumber());
307                         //before setting check if the contact is deleted
308                         if(pContact != null)
309                         {
310                                 ShowViewContactButton();
311                                 delete pContact;
312                                 pContact = null;
313                         }
314                         else
315                         {
316                                 ShowAddContactButton();
317                         }
318                 }
319                 else
320                 {
321                         //Show AddToContact
322                         ShowAddContactButton();
323                 }
324
325                 //Check if call is Emergency call or Hidden call,
326                 //then disable all button in Call button panel.
327                 if (pEndCall->IsEmergency() == true || pEndCall->GetContactNumber().IsEmpty() == true)
328                 {
329                         __pCallButtonsPanel->SetEndCallPanelState(false);
330                 }
331                 else
332                 {
333                         __pCallButtonsPanel->SetEndCallPanelState(true);
334                 }
335
336                 //check if we reached the end call form of an outgoing call then don't show add to contacts
337                 if(pEndCall->GetCalllogType() == CALL_LOG_TYPE_VOICE_OUTGOING)
338                 {
339                         __pCallButtonsPanel->ShowOrHideAddtoContactsButton(false);
340                 }
341                 else if(pEndCall->GetCalllogType() == CALL_LOG_TYPE_VOICE_INCOMING)
342                 {
343                         __pCallButtonsPanel->ShowOrHideAddtoContactsButton(true);
344                 }
345
346         }
347         break;
348
349         default:
350                 break;
351         }
352
353         //Before starting end call timer check if messaging appcontrol was launched during incoming call
354         if (__pEndCallEventTimer && __pCallPresentor->IsAppControlRunning() == false)
355         {
356                 __pEndCallEventTimer->Start(IDI_APP_END_TIMER);
357         }
358
359         if (pArgs)
360         {
361                 pArgs->RemoveAll();
362                 delete pArgs;
363                 pArgs = null;
364         }
365         CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
366         pCallApp->SetTopMostWindow(false);
367         AddOrientationEventListener(*this);
368 }
369
370 void
371 EndCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
372 {
373         if (__pEndCallEventTimer != null)
374         {
375                 __pEndCallEventTimer->Cancel();
376         }
377         if (__pContactNumber)
378         {
379                 delete __pContactNumber;
380                 __pContactNumber = null;
381         }
382         if (__pSmallPhotoLabel != null)
383         {
384                 __pSmallPhotoLabel->SetShowState(false);
385         }
386         //remove itself as listener
387         CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
388         pPhoneApp->RemoveAppStateChangeListener(*this);
389         RemoveOrientationEventListener(*this);
390 }
391
392 result
393 EndCallForm::OnDraw(void)
394 {
395         return E_SUCCESS;
396 }
397
398 void
399 EndCallForm::ShowViewContactButton(void)
400 {
401         __pCallButtonsPanel->ShowViewContactButton();
402 }
403
404 void
405 EndCallForm::ShowAddContactButton(void)
406 {
407         __pCallButtonsPanel->ShowAddContactButton();
408 }
409
410 void
411 EndCallForm::ShowPhoneNumber(const String& phoneNumber, const String& lblName)
412 {
413         String formattedNumber = phoneNumber;
414         Label* pContactLbl = static_cast<Label*>(GetControl(lblName));
415         pContactLbl->SetText(formattedNumber);
416 }
417
418 void
419 EndCallForm::ShowPersonDetails(const String& phoneNumber, const String& nameLblName, const String& photoLblName, AppCallInfo* pCallInfo)
420 {
421         //show phone number
422         ShowPhoneNumber(phoneNumber, IDC_NUMBER1_LABEL);
423
424         Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
425         Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLblName));
426
427         //fetch contact details based on phone number
428         String* pDisplayName = pCallInfo->FetchCallerNameN();
429         Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
430
431         //passing an empty string to SetText fails in label,
432         //if previously valid text has been set
433         if (pDisplayName != null && pDisplayName->IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
434         {
435                 pDisplayName->Append(L" ");
436         }
437
438         // show display name on name Label
439         if (pDisplayName != null)
440         {
441                 pNameLbl->SetText(*pDisplayName);
442         }
443
444         // If record not found or no photo id present for user,
445         //fetch default bitmap.
446         if (pPhotoBitmap != null)
447         {
448                 if(pPhotoBitmap->GetHeight() <= H_SMALL_PHOTO
449                                 && pPhotoBitmap->GetWidth() <= W_SMALL_PHOTO)
450                 {
451                         ShowThumbnailImage(pPhotoBitmap,photoLblName);
452                 }
453                 else
454                 {
455                         Canvas* pCanvas = new (std::nothrow) Canvas;
456                         Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
457                         pCanvas->Construct(canvasRect);
458                         //draw the contact bitmap
459                         pCanvas->DrawBitmap(canvasRect,*pPhotoBitmap);
460                         Bitmap* pNewPhotoId = new Bitmap();
461                         pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
462                         delete pCanvas;
463
464                         pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
465                         pPhotoLbl->Invalidate(true);
466                         delete pNewPhotoId;
467                 }
468         }
469         else
470         {
471                 //Set Default Photo
472                 Bitmap* pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_END_CALL_DEFAULT_ICON,W_PHOTO_LABEL,H_PHOTO_LABEL);
473                 if (pDefaultPhoto != null)
474                 {
475                         pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
476                         pPhotoLbl->Invalidate(true);
477                         delete pDefaultPhoto;
478                 }
479         }
480         RequestRedraw(true);
481         //free resources
482         if (pDisplayName)
483         {
484                 delete pDisplayName;
485                 pDisplayName = null;
486         }
487         if (pPhotoBitmap)
488         {
489                 delete pPhotoBitmap;
490                 pPhotoBitmap = null;
491         }
492 }
493
494 void
495 EndCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,const String& photoLabel)
496 {
497         Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
498
499         if (pPhotoLbl != null && pPhotoId != null)
500         {
501                 Canvas* pCanvas = new (std::nothrow) Canvas;
502                 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
503                 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
504                 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
505                 pCanvas->Construct(canvasRect);
506                 //draw the back ground
507                 pCanvas->DrawBitmap(canvasRect,*pBackground);
508                 //draw shadow (to be enabled after correct shadow image is provided )
509                 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
510                         //      (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
511                 //draw the contact bitmap
512                 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
513                                 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
514                 Bitmap* pNewPhotoId = new Bitmap();
515                 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
516                 delete pCanvas;
517
518                 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
519                 pPhotoLbl->Invalidate(true);
520                 delete pNewPhotoId;
521                 delete pBackground;
522                 delete pShadow;
523         }
524 }
525
526 void
527 EndCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
528 {
529         if (__pSmallPhotoLabel != null)
530         {
531                 RemoveControl(*__pSmallPhotoLabel);
532                 __pSmallPhotoLabel = null;
533         }
534         //Draw Small Photo and show on small photo label
535         __pSmallPhotoLabel  = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
536         __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
537         __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
538         __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
539         // Add a Label to the Form
540         AddControl(*__pSmallPhotoLabel);
541         __pSmallPhotoLabel->Invalidate(true);
542 }
543
544 void
545 EndCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
546 {
547         //goto initial scene or close application, since this was last active call.
548         HandleLastCallCompletion();
549 }
550
551 void
552 EndCallForm::OnAppControlCompleteResponseReceived(const AppId& appId, const String& operationId, AppCtrlResult appControlResult, const IMap* pExtraData)
553 {
554         AppLogDebug("Enter");
555         if (__isMsgAppControlLaunched == true)
556         {
557                 //Message AppControl request completed.
558                 __isMsgAppControlLaunched = false;
559                 __pCallPresentor->AppControlRequestCompleted();
560         }
561         if(__isContactAppControlLaunched == true)
562         {
563                 //notify app control completed
564                 __isContactAppControlLaunched = false;
565                 __pCallPresentor->AppControlRequestCompleted();
566         }
567         //AppControl completed, goto initial scene if present
568         //else exit.
569         HandleLastCallCompletion();
570 }
571
572 void
573 EndCallForm::HandleLastCallCompletion(void)
574 {
575         CallApp* pPhoneApp = (static_cast<CallApp*>(UiApp::GetInstance()));
576         pPhoneApp->Terminate();
577 }
578
579 void
580 EndCallForm::OnForeground(void)
581 {
582         AppLogDebug("Enter");
583         //If Contact app control was launched
584         //as we do not know if it success or failed.
585         if(__isContactAppControlLaunched == true)
586         {
587                 if(__pEndCallEventTimer != null)
588                 {
589                         __pEndCallEventTimer->Start(2000);
590                 }
591                 if (__pContactNumber != null && __pContactNumber->IsEmpty() == false)
592                 {
593                         AppCallInfo* ActiveCallInfo = new (std::nothrow) AppCallInfo();
594                         ActiveCallInfo->SetContactNumber(*__pContactNumber);
595                         Contact* pContact = __pCallPresentor->GetContactN(*__pContactNumber);
596                         if (pContact != null)
597                         {
598                                 ActiveCallInfo->SetContactInfo(*pContact);
599                         }
600                         //before setting check if the contact is deleted
601                         if(pContact != null)
602                         {
603
604                                 ShowViewContactButton();
605                                 delete pContact;
606                                 pContact = null;
607                         }
608                         else
609                         {
610                                 ShowAddContactButton();
611                         }
612                         ShowPersonDetails(*__pContactNumber, IDC_CALLER1_LABEL, IDC_CALLER1_BIGPHOTO_LABEL,ActiveCallInfo);
613                         delete ActiveCallInfo;
614                 }
615
616                 //notify app control completed
617                 __isContactAppControlLaunched = false;
618                 __pCallPresentor->AppControlRequestCompleted();
619         }
620         else if (__isMsgAppControlLaunched == true)
621         {
622                 //Message AppControl request completed.
623                 if(__pEndCallEventTimer != null)
624                 {
625                         __pEndCallEventTimer->Start(2000);
626                 }
627                 __isMsgAppControlLaunched = false;
628                 __pCallPresentor->AppControlRequestCompleted();
629         }
630         else if(__pCallPresentor->IsAppControlRunning() == true)
631         {
632                 if(__pEndCallEventTimer != null)
633                 {
634                         __pEndCallEventTimer->Start(2000);
635                 }
636                 __pCallPresentor->AppControlRequestCompleted();
637         }
638         AppLogDebug("Exit");
639 }
640
641 void
642 EndCallForm::OnBackground(void)
643 {
644         AppLogDebug("Enter");
645 }
646
647 void
648 EndCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
649 {
650         AppLogDebug("Enter");
651         if (__pCallButtonsPanel != null)
652         {
653                 //update position of call buttons panel
654                 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
655                 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
656                 //bring button on top
657                 __pCallButtonsPanel->SetButtonPosition();
658                 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
659                 if (pRelativeLayout != null)
660                 {
661                         //pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_TOP_TO_TOP);
662                 }
663                 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
664                 if (pRelativeLayout != null)
665                 {
666                         pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
667                         pRelativeLayout->SetRelation(*__pCallButtonsPanel, *this, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
668                 }
669         }
670 }