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_OK = 41;
53 static const int IDA_POPUP_DELETE_CANCEL = 42;
54 static const int IDA_POPUP_DELETE_PROGRESS_CANCEL = 43;
56 static const int X_EMPTY_IMAGE = 220;
57 static const int Y_EMPTY_IMAGE = 300;
58 static const int W_EMPTY_IMAGE = 280;
59 static const int H_EMPTY_IMAGE = 280;
60 static const int Y_EMPTY_COMMENT = 618;
61 static const int H_EMPTY_COMMENT = 38;
62 static const int W_INITIAL_PANEL = 10;
63 static const int H_INITIAL_PANEL = 10;
64 static const int H_SELECT_ALL = 112;
65 static const int H_SEARCHBAR = 86;
66 static const int H_BOTTOM_LABEL = 48;
67 static const int H_GROUP_ITEM = 76;
68 static const int W_CONTACT_VALUE_POPUP = 688;
69 static const int H_CONTACT_VALUE_POPUP = 532;
70 static const int H_CONTACT_VALUE_POPUP_LIST_VIEW = 338;
71 static const int H_CLOSE_BUTTON = 74;
72 static const int Y_CLOSE_BUTTON = 358;
73 static const int W_CLOSE_BUTTON = 394;
74 static const int H_DELETE_PROGRESS_POPUP = 308;
75 static const int Y_DELETE_POPUP_TITLE = 20;
76 static const int H_DELETE_POPUP_ELEMENT = 60;
77 static const int H_DELETE_POPUP_PROGRESS = 34;
78 static const int Y_DELETE_POPUP_CANCEL_BUTTON = 214;
79 static const int H_DELETE_POPUP_CANCEL_BUTTON = 74;
80 static const int W_DELETE_POPUP_CANCEL_BUTTON = 394;
81 static const int X_LIST_ITEM_TEXT_MARGIN = 32;
82 static const int H_CHECK_LABEL = 72;
83 static const int Y_CHECK_LABEL = 20;
85 static const int FONT_SIZE_EMPTY_COMMENT = 32;
86 static const int FONT_SIZE_BOTTOM_LABEL = 32;
87 static const int FONT_SIZE_DELETE_POPUP_TEXT = 36;
89 static const unsigned int COLOR_EMPTY_COMMENT = Color32<102, 102, 102>::Value;
90 static const unsigned int COLOR_BOTTOM_LABEL_BG = Color32<68, 68, 68>::Value;
91 static const unsigned int COLOR_BOTTOM_LABEL_FONT = Color32<255, 255, 255>::Value;
92 static const unsigned int COLOR_DELETE_POPUP_TEXT = Color32<128, 128, 128>::Value;
93 static const unsigned int COLOR_CHECK_LABEL_BG = Color32<220, 218, 211>::Value;
94 static const unsigned int COLOR_DELETE_BUTTON_NORMAL = Color32<213, 82, 82>::Value;
95 static const unsigned int COLOR_DELETE_BUTTON_PRESSED = Color32<194, 71, 71>::Value;
96 static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Value;
98 static const int LIST_VIEW_GROUP_INDEX_SHIFT = 16;
99 static const int LIST_VIEW_MASK = 0xFFFF;
101 static const wchar_t* IDB_NO_CONTENTS = L"00_Nocontents_text.png";
103 ContactListEditorPanel::ContactListEditorPanel(void)
104 : __pTempContactValueHashMap(null)
107 , __pSearchListView(null)
109 , __pCheckLabel(null)
110 , __pEmptyImageLabel(null)
111 , __pEmptyCommentLabel(null)
112 , __pBottomLabel(null)
113 , __pMultipleContactValuePopup(null)
114 , __pDeleteProgressPopup(null)
115 , __pDeleteConfirmationPopup(null)
116 , __pContactValueListEvent(null)
117 , __pPresentationModel(null)
118 , __pSearchListEvent(null)
119 , __isContactRemoved(false)
120 , __selectedIndex(-1)
121 , __selectedSearchIndex(-1)
122 , __deleteGroupIndex(0)
123 , __deleteItemIndex(0)
125 __deleteContactTimer.Construct(*this);
128 ContactListEditorPanel::~ContactListEditorPanel(void)
133 ContactListEditorPanel::Initialize(void)
135 Construct(Rectangle(0, 0, W_INITIAL_PANEL, H_INITIAL_PANEL));
139 ContactListEditorPanel::OnInitializing(void)
141 const Form* pForm = dynamic_cast<Form*>(GetParent());
144 FloatRectangle clientBounds = pForm->GetClientAreaBoundsF();
145 SetBounds(FloatRectangle(0, 0, clientBounds.width, clientBounds.height));
147 __pPresentationModel = ContactListPresentationModel::GetInstance();
149 __pCheckLabel = new (std::nothrow) Label();
150 __pCheckLabel->Construct(Rectangle(0, H_SEARCHBAR + Y_CHECK_LABEL, clientBounds.width, H_CHECK_LABEL), L"");
151 __pCheckLabel->SetBackgroundColor(COLOR_CHECK_LABEL_BG);
153 AddControl(__pCheckLabel);
155 __pSelectAll = new (std::nothrow) CheckButton();
156 __pSelectAll->Construct(Rectangle(0, H_SEARCHBAR, clientBounds.width, H_SELECT_ALL), CHECK_BUTTON_STYLE_MARK, BACKGROUND_STYLE_NONE);
157 __pSelectAll->SetText(ResourceManager::GetString(L"IDS_COM_BODY_SELECT_ALL"));
158 __pSelectAll->SetActionId(IDA_CHECK_SELECT_ALL_CHECKED, IDA_CHECK_SELECT_ALL_UNCHECKED);
159 __pSelectAll->AddActionEventListener(*this);
161 AddControl(__pSelectAll);
163 __pListView = new (std::nothrow) GroupedListView();
164 __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);
165 __pListView->SetItemProvider(*this);
166 __pListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_PB_BODY_NO_CONTACTS"));
167 __pListView->AddFastScrollListener(*this);
168 __pListView->AddGroupedListViewItemEventListener(*this);
169 __pListView->AddTouchEventListener(*this);
171 AddControl(__pListView);
173 __pSearchBar = new (std::nothrow) SearchBar();
174 __pSearchBar->Construct(Rectangle(0, 0, clientBounds.width, H_SEARCHBAR));
175 __pSearchBar->SetGuideText(ResourceManager::GetString(L"IDS_COM_BODY_SEARCH"));
176 __pSearchBar->AddSearchBarEventListener(*this);
177 __pSearchBar->AddTextEventListener(*this);
178 __pSearchBar->AddKeypadEventListener(*this);
179 __pSearchBar->SetContentAreaSize(Dimension(0, 0));
181 __pSearchListEvent = new (std::nothrow) SearchListEventListener(LIST_ANNEX_STYLE_MARK, __pPresentationModel);
183 AddControl(__pSearchBar);
185 __pSearchListView = new (std::nothrow) GroupedListView();
186 __pSearchListView->Construct(Rectangle(0, H_SEARCHBAR, clientBounds.width, clientBounds.height - H_SEARCHBAR - H_BOTTOM_LABEL), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
187 __pSearchListView->SetItemProvider(*__pSearchListEvent);
188 __pSearchListView->AddGroupedListViewItemEventListener(*this);
189 __pSearchListView->AddTouchEventListener(*this);
190 __pSearchListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_PB_BODY_NO_CONTACTS"));
191 __pSearchListView->SetShowState(false);
193 AddControl(__pSearchListView);
195 __pEmptyImageLabel = new (std::nothrow) Label();
196 __pEmptyImageLabel->Construct(Rectangle(X_EMPTY_IMAGE, Y_EMPTY_IMAGE, W_EMPTY_IMAGE, H_EMPTY_IMAGE), L"");
197 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_NO_CONTENTS);
200 __pEmptyImageLabel->SetBackgroundBitmap(*pBitmap);
203 __pEmptyImageLabel->SetShowState(false);
205 AddControl(__pEmptyImageLabel);
207 __pEmptyCommentLabel = new (std::nothrow) Label();
208 __pEmptyCommentLabel->Construct(Rectangle(0, Y_EMPTY_COMMENT, clientBounds.width, H_EMPTY_COMMENT),
209 ResourceManager::GetString(L"IDS_PB_BODY_NO_CONTACTS"));
210 __pEmptyCommentLabel->SetTextConfig(FONT_SIZE_EMPTY_COMMENT, LABEL_TEXT_STYLE_NORMAL);
211 __pEmptyCommentLabel->SetTextColor(Color(COLOR_EMPTY_COMMENT));
212 __pEmptyCommentLabel->SetShowState(false);
214 AddControl(__pEmptyCommentLabel);
216 __pBottomLabel = new (std::nothrow) Label();
217 __pBottomLabel->Construct(FloatRectangle(0, clientBounds.height - H_BOTTOM_LABEL, clientBounds.width, H_BOTTOM_LABEL),
218 ResourceManager::GetString(L"IDS_COM_POP_SELECTED") + INITIAL_SELECTED_COUNT);
219 __pBottomLabel->SetBackgroundColor(Color(COLOR_BOTTOM_LABEL_BG));
220 __pBottomLabel->SetTextColor(Color(COLOR_BOTTOM_LABEL_FONT));
221 __pBottomLabel->SetTextConfig(FONT_SIZE_BOTTOM_LABEL, LABEL_TEXT_STYLE_BOLD);
222 __pBottomLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
223 __pBottomLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
224 AddControl(__pBottomLabel);
226 __pTempContactValueHashMap = new (std::nothrow) HashMap();
227 __pTempContactValueHashMap->Construct();
233 ContactListEditorPanel::OnTerminating(void)
235 result r = E_SUCCESS;
237 if (__pPresentationModel != null)
239 __pPresentationModel->RemoveContactChangeListener(*this);
242 delete __pSearchListEvent;
244 __pTempContactValueHashMap->RemoveAll(true);
245 delete __pTempContactValueHashMap;
247 delete __pDeleteProgressPopup;
248 delete __pDeleteConfirmationPopup;
249 delete __pMultipleContactValuePopup;
255 ContactListEditorPanel::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
257 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
258 SceneManager* pSceneManager = SceneManager::GetInstance();
259 Form* pForm = dynamic_cast<Form*>(GetParent());
264 case IDA_HEADER_CONTACTS:
266 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
267 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK && pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_MULTI)
269 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_LIST_EDITOR));
273 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_LIST));
277 case IDA_HEADER_GROUPS:
279 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_LIST));
282 case IDA_HEADER_FAVORITES:
284 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
286 if (pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_SINGLE)
288 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FAVORITE_LIST));
290 else if (pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_MULTI)
292 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FAVORITE_LIST_EDITOR));
297 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FAVORITE_LIST));
301 case IDA_CHECK_SELECT_ALL_CHECKED:
303 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
305 int itemCount = __pListView->GetItemCountAt(groupIndex);
306 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
308 __pListView->SetItemChecked(groupIndex, itemIndex, true);
311 index |= groupIndex << LIST_VIEW_GROUP_INDEX_SHIFT;
313 Integer hashMapIndex(index);
315 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
317 if (__pTempContactValueHashMap->GetValue(hashMapIndex) == null)
319 String phoneNumber = __pPresentationModel->GetDefaultPhoneNumber(groupIndex, itemIndex);
320 __pTempContactValueHashMap->Add(*(new (std::nothrow) Integer(index)), *(new (std::nothrow) String(phoneNumber)));
323 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
325 if (__pTempContactValueHashMap->GetValue(hashMapIndex) == null)
327 String email = __pPresentationModel->GetDefaultEmail(groupIndex, itemIndex);
328 __pTempContactValueHashMap->Add(*(new (std::nothrow) Integer(index)), *(new (std::nothrow) String(email)));
333 __pListView->Invalidate(true);
337 case IDA_CHECK_SELECT_ALL_UNCHECKED:
339 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
341 int itemCount = __pListView->GetItemCountAt(groupIndex);
342 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
344 __pListView->SetItemChecked(groupIndex, itemIndex, false);
347 __pTempContactValueHashMap->RemoveAll(true);
348 __pListView->Invalidate(true);
352 case IDA_FOOTER_DELETE:
354 ShowDeleteConfirmationPopup();
357 case IDA_FOOTER_CANCEL:
359 pSceneManager->GoBackward(BackwardSceneTransition());
362 case IDA_FOOTER_DONE:
364 ReturnMultipleValues();
367 case IDA_POPUP_CONTACT_VALUE_CLOSE:
369 HideContactValuePopup();
372 case IDA_POPUP_DELETE_OK:
374 ShowDeleteProgressPopup();
377 case IDA_POPUP_DELETE_CANCEL:
379 HideDeleteConfirmationPopup();
382 case IDA_POPUP_DELETE_PROGRESS_CANCEL:
384 __deleteContactTimer.Cancel();
385 HideDeleteProgressPopup();
386 pSceneManager->GoBackward(BackwardSceneTransition());
395 ContactListEditorPanel::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
396 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
398 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
400 Form* pForm = dynamic_cast<Form*>(GetParent());
403 Header* pHeader = pForm->GetHeader();
404 pHeader->AddActionEventListener(*this);
406 Footer* pFooter = pForm->GetFooter();
407 pFooter->RemoveAllItems();
408 pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
409 pForm->SetFormMenuEventListener(null);
411 __pPresentationModel->InitializeContactList();
412 __pListView->SetFastScrollIndex(__pPresentationModel->GetAllKeys(), false);
413 __pListView->UpdateList();
415 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
417 pFooter->SetShowState(true);
419 FooterItem footerItemDone;
420 footerItemDone.Construct(IDA_FOOTER_DONE);
421 footerItemDone.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE"));
422 pFooter->AddItem(footerItemDone);
424 if (__pPresentationModel->GetContactCount() == 0)
426 pFooter->SetItemEnabled(0, false);
428 __pSearchBar->SetShowState(false);
429 __pCheckLabel->SetShowState(false);
430 __pSelectAll->SetShowState(false);
431 __pListView->SetShowState(false);
432 __pEmptyImageLabel->SetShowState(true);
433 __pEmptyCommentLabel->SetShowState(true);
434 __pBottomLabel->SetShowState(false);
439 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
441 int itemCount = __pListView->GetItemCountAt(groupIndex);
442 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
444 __pListView->SetItemChecked(groupIndex, itemIndex, false);
448 pFooter->SetItemEnabled(0, false);
450 __pSearchBar->SetShowState(true);
451 __pCheckLabel->SetShowState(true);
452 __pSelectAll->SetShowState(true);
453 __pListView->SetShowState(true);
454 __pEmptyImageLabel->SetShowState(false);
455 __pEmptyCommentLabel->SetShowState(false);
457 __pSelectAll->SetSelected(false);
462 __pSelectAll->SetSelected(false);
463 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
465 int itemCount = __pListView->GetItemCountAt(groupIndex);
466 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
468 __pListView->SetItemChecked(groupIndex, itemIndex, false);
472 FooterItem footerDelete;
473 footerDelete.Construct(IDA_FOOTER_DELETE);
474 footerDelete.SetText(ResourceManager::GetString(L"IDS_COM_SK_DELETE"));
476 FooterItem footerCancel;
477 footerCancel.Construct(IDA_FOOTER_CANCEL);
478 footerCancel.SetText(ResourceManager::GetString(L"IDS_PB_SK_CANCEL"));
479 pFooter->AddItem(footerCancel);
480 pFooter->AddItem(footerDelete);
481 pFooter->SetItemEnabled(1, false);
484 __pPresentationModel->AddContactChangeListener(*this);
485 pFooter->AddActionEventListener(*this);
490 pArgs->RemoveAll(true);
496 ContactListEditorPanel::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
497 const Tizen::Ui::Scenes::SceneId& nextSceneId)
499 Form* pForm = dynamic_cast<Form*>(GetParent());
502 if (pForm->IsFooterVisible() == false)
504 pForm->SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
507 Header* pHeader = pForm->GetHeader();
508 pHeader->RemoveActionEventListener(*this);
510 Footer* pFooter = pForm->GetFooter();
511 pFooter->RemoveActionEventListener(*this);
513 if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
515 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
518 __pPresentationModel->RemoveContactChangeListener(*this);
522 ContactListEditorPanel::RemoveContactList(void)
524 result r = E_FAILURE;
526 for (int groupIndex = __deleteGroupIndex; groupIndex < __pListView->GetGroupCount(); groupIndex++)
528 int itemCount = __pListView->GetItemCountAt(groupIndex);
529 for (int itemIndex = __deleteItemIndex; itemIndex < itemCount; itemIndex++)
531 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
533 r = __pPresentationModel->RemoveContact(groupIndex, itemIndex, false);
535 __deleteGroupIndex = groupIndex;
536 __deleteItemIndex = ++itemIndex;
541 __deleteItemIndex = 0;
544 __deleteGroupIndex = 0;
545 __deleteItemIndex = 0;
551 ContactListEditorPanel::GetCheckedContactCounts(void)
553 int contactCount = 0;
555 for (int groupIndex = __deleteGroupIndex; groupIndex < __pListView->GetGroupCount(); groupIndex++)
557 int itemCount = __pListView->GetItemCountAt(groupIndex);
558 for (int itemIndex = __deleteItemIndex; itemIndex < itemCount; itemIndex++)
560 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
570 Tizen::Ui::Controls::ListItemBase*
571 ContactListEditorPanel::CreateItem(int groupIndex, int itemIndex, int itemWidth)
574 Bitmap* pThumbnail = null;
576 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
578 CustomItem* pItem = new (std::nothrow) CustomItem();
579 pItem->Construct(Dimension(itemWidth, pContactsApp->GetListItemSingleLineHeight()), LIST_ANNEX_STYLE_MARK);
581 __pPresentationModel->GetContactItemInfoN(groupIndex, itemIndex, name, pThumbnail);
583 ContactListItem* pCustomElement = new (std::nothrow) ContactListItem(name, pThumbnail);
584 pItem->AddElement(Rectangle(0, 0, itemWidth - (ListItemBase::GetAnnexWidth(LIST_ANNEX_STYLE_MARK) + X_LIST_ITEM_TEXT_MARGIN), pContactsApp->GetListItemSingleLineHeight()), 0, *(static_cast<ICustomElement *>(pCustomElement)));
590 ContactListEditorPanel::DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
599 ContactListEditorPanel::GetItemCount(int groupIndex)
601 return __pPresentationModel->GetContactCount(groupIndex);
605 ContactListEditorPanel::GetGroupCount(void)
607 return __pPresentationModel->GetKeyCount();
610 Tizen::Ui::Controls::GroupItem*
611 ContactListEditorPanel::CreateGroupItem(int groupIndex, int itemWidth)
613 GroupItem* pItem = new (std::nothrow) GroupItem();
614 pItem->Construct(Dimension(itemWidth, H_GROUP_ITEM));
615 pItem->SetElement(__pPresentationModel->GetKey(groupIndex), null);
621 ContactListEditorPanel::DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::GroupItem* pItem, int itemWidth)
630 ContactListEditorPanel::OnSearchBarModeChanged(Tizen::Ui::Controls::SearchBar& source, Tizen::Ui::Controls::SearchBarMode mode)
632 if (mode == SEARCH_BAR_MODE_NORMAL)
634 int count = __pPresentationModel->GetSearchedContactCount();
635 bool isChecked = true;
637 for (int index = 0; index < count; index++)
642 __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
644 __pListView->SetItemChecked(groupIndex, itemIndex, __pSearchListView->IsItemChecked(0, index));
647 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount() && isChecked == true; groupIndex++)
649 int itemCount = __pListView->GetItemCountAt(groupIndex);
650 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
652 if (__pListView->IsItemChecked(groupIndex, itemIndex) == false)
660 __pListView->SetShowState(true);
661 __pListView->Invalidate(true);
662 __pCheckLabel->SetShowState(true);
663 __pSelectAll->SetShowState(true);
664 __pSelectAll->SetSelected(isChecked);
665 __pSearchListView->SetShowState(false);
666 __pPresentationModel->ResetSearchedContactList();
667 __pSearchListView->UpdateList();
672 ContactListEditorPanel::OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
677 ContactListEditorPanel::OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus status)
679 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
681 int mainGroupIndex = groupIndex;
682 int mainItemIndex = itemIndex;
684 if (listView.Equals(*__pSearchListView) == true)
686 __selectedSearchIndex = 0;
687 __selectedSearchIndex |= groupIndex << LIST_VIEW_GROUP_INDEX_SHIFT;
688 __selectedSearchIndex |= itemIndex;
690 __pPresentationModel->GetItemMainIndex(itemIndex, mainGroupIndex, mainItemIndex);
694 __selectedIndex |= mainGroupIndex << LIST_VIEW_GROUP_INDEX_SHIFT;
695 __selectedIndex |= mainItemIndex;
697 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
699 if (listView.IsItemChecked(groupIndex, itemIndex) == true)
702 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
704 pList = __pPresentationModel->GetAllPhoneNumbersN(mainGroupIndex, mainItemIndex);
708 ReturnResultFailed();
712 if (pList->GetCount() > 1)
714 listView.SetItemChecked(groupIndex, itemIndex, false);
715 __pContactValueListEvent = new (std::nothrow) ContactValueListItemProvider(pList);
716 ShowContactValuePopup(mainGroupIndex, mainItemIndex);
718 else if (pList->GetCount() == 1)
720 String* pContactValueInfo = static_cast<String *>(pList->GetAt(0));
722 pContactValueInfo->IndexOf(CHARACTER_SPACE, 0, blankIndex);
723 pContactValueInfo->Remove(0, blankIndex + 1);
724 __pTempContactValueHashMap->Add(*(new (std::nothrow) Integer(__selectedIndex)), *(new (std::nothrow) String(*pContactValueInfo)));
729 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
731 pList = __pPresentationModel->GetAllEmailsN(mainGroupIndex, mainItemIndex);
735 ReturnResultFailed();
739 if (pList->GetCount() > 1)
741 listView.SetItemChecked(groupIndex, itemIndex, false);
742 __pContactValueListEvent = new (std::nothrow) ContactValueListItemProvider(pList);
743 ShowContactValuePopup(mainGroupIndex, mainItemIndex);
745 else if (pList->GetCount() == 1)
747 String* pContactValueInfo = static_cast<String *>(pList->GetAt(0));
749 pContactValueInfo->IndexOf(CHARACTER_SPACE, 0, blankIndex);
750 pContactValueInfo->Remove(0, blankIndex + 1);
751 __pTempContactValueHashMap->Add(*(new (std::nothrow) Integer(__selectedIndex)), *(new (std::nothrow) String(*pContactValueInfo)));
759 Integer keyIndex(__selectedIndex);
760 __pTempContactValueHashMap->Remove(keyIndex, true);
764 if (listView.Equals(*__pListView) == true)
766 if (listView.IsItemChecked(groupIndex, itemIndex) == true)
768 bool isChecked = true;
769 for (int groupIndex = 0; groupIndex < listView.GetGroupCount() && isChecked == true; groupIndex++)
771 int itemCount = listView.GetItemCountAt(groupIndex);
772 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
774 if (listView.IsItemChecked(groupIndex, itemIndex) == false)
781 __pSelectAll->SetSelected(isChecked);
783 else if (listView.IsItemChecked(groupIndex, itemIndex) == false)
785 __pSelectAll->SetSelected(false);
788 else if (listView.Equals(*__pSearchListView) == true)
790 int count = __pPresentationModel->GetSearchedContactCount();
792 for (int index = 0; index < count; index++)
797 __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
799 __pListView->SetItemChecked(groupIndex, itemIndex, __pSearchListView->IsItemChecked(0, index));
807 ContactListEditorPanel::OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction)
812 ContactListEditorPanel::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
817 ContactListEditorPanel::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
819 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
821 int groupIndex = (__selectedIndex >> LIST_VIEW_GROUP_INDEX_SHIFT) & LIST_VIEW_MASK;
822 int itemIndex = __selectedIndex & LIST_VIEW_MASK;
825 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
827 pList = __pPresentationModel->GetAllPhoneNumbersN(groupIndex, itemIndex);
829 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
831 pList = __pPresentationModel->GetAllEmailsN(groupIndex, itemIndex);
836 ReturnResultFailed();
840 String* pContactValueInfo = static_cast<String *>(pList->GetAt(index));
842 pContactValueInfo->IndexOf(CHARACTER_SPACE, 0, blankIndex);
843 pContactValueInfo->Remove(0, blankIndex + 1);
844 __pTempContactValueHashMap->Add(*(new (std::nothrow) Integer(__selectedIndex)), *(new (std::nothrow) String(*pContactValueInfo)));
848 HideContactValuePopup();
850 if (__pListView->GetShowState() == true)
852 __pListView->SetItemChecked(groupIndex, itemIndex, true);
854 bool isChecked = true;
855 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount() && isChecked == true; groupIndex++)
857 int itemCount = __pListView->GetItemCountAt(groupIndex);
858 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
860 if (__pListView->IsItemChecked(groupIndex, itemIndex) == false)
868 __pSelectAll->SetSelected(isChecked);
872 groupIndex = (__selectedSearchIndex >> LIST_VIEW_GROUP_INDEX_SHIFT) & LIST_VIEW_MASK;
873 itemIndex = __selectedSearchIndex & LIST_VIEW_MASK;
874 __pSearchListView->SetItemChecked(groupIndex, itemIndex, true);
876 int count = __pPresentationModel->GetSearchedContactCount();
878 for (int index = 0; index < count; index++)
880 __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
882 __pListView->SetItemChecked(groupIndex, itemIndex, __pSearchListView->IsItemChecked(0, index));
890 ContactListEditorPanel::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
895 ContactListEditorPanel::OnFastScrollIndexSelected(Tizen::Ui::Control& source, Tizen::Base::String& index)
897 __pListView->ScrollToItem(__pPresentationModel->GetKeyIndex(index), -1);
898 __pListView->Invalidate(false);
902 ContactListEditorPanel::OnTextValueChanged(const Tizen::Ui::Control& source)
904 String searchText = __pSearchBar->GetText();
907 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
908 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
910 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_HAS_PHONE_ONLY);
912 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
914 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_HAS_EMAIL_ONLY);
918 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_NORMAL);
921 if (searchText.GetLength() != 0)
923 __pCheckLabel->SetShowState(false);
924 __pSelectAll->SetShowState(false);
925 __pListView->SetShowState(false);
926 __pSearchListView->SetShowState(true);
928 __pSearchListView->UpdateList();
930 int count = __pPresentationModel->GetSearchedContactCount();
932 for (int index = 0; index < count; index++)
937 __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
938 __pSearchListView->SetItemChecked(0, index, __pListView->IsItemChecked(groupIndex, itemIndex));
941 __pSearchListView->Invalidate(true);
945 __pCheckLabel->SetShowState(true);
946 __pSelectAll->SetShowState(true);
947 __pListView->SetShowState(true);
948 __pSearchListView->SetShowState(false);
950 int count = __pPresentationModel->GetSearchedContactCount();
951 bool isChecked = true;
953 for (int index = 0; index < count; index++)
958 __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
959 __pListView->SetItemChecked(groupIndex, itemIndex, __pSearchListView->IsItemChecked(0, index));
962 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount() && isChecked == true; groupIndex++)
964 int itemCount = __pListView->GetItemCountAt(groupIndex);
965 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
967 if (__pListView->IsItemChecked(groupIndex, itemIndex) == false)
975 __pSelectAll->SetSelected(isChecked);
976 __pListView->Invalidate(true);
981 ContactListEditorPanel::OnTextValueChangeCanceled(const Tizen::Ui::Control& source)
986 ContactListEditorPanel::OnContactsChanged(void)
988 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
989 Form* pForm = dynamic_cast<Form*>(GetParent());
992 HideContactValuePopup();
994 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
996 Footer* pFooter = pForm->GetFooter();
997 pFooter->RemoveAllItems();
999 FooterItem footerItemDone;
1000 footerItemDone.Construct(IDA_FOOTER_DONE);
1001 footerItemDone.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE"));
1002 pFooter->AddItem(footerItemDone);
1004 __pPresentationModel->InitializeContactList();
1006 if (__pPresentationModel->GetContactCount() == 0)
1008 pFooter->SetItemEnabled(0, false);
1010 __pSearchBar->SetShowState(false);
1011 __pCheckLabel->SetShowState(false);
1012 __pSelectAll->SetShowState(false);
1013 __pListView->SetShowState(false);
1014 __pEmptyImageLabel->SetShowState(true);
1015 __pEmptyCommentLabel->SetShowState(true);
1016 __pBottomLabel->SetShowState(false);
1020 if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
1022 Form* pForm = dynamic_cast<Form*>(GetParent());
1025 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
1029 __pListView->SetShowState(true);
1030 __pSelectAll->SetShowState(true);
1031 __pCheckLabel->SetShowState(true);
1033 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
1035 int itemCount = __pListView->GetItemCountAt(groupIndex);
1036 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
1038 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
1040 __pListView->SetItemChecked(groupIndex, itemIndex, false);
1045 pFooter->SetItemEnabled(0, false);
1047 __pSearchBar->SetShowState(true);
1048 __pSelectAll->SetSelected(false);
1049 __pEmptyImageLabel->SetShowState(false);
1050 __pEmptyCommentLabel->SetShowState(false);
1051 UpdateBottomLabel();
1053 __pListView->SetFastScrollIndex(__pPresentationModel->GetAllKeys(), false);
1054 __pListView->UpdateList();
1057 else if (__isContactRemoved == false)
1059 __pPresentationModel->InitializeContactList();
1060 if( __pPresentationModel->GetContactCount() == 0)
1062 SceneManager* pSceneManager = SceneManager::GetInstance();
1063 pSceneManager->GoBackward(BackwardSceneTransition());
1066 if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
1068 Form* pForm = dynamic_cast<Form*>(GetParent());
1071 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
1074 __pSelectAll->SetSelected(false);
1076 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
1078 int itemCount = __pListView->GetItemCountAt(groupIndex);
1079 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
1081 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
1083 __pListView->SetItemChecked(groupIndex, itemIndex, false);
1087 UpdateBottomLabel();
1088 __pListView->SetFastScrollIndex(__pPresentationModel->GetAllKeys(), false);
1089 __pListView->UpdateList();
1094 ContactListEditorPanel::OnCategoriesChanged(void)
1099 ContactListEditorPanel::UpdateBottomLabel(void)
1101 Form* pForm = dynamic_cast<Form*>(GetParent());
1103 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1104 int selectedCount = 0;
1105 int fotterItemIndex = 1;
1107 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
1109 fotterItemIndex = 0;
1113 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
1115 int itemCount = __pListView->GetItemCountAt(groupIndex);
1116 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
1118 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
1125 String selected = ResourceManager::GetString(L"IDS_COM_POP_SELECTED");
1126 selected.Append(L" (");
1127 selected.Append(selectedCount);
1128 selected.Append(L")");
1129 __pBottomLabel->SetText(selected);
1130 __pBottomLabel->SetPosition(FloatPoint(0, pForm->GetClientAreaBoundsF().height - H_BOTTOM_LABEL));
1131 __pBottomLabel->Invalidate(false);
1133 Footer* pFooter = pForm->GetFooter();
1135 if (selectedCount > 0 && __pBottomLabel->GetShowState() == false)
1137 __pBottomLabel->SetShowState(true);
1138 __pListView->SetSize(__pListView->GetSize().width, __pListView->GetSize().height - H_BOTTOM_LABEL);
1139 __pSearchListView->SetSize(__pSearchListView->GetSize().width, __pSearchListView->GetSize().height - H_BOTTOM_LABEL);
1140 pFooter->SetItemEnabled(fotterItemIndex, true);
1142 else if (selectedCount == 0 && __pBottomLabel->GetShowState() == true)
1144 __pBottomLabel->SetShowState(false);
1145 __pListView->SetSize(__pListView->GetSize().width, __pListView->GetSize().height + H_BOTTOM_LABEL);
1146 __pSearchListView->SetSize(__pSearchListView->GetSize().width, __pSearchListView->GetSize().height + H_BOTTOM_LABEL);
1147 pFooter->SetItemEnabled(fotterItemIndex, false);
1150 pFooter->Invalidate(true);
1156 ContactListEditorPanel::ShowContactValuePopup(int groupIndex, int itemIndex)
1158 delete __pMultipleContactValuePopup;
1159 __pMultipleContactValuePopup = new (std::nothrow) Popup();
1160 __pMultipleContactValuePopup->Construct(true, Dimension(W_CONTACT_VALUE_POPUP, H_CONTACT_VALUE_POPUP));
1161 __pMultipleContactValuePopup->SetTitleText(__pPresentationModel->GetName(groupIndex, itemIndex));
1162 __pMultipleContactValuePopup->SetPropagatedKeyEventListener(this);
1164 Rectangle popupClientBounds = __pMultipleContactValuePopup->GetClientAreaBounds();
1166 ListView* pListView = new (std::nothrow) ListView();
1167 pListView->Construct(Rectangle(0, 0, popupClientBounds.width, H_CONTACT_VALUE_POPUP_LIST_VIEW));
1168 pListView->SetItemProvider(*__pContactValueListEvent);
1169 pListView->AddListViewItemEventListener(*this);
1171 __pMultipleContactValuePopup->AddControl(pListView);
1173 Button* pCancelButton = new (std::nothrow) Button();
1174 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"));
1175 pCancelButton->SetActionId(IDA_POPUP_CONTACT_VALUE_CLOSE);
1176 pCancelButton->AddActionEventListener(*this);
1178 __pMultipleContactValuePopup->AddControl(pCancelButton);
1179 __pMultipleContactValuePopup->SetShowState(true);
1180 __pMultipleContactValuePopup->Show();
1184 ContactListEditorPanel::HideContactValuePopup(void)
1186 if (__pMultipleContactValuePopup != null)
1188 __pMultipleContactValuePopup->SetShowState(false);
1194 ContactListEditorPanel::ShowDeleteConfirmationPopup(void)
1196 if (__pDeleteConfirmationPopup == null)
1198 __pDeleteConfirmationPopup = new (std::nothrow) Popup();
1199 __pDeleteConfirmationPopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
1200 __pDeleteConfirmationPopup->SetPropagatedKeyEventListener(this);
1202 Rectangle popupClientBounds = __pDeleteConfirmationPopup->GetClientAreaBounds();
1204 Label* pLabel = new (std::nothrow) Label();
1205 pLabel->Construct(Rectangle(X_DELETE_LABEL, Y_DELETE_LABEL, W_DELETE_LABEL, H_DELETE_LABEL), ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
1206 pLabel->SetTextConfig(FONT_SIZE_DELETE_CONFIRM, LABEL_TEXT_STYLE_NORMAL);
1207 pLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1208 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1210 Button* pDeleteButton = new (std::nothrow) Button();
1211 pDeleteButton->Construct(Rectangle(X_DELETE_LABEL + W_DELETE_BUTTON + W_POPUP_ITEM_GAP, Y_DELETE_BUTTON, W_DELETE_BUTTON, H_DELETE_BUTTON), ResourceManager::GetString(L"IDS_COM_SK_DELETE"));
1212 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
1213 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
1214 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
1215 pDeleteButton->SetTextSize(FONT_SIZE_DELETE_BUTTON);
1216 pDeleteButton->SetActionId(IDA_POPUP_DELETE_OK);
1217 pDeleteButton->AddActionEventListener(*this);
1219 Button* pCancelButton = new (std::nothrow) Button();
1220 pCancelButton->Construct(Rectangle(X_DELETE_LABEL, Y_DELETE_BUTTON, W_DELETE_BUTTON, H_DELETE_BUTTON), ResourceManager::GetString(L"IDS_PB_SK_CANCEL"));
1221 pCancelButton->SetTextSize(FONT_SIZE_DELETE_BUTTON);
1222 pCancelButton->SetActionId(IDA_POPUP_DELETE_CANCEL);
1223 pCancelButton->AddActionEventListener(*this);
1225 __pDeleteConfirmationPopup->AddControl(pLabel);
1226 __pDeleteConfirmationPopup->AddControl(pDeleteButton);
1227 __pDeleteConfirmationPopup->AddControl(pCancelButton);
1230 __pDeleteConfirmationPopup->SetShowState(true);
1231 __pDeleteConfirmationPopup->Show();
1235 ContactListEditorPanel::HideDeleteConfirmationPopup(void)
1237 if (__pDeleteConfirmationPopup != null)
1239 __pDeleteConfirmationPopup->SetShowState(false);
1245 ContactListEditorPanel::ShowDeleteProgressPopup(void)
1247 if (__pDeleteProgressPopup != null)
1249 delete __pDeleteProgressPopup;
1252 __pDeleteProgressPopup = new (std::nothrow) Popup();
1253 __pDeleteProgressPopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_PROGRESS_POPUP));
1254 __pDeleteProgressPopup->AddWindowEventListener(*this);
1256 Rectangle clientBounds = __pDeleteProgressPopup->GetClientAreaBounds();
1258 Label* pLabelTitle = new (std::nothrow) Label();
1259 pLabelTitle->Construct(Rectangle(0, Y_DELETE_POPUP_TITLE, clientBounds.width, H_DELETE_POPUP_ELEMENT), ResourceManager::GetString(L"IDS_PB_POP_DELETING_CONTACTS_ING"));
1260 pLabelTitle->SetTextColor(COLOR_DELETE_POPUP_TEXT);
1261 pLabelTitle->SetTextConfig(FONT_SIZE_DELETE_POPUP_TEXT, LABEL_TEXT_STYLE_BOLD);
1262 pLabelTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1264 __pDeleteProgressPopup->AddControl(pLabelTitle);
1266 Progress* pProgress = new (std::nothrow) Progress();
1267 pProgress->Construct(Rectangle(0, Y_DELETE_POPUP_TITLE + H_DELETE_POPUP_ELEMENT, clientBounds.width, H_DELETE_POPUP_PROGRESS), 0, GetCheckedContactCounts());
1269 __pDeleteProgressPopup->AddControl(pProgress);
1271 Label* pLabelPercentage = new (std::nothrow) Label();
1272 pLabelPercentage->Construct(Rectangle(0, pProgress->GetY() + pProgress->GetHeight(), clientBounds.width / 2, H_DELETE_POPUP_ELEMENT), Integer::ToString(pProgress->GetPercentComplete()) + L"%");
1273 pLabelPercentage->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1274 pLabelPercentage->SetTextColor(COLOR_DELETE_POPUP_TEXT);
1275 pLabelPercentage->SetTextConfig(FONT_SIZE_DELETE_POPUP_TEXT, LABEL_TEXT_STYLE_NORMAL);
1277 __pDeleteProgressPopup->AddControl(pLabelPercentage);
1279 String currentOfTotal(Integer::ToString(pProgress->GetValue()) + L" / " + Integer::ToString(GetCheckedContactCounts()));
1280 Label* pLabelTotal = new (std::nothrow) Label();
1281 pLabelTotal->Construct(Rectangle(clientBounds.width / 2, pLabelPercentage->GetY(), clientBounds.width / 2, H_DELETE_POPUP_ELEMENT), currentOfTotal);
1282 pLabelTotal->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
1283 pLabelTotal->SetTextColor(COLOR_DELETE_POPUP_TEXT);
1284 pLabelTotal->SetTextConfig(FONT_SIZE_DELETE_POPUP_TEXT, LABEL_TEXT_STYLE_NORMAL);
1286 __pDeleteProgressPopup->AddControl(pLabelTotal);
1288 Button* pCancelButton = new (std::nothrow) Button();
1289 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));
1290 pCancelButton->SetText(ResourceManager::GetString("IDS_PB_SK_CANCEL"));
1291 pCancelButton->SetActionId(IDA_POPUP_DELETE_PROGRESS_CANCEL);
1292 pCancelButton->AddActionEventListener(*this);
1294 __pDeleteProgressPopup->AddControl(pCancelButton);
1295 __pDeleteProgressPopup->Show();
1297 __isContactRemoved = true;
1301 ContactListEditorPanel::HideDeleteProgressPopup(void)
1303 if (__pDeleteProgressPopup != null)
1305 delete __pDeleteProgressPopup;
1306 __pDeleteProgressPopup = null;
1308 __isContactRemoved = false;
1310 __pListView->UpdateList();
1315 ContactListEditorPanel::ReturnValues(RequestId requestId, Tizen::App::AppCtrlResult appCtrlResult, const Tizen::Base::Collection::IMap* pReturnValue)
1317 AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance();
1318 result r = pAppManager->SendAppControlResult(requestId, appCtrlResult, pReturnValue);
1319 AppLogDebug("[%s] The return result from SendAppControlResult(), AppCtrlResult value : %d.", GetErrorMessage(r), appCtrlResult);
1321 UiApp::GetInstance()->Terminate();
1325 ContactListEditorPanel::ReturnMultipleValues(void)
1327 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1329 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
1331 ArrayList* pValueList = new (std::nothrow) ArrayList();
1332 pValueList->Construct();
1334 HashMap* pReturnValue = new (std::nothrow) HashMap();
1335 pReturnValue->Construct();
1337 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
1339 IMapEnumerator* pMapEnum = __pTempContactValueHashMap->GetMapEnumeratorN();
1340 while (pMapEnum->MoveNext() == E_SUCCESS)
1342 String* pValue = static_cast<String*> (pMapEnum->GetValue());
1343 pValueList->Add(new (std::nothrow) String(*pValue));
1345 pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_PHONE), pValueList);
1349 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
1351 IMapEnumerator* pMapEnum = __pTempContactValueHashMap->GetMapEnumeratorN();
1352 while (pMapEnum->MoveNext() == E_SUCCESS)
1354 String* pValue = static_cast<String*> (pMapEnum->GetValue());
1355 pValueList->Add(new (std::nothrow) String(*pValue));
1357 pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_EMAIL), pValueList);
1361 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_ITEM_ID)
1363 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
1365 int itemCount = __pListView->GetItemCountAt(groupIndex);
1366 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
1368 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
1371 contactId.Append(__pPresentationModel->GetContactId(groupIndex, itemIndex));
1372 pValueList->Add(new (std::nothrow) String(contactId));
1376 pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_ITEM_ID), pValueList);
1382 ReturnValues(pContactsApp->GetRequestId(), APP_CTRL_RESULT_FAILED, pReturnValue);
1387 ReturnValues(pContactsApp->GetRequestId(), APP_CTRL_RESULT_SUCCEEDED, pReturnValue);
1392 ContactListEditorPanel::ReturnResultFailed(void)
1394 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1396 ReturnValues(pContactsApp->GetRequestId(), APP_CTRL_RESULT_FAILED, null);
1400 ContactListEditorPanel::OnKeypadWillOpen(Tizen::Ui::Control& source)
1405 ContactListEditorPanel::OnKeypadOpened(Tizen::Ui::Control& source)
1407 Form* pForm = dynamic_cast<Form*>(GetParent());
1410 if (__pBottomLabel->GetShowState() == true)
1412 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, pForm->GetClientAreaBounds().width, pForm->GetClientAreaBounds().height - H_SEARCHBAR - H_BOTTOM_LABEL));
1413 __pBottomLabel->SetPosition(FloatPoint(0, pForm->GetClientAreaBoundsF().height - H_BOTTOM_LABEL));
1414 __pBottomLabel->Invalidate(true);
1418 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, pForm->GetClientAreaBounds().width, pForm->GetClientAreaBounds().height - H_SEARCHBAR));
1423 ContactListEditorPanel::OnKeypadClosed(Tizen::Ui::Control& source)
1425 Form* pForm = dynamic_cast<Form*>(GetParent());
1428 if (__pBottomLabel->GetShowState() == true)
1430 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, pForm->GetClientAreaBounds().width, pForm->GetClientAreaBounds().height - H_SEARCHBAR - H_BOTTOM_LABEL));
1431 __pBottomLabel->SetPosition(FloatPoint(0, pForm->GetClientAreaBoundsF().height - H_BOTTOM_LABEL));
1432 __pBottomLabel->Invalidate(true);
1433 if (SceneManager::GetInstance()->GetCurrentSceneId() == IDSCN_CONTACT_LIST_EDITOR)
1435 UpdateBottomLabel();
1440 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, pForm->GetClientAreaBounds().width, pForm->GetClientAreaBounds().height - H_SEARCHBAR));
1445 ContactListEditorPanel::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1447 Form* pForm = dynamic_cast<Form*>(GetParent());
1449 if (__pBottomLabel->GetShowState() == true)
1451 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, pForm->GetClientAreaBounds().width, pForm->GetClientAreaBounds().height - H_SEARCHBAR - H_BOTTOM_LABEL));
1452 __pBottomLabel->SetPosition(FloatPoint(0, pForm->GetClientAreaBoundsF().height - H_BOTTOM_LABEL));
1453 __pBottomLabel->Invalidate(true);
1457 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, pForm->GetClientAreaBounds().width, pForm->GetClientAreaBounds().height - H_SEARCHBAR));
1462 ContactListEditorPanel::OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction)
1464 if (keypadAction == KEYPAD_ACTION_SEARCH)
1466 __pSearchBar->HideKeypad();
1471 ContactListEditorPanel::OnWindowActivated (const Tizen::Ui::Window &source)
1473 __deleteContactTimer.Start(1);
1477 ContactListEditorPanel::OnWindowDeactivated (const Tizen::Ui::Window &source)
1482 ContactListEditorPanel::OnTimerExpired(Tizen::Base::Runtime::Timer &timer)
1484 Progress* pProgress = static_cast<Progress *>(__pDeleteProgressPopup->GetControl(1));
1486 pProgress->SetValue(pProgress->GetValue() + 1);
1487 pProgress->Invalidate(false);
1489 Label* pLabelPercentage = static_cast<Label *>(__pDeleteProgressPopup->GetControl(2));
1491 pLabelPercentage->SetText(Integer::ToString(pProgress->GetPercentComplete()) + L"%");
1492 pLabelPercentage->Invalidate(false);
1494 Label* pLabelTotal = static_cast<Label *>(__pDeleteProgressPopup->GetControl(3));
1496 String currentOfTotal = pLabelTotal->GetText();
1497 currentOfTotal.Remove(0, Integer::ToString(pProgress->GetValue() - 1).GetLength());
1498 currentOfTotal.Insert(Integer::ToString(pProgress->GetValue()), 0);
1499 pLabelTotal->SetText(currentOfTotal);
1500 pLabelTotal->Invalidate(false);
1502 if (RemoveContactList() == E_SUCCESS)
1504 __deleteContactTimer.Start(1);
1508 SceneManager* pSceneManager = SceneManager::GetInstance();
1509 pSceneManager->GoBackward(BackwardSceneTransition());
1514 ContactListEditorPanel::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo & touchInfo)
1516 GroupedListView* pList = static_cast<GroupedListView*>(&const_cast<Control&>(source));
1524 ContactListEditorPanel::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1529 ContactListEditorPanel::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1534 ContactListEditorPanel::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1539 ContactListEditorPanel::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1544 ContactListEditorPanel::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
1550 ContactListEditorPanel::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
1552 if (keyEventInfo.GetKeyCode() == KEY_BACK || keyEventInfo.GetKeyCode() == KEY_ESC)
1554 if (__pDeleteConfirmationPopup && __pDeleteConfirmationPopup->GetShowState() == true)
1556 HideDeleteConfirmationPopup();
1559 if (__pMultipleContactValuePopup && __pMultipleContactValuePopup->GetShowState() == true)
1561 HideContactValuePopup();
1569 ContactListEditorPanel::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
1575 ContactListEditorPanel::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)