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