Fix for N_SE-28854 N_SE-29290 N_SE-27358 N_SE-25429 N_SE-25498 N_SE-25689 N_SE-27155...
[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 const wchar_t* IDS_REJECT_MESSAGE_BTN = L"IDS_REJECT_MESSAGE_BTN";
123 const wchar_t* IDS_LIST_SEND_BUTTON = L"IDS_LIST_SEND_BUTTON";
124 const wchar_t* IDS_NO_MESSAGE_STR = L"IDS_NO_MESSAGE_STR";
125
126 const wchar_t* IDI_FORM_VISUAL_ELE_NAME = L"FormVisEle";
127 const wchar_t* IDI_PANEL_VISUAL_ELE_NAME = L"PanelVisEle";
128 const wchar_t* IDI_ACCEPT_VISUAL_ELE_NAME = L"AcceptVisEle";
129 const wchar_t* IDI_REJECT_VISUAL_ELE_NAME = L"RejectVisEle";
130 const wchar_t* IDI_ACCEPT_ARROW_VISUAL_ELE_NAME = L"AcceptArrowVisEle";
131 const wchar_t* IDI_REJECT_ARROW_VISUAL_ELE_NAME = L"RejectArrowVisEle";
132 const wchar_t* IDI_REJECT_FINAL_VISUAL_ELE_NAME = L"RejectFinalVisEle";
133 const wchar_t* IDI_ACCEPT_FINAL_VISUAL_ELE_NAME = L"AcceptFinalVisEle";
134
135 class SmsListener
136         : public Object
137         , public ISmsListener
138 {
139 public:
140                 void  OnSmsMessageSent(result r)
141                 {
142                 }
143 };
144
145 IncomingCallForm::IncomingCallForm(void)
146         : BaseForm(FORMTYPE_INCOMINGCALL)
147 {
148         __pActiveContactNo = null;
149         __pRejectMessageList = null;
150         __incomingCallHandle = -1;
151         __isAnswerCallStarted = false;
152         __isRejectCallStarted = false;
153         __pAcceptArrowLabelsList = null;
154         __pRejectArrowLabelsList = null;
155         __pRejectCircle = null;
156         __pAcceptCircle = null;
157         __pAcceptDial = null;
158         __pRejectDial = null;
159         __pAcceptArrow = null;
160         __pRejectArrow = null;
161         __pAcceptLabel = null;
162         __pRejectLabel = null;
163         __pAcceptArrowLabel = null;
164         __pRejectArrowLabel = null;
165         __pCallHandlePanel = null;
166         __pAcceptVisElem = null;
167         __pRejectVisElem = null;
168         __pRejectFinalVisElem = null;
169         __pAcceptFinalVisElem = null;
170         __pAcceptArrowVisElem = null;
171         __pRejectArrowVisElem = null;
172         __pCallPresentor = null;
173         __pOptionPopup = null;
174         __pSmallPhotoLabel = null;
175 }
176
177 IncomingCallForm::~IncomingCallForm(void)
178 {
179 }
180
181 void
182 IncomingCallForm::Initialize(void)
183 {
184         Construct(IDL_INCOMING_CALL_FORM);
185 }
186
187 result
188 IncomingCallForm::OnInitializing(void)
189 {
190         result r = E_SUCCESS;
191         Canvas* pCanvas = null;
192
193         InitializeFooter();
194
195
196         VisualElement* pFormVisElem = new (std::nothrow) VisualElement();
197         r = pFormVisElem->Construct();
198         pFormVisElem->SetBounds(FloatRectangle(GetClientAreaBounds().x, GetClientAreaBounds().y, GetClientAreaBounds().width, GetClientAreaBounds().height));
199         pFormVisElem->SetShowState(true);
200         pFormVisElem->SetOpacity(1.0f);
201         pFormVisElem->SetName(IDI_FORM_VISUAL_ELE_NAME);
202         GetVisualElement()->AttachChild(*pFormVisElem);
203         pCanvas = pFormVisElem->GetCanvasN();
204         if(pCanvas != null)
205         {
206                 pCanvas->Clear();
207                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
208                 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
209                 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(GetClientAreaBounds().x, GetClientAreaBounds().y, GetClientAreaBounds().width, GetClientAreaBounds().height));
210                 delete pCanvas;
211                 pCanvas = null;
212         }
213         HideRejectPanel();
214
215         Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
216         if (pButtonRejectMessage)
217         {
218                 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
219                                                                            IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, false);
220                 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
221                                                                            IDB_REJECT_MESSAGE_UP_ARROW, IDB_REJECT_MESSAGE_ICON, false, true);
222                 pButtonRejectMessage->SetActionId(IDA_SHOW_REJECT_CALL_MESSAGE_PANEL);
223                 pButtonRejectMessage->AddActionEventListener(*this);
224         }
225
226         //Get Reject list from Settings Manager
227         IMapT<int,String>* pMsgMap = SettingsManager::GetInstance()->GetRejectMessageListN();
228         if(pMsgMap != null)
229         {
230                 __pRejectMessageList = pMsgMap->GetValuesN();
231                 delete pMsgMap;
232                 pMsgMap = null;
233         }
234         InitializeTableView();
235
236         __pAcceptCircle = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
237         __pRejectCircle = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_CIRCLE_ICON, W_DIAL_LABEL, H_DIAL_LABEL);
238         __pAcceptDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_ACCEPT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
239         __pRejectDial = AppUtility::GetBitmapFromResourcesN(IDB_CALL_REJECT_ICON, W_DIAL_BITMAP, H_DIAL_BITMAP);
240         __pAcceptArrow = AppUtility::GetBitmapFromResourcesN(IDB_ACCEPT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
241         __pRejectArrow = AppUtility::GetBitmapFromResourcesN(IDB_REJECT_ARROW_ICON, W_ARROW_LABEL, H_ARROW_LABEL);
242
243
244         if(__pRejectDial == null)
245         {
246                 AppLogDebug("Null");
247         }
248         //Panel for showing accept and reject call buttons.
249         Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL, true));
250          int yPos = pPhotoLbl->GetX()+pPhotoLbl->GetHeight()+ Y_CALL_PANEL;
251
252         __pCallHandlePanel = new (std::nothrow) Panel();
253         r = __pCallHandlePanel->Construct(Rectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width - X_CALL_PANEL, H_CALL_PANEL), GROUP_STYLE_NONE);
254         __pCallHandlePanel->AddTouchEventListener(*this);
255         AddControl(*__pCallHandlePanel);
256         __pCallHandlePanel->SetBackgroundColor(COLOR_SWIPE_PANEL);
257         VisualElement* pCallPanelVisElem = new (std::nothrow) VisualElement();
258         r = pCallPanelVisElem->Construct();
259         pCallPanelVisElem->SetBounds(FloatRectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width, H_CALL_PANEL));
260         pCallPanelVisElem->SetShowState(true);
261         pCallPanelVisElem->SetOpacity(1.0f);
262         pCallPanelVisElem->SetName(IDI_PANEL_VISUAL_ELE_NAME);
263         __pCallHandlePanel->GetVisualElement()->AttachChild(*pCallPanelVisElem);
264         pCanvas = pCallPanelVisElem->GetCanvasN();
265         if(pCanvas != null)
266         {
267                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
268                 pCanvas->Clear();
269                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
270                 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
271                 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(X_CALL_PANEL, yPos, GetClientAreaBounds().width, H_CALL_PANEL));
272                 delete pCanvas;
273                 pCanvas = null;
274         }
275         //Lock Label for animation
276         __pAcceptLabel = new (std::nothrow) Label();
277         r = __pAcceptLabel->Construct(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), L"");
278         __pAcceptLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
279         __pAcceptLabel->AddTouchEventListener(*this);
280         __pCallHandlePanel->AddControl(*__pAcceptLabel);
281         //left dial icon
282         __pAcceptVisElem = new (std::nothrow) VisualElement();
283         r = __pAcceptVisElem->Construct();
284         __pAcceptVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
285         __pAcceptVisElem->SetShowState(true);
286         __pAcceptVisElem->SetOpacity(1.0f);
287         __pAcceptVisElem->SetName(IDI_ACCEPT_VISUAL_ELE_NAME);
288         __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
289         pCanvas = __pAcceptVisElem->GetCanvasN();
290         if(pCanvas != null)
291         {
292                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
293                 pCanvas->Clear();
294                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
295                 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
296                 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
297                 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pAcceptCircle);
298                 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
299                 delete pCanvas;
300                 pCanvas = null;
301         }
302         //UnLock Label for animation
303         __pRejectLabel = new (std::nothrow) Label();
304         r = __pRejectLabel->Construct(Rectangle(REJECT_LABEL_X_OFFSET, 0, W_DIAL_LABEL, H_DIAL_LABEL), L"");
305         __pRejectLabel->AddTouchEventListener(*this);
306         __pCallHandlePanel->AddControl(*__pRejectLabel);
307         __pRejectLabel->SetBackgroundColor(COLOR_SWIPE_PANEL);
308         SetControlAlwaysAtBottom(*__pCallHandlePanel, true);
309
310         //Right reject icon
311         __pRejectVisElem = new (std::nothrow) VisualElement();
312         r = __pRejectVisElem->Construct();
313         __pRejectVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
314         __pRejectVisElem->SetShowState(true);
315         __pRejectVisElem->SetOpacity(1.00f);
316         __pRejectVisElem->SetName(IDI_REJECT_VISUAL_ELE_NAME);
317         __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
318         pCanvas = __pRejectVisElem->GetCanvasN();
319         if(pCanvas != null)
320         {
321                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
322                 pCanvas->Clear();
323                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
324                 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
325                 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
326                 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
327                 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
328                 delete pCanvas;
329                 pCanvas = null;
330         }
331
332         //! Constructs an array list to store the unlock labels
333         __pAcceptArrowLabelsList = new (std::nothrow) ArrayList();
334         r = __pAcceptArrowLabelsList->Construct();
335
336         //! Constructs the Unlock Labels with the bitmap as background, adds the touch event Listener and adds them to the panel.
337         int x = X_ARROW_LABEL_STARTPOS;
338         for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
339         {
340                 __pAcceptArrowLabel = new (std::nothrow) Label();
341                 r = __pAcceptArrowLabel->Construct(Rectangle(x, Y_ARROW_LABEL, W_ARROW_LABEL, H_ARROW_LABEL), L"");
342                 __pAcceptArrowLabel->AddTouchEventListener(*this);
343                 __pCallHandlePanel->AddControl(*__pAcceptArrowLabel);
344                 __pAcceptArrowLabelsList->Add(*__pAcceptArrowLabel);
345                 __pAcceptArrowVisElem = new (std::nothrow) VisualElement();
346                 r = __pAcceptArrowVisElem->Construct();
347                 __pAcceptArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
348                 __pAcceptArrowVisElem->SetShowState(true);
349                 __pAcceptArrowVisElem->SetOpacity(0.0f);
350                 String VisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
351                 VisualEleName.Append(index);
352                 __pAcceptArrowVisElem->SetName(VisualEleName);
353                 __pAcceptArrowLabel->GetVisualElement()->AttachChild(*__pAcceptArrowVisElem);
354                 pCanvas = __pAcceptArrowVisElem->GetCanvasN();
355                 if(pCanvas != null)
356                 {
357                         pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
358                         pCanvas->Clear();
359                         pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
360                         pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
361                         pCanvas->DrawRectangle(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
362                         pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
363                         pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pAcceptArrow);
364                         delete pCanvas;
365                         pCanvas = null;
366                 }
367                 x += ARROW_LABEL_X_MARGIN;
368         }
369         //! Constructs an array list to store the unlock labels
370         __pRejectArrowLabelsList = new (std::nothrow) ArrayList();
371         r = __pRejectArrowLabelsList->Construct();
372
373         x = X_ARROW_REJECT_LABEL_STARTPOS;
374         for (int index = 0; index < COUNT_ARROW_ELEMENTS; index++)
375         {
376                 __pRejectArrowLabel = new (std::nothrow) Label();
377                 r = __pRejectArrowLabel->Construct(Rectangle(x, Y_ARROW_LABEL, W_ARROW_LABEL, H_ARROW_LABEL), L"");
378                 __pRejectArrowLabel->AddTouchEventListener(*this);
379                 __pCallHandlePanel->AddControl(*__pRejectArrowLabel);
380                 __pRejectArrowLabelsList->Add(*__pRejectArrowLabel);
381                 __pRejectArrowVisElem = new (std::nothrow) VisualElement();
382                 r = __pRejectArrowVisElem->Construct();
383                 __pRejectArrowVisElem->SetBounds(FloatRectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
384                 __pRejectArrowVisElem->SetShowState(true);
385                 __pRejectArrowVisElem->SetOpacity(0.0f);
386                 String VisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
387                 VisualEleName.Append(index);
388                 __pRejectArrowVisElem->SetName(VisualEleName);
389                 __pRejectArrowLabel->GetVisualElement()->AttachChild(*__pRejectArrowVisElem);
390                 pCanvas = __pRejectArrowVisElem->GetCanvasN();
391                 if(pCanvas != null)
392                 {
393                         pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
394                         pCanvas->Clear();
395                         pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
396                         pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
397                         pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL));
398                         pCanvas->DrawBitmap(Rectangle(0, 0, W_ARROW_LABEL, H_ARROW_LABEL), *__pRejectArrow);
399                         delete pCanvas;
400                         pCanvas = null;
401                 }
402                 x -= ARROW_LABEL_X_MARGIN;
403         }
404
405
406         return r;
407 }
408
409 void
410 IncomingCallForm::InitializeFooter(void)
411 {
412         Footer* pFooter = GetFooter();
413         FooterItem footerItemCreate;
414
415         SetFormBackEventListener(this);
416         if(pFooter != null)
417         {
418                 pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);
419                 pFooter->AddActionEventListener(*this);
420
421                 footerItemCreate.Construct(IDA_CREATE_REJECT_CALL_MESSAGE);
422                 footerItemCreate.SetText(AppUtility::GetResourceString(IDS_REJECT_MESSAGE_CREATE));
423                 pFooter->AddItem(footerItemCreate);
424                 pFooter->SetBackButton();
425                 pFooter->SetShowState(false);
426         }
427 }
428
429 void
430 IncomingCallForm::ShowRejectMessageFooter(void)
431 {
432         Footer* pFooter = GetFooter();
433         if(pFooter != null)
434         {
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         if(__pCallPresentor == null)
730         {
731                 __pCallPresentor = CallPresentationModel::GetInstance();
732         }
733         __pCallPresentor->SetTelEventListener(this);
734         HideRejectPanel();
735
736         if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
737         {
738                 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
739         }
740         if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
741         {
742                 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
743         }
744
745         __pAcceptVisElem->SetOpacity(1.0f);
746         __pRejectVisElem->SetOpacity(1.00f);
747         for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
748         {
749                 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
750                 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
751                 RejectVisualEleName.Append(i);
752                 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
753                 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
754                 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
755                 AcceptVisualEleName.Append(i);
756                 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
757                 switch(i)
758                 {
759                         case 0:
760                                 __pAcceptArrowVisElem->SetOpacity(0.6f);
761                                 __pRejectArrowVisElem->SetOpacity(0.6f);
762                         break;
763                         case 1:
764                                 __pAcceptArrowVisElem->SetOpacity(0.8f);
765                                 __pRejectArrowVisElem->SetOpacity(0.8f);
766                         break;
767                         case 2:
768                                 __pAcceptArrowVisElem->SetOpacity(1.0f);
769                                 __pRejectArrowVisElem->SetOpacity(1.0f);
770                         break;
771                 }
772
773         }
774
775
776         if (pArgs != null)
777         {
778                 //get Call Info
779                 CallInfo* pIncomingCall = static_cast<CallInfo*>(pArgs->GetAt(0));
780                 if (pIncomingCall != null)
781                 {
782                         //start alert with contact's custom ringtone
783                         __pCallPresentor->StartAlert(*pIncomingCall);
784                         //show contact number
785                         String contactNo;
786                         contactNo.Append(pIncomingCall->GetContactNumber());
787                         if (__pActiveContactNo)
788                         {
789                                 delete __pActiveContactNo;
790                                 __pActiveContactNo = null;
791                         }
792                         __incomingCallHandle = pIncomingCall->GetCallHandle()->ToLong();
793                         __pActiveContactNo = new (std::nothrow) String();
794
795                         if(contactNo.IsEmpty())
796                         {
797                                 AppLogDebug("Number empty");
798                                 contactNo.Append(AppUtility::GetResourceString(IDS_NUMBER_UNKNOWN));
799                                 AppLogDebug("%ls",contactNo.GetPointer());
800                         }
801                         __pActiveContactNo->Append(contactNo);
802                         //Show person details
803                         ShowPersonDetails(*__pActiveContactNo, IDC_NUMBER_LABEL, IDC_CALLER_LABEL, pIncomingCall);
804                         //Check if incoming call is hidden call, then do not show "Reject with Message" button
805                         Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
806                         if (pButtonRejectMessage)
807                         {
808                                 //for hidden call, contact number is not present
809                                 bool showRejectMsgButton = (pIncomingCall->GetContactNumber().IsEmpty() == false);
810                                 pButtonRejectMessage->SetShowState(showRejectMsgButton);
811                                 pButtonRejectMessage->Invalidate(true);
812                         }
813                 }
814                 pArgs->RemoveAll();
815                 delete pArgs;
816                 pArgs = null;
817         }
818         CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
819         pCallApp->SetTopMostWindow(true);
820
821
822 }
823
824 void
825 IncomingCallForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
826 {
827         if (__pSmallPhotoLabel != null)
828         {
829                 RemoveControl(*__pSmallPhotoLabel);
830                 __pSmallPhotoLabel = null;
831         }
832         for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
833         {
834                 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
835                 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
836                 RejectVisualEleName.Append(i);
837                 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
838                 __pRejectArrowVisElem->SetOpacity(0.0f);
839                 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
840                 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
841                 AcceptVisualEleName.Append(i);
842                 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
843                 __pAcceptArrowVisElem->SetOpacity(0.0f);
844         }
845         if(__pAcceptLabel != null)
846         {
847                 if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) != null)
848                 {
849                         AppLogDebug("__pAcceptLabel Detatach child");
850                         __pAcceptLabel->GetVisualElement()->DetachChild(*__pAcceptFinalVisElem);
851                 }
852         }
853         if(__pRejectLabel != null)
854         {
855                 if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) != null)
856                 {
857                         AppLogDebug("__pRejectLabel Detatach child");
858                         __pRejectLabel->GetVisualElement()->DetachChild(*__pRejectFinalVisElem);
859                 }
860
861         }
862         CallApp* pCallApp = static_cast<CallApp*>(CallApp::GetInstance());
863         pCallApp->SetTopMostWindow(false);
864 }
865
866 result
867 IncomingCallForm::OnDraw(void)
868 {
869         Bitmap* pBackgroundWp = null;
870         // get a Canvas instance
871         Canvas* pCanvas = GetCanvasN();
872
873         pBackgroundWp = AppResource::GetInstance()->GetBitmapN(IDB_CALL_BG);
874
875         if (pCanvas)
876         {
877
878                 if (pBackgroundWp)
879                 {
880                         pCanvas->DrawBitmap(pCanvas->GetBounds(), *pBackgroundWp);
881                 }
882         }
883
884         delete pBackgroundWp;
885         pBackgroundWp = null;
886
887         delete pCanvas;
888         pCanvas = null;
889
890         return E_SUCCESS;
891 }
892
893 void
894 IncomingCallForm::HideRejectPanel(void)
895 {
896         Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
897         if (pKeysPanel)
898         {
899                 pKeysPanel->SetShowState(false);
900                 Button* pButtonReject = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
901                 pButtonReject->SetActionId(IDA_CANCEL_REJECT_CALL_MESSAGE_PANEL);
902                 pButtonReject->AddActionEventListener(*this);
903                 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
904                                                                            IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, false);
905                 SetBitmapToRejectMessageButton(IDS_REJECT_MESSAGE_BTN,IDB_REJECT_MESSAGE_BG,
906                                                                            IDB_REJECT_MESSAGE_DOWN_ARROW, IDB_REJECT_MESSAGE_ICON, true, true);
907
908                 HideRejectMessageFooter();
909                 pKeysPanel->Invalidate(true);
910         }
911 }
912
913 void
914 IncomingCallForm::InitializeTableView(void)
915 {
916         Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
917
918         TableView* pMessageList = static_cast<TableView*>(pKeysPanel->GetControl(IDC_MSG_TABLEVIEW));
919         pMessageList->SetItemProvider(this);
920         pMessageList->AddTableViewItemEventListener(*this);
921 }
922
923 ///////////////////////////////////////////////////////////////////////////////
924 /////                   Table View Functionality supporting functions                    /////
925 //////////////////////////////////////////////////////////////////////////////
926 int
927 IncomingCallForm::GetItemCount(void)
928 {
929         if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
930         {
931                 return (__pRejectMessageList->GetCount());
932         }
933         return 1;
934 }
935
936 TableViewItem*
937 IncomingCallForm::CreateItem(int itemIndex, int itemWidth)
938 {
939         //create a new item
940         TableViewItem* pItem = new (std::nothrow) TableViewItem();
941         pItem->Construct(Dimension(itemWidth, H_LIST_NORMAL_MENU_ITEM), TABLE_VIEW_ANNEX_STYLE_NORMAL);
942
943         //Message text item rectangle
944         Rectangle itemRect(X_LIST_TEXT_ITEM, 0, W_LIST_TEXT_ITEM, H_LIST_NORMAL_MENU_ITEM);
945
946         //Message
947         String itemName(L"");
948         bool isShowSendButton = true;
949         if(__pRejectMessageList != null && __pRejectMessageList->GetCount() > 0)
950         {
951                 __pRejectMessageList->GetAt(itemIndex, itemName);
952         }
953         else
954         {
955                 itemName.Append(AppUtility::GetResourceString(IDS_NO_MESSAGE_STR));
956                 isShowSendButton = false;
957         }
958
959         Label* pMsgLbl = new (std::nothrow) Label();
960         pMsgLbl->Construct(itemRect, itemName);
961         pMsgLbl->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
962         pMsgLbl->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
963         pMsgLbl->SetTextConfig(FONT_SIZE_MSG_TXT, LABEL_TEXT_STYLE_NORMAL);
964         pMsgLbl->SetTextColor(COLOR_LIST_TEXT_NORMAL);
965         pItem->AddControl(*pMsgLbl);
966
967         //Send Button
968         if(isShowSendButton == true)
969         {
970                 String sendText = AppUtility::GetResourceString(IDS_LIST_SEND_BUTTON);
971                 Button* pSendButton = new (std::nothrow) Button();
972                 pSendButton->Construct(Rectangle(X_SEND_TEXT_ITEM, Y_SEND_TEXT_ITEM, W_SEND_TEXT_ITEM, H_SEND_TEXT_ITEM), sendText);
973                 //set action id and listener
974                 int actionId = IDA_SEND_REJECT_MSG1;
975                 switch(itemIndex)
976                 {
977                 case 0:
978                         actionId = IDA_SEND_REJECT_MSG1;
979                         break;
980                 case 1:
981                         actionId = IDA_SEND_REJECT_MSG2;
982                         break;
983                 case 2:
984                         actionId = IDA_SEND_REJECT_MSG3;
985                         break;
986                 case 3:
987                         actionId = IDA_SEND_REJECT_MSG4;
988                         break;
989                 case 4:
990                         actionId = IDA_SEND_REJECT_MSG5;
991                         break;
992                 case 5:
993                         actionId = IDA_SEND_REJECT_MSG6;
994                         break;
995                 }
996                 pSendButton->SetActionId(actionId);
997                 pSendButton->AddActionEventListener(*this);
998                 pItem->AddControl(*pSendButton);
999                 pItem->SetIndividualSelectionEnabled(pSendButton, true);
1000         }
1001
1002         return pItem;
1003 }
1004
1005 bool
1006 IncomingCallForm::DeleteItem(int itemIndex, TableViewItem* pItem)
1007 {
1008         delete pItem;
1009         pItem = null;
1010         return true;
1011 }
1012
1013 int
1014 IncomingCallForm::GetDefaultItemHeight(void)
1015 {
1016         return H_LIST_NORMAL_MENU_ITEM;
1017 }
1018
1019 void
1020 IncomingCallForm::ShowPersonDetails(const String& phoneNumber, const String& contactLblName, const String& nameLblName, CallInfo* pCallInfo)
1021 {
1022         //call individual methods to show contact number, caller name & photo
1023         SetTextToLabel(phoneNumber, contactLblName);
1024
1025         //fetch contact details based on phone number
1026         String* pDisplayName = pCallInfo->FetchCallerNameN();
1027         Bitmap* pPhotoBitmap = pCallInfo->FetchCallerPhotoN();
1028         ShowCallerPhoto(pPhotoBitmap);
1029
1030         //free resources
1031         if (pDisplayName)
1032         {
1033                 SetTextToLabel(*pDisplayName, nameLblName);
1034                 delete pDisplayName;
1035                 pDisplayName = null;
1036         }
1037
1038         if (pPhotoBitmap)
1039         {
1040                 delete pPhotoBitmap;
1041                 pPhotoBitmap = null;
1042         }
1043 }
1044
1045 void
1046 IncomingCallForm::SetTextToLabel(const String& textToBeSet, const String& lblName)
1047 {
1048         Label* pContactLbl = static_cast<Label*>(GetControl(lblName));
1049         //passing an empty string to SetText fails in label,
1050         //if previously valid text has been set
1051         if (textToBeSet.IsEmpty() == true && pContactLbl->GetText().IsEmpty() == false)
1052         {
1053                 String stringToBeSet(L"");
1054                 pContactLbl->SetText(stringToBeSet);
1055         }
1056
1057         else
1058         {
1059                 pContactLbl->SetText(textToBeSet);
1060         }
1061 }
1062
1063 void
1064 IncomingCallForm::ShowCallerPhoto(const Bitmap* pPhotoId)
1065 {
1066         bool showSmallPhoto = false;
1067         //show photo - for Big Photo Id, Animated Call Image
1068         if (pPhotoId == null)
1069         {
1070                 pPhotoId = AppUtility::GetBitmapFromResourcesN(IDB_ACTIVE_CALL_DEFAULT_ICON,W_CONFERENCE_PHOTO,W_CONFERENCE_PHOTO);
1071         }
1072         else
1073         {
1074                 //Check the size of photo
1075                 // Now checking the condition with && but actually it should be ||
1076                 //But for now keeping it as && because _pContact->GetThubNail() returns image width as
1077                 // height 270 and width = 480 . So all images set thru gallery is show as small image
1078                 if(pPhotoId->GetHeight() <= H_SMALL_PHOTO
1079                                 && pPhotoId->GetWidth() <= W_SMALL_PHOTO)
1080                 {
1081                         showSmallPhoto = true;
1082                 }
1083         }
1084
1085         Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1086         if(showSmallPhoto == true)
1087         {
1088                 ShowThumbnailImage(pPhotoId);
1089         }
1090         else
1091         {
1092                 if (pPhotoLbl != null && pPhotoId != null)
1093                 {
1094                         Canvas* pCanvas = new (std::nothrow) Canvas;
1095                         Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1096                         pCanvas->Construct(canvasRect);
1097                         //draw the contact bitmap
1098                         pCanvas->DrawBitmap(canvasRect,*pPhotoId);
1099                         Bitmap* pNewPhotoId = new Bitmap();
1100                         pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1101                         delete pCanvas;
1102
1103                         pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1104                         pPhotoLbl->Invalidate(true);
1105                         delete pNewPhotoId;
1106                 }
1107         }
1108 }
1109
1110 void
1111 IncomingCallForm::ShowThumbnailImage(const Bitmap* pPhotoId)
1112 {
1113         Label* pPhotoLbl = static_cast<Label*>(GetControl(IDC_BIG_PHOTO_LABEL));
1114
1115         if (pPhotoLbl != null && pPhotoId != null)
1116         {
1117                 Canvas* pCanvas = new (std::nothrow) Canvas;
1118                 Bitmap* pBackground = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_BACKGROUND,W_CALL_THUMBNAIL,H_CALL_THUMBNAIL);
1119                 Bitmap* pShadow = AppUtility::GetBitmapFromResourcesN(IDB_CALL_THUMBNAIL_SHADOW,W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW);
1120                 Rectangle canvasRect(Rectangle(0, 0, pPhotoLbl->GetBounds().width, pPhotoLbl->GetBounds().height));
1121                 pCanvas->Construct(canvasRect);
1122                 //draw the back ground
1123                 pCanvas->DrawBitmap(canvasRect,*pBackground);
1124                 //draw shadow (to be enabled after correct shadow image is provided )
1125                 //pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_CALL_THUMBNAIL_SHADOW/2),
1126                         //      (pPhotoLbl->GetBounds().height/2)-(H_CALL_THUMBNAIL_SHADOW/2),W_CALL_THUMBNAIL_SHADOW,H_CALL_THUMBNAIL_SHADOW),*pShadow);
1127                 //draw the contact bitmap
1128                 pCanvas->DrawBitmap(Rectangle((pPhotoLbl->GetBounds().width/2)-(W_SMALL_PHOTO/2),
1129                                 (pPhotoLbl->GetBounds().height/2)-(H_SMALL_PHOTO/2),W_SMALL_PHOTO,H_SMALL_PHOTO),*pPhotoId);
1130                 Bitmap* pNewPhotoId = new Bitmap();
1131                 pNewPhotoId->Construct(*pCanvas, pCanvas->GetBounds());
1132                 delete pCanvas;
1133
1134                 pPhotoLbl->SetBackgroundBitmap(*pNewPhotoId);
1135                 pPhotoLbl->Invalidate(true);
1136                 delete pNewPhotoId;
1137                 delete pBackground;
1138                 delete pShadow;
1139         }
1140
1141 }
1142
1143 void
1144 IncomingCallForm::ShowCallersPhotoThumbnail(const Bitmap& pPhotoId)
1145 {
1146         //Draw Small Photo and show on small photo label
1147         __pSmallPhotoLabel  = new (std::nothrow) Label();//static_cast<Label*>(GetControl(IDC_SMALL_PHOTO_LABEL));
1148         __pSmallPhotoLabel->Construct(Rectangle(X_PHOTO_LBL, Y_PHOTO_LBL, W_PHOTO_LBL, H_PHOTO_LBL), L"");
1149         __pSmallPhotoLabel->SetBackgroundColor(Color(0,0,0));
1150         __pSmallPhotoLabel->SetBackgroundBitmap(pPhotoId);
1151         // Add a Label to the Form
1152         AddControl(*__pSmallPhotoLabel);
1153         __pSmallPhotoLabel->Invalidate(true);
1154 }
1155
1156 void
1157 IncomingCallForm::ShowTimerInfo(const String& timerLblName, const String& textToBeDisplayed)
1158 {
1159         Label* pTimerLbl = static_cast<Label*>(GetControl(timerLblName));
1160         if (pTimerLbl != null)
1161         {
1162                 pTimerLbl->SetText(textToBeDisplayed);
1163         }
1164 }
1165
1166 void
1167 IncomingCallForm::SetBitmapToRejectMessageButton(const String& btnName, const String& bgBitmap
1168                                                                                                 , const String& arrowBitmap, const String& messageIconBitmap, bool isButtonInPanel, bool setButtonPressBitmap)
1169 {
1170
1171         Button* pButton = null;
1172         if (isButtonInPanel == false)
1173         {
1174                 pButton = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1175         }
1176         else
1177         {
1178                 Panel* pKeysPanel = static_cast<Panel*>(GetControl(IDC_REJECT_PANEL));
1179                 pButton = static_cast<Button*>(pKeysPanel->GetControl(IDC_REJECT_MESSAGE_CANCEL_BUTTON));
1180         }
1181         Bitmap* pHoldBmp = null;
1182         Canvas* pCanvas = null;
1183         pCanvas = new (std::nothrow) Canvas();
1184         pCanvas->Construct(Rectangle(0,0,pButton->GetBounds().width,pButton->GetBounds().height));
1185         //set bitmap to button
1186         pHoldBmp = AppUtility::GetBitmapFromResourcesN(bgBitmap);
1187         if (pHoldBmp)
1188         {
1189                 //scale bitmap to predefined size
1190                 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1191                 pHoldBmp->Scale(Dimension(pButton->GetBounds().width, H_MESSAGE_BG_BITMAP));
1192                 pCanvas->DrawBitmap(Rectangle(Point(0, 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1193         }
1194         delete pHoldBmp;
1195         pHoldBmp = null;
1196         pHoldBmp = AppUtility::GetBitmapFromResourcesN(arrowBitmap);
1197         if (pHoldBmp)
1198         {
1199                 //scale bitmap to predefined size
1200                 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1201                 pHoldBmp->Scale(Dimension(W_ARROW_BITMAP, H_ARROW_BITMAP));
1202                 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetBounds().width / 2 - 17/*Width of arrow / 2*/), 0), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1203         }
1204         delete pHoldBmp;
1205         pHoldBmp = null;
1206
1207
1208
1209         //set button name
1210         String holdBtnName = AppUtility::GetResourceString(btnName);
1211         Dimension textDimension;
1212         if (!holdBtnName.IsEmpty())
1213         {
1214                 Font font;
1215                 font.Construct(FONT_STYLE_PLAIN, pButton->GetTextSize());
1216                 font.GetTextExtent(holdBtnName, holdBtnName.GetLength(), textDimension);
1217                 textDimension.height = textDimension.height + font.GetDescender();
1218                 TextElement* pTextElement = new (std::nothrow) TextElement();
1219                 pTextElement->Construct(holdBtnName);
1220                 Color textColor(249, 249, 249);
1221                 if (setButtonPressBitmap)
1222                 {
1223                         textColor.SetAlpha(255);
1224                 }
1225                 else
1226                 {
1227                         textColor.SetAlpha(127);
1228                 }
1229
1230                 pTextElement->SetTextColor(textColor);
1231                 pTextElement->SetFont(font);
1232
1233                 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1234                 pEnrichedText->Construct(textDimension);
1235                 pEnrichedText->Add(*pTextElement);
1236                 //Point textPos((X_MESSAGE_BITMAP + pHoldBmp->GetWidth() + MESSAGE_TEXT_X_MARGIN), Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1237                 Point textPos((pButton->GetWidth()/2)-(textDimension.width/2) + MESSAGE_TEXT_X_MARGIN,Y_MESSAGE_BITMAP + MESSAGE_TEXT_Y_MARGIN);
1238                 pCanvas->DrawText(textPos, *pEnrichedText);
1239                 // Cleans up
1240                 pEnrichedText->RemoveAll(true);
1241                 delete pEnrichedText;
1242         }
1243
1244
1245         pHoldBmp = AppUtility::GetBitmapFromResourcesN(messageIconBitmap);
1246         if (pHoldBmp)
1247         {
1248                 //scale bitmap to predefined size
1249                 pHoldBmp->SetScalingQuality(BITMAP_SCALING_QUALITY_MID);
1250                 pHoldBmp->Scale(Dimension(W_MESSAGE_BITMAP, H_MESSAGE_BITMAP));
1251                 //pCanvas->DrawBitmap(Rectangle(Point(X_MESSAGE_BITMAP, Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1252                 pCanvas->DrawBitmap(Rectangle(Point((pButton->GetWidth()/2)-(textDimension.width/2) -pHoldBmp->GetWidth(), Y_MESSAGE_BITMAP), Dimension(pHoldBmp->GetWidth(), pHoldBmp->GetHeight())), *pHoldBmp);
1253         }
1254
1255         //set background bitmpa to button
1256         Bitmap* pActualBgBmp = new (std::nothrow) Bitmap();
1257         pActualBgBmp->Construct(*pCanvas, pCanvas->GetBounds());
1258         if (setButtonPressBitmap)
1259         {
1260                 pButton->SetPressedBackgroundBitmap(*pActualBgBmp);
1261         }
1262         else
1263         {
1264                 pButton->SetNormalBackgroundBitmap(*pActualBgBmp);
1265         }
1266         delete pActualBgBmp;
1267         delete pHoldBmp;
1268         delete pCanvas;
1269 }
1270
1271 /*!In OnTouchPressed, It creates the three visual elements and starts the animation of opacity and rotation variation
1272   */
1273 void
1274 IncomingCallForm::OnTouchPressed(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1275 {
1276         __pCallPresentor->StopAlert();
1277         if (currentPosition.x < VALID_TOUCH_X_OFFSET && currentPosition.y < VALID_TOUCH_Y_OFFSET)
1278         {
1279                 Rectangle rect = source.GetBounds();
1280                 if (source.Equals(*__pAcceptLabel))
1281                 {
1282                         __isAnswerCallStarted = true;
1283                         __isRejectCallStarted = false;
1284                 }
1285                 else if (source.Equals(*__pRejectLabel))
1286                 {
1287                         __isAnswerCallStarted = false;
1288                         __isRejectCallStarted = true;
1289                 }
1290                 else
1291                 {
1292                         // touch event between the 2 labels. So Do nothing
1293                         return;
1294                 }
1295
1296         }
1297 }
1298
1299 // On Touch released, the animation and the visual elements disappear
1300 void
1301 IncomingCallForm::OnTouchReleased(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1302 {
1303         if (__isAnswerCallStarted == true)
1304         {
1305                 if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1306                 {
1307                         //Right reject icon
1308                         if(__pRejectFinalVisElem == null)
1309                         {
1310                                 __pRejectFinalVisElem = new (std::nothrow) VisualElement();
1311                         }
1312                         __pRejectFinalVisElem->Construct();
1313                         __pRejectFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1314                         __pRejectFinalVisElem->SetShowState(true);
1315                         __pRejectFinalVisElem->SetOpacity(1.00f);
1316                         __pRejectFinalVisElem->SetName(IDI_REJECT_FINAL_VISUAL_ELE_NAME);
1317                         if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_FINAL_VISUAL_ELE_NAME,true) == null)
1318                         {
1319                                 AppLogDebug("AttachChild __pRejectFinalVisElem");
1320                                 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectFinalVisElem);
1321                         }
1322                         Canvas* pCanvas = __pRejectFinalVisElem->GetCanvasN();
1323                         if(pCanvas != null)
1324                         {
1325                                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1326                                 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1327                                 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, W_DIAL_LABEL), *__pAcceptCircle);
1328                                 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pAcceptDial);
1329                                 delete pCanvas;
1330                         }
1331
1332                         __pAcceptVisElem->SetOpacity(0.0f);
1333                         //fetch already active call list
1334                         ArrayListT<CallInfo>* pCallList  = static_cast<ArrayListT<CallInfo>*>(__pCallPresentor->GetCallListN());
1335                         if (pCallList != null && pCallList->GetCount() > 0)
1336                         {
1337                                 //then atleast 1 active call exist.
1338                                 CallInfo phnCallInfo;
1339                                 pCallList->GetAt(0,phnCallInfo);
1340                                 //Check if only 1 call exist and it is on Hold
1341                                 if(pCallList->GetCount() == 1 && phnCallInfo.IsOnHold())
1342                                 {
1343                                         //directly accept call
1344                                         __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1345                                 }
1346                                 else
1347                                 {
1348                                         //Either 1 call exist and not "on Hold".
1349                                         //Or 2 calls exist.
1350                                         if(__pOptionPopup != null)
1351                                         {
1352                                                 delete __pOptionPopup;
1353                                                 __pOptionPopup = null;
1354                                         }
1355                                         __pOptionPopup = new (std::nothrow) CallOptionPopup(*this,*(__pCallPresentor));
1356                                         __pOptionPopup->Initialize();
1357                                         __pOptionPopup->SetShowState(true);
1358                                         __pOptionPopup->Draw();
1359                                         __pOptionPopup->Show();
1360                                 }
1361                                 pCallList->RemoveAll();
1362                         }
1363                         else
1364                         {
1365                                 //no active call - Accept the  incoming call
1366                                 __pCallPresentor->AcceptIncomingCall(ANSERWING_OPTION_ACCEPT_CALL,__incomingCallHandle);
1367                         }
1368                         delete pCallList;
1369                         pCallList = null;
1370                 }
1371                 else
1372                 {
1373                         __pAcceptVisElem->SetOpacity(1.0f);
1374                         __pRejectVisElem->SetOpacity(1.00f);
1375
1376                 }
1377         }
1378         else if (__isRejectCallStarted == true)
1379         {
1380                 if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1381                 {
1382                         //left dial icon
1383                         if(__pAcceptFinalVisElem == null)
1384                         {
1385                                 __pAcceptFinalVisElem = new (std::nothrow) VisualElement();
1386                         }
1387                         __pAcceptFinalVisElem->Construct();
1388                         __pAcceptFinalVisElem->SetBounds(FloatRectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1389                         __pAcceptFinalVisElem->SetShowState(true);
1390                         __pAcceptFinalVisElem->SetOpacity(1.0f);
1391                         __pAcceptFinalVisElem->SetName(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME);
1392                         if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_FINAL_VISUAL_ELE_NAME,true) == null)
1393                         {
1394                                 AppLogDebug("AttachChild __pAcceptFinalVisElem");
1395                                 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptFinalVisElem);
1396                         }
1397                         Canvas* pCanvas = __pAcceptFinalVisElem->GetCanvasN();
1398                         if(pCanvas != null)
1399                         {
1400                                 AppLogDebug("__pAcceptFinalVisElem drawing");
1401                                 pCanvas->SetBackgroundColor(COLOR_SWIPE_PANEL);
1402                                 pCanvas->SetForegroundColor(COLOR_SWIPE_PANEL);
1403                                 pCanvas->FillRectangle(COLOR_SWIPE_PANEL, Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL));
1404                                 pCanvas->DrawBitmap(Rectangle(0, 0, W_DIAL_LABEL, H_DIAL_LABEL), *__pRejectCircle);
1405                                 pCanvas->DrawBitmap(Rectangle(DIAL_ICON_X_OFFSET, DIAL_ICON_Y_OFFSET, W_DIAL_BITMAP, H_DIAL_BITMAP), *__pRejectDial);
1406                                 delete pCanvas;
1407                         }
1408                         __pRejectVisElem->SetOpacity(0.0f);
1409                         //Reject the call
1410                         __pCallPresentor->RejectCall(__incomingCallHandle, false,*__pActiveContactNo);
1411                 }
1412                 else
1413                 {
1414                         __pAcceptVisElem->SetOpacity(1.0f);
1415                         __pRejectVisElem->SetOpacity(1.00f);
1416
1417                 }
1418         }
1419         __isAnswerCallStarted = false;
1420         __isRejectCallStarted = false;
1421 }
1422
1423 void
1424 IncomingCallForm::OnTouchMoved(const Control& source, const Point& currentPosition, const TouchEventInfo& touchInfo)
1425 {
1426         if (__isAnswerCallStarted == true)
1427         {
1428                 if (currentPosition.x > 170 && currentPosition.x < 578)
1429                 {
1430                         if (currentPosition.x > REJECT_LABEL_X_OFFSET)
1431                         {
1432                                 __pRejectVisElem->SetOpacity(0.60f);
1433                                 __pAcceptVisElem->SetOpacity(0.60f);
1434                         }
1435                         else
1436                         {
1437                                 __pRejectVisElem->SetOpacity(1.0f);
1438                                 __pAcceptVisElem->SetOpacity(1.0f);
1439                         }
1440
1441                 }
1442         }
1443         if (__isRejectCallStarted == true)
1444         {
1445                 if (currentPosition.x < 0 && currentPosition.x > -522)
1446                 {
1447                         if (currentPosition.x < ACCEPT_LABEL_RELATIVE_POS)
1448                         {
1449                                 __pRejectVisElem->SetOpacity(0.60f);
1450                                 __pAcceptVisElem->SetOpacity(0.60f);
1451                         }
1452                         else
1453                         {
1454                                 __pRejectVisElem->SetOpacity(1.0f);
1455                                 __pAcceptVisElem->SetOpacity(1.0f);
1456                         }
1457                 }
1458         }
1459 }
1460
1461 void
1462 IncomingCallForm::OnItemSelected(int itemIndex)
1463 {
1464
1465         ArrayList* pArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
1466         pArgs->Construct();
1467
1468         //display name, mobile number
1469         Integer* argIndex = new (std::nothrow) Integer(itemIndex);
1470         pArgs->Add(argIndex);
1471         SendUserEvent(REQUEST_ITEM_SELECTED,pArgs);
1472
1473 }
1474
1475 void
1476 IncomingCallForm::HandleMultipleCallSelection(int itemIndex)
1477 {
1478         if(__pAcceptLabel->GetVisualElement()->GetChild(IDI_ACCEPT_VISUAL_ELE_NAME,true) == null)
1479         {
1480                 __pAcceptLabel->GetVisualElement()->AttachChild(*__pAcceptVisElem);
1481         }
1482         if(__pRejectLabel->GetVisualElement()->GetChild(IDI_REJECT_VISUAL_ELE_NAME,true) == null)
1483         {
1484                 __pRejectLabel->GetVisualElement()->AttachChild(*__pRejectVisElem);
1485         }
1486
1487         __pAcceptVisElem->SetOpacity(1.0f);
1488         __pRejectVisElem->SetOpacity(1.00f);
1489
1490         for (int i = 0; i < COUNT_ARROW_ELEMENTS; i++)
1491         {
1492                 __pRejectArrowLabel = static_cast<Label*>(__pRejectArrowLabelsList->GetAt(i));
1493                 String RejectVisualEleName(IDI_REJECT_ARROW_VISUAL_ELE_NAME);
1494                 RejectVisualEleName.Append(i);
1495                 __pRejectArrowVisElem = __pRejectArrowLabel->GetVisualElement()->GetChild(RejectVisualEleName,true);
1496                 __pRejectArrowVisElem->SetOpacity(0.0f);
1497                 __pAcceptArrowLabel = static_cast<Label*>(__pAcceptArrowLabelsList->GetAt(i));
1498                 String AcceptVisualEleName(IDI_ACCEPT_ARROW_VISUAL_ELE_NAME);
1499                 AcceptVisualEleName.Append(i);
1500                 __pAcceptArrowVisElem = __pAcceptArrowLabel->GetVisualElement()->GetChild(AcceptVisualEleName,true);
1501                 __pAcceptArrowVisElem->SetOpacity(0.0f);
1502         }
1503         if (__pRejectFinalVisElem != null)
1504         {
1505                 __pRejectFinalVisElem->Destroy();
1506                 __pRejectFinalVisElem = null;
1507         }
1508
1509         if (__pAcceptFinalVisElem != null)
1510         {
1511                 __pAcceptFinalVisElem->Destroy();
1512                 __pAcceptFinalVisElem = null;
1513         }
1514         if (__pOptionPopup)
1515         {
1516                 delete __pOptionPopup;
1517                 __pOptionPopup = null;
1518         }
1519         //accept call
1520         __pCallPresentor->AcceptIncomingCall(CallAnsweringOptions(itemIndex),__incomingCallHandle);
1521 }
1522
1523 void
1524 IncomingCallForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
1525 {
1526         switch(requestId)
1527         {
1528                 case REQUEST_ITEM_SELECTED:
1529                 {
1530                         if(pArgs != null)
1531                         {
1532                                 Integer *index = static_cast<Integer*>(pArgs->GetAt(0));
1533                                 if(index != null)
1534                                 {
1535                                         HandleMultipleCallSelection(index->ToInt());
1536                                 }
1537                         }
1538                 }
1539                 break;
1540         }
1541 }
1542
1543 void
1544 IncomingCallForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
1545 {
1546         AppLogDebug("Enter");
1547         HideRejectPanel();
1548         SetFocus();
1549         Button* pButtonRejectMessage = static_cast<Button*>(GetControl(IDC_REJECT_MESSAGE_BUTTON));
1550         if (pButtonRejectMessage)
1551         {
1552                 pButtonRejectMessage->SetShowState(true);
1553                 pButtonRejectMessage->Invalidate(true);
1554                 pButtonRejectMessage->Draw();
1555         }
1556         RequestRedraw(true);
1557
1558 }