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 CtGroupEditorForm.cpp
19 * @brief This is the implementation file for the GroupEditorForm class.
24 #include "CtContactsApp.h"
25 #include "CtGroupEditorForm.h"
26 #include "CtGroupPresentationModel.h"
27 #include "CtResourceManager.h"
28 #include "CtSceneRegister.h"
30 #include "CtCommonUtil.h"
32 using namespace Tizen::App;
33 using namespace Tizen::Base;
34 using namespace Tizen::Base::Collection;
35 using namespace Tizen::Graphics;
36 using namespace Tizen::Io;
37 using namespace Tizen::Media;
38 using namespace Tizen::Ui;
39 using namespace Tizen::Ui::Controls;
40 using namespace Tizen::Ui::Scenes;
41 using namespace Tizen::Social;
42 using namespace Tizen::System;
44 static const int IDA_HEADER_SAVE = 0;
45 static const int IDA_BUTTON_GALLERY = 10;
46 static const int IDA_BUTTON_TAKE_PHOTO = 11;
47 static const int IDA_BUTTON_REMOVE = 12;
48 static const int IDA_BUTTON_RINGTONE_CLEAR = 13;
49 static const int IDA_POPUP_DISCARD_CHANGES_OK = 20;
50 static const int IDA_POPUP_DISCARD_CHANGES_CANCEL = 21;
52 static const wchar_t* IDB_ICON_ADD_NORMAL = L"C02_caller_id_icon_add.png";
53 static const wchar_t* IDB_ICON_ADD_PRESSED = L"C02_caller_id_icon_add_press.png";
54 static const wchar_t* IDB_ICON_CAMERA_NORMAL = L"C02_caller_id_icon_camera.png";
55 static const wchar_t* IDB_ICON_CAMERA_PRESSED = L"C02_caller_id_icon_camera_press.png";
56 static const wchar_t* IDB_ICON_REMOVE_NORMAL = L"00_button_expand_minus_press.png";
57 static const wchar_t* IDB_ICON_REMOVE_PRESSED = L"00_button_expand_minus_press.png";
58 static const wchar_t* IDB_REMOVE_BG_NORMAL = L"00_circle_button_delete.png";
59 static const wchar_t* IDB_REMOVE_BG_PRESSED = L"00_circle_button_delete_press.png";
60 static const wchar_t* IDB_DETAILS_RESET_NORMAL = L"00_button_refresh.png";
61 static const wchar_t* IDB_DETAILS_RESET_PRESSED = L"00_button_refresh_press.png";
63 static const int H_ITEM = 128;
64 static const int H_THUMBNAIL = 360;
65 static const int Y_THUMBNAIL = 49;
66 static const int H_ICON_BUTTON = 74;
67 static const int Y_REMOVE_BUTTON = 26;
68 static const int X_REMOVE_BUTTON_MARGIN = 40;
69 static const int X_REFRESH_BUTTON_MARGIN = 88;
71 static const int X_RINGTONE_TEXT = 3;
72 static const int Y_RINGTONE_TITLE = 10;
73 static const int Y_RINGTONE_NAME = 68;
74 static const int W_RINGTONE_TEXT = 600;
75 static const int H_RINGTONE_TITLE = 58;
76 static const int H_RINGTONE_NAME = 60;
78 static const int X_GROUP_TEXT_GAP = 5;
79 static const int H_GROUP_TEXT_GAP = 10;
81 static const unsigned int COLOR_GUIDE_TEXT = Color32<255, 0, 0>::Value;
82 static const unsigned int COLOR_RINGTONE_TITLE = Color32<128, 128, 128>::Value;
83 static const unsigned int COLOR_THUMBNAIL = Color32<239, 237, 229>::Value;
84 static const unsigned int COLOR_TABLE_BG = Color32<248, 246, 239>::Value;
85 static const unsigned int COLOR_ITEM_TITLE = Color32<128, 128, 128>::Value;
86 static const unsigned int COLOR_ITEM_VALUE = Color32<0, 0, 0>::Value;
87 static const unsigned int COLOR_ITEM_PRESSED = Color32<248, 246, 239>::Value;
88 static const unsigned int COLOR_PRESSED = Color32<87, 135, 194>::Value;
90 static const int ITEM_COUNT = 3;
92 static const int FONT_SIZE_RINGTONE_TITLE = 32;
94 static const wchar_t* INPUT_DATA_SELECTION_MODE_SINGLE = L"single";
95 static const wchar_t* INPUT_KEY_SELECTION_MODE = L"http://tizen.org/appcontrol/data/selection_mode";
96 static const wchar_t* INPUT_KEY_IMAGEVIEWER_MODE = L"http://tizen.org/appcontrol/data/image/crop_mode";
97 static const wchar_t* INPUT_KEY_ALLOW_SWITCH = L"http://tizen.org/appcontrol/data/camera/allow_switch";
98 static const wchar_t* INPUT_MIME_TYPE_CAMERA = L"image/jpg";
99 static const wchar_t* INPUT_MIME_TYPE_GALLERY = L"image/*";
100 static const wchar_t* INPUT_MIME_TYPE_AUDIO = L"audio/*";
101 static const wchar_t* INPUT_VALUE_FALSE = L"false";
102 static const wchar_t* INPUT_VALUE_IMAGEVIEWER_TYPE = L"fit_to_screen";
103 static const wchar_t* OUTPUT_KEY_SELECTED = L"http://tizen.org/appcontrol/data/selected";
104 static const wchar_t* THUMBNAIL_LABEL = L"thumbnail";
105 static const wchar_t* THUMBNAIL_EMPTY_LABEL = L"emptyThumbnail";
106 static const wchar_t* ADD_BUTTON = L"add";
107 static const wchar_t* CAMERA_BUTTON = L"camera";
108 static const wchar_t* REMOVE_BUTTON = L"remove";
109 static const wchar_t* SD_CARD_UNMOUNTED = L"Unmounted";
111 static const wchar_t* GROUP_EDITOR_LABEL_TITLE = L"GroupLabelTitle";
112 static const wchar_t* GROUP_EDITOR_LABEL_VALUE = L"GroupLabelValue";
113 static const wchar_t* GROUP_EDITOR_STYLE_PANEL = L"GroupStylePanel";
115 GroupEditorForm::GroupEditorForm(void)
116 : __pPresentationModel(null)
118 , __pFileEventManager(null)
119 , __isEditMode(false)
121 , __isGroupsChanged(false)
122 , __pDiscardChangesPopup(null)
126 GroupEditorForm::~GroupEditorForm(void)
131 GroupEditorForm::Initialize(void)
133 Construct(L"IDL_GROUP_EDITOR_FORM");
137 GroupEditorForm::OnInitializing(void)
139 Footer* pFooter = GetFooter();
140 pFooter->AddActionEventListener(*this);
141 SetFormBackEventListener(this);
142 DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
144 __pTableView = new (std::nothrow) TableView();
145 __pTableView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height), true, TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT);
146 __pTableView->SetItemProvider(this);
147 __pTableView->AddTableViewItemEventListener(*this);
148 AddControl(__pTableView);
154 GroupEditorForm::OnTerminating(void)
156 __pTableView->SetItemProvider(null);
158 delete __pPresentationModel;
159 delete __pFileEventManager;
161 if (__pDiscardChangesPopup != null)
163 delete __pDiscardChangesPopup;
166 DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
172 GroupEditorForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
174 SceneManager* pSceneManager = SceneManager::GetInstance();
178 Footer* pFooter = GetFooter();
179 FooterItemStatus status;
180 pFooter->GetItemStatus(0, status);
182 if (status != FOOTER_ITEM_STATUS_DISABLED && __isGroupsChanged == true)
184 ShowDiscardChangesPopup();
188 result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
189 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go backward", GetErrorMessage(r));
193 GroupEditorForm::ShowDiscardChangesPopup(void)
195 if (__pDiscardChangesPopup == null)
197 __pDiscardChangesPopup = new (std::nothrow) Popup();
198 __pDiscardChangesPopup->Construct(false, Dimension(W_SAVE_POPUP, H_SAVE_POPUP));
199 __pDiscardChangesPopup->SetPropagatedKeyEventListener(this);
201 Rectangle popupClientBounds = __pDiscardChangesPopup->GetClientAreaBounds();
203 Label* pLabel = new (std::nothrow) Label();
204 pLabel->Construct(Rectangle(X_SAVE_LABEL, Y_SAVE_LABEL, W_SAVE_LABEL, H_SAVE_LABEL), ResourceManager::GetString(L"IDS_PB_POP_DISCARD_CHANGES_Q"));
205 pLabel->SetTextConfig(FONT_SIZE_SAVE_CONFIRM, LABEL_TEXT_STYLE_NORMAL);
206 pLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
207 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
209 Button* pSaveButton = new (std::nothrow) Button();
210 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"));
211 pSaveButton->SetTextSize(FONT_SIZE_SAVE_BUTTON);
212 pSaveButton->SetActionId(IDA_POPUP_DISCARD_CHANGES_OK);
213 pSaveButton->AddActionEventListener(*this);
215 Button* pCancelButton = new (std::nothrow) Button();
216 pCancelButton->Construct(Rectangle(X_SAVE_LABEL, Y_SAVE_BUTTON, W_SAVE_BUTTON, H_SAVE_BUTTON), ResourceManager::GetString(L"IDS_PB_SK_CANCEL"));
217 pCancelButton->SetTextSize(FONT_SIZE_SAVE_BUTTON);
218 pCancelButton->SetActionId(IDA_POPUP_DISCARD_CHANGES_CANCEL);
219 pCancelButton->AddActionEventListener(*this);
221 __pDiscardChangesPopup->AddControl(pLabel);
222 __pDiscardChangesPopup->AddControl(pSaveButton);
223 __pDiscardChangesPopup->AddControl(pCancelButton);
226 __pDiscardChangesPopup->SetShowState(true);
227 __pDiscardChangesPopup->Show();
231 GroupEditorForm::HideDiscardChangesPopup(void)
233 __pDiscardChangesPopup->SetShowState(false);
238 GroupEditorForm::OnFileEventOccured(const unsigned long events, const Tizen::Base::String &path, const unsigned int eventId)
240 String thumbnailPath = __pPresentationModel->GetThumbnailPath();
241 if (thumbnailPath.Equals(path, false) == true)
243 __pPresentationModel->SetThumbnailPath(String());
244 __pTableView->RefreshItem(0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
245 __pTableView->RefreshItem(1, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
249 String ringtonePath = __pPresentationModel->GetRingtone();
250 if (ringtonePath.Equals(path, false) == true )
252 __pPresentationModel->SetRingtone(String());
253 __pTableView->RefreshItem(2, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
259 GroupEditorForm::OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String &state)
261 if (deviceType != DEVICE_TYPE_STORAGE_CARD || __pPresentationModel->GetThumbnailPath().IsEmpty())
266 if (state.Equals(SD_CARD_UNMOUNTED, false) && File::IsFileExist(__pPresentationModel->GetThumbnailPath()) == false)
268 __pPresentationModel->SetThumbnailPath(L"");
269 __pTableView->RefreshItem(0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
275 GroupEditorForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
279 case IDA_HEADER_SAVE:
281 result r = E_SUCCESS;
283 if (CommonUtil::isMemoryAvailable() == false)
285 CommonUtil::showMemoryFullMessageBox();
289 __pTableView->RefreshItem(1, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
291 if (__pPresentationModel->IsDefaultCategory() == false && __pPresentationModel->IsDuplicatedCategory() == true)
293 Footer* pFooter = GetFooter();
294 pFooter->SetItemEnabled(0, false);
300 r = __pPresentationModel->UpdateCategory();
304 OnCategoriesChanged();
306 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to update category", GetErrorMessage(r));
310 r = __pPresentationModel->AddCategory();
311 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to add category", GetErrorMessage(r));
318 case IDA_BUTTON_GALLERY:
320 LaunchAppControl(PROVIDER_ID_GALLERY, OPERATION_ID_PICK);
323 case IDA_BUTTON_TAKE_PHOTO:
325 LaunchAppControl(PROVIDER_ID_CAMERA, OPERATION_ID_CREATE_CONTENT);
328 case IDA_BUTTON_REMOVE:
330 __pPresentationModel->SetThumbnailPath(String());
331 __pTableView->RefreshItem(0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
332 __pTableView->RefreshItem(1, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
334 if (__pFileEventManager != null)
336 delete __pFileEventManager;
337 __pFileEventManager = null;
341 case IDA_BUTTON_RINGTONE_CLEAR:
343 __pPresentationModel->SetRingtone(String());
344 __pTableView->RefreshItem(2, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
347 case IDA_POPUP_DISCARD_CHANGES_OK:
349 HideDiscardChangesPopup();
352 SceneManager* pSceneManager = SceneManager::GetInstance();
353 result r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
354 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go backward", GetErrorMessage(r));
357 case IDA_POPUP_DISCARD_CHANGES_CANCEL:
359 HideDiscardChangesPopup();
368 GroupEditorForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
369 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
371 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
372 pContactsApp->AddContactsAppChangeEventListener(*this);
374 RecordId categoryId = INVALID_RECORD_ID;
378 IEnumerator* pEnum = pArgs->GetEnumeratorN();
379 if (pEnum->MoveNext() == E_SUCCESS)
381 Integer* pCategoryId = static_cast<Integer*>(pEnum->GetCurrent());
382 if (pCategoryId != null)
384 categoryId = pCategoryId->ToInt();
390 pArgs->RemoveAll(true);
394 __pPresentationModel = new (std::nothrow) GroupPresentationModel();
395 __pPresentationModel->Construct(categoryId);
396 __pPresentationModel->AddContactChangeListener(*this);
398 Header* pHeader = GetHeader();
401 pHeader->SetTitleText(ResourceManager::GetString(L"IDS_PB_OPT2_EDIT_GROUPS"));
405 pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_CREATE"));
408 Footer* pFooter = GetFooter();
411 pFooter->SetItemEnabled(0, true);
415 pFooter->SetItemEnabled(0, false);
421 GroupEditorForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
422 const Tizen::Ui::Scenes::SceneId& nextSceneId)
424 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
425 pContactsApp->RemoveContactsAppChangeEventListener(*this);
427 __pPresentationModel->RemoveContactChangeListener(*this);
431 GroupEditorForm::GetItemCount(void)
436 Tizen::Ui::Controls::TableViewItem*
437 GroupEditorForm::CreateItem(int itemIndex, int itemWidth)
439 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
441 Label* pSubjectLabel = null;
442 Label* pContentLabel = null;
443 int itemHeight = H_ITEM + pContactsApp->GetFontHeightOffset();
447 itemHeight = Y_THUMBNAIL * 2 + H_THUMBNAIL;
450 TableViewItem* pItem = new (std::nothrow) TableViewItem();
451 pItem->Construct(Dimension(itemWidth, itemHeight), TABLE_VIEW_ANNEX_STYLE_NORMAL);
455 Label* pThumbnailLabel = new (std::nothrow) Label();
456 pThumbnailLabel->Construct(Rectangle((itemWidth - H_THUMBNAIL) / 2, Y_THUMBNAIL, H_THUMBNAIL, H_THUMBNAIL), L"");
457 pThumbnailLabel->SetName(THUMBNAIL_LABEL);
458 pItem->AddControl(pThumbnailLabel);
459 Label* pEmptyThumbnailLabel = new (std::nothrow) Label();
460 pEmptyThumbnailLabel->Construct(Rectangle((itemWidth - H_THUMBNAIL) / 2, Y_THUMBNAIL, H_THUMBNAIL, H_THUMBNAIL), L"");
461 pEmptyThumbnailLabel->SetName(THUMBNAIL_EMPTY_LABEL);
462 pEmptyThumbnailLabel->SetBackgroundColor(COLOR_THUMBNAIL);
463 pItem->AddControl(pEmptyThumbnailLabel);
465 if (__pPresentationModel->GetThumbnailPath().IsEmpty() == false)
467 Bitmap* pThumbnail = null;
468 ImageBuffer thumbnailImageBuffer;
469 result r = thumbnailImageBuffer.Construct(__pPresentationModel->GetThumbnailPath());
472 pThumbnail = thumbnailImageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_RGB565, BUFFER_SCALING_NONE);
474 pThumbnailLabel->SetBackgroundBitmap(*pThumbnail);
477 pEmptyThumbnailLabel->SetShowState(false);
480 Button* pButtonAdd = new (std::nothrow) Button();
481 pButtonAdd->Construct(Rectangle((itemWidth - H_ICON_BUTTON) / 2, (H_THUMBNAIL - H_ICON_BUTTON) / 2 + Y_THUMBNAIL, H_ICON_BUTTON, H_ICON_BUTTON), L"");
482 pButtonAdd->SetActionId(IDA_BUTTON_GALLERY);
483 pButtonAdd->AddActionEventListener(*this);
484 pButtonAdd->SetName(ADD_BUTTON);
485 Bitmap* pIconNormal = ResourceManager::GetBitmapN(IDB_ICON_ADD_NORMAL);
486 Bitmap* pIconPressed = ResourceManager::GetBitmapN(IDB_ICON_ADD_PRESSED);
487 if (pIconNormal != null)
489 pButtonAdd->SetNormalBackgroundBitmap(*pIconNormal);
492 if (pIconPressed != null)
494 pButtonAdd->SetPressedBackgroundBitmap(*pIconPressed);
497 pItem->AddControl(pButtonAdd);
498 pItem->SetIndividualSelectionEnabled(pButtonAdd, true);
500 Button* pButtonCamera = new (std::nothrow) Button();
501 pButtonCamera->Construct(Rectangle((itemWidth - H_THUMBNAIL) / 2 + H_THUMBNAIL, Y_THUMBNAIL + H_THUMBNAIL - H_ICON_BUTTON, H_ICON_BUTTON, H_ICON_BUTTON), L"");
502 pButtonCamera->SetActionId(IDA_BUTTON_TAKE_PHOTO);
503 pButtonCamera->AddActionEventListener(*this);
504 pButtonCamera->SetName(CAMERA_BUTTON);
505 pIconNormal = ResourceManager::GetBitmapN(IDB_ICON_CAMERA_NORMAL);
506 pIconPressed = ResourceManager::GetBitmapN(IDB_ICON_CAMERA_PRESSED);
507 if (pIconNormal != null)
509 pButtonCamera->SetNormalBackgroundBitmap(*pIconNormal);
512 if (pIconPressed != null)
514 pButtonCamera->SetPressedBackgroundBitmap(*pIconPressed);
517 pItem->AddControl(pButtonCamera);
518 pItem->SetIndividualSelectionEnabled(pButtonCamera, true);
520 Button* pButtonRemove = new (std::nothrow) Button();
521 pButtonRemove->Construct(Rectangle((itemWidth - H_THUMBNAIL) / 2 - X_REMOVE_BUTTON_MARGIN, Y_REMOVE_BUTTON, H_ICON_BUTTON, H_ICON_BUTTON), L"");
522 pButtonRemove->SetActionId(IDA_BUTTON_REMOVE);
523 pButtonRemove->AddActionEventListener(*this);
524 pButtonRemove->SetName(REMOVE_BUTTON);
525 pIconNormal = ResourceManager::GetBitmapN(IDB_ICON_REMOVE_NORMAL);
526 pIconPressed = ResourceManager::GetBitmapN(IDB_ICON_REMOVE_PRESSED);
527 if (pIconNormal != null)
529 pButtonRemove->SetNormalBitmap(Point(0, 0), *pIconNormal);
532 if (pIconPressed != null)
534 pButtonRemove->SetPressedBitmap(Point(0, 0), *pIconPressed);
538 pIconNormal = ResourceManager::GetBitmapN(IDB_REMOVE_BG_NORMAL);
539 pIconPressed = ResourceManager::GetBitmapN(IDB_REMOVE_BG_PRESSED);
540 if (pIconNormal != null)
542 pButtonRemove->SetNormalBackgroundBitmap(*pIconNormal);
545 if (pIconPressed != null)
547 pButtonRemove->SetPressedBackgroundBitmap(*pIconPressed);
550 pItem->AddControl(pButtonRemove);
551 pItem->SetIndividualSelectionEnabled(pButtonRemove, true);
553 if (__pPresentationModel->GetThumbnailPath().IsEmpty() == true)
555 pButtonRemove->SetShowState(false);
559 pButtonAdd->SetShowState(false);
561 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
562 pItem->SetBackgroundColor(COLOR_TABLE_BG, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
564 else if (itemIndex == 1)
566 EditField* pEditField = new (std::nothrow) EditField();
567 pEditField->Construct(Rectangle(X_GROUP_TEXT_GAP, X_GROUP_TEXT_GAP, itemWidth - H_GROUP_TEXT_GAP, H_ITEM + pContactsApp->GetFontHeightOffset() - H_GROUP_TEXT_GAP), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, EDIT_FIELD_TITLE_STYLE_TOP, !__pPresentationModel->IsDefaultCategory());
568 pEditField->AddTextEventListener(*this);
569 pEditField->AddKeypadEventListener(*this);
570 pEditField->SetText(__pPresentationModel->GetCategoryName());
571 pEditField->SetTitleText(ResourceManager::GetString(L"IDS_PB_BODY_GROUP_NAME_ABB"));
572 pEditField->SetTextSize(pContactsApp->GetFontSize());
573 pEditField->SetEnabled(!__pPresentationModel->IsDefaultCategory());
575 if (__isEditMode == true)
577 String categoryName = __pPresentationModel->GetCategoryName();
578 if (__pPresentationModel->IsDefaultCategory())
580 if (categoryName.Equals(DEFAULT_GROUP_FAMILY, false))
582 categoryName.Clear();
583 categoryName = ResourceManager::GetString(L"IDS_PB_BODY_DEFAULT_GROUP_FAMILY");
585 else if (categoryName.Equals(DEFAULT_GROUP_FRIENDS, false))
587 categoryName.Clear();
588 categoryName = ResourceManager::GetString(L"IDS_PB_BODY_DEFAULT_GROUP_FRIENDS");
590 else if (categoryName.Equals(DEFAULT_GROUP_COWORKERS, false))
592 categoryName.Clear();
593 categoryName = ResourceManager::GetString(L"IDS_PB_BODY_CO_WORKERS");
596 pEditField->SetText(categoryName);
599 pItem->SetBackgroundColor(COLOR_THUMBNAIL, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
600 pItem->SetBackgroundColor(COLOR_THUMBNAIL, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED);
602 pItem->AddControl(pEditField);
603 pItem->SetIndividualSelectionEnabled(pEditField, true);
605 else if (itemIndex == 2)
607 Panel* pGroupStyle = new (std::nothrow) Panel();
608 pGroupStyle->Construct(Rectangle(0, 0, itemWidth , itemHeight), GROUP_STYLE_NONE);
609 pGroupStyle->SetName(GROUP_EDITOR_STYLE_PANEL);
610 pGroupStyle->SetBackgroundColor(COLOR_THUMBNAIL);
611 pGroupStyle->AddTouchEventListener(*this);
612 pItem->AddKeyEventListener(*this);
613 pItem->AddControl(pGroupStyle);
615 pSubjectLabel = new (std::nothrow) Label();
616 pSubjectLabel->Construct(Rectangle(X_RINGTONE_TEXT, Y_RINGTONE_TITLE, W_RINGTONE_TEXT, H_RINGTONE_TITLE),
617 ResourceManager::GetString(L"IDS_PB_BODY_RINGTONE"));
618 pSubjectLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
619 pSubjectLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
620 pSubjectLabel->SetTextColor(Color(COLOR_RINGTONE_TITLE));
621 pSubjectLabel->SetTextConfig(FONT_SIZE_RINGTONE_TITLE, LABEL_TEXT_STYLE_BOLD);
622 pSubjectLabel->SetName(GROUP_EDITOR_LABEL_TITLE);
623 pSubjectLabel->AddTouchEventListener(*this);
624 pGroupStyle->AddControl(pSubjectLabel);
627 String ringtonePath = __pPresentationModel->GetRingtone();
630 if (ringtonePath.IsEmpty() == true)
632 trimmedPath = ResourceManager::GetString(L"IDS_PB_BODY_DEFAULT");
636 ringtonePath.LastIndexOf(L"/", ringtonePath.GetLength() - 1, index);
639 ringtonePath.SubString(index + 1, trimmedPath);
643 pContentLabel = new (std::nothrow) Label();
644 pContentLabel->Construct(Rectangle(X_RINGTONE_TEXT, Y_RINGTONE_NAME, W_RINGTONE_TEXT, H_RINGTONE_NAME + pContactsApp->GetFontHeightOffset()), trimmedPath);
645 pContentLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
646 pContentLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
647 pContentLabel->SetTextConfig(pContactsApp->GetFontSize(), LABEL_TEXT_STYLE_NORMAL);
648 pContentLabel->SetName(GROUP_EDITOR_LABEL_VALUE);
649 pContentLabel->AddTouchEventListener(*this);
650 pGroupStyle->AddControl(pContentLabel);
652 Button* pClearButton = new (std::nothrow) Button();
653 pClearButton->Construct(Rectangle(itemWidth - X_REFRESH_BUTTON_MARGIN, (pItem->GetHeight() - H_ICON_BUTTON) / 2, H_ICON_BUTTON, H_ICON_BUTTON));
654 pClearButton->SetActionId(IDA_BUTTON_RINGTONE_CLEAR);
655 pClearButton->AddActionEventListener(*this);
657 Bitmap* pReset = ResourceManager::GetBitmapN(IDB_DETAILS_RESET_NORMAL);
660 pClearButton->SetNormalBitmap(Point(0, 0), *pReset);
663 pReset = ResourceManager::GetBitmapN(IDB_DETAILS_RESET_PRESSED);
666 pClearButton->SetPressedBitmap(Point(0, 0), *pReset);
670 pItem->AddControl(pClearButton);
671 pItem->SetIndividualSelectionEnabled(pClearButton, true);
673 pItem->SetBackgroundColor(COLOR_THUMBNAIL, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
680 GroupEditorForm::DeleteItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
687 GroupEditorForm::UpdateItem(int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem)
696 Button* pRemoveButton = static_cast<Button*>(pItem->GetControl(REMOVE_BUTTON, false));
697 Button* pAddButton = static_cast<Button*>(pItem->GetControl(ADD_BUTTON, false));
698 Label* pThumbnailLabel = static_cast<Label*>(pItem->GetControl(THUMBNAIL_LABEL, false));
699 Label* pThumbnailEmptyLabel = static_cast<Label*>(pItem->GetControl(THUMBNAIL_EMPTY_LABEL, false));
700 if (pRemoveButton == null || pAddButton == null ||
701 pThumbnailLabel == null || pThumbnailEmptyLabel == null)
706 if (__pPresentationModel->GetThumbnailPath().IsEmpty() == true)
708 pRemoveButton->SetShowState(false);
709 pThumbnailLabel->SetShowState(false);
710 pThumbnailEmptyLabel->SetShowState(true);
711 pAddButton->SetShowState(true);
715 pAddButton->SetShowState(false);
716 pThumbnailEmptyLabel->SetShowState(false);
717 pThumbnailLabel->SetShowState(true);
718 pRemoveButton->SetShowState(true);
720 Bitmap* pThumbnail = null;
721 ImageBuffer thumbnailImageBuffer;
722 result r = thumbnailImageBuffer.Construct(__pPresentationModel->GetThumbnailPath());
725 pThumbnail = thumbnailImageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_ARGB8888, BUFFER_SCALING_NONE);
727 pThumbnailLabel->SetBackgroundBitmap(*pThumbnail);
730 pThumbnailLabel->Invalidate(false);
733 else if (itemIndex == 1)
735 EditField* pEditField = static_cast<EditField*>(pItem->GetControl(0));
736 if (pEditField == null)
741 String groupName = pEditField->GetText();
744 if (groupName.GetLength() > 0)
746 Footer* pFooter = GetFooter();
747 pFooter->SetItemEnabled(0, true);
748 pFooter->Invalidate(true);
751 if (__pPresentationModel->IsDefaultCategory() == false && __pPresentationModel->IsDuplicatedCategory() == true)
753 pEditField->SetEnabled(true);
755 pEditField->SetGuideTextColor(Color(COLOR_GUIDE_TEXT));
756 pEditField->SetGuideText(ResourceManager::GetString(L"IDS_PB_POP_GROUP_ALREADY_IN_USE"));
757 pEditField->SetFocus();
758 pEditField->Invalidate(false);
761 else if (itemIndex == 2)
764 String ringtonePath = __pPresentationModel->GetRingtone();
767 if (ringtonePath.IsEmpty() == true)
769 trimmedPath = ResourceManager::GetString(L"IDS_PB_BODY_DEFAULT");
773 ringtonePath.LastIndexOf(L"/", ringtonePath.GetLength() - 1, index);
776 ringtonePath.SubString(index + 1, trimmedPath);
780 Panel* pPanel = static_cast<Panel*>(pItem->GetControl(0));
787 Label* pRingtoneName = static_cast<Label*>(pPanel->GetControl(1));
789 if (pRingtoneName == null)
794 if (pRingtoneName != null)
796 pRingtoneName->SetText(trimmedPath);
797 pRingtoneName->Invalidate(true);
803 GroupEditorForm::GetDefaultItemHeight(void)
809 GroupEditorForm::OnTableViewItemStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewItem* pItem, Tizen::Ui::Controls::TableViewItemStatus status)
811 if (status == TABLE_VIEW_ITEM_STATUS_SELECTED && itemIndex == 2)
813 LaunchAppControl(PROVIDER_ID_FILEMANAGER, OPERATION_ID_PICK);
818 GroupEditorForm::OnTableViewContextItemActivationStateChanged(Tizen::Ui::Controls::TableView& tableView, int itemIndex, Tizen::Ui::Controls::TableViewContextItem* pContextItem, bool activated)
823 GroupEditorForm::OnTableViewItemReordered(Tizen::Ui::Controls::TableView& tableView, int itemIndexFrom, int itemIndexTo)
828 GroupEditorForm::OnTextValueChanged(const Tizen::Ui::Control& source)
830 EditField* pEditField = const_cast<EditField *>(static_cast<const EditField *>(&source));
831 if (pEditField == null)
836 String existingCategoryName = __pPresentationModel->GetCategoryName();
837 String name = pEditField->GetText();
841 pEditField->SetGuideText(String(CHARACTER_SPACE));
842 pEditField->Invalidate(false);
844 Footer* pFooter = GetFooter();
845 pFooter->SetItemEnabled(0, false);
846 pFooter->Invalidate(true);
850 __pPresentationModel->SetCategoryName(name);
852 bool isSaveEnabled = false;
854 __isGroupsChanged = false;
856 for (int index = 0; index < name.GetLength(); index++)
858 name.GetCharAt(index, ch);
862 isSaveEnabled = true;
863 __isGroupsChanged = true;
868 Footer* pFooter = GetFooter();
870 pFooter->SetItemEnabled(0, isSaveEnabled);
871 pFooter->Invalidate(true);
875 GroupEditorForm::OnTextValueChangeCanceled(const Tizen::Ui::Control& source)
880 GroupEditorForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
882 Panel* pPanel = null;
884 if (source.GetName().Equals(GROUP_EDITOR_STYLE_PANEL, true))
886 pPanel = static_cast<Panel*>(&(const_cast<Control&>(source)));
888 else if (source.GetName().Equals(GROUP_EDITOR_LABEL_TITLE, true) || source.GetName().Equals(GROUP_EDITOR_LABEL_VALUE, true))
890 pPanel = static_cast<Panel*>(source.GetParent());
895 pPanel->SetBackgroundColor(COLOR_PRESSED);
897 Label* pLabelValue = static_cast<Label*>(pPanel->GetControl(GROUP_EDITOR_LABEL_VALUE, true));
898 pLabelValue->SetTextColor(Color(COLOR_ITEM_PRESSED));
900 Label* pLabelTitle = static_cast<Label*>(pPanel->GetControl(GROUP_EDITOR_LABEL_TITLE, true));
901 pLabelTitle->SetTextColor(COLOR_ITEM_PRESSED);
903 pPanel->Invalidate(true);
908 GroupEditorForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
910 Panel* pPanel = null;
912 if (source.GetName().Equals(GROUP_EDITOR_STYLE_PANEL, true))
914 pPanel = static_cast<Panel*>(&(const_cast<Control&>(source)));
916 else if (source.GetName().Equals(GROUP_EDITOR_LABEL_TITLE, true) || source.GetName().Equals(GROUP_EDITOR_LABEL_VALUE, true))
918 pPanel = static_cast<Panel*>(source.GetParent());
923 pPanel->SetBackgroundColor(COLOR_THUMBNAIL);
925 Label* pLabelValue = static_cast<Label*>(pPanel->GetControl(GROUP_EDITOR_LABEL_VALUE, true));
926 pLabelValue->SetTextColor(Color(COLOR_ITEM_VALUE));
928 Label* pLabelTitle = static_cast<Label*>(pPanel->GetControl(GROUP_EDITOR_LABEL_TITLE, true));
929 pLabelTitle->SetTextColor(COLOR_ITEM_TITLE);
931 pPanel->Invalidate(true);
937 GroupEditorForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
939 Panel* pPanel = null;
941 if (source.GetName().Equals(GROUP_EDITOR_STYLE_PANEL, true))
943 pPanel = static_cast<Panel*>(&(const_cast<Control&>(source)));
945 else if (source.GetName().Equals(GROUP_EDITOR_LABEL_TITLE, true) || source.GetName().Equals(GROUP_EDITOR_LABEL_VALUE, true))
947 pPanel = static_cast<Panel*>(source.GetParent());
952 pPanel->SetBackgroundColor(COLOR_THUMBNAIL);
954 Label* pLabelValue = static_cast<Label*>(pPanel->GetControl(GROUP_EDITOR_LABEL_VALUE, true));
955 pLabelValue->SetTextColor(Color(COLOR_ITEM_VALUE));
957 Label* pLabelTitle = static_cast<Label*>(pPanel->GetControl(GROUP_EDITOR_LABEL_TITLE, true));
958 pLabelTitle->SetTextColor(COLOR_ITEM_TITLE);
960 pPanel->Invalidate(true);
965 GroupEditorForm::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
970 GroupEditorForm::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
975 GroupEditorForm::OnTouchCanceled(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
980 GroupEditorForm::OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
982 if (keyCode == KEY_ENTER )
984 TableViewItem* pItem = static_cast<TableViewItem*>(&(const_cast<Control&>(source)));
986 Panel* pPanel = static_cast<Panel*>(pItem->GetControl(0));
993 Label* pLabelValue = static_cast<Label*>(pPanel->GetControl(GROUP_EDITOR_LABEL_VALUE, true));
995 if (pLabelValue == null)
1000 Label* pLabelTitle = static_cast<Label*>(pPanel->GetControl(GROUP_EDITOR_LABEL_TITLE, true));
1002 if (pLabelTitle == null)
1007 pPanel->SetBackgroundColor(COLOR_PRESSED);
1008 pLabelValue->SetTextColor(Color(COLOR_ITEM_PRESSED));
1009 pLabelTitle->SetTextColor(COLOR_ITEM_PRESSED);
1010 pPanel->Invalidate(true);
1015 GroupEditorForm::OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1017 if (keyCode == KEY_ENTER )
1020 TableViewItem* pItem = static_cast<TableViewItem*>(&(const_cast<Control&>(source)));
1022 Panel* pPanel = static_cast<Panel*>(pItem->GetControl(0));
1029 Label* pLabelValue = static_cast<Label*>(pPanel->GetControl(GROUP_EDITOR_LABEL_VALUE, true));
1031 if (pLabelValue == null)
1036 Label* pLabelTitle = static_cast<Label*>(pPanel->GetControl(GROUP_EDITOR_LABEL_TITLE, true));
1038 if (pLabelTitle == null)
1043 pPanel->SetBackgroundColor(COLOR_THUMBNAIL);
1044 pLabelValue->SetTextColor(Color(COLOR_ITEM_VALUE));
1045 pLabelTitle->SetTextColor(COLOR_ITEM_TITLE);
1046 pPanel->Invalidate(true);
1051 GroupEditorForm::OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCode keyCode)
1057 GroupEditorForm::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
1063 GroupEditorForm::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
1065 if (keyEventInfo.GetKeyCode() == KEY_BACK || keyEventInfo.GetKeyCode() == KEY_ESC)
1067 if (__pDiscardChangesPopup && __pDiscardChangesPopup->GetShowState() == true)
1069 HideDiscardChangesPopup();
1077 GroupEditorForm::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
1083 GroupEditorForm::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
1089 GroupEditorForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
1094 GroupEditorForm::OnKeypadOpened(Tizen::Ui::Control& source)
1096 Rectangle clientBounds = GetClientAreaBounds();
1098 __pTableView->SetSize(clientBounds.width, clientBounds.height);
1102 GroupEditorForm::OnKeypadClosed(Tizen::Ui::Control& source)
1107 GroupEditorForm::OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction)
1112 GroupEditorForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1114 Rectangle clientBounds = GetClientAreaBounds();
1116 __pTableView->SetSize(clientBounds.width, clientBounds.height);
1120 GroupEditorForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, Tizen::App::AppCtrlResult appControlResult, const Tizen::Base::Collection::IMap* pExtraData)
1122 AppLogDebug("ENTER");
1127 TryReturnVoid(appControlResult == APP_CTRL_RESULT_SUCCEEDED, "[E_FAILURE] The result of an appcontrol is not succeeded.");
1128 TryReturnVoid(pExtraData != null, "[E_FAILURE] The extra data is null.");
1130 const String *pResultString = null;
1131 const ArrayList* pResultList = dynamic_cast<const ArrayList*>(pExtraData->GetValue(String(OUTPUT_KEY_SELECTED)));
1132 if (pResultList != null)
1134 pResultString = static_cast<const String*>(pResultList->GetAt(0));
1138 pResultString = static_cast<const String*>(pExtraData->GetValue(String(OUTPUT_KEY_SELECTED)));
1140 TryReturnVoid(pResultString != null, "[E_FAILURE] Unable to get file path.");
1142 if (appId.Equals(String(PROVIDER_ID_CAMERA)) && operationId.Equals(String(OPERATION_ID_CREATE_CONTENT)))
1144 __pPresentationModel->SetThumbnailPath(*pResultString);
1145 __pTableView->RefreshItem(0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1147 if (__pFileEventManager == null)
1149 __pFileEventManager = new (std::nothrow) FileEventManager();
1150 __pFileEventManager->Construct(*this);
1152 __pFileEventManager->AddPath(*pResultString, FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_DELETE_SELF | FILE_EVENT_TYPE_MODIFY | FILE_EVENT_TYPE_MOVE_SELF);
1153 __isGroupsChanged = true;
1155 else if (appId.Equals(String(PROVIDER_ID_GALLERY)) && operationId.Equals(String(OPERATION_ID_PICK)))
1159 ImageFormat imageFormat;
1160 result r = ImageBuffer::GetImageInfo(*pResultString, imageFormat, width, height);
1162 if (appControlResult == APP_CTRL_RESULT_FAILED || r != E_SUCCESS)
1164 int modalResult = 0;
1165 MessageBox unsupportedMessageBox;
1166 unsupportedMessageBox.Construct(L"", ResourceManager::GetString(L"IDS_MP_POP_INVALID_FILE"), MSGBOX_STYLE_NONE, 3000);
1167 unsupportedMessageBox.ShowAndWait(modalResult);
1172 r = LaunchImageViewerAppControl(*pResultString);
1174 else if (appId.Equals(String(PROVIDER_ID_FILEMANAGER)) && operationId.Equals(String(OPERATION_ID_PICK)))
1176 __pPresentationModel->SetRingtone(*pResultString);
1177 __pTableView->RefreshItem(2, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1179 if (__pFileEventManager == null)
1181 __pFileEventManager = new (std::nothrow) FileEventManager();
1182 __pFileEventManager->Construct(*this);
1184 __pFileEventManager->AddPath(*pResultString, FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_DELETE_SELF | FILE_EVENT_TYPE_MODIFY | FILE_EVENT_TYPE_MOVE_SELF);
1185 __isGroupsChanged = true;
1187 else if(appId.Equals(String(PROVIDER_ID_IMAGEVIEWER)) && operationId.Equals(String(OPERATION_ID_CROP)))
1191 ImageFormat imageFormat;
1192 result r = ImageBuffer::GetImageInfo(*pResultString, imageFormat, width, height);
1194 if (appControlResult == APP_CTRL_RESULT_FAILED || r != E_SUCCESS)
1196 int modalResult = 0;
1197 MessageBox unsupportedMessageBox;
1198 unsupportedMessageBox.Construct(L"", ResourceManager::GetString(L"IDS_MP_POP_INVALID_FILE"), MSGBOX_STYLE_NONE, 3000);
1199 unsupportedMessageBox.ShowAndWait(modalResult);
1204 __pPresentationModel->SetThumbnailPath(*pResultString);
1205 __pTableView->RefreshItem(0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1207 if (__pFileEventManager == null)
1209 __pFileEventManager = new (std::nothrow) FileEventManager();
1210 __pFileEventManager->Construct(*this);
1212 __pFileEventManager->AddPath(*pResultString, FILE_EVENT_TYPE_DELETE | FILE_EVENT_TYPE_DELETE_SELF | FILE_EVENT_TYPE_MODIFY | FILE_EVENT_TYPE_MOVE_SELF);
1213 __isGroupsChanged = true;
1215 __pTableView->RefreshItem(0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1218 AppLogDebug("EXIT");
1222 GroupEditorForm::LaunchAppControl(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId)
1224 result r = E_SUCCESS;
1231 extraData.Construct();
1233 if (appId.Equals(String(PROVIDER_ID_CAMERA)) && operationId.Equals(String(OPERATION_ID_CREATE_CONTENT)))
1235 mimeType.Append(INPUT_MIME_TYPE_CAMERA);
1236 extraData.Add(new (std::nothrow) String(INPUT_KEY_ALLOW_SWITCH), new (std::nothrow) String(INPUT_VALUE_FALSE));
1238 else if (appId.Equals(String(PROVIDER_ID_GALLERY)) && operationId.Equals(String(OPERATION_ID_PICK)))
1240 mimeType.Append(INPUT_MIME_TYPE_GALLERY);
1241 extraData.Add(new (std::nothrow) String(INPUT_KEY_SELECTION_MODE), new (std::nothrow) String(INPUT_DATA_SELECTION_MODE_SINGLE));
1243 else if (appId.Equals(String(PROVIDER_ID_FILEMANAGER)) && operationId.Equals(String(OPERATION_ID_PICK)))
1245 mimeType.Append(INPUT_MIME_TYPE_AUDIO);
1246 extraData.Add(new (std::nothrow) String(INPUT_KEY_SELECTION_MODE), new (std::nothrow) String(INPUT_DATA_SELECTION_MODE_SINGLE));
1249 AppControl* pAppControl = AppManager::FindAppControlN(appId, operationId);
1251 if (pAppControl != null)
1253 r = pAppControl->Start(&uri, &mimeType, &extraData, this);
1254 TryCatch(r == E_SUCCESS, , "[%s] Unable to launch app control", GetErrorMessage(r));
1261 extraData.RemoveAll(true);
1268 GroupEditorForm::LaunchImageViewerAppControl(const Tizen::Base::String& filePath)
1270 result r = E_SUCCESS;
1273 extraData.Construct();
1274 String typeKey = L"http://tizen.org/appcontrol/data/image/crop_mode";
1275 String typeVal = L"fit_to_screen";
1276 extraData.Add(new (std::nothrow) String(INPUT_KEY_IMAGEVIEWER_MODE), new (std::nothrow) String(INPUT_VALUE_IMAGEVIEWER_TYPE));
1278 AppControl* pAppControl = AppManager::FindAppControlN(PROVIDER_ID_IMAGEVIEWER, OPERATION_ID_CROP);
1280 if (pAppControl != null)
1282 r = pAppControl->Start(&filePath, null, &extraData, this);
1283 TryCatch(r == E_SUCCESS, , "[%s] Unable to launch app control", GetErrorMessage(r));
1290 extraData.RemoveAll(true);
1297 GroupEditorForm::OnContactsChanged(void)
1302 GroupEditorForm::OnCategoriesChanged(void)
1304 result r = E_SUCCESS;
1306 SceneManager* pSceneManager = SceneManager::GetInstance();
1308 SceneId previousSceneId;
1309 IListT<SceneId>* pHistoryList = pSceneManager->GetSceneHistoryN();
1310 if (pHistoryList != null)
1312 int count = pHistoryList->GetCount();
1313 r = pHistoryList->GetAt(count - 1, previousSceneId);
1314 delete pHistoryList;
1315 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to get previous scene id", GetErrorMessage(r));
1318 if (previousSceneId.Equals(IDSCN_CONTACT_DETAILS, true) || previousSceneId.Equals(IDSCN_CONTACT_EDITOR, true))
1320 if (__pPresentationModel->GetCategoryCount() > 0)
1322 ArrayList* pArg = new (std::nothrow) ArrayList();
1324 pArg->Add(new (std::nothrow) Integer(__pPresentationModel->GetCategoryId()));
1326 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), pArg);
1327 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go backward", GetErrorMessage(r));
1335 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
1336 TryReturnVoid(r == E_SUCCESS, "[%s] Unable to go backward", GetErrorMessage(r));
1341 GroupEditorForm::OnForeground(void)
1343 if ( File::IsFileExist(__pPresentationModel->GetThumbnailPath()) == false)
1345 __pPresentationModel->SetThumbnailPath(L"");
1346 __pTableView->RefreshItem(0, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1348 if (IsEnabled() == false)
1356 GroupEditorForm::OnBackground(void)