NABI_SE Issue Fix: 45902 45915 and internal issue fix
[apps/osp/Contacts.git] / src / CtContactDetailsForm.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (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        CtContactDetailsForm.cpp
19  * @brief       This is the implementation file for the ContactDetailsForm class.
20  */
21
22 #include <FApp.h>
23 #include <FBase.h>
24 #include <FMedia.h>
25 #include <FSocial.h>
26 #include "CtContactDetailsForm.h"
27 #include "CtContactPresentationModel.h"
28 #include "CtContactValueListItemProvider.h"
29 #include "CtContactsApp.h"
30 #include "CtResourceManager.h"
31 #include "CtSceneRegister.h"
32 #include "CtTypes.h"
33
34 using namespace Tizen::App;
35 using namespace Tizen::Base;
36 using namespace Tizen::Base::Collection;
37 using namespace Tizen::Base::Utility;
38 using namespace Tizen::Graphics;
39 using namespace Tizen::Io;
40 using namespace Tizen::Media;
41 using namespace Tizen::Ui;
42 using namespace Tizen::Ui::Controls;
43 using namespace Tizen::Ui::Scenes;
44 using namespace Tizen::Social;
45
46 static const int IDA_FOOTER_EDIT = 10;
47 static const int IDA_FOOTER_DELETE = 11;
48 static const int IDA_FOOTER_ADD = 13;
49 static const int IDA_VOICE_CALL = 20;
50 static const int IDA_MESSAGE = 21;
51 static const int IDA_VIDEO_CALL = 22;
52 static const int IDA_CONTEXTMENU_SHARE_EMAIL = 30;
53 static const int IDA_CONTEXTMENU_SHARE_MESSAGE = 31;
54 static const int IDA_BUTTON_RINGTONE_CLEAR = 40;
55 static const int IDA_BUTTON_SHARE_NAME_CARD = 50;
56 static const int IDA_POPUP_CLOSE = 60;
57 static const int IDA_INVALID_FILE_POPUP_CLOSE = 61;
58 static const int IDA_MORE_DEFAULT_NUMBER = 70;
59
60 static const wchar_t* IDB_DETAILS_FAVORITE_ON = L"00_icon_favorite_on.png";
61 static const wchar_t* IDB_DETAILS_FAVORITE_OFF = L"00_icon_favorite_off.png";
62 static const wchar_t* IDB_DETAILS_RESET_NORMAL = L"00_button_refresh.png";
63 static const wchar_t* IDB_DETAILS_RESET_PRESSED = L"00_button_refresh_press.png";
64 static const wchar_t* IDB_CIRCLE_BUTTON_NORMAL = L"C02_circle_button.png";
65 static const wchar_t* IDB_CIRCLE_BUTTON_PRESSED = L"C02_circle_button_press.png";
66 static const wchar_t* IDB_CALL_NORMAL = L"C02_circle_icon_call.png";
67 static const wchar_t* IDB_CALL_PRESSED = L"C02_circle_icon_call_press.png";
68 static const wchar_t* IDB_SMS_NORMAL = L"C02_circle_icon_sms.png";
69 static const wchar_t* IDB_SMS_PRESSED = L"C02_circle_icon_sms_press.png";
70 static const wchar_t* IDB_VIDEO_CALL_NORMAL = L"C02_circle_icon_vt-call.png";
71 static const wchar_t* IDB_VIDEO_CALL_PRESSED = L"C02_circle_icon_vt-call_press.png";
72
73 static const wchar_t* FAVORITE_LABEL = L"FavoriteLabel";
74 static const wchar_t* GROUP_STYLE_PANEL = L"GroupStylePanel";
75 static const wchar_t* GROUP_LABEL = L"GroupLabel";
76
77 static const int Y_THUMBNAIL = 34;
78 static const int H_THUMBNAIL = 360;
79 static const int X_MAIN_INFO = 26;
80 static const int H_NAME = 70;
81 static const int H_SUB_INFO = 40;
82 static const int H_SUB_INFO_DIVIDER = 6;
83 static const int H_DEFAULT_NUMBER = 50;
84 static const int H_QUICK_BUTTON_DIVIDER = 42;
85 #if __SUPPORT_VIDEO_CALL
86 static const int W_QUICK_BUTTON_GAP = 115;
87 static const int X_QUICK_BUTTON = 38;
88 #else
89 static const int W_QUICK_BUTTON_GAP = 148;
90 static const int X_QUICK_BUTTON = 148;
91 #endif
92 static const int H_QUICK_BUTTON = 138;
93 static const int Y_FAVORITE = 10;
94 static const int H_FAVORITE = 45;
95 static const int W_FAVORITE_GAP = 26;
96 static const int W_GROUP_STYLE_MARGIN = 16;
97 static const int W_TEXT_MARGIN = 26;
98 static const int W_TYPE = 160;
99 static const int H_ITEM = 112;
100 static const int H_ITEM_DOUBLE_LINE = 148;
101 static const int H_ADDITIONAL_ITEM = 54;
102 static const int Y_ITEM_TITLE = 22;
103 static const int H_ITEM_TITLE = 42;
104 static const int H_ITEM_VALUE = 62;
105 static const int H_ICON = 74;
106 static const int Y_BUTTON = 20;
107 static const int H_BUTTON = 72;
108 static const int H_BUTTON_CONTAINER = 132;
109 static const int W_BUTTON_GAP = 18;
110
111 static const int W_POPUP = 688;
112 static const int H_POPUP = 532;
113 static const int H_INVALID_FILE_POPUP = 200;
114 static const int H_POPUP_LIST_VIEW = 338;
115 static const int Y_POPUP_BUTTON = 358;
116 static const int H_POPUP_BUTTON = 74;
117 static const int W_POPUP_BUTTON = 394;
118 static const int Y_POPUP_TEXT_LABEL = 12;
119 static const int H_POPUP_TEXT_LABEL = 90;
120
121 static const int SUB_INDEX_MASK = 0xF000;
122 static const int MESSAGE_BOX_TIMEOUT_MS = 300000;
123
124 static const unsigned int COLOR_TABLE_BG = Color32<248, 246, 239>::Value;
125 static const unsigned int COLOR_ITEM_TITLE = Color32<128, 128, 128>::Value;
126 static const unsigned int COLOR_ITEM_VALUE = Color32<0, 0, 0>::Value;
127 static const unsigned int COLOR_ITEM_TYPE = Color32<128, 128, 128>::Value;
128 static const unsigned int COLOR_OTHER_NUMBER = Color32<0, 0, 0>::Value;
129 static const unsigned int COLOR_NAME = Color32<59, 115, 182>::Value;
130 static const unsigned int COLOR_GROUP_STYLE = Color32<240, 237, 232>::Value;
131 static const unsigned int COLOR_POPUP_TEXT = Color32<0, 0, 0>::Value;
132 static const unsigned int COLOR_PRESSED = Color32<87, 135, 194>::Value;
133
134 static const int FONT_SIZE_NAME = 56;
135 static const int FONT_SIZE_SUB_INFO = 32;
136 static const int FONT_SIZE_MAIN_TEXT = 44;
137 static const int FONT_SIZE_SUB_TEXT = 32;
138 static const int FONT_SIZE_POPUP_TEXT = 38;
139
140 static const wchar_t* INPUT_KEY_CALL_TYPE = L"http://tizen.org/appcontrol/data/call/type";
141 static const wchar_t* INPUT_KEY_MESSAGE_TYPE = L"http://tizen.org/appcontrol/data/message/type";
142 static const wchar_t* INPUT_KEY_MESSAGE_TO = L"http://tizen.org/appcontrol/data/to";
143 static const wchar_t* INPUT_KEY_SELECTION_MODE = L"http://tizen.org/appcontrol/data/selection_mode";
144 static const wchar_t* INPUT_DATA_SELECTION_MODE_SINGLE = L"single";
145 static const wchar_t* INPUT_MIME_TYPE_AUDIO = L"audio/*";
146 static const wchar_t* INPUT_URI_TEL = L"tel:";
147 static const wchar_t* INPUT_TYPE_VIDEO = L"video";
148 static const wchar_t* INPUT_TYPE_VOICE = L"voice";
149 static const wchar_t* INPUT_TYPE_SMS = L"sms";
150 static const wchar_t* INPUT_TYPE_MMS = L"mms";
151 static const wchar_t* OUTPUT_KEY_SELECTED = L"http://tizen.org/appcontrol/data/selected";
152 static const wchar_t* KEY_VIEW_TYPE = L"viewType";
153 static const wchar_t* KEY_VIEW_TYPE_VCF = L"path";
154 static const wchar_t* KEY_VIEW_TYPE_CONTACT_ID = L"contactId";
155 static const wchar_t* VALUE_VIEW_TYPE_VCF = L"vcf";
156 static const wchar_t* VALUE_VIEW_TYPE_CONTACT = L"contact";
157
158 ContactDetailsForm::ContactDetailsForm(void)
159 : __isAppControlLaunching(false)
160 , __pAppControl(null)
161 , __pTableView(null)
162 , __pContextMenuCall(null)
163 , __pContextMenuShare(null)
164 , __pFileEventManager(null)
165 , __pOptionMenu(null)
166 , __pDefaultSelectorPopup(null)
167 , __pInvalidFilePopup(null)
168 , __pItemList(null)
169 , __pPresentationModel(null)
170 , __scrolledDistance(0)
171 {
172 }
173
174 ContactDetailsForm::~ContactDetailsForm(void)
175 {
176 }
177
178 void
179 ContactDetailsForm::Initialize(void)
180 {
181         Construct(L"IDL_CONTACT_DETAILS_FORM");
182 }
183
184 result
185 ContactDetailsForm::OnInitializing(void)
186 {
187         Footer* pFooter = GetFooter();
188         pFooter->AddActionEventListener(*this);
189         SetFormBackEventListener(this);
190         SetFormMenuEventListener(this);
191
192         __pTableView = new (std::nothrow) TableView();
193         __pTableView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), false, TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT);
194         __pTableView->SetItemProvider(this);
195         __pTableView->AddTableViewItemEventListener(*this);
196         __pTableView->SetBackgroundColor(COLOR_TABLE_BG);
197         __pTableView->AddTouchEventListener(*this);
198         __pTableView->AddScrollEventListener(*this);
199         AddControl(__pTableView);
200
201         __pContextMenuCall = new (std::nothrow) ContextMenu();
202         __pContextMenuCall->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
203         __pContextMenuCall->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_CALL"), IDA_VOICE_CALL);
204         __pContextMenuCall->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"), IDA_MESSAGE);
205 #if     __SUPPORT_VIDEO_CALL
206         __pContextMenuCall->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_VIDEO_CALL"), IDA_VIDEO_CALL);
207 #endif
208         __pContextMenuCall->AddActionEventListener(*this);
209         __pContextMenuCall->SetFocusable(true);
210
211         __pContextMenuShare = new (std::nothrow) ContextMenu();
212         __pContextMenuShare->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
213         __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), IDA_CONTEXTMENU_SHARE_EMAIL);
214         __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"), IDA_CONTEXTMENU_SHARE_MESSAGE);
215         __pContextMenuShare->AddActionEventListener(*this);
216         __pContextMenuShare->SetFocusable(true);
217
218         __pItemList = new (std::nothrow) ArrayListT<int>();
219         __pItemList->Construct();
220
221         __pPresentationModel = new (std::nothrow) ContactPresentationModel();
222         __pPresentationModel->Construct();
223         __pPresentationModel->AddContactChangeListener(*this);
224
225         __pOptionMenu = new (std::nothrow) OptionMenu();
226         __pOptionMenu->Construct();
227         __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_PB_BODY_MARK_AS_DEFAULT_NUMBER"), IDA_MORE_DEFAULT_NUMBER);
228         __pOptionMenu->AddActionEventListener(*this);
229         __pOptionMenu->SetShowState(false);
230
231         return E_SUCCESS;
232 }
233
234 result
235 ContactDetailsForm::OnTerminating(void)
236 {
237         delete __pAppControl;
238         delete __pContextMenuCall;
239         delete __pContextMenuShare;
240         delete __pFileEventManager;
241         delete __pOptionMenu;
242
243         if (__pItemList != null)
244         {
245                 __pItemList->RemoveAll();
246                 delete __pItemList;
247         }
248
249         if (__pPresentationModel != null)
250         {
251                 __pPresentationModel->RemoveContactChangeListener(*this);
252                 delete __pPresentationModel;
253         }
254
255         delete __pDefaultSelectorPopup;
256         delete __pInvalidFilePopup;
257
258         return E_SUCCESS;
259 }
260
261 void
262 ContactDetailsForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
263 {
264         AppLog("ContactDetailsForm::OnActionPerformed(), actionId %d", actionId);
265
266         result r = E_SUCCESS;
267         SceneManager* pSceneManager = SceneManager::GetInstance();
268
269         switch (actionId)
270         {
271         case IDA_FOOTER_EDIT:
272                 {
273                         ArrayList* pList = new (std::nothrow) ArrayList();
274                         pList->Construct();
275                         pList->Add(*(new (std::nothrow) Integer(__pPresentationModel->GetContactId())));
276                         r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
277                         TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go forward", GetErrorMessage(r));
278                 }
279                 break;
280         case IDA_FOOTER_DELETE:
281                 {
282                         int modalResult = 0;
283                         MessageBox deleteMessageBox;
284                         deleteMessageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"), MSGBOX_STYLE_YESNO, MESSAGE_BOX_TIMEOUT_MS);
285                         deleteMessageBox.ShowAndWait(modalResult);
286
287                         if (modalResult == MSGBOX_RESULT_YES)
288                         {
289                                 r = __pPresentationModel->RemoveContact();
290                                 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to remove contact", GetErrorMessage(r));
291                         }
292                 }
293                 break;
294         case IDA_FOOTER_ADD:
295                 {
296                         ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
297                         
298                         if (pContactsApp->GetOperationId() == OPERATION_ID_VIEW)
299                         {
300                                 if(Tizen::Io::File::IsFileExist(__pPresentationModel->GetVcfPath()) == false)
301                                 {
302                                         ShowInvalidFilePopup(false);
303                                         return;
304                                 }
305                         }
306
307                         ArrayList* pList = new (std::nothrow) ArrayList();
308                         pList->Construct();
309                         pList->Add(*(new (std::nothrow) Integer(INVALID_RECORD_ID)));
310                         pList->Add(*(new (std::nothrow) String(__pPresentationModel->GetVcfPath())));
311                         r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
312                         TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go forward", GetErrorMessage(r));
313                 }
314                 break;
315         case IDA_MORE_DEFAULT_NUMBER:
316                 {
317                         ShowDefaultSelectorPopup();
318                 }
319                 break;
320         case IDA_BUTTON_RINGTONE_CLEAR:
321                 {
322                         __pPresentationModel->SetValue(DETAIL_PROPERTY_RINGTONE, String());
323                         __pPresentationModel->UpdateContact();
324                         __pTableView->RefreshItem(__pItemList->GetCount() - 1, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
325                 }
326                 break;
327         case IDA_VOICE_CALL:
328                 {
329                         r = LaunchAppControl(PROVIDER_ID_PHONE, OPERATION_ID_CALL, INPUT_TYPE_VOICE, source.GetName());
330                         TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
331                 }
332                 break;
333         case IDA_MESSAGE:
334                 {
335                         r = LaunchAppControl(PROVIDER_ID_MESSAGE, OPERATION_ID_COMPOSE, INPUT_TYPE_SMS, source.GetName());
336                         TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
337                 }
338                 break;
339         case IDA_VIDEO_CALL:
340                 {
341                         r = LaunchAppControl(PROVIDER_ID_PHONE, OPERATION_ID_CALL, INPUT_TYPE_VIDEO, source.GetName());
342                         TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
343                 }
344                 break;
345         case IDA_CONTEXTMENU_SHARE_EMAIL:
346                 {
347                         r = LaunchAppControl(PROVIDER_ID_EMAIL, OPERATION_ID_COMPOSE);
348                         TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
349                 }
350                 break;
351         case IDA_CONTEXTMENU_SHARE_MESSAGE:
352                 {
353                         r = LaunchAppControl(PROVIDER_ID_MESSAGE, OPERATION_ID_COMPOSE, INPUT_TYPE_MMS);
354                         TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
355                 }
356                 break;
357         case IDA_BUTTON_SHARE_NAME_CARD:
358                 {
359                         Point itemPoint;
360                         itemPoint.x = GetClientAreaBounds().width / 2;
361                         itemPoint.y = 0;
362
363                         TableViewItem* pParent = static_cast<TableViewItem*>(source.GetParent());
364                         if (pParent != null)
365                         {
366                                 itemPoint.y = GetClientAreaBounds().y + pParent->GetY() + source.GetY() - __scrolledDistance;
367                         }
368
369                         __pContextMenuShare->SetAnchorPosition(itemPoint);
370                         __pContextMenuShare->SetShowState(true);
371                         __pContextMenuShare->Show();
372                 }
373                 break;
374         case IDA_POPUP_CLOSE:
375                 {
376                         HideDefaultSelectorPopup();
377                 }
378                 break;
379         case IDA_INVALID_FILE_POPUP_CLOSE:
380                 {
381                         __pInvalidFilePopup->SetShowState(false);
382
383                         ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
384
385                         result r = AppControlProviderManager::GetInstance()->SendAppControlResult(pContactsApp->GetRequestId(), APP_CTRL_RESULT_FAILED, null);
386                         AppLogDebug("[%s] The return result from SendAppControlResult().", GetErrorMessage(r));
387
388                         UiApp::GetInstance()->Terminate();
389                 }
390                 break;
391         default:
392                 break;
393         }
394 }
395
396 void
397 ContactDetailsForm::OnFormMenuRequested(Tizen::Ui::Controls::Form& source)
398 {
399         __pOptionMenu->SetShowState(true);
400         __pOptionMenu->Show();
401 }
402
403 void
404 ContactDetailsForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
405 {
406         if (__appControlViewType.IsEmpty() == false)
407         {
408                 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
409                 AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance();
410
411                 result r = pAppManager->SendAppControlResult(pContactsApp->GetRequestId(), APP_CTRL_RESULT_CANCELED, null);
412                 AppLogDebug("[%s] The return result from SendAppControlResult().", GetErrorMessage(r));
413
414                 UiApp::GetInstance()->Terminate();
415         }
416         else
417         {
418                 SceneManager* pSceneManager = SceneManager::GetInstance();
419
420                 result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
421                 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go backward", GetErrorMessage(r));
422         }
423 }
424
425 void
426 ContactDetailsForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, IList* pArgs)
427 {
428         ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
429         TryReturnVoid(pContactsApp != null, "Unable to cast UiApp to ContactsApp");
430
431         pContactsApp->AddContactsAppChangeEventListener(*this);
432
433         if (previousSceneId == IDSCN_GROUP_SELECTOR || previousSceneId == IDSCN_GROUP_EDITOR)
434         {
435                 if (pArgs == null)
436                 {
437                         return;
438                 }
439
440                 Integer* pArgument = null;
441                 __pPresentationModel->RemoveContactFromAllCategories();
442                 IEnumerator* pEnum = pArgs->GetEnumeratorN();
443                 while (pEnum->MoveNext() == E_SUCCESS)
444                 {
445                         pArgument = static_cast<Integer*>(pEnum->GetCurrent());
446                         if (pArgument != null)
447                         {
448                                 __pPresentationModel->AddContactToCategory(pArgument->ToInt());
449                         }
450                 }
451                 delete pEnum;
452
453                 __pTableView->RefreshItem(__pItemList->GetCount() - 2, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
454         }
455         else if (previousSceneId == IDSCN_CONTACT_EDITOR && __appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == false)
456         {
457                 InitializeDetailItemList();
458                 __pTableView->UpdateTableView();
459         }
460         else
461         {
462                 if (pArgs == null)
463                 {
464                         return;
465                 }
466
467                 if (pContactsApp->GetOperationId() == OPERATION_ID_VIEW)
468                 {
469                         __pPresentationModel->RemoveContactChangeListener(*this);
470
471                         result r = InitializeAppControl(pArgs);
472
473                         if (IsFailed(r))
474                         {
475                                 pArgs->RemoveAll(true);
476                                 delete pArgs;
477                                 AppLogDebug("Unable to initialize appcontrol");
478
479                                 ShowInvalidFilePopup();
480
481                                 return;
482                         }
483
484                         InitializeDetailItemList();
485                 }
486                 else
487                 {
488                         Integer* pContactId = static_cast<Integer*>(pArgs->GetAt(0));
489                         if (pContactId != null)
490                         {
491                                 __pPresentationModel->SetContactId(pContactId->ToInt());
492                                 InitializeDetailItemList();
493                         }
494                 }
495                 __pTableView->UpdateTableView();
496         }
497
498         if (pArgs != null)
499         {
500                 pArgs->RemoveAll(true);
501                 delete pArgs;
502         }
503 }
504
505 result
506 ContactDetailsForm::InitializeAppControl(Tizen::Base::Collection::IList* pArgs)
507 {
508         if (pArgs == null)
509         {
510                 return E_FAILURE;
511         }
512
513         result r = E_SUCCESS;
514
515         String* pArgStringType = null;
516         String* pArgStringValue = null;
517         String keyViewType;
518         String keyValue;
519         String valueViewType;
520         String value;
521
522         pArgStringType = static_cast<String*>(pArgs->GetAt(0));
523         pArgStringValue = static_cast<String*>(pArgs->GetAt(1));
524
525         TryReturn(pArgStringType != null && pArgStringValue != null, E_FAILURE, "[E_FAILURE] Unable to initialize appcontrol");
526
527         ParseAppControlArgument(*pArgStringType, keyViewType, valueViewType);
528         ParseAppControlArgument(*pArgStringValue, keyValue, value);
529
530         if (keyViewType.Equals(KEY_VIEW_TYPE, false))
531         {
532                 if (valueViewType.Equals(VALUE_VIEW_TYPE_CONTACT, false))
533                 {
534                         if (keyValue.Equals(KEY_VIEW_TYPE_CONTACT_ID, false))
535                         {
536                                 RecordId contactId;
537                                 Integer::Parse(value, contactId);
538                                 r = __pPresentationModel->SetContactId(contactId);
539                                 __appControlViewType = valueViewType;
540
541                                 Footer* pFooter = GetFooter();
542                                 pFooter->RemoveAllItems();
543
544                                 FooterItem footerItemEdit;
545                                 footerItemEdit.Construct(IDA_FOOTER_EDIT);
546                                 footerItemEdit.SetText(ResourceManager::GetString(L"IDS_COM_SK_EDIT"));
547                                 pFooter->AddItem(footerItemEdit);
548
549                                 __pPresentationModel->AddContactChangeListener(*this);
550                         }
551                         else
552                         {
553                                 AppLogDebug("Invalid KEY(contactId) of AppControl[VIEW]. [%ls] has been input", keyValue.GetPointer());
554                                 r = E_FAILURE;
555                         }
556                 }
557                 else if (valueViewType.Equals(VALUE_VIEW_TYPE_VCF, false))
558                 {
559                         if (keyValue.Equals(KEY_VIEW_TYPE_VCF, false))
560                         {
561                                 r = __pPresentationModel->SetVcfPath(value);
562
563                                 __appControlViewType = valueViewType;
564                                 Footer* pFooter = GetFooter();
565                                 pFooter->RemoveAllItems();
566                                 pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
567
568                                 FooterItem footerItemAdd;
569                                 footerItemAdd.Construct(IDA_FOOTER_ADD);
570                                 footerItemAdd.SetText(ResourceManager::GetString(L"IDS_COM_OPT_ADD_TO_CONTACTS"));
571                                 pFooter->AddItem(footerItemAdd);
572                         }
573                         else
574                         {
575                                 AppLogDebug("Invalid KEY(path) of AppControl[VIEW]. [%ls] has been input", keyValue.GetPointer());
576                                 r = E_FAILURE;
577                         }
578                 }
579                 else
580                 {
581                         AppLogDebug("viewType of AppControl[VIEW] should be either vcf or contact. [%ls] has been inpue", keyValue.GetPointer());
582                         r = E_FAILURE;
583                 }
584         }
585         else
586         {
587                 AppLogDebug("Invalid KEY(viewType) of AppControl[VIEW]. [%ls] has been input", keyViewType.GetPointer());
588                 r = E_FAILURE;
589         }
590
591         return r;
592 }
593
594 void
595 ContactDetailsForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
596 {
597         ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
598         pContactsApp->RemoveContactsAppChangeEventListener(*this);
599
600         delete __pAppControl;
601         __pAppControl = null;
602 }
603
604 void
605 ContactDetailsForm::InitializeDetailItemList(void)
606 {
607         if (__pItemList->GetCount() > 0)
608         {
609                 __pItemList->RemoveAll();
610         }
611
612         // Default area
613         __pItemList->Add(DETAIL_PROPERTY_MAIN_INFO);
614
615         // Other Phone Numbers
616         Footer* pFooter = GetFooter();
617         pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
618         int otherNumberCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER);
619         
620         if (otherNumberCount > 1)
621         {
622                 if (__appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == false)
623                 {
624                         SetFormMenuEventListener(this);
625                 }
626                 else
627                 {
628                         SetFormMenuEventListener(null);
629                 }
630
631                 for (int subIndex = 0; subIndex < otherNumberCount; subIndex++)
632                 {
633                         if (__pPresentationModel->GetDefaultNumberIndex() != subIndex)
634                         {
635                                 __pItemList->Add(DETAIL_PROPERTY_PHONE_NUMBER + subIndex);
636                         }
637                 }
638         }
639         else
640         {
641                 SetFormMenuEventListener(null);
642         }
643
644         if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_EMAIL) > 0)
645         {
646                 __pItemList->Add(DETAIL_PROPERTY_EMAIL);
647         }
648
649         if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_ADDRESS) > 0)
650         {
651                 __pItemList->Add(DETAIL_PROPERTY_ADDRESS);
652         }
653
654         if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_IM_ADDRESS) > 0)
655         {
656                 __pItemList->Add(DETAIL_PROPERTY_IM_ADDRESS);
657         }
658
659         if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_URL) > 0)
660         {
661                 __pItemList->Add(DETAIL_PROPERTY_URL);
662         }
663
664         if (__pPresentationModel->GetValue(DETAIL_PROPERTY_BIRTHDAY).IsEmpty() == false)
665         {
666                 __pItemList->Add(DETAIL_PROPERTY_BIRTHDAY);
667         }
668
669         if (__pPresentationModel->GetValue(DETAIL_PROPERTY_NOTE).IsEmpty() == false)
670         {
671                 __pItemList->Add(DETAIL_PROPERTY_NOTE);
672         }
673
674         __pItemList->Add(DETAIL_PROPERTY_GROUP);
675         __pItemList->Add(DETAIL_PROPERTY_RINGTONE);
676 }
677
678 int
679 ContactDetailsForm::GetItemCount(void)
680 {
681         return __pItemList->GetCount();
682 }
683
684 Tizen::Ui::Controls::TableViewItem*
685 ContactDetailsForm::CreateItem(int itemIndex, int itemWidth)
686 {
687         TableViewItem* pItem = new (std::nothrow) TableViewItem();
688
689         int contentItemIndex = -1;
690         int itemSubIndex = -1;
691         __pItemList->GetAt(itemIndex, contentItemIndex);
692
693         switch (contentItemIndex & SUB_INDEX_MASK)
694         {
695         case DETAIL_PROPERTY_PHONE_NUMBER:
696                 {
697                         itemSubIndex = contentItemIndex - DETAIL_PROPERTY_PHONE_NUMBER;
698                         contentItemIndex = DETAIL_PROPERTY_PHONE_NUMBER;
699                 }
700                 break;
701         case DETAIL_PROPERTY_EMAIL:
702                 {
703                         contentItemIndex = DETAIL_PROPERTY_EMAIL;
704                 }
705                 break;
706         case DETAIL_PROPERTY_IM_ADDRESS:
707                 {
708                         contentItemIndex = DETAIL_PROPERTY_IM_ADDRESS;
709                 }
710                 break;
711         case DETAIL_PROPERTY_ADDRESS:
712                 {
713                         contentItemIndex = DETAIL_PROPERTY_ADDRESS;
714                 }
715                 break;
716         case DETAIL_PROPERTY_URL:
717                 {
718                         contentItemIndex = DETAIL_PROPERTY_URL;
719                 }
720                 break;
721         default:
722                 break;
723         }
724
725         switch (contentItemIndex)
726         {
727         case DETAIL_PROPERTY_MAIN_INFO:
728                 {
729                         AddMainInfo(itemWidth, pItem);
730                 }
731                 break;
732         case DETAIL_PROPERTY_PHONE_NUMBER: // fall through
733         case DETAIL_PROPERTY_EMAIL: // fall through
734         case DETAIL_PROPERTY_ADDRESS: // fall through
735         case DETAIL_PROPERTY_URL: // fall through
736         case DETAIL_PROPERTY_BIRTHDAY: // fall through
737         case DETAIL_PROPERTY_NOTE:
738         case DETAIL_PROPERTY_IM_ADDRESS:
739                 {
740                         AddProperty(itemWidth, pItem, contentItemIndex, itemSubIndex);
741                 }
742                 break;
743         case DETAIL_PROPERTY_GROUP:
744                 {
745                         AddGroup(itemWidth, pItem);
746                 }
747                 break;
748         case DETAIL_PROPERTY_RINGTONE:
749                 {
750                         AddRingTone(itemWidth, pItem);
751                 }
752                 break;
753         default:
754                 {
755                         delete pItem;
756                         pItem = null;
757                 }
758                 break;
759         }
760
761         return pItem;
762 }
763
764 bool
765 ContactDetailsForm::DeleteItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
766 {
767         delete pItem;
768         return true;
769 }
770
771 void
772 ContactDetailsForm::UpdateItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
773 {
774         int contentItemIndex = -1;
775         __pItemList->GetAt(itemIndex, contentItemIndex);
776
777         String value;
778
779         if (contentItemIndex == DETAIL_PROPERTY_GROUP)
780         {
781                 value =  __pPresentationModel->GetValue(DETAIL_PROPERTY_GROUP);
782
783                 if (value.IsEmpty())
784                 {
785                         value = ResourceManager::GetString(L"IDS_PB_BODY_NOT_ASSIGNED");
786                 }
787         }
788         else if (contentItemIndex == DETAIL_PROPERTY_RINGTONE)
789         {
790                 String path =  __pPresentationModel->GetValue(DETAIL_PROPERTY_RINGTONE);
791                 int index = 0;
792                 path.LastIndexOf(L"/", path.GetLength() - 1, index);
793
794                 if (index != 0)
795                 {
796                         path.SubString(index + 1, value);
797                 }
798         }
799
800         Label* pValueLabel = static_cast<Label*>(pItem->GetControl(2));
801         if (pValueLabel == null)
802         {
803                 return;
804         }
805
806         pValueLabel->SetText(value);
807         pValueLabel->Invalidate(false);
808 }
809
810 int
811 ContactDetailsForm::GetDefaultItemHeight(void)
812 {
813         return H_ITEM;
814 }
815
816 void
817 ContactDetailsForm::AddMainInfo(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem)
818 {
819         int itemHeight = Y_THUMBNAIL;
820
821         Label* pThumbnailLabel = null;
822
823         String thumbnailPath = __pPresentationModel->GetValue(DETAIL_PROPERTY_THUMBNAIL);
824         Bitmap* pThumbnail = null;
825         ImageBuffer thumbnailImageBuffer;
826         result r = thumbnailImageBuffer.Construct(thumbnailPath);
827         if (r == E_SUCCESS)
828         {
829                 pThumbnail = thumbnailImageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_ARGB8888, BUFFER_SCALING_NONE);
830         }
831         if (pThumbnail != null)
832         {
833                 pThumbnail->SetScalingQuality(BITMAP_SCALING_QUALITY_HIGH);
834                 pThumbnail->Scale(Dimension(H_THUMBNAIL, H_THUMBNAIL));
835                 pThumbnailLabel = new (std::nothrow) Label();
836                 pThumbnailLabel->Construct(Rectangle((itemWidth - H_THUMBNAIL) / 2, Y_THUMBNAIL, H_THUMBNAIL, H_THUMBNAIL), L"");
837                 pThumbnailLabel->SetBackgroundBitmap(*pThumbnail);
838                 delete pThumbnail;
839
840                 itemHeight += (H_THUMBNAIL + Y_THUMBNAIL);
841         }
842
843         String firstName = __pPresentationModel->GetValue(DETAIL_PROPERTY_FIRST_NAME);
844         String middleName = __pPresentationModel->GetValue(DETAIL_PROPERTY_MIDDLE_NAME);
845         String lastName = __pPresentationModel->GetValue(DETAIL_PROPERTY_LAST_NAME);
846         String nickName = __pPresentationModel->GetValue(DETAIL_PROPERTY_NICK_NAME);
847         String suffix = __pPresentationModel->GetValue(DETAIL_PROPERTY_NAME_SUFFIX);
848         String jobTitle = __pPresentationModel->GetValue(DETAIL_PROPERTY_JOB_TITLE);
849         String company = __pPresentationModel->GetValue(DETAIL_PROPERTY_COMPANY);
850         String department = __pPresentationModel->GetValue(DETAIL_PROPERTY_DEPARTMENT);
851
852         String name;
853         if (firstName.IsEmpty() == false)
854         {
855                 name = firstName + CHARACTER_SPACE;
856         }
857         if (middleName.IsEmpty() == false)
858         {
859                 name += (middleName + CHARACTER_SPACE);
860         }
861         if (lastName.IsEmpty() == false)
862         {
863                 name += lastName;
864         }
865
866         if (name.IsEmpty())
867         {
868                 if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER))
869                 {
870                         name.Append(__pPresentationModel->GetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER));
871                 }
872                 else
873                 {
874                         name.Append(__pPresentationModel->GetValue(DETAIL_PROPERTY_EMAIL, 0));
875                 }
876         }
877
878         String suffixNickName;
879         if (suffix.IsEmpty() == false)
880         {
881                 suffixNickName = suffix + CHARACTER_SPACE;
882         }
883         if (nickName.IsEmpty() == false)
884         {
885                 suffixNickName += nickName;
886         }
887
888         String companyInfo;
889         if (jobTitle.IsEmpty() == false)
890         {
891                 companyInfo = jobTitle + CHARACTER_SPACE;
892         }
893         if (company.IsEmpty() == false)
894         {
895                 companyInfo += company + CHARACTER_SPACE;
896         }
897         if (department.IsEmpty() == false)
898         {
899                 companyInfo += department;
900         }
901
902         Label* pNameLabel = null;
903         Label* pFavoriteLabel = null;
904         if (name.IsEmpty() == false)
905         {
906                 pNameLabel = new (std::nothrow) Label();
907                 pNameLabel->Construct(Rectangle(X_MAIN_INFO, itemHeight, itemWidth - (X_MAIN_INFO + H_FAVORITE + W_FAVORITE_GAP * 2), H_NAME), name);
908                 pNameLabel->SetTextConfig(FONT_SIZE_NAME, LABEL_TEXT_STYLE_BOLD);
909                 pNameLabel->SetTextColor(COLOR_NAME);
910                 pNameLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
911                 pNameLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
912
913                 if (__appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == false)
914                 {
915                         pFavoriteLabel = new (std::nothrow) Label();
916                         pFavoriteLabel->Construct(Rectangle(itemWidth - (H_FAVORITE + W_FAVORITE_GAP * 2), itemHeight + Y_FAVORITE, H_FAVORITE, H_FAVORITE), L"");
917                         pFavoriteLabel->SetName(FAVORITE_LABEL);
918                         pFavoriteLabel->AddTouchEventListener(*this);
919
920                         Bitmap* pBitmap = null;
921                         if (__pPresentationModel->IsFavorite())
922                         {
923                                 pBitmap = ResourceManager::GetBitmapN(IDB_DETAILS_FAVORITE_ON);
924                         }
925                         else
926                         {
927                                 pBitmap = ResourceManager::GetBitmapN(IDB_DETAILS_FAVORITE_OFF);
928                         }
929
930                         if (pBitmap != null)
931                         {
932                                 pFavoriteLabel->SetBackgroundBitmap(*pBitmap);
933                                 delete pBitmap;
934                         }
935                 }
936
937                 itemHeight += H_NAME;
938         }
939
940         Label* pSuffixNickNameLabel = null;
941         if (suffixNickName.IsEmpty() == false)
942         {
943                 pSuffixNickNameLabel = new (std::nothrow) Label();
944                 pSuffixNickNameLabel->Construct(Rectangle(X_MAIN_INFO, itemHeight, itemWidth - X_MAIN_INFO, H_SUB_INFO), suffixNickName);
945                 pSuffixNickNameLabel->SetTextConfig(FONT_SIZE_SUB_INFO, LABEL_TEXT_STYLE_NORMAL);
946                 pSuffixNickNameLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
947                 pSuffixNickNameLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
948                 itemHeight += (H_SUB_INFO + H_SUB_INFO_DIVIDER);
949         }
950
951         Label* pCompanyInfoLabel = null;
952         if (companyInfo.IsEmpty() == false)
953         {
954                 pCompanyInfoLabel = new (std::nothrow) Label();
955                 pCompanyInfoLabel->Construct(Rectangle(X_MAIN_INFO, itemHeight, itemWidth - X_MAIN_INFO, H_SUB_INFO), companyInfo);
956                 pCompanyInfoLabel->SetTextConfig(FONT_SIZE_SUB_INFO, LABEL_TEXT_STYLE_NORMAL);
957                 pCompanyInfoLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
958                 pCompanyInfoLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
959                 itemHeight += (H_SUB_INFO + H_SUB_INFO_DIVIDER);
960         }
961
962         Label* pDefaultNumberLabel = null;
963         Button* pCallButton = null;
964         Button* pMessageButton = null;
965 #if __SUPPORT_VIDEO_CALL
966         Button* pVideoCallButton = null;
967 #endif
968
969         String defaultPhoneNumber = __pPresentationModel->GetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER);
970         if (defaultPhoneNumber.IsEmpty() == false)
971         {
972                 pDefaultNumberLabel = new (std::nothrow) Label();
973                 pDefaultNumberLabel->Construct(Rectangle(X_MAIN_INFO, itemHeight, itemWidth - X_MAIN_INFO, H_DEFAULT_NUMBER), defaultPhoneNumber);
974                 pDefaultNumberLabel->SetTextConfig(FONT_SIZE_MAIN_TEXT, LABEL_TEXT_STYLE_BOLD);
975                 pDefaultNumberLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
976                 pDefaultNumberLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
977                 itemHeight += (H_DEFAULT_NUMBER + H_QUICK_BUTTON_DIVIDER);
978
979                 Bitmap* pBgNormal = ResourceManager::GetBitmapN(IDB_CIRCLE_BUTTON_NORMAL);
980                 Bitmap* pBgPressed = ResourceManager::GetBitmapN(IDB_CIRCLE_BUTTON_PRESSED);
981                 Bitmap* pCallNormal = ResourceManager::GetBitmapN(IDB_CALL_NORMAL);
982                 Bitmap* pCallPressed = ResourceManager::GetBitmapN(IDB_CALL_PRESSED);
983                 Bitmap* pMessageNormal = ResourceManager::GetBitmapN(IDB_SMS_NORMAL);
984                 Bitmap* pMessagePressed = ResourceManager::GetBitmapN(IDB_SMS_PRESSED);
985                 Bitmap* pVideoCallNormal = ResourceManager::GetBitmapN(IDB_VIDEO_CALL_NORMAL);
986                 Bitmap* pVideoCallPressed = ResourceManager::GetBitmapN(IDB_VIDEO_CALL_PRESSED);
987
988                 pCallButton = new (std::nothrow) Button();
989                 pCallButton->Construct(Rectangle(X_QUICK_BUTTON, itemHeight, H_QUICK_BUTTON, H_QUICK_BUTTON));
990                 pCallButton->SetActionId(IDA_VOICE_CALL);
991                 pCallButton->AddActionEventListener(*this);
992                 if (pBgNormal != null)
993                 {
994                         pCallButton->SetNormalBackgroundBitmap(*pBgNormal);
995                 }
996                 if (pBgPressed != null)
997                 {
998                         pCallButton->SetPressedBackgroundBitmap(*pBgPressed);
999                 }
1000                 if (pCallNormal != null)
1001                 {
1002                         pCallButton->SetNormalBitmap(Point(0, 0), *pCallNormal);
1003                 }
1004                 if (pCallPressed != null)
1005                 {
1006                         pCallButton->SetPressedBitmap(Point(0, 0), *pCallPressed);
1007                 }
1008
1009                 pMessageButton = new (std::nothrow) Button();
1010                 pMessageButton->Construct(Rectangle((X_QUICK_BUTTON + H_QUICK_BUTTON + W_QUICK_BUTTON_GAP), itemHeight, H_QUICK_BUTTON, H_QUICK_BUTTON));
1011                 pMessageButton->SetActionId(IDA_MESSAGE);
1012                 pMessageButton->AddActionEventListener(*this);
1013                 if (pBgNormal != null)
1014                 {
1015                         pMessageButton->SetNormalBackgroundBitmap(*pBgNormal);
1016                 }
1017                 if (pBgPressed != null)
1018                 {
1019                         pMessageButton->SetPressedBackgroundBitmap(*pBgPressed);
1020                 }
1021                 if (pMessageNormal != null)
1022                 {
1023                         pMessageButton->SetNormalBitmap(Point(0, 0), *pMessageNormal);
1024                 }
1025                 if (pMessagePressed != null)
1026                 {
1027                         pMessageButton->SetPressedBitmap(Point(0, 0), *pMessagePressed);
1028                 }
1029 #if __SUPPORT_VIDEO_CALL
1030                 pVideoCallButton = new (std::nothrow) Button();
1031                 pVideoCallButton->Construct(Rectangle((X_QUICK_BUTTON + (H_QUICK_BUTTON * 2) + (W_QUICK_BUTTON_GAP * 2)), itemHeight, H_QUICK_BUTTON, H_QUICK_BUTTON));
1032                 pVideoCallButton->SetActionId(IDA_VIDEO_CALL);
1033                 pVideoCallButton->AddActionEventListener(*this);
1034                 if (pBgNormal != null)
1035                 {
1036                         pVideoCallButton->SetNormalBackgroundBitmap(*pBgNormal);
1037                 }
1038                 if (pBgPressed != null)
1039                 {
1040                         pVideoCallButton->SetPressedBackgroundBitmap(*pBgPressed);
1041                 }
1042                 if (pVideoCallNormal != null)
1043                 {
1044                         pVideoCallButton->SetNormalBitmap(Point(0, 0), *pVideoCallNormal);
1045                 }
1046                 if (pVideoCallPressed != null)
1047                 {
1048                         pVideoCallButton->SetPressedBitmap(Point(0, 0), *pVideoCallPressed);
1049                 }
1050 #endif
1051
1052                 delete pBgNormal;
1053                 delete pBgPressed;
1054                 delete pCallNormal;
1055                 delete pCallPressed;
1056                 delete pMessageNormal;
1057                 delete pMessagePressed;
1058                 delete pVideoCallNormal;
1059                 delete pVideoCallPressed;
1060
1061                 itemHeight += (H_QUICK_BUTTON + H_QUICK_BUTTON_DIVIDER);
1062         }
1063         else
1064         {
1065                 itemHeight += H_QUICK_BUTTON_DIVIDER;
1066         }
1067
1068         pItem->Construct(Dimension(itemWidth, itemHeight));
1069         pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1070         pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1071
1072         if (pThumbnailLabel != null)
1073         {
1074                 pItem->AddControl(pThumbnailLabel);
1075         }
1076         if (pNameLabel != null)
1077         {
1078                 pItem->AddControl(pNameLabel);
1079         }
1080         if (pFavoriteLabel != null)
1081         {
1082                 pItem->AddControl(pFavoriteLabel);
1083         }
1084         if (pSuffixNickNameLabel != null)
1085         {
1086                 pItem->AddControl(pSuffixNickNameLabel);
1087         }
1088         if (pCompanyInfoLabel != null)
1089         {
1090                 pItem->AddControl(pCompanyInfoLabel);
1091         }
1092         if (pDefaultNumberLabel != null)
1093         {
1094                 pItem->AddControl(pDefaultNumberLabel);
1095         }
1096 #if __SUPPORT_VIDEO_CALL
1097         if (pCallButton != null && pMessageButton != null && pVideoCallButton != null)
1098         {
1099                 pItem->AddControl(pCallButton);
1100                 pItem->AddControl(pMessageButton);
1101                 pItem->AddControl(pVideoCallButton);
1102         }
1103 #else
1104         if (pCallButton != null && pMessageButton != null)
1105         {
1106                 pItem->AddControl(pCallButton);
1107                 pItem->AddControl(pMessageButton);
1108         }
1109 #endif
1110 }
1111
1112 void
1113 ContactDetailsForm::AddProperty(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem, int detailProperty, int itemSubIndex)
1114 {
1115         String title;
1116         String value;
1117         String type;
1118         int lineCount = 1;
1119         int itemHeight = H_ITEM_DOUBLE_LINE;
1120         int valueCount = __pPresentationModel->GetMultiValuesCount(static_cast<DetailProperty>(detailProperty));
1121
1122         ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1123         if (detailProperty != DETAIL_PROPERTY_PHONE_NUMBER && valueCount > 1)
1124         {
1125                 pItem->Construct(Dimension(itemWidth, H_ITEM_DOUBLE_LINE + pContactsApp->GetFontHeightOffset() + ((H_ADDITIONAL_ITEM + pContactsApp->GetFontHeightOffset()) * (valueCount - 1))), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1126                 CreateTitleValueTypeItem(itemWidth, pItem, detailProperty);
1127
1128                 return;
1129         }
1130
1131         switch (detailProperty)
1132         {
1133         case DETAIL_PROPERTY_PHONE_NUMBER:
1134                 {
1135                         type = __pPresentationModel->GetType(DETAIL_PROPERTY_PHONE_NUMBER, itemSubIndex);
1136                         value = __pPresentationModel->GetValue(DETAIL_PROPERTY_PHONE_NUMBER, itemSubIndex);
1137
1138                         pItem->Construct(Dimension(itemWidth, H_ITEM + pContactsApp->GetFontHeightOffset()), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1139                         pItem->SetName(value);
1140
1141                         CreateValueTypeItem(itemWidth, pItem, value, type);
1142
1143                         return;
1144                 }
1145                 break;
1146         case DETAIL_PROPERTY_EMAIL:
1147                 {
1148                         title = ResourceManager::GetString(L"IDS_COM_BODY_EMAIL");
1149                         type = __pPresentationModel->GetType(static_cast<DetailProperty>(detailProperty), 0);
1150                         value = __pPresentationModel->GetValue(static_cast<DetailProperty>(detailProperty), 0);
1151                 }
1152                 break;
1153         case DETAIL_PROPERTY_ADDRESS:
1154                 {
1155                         title = ResourceManager::GetString(L"IDS_PB_BODY_ADDRESS");
1156                         type = __pPresentationModel->GetType(static_cast<DetailProperty>(detailProperty), 0);
1157                         value = __pPresentationModel->GetValue(static_cast<DetailProperty>(detailProperty), 0);
1158                 }
1159                 break;
1160         case DETAIL_PROPERTY_IM_ADDRESS:
1161                 {
1162                         title = ResourceManager::GetString(L"IDS_PB_HEADER_INSTANT_MESSENGER_ABB");
1163                         type = __pPresentationModel->GetType(static_cast<DetailProperty>(detailProperty), 0);
1164                         value = __pPresentationModel->GetValue(static_cast<DetailProperty>(detailProperty), 0);
1165                 }
1166                 break;
1167         case DETAIL_PROPERTY_URL:
1168                 {
1169                         title = ResourceManager::GetString(L"IDS_PB_BODY_URL");
1170                         type = __pPresentationModel->GetType(static_cast<DetailProperty>(detailProperty), 0);
1171                         value = __pPresentationModel->GetValue(static_cast<DetailProperty>(detailProperty), 0);
1172                 }
1173                 break;
1174         case DETAIL_PROPERTY_BIRTHDAY:
1175                 {
1176                         title = ResourceManager::GetString(L"IDS_PB_BODY_BIRTHDAY");
1177                         value = __pPresentationModel->GetValue(DETAIL_PROPERTY_BIRTHDAY);
1178                 }
1179                 break;
1180         case DETAIL_PROPERTY_NOTE:
1181                 {
1182                         pItem->Construct(Dimension(itemWidth, itemHeight + pContactsApp->GetFontHeightOffset()), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1183                         CreateNoteItem(itemWidth, pItem);
1184
1185                         return;
1186                 }
1187                 break;
1188         default:
1189                 break;
1190         }
1191
1192         pItem->Construct(Dimension(itemWidth, itemHeight + pContactsApp->GetFontHeightOffset()), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1193         CreateTitleValueTypeItem(itemWidth, pItem, title, value, type, lineCount);
1194 }
1195
1196 void
1197 ContactDetailsForm::AddGroup(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem)
1198 {
1199         ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1200
1201         pItem->Construct(Dimension(itemWidth, H_ITEM_DOUBLE_LINE + pContactsApp->GetFontHeightOffset()), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1202         pItem->SetName(Integer::ToString(DETAIL_PROPERTY_GROUP));
1203
1204         String title = ResourceManager::GetString(L"IDS_PB_BODY_GROUPS");
1205         String value =  __pPresentationModel->GetValue(DETAIL_PROPERTY_GROUP);
1206
1207         if (value.IsEmpty())
1208         {
1209                 value = ResourceManager::GetString(L"IDS_PB_BODY_NOT_ASSIGNED");
1210         }
1211
1212         AddGroupStylePanel(itemWidth, pItem, GROUP_STYLE_TOP);
1213
1214         CreateTitleValueTypeItem(itemWidth, pItem, title, value);
1215 }
1216
1217 void
1218 ContactDetailsForm::AddRingTone(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem)
1219 {
1220         ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1221
1222         pItem->Construct(Dimension(itemWidth, H_ITEM_DOUBLE_LINE + pContactsApp->GetFontHeightOffset()), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1223         pItem->SetName(Integer::ToString(DETAIL_PROPERTY_RINGTONE));
1224
1225         String title = ResourceManager::GetString(L"IDS_PB_BODY_RINGTONE");
1226         String value = __pPresentationModel->GetValue(DETAIL_PROPERTY_RINGTONE);
1227
1228         int index = 0;
1229         String trimmedPath;
1230         value.LastIndexOf(L"/", value.GetLength() - 1, index);
1231
1232         if (index != 0)
1233         {
1234                 value.SubString(index + 1, trimmedPath);
1235         }
1236
1237         AddGroupStylePanel(itemWidth, pItem, GROUP_STYLE_BOTTOM);
1238
1239         CreateTitleValueTypeItem(itemWidth, pItem, title, trimmedPath);
1240
1241         if (__appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == false)
1242         {
1243                 Button* pClearButton = new (std::nothrow) Button();
1244                 pClearButton->Construct(Rectangle(itemWidth - H_ICON - W_TEXT_MARGIN, (H_ITEM_DOUBLE_LINE + pContactsApp->GetFontHeightOffset()  - H_ICON) / 2, H_ICON, H_ICON));
1245                 pClearButton->SetActionId(IDA_BUTTON_RINGTONE_CLEAR);
1246                 pClearButton->AddActionEventListener(*this);
1247
1248                 Bitmap* pReset = ResourceManager::GetBitmapN(IDB_DETAILS_RESET_NORMAL);
1249                 if (pReset != null)
1250                 {
1251                         pClearButton->SetNormalBitmap(Point(0, 0), *pReset);
1252                         delete pReset;
1253                 }
1254                 pReset = ResourceManager::GetBitmapN(IDB_DETAILS_RESET_PRESSED);
1255                 if (pReset != null)
1256                 {
1257                         pClearButton->SetPressedBitmap(Point(0, 0), *pReset);
1258                         delete pReset;
1259                 }
1260
1261                 pItem->AddControl(pClearButton);
1262                 pItem->SetIndividualSelectionEnabled(pClearButton, true);
1263         }
1264 }
1265
1266 void
1267 ContactDetailsForm::AddShareButtons(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem)
1268 {
1269         pItem->Construct(Dimension(itemWidth, H_BUTTON_CONTAINER));
1270
1271         int buttonWidth = itemWidth - W_BUTTON_GAP * 2;
1272
1273         Button* pSendNameButton = new (std::nothrow) Button();
1274         pSendNameButton->Construct(Rectangle(W_BUTTON_GAP, Y_BUTTON, buttonWidth, H_BUTTON), ResourceManager::GetString(L"IDS_PB_HEADER_SEND_NAMECARD"));
1275         pSendNameButton->SetActionId(IDA_BUTTON_SHARE_NAME_CARD);
1276         pSendNameButton->AddActionEventListener(*this);
1277         pItem->AddControl(pSendNameButton);
1278 }
1279
1280 void
1281 ContactDetailsForm::CreateValueTypeItem(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem, const Tizen::Base::String& value, const Tizen::Base::String& type)
1282 {
1283         ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1284         pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1285         pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1286
1287         Label* pValueLabel = new (std::nothrow) Label();
1288         pValueLabel->Construct(Rectangle(W_TEXT_MARGIN, 0, itemWidth - W_TEXT_MARGIN * 2 - W_TYPE, H_ITEM + pContactsApp->GetFontHeightOffset()), value);
1289         pValueLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1290         pValueLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1291         pValueLabel->SetTextConfig(pContactsApp->GetFontSize(), LABEL_TEXT_STYLE_NORMAL);
1292         pValueLabel->SetTextColor(COLOR_OTHER_NUMBER);
1293         pItem->AddControl(pValueLabel);
1294
1295         Label* pTypeLabel = new (std::nothrow) Label();
1296         pTypeLabel->Construct(Rectangle((itemWidth - W_TEXT_MARGIN - W_TYPE), 0, W_TYPE, H_ITEM + pContactsApp->GetFontHeightOffset()), type);
1297         pTypeLabel->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
1298         pTypeLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1299         pTypeLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1300         pTypeLabel->SetTextColor(COLOR_ITEM_TYPE);
1301         pItem->AddControl(pTypeLabel);
1302 }
1303
1304 void
1305 ContactDetailsForm::CreateTitleValueTypeItem(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem, const Tizen::Base::String& title, const Tizen::Base::String& value, const Tizen::Base::String& type, int lineCount)
1306 {
1307         int valueWidth = itemWidth - (W_TEXT_MARGIN * 2);
1308
1309         ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1310
1311         pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1312         pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1313
1314         Label* pTitleLabel = new (std::nothrow) Label();
1315         pTitleLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE, itemWidth - W_TEXT_MARGIN, H_ITEM_TITLE), title);
1316         pTitleLabel->SetName(GROUP_LABEL);
1317         pTitleLabel->AddTouchEventListener(*this);
1318         pTitleLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1319         pTitleLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1320         pTitleLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1321         pTitleLabel->SetTextColor(COLOR_ITEM_TITLE);
1322         pItem->AddControl(pTitleLabel);
1323
1324         if (type.IsEmpty() == false)
1325         {
1326                 Label* pTypeLabel = new (std::nothrow) Label();
1327                 pTypeLabel->Construct(Rectangle((itemWidth - W_TEXT_MARGIN - W_TYPE), Y_ITEM_TITLE + H_ITEM_TITLE, W_TYPE, H_ITEM_VALUE), type);
1328                 pTypeLabel->SetName(GROUP_LABEL);
1329                 pTypeLabel->AddTouchEventListener(*this);
1330                 pTypeLabel->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
1331                 pTypeLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1332                 pTypeLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1333                 pTypeLabel->SetTextColor(COLOR_ITEM_TYPE);
1334                 pItem->AddControl(pTypeLabel);
1335
1336                 valueWidth = itemWidth - (W_TEXT_MARGIN * 2) - W_TYPE;
1337         }
1338         else if (title.Equals(ResourceManager::GetString(L"IDS_PB_BODY_RINGTONE"), false))
1339         {
1340                 valueWidth = itemWidth - (W_TEXT_MARGIN * 2) - H_ICON;
1341         }
1342
1343         Label* pValueLabel = new (std::nothrow) Label();
1344         pValueLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE + H_ITEM_TITLE, valueWidth, (H_ITEM_VALUE + pContactsApp->GetFontHeightOffset()) * lineCount), value);
1345         pValueLabel->SetName(GROUP_LABEL);
1346         pValueLabel->AddTouchEventListener(*this);
1347         pValueLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1348         pValueLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1349         pValueLabel->SetTextConfig(pContactsApp->GetFontSize(), LABEL_TEXT_STYLE_NORMAL);
1350         pValueLabel->SetTextColor(COLOR_ITEM_VALUE);
1351         pItem->AddControl(pValueLabel);
1352 }
1353
1354 void
1355 ContactDetailsForm::CreateTitleValueTypeItem(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem, int detailProperty)
1356 {
1357         String title;
1358         ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1359
1360         pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1361         pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1362
1363         switch (detailProperty)
1364         {
1365         case DETAIL_PROPERTY_EMAIL:
1366                 {
1367                         title = ResourceManager::GetString(L"IDS_COM_BODY_EMAIL");
1368                 }
1369                 break;
1370         case DETAIL_PROPERTY_ADDRESS:
1371                 {
1372                         title = ResourceManager::GetString(L"IDS_PB_BODY_ADDRESS");
1373                 }
1374                 break;
1375         case DETAIL_PROPERTY_URL:
1376                 {
1377                         title = ResourceManager::GetString(L"IDS_PB_BODY_URL");
1378                 }
1379                 break;
1380         case DETAIL_PROPERTY_IM_ADDRESS:
1381                 {
1382                         title = ResourceManager::GetString(L"IDS_PB_HEADER_INSTANT_MESSENGER_ABB");
1383                 }
1384                 break;
1385         default:
1386                 break;
1387         }
1388
1389         Label* pTitleLabel = new (std::nothrow) Label();
1390         pTitleLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE, itemWidth - W_TEXT_MARGIN, H_ITEM_TITLE), title);
1391         pTitleLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1392         pTitleLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1393         pTitleLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1394         pTitleLabel->SetTextColor(COLOR_ITEM_TITLE);
1395         pItem->AddControl(pTitleLabel);
1396
1397         for (int i = 0; i < __pPresentationModel->GetMultiValuesCount(static_cast<DetailProperty>(detailProperty)); i++)
1398         {
1399                 String type = __pPresentationModel->GetType(static_cast<DetailProperty>(detailProperty), i);
1400                 String value = __pPresentationModel->GetValue(static_cast<DetailProperty>(detailProperty), i);
1401
1402                 int valueWidth = itemWidth - (W_TEXT_MARGIN * 2);
1403                 if (type.IsEmpty() == false)
1404                 {
1405                         Label* pTypeLabel = new (std::nothrow) Label();
1406                         pTypeLabel->Construct(Rectangle((itemWidth - W_TEXT_MARGIN - W_TYPE), (H_ADDITIONAL_ITEM + pContactsApp->GetFontHeightOffset())/2 + H_ITEM_TITLE + ((H_ADDITIONAL_ITEM + pContactsApp->GetFontHeightOffset()) * i), W_TYPE, H_ITEM_VALUE), type);
1407                         pTypeLabel->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
1408                         pTypeLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1409                         pTypeLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1410                         pTypeLabel->SetTextColor(COLOR_ITEM_TYPE);
1411                         pItem->AddControl(pTypeLabel);
1412
1413                         valueWidth = itemWidth - (W_TEXT_MARGIN * 2) - W_TYPE;
1414                 }
1415
1416                 Label* pValueLabel = new (std::nothrow) Label();
1417                 pValueLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE + H_ITEM_TITLE + ((H_ADDITIONAL_ITEM + pContactsApp->GetFontHeightOffset()) * i), valueWidth, H_ITEM_VALUE + pContactsApp->GetFontHeightOffset()), value);
1418                 pValueLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1419                 pValueLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1420                 pValueLabel->SetTextConfig(pContactsApp->GetFontSize(), LABEL_TEXT_STYLE_NORMAL);
1421                 pValueLabel->SetTextColor(COLOR_ITEM_VALUE);
1422                 pItem->AddControl(pValueLabel);
1423         }
1424 }
1425
1426 void
1427 ContactDetailsForm::CreateNoteItem(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem)
1428 {
1429         ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1430
1431         pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1432         pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1433
1434         String title = ResourceManager::GetString(L"IDS_PB_BODY_NOTE");
1435         String value = __pPresentationModel->GetValue(DETAIL_PROPERTY_NOTE);
1436
1437         Label* pTitleLabel = new (std::nothrow) Label();
1438         pTitleLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE, itemWidth - W_TEXT_MARGIN, H_ITEM_TITLE), title);
1439         pTitleLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1440         pTitleLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1441         pTitleLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1442         pTitleLabel->SetTextColor(COLOR_ITEM_TITLE);
1443         pItem->AddControl(pTitleLabel);
1444
1445         Label* pValueLabel = new (std::nothrow) Label();
1446         pValueLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE + H_ITEM_TITLE, itemWidth - (W_TEXT_MARGIN * 2), H_ITEM_VALUE), value);
1447         pValueLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1448         pValueLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
1449         pValueLabel->SetTextConfig(pContactsApp->GetFontSize(), LABEL_TEXT_STYLE_NORMAL);
1450         pValueLabel->SetTextColor(COLOR_ITEM_VALUE);
1451         pItem->AddControl(pValueLabel);
1452
1453         Font font;
1454         font.Construct(FONT_STYLE_PLAIN, pContactsApp->GetFontSize());
1455
1456         TextElement* pNameElement = new (std::nothrow) TextElement();
1457         pNameElement->Construct(value);
1458         pNameElement->SetFont(font);
1459
1460         EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1461         pEnrichedText->Construct(Dimension(itemWidth - (W_TEXT_MARGIN * 2) - (pValueLabel->GetLeftMargin() * 2), H_ITEM_VALUE));
1462         pEnrichedText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
1463         pEnrichedText->SetTextAbbreviationEnabled(false);
1464         pEnrichedText->Add(*pNameElement);
1465
1466         pValueLabel->SetSize(pValueLabel->GetWidth(), pEnrichedText->GetTotalLineHeight() + pValueLabel->GetTopMargin());
1467         pItem->SetSize(itemWidth, (Y_ITEM_TITLE * 2) + H_ITEM_TITLE + pEnrichedText->GetTotalLineHeight());
1468
1469         pEnrichedText->RemoveAllTextElements(true);
1470         delete pEnrichedText;
1471 }
1472
1473 void
1474 ContactDetailsForm::OnTableViewItemStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1475 {
1476         SceneManager* pSceneManager = SceneManager::GetInstance();
1477
1478         if (status == TABLE_VIEW_ITEM_STATUS_SELECTED)
1479         {
1480                 String itemName = pItem->GetName();
1481
1482                 if (itemName.Equals(Integer::ToString(DETAIL_PROPERTY_GROUP), true) == true)
1483                 {
1484                         if (__appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == true)
1485                         {
1486                                 return;
1487                         }
1488
1489                         if (__pPresentationModel->GetCategoryCount() > 0)
1490                         {
1491                                 IList* pCategoryList = __pPresentationModel->GetAssignedCategoryIdListN();
1492
1493                                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_SELECTOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pCategoryList);
1494                         }
1495                         else
1496                         {
1497                                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
1498                         }
1499                 }
1500                 else if (itemName.Equals(Integer::ToString(DETAIL_PROPERTY_RINGTONE), true) == true)
1501                 {
1502                         if (__appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == true)
1503                         {
1504                                 return;
1505                         }
1506
1507                         result r = LaunchAppControl(PROVIDER_ID_FILEMANAGER, OPERATION_ID_PICK);
1508                         TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
1509                 }
1510                 else if (itemName.IsEmpty() == false)
1511                 {
1512                         if (__isAppControlLaunching == true)
1513                         {
1514                                 return;
1515                         }
1516                         Point itemPoint;
1517                         itemPoint.x = GetClientAreaBounds().width / 2;
1518                         itemPoint.y = GetClientAreaBounds().y + pItem->GetY() + (pItem->GetHeight() / 2) - __scrolledDistance;
1519
1520                         __pContextMenuCall->SetName(itemName);
1521                         __pContextMenuCall->SetAnchorPosition(itemPoint);
1522                         __pContextMenuCall->SetShowState(true);
1523                         __pContextMenuCall->Show();
1524                 }
1525         }
1526 }
1527
1528 void
1529 ContactDetailsForm::OnTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated)
1530 {
1531 }
1532
1533 void
1534 ContactDetailsForm::OnTableViewItemReordered(Tizen::Ui::Controls::TableView& tableView, int itemIndexFrom, int itemIndexTo)
1535 {
1536 }
1537
1538 void
1539 ContactDetailsForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo & touchInfo)
1540 {
1541         if (source.GetName().Equals(GROUP_STYLE_PANEL, true))
1542         {
1543                 Panel* pPanel = static_cast<Panel*>(&const_cast<Control&>(source));
1544                 pPanel->SetBackgroundColor(COLOR_PRESSED);
1545         }
1546         else if (source.GetName().Equals(GROUP_LABEL, true))
1547         {
1548                 Panel* pPanel = static_cast<Panel*>(source.GetParent()->GetControl(GROUP_STYLE_PANEL));
1549                 if (pPanel != null)
1550                 {
1551                         pPanel->SetBackgroundColor(COLOR_PRESSED);
1552                 }
1553         }
1554 }
1555
1556 void
1557 ContactDetailsForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1558 {
1559         if (source.GetName().Equals(GROUP_STYLE_PANEL, true))
1560         {
1561                 Panel* pPanel = static_cast<Panel*>(&const_cast<Control&>(source));
1562                 pPanel->SetBackgroundColor(COLOR_GROUP_STYLE);
1563         }
1564         else if (source.GetName().Equals(GROUP_LABEL, true))
1565         {
1566                 Panel* pPanel = static_cast<Panel*>(source.GetParent()->GetControl(GROUP_STYLE_PANEL));
1567                 if (pPanel != null)
1568                 {
1569                         pPanel->SetBackgroundColor(COLOR_GROUP_STYLE);
1570                 }
1571         }
1572         else if (source.GetName().Equals(FAVORITE_LABEL, true))
1573         {
1574                 Label* pLabel = static_cast<Label*>(&const_cast<Control&>(source));
1575                 if (pLabel == null)
1576                 {
1577                         return;
1578                 }
1579
1580                 __pPresentationModel->SetAsFavorite(!__pPresentationModel->IsFavorite());
1581
1582                 Bitmap* pBitmap = null;
1583                 if (__pPresentationModel->IsFavorite())
1584                 {
1585                         pBitmap = ResourceManager::GetBitmapN(IDB_DETAILS_FAVORITE_ON);
1586                 }
1587                 else
1588                 {
1589                         pBitmap = ResourceManager::GetBitmapN(IDB_DETAILS_FAVORITE_OFF);
1590                 }
1591
1592                 if (pBitmap != null)
1593                 {
1594                         pLabel->SetBackgroundBitmap(*pBitmap);
1595                         delete pBitmap;
1596                 }
1597                 pLabel->Invalidate(false);
1598         }
1599 }
1600
1601 void
1602 ContactDetailsForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1603 {
1604 }
1605
1606 void
1607 ContactDetailsForm::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1608 {
1609 }
1610
1611 void
1612 ContactDetailsForm::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1613 {
1614 }
1615
1616 void
1617 ContactDetailsForm::OnTouchCanceled(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1618 {
1619 }
1620
1621 void
1622 ContactDetailsForm::OnFileEventOccured(const unsigned long events, const Tizen::Base::String &path, const unsigned int eventId)
1623 {
1624         AppLogDebug("Kamesh: OnFileEventOccured");
1625         AppLogDebug("Kamesh: path = %ls", path.GetPointer());
1626         String ringtonePath = __pPresentationModel->GetValue(DETAIL_PROPERTY_RINGTONE);
1627         AppLogDebug("Kamesh: ringtonePath = %ls", ringtonePath.GetPointer());
1628         if (ringtonePath.Equals(ResourceManager::GetString(L"IDS_PB_BODY_DEFAULT"), false) == true )
1629         {
1630                 __pTableView->RefreshItem(__pItemList->GetCount() - 1, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1631         }
1632 }
1633
1634 void
1635 ContactDetailsForm::OnScrollEndReached (Tizen::Ui::Control &source, Tizen::Ui::Controls::ScrollEndEvent type)
1636 {
1637 }
1638
1639 void
1640 ContactDetailsForm::OnScrollPositionChanged (Tizen::Ui::Control &source, int scrollPos)
1641 {
1642         __scrolledDistance = scrollPos;
1643 }
1644
1645 void
1646 ContactDetailsForm::OnScrollStopped (Tizen::Ui::Control &source)
1647 {
1648 }
1649
1650 void
1651 ContactDetailsForm::OnContactsChanged(void)
1652 {
1653         if (__pPresentationModel->IsContactRemoved())
1654         {
1655                 if (__appControlViewType.IsEmpty() == true)
1656                 {
1657                         SceneManager* pSceneManager = SceneManager::GetInstance();
1658
1659                         result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
1660                         TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go backward", GetErrorMessage(r));
1661                 }
1662                 else
1663                 {
1664                         UiApp::GetInstance()->Terminate();
1665                 }
1666         }
1667         else
1668         {
1669                 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1670                 TryReturnVoid(pContactsApp != null, "Unable to get ContactsApp instance.");
1671
1672                 if (pContactsApp->GetAppUiState() == APP_UI_STATE_BACKGROUND)
1673                 {
1674                         InitializeDetailItemList();
1675                         __pTableView->UpdateTableView();
1676                 }
1677         }
1678
1679         delete __pDefaultSelectorPopup;
1680         __pDefaultSelectorPopup = null;
1681 }
1682
1683 void
1684 ContactDetailsForm::OnCategoriesChanged(void)
1685 {
1686 }
1687
1688 result
1689 ContactDetailsForm::LaunchAppControl(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, const Tizen::Base::String& launchType, const Tizen::Base::String& value)
1690 {
1691         result r = E_SUCCESS;
1692
1693         if (__pAppControl != null)
1694         {
1695                 return E_FAILURE;
1696         }
1697
1698         String uri;
1699         String mimeType;
1700         HashMap extraData;
1701         extraData.Construct();
1702         IAppControlResponseListener* pEvent = null;
1703
1704         if (appId.Equals(String(PROVIDER_ID_PHONE)) && operationId.Equals(String(OPERATION_ID_CALL)))
1705         {
1706                 uri.Append(INPUT_URI_TEL);
1707
1708                 if (value.IsEmpty())
1709                 {
1710                         uri.Append(__pPresentationModel->GetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER));
1711                 }
1712                 else
1713                 {
1714                         uri.Append(value);
1715                 }
1716
1717                 extraData.Add(new (std::nothrow) String(INPUT_KEY_CALL_TYPE), new (std::nothrow) String(launchType));
1718         }
1719         else if (appId.Equals(String(PROVIDER_ID_MESSAGE)) && operationId.Equals(String(OPERATION_ID_COMPOSE)))
1720         {
1721                 String recipientAddress;
1722
1723                 if (value.IsEmpty())
1724                 {
1725                         recipientAddress.Append(__pPresentationModel->GetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER));
1726                 }
1727                 else
1728                 {
1729                         recipientAddress.Append(value);
1730                 }
1731                 extraData.Add(new (std::nothrow) String(INPUT_KEY_MESSAGE_TO), new (std::nothrow) String(recipientAddress));
1732                 extraData.Add(new (std::nothrow) String(INPUT_KEY_MESSAGE_TYPE), new (std::nothrow) String(INPUT_TYPE_SMS));
1733         }
1734         else if (appId.Equals(String(PROVIDER_ID_FILEMANAGER)) && operationId.Equals(String(OPERATION_ID_PICK)))
1735         {
1736                 mimeType.Append(INPUT_MIME_TYPE_AUDIO);
1737                 extraData.Add(new (std::nothrow) String(INPUT_KEY_SELECTION_MODE), new (std::nothrow) String(INPUT_DATA_SELECTION_MODE_SINGLE));
1738
1739                 pEvent = this;
1740         }
1741         else if (appId.Equals(String(PROVIDER_ID_EMAIL)) && operationId.Equals(String(OPERATION_ID_COMPOSE)))
1742         {
1743                 ArrayList* pArgList = new (std::nothrow) ArrayList();
1744                 pArgList->Construct();
1745
1746                 pArgList->Add(new (std::nothrow) String(__pPresentationModel->GetValue(DETAIL_PROPERTY_EMAIL, 0)));
1747                 extraData.Add(new (std::nothrow) String(INPUT_KEY_MESSAGE_TO), pArgList);
1748         }
1749
1750         __pAppControl = AppManager::FindAppControlN(appId, operationId);
1751
1752         if (__pAppControl != null)
1753         {
1754                 r = __pAppControl->Start(&uri, &mimeType, &extraData, pEvent);
1755                 TryCatch(r == E_SUCCESS, , "[%s] Unable to launch app control", GetErrorMessage(r));
1756
1757                 __isAppControlLaunching = true;
1758
1759                 if (operationId.Equals(String(OPERATION_ID_PICK)))
1760                 {
1761                         SetEnabled(false);
1762                         Invalidate(true);
1763                 }
1764
1765                 Footer* pFooter = GetFooter();
1766                 pFooter->SetEnabled(false);
1767         }
1768
1769 CATCH:
1770         extraData.RemoveAll(true);
1771         return r;
1772 }
1773
1774 void
1775 ContactDetailsForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData)
1776 {
1777         AppLogDebug("ENTER");
1778
1779         SetEnabled(true);
1780         Invalidate(true);
1781
1782         if (pExtraData == null)
1783         {
1784                 return;
1785         }
1786
1787         if (appId.Equals(String(PROVIDER_ID_FILEMANAGER)) && operationId.Equals(String(OPERATION_ID_PICK)))
1788         {
1789                 if (appControlResult == APP_CTRL_RESULT_SUCCEEDED)
1790                 {
1791                         const String *pResultString = null;
1792                         const ArrayList* pResultList = dynamic_cast<const ArrayList*>(pExtraData->GetValue(String(OUTPUT_KEY_SELECTED)));
1793                         if (pResultList != null)
1794                         {
1795                                 pResultString = static_cast<const String*>(pResultList->GetAt(0));
1796                         }
1797                         else
1798                         {
1799                                 pResultString = static_cast<const String*>(pExtraData->GetValue(String(OUTPUT_KEY_SELECTED)));
1800                         }
1801
1802                         if (pResultString != null && pResultString->IsEmpty() == false)
1803                         {
1804                                 __pPresentationModel->SetValue(DETAIL_PROPERTY_RINGTONE, *pResultString);
1805                                 __pPresentationModel->UpdateContact();
1806                                 __pTableView->RefreshItem(__pItemList->GetCount() - 1, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1807
1808                                 if (__pFileEventManager == null)
1809                                 {
1810                                         __pFileEventManager = new (std::nothrow) FileEventManager();
1811                                         __pFileEventManager->Construct(*this);
1812                                 }
1813                                 __pFileEventManager->AddPath(*pResultString, FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_DELETE_SELF | FILE_EVENT_TYPE_MODIFY | FILE_EVENT_TYPE_MOVE_SELF);
1814
1815                         }
1816                 }
1817         }
1818
1819         AppLogDebug("EXIT");
1820 }
1821
1822 void
1823 ContactDetailsForm::AddGroupStylePanel(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::GroupStyle groupStyle)
1824 {
1825         ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1826
1827         Panel* pGroupStyle = new (std::nothrow) Panel();
1828         pGroupStyle->Construct(Rectangle(W_GROUP_STYLE_MARGIN, 0, itemWidth - W_GROUP_STYLE_MARGIN * 2, H_ITEM_DOUBLE_LINE + pContactsApp->GetFontHeightOffset()), groupStyle);
1829         pGroupStyle->SetName(GROUP_STYLE_PANEL);
1830         pGroupStyle->SetBackgroundColor(COLOR_GROUP_STYLE);
1831         pGroupStyle->AddTouchEventListener(*this);
1832         pItem->AddControl(pGroupStyle);
1833 }
1834
1835 result
1836 ContactDetailsForm::ParseAppControlArgument(const Tizen::Base::String& argument, Tizen::Base::String& type, Tizen::Base::String& content)
1837 {
1838         result r = E_SUCCESS;
1839
1840         if (argument.IsEmpty() || argument.Contains(DELIMITER) == false)
1841         {
1842                 return E_FAILURE;
1843         }
1844
1845         StringTokenizer stringToken(argument, DELIMITER);
1846
1847         r = stringToken.GetNextToken(type);
1848         TryReturn(r == E_SUCCESS, r, "[%s] Unable to get type", GetErrorMessage(r));
1849
1850         r = stringToken.GetNextToken(content);
1851         TryReturn(r == E_SUCCESS, r, "[%s] Unable to get content", GetErrorMessage(r));
1852
1853         return r;
1854 }
1855
1856 void
1857 ContactDetailsForm::ShowDefaultSelectorPopup(void)
1858 {
1859         ArrayList* pList = new (std::nothrow) ArrayList();
1860         pList->Construct();
1861
1862         String numberWithType;
1863         int numberCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER);
1864         for (int index = 0; index < numberCount; index++)
1865         {
1866                 numberWithType = __pPresentationModel->GetType(DETAIL_PROPERTY_PHONE_NUMBER, index) + L"  ";
1867                 numberWithType += __pPresentationModel->GetValue(DETAIL_PROPERTY_PHONE_NUMBER, index);
1868
1869                 pList->Add(*(new (std::nothrow) String(numberWithType)));
1870         }
1871         ContactValueListItemProvider* pProvider = new (std::nothrow) ContactValueListItemProvider(pList);
1872
1873         delete __pDefaultSelectorPopup;
1874         __pDefaultSelectorPopup = new (std::nothrow) Popup();
1875         __pDefaultSelectorPopup->Construct(true, Dimension(W_POPUP, H_POPUP));
1876         __pDefaultSelectorPopup->SetTitleText(ResourceManager::GetString(L"IDS_PB_BODY_MARK_AS_DEFAULT_NUMBER"));
1877         __pDefaultSelectorPopup->SetPropagatedKeyEventListener(this);
1878
1879         Rectangle popupClientBounds = __pDefaultSelectorPopup->GetClientAreaBounds();
1880
1881         ListView* pOtherNumberList = new (std::nothrow) ListView();
1882         pOtherNumberList->Construct(Rectangle(0, 0, popupClientBounds.width, H_POPUP_LIST_VIEW));
1883         pOtherNumberList->AddListViewItemEventListener(*this);
1884         pOtherNumberList->SetItemProvider(*pProvider);
1885
1886         __pDefaultSelectorPopup->AddControl(pOtherNumberList);
1887
1888         Button* pCloseButton = new (std::nothrow) Button();
1889         pCloseButton->Construct(Rectangle((popupClientBounds.width - W_POPUP_BUTTON) / 2, Y_POPUP_BUTTON,
1890                                                                         W_POPUP_BUTTON, H_POPUP_BUTTON), ResourceManager::GetString(L"IDS_COM_POP_CLOSE"));
1891         pCloseButton->SetActionId(IDA_POPUP_CLOSE);
1892         pCloseButton->AddActionEventListener(*this);
1893
1894         __pDefaultSelectorPopup->AddControl(pCloseButton);
1895         __pDefaultSelectorPopup->SetShowState(true);
1896         __pDefaultSelectorPopup->Show();
1897 }
1898
1899 void
1900 ContactDetailsForm::HideDefaultSelectorPopup(void)
1901 {
1902         __pDefaultSelectorPopup->SetShowState(false);
1903
1904         Invalidate(true);
1905 }
1906
1907 void
1908 ContactDetailsForm::ShowInvalidFilePopup(bool isInvalidFormat)
1909 {
1910         if (__pInvalidFilePopup != null)
1911         {
1912                 delete __pInvalidFilePopup;
1913         }
1914
1915         __pInvalidFilePopup = new (std::nothrow) Popup();
1916         __pInvalidFilePopup->Construct(false, Dimension(W_POPUP, H_INVALID_FILE_POPUP));
1917         __pInvalidFilePopup->SetPropagatedKeyEventListener(this);
1918
1919         Rectangle clientBounds = __pInvalidFilePopup->GetClientAreaBounds();
1920
1921         Label* pLabelText = new (std::nothrow) Label();
1922         if(isInvalidFormat == true)
1923         {
1924                 pLabelText->Construct(Rectangle(0, Y_POPUP_TEXT_LABEL, clientBounds.width, H_POPUP_TEXT_LABEL), ResourceManager::GetString(L"IDS_RSSR_BODY_INVALID_FORMAT"));
1925         }
1926         else
1927         {
1928                 pLabelText->Construct(Rectangle(0, Y_POPUP_TEXT_LABEL, clientBounds.width, H_POPUP_TEXT_LABEL), ResourceManager::GetString(L"IDS_MP_POP_INVALID_FILE"));
1929         }
1930
1931         pLabelText->SetTextColor(COLOR_POPUP_TEXT);
1932         pLabelText->SetTextConfig(FONT_SIZE_POPUP_TEXT, LABEL_TEXT_STYLE_BOLD);
1933         pLabelText->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
1934
1935         __pInvalidFilePopup->AddControl(pLabelText);
1936
1937         Button* pButtonClose = new (std::nothrow) Button();
1938         pButtonClose->Construct(Rectangle((clientBounds.width - W_POPUP_BUTTON) / 2, pLabelText->GetY() + pLabelText->GetHeight(), W_POPUP_BUTTON, H_POPUP_BUTTON));
1939         pButtonClose->SetText(ResourceManager::GetString("IDS_COM_SK_OK"));
1940         pButtonClose->SetActionId(IDA_INVALID_FILE_POPUP_CLOSE);
1941         pButtonClose->AddActionEventListener(*this);
1942
1943         __pInvalidFilePopup->AddControl(pButtonClose);
1944
1945         __pInvalidFilePopup->Show();
1946 }
1947
1948 void
1949 ContactDetailsForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
1950 {
1951         __pPresentationModel->SetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER, L"", index);
1952         __pPresentationModel->AddAddressBook();
1953         InitializeDetailItemList();
1954         __pTableView->UpdateTableView();
1955
1956         HideDefaultSelectorPopup();
1957 }
1958
1959 void
1960 ContactDetailsForm::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
1961 {
1962 }
1963
1964 void
1965 ContactDetailsForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
1966 {
1967 }
1968
1969 void
1970 ContactDetailsForm::OnForeground(void)
1971 {
1972         if (IsEnabled() == false)
1973         {
1974                 SetEnabled(true);
1975                 Invalidate(true);
1976         }
1977
1978         Footer* pFooter = GetFooter();
1979         pFooter->SetEnabled(true);
1980
1981         delete __pAppControl;
1982         __pAppControl = null;
1983
1984         __isAppControlLaunching = false;
1985 }
1986
1987 void
1988 ContactDetailsForm::OnBackground(void)
1989 {
1990 }
1991
1992 bool
1993 ContactDetailsForm::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
1994 {
1995         return false;
1996 }
1997
1998 bool
1999 ContactDetailsForm::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
2000 {
2001         if (keyEventInfo.GetKeyCode() == KEY_BACK)
2002         {
2003                 if (__pDefaultSelectorPopup && __pDefaultSelectorPopup->GetShowState() == true)
2004                 {
2005                         HideDefaultSelectorPopup();
2006                         return true;
2007                 }
2008                 else if (__pInvalidFilePopup && __pInvalidFilePopup->GetShowState() == true)
2009                 {
2010                         __pInvalidFilePopup->SetShowState(false);
2011
2012                         ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
2013
2014                         result r = AppControlProviderManager::GetInstance()->SendAppControlResult(pContactsApp->GetRequestId(), APP_CTRL_RESULT_FAILED, null);
2015                         AppLogDebug("[%s] The return result from SendAppControlResult().", GetErrorMessage(r));
2016
2017                         UiApp::GetInstance()->Terminate();
2018                         return true;
2019                 }
2020         }
2021         return false;
2022 }
2023
2024 bool
2025 ContactDetailsForm::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
2026 {
2027         return false;
2028 }
2029
2030 bool
2031 ContactDetailsForm::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
2032 {
2033         return false;
2034 }