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 CtContactListEditorPanel.cpp
19 * @brief This is the implementation file for the ContactListEditorPanel class.
23 #include "CtContactListEditorPanel.h"
24 #include "CtContactListItem.h"
25 #include "CtContactListPresentationModel.h"
26 #include "CtContactsApp.h"
27 #include "CtMainForm.h"
28 #include "CtResourceManager.h"
29 #include "CtSceneRegister.h"
30 #include "CtSearchListItem.h"
31 #include "CtSearchListEventListener.h"
34 using namespace Tizen::App;
35 using namespace Tizen::Base;
36 using namespace Tizen::Base::Collection;
37 using namespace Tizen::Graphics;
38 using namespace Tizen::Ui;
39 using namespace Tizen::Ui::Controls;
40 using namespace Tizen::Ui::Scenes;
41 using namespace Tizen::Social;
43 static const int IDA_HEADER_CONTACTS = 10;
44 static const int IDA_HEADER_GROUPS = 11;
45 static const int IDA_HEADER_FAVORITES = 12;
46 static const int IDA_CHECK_SELECT_ALL_CHECKED = 20;
47 static const int IDA_CHECK_SELECT_ALL_UNCHECKED = 21;
48 static const int IDA_FOOTER_DELETE = 30;
49 static const int IDA_FOOTER_CANCEL = 31;
50 static const int IDA_FOOTER_DONE = 32;
51 static const int IDA_POPUP_CONTACT_VALUE_CLOSE = 40;
52 static const int IDA_POPUP_DELETE_CANCEL = 41;
54 static const int X_EMPTY_IMAGE = 220;
55 static const int Y_EMPTY_IMAGE = 300;
56 static const int W_EMPTY_IMAGE = 280;
57 static const int H_EMPTY_IMAGE = 280;
58 static const int Y_EMPTY_COMMENT = 618;
59 static const int H_EMPTY_COMMENT = 38;
60 static const int W_INITIAL_PANEL = 10;
61 static const int H_INITIAL_PANEL = 10;
62 static const int H_SELECT_ALL = 112;
63 static const int H_SEARCHBAR = 86;
64 static const int H_BOTTOM_LABEL = 48;
65 static const int H_GROUP_ITEM = 76;
66 static const int W_CONTACT_VALUE_POPUP = 688;
67 static const int H_CONTACT_VALUE_POPUP = 532;
68 static const int H_CONTACT_VALUE_POPUP_LIST_VIEW = 338;
69 static const int H_CLOSE_BUTTON = 74;
70 static const int Y_CLOSE_BUTTON = 358;
71 static const int W_CLOSE_BUTTON = 394;
72 static const int W_DELETE_POPUP = 688;
73 static const int H_DELETE_POPUP = 308;
74 static const int Y_DELETE_POPUP_TITLE = 20;
75 static const int H_DELETE_POPUP_ELEMENT = 60;
76 static const int H_DELETE_POPUP_PROGRESS = 34;
77 static const int Y_DELETE_POPUP_CANCEL_BUTTON = 214;
78 static const int H_DELETE_POPUP_CANCEL_BUTTON = 74;
79 static const int W_DELETE_POPUP_CANCEL_BUTTON = 394;
80 static const int X_LIST_ITEM_TEXT_MARGIN = 32;
81 static const int H_CHECK_LABEL = 72;
82 static const int Y_CHECK_LABEL = 20;
84 static const int FONT_SIZE_EMPTY_COMMENT = 32;
85 static const int FONT_SIZE_BOTTOM_LABEL = 32;
86 static const int FONT_SIZE_DELETE_POPUP_TEXT = 36;
88 static const unsigned int COLOR_EMPTY_COMMENT = Color32<102, 102, 102>::Value;
89 static const unsigned int COLOR_BOTTOM_LABEL_BG = Color32<68, 68, 68>::Value;
90 static const unsigned int COLOR_BOTTOM_LABEL_FONT = Color32<255, 255, 255>::Value;
91 static const unsigned int COLOR_DELETE_POPUP_TEXT = Color32<128, 128, 128>::Value;
92 static const unsigned int COLOR_CHECK_LABEL_BG = Color32<220, 218, 211>::Value;
94 static const int LIST_VIEW_GROUP_INDEX_SHIFT = 16;
95 static const int LIST_VIEW_MASK = 0xFFFF;
97 static const wchar_t* IDB_NO_CONTENTS = L"00_Nocontents_text.png";
99 ContactListEditorPanel::ContactListEditorPanel(void)
100 : __pTempContactValueHashMap(null)
103 , __pSearchListView(null)
105 , __pCheckLabel(null)
106 , __pEmptyImageLabel(null)
107 , __pEmptyCommentLabel(null)
108 , __pBottomLabel(null)
109 , __pMultipleContactValuePopup(null)
110 , __pDeletePopup(null)
111 , __changedSceneId(IDSCN_CONTACT_LIST_EDITOR)
112 , __pContactValueListEvent(null)
113 , __pPresentationModel(null)
114 , __pSearchListEvent(null)
115 , __isKeypadOpened(false)
116 , __isContactRemoved(false)
117 , __selectedIndex(-1)
118 , __selectedSearchIndex(-1)
119 , __deleteGroupIndex(0)
120 , __deleteItemIndex(0)
122 __deleteContactTimer.Construct(*this);
125 ContactListEditorPanel::~ContactListEditorPanel(void)
130 ContactListEditorPanel::Initialize(void)
132 Construct(Rectangle(0, 0, W_INITIAL_PANEL, H_INITIAL_PANEL));
136 ContactListEditorPanel::OnInitializing(void)
138 const Form* pForm = dynamic_cast<Form*>(GetParent());
141 Rectangle clientBounds = pForm->GetClientAreaBounds();
142 SetBounds(Rectangle(0, 0, clientBounds.width, clientBounds.height));
144 __pPresentationModel = ContactListPresentationModel::GetInstance();
146 __pCheckLabel = new (std::nothrow) Label();
147 __pCheckLabel->Construct(Rectangle(0, H_SEARCHBAR + Y_CHECK_LABEL, clientBounds.width, H_CHECK_LABEL), L"");
148 __pCheckLabel->SetBackgroundColor(COLOR_CHECK_LABEL_BG);
150 AddControl(__pCheckLabel);
152 __pSelectAll = new (std::nothrow) CheckButton();
153 __pSelectAll->Construct(Rectangle(0, H_SEARCHBAR, clientBounds.width, H_SELECT_ALL), CHECK_BUTTON_STYLE_MARK, BACKGROUND_STYLE_NONE);
154 __pSelectAll->SetText(ResourceManager::GetString(L"IDS_COM_BODY_SELECT_ALL"));
155 __pSelectAll->SetActionId(IDA_CHECK_SELECT_ALL_CHECKED, IDA_CHECK_SELECT_ALL_UNCHECKED);
156 __pSelectAll->AddActionEventListener(*this);
158 AddControl(__pSelectAll);
160 __pListView = new (std::nothrow) GroupedListView();
161 __pListView->Construct(Rectangle(0, H_SEARCHBAR + H_SELECT_ALL, clientBounds.width, clientBounds.height - H_SEARCHBAR - H_SELECT_ALL - H_BOTTOM_LABEL), GROUPED_LIST_VIEW_STYLE_INDEXED, true, true);
162 __pListView->SetItemProvider(*this);
163 __pListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_PB_BODY_NO_CONTACTS"));
164 __pListView->AddFastScrollListener(*this);
165 __pListView->AddGroupedListViewItemEventListener(*this);
166 __pListView->AddTouchEventListener(*this);
168 AddControl(__pListView);
170 __pSearchBar = new (std::nothrow) SearchBar();
171 __pSearchBar->Construct(Rectangle(0, 0, clientBounds.width, H_SEARCHBAR));
172 __pSearchBar->SetGuideText(ResourceManager::GetString(L"IDS_COM_BODY_SEARCH"));
173 __pSearchBar->AddSearchBarEventListener(*this);
174 __pSearchBar->AddTextEventListener(*this);
175 __pSearchBar->AddKeypadEventListener(*this);
176 __pSearchBar->SetContentAreaSize(Dimension(0, 0));
178 __pSearchListEvent = new (std::nothrow) SearchListEventListener(LIST_ANNEX_STYLE_MARK, __pPresentationModel);
180 AddControl(__pSearchBar);
182 __pSearchListView = new (std::nothrow) GroupedListView();
183 __pSearchListView->Construct(Rectangle(0, H_SEARCHBAR, clientBounds.width, clientBounds.height - H_SEARCHBAR), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
184 __pSearchListView->SetItemProvider(*__pSearchListEvent);
185 __pSearchListView->AddGroupedListViewItemEventListener(*this);
186 __pSearchListView->AddTouchEventListener(*this);
187 __pSearchListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_PB_BODY_NO_CONTACTS"));
188 __pSearchListView->SetShowState(false);
190 AddControl(__pSearchListView);
192 __pEmptyImageLabel = new (std::nothrow) Label();
193 __pEmptyImageLabel->Construct(Rectangle(X_EMPTY_IMAGE, Y_EMPTY_IMAGE, W_EMPTY_IMAGE, H_EMPTY_IMAGE), L"");
194 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_NO_CONTENTS);
197 __pEmptyImageLabel->SetBackgroundBitmap(*pBitmap);
200 __pEmptyImageLabel->SetShowState(false);
202 AddControl(__pEmptyImageLabel);
204 __pEmptyCommentLabel = new (std::nothrow) Label();
205 __pEmptyCommentLabel->Construct(Rectangle(0, Y_EMPTY_COMMENT, clientBounds.width, H_EMPTY_COMMENT),
206 ResourceManager::GetString(L"IDS_PB_BODY_NO_CONTACTS"));
207 __pEmptyCommentLabel->SetTextConfig(FONT_SIZE_EMPTY_COMMENT, LABEL_TEXT_STYLE_NORMAL);
208 __pEmptyCommentLabel->SetTextColor(Color(COLOR_EMPTY_COMMENT));
209 __pEmptyCommentLabel->SetShowState(false);
211 AddControl(__pEmptyCommentLabel);
213 __pBottomLabel = new (std::nothrow) Label();
214 __pBottomLabel->Construct(Rectangle(0, clientBounds.height - H_BOTTOM_LABEL, clientBounds.width, H_BOTTOM_LABEL),
215 ResourceManager::GetString(L"IDS_COM_POP_SELECTED") + INITIAL_SELECTED_COUNT);
216 __pBottomLabel->SetBackgroundColor(Color(COLOR_BOTTOM_LABEL_BG));
217 __pBottomLabel->SetTextColor(Color(COLOR_BOTTOM_LABEL_FONT));
218 __pBottomLabel->SetTextConfig(FONT_SIZE_BOTTOM_LABEL, LABEL_TEXT_STYLE_BOLD);
219 __pBottomLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
220 __pBottomLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
221 AddControl(__pBottomLabel);
223 __pTempContactValueHashMap = new (std::nothrow) HashMap();
224 __pTempContactValueHashMap->Construct();
230 ContactListEditorPanel::OnTerminating(void)
232 result r = E_SUCCESS;
234 if (__pPresentationModel != null)
236 __pPresentationModel->RemoveContactChangeListener(*this);
239 delete __pSearchListEvent;
241 __pTempContactValueHashMap->RemoveAll(true);
242 delete __pTempContactValueHashMap;
244 delete __pDeletePopup;
245 delete __pMultipleContactValuePopup;
251 ContactListEditorPanel::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
253 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
254 SceneManager* pSceneManager = SceneManager::GetInstance();
255 Form* pForm = dynamic_cast<Form*>(GetParent());
260 case IDA_HEADER_CONTACTS:
264 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
265 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK && pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_MULTI)
267 if (__isKeypadOpened)
269 __changedSceneId = IDSCN_CONTACT_LIST_EDITOR;
273 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_LIST_EDITOR));
278 if (__isKeypadOpened)
280 __changedSceneId = IDSCN_CONTACT_LIST_EDITOR;
284 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_LIST));
289 case IDA_HEADER_GROUPS:
293 if (__isKeypadOpened)
295 __changedSceneId = IDSCN_GROUP_LIST;
299 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_LIST));
303 case IDA_HEADER_FAVORITES:
307 if (__isKeypadOpened)
309 __changedSceneId = IDSCN_FAVORITE_LIST;
311 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
313 if (pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_SINGLE)
315 __changedSceneId = IDSCN_FAVORITE_LIST;
317 else if (pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_MULTI)
319 __changedSceneId = IDSCN_FAVORITE_LIST_EDITOR;
325 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
327 if (pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_SINGLE)
329 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FAVORITE_LIST));
331 else if (pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_MULTI)
333 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FAVORITE_LIST_EDITOR));
338 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FAVORITE_LIST));
342 case IDA_CHECK_SELECT_ALL_CHECKED:
344 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
346 int itemCount = __pListView->GetItemCountAt(groupIndex);
347 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
349 __pListView->SetItemChecked(groupIndex, itemIndex, true);
352 index |= groupIndex << LIST_VIEW_GROUP_INDEX_SHIFT;
354 Integer hashMapIndex(index);
356 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
358 if (__pTempContactValueHashMap->GetValue(hashMapIndex) == null)
360 String phoneNumber = __pPresentationModel->GetDefaultPhoneNumber(groupIndex, itemIndex);
361 __pTempContactValueHashMap->Add(*(new (std::nothrow) Integer(index)), *(new (std::nothrow) String(phoneNumber)));
364 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
366 if (__pTempContactValueHashMap->GetValue(hashMapIndex) == null)
368 String email = __pPresentationModel->GetDefaultEmail(groupIndex, itemIndex);
369 __pTempContactValueHashMap->Add(*(new (std::nothrow) Integer(index)), *(new (std::nothrow) String(email)));
374 __pListView->Invalidate(true);
378 case IDA_CHECK_SELECT_ALL_UNCHECKED:
380 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
382 int itemCount = __pListView->GetItemCountAt(groupIndex);
383 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
385 __pListView->SetItemChecked(groupIndex, itemIndex, false);
388 __pTempContactValueHashMap->RemoveAll(true);
389 __pListView->Invalidate(true);
393 case IDA_FOOTER_DELETE:
398 case IDA_FOOTER_CANCEL:
400 pSceneManager->GoBackward(BackwardSceneTransition());
403 case IDA_FOOTER_DONE:
405 ReturnMultipleValues();
408 case IDA_POPUP_CONTACT_VALUE_CLOSE:
410 HideContactValuePopup();
413 case IDA_POPUP_DELETE_CANCEL:
415 __deleteContactTimer.Cancel();
417 pSceneManager->GoBackward(BackwardSceneTransition());
426 ContactListEditorPanel::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
427 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
429 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
431 Form* pForm = dynamic_cast<Form*>(GetParent());
434 Header* pHeader = pForm->GetHeader();
435 pHeader->AddActionEventListener(*this);
437 Footer* pFooter = pForm->GetFooter();
438 pFooter->RemoveAllItems();
439 pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
440 pForm->SetFormMenuEventListener(null);
442 __pPresentationModel->InitializeContactList();
443 __pListView->SetFastScrollIndex(__pPresentationModel->GetAllKeys(), false);
444 __pListView->UpdateList();
446 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
448 if (__pPresentationModel->GetContactCount() == 0)
450 __pSearchBar->SetShowState(false);
451 __pCheckLabel->SetShowState(false);
452 __pSelectAll->SetShowState(false);
453 __pListView->SetShowState(false);
454 __pEmptyImageLabel->SetShowState(true);
455 __pEmptyCommentLabel->SetShowState(true);
456 __pBottomLabel->SetShowState(false);
461 FooterItem footerItemDone;
462 footerItemDone.Construct(IDA_FOOTER_DONE);
463 footerItemDone.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE"));
464 pFooter->AddItem(footerItemDone);
466 bool isChecked = false;
467 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount() && isChecked == false; groupIndex++)
469 int itemCount = __pListView->GetItemCountAt(groupIndex);
470 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
472 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
480 if (isChecked == false)
482 pFooter->SetItemEnabled(0, false);
488 __pSelectAll->SetSelected(false);
489 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
491 int itemCount = __pListView->GetItemCountAt(groupIndex);
492 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
494 __pListView->SetItemChecked(groupIndex, itemIndex, false);
498 FooterItem footerDelete;
499 footerDelete.Construct(IDA_FOOTER_DELETE);
500 footerDelete.SetText(ResourceManager::GetString(L"IDS_COM_SK_DELETE"));
502 FooterItem footerCancel;
503 footerCancel.Construct(IDA_FOOTER_CANCEL);
504 footerCancel.SetText(ResourceManager::GetString(L"IDS_PB_SK_CANCEL"));
505 pFooter->AddItem(footerDelete);
506 pFooter->AddItem(footerCancel);
507 pFooter->SetItemEnabled(0, false);
510 __pPresentationModel->AddContactChangeListener(*this);
511 pFooter->AddActionEventListener(*this);
516 pArgs->RemoveAll(true);
522 ContactListEditorPanel::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
523 const Tizen::Ui::Scenes::SceneId& nextSceneId)
525 Form* pForm = dynamic_cast<Form*>(GetParent());
528 if (pForm->IsFooterVisible() == false)
530 pForm->SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
533 Header* pHeader = pForm->GetHeader();
534 pHeader->RemoveActionEventListener(*this);
536 Footer* pFooter = pForm->GetFooter();
537 pFooter->RemoveActionEventListener(*this);
539 if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
541 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
544 __pPresentationModel->RemoveContactChangeListener(*this);
548 ContactListEditorPanel::RemoveContactList(void)
550 result r = E_FAILURE;
552 for (int groupIndex = __deleteGroupIndex; groupIndex < __pListView->GetGroupCount(); groupIndex++)
554 int itemCount = __pListView->GetItemCountAt(groupIndex);
555 for (int itemIndex = __deleteItemIndex; itemIndex < itemCount; itemIndex++)
557 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
559 r = __pPresentationModel->RemoveContact(groupIndex, itemIndex, false);
561 __deleteGroupIndex = groupIndex;
562 __deleteItemIndex = ++itemIndex;
567 __deleteItemIndex = 0;
570 __deleteGroupIndex = 0;
571 __deleteItemIndex = 0;
577 ContactListEditorPanel::GetCheckedContactCounts(void)
579 int contactCount = 0;
581 for (int groupIndex = __deleteGroupIndex; groupIndex < __pListView->GetGroupCount(); groupIndex++)
583 int itemCount = __pListView->GetItemCountAt(groupIndex);
584 for (int itemIndex = __deleteItemIndex; itemIndex < itemCount; itemIndex++)
586 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
596 Tizen::Ui::Controls::ListItemBase*
597 ContactListEditorPanel::CreateItem(int groupIndex, int itemIndex, int itemWidth)
600 Bitmap* pThumbnail = null;
602 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
604 CustomItem* pItem = new (std::nothrow) CustomItem();
605 pItem->Construct(Dimension(itemWidth, pContactsApp->GetListItemSingleLineHeight()), LIST_ANNEX_STYLE_MARK);
607 __pPresentationModel->GetContactItemInfoN(groupIndex, itemIndex, name, pThumbnail);
609 ContactListItem* pCustomElement = new (std::nothrow) ContactListItem(name, pThumbnail);
610 pItem->AddElement(Rectangle(0, 0, itemWidth - (ListItemBase::GetAnnexWidth(LIST_ANNEX_STYLE_MARK) + X_LIST_ITEM_TEXT_MARGIN), pContactsApp->GetListItemSingleLineHeight()), 0, *(static_cast<ICustomElement *>(pCustomElement)));
616 ContactListEditorPanel::DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
625 ContactListEditorPanel::GetItemCount(int groupIndex)
627 return __pPresentationModel->GetContactCount(groupIndex);
631 ContactListEditorPanel::GetGroupCount(void)
633 return __pPresentationModel->GetKeyCount();
636 Tizen::Ui::Controls::GroupItem*
637 ContactListEditorPanel::CreateGroupItem(int groupIndex, int itemWidth)
639 GroupItem* pItem = new (std::nothrow) GroupItem();
640 pItem->Construct(Dimension(itemWidth, H_GROUP_ITEM));
641 pItem->SetElement(__pPresentationModel->GetKey(groupIndex), null);
647 ContactListEditorPanel::DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::GroupItem* pItem, int itemWidth)
656 ContactListEditorPanel::OnSearchBarModeChanged(Tizen::Ui::Controls::SearchBar& source, Tizen::Ui::Controls::SearchBarMode mode)
658 if (mode == SEARCH_BAR_MODE_NORMAL)
660 int count = __pPresentationModel->GetSearchedContactCount();
661 bool isChecked = true;
663 for (int index = 0; index < count; index++)
668 __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
670 __pListView->SetItemChecked(groupIndex, itemIndex, __pSearchListView->IsItemChecked(0, index));
673 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount() && isChecked == true; groupIndex++)
675 int itemCount = __pListView->GetItemCountAt(groupIndex);
676 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
678 if (__pListView->IsItemChecked(groupIndex, itemIndex) == false)
686 __pListView->SetShowState(true);
687 __pListView->Invalidate(true);
688 __pCheckLabel->SetShowState(true);
689 __pSelectAll->SetShowState(true);
690 __pSelectAll->SetSelected(isChecked);
691 __pSearchListView->SetShowState(false);
692 __pPresentationModel->ResetSearchedContactList();
693 __pSearchListView->UpdateList();
698 ContactListEditorPanel::OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
703 ContactListEditorPanel::OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus status)
705 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
707 int mainGroupIndex = groupIndex;
708 int mainItemIndex = itemIndex;
710 if (listView.Equals(*__pSearchListView) == true)
712 __selectedSearchIndex = 0;
713 __selectedSearchIndex |= groupIndex << LIST_VIEW_GROUP_INDEX_SHIFT;
714 __selectedSearchIndex |= itemIndex;
716 __pPresentationModel->GetItemMainIndex(itemIndex, mainGroupIndex, mainItemIndex);
720 __selectedIndex |= mainGroupIndex << LIST_VIEW_GROUP_INDEX_SHIFT;
721 __selectedIndex |= mainItemIndex;
723 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
725 if (listView.IsItemChecked(groupIndex, itemIndex) == true)
728 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
730 pList = __pPresentationModel->GetAllPhoneNumbersN(mainGroupIndex, mainItemIndex);
734 ReturnResultFailed();
738 if (pList->GetCount() > 1)
740 listView.SetItemChecked(groupIndex, itemIndex, false);
741 __pContactValueListEvent = new (std::nothrow) ContactValueListItemProvider(pList);
742 ShowContactValuePopup(mainGroupIndex, mainItemIndex);
744 else if (pList->GetCount() == 1)
746 String* pContactValueInfo = static_cast<String *>(pList->GetAt(0));
748 pContactValueInfo->IndexOf(CHARACTER_SPACE, 0, blankIndex);
749 pContactValueInfo->Remove(0, blankIndex + 1);
750 __pTempContactValueHashMap->Add(*(new (std::nothrow) Integer(__selectedIndex)), *(new (std::nothrow) String(*pContactValueInfo)));
755 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
757 pList = __pPresentationModel->GetAllEmailsN(mainGroupIndex, mainItemIndex);
761 ReturnResultFailed();
765 if (pList->GetCount() > 1)
767 listView.SetItemChecked(groupIndex, itemIndex, false);
768 __pContactValueListEvent = new (std::nothrow) ContactValueListItemProvider(pList);
769 ShowContactValuePopup(mainGroupIndex, mainItemIndex);
771 else if (pList->GetCount() == 1)
773 String* pContactValueInfo = static_cast<String *>(pList->GetAt(0));
775 pContactValueInfo->IndexOf(CHARACTER_SPACE, 0, blankIndex);
776 pContactValueInfo->Remove(0, blankIndex + 1);
777 __pTempContactValueHashMap->Add(*(new (std::nothrow) Integer(__selectedIndex)), *(new (std::nothrow) String(*pContactValueInfo)));
785 Integer keyIndex(__selectedIndex);
786 __pTempContactValueHashMap->Remove(keyIndex, true);
790 if (listView.Equals(*__pListView) == true)
792 if (listView.IsItemChecked(groupIndex, itemIndex) == true)
794 bool isChecked = true;
795 for (int groupIndex = 0; groupIndex < listView.GetGroupCount() && isChecked == true; groupIndex++)
797 int itemCount = listView.GetItemCountAt(groupIndex);
798 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
800 if (listView.IsItemChecked(groupIndex, itemIndex) == false)
807 __pSelectAll->SetSelected(isChecked);
809 else if (listView.IsItemChecked(groupIndex, itemIndex) == false)
811 __pSelectAll->SetSelected(false);
814 else if (listView.Equals(*__pSearchListView) == true)
816 int count = __pPresentationModel->GetSearchedContactCount();
818 for (int index = 0; index < count; index++)
823 __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
825 __pListView->SetItemChecked(groupIndex, itemIndex, __pSearchListView->IsItemChecked(0, index));
833 ContactListEditorPanel::OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction)
838 ContactListEditorPanel::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
843 ContactListEditorPanel::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
845 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
847 int groupIndex = (__selectedIndex >> LIST_VIEW_GROUP_INDEX_SHIFT) & LIST_VIEW_MASK;
848 int itemIndex = __selectedIndex & LIST_VIEW_MASK;
851 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
853 pList = __pPresentationModel->GetAllPhoneNumbersN(groupIndex, itemIndex);
855 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
857 pList = __pPresentationModel->GetAllEmailsN(groupIndex, itemIndex);
862 ReturnResultFailed();
866 String* pContactValueInfo = static_cast<String *>(pList->GetAt(index));
868 pContactValueInfo->IndexOf(CHARACTER_SPACE, 0, blankIndex);
869 pContactValueInfo->Remove(0, blankIndex + 1);
870 __pTempContactValueHashMap->Add(*(new (std::nothrow) Integer(__selectedIndex)), *(new (std::nothrow) String(*pContactValueInfo)));
874 HideContactValuePopup();
876 if (__pListView->GetShowState() == true)
878 __pListView->SetItemChecked(groupIndex, itemIndex, true);
880 bool isChecked = true;
881 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount() && isChecked == true; groupIndex++)
883 int itemCount = __pListView->GetItemCountAt(groupIndex);
884 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
886 if (__pListView->IsItemChecked(groupIndex, itemIndex) == false)
894 __pSelectAll->SetSelected(isChecked);
898 groupIndex = (__selectedSearchIndex >> LIST_VIEW_GROUP_INDEX_SHIFT) & LIST_VIEW_MASK;
899 itemIndex = __selectedSearchIndex & LIST_VIEW_MASK;
900 __pSearchListView->SetItemChecked(groupIndex, itemIndex, true);
902 int count = __pPresentationModel->GetSearchedContactCount();
904 for (int index = 0; index < count; index++)
906 __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
908 __pListView->SetItemChecked(groupIndex, itemIndex, __pSearchListView->IsItemChecked(0, index));
916 ContactListEditorPanel::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
921 ContactListEditorPanel::OnFastScrollIndexSelected(Tizen::Ui::Control& source, Tizen::Base::String& index)
923 __pListView->ScrollToItem(__pPresentationModel->GetKeyIndex(index), -1);
924 __pListView->Invalidate(false);
928 ContactListEditorPanel::OnTextValueChanged(const Tizen::Ui::Control& source)
930 String searchText = __pSearchBar->GetText();
933 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
934 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
936 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_HAS_PHONE_ONLY);
938 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
940 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_HAS_EMAIL_ONLY);
944 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_NORMAL);
947 if (searchText.GetLength() != 0)
949 __pCheckLabel->SetShowState(false);
950 __pSelectAll->SetShowState(false);
951 __pListView->SetShowState(false);
952 __pSearchListView->SetShowState(true);
954 __pSearchListView->UpdateList();
956 int count = __pPresentationModel->GetSearchedContactCount();
958 for (int index = 0; index < count; index++)
963 __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
964 __pSearchListView->SetItemChecked(0, index, __pListView->IsItemChecked(groupIndex, itemIndex));
967 __pSearchListView->Invalidate(true);
971 __pCheckLabel->SetShowState(true);
972 __pSelectAll->SetShowState(true);
973 __pListView->SetShowState(true);
974 __pSearchListView->SetShowState(false);
976 int count = __pPresentationModel->GetSearchedContactCount();
977 bool isChecked = true;
979 for (int index = 0; index < count; index++)
984 __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
985 __pListView->SetItemChecked(groupIndex, itemIndex, __pSearchListView->IsItemChecked(0, index));
988 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount() && isChecked == true; groupIndex++)
990 int itemCount = __pListView->GetItemCountAt(groupIndex);
991 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
993 if (__pListView->IsItemChecked(groupIndex, itemIndex) == false)
1001 __pSelectAll->SetSelected(isChecked);
1002 __pListView->Invalidate(true);
1007 ContactListEditorPanel::OnTextValueChangeCanceled(const Tizen::Ui::Control& source)
1012 ContactListEditorPanel::OnContactsChanged(void)
1014 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1015 Form* pForm = dynamic_cast<Form*>(GetParent());
1018 HideContactValuePopup();
1020 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
1022 Footer* pFooter = pForm->GetFooter();
1023 pFooter->RemoveAllItems();
1025 __pPresentationModel->InitializeContactList();
1027 if (__pPresentationModel->GetContactCount() == 0)
1029 __pSearchBar->SetShowState(false);
1030 __pCheckLabel->SetShowState(false);
1031 __pSelectAll->SetShowState(false);
1032 __pListView->SetShowState(false);
1033 __pEmptyImageLabel->SetShowState(true);
1034 __pEmptyCommentLabel->SetShowState(true);
1035 __pBottomLabel->SetShowState(false);
1039 FooterItem footerItemDone;
1040 footerItemDone.Construct(IDA_FOOTER_DONE);
1041 footerItemDone.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE"));
1042 pFooter->AddItem(footerItemDone);
1044 if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
1046 Form* pForm = dynamic_cast<Form*>(GetParent());
1049 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
1053 __pListView->SetShowState(true);
1054 __pSelectAll->SetShowState(true);
1055 __pCheckLabel->SetShowState(true);
1057 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
1059 int itemCount = __pListView->GetItemCountAt(groupIndex);
1060 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
1062 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
1064 __pListView->SetItemChecked(groupIndex, itemIndex, false);
1069 pFooter->SetItemEnabled(0, false);
1071 __pSearchBar->SetShowState(true);
1072 __pSelectAll->SetSelected(false);
1073 __pEmptyImageLabel->SetShowState(false);
1074 __pEmptyCommentLabel->SetShowState(false);
1075 UpdateBottomLabel();
1077 __pListView->SetFastScrollIndex(__pPresentationModel->GetAllKeys(), false);
1078 __pListView->UpdateList();
1081 else if (__isContactRemoved == false)
1083 __pPresentationModel->InitializeContactList();
1084 if( __pPresentationModel->GetContactCount() == 0)
1086 SceneManager* pSceneManager = SceneManager::GetInstance();
1087 pSceneManager->GoBackward(BackwardSceneTransition());
1090 if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
1092 Form* pForm = dynamic_cast<Form*>(GetParent());
1095 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
1098 __pSelectAll->SetSelected(false);
1100 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
1102 int itemCount = __pListView->GetItemCountAt(groupIndex);
1103 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
1105 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
1107 __pListView->SetItemChecked(groupIndex, itemIndex, false);
1111 UpdateBottomLabel();
1112 __pListView->SetFastScrollIndex(__pPresentationModel->GetAllKeys(), false);
1113 __pListView->UpdateList();
1118 ContactListEditorPanel::OnCategoriesChanged(void)
1123 ContactListEditorPanel::UpdateBottomLabel(void)
1125 int selectedCount = 0;
1126 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
1128 int itemCount = __pListView->GetItemCountAt(groupIndex);
1129 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
1131 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
1138 String selected = ResourceManager::GetString(L"IDS_COM_POP_SELECTED");
1139 selected.Append(L" (");
1140 selected.Append(selectedCount);
1141 selected.Append(L")");
1142 __pBottomLabel->SetText(selected);
1143 __pBottomLabel->Invalidate(false);
1145 Form* pForm = dynamic_cast<Form*>(GetParent());
1148 Footer* pFooter = pForm->GetFooter();
1150 if (selectedCount > 0)
1152 __pBottomLabel->SetShowState(true);
1153 __pListView->SetSize(__pListView->GetSize().width, pForm->GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSelectAll->GetHeight() - H_BOTTOM_LABEL);
1154 __pSearchListView->SetSize(__pSearchListView->GetSize().width, pForm->GetClientAreaBounds().height - __pSearchBar->GetHeight());
1155 pFooter->SetItemEnabled(0, true);
1159 __pBottomLabel->SetShowState(false);
1160 __pListView->SetSize(__pListView->GetSize().width, pForm->GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSelectAll->GetHeight());
1161 __pSearchListView->SetSize(__pSearchListView->GetSize().width, pForm->GetClientAreaBounds().height - __pSearchBar->GetHeight());
1162 pFooter->SetItemEnabled(0, false);
1165 pFooter->Invalidate(true);
1171 ContactListEditorPanel::ShowContactValuePopup(int groupIndex, int itemIndex)
1173 delete __pMultipleContactValuePopup;
1174 __pMultipleContactValuePopup = new (std::nothrow) Popup();
1175 __pMultipleContactValuePopup->Construct(true, Dimension(W_CONTACT_VALUE_POPUP, H_CONTACT_VALUE_POPUP));
1176 __pMultipleContactValuePopup->SetTitleText(__pPresentationModel->GetName(groupIndex, itemIndex));
1177 __pMultipleContactValuePopup->SetPropagatedKeyEventListener(this);
1179 Rectangle popupClientBounds = __pMultipleContactValuePopup->GetClientAreaBounds();
1181 ListView* pListView = new (std::nothrow) ListView();
1182 pListView->Construct(Rectangle(0, 0, popupClientBounds.width, H_CONTACT_VALUE_POPUP_LIST_VIEW));
1183 pListView->SetItemProvider(*__pContactValueListEvent);
1184 pListView->AddListViewItemEventListener(*this);
1186 __pMultipleContactValuePopup->AddControl(pListView);
1188 Button* pCancelButton = new (std::nothrow) Button();
1189 pCancelButton->Construct(Rectangle((popupClientBounds.width - W_CLOSE_BUTTON) / 2, Y_CLOSE_BUTTON, W_CLOSE_BUTTON, H_CLOSE_BUTTON), ResourceManager::GetString(L"IDS_COM_POP_CLOSE"));
1190 pCancelButton->SetActionId(IDA_POPUP_CONTACT_VALUE_CLOSE);
1191 pCancelButton->AddActionEventListener(*this);
1193 __pMultipleContactValuePopup->AddControl(pCancelButton);
1194 __pMultipleContactValuePopup->SetShowState(true);
1195 __pMultipleContactValuePopup->Show();
1199 ContactListEditorPanel::HideContactValuePopup(void)
1201 if (__pMultipleContactValuePopup != null)
1203 __pMultipleContactValuePopup->SetShowState(false);
1209 ContactListEditorPanel::ShowDeletePopup(void)
1211 if (__pDeletePopup != null)
1213 delete __pDeletePopup;
1216 __pDeletePopup = new (std::nothrow) Popup();
1217 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
1218 __pDeletePopup->AddWindowEventListener(*this);
1220 Rectangle clientBounds = __pDeletePopup->GetClientAreaBounds();
1222 Label* pLabelTitle = new (std::nothrow) Label();
1223 pLabelTitle->Construct(Rectangle(0, Y_DELETE_POPUP_TITLE, clientBounds.width, H_DELETE_POPUP_ELEMENT), ResourceManager::GetString(L"IDS_PB_POP_DELETING_CONTACTS_ING"));
1224 pLabelTitle->SetTextColor(COLOR_DELETE_POPUP_TEXT);
1225 pLabelTitle->SetTextConfig(FONT_SIZE_DELETE_POPUP_TEXT, LABEL_TEXT_STYLE_BOLD);
1226 pLabelTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1228 __pDeletePopup->AddControl(pLabelTitle);
1230 Progress* pProgress = new (std::nothrow) Progress();
1231 pProgress->Construct(Rectangle(0, Y_DELETE_POPUP_TITLE + H_DELETE_POPUP_ELEMENT, clientBounds.width, H_DELETE_POPUP_PROGRESS), 0, GetCheckedContactCounts());
1233 __pDeletePopup->AddControl(pProgress);
1235 Label* pLabelPercentage = new (std::nothrow) Label();
1236 pLabelPercentage->Construct(Rectangle(0, pProgress->GetY() + pProgress->GetHeight(), clientBounds.width / 2, H_DELETE_POPUP_ELEMENT), Integer::ToString(pProgress->GetPercentComplete()) + L"%");
1237 pLabelPercentage->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1238 pLabelPercentage->SetTextColor(COLOR_DELETE_POPUP_TEXT);
1239 pLabelPercentage->SetTextConfig(FONT_SIZE_DELETE_POPUP_TEXT, LABEL_TEXT_STYLE_NORMAL);
1241 __pDeletePopup->AddControl(pLabelPercentage);
1243 String currentOfTotal(Integer::ToString(pProgress->GetValue()) + L" / " + Integer::ToString(GetCheckedContactCounts()));
1244 Label* pLabelTotal = new (std::nothrow) Label();
1245 pLabelTotal->Construct(Rectangle(clientBounds.width / 2, pLabelPercentage->GetY(), clientBounds.width / 2, H_DELETE_POPUP_ELEMENT), currentOfTotal);
1246 pLabelTotal->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
1247 pLabelTotal->SetTextColor(COLOR_DELETE_POPUP_TEXT);
1248 pLabelTotal->SetTextConfig(FONT_SIZE_DELETE_POPUP_TEXT, LABEL_TEXT_STYLE_NORMAL);
1250 __pDeletePopup->AddControl(pLabelTotal);
1252 Button* pCancelButton = new (std::nothrow) Button();
1253 pCancelButton->Construct(Rectangle((clientBounds.width - W_DELETE_POPUP_CANCEL_BUTTON) / 2, Y_DELETE_POPUP_CANCEL_BUTTON, W_DELETE_POPUP_CANCEL_BUTTON, H_DELETE_POPUP_CANCEL_BUTTON));
1254 pCancelButton->SetText(ResourceManager::GetString("IDS_PB_SK_CANCEL"));
1255 pCancelButton->SetActionId(IDA_POPUP_DELETE_CANCEL);
1256 pCancelButton->AddActionEventListener(*this);
1258 __pDeletePopup->AddControl(pCancelButton);
1259 __pDeletePopup->Show();
1261 __isContactRemoved = true;
1265 ContactListEditorPanel::HideDeletePopup(void)
1267 delete __pDeletePopup;
1268 __pDeletePopup = null;
1270 __isContactRemoved = false;
1272 __pListView->UpdateList();
1277 ContactListEditorPanel::ReturnValues(RequestId requestId, Tizen::App::AppCtrlResult appCtrlResult, const Tizen::Base::Collection::IMap* pReturnValue)
1279 AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance();
1280 result r = pAppManager->SendAppControlResult(requestId, appCtrlResult, pReturnValue);
1281 AppLogDebug("[%s] The return result from SendAppControlResult(), AppCtrlResult value : %d.", GetErrorMessage(r), appCtrlResult);
1283 UiApp::GetInstance()->Terminate();
1287 ContactListEditorPanel::ReturnMultipleValues(void)
1289 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1291 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
1293 ArrayList* pValueList = new (std::nothrow) ArrayList();
1294 pValueList->Construct();
1296 HashMap* pReturnValue = new (std::nothrow) HashMap();
1297 pReturnValue->Construct();
1299 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
1301 IMapEnumerator* pMapEnum = __pTempContactValueHashMap->GetMapEnumeratorN();
1302 while (pMapEnum->MoveNext() == E_SUCCESS)
1304 String* pValue = static_cast<String*> (pMapEnum->GetValue());
1305 pValueList->Add(new (std::nothrow) String(*pValue));
1307 pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_PHONE), pValueList);
1311 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
1313 IMapEnumerator* pMapEnum = __pTempContactValueHashMap->GetMapEnumeratorN();
1314 while (pMapEnum->MoveNext() == E_SUCCESS)
1316 String* pValue = static_cast<String*> (pMapEnum->GetValue());
1317 pValueList->Add(new (std::nothrow) String(*pValue));
1319 pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_EMAIL), pValueList);
1323 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_ITEM_ID)
1325 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
1327 int itemCount = __pListView->GetItemCountAt(groupIndex);
1328 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
1330 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
1333 contactId.Append(__pPresentationModel->GetContactId(groupIndex, itemIndex));
1334 pValueList->Add(new (std::nothrow) String(contactId));
1338 pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_ITEM_ID), pValueList);
1344 ReturnValues(pContactsApp->GetRequestId(), APP_CTRL_RESULT_FAILED, pReturnValue);
1349 ReturnValues(pContactsApp->GetRequestId(), APP_CTRL_RESULT_SUCCEEDED, pReturnValue);
1354 ContactListEditorPanel::ReturnResultFailed(void)
1356 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1358 ReturnValues(pContactsApp->GetRequestId(), APP_CTRL_RESULT_FAILED, null);
1362 ContactListEditorPanel::OnKeypadWillOpen(Tizen::Ui::Control& source)
1367 ContactListEditorPanel::OnKeypadOpened(Tizen::Ui::Control& source)
1369 Form* pForm = dynamic_cast<Form*>(GetParent());
1372 pForm->SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, false);
1373 __isKeypadOpened = true;
1377 ContactListEditorPanel::OnKeypadClosed(Tizen::Ui::Control& source)
1379 Form* pForm = dynamic_cast<Form*>(GetParent());
1382 pForm->SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
1383 pForm->Invalidate(true);
1384 __isKeypadOpened = false;
1386 if (SceneManager::GetInstance()->GetCurrentSceneId() == IDSCN_CONTACT_LIST_EDITOR)
1388 UpdateBottomLabel();
1391 if (__changedSceneId.Equals(IDSCN_CONTACT_LIST_EDITOR, true) == false)
1393 SceneManager* pSceneManager = SceneManager::GetInstance();
1394 pSceneManager->GoForward(ForwardSceneTransition(__changedSceneId));
1396 __changedSceneId = IDSCN_CONTACT_LIST_EDITOR;
1401 ContactListEditorPanel::OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction)
1403 if (keypadAction == KEYPAD_ACTION_SEARCH)
1405 __pSearchBar->HideKeypad();
1410 ContactListEditorPanel::OnWindowActivated (const Tizen::Ui::Window &source)
1412 __deleteContactTimer.Start(1);
1416 ContactListEditorPanel::OnWindowDeactivated (const Tizen::Ui::Window &source)
1421 ContactListEditorPanel::OnTimerExpired(Tizen::Base::Runtime::Timer &timer)
1423 Progress* pProgress = static_cast<Progress *>(__pDeletePopup->GetControl(1));
1425 pProgress->SetValue(pProgress->GetValue() + 1);
1426 pProgress->Invalidate(false);
1428 Label* pLabelPercentage = static_cast<Label *>(__pDeletePopup->GetControl(2));
1430 pLabelPercentage->SetText(Integer::ToString(pProgress->GetPercentComplete()) + L"%");
1431 pLabelPercentage->Invalidate(false);
1433 Label* pLabelTotal = static_cast<Label *>(__pDeletePopup->GetControl(3));
1435 String currentOfTotal = pLabelTotal->GetText();
1436 currentOfTotal.Remove(0, Integer::ToString(pProgress->GetValue() - 1).GetLength());
1437 currentOfTotal.Insert(Integer::ToString(pProgress->GetValue()), 0);
1438 pLabelTotal->SetText(currentOfTotal);
1439 pLabelTotal->Invalidate(false);
1441 if (RemoveContactList() == E_SUCCESS)
1443 __deleteContactTimer.Start(1);
1447 SceneManager* pSceneManager = SceneManager::GetInstance();
1448 pSceneManager->GoBackward(BackwardSceneTransition());
1453 ContactListEditorPanel::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo & touchInfo)
1455 GroupedListView* pList = static_cast<GroupedListView*>(&const_cast<Control&>(source));
1463 ContactListEditorPanel::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1468 ContactListEditorPanel::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1473 ContactListEditorPanel::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1478 ContactListEditorPanel::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1483 ContactListEditorPanel::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
1489 ContactListEditorPanel::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
1491 if (keyEventInfo.GetKeyCode() == KEY_BACK)
1493 if (__pMultipleContactValuePopup && __pMultipleContactValuePopup->GetShowState() == true)
1495 HideContactValuePopup();
1503 ContactListEditorPanel::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
1509 ContactListEditorPanel::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)