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