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 "CtCommonUtil.h"
28 #include "CtMainForm.h"
29 #include "CtResourceManager.h"
30 #include "CtSceneRegister.h"
31 #include "CtSearchListItem.h"
32 #include "CtSearchListEventListener.h"
35 using namespace Tizen::App;
36 using namespace Tizen::Base;
37 using namespace Tizen::Base::Collection;
38 using namespace Tizen::Graphics;
39 using namespace Tizen::Ui;
40 using namespace Tizen::Ui::Controls;
41 using namespace Tizen::Ui::Scenes;
42 using namespace Tizen::Social;
44 static const int IDA_HEADER_CONTACTS = 10;
45 static const int IDA_HEADER_GROUPS = 11;
46 static const int IDA_HEADER_FAVORITES = 12;
47 static const int IDA_CHECK_SELECT_ALL_CHECKED = 20;
48 static const int IDA_CHECK_SELECT_ALL_UNCHECKED = 21;
49 static const int IDA_FOOTER_DELETE = 30;
50 static const int IDA_FOOTER_CANCEL = 31;
51 static const int IDA_FOOTER_DONE = 32;
52 static const int IDA_POPUP_CONTACT_VALUE_CLOSE = 40;
53 static const int IDA_POPUP_DELETE_OK = 41;
54 static const int IDA_POPUP_DELETE_CANCEL = 42;
55 static const int IDA_POPUP_DELETE_PROGRESS_CANCEL = 43;
57 static const int X_EMPTY_IMAGE = 220;
58 static const int Y_EMPTY_IMAGE = 300;
59 static const int W_EMPTY_IMAGE = 280;
60 static const int H_EMPTY_IMAGE = 280;
61 static const int Y_EMPTY_COMMENT = 618;
62 static const int H_EMPTY_COMMENT = 38;
63 static const int W_INITIAL_PANEL = 10;
64 static const int H_INITIAL_PANEL = 10;
65 static const int H_SELECT_ALL = 112;
66 static const int H_SEARCHBAR = 86;
67 static const int H_BOTTOM_LABEL = 48;
68 static const int H_GROUP_ITEM = 76;
69 static const int W_CONTACT_VALUE_POPUP = 688;
70 static const int H_CONTACT_VALUE_POPUP = 532;
71 static const int H_CONTACT_VALUE_POPUP_LIST_VIEW = 338;
72 static const int H_CLOSE_BUTTON = 74;
73 static const int Y_CLOSE_BUTTON = 358;
74 static const int W_CLOSE_BUTTON = 394;
75 static const int H_DELETE_PROGRESS_POPUP = 308;
76 static const int Y_DELETE_POPUP_TITLE = 20;
77 static const int H_DELETE_POPUP_ELEMENT = 60;
78 static const int H_DELETE_POPUP_PROGRESS = 34;
79 static const int Y_DELETE_POPUP_CANCEL_BUTTON = 214;
80 static const int H_DELETE_POPUP_CANCEL_BUTTON = 74;
81 static const int W_DELETE_POPUP_CANCEL_BUTTON = 394;
82 static const int X_LIST_ITEM_TEXT_MARGIN = 32;
83 static const int H_CHECK_LABEL = 72;
84 static const int Y_CHECK_LABEL = 20;
86 static const int FONT_SIZE_EMPTY_COMMENT = 32;
87 static const int FONT_SIZE_BOTTOM_LABEL = 32;
88 static const int FONT_SIZE_DELETE_POPUP_TEXT = 36;
90 static const unsigned int COLOR_EMPTY_COMMENT = Color32<102, 102, 102>::Value;
91 static const unsigned int COLOR_BOTTOM_LABEL_BG = Color32<68, 68, 68>::Value;
92 static const unsigned int COLOR_BOTTOM_LABEL_FONT = Color32<255, 255, 255>::Value;
93 static const unsigned int COLOR_DELETE_POPUP_TEXT = Color32<128, 128, 128>::Value;
94 static const unsigned int COLOR_CHECK_LABEL_BG = Color32<220, 218, 211>::Value;
95 static const unsigned int COLOR_DELETE_BUTTON_NORMAL = Color32<213, 82, 82>::Value;
96 static const unsigned int COLOR_DELETE_BUTTON_PRESSED = Color32<194, 71, 71>::Value;
97 static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Value;
99 static const int LIST_VIEW_GROUP_INDEX_SHIFT = 16;
100 static const int LIST_VIEW_MASK = 0xFFFF;
102 static const wchar_t* IDB_NO_CONTENTS = L"00_Nocontents_text.png";
104 ContactListEditorPanel::ContactListEditorPanel(void)
105 : __pTempContactValueHashMap(null)
108 , __pSearchListView(null)
110 , __pCheckLabel(null)
111 , __pEmptyImageLabel(null)
112 , __pEmptyCommentLabel(null)
113 , __pBottomLabel(null)
114 , __pMultipleContactValuePopup(null)
115 , __pDeleteProgressPopup(null)
116 , __pDeleteConfirmationPopup(null)
117 , __pContactValueListEvent(null)
118 , __pPresentationModel(null)
119 , __pSearchListEvent(null)
120 , __isContactRemoved(false)
121 , __selectedIndex(-1)
122 , __selectedSearchIndex(-1)
123 , __deleteGroupIndex(0)
124 , __deleteItemIndex(0)
126 __deleteContactTimer.Construct(*this);
129 ContactListEditorPanel::~ContactListEditorPanel(void)
134 ContactListEditorPanel::Initialize(void)
136 Construct(Rectangle(0, 0, W_INITIAL_PANEL, H_INITIAL_PANEL));
140 ContactListEditorPanel::OnInitializing(void)
142 const Form* pForm = dynamic_cast<Form*>(GetParent());
145 FloatRectangle clientBounds = pForm->GetClientAreaBoundsF();
146 SetBounds(FloatRectangle(0, 0, clientBounds.width, clientBounds.height));
148 __pPresentationModel = ContactListPresentationModel::GetInstance();
150 __pCheckLabel = new (std::nothrow) Label();
151 __pCheckLabel->Construct(Rectangle(0, H_SEARCHBAR + Y_CHECK_LABEL, clientBounds.width, H_CHECK_LABEL), L"");
152 __pCheckLabel->SetBackgroundColor(COLOR_CHECK_LABEL_BG);
154 AddControl(__pCheckLabel);
156 __pSelectAll = new (std::nothrow) CheckButton();
157 __pSelectAll->Construct(Rectangle(0, H_SEARCHBAR, clientBounds.width, H_SELECT_ALL), CHECK_BUTTON_STYLE_MARK, BACKGROUND_STYLE_NONE);
158 __pSelectAll->SetText(ResourceManager::GetString(L"IDS_COM_BODY_SELECT_ALL"));
159 __pSelectAll->SetActionId(IDA_CHECK_SELECT_ALL_CHECKED, IDA_CHECK_SELECT_ALL_UNCHECKED);
160 __pSelectAll->AddActionEventListener(*this);
162 AddControl(__pSelectAll);
164 __pListView = new (std::nothrow) GroupedListView();
165 __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);
166 __pListView->SetItemProvider(*this);
167 __pListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_PB_BODY_NO_CONTACTS"));
168 __pListView->AddFastScrollListener(*this);
169 __pListView->AddGroupedListViewItemEventListener(*this);
170 __pListView->AddTouchEventListener(*this);
172 AddControl(__pListView);
174 __pSearchBar = new (std::nothrow) SearchBar();
175 __pSearchBar->Construct(Rectangle(0, 0, clientBounds.width, H_SEARCHBAR));
176 __pSearchBar->SetGuideText(ResourceManager::GetString(L"IDS_COM_BODY_SEARCH"));
177 __pSearchBar->AddSearchBarEventListener(*this);
178 __pSearchBar->AddTextEventListener(*this);
179 __pSearchBar->AddKeypadEventListener(*this);
180 __pSearchBar->SetContentAreaSize(Dimension(0, 0));
182 __pSearchListEvent = new (std::nothrow) SearchListEventListener(LIST_ANNEX_STYLE_MARK, __pPresentationModel);
184 AddControl(__pSearchBar);
186 __pSearchListView = new (std::nothrow) GroupedListView();
187 __pSearchListView->Construct(Rectangle(0, H_SEARCHBAR, clientBounds.width, clientBounds.height - H_SEARCHBAR - H_BOTTOM_LABEL), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
188 __pSearchListView->SetItemProvider(*__pSearchListEvent);
189 __pSearchListView->AddGroupedListViewItemEventListener(*this);
190 __pSearchListView->AddTouchEventListener(*this);
191 __pSearchListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_PB_BODY_NO_CONTACTS"));
192 __pSearchListView->SetShowState(false);
194 AddControl(__pSearchListView);
196 __pEmptyImageLabel = new (std::nothrow) Label();
197 __pEmptyImageLabel->Construct(Rectangle(X_EMPTY_IMAGE, Y_EMPTY_IMAGE, W_EMPTY_IMAGE, H_EMPTY_IMAGE), L"");
198 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_NO_CONTENTS);
201 __pEmptyImageLabel->SetBackgroundBitmap(*pBitmap);
204 __pEmptyImageLabel->SetShowState(false);
206 AddControl(__pEmptyImageLabel);
208 __pEmptyCommentLabel = new (std::nothrow) Label();
209 __pEmptyCommentLabel->Construct(Rectangle(0, Y_EMPTY_COMMENT, clientBounds.width, H_EMPTY_COMMENT),
210 ResourceManager::GetString(L"IDS_PB_BODY_NO_CONTACTS"));
211 __pEmptyCommentLabel->SetTextConfig(FONT_SIZE_EMPTY_COMMENT, LABEL_TEXT_STYLE_NORMAL);
212 __pEmptyCommentLabel->SetTextColor(Color(COLOR_EMPTY_COMMENT));
213 __pEmptyCommentLabel->SetShowState(false);
215 AddControl(__pEmptyCommentLabel);
217 __pBottomLabel = new (std::nothrow) Label();
218 __pBottomLabel->Construct(FloatRectangle(0, clientBounds.height - H_BOTTOM_LABEL, clientBounds.width, H_BOTTOM_LABEL),
219 ResourceManager::GetString(L"IDS_COM_POP_SELECTED") + INITIAL_SELECTED_COUNT);
220 __pBottomLabel->SetBackgroundColor(Color(COLOR_BOTTOM_LABEL_BG));
221 __pBottomLabel->SetTextColor(Color(COLOR_BOTTOM_LABEL_FONT));
222 __pBottomLabel->SetTextConfig(FONT_SIZE_BOTTOM_LABEL, LABEL_TEXT_STYLE_BOLD);
223 __pBottomLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
224 __pBottomLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
225 AddControl(__pBottomLabel);
227 __pTempContactValueHashMap = new (std::nothrow) HashMap();
228 __pTempContactValueHashMap->Construct();
234 ContactListEditorPanel::OnTerminating(void)
236 result r = E_SUCCESS;
238 if (__pPresentationModel != null)
240 __pPresentationModel->RemoveContactChangeListener(*this);
243 delete __pSearchListEvent;
245 __pTempContactValueHashMap->RemoveAll(true);
246 delete __pTempContactValueHashMap;
248 delete __pDeleteProgressPopup;
249 delete __pDeleteConfirmationPopup;
250 delete __pMultipleContactValuePopup;
256 ContactListEditorPanel::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
258 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
259 SceneManager* pSceneManager = SceneManager::GetInstance();
260 Form* pForm = dynamic_cast<Form*>(GetParent());
265 case IDA_HEADER_CONTACTS:
267 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
268 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK && pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_MULTI)
270 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_LIST_EDITOR));
274 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_LIST));
278 case IDA_HEADER_GROUPS:
280 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_LIST));
283 case IDA_HEADER_FAVORITES:
285 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
287 if (pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_SINGLE)
289 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FAVORITE_LIST));
291 else if (pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_MULTI)
293 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FAVORITE_LIST_EDITOR));
298 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FAVORITE_LIST));
302 case IDA_CHECK_SELECT_ALL_CHECKED:
304 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
306 int itemCount = __pListView->GetItemCountAt(groupIndex);
307 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
309 __pListView->SetItemChecked(groupIndex, itemIndex, true);
312 index |= groupIndex << LIST_VIEW_GROUP_INDEX_SHIFT;
314 Integer hashMapIndex(index);
316 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
318 if (__pTempContactValueHashMap->GetValue(hashMapIndex) == null)
320 String phoneNumber = __pPresentationModel->GetDefaultPhoneNumber(groupIndex, itemIndex);
321 __pTempContactValueHashMap->Add(*(new (std::nothrow) Integer(index)), *(new (std::nothrow) String(phoneNumber)));
324 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
326 if (__pTempContactValueHashMap->GetValue(hashMapIndex) == null)
328 String email = __pPresentationModel->GetDefaultEmail(groupIndex, itemIndex);
329 __pTempContactValueHashMap->Add(*(new (std::nothrow) Integer(index)), *(new (std::nothrow) String(email)));
334 __pListView->Invalidate(true);
338 case IDA_CHECK_SELECT_ALL_UNCHECKED:
340 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
342 int itemCount = __pListView->GetItemCountAt(groupIndex);
343 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
345 __pListView->SetItemChecked(groupIndex, itemIndex, false);
348 __pTempContactValueHashMap->RemoveAll(true);
349 __pListView->Invalidate(true);
353 case IDA_FOOTER_DELETE:
355 ShowDeleteConfirmationPopup();
358 case IDA_FOOTER_CANCEL:
360 pSceneManager->GoBackward(BackwardSceneTransition());
363 case IDA_FOOTER_DONE:
365 ReturnMultipleValues();
368 case IDA_POPUP_CONTACT_VALUE_CLOSE:
370 HideContactValuePopup();
373 case IDA_POPUP_DELETE_OK:
375 ShowDeleteProgressPopup();
378 case IDA_POPUP_DELETE_CANCEL:
380 HideDeleteConfirmationPopup();
383 case IDA_POPUP_DELETE_PROGRESS_CANCEL:
385 __deleteContactTimer.Cancel();
386 HideDeleteProgressPopup();
387 pSceneManager->GoBackward(BackwardSceneTransition());
396 ContactListEditorPanel::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
397 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
399 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
401 Form* pForm = dynamic_cast<Form*>(GetParent());
404 Header* pHeader = pForm->GetHeader();
405 pHeader->AddActionEventListener(*this);
407 Footer* pFooter = pForm->GetFooter();
408 pFooter->RemoveAllItems();
409 pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
410 pForm->SetFormMenuEventListener(null);
412 __pPresentationModel->InitializeContactList();
413 __pListView->SetFastScrollIndex(__pPresentationModel->GetAllKeys(), false);
414 __pListView->UpdateList();
416 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
418 pFooter->SetShowState(true);
420 FooterItem footerItemDone;
421 footerItemDone.Construct(IDA_FOOTER_DONE);
422 footerItemDone.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE"));
423 pFooter->AddItem(footerItemDone);
425 if (__pPresentationModel->GetContactCount() == 0)
427 pFooter->SetItemEnabled(0, false);
429 __pSearchBar->SetShowState(false);
430 __pCheckLabel->SetShowState(false);
431 __pSelectAll->SetShowState(false);
432 __pListView->SetShowState(false);
433 __pEmptyImageLabel->SetShowState(true);
434 __pEmptyCommentLabel->SetShowState(true);
435 __pBottomLabel->SetShowState(false);
440 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
442 int itemCount = __pListView->GetItemCountAt(groupIndex);
443 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
445 __pListView->SetItemChecked(groupIndex, itemIndex, false);
449 pFooter->SetItemEnabled(0, false);
451 __pSearchBar->SetShowState(true);
452 __pCheckLabel->SetShowState(true);
453 __pSelectAll->SetShowState(true);
454 __pListView->SetShowState(true);
455 __pEmptyImageLabel->SetShowState(false);
456 __pEmptyCommentLabel->SetShowState(false);
458 __pSelectAll->SetSelected(false);
463 __pSelectAll->SetSelected(false);
464 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
466 int itemCount = __pListView->GetItemCountAt(groupIndex);
467 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
469 __pListView->SetItemChecked(groupIndex, itemIndex, false);
473 FooterItem footerDelete;
474 footerDelete.Construct(IDA_FOOTER_DELETE);
475 footerDelete.SetText(ResourceManager::GetString(L"IDS_COM_SK_DELETE"));
477 FooterItem footerCancel;
478 footerCancel.Construct(IDA_FOOTER_CANCEL);
479 footerCancel.SetText(ResourceManager::GetString(L"IDS_PB_SK_CANCEL"));
480 pFooter->AddItem(footerCancel);
481 pFooter->AddItem(footerDelete);
482 pFooter->SetItemEnabled(1, false);
485 __pPresentationModel->AddContactChangeListener(*this);
486 pFooter->AddActionEventListener(*this);
491 pArgs->RemoveAll(true);
497 ContactListEditorPanel::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
498 const Tizen::Ui::Scenes::SceneId& nextSceneId)
500 Form* pForm = dynamic_cast<Form*>(GetParent());
503 if (pForm->IsFooterVisible() == false)
505 pForm->SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
508 Header* pHeader = pForm->GetHeader();
509 pHeader->RemoveActionEventListener(*this);
511 Footer* pFooter = pForm->GetFooter();
512 pFooter->RemoveActionEventListener(*this);
514 if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
516 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
519 __pPresentationModel->RemoveContactChangeListener(*this);
523 ContactListEditorPanel::RemoveContactList(void)
525 result r = E_FAILURE;
527 for (int groupIndex = __deleteGroupIndex; groupIndex < __pListView->GetGroupCount(); groupIndex++)
529 int itemCount = __pListView->GetItemCountAt(groupIndex);
530 for (int itemIndex = __deleteItemIndex; itemIndex < itemCount; itemIndex++)
532 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
534 r = __pPresentationModel->RemoveContact(groupIndex, itemIndex, false);
536 __deleteGroupIndex = groupIndex;
537 __deleteItemIndex = ++itemIndex;
542 __deleteItemIndex = 0;
545 __deleteGroupIndex = 0;
546 __deleteItemIndex = 0;
552 ContactListEditorPanel::GetCheckedContactCounts(void)
554 int contactCount = 0;
556 for (int groupIndex = __deleteGroupIndex; groupIndex < __pListView->GetGroupCount(); groupIndex++)
558 int itemCount = __pListView->GetItemCountAt(groupIndex);
559 for (int itemIndex = __deleteItemIndex; itemIndex < itemCount; itemIndex++)
561 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
571 Tizen::Ui::Controls::ListItemBase*
572 ContactListEditorPanel::CreateItem(int groupIndex, int itemIndex, int itemWidth)
575 Bitmap* pThumbnail = null;
577 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
579 CustomItem* pItem = new (std::nothrow) CustomItem();
580 pItem->Construct(Dimension(itemWidth, pContactsApp->GetListItemSingleLineHeight()), LIST_ANNEX_STYLE_MARK);
582 __pPresentationModel->GetContactItemInfoN(groupIndex, itemIndex, name, pThumbnail);
584 ContactListItem* pCustomElement = new (std::nothrow) ContactListItem(name, pThumbnail);
585 pItem->AddElement(Rectangle(0, 0, itemWidth - (ListItemBase::GetAnnexWidth(LIST_ANNEX_STYLE_MARK) + X_LIST_ITEM_TEXT_MARGIN), pContactsApp->GetListItemSingleLineHeight()), 0, *(static_cast<ICustomElement *>(pCustomElement)));
591 ContactListEditorPanel::DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
600 ContactListEditorPanel::GetItemCount(int groupIndex)
602 return __pPresentationModel->GetContactCount(groupIndex);
606 ContactListEditorPanel::GetGroupCount(void)
608 return __pPresentationModel->GetKeyCount();
611 Tizen::Ui::Controls::GroupItem*
612 ContactListEditorPanel::CreateGroupItem(int groupIndex, int itemWidth)
614 GroupItem* pItem = new (std::nothrow) GroupItem();
615 pItem->Construct(Dimension(itemWidth, H_GROUP_ITEM));
616 pItem->SetElement(__pPresentationModel->GetKey(groupIndex), null);
622 ContactListEditorPanel::DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::GroupItem* pItem, int itemWidth)
631 ContactListEditorPanel::OnSearchBarModeChanged(Tizen::Ui::Controls::SearchBar& source, Tizen::Ui::Controls::SearchBarMode mode)
633 if (mode == SEARCH_BAR_MODE_NORMAL)
635 int count = __pPresentationModel->GetSearchedContactCount();
636 bool isChecked = true;
638 for (int index = 0; index < count; index++)
643 __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
645 __pListView->SetItemChecked(groupIndex, itemIndex, __pSearchListView->IsItemChecked(0, index));
648 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount() && isChecked == true; groupIndex++)
650 int itemCount = __pListView->GetItemCountAt(groupIndex);
651 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
653 if (__pListView->IsItemChecked(groupIndex, itemIndex) == false)
661 __pListView->SetShowState(true);
662 __pListView->Invalidate(true);
663 __pCheckLabel->SetShowState(true);
664 __pSelectAll->SetShowState(true);
665 __pSelectAll->SetSelected(isChecked);
666 __pSearchListView->SetShowState(false);
667 __pPresentationModel->ResetSearchedContactList();
668 __pSearchListView->UpdateList();
673 ContactListEditorPanel::OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
678 ContactListEditorPanel::OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus status)
680 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
682 int mainGroupIndex = groupIndex;
683 int mainItemIndex = itemIndex;
685 if (listView.Equals(*__pSearchListView) == true)
687 __selectedSearchIndex = 0;
688 __selectedSearchIndex |= groupIndex << LIST_VIEW_GROUP_INDEX_SHIFT;
689 __selectedSearchIndex |= itemIndex;
691 __pPresentationModel->GetItemMainIndex(itemIndex, mainGroupIndex, mainItemIndex);
695 __selectedIndex |= mainGroupIndex << LIST_VIEW_GROUP_INDEX_SHIFT;
696 __selectedIndex |= mainItemIndex;
698 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
700 if (listView.IsItemChecked(groupIndex, itemIndex) == true)
703 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
705 pList = __pPresentationModel->GetAllPhoneNumbersN(mainGroupIndex, mainItemIndex);
709 ReturnResultFailed();
713 if (pList->GetCount() > 1)
715 listView.SetItemChecked(groupIndex, itemIndex, false);
716 __pContactValueListEvent = new (std::nothrow) ContactValueListItemProvider(pList);
717 ShowContactValuePopup(mainGroupIndex, mainItemIndex);
719 else if (pList->GetCount() == 1)
721 String* pContactValueInfo = static_cast<String *>(pList->GetAt(0));
723 pContactValueInfo->IndexOf(CHARACTER_SPACE, 0, blankIndex);
724 pContactValueInfo->Remove(0, blankIndex + 1);
725 __pTempContactValueHashMap->Add(*(new (std::nothrow) Integer(__selectedIndex)), *(new (std::nothrow) String(*pContactValueInfo)));
730 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
732 pList = __pPresentationModel->GetAllEmailsN(mainGroupIndex, mainItemIndex);
736 ReturnResultFailed();
740 if (pList->GetCount() > 1)
742 listView.SetItemChecked(groupIndex, itemIndex, false);
743 __pContactValueListEvent = new (std::nothrow) ContactValueListItemProvider(pList);
744 ShowContactValuePopup(mainGroupIndex, mainItemIndex);
746 else if (pList->GetCount() == 1)
748 String* pContactValueInfo = static_cast<String *>(pList->GetAt(0));
750 pContactValueInfo->IndexOf(CHARACTER_SPACE, 0, blankIndex);
751 pContactValueInfo->Remove(0, blankIndex + 1);
752 __pTempContactValueHashMap->Add(*(new (std::nothrow) Integer(__selectedIndex)), *(new (std::nothrow) String(*pContactValueInfo)));
760 Integer keyIndex(__selectedIndex);
761 __pTempContactValueHashMap->Remove(keyIndex, true);
765 if (listView.Equals(*__pListView) == true)
767 if (listView.IsItemChecked(groupIndex, itemIndex) == true)
769 bool isChecked = true;
770 for (int groupIndex = 0; groupIndex < listView.GetGroupCount() && isChecked == true; groupIndex++)
772 int itemCount = listView.GetItemCountAt(groupIndex);
773 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
775 if (listView.IsItemChecked(groupIndex, itemIndex) == false)
782 __pSelectAll->SetSelected(isChecked);
784 else if (listView.IsItemChecked(groupIndex, itemIndex) == false)
786 __pSelectAll->SetSelected(false);
789 else if (listView.Equals(*__pSearchListView) == true)
791 int count = __pPresentationModel->GetSearchedContactCount();
793 for (int index = 0; index < count; index++)
798 __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
800 __pListView->SetItemChecked(groupIndex, itemIndex, __pSearchListView->IsItemChecked(0, index));
808 ContactListEditorPanel::OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction)
813 ContactListEditorPanel::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
818 ContactListEditorPanel::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
820 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
822 int groupIndex = (__selectedIndex >> LIST_VIEW_GROUP_INDEX_SHIFT) & LIST_VIEW_MASK;
823 int itemIndex = __selectedIndex & LIST_VIEW_MASK;
826 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
828 pList = __pPresentationModel->GetAllPhoneNumbersN(groupIndex, itemIndex);
830 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
832 pList = __pPresentationModel->GetAllEmailsN(groupIndex, itemIndex);
837 ReturnResultFailed();
841 String* pContactValueInfo = static_cast<String *>(pList->GetAt(index));
843 pContactValueInfo->IndexOf(CHARACTER_SPACE, 0, blankIndex);
844 pContactValueInfo->Remove(0, blankIndex + 1);
845 __pTempContactValueHashMap->Add(*(new (std::nothrow) Integer(__selectedIndex)), *(new (std::nothrow) String(*pContactValueInfo)));
849 HideContactValuePopup();
851 if (__pListView->GetShowState() == true)
853 __pListView->SetItemChecked(groupIndex, itemIndex, true);
855 bool isChecked = true;
856 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount() && isChecked == true; groupIndex++)
858 int itemCount = __pListView->GetItemCountAt(groupIndex);
859 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
861 if (__pListView->IsItemChecked(groupIndex, itemIndex) == false)
869 __pSelectAll->SetSelected(isChecked);
873 groupIndex = (__selectedSearchIndex >> LIST_VIEW_GROUP_INDEX_SHIFT) & LIST_VIEW_MASK;
874 itemIndex = __selectedSearchIndex & LIST_VIEW_MASK;
875 __pSearchListView->SetItemChecked(groupIndex, itemIndex, true);
877 int count = __pPresentationModel->GetSearchedContactCount();
879 for (int index = 0; index < count; index++)
881 __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
883 __pListView->SetItemChecked(groupIndex, itemIndex, __pSearchListView->IsItemChecked(0, index));
891 ContactListEditorPanel::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
896 ContactListEditorPanel::OnFastScrollIndexSelected(Tizen::Ui::Control& source, Tizen::Base::String& index)
898 __pListView->ScrollToItem(__pPresentationModel->GetKeyIndex(index), -1);
899 __pListView->Invalidate(false);
903 ContactListEditorPanel::OnTextValueChanged(const Tizen::Ui::Control& source)
905 String searchText = __pSearchBar->GetText();
908 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
909 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
911 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_HAS_PHONE_ONLY);
913 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
915 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_HAS_EMAIL_ONLY);
919 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_NORMAL);
922 if (searchText.GetLength() != 0)
924 __pCheckLabel->SetShowState(false);
925 __pSelectAll->SetShowState(false);
926 __pListView->SetShowState(false);
927 __pSearchListView->SetShowState(true);
929 __pSearchListView->UpdateList();
931 int count = __pPresentationModel->GetSearchedContactCount();
933 for (int index = 0; index < count; index++)
938 __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
939 __pSearchListView->SetItemChecked(0, index, __pListView->IsItemChecked(groupIndex, itemIndex));
942 __pSearchListView->Invalidate(true);
946 __pCheckLabel->SetShowState(true);
947 __pSelectAll->SetShowState(true);
948 __pListView->SetShowState(true);
949 __pSearchListView->SetShowState(false);
951 int count = __pPresentationModel->GetSearchedContactCount();
952 bool isChecked = true;
954 for (int index = 0; index < count; index++)
959 __pPresentationModel->GetItemMainIndex(index, groupIndex, itemIndex);
960 __pListView->SetItemChecked(groupIndex, itemIndex, __pSearchListView->IsItemChecked(0, index));
963 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount() && isChecked == true; groupIndex++)
965 int itemCount = __pListView->GetItemCountAt(groupIndex);
966 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
968 if (__pListView->IsItemChecked(groupIndex, itemIndex) == false)
976 __pSelectAll->SetSelected(isChecked);
977 __pListView->Invalidate(true);
982 ContactListEditorPanel::OnTextValueChangeCanceled(const Tizen::Ui::Control& source)
987 ContactListEditorPanel::OnContactsChanged(void)
989 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
990 Form* pForm = dynamic_cast<Form*>(GetParent());
993 HideContactValuePopup();
995 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
997 Footer* pFooter = pForm->GetFooter();
998 pFooter->RemoveAllItems();
1000 FooterItem footerItemDone;
1001 footerItemDone.Construct(IDA_FOOTER_DONE);
1002 footerItemDone.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE"));
1003 pFooter->AddItem(footerItemDone);
1005 __pPresentationModel->InitializeContactList();
1007 if (__pPresentationModel->GetContactCount() == 0)
1009 pFooter->SetItemEnabled(0, false);
1011 __pSearchBar->SetShowState(false);
1012 __pCheckLabel->SetShowState(false);
1013 __pSelectAll->SetShowState(false);
1014 __pListView->SetShowState(false);
1015 __pEmptyImageLabel->SetShowState(true);
1016 __pEmptyCommentLabel->SetShowState(true);
1017 __pBottomLabel->SetShowState(false);
1021 if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
1023 Form* pForm = dynamic_cast<Form*>(GetParent());
1026 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
1030 __pListView->SetShowState(true);
1031 __pSelectAll->SetShowState(true);
1032 __pCheckLabel->SetShowState(true);
1034 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
1036 int itemCount = __pListView->GetItemCountAt(groupIndex);
1037 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
1039 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
1041 __pListView->SetItemChecked(groupIndex, itemIndex, false);
1046 pFooter->SetItemEnabled(0, false);
1048 __pSearchBar->SetShowState(true);
1049 __pSelectAll->SetSelected(false);
1050 __pEmptyImageLabel->SetShowState(false);
1051 __pEmptyCommentLabel->SetShowState(false);
1052 UpdateBottomLabel();
1054 __pListView->SetFastScrollIndex(__pPresentationModel->GetAllKeys(), false);
1055 __pListView->UpdateList();
1058 else if (__isContactRemoved == false)
1060 __pPresentationModel->InitializeContactList();
1061 if( __pPresentationModel->GetContactCount() == 0)
1063 SceneManager* pSceneManager = SceneManager::GetInstance();
1064 pSceneManager->GoBackward(BackwardSceneTransition());
1067 if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
1069 Form* pForm = dynamic_cast<Form*>(GetParent());
1072 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
1075 __pSelectAll->SetSelected(false);
1077 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
1079 int itemCount = __pListView->GetItemCountAt(groupIndex);
1080 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
1082 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
1084 __pListView->SetItemChecked(groupIndex, itemIndex, false);
1088 UpdateBottomLabel();
1089 __pListView->SetFastScrollIndex(__pPresentationModel->GetAllKeys(), false);
1090 __pListView->UpdateList();
1095 ContactListEditorPanel::OnCategoriesChanged(void)
1100 ContactListEditorPanel::UpdateBottomLabel(void)
1102 Form* pForm = dynamic_cast<Form*>(GetParent());
1104 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1105 int selectedCount = 0;
1106 int fotterItemIndex = 1;
1108 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
1110 fotterItemIndex = 0;
1114 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
1116 int itemCount = __pListView->GetItemCountAt(groupIndex);
1117 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
1119 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
1126 String selected = ResourceManager::GetString(L"IDS_COM_POP_SELECTED");
1127 selected.Append(L" (");
1128 selected.Append(selectedCount);
1129 selected.Append(L")");
1130 __pBottomLabel->SetText(selected);
1131 __pBottomLabel->SetPosition(FloatPoint(0, pForm->GetClientAreaBoundsF().height - H_BOTTOM_LABEL));
1132 __pBottomLabel->Invalidate(false);
1134 Footer* pFooter = pForm->GetFooter();
1136 if (selectedCount > 0 && __pBottomLabel->GetShowState() == false)
1138 __pBottomLabel->SetShowState(true);
1139 __pListView->SetSize(__pListView->GetSize().width, __pListView->GetSize().height - H_BOTTOM_LABEL);
1140 __pSearchListView->SetSize(__pSearchListView->GetSize().width, __pSearchListView->GetSize().height - H_BOTTOM_LABEL);
1141 pFooter->SetItemEnabled(fotterItemIndex, true);
1143 else if (selectedCount == 0 && __pBottomLabel->GetShowState() == true)
1145 __pBottomLabel->SetShowState(false);
1146 __pListView->SetSize(__pListView->GetSize().width, __pListView->GetSize().height + H_BOTTOM_LABEL);
1147 __pSearchListView->SetSize(__pSearchListView->GetSize().width, __pSearchListView->GetSize().height + H_BOTTOM_LABEL);
1148 pFooter->SetItemEnabled(fotterItemIndex, false);
1151 pFooter->Invalidate(true);
1157 ContactListEditorPanel::ShowContactValuePopup(int groupIndex, int itemIndex)
1159 delete __pMultipleContactValuePopup;
1160 __pMultipleContactValuePopup = new (std::nothrow) Popup();
1161 __pMultipleContactValuePopup->Construct(true, Dimension(W_CONTACT_VALUE_POPUP, H_CONTACT_VALUE_POPUP));
1162 __pMultipleContactValuePopup->SetTitleText(__pPresentationModel->GetName(groupIndex, itemIndex));
1163 __pMultipleContactValuePopup->SetPropagatedKeyEventListener(this);
1165 Rectangle popupClientBounds = __pMultipleContactValuePopup->GetClientAreaBounds();
1167 ListView* pListView = new (std::nothrow) ListView();
1168 pListView->Construct(Rectangle(0, 0, popupClientBounds.width, H_CONTACT_VALUE_POPUP_LIST_VIEW));
1169 pListView->SetItemProvider(*__pContactValueListEvent);
1170 pListView->AddListViewItemEventListener(*this);
1172 __pMultipleContactValuePopup->AddControl(pListView);
1174 Button* pCancelButton = new (std::nothrow) Button();
1175 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"));
1176 pCancelButton->SetActionId(IDA_POPUP_CONTACT_VALUE_CLOSE);
1177 pCancelButton->AddActionEventListener(*this);
1179 __pMultipleContactValuePopup->AddControl(pCancelButton);
1180 __pMultipleContactValuePopup->SetShowState(true);
1181 __pMultipleContactValuePopup->Show();
1185 ContactListEditorPanel::HideContactValuePopup(void)
1187 if (__pMultipleContactValuePopup != null)
1189 __pMultipleContactValuePopup->SetShowState(false);
1195 ContactListEditorPanel::ShowDeleteConfirmationPopup(void)
1197 if (__pDeleteConfirmationPopup == null)
1199 __pDeleteConfirmationPopup = new (std::nothrow) Popup();
1200 __pDeleteConfirmationPopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
1201 __pDeleteConfirmationPopup->SetPropagatedKeyEventListener(this);
1203 Rectangle popupClientBounds = __pDeleteConfirmationPopup->GetClientAreaBounds();
1205 Label* pLabel = new (std::nothrow) Label();
1206 pLabel->Construct(Rectangle(X_DELETE_LABEL, Y_DELETE_LABEL, W_DELETE_LABEL, H_DELETE_LABEL), ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
1207 pLabel->SetTextConfig(FONT_SIZE_DELETE_CONFIRM, LABEL_TEXT_STYLE_NORMAL);
1208 pLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1209 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1211 Button* pDeleteButton = new (std::nothrow) Button();
1212 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"));
1213 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
1214 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
1215 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
1216 pDeleteButton->SetTextSize(FONT_SIZE_DELETE_BUTTON);
1217 pDeleteButton->SetActionId(IDA_POPUP_DELETE_OK);
1218 pDeleteButton->AddActionEventListener(*this);
1220 Button* pCancelButton = new (std::nothrow) Button();
1221 pCancelButton->Construct(Rectangle(X_DELETE_LABEL, Y_DELETE_BUTTON, W_DELETE_BUTTON, H_DELETE_BUTTON), ResourceManager::GetString(L"IDS_PB_SK_CANCEL"));
1222 pCancelButton->SetTextSize(FONT_SIZE_DELETE_BUTTON);
1223 pCancelButton->SetActionId(IDA_POPUP_DELETE_CANCEL);
1224 pCancelButton->AddActionEventListener(*this);
1226 __pDeleteConfirmationPopup->AddControl(pLabel);
1227 __pDeleteConfirmationPopup->AddControl(pDeleteButton);
1228 __pDeleteConfirmationPopup->AddControl(pCancelButton);
1231 __pDeleteConfirmationPopup->SetShowState(true);
1232 __pDeleteConfirmationPopup->Show();
1236 ContactListEditorPanel::HideDeleteConfirmationPopup(void)
1238 if (__pDeleteConfirmationPopup != null)
1240 __pDeleteConfirmationPopup->SetShowState(false);
1246 ContactListEditorPanel::ShowDeleteProgressPopup(void)
1248 if (__pDeleteProgressPopup != null)
1250 delete __pDeleteProgressPopup;
1253 __pDeleteProgressPopup = new (std::nothrow) Popup();
1254 __pDeleteProgressPopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_PROGRESS_POPUP));
1255 __pDeleteProgressPopup->AddWindowEventListener(*this);
1257 Rectangle clientBounds = __pDeleteProgressPopup->GetClientAreaBounds();
1259 Label* pLabelTitle = new (std::nothrow) Label();
1260 pLabelTitle->Construct(Rectangle(0, Y_DELETE_POPUP_TITLE, clientBounds.width, H_DELETE_POPUP_ELEMENT), ResourceManager::GetString(L"IDS_PB_POP_DELETING_CONTACTS_ING"));
1261 pLabelTitle->SetTextColor(COLOR_DELETE_POPUP_TEXT);
1262 pLabelTitle->SetTextConfig(FONT_SIZE_DELETE_POPUP_TEXT, LABEL_TEXT_STYLE_BOLD);
1263 pLabelTitle->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1265 __pDeleteProgressPopup->AddControl(pLabelTitle);
1267 Progress* pProgress = new (std::nothrow) Progress();
1268 pProgress->Construct(Rectangle(0, Y_DELETE_POPUP_TITLE + H_DELETE_POPUP_ELEMENT, clientBounds.width, H_DELETE_POPUP_PROGRESS), 0, GetCheckedContactCounts());
1270 __pDeleteProgressPopup->AddControl(pProgress);
1272 Label* pLabelPercentage = new (std::nothrow) Label();
1273 pLabelPercentage->Construct(Rectangle(0, pProgress->GetY() + pProgress->GetHeight(), clientBounds.width / 2, H_DELETE_POPUP_ELEMENT), Integer::ToString(pProgress->GetPercentComplete()) + L"%");
1274 pLabelPercentage->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1275 pLabelPercentage->SetTextColor(COLOR_DELETE_POPUP_TEXT);
1276 pLabelPercentage->SetTextConfig(FONT_SIZE_DELETE_POPUP_TEXT, LABEL_TEXT_STYLE_NORMAL);
1278 __pDeleteProgressPopup->AddControl(pLabelPercentage);
1280 String currentOfTotal(Integer::ToString(pProgress->GetValue()) + L" / " + Integer::ToString(GetCheckedContactCounts()));
1281 Label* pLabelTotal = new (std::nothrow) Label();
1282 pLabelTotal->Construct(Rectangle(clientBounds.width / 2, pLabelPercentage->GetY(), clientBounds.width / 2, H_DELETE_POPUP_ELEMENT), currentOfTotal);
1283 pLabelTotal->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
1284 pLabelTotal->SetTextColor(COLOR_DELETE_POPUP_TEXT);
1285 pLabelTotal->SetTextConfig(FONT_SIZE_DELETE_POPUP_TEXT, LABEL_TEXT_STYLE_NORMAL);
1287 __pDeleteProgressPopup->AddControl(pLabelTotal);
1289 Button* pCancelButton = new (std::nothrow) Button();
1290 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));
1291 pCancelButton->SetText(ResourceManager::GetString("IDS_PB_SK_CANCEL"));
1292 pCancelButton->SetActionId(IDA_POPUP_DELETE_PROGRESS_CANCEL);
1293 pCancelButton->AddActionEventListener(*this);
1295 __pDeleteProgressPopup->AddControl(pCancelButton);
1296 __pDeleteProgressPopup->Show();
1298 __isContactRemoved = true;
1302 ContactListEditorPanel::HideDeleteProgressPopup(void)
1304 if (__pDeleteProgressPopup != null)
1306 delete __pDeleteProgressPopup;
1307 __pDeleteProgressPopup = null;
1309 __isContactRemoved = false;
1311 __pListView->UpdateList();
1316 ContactListEditorPanel::ReturnValues(RequestId requestId, Tizen::App::AppCtrlResult appCtrlResult, const Tizen::Base::Collection::IMap* pReturnValue)
1318 AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance();
1319 result r = pAppManager->SendAppControlResult(requestId, appCtrlResult, pReturnValue);
1320 AppLogDebug("[%s] The return result from SendAppControlResult(), AppCtrlResult value : %d.", GetErrorMessage(r), appCtrlResult);
1322 UiApp::GetInstance()->Terminate();
1326 ContactListEditorPanel::ReturnMultipleValues(void)
1328 if (CommonUtil::isMemoryAvailable() == false)
1330 CommonUtil::showMemoryFullMessageBox();
1334 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1336 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
1338 ArrayList* pValueList = new (std::nothrow) ArrayList();
1339 pValueList->Construct();
1341 HashMap* pReturnValue = new (std::nothrow) HashMap();
1342 pReturnValue->Construct();
1344 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
1346 IMapEnumerator* pMapEnum = __pTempContactValueHashMap->GetMapEnumeratorN();
1347 while (pMapEnum->MoveNext() == E_SUCCESS)
1349 String* pValue = static_cast<String*> (pMapEnum->GetValue());
1350 pValueList->Add(new (std::nothrow) String(*pValue));
1352 pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_PHONE), pValueList);
1356 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
1358 IMapEnumerator* pMapEnum = __pTempContactValueHashMap->GetMapEnumeratorN();
1359 while (pMapEnum->MoveNext() == E_SUCCESS)
1361 String* pValue = static_cast<String*> (pMapEnum->GetValue());
1362 pValueList->Add(new (std::nothrow) String(*pValue));
1364 pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_EMAIL), pValueList);
1368 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_ITEM_ID)
1370 for (int groupIndex = 0; groupIndex < __pListView->GetGroupCount(); groupIndex++)
1372 int itemCount = __pListView->GetItemCountAt(groupIndex);
1373 for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
1375 if (__pListView->IsItemChecked(groupIndex, itemIndex) == true)
1378 contactId.Append(__pPresentationModel->GetContactId(groupIndex, itemIndex));
1379 pValueList->Add(new (std::nothrow) String(contactId));
1383 pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_ITEM_ID), pValueList);
1389 ReturnValues(pContactsApp->GetRequestId(), APP_CTRL_RESULT_FAILED, pReturnValue);
1394 ReturnValues(pContactsApp->GetRequestId(), APP_CTRL_RESULT_SUCCEEDED, pReturnValue);
1399 ContactListEditorPanel::ReturnResultFailed(void)
1401 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
1403 ReturnValues(pContactsApp->GetRequestId(), APP_CTRL_RESULT_FAILED, null);
1407 ContactListEditorPanel::OnKeypadWillOpen(Tizen::Ui::Control& source)
1412 ContactListEditorPanel::OnKeypadOpened(Tizen::Ui::Control& source)
1414 Form* pForm = dynamic_cast<Form*>(GetParent());
1417 if (__pBottomLabel->GetShowState() == true)
1419 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, pForm->GetClientAreaBounds().width, pForm->GetClientAreaBounds().height - H_SEARCHBAR - H_BOTTOM_LABEL));
1420 __pBottomLabel->SetPosition(FloatPoint(0, pForm->GetClientAreaBoundsF().height - H_BOTTOM_LABEL));
1421 __pBottomLabel->Invalidate(true);
1425 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, pForm->GetClientAreaBounds().width, pForm->GetClientAreaBounds().height - H_SEARCHBAR));
1430 ContactListEditorPanel::OnKeypadClosed(Tizen::Ui::Control& source)
1432 Form* pForm = dynamic_cast<Form*>(GetParent());
1435 if (__pBottomLabel->GetShowState() == true)
1437 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, pForm->GetClientAreaBounds().width, pForm->GetClientAreaBounds().height - H_SEARCHBAR - H_BOTTOM_LABEL));
1438 __pBottomLabel->SetPosition(FloatPoint(0, pForm->GetClientAreaBoundsF().height - H_BOTTOM_LABEL));
1439 __pBottomLabel->Invalidate(true);
1440 if (SceneManager::GetInstance()->GetCurrentSceneId() == IDSCN_CONTACT_LIST_EDITOR)
1442 UpdateBottomLabel();
1447 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, pForm->GetClientAreaBounds().width, pForm->GetClientAreaBounds().height - H_SEARCHBAR));
1452 ContactListEditorPanel::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1454 Form* pForm = dynamic_cast<Form*>(GetParent());
1456 if (__pBottomLabel->GetShowState() == true)
1458 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, pForm->GetClientAreaBounds().width, pForm->GetClientAreaBounds().height - H_SEARCHBAR - H_BOTTOM_LABEL));
1459 __pBottomLabel->SetPosition(FloatPoint(0, pForm->GetClientAreaBoundsF().height - H_BOTTOM_LABEL));
1460 __pBottomLabel->Invalidate(true);
1464 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, pForm->GetClientAreaBounds().width, pForm->GetClientAreaBounds().height - H_SEARCHBAR));
1469 ContactListEditorPanel::OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction)
1471 if (keypadAction == KEYPAD_ACTION_SEARCH)
1473 __pSearchBar->HideKeypad();
1478 ContactListEditorPanel::OnWindowActivated (const Tizen::Ui::Window &source)
1480 __deleteContactTimer.Start(1);
1484 ContactListEditorPanel::OnWindowDeactivated (const Tizen::Ui::Window &source)
1489 ContactListEditorPanel::OnTimerExpired(Tizen::Base::Runtime::Timer &timer)
1491 Progress* pProgress = static_cast<Progress *>(__pDeleteProgressPopup->GetControl(1));
1493 pProgress->SetValue(pProgress->GetValue() + 1);
1494 pProgress->Invalidate(false);
1496 Label* pLabelPercentage = static_cast<Label *>(__pDeleteProgressPopup->GetControl(2));
1498 pLabelPercentage->SetText(Integer::ToString(pProgress->GetPercentComplete()) + L"%");
1499 pLabelPercentage->Invalidate(false);
1501 Label* pLabelTotal = static_cast<Label *>(__pDeleteProgressPopup->GetControl(3));
1503 String currentOfTotal = pLabelTotal->GetText();
1504 currentOfTotal.Remove(0, Integer::ToString(pProgress->GetValue() - 1).GetLength());
1505 currentOfTotal.Insert(Integer::ToString(pProgress->GetValue()), 0);
1506 pLabelTotal->SetText(currentOfTotal);
1507 pLabelTotal->Invalidate(false);
1509 if (RemoveContactList() == E_SUCCESS)
1511 __deleteContactTimer.Start(1);
1515 SceneManager* pSceneManager = SceneManager::GetInstance();
1516 pSceneManager->GoBackward(BackwardSceneTransition());
1521 ContactListEditorPanel::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo & touchInfo)
1523 GroupedListView* pList = static_cast<GroupedListView*>(&const_cast<Control&>(source));
1531 ContactListEditorPanel::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1536 ContactListEditorPanel::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1541 ContactListEditorPanel::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1546 ContactListEditorPanel::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1551 ContactListEditorPanel::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
1557 ContactListEditorPanel::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
1559 if (keyEventInfo.GetKeyCode() == KEY_BACK || keyEventInfo.GetKeyCode() == KEY_ESC)
1561 if (__pDeleteConfirmationPopup && __pDeleteConfirmationPopup->GetShowState() == true)
1563 HideDeleteConfirmationPopup();
1566 if (__pMultipleContactValuePopup && __pMultipleContactValuePopup->GetShowState() == true)
1568 HideContactValuePopup();
1576 ContactListEditorPanel::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
1582 ContactListEditorPanel::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)