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 if (__pCurrentFocusedItem != null)
1057 Rectangle clientBounds = GetClientAreaBounds();
1059 AppLogDebug("Contacts::OnKeypadclosed bounds are width:(%d), height:(%d)", clientBounds.width, clientBounds.height);
1060 __pTableView->SetSize(clientBounds.width, clientBounds.height);
1062 else if (__isMoreInformationContextMenuShowing)
1064 Point anchorPosition = __pMoreInformationContextMenu->GetAnchorPosition();
1065 __pTableView->ScrollToItem(TABLE_VIEW_MORE_INFORMATION_FIELD_INDEX, 0, TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_BOTTOM);
1066 if (__scrolledDistance != __origScrolledDistance)
1068 __scrolledDistance = __origScrolledDistance;
1070 anchorPosition.y -= __scrolledDistance;
1071 __pMoreInformationContextMenu->SetAnchorPosition(anchorPosition);
1072 __pMoreInformationContextMenu->Show();
1074 __isMoreInformationContextMenuShowing = false;
1076 __isKeypadOpened = false;
1080 ContactEditorForm::OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction)
1085 ContactEditorForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1087 Rectangle clientBounds = GetClientAreaBounds();
1088 int diff = clientBounds.height - __pTableView->GetHeight();
1090 if (__pTypeContextMenu != null)
1092 int yPos = __pTypeContextMenu->GetAnchorPosition().y;
1093 __pTypeContextMenu->SetAnchorPosition(Point(__pTypeContextMenu->GetAnchorPosition().x, yPos + diff));
1094 __pTypeContextMenu->Show();
1096 __pTableView->SetSize(clientBounds.width, clientBounds.height);
1100 ContactEditorForm::OnGroupedTableViewItemStateChanged(Tizen::Ui::Controls::GroupedTableView &tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem *pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1102 SceneManager* pSceneManager = SceneManager::GetInstance();
1104 if (status == TABLE_VIEW_ITEM_STATUS_SELECTED && groupIndex == TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX)
1106 if (__pCurrentFocusedItem != null)
1113 if (__pPresentationModel->GetCategoryCount() > 0)
1115 IList* pCategoryList = __pPresentationModel->GetAssignedCategoryIdListN();
1117 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_SELECTOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pCategoryList);
1121 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
1126 else if (itemIndex == 2)
1128 LaunchAppControl(PROVIDER_ID_FILEMANAGER, OPERATION_ID_PICK);
1134 ContactEditorForm::OnGroupedTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::GroupedTableView &tableView, int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewContextItem *pContextItem, bool activated)
1139 ContactEditorForm::OnGroupedTableViewGroupItemStateChanged(Tizen::Ui::Controls::GroupedTableView &tableView, int groupIndex, Tizen::Ui::Controls::TableViewGroupItem *pItem, Tizen::Ui::Controls::TableViewItemStatus status)
1144 ContactEditorForm::GetGroupCount(void)
1146 return GROUP_ITEM_COUNT;
1150 ContactEditorForm::GetItemCount(int groupIndex)
1156 case TABLE_VIEW_THUMBNAIL_FIELD_INDEX:
1161 case TABLE_VIEW_NAME_FIELD_INDEX:
1163 itemCount = NAME_FIELD_ITEM_COUNT;
1166 case TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX:
1168 itemCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER) + 1;
1170 if (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER) > 1)
1172 __isDefaultPhoneNumberButtonEnabled = true;
1177 __isDefaultPhoneNumberButtonEnabled = false;
1181 case TABLE_VIEW_EMAIL_FIELD_INDEX:
1183 itemCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_EMAIL) + 1;
1186 case TABLE_VIEW_ADDRESS_FIELD_INDEX:
1188 itemCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_ADDRESS) + 1;
1191 case TABLE_VIEW_IM_ADDRESS_FIELD_INDEX:
1193 itemCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_IM_ADDRESS);
1195 if ((itemCount == 0 && __pImAddressFieldItem->GetCount() > 0) || itemCount > 0)
1201 case TABLE_VIEW_URL_FIELD_INDEX:
1203 itemCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_URL);
1205 if ((itemCount == 0 && __pUrlFieldItem->GetCount() > 0) || itemCount > 0)
1211 case TABLE_VIEW_BIRTHDAY_FIELD_INDEX:
1214 if (__pPresentationModel->GetBirthday(birthday) != E_SUCCESS)
1224 case TABLE_VIEW_NOTE_FIELD_INDEX:
1226 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_NOTE).IsEmpty() == false || __pNoteFieldItem != null )
1236 case TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX:
1241 case TABLE_VIEW_MORE_INFORMATION_FIELD_INDEX:
1243 if (IsMoreInformationButtonVisible())
1261 ContactEditorForm::GetDefaultGroupItemHeight(void)
1263 return H_EMPTY_SPACE;
1267 ContactEditorForm::GetDefaultItemHeight(void)
1269 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1270 return pContactsApp->GetListItemSingleLineHeight();
1274 ContactEditorForm::CreateGroupItem(int groupIndex, int itemWidth)
1276 int groupItemHeight = H_EMPTY_SPACE;
1278 if (groupIndex == TABLE_VIEW_THUMBNAIL_FIELD_INDEX)
1280 groupItemHeight = H_THUMBNAIL_GROUP_ITEM_HEIGHT;
1282 else if (groupIndex == TABLE_VIEW_NAME_FIELD_INDEX)
1284 groupItemHeight = H_NAMEFIELD_GROUP_ITEM_HEIGHT;
1286 else if (groupIndex == TABLE_VIEW_BIRTHDAY_FIELD_INDEX)
1288 groupItemHeight = Y_EDIT_FIELD_GAP;
1290 else if (groupIndex == TABLE_VIEW_NOTE_FIELD_INDEX)
1292 groupItemHeight = H_EDIT_FIELD_GAP;
1294 else if ((groupIndex > TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX && groupIndex < TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX) || groupIndex == TABLE_VIEW_MORE_INFORMATION_FIELD_INDEX)
1296 groupItemHeight = 0;
1299 TableViewGroupItem* pGroupItem = new (std::nothrow) TableViewGroupItem();
1300 pGroupItem->Construct(Dimension(itemWidth, groupItemHeight));
1301 pGroupItem->SetBackgroundColor(Color(COLOR_TABLE_VIEW_BG), TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1302 pGroupItem->SetEnabled(false);
1304 Panel* pPanel = new (std::nothrow) Panel();
1305 pPanel->Construct(Rectangle(0, -(H_DIVIDER), itemWidth, groupItemHeight + H_DIVIDER));
1306 pPanel->SetBackgroundColor(Color(COLOR_TABLE_VIEW_BG));
1308 pGroupItem->AddControl(pPanel);
1314 ContactEditorForm::DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem* pItem)
1323 ContactEditorForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
1325 TableViewItem* pItem = null;
1329 case TABLE_VIEW_THUMBNAIL_FIELD_INDEX:
1331 pItem = GetThumbnailField(itemWidth);
1334 case TABLE_VIEW_NAME_FIELD_INDEX:
1336 pItem = GetNameFields(itemWidth);
1339 case TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX:
1341 if ((itemIndex == __pTableView->GetItemCountAt(groupIndex) - 1) && __isDefaultPhoneNumberButtonEnabled == true)
1343 pItem = GetDefaultPhoneNumberItem(itemWidth);
1347 pItem = GetPhoneNumberFields(itemIndex, itemWidth);
1350 case TABLE_VIEW_EMAIL_FIELD_INDEX:
1352 pItem = GetEmailFields(itemIndex, itemWidth);
1355 case TABLE_VIEW_ADDRESS_FIELD_INDEX:
1357 pItem = GetAddressFields(itemIndex, itemWidth);
1360 case TABLE_VIEW_IM_ADDRESS_FIELD_INDEX:
1362 pItem = GetImAddressFields(itemIndex, itemWidth);
1365 case TABLE_VIEW_URL_FIELD_INDEX:
1367 pItem = GetUrlFields(itemIndex, itemWidth);
1370 case TABLE_VIEW_BIRTHDAY_FIELD_INDEX:
1372 pItem = GetBirthdayField(itemWidth);
1375 case TABLE_VIEW_NOTE_FIELD_INDEX:
1377 pItem = GetNoteField(itemWidth);
1380 case TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX:
1385 pItem = GetGroupsField(itemWidth);
1389 pItem = new (std::nothrow) TableViewItem();
1390 pItem->Construct(Dimension(itemWidth, H_DIVIDER * 2));
1391 pItem->SetEnabled(false);
1395 pItem = GetRingtoneField(itemWidth);
1402 case TABLE_VIEW_MORE_INFORMATION_FIELD_INDEX:
1404 if (IsMoreInformationButtonVisible())
1406 pItem = GetMoreInformationField(itemWidth);
1422 ContactEditorForm::DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
1424 if ((groupIndex > TABLE_VIEW_NAME_FIELD_INDEX && groupIndex < TABLE_VIEW_BIRTHDAY_FIELD_INDEX) || groupIndex == TABLE_VIEW_NOTE_FIELD_INDEX)
1427 __pDeletedItemList->IndexOf(*pItem, index);
1431 __pDeletedItemList->RemoveAt(index);
1438 else if (groupIndex == TABLE_VIEW_NAME_FIELD_INDEX)
1441 __pNameFieldItem = null;
1444 if (__pCurrentFocusedItem == pItem && __isKeypadOpened)
1446 __isKeypadOpened = false;
1456 ContactEditorForm::UpdateGroupItem(int groupIndex, Tizen::Ui::Controls::TableViewGroupItem *pItem)
1461 ContactEditorForm::UpdateItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::TableViewItem *pItem)
1470 case TABLE_VIEW_THUMBNAIL_FIELD_INDEX:
1472 SetThumbnailControls(*pItem, true);
1473 pItem->Invalidate(true);
1476 case TABLE_VIEW_NAME_FIELD_INDEX:
1478 if (__pCurrentFocusedItem == pItem && __isKeypadOpened)
1480 __isKeypadOpened = false;
1482 pItem->RemoveAllControls();
1483 SetNameFields(*pItem);
1487 case TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX:
1490 Panel* pPanel = static_cast<Panel*>(pItem->GetControl(0));
1497 Label* pLabel = static_cast<Label*>(pPanel->GetControl(1));
1506 valueString = __pPresentationModel->GetValue(DETAIL_PROPERTY_GROUP);
1507 if (valueString.IsEmpty() == true)
1509 valueString = ResourceManager::GetString(L"IDS_PB_BODY_NOT_ASSIGNED");
1512 else if (itemIndex == 2)
1514 String ringtoneName = __pPresentationModel->GetValue(DETAIL_PROPERTY_RINGTONE);
1517 ringtoneName.LastIndexOf(L"/", ringtoneName.GetLength() - 1, index);
1521 ringtoneName.SubString(index + 1, valueString);
1525 pLabel->SetText(valueString);
1526 pLabel->Invalidate(false);
1529 case TABLE_VIEW_BIRTHDAY_FIELD_INDEX:
1533 DateTime birthdayDate;
1534 EditDate* pBirthday = static_cast<EditDate *>(pItem->GetControl(1));
1536 if (pBirthday == null)
1541 __pPresentationModel->GetBirthday(birthdayDate);
1543 pBirthday->GetYearRange(min, max);
1544 max = birthdayDate.GetYear();
1545 pBirthday->SetYearRange(max - BIRTHDAY_MIN_YEAR_DIFF, max);
1546 pBirthday->SetDate(birthdayDate);
1547 pBirthday->Invalidate(false);
1550 case TABLE_VIEW_NOTE_FIELD_INDEX:
1552 Control* pNoteField = pItem->GetControl(1);
1553 Control* pNoteLabel = pItem->GetControl(0);
1554 if (pNoteField == null)
1559 pItem->SetSize(pItem->GetWidth(), pNoteLabel->GetHeight() + pNoteField->GetHeight() + H_EDIT_FIELD_GAP);
1567 Tizen::Ui::Controls::TableViewItem*
1568 ContactEditorForm::GetThumbnailField(int itemWidth)
1570 TableViewItem* pThumbnailItem = new (std::nothrow) TableViewItem();
1571 pThumbnailItem->Construct(Dimension(itemWidth, W_THUMBNAIL + H_THUMBNAIL_DELETE_BUTTON_GAP + Y_EDIT_FIELD_GAP * 2));
1572 pThumbnailItem->SetBackgroundColor(Color(0), TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1574 SetThumbnailControls(*pThumbnailItem);
1576 return pThumbnailItem;
1579 Tizen::Ui::Controls::TableViewItem*
1580 ContactEditorForm::GetNameFields(int itemWidth)
1582 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1584 __pNameFieldItem = new (std::nothrow) TableViewItem();
1585 __pNameFieldItem->Construct(Dimension(itemWidth, pContactsApp->GetListItemSingleLineHeight()));
1586 __pNameFieldItem->SetBackgroundColor(Color(0), TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1588 SetNameFields(*__pNameFieldItem);
1590 return __pNameFieldItem;
1594 ContactEditorForm::SetNameFields(Tizen::Ui::Controls::TableViewItem& item)
1596 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1598 int itemWidth = item.GetWidth();
1599 int itemHeight = pContactsApp->GetListItemSingleLineHeight();
1601 if (__isExpandable == true)
1603 itemHeight = DEFAULT_EXPAND_NAME_FIELD_COUNT * pContactsApp->GetListItemSingleLineHeight();
1605 if (__isJobTitleEnabled == true)
1607 itemHeight += pContactsApp->GetListItemSingleLineHeight();
1610 if (__isDepartmentEnabled)
1612 itemHeight += pContactsApp->GetListItemSingleLineHeight();
1616 item.SetSize(itemWidth, itemHeight);
1618 Rectangle itemBounds(W_ITEM_GAP, Y_EDIT_FIELD_GAP, itemWidth - (W_ITEM_GAP * 3) - H_BUTTON, pContactsApp->GetListItemSingleLineHeight() - H_EDIT_FIELD_GAP);
1620 if (__isExpandable == true)
1622 EditField* pFirstName = new (std::nothrow) EditField();
1623 pFirstName->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, false, __pPresentationModel->GetValue(DETAIL_PROPERTY_FIRST_NAME).GetLength() + EDIT_FIELD_EXTENDED_LENGTH);
1624 pFirstName->SetGuideText(ResourceManager::GetString(L"IDS_PB_BODY_FIRST_NAME"));
1625 pFirstName->AddFocusEventListener(*this);
1626 pFirstName->AddKeypadEventListener(*this);
1627 pFirstName->SetName(ResourceManager::GetString(L"IDS_PB_BODY_FIRST_NAME"));
1628 pFirstName->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_FIRST_NAME));
1629 pFirstName->AddTextEventListener(*this);
1630 pFirstName->SetTextSize(pContactsApp->GetFontSize());
1632 item.AddControl(pFirstName);
1633 item.SetIndividualSelectionEnabled(pFirstName, true);
1635 itemBounds.y += pContactsApp->GetListItemSingleLineHeight();
1636 EditField* pMiddleName = new (std::nothrow) EditField();
1637 pMiddleName->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, false, __pPresentationModel->GetValue(DETAIL_PROPERTY_MIDDLE_NAME).GetLength() + EDIT_FIELD_EXTENDED_LENGTH);
1638 pMiddleName->SetGuideText(ResourceManager::GetString(L"IDS_PB_BODY_MIDDLE_NAME"));
1639 pMiddleName->AddFocusEventListener(*this);
1640 pMiddleName->AddKeypadEventListener(*this);
1641 pMiddleName->AddTextEventListener(*this);
1642 pMiddleName->SetName(ResourceManager::GetString(L"IDS_PB_BODY_MIDDLE_NAME"));
1643 pMiddleName->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_MIDDLE_NAME));
1644 pMiddleName->SetTextSize(pContactsApp->GetFontSize());
1646 item.AddControl(pMiddleName);
1647 item.SetIndividualSelectionEnabled(pMiddleName, true);
1649 itemBounds.y += pContactsApp->GetListItemSingleLineHeight();
1650 EditField* pLastName = new (std::nothrow) EditField();
1651 pLastName->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, false, __pPresentationModel->GetValue(DETAIL_PROPERTY_LAST_NAME).GetLength() + EDIT_FIELD_EXTENDED_LENGTH);
1652 pLastName->SetGuideText(ResourceManager::GetString(L"IDS_PB_BODY_LAST_NAME"));
1653 pLastName->AddFocusEventListener(*this);
1654 pLastName->AddKeypadEventListener(*this);
1655 pLastName->SetName(ResourceManager::GetString(L"IDS_PB_BODY_LAST_NAME"));
1656 pLastName->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_LAST_NAME));
1657 pLastName->SetTextSize(pContactsApp->GetFontSize());
1658 pLastName->AddTextEventListener(*this);
1660 item.AddControl(pLastName);
1661 item.SetIndividualSelectionEnabled(pLastName, true);
1663 itemBounds.y += pContactsApp->GetListItemSingleLineHeight();
1664 EditField* pSuffix = new (std::nothrow) EditField();
1665 pSuffix->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, false, __pPresentationModel->GetValue(DETAIL_PROPERTY_NAME_SUFFIX).GetLength() + EDIT_FIELD_EXTENDED_LENGTH);
1666 pSuffix->SetGuideText(ResourceManager::GetString(L"IDS_PB_BODY_SUFFIX"));
1667 pSuffix->AddFocusEventListener(*this);
1668 pSuffix->AddKeypadEventListener(*this);
1669 pSuffix->AddTextEventListener(*this);
1670 pSuffix->SetName(ResourceManager::GetString(L"IDS_PB_BODY_SUFFIX"));
1671 pSuffix->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_NAME_SUFFIX));
1672 pSuffix->SetTextSize(pContactsApp->GetFontSize());
1674 item.AddControl(pSuffix);
1675 item.SetIndividualSelectionEnabled(pSuffix, true);
1677 itemBounds.y += pContactsApp->GetListItemSingleLineHeight();
1678 EditField* pNickName = new (std::nothrow) EditField();
1679 pNickName->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY);
1680 pNickName->SetGuideText(ResourceManager::GetString(L"IDS_PB_BODY_NICKNAME"));
1681 pNickName->AddFocusEventListener(*this);
1682 pNickName->AddKeypadEventListener(*this);
1683 pNickName->AddTextEventListener(*this);
1684 pNickName->SetName(ResourceManager::GetString(L"IDS_PB_BODY_NICKNAME"));
1685 pNickName->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_NICK_NAME));
1686 pNickName->SetTextSize(pContactsApp->GetFontSize());
1688 item.AddControl(pNickName);
1689 item.SetIndividualSelectionEnabled(pNickName, true);
1691 itemBounds.y += pContactsApp->GetListItemSingleLineHeight();
1692 if (__isJobTitleEnabled == true)
1694 EditField* pJobTitle = new (std::nothrow) EditField();
1695 pJobTitle->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY);
1696 pJobTitle->SetGuideText(ResourceManager::GetString(L"IDS_PB_BODY_JOB_TITLE"));
1697 pJobTitle->AddFocusEventListener(*this);
1698 pJobTitle->AddKeypadEventListener(*this);
1699 pJobTitle->AddTextEventListener(*this);
1700 pJobTitle->SetName(ResourceManager::GetString(L"IDS_PB_BODY_JOB_TITLE"));
1701 pJobTitle->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_JOB_TITLE));
1702 pJobTitle->SetTextSize(pContactsApp->GetFontSize());
1704 item.AddControl(pJobTitle);
1705 item.SetIndividualSelectionEnabled(pJobTitle, true);
1707 itemBounds.y += pContactsApp->GetListItemSingleLineHeight();
1710 if (__isDepartmentEnabled == true)
1712 EditField* pDepartment = new (std::nothrow) EditField();
1713 pDepartment->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY);
1714 pDepartment->SetGuideText(ResourceManager::GetString(L"IDS_PB_BODY_DEPARTMENT"));
1715 pDepartment->AddFocusEventListener(*this);
1716 pDepartment->AddKeypadEventListener(*this);
1717 pDepartment->AddTextEventListener(*this);
1718 pDepartment->SetName(ResourceManager::GetString(L"IDS_PB_BODY_DEPARTMENT"));
1719 pDepartment->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_DEPARTMENT));
1720 pDepartment->SetTextSize(pContactsApp->GetFontSize());
1722 item.AddControl(pDepartment);
1723 item.SetIndividualSelectionEnabled(pDepartment, true);
1725 itemBounds.y += pContactsApp->GetListItemSingleLineHeight();
1728 EditField* pCompanyName = new (std::nothrow) EditField();
1729 pCompanyName->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY);
1730 pCompanyName->SetGuideText(ResourceManager::GetString(L"IDS_PB_BODY_COMPANY"));
1731 pCompanyName->AddFocusEventListener(*this);
1732 pCompanyName->AddKeypadEventListener(*this);
1733 pCompanyName->SetName(ResourceManager::GetString(L"IDS_PB_BODY_COMPANY"));
1734 pCompanyName->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_COMPANY));
1735 pCompanyName->SetTextSize(pContactsApp->GetFontSize());
1737 item.AddControl(pCompanyName);
1738 item.SetIndividualSelectionEnabled(pCompanyName, true);
1743 String firstName(__pPresentationModel->GetValue(DETAIL_PROPERTY_FIRST_NAME));
1744 String lastName(__pPresentationModel->GetValue(DETAIL_PROPERTY_LAST_NAME));
1745 String middleName(__pPresentationModel->GetValue(DETAIL_PROPERTY_MIDDLE_NAME));
1746 String suffix(__pPresentationModel->GetValue(DETAIL_PROPERTY_NAME_SUFFIX));
1748 nameLength = firstName.GetLength() + lastName.GetLength() + middleName.GetLength();
1749 if (suffix.IsEmpty() == false)
1751 nameLength = nameLength + suffix.GetLength() + 1;
1754 EditField* pName = new (std::nothrow) EditField();
1755 pName->Construct(itemBounds, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, false, nameLength + EDIT_FIELD_EXTENDED_LENGTH);
1756 pName->SetGuideText(ResourceManager::GetString(L"IDS_COM_BODY_DETAILS_NAME"));
1757 pName->AddFocusEventListener(*this);
1758 pName->AddKeypadEventListener(*this);
1759 pName->SetName(Integer::ToString(IDA_INPUT_FIELD_DISPLAY_NAME));
1760 pName->AddTextEventListener(*this);
1761 pName->SetTextSize(pContactsApp->GetFontSize());
1763 if (firstName.IsEmpty() == false)
1765 pName->SetText(firstName);
1768 if (middleName.IsEmpty() == false)
1770 pName->AppendText(CHARACTER_SPACE + middleName);
1773 if (lastName.IsEmpty() == false)
1775 pName->AppendText(CHARACTER_SPACE + lastName);
1778 if (suffix.IsEmpty() == false)
1780 pName->AppendText(DELIMITER_COMMA);
1781 pName->AppendText(CHARACTER_SPACE + suffix);
1784 item.AddControl(pName);
1785 item.SetIndividualSelectionEnabled(pName, true);
1786 __fullName = pName->GetText();
1789 Button* pButtonExpand = new (std::nothrow) Button();
1790 pButtonExpand->Construct(Rectangle(itemWidth - (H_BUTTON + W_ITEM_GAP), (pContactsApp->GetListItemSingleLineHeight() - H_BUTTON) / 2, H_BUTTON, H_BUTTON));
1791 pButtonExpand->SetActionId(IDA_BUTTON_EXPANDABLE);
1792 pButtonExpand->SetName(EXPAND_BUTTON);
1793 pButtonExpand->AddActionEventListener(*this);
1795 Bitmap* pBitmap = null;
1796 Bitmap* pBitmapPressed = null;
1798 if (__isExpandable == true)
1800 pBitmap = ResourceManager::GetBitmapN(IDB_EXPAND_OPENED);
1801 pBitmapPressed = ResourceManager::GetBitmapN(IDB_EXPAND_OPENED_PRESSED);
1805 pBitmap = ResourceManager::GetBitmapN(IDB_EXPAND_CLOSED);
1806 pBitmapPressed = ResourceManager::GetBitmapN(IDB_EXPAND_CLOSED_PRESSED);
1809 if (pBitmap != null)
1811 pButtonExpand->SetNormalBitmap(Point(0, 0), *pBitmap);
1814 if (pBitmapPressed != null)
1816 pButtonExpand->SetPressedBitmap(Point(0, 0), *pBitmapPressed);
1820 delete pBitmapPressed;
1822 pBitmap = ResourceManager::GetBitmapN(IDB_EXPAND_BUTTON_NORMAL);
1823 pBitmapPressed = ResourceManager::GetBitmapN(IDB_EXPAND_BUTTON_PRESSED);
1825 if (pBitmap != null)
1827 pButtonExpand->SetNormalBackgroundBitmap(*pBitmap);
1830 if (pBitmapPressed != null)
1832 pButtonExpand->SetPressedBackgroundBitmap(*pBitmapPressed);
1833 delete pBitmapPressed;
1836 item.AddControl(pButtonExpand);
1837 item.SetIndividualSelectionEnabled(pButtonExpand, true);
1840 Tizen::Ui::Controls::TableViewItem*
1841 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)
1843 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1845 TableViewItem* pTableViewItem = new (std::nothrow) TableViewItem();
1846 pTableViewItem->Construct(Dimension(itemWidth, pContactsApp->GetListItemSingleLineHeight()), TABLE_VIEW_ANNEX_STYLE_NORMAL);
1847 pTableViewItem->SetBackgroundColor(Color(0), TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
1849 EditField* pInputField = new (std::nothrow) EditField();
1850 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);
1851 pInputField->SetGuideText(guideText);
1852 pInputField->SetText(text);
1853 pInputField->SetTextSize(pContactsApp->GetFontSize());
1854 pInputField->AddKeypadEventListener(*this);
1855 pInputField->AddFocusEventListener(*this);
1856 pInputField->AddTextEventListener(*this);
1857 pInputField->SetEnabled(true);
1859 int parsedItemIndex = 0;
1860 parsedItemIndex |= (groupIndex << TABLE_VIEW_INPUT_FIELD_ACTION_SHIFT);
1861 parsedItemIndex |= (groupIndex << TABLE_VIEW_GROUP_INDEX_SHIFT);
1862 parsedItemIndex |= itemIndex;
1864 pInputField->SetName(Integer::ToString(parsedItemIndex));
1865 pTableViewItem->AddControl(pInputField);
1867 Button *pButtonType = new (std::nothrow) Button();
1868 pButtonType->Construct(Rectangle(pInputField->GetX() + pInputField->GetWidth() + W_ITEM_GAP, (pContactsApp->GetListItemSingleLineHeight() - H_BUTTON) / 2, W_TYPE_BUTTON, H_BUTTON));
1869 pButtonType->SetText(titleText);
1870 pButtonType->SetActionId(IDA_BUTTON_TYPE);
1871 pButtonType->AddActionEventListener(*this);
1872 pButtonType->AddTouchEventListener(*this);
1873 pButtonType->SetName(Integer::ToString(parsedItemIndex));
1875 Bitmap* pDropBoxIcon = ResourceManager::GetBitmapN(IDB_BUTTON_DROPBOX);
1877 if (pDropBoxIcon != null)
1879 pButtonType->SetNormalBitmap(Point(W_TYPE_BUTTON - W_DROPBOX_ICON, H_BUTTON - H_DROPBOX_ICON), *pDropBoxIcon);
1880 pButtonType->SetPressedBitmap(Point(W_TYPE_BUTTON - W_DROPBOX_ICON, H_BUTTON - H_DROPBOX_ICON), *pDropBoxIcon);
1881 pButtonType->SetDisabledBitmap(Point(W_TYPE_BUTTON - W_DROPBOX_ICON, H_BUTTON - H_DROPBOX_ICON), *pDropBoxIcon);
1882 delete pDropBoxIcon;
1884 pTableViewItem->AddControl(pButtonType);
1886 Button *pButtonDelete = new (std::nothrow) Button();
1887 pButtonDelete->Construct(Rectangle(itemWidth - H_BUTTON - W_ITEM_GAP, (pContactsApp->GetListItemSingleLineHeight() - H_BUTTON) / 2, H_BUTTON, H_BUTTON));
1888 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_MINUS);
1889 Bitmap* pBitmapPressed = ResourceManager::GetBitmapN(IDB_BUTTON_MINUS_PRESSED);
1891 if (pBitmap != null)
1893 pButtonDelete->SetNormalBitmap(Point(0, 0), *pBitmap);
1896 if (pBitmapPressed != null)
1898 pButtonDelete->SetPressedBitmap(Point(0, 0), *pBitmapPressed);
1899 delete pBitmapPressed;
1902 pBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_DELETE_NORMAL);
1903 pBitmapPressed = ResourceManager::GetBitmapN(IDB_BUTTON_DELETE_PRESSED);
1905 if (pBitmap != null)
1907 pButtonDelete->SetNormalBackgroundBitmap(*pBitmap);
1910 if (pBitmapPressed != null)
1912 pButtonDelete->SetPressedBackgroundBitmap(*pBitmapPressed);
1913 delete pBitmapPressed;
1917 actionId |= TABLE_VIEW_DELETE_INPUT_FIELD_ID;
1918 actionId |= (groupIndex << TABLE_VIEW_GROUP_INDEX_SHIFT);
1919 actionId |= itemIndex;
1921 pButtonDelete->SetActionId(actionId);
1922 pButtonDelete->AddActionEventListener(*this);
1924 pTableViewItem->AddControl(pButtonDelete);
1926 if (isDeleteButton == false)
1928 pButtonDelete->SetShowState(false);
1931 pTableViewItem->SetIndividualSelectionEnabled(pInputField, true);
1932 pTableViewItem->SetIndividualSelectionEnabled(pButtonType, true);
1933 pTableViewItem->SetIndividualSelectionEnabled(pButtonDelete, true);
1935 return pTableViewItem;
1938 Tizen::Ui::Controls::TableViewItem*
1939 ContactEditorForm::GetPhoneNumberFields(int itemIndex, int itemWidth)
1941 if (__pPhoneNumberFieldItem->GetCount() == 0)
1943 int phoneNumberCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER);
1944 String guideText = ResourceManager::GetString(L"IDS_PB_BODY_NUMBER");
1945 String defaultPhoneNumber = __pPresentationModel->GetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER);
1947 for (int i = 0; i < phoneNumberCount; i++)
1949 String typeString = __pPresentationModel->GetType(DETAIL_PROPERTY_PHONE_NUMBER, i);
1950 String phoneNumberString = __pPresentationModel->GetValue(DETAIL_PROPERTY_PHONE_NUMBER, i);
1952 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX, i, itemWidth, EDIT_FIELD_STYLE_PHONE_NUMBER, typeString, guideText, phoneNumberString, true);
1953 pItem->SetName(Integer::ToString(__pPresentationModel->GetPhoneNumberType(i)));
1955 __pPhoneNumberFieldItem->Add(*pItem);
1958 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX, phoneNumberCount, itemWidth, EDIT_FIELD_STYLE_PHONE_NUMBER, __pPresentationModel->GetPhoneNumberTypeString(DETAIL_PHONENUMBER_TYPE_MOBILE), guideText);
1959 pItem->SetName(Integer::ToString(DETAIL_PHONENUMBER_TYPE_MOBILE));
1961 __pPhoneNumberFieldItem->Add(*pItem);
1962 SetAsDefaultPhoneNumber(__pPresentationModel->GetDefaultNumberIndex());
1965 if (__pPhoneNumberFieldItem->GetCount() < (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER) + 1))
1967 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"));
1968 pItem->SetName(Integer::ToString(DETAIL_PHONENUMBER_TYPE_MOBILE));
1970 __pPhoneNumberFieldItem->Add(*pItem);
1973 TableViewItem* pItem = static_cast<TableViewItem *>(__pPhoneNumberFieldItem->GetAt(itemIndex));
1982 Tizen::Ui::Controls::TableViewItem*
1983 ContactEditorForm::GetEmailFields(int itemIndex, int itemWidth)
1985 if (__pEmailFieldItem->GetCount() == 0)
1987 int emailCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_EMAIL);
1988 String guideText = ResourceManager::GetString(L"IDS_COM_BODY_EMAIL");
1990 for (int i = 0; i < emailCount; i++)
1992 String typeString = __pPresentationModel->GetType(DETAIL_PROPERTY_EMAIL, i);
1993 String emailString = __pPresentationModel->GetValue(DETAIL_PROPERTY_EMAIL, i);
1995 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_EMAIL_FIELD_INDEX, i, itemWidth, EDIT_FIELD_STYLE_EMAIL, typeString, guideText, emailString, true);
1996 pItem->SetName(Integer::ToString(__pPresentationModel->GetEmailType(i)));
1998 __pEmailFieldItem->Add(*pItem);
2001 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_EMAIL_FIELD_INDEX, emailCount, itemWidth, EDIT_FIELD_STYLE_EMAIL, __pPresentationModel->GetEmailTypeString(DETAIL_EMAIL_TYPE_HOME), guideText);
2002 pItem->SetName(Integer::ToString(DETAIL_EMAIL_TYPE_HOME));
2004 __pEmailFieldItem->Add(*pItem);
2007 if (__pEmailFieldItem->GetCount() < (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_EMAIL) + 1))
2009 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"));
2010 pItem->SetName(Integer::ToString(DETAIL_EMAIL_TYPE_HOME));
2012 __pEmailFieldItem->Add(*pItem);
2015 TableViewItem* pItem = static_cast<TableViewItem *>(__pEmailFieldItem->GetAt(itemIndex));
2024 Tizen::Ui::Controls::TableViewItem*
2025 ContactEditorForm::GetAddressFields(int itemIndex, int itemWidth)
2027 if (__pAddressFieldItem->GetCount() == 0)
2029 int addressCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_ADDRESS);
2030 String guideText = ResourceManager::GetString(L"IDS_PB_BODY_ADDRESS");
2032 for (int i = 0; i < addressCount; i++)
2034 String typeString = __pPresentationModel->GetType(DETAIL_PROPERTY_ADDRESS, i);
2035 String addressString = __pPresentationModel->GetValue(DETAIL_PROPERTY_ADDRESS, i);
2037 TableViewItem* pItem= GetInputFieldN(TABLE_VIEW_ADDRESS_FIELD_INDEX, i, itemWidth, EDIT_FIELD_STYLE_NORMAL, typeString, guideText, addressString, true);
2038 pItem->SetName(Integer::ToString(__pPresentationModel->GetAddressType(DETAIL_PROPERTY_ADDRESS, i)));
2040 __pAddressFieldItem->Add(*pItem);
2043 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_ADDRESS_FIELD_INDEX, addressCount, itemWidth, EDIT_FIELD_STYLE_NORMAL, ResourceManager::GetString(L"IDS_PB_BODY_HOME"), guideText);
2044 pItem->SetName(Integer::ToString(DETAIL_ADDRESS_TYPE_HOME));
2046 __pAddressFieldItem->Add(*pItem);
2049 if (__pAddressFieldItem->GetCount() < (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_ADDRESS) + 1))
2051 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"));
2052 pItem->SetName(Integer::ToString(DETAIL_ADDRESS_TYPE_HOME));
2054 __pAddressFieldItem->Add(*pItem);
2057 TableViewItem* pItem = static_cast<TableViewItem *>(__pAddressFieldItem->GetAt(itemIndex));
2066 Tizen::Ui::Controls::TableViewItem*
2067 ContactEditorForm::GetImAddressFields(int itemIndex, int itemWidth)
2069 if (__pImAddressFieldItem->GetCount() == 0)
2071 int imCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_IM_ADDRESS);
2072 String guideText = ResourceManager::GetString(L"IDS_PB_HEADER_INSTANT_MESSENGER_ABB");
2074 for (int i = 0; i < imCount; i++)
2076 String typeString = __pPresentationModel->GetType(DETAIL_PROPERTY_IM_ADDRESS, i);
2077 String imString = __pPresentationModel->GetValue(DETAIL_PROPERTY_IM_ADDRESS, i);
2079 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_IM_ADDRESS_FIELD_INDEX, i, itemWidth, EDIT_FIELD_STYLE_NORMAL, typeString, guideText, imString, true);
2080 pItem->SetName(Integer::ToString(__pPresentationModel->GetImAddressType(i)));
2082 __pImAddressFieldItem->Add(*pItem);
2085 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_IM_ADDRESS_FIELD_INDEX, imCount, itemWidth, EDIT_FIELD_STYLE_NORMAL, IM_ADDRESS_YAHOO, guideText);
2086 pItem->SetName(Integer::ToString(DETAIL_IM_ADDRESS_TYPE_YAHOO));
2088 __pImAddressFieldItem->Add(*pItem);
2091 if (__pImAddressFieldItem->GetCount() < (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_IM_ADDRESS) + 1))
2093 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"));
2094 pItem->SetName(Integer::ToString(DETAIL_IM_ADDRESS_TYPE_YAHOO));
2096 __pImAddressFieldItem->Add(*pItem);
2099 TableViewItem* pItem = static_cast<TableViewItem *>(__pImAddressFieldItem->GetAt(itemIndex));
2108 Tizen::Ui::Controls::TableViewItem*
2109 ContactEditorForm::GetUrlFields(int itemIndex, int itemWidth)
2111 if (__pUrlFieldItem->GetCount() == 0)
2113 int urlCount = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_URL);
2114 String guideText = ResourceManager::GetString(L"IDS_PB_BODY_URL");
2116 for (int i = 0; i < urlCount; i++)
2118 String typeString = __pPresentationModel->GetType(DETAIL_PROPERTY_URL, i);
2119 String urlString = __pPresentationModel->GetValue(DETAIL_PROPERTY_URL, i);
2121 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_URL_FIELD_INDEX, i, itemWidth, EDIT_FIELD_STYLE_URL, typeString, guideText, urlString, true);
2122 pItem->SetName(Integer::ToString(__pPresentationModel->GetUrlType(i)));
2124 __pUrlFieldItem->Add(*pItem);
2127 TableViewItem* pItem = GetInputFieldN(TABLE_VIEW_URL_FIELD_INDEX, urlCount, itemWidth, EDIT_FIELD_STYLE_URL, __pPresentationModel->GetUrlTypeString(DETAIL_URL_TYPE_HOME), guideText);
2128 pItem->SetName(Integer::ToString(DETAIL_URL_TYPE_HOME));
2130 __pUrlFieldItem->Add(*pItem);
2133 if (__pUrlFieldItem->GetCount() < (__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_URL) + 1))
2135 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"));
2136 pItem->SetName(Integer::ToString(DETAIL_URL_TYPE_HOME));
2138 __pUrlFieldItem->Add(*pItem);
2141 TableViewItem* pItem = static_cast<TableViewItem *>(__pUrlFieldItem->GetAt(itemIndex));
2149 Tizen::Ui::Controls::TableViewItem*
2150 ContactEditorForm::GetGroupsField(int itemWidth)
2152 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
2154 TableViewItem* pGroupsItem = new (std::nothrow) TableViewItem();
2155 pGroupsItem->Construct(Dimension(itemWidth, H_DOUBLE_LINE_ITEM + pContactsApp->GetFontHeightOffset()), TABLE_VIEW_ANNEX_STYLE_NORMAL);
2156 pGroupsItem->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND);
2157 pGroupsItem->AddKeyEventListener(*this);
2159 Panel* pGroupStyle = new (std::nothrow) Panel();
2160 pGroupStyle->Construct(Rectangle(0, 0, itemWidth , H_DOUBLE_LINE_ITEM + pContactsApp->GetFontHeightOffset()), GROUP_STYLE_NONE);
2161 pGroupStyle->SetName(GROUP_STYLE_PANEL);
2162 pGroupStyle->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND);
2163 pGroupStyle->AddTouchEventListener(*this);
2164 pGroupsItem->AddControl(pGroupStyle);
2166 Label* pLabelTitle = new (std::nothrow) Label();
2167 pLabelTitle->Construct(Rectangle(0, H_GROUP_RINGTONE_TITLE_GAP, itemWidth, H_GROUP_RINGTONE_TITLE_LABEL), ResourceManager::GetString(L"IDS_PB_BODY_GROUPS"));
2168 pLabelTitle->SetName(GROUP_LABEL_TITLE);
2169 pLabelTitle->AddTouchEventListener(*this);
2170 pLabelTitle->SetTextConfig(FONT_SIZE_TITLE_TEXT, LABEL_TEXT_STYLE_BOLD);
2171 pLabelTitle->SetTextColor(COLOR_ITEM_TITLE);
2172 pLabelTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
2174 pGroupStyle->AddControl(pLabelTitle);
2176 String groupsName = __pPresentationModel->GetValue(DETAIL_PROPERTY_GROUP);
2177 if (groupsName.IsEmpty() == true)
2179 groupsName = ResourceManager::GetString(L"IDS_PB_BODY_NOT_ASSIGNED");
2182 Label* pLabelGroupName = new (std::nothrow) Label();
2183 pLabelGroupName->Construct(Rectangle(0, H_GROUP_RINGTONE_TITLE_GAP + H_GROUP_RINGTONE_TITLE_LABEL, itemWidth, H_GROUP_RINGTONE_VALUE_LABEL + pContactsApp->GetFontHeightOffset()), groupsName);
2184 pLabelGroupName->SetName(GROUP_LABEL_VALUE);
2185 pLabelGroupName->AddTouchEventListener(*this);
2186 pLabelGroupName->SetTextConfig(pContactsApp->GetFontSize(), LABEL_TEXT_STYLE_NORMAL);
2187 pLabelGroupName->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
2189 pGroupStyle->AddControl(pLabelGroupName);
2194 Tizen::Ui::Controls::TableViewItem*
2195 ContactEditorForm::GetBirthdayField(int itemWidth)
2197 DateTime birthdayDate;
2198 EditDate* pBirthday = new (std::nothrow) EditDate();
2199 pBirthday->Construct(Point(W_TITLE_LABEL, 0));
2200 pBirthday->AddDateChangeEventListener(*this);
2202 __pPresentationModel->GetBirthday(birthdayDate);
2203 pBirthday->SetDate(birthdayDate);
2205 DateTime currentDate;
2206 Tizen::System::SystemTime::GetCurrentTime(currentDate);
2209 pBirthday->GetYearRange(min, max);
2210 max = currentDate.GetYear();
2211 pBirthday->SetYearRange(max - BIRTHDAY_MIN_YEAR_DIFF, max);
2213 TableViewItem* pBirthdayItem = new (std::nothrow) TableViewItem();
2214 pBirthdayItem->Construct(Dimension(itemWidth, H_ITEM), TABLE_VIEW_ANNEX_STYLE_NORMAL);
2215 pBirthdayItem->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
2216 pBirthdayItem->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
2218 Label* pLabelTitle = new (std::nothrow) Label();
2219 pLabelTitle->Construct(Rectangle(0, 0, W_TITLE_LABEL, pBirthdayItem->GetHeight()), L"");
2220 pLabelTitle->SetText(ResourceManager::GetString(L"IDS_PB_BODY_BIRTHDAY"));
2221 pLabelTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
2222 pLabelTitle->SetTextColor(COLOR_ITEM_TITLE);
2223 pLabelTitle->SetTextConfig(FONT_SIZE_TITLE_TEXT, LABEL_TEXT_STYLE_BOLD);
2225 pBirthdayItem->AddControl(pLabelTitle);
2226 pBirthdayItem->AddControl(pBirthday);
2228 Button* pClearButton = new (std::nothrow) Button();
2229 pClearButton->Construct(Rectangle(itemWidth - (H_BUTTON * 2) - H_BUTTON/2, (pBirthdayItem->GetHeight() - H_BUTTON) / 2, H_BUTTON, H_BUTTON));
2230 pClearButton->SetActionId(IDA_BUTTON_BIRTHDAY_CLEAR);
2231 pClearButton->AddActionEventListener(*this);
2233 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_RESET_NORMAL);
2234 if (pBitmap != null)
2236 pClearButton->SetNormalBitmap(Point(0, 0), *pBitmap);
2239 pBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_RESET_PRESSED);
2240 if (pBitmap != null)
2242 pClearButton->SetPressedBitmap(Point(0, 0), *pBitmap);
2246 pBirthdayItem->AddControl(pClearButton);
2248 Button *pButtonDelete = new (std::nothrow) Button();
2249 pButtonDelete->Construct(Rectangle(itemWidth - H_BUTTON - W_ITEM_GAP, (H_ITEM - H_BUTTON) / 2, H_BUTTON, H_BUTTON));
2251 pBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_MINUS);
2252 if (pBitmap != null)
2254 pButtonDelete->SetNormalBitmap(Point(0, 0), *pBitmap);
2258 pBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_MINUS_PRESSED);
2259 if (pBitmap != null)
2261 pButtonDelete->SetPressedBitmap(Point(0, 0), *pBitmap);
2265 pBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_DELETE_NORMAL);
2266 if (pBitmap != null)
2268 pButtonDelete->SetNormalBackgroundBitmap(*pBitmap);
2272 pBitmap = ResourceManager::GetBitmapN(IDB_BUTTON_DELETE_PRESSED);
2273 if (pBitmap != null)
2275 pButtonDelete->SetPressedBackgroundBitmap(*pBitmap);
2279 pButtonDelete->SetActionId(IDA_BUTTON_BIRTHDAY_DELETE);
2280 pButtonDelete->AddActionEventListener(*this);
2282 pBirthdayItem->AddControl(pButtonDelete);
2284 pBirthdayItem->SetIndividualSelectionEnabled(pBirthday, true);
2285 pBirthdayItem->SetIndividualSelectionEnabled(pClearButton, true);
2286 pBirthdayItem->SetIndividualSelectionEnabled(pButtonDelete, true);
2288 return pBirthdayItem;
2291 Tizen::Ui::Controls::TableViewItem*
2292 ContactEditorForm::GetNoteField(int itemWidth)
2294 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
2296 if (__pNoteFieldItem != null)
2298 return __pNoteFieldItem;
2301 __pNoteFieldItem = new (std::nothrow) TableViewItem();
2302 __pNoteFieldItem->Construct(Dimension(itemWidth, H_DOUBLE_LINE_ITEM + pContactsApp->GetListItemSingleLineHeight()), TABLE_VIEW_ANNEX_STYLE_NORMAL);
2303 __pNoteFieldItem->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
2304 __pNoteFieldItem->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
2307 Label* pNoteTitle = new (std::nothrow) Label();
2308 pNoteTitle->Construct(Rectangle(0, 0, itemWidth, H_LABEL), ResourceManager::GetString(L"IDS_PB_BODY_NOTE"));
2309 pNoteTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
2310 pNoteTitle->SetTextColor(COLOR_ITEM_TITLE);
2311 pNoteTitle->SetTextConfig(FONT_SIZE_TITLE_TEXT, LABEL_TEXT_STYLE_BOLD);
2312 __pNoteFieldItem->AddControl(pNoteTitle);
2314 ExpandableEditArea* pNoteEditArea = new (std::nothrow) ExpandableEditArea();
2315 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);
2316 pNoteEditArea->SetTitleText(ResourceManager::GetString(L"IDS_PB_BODY_NOTE"));
2317 pNoteEditArea->SetText(__pPresentationModel->GetValue(DETAIL_PROPERTY_NOTE));
2318 pNoteEditArea->AddExpandableEditAreaEventListener(*this);
2319 pNoteEditArea->AddKeypadEventListener(*this);
2320 pNoteEditArea->AddFocusEventListener(*this);
2321 pNoteEditArea->SetTextSize(pContactsApp->GetFontSize());
2322 pNoteEditArea->AddTextEventListener(*this);
2324 __pNoteFieldItem->AddControl(pNoteEditArea);
2325 __pNoteFieldItem->SetIndividualSelectionEnabled(pNoteEditArea, true);
2327 return __pNoteFieldItem;
2330 Tizen::Ui::Controls::TableViewItem*
2331 ContactEditorForm::GetRingtoneField(int itemWidth)
2333 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
2335 TableViewItem* pRingtoneItem = new (std::nothrow) TableViewItem();
2336 pRingtoneItem->Construct(Dimension(itemWidth, H_DOUBLE_LINE_ITEM + pContactsApp->GetFontHeightOffset()), TABLE_VIEW_ANNEX_STYLE_NORMAL);
2337 pRingtoneItem->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND);
2338 pRingtoneItem->AddKeyEventListener(*this);
2340 Panel* pGroupStyle = new (std::nothrow) Panel();
2341 pGroupStyle->Construct(Rectangle(0, 0, itemWidth , H_DOUBLE_LINE_ITEM + pContactsApp->GetFontHeightOffset()), GROUP_STYLE_NONE);
2342 pGroupStyle->SetName(GROUP_STYLE_PANEL);
2343 pGroupStyle->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND);
2344 pGroupStyle->AddTouchEventListener(*this);
2345 pRingtoneItem->AddControl(pGroupStyle);
2347 Label* pLabelTitle = new (std::nothrow) Label();
2348 pLabelTitle->Construct(Rectangle(0, H_GROUP_RINGTONE_TITLE_GAP, itemWidth, H_GROUP_RINGTONE_TITLE_LABEL), ResourceManager::GetString(L"IDS_PB_BODY_RINGTONE"));
2349 pLabelTitle->SetName(GROUP_LABEL_TITLE);
2350 pLabelTitle->AddTouchEventListener(*this);
2351 pLabelTitle->SetTextConfig(FONT_SIZE_TITLE_TEXT, LABEL_TEXT_STYLE_BOLD);
2352 pLabelTitle->SetTextColor(COLOR_ITEM_TITLE);
2353 pLabelTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
2355 pGroupStyle->AddControl(pLabelTitle);
2357 String ringtoneName = __pPresentationModel->GetValue(DETAIL_PROPERTY_RINGTONE);
2361 ringtoneName.LastIndexOf(L"/", ringtoneName.GetLength() - 1, index);
2365 ringtoneName.SubString(index + 1, trimmedPath);
2368 Label* pLabelRingToneName = new (std::nothrow) Label();
2369 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);
2370 pLabelRingToneName->SetName(GROUP_LABEL_VALUE);
2371 pLabelRingToneName->AddTouchEventListener(*this);
2372 pLabelRingToneName->SetTextConfig(pContactsApp->GetFontSize(), LABEL_TEXT_STYLE_NORMAL);
2373 pLabelRingToneName->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
2374 pGroupStyle->AddControl(pLabelRingToneName);
2376 Button* pClearButton = new (std::nothrow) Button();
2377 pClearButton->Construct(Rectangle(itemWidth - X_REFRESH_BUTTON_MARGIN, (pRingtoneItem->GetHeight() - H_ICON_BUTTON) / 2, H_ICON_BUTTON, H_ICON_BUTTON));
2378 pClearButton->SetActionId(IDA_BUTTON_RINGTONE_CLEAR);
2379 pClearButton->AddActionEventListener(*this);
2381 Bitmap* pReset = ResourceManager::GetBitmapN(IDB_DETAILS_RESET_NORMAL);
2384 pClearButton->SetNormalBitmap(Point(0, 0), *pReset);
2387 pReset = ResourceManager::GetBitmapN(IDB_DETAILS_RESET_PRESSED);
2390 pClearButton->SetPressedBitmap(Point(0, 0), *pReset);
2394 pGroupStyle->AddControl(pClearButton);
2395 pRingtoneItem->SetIndividualSelectionEnabled(pClearButton, true);
2397 return pRingtoneItem;
2400 Tizen::Ui::Controls::TableViewItem*
2401 ContactEditorForm::GetMoreInformationField(int itemWidth)
2403 TableViewItem* pMoreInformationItem = new (std::nothrow) TableViewItem();
2404 pMoreInformationItem->Construct(Dimension(itemWidth, H_DESCRIPTION_CONTAINER));
2405 pMoreInformationItem->SetBackgroundColor(Color(COLOR_TABLE_VIEW_BG), TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
2406 pMoreInformationItem->SetBackgroundColor(Color(COLOR_TABLE_VIEW_BG), TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
2408 Panel* pPanel = new (std::nothrow) Panel();
2409 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));
2410 pPanel->SetBackgroundColor(Color(COLOR_TABLE_VIEW_BG));
2412 pMoreInformationItem->AddControl(pPanel);
2414 Button* pButtonMoreInformation = new (std::nothrow) Button();
2415 pButtonMoreInformation->Construct(Rectangle(X_MORE_INFORMATION_BUTTON, Y_MORE_INFORMATION_BUTTON, itemWidth - (X_MORE_INFORMATION_BUTTON * 2), H_BUTTON));
2416 pButtonMoreInformation->SetText(ResourceManager::GetString(L"IDS_KA_BODY_MORE_INFORMATION"));
2417 pButtonMoreInformation->SetActionId(IDA_BUTTON_MORE_INFO);
2418 pButtonMoreInformation->AddActionEventListener(*this);
2420 pPanel->AddControl(pButtonMoreInformation);
2422 return pMoreInformationItem;
2425 Tizen::Ui::Controls::TableViewItem*
2426 ContactEditorForm::GetDefaultPhoneNumberItem(int itemWidth)
2428 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
2430 TableViewItem* pDefaultPhoneNumberItem = new (std::nothrow) TableViewItem();
2431 pDefaultPhoneNumberItem->Construct(Dimension(itemWidth, pContactsApp->GetListItemSingleLineHeight()));
2432 pDefaultPhoneNumberItem->SetBackgroundColor(Color(0), TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
2434 Button* pButtonDefaultNumber = new (std::nothrow) Button();
2435 pButtonDefaultNumber->Construct(Rectangle(X_MORE_INFORMATION_BUTTON, Y_DEFAULT_NUMBER_BUTTON, itemWidth - (X_MORE_INFORMATION_BUTTON * 2), H_BUTTON));
2436 pButtonDefaultNumber->SetText(ResourceManager::GetString(L"IDS_PB_BODY_MARK_AS_DEFAULT_NUMBER"));
2437 pButtonDefaultNumber->SetActionId(IDA_BUTTON_DEFAULT_PHONE_NUMBER);
2438 pButtonDefaultNumber->AddActionEventListener(*this);
2440 pDefaultPhoneNumberItem->AddControl(pButtonDefaultNumber);
2441 pDefaultPhoneNumberItem->SetIndividualSelectionEnabled(pButtonDefaultNumber, true);
2443 return pDefaultPhoneNumberItem;
2447 ContactEditorForm::DeleteInputField(int groupIndex, int itemIndex, int isUpdating)
2449 result r = E_SUCCESS;
2450 ArrayList* pFieldList = null;
2454 case TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX:
2456 pFieldList = __pPhoneNumberFieldItem;
2457 __pPresentationModel->SetPhoneNumber(DETAIL_PHONENUMBER_TYPE_NONE, L"", itemIndex); //phoneNumberType doesn't matter
2460 case TABLE_VIEW_EMAIL_FIELD_INDEX:
2462 pFieldList = __pEmailFieldItem;
2463 __pPresentationModel->SetEmail(DETAIL_EMAIL_TYPE_NONE, L"", itemIndex);
2466 case TABLE_VIEW_ADDRESS_FIELD_INDEX:
2468 pFieldList = __pAddressFieldItem;
2469 __pPresentationModel->SetAddress(DETAIL_ADDRESS_TYPE_NONE, L"", itemIndex);
2472 case TABLE_VIEW_IM_ADDRESS_FIELD_INDEX:
2474 pFieldList = __pImAddressFieldItem;
2475 __pPresentationModel->SetImAddress(DETAIL_IM_ADDRESS_TYPE_NONE, L"", itemIndex);
2478 case TABLE_VIEW_URL_FIELD_INDEX:
2480 pFieldList = __pUrlFieldItem;
2481 __pPresentationModel->SetUrl(DETAIL_URL_TYPE_NONE, L"", itemIndex);
2488 TryReturn(pFieldList != null, E_FAILURE, "[E_FAILURE] Unable to delete the item.")
2490 __pDeletedItemList->Add(pFieldList->GetAt(itemIndex));
2492 r = pFieldList->RemoveAt(itemIndex, false);
2494 if (__previousGroupIndex == groupIndex && __previousItemIndex == itemIndex)
2496 __previousGroupIndex = -1;
2497 __previousItemIndex = -1;
2499 if (isUpdating == false)
2501 __pTableView->RefreshItem(groupIndex, itemIndex, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
2504 Rectangle clientBounds = GetClientAreaBounds();
2505 __pTableView->SetSize(clientBounds.width, clientBounds.height);
2507 for (int i = itemIndex; i < pFieldList->GetCount(); i++)
2509 TableViewItem* pItem = static_cast<TableViewItem *>(pFieldList->GetAt(i));
2516 EditField* pInputField = static_cast<EditField*>(pItem->GetControl(0));
2517 if (pInputField == null)
2522 result r = Integer::Decode(pInputField->GetName(), parsedIndex);
2523 if (r == E_NUM_FORMAT)
2527 pInputField->SetName(Integer::ToString(parsedIndex - 1));
2529 Button* pTypeButton = static_cast<Button*>(pItem->GetControl(1));
2530 if (pTypeButton == null)
2535 r = Integer::Decode(pTypeButton->GetName(), parsedIndex);
2536 if (r == E_NUM_FORMAT)
2540 pTypeButton->SetName(Integer::ToString(parsedIndex - 1));
2542 Button* pDeleteButton = static_cast<Button *>(pItem->GetControl(2));
2543 if (pDeleteButton == null)
2547 pDeleteButton->SetActionId(pDeleteButton->GetActionId() - 1);
2550 SaveContactData(false);
2551 SetSaveButtonEnabled(IsSaveContactValid());
2553 if (groupIndex == TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX)
2555 if (itemIndex == __pPresentationModel->GetDefaultNumberIndex())
2557 SetAsDefaultPhoneNumber(0);
2559 else if (itemIndex < __pPresentationModel->GetDefaultNumberIndex())
2561 SetAsDefaultPhoneNumber(__pPresentationModel->GetDefaultNumberIndex() - 1);
2565 if (__isDefaultPhoneNumberButtonEnabled == true && __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER) < 2)
2567 if (isUpdating == false)
2569 __pTableView->RefreshItem(TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX, __pTableView->GetItemCountAt(TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX) - 1, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
2571 __isDefaultPhoneNumberButtonEnabled = false;
2578 ContactEditorForm::SetThumbnailControls(Tizen::Ui::Controls::TableViewItem& item, bool isUpdated)
2580 Label* pLabelThumbnail = null;
2581 Button* pButtonAdd = null;
2582 Button* pButtonDelete = null;
2584 if (isUpdated == false)
2586 int itemWidth = GetBounds().width;
2588 pLabelThumbnail = new (std::nothrow) Label();
2589 pLabelThumbnail->Construct(Rectangle((itemWidth - W_THUMBNAIL) / 2, H_THUMBNAIL_DELETE_BUTTON_GAP + Y_EDIT_FIELD_GAP, W_THUMBNAIL, W_THUMBNAIL), L"");
2591 item.AddControl(pLabelThumbnail);
2593 Bitmap* pBitmapItem = null;
2594 Bitmap* pBitmapItemPressed = null;
2596 pButtonAdd = new (std::nothrow) Button();
2597 pButtonAdd->Construct(Rectangle(pLabelThumbnail->GetX() + ((pLabelThumbnail->GetWidth() - H_BUTTON) / 2), pLabelThumbnail->GetY() + ((pLabelThumbnail->GetHeight() - H_BUTTON) / 2), H_BUTTON, H_BUTTON));
2598 pButtonAdd->SetActionId(IDA_BUTTON_THUMBNAIL_ADD);
2599 pButtonAdd->AddActionEventListener(*this);
2601 pBitmapItem = ResourceManager::GetBitmapN(IDB_BUTTON_ADD);
2602 pBitmapItemPressed = ResourceManager::GetBitmapN(IDB_BUTTON_ADD_PRESSED);
2604 if (pBitmapItem != null)
2606 pButtonAdd->SetNormalBackgroundBitmap(*pBitmapItem);
2609 if (pBitmapItemPressed != null)
2611 pButtonAdd->SetPressedBackgroundBitmap(*pBitmapItemPressed);
2612 delete pBitmapItemPressed;
2614 item.AddControl(pButtonAdd);
2615 item.SetIndividualSelectionEnabled(pButtonAdd, true);
2617 pButtonDelete = new (std::nothrow) Button();
2618 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));
2619 pButtonDelete->SetActionId(IDA_BUTTON_THUMBNAIL_DELETE);
2620 pButtonDelete->AddActionEventListener(*this);
2622 pBitmapItem = ResourceManager::GetBitmapN(IDB_BUTTON_MINUS);
2623 pBitmapItemPressed = ResourceManager::GetBitmapN(IDB_BUTTON_MINUS_PRESSED);
2625 if (pBitmapItem != null)
2627 pButtonDelete->SetNormalBitmap(Point(0, 0), *pBitmapItem);
2630 if (pBitmapItemPressed != null)
2632 pButtonDelete->SetPressedBitmap(Point(0, 0), *pBitmapItemPressed);
2633 delete pBitmapItemPressed;
2636 pBitmapItem = ResourceManager::GetBitmapN(IDB_BUTTON_DELETE_NORMAL);
2637 pBitmapItemPressed = ResourceManager::GetBitmapN(IDB_BUTTON_DELETE_PRESSED);
2639 if (pBitmapItem != null)
2641 pButtonDelete->SetNormalBackgroundBitmap(*pBitmapItem);
2644 if (pBitmapItemPressed != null)
2646 pButtonDelete->SetPressedBackgroundBitmap(*pBitmapItemPressed);
2647 delete pBitmapItemPressed;
2649 item.AddControl(pButtonDelete);
2650 item.SetIndividualSelectionEnabled(pButtonDelete, true);
2652 Button* pButtonCamera = new (std::nothrow) Button();
2653 pButtonCamera->Construct(Rectangle(pLabelThumbnail->GetX() + pLabelThumbnail->GetWidth(), pLabelThumbnail->GetY() + pLabelThumbnail->GetHeight() - H_BUTTON, H_BUTTON, H_BUTTON));
2654 pButtonCamera->SetActionId(IDA_BUTTON_CAMERA);
2655 pButtonCamera->AddActionEventListener(*this);
2657 pBitmapItem = ResourceManager::GetBitmapN(IDB_BUTTON_CAMERA);
2658 pBitmapItemPressed = ResourceManager::GetBitmapN(IDB_BUTTON_CAMERA_PRESSED);
2659 if (pBitmapItem != null)
2661 pButtonCamera->SetNormalBackgroundBitmap(*pBitmapItem);
2664 if (pBitmapItemPressed != null)
2666 pButtonCamera->SetPressedBackgroundBitmap(*pBitmapItemPressed);
2667 delete pBitmapItemPressed;
2670 item.AddControl(pButtonCamera);
2671 item.SetIndividualSelectionEnabled(pButtonCamera, true);
2675 pLabelThumbnail = static_cast<Label*>(item.GetControl(0));
2676 TryReturnVoid(pLabelThumbnail != null, "[E_FAILURE] Unable to get a thumbnail control.");
2678 pButtonAdd = static_cast<Button*>(item.GetControl(1));
2679 TryReturnVoid(pButtonAdd != null, "[E_FAILURE] Unable to get a button.");
2681 pButtonDelete = static_cast<Button*>(item.GetControl(2));
2682 TryReturnVoid(pButtonDelete != null, "[E_FAILURE] Unable to get a button.");
2685 Bitmap* pThumbnail = null;
2686 String thumbnailPath = __pPresentationModel->GetValue(DETAIL_PROPERTY_THUMBNAIL);
2688 if (thumbnailPath.IsEmpty() == false)
2690 ImageBuffer thumbnailImageBuffer;
2691 result r = thumbnailImageBuffer.Construct(thumbnailPath);
2694 pThumbnail = thumbnailImageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_ARGB8888, BUFFER_SCALING_NONE);
2696 if (pThumbnail != null)
2698 pThumbnail->SetScalingQuality(BITMAP_SCALING_QUALITY_HIGH);
2699 pThumbnail->Scale(Dimension(W_THUMBNAIL, W_THUMBNAIL));
2700 pLabelThumbnail->SetBackgroundBitmap(*pThumbnail);
2702 pButtonAdd->SetShowState(false);
2703 pButtonAdd->SetEnabled(false);
2704 pButtonDelete->SetShowState(true);
2708 pThumbnail = ResourceManager::GetBitmapN(IDB_THUMBNAIL_BACKGROUND);
2709 if (pThumbnail != null)
2711 pLabelThumbnail->SetBackgroundBitmap(*pThumbnail);
2712 pButtonAdd->SetShowState(true);
2713 pButtonAdd->SetEnabled(true);
2714 pButtonDelete->SetShowState(false);
2722 ContactEditorForm::AddHorizontalDivider(Tizen::Ui::Controls::TableViewItem* pItem, int positionY, int width)
2724 Label* pDivider = new (std::nothrow) Label();
2725 pDivider->Construct(Rectangle(0, positionY, width, H_DIVIDER), L"");
2726 pDivider->SetBackgroundColor(Color(COLOR_DIVIDER));
2727 pDivider->SetEnabled(false);
2729 pItem->AddControl(pDivider);
2733 ContactEditorForm::AddVerticalDivider(Tizen::Ui::Controls::TableViewItem* pItem, int positionX, int positionY)
2735 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
2737 Label* pDivider = new (std::nothrow) Label();
2738 pDivider->Construct(Rectangle(positionX, positionY, W_DIVIDER, pContactsApp->GetListItemSingleLineHeight()), L"");
2739 pDivider->SetBackgroundColor(Color(COLOR_DIVIDER));
2740 pDivider->SetEnabled(false);
2742 pItem->AddControl(pDivider);
2746 ContactEditorForm::SetAsDefaultPhoneNumber(int index, bool scrollToItem)
2748 result r = E_SUCCESS;
2749 TableViewItem* pItem = null;
2750 EditField* pEditField = null;
2752 pItem = static_cast<TableViewItem *>(__pPhoneNumberFieldItem->GetAt(index));
2759 pEditField = static_cast<EditField *>(pItem->GetControl(0));
2760 if (pEditField == null)
2766 __pPresentationModel->SetValue(DETAIL_PROPERTY_DEFAULT_PHONE_NUMBER, L"", index);
2768 if (pEditField->IsVisible() == false && scrollToItem == true)
2770 __pTableView->ScrollToItem(TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX, index);
2772 pEditField->Invalidate(true);
2779 ContactEditorForm::ChangeNameFieldStatus(void)
2781 result r = E_SUCCESS;
2783 r = SaveNameFields();
2785 __isExpandable = (__isExpandable == true) ? false : true;
2791 ContactEditorForm::SaveContactData(bool isSaved)
2793 result r = E_SUCCESS;
2795 if (isSaved == true)
2797 if (CommonUtil::isMemoryAvailable() == false)
2799 CommonUtil::showMemoryFullMessageBox();
2804 r = SaveNameFields();
2806 for (int i = 0; i < __pPhoneNumberFieldItem->GetCount(); i++)
2809 TableViewItem* pItem = static_cast<TableViewItem *>(__pPhoneNumberFieldItem->GetAt(i));
2816 EditField* pEditField = static_cast<EditField *>(pItem->GetControl(0));
2817 if (pEditField == null)
2823 String phoneNumberString(pEditField->GetText());
2824 String phoneNumberTypeString(pItem->GetName());
2825 int phoneNumberType;
2826 phoneNumberString.Trim();
2829 for (int i = 0; i < phoneNumberString.GetLength(); i++)
2831 phoneNumberString.GetCharAt(i, ch);
2833 if(ch == '+' && i == 0)
2837 if((ch == ',' || ch == ';' || ch == 'p') && i == 0)
2842 else if ((ch < '0' || ch > '9') && (ch != '*') && (ch != '#') && (ch != ',') && (ch != ';') && (ch != 'p'))
2853 if (isSaved == true && phoneNumberString.GetLength() > 0 && r != E_SUCCESS)
2856 MessageBox invalidNumberMessage;
2857 invalidNumberMessage.Construct(L"", ResourceManager::GetString(L"IDS_PB_BODY_INVALID_NUMBER"), MSGBOX_STYLE_OK, MESSAGE_BOX_TIMEOUT_MS);
2858 invalidNumberMessage.ShowAndWait(modalResult);
2863 Integer::Parse(phoneNumberTypeString, phoneNumberType);
2865 __pPresentationModel->SetPhoneNumber((DetailPhoneNumberType)phoneNumberType, phoneNumberString, i);
2868 for (int i = 0; i < __pEmailFieldItem->GetCount(); i++)
2870 TableViewItem* pItem = static_cast<TableViewItem *>(__pEmailFieldItem->GetAt(i));
2877 EditField* pEditField = static_cast<EditField *>(pItem->GetControl(0));
2878 if (pEditField == null)
2884 String emailString(pEditField->GetText());
2885 String remainingString;
2886 String emailTypeString(pItem->GetName());
2890 Integer::Parse(emailTypeString, emailType);
2892 r = __pPresentationModel->SetEmail((DetailEmailType)emailType, emailString, i);
2894 if (isSaved == true && r == E_SUCCESS)
2896 if(emailString.GetLength() > 0)
2898 bool isValidEmail = ValidateEmailAddress(emailString);
2899 if (isValidEmail != true)
2902 MessageBox invalidEmailMessage;
2903 invalidEmailMessage.Construct(L"", ResourceManager::GetString(L"IDS_PB_POP_INVALID_EMAIL_ADDRESS"), MSGBOX_STYLE_OK, MESSAGE_BOX_TIMEOUT_MS);
2904 invalidEmailMessage.ShowAndWait(modalResult);
2905 pEditField->ShowKeypad();
2913 for (int i = 0; i < __pAddressFieldItem->GetCount(); i++)
2915 TableViewItem* pItem = static_cast<TableViewItem *>(__pAddressFieldItem->GetAt(i));
2922 EditField* pEditField = static_cast<EditField *>(pItem->GetControl(0));
2923 if (pEditField == null)
2929 String addressString(pEditField->GetText());
2931 addressString.Trim();
2932 __pPresentationModel->SetValue(DETAIL_PROPERTY_ADDRESS_STREET, addressString, i);
2935 for (int i = 0; i < __pImAddressFieldItem->GetCount(); i++)
2937 TableViewItem* pItem = static_cast<TableViewItem *>(__pImAddressFieldItem->GetAt(i));
2944 EditField* pEditField = static_cast<EditField *>(pItem->GetControl(0));
2945 if (pEditField == null)
2951 String addressString(pEditField->GetText());
2952 String addressTypeString(pItem->GetName());
2955 addressString.Trim();
2956 Integer::Parse(addressTypeString, addressType);
2958 __pPresentationModel->SetImAddress((DetailImAddressType)addressType, addressString, i);
2961 for (int i = 0; i < __pUrlFieldItem->GetCount(); i++)
2963 TableViewItem* pItem = static_cast<TableViewItem *>(__pUrlFieldItem->GetAt(i));
2970 EditField* pEditField = static_cast<EditField *>(pItem->GetControl(0));
2971 if (pEditField == null)
2977 String urlString(pEditField->GetText());
2978 String urlTypeString(pItem->GetName());
2982 Integer::Parse(urlTypeString, urlType);
2984 __pPresentationModel->SetUrl((DetailUrlType)urlType, urlString, i);
2987 if (__pNoteFieldItem != null)
2990 ExpandableEditArea* pNoteEditArea = static_cast<ExpandableEditArea *>(__pNoteFieldItem->GetControl(1));
2991 if (pNoteEditArea != null)
2993 noteString.Append(pNoteEditArea->GetText());
2996 __pPresentationModel->SetValue(DETAIL_PROPERTY_NOTE, noteString);
2999 if (isSaved == true)
3001 r = __pPresentationModel->AddAddressBook();
3007 ContactEditorForm::SaveNameFields(void)
3009 result r = E_SUCCESS;
3011 if (__pNameFieldItem == null)
3016 if (__isExpandable == true)
3018 EditField* pFirstName = static_cast<EditField *>(__pNameFieldItem->GetControl(ResourceManager::GetString(L"IDS_PB_BODY_FIRST_NAME"), false));
3019 if (pFirstName == null)
3023 __pPresentationModel->SetValue(DETAIL_PROPERTY_FIRST_NAME, pFirstName->GetText());
3025 EditField* pLastName = static_cast<EditField *>(__pNameFieldItem->GetControl(ResourceManager::GetString(L"IDS_PB_BODY_LAST_NAME"), false));
3026 if (pLastName == null)
3031 __pPresentationModel->SetValue(DETAIL_PROPERTY_LAST_NAME, pLastName->GetText());
3033 EditField* pMiddleName = static_cast<EditField *>(__pNameFieldItem->GetControl(ResourceManager::GetString(L"IDS_PB_BODY_MIDDLE_NAME"), false));
3034 if (pMiddleName == null)
3038 __pPresentationModel->SetValue(DETAIL_PROPERTY_MIDDLE_NAME, pMiddleName->GetText());
3040 EditField* pSuffix = static_cast<EditField *>(__pNameFieldItem->GetControl(ResourceManager::GetString(L"IDS_PB_BODY_SUFFIX"), false));
3041 if (pSuffix == null)
3045 __pPresentationModel->SetValue(DETAIL_PROPERTY_NAME_SUFFIX, pSuffix->GetText());
3047 EditField* pNickName = static_cast<EditField *>(__pNameFieldItem->GetControl(ResourceManager::GetString(L"IDS_PB_BODY_NICKNAME"), false));
3048 if (pNickName == null)
3052 __pPresentationModel->SetValue(DETAIL_PROPERTY_NICK_NAME, pNickName->GetText());
3054 EditField* pCompanyName = static_cast<EditField *>(__pNameFieldItem->GetControl(ResourceManager::GetString(L"IDS_PB_BODY_COMPANY"), false));
3055 if (pCompanyName == null)
3059 __pPresentationModel->SetValue(DETAIL_PROPERTY_COMPANY, pCompanyName->GetText());
3061 if (__isJobTitleEnabled == true)
3063 EditField* pJobTitle = static_cast<EditField *>(__pNameFieldItem->GetControl(ResourceManager::GetString(L"IDS_PB_BODY_JOB_TITLE"), false));
3064 if (pJobTitle == null)
3068 __pPresentationModel->SetValue(DETAIL_PROPERTY_JOB_TITLE, pJobTitle->GetText());
3071 if (__isDepartmentEnabled == true)
3073 EditField* pDepartment = static_cast<EditField *>(__pNameFieldItem->GetControl(ResourceManager::GetString(L"IDS_PB_BODY_DEPARTMENT"), false));
3074 if (pDepartment == null)
3078 __pPresentationModel->SetValue(DETAIL_PROPERTY_DEPARTMENT, pDepartment->GetText());
3083 EditField* pName = static_cast<EditField *>(__pNameFieldItem->GetControl(Integer::ToString(IDA_INPUT_FIELD_DISPLAY_NAME), false));
3089 int delimeterIndex = -1;
3090 int delimcommaIndex = -1;
3092 String displayName(pName->GetText());
3093 if (displayName != __fullName)
3101 if (!displayName.IsEmpty())
3103 displayName.IndexOf(DELIMITER_COMMA, 0, delimcommaIndex);
3104 if (delimcommaIndex >= 0)
3106 displayName.SubString(delimcommaIndex + 1, displayName.GetLength() - (delimcommaIndex + 1), suffix);
3107 displayName.SetLength(delimcommaIndex);
3111 if (!displayName.IsEmpty())
3113 delimeterIndex = -1;
3114 displayName.IndexOf(CHARACTER_SPACE, 0, delimeterIndex);
3115 if (delimeterIndex < 0)
3117 firstName.Append(displayName);
3121 displayName.SubString(0, delimeterIndex++, firstName);
3122 displayName.SubString(delimeterIndex, displayName.GetLength() - delimeterIndex, displayName);
3124 delimeterIndex = -1;
3127 if (!displayName.IsEmpty())
3129 displayName.IndexOf(CHARACTER_SPACE, 0, delimeterIndex);
3130 if (delimeterIndex < 0)
3132 lastName.Append(displayName);
3136 displayName.SubString(0, delimeterIndex, middleName);
3137 displayName.SubString(delimeterIndex + 1, displayName.GetLength() - (delimeterIndex + 1), lastName);
3143 __pPresentationModel->SetValue(DETAIL_PROPERTY_FIRST_NAME, firstName);
3144 __pPresentationModel->SetValue(DETAIL_PROPERTY_MIDDLE_NAME, middleName);
3145 __pPresentationModel->SetValue(DETAIL_PROPERTY_LAST_NAME, lastName);
3146 __pPresentationModel->SetValue(DETAIL_PROPERTY_NAME_SUFFIX, suffix);
3154 ContactEditorForm::IsSaveContactValid(void)
3156 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_FIRST_NAME).IsEmpty() == false)
3161 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_LAST_NAME).IsEmpty() == false)
3166 for (int i = 0; i < __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER); i++)
3168 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_PHONE_NUMBER, i).IsEmpty() == false)
3174 for (int i = 0; i < __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_EMAIL); i++)
3176 if (__pPresentationModel->GetValue(DETAIL_PROPERTY_EMAIL, i).IsEmpty() == false)
3186 ContactEditorForm::SetSaveButtonEnabled(bool enable)
3188 Footer* pFooter = GetFooter();
3192 pFooter->SetItemEnabled(0, true);
3196 pFooter->SetItemEnabled(0, false);
3199 pFooter->Invalidate(true);
3203 ContactEditorForm::IsMoreInformationButtonVisible(void)
3205 if (__isJobTitleEnabled == false)
3210 if (__isDepartmentEnabled == false)
3215 if (__pImAddressFieldItem->GetCount() == 0)
3220 if (__pUrlFieldItem->GetCount() == 0)
3226 if (__pPresentationModel->GetBirthday(birthday) != E_SUCCESS)
3231 if (__pNoteFieldItem == null)
3240 ContactEditorForm::OnTextValueChanged(const Tizen::Ui::Control& source)
3242 TableViewItem* pTableViewItem = static_cast<TableViewItem *>(source.GetParent());
3244 __isContactModified = true;
3246 if (pTableViewItem == null)
3251 SaveContactData(false);
3252 SetSaveButtonEnabled(IsSaveContactValid());
3254 if (__pNameFieldItem == pTableViewItem)
3259 EditField* pEditField = const_cast<EditField *>(static_cast<const EditField *>(&source));
3260 if (pEditField == null)
3265 Control* pDeleteButton = pTableViewItem->GetControl(2);
3266 if (pDeleteButton == null)
3276 Integer::Decode(pEditField->GetName(), index);
3277 groupIndex = (index & TABLE_VIEW_GROUP_INDEX_MASK) >> TABLE_VIEW_GROUP_INDEX_SHIFT;
3278 inputFlag = (index & TABLE_VIEW_INPUT_FIELD_INDEX_MASK) >> TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
3279 int itemIndex = (index & TABLE_VIEW_ITEM_INDEX_MASK);
3280 itemCount = __pTableView->GetItemCountAt(groupIndex);
3282 String trimmedString = pEditField->GetText();
3283 trimmedString.Trim();
3285 if (trimmedString.IsEmpty())
3287 pDeleteButton->SetShowState(false);
3288 __previousItemIndex = itemIndex; //if the entered text is empty store the index of the field for deletion
3289 __previousGroupIndex = groupIndex;
3291 else if (pDeleteButton->GetShowState() == false)
3293 __previousItemIndex = -1;
3294 __previousGroupIndex = -1;
3295 pDeleteButton->SetShowState(true);
3298 index |= (1 << TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT);
3299 pEditField->SetName(Integer::ToString(index));
3301 if (groupIndex == TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX)
3303 if (__isDefaultPhoneNumberButtonEnabled == false && __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER) > 1)
3305 __isDefaultPhoneNumberButtonEnabled = true;
3306 __pTableView->RefreshItem(groupIndex, __pTableView->GetItemCountAt(groupIndex), TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
3308 else if (itemCount > 1)
3314 ArrayList* pFieldList = null;
3317 case TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX:
3319 pFieldList = __pPhoneNumberFieldItem;
3322 case TABLE_VIEW_EMAIL_FIELD_INDEX:
3324 pFieldList = __pEmailFieldItem;
3327 case TABLE_VIEW_ADDRESS_FIELD_INDEX:
3329 pFieldList = __pAddressFieldItem;
3332 case TABLE_VIEW_IM_ADDRESS_FIELD_INDEX:
3334 pFieldList = __pImAddressFieldItem;
3337 case TABLE_VIEW_URL_FIELD_INDEX:
3339 pFieldList = __pUrlFieldItem;
3346 if (pFieldList != null)
3348 TableViewItem* pItem = static_cast<TableViewItem*>(pFieldList->GetAt(pFieldList->GetCount() - 1));
3351 EditField* pInputField = static_cast<EditField*>(pItem->GetControl(0));
3353 if (pInputField != null && pInputField->GetTextLength() != 0)
3355 __pTableView->RefreshItem(groupIndex, itemCount, TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
3363 __previousItemIndex = -1;
3364 __previousGroupIndex = -1;
3366 if(__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER) <= 1 && __isDefaultPhoneNumberButtonEnabled == true)
3368 __isDefaultPhoneNumberButtonEnabled = false;
3369 __pTableView->RefreshItem(groupIndex, __pTableView->GetItemCountAt(groupIndex) - 1, TABLE_VIEW_REFRESH_TYPE_ITEM_REMOVE);
3371 else if(__pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER) > 1 && __isDefaultPhoneNumberButtonEnabled == false)
3373 __isDefaultPhoneNumberButtonEnabled = true;
3374 __pTableView->RefreshItem(groupIndex, __pTableView->GetItemCountAt(groupIndex), TABLE_VIEW_REFRESH_TYPE_ITEM_ADD);
3379 ContactEditorForm::OnTextValueChangeCanceled(const Tizen::Ui::Control& source)
3384 ContactEditorForm::ParseAppControlArgument(const Tizen::Base::String& argument, Tizen::Base::String& type, Tizen::Base::String& content)
3386 result r = E_SUCCESS;
3388 if (argument.IsEmpty() || argument.Contains(DELIMITER) == false)
3395 argument.IndexOf(DELIMITER, 0, delimiterIndex);
3396 argument.SubString(0, delimiterIndex++, type);
3397 TryReturn(r == E_SUCCESS, r, "[%s] Unable to get type", GetErrorMessage(r));
3398 argument.SubString(delimiterIndex, argument.GetLength() - delimiterIndex, content);
3399 TryReturn(r == E_SUCCESS, r, "[%s] Unable to get type", GetErrorMessage(r));
3405 ContactEditorForm::OnFocusGained(const Tizen::Ui::Control& source)
3407 __pCurrentFocusedItem = source.GetParent();
3409 if (__previousItemIndex != -1 && __previousGroupIndex != -1)
3411 const EditField* pEditField = static_cast<const EditField*>(&source);
3412 if (pEditField == null)
3421 Integer::Decode(pEditField->GetName(), index);
3422 groupIndex = (index & TABLE_VIEW_GROUP_INDEX_MASK) >> TABLE_VIEW_GROUP_INDEX_SHIFT;
3423 itemIndex = (index & TABLE_VIEW_ITEM_INDEX_MASK);
3425 if (groupIndex == __previousGroupIndex && itemIndex == __previousItemIndex)
3427 //Same item is focused. Hence not deleting it
3431 DeleteInputField(__previousGroupIndex, __previousItemIndex);
3437 ContactEditorForm::OnFocusLost(const Tizen::Ui::Control& source)
3439 if (__pCurrentFocusedItem == __pNameFieldItem)
3444 __pCurrentFocusedItem = null;
3448 ContactEditorForm::ShowDefaultPhoneNumberContextMenu(const Tizen::Graphics::Point& position)
3450 if (__pDefaultPhoneNumberContextMenu != null)
3452 delete __pDefaultPhoneNumberContextMenu;
3453 __pDefaultPhoneNumberContextMenu = null;
3456 __pDefaultPhoneNumberContextMenu = new (std::nothrow) ContextMenu();
3457 __pDefaultPhoneNumberContextMenu->Construct(position, CONTEXT_MENU_STYLE_LIST);
3458 __pDefaultPhoneNumberContextMenu->AddActionEventListener(*this);
3459 __pDefaultPhoneNumberContextMenu->SetFocusable(true);
3461 int count = __pPresentationModel->GetMultiValuesCount(DETAIL_PROPERTY_PHONE_NUMBER);
3462 int defaultPhoneNumberIndex = __pPresentationModel->GetDefaultNumberIndex();
3464 for (int i = 0; i < count; i++)
3466 String phoneNumber(__pPresentationModel->GetValue(DETAIL_PROPERTY_PHONE_NUMBER, i));
3468 if (i != defaultPhoneNumberIndex)
3470 phoneNumber.Insert(__pPresentationModel->GetType(DETAIL_PROPERTY_PHONE_NUMBER, i) + CHARACTER_SPACE, 0);
3471 __pDefaultPhoneNumberContextMenu->AddItem(phoneNumber, i);
3475 if (__pDefaultPhoneNumberContextMenu->GetItemCount() > 0)
3477 __pDefaultPhoneNumberContextMenu->Show();
3482 ContactEditorForm::ShowMoreInformationContextMenu(const Tizen::Graphics::Point& position)
3484 if (__pMoreInformationContextMenu != null)
3486 delete __pMoreInformationContextMenu;
3487 __pMoreInformationContextMenu = null;
3490 __pMoreInformationContextMenu = new (std::nothrow) ContextMenu();
3491 __pMoreInformationContextMenu->Construct(position, CONTEXT_MENU_STYLE_LIST);
3493 __pMoreInformationContextMenu->SetMaxVisibleItemsCount(6);
3494 __pMoreInformationContextMenu->AddActionEventListener(*this);
3495 __pMoreInformationContextMenu->SetFocusable(true);
3497 if (__isJobTitleEnabled == false)
3499 __pMoreInformationContextMenu->AddItem(ResourceManager::GetString(L"IDS_PB_BODY_JOB_TITLE"), IDA_CONTEXT_MENU_ITEM_JOB_TITLE);
3502 if (__isDepartmentEnabled == false)
3504 __pMoreInformationContextMenu->AddItem(ResourceManager::GetString(L"IDS_PB_BODY_DEPARTMENT"), IDA_CONTEXT_MENU_ITEM_DEPARTMENT);
3507 if (__pImAddressFieldItem->GetCount() == 0)
3509 __pMoreInformationContextMenu->AddItem(ResourceManager::GetString(L"IDS_PB_HEADER_INSTANT_MESSENGER_ABB"), IDA_CONTEXT_MENU_ITEM_INSTANT_MESSENGER);
3512 if (__pUrlFieldItem->GetCount() == 0)
3514 __pMoreInformationContextMenu->AddItem(ResourceManager::GetString(L"IDS_PB_BODY_URL"), IDA_CONTEXT_MENU_ITEM_URL);
3518 if (__pPresentationModel->GetBirthday(birthday) != E_SUCCESS)
3520 __pMoreInformationContextMenu->AddItem(ResourceManager::GetString(L"IDS_PB_BODY_BIRTHDAY"), IDA_CONTEXT_MENU_ITEM_BIRTHDAY);
3523 if (__pNoteFieldItem == null)
3525 __pMoreInformationContextMenu->AddItem(ResourceManager::GetString(L"IDS_PB_BODY_NOTE"), IDA_CONTEXT_MENU_ITEM_NOTE);
3528 if (__isMoreInformationContextMenuShowing == false)
3530 __pMoreInformationContextMenu->Show();
3535 ContactEditorForm::ShowTypeContextMenu(int currentType, const Tizen::Graphics::Point& position, int itemTag)
3537 int groupIndex = (itemTag & TABLE_VIEW_GROUP_INDEX_MASK) >> TABLE_VIEW_GROUP_INDEX_SHIFT;
3539 __groupIndex = groupIndex;
3540 __itemIndex = itemTag;
3542 if (__isKeypadOpened)
3544 __isTypeContextMenuShowing = true;
3547 if (__pTypeContextMenu != null)
3549 delete __pTypeContextMenu;
3550 __pTypeContextMenu = null;
3553 __pTypeContextMenu = new (std::nothrow) ContextMenu();
3554 __pTypeContextMenu->Construct(position, CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_LEFTWARD);
3555 __pTypeContextMenu->AddActionEventListener(*this);
3556 __pTypeContextMenu->SetFocusable(true);
3560 case TABLE_VIEW_PHONE_NUMBER_FIELD_INDEX:
3562 __pTypeContextMenu->SetMaxVisibleItemsCount(DETAIL_PHONENUMBER_TYPE_OTHER + 1);
3563 for (int i = 0; i <= DETAIL_PHONENUMBER_TYPE_OTHER; i++)
3565 int index = i << TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
3566 __pTypeContextMenu->AddItem(__pPresentationModel->GetPhoneNumberTypeString((DetailPhoneNumberType)i), itemTag | index);
3570 case TABLE_VIEW_EMAIL_FIELD_INDEX:
3572 __pTypeContextMenu->SetMaxVisibleItemsCount(DETAIL_EMAIL_TYPE_OTHER + 1);
3573 for (int i = 0; i <= DETAIL_EMAIL_TYPE_OTHER; i++)
3575 int index = i << TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
3576 __pTypeContextMenu->AddItem(__pPresentationModel->GetAddressTypeString((DetailAddressType)i), itemTag | index);
3580 case TABLE_VIEW_ADDRESS_FIELD_INDEX:
3582 __pTypeContextMenu->SetMaxVisibleItemsCount(DETAIL_ADDRESS_TYPE_OTHER + 1);
3583 for (int i = 0; i <= DETAIL_ADDRESS_TYPE_OTHER; i++)
3585 int index = i << TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
3586 __pTypeContextMenu->AddItem(__pPresentationModel->GetAddressTypeString((DetailAddressType)i), itemTag | index);
3590 case TABLE_VIEW_IM_ADDRESS_FIELD_INDEX:
3592 __pTypeContextMenu->SetMaxVisibleItemsCount(7); // Temporary the code due to limit max count(8) by UI framework.
3593 for (int i = 0; i <= DETAIL_IM_ADDRESS_TYPE_OTHER; i++)
3595 int index = i << TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
3596 __pTypeContextMenu->AddItem(__pPresentationModel->GetImAddressTypeString((DetailImAddressType)i), itemTag | index);
3600 case TABLE_VIEW_URL_FIELD_INDEX:
3602 __pTypeContextMenu->SetMaxVisibleItemsCount(DETAIL_URL_TYPE_OTHER + 1);
3603 for (int i = 0; i <= DETAIL_URL_TYPE_OTHER; i++)
3605 int index = i << TABLE_VIEW_INPUT_FIELD_INDEX_SHIFT;
3606 __pTypeContextMenu->AddItem(__pPresentationModel->GetUrlTypeString((DetailUrlType)i), itemTag | index);
3612 __isTypeContextMenuShowing = false;
3615 delete __pTypeContextMenu;
3616 __pTypeContextMenu = null;
3621 if (__pTypeContextMenu != null)
3623 __pTypeContextMenu->RemoveItemAt(currentType);
3624 __pTypeContextMenu->Show();
3629 ContactEditorForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
3631 __isScrollOccurred = false;
3633 Panel* pPanel = null;
3635 if (source.GetName().Equals(GROUP_STYLE_PANEL, true))
3637 pPanel = static_cast<Panel*>(&(const_cast<Control&>(source)));
3639 else if (source.GetName().Equals(GROUP_LABEL_TITLE, true) || source.GetName().Equals(GROUP_LABEL_VALUE, true))
3641 pPanel = static_cast<Panel*>(source.GetParent());
3646 pPanel->SetBackgroundColor(COLOR_PRESSED);
3648 Label* pLabelValue = static_cast<Label*>(pPanel->GetControl(GROUP_LABEL_VALUE, true));
3649 pLabelValue->SetTextColor(Color(COLOR_ITEM_PRESSED));
3651 Label* pLabelTitle = static_cast<Label*>(pPanel->GetControl(GROUP_LABEL_TITLE, true));
3652 pLabelTitle->SetTextColor(COLOR_ITEM_PRESSED);
3654 pPanel->Invalidate(true);
3659 ContactEditorForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
3661 Panel* pPanel = null;
3663 if (source.GetName().Equals(GROUP_STYLE_PANEL, true))
3665 pPanel = static_cast<Panel*>(&(const_cast<Control&>(source)));
3667 else if (source.GetName().Equals(GROUP_LABEL_TITLE, true) || source.GetName().Equals(GROUP_LABEL_VALUE, true))
3669 pPanel = static_cast<Panel*>(source.GetParent());
3674 pPanel->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND);
3676 Label* pLabelValue = static_cast<Label*>(pPanel->GetControl(GROUP_LABEL_VALUE, true));
3677 pLabelValue->SetTextColor(Color(COLOR_ITEM_VALUE));
3679 Label* pLabelTitle = static_cast<Label*>(pPanel->GetControl(GROUP_LABEL_TITLE, true));
3680 pLabelTitle->SetTextColor(COLOR_ITEM_TITLE);
3682 pPanel->Invalidate(true);
3685 if (__isScrollOccurred || source.Contains(currentPosition) == false)
3692 ContactEditorForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
3694 Panel* pPanel = null;
3696 if (source.GetName().Equals(GROUP_STYLE_PANEL, true))
3698 pPanel = static_cast<Panel*>(&(const_cast<Control&>(source)));
3700 else if (source.GetName().Equals(GROUP_LABEL_TITLE, true) || source.GetName().Equals(GROUP_LABEL_VALUE, true))
3702 pPanel = static_cast<Panel*>(source.GetParent());
3707 pPanel->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND);
3709 Label* pLabelValue = static_cast<Label*>(pPanel->GetControl(GROUP_LABEL_VALUE, true));
3710 pLabelValue->SetTextColor(Color(COLOR_ITEM_VALUE));
3712 Label* pLabelTitle = static_cast<Label*>(pPanel->GetControl(GROUP_LABEL_TITLE, true));
3713 pLabelTitle->SetTextColor(COLOR_ITEM_TITLE);
3715 pPanel->Invalidate(true);
3720 ContactEditorForm::OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
3722 if (keyCode == KEY_ENTER )
3724 TableViewItem* pItem = static_cast<TableViewItem*>(&(const_cast<Control&>(source)));
3726 Panel* pPanel = static_cast<Panel*>(pItem->GetControl(0));
3733 Label* pLabelValue = static_cast<Label*>(pPanel->GetControl(1));
3735 if (pLabelValue == null)
3740 Label* pLabelTitle = static_cast<Label*>(pPanel->GetControl(0));
3742 if (pLabelTitle == null)
3747 pPanel->SetBackgroundColor(COLOR_PRESSED);
3748 pLabelValue->SetTextColor(Color(COLOR_ITEM_PRESSED));
3749 pLabelTitle->SetTextColor(COLOR_ITEM_PRESSED);
3750 pPanel->Invalidate(true);
3755 ContactEditorForm::OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
3757 if (keyCode == KEY_ENTER )
3760 TableViewItem* pItem = static_cast<TableViewItem*>(&(const_cast<Control&>(source)));
3762 Panel* pPanel = static_cast<Panel*>(pItem->GetControl(0));
3769 Label* pLabelValue = static_cast<Label*>(pPanel->GetControl(1));
3771 if (pLabelValue == null)
3776 Label* pLabelTitle = static_cast<Label*>(pPanel->GetControl(0));
3778 if (pLabelTitle == null)
3783 pPanel->SetBackgroundColor(COLOR_THUMBNAIL_BACKGROUND);
3784 pLabelValue->SetTextColor(Color(COLOR_ITEM_VALUE));
3785 pLabelTitle->SetTextColor(COLOR_ITEM_TITLE);
3786 pPanel->Invalidate(true);
3791 ContactEditorForm::OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
3797 ContactEditorForm::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
3802 ContactEditorForm::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
3807 ContactEditorForm::OnTouchCanceled(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
3812 ContactEditorForm::OnScrollEndReached (Tizen::Ui::Control &source, Tizen::Ui::Controls::ScrollEndEvent type)
3817 ContactEditorForm::OnScrollPositionChanged (Tizen::Ui::Control &source, int scrollPos)
3819 int scrollDif = scrollPos - __scrolledDistance;
3820 if (__isTypeContextMenuShowing)
3822 Point anchorPosition = __pTypeContextMenu->GetAnchorPosition();
3824 anchorPosition.y -= scrollDif;
3825 __pTypeContextMenu->SetAnchorPosition(anchorPosition);
3826 __pTypeContextMenu->Show();
3828 __isTypeContextMenuShowing = false;
3832 if (__pDefaultPhoneNumberContextMenu != null)
3834 Point anchorPosition = __pDefaultPhoneNumberContextMenu->GetAnchorPosition();
3836 anchorPosition.y -= scrollDif;
3837 __pDefaultPhoneNumberContextMenu->SetAnchorPosition(anchorPosition);
3838 __pDefaultPhoneNumberContextMenu->Show();
3841 __scrolledDistance = scrollPos;
3842 __origScrolledDistance = scrollPos;
3844 if (__isScrollOccurred == false)
3846 __isScrollOccurred = true;
3851 ContactEditorForm::OnScrollStopped (Tizen::Ui::Control &source)
3856 ContactEditorForm::OnExpandableEditAreaLineAdded (Tizen::Ui::Controls::ExpandableEditArea &source, int newLineCount)
3858 __pTableView->RefreshItem(TABLE_VIEW_NOTE_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
3862 ContactEditorForm::OnExpandableEditAreaLineRemoved (Tizen::Ui::Controls::ExpandableEditArea &source, int newLineCount)
3864 __pTableView->RefreshItem(TABLE_VIEW_NOTE_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
3868 ContactEditorForm::OnDateChanged(const Tizen::Ui::Control& source, int year, int month, int day)
3870 DateTime changedDate;
3872 changedDate.SetValue(year, month, day);
3873 __pPresentationModel->SetBirthday(changedDate);
3874 __isContactModified = true;
3878 ContactEditorForm::OnDateChangeCanceled(const Tizen::Ui::Control& source)
3883 ContactEditorForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData)
3885 AppLogDebug("ENTER");
3887 if (__pAppControl != null)
3889 delete __pAppControl;
3890 __pAppControl = null;
3893 TryReturnVoid(appControlResult == APP_CTRL_RESULT_SUCCEEDED, "[E_FAILURE] The result of an appcontrol is not succeeded.");
3894 TryReturnVoid(pExtraData != null, "[E_FAILURE] The extra data is null.");
3896 const String *pResultString = null;
3897 const ArrayList* pResultList = dynamic_cast<const ArrayList*>(pExtraData->GetValue(String(OUTPUT_KEY_SELECTED)));
3898 if (pResultList != null)
3900 pResultString = static_cast<const String*>(pResultList->GetAt(0));
3904 pResultString = static_cast<const String*>(pExtraData->GetValue(String(OUTPUT_KEY_SELECTED)));
3906 TryReturnVoid(pResultString != null, "[E_FAILURE] Unable to get file path.");
3908 if (appId.Equals(String(PROVIDER_ID_CAMERA)) && operationId.Equals(String(OPERATION_ID_CREATE_CONTENT)))
3910 __pPresentationModel->SetThumbnail(*pResultString);
3911 __pTableView->RefreshItem(TABLE_VIEW_THUMBNAIL_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
3913 if (__pFileEventManager == null)
3915 __pFileEventManager = new (std::nothrow) FileEventManager();
3916 __pFileEventManager->Construct(*this);
3918 __pFileEventManager->AddPath(*pResultString, FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_DELETE_SELF | FILE_EVENT_TYPE_MODIFY | FILE_EVENT_TYPE_MOVE_SELF);
3919 __isContactModified = true;
3921 else if (appId.Equals(String(PROVIDER_ID_GALLERY)) && operationId.Equals(String(OPERATION_ID_PICK)))
3925 ImageFormat imageFormat;
3926 result r = ImageBuffer::GetImageInfo(*pResultString, imageFormat, width, height);
3928 if (appControlResult == APP_CTRL_RESULT_FAILED || r != E_SUCCESS)
3930 int modalResult = 0;
3931 MessageBox unsupportedMessageBox;
3932 unsupportedMessageBox.Construct(L"", ResourceManager::GetString(L"IDS_MP_POP_INVALID_FILE"), MSGBOX_STYLE_NONE, 3000);
3933 unsupportedMessageBox.ShowAndWait(modalResult);
3938 r = LaunchImageViewerAppControl(*pResultString);
3940 else if (appId.Equals(String(PROVIDER_ID_FILEMANAGER)) && operationId.Equals(String(OPERATION_ID_PICK)))
3942 __pPresentationModel->SetValue(DETAIL_PROPERTY_RINGTONE, *pResultString);
3943 __pTableView->RefreshItem(TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX, 2, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
3945 if (__pFileEventManager == null)
3947 __pFileEventManager = new (std::nothrow) FileEventManager();
3948 __pFileEventManager->Construct(*this);
3950 __pFileEventManager->AddPath(*pResultString, FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_DELETE_SELF | FILE_EVENT_TYPE_MODIFY | FILE_EVENT_TYPE_MOVE_SELF);
3952 __isContactModified = true;
3954 else if(appId.Equals(String(PROVIDER_ID_IMAGEVIEWER)) && operationId.Equals(String(OPERATION_ID_CROP)))
3958 ImageFormat imageFormat;
3959 result r = ImageBuffer::GetImageInfo(*pResultString, imageFormat, width, height);
3961 if (appControlResult == APP_CTRL_RESULT_FAILED || r != E_SUCCESS)
3963 int modalResult = 0;
3964 MessageBox unsupportedMessageBox;
3965 unsupportedMessageBox.Construct(L"", ResourceManager::GetString(L"IDS_MP_POP_INVALID_FILE"), MSGBOX_STYLE_NONE, 3000);
3966 unsupportedMessageBox.ShowAndWait(modalResult);
3971 __pPresentationModel->SetThumbnail(*pResultString);
3972 AppLogDebug("pResultString is %ls", pResultString->GetPointer());
3973 __isContactModified = true;
3974 __pTableView->RefreshItem(TABLE_VIEW_THUMBNAIL_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
3976 if (__pFileEventManager == null)
3978 __pFileEventManager = new (std::nothrow) FileEventManager();
3979 __pFileEventManager->Construct(*this);
3981 __pFileEventManager->AddPath(*pResultString, FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_DELETE_SELF | FILE_EVENT_TYPE_MODIFY | FILE_EVENT_TYPE_MOVE_SELF);
3984 AppLogDebug("EXIT");
3988 ContactEditorForm::LaunchAppControl(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId)
3990 result r = E_SUCCESS;
3995 extraData.Construct();
3997 if (appId.Equals(String(PROVIDER_ID_CAMERA)) && operationId.Equals(String(OPERATION_ID_CREATE_CONTENT)))
3999 mimeType.Append(INPUT_MIME_TYPE_CAMERA);
4000 extraData.Add(new (std::nothrow) String(INPUT_KEY_ALLOW_SWITCH), new (std::nothrow) String(INPUT_VALUE_FALSE));
4002 else if (appId.Equals(String(PROVIDER_ID_GALLERY)) && operationId.Equals(String(OPERATION_ID_PICK)))
4004 mimeType.Append(INPUT_MIME_TYPE_GALLERY);
4005 extraData.Add(new (std::nothrow) String(INPUT_KEY_SELECTION_MODE), new (std::nothrow) String(INPUT_DATA_SELECTION_MODE_SINGLE));
4007 else if (appId.Equals(String(PROVIDER_ID_FILEMANAGER)) && operationId.Equals(String(OPERATION_ID_PICK)))
4009 mimeType.Append(INPUT_MIME_TYPE_AUDIO);
4010 extraData.Add(new (std::nothrow) String(INPUT_KEY_SELECTION_MODE), new (std::nothrow) String(INPUT_DATA_SELECTION_MODE_SINGLE));
4013 __pAppControl = AppManager::FindAppControlN(appId, operationId);
4015 if (__pAppControl != null)
4017 r = __pAppControl->Start(&uri, &mimeType, &extraData, this);
4018 TryCatch(r == E_SUCCESS, , "[%s] Unable to launch app control.", GetErrorMessage(r));
4023 extraData.RemoveAll(true);
4028 extraData.RemoveAll(true);
4029 delete __pAppControl;
4030 __pAppControl = null;
4036 ContactEditorForm::LaunchImageViewerAppControl(const Tizen::Base::String& filePath)
4038 result r = E_SUCCESS;
4041 extraData.Construct();
4042 extraData.Add(new (std::nothrow) String(INPUT_KEY_IMAGEVIEWER_MODE), new (std::nothrow) String(INPUT_VALUE_IMAGEVIEWER_TYPE));
4044 __pAppControl = AppManager::FindAppControlN(PROVIDER_ID_IMAGEVIEWER, OPERATION_ID_CROP);
4048 r = __pAppControl->Start(&filePath, null, &extraData, this);
4049 TryCatch(r == E_SUCCESS, , "[%s] Unable to launch app control.", GetErrorMessage(r));
4054 extraData.RemoveAll(true);
4059 extraData.RemoveAll(true);
4060 delete __pAppControl;
4061 __pAppControl = null;
4067 ContactEditorForm::OnContactsChanged(void)
4069 SceneManager* pSceneManager = SceneManager::GetInstance();
4070 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
4072 if (__isSaved == false)
4074 if (__pPresentationModel->IsContactRemoved())
4076 if (pContactsApp->GetOperationId() == OPERATION_ID_VIEW)
4078 __pPresentationModel->RemoveContactChangeListener(*this);
4082 if (__pAppControl != null)
4084 __pAppControl->Stop();
4086 pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
4097 AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance();
4098 HashMap* pReturnValue = new (std::nothrow) HashMap();
4099 pReturnValue->Construct();
4101 pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_ITEM_ID), new (std::nothrow) String(Integer::ToString(__pPresentationModel->GetContactId())));
4103 result r = pAppManager->SendAppControlResult(pContactsApp->GetRequestId(), APP_CTRL_RESULT_SUCCEEDED, pReturnValue);
4104 AppLogDebug("[%s] The return result from SendAppControlResult().", GetErrorMessage(r));
4106 UiApp::GetInstance()->Terminate();
4110 ArrayList* pArg = null;
4112 if (__pPresentationModel->GetVcfPath().IsEmpty() == false)
4114 pArg = new (std::nothrow) ArrayList();
4117 String* pViewType = new (std::nothrow) String();
4118 String* pValueType = new (std::nothrow) String();
4120 pViewType->Append(VIEW_TYPE);
4121 pViewType->Append(DELIMITER);
4122 pViewType->Append(VIEW_TYPE_VALUE_CONTACT);
4124 pValueType->Append(VIEW_TYPE_CONTACT_ID);
4125 pValueType->Append(DELIMITER);
4126 pValueType->Append(Integer::ToString(__pPresentationModel->GetContactId()));
4128 pArg->Add(pViewType);
4129 pArg->Add(pValueType);
4131 pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), pArg);
4138 ContactEditorForm::OnCategoriesChanged(void)
4143 ContactEditorForm::OnForeground(void)
4148 ContactEditorForm::OnBackground(void)
4150 if (__previousItemIndex != -1 && __previousGroupIndex != -1)
4152 DeleteInputField(__previousGroupIndex, __previousItemIndex);
4154 if (IsEnabled() == false)
4162 ContactEditorForm::OnFileEventOccured(const unsigned long events, const Tizen::Base::String &path, const unsigned int eventId)
4164 String thumbnailPath = __pPresentationModel->GetValue(DETAIL_PROPERTY_THUMBNAIL);
4165 if (thumbnailPath.Equals(path, false) == true)
4167 __pPresentationModel->SetThumbnail(L"");
4168 __pTableView->RefreshItem(TABLE_VIEW_THUMBNAIL_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
4172 String ringtonePath = __pPresentationModel->GetValue(DETAIL_PROPERTY_RINGTONE);
4173 if (ringtonePath.Equals(ResourceManager::GetString(L"IDS_PB_BODY_DEFAULT"), false) == true )
4175 __pTableView->RefreshItem(TABLE_VIEW_GROUP_RINGTONE_FIELD_INDEX, 2, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
4181 ContactEditorForm::OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String &state)
4183 if (deviceType != DEVICE_TYPE_STORAGE_CARD || __pPresentationModel->GetValue(DETAIL_PROPERTY_THUMBNAIL).IsEmpty())
4188 if (state.Equals(SD_CARD_UNMOUNTED, false) && File::IsFileExist(__pPresentationModel->GetValue(DETAIL_PROPERTY_THUMBNAIL)) == false)
4190 __pPresentationModel->SetThumbnail(L"");
4191 __pTableView->RefreshItem(TABLE_VIEW_THUMBNAIL_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
4195 bool ContactEditorForm::ValidateEmailAddress(const Tizen::Base::String& emailAddress)
4199 const wchar_t* tmpChar;
4200 const wchar_t* tmpDomain;
4201 String splChars = L"([<@,;\\:\">])";
4203 for (tmpChar = emailAddress.GetPointer(), index=0; index < emailAddress.GetLength(); tmpChar++, index++)
4205 if (*tmpChar == '\"' && (tmpChar == emailAddress.GetPointer() || *(tmpChar-1) == '.' || *(tmpChar-1) == '\"'))
4209 if (*tmpChar == '\"')
4213 if (*tmpChar == '\\' && (*++tmpChar == ' '))
4217 if (*tmpChar <= ' ' || *tmpChar >= 127)
4226 if (*tmpChar == '@')
4230 if (*tmpChar != '.')
4236 if (*tmpChar == '@')
4240 if (*tmpChar <= ' ' || *tmpChar >= 127)
4244 if (splChars.IndexOf(*tmpChar, 0, index) != E_OBJ_NOT_FOUND)
4249 if (tmpChar == emailAddress.GetPointer() || *(tmpChar-1) == '.')
4254 if (!*(tmpDomain = ++tmpChar))
4260 if (*tmpChar == '.')
4262 if (tmpChar == tmpDomain || *(tmpChar-1) == '.')
4268 if (*tmpChar <= ' ' || *tmpChar >= 127)
4272 if (splChars.IndexOf(*tmpChar, 0, index) != E_OBJ_NOT_FOUND)
4276 } while (*++tmpChar);
4278 if (*(tmpChar-1) == '.')
4292 ContactEditorForm::OnSettingChanged(Tizen::Base::String &key)
4294 if(key == L"http://tizen.org/setting/locale.date_time")
4297 __pPresentationModel->GetBirthday(bday);
4299 DateTime currentDate;
4300 Tizen::System::SystemTime::GetCurrentTime(currentDate);
4302 if(bday > currentDate)
4304 __pPresentationModel->SetBirthday(currentDate);
4305 __pTableView->RefreshItem(TABLE_VIEW_BIRTHDAY_FIELD_INDEX, 0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
4311 ContactEditorForm::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
4317 ContactEditorForm::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
4319 if (keyEventInfo.GetKeyCode() == KEY_BACK || keyEventInfo.GetKeyCode() == KEY_ESC)
4321 if (__pDiscardChangesPopup && __pDiscardChangesPopup->GetShowState() == true)
4323 HideDiscardChangesPopup();
4331 ContactEditorForm::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
4337 ContactEditorForm::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
4343 ContactEditorForm::ShowDiscardChangesPopup(void)
4345 if (__pDiscardChangesPopup == null)
4347 __pDiscardChangesPopup = new (std::nothrow) Popup();
4348 __pDiscardChangesPopup->Construct(false, Dimension(W_SAVE_POPUP, H_SAVE_POPUP));
4349 __pDiscardChangesPopup->SetPropagatedKeyEventListener(this);
4351 Rectangle popupClientBounds = __pDiscardChangesPopup->GetClientAreaBounds();
4353 Label* pLabel = new (std::nothrow) Label();
4354 pLabel->Construct(Rectangle(X_SAVE_LABEL, Y_SAVE_LABEL, W_SAVE_LABEL, H_SAVE_LABEL), ResourceManager::GetString(L"IDS_PB_POP_DISCARD_CHANGES_Q"));
4355 pLabel->SetTextConfig(FONT_SIZE_SAVE_CONFIRM, LABEL_TEXT_STYLE_NORMAL);
4356 pLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
4357 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
4359 Button* pSaveButton = new (std::nothrow) Button();
4360 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"));
4361 pSaveButton->SetTextSize(FONT_SIZE_SAVE_BUTTON);
4362 pSaveButton->SetActionId(IDA_POPUP_DISCARD_CHANGES_OK);
4363 pSaveButton->AddActionEventListener(*this);
4365 Button* pCancelButton = new (std::nothrow) Button();
4366 pCancelButton->Construct(Rectangle(X_SAVE_LABEL, Y_SAVE_BUTTON, W_SAVE_BUTTON, H_SAVE_BUTTON), ResourceManager::GetString(L"IDS_PB_SK_CANCEL"));
4367 pCancelButton->SetTextSize(FONT_SIZE_SAVE_BUTTON);
4368 pCancelButton->SetActionId(IDA_POPUP_DISCARD_CHANGES_CANCEL);
4369 pCancelButton->AddActionEventListener(*this);
4371 __pDiscardChangesPopup->AddControl(pLabel);
4372 __pDiscardChangesPopup->AddControl(pSaveButton);
4373 __pDiscardChangesPopup->AddControl(pCancelButton);
4376 __pDiscardChangesPopup->SetShowState(true);
4377 __pDiscardChangesPopup->Show();
4381 ContactEditorForm::HideDiscardChangesPopup(void)
4383 __pDiscardChangesPopup->SetShowState(false);