2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://floralicense.org/license/
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.
18 * @file CtContactDetailsForm.cpp
19 * @brief This is the implementation file for the ContactDetailsForm class.
26 #include "CtContactDetailsForm.h"
27 #include "CtContactPresentationModel.h"
28 #include "CtContactValueListItemProvider.h"
29 #include "CtContactsApp.h"
30 #include "CtResourceManager.h"
31 #include "CtSceneRegister.h"
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::Media;
40 using namespace Tizen::Ui;
41 using namespace Tizen::Ui::Controls;
42 using namespace Tizen::Ui::Scenes;
43 using namespace Tizen::Social;
45 static const int IDA_FOOTER_EDIT = 10;
46 static const int IDA_FOOTER_DELETE = 11;
47 static const int IDA_FOOTER_MORE = 12;
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;
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";
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";
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;
89 static const int W_QUICK_BUTTON_GAP = 148;
90 static const int X_QUICK_BUTTON = 148;
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 = 140;
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 = 54;
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;
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 static const int X_MORE = 55;
122 static const int SUB_INDEX_MASK = 0xF000;
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;
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;
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";
158 ContactDetailsForm::ContactDetailsForm(void)
159 : __isAppControlLaunching(false)
160 , __pAppControl(null)
162 , __pContextMenuCall(null)
163 , __pContextMenuShare(null)
164 , __pOptionMenu(null)
165 , __pDefaultSelectorPopup(null)
166 , __pInvalidFilePopup(null)
168 , __pPresentationModel(null)
169 , __scrolledDistance(0)
173 ContactDetailsForm::~ContactDetailsForm(void)
178 ContactDetailsForm::Initialize(void)
180 Construct(L"IDL_CONTACT_DETAILS_FORM");
184 ContactDetailsForm::OnInitializing(void)
186 Footer* pFooter = GetFooter();
187 pFooter->AddActionEventListener(*this);
188 SetFormBackEventListener(this);
189 SetFormMenuEventListener(this);
191 __pTableView = new (std::nothrow) TableView();
192 __pTableView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), true, TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT);
193 __pTableView->SetItemProvider(this);
194 __pTableView->AddTableViewItemEventListener(*this);
195 __pTableView->SetBackgroundColor(COLOR_TABLE_BG);
196 __pTableView->AddTouchEventListener(*this);
197 __pTableView->AddScrollEventListener(*this);
198 AddControl(__pTableView);
200 __pContextMenuCall = new (std::nothrow) ContextMenu();
201 __pContextMenuCall->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
202 __pContextMenuCall->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_CALL"), IDA_VOICE_CALL);
203 __pContextMenuCall->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"), IDA_MESSAGE);
204 #if __SUPPORT_VIDEO_CALL
205 __pContextMenuCall->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_VIDEO_CALL"), IDA_VIDEO_CALL);
207 __pContextMenuCall->AddActionEventListener(*this);
209 __pContextMenuShare = new (std::nothrow) ContextMenu();
210 __pContextMenuShare->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
211 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), IDA_CONTEXTMENU_SHARE_EMAIL);
212 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"), IDA_CONTEXTMENU_SHARE_MESSAGE);
213 __pContextMenuShare->AddActionEventListener(*this);
215 __pItemList = new (std::nothrow) ArrayListT<int>();
216 __pItemList->Construct();
218 __pPresentationModel = new (std::nothrow) ContactPresentationModel();
219 __pPresentationModel->Construct();
220 __pPresentationModel->AddContactChangeListener(*this);
222 __pOptionMenu = new (std::nothrow) OptionMenu();
223 __pOptionMenu->Construct();
224 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_PB_BODY_MARK_AS_DEFAULT_NUMBER"), IDA_MORE_DEFAULT_NUMBER);
225 __pOptionMenu->AddActionEventListener(*this);
226 __pOptionMenu->SetShowState(false);
232 ContactDetailsForm::OnTerminating(void)
234 delete __pAppControl;
235 delete __pContextMenuCall;
236 delete __pContextMenuShare;
237 delete __pOptionMenu;
239 if (__pItemList != null)
241 __pItemList->RemoveAll();
245 if (__pPresentationModel != null)
247 __pPresentationModel->RemoveContactChangeListener(*this);
248 delete __pPresentationModel;
251 delete __pDefaultSelectorPopup;
252 delete __pInvalidFilePopup;
258 ContactDetailsForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
260 AppLog("ContactDetailsForm::OnActionPerformed(), actionId %d", actionId);
262 result r = E_SUCCESS;
263 SceneManager* pSceneManager = SceneManager::GetInstance();
267 case IDA_FOOTER_EDIT:
269 ArrayList* pList = new (std::nothrow) ArrayList();
271 pList->Add(*(new (std::nothrow) Integer(__pPresentationModel->GetContactId())));
272 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
273 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go forward", GetErrorMessage(r));
276 case IDA_FOOTER_DELETE:
279 MessageBox deleteMessageBox;
280 deleteMessageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"), MSGBOX_STYLE_YESNO);
281 deleteMessageBox.ShowAndWait(modalResult);
283 if (modalResult == MSGBOX_RESULT_YES)
285 r = __pPresentationModel->RemoveContact();
286 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to remove contact", GetErrorMessage(r));
292 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
294 if (pContactsApp->GetOperationId() == OPERATION_ID_VIEW)
296 if(Tizen::Io::File::IsFileExist(__pPresentationModel->GetVcfPath()) == false)
298 ShowInvalidFilePopup(false);
303 ArrayList* pList = new (std::nothrow) ArrayList();
305 pList->Add(*(new (std::nothrow) Integer(INVALID_RECORD_ID)));
306 pList->Add(*(new (std::nothrow) String(__pPresentationModel->GetVcfPath())));
307 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
308 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go forward", GetErrorMessage(r));
311 case IDA_MORE_DEFAULT_NUMBER:
313 ShowDefaultSelectorPopup();
316 case IDA_BUTTON_RINGTONE_CLEAR:
318 __pPresentationModel->SetValue(DETAIL_PROPERTY_RINGTONE, String());
319 __pPresentationModel->UpdateContact();
320 __pTableView->RefreshItem(__pItemList->GetCount() - 1, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
325 r = LaunchAppControl(PROVIDER_ID_PHONE, OPERATION_ID_CALL, INPUT_TYPE_VOICE, source.GetName());
326 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
331 r = LaunchAppControl(PROVIDER_ID_MESSAGE, OPERATION_ID_COMPOSE, INPUT_TYPE_SMS, source.GetName());
332 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
337 r = LaunchAppControl(PROVIDER_ID_PHONE, OPERATION_ID_CALL, INPUT_TYPE_VIDEO, source.GetName());
338 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
341 case IDA_CONTEXTMENU_SHARE_EMAIL:
343 r = LaunchAppControl(PROVIDER_ID_EMAIL, OPERATION_ID_COMPOSE);
344 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
347 case IDA_CONTEXTMENU_SHARE_MESSAGE:
349 r = LaunchAppControl(PROVIDER_ID_MESSAGE, OPERATION_ID_COMPOSE, INPUT_TYPE_MMS);
350 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
353 case IDA_BUTTON_SHARE_NAME_CARD:
356 itemPoint.x = GetClientAreaBounds().width / 2;
359 TableViewItem* pParent = static_cast<TableViewItem*>(source.GetParent());
362 itemPoint.y = GetClientAreaBounds().y + pParent->GetY() + source.GetY() - __scrolledDistance;
365 __pContextMenuShare->SetAnchorPosition(itemPoint);
366 __pContextMenuShare->SetShowState(true);
367 __pContextMenuShare->Show();
370 case IDA_POPUP_CLOSE:
372 HideDefaultSelectorPopup();
375 case IDA_INVALID_FILE_POPUP_CLOSE:
377 __pInvalidFilePopup->SetShowState(false);
379 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
381 result r = AppControlProviderManager::GetInstance()->SendAppControlResult(pContactsApp->GetRequestId(), APP_CTRL_RESULT_FAILED, null);
382 AppLogDebug("[%s] The return result from SendAppControlResult().", GetErrorMessage(r));
384 UiApp::GetInstance()->Terminate();
392 ContactDetailsForm::OnFormMenuRequested(Tizen::Ui::Controls::Form& source)
394 __pOptionMenu->SetShowState(true);
395 __pOptionMenu->Show();
399 ContactDetailsForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
401 if (__appControlViewType.IsEmpty() == false)
403 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
404 AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance();
406 result r = pAppManager->SendAppControlResult(pContactsApp->GetRequestId(), APP_CTRL_RESULT_CANCELED, null);
407 AppLogDebug("[%s] The return result from SendAppControlResult().", GetErrorMessage(r));
409 UiApp::GetInstance()->Terminate();
413 SceneManager* pSceneManager = SceneManager::GetInstance();
415 result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
416 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go backward", GetErrorMessage(r));
421 ContactDetailsForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, IList* pArgs)
423 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
424 TryReturnVoid(pContactsApp != null, "Unable to cast UiApp to ContactsApp");
426 pContactsApp->AddContactsAppChangeEventListener(*this);
428 if (previousSceneId == IDSCN_GROUP_SELECTOR || previousSceneId == IDSCN_GROUP_EDITOR)
435 Integer* pArgument = null;
436 __pPresentationModel->RemoveContactFromAllCategories();
437 IEnumerator* pEnum = pArgs->GetEnumeratorN();
438 while (pEnum->MoveNext() == E_SUCCESS)
440 pArgument = static_cast<Integer*>(pEnum->GetCurrent());
441 if (pArgument != null)
443 __pPresentationModel->AddContactToCategory(pArgument->ToInt());
448 __pTableView->RefreshItem(__pItemList->GetCount() - 2, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
450 else if (previousSceneId == IDSCN_CONTACT_EDITOR && __appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == false)
452 InitializeDetailItemList();
453 __pTableView->UpdateTableView();
462 if (pContactsApp->GetOperationId() == OPERATION_ID_VIEW)
464 __pPresentationModel->RemoveContactChangeListener(*this);
466 result r = InitializeAppControl(pArgs);
470 pArgs->RemoveAll(true);
472 AppLogDebug("Unable to initialize appcontrol");
474 ShowInvalidFilePopup();
479 InitializeDetailItemList();
483 Integer* pContactId = static_cast<Integer*>(pArgs->GetAt(0));
484 if (pContactId != null)
486 __pPresentationModel->SetContactId(pContactId->ToInt());
487 InitializeDetailItemList();
490 __pTableView->UpdateTableView();
495 pArgs->RemoveAll(true);
501 ContactDetailsForm::InitializeAppControl(Tizen::Base::Collection::IList* pArgs)
508 result r = E_SUCCESS;
510 String* pArgStringType = null;
511 String* pArgStringValue = null;
514 String valueViewType;
517 pArgStringType = static_cast<String*>(pArgs->GetAt(0));
518 pArgStringValue = static_cast<String*>(pArgs->GetAt(1));
520 TryReturn(pArgStringType != null && pArgStringValue != null, E_FAILURE, "[E_FAILURE] Unable to initialize appcontrol");
522 ParseAppControlArgument(*pArgStringType, keyViewType, valueViewType);
523 ParseAppControlArgument(*pArgStringValue, keyValue, value);
525 if (keyViewType.Equals(KEY_VIEW_TYPE, false))
527 if (valueViewType.Equals(VALUE_VIEW_TYPE_CONTACT, false))
529 if (keyValue.Equals(KEY_VIEW_TYPE_CONTACT_ID, false))
532 Integer::Parse(value, contactId);
533 r = __pPresentationModel->SetContactId(contactId);
534 __appControlViewType = valueViewType;
536 Footer* pFooter = GetFooter();
537 pFooter->RemoveAllItems();
539 FooterItem footerItemEdit;
540 footerItemEdit.Construct(IDA_FOOTER_EDIT);
541 footerItemEdit.SetText(ResourceManager::GetString(L"IDS_COM_SK_EDIT"));
542 pFooter->AddItem(footerItemEdit);
544 FooterItem footerItemDelete;
545 footerItemDelete.Construct(IDA_FOOTER_DELETE);
546 footerItemDelete.SetText(ResourceManager::GetString(L"IDS_COM_SK_DELETE"));
547 pFooter->AddItem(footerItemDelete);
549 __pPresentationModel->AddContactChangeListener(*this);
553 AppLogDebug("Invalid KEY(contactId) of AppControl[VIEW]. [%ls] has been input", keyValue.GetPointer());
557 else if (valueViewType.Equals(VALUE_VIEW_TYPE_VCF, false))
559 if (keyValue.Equals(KEY_VIEW_TYPE_VCF, false))
561 r = __pPresentationModel->SetVcfPath(value);
563 __appControlViewType = valueViewType;
564 Footer* pFooter = GetFooter();
565 pFooter->RemoveAllItems();
566 pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
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);
575 AppLogDebug("Invalid KEY(path) of AppControl[VIEW]. [%ls] has been input", keyValue.GetPointer());
581 AppLogDebug("viewType of AppControl[VIEW] should be either vcf or contact. [%ls] has been inpue", keyValue.GetPointer());
587 AppLogDebug("Invalid KEY(viewType) of AppControl[VIEW]. [%ls] has been input", keyViewType.GetPointer());
595 ContactDetailsForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
597 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
598 pContactsApp->RemoveContactsAppChangeEventListener(*this);
600 delete __pAppControl;
601 __pAppControl = null;
605 ContactDetailsForm::InitializeDetailItemList(void)
607 if (__pItemList->GetCount() > 0)
609 __pItemList->RemoveAll();
613 __pItemList->Add(DETAIL_PROPERTY_MAIN_INFO);
615 // Other Phone Numbers
616 Footer* pFooter = GetFooter();
617 pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
618 int otherNumberCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER);
620 if (otherNumberCount > 1)
622 if (__appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == false)
624 pFooter->SetMenuButton();
628 pFooter->RemoveMenuButton();
631 for (int subIndex = 0; subIndex < otherNumberCount; subIndex++)
633 if (__pPresentationModel->GetDefaultNumberIndex() != subIndex)
635 __pItemList->Add(DETAIL_PROPERTY_PHONE_NUMBER + subIndex);
641 pFooter->RemoveMenuButton();
644 if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_EMAIL) > 0)
646 __pItemList->Add(DETAIL_PROPERTY_EMAIL);
649 if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_ADDRESS) > 0)
651 __pItemList->Add(DETAIL_PROPERTY_ADDRESS);
654 if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_IM_ADDRESS) > 0)
656 __pItemList->Add(DETAIL_PROPERTY_IM_ADDRESS);
659 if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_URL) > 0)
661 __pItemList->Add(DETAIL_PROPERTY_URL);
664 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_BIRTHDAY).IsEmpty() == false)
666 __pItemList->Add(DETAIL_PROPERTY_BIRTHDAY);
669 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_NOTE).IsEmpty() == false)
671 __pItemList->Add(DETAIL_PROPERTY_NOTE);
674 __pItemList->Add(DETAIL_PROPERTY_GROUP);
675 __pItemList->Add(DETAIL_PROPERTY_RINGTONE);
679 ContactDetailsForm::GetItemCount(void)
681 return __pItemList->GetCount();
684 Tizen::Ui::Controls::TableViewItem*
685 ContactDetailsForm::CreateItem(int itemIndex, int itemWidth)
687 TableViewItem* pItem = new (std::nothrow) TableViewItem();
689 int contentItemIndex = -1;
690 int itemSubIndex = -1;
691 __pItemList->GetAt(itemIndex, contentItemIndex);
693 switch (contentItemIndex & SUB_INDEX_MASK)
695 case DETAIL_PROPERTY_PHONE_NUMBER:
697 itemSubIndex = contentItemIndex - DETAIL_PROPERTY_PHONE_NUMBER;
698 contentItemIndex = DETAIL_PROPERTY_PHONE_NUMBER;
701 case DETAIL_PROPERTY_EMAIL:
703 contentItemIndex = DETAIL_PROPERTY_EMAIL;
706 case DETAIL_PROPERTY_IM_ADDRESS:
708 contentItemIndex = DETAIL_PROPERTY_IM_ADDRESS;
711 case DETAIL_PROPERTY_ADDRESS:
713 contentItemIndex = DETAIL_PROPERTY_ADDRESS;
716 case DETAIL_PROPERTY_URL:
718 contentItemIndex = DETAIL_PROPERTY_URL;
725 switch (contentItemIndex)
727 case DETAIL_PROPERTY_MAIN_INFO:
729 AddMainInfo(itemWidth, pItem);
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:
740 AddProperty(itemWidth, pItem, contentItemIndex, itemSubIndex);
743 case DETAIL_PROPERTY_GROUP:
745 AddGroup(itemWidth, pItem);
748 case DETAIL_PROPERTY_RINGTONE:
750 AddRingTone(itemWidth, pItem);
765 ContactDetailsForm::DeleteItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
772 ContactDetailsForm::UpdateItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
774 int contentItemIndex = -1;
775 __pItemList->GetAt(itemIndex, contentItemIndex);
779 if (contentItemIndex == DETAIL_PROPERTY_GROUP)
781 value = __pPresentationModel->GetValue(DETAIL_PROPERTY_GROUP);
785 value = ResourceManager::GetString(L"IDS_PB_BODY_NOT_ASSIGNED");
788 else if (contentItemIndex == DETAIL_PROPERTY_RINGTONE)
790 String path = __pPresentationModel->GetValue(DETAIL_PROPERTY_RINGTONE);
792 path.LastIndexOf(L"/", path.GetLength() - 1, index);
796 path.SubString(index + 1, value);
800 Label* pValueLabel = static_cast<Label*>(pItem->GetControl(2));
801 if (pValueLabel == null)
806 pValueLabel->SetText(value);
807 pValueLabel->Invalidate(false);
811 ContactDetailsForm::GetDefaultItemHeight(void)
817 ContactDetailsForm::AddMainInfo(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem)
819 int itemHeight = Y_THUMBNAIL;
821 Label* pThumbnailLabel = null;
823 String thumbnailPath = __pPresentationModel->GetValue(DETAIL_PROPERTY_THUMBNAIL);
824 Bitmap* pThumbnail = null;
825 ImageBuffer thumbnailImageBuffer;
826 result r = thumbnailImageBuffer.Construct(thumbnailPath);
829 pThumbnail = thumbnailImageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_ARGB8888, BUFFER_SCALING_NONE);
831 if (pThumbnail != null)
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);
840 itemHeight += (H_THUMBNAIL + Y_THUMBNAIL);
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);
853 if (firstName.IsEmpty() == false)
855 name = firstName + CHARACTER_SPACE;
857 if (middleName.IsEmpty() == false)
859 name += (middleName + CHARACTER_SPACE);
861 if (lastName.IsEmpty() == false)
868 if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER))
870 name.Append(__pPresentationModel->GetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER));
874 name.Append(__pPresentationModel->GetValue(DETAIL_PROPERTY_EMAIL, 0));
878 String suffixNickName;
879 if (suffix.IsEmpty() == false)
881 suffixNickName = suffix + CHARACTER_SPACE;
883 if (nickName.IsEmpty() == false)
885 suffixNickName += nickName;
889 if (jobTitle.IsEmpty() == false)
891 companyInfo = jobTitle + CHARACTER_SPACE;
893 if (company.IsEmpty() == false)
895 companyInfo += company + CHARACTER_SPACE;
897 if (department.IsEmpty() == false)
899 companyInfo += department;
902 Label* pNameLabel = null;
903 Label* pFavoriteLabel = null;
904 if (name.IsEmpty() == false)
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);
913 if (__appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == false)
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);
920 Bitmap* pBitmap = null;
921 if (__pPresentationModel->IsFavorite())
923 pBitmap = ResourceManager::GetBitmapN(IDB_DETAILS_FAVORITE_ON);
927 pBitmap = ResourceManager::GetBitmapN(IDB_DETAILS_FAVORITE_OFF);
932 pFavoriteLabel->SetBackgroundBitmap(*pBitmap);
937 itemHeight += H_NAME;
940 Label* pSuffixNickNameLabel = null;
941 if (suffixNickName.IsEmpty() == false)
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);
951 Label* pCompanyInfoLabel = null;
952 if (companyInfo.IsEmpty() == false)
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);
962 Label* pDefaultNumberLabel = null;
963 Button* pCallButton = null;
964 Button* pMessageButton = null;
965 #if __SUPPORT_VIDEO_CALL
966 Button* pVideoCallButton = null;
969 String defaultPhoneNumber = __pPresentationModel->GetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER);
970 if (defaultPhoneNumber.IsEmpty() == false)
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);
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);
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)
994 pCallButton->SetNormalBackgroundBitmap(*pBgNormal);
996 if (pBgPressed != null)
998 pCallButton->SetPressedBackgroundBitmap(*pBgPressed);
1000 if (pCallNormal != null)
1002 pCallButton->SetNormalBitmap(Point(0, 0), *pCallNormal);
1004 if (pCallPressed != null)
1006 pCallButton->SetPressedBitmap(Point(0, 0), *pCallPressed);
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)
1015 pMessageButton->SetNormalBackgroundBitmap(*pBgNormal);
1017 if (pBgPressed != null)
1019 pMessageButton->SetPressedBackgroundBitmap(*pBgPressed);
1021 if (pMessageNormal != null)
1023 pMessageButton->SetNormalBitmap(Point(0, 0), *pMessageNormal);
1025 if (pMessagePressed != null)
1027 pMessageButton->SetPressedBitmap(Point(0, 0), *pMessagePressed);
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)
1036 pVideoCallButton->SetNormalBackgroundBitmap(*pBgNormal);
1038 if (pBgPressed != null)
1040 pVideoCallButton->SetPressedBackgroundBitmap(*pBgPressed);
1042 if (pVideoCallNormal != null)
1044 pVideoCallButton->SetNormalBitmap(Point(0, 0), *pVideoCallNormal);
1046 if (pVideoCallPressed != null)
1048 pVideoCallButton->SetPressedBitmap(Point(0, 0), *pVideoCallPressed);
1055 delete pCallPressed;
1056 delete pMessageNormal;
1057 delete pMessagePressed;
1058 delete pVideoCallNormal;
1059 delete pVideoCallPressed;
1061 itemHeight += (H_QUICK_BUTTON + H_QUICK_BUTTON_DIVIDER);
1065 itemHeight += H_QUICK_BUTTON_DIVIDER;
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);
1072 if (pThumbnailLabel != null)
1074 pItem->AddControl(pThumbnailLabel);
1076 if (pNameLabel != null)
1078 pItem->AddControl(pNameLabel);
1080 if (pFavoriteLabel != null)
1082 pItem->AddControl(pFavoriteLabel);
1084 if (pSuffixNickNameLabel != null)
1086 pItem->AddControl(pSuffixNickNameLabel);
1088 if (pCompanyInfoLabel != null)
1090 pItem->AddControl(pCompanyInfoLabel);
1092 if (pDefaultNumberLabel != null)
1094 pItem->AddControl(pDefaultNumberLabel);
1096 #if __SUPPORT_VIDEO_CALL
1097 if (pCallButton != null && pMessageButton != null && pVideoCallButton != null)
1099 pItem->AddControl(pCallButton);
1100 pItem->AddControl(pMessageButton);
1101 pItem->AddControl(pVideoCallButton);
1104 if (pCallButton != null && pMessageButton != null)
1106 pItem->AddControl(pCallButton);
1107 pItem->AddControl(pMessageButton);
1113 ContactDetailsForm::AddProperty(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem, int detailProperty, int itemSubIndex)
1119 int itemHeight = H_ITEM_DOUBLE_LINE;
1120 int valueCount = __pPresentationModel->GetMultiValuesCount(static_cast<DetailProperty>(detailProperty));
1122 if (detailProperty != DETAIL_PROPERTY_PHONE_NUMBER && valueCount > 1)
1124 pItem->Construct(Dimension(itemWidth, H_ITEM_DOUBLE_LINE + (H_ADDITIONAL_ITEM * (valueCount - 1))), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1125 CreateTitleValueTypeItem(itemWidth, pItem, detailProperty);
1130 switch (detailProperty)
1132 case DETAIL_PROPERTY_PHONE_NUMBER:
1134 type = __pPresentationModel->GetType(DETAIL_PROPERTY_PHONE_NUMBER, itemSubIndex);
1135 value = __pPresentationModel->GetValue(DETAIL_PROPERTY_PHONE_NUMBER, itemSubIndex);
1137 pItem->Construct(Dimension(itemWidth, H_ITEM), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1138 pItem->SetName(value);
1140 CreateValueTypeItem(itemWidth, pItem, value, type);
1145 case DETAIL_PROPERTY_EMAIL:
1147 title = ResourceManager::GetString(L"IDS_COM_BODY_EMAIL");
1148 type = __pPresentationModel->GetType(static_cast<DetailProperty>(detailProperty), 0);
1149 value = __pPresentationModel->GetValue(static_cast<DetailProperty>(detailProperty), 0);
1152 case DETAIL_PROPERTY_ADDRESS:
1154 title = ResourceManager::GetString(L"IDS_PB_BODY_ADDRESS");
1155 type = __pPresentationModel->GetType(static_cast<DetailProperty>(detailProperty), 0);
1156 value = __pPresentationModel->GetValue(static_cast<DetailProperty>(detailProperty), 0);
1159 case DETAIL_PROPERTY_IM_ADDRESS:
1161 title = ResourceManager::GetString(L"IDS_PB_HEADER_INSTANT_MESSENGER_ABB");
1162 type = __pPresentationModel->GetType(static_cast<DetailProperty>(detailProperty), 0);
1163 value = __pPresentationModel->GetValue(static_cast<DetailProperty>(detailProperty), 0);
1166 case DETAIL_PROPERTY_URL:
1168 title = ResourceManager::GetString(L"IDS_PB_BODY_URL");
1169 type = __pPresentationModel->GetType(static_cast<DetailProperty>(detailProperty), 0);
1170 value = __pPresentationModel->GetValue(static_cast<DetailProperty>(detailProperty), 0);
1173 case DETAIL_PROPERTY_BIRTHDAY:
1175 title = ResourceManager::GetString(L"IDS_PB_BODY_BIRTHDAY");
1176 value = __pPresentationModel->GetValue(DETAIL_PROPERTY_BIRTHDAY);
1179 case DETAIL_PROPERTY_NOTE:
1181 pItem->Construct(Dimension(itemWidth, itemHeight), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1182 CreateNoteItem(itemWidth, pItem);
1191 pItem->Construct(Dimension(itemWidth, itemHeight), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1192 CreateTitleValueTypeItem(itemWidth, pItem, title, value, type, lineCount);
1196 ContactDetailsForm::AddGroup(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem)
1198 pItem->Construct(Dimension(itemWidth, H_ITEM_DOUBLE_LINE), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1199 pItem->SetName(Integer::ToString(DETAIL_PROPERTY_GROUP));
1201 String title = ResourceManager::GetString(L"IDS_PB_BODY_GROUPS");
1202 String value = __pPresentationModel->GetValue(DETAIL_PROPERTY_GROUP);
1204 if (value.IsEmpty())
1206 value = ResourceManager::GetString(L"IDS_PB_BODY_NOT_ASSIGNED");
1209 AddGroupStylePanel(itemWidth, pItem, GROUP_STYLE_TOP);
1211 CreateTitleValueTypeItem(itemWidth, pItem, title, value);
1215 ContactDetailsForm::AddRingTone(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem)
1217 pItem->Construct(Dimension(itemWidth, H_ITEM_DOUBLE_LINE), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1218 pItem->SetName(Integer::ToString(DETAIL_PROPERTY_RINGTONE));
1220 String title = ResourceManager::GetString(L"IDS_PB_BODY_RINGTONE");
1221 String value = __pPresentationModel->GetValue(DETAIL_PROPERTY_RINGTONE);
1225 value.LastIndexOf(L"/", value.GetLength() - 1, index);
1229 value.SubString(index + 1, trimmedPath);
1232 AddGroupStylePanel(itemWidth, pItem, GROUP_STYLE_BOTTOM);
1234 CreateTitleValueTypeItem(itemWidth, pItem, title, trimmedPath);
1236 if (__appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == false)
1238 Button* pClearButton = new (std::nothrow) Button();
1239 pClearButton->Construct(Rectangle(itemWidth - H_ICON - W_TEXT_MARGIN, (H_ITEM_DOUBLE_LINE - H_ICON) / 2, H_ICON, H_ICON));
1240 pClearButton->SetActionId(IDA_BUTTON_RINGTONE_CLEAR);
1241 pClearButton->AddActionEventListener(*this);
1243 Bitmap* pReset = ResourceManager::GetBitmapN(IDB_DETAILS_RESET_NORMAL);
1246 pClearButton->SetNormalBitmap(Point(0, 0), *pReset);
1249 pReset = ResourceManager::GetBitmapN(IDB_DETAILS_RESET_PRESSED);
1252 pClearButton->SetPressedBitmap(Point(0, 0), *pReset);
1256 pItem->AddControl(pClearButton);
1257 pItem->SetIndividualSelectionEnabled(pClearButton, true);
1262 ContactDetailsForm::AddShareButtons(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem)
1264 pItem->Construct(Dimension(itemWidth, H_BUTTON_CONTAINER));
1266 int buttonWidth = itemWidth - W_BUTTON_GAP * 2;
1268 Button* pSendNameButton = new (std::nothrow) Button();
1269 pSendNameButton->Construct(Rectangle(W_BUTTON_GAP, Y_BUTTON, buttonWidth, H_BUTTON), ResourceManager::GetString(L"IDS_PB_HEADER_SEND_NAMECARD"));
1270 pSendNameButton->SetActionId(IDA_BUTTON_SHARE_NAME_CARD);
1271 pSendNameButton->AddActionEventListener(*this);
1272 pItem->AddControl(pSendNameButton);
1276 ContactDetailsForm::CreateValueTypeItem(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem, const Tizen::Base::String& value, const Tizen::Base::String& type)
1278 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1279 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1281 Label* pValueLabel = new (std::nothrow) Label();
1282 pValueLabel->Construct(Rectangle(W_TEXT_MARGIN, 0, itemWidth - W_TEXT_MARGIN * 2 - W_TYPE, H_ITEM), value);
1283 pValueLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1284 pValueLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1285 pValueLabel->SetTextConfig(FONT_SIZE_MAIN_TEXT, LABEL_TEXT_STYLE_NORMAL);
1286 pValueLabel->SetTextColor(COLOR_OTHER_NUMBER);
1287 pItem->AddControl(pValueLabel);
1289 Label* pTypeLabel = new (std::nothrow) Label();
1290 pTypeLabel->Construct(Rectangle((itemWidth - W_TEXT_MARGIN - W_TYPE), 0, W_TYPE, H_ITEM), type);
1291 pTypeLabel->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
1292 pTypeLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1293 pTypeLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1294 pTypeLabel->SetTextColor(COLOR_ITEM_TYPE);
1295 pItem->AddControl(pTypeLabel);
1299 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)
1301 int valueWidth = itemWidth - (W_TEXT_MARGIN * 2);
1303 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1304 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1306 Label* pTitleLabel = new (std::nothrow) Label();
1307 pTitleLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE, itemWidth - W_TEXT_MARGIN, H_ITEM_TITLE), title);
1308 pTitleLabel->SetName(GROUP_LABEL);
1309 pTitleLabel->AddTouchEventListener(*this);
1310 pTitleLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1311 pTitleLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1312 pTitleLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1313 pTitleLabel->SetTextColor(COLOR_ITEM_TITLE);
1314 pItem->AddControl(pTitleLabel);
1316 if (type.IsEmpty() == false)
1318 Label* pTypeLabel = new (std::nothrow) Label();
1319 pTypeLabel->Construct(Rectangle((itemWidth - W_TEXT_MARGIN - W_TYPE), Y_ITEM_TITLE + H_ITEM_TITLE, W_TYPE, H_ITEM_VALUE), type);
1320 pTypeLabel->SetName(GROUP_LABEL);
1321 pTypeLabel->AddTouchEventListener(*this);
1322 pTypeLabel->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
1323 pTypeLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1324 pTypeLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1325 pTypeLabel->SetTextColor(COLOR_ITEM_TYPE);
1326 pItem->AddControl(pTypeLabel);
1328 valueWidth = itemWidth - (W_TEXT_MARGIN * 2) - W_TYPE;
1330 else if (title.Equals(ResourceManager::GetString(L"IDS_PB_BODY_RINGTONE"), false))
1332 valueWidth = itemWidth - (W_TEXT_MARGIN * 2) - H_ICON;
1335 Label* pValueLabel = new (std::nothrow) Label();
1336 pValueLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE + H_ITEM_TITLE, valueWidth, H_ITEM_VALUE * lineCount), value);
1337 pValueLabel->SetName(GROUP_LABEL);
1338 pValueLabel->AddTouchEventListener(*this);
1339 pValueLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1340 pValueLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1341 pValueLabel->SetTextConfig(FONT_SIZE_MAIN_TEXT, LABEL_TEXT_STYLE_NORMAL);
1342 pValueLabel->SetTextColor(COLOR_ITEM_VALUE);
1343 pItem->AddControl(pValueLabel);
1347 ContactDetailsForm::CreateTitleValueTypeItem(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem, int detailProperty)
1351 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1352 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1354 switch (detailProperty)
1356 case DETAIL_PROPERTY_EMAIL:
1358 title = ResourceManager::GetString(L"IDS_COM_BODY_EMAIL");
1361 case DETAIL_PROPERTY_ADDRESS:
1363 title = ResourceManager::GetString(L"IDS_PB_BODY_ADDRESS");
1366 case DETAIL_PROPERTY_URL:
1368 title = ResourceManager::GetString(L"IDS_PB_BODY_URL");
1371 case DETAIL_PROPERTY_IM_ADDRESS:
1373 title = ResourceManager::GetString(L"IDS_PB_HEADER_INSTANT_MESSENGER_ABB");
1380 Label* pTitleLabel = new (std::nothrow) Label();
1381 pTitleLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE, itemWidth - W_TEXT_MARGIN, H_ITEM_TITLE), title);
1382 pTitleLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1383 pTitleLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1384 pTitleLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1385 pTitleLabel->SetTextColor(COLOR_ITEM_TITLE);
1386 pItem->AddControl(pTitleLabel);
1388 for (int i = 0; i < __pPresentationModel->GetMultiValuesCount(static_cast<DetailProperty>(detailProperty)); i++)
1390 String type = __pPresentationModel->GetType(static_cast<DetailProperty>(detailProperty), i);
1391 String value = __pPresentationModel->GetValue(static_cast<DetailProperty>(detailProperty), i);
1393 int valueWidth = itemWidth - (W_TEXT_MARGIN * 2);
1394 if (type.IsEmpty() == false)
1396 Label* pTypeLabel = new (std::nothrow) Label();
1397 pTypeLabel->Construct(Rectangle((itemWidth - W_TEXT_MARGIN - W_TYPE), Y_ITEM_TITLE + H_ITEM_TITLE + (H_ADDITIONAL_ITEM * i), W_TYPE, H_ITEM_VALUE), type);
1398 pTypeLabel->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
1399 pTypeLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1400 pTypeLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1401 pTypeLabel->SetTextColor(COLOR_ITEM_TYPE);
1402 pItem->AddControl(pTypeLabel);
1404 valueWidth = itemWidth - (W_TEXT_MARGIN * 2) - W_TYPE;
1407 Label* pValueLabel = new (std::nothrow) Label();
1408 pValueLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE + H_ITEM_TITLE + (H_ADDITIONAL_ITEM * i), valueWidth, H_ITEM_VALUE), value);
1409 pValueLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1410 pValueLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1411 pValueLabel->SetTextConfig(FONT_SIZE_MAIN_TEXT, LABEL_TEXT_STYLE_NORMAL);
1412 pValueLabel->SetTextColor(COLOR_ITEM_VALUE);
1413 pItem->AddControl(pValueLabel);
1418 ContactDetailsForm::CreateNoteItem(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem)
1420 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1421 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1423 String title = ResourceManager::GetString(L"IDS_PB_BODY_NOTE");
1424 String value = __pPresentationModel->GetValue(DETAIL_PROPERTY_NOTE);
1426 Label* pTitleLabel = new (std::nothrow) Label();
1427 pTitleLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE, itemWidth - W_TEXT_MARGIN, H_ITEM_TITLE), title);
1428 pTitleLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1429 pTitleLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1430 pTitleLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1431 pTitleLabel->SetTextColor(COLOR_ITEM_TITLE);
1432 pItem->AddControl(pTitleLabel);
1434 Label* pValueLabel = new (std::nothrow) Label();
1435 pValueLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE + H_ITEM_TITLE, itemWidth - (W_TEXT_MARGIN * 2), H_ITEM_VALUE), value);
1436 pValueLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1437 pValueLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
1438 pValueLabel->SetTextConfig(FONT_SIZE_MAIN_TEXT, LABEL_TEXT_STYLE_NORMAL);
1439 pValueLabel->SetTextColor(COLOR_ITEM_VALUE);
1440 pItem->AddControl(pValueLabel);
1443 font.Construct(FONT_STYLE_PLAIN, FONT_SIZE_MAIN_TEXT);
1445 TextElement* pNameElement = new (std::nothrow) TextElement();
1446 pNameElement->Construct(value);
1447 pNameElement->SetFont(font);
1449 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1450 pEnrichedText->Construct(Dimension(itemWidth - (W_TEXT_MARGIN * 2) - (pValueLabel->GetLeftMargin() * 2), H_ITEM_VALUE));
1451 pEnrichedText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
1452 pEnrichedText->SetTextAbbreviationEnabled(false);
1453 pEnrichedText->Add(*pNameElement);
1455 pValueLabel->SetSize(pValueLabel->GetWidth(), pEnrichedText->GetTotalLineHeight() + pValueLabel->GetTopMargin());
1456 pItem->SetSize(itemWidth, (Y_ITEM_TITLE * 2) + H_ITEM_TITLE + pEnrichedText->GetTotalLineHeight());
1458 pEnrichedText->RemoveAllTextElements(true);
1459 delete pEnrichedText;
1463 ContactDetailsForm::OnTableViewItemStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1465 SceneManager* pSceneManager = SceneManager::GetInstance();
1467 if (status == TABLE_VIEW_ITEM_STATUS_SELECTED)
1469 String itemName = pItem->GetName();
1471 if (itemName.Equals(Integer::ToString(DETAIL_PROPERTY_GROUP), true) == true)
1473 if (__appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == true)
1478 if (__pPresentationModel->GetCategoryCount() > 0)
1480 IList* pCategoryList = __pPresentationModel->GetAssignedCategoryIdListN();
1482 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_SELECTOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pCategoryList);
1486 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
1489 else if (itemName.Equals(Integer::ToString(DETAIL_PROPERTY_RINGTONE), true) == true)
1491 if (__appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == true)
1496 result r = LaunchAppControl(PROVIDER_ID_FILEMANAGER, OPERATION_ID_PICK);
1497 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
1499 else if (itemName.IsEmpty() == false)
1501 if (__isAppControlLaunching == true)
1506 itemPoint.x = GetClientAreaBounds().width / 2;
1507 itemPoint.y = GetClientAreaBounds().y + pItem->GetY() + (pItem->GetHeight() / 2) - __scrolledDistance;
1509 __pContextMenuCall->SetName(itemName);
1510 __pContextMenuCall->SetAnchorPosition(itemPoint);
1511 __pContextMenuCall->SetShowState(true);
1512 __pContextMenuCall->Show();
1518 ContactDetailsForm::OnTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated)
1523 ContactDetailsForm::OnTableViewItemReordered(Tizen::Ui::Controls::TableView& tableView, int itemIndexFrom, int itemIndexTo)
1528 ContactDetailsForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo & touchInfo)
1530 if (source.GetName().Equals(GROUP_STYLE_PANEL, true))
1532 Panel* pPanel = static_cast<Panel*>(&const_cast<Control&>(source));
1533 pPanel->SetBackgroundColor(COLOR_PRESSED);
1535 else if (source.GetName().Equals(GROUP_LABEL, true))
1537 Panel* pPanel = static_cast<Panel*>(source.GetParent()->GetControl(GROUP_STYLE_PANEL));
1538 pPanel->SetBackgroundColor(COLOR_PRESSED);
1543 ContactDetailsForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1545 if (source.GetName().Equals(GROUP_STYLE_PANEL, true))
1547 Panel* pPanel = static_cast<Panel*>(&const_cast<Control&>(source));
1548 pPanel->SetBackgroundColor(COLOR_GROUP_STYLE);
1550 else if (source.GetName().Equals(GROUP_LABEL, true))
1552 Panel* pPanel = static_cast<Panel*>(source.GetParent()->GetControl(GROUP_STYLE_PANEL));
1553 pPanel->SetBackgroundColor(COLOR_GROUP_STYLE);
1555 else if (source.GetName().Equals(FAVORITE_LABEL, true))
1557 Label* pLabel = static_cast<Label*>(&const_cast<Control&>(source));
1563 __pPresentationModel->SetAsFavorite(!__pPresentationModel->IsFavorite());
1565 Bitmap* pBitmap = null;
1566 if (__pPresentationModel->IsFavorite())
1568 pBitmap = ResourceManager::GetBitmapN(IDB_DETAILS_FAVORITE_ON);
1572 pBitmap = ResourceManager::GetBitmapN(IDB_DETAILS_FAVORITE_OFF);
1575 if (pBitmap != null)
1577 pLabel->SetBackgroundBitmap(*pBitmap);
1580 pLabel->Invalidate(false);
1585 ContactDetailsForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1590 ContactDetailsForm::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1595 ContactDetailsForm::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1600 ContactDetailsForm::OnTouchCanceled(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1605 ContactDetailsForm::OnScrollEndReached (Tizen::Ui::Control &source, Tizen::Ui::Controls::ScrollEndEvent type)
1610 ContactDetailsForm::OnScrollPositionChanged (Tizen::Ui::Control &source, int scrollPos)
1612 __scrolledDistance = scrollPos;
1616 ContactDetailsForm::OnScrollStopped (Tizen::Ui::Control &source)
1621 ContactDetailsForm::OnContactsChanged(void)
1623 if (__pPresentationModel->IsContactRemoved())
1625 if (__appControlViewType.IsEmpty() == true)
1627 SceneManager* pSceneManager = SceneManager::GetInstance();
1629 result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
1630 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go backward", GetErrorMessage(r));
1634 UiApp::GetInstance()->Terminate();
1639 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1640 TryReturnVoid(pContactsApp != null, "Unable to get ContactsApp instance.");
1642 if (pContactsApp->GetAppUiState() == APP_UI_STATE_BACKGROUND)
1644 InitializeDetailItemList();
1645 __pTableView->UpdateTableView();
1649 delete __pDefaultSelectorPopup;
1650 __pDefaultSelectorPopup = null;
1654 ContactDetailsForm::OnCategoriesChanged(void)
1659 ContactDetailsForm::LaunchAppControl(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, const Tizen::Base::String& launchType, const Tizen::Base::String& value)
1661 result r = E_SUCCESS;
1663 if (__pAppControl != null)
1671 extraData.Construct();
1672 IAppControlResponseListener* pEvent = null;
1674 if (appId.Equals(String(PROVIDER_ID_PHONE)) && operationId.Equals(String(OPERATION_ID_CALL)))
1676 uri.Append(INPUT_URI_TEL);
1678 if (value.IsEmpty())
1680 uri.Append(__pPresentationModel->GetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER));
1687 extraData.Add(new (std::nothrow) String(INPUT_KEY_CALL_TYPE), new (std::nothrow) String(launchType));
1689 else if (appId.Equals(String(PROVIDER_ID_MESSAGE)) && operationId.Equals(String(OPERATION_ID_COMPOSE)))
1691 String recipientAddress;
1693 if (value.IsEmpty())
1695 recipientAddress.Append(__pPresentationModel->GetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER));
1699 recipientAddress.Append(value);
1701 extraData.Add(new (std::nothrow) String(INPUT_KEY_MESSAGE_TO), new (std::nothrow) String(recipientAddress));
1702 extraData.Add(new (std::nothrow) String(INPUT_KEY_MESSAGE_TYPE), new (std::nothrow) String(INPUT_TYPE_SMS));
1704 else if (appId.Equals(String(PROVIDER_ID_FILEMANAGER)) && operationId.Equals(String(OPERATION_ID_PICK)))
1706 mimeType.Append(INPUT_MIME_TYPE_AUDIO);
1707 extraData.Add(new (std::nothrow) String(INPUT_KEY_SELECTION_MODE), new (std::nothrow) String(INPUT_DATA_SELECTION_MODE_SINGLE));
1711 else if (appId.Equals(String(PROVIDER_ID_EMAIL)) && operationId.Equals(String(OPERATION_ID_COMPOSE)))
1713 ArrayList* pArgList = new (std::nothrow) ArrayList();
1714 pArgList->Construct();
1716 pArgList->Add(new (std::nothrow) String(__pPresentationModel->GetValue(DETAIL_PROPERTY_EMAIL, 0)));
1717 extraData.Add(new (std::nothrow) String(INPUT_KEY_MESSAGE_TO), pArgList);
1720 __pAppControl = AppManager::FindAppControlN(appId, operationId);
1722 if (__pAppControl != null)
1724 r = __pAppControl->Start(&uri, &mimeType, &extraData, pEvent);
1725 TryCatch(r == E_SUCCESS, , "[%s] Unable to launch app control", GetErrorMessage(r));
1727 __isAppControlLaunching = true;
1729 if (operationId.Equals(String(OPERATION_ID_PICK)))
1735 Footer* pFooter = GetFooter();
1736 pFooter->SetEnabled(false);
1740 extraData.RemoveAll(true);
1745 ContactDetailsForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData)
1747 AppLogDebug("ENTER");
1752 if (pExtraData == null)
1757 if (appId.Equals(String(PROVIDER_ID_FILEMANAGER)) && operationId.Equals(String(OPERATION_ID_PICK)))
1759 if (appControlResult == APP_CTRL_RESULT_SUCCEEDED)
1761 const String *pResultString = null;
1762 const ArrayList* pResultList = dynamic_cast<const ArrayList*>(pExtraData->GetValue(String(OUTPUT_KEY_SELECTED)));
1763 if (pResultList != null)
1765 pResultString = static_cast<const String*>(pResultList->GetAt(0));
1769 pResultString = static_cast<const String*>(pExtraData->GetValue(String(OUTPUT_KEY_SELECTED)));
1772 if (pResultString != null && pResultString->IsEmpty() == false)
1774 __pPresentationModel->SetValue(DETAIL_PROPERTY_RINGTONE, *pResultString);
1775 __pPresentationModel->UpdateContact();
1776 __pTableView->RefreshItem(__pItemList->GetCount() - 1, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1781 AppLogDebug("EXIT");
1785 ContactDetailsForm::AddGroupStylePanel(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::GroupStyle groupStyle)
1787 Panel* pGroupStyle = new (std::nothrow) Panel();
1788 pGroupStyle->Construct(Rectangle(W_GROUP_STYLE_MARGIN, 0, itemWidth - W_GROUP_STYLE_MARGIN * 2, H_ITEM_DOUBLE_LINE), groupStyle);
1789 pGroupStyle->SetName(GROUP_STYLE_PANEL);
1790 pGroupStyle->SetBackgroundColor(COLOR_GROUP_STYLE);
1791 pGroupStyle->AddTouchEventListener(*this);
1792 pItem->AddControl(pGroupStyle);
1796 ContactDetailsForm::ParseAppControlArgument(const Tizen::Base::String& argument, Tizen::Base::String& type, Tizen::Base::String& content)
1798 result r = E_SUCCESS;
1800 if (argument.IsEmpty() || argument.Contains(DELIMITER) == false)
1805 StringTokenizer stringToken(argument, DELIMITER);
1807 r = stringToken.GetNextToken(type);
1808 TryReturn(r == E_SUCCESS, r, "[%s] Unable to get type", GetErrorMessage(r));
1810 r = stringToken.GetNextToken(content);
1811 TryReturn(r == E_SUCCESS, r, "[%s] Unable to get content", GetErrorMessage(r));
1817 ContactDetailsForm::ShowDefaultSelectorPopup(void)
1819 ArrayList* pList = new (std::nothrow) ArrayList();
1822 String numberWithType;
1823 int numberCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER);
1824 for (int index = 0; index < numberCount; index++)
1826 numberWithType = __pPresentationModel->GetType(DETAIL_PROPERTY_PHONE_NUMBER, index) + L" ";
1827 numberWithType += __pPresentationModel->GetValue(DETAIL_PROPERTY_PHONE_NUMBER, index);
1829 pList->Add(*(new (std::nothrow) String(numberWithType)));
1831 ContactValueListItemProvider* pProvider = new (std::nothrow) ContactValueListItemProvider(pList);
1833 delete __pDefaultSelectorPopup;
1834 __pDefaultSelectorPopup = new (std::nothrow) Popup();
1835 __pDefaultSelectorPopup->Construct(true, Dimension(W_POPUP, H_POPUP));
1836 __pDefaultSelectorPopup->SetTitleText(ResourceManager::GetString(L"IDS_PB_BODY_MARK_AS_DEFAULT_NUMBER"));
1838 Rectangle popupClientBounds = __pDefaultSelectorPopup->GetClientAreaBounds();
1840 ListView* pOtherNumberList = new (std::nothrow) ListView();
1841 pOtherNumberList->Construct(Rectangle(0, 0, popupClientBounds.width, H_POPUP_LIST_VIEW));
1842 pOtherNumberList->AddListViewItemEventListener(*this);
1843 pOtherNumberList->SetItemProvider(*pProvider);
1845 __pDefaultSelectorPopup->AddControl(pOtherNumberList);
1847 Button* pCloseButton = new (std::nothrow) Button();
1848 pCloseButton->Construct(Rectangle((popupClientBounds.width - W_POPUP_BUTTON) / 2, Y_POPUP_BUTTON,
1849 W_POPUP_BUTTON, H_POPUP_BUTTON), ResourceManager::GetString(L"IDS_COM_POP_CLOSE"));
1850 pCloseButton->SetActionId(IDA_POPUP_CLOSE);
1851 pCloseButton->AddActionEventListener(*this);
1853 __pDefaultSelectorPopup->AddControl(pCloseButton);
1854 __pDefaultSelectorPopup->SetShowState(true);
1855 __pDefaultSelectorPopup->Show();
1859 ContactDetailsForm::HideDefaultSelectorPopup(void)
1861 __pDefaultSelectorPopup->SetShowState(false);
1867 ContactDetailsForm::ShowInvalidFilePopup(bool isInvalidFormat)
1869 if (__pInvalidFilePopup != null)
1871 delete __pInvalidFilePopup;
1874 __pInvalidFilePopup = new (std::nothrow) Popup();
1875 __pInvalidFilePopup->Construct(false, Dimension(W_POPUP, H_INVALID_FILE_POPUP));
1877 Rectangle clientBounds = __pInvalidFilePopup->GetClientAreaBounds();
1879 Label* pLabelText = new (std::nothrow) Label();
1880 if(isInvalidFormat == true)
1882 pLabelText->Construct(Rectangle(0, Y_POPUP_TEXT_LABEL, clientBounds.width, H_POPUP_TEXT_LABEL), ResourceManager::GetString(L"IDS_RSSR_BODY_INVALID_FORMAT"));
1886 pLabelText->Construct(Rectangle(0, Y_POPUP_TEXT_LABEL, clientBounds.width, H_POPUP_TEXT_LABEL), ResourceManager::GetString(L"IDS_MP_POP_INVALID_FILE"));
1889 pLabelText->SetTextColor(COLOR_POPUP_TEXT);
1890 pLabelText->SetTextConfig(FONT_SIZE_POPUP_TEXT, LABEL_TEXT_STYLE_BOLD);
1891 pLabelText->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
1893 __pInvalidFilePopup->AddControl(pLabelText);
1895 Button* pButtonClose = new (std::nothrow) Button();
1896 pButtonClose->Construct(Rectangle((clientBounds.width - W_POPUP_BUTTON) / 2, pLabelText->GetY() + pLabelText->GetHeight(), W_POPUP_BUTTON, H_POPUP_BUTTON));
1897 pButtonClose->SetText(ResourceManager::GetString("IDS_COM_SK_OK"));
1898 pButtonClose->SetActionId(IDA_INVALID_FILE_POPUP_CLOSE);
1899 pButtonClose->AddActionEventListener(*this);
1901 __pInvalidFilePopup->AddControl(pButtonClose);
1903 __pInvalidFilePopup->Show();
1907 ContactDetailsForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
1909 __pPresentationModel->SetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER, L"", index);
1910 __pPresentationModel->AddAddressBook();
1911 InitializeDetailItemList();
1912 __pTableView->UpdateTableView();
1914 HideDefaultSelectorPopup();
1918 ContactDetailsForm::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
1923 ContactDetailsForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
1928 ContactDetailsForm::OnForeground(void)
1930 if (IsEnabled() == false)
1936 Footer* pFooter = GetFooter();
1937 pFooter->SetEnabled(true);
1939 delete __pAppControl;
1940 __pAppControl = null;
1942 __isAppControlLaunching = false;
1946 ContactDetailsForm::OnBackground(void)