2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
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";
72 static const wchar_t* IDB_MORE_NORMAL = L"00_icon_more.png";
73 static const wchar_t* IDB_MORE_PRESSED = L"00_icon_more_press.png";
75 static const wchar_t* FAVORITE_LABEL = L"FavoriteLabel";
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;
133 static const int FONT_SIZE_NAME = 56;
134 static const int FONT_SIZE_SUB_INFO = 32;
135 static const int FONT_SIZE_MAIN_TEXT = 44;
136 static const int FONT_SIZE_SUB_TEXT = 32;
137 static const int FONT_SIZE_POPUP_TEXT = 38;
139 static const wchar_t* INPUT_KEY_CALL_TYPE = L"http://tizen.org/appcontrol/data/call/type";
140 static const wchar_t* INPUT_KEY_MESSAGE_TYPE = L"http://tizen.org/appcontrol/data/message/type";
141 static const wchar_t* INPUT_KEY_MESSAGE_TO = L"http://tizen.org/appcontrol/data/to";
142 static const wchar_t* INPUT_KEY_SELECTION_MODE = L"http://tizen.org/appcontrol/data/selection_mode";
143 static const wchar_t* INPUT_DATA_SELECTION_MODE_SINGLE = L"single";
144 static const wchar_t* INPUT_MIME_TYPE_AUDIO = L"audio/*";
145 static const wchar_t* INPUT_URI_TEL = L"tel:";
146 static const wchar_t* INPUT_TYPE_VIDEO = L"video";
147 static const wchar_t* INPUT_TYPE_VOICE = L"voice";
148 static const wchar_t* INPUT_TYPE_SMS = L"sms";
149 static const wchar_t* INPUT_TYPE_MMS = L"mms";
150 static const wchar_t* OUTPUT_KEY_SELECTED = L"http://tizen.org/appcontrol/data/selected";
151 static const wchar_t* KEY_VIEW_TYPE = L"viewType";
152 static const wchar_t* KEY_VIEW_TYPE_VCF = L"path";
153 static const wchar_t* KEY_VIEW_TYPE_CONTACT_ID = L"contactId";
154 static const wchar_t* VALUE_VIEW_TYPE_VCF = L"vcf";
155 static const wchar_t* VALUE_VIEW_TYPE_CONTACT = L"contact";
157 ContactDetailsForm::ContactDetailsForm(void)
158 : __pAppControl(null)
160 , __pContextMenuCall(null)
161 , __pContextMenuShare(null)
162 , __pContextMenuMore(null)
163 , __pDefaultSelectorPopup(null)
164 , __pInvalidFilePopup(null)
166 , __pPresentationModel(null)
167 , __scrolledDistance(0)
171 ContactDetailsForm::~ContactDetailsForm(void)
176 ContactDetailsForm::Initialize(void)
178 Construct(L"IDL_CONTACT_DETAILS_FORM");
182 ContactDetailsForm::OnInitializing(void)
184 Footer* pFooter = GetFooter();
185 pFooter->AddActionEventListener(*this);
186 SetFormBackEventListener(this);
188 __pTableView = new (std::nothrow) TableView();
189 __pTableView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), true, TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT);
190 __pTableView->SetItemProvider(this);
191 __pTableView->AddTableViewItemEventListener(*this);
192 __pTableView->SetBackgroundColor(COLOR_TABLE_BG);
193 __pTableView->AddTouchEventListener(*this);
194 __pTableView->AddScrollEventListener(*this);
195 AddControl(*__pTableView);
197 __pContextMenuCall = new (std::nothrow) ContextMenu();
198 __pContextMenuCall->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
199 __pContextMenuCall->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_CALL"), IDA_VOICE_CALL);
200 __pContextMenuCall->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"), IDA_MESSAGE);
201 #if __SUPPORT_VIDEO_CALL
202 __pContextMenuCall->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_VIDEO_CALL"), IDA_VIDEO_CALL);
204 __pContextMenuCall->AddActionEventListener(*this);
206 __pContextMenuShare = new (std::nothrow) ContextMenu();
207 __pContextMenuShare->Construct(Point(0, 0), CONTEXT_MENU_STYLE_LIST);
208 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), IDA_CONTEXTMENU_SHARE_EMAIL);
209 __pContextMenuShare->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"), IDA_CONTEXTMENU_SHARE_MESSAGE);
210 __pContextMenuShare->AddActionEventListener(*this);
212 __pContextMenuMore = new (std::nothrow) ContextMenu();
213 __pContextMenuMore->Construct(Point(X_MORE, GetClientAreaBounds().y + GetClientAreaBounds().height), CONTEXT_MENU_STYLE_LIST);
214 __pContextMenuMore->AddItem(ResourceManager::GetString(L"IDS_PB_BODY_MARK_AS_DEFAULT_NUMBER"), IDA_MORE_DEFAULT_NUMBER);
215 __pContextMenuMore->AddActionEventListener(*this);
217 __pItemList = new (std::nothrow) ArrayListT<int>();
218 __pItemList->Construct();
220 __pPresentationModel = new (std::nothrow) ContactPresentationModel();
221 __pPresentationModel->Construct();
222 __pPresentationModel->AddContactChangeListener(*this);
228 ContactDetailsForm::OnTerminating(void)
230 delete __pAppControl;
231 delete __pContextMenuCall;
232 delete __pContextMenuShare;
233 delete __pContextMenuMore;
235 if (__pItemList != null)
237 __pItemList->RemoveAll();
241 if (__pPresentationModel != null)
243 __pPresentationModel->RemoveContactChangeListener(*this);
244 delete __pPresentationModel;
247 delete __pDefaultSelectorPopup;
248 delete __pInvalidFilePopup;
254 ContactDetailsForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
256 AppLog("ContactDetailsForm::OnActionPerformed(), actionId %d", actionId);
258 result r = E_SUCCESS;
259 SceneManager* pSceneManager = SceneManager::GetInstance();
263 case IDA_FOOTER_EDIT:
265 ArrayList* pList = new (std::nothrow) ArrayList();
267 pList->Add(*(new (std::nothrow) Integer(__pPresentationModel->GetContactId())));
268 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
269 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go forward", GetErrorMessage(r));
272 case IDA_FOOTER_DELETE:
275 MessageBox deleteMessageBox;
276 deleteMessageBox.Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"), MSGBOX_STYLE_YESNO);
277 deleteMessageBox.ShowAndWait(modalResult);
279 if (modalResult == MSGBOX_RESULT_YES)
281 r = __pPresentationModel->RemoveContact();
282 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to remove contact", GetErrorMessage(r));
286 case IDA_FOOTER_MORE:
288 __pContextMenuMore->SetShowState(true);
289 __pContextMenuMore->Show();
294 ArrayList* pList = new (std::nothrow) ArrayList();
296 pList->Add(*(new (std::nothrow) Integer(INVALID_RECORD_ID)));
297 pList->Add(*(new (std::nothrow) String(__pPresentationModel->GetVcfPath())));
298 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
299 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go forward", GetErrorMessage(r));
302 case IDA_MORE_DEFAULT_NUMBER:
304 ShowDefaultSelectorPopup();
307 case IDA_BUTTON_RINGTONE_CLEAR:
309 __pPresentationModel->SetValue(DETAIL_PROPERTY_RINGTONE, String());
310 __pPresentationModel->UpdateContact();
311 __pTableView->RefreshItem(__pItemList->GetCount() - 1, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
316 r = LaunchAppControl(PROVIDER_ID_PHONE, OPERATION_ID_CALL, INPUT_TYPE_VOICE, source.GetName());
317 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
322 r = LaunchAppControl(PROVIDER_ID_MESSAGE, OPERATION_ID_COMPOSE, INPUT_TYPE_SMS, source.GetName());
323 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
328 r = LaunchAppControl(PROVIDER_ID_PHONE, OPERATION_ID_CALL, INPUT_TYPE_VIDEO, source.GetName());
329 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
332 case IDA_CONTEXTMENU_SHARE_EMAIL:
334 r = LaunchAppControl(PROVIDER_ID_EMAIL, OPERATION_ID_COMPOSE);
335 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
338 case IDA_CONTEXTMENU_SHARE_MESSAGE:
340 r = LaunchAppControl(PROVIDER_ID_MESSAGE, OPERATION_ID_COMPOSE, INPUT_TYPE_MMS);
341 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
344 case IDA_BUTTON_SHARE_NAME_CARD:
347 itemPoint.x = GetClientAreaBounds().width / 2;
350 TableViewItem* pParent = static_cast<TableViewItem*>(source.GetParent());
353 itemPoint.y = GetClientAreaBounds().y + pParent->GetY() + source.GetY() - __scrolledDistance;
356 __pContextMenuShare->SetAnchorPosition(itemPoint);
357 __pContextMenuShare->SetShowState(true);
358 __pContextMenuShare->Show();
361 case IDA_POPUP_CLOSE:
363 HideDefaultSelectorPopup();
366 case IDA_INVALID_FILE_POPUP_CLOSE:
368 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
370 result r = AppControlProviderManager::GetInstance()->SendAppControlResult(pContactsApp->GetRequestId(), APP_CTRL_RESULT_FAILED, null);
371 AppLogDebug("[%s] The return result from SendAppControlResult().", GetErrorMessage(r));
373 UiApp::GetInstance()->Terminate();
382 ContactDetailsForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
384 if (__appControlViewType.IsEmpty() == false)
386 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
387 AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance();
389 result r = pAppManager->SendAppControlResult(pContactsApp->GetRequestId(), APP_CTRL_RESULT_CANCELED, null);
390 AppLogDebug("[%s] The return result from SendAppControlResult().", GetErrorMessage(r));
392 UiApp::GetInstance()->Terminate();
396 SceneManager* pSceneManager = SceneManager::GetInstance();
398 result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
399 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go backward", GetErrorMessage(r));
404 ContactDetailsForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, IList* pArgs)
406 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
407 TryReturnVoid(pContactsApp != null, "Unable to cast UiApp to ContactsApp");
409 pContactsApp->AddContactsAppChangeEventListener(*this);
411 if (previousSceneId == IDSCN_GROUP_SELECTOR || previousSceneId == IDSCN_GROUP_EDITOR)
418 Integer* pArgument = null;
419 __pPresentationModel->RemoveContactFromAllCategories();
420 IEnumerator* pEnum = pArgs->GetEnumeratorN();
421 while (pEnum->MoveNext() == E_SUCCESS)
423 pArgument = static_cast<Integer*>(pEnum->GetCurrent());
424 if (pArgument != null)
426 __pPresentationModel->AddContactToCategory(pArgument->ToInt());
431 __pTableView->RefreshItem(__pItemList->GetCount() - 2, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
433 else if (previousSceneId == IDSCN_CONTACT_EDITOR && __appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == false)
435 InitializeDetailItemList();
436 __pTableView->UpdateTableView();
445 if (pContactsApp->GetOperationId() == OPERATION_ID_VIEW)
447 __pPresentationModel->RemoveContactChangeListener(*this);
449 result r = InitializeAppControl(pArgs);
453 pArgs->RemoveAll(true);
455 AppLogDebug("Unable to initialize appcontrol");
457 ShowInvalidFilePopup();
462 InitializeDetailItemList();
466 Integer* pContactId = static_cast<Integer*>(pArgs->GetAt(0));
467 if (pContactId != null)
469 __pPresentationModel->SetContactId(pContactId->ToInt());
470 InitializeDetailItemList();
473 __pTableView->UpdateTableView();
478 pArgs->RemoveAll(true);
484 ContactDetailsForm::InitializeAppControl(Tizen::Base::Collection::IList* pArgs)
491 result r = E_SUCCESS;
493 String* pArgStringType = null;
494 String* pArgStringValue = null;
497 String valueViewType;
500 pArgStringType = static_cast<String*>(pArgs->GetAt(0));
501 pArgStringValue = static_cast<String*>(pArgs->GetAt(1));
503 TryReturn(pArgStringType != null && pArgStringValue != null, E_FAILURE, "[E_FAILURE] Unable to initialize appcontrol");
505 ParseAppControlArgument(*pArgStringType, keyViewType, valueViewType);
506 ParseAppControlArgument(*pArgStringValue, keyValue, value);
508 if (keyViewType.Equals(KEY_VIEW_TYPE, false))
510 if (valueViewType.Equals(VALUE_VIEW_TYPE_CONTACT, false))
512 if (keyValue.Equals(KEY_VIEW_TYPE_CONTACT_ID, false))
515 Integer::Parse(value, contactId);
516 r = __pPresentationModel->SetContactId(contactId);
517 __appControlViewType = valueViewType;
519 Footer* pFooter = GetFooter();
520 pFooter->RemoveAllItems();
522 FooterItem footerItemEdit;
523 footerItemEdit.Construct(IDA_FOOTER_EDIT);
524 footerItemEdit.SetText(ResourceManager::GetString(L"IDS_COM_SK_EDIT"));
525 pFooter->AddItem(footerItemEdit);
527 FooterItem footerItemDelete;
528 footerItemDelete.Construct(IDA_FOOTER_DELETE);
529 footerItemDelete.SetText(ResourceManager::GetString(L"IDS_COM_SK_DELETE"));
530 pFooter->AddItem(footerItemDelete);
532 __pPresentationModel->AddContactChangeListener(*this);
536 AppLogDebug("Invalid KEY(contactId) of AppControl[VIEW]. [%ls] has been input", keyValue.GetPointer());
540 else if (valueViewType.Equals(VALUE_VIEW_TYPE_VCF, false))
542 if (keyValue.Equals(KEY_VIEW_TYPE_VCF, false))
544 r = __pPresentationModel->SetVcfPath(value);
546 __appControlViewType = valueViewType;
547 Footer* pFooter = GetFooter();
548 pFooter->RemoveAllItems();
549 pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
551 FooterItem footerItemAdd;
552 footerItemAdd.Construct(IDA_FOOTER_ADD);
553 footerItemAdd.SetText(ResourceManager::GetString(L"IDS_COM_OPT_ADD_TO_CONTACTS"));
554 pFooter->AddItem(footerItemAdd);
558 AppLogDebug("Invalid KEY(path) of AppControl[VIEW]. [%ls] has been input", keyValue.GetPointer());
564 AppLogDebug("viewType of AppControl[VIEW] should be either vcf or contact. [%ls] has been inpue", keyValue.GetPointer());
570 AppLogDebug("Invalid KEY(viewType) of AppControl[VIEW]. [%ls] has been input", keyViewType.GetPointer());
578 ContactDetailsForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
580 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
581 pContactsApp->RemoveContactsAppChangeEventListener(*this);
583 delete __pAppControl;
584 __pAppControl = null;
588 ContactDetailsForm::InitializeDetailItemList(void)
590 if (__pItemList->GetCount() > 0)
592 __pItemList->RemoveAll();
596 __pItemList->Add(DETAIL_PROPERTY_MAIN_INFO);
598 // Other Phone Numbers
599 Footer* pFooter = GetFooter();
600 pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
601 int otherNumberCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER);
602 if (otherNumberCount > 1)
604 ButtonItem footerItemMore;
605 footerItemMore.Construct(BUTTON_ITEM_STYLE_ICON, IDA_FOOTER_MORE);
606 footerItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL, ResourceManager::GetBitmapN(IDB_MORE_NORMAL));
607 footerItemMore.SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED, ResourceManager::GetBitmapN(IDB_MORE_PRESSED));
609 if (__appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == false)
611 pFooter->SetButton(BUTTON_POSITION_LEFT, footerItemMore);
614 for (int subIndex = 0; subIndex < otherNumberCount; subIndex++)
616 if (__pPresentationModel->GetDefaultNumberIndex() != subIndex)
618 __pItemList->Add(DETAIL_PROPERTY_PHONE_NUMBER + subIndex);
623 if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_EMAIL) > 0)
625 __pItemList->Add(DETAIL_PROPERTY_EMAIL);
628 if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_ADDRESS) > 0)
630 __pItemList->Add(DETAIL_PROPERTY_ADDRESS);
633 if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_IM_ADDRESS) > 0)
635 __pItemList->Add(DETAIL_PROPERTY_IM_ADDRESS);
638 if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_URL) > 0)
640 __pItemList->Add(DETAIL_PROPERTY_URL);
643 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_BIRTHDAY).IsEmpty() == false)
645 __pItemList->Add(DETAIL_PROPERTY_BIRTHDAY);
648 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_NOTE).IsEmpty() == false)
650 __pItemList->Add(DETAIL_PROPERTY_NOTE);
653 __pItemList->Add(DETAIL_PROPERTY_GROUP);
654 __pItemList->Add(DETAIL_PROPERTY_RINGTONE);
658 ContactDetailsForm::GetItemCount(void)
660 return __pItemList->GetCount();
663 Tizen::Ui::Controls::TableViewItem*
664 ContactDetailsForm::CreateItem(int itemIndex, int itemWidth)
666 TableViewItem* pItem = new (std::nothrow) TableViewItem();
668 int contentItemIndex = -1;
669 int itemSubIndex = -1;
670 __pItemList->GetAt(itemIndex, contentItemIndex);
672 switch (contentItemIndex & SUB_INDEX_MASK)
674 case DETAIL_PROPERTY_PHONE_NUMBER:
676 itemSubIndex = contentItemIndex - DETAIL_PROPERTY_PHONE_NUMBER;
677 contentItemIndex = DETAIL_PROPERTY_PHONE_NUMBER;
680 case DETAIL_PROPERTY_EMAIL:
682 contentItemIndex = DETAIL_PROPERTY_EMAIL;
685 case DETAIL_PROPERTY_IM_ADDRESS:
687 contentItemIndex = DETAIL_PROPERTY_IM_ADDRESS;
690 case DETAIL_PROPERTY_ADDRESS:
692 contentItemIndex = DETAIL_PROPERTY_ADDRESS;
695 case DETAIL_PROPERTY_URL:
697 contentItemIndex = DETAIL_PROPERTY_URL;
704 switch (contentItemIndex)
706 case DETAIL_PROPERTY_MAIN_INFO:
708 AddMainInfo(itemWidth, pItem);
711 case DETAIL_PROPERTY_PHONE_NUMBER: // fall through
712 case DETAIL_PROPERTY_EMAIL: // fall through
713 case DETAIL_PROPERTY_ADDRESS: // fall through
714 case DETAIL_PROPERTY_URL: // fall through
715 case DETAIL_PROPERTY_BIRTHDAY: // fall through
716 case DETAIL_PROPERTY_NOTE:
717 case DETAIL_PROPERTY_IM_ADDRESS:
719 AddProperty(itemWidth, pItem, contentItemIndex, itemSubIndex);
722 case DETAIL_PROPERTY_GROUP:
724 AddGroup(itemWidth, pItem);
727 case DETAIL_PROPERTY_RINGTONE:
729 AddRingTone(itemWidth, pItem);
744 ContactDetailsForm::DeleteItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
751 ContactDetailsForm::UpdateItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
753 int contentItemIndex = -1;
754 __pItemList->GetAt(itemIndex, contentItemIndex);
758 if (contentItemIndex == DETAIL_PROPERTY_GROUP)
760 value = __pPresentationModel->GetValue(DETAIL_PROPERTY_GROUP);
764 value = ResourceManager::GetString(L"IDS_PB_BODY_NOT_ASSIGNED");
767 else if (contentItemIndex == DETAIL_PROPERTY_RINGTONE)
769 String path = __pPresentationModel->GetValue(DETAIL_PROPERTY_RINGTONE);
771 path.LastIndexOf(L"/", path.GetLength() - 1, index);
775 path.SubString(index + 1, value);
779 Label* pValueLabel = static_cast<Label*>(pItem->GetControl(2));
780 if (pValueLabel == null)
785 pValueLabel->SetText(value);
786 pValueLabel->Invalidate(false);
790 ContactDetailsForm::GetDefaultItemHeight(void)
796 ContactDetailsForm::AddMainInfo(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem)
798 int itemHeight = Y_THUMBNAIL;
800 Label* pThumbnailLabel = null;
802 String thumbnailPath = __pPresentationModel->GetValue(DETAIL_PROPERTY_THUMBNAIL);
803 Bitmap* pThumbnail = null;
804 ImageBuffer thumbnailImageBuffer;
805 result r = thumbnailImageBuffer.Construct(thumbnailPath);
808 pThumbnail = thumbnailImageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_ARGB8888, BUFFER_SCALING_NONE);
810 if (pThumbnail != null)
812 pThumbnail->SetScalingQuality(BITMAP_SCALING_QUALITY_HIGH);
813 pThumbnail->Scale(Dimension(H_THUMBNAIL, H_THUMBNAIL));
814 pThumbnailLabel = new (std::nothrow) Label();
815 pThumbnailLabel->Construct(Rectangle((itemWidth - H_THUMBNAIL) / 2, Y_THUMBNAIL, H_THUMBNAIL, H_THUMBNAIL), L"");
816 pThumbnailLabel->SetBackgroundBitmap(*pThumbnail);
819 itemHeight += (H_THUMBNAIL + Y_THUMBNAIL);
822 String firstName = __pPresentationModel->GetValue(DETAIL_PROPERTY_FIRST_NAME);
823 String middleName = __pPresentationModel->GetValue(DETAIL_PROPERTY_MIDDLE_NAME);
824 String lastName = __pPresentationModel->GetValue(DETAIL_PROPERTY_LAST_NAME);
825 String nickName = __pPresentationModel->GetValue(DETAIL_PROPERTY_NICK_NAME);
826 String suffix = __pPresentationModel->GetValue(DETAIL_PROPERTY_NAME_SUFFIX);
827 String jobTitle = __pPresentationModel->GetValue(DETAIL_PROPERTY_JOB_TITLE);
828 String company = __pPresentationModel->GetValue(DETAIL_PROPERTY_COMPANY);
829 String department = __pPresentationModel->GetValue(DETAIL_PROPERTY_DEPARTMENT);
832 if (firstName.IsEmpty() == false)
834 name = firstName + CHARACTER_SPACE;
836 if (middleName.IsEmpty() == false)
838 name += (middleName + CHARACTER_SPACE);
840 if (lastName.IsEmpty() == false)
847 if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER))
849 name.Append(__pPresentationModel->GetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER));
853 name.Append(__pPresentationModel->GetValue(DETAIL_PROPERTY_EMAIL, 0));
857 String suffixNickName;
858 if (suffix.IsEmpty() == false)
860 suffixNickName = suffix + CHARACTER_SPACE;
862 if (nickName.IsEmpty() == false)
864 suffixNickName += nickName;
868 if (jobTitle.IsEmpty() == false)
870 companyInfo = jobTitle + CHARACTER_SPACE;
872 if (company.IsEmpty() == false)
874 companyInfo += company + CHARACTER_SPACE;
876 if (department.IsEmpty() == false)
878 companyInfo += department;
881 Label* pNameLabel = null;
882 Label* pFavoriteLabel = null;
883 if (name.IsEmpty() == false)
885 pNameLabel = new (std::nothrow) Label();
886 pNameLabel->Construct(Rectangle(X_MAIN_INFO, itemHeight, itemWidth - (X_MAIN_INFO + H_FAVORITE + W_FAVORITE_GAP * 2), H_NAME), name);
887 pNameLabel->SetTextConfig(FONT_SIZE_NAME, LABEL_TEXT_STYLE_BOLD);
888 pNameLabel->SetTextColor(COLOR_NAME);
889 pNameLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
890 pNameLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
892 if (__appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == false)
894 pFavoriteLabel = new (std::nothrow) Label();
895 pFavoriteLabel->Construct(Rectangle(itemWidth - (H_FAVORITE + W_FAVORITE_GAP * 2), itemHeight + Y_FAVORITE, H_FAVORITE, H_FAVORITE), L"");
896 pFavoriteLabel->SetName(FAVORITE_LABEL);
897 pFavoriteLabel->AddTouchEventListener(*this);
899 Bitmap* pBitmap = null;
900 if (__pPresentationModel->IsFavorite())
902 pBitmap = ResourceManager::GetBitmapN(IDB_DETAILS_FAVORITE_ON);
906 pBitmap = ResourceManager::GetBitmapN(IDB_DETAILS_FAVORITE_OFF);
911 pFavoriteLabel->SetBackgroundBitmap(*pBitmap);
916 itemHeight += H_NAME;
919 Label* pSuffixNickNameLabel = null;
920 if (suffixNickName.IsEmpty() == false)
922 pSuffixNickNameLabel = new (std::nothrow) Label();
923 pSuffixNickNameLabel->Construct(Rectangle(X_MAIN_INFO, itemHeight, itemWidth - X_MAIN_INFO, H_SUB_INFO), suffixNickName);
924 pSuffixNickNameLabel->SetTextConfig(FONT_SIZE_SUB_INFO, LABEL_TEXT_STYLE_NORMAL);
925 pSuffixNickNameLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
926 pSuffixNickNameLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
927 itemHeight += (H_SUB_INFO + H_SUB_INFO_DIVIDER);
930 Label* pCompanyInfoLabel = null;
931 if (companyInfo.IsEmpty() == false)
933 pCompanyInfoLabel = new (std::nothrow) Label();
934 pCompanyInfoLabel->Construct(Rectangle(X_MAIN_INFO, itemHeight, itemWidth - X_MAIN_INFO, H_SUB_INFO), companyInfo);
935 pCompanyInfoLabel->SetTextConfig(FONT_SIZE_SUB_INFO, LABEL_TEXT_STYLE_NORMAL);
936 pCompanyInfoLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
937 pCompanyInfoLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
938 itemHeight += (H_SUB_INFO + H_SUB_INFO_DIVIDER);
941 Label* pDefaultNumberLabel = null;
942 Button* pCallButton = null;
943 Button* pMessageButton = null;
944 #if __SUPPORT_VIDEO_CALL
945 Button* pVideoCallButton = null;
948 String defaultPhoneNumber = __pPresentationModel->GetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER);
949 if (defaultPhoneNumber.IsEmpty() == false)
951 pDefaultNumberLabel = new (std::nothrow) Label();
952 pDefaultNumberLabel->Construct(Rectangle(X_MAIN_INFO, itemHeight, itemWidth - X_MAIN_INFO, H_DEFAULT_NUMBER), defaultPhoneNumber);
953 pDefaultNumberLabel->SetTextConfig(FONT_SIZE_MAIN_TEXT, LABEL_TEXT_STYLE_BOLD);
954 pDefaultNumberLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
955 pDefaultNumberLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
956 itemHeight += (H_DEFAULT_NUMBER + H_QUICK_BUTTON_DIVIDER);
958 Bitmap* pBgNormal = ResourceManager::GetBitmapN(IDB_CIRCLE_BUTTON_NORMAL);
959 Bitmap* pBgPressed = ResourceManager::GetBitmapN(IDB_CIRCLE_BUTTON_PRESSED);
960 Bitmap* pCallNormal = ResourceManager::GetBitmapN(IDB_CALL_NORMAL);
961 Bitmap* pCallPressed = ResourceManager::GetBitmapN(IDB_CALL_PRESSED);
962 Bitmap* pMessageNormal = ResourceManager::GetBitmapN(IDB_SMS_NORMAL);
963 Bitmap* pMessagePressed = ResourceManager::GetBitmapN(IDB_SMS_PRESSED);
964 Bitmap* pVideoCallNormal = ResourceManager::GetBitmapN(IDB_VIDEO_CALL_NORMAL);
965 Bitmap* pVideoCallPressed = ResourceManager::GetBitmapN(IDB_VIDEO_CALL_PRESSED);
967 pCallButton = new (std::nothrow) Button();
968 pCallButton->Construct(Rectangle(X_QUICK_BUTTON, itemHeight, H_QUICK_BUTTON, H_QUICK_BUTTON));
969 pCallButton->SetActionId(IDA_VOICE_CALL);
970 pCallButton->AddActionEventListener(*this);
971 if (pBgNormal != null)
973 pCallButton->SetNormalBackgroundBitmap(*pBgNormal);
975 if (pBgPressed != null)
977 pCallButton->SetPressedBackgroundBitmap(*pBgPressed);
979 if (pCallNormal != null)
981 pCallButton->SetNormalBitmap(Point(0, 0), *pCallNormal);
983 if (pCallPressed != null)
985 pCallButton->SetPressedBitmap(Point(0, 0), *pCallPressed);
988 pMessageButton = new (std::nothrow) Button();
989 pMessageButton->Construct(Rectangle((X_QUICK_BUTTON + H_QUICK_BUTTON + W_QUICK_BUTTON_GAP), itemHeight, H_QUICK_BUTTON, H_QUICK_BUTTON));
990 pMessageButton->SetActionId(IDA_MESSAGE);
991 pMessageButton->AddActionEventListener(*this);
992 if (pBgNormal != null)
994 pMessageButton->SetNormalBackgroundBitmap(*pBgNormal);
996 if (pBgPressed != null)
998 pMessageButton->SetPressedBackgroundBitmap(*pBgPressed);
1000 if (pMessageNormal != null)
1002 pMessageButton->SetNormalBitmap(Point(0, 0), *pMessageNormal);
1004 if (pMessagePressed != null)
1006 pMessageButton->SetPressedBitmap(Point(0, 0), *pMessagePressed);
1008 #if __SUPPORT_VIDEO_CALL
1009 pVideoCallButton = new (std::nothrow) Button();
1010 pVideoCallButton->Construct(Rectangle((X_QUICK_BUTTON + (H_QUICK_BUTTON * 2) + (W_QUICK_BUTTON_GAP * 2)), itemHeight, H_QUICK_BUTTON, H_QUICK_BUTTON));
1011 pVideoCallButton->SetActionId(IDA_VIDEO_CALL);
1012 pVideoCallButton->AddActionEventListener(*this);
1013 if (pBgNormal != null)
1015 pVideoCallButton->SetNormalBackgroundBitmap(*pBgNormal);
1017 if (pBgPressed != null)
1019 pVideoCallButton->SetPressedBackgroundBitmap(*pBgPressed);
1021 if (pVideoCallNormal != null)
1023 pVideoCallButton->SetNormalBitmap(Point(0, 0), *pVideoCallNormal);
1025 if (pVideoCallPressed != null)
1027 pVideoCallButton->SetPressedBitmap(Point(0, 0), *pVideoCallPressed);
1034 delete pCallPressed;
1035 delete pMessageNormal;
1036 delete pMessagePressed;
1037 delete pVideoCallNormal;
1038 delete pVideoCallPressed;
1040 itemHeight += (H_QUICK_BUTTON + H_QUICK_BUTTON_DIVIDER);
1044 itemHeight += H_QUICK_BUTTON_DIVIDER;
1047 pItem->Construct(Dimension(itemWidth, itemHeight));
1048 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1049 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1051 if (pThumbnailLabel != null)
1053 pItem->AddControl(*pThumbnailLabel);
1055 if (pNameLabel != null)
1057 pItem->AddControl(*pNameLabel);
1059 if (pFavoriteLabel != null)
1061 pItem->AddControl(*pFavoriteLabel);
1063 if (pSuffixNickNameLabel != null)
1065 pItem->AddControl(*pSuffixNickNameLabel);
1067 if (pCompanyInfoLabel != null)
1069 pItem->AddControl(*pCompanyInfoLabel);
1071 if (pDefaultNumberLabel != null)
1073 pItem->AddControl(*pDefaultNumberLabel);
1075 #if __SUPPORT_VIDEO_CALL
1076 if (pCallButton != null && pMessageButton != null && pVideoCallButton != null)
1078 pItem->AddControl(*pCallButton);
1079 pItem->AddControl(*pMessageButton);
1080 pItem->AddControl(*pVideoCallButton);
1083 if (pCallButton != null && pMessageButton != null)
1085 pItem->AddControl(*pCallButton);
1086 pItem->AddControl(*pMessageButton);
1092 ContactDetailsForm::AddProperty(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem, int detailProperty, int itemSubIndex)
1098 int itemHeight = H_ITEM_DOUBLE_LINE;
1099 int valueCount = __pPresentationModel->GetMultiValuesCount(static_cast<DetailProperty>(detailProperty));
1101 if (detailProperty != DETAIL_PROPERTY_PHONE_NUMBER && valueCount > 1)
1103 pItem->Construct(Dimension(itemWidth, H_ITEM_DOUBLE_LINE + (H_ADDITIONAL_ITEM * (valueCount - 1))), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1104 CreateTitleValueTypeItem(itemWidth, pItem, detailProperty);
1109 switch (detailProperty)
1111 case DETAIL_PROPERTY_PHONE_NUMBER:
1113 type = __pPresentationModel->GetType(DETAIL_PROPERTY_PHONE_NUMBER, itemSubIndex);
1114 value = __pPresentationModel->GetValue(DETAIL_PROPERTY_PHONE_NUMBER, itemSubIndex);
1116 pItem->Construct(Dimension(itemWidth, H_ITEM), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1117 pItem->SetName(value);
1119 CreateValueTypeItem(itemWidth, pItem, value, type);
1124 case DETAIL_PROPERTY_EMAIL:
1126 title = ResourceManager::GetString(L"IDS_COM_BODY_EMAIL");
1127 type = __pPresentationModel->GetType(static_cast<DetailProperty>(detailProperty), 0);
1128 value = __pPresentationModel->GetValue(static_cast<DetailProperty>(detailProperty), 0);
1131 case DETAIL_PROPERTY_ADDRESS:
1133 title = ResourceManager::GetString(L"IDS_PB_BODY_ADDRESS");
1134 type = __pPresentationModel->GetType(static_cast<DetailProperty>(detailProperty), 0);
1135 value = __pPresentationModel->GetValue(static_cast<DetailProperty>(detailProperty), 0);
1138 case DETAIL_PROPERTY_IM_ADDRESS:
1140 title = ResourceManager::GetString(L"IDS_PB_HEADER_INSTANT_MESSENGER_ABB");
1141 type = __pPresentationModel->GetType(static_cast<DetailProperty>(detailProperty), 0);
1142 value = __pPresentationModel->GetValue(static_cast<DetailProperty>(detailProperty), 0);
1145 case DETAIL_PROPERTY_URL:
1147 title = ResourceManager::GetString(L"IDS_PB_BODY_URL");
1148 type = __pPresentationModel->GetType(static_cast<DetailProperty>(detailProperty), 0);
1149 value = __pPresentationModel->GetValue(static_cast<DetailProperty>(detailProperty), 0);
1152 case DETAIL_PROPERTY_BIRTHDAY:
1154 title = ResourceManager::GetString(L"IDS_PB_BODY_BIRTHDAY");
1155 value = __pPresentationModel->GetValue(DETAIL_PROPERTY_BIRTHDAY);
1158 case DETAIL_PROPERTY_NOTE:
1160 pItem->Construct(Dimension(itemWidth, itemHeight), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1161 CreateNoteItem(itemWidth, pItem);
1170 pItem->Construct(Dimension(itemWidth, itemHeight), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1171 CreateTitleValueTypeItem(itemWidth, pItem, title, value, type, lineCount);
1175 ContactDetailsForm::AddGroup(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem)
1177 pItem->Construct(Dimension(itemWidth, H_ITEM_DOUBLE_LINE), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1178 pItem->SetName(Integer::ToString(DETAIL_PROPERTY_GROUP));
1180 String title = ResourceManager::GetString(L"IDS_PB_BODY_GROUPS");
1181 String value = __pPresentationModel->GetValue(DETAIL_PROPERTY_GROUP);
1183 if (value.IsEmpty())
1185 value = ResourceManager::GetString(L"IDS_PB_BODY_NOT_ASSIGNED");
1188 AddGroupStylePanel(itemWidth, pItem, GROUP_STYLE_TOP);
1190 CreateTitleValueTypeItem(itemWidth, pItem, title, value);
1194 ContactDetailsForm::AddRingTone(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem)
1196 pItem->Construct(Dimension(itemWidth, H_ITEM_DOUBLE_LINE), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1197 pItem->SetName(Integer::ToString(DETAIL_PROPERTY_RINGTONE));
1199 String title = ResourceManager::GetString(L"IDS_PB_BODY_RINGTONE");
1200 String value = __pPresentationModel->GetValue(DETAIL_PROPERTY_RINGTONE);
1204 value.LastIndexOf(L"/", value.GetLength() - 1, index);
1208 value.SubString(index + 1, trimmedPath);
1211 AddGroupStylePanel(itemWidth, pItem, GROUP_STYLE_BOTTOM);
1213 CreateTitleValueTypeItem(itemWidth, pItem, title, trimmedPath);
1215 if (__appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == false)
1217 Button* pClearButton = new (std::nothrow) Button();
1218 pClearButton->Construct(Rectangle(itemWidth - H_ICON - W_TEXT_MARGIN, (H_ITEM_DOUBLE_LINE - H_ICON) / 2, H_ICON, H_ICON));
1219 pClearButton->SetActionId(IDA_BUTTON_RINGTONE_CLEAR);
1220 pClearButton->AddActionEventListener(*this);
1222 Bitmap* pReset = ResourceManager::GetBitmapN(IDB_DETAILS_RESET_NORMAL);
1225 pClearButton->SetNormalBitmap(Point(0, 0), *pReset);
1228 pReset = ResourceManager::GetBitmapN(IDB_DETAILS_RESET_PRESSED);
1231 pClearButton->SetPressedBitmap(Point(0, 0), *pReset);
1235 pItem->AddControl(*pClearButton);
1236 pItem->SetIndividualSelectionEnabled(pClearButton, true);
1241 ContactDetailsForm::AddShareButtons(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem)
1243 pItem->Construct(Dimension(itemWidth, H_BUTTON_CONTAINER));
1245 int buttonWidth = itemWidth - W_BUTTON_GAP * 2;
1247 Button* pSendNameButton = new (std::nothrow) Button();
1248 pSendNameButton->Construct(Rectangle(W_BUTTON_GAP, Y_BUTTON, buttonWidth, H_BUTTON), ResourceManager::GetString(L"IDS_PB_HEADER_SEND_NAMECARD"));
1249 pSendNameButton->SetActionId(IDA_BUTTON_SHARE_NAME_CARD);
1250 pSendNameButton->AddActionEventListener(*this);
1251 pItem->AddControl(*pSendNameButton);
1255 ContactDetailsForm::CreateValueTypeItem(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem, const Tizen::Base::String& value, const Tizen::Base::String& type)
1257 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1258 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1260 Label* pValueLabel = new (std::nothrow) Label();
1261 pValueLabel->Construct(Rectangle(W_TEXT_MARGIN, 0, itemWidth - W_TEXT_MARGIN * 2 - W_TYPE, H_ITEM), value);
1262 pValueLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1263 pValueLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1264 pValueLabel->SetTextConfig(FONT_SIZE_MAIN_TEXT, LABEL_TEXT_STYLE_NORMAL);
1265 pValueLabel->SetTextColor(COLOR_OTHER_NUMBER);
1266 pItem->AddControl(*pValueLabel);
1268 Label* pTypeLabel = new (std::nothrow) Label();
1269 pTypeLabel->Construct(Rectangle((itemWidth - W_TEXT_MARGIN - W_TYPE), 0, W_TYPE, H_ITEM), type);
1270 pTypeLabel->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
1271 pTypeLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1272 pTypeLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1273 pTypeLabel->SetTextColor(COLOR_ITEM_TYPE);
1274 pItem->AddControl(*pTypeLabel);
1278 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)
1280 int valueWidth = itemWidth - (W_TEXT_MARGIN * 2);
1282 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1283 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1285 Label* pTitleLabel = new (std::nothrow) Label();
1286 pTitleLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE, itemWidth - W_TEXT_MARGIN, H_ITEM_TITLE), title);
1287 pTitleLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1288 pTitleLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1289 pTitleLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1290 pTitleLabel->SetTextColor(COLOR_ITEM_TITLE);
1291 pItem->AddControl(*pTitleLabel);
1293 if (type.IsEmpty() == false)
1295 Label* pTypeLabel = new (std::nothrow) Label();
1296 pTypeLabel->Construct(Rectangle((itemWidth - W_TEXT_MARGIN - W_TYPE), Y_ITEM_TITLE + H_ITEM_TITLE, W_TYPE, H_ITEM_VALUE), 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);
1303 valueWidth = itemWidth - (W_TEXT_MARGIN * 2) - W_TYPE;
1305 else if (title.Equals(ResourceManager::GetString(L"IDS_PB_BODY_RINGTONE"), false))
1307 valueWidth = itemWidth - (W_TEXT_MARGIN * 2) - H_ICON;
1310 Label* pValueLabel = new (std::nothrow) Label();
1311 pValueLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE + H_ITEM_TITLE, valueWidth, H_ITEM_VALUE * lineCount), value);
1312 pValueLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1313 pValueLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1314 pValueLabel->SetTextConfig(FONT_SIZE_MAIN_TEXT, LABEL_TEXT_STYLE_NORMAL);
1315 pValueLabel->SetTextColor(COLOR_ITEM_VALUE);
1316 pItem->AddControl(*pValueLabel);
1320 ContactDetailsForm::CreateTitleValueTypeItem(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem, int detailProperty)
1324 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1325 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1327 switch (detailProperty)
1329 case DETAIL_PROPERTY_EMAIL:
1331 title = ResourceManager::GetString(L"IDS_COM_BODY_EMAIL");
1334 case DETAIL_PROPERTY_ADDRESS:
1336 title = ResourceManager::GetString(L"IDS_PB_BODY_ADDRESS");
1339 case DETAIL_PROPERTY_URL:
1341 title = ResourceManager::GetString(L"IDS_PB_BODY_URL");
1344 case DETAIL_PROPERTY_IM_ADDRESS:
1346 title = ResourceManager::GetString(L"IDS_PB_HEADER_INSTANT_MESSENGER_ABB");
1353 Label* pTitleLabel = new (std::nothrow) Label();
1354 pTitleLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE, itemWidth - W_TEXT_MARGIN, H_ITEM_TITLE), title);
1355 pTitleLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1356 pTitleLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1357 pTitleLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1358 pTitleLabel->SetTextColor(COLOR_ITEM_TITLE);
1359 pItem->AddControl(*pTitleLabel);
1361 for (int i = 0; i < __pPresentationModel->GetMultiValuesCount(static_cast<DetailProperty>(detailProperty)); i++)
1363 String type = __pPresentationModel->GetType(static_cast<DetailProperty>(detailProperty), i);
1364 String value = __pPresentationModel->GetValue(static_cast<DetailProperty>(detailProperty), i);
1366 int valueWidth = itemWidth - (W_TEXT_MARGIN * 2);
1367 if (type.IsEmpty() == false)
1369 Label* pTypeLabel = new (std::nothrow) Label();
1370 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);
1371 pTypeLabel->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
1372 pTypeLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1373 pTypeLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1374 pTypeLabel->SetTextColor(COLOR_ITEM_TYPE);
1375 pItem->AddControl(*pTypeLabel);
1377 valueWidth = itemWidth - (W_TEXT_MARGIN * 2) - W_TYPE;
1380 Label* pValueLabel = new (std::nothrow) Label();
1381 pValueLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE + H_ITEM_TITLE + (H_ADDITIONAL_ITEM * i), valueWidth, H_ITEM_VALUE), value);
1382 pValueLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1383 pValueLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1384 pValueLabel->SetTextConfig(FONT_SIZE_MAIN_TEXT, LABEL_TEXT_STYLE_NORMAL);
1385 pValueLabel->SetTextColor(COLOR_ITEM_VALUE);
1386 pItem->AddControl(*pValueLabel);
1391 ContactDetailsForm::CreateNoteItem(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem)
1393 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1394 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1396 String title = ResourceManager::GetString(L"IDS_PB_BODY_NOTE");
1397 String value = __pPresentationModel->GetValue(DETAIL_PROPERTY_NOTE);
1399 Label* pTitleLabel = new (std::nothrow) Label();
1400 pTitleLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE, itemWidth - W_TEXT_MARGIN, H_ITEM_TITLE), title);
1401 pTitleLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1402 pTitleLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1403 pTitleLabel->SetTextConfig(FONT_SIZE_SUB_TEXT, LABEL_TEXT_STYLE_BOLD);
1404 pTitleLabel->SetTextColor(COLOR_ITEM_TITLE);
1405 pItem->AddControl(*pTitleLabel);
1407 Label* pValueLabel = new (std::nothrow) Label();
1408 pValueLabel->Construct(Rectangle(W_TEXT_MARGIN, Y_ITEM_TITLE + H_ITEM_TITLE, itemWidth - (W_TEXT_MARGIN * 2), H_ITEM_VALUE), value);
1409 pValueLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1410 pValueLabel->SetTextVerticalAlignment(ALIGNMENT_TOP);
1411 pValueLabel->SetTextConfig(FONT_SIZE_MAIN_TEXT, LABEL_TEXT_STYLE_NORMAL);
1412 pValueLabel->SetTextColor(COLOR_ITEM_VALUE);
1413 pItem->AddControl(*pValueLabel);
1416 font.Construct(FONT_STYLE_PLAIN, FONT_SIZE_MAIN_TEXT);
1418 TextElement* pNameElement = new (std::nothrow) TextElement();
1419 pNameElement->Construct(value);
1420 pNameElement->SetFont(font);
1422 EnrichedText* pEnrichedText = new (std::nothrow) EnrichedText();
1423 pEnrichedText->Construct(Dimension(itemWidth - (W_TEXT_MARGIN * 2) - (pValueLabel->GetLeftMargin() * 2), H_ITEM_VALUE));
1424 pEnrichedText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
1425 pEnrichedText->SetTextAbbreviationEnabled(false);
1426 pEnrichedText->Add(*pNameElement);
1428 pValueLabel->SetSize(pValueLabel->GetWidth(), pEnrichedText->GetTotalLineHeight() + pValueLabel->GetTopMargin());
1429 pItem->SetSize(itemWidth, (Y_ITEM_TITLE * 2) + H_ITEM_TITLE + pEnrichedText->GetTotalLineHeight());
1431 pEnrichedText->RemoveAllTextElements(true);
1432 delete pEnrichedText;
1436 ContactDetailsForm::OnTableViewItemStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1438 SceneManager* pSceneManager = SceneManager::GetInstance();
1440 if (status == TABLE_VIEW_ITEM_STATUS_SELECTED)
1442 String itemName = pItem->GetName();
1444 if (itemName.Equals(Integer::ToString(DETAIL_PROPERTY_GROUP), true) == true)
1446 if (__appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == true)
1451 if (__pPresentationModel->GetCategoryCount() > 0)
1453 IList* pCategoryList = __pPresentationModel->GetAssignedCategoryIdListN();
1455 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_SELECTOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pCategoryList);
1459 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
1462 else if (itemName.Equals(Integer::ToString(DETAIL_PROPERTY_RINGTONE), true) == true)
1464 if (__appControlViewType.Equals(VALUE_VIEW_TYPE_VCF, false) == true)
1469 result r = LaunchAppControl(PROVIDER_ID_FILEMANAGER, OPERATION_ID_PICK);
1470 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to launch appcontrol", GetErrorMessage(r));
1472 else if (itemName.IsEmpty() == false)
1475 itemPoint.x = GetClientAreaBounds().width / 2;
1476 itemPoint.y = GetClientAreaBounds().y + pItem->GetY() + (pItem->GetHeight() / 2) - __scrolledDistance;
1478 __pContextMenuCall->SetName(itemName);
1479 __pContextMenuCall->SetAnchorPosition(itemPoint);
1480 __pContextMenuCall->SetShowState(true);
1481 __pContextMenuCall->Show();
1487 ContactDetailsForm::OnTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated)
1492 ContactDetailsForm::OnTableViewItemReordered(Tizen::Ui::Controls::TableView& tableView, int itemIndexFrom, int itemIndexTo)
1497 ContactDetailsForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo & touchInfo)
1502 ContactDetailsForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1504 if (source.GetName().Equals(FAVORITE_LABEL, true))
1506 Label* pLabel = static_cast<Label*>(&const_cast<Control&>(source));
1512 __pPresentationModel->SetAsFavorite(!__pPresentationModel->IsFavorite());
1514 Bitmap* pBitmap = null;
1515 if (__pPresentationModel->IsFavorite())
1517 pBitmap = ResourceManager::GetBitmapN(IDB_DETAILS_FAVORITE_ON);
1521 pBitmap = ResourceManager::GetBitmapN(IDB_DETAILS_FAVORITE_OFF);
1524 if (pBitmap != null)
1526 pLabel->SetBackgroundBitmap(*pBitmap);
1529 pLabel->Invalidate(false);
1534 ContactDetailsForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1539 ContactDetailsForm::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1544 ContactDetailsForm::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1549 ContactDetailsForm::OnTouchCanceled(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1554 ContactDetailsForm::OnScrollEndReached (Tizen::Ui::Control &source, Tizen::Ui::Controls::ScrollEndEvent type)
1559 ContactDetailsForm::OnScrollPositionChanged (Tizen::Ui::Control &source, int scrollPos)
1561 __scrolledDistance = scrollPos;
1565 ContactDetailsForm::OnScrollStopped (Tizen::Ui::Control &source)
1570 ContactDetailsForm::OnContactsChanged(void)
1572 if (__pPresentationModel->IsContactRemoved())
1574 if (__appControlViewType.IsEmpty() == true)
1576 SceneManager* pSceneManager = SceneManager::GetInstance();
1578 result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
1579 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go backward", GetErrorMessage(r));
1583 UiApp::GetInstance()->Terminate();
1588 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1589 TryReturnVoid(pContactsApp != null, "Unable to get ContactsApp instance.");
1591 if (pContactsApp->GetAppUiState() == APP_UI_STATE_BACKGROUND)
1593 __pTableView->UpdateTableView();
1597 delete __pDefaultSelectorPopup;
1598 __pDefaultSelectorPopup = null;
1602 ContactDetailsForm::OnCategoriesChanged(void)
1607 ContactDetailsForm::LaunchAppControl(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, const Tizen::Base::String& launchType, const Tizen::Base::String& value)
1609 result r = E_SUCCESS;
1611 if (__pAppControl != null)
1619 extraData.Construct();
1620 IAppControlResponseListener* pEvent = null;
1622 if (appId.Equals(String(PROVIDER_ID_PHONE)) && operationId.Equals(String(OPERATION_ID_CALL)))
1624 uri.Append(INPUT_URI_TEL);
1626 if (value.IsEmpty())
1628 uri.Append(__pPresentationModel->GetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER));
1635 extraData.Add(new (std::nothrow) String(INPUT_KEY_CALL_TYPE), new (std::nothrow) String(launchType));
1637 else if (appId.Equals(String(PROVIDER_ID_MESSAGE)) && operationId.Equals(String(OPERATION_ID_COMPOSE)))
1639 String recipientAddress;
1641 if (value.IsEmpty())
1643 recipientAddress.Append(__pPresentationModel->GetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER));
1647 recipientAddress.Append(value);
1649 extraData.Add(new (std::nothrow) String(INPUT_KEY_MESSAGE_TO), new (std::nothrow) String(recipientAddress));
1650 extraData.Add(new (std::nothrow) String(INPUT_KEY_MESSAGE_TYPE), new (std::nothrow) String(INPUT_TYPE_SMS));
1652 else if (appId.Equals(String(PROVIDER_ID_FILEMANAGER)) && operationId.Equals(String(OPERATION_ID_PICK)))
1654 mimeType.Append(INPUT_MIME_TYPE_AUDIO);
1655 extraData.Add(new (std::nothrow) String(INPUT_KEY_SELECTION_MODE), new (std::nothrow) String(INPUT_DATA_SELECTION_MODE_SINGLE));
1659 else if (appId.Equals(String(PROVIDER_ID_EMAIL)) && operationId.Equals(String(OPERATION_ID_COMPOSE)))
1661 ArrayList* pArgList = new (std::nothrow) ArrayList();
1662 pArgList->Construct();
1664 pArgList->Add(new (std::nothrow) String(__pPresentationModel->GetValue(DETAIL_PROPERTY_EMAIL, 0)));
1665 extraData.Add(new (std::nothrow) String(INPUT_KEY_MESSAGE_TO), pArgList);
1668 __pAppControl = AppManager::FindAppControlN(appId, operationId);
1669 if (__pAppControl != null)
1671 r = __pAppControl->Start(&uri, &mimeType, &extraData, pEvent);
1672 TryCatch(r == E_SUCCESS, , "[%s] Unable to launch app control", GetErrorMessage(r));
1674 if (operationId.Equals(String(OPERATION_ID_PICK)))
1680 Footer* pFooter = GetFooter();
1681 pFooter->SetEnabled(false);
1685 extraData.RemoveAll(true);
1691 ContactDetailsForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData)
1693 AppLogDebug("ENTER");
1698 if (pExtraData == null)
1703 if (appId.Equals(String(PROVIDER_ID_FILEMANAGER)) && operationId.Equals(String(OPERATION_ID_PICK)))
1705 if (appControlResult == APP_CTRL_RESULT_SUCCEEDED)
1707 const String *pResultString = null;
1708 const ArrayList* pResultList = dynamic_cast<const ArrayList*>(pExtraData->GetValue(String(OUTPUT_KEY_SELECTED)));
1709 if (pResultList != null)
1711 pResultString = static_cast<const String*>(pResultList->GetAt(0));
1715 pResultString = static_cast<const String*>(pExtraData->GetValue(String(OUTPUT_KEY_SELECTED)));
1718 if (pResultString != null && pResultString->IsEmpty() == false)
1720 __pPresentationModel->SetValue(DETAIL_PROPERTY_RINGTONE, *pResultString);
1721 __pPresentationModel->UpdateContact();
1722 __pTableView->RefreshItem(__pItemList->GetCount() - 1, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1727 AppLogDebug("EXIT");
1731 ContactDetailsForm::AddGroupStylePanel(int itemWidth, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::GroupStyle groupStyle)
1733 Panel* pGroupStyle = new (std::nothrow) Panel();
1734 pGroupStyle->Construct(Rectangle(W_GROUP_STYLE_MARGIN, 0, itemWidth - W_GROUP_STYLE_MARGIN * 2, H_ITEM_DOUBLE_LINE), groupStyle);
1735 pGroupStyle->SetBackgroundColor(COLOR_GROUP_STYLE);
1736 pItem->AddControl(*pGroupStyle);
1740 ContactDetailsForm::ParseAppControlArgument(const Tizen::Base::String& argument, Tizen::Base::String& type, Tizen::Base::String& content)
1742 result r = E_SUCCESS;
1744 if (argument.IsEmpty() || argument.Contains(DELIMITER) == false)
1749 StringTokenizer stringToken(argument, DELIMITER);
1751 r = stringToken.GetNextToken(type);
1752 TryReturn(r == E_SUCCESS, r, "[%s] Unable to get type", GetErrorMessage(r));
1754 r = stringToken.GetNextToken(content);
1755 TryReturn(r == E_SUCCESS, r, "[%s] Unable to get content", GetErrorMessage(r));
1761 ContactDetailsForm::ShowDefaultSelectorPopup(void)
1763 ArrayList* pList = new (std::nothrow) ArrayList();
1766 String numberWithType;
1767 int numberCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER);
1768 for (int index = 0; index < numberCount; index++)
1770 numberWithType = __pPresentationModel->GetType(DETAIL_PROPERTY_PHONE_NUMBER, index) + L" ";
1771 numberWithType += __pPresentationModel->GetValue(DETAIL_PROPERTY_PHONE_NUMBER, index);
1773 pList->Add(*(new (std::nothrow) String(numberWithType)));
1775 ContactValueListItemProvider* pProvider = new (std::nothrow) ContactValueListItemProvider(pList);
1777 delete __pDefaultSelectorPopup;
1778 __pDefaultSelectorPopup = new (std::nothrow) Popup();
1779 __pDefaultSelectorPopup->Construct(true, Dimension(W_POPUP, H_POPUP));
1780 __pDefaultSelectorPopup->SetTitleText(ResourceManager::GetString(L"IDS_PB_BODY_MARK_AS_DEFAULT_NUMBER"));
1782 Rectangle popupClientBounds = __pDefaultSelectorPopup->GetClientAreaBounds();
1784 ListView* pOtherNumberList = new (std::nothrow) ListView();
1785 pOtherNumberList->Construct(Rectangle(0, 0, popupClientBounds.width, H_POPUP_LIST_VIEW));
1786 pOtherNumberList->AddListViewItemEventListener(*this);
1787 pOtherNumberList->SetItemProvider(*pProvider);
1789 __pDefaultSelectorPopup->AddControl(*pOtherNumberList);
1791 Button* pCloseButton = new (std::nothrow) Button();
1792 pCloseButton->Construct(Rectangle((popupClientBounds.width - W_POPUP_BUTTON) / 2, Y_POPUP_BUTTON,
1793 W_POPUP_BUTTON, H_POPUP_BUTTON), ResourceManager::GetString(L"IDS_COM_POP_CLOSE"));
1794 pCloseButton->SetActionId(IDA_POPUP_CLOSE);
1795 pCloseButton->AddActionEventListener(*this);
1797 __pDefaultSelectorPopup->AddControl(*pCloseButton);
1798 __pDefaultSelectorPopup->SetShowState(true);
1799 __pDefaultSelectorPopup->Show();
1803 ContactDetailsForm::HideDefaultSelectorPopup(void)
1805 __pDefaultSelectorPopup->SetShowState(false);
1811 ContactDetailsForm::ShowInvalidFilePopup(void)
1813 if (__pInvalidFilePopup != null)
1815 delete __pInvalidFilePopup;
1818 __pInvalidFilePopup = new (std::nothrow) Popup();
1819 __pInvalidFilePopup->Construct(false, Dimension(W_POPUP, H_INVALID_FILE_POPUP));
1821 Rectangle clientBounds = __pInvalidFilePopup->GetClientAreaBounds();
1823 Label* pLabelText = new (std::nothrow) Label();
1824 pLabelText->Construct(Rectangle(0, Y_POPUP_TEXT_LABEL, clientBounds.width, H_POPUP_TEXT_LABEL), ResourceManager::GetString(L"IDS_RSSR_BODY_INVALID_FORMAT"));
1825 pLabelText->SetTextColor(COLOR_POPUP_TEXT);
1826 pLabelText->SetTextConfig(FONT_SIZE_POPUP_TEXT, LABEL_TEXT_STYLE_BOLD);
1827 pLabelText->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
1829 __pInvalidFilePopup->AddControl(*pLabelText);
1831 Button* pButtonClose = new (std::nothrow) Button();
1832 pButtonClose->Construct(Rectangle((clientBounds.width - W_POPUP_BUTTON) / 2, pLabelText->GetY() + pLabelText->GetHeight(), W_POPUP_BUTTON, H_POPUP_BUTTON));
1833 pButtonClose->SetText(ResourceManager::GetString("IDS_COM_SK_OK"));
1834 pButtonClose->SetActionId(IDA_INVALID_FILE_POPUP_CLOSE);
1835 pButtonClose->AddActionEventListener(*this);
1837 __pInvalidFilePopup->AddControl(*pButtonClose);
1839 __pInvalidFilePopup->Show();
1843 ContactDetailsForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
1845 __pPresentationModel->SetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER, L"", index);
1846 __pPresentationModel->AddAddressBook();
1847 InitializeDetailItemList();
1848 __pTableView->UpdateTableView();
1850 HideDefaultSelectorPopup();
1854 ContactDetailsForm::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
1859 ContactDetailsForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
1864 ContactDetailsForm::OnForeground(void)
1866 if (IsEnabled() == false)
1872 Footer* pFooter = GetFooter();
1873 pFooter->SetEnabled(true);
1875 delete __pAppControl;
1876 __pAppControl = null;
1880 ContactDetailsForm::OnBackground(void)