Fix forN_SE-36058
[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         break;
337
338         default:
339                 break;
340         }
341
342         if (__pEndCallEventTimer)
343         {
344                 __pEndCallEventTimer->Start(IDI_APP_END_TIMER);
345         }
346
347         if (pArgs)
348         {
349                 pArgs->RemoveAll();
350                 delete pArgs;
351                 pArgs = null;
352         }
353         AddOrientationEventListener(*this);
354 }
355
356 void
357 EndCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
358 {
359         if (__pEndCallEventTimer != null)
360         {
361                 __pEndCallEventTimer->Cancel();
362         }
363         if (__pContactNumber)
364         {
365                 delete __pContactNumber;
366                 __pContactNumber = null;
367         }
368         if (__pSmallPhotoLabel != null)
369         {
370                 __pSmallPhotoLabel->SetShowState(false);
371         }
372         //remove itself as listener
373         CallApp* pPhoneApp = static_cast<CallApp*>(CallApp::GetInstance());
374         pPhoneApp->RemoveAppStateChangeListener(*this);
375         RemoveOrientationEventListener(*this);
376 }
377
378 result
379 EndCallForm::OnDraw(void)
380 {
381         return E_SUCCESS;
382 }
383
384 void
385 EndCallForm::ShowViewContactButton(void)
386 {
387         __pCallButtonsPanel->ShowViewContactButton();
388 }
389
390 void
391 EndCallForm::ShowAddContactButton(void)
392 {
393         __pCallButtonsPanel->ShowAddContactButton();
394 }
395
396 void
397 EndCallForm::ShowPhoneNumber(const String& phoneNumber, const String& lblName)
398 {
399         String formattedNumber = phoneNumber;
400         Label* pContactLbl = static_cast<Label*>(GetControl(lblName));
401         pContactLbl->SetText(formattedNumber);
402 }
403
404 void
405 EndCallForm::ShowPersonDetails(const String& phoneNumber, const String& nameLblName, const String& photoLblName, AppCallInfo* pCallInfo)
406 {
407         //show phone number
408         ShowPhoneNumber(phoneNumber, IDC_NUMBER1_LABEL);
409
410         Label* pNameLbl = static_cast<Label*>(GetControl(nameLblName));
411         Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLblName));
412
413         //fetch contact details based on phone number
414         String* pDisplayName = pCallInfo->FetchCallerNameN();
415         Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
416
417         //passing an empty string to SetText fails in label,
418         //if previously valid text has been set
419         if (pDisplayName != null && pDisplayName->IsEmpty() == true && pNameLbl->GetText().IsEmpty() == false)
420         {
421                 pDisplayName->Append(L" ");
422         }
423
424         // show display name on name Label
425         if (pDisplayName != null)
426         {
427                 pNameLbl->SetText(*pDisplayName);
428         }
429
430         // If record not found or no photo id present for user,
431         //fetch default bitmap.
432         if (pPhotoBitmap != null)
433         {
434                 if(pPhotoBitmap->GetHeight() <= H_SMALL_PHOTO
435                                 && pPhotoBitmap->GetWidth() <= W_SMALL_PHOTO)
436                 {
437                         ShowThumbnailImage(pPhotoBitmap,photoLblName);
438                 }
439                 else
440                 {
441                         Canvas* pCanvas = new (std::nothrow) Canvas;
442                         Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
443                         pCanvas->Construct(canvasRect);
444                         //draw the contact bitmap
445                         pCanvas->DrawBitmap(canvasRect,*pPhotoBitmap);
446                         Bitmap* pNewPhotoId = new Bitmap();
447                         pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
448                         delete pCanvas;
449
450                         pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
451                         pPhotoLbl->Invalidate(true);
452                         delete pNewPhotoId;
453                 }
454         }
455         else
456         {
457                 //Set Default Photo
458                 Bitmap* pDefaultPhoto = AppUtility::GetBitmapFromResourcesN(IDB_END_CALL_DEFAULT_ICON,W_PHOTO_LABEL,H_PHOTO_LABEL);
459                 if (pDefaultPhoto != null)
460                 {
461                         pPhotoLbl->SetBackgroundBitmap(*pDefaultPhoto);
462                         pPhotoLbl->Invalidate(true);
463                         delete pDefaultPhoto;
464                 }
465         }
466         RequestRedraw(true);
467         //free resources
468         if (pDisplayName)
469         {
470                 delete pDisplayName;
471                 pDisplayName = null;
472         }
473         if (pPhotoBitmap)
474         {
475                 delete pPhotoBitmap;
476                 pPhotoBitmap = null;
477         }
478 }
479
480 void
481 EndCallForm::ShowThumbnailImage(const Bitmap* pPhotoId,const String& photoLabel)
482 {
483         Label* pPhotoLbl = static_cast<Label*>(GetControl(photoLabel));
484
485         if (pPhotoLbl != null && pPhotoId != null)
486         {
487                 Canvas* pCanvas = new (std::nothrow) Canvas;
488                 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
489                 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
490                 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
491                 pCanvas->Construct(canvasRect);
492                 //draw the back ground
493                 pCanvas->DrawBitmap(canvasRect,*pBackground);
494                 //draw shadow (to be enabled after correct shadow image is provided )
495                 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
496                         //      (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
497                 //draw the contact bitmap
498                 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
499                                 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
500                 Bitmap* pNewPhotoId = new Bitmap();
501                 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
502                 delete pCanvas;
503
504                 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
505                 pPhotoLbl->Invalidate(true);
506                 delete pNewPhotoId;
507                 delete pBackground;
508                 delete pShadow;
509         }
510 }
511
512 void
513 EndCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
514 {
515         if (__pSmallPhotoLabel != null)
516         {
517                 RemoveControl(*__pSmallPhotoLabel);
518                 __pSmallPhotoLabel = null;
519         }
520         //Draw Small Photo and show on small photo label
521         __pSmallPhotoLabel  = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
522         __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
523         __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
524         __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
525         // Add a Label to the Form
526         AddControl(*__pSmallPhotoLabel);
527         __pSmallPhotoLabel->Invalidate(true);
528 }
529
530 void
531 EndCallForm::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
532 {
533         //goto initial scene or close application, since this was last active call.
534         HandleLastCallCompletion();
535 }
536
537 void
538 EndCallForm::OnAppControlCompleteResponseReceived(const AppId& appId, const String& operationId, AppCtrlResult appControlResult, const IMap* pExtraData)
539 {
540         AppLogDebug("Enter");
541         if (__isMsgAppControlLaunched == true)
542         {
543                 //Message AppControl request completed.
544                 __isMsgAppControlLaunched = false;
545                 __pCallPresentor->AppControlRequestCompleted();
546         }
547         if(__isContactAppControlLaunched == true)
548         {
549                 //notify app control completed
550                 __isContactAppControlLaunched = false;
551                 __pCallPresentor->AppControlRequestCompleted();
552         }
553         //AppControl completed, goto initial scene if present
554         //else exit.
555         HandleLastCallCompletion();
556 }
557
558 void
559 EndCallForm::HandleLastCallCompletion(void)
560 {
561         CallApp* pPhoneApp = (static_cast<CallApp*>(UiApp::GetInstance()));
562         pPhoneApp->Terminate();
563 }
564
565 void
566 EndCallForm::OnForeground(void)
567 {
568         AppLogDebug("Enter");
569         //If Contact app control was launched
570         //as we do not know if it success or failed.
571         if(__isContactAppControlLaunched == true)
572         {
573                 if(__pEndCallEventTimer != null)
574                 {
575                         __pEndCallEventTimer->Start(2000);
576                 }
577                 if (__pContactNumber != null && __pContactNumber->IsEmpty() == false)
578                 {
579                         AppCallInfo* ActiveCallInfo = new (std::nothrow) AppCallInfo();
580                         ActiveCallInfo->SetContactNumber(*__pContactNumber);
581                         Contact* pContact = __pCallPresentor->GetContactN(*__pContactNumber);
582                         if (pContact != null)
583                         {
584                                 ActiveCallInfo->SetContactInfo(*pContact);
585                         }
586                         //before setting check if the contact is deleted
587                         if(pContact != null)
588                         {
589
590                                 ShowViewContactButton();
591                                 delete pContact;
592                                 pContact = null;
593                         }
594                         else
595                         {
596                                 ShowAddContactButton();
597                         }
598                         ShowPersonDetails(*__pContactNumber, IDC_CALLER1_LABEL, IDC_CALLER1_BIGPHOTO_LABEL,ActiveCallInfo);
599                         delete ActiveCallInfo;
600                 }
601
602                 //notify app control completed
603                 __isContactAppControlLaunched = false;
604                 __pCallPresentor->AppControlRequestCompleted();
605         }
606
607         if (__isMsgAppControlLaunched == true)
608         {
609                 //Message AppControl request completed.
610                 if(__pEndCallEventTimer != null)
611                 {
612                         __pEndCallEventTimer->Start(2000);
613                 }
614                 __isMsgAppControlLaunched = false;
615                 __pCallPresentor->AppControlRequestCompleted();
616         }
617         AppLogDebug("Exit");
618 }
619
620 void
621 EndCallForm::OnBackground(void)
622 {
623         AppLogDebug("Enter");
624 }
625
626 void
627 EndCallForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
628 {
629         AppLogDebug("Enter");
630         if (__pCallButtonsPanel != null)
631         {
632                 //update position of call buttons panel
633                 Label* pKeysBgLbl = static_cast<Label*>(GetControl(IDC_KEY_BG_LABEL, true));
634                 __pCallButtonsPanel->SetBounds(pKeysBgLbl->GetBounds());
635                 //bring button on top
636                 __pCallButtonsPanel->SetButtonPosition();
637                 RelativeLayout* pRelativeLayout = dynamic_cast<RelativeLayout*>(GetPortraitLayoutN());
638                 if (pRelativeLayout != null)
639                 {
640                         //pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_TOP_TO_TOP);
641                 }
642                 pRelativeLayout = dynamic_cast<RelativeLayout*>(GetLandscapeLayoutN());
643                 if (pRelativeLayout != null)
644                 {
645                         pRelativeLayout->SetRelation(*__pCallButtonsPanel, *pKeysBgLbl, RECT_EDGE_RELATION_LEFT_TO_LEFT);
646                         pRelativeLayout->SetRelation(*__pCallButtonsPanel, *this, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
647                 }
648         }
649 }