1.Landscape support for incoming call
[apps/osp/Call.git] / src / CallIncomingCallForm.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    CallIncomingCallForm.cpp
19  * @brief       Incoming Call form implementation
20  */
21 #include <FBaseColIList.h>
22 #include <FMessaging.h>
23 #include "CallIncomingCallForm.h"
24 #include "CallAppUtility.h"
25 #include "CallSettingsManager.h"
26 #include "CallPresentationModel.h"
27 #include "CallSceneRegister.h"
28 #include "CallTypes.h"
29 #include "CallApp.h"
30
31 using namespace Tizen::App;
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Collection;
34 using namespace Tizen::Graphics;
35 using namespace Tizen::Messaging;
36 using namespace Tizen::Ui;
37 using namespace Tizen::Ui::Animations;
38 using namespace Tizen::Ui::Controls;
39 using namespace Tizen::Ui::Scenes;
40
41 //Constants
42 const int W_DIAL_BITMAP = 100;
43 const int H_DIAL_BITMAP = 100;
44 const int W_CREATE_BITMAP = 56;
45 const int H_CREATE_BITMAP = 56;
46 const int X_CREATE_BITMAP = 8;
47 const int Y_CREATE_BITMAP = 8;
48 const int W_MESSAGE_BG_BITMAP = 720;
49 const int H_MESSAGE_BG_BITMAP = 110;
50 const int W_ARROW_BITMAP = 28;
51 const int H_ARROW_BITMAP = 36;
52 const int W_MESSAGE_BITMAP = 50;
53 const int H_MESSAGE_BITMAP = 50;
54 const int X_MESSAGE_BITMAP = 185;
55 const int Y_MESSAGE_BITMAP = 50;
56 const int MESSAGE_TEXT_X_MARGIN = 20;
57 const int MESSAGE_TEXT_Y_MARGIN = 10;
58 const int SEND_TEXT_X_MARGIN = 78;
59 const int SEND_TEXT_Y_MARGIN = 20;
60 const int SEND_BUTTON_ROUND_DIMENSION = 5;
61 const int W_DIAL_LABEL = 188;
62 const int H_DIAL_LABEL = 188;
63 const int DIAL_ICON_X_OFFSET = 44;
64 const int DIAL_ICON_Y_OFFSET = 44;
65 const int REJECT_LABEL_X_OFFSET = 492;
66 const int X_CALL_PANEL = 20;
67 const int Y_CALL_PANEL = 110;
68 const int H_CALL_PANEL = 188;
69 const int Y_ARROW_LABEL = 79;
70 const int W_ARROW_LABEL = 20;
71 const int H_ARROW_LABEL = 32;
72 const int VALID_TOUCH_X_OFFSET = 158;
73 const int VALID_TOUCH_Y_OFFSET = 158;
74 const int X_ARROW_LABEL_STARTPOS = 206; // 188 circle wodth , 18 GUI spec
75 const int X_ARROW_REJECT_LABEL_STARTPOS = 454; // 700 width of panel - 20 offset - 188 circle width - 18 GUI spec - 20 width of image
76 const int ARROW_LABEL_X_MARGIN = 48; //20 width of arrow and 28 GUI spec
77 const int ACCEPT_LABEL_RELATIVE_POS = -384; //relative pos of accept labels right to reject labels left
78 const int MAX_LIST_HEIGHT = 448;//678;
79 const int H_REJECT_VIEW_FOOTER = 98;
80 const int X_LIST_TEXT_ITEM = 16;
81 const int W_LIST_TEXT_ITEM = 452;
82 const int H_LIST_TEXT_ITEM = 111;
83 const int X_SEND_TEXT_ITEM = 484;
84 const int Y_SEND_TEXT_ITEM = 20;
85 const int W_SEND_TEXT_ITEM = 220;
86 const int H_SEND_TEXT_ITEM = 72;
87 const int X_PHOTO_LBL = 166;
88 const int Y_PHOTO_LBL = 232;
89 const int W_PHOTO_LBL = 388;
90 const int H_PHOTO_LBL = 388;
91 const int W_PHOTO_LABEL = 720;
92 const int H_PHOTO_LABEL = 720;
93 const int COUNT_ARROW_ELEMENTS = 3;
94
95 const unsigned int COLOR_SEND_BUTTON_PRESSED = Color32<130, 142, 150>::Value;
96 const unsigned int COLOR_SEND_BUTTON_NORMAL = Color32<64, 156, 211>::Value;
97 const unsigned int COLOR_SWIPE_PANEL = Color32<0, 0, 0, 255>::Value;
98 const unsigned int COLOR_LIST_TEXT_NORMAL = Color32<0, 0, 0>::Value;
99 const unsigned int COLOR_LIST_TEXT_PRESSED = Color32<249, 249, 249>::Value;
100
101 const int FONT_SIZE_MSG_TXT = 44;
102
103 static const wchar_t* IDL_INCOMING_CALL_FORM = L"IDL_INCOMING_CALL_FORM";
104 static const wchar_t* IDB_REJECT_MESSAGE_BG = L"C01-1_Reject_message_bg.png";
105 static const wchar_t* IDB_REJECT_MESSAGE_UP_ARROW = L"C01-1_Reject_message_arrow_01.png";
106 static const wchar_t* IDB_REJECT_MESSAGE_DOWN_ARROW = L"C01-1_Reject_message_arrow_02.png";
107 static const wchar_t* IDB_REJECT_MESSAGE_ICON = L"C01-1_icon_Reject_with_Message.png";
108 static const wchar_t* IDB_ACCEPT_CIRCLE_ICON = L"C01-1_accept_left.png";
109 static const wchar_t* IDB_REJECT_CIRCLE_ICON = L"C01-1_reject_right.png";
110 static const wchar_t* IDB_CALL_ACCEPT_ICON = L"C01-1_accept_left_dial_answer.png";
111 static const wchar_t* IDB_CALL_REJECT_ICON = L"C01-1_reject_right_dial_decline.png";
112 static const wchar_t* IDB_ACCEPT_ARROW_ICON = L"C01-1_arrow_g.png";
113 static const wchar_t* IDB_REJECT_ARROW_ICON = L"C01-1_arrow_r.png";
114 static const wchar_t* IDB_CALL_BG = L"C01-1_calling_BG_01.png";
115 static const wchar_t* IDC_REJECT_MESSAGE_BUTTON = L"IDC_REJECT_MESSAGE_BUTTON";
116 static const wchar_t* IDC_REJECT_PANEL = L"IDC_REJECT_PANEL";
117 static const wchar_t* IDC_REJECT_MESSAGE_CANCEL_BUTTON = L"IDC_REJECT_MESSAGE_CANCEL_BUTTON";
118 static const wchar_t* IDC_MSG_TABLEVIEW = L"IDC_MSG_TABLEVIEW";
119 static const wchar_t* IDC_CALLER_LABEL = L"IDC_CALLER_LABEL";
120 static const wchar_t* IDC_NUMBER_LABEL = L"IDC_NUMBER_LABEL";
121 static const wchar_t* IDC_BIG_PHOTO_LABEL = L"IDC_BIG_PHOTO_LABEL";
122 static const wchar_t* IDC_CALLHANDEL_PANEL = L"IDC_CALLHANDEL_PANEL";
123 static const wchar_t* IDC_ACCEPT_LABEL = L"IDC_ACCEPT_LABEL";
124 static const wchar_t* IDC_REJECT_LEBEL = L"IDC_REJECT_LEBEL";
125 static const wchar_t* IDC_ACCEPT_ARROW = L"IDC_ACCEPT_ARROW_";
126 static const wchar_t* IDC_REJECT_ARROW = L"IDC_REJECT_ARROW_";
127 const wchar_t* IDS_REJECT_MESSAGE_BTN = L"IDS_REJECT_MESSAGE_BTN";
128 const wchar_t* IDS_LIST_SEND_BUTTON = L"IDS_LIST_SEND_BUTTON";
129 const wchar_t* IDS_NO_MESSAGE_STR = L"IDS_NO_MESSAGE_STR";
130
131 const wchar_t* IDI_FORM_VISUAL_ELE_NAME = L"FormVisEle";
132 const wchar_t* IDI_PANEL_VISUAL_ELE_NAME = L"PanelVisEle";
133 const wchar_t* IDI_ACCEPT_VISUAL_ELE_NAME = L"AcceptVisEle";
134 const wchar_t* IDI_REJECT_VISUAL_ELE_NAME = L"RejectVisEle";
135 const wchar_t* IDI_ACCEPT_ARROW_VISUAL_ELE_NAME = L"AcceptArrowVisEle";
136 const wchar_t* IDI_REJECT_ARROW_VISUAL_ELE_NAME = L"RejectArrowVisEle";
137 const wchar_t* IDI_REJECT_FINAL_VISUAL_ELE_NAME = L"RejectFinalVisEle";
138 const wchar_t* IDI_ACCEPT_FINAL_VISUAL_ELE_NAME = L"AcceptFinalVisEle";
139
140 class SmsListener
141         : public Object
142         , public ISmsListener
143 {
144 public:
145                 void  OnSmsMessageSent(result r)
146                 {
147                 }
148 };
149
150 IncomingCallForm::IncomingCallForm(void)
151         : BaseForm(FORMTYPE_INCOMINGCALL)
152 {
153         __pActiveContactNo = null;
154         __pRejectMessageList = null;
155         __incomingCallHandle = -1;
156         __isAnswerCallStarted = false;
157         __isRejectCallStarted = false;
158         __pAcceptArrowLabelsList = null;
159         __pRejectArrowLabelsList = null;
160         __pRejectCircle = null;
161         __pAcceptCircle = null;
162         __pAcceptDial = null;
163         __pRejectDial = null;
164         __pAcceptArrow = null;
165         __pRejectArrow = null;
166         __pAcceptLabel = null;
167         __pRejectLabel = null;
168         __pAcceptArrowLabel = null;
169         __pRejectArrowLabel = null;
170         __pCallHandlePanel = null;
171         __pAcceptVisElem = null;
172         __pRejectVisElem = null;
173         __pRejectFinalVisElem = null;
174         __pAcceptFinalVisElem = null;
175         __pAcceptArrowVisElem = null;
176         __pRejectArrowVisElem = null;
177         __pCallPresentor = null;
178         __pOptionPopup = null;
179         __pSmallPhotoLabel = null;
180 }
181
182 IncomingCallForm::~IncomingCallForm(void)
183 {
184 }
185
186 void
187 IncomingCallForm::Initialize(void)
188 {
189         Construct(IDL_INCOMING_CALL_FORM);
190 }
191
192 result
193 IncomingCallForm::OnInitializing(void)
194 {
195         result r = E_SUCCESS;
196         Canvas* pCanvas = null;
197
198         InitializeFooter();
199
200
201         VisualElement* pFormVisElem = new (std::nothrow) VisualElement();
202         r = pFormVisElem->Construct();
203         pFormVisElem->SetBounds(FloatRectangle(GetBounds().x, GetBounds().y, GetBounds().width, GetBounds().height));
204         pFormVisElem->SetShowState(true);
205         pFormVisElem->SetOpacity(1.0f);
206         pFormVisElem->SetName(IDI_FORM_VISUAL_ELE_NAME);
207         GetVisualElement()->AttachChild(*pFormVisElem);
208         pCanvas = pFormVisElem->GetCanvasN();
209         if(pCanvas != null)
210         {
211                 pCanvas->Clear();
212                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
213                 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
214                 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(GetBounds().x, GetBounds().y, GetBounds().width, GetBounds().height));
215                 delete pCanvas;
216                 pCanvas = null;
217         }
218         HideRejectPanel();
219
220         Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
221         if (pButtonRejectMessage)
222         {
223                 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
224                                                                            IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
225                 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
226                                                                            IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
227                 pButtonRejectMessage->SetActionId(IDA_SHOW_REJECT_CALL_MESSAGE_PANEL);
228                 pButtonRejectMessage->AddActionEventListener(*this);
229         }
230
231         //Get Reject list from Settings Manager
232         IMapT<int,String>* pMsgMap = SettingsManager::GetInstance()->GetRejectMessageListN();
233         if(pMsgMap != null)
234         {
235                 __pRejectMessageList = pMsgMap->GetValuesN();
236                 delete pMsgMap;
237                 pMsgMap = null;
238         }
239         InitializeTableView();
240
241         __pAcceptCircle = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
242         __pRejectCircle = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
243         __pAcceptDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_ACCEPT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
244         __pRejectDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_REJECT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
245         __pAcceptArrow = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
246         __pRejectArrow = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
247
248
249         if(__pRejectDial == null)
250         {
251                 AppLogDebug("Null");
252         }
253         //Panel for showing accept and reject call buttons.
254         Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL, true));
255          int yPos = pPhotoLbl->GetX()+pPhotoLbl->GetHeight()+ Y_CALL_PANEL;
256
257         __pCallHandlePanel = static_cast<Panel*>(GetControl(IDC_CALLHANDEL_PANEL, true));
258         __pCallHandlePanel->AddTouchEventListener(*this);
259         __pCallHandlePanel->SetBackgroundColor(COLOR_SWIPE_PANEL);
260         VisualElement* pCallPanelVisElem = new (std::nothrow) VisualElement();
261         r = pCallPanelVisElem->Construct();
262         pCallPanelVisElem->SetBounds(FloatRectangle(__pCallHandlePanel->GetBoundsF()));
263         pCallPanelVisElem->SetShowState(true);
264         pCallPanelVisElem->SetOpacity(1.0f);
265         pCallPanelVisElem->SetName(IDI_PANEL_VISUAL_ELE_NAME);
266         __pCallHandlePanel->GetVisualElement()->AttachChild(*pCallPanelVisElem);
267         pCanvas = pCallPanelVisElem->GetCanvasN();
268         if(pCanvas != null)
269         {
270                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
271                 pCanvas->Clear();
272                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
273                 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
274                 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width, H_CALL_PANEL));
275                 delete pCanvas;
276                 pCanvas = null;
277         }
278         //Lock Label for animation
279         __pAcceptLabel = static_cast<Label*>(GetControl(IDC_ACCEPT_LABEL, true));
280         __pAcceptLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
281         __pAcceptLabel->AddTouchEventListener(*this);
282         //left dial icon
283         __pAcceptVisElem = new (std::nothrow) VisualElement();
284         r = __pAcceptVisElem->Construct();
285         __pAcceptVisElem->SetBounds(FloatRectangle(0, 0, __pAcceptLabel->GetWidth(), __pAcceptLabel->GetHeight()));
286         __pAcceptVisElem->SetShowState(true);
287         __pAcceptVisElem->SetOpacity(1.0f);
288         __pAcceptVisElem->SetName(IDI_ACCEPT_VISUAL_ELE_NAME);
289         __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
290         pCanvas = __pAcceptVisElem->GetCanvasN();
291         if(pCanvas != null)
292         {
293                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
294                 pCanvas->Clear();
295                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
296                 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
297                 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
298                 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pAcceptCircle);
299                 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
300                 delete pCanvas;
301                 pCanvas = null;
302         }
303         //UnLock Label for animation
304         __pRejectLabel = static_cast<Label*>(GetControl(IDC_REJECT_LEBEL, true));
305         __pRejectLabel->AddTouchEventListener(*this);
306         __pRejectLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
307         SetControlAlwaysAtBottom(*__pCallHandlePanel, true);
308
309         //Right reject icon
310         __pRejectVisElem = new (std::nothrow) VisualElement();
311         r = __pRejectVisElem->Construct();
312         __pRejectVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
313         __pRejectVisElem->SetShowState(true);
314         __pRejectVisElem->SetOpacity(1.00f);
315         __pRejectVisElem->SetName(IDI_REJECT_VISUAL_ELE_NAME);
316         __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
317         pCanvas = __pRejectVisElem->GetCanvasN();
318         if(pCanvas != null)
319         {
320                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
321                 pCanvas->Clear();
322                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
323                 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
324                 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
325                 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
326                 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
327                 delete pCanvas;
328                 pCanvas = null;
329         }
330
331         //! Constructs an array list to store the unlock labels
332         __pAcceptArrowLabelsList = new (std::nothrow) ArrayList();
333         r = __pAcceptArrowLabelsList->Construct();
334
335         //! Constructs the Unlock Labels with the bitmap as background, adds the touch event Listener and adds them to the panel.
336         int x = X_ARROW_LABEL_STARTPOS;
337         for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
338         {
339                 String LabelName(IDC_ACCEPT_ARROW);
340                 LabelName.Append(index+1);
341                 __pAcceptArrowLabel = static_cast<Label*>(GetControl(LabelName, true));
342                 __pAcceptArrowLabel->AddTouchEventListener(*this);
343                 __pAcceptArrowLabelsList->Add(*__pAcceptArrowLabel);
344                 __pAcceptArrowVisElem = new (std::nothrow) VisualElement();
345                 r = __pAcceptArrowVisElem->Construct();
346                 __pAcceptArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
347                 __pAcceptArrowVisElem->SetShowState(true);
348                 __pAcceptArrowVisElem->SetOpacity(0.0f);
349                 String VisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
350                 VisualEleName.Append(index);
351                 __pAcceptArrowVisElem->SetName(VisualEleName);
352                 __pAcceptArrowLabel->GetVisualElement()->AttachChild(*__pAcceptArrowVisElem);
353                 pCanvas = __pAcceptArrowVisElem->GetCanvasN();
354                 if(pCanvas != null)
355                 {
356                         pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
357                         pCanvas->Clear();
358                         pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
359                         pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
360                         pCanvas->DrawRectangle(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
361                         pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
362                         pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pAcceptArrow);
363                         delete pCanvas;
364                         pCanvas = null;
365                 }
366                 x += ARROW_LABEL_X_MARGIN;
367         }
368         //! Constructs an array list to store the unlock labels
369         __pRejectArrowLabelsList = new (std::nothrow) ArrayList();
370         r = __pRejectArrowLabelsList->Construct();
371
372         x = X_ARROW_REJECT_LABEL_STARTPOS;
373         for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
374         {
375                 String LabelName(IDC_REJECT_ARROW);
376                 LabelName.Append(index+1);
377                 __pRejectArrowLabel = static_cast<Label*>(GetControl(LabelName, true));
378                 __pRejectArrowLabel->AddTouchEventListener(*this);
379                 __pRejectArrowLabelsList->Add(*__pRejectArrowLabel);
380                 __pRejectArrowVisElem = new (std::nothrow) VisualElement();
381                 r = __pRejectArrowVisElem->Construct();
382                 __pRejectArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
383                 __pRejectArrowVisElem->SetShowState(true);
384                 __pRejectArrowVisElem->SetOpacity(0.0f);
385                 String VisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
386                 VisualEleName.Append(index);
387                 __pRejectArrowVisElem->SetName(VisualEleName);
388                 __pRejectArrowLabel->GetVisualElement()->AttachChild(*__pRejectArrowVisElem);
389                 pCanvas = __pRejectArrowVisElem->GetCanvasN();
390                 if(pCanvas != null)
391                 {
392                         pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
393                         pCanvas->Clear();
394                         pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
395                         pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
396                         pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
397                         pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pRejectArrow);
398                         delete pCanvas;
399                         pCanvas = null;
400                 }
401                 x -= ARROW_LABEL_X_MARGIN;
402         }
403
404
405         return r;
406 }
407
408 void
409 IncomingCallForm::InitializeFooter(void)
410 {
411         Footer* pFooter = GetFooter();
412         FooterItem footerItemCreate;
413
414         SetFormBackEventListener(this);
415         if(pFooter != null)
416         {
417                 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
418                 pFooter->AddActionEventListener(*this);
419
420                 footerItemCreate.Construct(IDA_CREATE_REJECT_CALL_MESSAGE);
421                 footerItemCreate.SetText(AppUtility::GetResourceString(IDS_REJECT_MESSAGE_CREATE));
422                 pFooter->AddItem(footerItemCreate);
423                 pFooter->SetBackButton();
424                 pFooter->SetShowState(false);
425         }
426 }
427
428 void
429 IncomingCallForm::ShowRejectMessageFooter(void)
430 {
431         Footer* pFooter = GetFooter();
432         if(pFooter != null)
433         {
434                 AppLogDebug("SetShowState");
435                 pFooter->SetShowState(true);
436
437         }
438 }
439
440 void
441 IncomingCallForm::HideRejectMessageFooter(void)
442 {
443         Footer* pFooter = GetFooter();
444         if(pFooter != null)
445         {
446                 pFooter->SetShowState(false);
447         }
448 }
449
450 result
451 IncomingCallForm::OnTerminating(void)
452 {
453         result r = E_SUCCESS;
454
455         if (__pRejectMessageList != null)
456         {
457                 delete __pRejectMessageList;
458                 __pRejectMessageList = null;
459         }
460         if (__pActiveContactNo != null)
461         {
462                 delete __pActiveContactNo;
463                 __pActiveContactNo = null;
464         }
465         __incomingCallHandle = -1;
466         __pCallPresentor = null;
467
468         /* Deleting fails in A4RC* SDK. Remove if not necessary
469         if (__pAcceptVisElem != null)
470         {
471                 __pAcceptVisElem->Destroy();
472                 __pAcceptVisElem = null;
473         }
474
475         if (__pRejectVisElem != null)
476         {
477                 __pRejectVisElem->Destroy();
478                 __pRejectVisElem = null;
479         }
480
481         if (__pRejectFinalVisElem != null)
482         {
483                 __pRejectFinalVisElem->Destroy();
484                 __pRejectFinalVisElem = null;
485         }
486
487         if (__pAcceptFinalVisElem != null)
488         {
489                 __pAcceptFinalVisElem->Destroy();
490                 __pAcceptFinalVisElem = null;
491         }
492
493         for (int i = 0; i < 7; i++)
494         {
495                 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
496                 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement();
497                 if (__pRejectArrowVisElem != null)
498                 {
499                         __pRejectArrowVisElem->Destroy();
500                         __pRejectArrowVisElem = null;
501                 }
502
503                 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
504                 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement();
505                 if (__pAcceptArrowVisElem != null)
506                 {
507                         __pAcceptArrowVisElem->Destroy();
508                         __pAcceptArrowVisElem = null;
509                 }
510         }
511
512         if (__pAcceptArrowVisElem != null)
513         {
514                 __pAcceptArrowVisElem = null;
515         }
516
517         if (__pRejectArrowVisElem != null)
518         {
519                 __pRejectArrowVisElem = null;
520         }
521 */
522         if (__pAcceptArrowLabelsList != null)
523         {
524                 __pAcceptArrowLabelsList->RemoveAll(false);
525                 delete __pAcceptArrowLabelsList;
526                 __pAcceptArrowLabelsList = null;
527         }
528
529         if (__pRejectArrowLabelsList != null)
530         {
531                 __pRejectArrowLabelsList->RemoveAll(false);
532                 delete __pRejectArrowLabelsList;
533                 __pRejectArrowLabelsList = null;
534         }
535
536         if (__pRejectCircle != null)
537         {
538                 delete __pRejectCircle;
539                 __pRejectCircle = null;
540         }
541
542         if (__pAcceptCircle != null)
543         {
544                 delete __pAcceptCircle;
545                 __pAcceptCircle = null;
546         }
547
548         if (__pAcceptDial != null)
549         {
550                 delete __pAcceptDial;
551                 __pAcceptDial = null;
552         }
553
554         if (__pRejectDial != null)
555         {
556                 delete __pRejectDial;
557                 __pRejectDial = null;
558         }
559
560         if (__pAcceptArrow != null)
561         {
562                 delete __pAcceptArrow;
563                 __pAcceptArrow = null;
564         }
565
566         if (__pRejectArrow != null)
567         {
568                 delete __pRejectArrow;
569                 __pRejectArrow = null;
570         }
571         __pCallHandlePanel->RemoveTouchEventListener(*this);
572         __pAcceptLabel->RemoveTouchEventListener(*this);
573         __pRejectLabel->RemoveTouchEventListener(*this);
574         __pAcceptArrowLabel->RemoveTouchEventListener(*this);
575         __pRejectArrowLabel->RemoveTouchEventListener(*this);
576         __pAcceptLabel = null;
577         __pRejectLabel = null;
578         __pAcceptArrowLabel = null;
579         __pRejectArrowLabel = null;
580         __pCallHandlePanel = null;
581         return r;
582 }
583
584 void
585 IncomingCallForm::OnActionPerformed(const Control& source, int actionId)
586 {
587         switch (actionId)
588         {
589         case IDA_SHOW_REJECT_CALL_MESSAGE_PANEL: // applicable in all form states
590         {
591                 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
592                 if (pKeysPanel)
593                 {
594                         pKeysPanel->SetShowState(true);
595                         TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
596                         Rectangle tmpRect = pMessageList->GetBounds();
597                         SetControlAlwaysOnTop(*pKeysPanel,true);
598
599                         //Set Height to Reject Message Panel
600                         int listHeight = H_LIST_NORMAL_MENU_ITEM; //If no messages
601                         if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
602                         {
603                                 listHeight = H_LIST_NORMAL_MENU_ITEM * (__pRejectMessageList->GetCount()); //multiply by number of items
604                         }
605                         if (listHeight > MAX_LIST_HEIGHT)
606                         {
607                                 listHeight = MAX_LIST_HEIGHT;
608                         }
609
610                         pMessageList->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, listHeight);
611                         tmpRect = pKeysPanel->GetBounds();
612                         pKeysPanel->SetBounds(tmpRect.x, tmpRect.y, tmpRect.width, H_MESSAGE_BG_BITMAP /*+ H_REJECT_VIEW_FOOTER*/ + listHeight);
613
614                         Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
615                         pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
616                         pButtonReject->AddActionEventListener(*this);
617                         pButtonReject->SetEnabled(true);
618                         pButtonReject->SetFocus();
619
620                         ShowRejectMessageFooter();
621
622                 /*      pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_BACK_BUTTON));
623                         pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
624                         pButtonReject->AddActionEventListener(*this);
625                         pButtonReject->SetEnabled(true);
626                         pButtonReject->SetFocus();
627
628                         Button* pButtonCreate = static_cast<Button*>(pKeysPanel->GetControl(IDC_CREATE_BUTTON));
629                         pButtonCreate->SetActionId(IDA_CREATE_REJECT_CALL_MESSAGE);
630                         pButtonCreate->AddActionEventListener(*this);
631                         pButtonCreate->SetEnabled(true);
632                         pButtonCreate->SetFocus();*/
633
634                         pKeysPanel->SetFocus();
635                         pKeysPanel->Draw();
636                 }
637                 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
638                 if (pButtonRejectMessage)
639                 {
640                         pButtonRejectMessage->SetShowState(false);
641                         pButtonRejectMessage->Invalidate(true);
642                         pButtonRejectMessage->Draw();
643                 }
644         }
645         break;
646
647         case IDA_CREATE_REJECT_CALL_MESSAGE:
648         {
649                 __pCallPresentor->RejectCall(__incomingCallHandle, true,*__pActiveContactNo);
650                 ArrayListT<CallInfo>* pCallList  = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
651                 if(pCallList != null && pCallList->GetCount() > 0)
652                 {
653                         __pCallPresentor->HandleCallConnected(*pCallList);
654                 }
655                 pCallList = null;
656         }
657         break;
658
659         case IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL:
660         {
661                 HideRejectPanel();
662                 SetFocus();
663                 Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
664                 if (pButtonRejectMessage)
665                 {
666                         pButtonRejectMessage->SetShowState(true);
667                         pButtonRejectMessage->Invalidate(true);
668                         pButtonRejectMessage->Draw();
669                 }
670                 RequestRedraw(true);
671         }
672         break;
673
674         case IDA_SEND_REJECT_MSG1:
675         case IDA_SEND_REJECT_MSG2:
676         case IDA_SEND_REJECT_MSG3:
677         case IDA_SEND_REJECT_MSG4:
678         case IDA_SEND_REJECT_MSG5:
679         case IDA_SEND_REJECT_MSG6:
680         {
681                 __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
682                 SmsListener* pSmsListener = new (std::nothrow) SmsListener();
683                 SmsManager* pSmsManager = new (std::nothrow) SmsManager();
684                 result r = pSmsManager->Construct(*pSmsListener);
685                 if (IsFailed(r) == false)
686                 {
687                         RecipientList recipient;
688                         recipient.Add(RECIPIENT_TYPE_TO,*__pActiveContactNo);
689                         SmsMessage smsMessage;
690                         String textToBeSent;
691                         //calculate msgIndex
692                         int msgIndex = IDA_SEND_REJECT_MSG1;
693                         msgIndex = actionId - msgIndex;
694                         __pRejectMessageList->GetAt(msgIndex, textToBeSent);
695                         r = smsMessage.SetText(textToBeSent);
696                         if (IsFailed(r) == false)
697                         {
698                                 r = pSmsManager->Send(smsMessage,recipient,true);
699                                 if (IsFailed(r) == true)
700                                 {
701                                         //todo: error message
702                                 }
703                         }
704                         else
705                         {
706                                 //todo: error message
707                         }
708                 }
709                 else
710                 {
711                         //todo: error message
712                 }
713                 delete pSmsListener;
714                 delete pSmsManager;
715                 /*ArrayListT<CallInfo>* pCallList  = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
716                 __pCallPresentor->HandleCallConnected(*pCallList);
717                 pCallList = null;*/
718         }
719         break;
720
721         default:
722                 break;
723         }
724 }
725
726 void
727 IncomingCallForm::OnSceneActivatedN(const SceneId& previousSceneId,     const SceneId& currentSceneId, IList* pArgs)
728 {
729         AddOrientationEventListener(*this);
730         if(__pCallPresentor == null)
731         {
732                 __pCallPresentor = CallPresentationModel::GetInstance();
733         }
734         __pCallPresentor->SetTelEventListener(this);
735         HideRejectPanel();
736
737         if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
738         {
739                 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
740         }
741         if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
742         {
743                 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
744         }
745
746         __pAcceptVisElem->SetOpacity(1.0f);
747         __pRejectVisElem->SetOpacity(1.00f);
748         for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
749         {
750                 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
751                 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
752                 RejectVisualEleName.Append(i);
753                 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
754                 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
755                 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
756                 AcceptVisualEleName.Append(i);
757                 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
758                 switch(i)
759                 {
760                         case 0:
761                                 __pAcceptArrowVisElem->SetOpacity(0.6f);
762                                 __pRejectArrowVisElem->SetOpacity(0.6f);
763                         break;
764                         case 1:
765                                 __pAcceptArrowVisElem->SetOpacity(0.8f);
766                                 __pRejectArrowVisElem->SetOpacity(0.8f);
767                         break;
768                         case 2:
769                                 __pAcceptArrowVisElem->SetOpacity(1.0f);
770                                 __pRejectArrowVisElem->SetOpacity(1.0f);
771                         break;
772                 }
773
774         }
775
776
777         if (pArgs != null)
778         {
779                 //get Call Info
780                 CallInfo* pIncomingCall = static_cast<CallInfo*>(pArgs->GetAt(0));
781                 if (pIncomingCall != null)
782                 {
783                         //start alert with contact's custom ringtone
784                         __pCallPresentor->StartAlert(*pIncomingCall);
785                         //show contact number
786                         String contactNo;
787                         contactNo.Append(pIncomingCall->GetContactNumber());
788                         if (__pActiveContactNo)
789                         {
790                                 delete __pActiveContactNo;
791                                 __pActiveContactNo = null;
792                         }
793                         __incomingCallHandle = pIncomingCall->GetCallHandle()->ToLong();
794                         __pActiveContactNo = new (std::nothrow) String();
795
796                         if(contactNo.IsEmpty())
797                         {
798                                 AppLogDebug("Number empty");
799                                 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
800                                 AppLogDebug("%ls",contactNo.GetPointer());
801                         }
802                         __pActiveContactNo->Append(contactNo);
803                         //Show person details
804                         ShowPersonDetails(*__pActiveContactNo, IDC_NUMBER_LABEL, IDC_CALLER_LABEL, pIncomingCall);
805                         //Check if incoming call is hidden call, then do not show "Reject with Message" button
806                         Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
807                         if (pButtonRejectMessage)
808                         {
809                                 //for hidden call, contact number is not present
810                                 bool showRejectMsgButton = (pIncomingCall->GetContactNumber().IsEmpty() == false);
811                                 pButtonRejectMessage->SetShowState(showRejectMsgButton);
812                                 pButtonRejectMessage->Invalidate(true);
813                         }
814                 }
815                 pArgs->RemoveAll();
816                 delete pArgs;
817                 pArgs = null;
818         }
819         CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
820         pCallApp->SetTopMostWindow(true);
821
822
823 }
824
825 void
826 IncomingCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
827 {
828         RemoveOrientationEventListener(*this);
829         if (__pSmallPhotoLabel != null)
830         {
831                 RemoveControl(*__pSmallPhotoLabel);
832                 __pSmallPhotoLabel = null;
833         }
834         for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
835         {
836                 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
837                 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
838                 RejectVisualEleName.Append(i);
839                 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
840                 __pRejectArrowVisElem->SetOpacity(0.0f);
841                 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
842                 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
843                 AcceptVisualEleName.Append(i);
844                 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
845                 __pAcceptArrowVisElem->SetOpacity(0.0f);
846         }
847         if(__pAcceptLabel != null)
848         {
849                 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) != null)
850                 {
851                         AppLogDebug("__pAcceptLabel Detatach child");
852                         __pAcceptLabel->GetVisualElement()->DetachChild(*__pAcceptFinalVisElem);
853                 }
854         }
855         if(__pRejectLabel != null)
856         {
857                 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) != null)
858                 {
859                         AppLogDebug("__pRejectLabel Detatach child");
860                         __pRejectLabel->GetVisualElement()->DetachChild(*__pRejectFinalVisElem);
861                 }
862
863         }
864         CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
865         pCallApp->SetTopMostWindow(false);
866 }
867
868 result
869 IncomingCallForm::OnDraw(void)
870 {
871         Bitmap* pBackgroundWp = null;
872         // get a Canvas instance
873         Canvas* pCanvas = GetCanvasN();
874
875         pBackgroundWp = AppResource::GetInstance()->GetBitmapN(IDB_CALL_BG);
876
877         if (pCanvas)
878         {
879
880                 if (pBackgroundWp)
881                 {
882                         pCanvas->DrawBitmap(pCanvas->GetBounds(), *pBackgroundWp);
883                 }
884         }
885
886         delete pBackgroundWp;
887         pBackgroundWp = null;
888
889         delete pCanvas;
890         pCanvas = null;
891
892         return E_SUCCESS;
893 }
894
895 void
896 IncomingCallForm::HideRejectPanel(void)
897 {
898         Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
899         if (pKeysPanel)
900         {
901                 pKeysPanel->SetShowState(false);
902                 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
903                 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
904                 pButtonReject->AddActionEventListener(*this);
905                 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
906                                                                            IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false);
907                 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
908                                                                            IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true);
909
910                 HideRejectMessageFooter();
911                 pKeysPanel->Invalidate(true);
912         }
913 }
914
915 void
916 IncomingCallForm::InitializeTableView(void)
917 {
918         Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
919
920         TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
921         pMessageList->SetItemProvider(this);
922         pMessageList->AddTableViewItemEventListener(*this);
923 }
924
925 ///////////////////////////////////////////////////////////////////////////////
926 /////                   Table View Functionality supporting functions                    /////
927 //////////////////////////////////////////////////////////////////////////////
928 int
929 IncomingCallForm::GetItemCount(void)
930 {
931         if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
932         {
933                 return (__pRejectMessageList->GetCount());
934         }
935         return 1;
936 }
937
938 TableViewItem*
939 IncomingCallForm::CreateItem(int itemIndex, int itemWidth)
940 {
941         //create a new item
942         TableViewItem* pItem = new (std::nothrow) TableViewItem();
943         pItem->Construct(Dimension(itemWidth, H_LIST_NORMAL_MENU_ITEM), TABLE_VIEW_ANNEX_STYLE_NORMAL);
944
945         //Message text item rectangle
946         Rectangle itemRect(X_LIST_TEXT_ITEM, 0, W_LIST_TEXT_ITEM, H_LIST_NORMAL_MENU_ITEM);
947
948         //Message
949         String itemName(L"");
950         bool isShowSendButton = true;
951         if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
952         {
953                 __pRejectMessageList->GetAt(itemIndex, itemName);
954         }
955         else
956         {
957                 itemName.Append(AppUtility::GetResourceString(IDS_NO_MESSAGE_STR));
958                 isShowSendButton = false;
959         }
960
961         Label* pMsgLbl = new (std::nothrow) Label();
962         pMsgLbl->Construct(itemRect, itemName);
963         pMsgLbl->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
964         pMsgLbl->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
965         pMsgLbl->SetTextConfig(FONT_SIZE_MSG_TXT, LABEL_TEXT_STYLE_NORMAL);
966         pMsgLbl->SetTextColor(COLOR_LIST_TEXT_NORMAL);
967         pItem->AddControl(*pMsgLbl);
968
969         //Send Button
970         if(isShowSendButton == true)
971         {
972                 String sendText = AppUtility::GetResourceString(IDS_LIST_SEND_BUTTON);
973                 Button* pSendButton = new (std::nothrow) Button();
974                 pSendButton->Construct(Rectangle(X_SEND_TEXT_ITEM, Y_SEND_TEXT_ITEM, W_SEND_TEXT_ITEM, H_SEND_TEXT_ITEM), sendText);
975                 //set action id and listener
976                 int actionId = IDA_SEND_REJECT_MSG1;
977                 switch(itemIndex)
978                 {
979                 case 0:
980                         actionId = IDA_SEND_REJECT_MSG1;
981                         break;
982                 case 1:
983                         actionId = IDA_SEND_REJECT_MSG2;
984                         break;
985                 case 2:
986                         actionId = IDA_SEND_REJECT_MSG3;
987                         break;
988                 case 3:
989                         actionId = IDA_SEND_REJECT_MSG4;
990                         break;
991                 case 4:
992                         actionId = IDA_SEND_REJECT_MSG5;
993                         break;
994                 case 5:
995                         actionId = IDA_SEND_REJECT_MSG6;
996                         break;
997                 }
998                 pSendButton->SetActionId(actionId);
999                 pSendButton->AddActionEventListener(*this);
1000                 pItem->AddControl(*pSendButton);
1001                 pItem->SetIndividualSelectionEnabled(pSendButton, true);
1002         }
1003
1004         return pItem;
1005 }
1006
1007 bool
1008 IncomingCallForm::DeleteItem(int itemIndex, TableViewItem* pItem)
1009 {
1010         delete pItem;
1011         pItem = null;
1012         return true;
1013 }
1014
1015 int
1016 IncomingCallForm::GetDefaultItemHeight(void)
1017 {
1018         return H_LIST_NORMAL_MENU_ITEM;
1019 }
1020
1021 void
1022 IncomingCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, CallInfo* pCallInfo)
1023 {
1024         //call individual methods to show contact number, caller name & photo
1025         SetTextToLabel(phoneNumber, contactLblName);
1026
1027         //fetch contact details based on phone number
1028         String* pDisplayName = pCallInfo->FetchCallerNameN();
1029         Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1030         ShowCallerPhoto(pPhotoBitmap);
1031
1032         //free resources
1033         if (pDisplayName)
1034         {
1035                 SetTextToLabel(*pDisplayName, nameLblName);
1036                 delete pDisplayName;
1037                 pDisplayName = null;
1038         }
1039
1040         if (pPhotoBitmap)
1041         {
1042                 delete pPhotoBitmap;
1043                 pPhotoBitmap = null;
1044         }
1045 }
1046
1047 void
1048 IncomingCallForm::SetTextToLabel(const String& textToBeSet, const String& lblName)
1049 {
1050         Label* pContactLbl = static_cast<Label*>(GetControl(lblName));
1051         //passing an empty string to SetText fails in label,
1052         //if previously valid text has been set
1053         if (textToBeSet.IsEmpty() == true && pContactLbl->GetText().IsEmpty() == false)
1054         {
1055                 String stringToBeSet(L"");
1056                 pContactLbl->SetText(stringToBeSet);
1057         }
1058
1059         else
1060         {
1061                 pContactLbl->SetText(textToBeSet);
1062         }
1063 }
1064
1065 void
1066 IncomingCallForm::ShowCallerPhoto(const Bitmap* pPhotoId)
1067 {
1068         bool showSmallPhoto = false;
1069         //show photo - for Big Photo Id, Animated Call Image
1070         if (pPhotoId == null)
1071         {
1072                 pPhotoId = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1073         }
1074         else
1075         {
1076                 //Check the size of photo
1077                 // Now checking the condition with && but actually it should be ||
1078                 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1079                 // height 270 and width = 480 . So all images set thru gallery is show as small image
1080                 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1081                                 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1082                 {
1083                         showSmallPhoto = true;
1084                 }
1085         }
1086
1087         Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1088         if(showSmallPhoto == true)
1089         {
1090                 ShowThumbnailImage(pPhotoId);
1091         }
1092         else
1093         {
1094                 if (pPhotoLbl != null && pPhotoId != null)
1095                 {
1096                         Canvas* pCanvas = new (std::nothrow) Canvas;
1097                         Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1098                         pCanvas->Construct(canvasRect);
1099                         //draw the contact bitmap
1100                         pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1101                         Bitmap* pNewPhotoId = new Bitmap();
1102                         pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1103                         delete pCanvas;
1104
1105                         pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1106                         pPhotoLbl->Invalidate(true);
1107                         delete pNewPhotoId;
1108                 }
1109         }
1110 }
1111
1112 void
1113 IncomingCallForm::ShowThumbnailImage(const Bitmap* pPhotoId)
1114 {
1115         Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1116
1117         if (pPhotoLbl != null && pPhotoId != null)
1118         {
1119                 Canvas* pCanvas = new (std::nothrow) Canvas;
1120                 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1121                 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1122                 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1123                 pCanvas->Construct(canvasRect);
1124                 //draw the back ground
1125                 pCanvas->DrawBitmap(canvasRect,*pBackground);
1126                 //draw shadow (to be enabled after correct shadow image is provided )
1127                 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1128                         //      (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1129                 //draw the contact bitmap
1130                 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1131                                 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1132                 Bitmap* pNewPhotoId = new Bitmap();
1133                 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1134                 delete pCanvas;
1135
1136                 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1137                 pPhotoLbl->Invalidate(true);
1138                 delete pNewPhotoId;
1139                 delete pBackground;
1140                 delete pShadow;
1141         }
1142
1143 }
1144
1145 void
1146 IncomingCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1147 {
1148         //Draw Small Photo and show on small photo label
1149         __pSmallPhotoLabel  = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1150         __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1151         __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1152         __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1153         // Add a Label to the Form
1154         AddControl(*__pSmallPhotoLabel);
1155         __pSmallPhotoLabel->Invalidate(true);
1156 }
1157
1158 void
1159 IncomingCallForm::ShowTimerInfo(const String& timerLblName, const String& textToBeDisplayed)
1160 {
1161         Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1162         if (pTimerLbl != null)
1163         {
1164                 pTimerLbl->SetText(textToBeDisplayed);
1165         }
1166 }
1167
1168 void
1169 IncomingCallForm::SetBitmapToRejectMessageButton(const String& btnName, const String& bgBitmap
1170                                                                                                 , const String& arrowBitmap, const String& messageIconBitmap, bool isButtonInPanel, bool setButtonPressBitmap)
1171 {
1172
1173         Button* pButton = null;
1174         if (isButtonInPanel == false)
1175         {
1176                 pButton = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1177         }
1178         else
1179         {
1180                 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
1181                 pButton = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
1182         }
1183         Bitmap* pHoldBmp = null;
1184         Canvas* pCanvas = null;
1185         pCanvas = new (std::nothrow) Canvas();
1186         pCanvas->Construct(Rectangle(0,0,pButton->GetBounds().width,pButton->GetBounds().height));
1187         //set bitmap to button
1188         pHoldBmp = AppUtility::GetBitmapFromResourcesN(bgBitmap);
1189         if (pHoldBmp)
1190         {
1191                 //scale bitmap to predefined size
1192                 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1193                 pHoldBmp->Scale(Dimension(pButton->GetBounds().width, H_MESSAGE_BG_BITMAP));
1194                 pCanvas->DrawBitmap(Rectangle(Point(0, 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1195         }
1196         delete pHoldBmp;
1197         pHoldBmp = null;
1198         pHoldBmp = AppUtility::GetBitmapFromResourcesN(arrowBitmap);
1199         if (pHoldBmp)
1200         {
1201                 //scale bitmap to predefined size
1202                 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1203                 pHoldBmp->Scale(Dimension(W_ARROW_BITMAP, H_ARROW_BITMAP));
1204                 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetBounds().width / 2 - 17/*Width of arrow / 2*/), 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1205         }
1206         delete pHoldBmp;
1207         pHoldBmp = null;
1208
1209
1210
1211         //set button name
1212         String holdBtnName = AppUtility::GetResourceString(btnName);
1213         Dimension textDimension;
1214         if (!holdBtnName.IsEmpty())
1215         {
1216                 Font font;
1217                 font.Construct(FONT_STYLE_PLAIN, pButton->GetTextSize());
1218                 font.GetTextExtent(holdBtnName, holdBtnName.GetLength(), textDimension);
1219                 textDimension.height = textDimension.height + font.GetDescender();
1220                 TextElement* pTextElement = new (std::nothrow) TextElement();
1221                 pTextElement->Construct(holdBtnName);
1222                 Color textColor(249, 249, 249);
1223                 if (setButtonPressBitmap)
1224                 {
1225                         textColor.SetAlpha(255);
1226                 }
1227                 else
1228                 {
1229                         textColor.SetAlpha(127);
1230                 }
1231
1232                 pTextElement->SetTextColor(textColor);
1233                 pTextElement->SetFont(font);
1234
1235                 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1236                 pEnrichedText->Construct(textDimension);
1237                 pEnrichedText->Add(*pTextElement);
1238                 //Point textPos((X_MESSAGE_BITMAP + pHoldBmp->GetWidth() + MESSAGE_TEXT_X_MARGIN), Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1239                 Point textPos((pButton->GetWidth()/2)-(textDimension.width/2) + MESSAGE_TEXT_X_MARGIN,Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1240                 pCanvas->DrawText(textPos, *pEnrichedText);
1241                 // Cleans up
1242                 pEnrichedText->RemoveAll(true);
1243                 delete pEnrichedText;
1244         }
1245
1246
1247         pHoldBmp = AppUtility::GetBitmapFromResourcesN(messageIconBitmap);
1248         if (pHoldBmp)
1249         {
1250                 //scale bitmap to predefined size
1251                 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1252                 pHoldBmp->Scale(Dimension(W_MESSAGE_BITMAP, H_MESSAGE_BITMAP));
1253                 //pCanvas->DrawBitmap(Rectangle(Point(X_MESSAGE_BITMAP, Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1254                 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetWidth()/2)-(textDimension.width/2) -pHoldBmp->GetWidth(), Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1255         }
1256
1257         //set background bitmpa to button
1258         Bitmap* pActualBgBmp = new (std::nothrow) Bitmap();
1259         pActualBgBmp->Construct(*pCanvas, pCanvas->GetBounds());
1260         if (setButtonPressBitmap)
1261         {
1262                 pButton->SetPressedBackgroundBitmap(*pActualBgBmp);
1263         }
1264         else
1265         {
1266                 pButton->SetNormalBackgroundBitmap(*pActualBgBmp);
1267         }
1268         delete pActualBgBmp;
1269         delete pHoldBmp;
1270         delete pCanvas;
1271 }
1272
1273 /*!In OnTouchPressed, It creates the three visual elements and starts the animation of opacity and rotation variation
1274   */
1275 void
1276 IncomingCallForm::OnTouchPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1277 {
1278         __pCallPresentor->StopAlert();
1279         if (currentPosition.x < VALID_TOUCH_X_OFFSET && currentPosition.y < VALID_TOUCH_Y_OFFSET)
1280         {
1281                 Rectangle rect = source.GetBounds();
1282                 if (source.Equals(*__pAcceptLabel))
1283                 {
1284                         __isAnswerCallStarted = true;
1285                         __isRejectCallStarted = false;
1286                 }
1287                 else if (source.Equals(*__pRejectLabel))
1288                 {
1289                         __isAnswerCallStarted = false;
1290                         __isRejectCallStarted = true;
1291                 }
1292                 else
1293                 {
1294                         // touch event between the 2 labels. So Do nothing
1295                         return;
1296                 }
1297
1298         }
1299 }
1300
1301 // On Touch released, the animation and the visual elements disappear
1302 void
1303 IncomingCallForm::OnTouchReleased(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1304 {
1305         if (__isAnswerCallStarted == true)
1306         {
1307                 if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1308                 {
1309                         //Right reject icon
1310                         if(__pRejectFinalVisElem == null)
1311                         {
1312                                 __pRejectFinalVisElem = new (std::nothrow) VisualElement();
1313                         }
1314                         __pRejectFinalVisElem->Construct();
1315                         __pRejectFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1316                         __pRejectFinalVisElem->SetShowState(true);
1317                         __pRejectFinalVisElem->SetOpacity(1.00f);
1318                         __pRejectFinalVisElem->SetName(IDI_REJECT_FINAL_VISUAL_ELE_NAME);
1319                         if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) == null)
1320                         {
1321                                 AppLogDebug("AttachChild __pRejectFinalVisElem");
1322                                 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectFinalVisElem);
1323                         }
1324                         Canvas* pCanvas = __pRejectFinalVisElem->GetCanvasN();
1325                         if(pCanvas != null)
1326                         {
1327                                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1328                                 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1329                                 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, W_DIAL_LABEL), *__pAcceptCircle);
1330                                 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
1331                                 delete pCanvas;
1332                         }
1333
1334                         __pAcceptVisElem->SetOpacity(0.0f);
1335                         //fetch already active call list
1336                         ArrayListT<CallInfo>* pCallList  = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
1337                         if (pCallList != null && pCallList->GetCount() > 0)
1338                         {
1339                                 //then atleast 1 active call exist.
1340                                 CallInfo phnCallInfo;
1341                                 pCallList->GetAt(0,phnCallInfo);
1342                                 //Check if only 1 call exist and it is on Hold
1343                                 if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
1344                                 {
1345                                         //directly accept call
1346                                         __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1347                                 }
1348                                 else
1349                                 {
1350                                         //Either 1 call exist and not "on Hold".
1351                                         //Or 2 calls exist.
1352                                         if(__pOptionPopup != null)
1353                                         {
1354                                                 delete __pOptionPopup;
1355                                                 __pOptionPopup = null;
1356                                         }
1357                                         __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
1358                                         __pOptionPopup->Initialize();
1359                                         __pOptionPopup->SetShowState(true);
1360                                         __pOptionPopup->Draw();
1361                                         __pOptionPopup->Show();
1362                                 }
1363                                 pCallList->RemoveAll();
1364                         }
1365                         else
1366                         {
1367                                 //no active call - Accept the  incoming call
1368                                 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1369                         }
1370                         delete pCallList;
1371                         pCallList = null;
1372                 }
1373                 else
1374                 {
1375                         __pAcceptVisElem->SetOpacity(1.0f);
1376                         __pRejectVisElem->SetOpacity(1.00f);
1377
1378                 }
1379         }
1380         else if (__isRejectCallStarted == true)
1381         {
1382                 if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1383                 {
1384                         //left dial icon
1385                         if(__pAcceptFinalVisElem == null)
1386                         {
1387                                 __pAcceptFinalVisElem = new (std::nothrow) VisualElement();
1388                         }
1389                         __pAcceptFinalVisElem->Construct();
1390                         __pAcceptFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1391                         __pAcceptFinalVisElem->SetShowState(true);
1392                         __pAcceptFinalVisElem->SetOpacity(1.0f);
1393                         __pAcceptFinalVisElem->SetName(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME);
1394                         if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) == null)
1395                         {
1396                                 AppLogDebug("AttachChild __pAcceptFinalVisElem");
1397                                 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptFinalVisElem);
1398                         }
1399                         Canvas* pCanvas = __pAcceptFinalVisElem->GetCanvasN();
1400                         if(pCanvas != null)
1401                         {
1402                                 AppLogDebug("__pAcceptFinalVisElem drawing");
1403                                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1404                                 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
1405                                 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1406                                 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
1407                                 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
1408                                 delete pCanvas;
1409                         }
1410                         __pRejectVisElem->SetOpacity(0.0f);
1411                         //Reject the call
1412                         __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
1413                 }
1414                 else
1415                 {
1416                         __pAcceptVisElem->SetOpacity(1.0f);
1417                         __pRejectVisElem->SetOpacity(1.00f);
1418
1419                 }
1420         }
1421         __isAnswerCallStarted = false;
1422         __isRejectCallStarted = false;
1423 }
1424
1425 void
1426 IncomingCallForm::OnTouchMoved(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1427 {
1428         if (__isAnswerCallStarted == true)
1429         {
1430                 if (currentPosition.x > 170 && currentPosition.x < 578)
1431                 {
1432                         if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1433                         {
1434                                 __pRejectVisElem->SetOpacity(0.60f);
1435                                 __pAcceptVisElem->SetOpacity(0.60f);
1436                         }
1437                         else
1438                         {
1439                                 __pRejectVisElem->SetOpacity(1.0f);
1440                                 __pAcceptVisElem->SetOpacity(1.0f);
1441                         }
1442
1443                 }
1444         }
1445         if (__isRejectCallStarted == true)
1446         {
1447                 if (currentPosition.x < 0 && currentPosition.x > -522)
1448                 {
1449                         if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1450                         {
1451                                 __pRejectVisElem->SetOpacity(0.60f);
1452                                 __pAcceptVisElem->SetOpacity(0.60f);
1453                         }
1454                         else
1455                         {
1456                                 __pRejectVisElem->SetOpacity(1.0f);
1457                                 __pAcceptVisElem->SetOpacity(1.0f);
1458                         }
1459                 }
1460         }
1461 }
1462
1463 void
1464 IncomingCallForm::OnItemSelected(int itemIndex)
1465 {
1466
1467         ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
1468         pArgs->Construct();
1469
1470         //display name, mobile number
1471         Integer* argIndex = new (std::nothrow) Integer(itemIndex);
1472         pArgs->Add(argIndex);
1473         SendUserEvent(REQUEST_ITEM_SELECTED,pArgs);
1474
1475 }
1476
1477 void
1478 IncomingCallForm::HandleMultipleCallSelection(int itemIndex)
1479 {
1480         if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
1481         {
1482                 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
1483         }
1484         if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
1485         {
1486                 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
1487         }
1488
1489         __pAcceptVisElem->SetOpacity(1.0f);
1490         __pRejectVisElem->SetOpacity(1.00f);
1491
1492         for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
1493         {
1494                 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
1495                 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
1496                 RejectVisualEleName.Append(i);
1497                 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
1498                 __pRejectArrowVisElem->SetOpacity(0.0f);
1499                 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
1500                 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
1501                 AcceptVisualEleName.Append(i);
1502                 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
1503                 __pAcceptArrowVisElem->SetOpacity(0.0f);
1504         }
1505         if (__pRejectFinalVisElem != null)
1506         {
1507                 __pRejectFinalVisElem->Destroy();
1508                 __pRejectFinalVisElem = null;
1509         }
1510
1511         if (__pAcceptFinalVisElem != null)
1512         {
1513                 __pAcceptFinalVisElem->Destroy();
1514                 __pAcceptFinalVisElem = null;
1515         }
1516         if (__pOptionPopup)
1517         {
1518                 delete __pOptionPopup;
1519                 __pOptionPopup = null;
1520         }
1521         //accept call
1522         __pCallPresentor->AcceptIncomingCall(CallAnsweringOptions(itemIndex),__incomingCallHandle);
1523 }
1524
1525 void
1526 IncomingCallForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1527 {
1528         switch(requestId)
1529         {
1530                 case REQUEST_ITEM_SELECTED:
1531                 {
1532                         if(pArgs != null)
1533                         {
1534                                 Integer *index = static_cast<Integer*>(pArgs->GetAt(0));
1535                                 if(index != null)
1536                                 {
1537                                         HandleMultipleCallSelection(index->ToInt());
1538                                 }
1539                         }
1540                 }
1541                 break;
1542         }
1543 }
1544
1545 void
1546 IncomingCallForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
1547 {
1548         AppLogDebug("Enter");
1549         HideRejectPanel();
1550         SetFocus();
1551         Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1552         if (pButtonRejectMessage)
1553         {
1554                 pButtonRejectMessage->SetShowState(true);
1555                 pButtonRejectMessage->Invalidate(true);
1556                 pButtonRejectMessage->Draw();
1557         }
1558         RequestRedraw(true);
1559
1560 }
1561
1562 void
1563 IncomingCallForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1564 {
1565         Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1566         if (pButtonRejectMessage)
1567         {
1568                 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1569                                                                            IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
1570                 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
1571                                                                            IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
1572         }
1573
1574 }