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