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 CtContactEditorForm.cpp
19 * @brief This is the implementation file for the ContactEditorForm class.
24 #include "CtContactEditorForm.h"
25 #include "CtContactPresentationModel.h"
26 #include "CtContactsApp.h"
27 #include "CtContactValueListItemProvider.h"
28 #include "CtResourceManager.h"
29 #include "CtSceneRegister.h"
31 #include "CtCommonUtil.h"
33 using namespace Tizen::App;
34 using namespace Tizen::Base;
35 using namespace Tizen::Base::Collection;
36 using namespace Tizen::Base::Utility;
37 using namespace Tizen::Graphics;
38 using namespace Tizen::Io;
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;
44 using namespace Tizen::System;
46 static const int IDA_ACTION_BAR_SAVE = 11;
47 static const int IDA_BUTTON_THUMBNAIL_ADD = 21;
48 static const int IDA_BUTTON_THUMBNAIL_DELETE = 22;
49 static const int IDA_BUTTON_CAMERA = 23;
50 static const int IDA_BUTTON_EXPANDABLE = 24;
51 static const int IDA_BUTTON_MORE_INFO = 25;
52 static const int IDA_BUTTON_BIRTHDAY_CLEAR = 26;
53 static const int IDA_BUTTON_DEFAULT_PHONE_NUMBER = 27;
54 static const int IDA_BUTTON_RINGTONE_CLEAR = 28;
55 static const int IDA_BUTTON_TYPE = 29;
56 static const int IDA_BUTTON_BIRTHDAY_DELETE = 30;
57 static const int IDA_CONTEXT_MENU_ITEM_JOB_TITLE = 31;
58 static const int IDA_CONTEXT_MENU_ITEM_DEPARTMENT = 32;
59 static const int IDA_CONTEXT_MENU_ITEM_INSTANT_MESSENGER = 33;
60 static const int IDA_CONTEXT_MENU_ITEM_URL = 34;
61 static const int IDA_CONTEXT_MENU_ITEM_BIRTHDAY = 35;
62 static const int IDA_CONTEXT_MENU_ITEM_NOTE = 36;
63 static const int IDA_INPUT_FIELD_DISPLAY_NAME = 41;
64 static const int IDA_POPUP_DISCARD_CHANGES_OK = 44;
65 static const int IDA_POPUP_DISCARD_CHANGES_CANCEL = 45;
67 static const wchar_t* IDB_EXPAND_BUTTON_NORMAL = L"00_circle_button.png";
68 static const wchar_t* IDB_EXPAND_BUTTON_PRESSED = L"00_circle_button_press.png";
69 static const wchar_t* IDB_EXPAND_CLOSED = L"00_button_expand_closed.png";
70 static const wchar_t* IDB_EXPAND_CLOSED_PRESSED = L"00_button_expand_closed_press.png";
71 static const wchar_t* IDB_EXPAND_OPENED = L"00_button_expand_opened.png";
72 static const wchar_t* IDB_EXPAND_OPENED_PRESSED = L"00_button_expand_opened_press.png";
73 static const wchar_t* IDB_BUTTON_DELETE_NORMAL = L"00_circle_button_delete.png";
74 static const wchar_t* IDB_BUTTON_DELETE_PRESSED = L"00_circle_button_delete_press.png";
75 static const wchar_t* IDB_BUTTON_MINUS = L"00_button_expand_minus_press.png";
76 static const wchar_t* IDB_BUTTON_MINUS_PRESSED = L"00_button_expand_minus_press.png";
77 static const wchar_t* IDB_BUTTON_RESET_NORMAL = L"00_button_refresh.png";
78 static const wchar_t* IDB_BUTTON_RESET_PRESSED = L"00_button_refresh_press.png";
79 static const wchar_t* IDB_BUTTON_ADD= L"C02_caller_id_icon_add.png";
80 static const wchar_t* IDB_BUTTON_ADD_PRESSED = L"C02_caller_id_icon_add_press.png";
81 static const wchar_t* IDB_BUTTON_CAMERA = L"C02_caller_id_icon_camera.png";
82 static const wchar_t* IDB_BUTTON_CAMERA_PRESSED = L"C02_caller_id_icon_camera_press.png";
83 static const wchar_t* IDB_BUTTON_DROPBOX = L"C02_button_icon_dropbox.png";
84 static const wchar_t* IDB_THUMBNAIL_BACKGROUND = L"C02_created_photo_bg.png";
85 static const wchar_t* IDB_DETAILS_RESET_NORMAL = L"00_button_refresh.png";
86 static const wchar_t* IDB_DETAILS_RESET_PRESSED = L"00_button_refresh_press.png";
88 static const wchar_t* INPUT_DATA_SELECTION_MODE_SINGLE = L"single";
89 static const wchar_t* INPUT_KEY_SELECTION_MODE = L"http://tizen.org/appcontrol/data/selection_mode";
90 static const wchar_t* INPUT_KEY_IMAGEVIEWER_MODE = L"http://tizen.org/appcontrol/data/image/crop_mode";
91 static const wchar_t* INPUT_KEY_ALLOW_SWITCH = L"http://tizen.org/appcontrol/data/camera/allow_switch";
92 static const wchar_t* INPUT_MIME_TYPE_CAMERA = L"image/jpg";
93 static const wchar_t* INPUT_MIME_TYPE_GALLERY = L"image/*";
94 static const wchar_t* INPUT_MIME_TYPE_AUDIO = L"audio/*";
95 static const wchar_t* INPUT_VALUE_FALSE = L"false";
96 static const wchar_t* INPUT_VALUE_IMAGEVIEWER_TYPE = L"fit_to_screen";
97 static const wchar_t* OUTPUT_KEY_SELECTED = L"http://tizen.org/appcontrol/data/selected";
98 static const wchar_t* SD_CARD_UNMOUNTED = L"Unmounted";
100 static const int H_ITEM = 112;
101 static const int H_DOUBLE_LINE_ITEM = 140;
102 static const int H_LABEL = 40;
103 static const int H_DESCRIPTION_CONTAINER = 136;
104 static const int H_DIVIDER = 1;
105 static const int W_DIVIDER = 1;
106 static const int H_EMPTY_SPACE = 32;
107 static const int H_BUTTON = 74;
108 static const int H_ICON_BUTTON = 74;
109 static const int W_THUMBNAIL = 360;
110 static const int W_TITLE_LABEL = 170;
111 static const int X_MORE_INFORMATION_BUTTON = 60;
112 static const int Y_MORE_INFORMATION_BUTTON = 30;
113 static const int Y_DEFAULT_NUMBER_BUTTON = 19;
114 static const int W_ITEM_GAP = 16;
115 static const int W_TYPE_BUTTON = 186;
116 static const int H_THUMBNAIL_DELETE_BUTTON_GAP = 31;
117 static const int H_THUMBNAIL_GROUP_ITEM_HEIGHT = 34;
118 static const int H_NAMEFIELD_GROUP_ITEM_HEIGHT = 40;
119 static const int H_GROUP_RINGTONE_TITLE_GAP = 22;
120 static const int H_GROUP_RINGTONE_TITLE_LABEL = 42;
121 static const int H_GROUP_RINGTONE_VALUE_LABEL = 62;
122 static const int W_DROPBOX_ICON = 29;
123 static const int H_DROPBOX_ICON = 29;
124 static const int X_REFRESH_BUTTON_MARGIN = 88;
125 static const int Y_EDIT_FIELD_GAP = 5;
126 static const int H_EDIT_FIELD_GAP = 10;
128 static const int X_MORE_INFO_PANEL_GAP = 5;
129 static const int H_MORE_INFO_PANEL_GAP = 10;
131 static const int FONT_SIZE_TITLE_TEXT = 32;
133 static const int GROUP_ITEM_COUNT = 11;
134 static const int NAME_FIELD_ITEM_COUNT = 1;
136 static const int EDIT_FIELD_EXTENDED_LENGTH = 100;
138 static const int MESSAGE_BOX_TIMEOUT_MS = 300000;
139 static const int BIRTHDAY_MIN_YEAR_DIFF = 100;
141 static const int DEFAULT_EXPAND_NAME_FIELD_COUNT = 6;
143 static const wchar_t* EXPAND_BUTTON = L"ExpandButton";
145 static const unsigned int COLOR_TABLE_VIEW_BG = Color32<248, 246, 239>::Value;
146 static const unsigned int COLOR_DIVIDER = Color32<169, 169, 169>::Value;
147 static const unsigned int COLOR_THUMBNAIL_BACKGROUND = Color32<239, 237, 229>::Value;
148 static const unsigned int COLOR_ITEM_TITLE = Color32<128, 128, 128>::Value;
149 static const unsigned int COLOR_ITEM_VALUE = Color32<0, 0, 0>::Value;
150 static const unsigned int COLOR_ITEM_PRESSED = Color32<248, 246, 239>::Value;
151 static const unsigned int COLOR_PRESSED = Color32<87, 135, 194>::Value;
153 static const int TABLE_VIEW_DELETE_INPUT_FIELD_ID = 0xE0000000;
154 static const int TABLE_VIEW_INPUT_FIELD_ACTION_MASK = 0xF0000000;
155 static const int TABLE_VIEW_INPUT_FIELD_INDEX_MASK = 0x0F000000;
156 static const int TABLE_VIEW_GROUP_INDEX_MASK = 0x00FF0000;
157 static const int TABLE_VIEW_ITEM_INDEX_MASK = 0x0000FFFF;
158 static const int TABLE_VIEW_GROUP_INDEX_SHIFT = 16;
159 static const int TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT = 24;
160 static const int TABLE_VIEW_INPUT_FIELD_ACTION_SHIFT = 28;
161 static const int TABLE_VIEW_THUMBNAIL_FIELD_INDEX = 0;
162 static const int TABLE_VIEW_NAME_FIELD_INDEX = 1;
163 static const int TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX = 2;
164 static const int TABLE_VIEW_EMAIL_FIELD_INDEX = 3;
165 static const int TABLE_VIEW_ADDRESS_FIELD_INDEX = 4;
166 static const int TABLE_VIEW_IM_ADDRESS_FIELD_INDEX = 5;
167 static const int TABLE_VIEW_URL_FIELD_INDEX = 6;
168 static const int TABLE_VIEW_BIRTHDAY_FIELD_INDEX = 7;
169 static const int TABLE_VIEW_NOTE_FIELD_INDEX = 8;
170 static const int TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX = 9;
171 static const int TABLE_VIEW_MORE_INFORMATION_FIELD_INDEX = 10;
173 static const wchar_t* INPUT_TYPE_PHONE = L"phone";
174 static const wchar_t* INPUT_TYPE_EMAIL = L"email";
175 static const wchar_t* INPUT_TYPE_URL = L"url";
176 static const wchar_t* VIEW_TYPE = L"viewType";
177 static const wchar_t* VIEW_TYPE_VALUE_CONTACT = L"contact";
178 static const wchar_t* VIEW_TYPE_CONTACT_ID = L"contactId";
179 static const wchar_t* GROUP_LABEL_TITLE = L"GroupLabelTitle";
180 static const wchar_t* GROUP_LABEL_VALUE = L"GroupLabelValue";
181 static const wchar_t* GROUP_STYLE_PANEL = L"GroupStylePanel";
183 ContactEditorForm::ContactEditorForm(void)
184 : __isExpandable(false)
185 , __isAppControl(false)
186 , __isJobTitleEnabled(false)
187 , __isDepartmentEnabled(false)
188 , __isDefaultPhoneNumberButtonEnabled(false)
190 , __isMoreInformationContextMenuShowing(false)
191 , __isTypeContextMenuShowing(false)
192 , __isKeypadOpened(false)
193 , __isScrollOccurred(false)
194 , __isContactModified(false)
195 , __scrolledDistance(0)
196 , __origScrolledDistance(0)
199 , __previousItemIndex(-1)
200 , __previousGroupIndex(-1)
201 , __pAppControl(null)
202 , __pPhoneNumberFieldItem(null)
203 , __pEmailFieldItem(null)
204 , __pAddressFieldItem(null)
205 , __pImAddressFieldItem(null)
206 , __pUrlFieldItem(null)
207 , __pDeletedItemList(null)
208 , __pFileEventManager(null)
209 , __pDiscardChangesPopup(null)
210 , __pCurrentFocusedItem(null)
211 , __pDefaultPhoneNumberContextMenu(null)
212 , __pMoreInformationContextMenu(null)
213 , __pThumbnailContextMenu(null)
214 , __pTypeContextMenu(null)
216 , __pNameFieldItem(null)
217 , __pNoteFieldItem(null)
218 , __pPresentationModel(null)
222 ContactEditorForm::~ContactEditorForm(void)
227 ContactEditorForm::Initialize(void)
229 Construct(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
233 ContactEditorForm::OnInitializing(void)
235 SetFormBackEventListener(this);
236 SettingInfo::AddSettingEventListener(*this);
238 Footer* pFooter = GetFooter();
240 FooterItem footerItemSave;
241 footerItemSave.Construct(IDA_ACTION_BAR_SAVE);
242 footerItemSave.SetText(ResourceManager::GetString(L"IDS_COM_SK_SAVE"));
244 pFooter->AddItem(footerItemSave);
245 pFooter->AddActionEventListener(*this);
247 __pTableView = new (std::nothrow) GroupedTableView();
248 __pTableView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), false, TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT);
249 __pTableView->SetItemProvider(this);
250 __pTableView->AddScrollEventListener(*this);
251 __pTableView->AddGroupedTableViewItemEventListener(*this);
252 AddControl(__pTableView);
254 __pPhoneNumberFieldItem = new (std::nothrow) ArrayList();
255 __pPhoneNumberFieldItem->Construct();
257 __pEmailFieldItem = new (std::nothrow) ArrayList();
258 __pEmailFieldItem->Construct();
260 __pAddressFieldItem = new (std::nothrow) ArrayList();
261 __pAddressFieldItem->Construct();
263 __pImAddressFieldItem = new (std::nothrow) ArrayList();
264 __pImAddressFieldItem->Construct();
266 __pUrlFieldItem = new (std::nothrow) ArrayList();
267 __pUrlFieldItem->Construct();
269 __pPresentationModel = new (std::nothrow) ContactPresentationModel();
270 __pPresentationModel->Construct();
271 __pPresentationModel->AddContactChangeListener(*this);
273 DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
275 __pDeletedItemList = new ArrayList();
276 __pDeletedItemList->Construct();
282 ContactEditorForm::OnTerminating(void)
284 AppLog("ContactEditorForm::OnTerminating()");
286 result r = E_SUCCESS;
288 __pTableView->SetItemProvider(null);
290 if (__pPresentationModel != null)
292 __pPresentationModel->RemoveContactChangeListener(*this);
293 delete __pPresentationModel;
296 if (__pPhoneNumberFieldItem)
298 __pPhoneNumberFieldItem->RemoveAll(true);
299 delete __pPhoneNumberFieldItem;
302 if (__pEmailFieldItem)
304 __pEmailFieldItem->RemoveAll(true);
305 delete __pEmailFieldItem;
308 if (__pAddressFieldItem)
310 __pAddressFieldItem->RemoveAll(true);
311 delete __pAddressFieldItem;
316 __pUrlFieldItem->RemoveAll(true);
317 delete __pUrlFieldItem;
320 if (__pImAddressFieldItem)
322 __pImAddressFieldItem->RemoveAll(true);
323 delete __pImAddressFieldItem;
326 if (__pDeletedItemList)
328 __pDeletedItemList->RemoveAll(true);
329 delete __pDeletedItemList;
332 if (__pDiscardChangesPopup)
334 delete __pDiscardChangesPopup;
336 delete __pAppControl;
337 delete __pNameFieldItem;
338 delete __pNoteFieldItem;
339 delete __pDefaultPhoneNumberContextMenu;
340 delete __pMoreInformationContextMenu;
341 delete __pThumbnailContextMenu;
342 delete __pTypeContextMenu;
343 delete __pFileEventManager;
345 DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
346 SettingInfo::RemoveSettingEventListener(*this);
352 ContactEditorForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
356 if( IsSaveContactValid() == true && __isContactModified == true)
358 ShowDiscardChangesPopup();
361 if (__isAppControl == true)
363 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
364 AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance();
366 result r = pAppManager->SendAppControlResult(pContactsApp->GetRequestId(), APP_CTRL_RESULT_CANCELED, null);
367 AppLogDebug("[%s] The return result from SendAppControlResult().", GetErrorMessage(r));
369 UiApp::GetInstance()->Terminate();
373 SceneManager* pSceneManager = SceneManager::GetInstance();
375 result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
376 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go backward", GetErrorMessage(r));
381 ContactEditorForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
383 AppLog("ContactEditorForm::OnActionPerformed(), actionId %d", actionId);
385 if ((actionId & TABLE_VIEW_INPUT_FIELD_ACTION_MASK) == TABLE_VIEW_DELETE_INPUT_FIELD_ID)
387 int groupIndex = (actionId & TABLE_VIEW_GROUP_INDEX_MASK) >> TABLE_VIEW_GROUP_INDEX_SHIFT;
388 int itemIndex = (actionId & TABLE_VIEW_ITEM_INDEX_MASK);
390 if (groupIndex > TABLE_VIEW_NAME_FIELD_INDEX)
392 DeleteInputField(groupIndex, itemIndex);
393 if (groupIndex == __previousGroupIndex && itemIndex < __previousItemIndex) //if we deleted a number on top of the item to be deleted
395 __previousItemIndex--; //adjust the index of the item to be deleted
397 __isContactModified = true;
402 else if (&source == __pDefaultPhoneNumberContextMenu)
404 SetAsDefaultPhoneNumber(actionId, true);
405 __isContactModified = true;
409 else if (((actionId & TABLE_VIEW_INPUT_FIELD_ACTION_MASK) >> TABLE_VIEW_INPUT_FIELD_ACTION_SHIFT) == TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX)
411 int itemIndex = (actionId & TABLE_VIEW_ITEM_INDEX_MASK);
412 int selectedItemIndex = (actionId & TABLE_VIEW_INPUT_FIELD_INDEX_MASK) >> TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
414 TableViewItem* pItem = static_cast<TableViewItem *>(__pPhoneNumberFieldItem->GetAt(itemIndex));
419 pItem->SetName(Integer::ToString(selectedItemIndex));
421 Button* pButtonType = static_cast<Button *>(pItem->GetControl(1));
422 if (pButtonType == null)
427 pButtonType->SetText(__pPresentationModel->GetPhoneNumberTypeString((DetailPhoneNumberType)selectedItemIndex));
428 pButtonType->Invalidate(false);
430 __isContactModified = true;
433 else if (((actionId & TABLE_VIEW_INPUT_FIELD_ACTION_MASK) >> TABLE_VIEW_INPUT_FIELD_ACTION_SHIFT) == TABLE_VIEW_EMAIL_FIELD_INDEX)
435 int itemIndex = (actionId & TABLE_VIEW_ITEM_INDEX_MASK);
436 int selectedItemIndex = (actionId & TABLE_VIEW_INPUT_FIELD_INDEX_MASK) >> TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
438 TableViewItem* pItem = static_cast<TableViewItem *>(__pEmailFieldItem->GetAt(itemIndex));
443 pItem->SetName(Integer::ToString(selectedItemIndex));
445 Button* pButtonType = static_cast<Button *>(pItem->GetControl(1));
446 if (pButtonType == null)
451 pButtonType->SetText(__pPresentationModel->GetEmailTypeString((DetailEmailType)selectedItemIndex));
452 pButtonType->Invalidate(false);
454 __isContactModified = true;
457 else if (((actionId & TABLE_VIEW_INPUT_FIELD_ACTION_MASK) >> TABLE_VIEW_INPUT_FIELD_ACTION_SHIFT) == TABLE_VIEW_ADDRESS_FIELD_INDEX)
459 int itemIndex = (actionId & TABLE_VIEW_ITEM_INDEX_MASK);
460 int selectedItemIndex = (actionId & TABLE_VIEW_INPUT_FIELD_INDEX_MASK) >> TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
462 TableViewItem* pItem = static_cast<TableViewItem *>(__pAddressFieldItem->GetAt(itemIndex));
467 pItem->SetName(Integer::ToString(selectedItemIndex));
469 Button* pButtonType = static_cast<Button *>(pItem->GetControl(1));
470 if (pButtonType == null)
475 pButtonType->SetText(__pPresentationModel->GetAddressTypeString((DetailAddressType)selectedItemIndex));
476 pButtonType->Invalidate(false);
478 __isContactModified = true;
481 else if (((actionId & TABLE_VIEW_INPUT_FIELD_ACTION_MASK) >> TABLE_VIEW_INPUT_FIELD_ACTION_SHIFT) == TABLE_VIEW_IM_ADDRESS_FIELD_INDEX)
483 int itemIndex = (actionId & TABLE_VIEW_ITEM_INDEX_MASK);
484 int selectedItemIndex = (actionId & TABLE_VIEW_INPUT_FIELD_INDEX_MASK) >> TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
486 TableViewItem* pItem = static_cast<TableViewItem *>(__pImAddressFieldItem->GetAt(itemIndex));
491 pItem->SetName(Integer::ToString(selectedItemIndex));
493 Button* pButtonType = static_cast<Button *>(pItem->GetControl(1));
494 if (pButtonType == null)
499 pButtonType->SetText(__pPresentationModel->GetImAddressTypeString((DetailImAddressType)selectedItemIndex));
500 pButtonType->Invalidate(false);
502 __isContactModified = true;
505 else if (((actionId & TABLE_VIEW_INPUT_FIELD_ACTION_MASK) >> TABLE_VIEW_INPUT_FIELD_ACTION_SHIFT) == TABLE_VIEW_URL_FIELD_INDEX)
507 int itemIndex = (actionId & TABLE_VIEW_ITEM_INDEX_MASK);
508 int selectedItemIndex = (actionId & TABLE_VIEW_INPUT_FIELD_INDEX_MASK) >> TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
510 TableViewItem* pItem = static_cast<TableViewItem *>(__pUrlFieldItem->GetAt(itemIndex));
515 pItem->SetName(Integer::ToString(selectedItemIndex));
517 Button* pButtonType = static_cast<Button *>(pItem->GetControl(1));
518 if (pButtonType == null)
523 pButtonType->SetText(__pPresentationModel->GetUrlTypeString((DetailUrlType)selectedItemIndex));
524 pButtonType->Invalidate(false);
526 __isContactModified = true;
532 case IDA_ACTION_BAR_SAVE:
534 result r = E_SUCCESS;
536 DateTime changedDate;
537 DateTime currentDate;
538 SystemTime::GetCurrentTime(currentDate);
540 __pPresentationModel->GetBirthday(changedDate);
542 if (changedDate.CompareTo(currentDate) > 0)
545 MessageBox invalidBirthYear;
546 invalidBirthYear.Construct(L"", ResourceManager::GetString(L"IDS_SAPPS_POP_INVALID_DATE_OF_BIRTH"), MSGBOX_STYLE_OK, MESSAGE_BOX_TIMEOUT_MS);
547 invalidBirthYear.ShowAndWait(modalResult);
548 __pPresentationModel->SetBirthday(currentDate);
549 __pTableView->RefreshItem(TABLE_VIEW_BIRTHDAY_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
553 r = SaveContactData();
564 case IDA_BUTTON_THUMBNAIL_ADD:
566 if (__pCurrentFocusedItem != null)
570 LaunchAppControl(PROVIDER_ID_GALLERY, OPERATION_ID_PICK);
573 case IDA_BUTTON_THUMBNAIL_DELETE:
575 __pPresentationModel->SetThumbnail(L"");
576 __isContactModified = true;
577 __pTableView->RefreshItem(TABLE_VIEW_THUMBNAIL_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
579 delete __pFileEventManager;
580 __pFileEventManager = null;
583 case IDA_BUTTON_CAMERA:
585 if (__pCurrentFocusedItem != null)
589 LaunchAppControl(PROVIDER_ID_CAMERA, OPERATION_ID_CREATE_CONTENT);
592 case IDA_BUTTON_EXPANDABLE:
594 ChangeNameFieldStatus();
595 if (__previousItemIndex != -1 && __previousGroupIndex != -1)
597 DeleteInputField(__previousGroupIndex, __previousItemIndex, true);
599 if (__pCurrentFocusedItem == __pNameFieldItem)
601 __pCurrentFocusedItem = null;
604 __pTableView->UpdateTableView();
605 static_cast<Button*>(__pNameFieldItem->GetControl(EXPAND_BUTTON))->SetFocus();
607 Rectangle clientBounds = GetClientAreaBounds();
608 __pTableView->SetSize(clientBounds.width, clientBounds.height);
610 if (__pCurrentFocusedItem != null)
616 case IDA_BUTTON_MORE_INFO:
618 if (__pCurrentFocusedItem != null)
620 if (__isKeypadOpened)
622 __isMoreInformationContextMenuShowing = true;
623 __scrolledDistance = 0;
627 Control* pParentPanel = source.GetParent();
628 if (pParentPanel == null)
633 Control* pParentTableViewItem = pParentPanel->GetParent();
634 if (pParentTableViewItem == null)
639 Point contextMenuPos;
641 contextMenuPos.x = pParentTableViewItem->GetWidth() / 2;
642 contextMenuPos.y = GetClientAreaBounds().y + pParentTableViewItem->GetY() + source.GetY() - __scrolledDistance;
644 ShowMoreInformationContextMenu(contextMenuPos);
646 Button* pMoreInfo = static_cast<Button*>(&(const_cast<Control&>(source)));
647 pMoreInfo->SetFocus();
650 case IDA_BUTTON_BIRTHDAY_CLEAR:
652 DateTime currentDate;
653 Tizen::System::SystemTime::GetCurrentTime(currentDate);
654 __pPresentationModel->SetBirthday(currentDate);
656 __pTableView->RefreshItem(TABLE_VIEW_BIRTHDAY_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
657 __isContactModified = true;
660 case IDA_CONTEXT_MENU_ITEM_JOB_TITLE:
662 __isExpandable = false;
663 __isJobTitleEnabled = true;
665 ChangeNameFieldStatus();
667 __pTableView->UpdateTableView();
669 if (IsMoreInformationButtonVisible() == false)
671 __pTableView->RefreshItem(TABLE_VIEW_MORE_INFORMATION_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
673 __pTableView->ScrollToItem(TABLE_VIEW_NAME_FIELD_INDEX, 0);
676 case IDA_CONTEXT_MENU_ITEM_DEPARTMENT:
678 __isExpandable = false;
679 __isDepartmentEnabled = true;
681 ChangeNameFieldStatus();
683 __pTableView->UpdateTableView();
685 if (IsMoreInformationButtonVisible() == false)
687 __pTableView->RefreshItem(TABLE_VIEW_MORE_INFORMATION_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
689 __pTableView->ScrollToItem(TABLE_VIEW_NAME_FIELD_INDEX, 0);
692 case IDA_CONTEXT_MENU_ITEM_INSTANT_MESSENGER:
694 SaveContactData(false);
696 int index = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_IM_ADDRESS);
698 __pTableView->RefreshItem(TABLE_VIEW_IM_ADDRESS_FIELD_INDEX, index, TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
700 if (IsMoreInformationButtonVisible() == false)
702 __pTableView->RefreshItem(TABLE_VIEW_MORE_INFORMATION_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
704 __pTableView->ScrollToItem(TABLE_VIEW_IM_ADDRESS_FIELD_INDEX, 0);
707 case IDA_CONTEXT_MENU_ITEM_URL:
709 SaveContactData(false);
711 int index = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_URL);
713 __pTableView->RefreshItem(TABLE_VIEW_URL_FIELD_INDEX, index, TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
715 if (IsMoreInformationButtonVisible() == false)
717 __pTableView->RefreshItem(TABLE_VIEW_MORE_INFORMATION_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
719 __pTableView->ScrollToItem(TABLE_VIEW_URL_FIELD_INDEX, 0);
722 case IDA_CONTEXT_MENU_ITEM_BIRTHDAY:
724 DateTime currentDate;
726 Tizen::System::SystemTime::GetCurrentTime(currentDate);
727 __pPresentationModel->SetBirthday(currentDate);
729 __pTableView->RefreshItem(TABLE_VIEW_BIRTHDAY_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
731 if (IsMoreInformationButtonVisible() == false)
733 __pTableView->RefreshItem(TABLE_VIEW_MORE_INFORMATION_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
735 __pTableView->ScrollToItem(TABLE_VIEW_BIRTHDAY_FIELD_INDEX, 0);
738 case IDA_CONTEXT_MENU_ITEM_NOTE:
740 __pTableView->RefreshItem(TABLE_VIEW_NOTE_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
742 if (IsMoreInformationButtonVisible() == false)
744 __pTableView->RefreshItem(TABLE_VIEW_MORE_INFORMATION_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
746 __pTableView->ScrollToItem(TABLE_VIEW_NOTE_FIELD_INDEX, 0);
749 case IDA_BUTTON_DEFAULT_PHONE_NUMBER:
751 Control* pParent = source.GetParent();
752 Point contextMenuPos;
754 contextMenuPos.x = pParent->GetWidth() / 2;
755 contextMenuPos.y = GetClientAreaBounds().y + pParent->GetY() + source.GetY() + (source.GetHeight() / 2) - __scrolledDistance;
757 if (__pCurrentFocusedItem != null)
762 SaveContactData(false);
763 ShowDefaultPhoneNumberContextMenu(contextMenuPos);
766 case IDA_POPUP_DISCARD_CHANGES_CANCEL:
768 HideDiscardChangesPopup();
771 case IDA_POPUP_DISCARD_CHANGES_OK:
773 HideDiscardChangesPopup();
775 if (__isAppControl == true)
777 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
778 AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance();
780 result r = pAppManager->SendAppControlResult(pContactsApp->GetRequestId(), APP_CTRL_RESULT_CANCELED, null);
781 AppLogDebug("[%s] The return result from SendAppControlResult().", GetErrorMessage(r));
783 UiApp::GetInstance()->Terminate();
788 SceneManager* pSceneManager = SceneManager::GetInstance();
790 result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
791 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go backward", GetErrorMessage(r));
795 case IDA_BUTTON_RINGTONE_CLEAR:
797 __pPresentationModel->SetValue(DETAIL_PROPERTY_RINGTONE, L"", 0);
798 __pTableView->RefreshItem(TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX, 2, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
801 case IDA_BUTTON_BIRTHDAY_DELETE:
803 __pPresentationModel->RemoveBirthday();
804 __pTableView->RefreshItem(TABLE_VIEW_BIRTHDAY_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
807 case IDA_BUTTON_TYPE:
809 Control* pParent = source.GetParent();
810 Point position = pParent->GetPosition();
811 Point itemPosition(position.x + source.GetX(), GetClientAreaBounds().y + position.y + source.GetY() + (source.GetHeight() / 2) - __scrolledDistance);
812 String typeString = pParent->GetName();
813 String itemIndexTag = source.GetName();
817 Integer::Parse(itemIndexTag, itemIndex);
818 Integer::Parse(typeString, type);
819 ShowTypeContextMenu(type, itemPosition, itemIndex);
828 ContactEditorForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId,
829 Tizen::Base::Collection::IList* pArgs)
831 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
832 TryReturnVoid(pContactsApp != null, "Unable to cast UiApp to ContactsApp");
834 pContactsApp->AddContactsAppChangeEventListener(*this);
836 Header* pHeader = GetHeader();
837 Footer* pFooter = GetFooter();
839 if (previousSceneId.Equals(IDSCN_GROUP_SELECTOR, true) || previousSceneId.Equals(IDSCN_GROUP_EDITOR, true))
843 Integer* pCategoryId = null;
847 IList* pCategoryList = __pPresentationModel->GetAssignedCategoryIdListN();
848 prevCount = pCategoryList->GetCount();
849 delete pCategoryList;
851 __pPresentationModel->RemoveContactFromAllCategories();
853 IEnumerator* pEnum = pArgs->GetEnumeratorN();
854 while (pEnum->MoveNext() == E_SUCCESS)
856 pCategoryId = static_cast<Integer*>(pEnum->GetCurrent());
857 if (pCategoryId != null)
859 __pPresentationModel->AddContactToCategory(pCategoryId->ToInt());
860 __isContactModified = true;
865 if(prevCount > 0 && curCount == 0)
867 __isContactModified = true;
872 pArgs->RemoveAll(true);
876 __pTableView->RefreshItem(TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
881 if (pContactsApp->GetOperationId() == OPERATION_ID_ADD)
883 __isAppControl = true;
884 __pPresentationModel->PrepareNewContact();
886 pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_CREATE"));
887 pFooter->SetItemEnabled(0, false);
889 else if (pContactsApp->GetOperationId() == OPERATION_ID_EDIT)
891 __isAppControl = true;
895 String* pArgString = null;
899 IEnumerator* pEnum = pArgs->GetEnumeratorN();
900 while (pEnum->MoveNext() == E_SUCCESS)
902 pArgString = static_cast<String*>(pEnum->GetCurrent());
903 if (pArgString != null)
905 ParseAppControlArgument(*pArgString, type, content);
907 if (type.Equals(RETURN_TYPE_ITEM_ID, false))
910 Integer::Parse(content, contactId);
911 result r = __pPresentationModel->SetContactId(contactId, true);
915 AppLogDebug("Invalid contactId has been input : %d", contactId);
916 UiApp::GetInstance()->Terminate();
919 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_JOB_TITLE).IsEmpty() == false)
921 __isJobTitleEnabled = true;
923 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_DEPARTMENT).IsEmpty() == false)
925 __isDepartmentEnabled = true;
933 pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_SK_EDIT"));
940 Integer* pContactId = null;
942 pContactId = static_cast<Integer*>(pArgs->GetAt(0));
943 if (pContactId != null)
945 if (pContactId->ToInt() != INVALID_RECORD_ID)
947 pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_SK_EDIT"));
948 __pPresentationModel->SetContactId(pContactId->ToInt(), true);
952 pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_CREATE"));
954 String* pVcfPath = static_cast<String*>(pArgs->GetAt(1));
955 if (pVcfPath != null)
957 __pPresentationModel->SetVcfPath(*pVcfPath, true);
962 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_JOB_TITLE).IsEmpty() == false)
964 __isJobTitleEnabled = true;
966 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_DEPARTMENT).IsEmpty() == false)
968 __isDepartmentEnabled = true;
973 pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_CREATE"));
974 pFooter->SetItemEnabled(0, false);
975 __pPresentationModel->PrepareNewContact();
979 if (__isAppControl == true)
983 String* pArgString = null;
987 IEnumerator* pEnum = pArgs->GetEnumeratorN();
988 while (pEnum->MoveNext() == E_SUCCESS)
990 pArgString = static_cast<String*>(pEnum->GetCurrent());
991 if (pArgString != null)
993 result r = E_SUCCESS;
994 ParseAppControlArgument(*pArgString, type, content);
996 if (type.Equals(INPUT_TYPE_PHONE, false))
998 r = __pPresentationModel->SetValue(DETAIL_PROPERTY_PHONE_NUMBER, content, __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER));
1000 else if (type.Equals(INPUT_TYPE_EMAIL, false))
1002 r = __pPresentationModel->SetValue(DETAIL_PROPERTY_EMAIL, content, __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_EMAIL));
1004 else if (type.Equals(INPUT_TYPE_URL, false))
1006 r = __pPresentationModel->SetValue(DETAIL_PROPERTY_URL, content, __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_URL));
1011 pFooter->SetItemEnabled(0, true);
1021 pArgs->RemoveAll(true);
1027 ContactEditorForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)
1029 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1031 pContactsApp->RemoveContactsAppChangeEventListener(*this);
1032 if (__previousItemIndex != -1 && __previousGroupIndex != -1)
1034 DeleteInputField(__previousGroupIndex, __previousItemIndex);
1039 ContactEditorForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
1044 ContactEditorForm::OnKeypadOpened(Tizen::Ui::Control& source)
1046 Rectangle clientBounds = GetClientAreaBounds();
1048 __pTableView->SetSize(clientBounds.width, clientBounds.height);
1049 __isKeypadOpened = true;
1053 ContactEditorForm::OnKeypadClosed(Tizen::Ui::Control& source)
1055 Rectangle clientBounds = GetClientAreaBounds();
1056 AppLogDebug("Contacts::OnKeypadclosed bounds are width:(%d), height:(%d)", clientBounds.width, clientBounds.height);
1057 __pTableView->SetSize(clientBounds.width, clientBounds.height);
1059 if (__isMoreInformationContextMenuShowing)
1061 Point anchorPosition = __pMoreInformationContextMenu->GetAnchorPosition();
1062 __pTableView->ScrollToItem(TABLE_VIEW_MORE_INFORMATION_FIELD_INDEX, 0, TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_BOTTOM);
1063 if (__scrolledDistance != __origScrolledDistance)
1065 __scrolledDistance = __origScrolledDistance;
1067 anchorPosition.y -= __scrolledDistance;
1068 __pMoreInformationContextMenu->SetAnchorPosition(anchorPosition);
1069 __pMoreInformationContextMenu->Show();
1071 __isMoreInformationContextMenuShowing = false;
1073 __isKeypadOpened = false;
1077 ContactEditorForm::OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction)
1082 ContactEditorForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1084 Rectangle clientBounds = GetClientAreaBounds();
1085 int diff = clientBounds.height - __pTableView->GetHeight();
1087 if (__pTypeContextMenu != null)
1089 int yPos = __pTypeContextMenu->GetAnchorPosition().y;
1090 __pTypeContextMenu->SetAnchorPosition(Point(__pTypeContextMenu->GetAnchorPosition().x, yPos + diff));
1091 __pTypeContextMenu->Show();
1093 __pTableView->SetSize(clientBounds.width, clientBounds.height);
1097 ContactEditorForm::OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::GroupedTableView &tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem *pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1099 SceneManager* pSceneManager = SceneManager::GetInstance();
1101 if (status == TABLE_VIEW_ITEM_STATUS_SELECTED && groupIndex == TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX)
1103 if (__pCurrentFocusedItem != null)
1110 if (__pPresentationModel->GetCategoryCount() > 0)
1112 IList* pCategoryList = __pPresentationModel->GetAssignedCategoryIdListN();
1114 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_SELECTOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pCategoryList);
1118 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
1123 else if (itemIndex == 2)
1125 LaunchAppControl(PROVIDER_ID_FILEMANAGER, OPERATION_ID_PICK);
1131 ContactEditorForm::OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::GroupedTableView &tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewContextItem *pContextItem, bool activated)
1136 ContactEditorForm::OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::GroupedTableView &tableView, int groupIndex, Tizen::Ui::Controls::TableViewGroupItem *pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1141 ContactEditorForm::GetGroupCount(void)
1143 return GROUP_ITEM_COUNT;
1147 ContactEditorForm::GetItemCount(int groupIndex)
1153 case TABLE_VIEW_THUMBNAIL_FIELD_INDEX:
1158 case TABLE_VIEW_NAME_FIELD_INDEX:
1160 itemCount = NAME_FIELD_ITEM_COUNT;
1163 case TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX:
1165 itemCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER) + 1;
1167 if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER) > 1)
1169 __isDefaultPhoneNumberButtonEnabled = true;
1174 __isDefaultPhoneNumberButtonEnabled = false;
1178 case TABLE_VIEW_EMAIL_FIELD_INDEX:
1180 itemCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_EMAIL) + 1;
1183 case TABLE_VIEW_ADDRESS_FIELD_INDEX:
1185 itemCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_ADDRESS) + 1;
1188 case TABLE_VIEW_IM_ADDRESS_FIELD_INDEX:
1190 itemCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_IM_ADDRESS);
1192 if ((itemCount == 0 && __pImAddressFieldItem->GetCount() > 0) || itemCount > 0)
1198 case TABLE_VIEW_URL_FIELD_INDEX:
1200 itemCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_URL);
1202 if ((itemCount == 0 && __pUrlFieldItem->GetCount() > 0) || itemCount > 0)
1208 case TABLE_VIEW_BIRTHDAY_FIELD_INDEX:
1211 if (__pPresentationModel->GetBirthday(birthday) != E_SUCCESS)
1221 case TABLE_VIEW_NOTE_FIELD_INDEX:
1223 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_NOTE).IsEmpty() == false || __pNoteFieldItem != null )
1233 case TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX:
1238 case TABLE_VIEW_MORE_INFORMATION_FIELD_INDEX:
1240 if (IsMoreInformationButtonVisible())
1258 ContactEditorForm::GetDefaultGroupItemHeight(void)
1260 return H_EMPTY_SPACE;
1264 ContactEditorForm::GetDefaultItemHeight(void)
1266 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1267 return pContactsApp->GetListItemSingleLineHeight();
1271 ContactEditorForm::CreateGroupItem(int groupIndex, int itemWidth)
1273 int groupItemHeight = H_EMPTY_SPACE;
1275 if (groupIndex == TABLE_VIEW_THUMBNAIL_FIELD_INDEX)
1277 groupItemHeight = H_THUMBNAIL_GROUP_ITEM_HEIGHT;
1279 else if (groupIndex == TABLE_VIEW_NAME_FIELD_INDEX)
1281 groupItemHeight = H_NAMEFIELD_GROUP_ITEM_HEIGHT;
1283 else if (groupIndex == TABLE_VIEW_BIRTHDAY_FIELD_INDEX)
1285 groupItemHeight = Y_EDIT_FIELD_GAP;
1287 else if (groupIndex == TABLE_VIEW_NOTE_FIELD_INDEX)
1289 groupItemHeight = H_EDIT_FIELD_GAP;
1291 else if ((groupIndex > TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX && groupIndex < TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX) || groupIndex == TABLE_VIEW_MORE_INFORMATION_FIELD_INDEX)
1293 groupItemHeight = 0;
1296 TableViewGroupItem* pGroupItem = new (std::nothrow) TableViewGroupItem();
1297 pGroupItem->Construct(Dimension(itemWidth, groupItemHeight));
1298 pGroupItem->SetBackgroundColor(Color(COLOR_TABLE_VIEW_BG), TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1299 pGroupItem->SetEnabled(false);
1301 Panel* pPanel = new (std::nothrow) Panel();
1302 pPanel->Construct(Rectangle(0, -(H_DIVIDER), itemWidth, groupItemHeight + H_DIVIDER));
1303 pPanel->SetBackgroundColor(Color(COLOR_TABLE_VIEW_BG));
1305 pGroupItem->AddControl(pPanel);
1311 ContactEditorForm::DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem)
1320 ContactEditorForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
1322 TableViewItem* pItem = null;
1326 case TABLE_VIEW_THUMBNAIL_FIELD_INDEX:
1328 pItem = GetThumbnailField(itemWidth);
1331 case TABLE_VIEW_NAME_FIELD_INDEX:
1333 pItem = GetNameFields(itemWidth);
1336 case TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX:
1338 if ((itemIndex == __pTableView->GetItemCountAt(groupIndex) - 1) && __isDefaultPhoneNumberButtonEnabled == true)
1340 pItem = GetDefaultPhoneNumberItem(itemWidth);
1344 pItem = GetPhoneNumberFields(itemIndex, itemWidth);
1347 case TABLE_VIEW_EMAIL_FIELD_INDEX:
1349 pItem = GetEmailFields(itemIndex, itemWidth);
1352 case TABLE_VIEW_ADDRESS_FIELD_INDEX:
1354 pItem = GetAddressFields(itemIndex, itemWidth);
1357 case TABLE_VIEW_IM_ADDRESS_FIELD_INDEX:
1359 pItem = GetImAddressFields(itemIndex, itemWidth);
1362 case TABLE_VIEW_URL_FIELD_INDEX:
1364 pItem = GetUrlFields(itemIndex, itemWidth);
1367 case TABLE_VIEW_BIRTHDAY_FIELD_INDEX:
1369 pItem = GetBirthdayField(itemWidth);
1372 case TABLE_VIEW_NOTE_FIELD_INDEX:
1374 pItem = GetNoteField(itemWidth);
1377 case TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX:
1382 pItem = GetGroupsField(itemWidth);
1386 pItem = new (std::nothrow) TableViewItem();
1387 pItem->Construct(Dimension(itemWidth, H_DIVIDER * 2));
1388 pItem->SetEnabled(false);
1392 pItem = GetRingtoneField(itemWidth);
1399 case TABLE_VIEW_MORE_INFORMATION_FIELD_INDEX:
1401 if (IsMoreInformationButtonVisible())
1403 pItem = GetMoreInformationField(itemWidth);
1419 ContactEditorForm::DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
1421 if ((groupIndex > TABLE_VIEW_NAME_FIELD_INDEX && groupIndex < TABLE_VIEW_BIRTHDAY_FIELD_INDEX) || groupIndex == TABLE_VIEW_NOTE_FIELD_INDEX)
1424 __pDeletedItemList->IndexOf(*pItem, index);
1428 __pDeletedItemList->RemoveAt(index);
1435 else if (groupIndex == TABLE_VIEW_NAME_FIELD_INDEX)
1438 __pNameFieldItem = null;
1441 if (__pCurrentFocusedItem == pItem && __isKeypadOpened)
1443 __isKeypadOpened = false;
1453 ContactEditorForm::UpdateGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem *pItem)
1458 ContactEditorForm::UpdateItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem *pItem)
1467 case TABLE_VIEW_THUMBNAIL_FIELD_INDEX:
1469 SetThumbnailControls(*pItem, true);
1470 pItem->Invalidate(true);
1473 case TABLE_VIEW_NAME_FIELD_INDEX:
1475 if (__pCurrentFocusedItem == pItem && __isKeypadOpened)
1477 __isKeypadOpened = false;
1479 pItem->RemoveAllControls();
1480 SetNameFields(*pItem);
1484 case TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX:
1487 Panel* pPanel = static_cast<Panel*>(pItem->GetControl(0));
1494 Label* pLabel = static_cast<Label*>(pPanel->GetControl(1));
1503 valueString = __pPresentationModel->GetValue(DETAIL_PROPERTY_GROUP);
1504 if (valueString.IsEmpty() == true)
1506 valueString = ResourceManager::GetString(L"IDS_PB_BODY_NOT_ASSIGNED");
1509 else if (itemIndex == 2)
1511 String ringtoneName = __pPresentationModel->GetValue(DETAIL_PROPERTY_RINGTONE);
1514 ringtoneName.LastIndexOf(L"/", ringtoneName.GetLength() - 1, index);
1518 ringtoneName.SubString(index + 1, valueString);
1522 pLabel->SetText(valueString);
1523 pLabel->Invalidate(false);
1526 case TABLE_VIEW_BIRTHDAY_FIELD_INDEX:
1530 DateTime birthdayDate;
1531 EditDate* pBirthday = static_cast<EditDate *>(pItem->GetControl(1));
1533 if (pBirthday == null)
1538 __pPresentationModel->GetBirthday(birthdayDate);
1540 pBirthday->GetYearRange(min, max);
1541 max = birthdayDate.GetYear();
1542 pBirthday->SetYearRange(max - BIRTHDAY_MIN_YEAR_DIFF, max);
1543 pBirthday->SetDate(birthdayDate);
1544 pBirthday->Invalidate(false);
1547 case TABLE_VIEW_NOTE_FIELD_INDEX:
1549 Control* pNoteField = pItem->GetControl(1);
1550 Control* pNoteLabel = pItem->GetControl(0);
1551 if (pNoteField == null)
1556 pItem->SetSize(pItem->GetWidth(), pNoteLabel->GetHeight() + pNoteField->GetHeight() + H_EDIT_FIELD_GAP);
1564 Tizen::Ui::Controls::TableViewItem*
1565 ContactEditorForm::GetThumbnailField(int itemWidth)
1567 TableViewItem* pThumbnailItem = new (std::nothrow) TableViewItem();
1568 pThumbnailItem->Construct(Dimension(itemWidth, W_THUMBNAIL + H_THUMBNAIL_DELETE_BUTTON_GAP + Y_EDIT_FIELD_GAP * 2));
1569 pThumbnailItem->SetBackgroundColor(Color(0), TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1571 SetThumbnailControls(*pThumbnailItem);
1573 return pThumbnailItem;
1576 Tizen::Ui::Controls::TableViewItem*
1577 ContactEditorForm::GetNameFields(int itemWidth)
1579 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1581 __pNameFieldItem = new (std::nothrow) TableViewItem();
1582 __pNameFieldItem->Construct(Dimension(itemWidth, pContactsApp->GetListItemSingleLineHeight()));
1583 __pNameFieldItem->SetBackgroundColor(Color(0), TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1585 SetNameFields(*__pNameFieldItem);
1587 return __pNameFieldItem;
1591 ContactEditorForm::SetNameFields(Tizen::Ui::Controls::TableViewItem& item)
1593 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1595 int itemWidth = item.GetWidth();
1596 int itemHeight = pContactsApp->GetListItemSingleLineHeight();
1598 if (__isExpandable == true)
1600 itemHeight = DEFAULT_EXPAND_NAME_FIELD_COUNT * pContactsApp->GetListItemSingleLineHeight();
1602 if (__isJobTitleEnabled == true)
1604 itemHeight += pContactsApp->GetListItemSingleLineHeight();
1607 if (__isDepartmentEnabled)
1609 itemHeight += pContactsApp->GetListItemSingleLineHeight();
1613 item.SetSize(itemWidth, itemHeight);
1615 Rectangle itemBounds(W_ITEM_GAP, Y_EDIT_FIELD_GAP, itemWidth - (W_ITEM_GAP * 3) - H_BUTTON, pContactsApp->GetListItemSingleLineHeight() - H_EDIT_FIELD_GAP);
1617 if (__isExpandable == true)
1619 EditField* pFirstName = new (std::nothrow) EditField();
1620 pFirstName->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, false, __pPresentationModel->GetValue(DETAIL_PROPERTY_FIRST_NAME).GetLength() + EDIT_FIELD_EXTENDED_LENGTH);
1621 pFirstName->SetGuideText(ResourceManager::GetString(L"IDS_PB_BODY_FIRST_NAME"));
1622 pFirstName->AddFocusEventListener(*this);
1623 pFirstName->AddKeypadEventListener(*this);
1624 pFirstName->SetName(ResourceManager::GetString(L"IDS_PB_BODY_FIRST_NAME"));
1625 pFirstName->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_FIRST_NAME));
1626 pFirstName->AddTextEventListener(*this);
1627 pFirstName->SetTextSize(pContactsApp->GetFontSize());
1629 item.AddControl(pFirstName);
1630 item.SetIndividualSelectionEnabled(pFirstName, true);
1632 itemBounds.y += pContactsApp->GetListItemSingleLineHeight();
1633 EditField* pMiddleName = new (std::nothrow) EditField();
1634 pMiddleName->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, false, __pPresentationModel->GetValue(DETAIL_PROPERTY_MIDDLE_NAME).GetLength() + EDIT_FIELD_EXTENDED_LENGTH);
1635 pMiddleName->SetGuideText(ResourceManager::GetString(L"IDS_PB_BODY_MIDDLE_NAME"));
1636 pMiddleName->AddFocusEventListener(*this);
1637 pMiddleName->AddKeypadEventListener(*this);
1638 pMiddleName->AddTextEventListener(*this);
1639 pMiddleName->SetName(ResourceManager::GetString(L"IDS_PB_BODY_MIDDLE_NAME"));
1640 pMiddleName->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_MIDDLE_NAME));
1641 pMiddleName->SetTextSize(pContactsApp->GetFontSize());
1643 item.AddControl(pMiddleName);
1644 item.SetIndividualSelectionEnabled(pMiddleName, true);
1646 itemBounds.y += pContactsApp->GetListItemSingleLineHeight();
1647 EditField* pLastName = new (std::nothrow) EditField();
1648 pLastName->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, false, __pPresentationModel->GetValue(DETAIL_PROPERTY_LAST_NAME).GetLength() + EDIT_FIELD_EXTENDED_LENGTH);
1649 pLastName->SetGuideText(ResourceManager::GetString(L"IDS_PB_BODY_LAST_NAME"));
1650 pLastName->AddFocusEventListener(*this);
1651 pLastName->AddKeypadEventListener(*this);
1652 pLastName->SetName(ResourceManager::GetString(L"IDS_PB_BODY_LAST_NAME"));
1653 pLastName->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_LAST_NAME));
1654 pLastName->SetTextSize(pContactsApp->GetFontSize());
1655 pLastName->AddTextEventListener(*this);
1657 item.AddControl(pLastName);
1658 item.SetIndividualSelectionEnabled(pLastName, true);
1660 itemBounds.y += pContactsApp->GetListItemSingleLineHeight();
1661 EditField* pSuffix = new (std::nothrow) EditField();
1662 pSuffix->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, false, __pPresentationModel->GetValue(DETAIL_PROPERTY_NAME_SUFFIX).GetLength() + EDIT_FIELD_EXTENDED_LENGTH);
1663 pSuffix->SetGuideText(ResourceManager::GetString(L"IDS_PB_BODY_SUFFIX"));
1664 pSuffix->AddFocusEventListener(*this);
1665 pSuffix->AddKeypadEventListener(*this);
1666 pSuffix->AddTextEventListener(*this);
1667 pSuffix->SetName(ResourceManager::GetString(L"IDS_PB_BODY_SUFFIX"));
1668 pSuffix->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_NAME_SUFFIX));
1669 pSuffix->SetTextSize(pContactsApp->GetFontSize());
1671 item.AddControl(pSuffix);
1672 item.SetIndividualSelectionEnabled(pSuffix, true);
1674 itemBounds.y += pContactsApp->GetListItemSingleLineHeight();
1675 EditField* pNickName = new (std::nothrow) EditField();
1676 pNickName->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY);
1677 pNickName->SetGuideText(ResourceManager::GetString(L"IDS_PB_BODY_NICKNAME"));
1678 pNickName->AddFocusEventListener(*this);
1679 pNickName->AddKeypadEventListener(*this);
1680 pNickName->AddTextEventListener(*this);
1681 pNickName->SetName(ResourceManager::GetString(L"IDS_PB_BODY_NICKNAME"));
1682 pNickName->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_NICK_NAME));
1683 pNickName->SetTextSize(pContactsApp->GetFontSize());
1685 item.AddControl(pNickName);
1686 item.SetIndividualSelectionEnabled(pNickName, true);
1688 itemBounds.y += pContactsApp->GetListItemSingleLineHeight();
1689 if (__isJobTitleEnabled == true)
1691 EditField* pJobTitle = new (std::nothrow) EditField();
1692 pJobTitle->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY);
1693 pJobTitle->SetGuideText(ResourceManager::GetString(L"IDS_PB_BODY_JOB_TITLE"));
1694 pJobTitle->AddFocusEventListener(*this);
1695 pJobTitle->AddKeypadEventListener(*this);
1696 pJobTitle->AddTextEventListener(*this);
1697 pJobTitle->SetName(ResourceManager::GetString(L"IDS_PB_BODY_JOB_TITLE"));
1698 pJobTitle->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_JOB_TITLE));
1699 pJobTitle->SetTextSize(pContactsApp->GetFontSize());
1701 item.AddControl(pJobTitle);
1702 item.SetIndividualSelectionEnabled(pJobTitle, true);
1704 itemBounds.y += pContactsApp->GetListItemSingleLineHeight();
1707 if (__isDepartmentEnabled == true)
1709 EditField* pDepartment = new (std::nothrow) EditField();
1710 pDepartment->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY);
1711 pDepartment->SetGuideText(ResourceManager::GetString(L"IDS_PB_BODY_DEPARTMENT"));
1712 pDepartment->AddFocusEventListener(*this);
1713 pDepartment->AddKeypadEventListener(*this);
1714 pDepartment->AddTextEventListener(*this);
1715 pDepartment->SetName(ResourceManager::GetString(L"IDS_PB_BODY_DEPARTMENT"));
1716 pDepartment->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_DEPARTMENT));
1717 pDepartment->SetTextSize(pContactsApp->GetFontSize());
1719 item.AddControl(pDepartment);
1720 item.SetIndividualSelectionEnabled(pDepartment, true);
1722 itemBounds.y += pContactsApp->GetListItemSingleLineHeight();
1725 EditField* pCompanyName = new (std::nothrow) EditField();
1726 pCompanyName->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY);
1727 pCompanyName->SetGuideText(ResourceManager::GetString(L"IDS_PB_BODY_COMPANY"));
1728 pCompanyName->AddFocusEventListener(*this);
1729 pCompanyName->AddKeypadEventListener(*this);
1730 pCompanyName->SetName(ResourceManager::GetString(L"IDS_PB_BODY_COMPANY"));
1731 pCompanyName->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_COMPANY));
1732 pCompanyName->SetTextSize(pContactsApp->GetFontSize());
1734 item.AddControl(pCompanyName);
1735 item.SetIndividualSelectionEnabled(pCompanyName, true);
1740 String firstName(__pPresentationModel->GetValue(DETAIL_PROPERTY_FIRST_NAME));
1741 String lastName(__pPresentationModel->GetValue(DETAIL_PROPERTY_LAST_NAME));
1742 String middleName(__pPresentationModel->GetValue(DETAIL_PROPERTY_MIDDLE_NAME));
1743 String suffix(__pPresentationModel->GetValue(DETAIL_PROPERTY_NAME_SUFFIX));
1745 nameLength = firstName.GetLength() + lastName.GetLength() + middleName.GetLength();
1746 if (suffix.IsEmpty() == false)
1748 nameLength = nameLength + suffix.GetLength() + 1;
1751 EditField* pName = new (std::nothrow) EditField();
1752 pName->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, false, nameLength + EDIT_FIELD_EXTENDED_LENGTH);
1753 pName->SetGuideText(ResourceManager::GetString(L"IDS_COM_BODY_DETAILS_NAME"));
1754 pName->AddFocusEventListener(*this);
1755 pName->AddKeypadEventListener(*this);
1756 pName->SetName(Integer::ToString(IDA_INPUT_FIELD_DISPLAY_NAME));
1757 pName->AddTextEventListener(*this);
1758 pName->SetTextSize(pContactsApp->GetFontSize());
1760 if (firstName.IsEmpty() == false)
1762 pName->SetText(firstName);
1765 if (middleName.IsEmpty() == false)
1767 pName->AppendText(CHARACTER_SPACE + middleName);
1770 if (lastName.IsEmpty() == false)
1772 pName->AppendText(CHARACTER_SPACE + lastName);
1775 if (suffix.IsEmpty() == false)
1777 pName->AppendText(DELIMITER_COMMA);
1778 pName->AppendText(CHARACTER_SPACE + suffix);
1781 item.AddControl(pName);
1782 item.SetIndividualSelectionEnabled(pName, true);
1783 __fullName = pName->GetText();
1786 Button* pButtonExpand = new (std::nothrow) Button();
1787 pButtonExpand->Construct(Rectangle(itemWidth - (H_BUTTON + W_ITEM_GAP), (pContactsApp->GetListItemSingleLineHeight() - H_BUTTON) / 2, H_BUTTON, H_BUTTON));
1788 pButtonExpand->SetActionId(IDA_BUTTON_EXPANDABLE);
1789 pButtonExpand->SetName(EXPAND_BUTTON);
1790 pButtonExpand->AddActionEventListener(*this);
1792 Bitmap* pBitmap = null;
1793 Bitmap* pBitmapPressed = null;
1795 if (__isExpandable == true)
1797 pBitmap = ResourceManager::GetBitmapN(IDB_EXPAND_OPENED);
1798 pBitmapPressed = ResourceManager::GetBitmapN(IDB_EXPAND_OPENED_PRESSED);
1802 pBitmap = ResourceManager::GetBitmapN(IDB_EXPAND_CLOSED);
1803 pBitmapPressed = ResourceManager::GetBitmapN(IDB_EXPAND_CLOSED_PRESSED);
1806 if (pBitmap != null)
1808 pButtonExpand->SetNormalBitmap(Point(0, 0), *pBitmap);
1811 if (pBitmapPressed != null)
1813 pButtonExpand->SetPressedBitmap(Point(0, 0), *pBitmapPressed);
1817 delete pBitmapPressed;
1819 pBitmap = ResourceManager::GetBitmapN(IDB_EXPAND_BUTTON_NORMAL);
1820 pBitmapPressed = ResourceManager::GetBitmapN(IDB_EXPAND_BUTTON_PRESSED);
1822 if (pBitmap != null)
1824 pButtonExpand->SetNormalBackgroundBitmap(*pBitmap);
1827 if (pBitmapPressed != null)
1829 pButtonExpand->SetPressedBackgroundBitmap(*pBitmapPressed);
1830 delete pBitmapPressed;
1833 item.AddControl(pButtonExpand);
1834 item.SetIndividualSelectionEnabled(pButtonExpand, true);
1837 Tizen::Ui::Controls::TableViewItem*
1838 ContactEditorForm::GetInputFieldN(int groupIndex, int itemIndex, int itemWidth, Tizen::Ui::Controls::EditFieldStyle style, const Tizen::Base::String& titleText, const Tizen::Base::String& guideText, const Tizen::Base::String& text, bool isDeleteButton)
1840 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1842 TableViewItem* pTableViewItem = new (std::nothrow) TableViewItem();
1843 pTableViewItem->Construct(Dimension(itemWidth, pContactsApp->GetListItemSingleLineHeight()), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1844 pTableViewItem->SetBackgroundColor(Color(0), TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1846 EditField* pInputField = new (std::nothrow) EditField();
1847 pInputField->Construct(Rectangle(W_ITEM_GAP, Y_EDIT_FIELD_GAP, itemWidth - (W_ITEM_GAP * 4) - H_BUTTON - W_TYPE_BUTTON, pContactsApp->GetListItemSingleLineHeight() - H_EDIT_FIELD_GAP), style, INPUT_STYLE_OVERLAY);
1848 pInputField->SetGuideText(guideText);
1849 pInputField->SetText(text);
1850 pInputField->SetTextSize(pContactsApp->GetFontSize());
1851 pInputField->AddKeypadEventListener(*this);
1852 pInputField->AddFocusEventListener(*this);
1853 pInputField->AddTextEventListener(*this);
1854 pInputField->SetEnabled(true);
1856 int parsedItemIndex = 0;
1857 parsedItemIndex |= (groupIndex << TABLE_VIEW_INPUT_FIELD_ACTION_SHIFT);
1858 parsedItemIndex |= (groupIndex << TABLE_VIEW_GROUP_INDEX_SHIFT);
1859 parsedItemIndex |= itemIndex;
1861 pInputField->SetName(Integer::ToString(parsedItemIndex));
1862 pTableViewItem->AddControl(pInputField);
1864 Button *pButtonType = new (std::nothrow) Button();
1865 pButtonType->Construct(Rectangle(pInputField->GetX() + pInputField->GetWidth() + W_ITEM_GAP, (pContactsApp->GetListItemSingleLineHeight() - H_BUTTON) / 2, W_TYPE_BUTTON, H_BUTTON));
1866 pButtonType->SetText(titleText);
1867 pButtonType->SetActionId(IDA_BUTTON_TYPE);
1868 pButtonType->AddActionEventListener(*this);
1869 pButtonType->AddTouchEventListener(*this);
1870 pButtonType->SetName(Integer::ToString(parsedItemIndex));
1872 Bitmap* pDropBoxIcon = ResourceManager::GetBitmapN(IDB_BUTTON_DROPBOX);
1874 if (pDropBoxIcon != null)
1876 pButtonType->SetNormalBitmap(Point(W_TYPE_BUTTON - W_DROPBOX_ICON, H_BUTTON - H_DROPBOX_ICON), *pDropBoxIcon);
1877 pButtonType->SetPressedBitmap(Point(W_TYPE_BUTTON - W_DROPBOX_ICON, H_BUTTON - H_DROPBOX_ICON), *pDropBoxIcon);
1878 pButtonType->SetDisabledBitmap(Point(W_TYPE_BUTTON - W_DROPBOX_ICON, H_BUTTON - H_DROPBOX_ICON), *pDropBoxIcon);
1879 delete pDropBoxIcon;
1881 pTableViewItem->AddControl(pButtonType);
1883 Button *pButtonDelete = new (std::nothrow) Button();
1884 pButtonDelete->Construct(Rectangle(itemWidth - H_BUTTON - W_ITEM_GAP, (pContactsApp->GetListItemSingleLineHeight() - H_BUTTON) / 2, H_BUTTON, H_BUTTON));
1885 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_MINUS);
1886 Bitmap* pBitmapPressed = ResourceManager::GetBitmapN(IDB_BUTTON_MINUS_PRESSED);
1888 if (pBitmap != null)
1890 pButtonDelete->SetNormalBitmap(Point(0, 0), *pBitmap);
1893 if (pBitmapPressed != null)
1895 pButtonDelete->SetPressedBitmap(Point(0, 0), *pBitmapPressed);
1896 delete pBitmapPressed;
1899 pBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_DELETE_NORMAL);
1900 pBitmapPressed = ResourceManager::GetBitmapN(IDB_BUTTON_DELETE_PRESSED);
1902 if (pBitmap != null)
1904 pButtonDelete->SetNormalBackgroundBitmap(*pBitmap);
1907 if (pBitmapPressed != null)
1909 pButtonDelete->SetPressedBackgroundBitmap(*pBitmapPressed);
1910 delete pBitmapPressed;
1914 actionId |= TABLE_VIEW_DELETE_INPUT_FIELD_ID;
1915 actionId |= (groupIndex << TABLE_VIEW_GROUP_INDEX_SHIFT);
1916 actionId |= itemIndex;
1918 pButtonDelete->SetActionId(actionId);
1919 pButtonDelete->AddActionEventListener(*this);
1921 pTableViewItem->AddControl(pButtonDelete);
1923 if (isDeleteButton == false)
1925 pButtonDelete->SetShowState(false);
1928 pTableViewItem->SetIndividualSelectionEnabled(pInputField, true);
1929 pTableViewItem->SetIndividualSelectionEnabled(pButtonType, true);
1930 pTableViewItem->SetIndividualSelectionEnabled(pButtonDelete, true);
1932 return pTableViewItem;
1935 Tizen::Ui::Controls::TableViewItem*
1936 ContactEditorForm::GetPhoneNumberFields(int itemIndex, int itemWidth)
1938 if (__pPhoneNumberFieldItem->GetCount() == 0)
1940 int phoneNumberCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER);
1941 String guideText = ResourceManager::GetString(L"IDS_PB_BODY_NUMBER");
1942 String defaultPhoneNumber = __pPresentationModel->GetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER);
1944 for (int i = 0; i < phoneNumberCount; i++)
1946 String typeString = __pPresentationModel->GetType(DETAIL_PROPERTY_PHONE_NUMBER, i);
1947 String phoneNumberString = __pPresentationModel->GetValue(DETAIL_PROPERTY_PHONE_NUMBER, i);
1949 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX, i, itemWidth, EDIT_FIELD_STYLE_PHONE_NUMBER, typeString, guideText, phoneNumberString, true);
1950 pItem->SetName(Integer::ToString(__pPresentationModel->GetPhoneNumberType(i)));
1952 __pPhoneNumberFieldItem->Add(*pItem);
1955 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX, phoneNumberCount, itemWidth, EDIT_FIELD_STYLE_PHONE_NUMBER, __pPresentationModel->GetPhoneNumberTypeString(DETAIL_PHONENUMBER_TYPE_MOBILE), guideText);
1956 pItem->SetName(Integer::ToString(DETAIL_PHONENUMBER_TYPE_MOBILE));
1958 __pPhoneNumberFieldItem->Add(*pItem);
1959 SetAsDefaultPhoneNumber(__pPresentationModel->GetDefaultNumberIndex());
1962 if (__pPhoneNumberFieldItem->GetCount() < (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER) + 1))
1964 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX, __pPhoneNumberFieldItem->GetCount(), itemWidth, EDIT_FIELD_STYLE_PHONE_NUMBER, __pPresentationModel->GetPhoneNumberTypeString(DETAIL_PHONENUMBER_TYPE_MOBILE), ResourceManager::GetString(L"IDS_PB_BODY_NUMBER"));
1965 pItem->SetName(Integer::ToString(DETAIL_PHONENUMBER_TYPE_MOBILE));
1967 __pPhoneNumberFieldItem->Add(*pItem);
1970 TableViewItem* pItem = static_cast<TableViewItem *>(__pPhoneNumberFieldItem->GetAt(itemIndex));
1979 Tizen::Ui::Controls::TableViewItem*
1980 ContactEditorForm::GetEmailFields(int itemIndex, int itemWidth)
1982 if (__pEmailFieldItem->GetCount() == 0)
1984 int emailCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_EMAIL);
1985 String guideText = ResourceManager::GetString(L"IDS_COM_BODY_EMAIL");
1987 for (int i = 0; i < emailCount; i++)
1989 String typeString = __pPresentationModel->GetType(DETAIL_PROPERTY_EMAIL, i);
1990 String emailString = __pPresentationModel->GetValue(DETAIL_PROPERTY_EMAIL, i);
1992 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_EMAIL_FIELD_INDEX, i, itemWidth, EDIT_FIELD_STYLE_EMAIL, typeString, guideText, emailString, true);
1993 pItem->SetName(Integer::ToString(__pPresentationModel->GetEmailType(i)));
1995 __pEmailFieldItem->Add(*pItem);
1998 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_EMAIL_FIELD_INDEX, emailCount, itemWidth, EDIT_FIELD_STYLE_EMAIL, __pPresentationModel->GetEmailTypeString(DETAIL_EMAIL_TYPE_HOME), guideText);
1999 pItem->SetName(Integer::ToString(DETAIL_EMAIL_TYPE_HOME));
2001 __pEmailFieldItem->Add(*pItem);
2004 if (__pEmailFieldItem->GetCount() < (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_EMAIL) + 1))
2006 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_EMAIL_FIELD_INDEX, __pEmailFieldItem->GetCount(), itemWidth, EDIT_FIELD_STYLE_EMAIL, __pPresentationModel->GetEmailTypeString(DETAIL_EMAIL_TYPE_HOME), ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"));
2007 pItem->SetName(Integer::ToString(DETAIL_EMAIL_TYPE_HOME));
2009 __pEmailFieldItem->Add(*pItem);
2012 TableViewItem* pItem = static_cast<TableViewItem *>(__pEmailFieldItem->GetAt(itemIndex));
2021 Tizen::Ui::Controls::TableViewItem*
2022 ContactEditorForm::GetAddressFields(int itemIndex, int itemWidth)
2024 if (__pAddressFieldItem->GetCount() == 0)
2026 int addressCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_ADDRESS);
2027 String guideText = ResourceManager::GetString(L"IDS_PB_BODY_ADDRESS");
2029 for (int i = 0; i < addressCount; i++)
2031 String typeString = __pPresentationModel->GetType(DETAIL_PROPERTY_ADDRESS, i);
2032 String addressString = __pPresentationModel->GetValue(DETAIL_PROPERTY_ADDRESS, i);
2034 TableViewItem* pItem= GetInputFieldN(TABLE_VIEW_ADDRESS_FIELD_INDEX, i, itemWidth, EDIT_FIELD_STYLE_NORMAL, typeString, guideText, addressString, true);
2035 pItem->SetName(Integer::ToString(__pPresentationModel->GetAddressType(DETAIL_PROPERTY_ADDRESS, i)));
2037 __pAddressFieldItem->Add(*pItem);
2040 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_ADDRESS_FIELD_INDEX, addressCount, itemWidth, EDIT_FIELD_STYLE_NORMAL, ResourceManager::GetString(L"IDS_PB_BODY_HOME"), guideText);
2041 pItem->SetName(Integer::ToString(DETAIL_ADDRESS_TYPE_HOME));
2043 __pAddressFieldItem->Add(*pItem);
2046 if (__pAddressFieldItem->GetCount() < (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_ADDRESS) + 1))
2048 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_ADDRESS_FIELD_INDEX, __pAddressFieldItem->GetCount(), itemWidth, EDIT_FIELD_STYLE_NORMAL, ResourceManager::GetString(L"IDS_PB_BODY_HOME"), ResourceManager::GetString(L"IDS_PB_BODY_ADDRESS"));
2049 pItem->SetName(Integer::ToString(DETAIL_ADDRESS_TYPE_HOME));
2051 __pAddressFieldItem->Add(*pItem);
2054 TableViewItem* pItem = static_cast<TableViewItem *>(__pAddressFieldItem->GetAt(itemIndex));
2063 Tizen::Ui::Controls::TableViewItem*
2064 ContactEditorForm::GetImAddressFields(int itemIndex, int itemWidth)
2066 if (__pImAddressFieldItem->GetCount() == 0)
2068 int imCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_IM_ADDRESS);
2069 String guideText = ResourceManager::GetString(L"IDS_PB_HEADER_INSTANT_MESSENGER_ABB");
2071 for (int i = 0; i < imCount; i++)
2073 String typeString = __pPresentationModel->GetType(DETAIL_PROPERTY_IM_ADDRESS, i);
2074 String imString = __pPresentationModel->GetValue(DETAIL_PROPERTY_IM_ADDRESS, i);
2076 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_IM_ADDRESS_FIELD_INDEX, i, itemWidth, EDIT_FIELD_STYLE_NORMAL, typeString, guideText, imString, true);
2077 pItem->SetName(Integer::ToString(__pPresentationModel->GetImAddressType(i)));
2079 __pImAddressFieldItem->Add(*pItem);
2082 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_IM_ADDRESS_FIELD_INDEX, imCount, itemWidth, EDIT_FIELD_STYLE_NORMAL, IM_ADDRESS_YAHOO, guideText);
2083 pItem->SetName(Integer::ToString(DETAIL_IM_ADDRESS_TYPE_YAHOO));
2085 __pImAddressFieldItem->Add(*pItem);
2088 if (__pImAddressFieldItem->GetCount() < (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_IM_ADDRESS) + 1))
2090 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_IM_ADDRESS_FIELD_INDEX, __pImAddressFieldItem->GetCount(), itemWidth, EDIT_FIELD_STYLE_NORMAL, IM_ADDRESS_YAHOO, ResourceManager::GetString(L"IDS_PB_HEADER_INSTANT_MESSENGER_ABB"));
2091 pItem->SetName(Integer::ToString(DETAIL_IM_ADDRESS_TYPE_YAHOO));
2093 __pImAddressFieldItem->Add(*pItem);
2096 TableViewItem* pItem = static_cast<TableViewItem *>(__pImAddressFieldItem->GetAt(itemIndex));
2105 Tizen::Ui::Controls::TableViewItem*
2106 ContactEditorForm::GetUrlFields(int itemIndex, int itemWidth)
2108 if (__pUrlFieldItem->GetCount() == 0)
2110 int urlCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_URL);
2111 String guideText = ResourceManager::GetString(L"IDS_PB_BODY_URL");
2113 for (int i = 0; i < urlCount; i++)
2115 String typeString = __pPresentationModel->GetType(DETAIL_PROPERTY_URL, i);
2116 String urlString = __pPresentationModel->GetValue(DETAIL_PROPERTY_URL, i);
2118 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_URL_FIELD_INDEX, i, itemWidth, EDIT_FIELD_STYLE_URL, typeString, guideText, urlString, true);
2119 pItem->SetName(Integer::ToString(__pPresentationModel->GetUrlType(i)));
2121 __pUrlFieldItem->Add(*pItem);
2124 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_URL_FIELD_INDEX, urlCount, itemWidth, EDIT_FIELD_STYLE_URL, __pPresentationModel->GetUrlTypeString(DETAIL_URL_TYPE_HOME), guideText);
2125 pItem->SetName(Integer::ToString(DETAIL_URL_TYPE_HOME));
2127 __pUrlFieldItem->Add(*pItem);
2130 if (__pUrlFieldItem->GetCount() < (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_URL) + 1))
2132 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_URL_FIELD_INDEX, __pUrlFieldItem->GetCount(), itemWidth, EDIT_FIELD_STYLE_URL, __pPresentationModel->GetUrlTypeString(DETAIL_URL_TYPE_HOME), ResourceManager::GetString(L"IDS_PB_BODY_URL"));
2133 pItem->SetName(Integer::ToString(DETAIL_URL_TYPE_HOME));
2135 __pUrlFieldItem->Add(*pItem);
2138 TableViewItem* pItem = static_cast<TableViewItem *>(__pUrlFieldItem->GetAt(itemIndex));
2146 Tizen::Ui::Controls::TableViewItem*
2147 ContactEditorForm::GetGroupsField(int itemWidth)
2149 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
2151 TableViewItem* pGroupsItem = new (std::nothrow) TableViewItem();
2152 pGroupsItem->Construct(Dimension(itemWidth, H_DOUBLE_LINE_ITEM + pContactsApp->GetFontHeightOffset()), TABLE_VIEW_ANNEX_STYLE_NORMAL);
2153 pGroupsItem->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND);
2154 pGroupsItem->AddKeyEventListener(*this);
2156 Panel* pGroupStyle = new (std::nothrow) Panel();
2157 pGroupStyle->Construct(Rectangle(0, 0, itemWidth , H_DOUBLE_LINE_ITEM + pContactsApp->GetFontHeightOffset()), GROUP_STYLE_NONE);
2158 pGroupStyle->SetName(GROUP_STYLE_PANEL);
2159 pGroupStyle->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND);
2160 pGroupStyle->AddTouchEventListener(*this);
2161 pGroupsItem->AddControl(pGroupStyle);
2163 Label* pLabelTitle = new (std::nothrow) Label();
2164 pLabelTitle->Construct(Rectangle(0, H_GROUP_RINGTONE_TITLE_GAP, itemWidth, H_GROUP_RINGTONE_TITLE_LABEL), ResourceManager::GetString(L"IDS_PB_BODY_GROUPS"));
2165 pLabelTitle->SetName(GROUP_LABEL_TITLE);
2166 pLabelTitle->AddTouchEventListener(*this);
2167 pLabelTitle->SetTextConfig(FONT_SIZE_TITLE_TEXT, LABEL_TEXT_STYLE_BOLD);
2168 pLabelTitle->SetTextColor(COLOR_ITEM_TITLE);
2169 pLabelTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
2171 pGroupStyle->AddControl(pLabelTitle);
2173 String groupsName = __pPresentationModel->GetValue(DETAIL_PROPERTY_GROUP);
2174 if (groupsName.IsEmpty() == true)
2176 groupsName = ResourceManager::GetString(L"IDS_PB_BODY_NOT_ASSIGNED");
2179 Label* pLabelGroupName = new (std::nothrow) Label();
2180 pLabelGroupName->Construct(Rectangle(0, H_GROUP_RINGTONE_TITLE_GAP + H_GROUP_RINGTONE_TITLE_LABEL, itemWidth, H_GROUP_RINGTONE_VALUE_LABEL + pContactsApp->GetFontHeightOffset()), groupsName);
2181 pLabelGroupName->SetName(GROUP_LABEL_VALUE);
2182 pLabelGroupName->AddTouchEventListener(*this);
2183 pLabelGroupName->SetTextConfig(pContactsApp->GetFontSize(), LABEL_TEXT_STYLE_NORMAL);
2184 pLabelGroupName->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
2186 pGroupStyle->AddControl(pLabelGroupName);
2191 Tizen::Ui::Controls::TableViewItem*
2192 ContactEditorForm::GetBirthdayField(int itemWidth)
2194 DateTime birthdayDate;
2195 EditDate* pBirthday = new (std::nothrow) EditDate();
2196 pBirthday->Construct(Point(W_TITLE_LABEL, 0));
2197 pBirthday->AddDateChangeEventListener(*this);
2199 __pPresentationModel->GetBirthday(birthdayDate);
2200 pBirthday->SetDate(birthdayDate);
2202 DateTime currentDate;
2203 Tizen::System::SystemTime::GetCurrentTime(currentDate);
2206 pBirthday->GetYearRange(min, max);
2207 max = currentDate.GetYear();
2208 pBirthday->SetYearRange(max - BIRTHDAY_MIN_YEAR_DIFF, max);
2210 TableViewItem* pBirthdayItem = new (std::nothrow) TableViewItem();
2211 pBirthdayItem->Construct(Dimension(itemWidth, H_ITEM), TABLE_VIEW_ANNEX_STYLE_NORMAL);
2212 pBirthdayItem->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
2213 pBirthdayItem->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
2215 Label* pLabelTitle = new (std::nothrow) Label();
2216 pLabelTitle->Construct(Rectangle(0, 0, W_TITLE_LABEL, pBirthdayItem->GetHeight()), L"");
2217 pLabelTitle->SetText(ResourceManager::GetString(L"IDS_PB_BODY_BIRTHDAY"));
2218 pLabelTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
2219 pLabelTitle->SetTextColor(COLOR_ITEM_TITLE);
2220 pLabelTitle->SetTextConfig(FONT_SIZE_TITLE_TEXT, LABEL_TEXT_STYLE_BOLD);
2222 pBirthdayItem->AddControl(pLabelTitle);
2223 pBirthdayItem->AddControl(pBirthday);
2225 Button* pClearButton = new (std::nothrow) Button();
2226 pClearButton->Construct(Rectangle(itemWidth - (H_BUTTON * 2) - H_BUTTON/2, (pBirthdayItem->GetHeight() - H_BUTTON) / 2, H_BUTTON, H_BUTTON));
2227 pClearButton->SetActionId(IDA_BUTTON_BIRTHDAY_CLEAR);
2228 pClearButton->AddActionEventListener(*this);
2230 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_RESET_NORMAL);
2231 if (pBitmap != null)
2233 pClearButton->SetNormalBitmap(Point(0, 0), *pBitmap);
2236 pBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_RESET_PRESSED);
2237 if (pBitmap != null)
2239 pClearButton->SetPressedBitmap(Point(0, 0), *pBitmap);
2243 pBirthdayItem->AddControl(pClearButton);
2245 Button *pButtonDelete = new (std::nothrow) Button();
2246 pButtonDelete->Construct(Rectangle(itemWidth - H_BUTTON - W_ITEM_GAP, (H_ITEM - H_BUTTON) / 2, H_BUTTON, H_BUTTON));
2248 pBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_MINUS);
2249 if (pBitmap != null)
2251 pButtonDelete->SetNormalBitmap(Point(0, 0), *pBitmap);
2255 pBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_MINUS_PRESSED);
2256 if (pBitmap != null)
2258 pButtonDelete->SetPressedBitmap(Point(0, 0), *pBitmap);
2262 pBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_DELETE_NORMAL);
2263 if (pBitmap != null)
2265 pButtonDelete->SetNormalBackgroundBitmap(*pBitmap);
2269 pBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_DELETE_PRESSED);
2270 if (pBitmap != null)
2272 pButtonDelete->SetPressedBackgroundBitmap(*pBitmap);
2276 pButtonDelete->SetActionId(IDA_BUTTON_BIRTHDAY_DELETE);
2277 pButtonDelete->AddActionEventListener(*this);
2279 pBirthdayItem->AddControl(pButtonDelete);
2281 pBirthdayItem->SetIndividualSelectionEnabled(pBirthday, true);
2282 pBirthdayItem->SetIndividualSelectionEnabled(pClearButton, true);
2283 pBirthdayItem->SetIndividualSelectionEnabled(pButtonDelete, true);
2285 return pBirthdayItem;
2288 Tizen::Ui::Controls::TableViewItem*
2289 ContactEditorForm::GetNoteField(int itemWidth)
2291 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
2293 if (__pNoteFieldItem != null)
2295 return __pNoteFieldItem;
2298 __pNoteFieldItem = new (std::nothrow) TableViewItem();
2299 __pNoteFieldItem->Construct(Dimension(itemWidth, H_DOUBLE_LINE_ITEM + pContactsApp->GetListItemSingleLineHeight()), TABLE_VIEW_ANNEX_STYLE_NORMAL);
2300 __pNoteFieldItem->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
2301 __pNoteFieldItem->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
2304 Label* pNoteTitle = new (std::nothrow) Label();
2305 pNoteTitle->Construct(Rectangle(0, 0, itemWidth, H_LABEL), ResourceManager::GetString(L"IDS_PB_BODY_NOTE"));
2306 pNoteTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
2307 pNoteTitle->SetTextColor(COLOR_ITEM_TITLE);
2308 pNoteTitle->SetTextConfig(FONT_SIZE_TITLE_TEXT, LABEL_TEXT_STYLE_BOLD);
2309 __pNoteFieldItem->AddControl(pNoteTitle);
2311 ExpandableEditArea* pNoteEditArea = new (std::nothrow) ExpandableEditArea();
2312 pNoteEditArea->Construct(Rectangle(Y_EDIT_FIELD_GAP, H_LABEL, itemWidth - H_EDIT_FIELD_GAP, H_DOUBLE_LINE_ITEM + pContactsApp->GetListItemSingleLineHeight() - H_LABEL - H_EDIT_FIELD_GAP), EXPANDABLE_EDIT_AREA_STYLE_NORMAL, EXPANDABLE_EDIT_AREA_TITLE_STYLE_NONE);
2313 pNoteEditArea->SetTitleText(ResourceManager::GetString(L"IDS_PB_BODY_NOTE"));
2314 pNoteEditArea->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_NOTE));
2315 pNoteEditArea->AddExpandableEditAreaEventListener(*this);
2316 pNoteEditArea->AddKeypadEventListener(*this);
2317 pNoteEditArea->AddFocusEventListener(*this);
2318 pNoteEditArea->SetTextSize(pContactsApp->GetFontSize());
2319 pNoteEditArea->AddTextEventListener(*this);
2321 __pNoteFieldItem->AddControl(pNoteEditArea);
2322 __pNoteFieldItem->SetIndividualSelectionEnabled(pNoteEditArea, true);
2324 return __pNoteFieldItem;
2327 Tizen::Ui::Controls::TableViewItem*
2328 ContactEditorForm::GetRingtoneField(int itemWidth)
2330 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
2332 TableViewItem* pRingtoneItem = new (std::nothrow) TableViewItem();
2333 pRingtoneItem->Construct(Dimension(itemWidth, H_DOUBLE_LINE_ITEM + pContactsApp->GetFontHeightOffset()), TABLE_VIEW_ANNEX_STYLE_NORMAL);
2334 pRingtoneItem->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND);
2335 pRingtoneItem->AddKeyEventListener(*this);
2337 Panel* pGroupStyle = new (std::nothrow) Panel();
2338 pGroupStyle->Construct(Rectangle(0, 0, itemWidth , H_DOUBLE_LINE_ITEM + pContactsApp->GetFontHeightOffset()), GROUP_STYLE_NONE);
2339 pGroupStyle->SetName(GROUP_STYLE_PANEL);
2340 pGroupStyle->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND);
2341 pGroupStyle->AddTouchEventListener(*this);
2342 pRingtoneItem->AddControl(pGroupStyle);
2344 Label* pLabelTitle = new (std::nothrow) Label();
2345 pLabelTitle->Construct(Rectangle(0, H_GROUP_RINGTONE_TITLE_GAP, itemWidth, H_GROUP_RINGTONE_TITLE_LABEL), ResourceManager::GetString(L"IDS_PB_BODY_RINGTONE"));
2346 pLabelTitle->SetName(GROUP_LABEL_TITLE);
2347 pLabelTitle->AddTouchEventListener(*this);
2348 pLabelTitle->SetTextConfig(FONT_SIZE_TITLE_TEXT, LABEL_TEXT_STYLE_BOLD);
2349 pLabelTitle->SetTextColor(COLOR_ITEM_TITLE);
2350 pLabelTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
2352 pGroupStyle->AddControl(pLabelTitle);
2354 String ringtoneName = __pPresentationModel->GetValue(DETAIL_PROPERTY_RINGTONE);
2358 ringtoneName.LastIndexOf(L"/", ringtoneName.GetLength() - 1, index);
2362 ringtoneName.SubString(index + 1, trimmedPath);
2365 Label* pLabelRingToneName = new (std::nothrow) Label();
2366 pLabelRingToneName->Construct(Rectangle(0, H_GROUP_RINGTONE_TITLE_GAP + H_GROUP_RINGTONE_TITLE_LABEL, itemWidth - H_GROUP_RINGTONE_TITLE_GAP - H_ICON_BUTTON, H_GROUP_RINGTONE_VALUE_LABEL + pContactsApp->GetFontHeightOffset()), trimmedPath);
2367 pLabelRingToneName->SetName(GROUP_LABEL_VALUE);
2368 pLabelRingToneName->AddTouchEventListener(*this);
2369 pLabelRingToneName->SetTextConfig(pContactsApp->GetFontSize(), LABEL_TEXT_STYLE_NORMAL);
2370 pLabelRingToneName->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
2371 pGroupStyle->AddControl(pLabelRingToneName);
2373 Button* pClearButton = new (std::nothrow) Button();
2374 pClearButton->Construct(Rectangle(itemWidth - X_REFRESH_BUTTON_MARGIN, (pRingtoneItem->GetHeight() - H_ICON_BUTTON) / 2, H_ICON_BUTTON, H_ICON_BUTTON));
2375 pClearButton->SetActionId(IDA_BUTTON_RINGTONE_CLEAR);
2376 pClearButton->AddActionEventListener(*this);
2378 Bitmap* pReset = ResourceManager::GetBitmapN(IDB_DETAILS_RESET_NORMAL);
2381 pClearButton->SetNormalBitmap(Point(0, 0), *pReset);
2384 pReset = ResourceManager::GetBitmapN(IDB_DETAILS_RESET_PRESSED);
2387 pClearButton->SetPressedBitmap(Point(0, 0), *pReset);
2391 pGroupStyle->AddControl(pClearButton);
2392 pRingtoneItem->SetIndividualSelectionEnabled(pClearButton, true);
2394 return pRingtoneItem;
2397 Tizen::Ui::Controls::TableViewItem*
2398 ContactEditorForm::GetMoreInformationField(int itemWidth)
2400 TableViewItem* pMoreInformationItem = new (std::nothrow) TableViewItem();
2401 pMoreInformationItem->Construct(Dimension(itemWidth, H_DESCRIPTION_CONTAINER));
2402 pMoreInformationItem->SetBackgroundColor(Color(COLOR_TABLE_VIEW_BG), TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
2403 pMoreInformationItem->SetBackgroundColor(Color(COLOR_TABLE_VIEW_BG), TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
2405 Panel* pPanel = new (std::nothrow) Panel();
2406 pPanel->Construct(Rectangle(X_MORE_INFO_PANEL_GAP, X_MORE_INFO_PANEL_GAP, itemWidth - H_MORE_INFO_PANEL_GAP, H_DESCRIPTION_CONTAINER - H_MORE_INFO_PANEL_GAP));
2407 pPanel->SetBackgroundColor(Color(COLOR_TABLE_VIEW_BG));
2409 pMoreInformationItem->AddControl(pPanel);
2411 Button* pButtonMoreInformation = new (std::nothrow) Button();
2412 pButtonMoreInformation->Construct(Rectangle(X_MORE_INFORMATION_BUTTON, Y_MORE_INFORMATION_BUTTON, itemWidth - (X_MORE_INFORMATION_BUTTON * 2), H_BUTTON));
2413 pButtonMoreInformation->SetText(ResourceManager::GetString(L"IDS_KA_BODY_MORE_INFORMATION"));
2414 pButtonMoreInformation->SetActionId(IDA_BUTTON_MORE_INFO);
2415 pButtonMoreInformation->AddActionEventListener(*this);
2417 pPanel->AddControl(pButtonMoreInformation);
2419 return pMoreInformationItem;
2422 Tizen::Ui::Controls::TableViewItem*
2423 ContactEditorForm::GetDefaultPhoneNumberItem(int itemWidth)
2425 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
2427 TableViewItem* pDefaultPhoneNumberItem = new (std::nothrow) TableViewItem();
2428 pDefaultPhoneNumberItem->Construct(Dimension(itemWidth, pContactsApp->GetListItemSingleLineHeight()));
2429 pDefaultPhoneNumberItem->SetBackgroundColor(Color(0), TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
2431 Button* pButtonDefaultNumber = new (std::nothrow) Button();
2432 pButtonDefaultNumber->Construct(Rectangle(X_MORE_INFORMATION_BUTTON, Y_DEFAULT_NUMBER_BUTTON, itemWidth - (X_MORE_INFORMATION_BUTTON * 2), H_BUTTON));
2433 pButtonDefaultNumber->SetText(ResourceManager::GetString(L"IDS_PB_BODY_MARK_AS_DEFAULT_NUMBER"));
2434 pButtonDefaultNumber->SetActionId(IDA_BUTTON_DEFAULT_PHONE_NUMBER);
2435 pButtonDefaultNumber->AddActionEventListener(*this);
2437 pDefaultPhoneNumberItem->AddControl(pButtonDefaultNumber);
2438 pDefaultPhoneNumberItem->SetIndividualSelectionEnabled(pButtonDefaultNumber, true);
2440 return pDefaultPhoneNumberItem;
2444 ContactEditorForm::DeleteInputField(int groupIndex, int itemIndex, int isUpdating)
2446 result r = E_SUCCESS;
2447 ArrayList* pFieldList = null;
2451 case TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX:
2453 pFieldList = __pPhoneNumberFieldItem;
2454 __pPresentationModel->SetPhoneNumber(DETAIL_PHONENUMBER_TYPE_NONE, L"", itemIndex); //phoneNumberType doesn't matter
2457 case TABLE_VIEW_EMAIL_FIELD_INDEX:
2459 pFieldList = __pEmailFieldItem;
2460 __pPresentationModel->SetEmail(DETAIL_EMAIL_TYPE_NONE, L"", itemIndex);
2463 case TABLE_VIEW_ADDRESS_FIELD_INDEX:
2465 pFieldList = __pAddressFieldItem;
2466 __pPresentationModel->SetAddress(DETAIL_ADDRESS_TYPE_NONE, L"", itemIndex);
2469 case TABLE_VIEW_IM_ADDRESS_FIELD_INDEX:
2471 pFieldList = __pImAddressFieldItem;
2472 __pPresentationModel->SetImAddress(DETAIL_IM_ADDRESS_TYPE_NONE, L"", itemIndex);
2475 case TABLE_VIEW_URL_FIELD_INDEX:
2477 pFieldList = __pUrlFieldItem;
2478 __pPresentationModel->SetUrl(DETAIL_URL_TYPE_NONE, L"", itemIndex);
2485 TryReturn(pFieldList != null, E_FAILURE, "[E_FAILURE] Unable to delete the item.")
2487 __pDeletedItemList->Add(pFieldList->GetAt(itemIndex));
2489 r = pFieldList->RemoveAt(itemIndex, false);
2491 if (__previousGroupIndex == groupIndex && __previousItemIndex == itemIndex)
2493 __previousGroupIndex = -1;
2494 __previousItemIndex = -1;
2496 if (isUpdating == false)
2498 __pTableView->RefreshItem(groupIndex, itemIndex, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
2501 Rectangle clientBounds = GetClientAreaBounds();
2502 __pTableView->SetSize(clientBounds.width, clientBounds.height);
2504 for (int i = itemIndex; i < pFieldList->GetCount(); i++)
2506 TableViewItem* pItem = static_cast<TableViewItem *>(pFieldList->GetAt(i));
2513 EditField* pInputField = static_cast<EditField*>(pItem->GetControl(0));
2514 if (pInputField == null)
2519 result r = Integer::Decode(pInputField->GetName(), parsedIndex);
2520 if (r == E_NUM_FORMAT)
2524 pInputField->SetName(Integer::ToString(parsedIndex - 1));
2526 Button* pTypeButton = static_cast<Button*>(pItem->GetControl(1));
2527 if (pTypeButton == null)
2532 r = Integer::Decode(pTypeButton->GetName(), parsedIndex);
2533 if (r == E_NUM_FORMAT)
2537 pTypeButton->SetName(Integer::ToString(parsedIndex - 1));
2539 Button* pDeleteButton = static_cast<Button *>(pItem->GetControl(2));
2540 if (pDeleteButton == null)
2544 pDeleteButton->SetActionId(pDeleteButton->GetActionId() - 1);
2547 SaveContactData(false);
2548 SetSaveButtonEnabled(IsSaveContactValid());
2550 if (groupIndex == TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX)
2552 if (itemIndex == __pPresentationModel->GetDefaultNumberIndex())
2554 SetAsDefaultPhoneNumber(0);
2556 else if (itemIndex < __pPresentationModel->GetDefaultNumberIndex())
2558 SetAsDefaultPhoneNumber(__pPresentationModel->GetDefaultNumberIndex() - 1);
2562 if (__isDefaultPhoneNumberButtonEnabled == true && __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER) < 2)
2564 if (isUpdating == false)
2566 __pTableView->RefreshItem(TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX, __pTableView->GetItemCountAt(TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX) - 1, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
2568 __isDefaultPhoneNumberButtonEnabled = false;
2575 ContactEditorForm::SetThumbnailControls(Tizen::Ui::Controls::TableViewItem& item, bool isUpdated)
2577 Label* pLabelThumbnail = null;
2578 Button* pButtonAdd = null;
2579 Button* pButtonDelete = null;
2581 if (isUpdated == false)
2583 int itemWidth = GetBounds().width;
2585 pLabelThumbnail = new (std::nothrow) Label();
2586 pLabelThumbnail->Construct(Rectangle((itemWidth - W_THUMBNAIL) / 2, H_THUMBNAIL_DELETE_BUTTON_GAP + Y_EDIT_FIELD_GAP, W_THUMBNAIL, W_THUMBNAIL), L"");
2588 item.AddControl(pLabelThumbnail);
2590 Bitmap* pBitmapItem = null;
2591 Bitmap* pBitmapItemPressed = null;
2593 pButtonAdd = new (std::nothrow) Button();
2594 pButtonAdd->Construct(Rectangle(pLabelThumbnail->GetX() + ((pLabelThumbnail->GetWidth() - H_BUTTON) / 2), pLabelThumbnail->GetY() + ((pLabelThumbnail->GetHeight() - H_BUTTON) / 2), H_BUTTON, H_BUTTON));
2595 pButtonAdd->SetActionId(IDA_BUTTON_THUMBNAIL_ADD);
2596 pButtonAdd->AddActionEventListener(*this);
2598 pBitmapItem = ResourceManager::GetBitmapN(IDB_BUTTON_ADD);
2599 pBitmapItemPressed = ResourceManager::GetBitmapN(IDB_BUTTON_ADD_PRESSED);
2601 if (pBitmapItem != null)
2603 pButtonAdd->SetNormalBackgroundBitmap(*pBitmapItem);
2606 if (pBitmapItemPressed != null)
2608 pButtonAdd->SetPressedBackgroundBitmap(*pBitmapItemPressed);
2609 delete pBitmapItemPressed;
2611 item.AddControl(pButtonAdd);
2612 item.SetIndividualSelectionEnabled(pButtonAdd, true);
2614 pButtonDelete = new (std::nothrow) Button();
2615 pButtonDelete->Construct(Rectangle(pLabelThumbnail->GetX() - H_THUMBNAIL_DELETE_BUTTON_GAP, pLabelThumbnail->GetY() - H_THUMBNAIL_DELETE_BUTTON_GAP + Y_EDIT_FIELD_GAP, H_BUTTON, H_BUTTON));
2616 pButtonDelete->SetActionId(IDA_BUTTON_THUMBNAIL_DELETE);
2617 pButtonDelete->AddActionEventListener(*this);
2619 pBitmapItem = ResourceManager::GetBitmapN(IDB_BUTTON_MINUS);
2620 pBitmapItemPressed = ResourceManager::GetBitmapN(IDB_BUTTON_MINUS_PRESSED);
2622 if (pBitmapItem != null)
2624 pButtonDelete->SetNormalBitmap(Point(0, 0), *pBitmapItem);
2627 if (pBitmapItemPressed != null)
2629 pButtonDelete->SetPressedBitmap(Point(0, 0), *pBitmapItemPressed);
2630 delete pBitmapItemPressed;
2633 pBitmapItem = ResourceManager::GetBitmapN(IDB_BUTTON_DELETE_NORMAL);
2634 pBitmapItemPressed = ResourceManager::GetBitmapN(IDB_BUTTON_DELETE_PRESSED);
2636 if (pBitmapItem != null)
2638 pButtonDelete->SetNormalBackgroundBitmap(*pBitmapItem);
2641 if (pBitmapItemPressed != null)
2643 pButtonDelete->SetPressedBackgroundBitmap(*pBitmapItemPressed);
2644 delete pBitmapItemPressed;
2646 item.AddControl(pButtonDelete);
2647 item.SetIndividualSelectionEnabled(pButtonDelete, true);
2649 Button* pButtonCamera = new (std::nothrow) Button();
2650 pButtonCamera->Construct(Rectangle(pLabelThumbnail->GetX() + pLabelThumbnail->GetWidth(), pLabelThumbnail->GetY() + pLabelThumbnail->GetHeight() - H_BUTTON, H_BUTTON, H_BUTTON));
2651 pButtonCamera->SetActionId(IDA_BUTTON_CAMERA);
2652 pButtonCamera->AddActionEventListener(*this);
2654 pBitmapItem = ResourceManager::GetBitmapN(IDB_BUTTON_CAMERA);
2655 pBitmapItemPressed = ResourceManager::GetBitmapN(IDB_BUTTON_CAMERA_PRESSED);
2656 if (pBitmapItem != null)
2658 pButtonCamera->SetNormalBackgroundBitmap(*pBitmapItem);
2661 if (pBitmapItemPressed != null)
2663 pButtonCamera->SetPressedBackgroundBitmap(*pBitmapItemPressed);
2664 delete pBitmapItemPressed;
2667 item.AddControl(pButtonCamera);
2668 item.SetIndividualSelectionEnabled(pButtonCamera, true);
2672 pLabelThumbnail = static_cast<Label*>(item.GetControl(0));
2673 TryReturnVoid(pLabelThumbnail != null, "[E_FAILURE] Unable to get a thumbnail control.");
2675 pButtonAdd = static_cast<Button*>(item.GetControl(1));
2676 TryReturnVoid(pButtonAdd != null, "[E_FAILURE] Unable to get a button.");
2678 pButtonDelete = static_cast<Button*>(item.GetControl(2));
2679 TryReturnVoid(pButtonDelete != null, "[E_FAILURE] Unable to get a button.");
2682 Bitmap* pThumbnail = null;
2683 String thumbnailPath = __pPresentationModel->GetValue(DETAIL_PROPERTY_THUMBNAIL);
2685 if (thumbnailPath.IsEmpty() == false)
2687 ImageBuffer thumbnailImageBuffer;
2688 result r = thumbnailImageBuffer.Construct(thumbnailPath);
2691 pThumbnail = thumbnailImageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_ARGB8888, BUFFER_SCALING_NONE);
2693 if (pThumbnail != null)
2695 pThumbnail->SetScalingQuality(BITMAP_SCALING_QUALITY_HIGH);
2696 pThumbnail->Scale(Dimension(W_THUMBNAIL, W_THUMBNAIL));
2697 pLabelThumbnail->SetBackgroundBitmap(*pThumbnail);
2699 pButtonAdd->SetShowState(false);
2700 pButtonAdd->SetEnabled(false);
2701 pButtonDelete->SetShowState(true);
2705 pThumbnail = ResourceManager::GetBitmapN(IDB_THUMBNAIL_BACKGROUND);
2706 if (pThumbnail != null)
2708 pLabelThumbnail->SetBackgroundBitmap(*pThumbnail);
2709 pButtonAdd->SetShowState(true);
2710 pButtonAdd->SetEnabled(true);
2711 pButtonDelete->SetShowState(false);
2719 ContactEditorForm::AddHorizontalDivider(Tizen::Ui::Controls::TableViewItem* pItem, int positionY, int width)
2721 Label* pDivider = new (std::nothrow) Label();
2722 pDivider->Construct(Rectangle(0, positionY, width, H_DIVIDER), L"");
2723 pDivider->SetBackgroundColor(Color(COLOR_DIVIDER));
2724 pDivider->SetEnabled(false);
2726 pItem->AddControl(pDivider);
2730 ContactEditorForm::AddVerticalDivider(Tizen::Ui::Controls::TableViewItem* pItem, int positionX, int positionY)
2732 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
2734 Label* pDivider = new (std::nothrow) Label();
2735 pDivider->Construct(Rectangle(positionX, positionY, W_DIVIDER, pContactsApp->GetListItemSingleLineHeight()), L"");
2736 pDivider->SetBackgroundColor(Color(COLOR_DIVIDER));
2737 pDivider->SetEnabled(false);
2739 pItem->AddControl(pDivider);
2743 ContactEditorForm::SetAsDefaultPhoneNumber(int index, bool scrollToItem)
2745 result r = E_SUCCESS;
2746 TableViewItem* pItem = null;
2747 EditField* pEditField = null;
2749 pItem = static_cast<TableViewItem *>(__pPhoneNumberFieldItem->GetAt(index));
2756 pEditField = static_cast<EditField *>(pItem->GetControl(0));
2757 if (pEditField == null)
2763 __pPresentationModel->SetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER, L"", index);
2765 if (pEditField->IsVisible() == false && scrollToItem == true)
2767 __pTableView->ScrollToItem(TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX, index);
2769 pEditField->Invalidate(true);
2776 ContactEditorForm::ChangeNameFieldStatus(void)
2778 result r = E_SUCCESS;
2780 r = SaveNameFields();
2782 __isExpandable = (__isExpandable == true) ? false : true;
2788 ContactEditorForm::SaveContactData(bool isSaved)
2790 result r = E_SUCCESS;
2792 if (isSaved == true)
2794 if (CommonUtil::isMemoryAvailable() == false)
2796 CommonUtil::showMemoryFullMessageBox();
2801 r = SaveNameFields();
2803 for (int i = 0; i < __pPhoneNumberFieldItem->GetCount(); i++)
2806 TableViewItem* pItem = static_cast<TableViewItem *>(__pPhoneNumberFieldItem->GetAt(i));
2813 EditField* pEditField = static_cast<EditField *>(pItem->GetControl(0));
2814 if (pEditField == null)
2820 String phoneNumberString(pEditField->GetText());
2821 String phoneNumberTypeString(pItem->GetName());
2822 int phoneNumberType;
2823 phoneNumberString.Trim();
2826 for (int i = 0; i < phoneNumberString.GetLength(); i++)
2828 phoneNumberString.GetCharAt(i, ch);
2830 if(ch == '+' && i == 0)
2834 if((ch == ',' || ch == ';' || ch == 'p') && i == 0)
2839 else if ((ch < '0' || ch > '9') && (ch != '*') && (ch != '#') && (ch != ',') && (ch != ';') && (ch != 'p'))
2850 if (isSaved == true && phoneNumberString.GetLength() > 0 && r != E_SUCCESS)
2853 MessageBox invalidNumberMessage;
2854 invalidNumberMessage.Construct(L"", ResourceManager::GetString(L"IDS_PB_BODY_INVALID_NUMBER"), MSGBOX_STYLE_OK, MESSAGE_BOX_TIMEOUT_MS);
2855 invalidNumberMessage.ShowAndWait(modalResult);
2860 Integer::Parse(phoneNumberTypeString, phoneNumberType);
2862 __pPresentationModel->SetPhoneNumber((DetailPhoneNumberType)phoneNumberType, phoneNumberString, i);
2865 for (int i = 0; i < __pEmailFieldItem->GetCount(); i++)
2867 TableViewItem* pItem = static_cast<TableViewItem *>(__pEmailFieldItem->GetAt(i));
2874 EditField* pEditField = static_cast<EditField *>(pItem->GetControl(0));
2875 if (pEditField == null)
2881 String emailString(pEditField->GetText());
2882 String remainingString;
2883 String emailTypeString(pItem->GetName());
2887 Integer::Parse(emailTypeString, emailType);
2889 r = __pPresentationModel->SetEmail((DetailEmailType)emailType, emailString, i);
2891 if (isSaved == true && r == E_SUCCESS)
2893 if(emailString.GetLength() > 0)
2895 bool isValidEmail = ValidateEmailAddress(emailString);
2896 if (isValidEmail != true)
2899 MessageBox invalidEmailMessage;
2900 invalidEmailMessage.Construct(L"", ResourceManager::GetString(L"IDS_PB_POP_INVALID_EMAIL_ADDRESS"), MSGBOX_STYLE_OK, MESSAGE_BOX_TIMEOUT_MS);
2901 invalidEmailMessage.ShowAndWait(modalResult);
2902 pEditField->ShowKeypad();
2910 for (int i = 0; i < __pAddressFieldItem->GetCount(); i++)
2912 TableViewItem* pItem = static_cast<TableViewItem *>(__pAddressFieldItem->GetAt(i));
2919 EditField* pEditField = static_cast<EditField *>(pItem->GetControl(0));
2920 if (pEditField == null)
2926 String addressString(pEditField->GetText());
2927 String addressTypeString(pItem->GetName());
2930 addressString.Trim();
2931 Integer::Parse(addressTypeString, addressType);
2933 __pPresentationModel->SetAddress((DetailAddressType)addressType, addressString, i);
2936 for (int i = 0; i < __pImAddressFieldItem->GetCount(); i++)
2938 TableViewItem* pItem = static_cast<TableViewItem *>(__pImAddressFieldItem->GetAt(i));
2945 EditField* pEditField = static_cast<EditField *>(pItem->GetControl(0));
2946 if (pEditField == null)
2952 String addressString(pEditField->GetText());
2953 String addressTypeString(pItem->GetName());
2956 addressString.Trim();
2957 Integer::Parse(addressTypeString, addressType);
2959 __pPresentationModel->SetImAddress((DetailImAddressType)addressType, addressString, i);
2962 for (int i = 0; i < __pUrlFieldItem->GetCount(); i++)
2964 TableViewItem* pItem = static_cast<TableViewItem *>(__pUrlFieldItem->GetAt(i));
2971 EditField* pEditField = static_cast<EditField *>(pItem->GetControl(0));
2972 if (pEditField == null)
2978 String urlString(pEditField->GetText());
2979 String urlTypeString(pItem->GetName());
2983 Integer::Parse(urlTypeString, urlType);
2985 __pPresentationModel->SetUrl((DetailUrlType)urlType, urlString, i);
2988 if (__pNoteFieldItem != null)
2991 ExpandableEditArea* pNoteEditArea = static_cast<ExpandableEditArea *>(__pNoteFieldItem->GetControl(1));
2992 if (pNoteEditArea != null)
2994 noteString.Append(pNoteEditArea->GetText());
2997 __pPresentationModel->SetValue(DETAIL_PROPERTY_NOTE, noteString);
3000 if (isSaved == true)
3002 r = __pPresentationModel->AddAddressBook();
3008 ContactEditorForm::SaveNameFields(void)
3010 result r = E_SUCCESS;
3012 if (__pNameFieldItem == null)
3017 if (__isExpandable == true)
3019 EditField* pFirstName = static_cast<EditField *>(__pNameFieldItem->GetControl(ResourceManager::GetString(L"IDS_PB_BODY_FIRST_NAME"), false));
3020 if (pFirstName == null)
3024 __pPresentationModel->SetValue(DETAIL_PROPERTY_FIRST_NAME, pFirstName->GetText());
3026 EditField* pLastName = static_cast<EditField *>(__pNameFieldItem->GetControl(ResourceManager::GetString(L"IDS_PB_BODY_LAST_NAME"), false));
3027 if (pLastName == null)
3032 __pPresentationModel->SetValue(DETAIL_PROPERTY_LAST_NAME, pLastName->GetText());
3034 EditField* pMiddleName = static_cast<EditField *>(__pNameFieldItem->GetControl(ResourceManager::GetString(L"IDS_PB_BODY_MIDDLE_NAME"), false));
3035 if (pMiddleName == null)
3039 __pPresentationModel->SetValue(DETAIL_PROPERTY_MIDDLE_NAME, pMiddleName->GetText());
3041 EditField* pSuffix = static_cast<EditField *>(__pNameFieldItem->GetControl(ResourceManager::GetString(L"IDS_PB_BODY_SUFFIX"), false));
3042 if (pSuffix == null)
3046 __pPresentationModel->SetValue(DETAIL_PROPERTY_NAME_SUFFIX, pSuffix->GetText());
3048 EditField* pNickName = static_cast<EditField *>(__pNameFieldItem->GetControl(ResourceManager::GetString(L"IDS_PB_BODY_NICKNAME"), false));
3049 if (pNickName == null)
3053 __pPresentationModel->SetValue(DETAIL_PROPERTY_NICK_NAME, pNickName->GetText());
3055 EditField* pCompanyName = static_cast<EditField *>(__pNameFieldItem->GetControl(ResourceManager::GetString(L"IDS_PB_BODY_COMPANY"), false));
3056 if (pCompanyName == null)
3060 __pPresentationModel->SetValue(DETAIL_PROPERTY_COMPANY, pCompanyName->GetText());
3062 if (__isJobTitleEnabled == true)
3064 EditField* pJobTitle = static_cast<EditField *>(__pNameFieldItem->GetControl(ResourceManager::GetString(L"IDS_PB_BODY_JOB_TITLE"), false));
3065 if (pJobTitle == null)
3069 __pPresentationModel->SetValue(DETAIL_PROPERTY_JOB_TITLE, pJobTitle->GetText());
3072 if (__isDepartmentEnabled == true)
3074 EditField* pDepartment = static_cast<EditField *>(__pNameFieldItem->GetControl(ResourceManager::GetString(L"IDS_PB_BODY_DEPARTMENT"), false));
3075 if (pDepartment == null)
3079 __pPresentationModel->SetValue(DETAIL_PROPERTY_DEPARTMENT, pDepartment->GetText());
3084 EditField* pName = static_cast<EditField *>(__pNameFieldItem->GetControl(Integer::ToString(IDA_INPUT_FIELD_DISPLAY_NAME), false));
3090 int delimeterIndex = -1;
3091 int delimcommaIndex = -1;
3093 String displayName(pName->GetText());
3094 if (displayName != __fullName)
3102 if (!displayName.IsEmpty())
3104 displayName.IndexOf(DELIMITER_COMMA, 0, delimcommaIndex);
3105 if (delimcommaIndex >= 0)
3107 displayName.SubString(delimcommaIndex + 1, displayName.GetLength() - (delimcommaIndex + 1), suffix);
3108 displayName.SetLength(delimcommaIndex);
3112 if (!displayName.IsEmpty())
3114 delimeterIndex = -1;
3115 displayName.IndexOf(CHARACTER_SPACE, 0, delimeterIndex);
3116 if (delimeterIndex < 0)
3118 firstName.Append(displayName);
3122 displayName.SubString(0, delimeterIndex++, firstName);
3123 displayName.SubString(delimeterIndex, displayName.GetLength() - delimeterIndex, displayName);
3125 delimeterIndex = -1;
3128 if (!displayName.IsEmpty())
3130 displayName.IndexOf(CHARACTER_SPACE, 0, delimeterIndex);
3131 if (delimeterIndex < 0)
3133 lastName.Append(displayName);
3137 displayName.SubString(0, delimeterIndex, middleName);
3138 displayName.SubString(delimeterIndex + 1, displayName.GetLength() - (delimeterIndex + 1), lastName);
3144 __pPresentationModel->SetValue(DETAIL_PROPERTY_FIRST_NAME, firstName);
3145 __pPresentationModel->SetValue(DETAIL_PROPERTY_MIDDLE_NAME, middleName);
3146 __pPresentationModel->SetValue(DETAIL_PROPERTY_LAST_NAME, lastName);
3147 __pPresentationModel->SetValue(DETAIL_PROPERTY_NAME_SUFFIX, suffix);
3155 ContactEditorForm::IsSaveContactValid(void)
3157 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_FIRST_NAME).IsEmpty() == false)
3162 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_LAST_NAME).IsEmpty() == false)
3167 for (int i = 0; i < __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER); i++)
3169 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_PHONE_NUMBER, i).IsEmpty() == false)
3175 for (int i = 0; i < __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_EMAIL); i++)
3177 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_EMAIL, i).IsEmpty() == false)
3187 ContactEditorForm::SetSaveButtonEnabled(bool enable)
3189 Footer* pFooter = GetFooter();
3193 pFooter->SetItemEnabled(0, true);
3197 pFooter->SetItemEnabled(0, false);
3200 pFooter->Invalidate(true);
3204 ContactEditorForm::IsMoreInformationButtonVisible(void)
3206 if (__isJobTitleEnabled == false)
3211 if (__isDepartmentEnabled == false)
3216 if (__pImAddressFieldItem->GetCount() == 0)
3221 if (__pUrlFieldItem->GetCount() == 0)
3227 if (__pPresentationModel->GetBirthday(birthday) != E_SUCCESS)
3232 if (__pNoteFieldItem == null)
3241 ContactEditorForm::OnTextValueChanged(const Tizen::Ui::Control& source)
3243 TableViewItem* pTableViewItem = static_cast<TableViewItem *>(source.GetParent());
3245 __isContactModified = true;
3247 if (pTableViewItem == null)
3252 SaveContactData(false);
3253 SetSaveButtonEnabled(IsSaveContactValid());
3255 if (__pNameFieldItem == pTableViewItem)
3260 EditField* pEditField = const_cast<EditField *>(static_cast<const EditField *>(&source));
3261 if (pEditField == null)
3266 Control* pDeleteButton = pTableViewItem->GetControl(2);
3267 if (pDeleteButton == null)
3277 Integer::Decode(pEditField->GetName(), index);
3278 groupIndex = (index & TABLE_VIEW_GROUP_INDEX_MASK) >> TABLE_VIEW_GROUP_INDEX_SHIFT;
3279 inputFlag = (index & TABLE_VIEW_INPUT_FIELD_INDEX_MASK) >> TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
3280 int itemIndex = (index & TABLE_VIEW_ITEM_INDEX_MASK);
3281 itemCount = __pTableView->GetItemCountAt(groupIndex);
3283 String trimmedString = pEditField->GetText();
3284 trimmedString.Trim();
3286 if (trimmedString.IsEmpty())
3288 pDeleteButton->SetShowState(false);
3289 __previousItemIndex = itemIndex; //if the entered text is empty store the index of the field for deletion
3290 __previousGroupIndex = groupIndex;
3292 else if (pDeleteButton->GetShowState() == false)
3294 __previousItemIndex = -1;
3295 __previousGroupIndex = -1;
3296 pDeleteButton->SetShowState(true);
3299 index |= (1 << TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT);
3300 pEditField->SetName(Integer::ToString(index));
3302 if (groupIndex == TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX)
3304 if (__isDefaultPhoneNumberButtonEnabled == false && __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER) > 1)
3306 __isDefaultPhoneNumberButtonEnabled = true;
3307 __pTableView->RefreshItem(groupIndex, __pTableView->GetItemCountAt(groupIndex), TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
3309 else if (itemCount > 1)
3315 ArrayList* pFieldList = null;
3318 case TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX:
3320 pFieldList = __pPhoneNumberFieldItem;
3323 case TABLE_VIEW_EMAIL_FIELD_INDEX:
3325 pFieldList = __pEmailFieldItem;
3328 case TABLE_VIEW_ADDRESS_FIELD_INDEX:
3330 pFieldList = __pAddressFieldItem;
3333 case TABLE_VIEW_IM_ADDRESS_FIELD_INDEX:
3335 pFieldList = __pImAddressFieldItem;
3338 case TABLE_VIEW_URL_FIELD_INDEX:
3340 pFieldList = __pUrlFieldItem;
3347 if (pFieldList != null)
3349 TableViewItem* pItem = static_cast<TableViewItem*>(pFieldList->GetAt(pFieldList->GetCount() - 1));
3352 EditField* pInputField = static_cast<EditField*>(pItem->GetControl(0));
3354 if (pInputField != null && pInputField->GetTextLength() != 0)
3356 __pTableView->RefreshItem(groupIndex, itemCount, TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
3364 __previousItemIndex = -1;
3365 __previousGroupIndex = -1;
3367 if(__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER) <= 1 && __isDefaultPhoneNumberButtonEnabled == true)
3369 __isDefaultPhoneNumberButtonEnabled = false;
3370 __pTableView->RefreshItem(groupIndex, __pTableView->GetItemCountAt(groupIndex) - 1, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
3372 else if(__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER) > 1 && __isDefaultPhoneNumberButtonEnabled == false)
3374 __isDefaultPhoneNumberButtonEnabled = true;
3375 __pTableView->RefreshItem(groupIndex, __pTableView->GetItemCountAt(groupIndex), TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
3380 ContactEditorForm::OnTextValueChangeCanceled(const Tizen::Ui::Control& source)
3385 ContactEditorForm::ParseAppControlArgument(const Tizen::Base::String& argument, Tizen::Base::String& type, Tizen::Base::String& content)
3387 result r = E_SUCCESS;
3389 if (argument.IsEmpty() || argument.Contains(DELIMITER) == false)
3396 argument.IndexOf(DELIMITER, 0, delimiterIndex);
3397 argument.SubString(0, delimiterIndex++, type);
3398 TryReturn(r == E_SUCCESS, r, "[%s] Unable to get type", GetErrorMessage(r));
3399 argument.SubString(delimiterIndex, argument.GetLength() - delimiterIndex, content);
3400 TryReturn(r == E_SUCCESS, r, "[%s] Unable to get type", GetErrorMessage(r));
3406 ContactEditorForm::OnFocusGained(const Tizen::Ui::Control& source)
3408 __pCurrentFocusedItem = source.GetParent();
3410 if (__previousItemIndex != -1 && __previousGroupIndex != -1)
3412 const EditField* pEditField = static_cast<const EditField*>(&source);
3413 if (pEditField == null)
3422 Integer::Decode(pEditField->GetName(), index);
3423 groupIndex = (index & TABLE_VIEW_GROUP_INDEX_MASK) >> TABLE_VIEW_GROUP_INDEX_SHIFT;
3424 itemIndex = (index & TABLE_VIEW_ITEM_INDEX_MASK);
3426 if (groupIndex == __previousGroupIndex && itemIndex == __previousItemIndex)
3428 //Same item is focused. Hence not deleting it
3432 DeleteInputField(__previousGroupIndex, __previousItemIndex);
3438 ContactEditorForm::OnFocusLost(const Tizen::Ui::Control& source)
3440 if (__pCurrentFocusedItem == __pNameFieldItem)
3445 __pCurrentFocusedItem = null;
3449 ContactEditorForm::ShowDefaultPhoneNumberContextMenu(const Tizen::Graphics::Point& position)
3451 if (__pDefaultPhoneNumberContextMenu != null)
3453 delete __pDefaultPhoneNumberContextMenu;
3454 __pDefaultPhoneNumberContextMenu = null;
3457 __pDefaultPhoneNumberContextMenu = new (std::nothrow) ContextMenu();
3458 __pDefaultPhoneNumberContextMenu->Construct(position, CONTEXT_MENU_STYLE_LIST);
3459 __pDefaultPhoneNumberContextMenu->AddActionEventListener(*this);
3460 __pDefaultPhoneNumberContextMenu->SetFocusable(true);
3462 int count = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER);
3463 int defaultPhoneNumberIndex = __pPresentationModel->GetDefaultNumberIndex();
3465 for (int i = 0; i < count; i++)
3467 String phoneNumber(__pPresentationModel->GetValue(DETAIL_PROPERTY_PHONE_NUMBER, i));
3469 if (i != defaultPhoneNumberIndex)
3471 phoneNumber.Insert(__pPresentationModel->GetType(DETAIL_PROPERTY_PHONE_NUMBER, i) + CHARACTER_SPACE, 0);
3472 __pDefaultPhoneNumberContextMenu->AddItem(phoneNumber, i);
3476 if (__pDefaultPhoneNumberContextMenu->GetItemCount() > 0)
3478 __pDefaultPhoneNumberContextMenu->Show();
3483 ContactEditorForm::ShowMoreInformationContextMenu(const Tizen::Graphics::Point& position)
3485 if (__pMoreInformationContextMenu != null)
3487 delete __pMoreInformationContextMenu;
3488 __pMoreInformationContextMenu = null;
3491 __pMoreInformationContextMenu = new (std::nothrow) ContextMenu();
3492 __pMoreInformationContextMenu->Construct(position, CONTEXT_MENU_STYLE_LIST);
3494 __pMoreInformationContextMenu->SetMaxVisibleItemsCount(6);
3495 __pMoreInformationContextMenu->AddActionEventListener(*this);
3496 __pMoreInformationContextMenu->SetFocusable(true);
3498 if (__isJobTitleEnabled == false)
3500 __pMoreInformationContextMenu->AddItem(ResourceManager::GetString(L"IDS_PB_BODY_JOB_TITLE"), IDA_CONTEXT_MENU_ITEM_JOB_TITLE);
3503 if (__isDepartmentEnabled == false)
3505 __pMoreInformationContextMenu->AddItem(ResourceManager::GetString(L"IDS_PB_BODY_DEPARTMENT"), IDA_CONTEXT_MENU_ITEM_DEPARTMENT);
3508 if (__pImAddressFieldItem->GetCount() == 0)
3510 __pMoreInformationContextMenu->AddItem(ResourceManager::GetString(L"IDS_PB_HEADER_INSTANT_MESSENGER_ABB"), IDA_CONTEXT_MENU_ITEM_INSTANT_MESSENGER);
3513 if (__pUrlFieldItem->GetCount() == 0)
3515 __pMoreInformationContextMenu->AddItem(ResourceManager::GetString(L"IDS_PB_BODY_URL"), IDA_CONTEXT_MENU_ITEM_URL);
3519 if (__pPresentationModel->GetBirthday(birthday) != E_SUCCESS)
3521 __pMoreInformationContextMenu->AddItem(ResourceManager::GetString(L"IDS_PB_BODY_BIRTHDAY"), IDA_CONTEXT_MENU_ITEM_BIRTHDAY);
3524 if (__pNoteFieldItem == null)
3526 __pMoreInformationContextMenu->AddItem(ResourceManager::GetString(L"IDS_PB_BODY_NOTE"), IDA_CONTEXT_MENU_ITEM_NOTE);
3529 if (__isMoreInformationContextMenuShowing == false)
3531 __pMoreInformationContextMenu->Show();
3536 ContactEditorForm::ShowTypeContextMenu(int currentType, const Tizen::Graphics::Point& position, int itemTag)
3538 int groupIndex = (itemTag & TABLE_VIEW_GROUP_INDEX_MASK) >> TABLE_VIEW_GROUP_INDEX_SHIFT;
3540 __groupIndex = groupIndex;
3541 __itemIndex = itemTag;
3543 if (__isKeypadOpened)
3545 __isTypeContextMenuShowing = true;
3548 if (__pTypeContextMenu != null)
3550 delete __pTypeContextMenu;
3551 __pTypeContextMenu = null;
3554 __pTypeContextMenu = new (std::nothrow) ContextMenu();
3555 __pTypeContextMenu->Construct(position, CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_LEFTWARD);
3556 __pTypeContextMenu->AddActionEventListener(*this);
3557 __pTypeContextMenu->SetFocusable(true);
3561 case TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX:
3563 __pTypeContextMenu->SetMaxVisibleItemsCount(DETAIL_PHONENUMBER_TYPE_OTHER + 1);
3564 for (int i = 0; i <= DETAIL_PHONENUMBER_TYPE_OTHER; i++)
3566 int index = i << TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
3567 __pTypeContextMenu->AddItem(__pPresentationModel->GetPhoneNumberTypeString((DetailPhoneNumberType)i), itemTag | index);
3571 case TABLE_VIEW_EMAIL_FIELD_INDEX:
3573 __pTypeContextMenu->SetMaxVisibleItemsCount(DETAIL_EMAIL_TYPE_OTHER + 1);
3574 for (int i = 0; i <= DETAIL_EMAIL_TYPE_OTHER; i++)
3576 int index = i << TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
3577 __pTypeContextMenu->AddItem(__pPresentationModel->GetAddressTypeString((DetailAddressType)i), itemTag | index);
3581 case TABLE_VIEW_ADDRESS_FIELD_INDEX:
3583 __pTypeContextMenu->SetMaxVisibleItemsCount(DETAIL_ADDRESS_TYPE_OTHER + 1);
3584 for (int i = 0; i <= DETAIL_ADDRESS_TYPE_OTHER; i++)
3586 int index = i << TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
3587 __pTypeContextMenu->AddItem(__pPresentationModel->GetAddressTypeString((DetailAddressType)i), itemTag | index);
3591 case TABLE_VIEW_IM_ADDRESS_FIELD_INDEX:
3593 __pTypeContextMenu->SetMaxVisibleItemsCount(7); // Temporary the code due to limit max count(8) by UI framework.
3594 for (int i = 0; i <= DETAIL_IM_ADDRESS_TYPE_OTHER; i++)
3596 int index = i << TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
3597 __pTypeContextMenu->AddItem(__pPresentationModel->GetImAddressTypeString((DetailImAddressType)i), itemTag | index);
3601 case TABLE_VIEW_URL_FIELD_INDEX:
3603 __pTypeContextMenu->SetMaxVisibleItemsCount(DETAIL_URL_TYPE_OTHER + 1);
3604 for (int i = 0; i <= DETAIL_URL_TYPE_OTHER; i++)
3606 int index = i << TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
3607 __pTypeContextMenu->AddItem(__pPresentationModel->GetUrlTypeString((DetailUrlType)i), itemTag | index);
3613 __isTypeContextMenuShowing = false;
3616 delete __pTypeContextMenu;
3617 __pTypeContextMenu = null;
3622 if (__pTypeContextMenu != null)
3624 __pTypeContextMenu->RemoveItemAt(currentType);
3625 __pTypeContextMenu->Show();
3630 ContactEditorForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
3632 __isScrollOccurred = false;
3634 Panel* pPanel = null;
3636 if (source.GetName().Equals(GROUP_STYLE_PANEL, true))
3638 pPanel = static_cast<Panel*>(&(const_cast<Control&>(source)));
3640 else if (source.GetName().Equals(GROUP_LABEL_TITLE, true) || source.GetName().Equals(GROUP_LABEL_VALUE, true))
3642 pPanel = static_cast<Panel*>(source.GetParent());
3647 pPanel->SetBackgroundColor(COLOR_PRESSED);
3649 Label* pLabelValue = static_cast<Label*>(pPanel->GetControl(GROUP_LABEL_VALUE, true));
3650 pLabelValue->SetTextColor(Color(COLOR_ITEM_PRESSED));
3652 Label* pLabelTitle = static_cast<Label*>(pPanel->GetControl(GROUP_LABEL_TITLE, true));
3653 pLabelTitle->SetTextColor(COLOR_ITEM_PRESSED);
3655 pPanel->Invalidate(true);
3660 ContactEditorForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
3662 Panel* pPanel = null;
3664 if (source.GetName().Equals(GROUP_STYLE_PANEL, true))
3666 pPanel = static_cast<Panel*>(&(const_cast<Control&>(source)));
3668 else if (source.GetName().Equals(GROUP_LABEL_TITLE, true) || source.GetName().Equals(GROUP_LABEL_VALUE, true))
3670 pPanel = static_cast<Panel*>(source.GetParent());
3675 pPanel->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND);
3677 Label* pLabelValue = static_cast<Label*>(pPanel->GetControl(GROUP_LABEL_VALUE, true));
3678 pLabelValue->SetTextColor(Color(COLOR_ITEM_VALUE));
3680 Label* pLabelTitle = static_cast<Label*>(pPanel->GetControl(GROUP_LABEL_TITLE, true));
3681 pLabelTitle->SetTextColor(COLOR_ITEM_TITLE);
3683 pPanel->Invalidate(true);
3686 if (__isScrollOccurred || source.Contains(currentPosition) == false)
3693 ContactEditorForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
3695 Panel* pPanel = null;
3697 if (source.GetName().Equals(GROUP_STYLE_PANEL, true))
3699 pPanel = static_cast<Panel*>(&(const_cast<Control&>(source)));
3701 else if (source.GetName().Equals(GROUP_LABEL_TITLE, true) || source.GetName().Equals(GROUP_LABEL_VALUE, true))
3703 pPanel = static_cast<Panel*>(source.GetParent());
3708 pPanel->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND);
3710 Label* pLabelValue = static_cast<Label*>(pPanel->GetControl(GROUP_LABEL_VALUE, true));
3711 pLabelValue->SetTextColor(Color(COLOR_ITEM_VALUE));
3713 Label* pLabelTitle = static_cast<Label*>(pPanel->GetControl(GROUP_LABEL_TITLE, true));
3714 pLabelTitle->SetTextColor(COLOR_ITEM_TITLE);
3716 pPanel->Invalidate(true);
3721 ContactEditorForm::OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
3723 if (keyCode == KEY_ENTER )
3725 TableViewItem* pItem = static_cast<TableViewItem*>(&(const_cast<Control&>(source)));
3727 Panel* pPanel = static_cast<Panel*>(pItem->GetControl(0));
3734 Label* pLabelValue = static_cast<Label*>(pPanel->GetControl(1));
3736 if (pLabelValue == null)
3741 Label* pLabelTitle = static_cast<Label*>(pPanel->GetControl(0));
3743 if (pLabelTitle == null)
3748 pPanel->SetBackgroundColor(COLOR_PRESSED);
3749 pLabelValue->SetTextColor(Color(COLOR_ITEM_PRESSED));
3750 pLabelTitle->SetTextColor(COLOR_ITEM_PRESSED);
3751 pPanel->Invalidate(true);
3756 ContactEditorForm::OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
3758 if (keyCode == KEY_ENTER )
3761 TableViewItem* pItem = static_cast<TableViewItem*>(&(const_cast<Control&>(source)));
3763 Panel* pPanel = static_cast<Panel*>(pItem->GetControl(0));
3770 Label* pLabelValue = static_cast<Label*>(pPanel->GetControl(1));
3772 if (pLabelValue == null)
3777 Label* pLabelTitle = static_cast<Label*>(pPanel->GetControl(0));
3779 if (pLabelTitle == null)
3784 pPanel->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND);
3785 pLabelValue->SetTextColor(Color(COLOR_ITEM_VALUE));
3786 pLabelTitle->SetTextColor(COLOR_ITEM_TITLE);
3787 pPanel->Invalidate(true);
3792 ContactEditorForm::OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
3798 ContactEditorForm::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
3803 ContactEditorForm::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
3808 ContactEditorForm::OnTouchCanceled(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
3813 ContactEditorForm::OnScrollEndReached (Tizen::Ui::Control &source, Tizen::Ui::Controls::ScrollEndEvent type)
3818 ContactEditorForm::OnScrollPositionChanged (Tizen::Ui::Control &source, int scrollPos)
3820 int scrollDif = scrollPos - __scrolledDistance;
3821 if (__isTypeContextMenuShowing)
3823 Point anchorPosition = __pTypeContextMenu->GetAnchorPosition();
3825 anchorPosition.y -= scrollDif;
3826 __pTypeContextMenu->SetAnchorPosition(anchorPosition);
3827 __pTypeContextMenu->Show();
3829 __isTypeContextMenuShowing = false;
3833 if (__pDefaultPhoneNumberContextMenu != null)
3835 Point anchorPosition = __pDefaultPhoneNumberContextMenu->GetAnchorPosition();
3837 anchorPosition.y -= scrollDif;
3838 __pDefaultPhoneNumberContextMenu->SetAnchorPosition(anchorPosition);
3839 __pDefaultPhoneNumberContextMenu->Show();
3842 __scrolledDistance = scrollPos;
3843 __origScrolledDistance = scrollPos;
3845 if (__isScrollOccurred == false)
3847 __isScrollOccurred = true;
3852 ContactEditorForm::OnScrollStopped (Tizen::Ui::Control &source)
3857 ContactEditorForm::OnExpandableEditAreaLineAdded (Tizen::Ui::Controls::ExpandableEditArea &source, int newLineCount)
3859 __pTableView->RefreshItem(TABLE_VIEW_NOTE_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
3863 ContactEditorForm::OnExpandableEditAreaLineRemoved (Tizen::Ui::Controls::ExpandableEditArea &source, int newLineCount)
3865 __pTableView->RefreshItem(TABLE_VIEW_NOTE_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
3869 ContactEditorForm::OnDateChanged(const Tizen::Ui::Control& source, int year, int month, int day)
3871 DateTime changedDate;
3873 changedDate.SetValue(year, month, day);
3874 __pPresentationModel->SetBirthday(changedDate);
3875 __isContactModified = true;
3879 ContactEditorForm::OnDateChangeCanceled(const Tizen::Ui::Control& source)
3884 ContactEditorForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData)
3886 AppLogDebug("ENTER");
3888 if (__pAppControl != null)
3890 delete __pAppControl;
3891 __pAppControl = null;
3894 TryReturnVoid(appControlResult == APP_CTRL_RESULT_SUCCEEDED, "[E_FAILURE] The result of an appcontrol is not succeeded.");
3895 TryReturnVoid(pExtraData != null, "[E_FAILURE] The extra data is null.");
3897 const String *pResultString = null;
3898 const ArrayList* pResultList = dynamic_cast<const ArrayList*>(pExtraData->GetValue(String(OUTPUT_KEY_SELECTED)));
3899 if (pResultList != null)
3901 pResultString = static_cast<const String*>(pResultList->GetAt(0));
3905 pResultString = static_cast<const String*>(pExtraData->GetValue(String(OUTPUT_KEY_SELECTED)));
3907 TryReturnVoid(pResultString != null, "[E_FAILURE] Unable to get file path.");
3909 if (appId.Equals(String(PROVIDER_ID_CAMERA)) && operationId.Equals(String(OPERATION_ID_CREATE_CONTENT)))
3911 __pPresentationModel->SetThumbnail(*pResultString);
3912 __pTableView->RefreshItem(TABLE_VIEW_THUMBNAIL_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
3914 if (__pFileEventManager == null)
3916 __pFileEventManager = new (std::nothrow) FileEventManager();
3917 __pFileEventManager->Construct(*this);
3919 __pFileEventManager->AddPath(*pResultString, FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_DELETE_SELF | FILE_EVENT_TYPE_MODIFY | FILE_EVENT_TYPE_MOVE_SELF);
3920 __isContactModified = true;
3922 else if (appId.Equals(String(PROVIDER_ID_GALLERY)) && operationId.Equals(String(OPERATION_ID_PICK)))
3926 ImageFormat imageFormat;
3927 result r = ImageBuffer::GetImageInfo(*pResultString, imageFormat, width, height);
3929 if (appControlResult == APP_CTRL_RESULT_FAILED || r != E_SUCCESS)
3931 int modalResult = 0;
3932 MessageBox unsupportedMessageBox;
3933 unsupportedMessageBox.Construct(L"", ResourceManager::GetString(L"IDS_MP_POP_INVALID_FILE"), MSGBOX_STYLE_NONE, 3000);
3934 unsupportedMessageBox.ShowAndWait(modalResult);
3939 r = LaunchImageViewerAppControl(*pResultString);
3941 else if (appId.Equals(String(PROVIDER_ID_FILEMANAGER)) && operationId.Equals(String(OPERATION_ID_PICK)))
3943 __pPresentationModel->SetValue(DETAIL_PROPERTY_RINGTONE, *pResultString);
3944 __pTableView->RefreshItem(TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX, 2, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
3946 if (__pFileEventManager == null)
3948 __pFileEventManager = new (std::nothrow) FileEventManager();
3949 __pFileEventManager->Construct(*this);
3951 __pFileEventManager->AddPath(*pResultString, FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_DELETE_SELF | FILE_EVENT_TYPE_MODIFY | FILE_EVENT_TYPE_MOVE_SELF);
3953 __isContactModified = true;
3955 else if(appId.Equals(String(PROVIDER_ID_IMAGEVIEWER)) && operationId.Equals(String(OPERATION_ID_CROP)))
3959 ImageFormat imageFormat;
3960 result r = ImageBuffer::GetImageInfo(*pResultString, imageFormat, width, height);
3962 if (appControlResult == APP_CTRL_RESULT_FAILED || r != E_SUCCESS)
3964 int modalResult = 0;
3965 MessageBox unsupportedMessageBox;
3966 unsupportedMessageBox.Construct(L"", ResourceManager::GetString(L"IDS_MP_POP_INVALID_FILE"), MSGBOX_STYLE_NONE, 3000);
3967 unsupportedMessageBox.ShowAndWait(modalResult);
3972 __pPresentationModel->SetThumbnail(*pResultString);
3973 AppLogDebug("pResultString is %ls", pResultString->GetPointer());
3974 __isContactModified = true;
3975 __pTableView->RefreshItem(TABLE_VIEW_THUMBNAIL_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
3977 if (__pFileEventManager == null)
3979 __pFileEventManager = new (std::nothrow) FileEventManager();
3980 __pFileEventManager->Construct(*this);
3982 __pFileEventManager->AddPath(*pResultString, FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_DELETE_SELF | FILE_EVENT_TYPE_MODIFY | FILE_EVENT_TYPE_MOVE_SELF);
3985 AppLogDebug("EXIT");
3989 ContactEditorForm::LaunchAppControl(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId)
3991 result r = E_SUCCESS;
3996 extraData.Construct();
3998 if (appId.Equals(String(PROVIDER_ID_CAMERA)) && operationId.Equals(String(OPERATION_ID_CREATE_CONTENT)))
4000 mimeType.Append(INPUT_MIME_TYPE_CAMERA);
4001 extraData.Add(new (std::nothrow) String(INPUT_KEY_ALLOW_SWITCH), new (std::nothrow) String(INPUT_VALUE_FALSE));
4003 else if (appId.Equals(String(PROVIDER_ID_GALLERY)) && operationId.Equals(String(OPERATION_ID_PICK)))
4005 mimeType.Append(INPUT_MIME_TYPE_GALLERY);
4006 extraData.Add(new (std::nothrow) String(INPUT_KEY_SELECTION_MODE), new (std::nothrow) String(INPUT_DATA_SELECTION_MODE_SINGLE));
4008 else if (appId.Equals(String(PROVIDER_ID_FILEMANAGER)) && operationId.Equals(String(OPERATION_ID_PICK)))
4010 mimeType.Append(INPUT_MIME_TYPE_AUDIO);
4011 extraData.Add(new (std::nothrow) String(INPUT_KEY_SELECTION_MODE), new (std::nothrow) String(INPUT_DATA_SELECTION_MODE_SINGLE));
4014 __pAppControl = AppManager::FindAppControlN(appId, operationId);
4016 if (__pAppControl != null)
4018 r = __pAppControl->Start(&uri, &mimeType, &extraData, this);
4019 TryCatch(r == E_SUCCESS, , "[%s] Unable to launch app control.", GetErrorMessage(r));
4024 extraData.RemoveAll(true);
4029 extraData.RemoveAll(true);
4030 delete __pAppControl;
4031 __pAppControl = null;
4037 ContactEditorForm::LaunchImageViewerAppControl(const Tizen::Base::String& filePath)
4039 result r = E_SUCCESS;
4042 extraData.Construct();
4043 extraData.Add(new (std::nothrow) String(INPUT_KEY_IMAGEVIEWER_MODE), new (std::nothrow) String(INPUT_VALUE_IMAGEVIEWER_TYPE));
4045 __pAppControl = AppManager::FindAppControlN(PROVIDER_ID_IMAGEVIEWER, OPERATION_ID_CROP);
4049 r = __pAppControl->Start(&filePath, null, &extraData, this);
4050 TryCatch(r == E_SUCCESS, , "[%s] Unable to launch app control.", GetErrorMessage(r));
4055 extraData.RemoveAll(true);
4060 extraData.RemoveAll(true);
4061 delete __pAppControl;
4062 __pAppControl = null;
4068 ContactEditorForm::OnContactsChanged(void)
4070 SceneManager* pSceneManager = SceneManager::GetInstance();
4071 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
4073 if (__isSaved == false)
4075 if (__pPresentationModel->IsContactRemoved())
4077 if (pContactsApp->GetOperationId() == OPERATION_ID_VIEW)
4079 __pPresentationModel->RemoveContactChangeListener(*this);
4083 if (__pAppControl != null)
4085 __pAppControl->Stop();
4087 pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
4098 AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance();
4099 HashMap* pReturnValue = new (std::nothrow) HashMap();
4100 pReturnValue->Construct();
4102 pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_ITEM_ID), new (std::nothrow) String(Integer::ToString(__pPresentationModel->GetContactId())));
4104 result r = pAppManager->SendAppControlResult(pContactsApp->GetRequestId(), APP_CTRL_RESULT_SUCCEEDED, pReturnValue);
4105 AppLogDebug("[%s] The return result from SendAppControlResult().", GetErrorMessage(r));
4107 UiApp::GetInstance()->Terminate();
4111 ArrayList* pArg = null;
4113 if (__pPresentationModel->GetVcfPath().IsEmpty() == false)
4115 pArg = new (std::nothrow) ArrayList();
4118 String* pViewType = new (std::nothrow) String();
4119 String* pValueType = new (std::nothrow) String();
4121 pViewType->Append(VIEW_TYPE);
4122 pViewType->Append(DELIMITER);
4123 pViewType->Append(VIEW_TYPE_VALUE_CONTACT);
4125 pValueType->Append(VIEW_TYPE_CONTACT_ID);
4126 pValueType->Append(DELIMITER);
4127 pValueType->Append(Integer::ToString(__pPresentationModel->GetContactId()));
4129 pArg->Add(pViewType);
4130 pArg->Add(pValueType);
4132 pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), pArg);
4139 ContactEditorForm::OnCategoriesChanged(void)
4141 __pTableView->RefreshItem(TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
4145 ContactEditorForm::OnForeground(void)
4150 ContactEditorForm::OnBackground(void)
4152 if (__previousItemIndex != -1 && __previousGroupIndex != -1)
4154 DeleteInputField(__previousGroupIndex, __previousItemIndex);
4156 if (IsEnabled() == false)
4164 ContactEditorForm::OnFileEventOccured(const unsigned long events, const Tizen::Base::String &path, const unsigned int eventId)
4166 String thumbnailPath = __pPresentationModel->GetValue(DETAIL_PROPERTY_THUMBNAIL);
4167 if (thumbnailPath.Equals(path, false) == true)
4169 __pPresentationModel->SetThumbnail(L"");
4170 __pTableView->RefreshItem(TABLE_VIEW_THUMBNAIL_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
4174 String ringtonePath = __pPresentationModel->GetValue(DETAIL_PROPERTY_RINGTONE);
4175 if (ringtonePath.Equals(ResourceManager::GetString(L"IDS_PB_BODY_DEFAULT"), false) == true )
4177 __pTableView->RefreshItem(TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX, 2, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
4183 ContactEditorForm::OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String &state)
4185 if (deviceType != DEVICE_TYPE_STORAGE_CARD || __pPresentationModel->GetValue(DETAIL_PROPERTY_THUMBNAIL).IsEmpty())
4190 if (state.Equals(SD_CARD_UNMOUNTED, false) && File::IsFileExist(__pPresentationModel->GetValue(DETAIL_PROPERTY_THUMBNAIL)) == false)
4192 __pPresentationModel->SetThumbnail(L"");
4193 __pTableView->RefreshItem(TABLE_VIEW_THUMBNAIL_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
4197 bool ContactEditorForm::ValidateEmailAddress(const Tizen::Base::String& emailAddress)
4201 const wchar_t* tmpChar;
4202 const wchar_t* tmpDomain;
4203 String splChars = L"([<@,;\\:\">])";
4205 for (tmpChar = emailAddress.GetPointer(), index=0; index < emailAddress.GetLength(); tmpChar++, index++)
4207 if (*tmpChar == '\"' && (tmpChar == emailAddress.GetPointer() || *(tmpChar-1) == '.' || *(tmpChar-1) == '\"'))
4211 if (*tmpChar == '\"')
4215 if (*tmpChar == '\\' && (*++tmpChar == ' '))
4219 if (*tmpChar <= ' ' || *tmpChar >= 127)
4228 if (*tmpChar == '@')
4232 if (*tmpChar != '.')
4238 if (*tmpChar == '@')
4242 if (*tmpChar <= ' ' || *tmpChar >= 127)
4246 if (splChars.IndexOf(*tmpChar, 0, index) != E_OBJ_NOT_FOUND)
4251 if (tmpChar == emailAddress.GetPointer() || *(tmpChar-1) == '.')
4256 if (!*(tmpDomain = ++tmpChar))
4262 if (*tmpChar == '.')
4264 if (tmpChar == tmpDomain || *(tmpChar-1) == '.')
4270 if (*tmpChar <= ' ' || *tmpChar >= 127)
4274 if (splChars.IndexOf(*tmpChar, 0, index) != E_OBJ_NOT_FOUND)
4278 } while (*++tmpChar);
4280 if (*(tmpChar-1) == '.')
4294 ContactEditorForm::OnSettingChanged(Tizen::Base::String &key)
4296 if(key == L"http://tizen.org/setting/locale.date_time")
4299 __pPresentationModel->GetBirthday(bday);
4301 DateTime currentDate;
4302 Tizen::System::SystemTime::GetCurrentTime(currentDate);
4304 if(bday > currentDate)
4306 __pPresentationModel->SetBirthday(currentDate);
4307 __pTableView->RefreshItem(TABLE_VIEW_BIRTHDAY_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
4313 ContactEditorForm::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
4319 ContactEditorForm::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
4321 if (keyEventInfo.GetKeyCode() == KEY_BACK || keyEventInfo.GetKeyCode() == KEY_ESC)
4323 if (__pDiscardChangesPopup && __pDiscardChangesPopup->GetShowState() == true)
4325 HideDiscardChangesPopup();
4333 ContactEditorForm::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
4339 ContactEditorForm::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
4345 ContactEditorForm::ShowDiscardChangesPopup(void)
4347 if (__pDiscardChangesPopup == null)
4349 __pDiscardChangesPopup = new (std::nothrow) Popup();
4350 __pDiscardChangesPopup->Construct(false, Dimension(W_SAVE_POPUP, H_SAVE_POPUP));
4351 __pDiscardChangesPopup->SetPropagatedKeyEventListener(this);
4353 Rectangle popupClientBounds = __pDiscardChangesPopup->GetClientAreaBounds();
4355 Label* pLabel = new (std::nothrow) Label();
4356 pLabel->Construct(Rectangle(X_SAVE_LABEL, Y_SAVE_LABEL, W_SAVE_LABEL, H_SAVE_LABEL), ResourceManager::GetString(L"IDS_PB_POP_DISCARD_CHANGES_Q"));
4357 pLabel->SetTextConfig(FONT_SIZE_SAVE_CONFIRM, LABEL_TEXT_STYLE_NORMAL);
4358 pLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
4359 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
4361 Button* pSaveButton = new (std::nothrow) Button();
4362 pSaveButton->Construct(Rectangle(X_SAVE_LABEL + W_SAVE_BUTTON + W_POPUP_ITEM_GAP, Y_SAVE_BUTTON, W_SAVE_BUTTON, H_SAVE_BUTTON), ResourceManager::GetString(L"IDS_COM_SK_OK"));
4363 pSaveButton->SetTextSize(FONT_SIZE_SAVE_BUTTON);
4364 pSaveButton->SetActionId(IDA_POPUP_DISCARD_CHANGES_OK);
4365 pSaveButton->AddActionEventListener(*this);
4367 Button* pCancelButton = new (std::nothrow) Button();
4368 pCancelButton->Construct(Rectangle(X_SAVE_LABEL, Y_SAVE_BUTTON, W_SAVE_BUTTON, H_SAVE_BUTTON), ResourceManager::GetString(L"IDS_PB_SK_CANCEL"));
4369 pCancelButton->SetTextSize(FONT_SIZE_SAVE_BUTTON);
4370 pCancelButton->SetActionId(IDA_POPUP_DISCARD_CHANGES_CANCEL);
4371 pCancelButton->AddActionEventListener(*this);
4373 __pDiscardChangesPopup->AddControl(pLabel);
4374 __pDiscardChangesPopup->AddControl(pSaveButton);
4375 __pDiscardChangesPopup->AddControl(pCancelButton);
4378 __pDiscardChangesPopup->SetShowState(true);
4379 __pDiscardChangesPopup->Show();
4383 ContactEditorForm::HideDiscardChangesPopup(void)
4385 __pDiscardChangesPopup->SetShowState(false);