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 CtContactListPanel.cpp
19 * @brief This is the implementation file for the ContactListPanel class.
23 #include "CtAccountListItemProvider.h"
24 #include "CtContactListItem.h"
25 #include "CtContactListPanel.h"
26 #include "CtContactListPresentationModel.h"
27 #include "CtContactsApp.h"
28 #include "CtMainForm.h"
29 #include "CtResourceManager.h"
30 #include "CtSceneRegister.h"
31 #include "CtSearchListEventListener.h"
32 #include "CtSearchListItem.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;
43 using namespace Tizen::System;
46 static const int IDA_FOOTER_CREATE = 1;
47 static const int IDA_MORE_DELETE = 2;
48 static const int IDA_MORE_SETTING = 3;
49 static const int IDA_HEADER_CONTACTS = 10;
50 static const int IDA_HEADER_GROUPS = 11;
51 static const int IDA_HEADER_FAVORITES = 12;
52 static const int IDA_POPUP_DELETE_OK = 30;
53 static const int IDA_POPUP_DELETE_CANCEL = 31;
54 static const int IDA_POPUP_VIEW_OK = 32;
55 static const int IDA_POPUP_VIEW_CANCEL = 33;
56 static const int IDA_POPUP_CONTACT_VALUE_CLOSE = 34;
57 static const int IDA_LIST_ELEMENT_DELETE = 40;
58 static const int IDA_LIST_ELEMENT_CALL = 41;
59 static const int IDA_LIST_ELEMENT_MESSAGE = 42;
60 static const int IDA_LIST_ELEMENT_VIDEO_CALL = 43;
62 static const int X_EMPTY_IMAGE = 220;
63 static const int Y_EMPTY_IMAGE = 300;
64 static const int W_EMPTY_IMAGE = 280;
65 static const int H_EMPTY_IMAGE = 280;
66 static const int Y_EMPTY_COMMENT = 618;
67 static const int H_EMPTY_COMMENT = 38;
68 static const int H_GROUP_ITEM = 76;
69 static const int W_INITIAL_PANEL = 10;
70 static const int H_INITIAL_PANEL = 10;
71 static const int H_SEARCHBAR = 86;
72 static const int W_ACCOUNT_POPUP = 600;
73 static const int H_ACCOUNT_POPUP = 700;
74 static const int H_ACCOUNT_POPUP_BUTTON = 80;
75 static const int W_CONTACT_VALUE_POPUP = 688;
76 static const int H_CONTACT_VALUE_POPUP = 532;
77 static const int H_CONTACT_VALUE_POPUP_LIST_VIEW = 338;
78 static const int H_CLOSE_BUTTON = 74;
79 static const int Y_CLOSE_BUTTON = 358;
80 static const int W_CLOSE_BUTTON = 394;
82 static const int FONT_SIZE_EMPTY_COMMENT = 32;
84 static const unsigned int COLOR_EMPTY_COMMENT = Color32<102, 102, 102>::Value;
85 static const unsigned int COLOR_DELETE_BUTTON_NORMAL = Color32<213, 82, 82>::Value;
86 static const unsigned int COLOR_DELETE_BUTTON_PRESSED = Color32<194, 71, 71>::Value;
87 static const unsigned int COLOR_DELETE_BUTTON_TEXT = Color32<248, 246, 239>::Value;
88 static const unsigned int COLOR_DELETE_ELEMENT_NORMAL = Color32<208, 82, 82>::Value;
89 static const unsigned int COLOR_DELETE_ELEMENT_PRESSED = Color32<194, 71, 71>::Value;
90 static const unsigned int COLOR_DELETE_ELEMENT_TEXT = Color32<248, 246, 239>::Value;
92 static const int LIST_VIEW_GROUP_INDEX_SHIFT = 16;
93 static const int LIST_VIEW_MASK = 0xFFFF;
95 static const wchar_t* IDB_NO_CONTENTS = L"00_Nocontents_text.png";
97 static const wchar_t* INPUT_KEY_MESSAGE_TYPE = L"http://tizen.org/appcontrol/data/message/type";
98 static const wchar_t* INPUT_KEY_CALL_TYPE = L"http://tizen.org/appcontrol/data/call/type";
99 static const wchar_t* INPUT_KEY_MESSAGE_TO = L"http://tizen.org/appcontrol/data/to";
100 static const wchar_t* INPUT_TYPE_VIDEO = L"video";
101 static const wchar_t* INPUT_TYPE_VOICE = L"voice";
102 static const wchar_t* INPUT_TYPE_SMS = L"sms";
103 static const wchar_t* INPUT_URI_TEL = L"tel:";
105 ContactListPanel::ContactListPanel(void)
106 : __pAppControl(null)
109 , __pSearchListView(null)
110 , __pAccountPopup(null)
111 , __pDeletePopup(null)
112 , __pMultipleContactValuePopup(null)
114 , __pEmptyImageLabel(null)
115 , __pEmptyCommentLabel(null)
116 , __pOptionMenu(null)
117 , __pAccountListEvent(null)
118 , __pPresentationModel(null)
119 , __pContactValueListEvent(null)
120 , __pSearchListEvent(null)
121 , __sweptItemIndex(0)
122 , __selectedIndex(-1)
126 ContactListPanel::~ContactListPanel(void)
131 ContactListPanel::Initialize(void)
133 Construct(Rectangle(0, 0, W_INITIAL_PANEL, H_INITIAL_PANEL));
137 ContactListPanel::OnInitializing(void)
139 const Form* pForm = dynamic_cast<Form*>(GetParent());
142 Rectangle clientBounds = pForm->GetClientAreaBounds();
143 SetBounds(Rectangle(0, 0, clientBounds.width, clientBounds.height));
145 __pPresentationModel = ContactListPresentationModel::GetInstance();
147 __pListView = new (std::nothrow) GroupedListView();
148 __pListView->Construct(Rectangle(0, H_SEARCHBAR, clientBounds.width, clientBounds.height - H_SEARCHBAR), GROUPED_LIST_VIEW_STYLE_INDEXED, true, true);
149 __pListView->SetItemProvider(*this);
150 __pListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_PB_BODY_NO_CONTACTS"));
151 __pListView->AddFastScrollListener(*this);
152 __pListView->AddGroupedListViewItemEventListener(*this);
153 __pListView->AddTouchEventListener(*this);
155 AddControl(__pListView);
157 __pSearchBar = new (std::nothrow) SearchBar();
158 __pSearchBar->Construct(Rectangle(0, 0, clientBounds.width, H_SEARCHBAR));
159 __pSearchBar->SetGuideText(ResourceManager::GetString(L"IDS_COM_BODY_SEARCH"));
160 __pSearchBar->AddSearchBarEventListener(*this);
161 __pSearchBar->AddFocusEventListener(*this);
162 __pSearchBar->AddTextEventListener(*this);
163 __pSearchBar->AddKeypadEventListener(*this);
164 __pSearchBar->SetContentAreaSize(Dimension(0, 0));
166 __pSearchListEvent = new (std::nothrow) SearchListEventListener(LIST_ANNEX_STYLE_NORMAL, __pPresentationModel);
168 AddControl(__pSearchBar);
170 __pSearchListView = new (std::nothrow) GroupedListView();
171 __pSearchListView->Construct(Rectangle(0, H_SEARCHBAR, clientBounds.width, clientBounds.height - H_SEARCHBAR), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
172 __pSearchListView->SetItemProvider(*__pSearchListEvent);
173 __pSearchListView->AddGroupedListViewItemEventListener(*this);
174 __pSearchListView->AddTouchEventListener(*this);
175 __pSearchListView->SetTextOfEmptyList(ResourceManager::GetString(L"IDS_PB_BODY_NO_CONTACTS"));
176 __pSearchListView->SetShowState(false);
177 AddControl(__pSearchListView);
179 __pEmptyImageLabel = new (std::nothrow) Label();
180 __pEmptyImageLabel->Construct(Rectangle(X_EMPTY_IMAGE, Y_EMPTY_IMAGE, W_EMPTY_IMAGE, H_EMPTY_IMAGE), L"");
181 Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_NO_CONTENTS);
184 __pEmptyImageLabel->SetBackgroundBitmap(*pBitmap);
187 __pEmptyImageLabel->SetShowState(false);
189 AddControl(__pEmptyImageLabel);
191 __pEmptyCommentLabel = new (std::nothrow) Label();
192 __pEmptyCommentLabel->Construct(Rectangle(0, Y_EMPTY_COMMENT, clientBounds.width, H_EMPTY_COMMENT),
193 ResourceManager::GetString(L"IDS_PB_BODY_NO_CONTACTS"));
194 __pEmptyCommentLabel->SetTextConfig(FONT_SIZE_EMPTY_COMMENT, LABEL_TEXT_STYLE_NORMAL);
195 __pEmptyCommentLabel->SetTextColor(Color(COLOR_EMPTY_COMMENT));
196 __pEmptyCommentLabel->SetShowState(false);
198 AddControl(__pEmptyCommentLabel);
200 __pOptionMenu = new (std::nothrow) OptionMenu();
201 __pOptionMenu->Construct();
202 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_SK_DELETE"), IDA_MORE_DELETE);
203 __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_SETTINGS"), IDA_MORE_SETTING);
204 __pOptionMenu->AddActionEventListener(*this);
205 __pOptionMenu->SetShowState(false);
210 ContactListPanel::OnTerminating(void)
212 result r = E_SUCCESS;
214 if (__pPresentationModel != null)
216 __pPresentationModel->RemoveContactChangeListener(*this);
219 if (__pArgList != null)
221 __pArgList->RemoveAll(true);
224 if (__pDeletePopup != null)
226 delete __pDeletePopup;
228 delete __pAppControl;
229 delete __pAccountPopup;
230 delete __pSearchListEvent;
231 delete __pAccountListEvent;
232 delete __pOptionMenu;
233 delete __pMultipleContactValuePopup;
239 ContactListPanel::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
241 SceneManager* pSceneManager = SceneManager::GetInstance();
242 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
243 Form* pForm = dynamic_cast<Form*>(GetParent());
246 if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
248 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
253 case IDA_HEADER_CONTACTS:
255 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_LIST));
258 case IDA_HEADER_GROUPS:
260 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_LIST));
263 case IDA_HEADER_FAVORITES:
265 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
267 if (pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_SINGLE)
269 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FAVORITE_LIST));
271 else if (pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_MULTI)
273 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FAVORITE_LIST_EDITOR));
278 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FAVORITE_LIST));
282 case IDA_FOOTER_CREATE:
284 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
287 case IDA_MORE_DELETE:
289 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_LIST_EDITOR));
292 case IDA_MORE_SETTING:
294 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTINGS, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
297 case IDA_POPUP_DELETE_OK:
299 int groupIndex = (__sweptItemIndex >> LIST_VIEW_GROUP_INDEX_SHIFT) & LIST_VIEW_MASK;
300 int itemIndex = __sweptItemIndex & LIST_VIEW_MASK;
302 __pPresentationModel->RemoveContact(groupIndex, itemIndex);
306 case IDA_POPUP_DELETE_CANCEL:
311 case IDA_POPUP_VIEW_OK:
316 case IDA_POPUP_VIEW_CANCEL:
321 case IDA_POPUP_CONTACT_VALUE_CLOSE:
323 HideContactValuePopup();
332 ContactListPanel::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
333 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
335 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
337 Form* pForm = dynamic_cast<Form*>(GetParent());
340 Form *pEventForm = const_cast<Form*>(pForm);
341 pEventForm->SetFormMenuEventListener(this);
343 Header* pHeader = pForm->GetHeader();
344 pHeader->AddActionEventListener(*this);
346 Footer* pFooter = pForm->GetFooter();
347 pFooter->AddActionEventListener(*this);
348 pForm->SetFormMenuEventListener(null);
350 __pPresentationModel->InitializeContactList();
352 __pListView->SetFastScrollIndex(__pPresentationModel->GetAllKeys(), false);
353 __pListView->UpdateList();
355 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK || pContactsApp->GetOperationId() == OPERATION_ID_EDIT)
357 pFooter->SetShowState(false);
358 SetBounds(Rectangle(0, 0, pForm->GetClientAreaBounds().width, pForm->GetClientAreaBounds().height));
359 __pListView->SetSize(__pListView->GetWidth(), pForm->GetClientAreaBounds().height - __pSearchBar->GetHeight());
360 __pSearchListView->SetSize(__pSearchListView->GetWidth(), pForm->GetClientAreaBounds().height - __pSearchBar->GetHeight());
363 if (__pPresentationModel->GetContactCount() == 0)
365 __pSearchBar->SetShowState(false);
366 __pListView->SetShowState(false);
367 __pEmptyImageLabel->SetShowState(true);
368 __pEmptyCommentLabel->SetShowState(true);
372 __pSearchBar->SetShowState(true);
373 __pListView->SetShowState(true);
374 __pEmptyImageLabel->SetShowState(false);
375 __pEmptyCommentLabel->SetShowState(false);
380 __pArgList = new (std::nothrow) ArrayList();
381 __pArgList->Construct();
383 for (int i = 0; i < pArgs->GetCount(); i++)
385 __pArgList->Add(new (std::nothrow) String(*static_cast<String*>(pArgs->GetAt(i))));
391 FooterItem footerItemCreate;
392 footerItemCreate.Construct(IDA_FOOTER_CREATE);
393 footerItemCreate.SetText(ResourceManager::GetString(L"IDS_COM_BODY_CREATE"));
395 int count = pFooter->GetItemCount();
398 pFooter->AddItem(footerItemCreate);
402 pFooter->SetItemAt(0, footerItemCreate);
406 pFooter->SetItemAt(0, footerItemCreate);
407 pFooter->RemoveItemAt(1);
408 pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
411 if (__pPresentationModel->GetContactCount() > 0)
413 pForm->SetFormMenuEventListener(this);
414 __pSearchBar->SetShowState(true);
415 __pListView->SetShowState(true);
416 __pEmptyImageLabel->SetShowState(false);
417 __pEmptyCommentLabel->SetShowState(false);
419 if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT && __pSearchBar->GetTextLength() != 0)
421 String searchText = __pSearchBar->GetText();
424 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
425 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
427 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_HAS_PHONE_ONLY);
429 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
431 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_HAS_EMAIL_ONLY);
435 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_NORMAL);
437 __pSearchListView->UpdateList();
438 __pListView->SetShowState(false);
439 __pSearchListView->SetShowState(true);
443 __pListView->SetShowState(true);
444 __pSearchListView->SetShowState(false);
449 __pSearchBar->SetShowState(false);
450 __pListView->SetShowState(false);
451 __pSearchListView->SetShowState(false);
452 __pEmptyImageLabel->SetShowState(true);
453 __pEmptyCommentLabel->SetShowState(true);
455 pContactsApp->AddContactsAppChangeEventListener(*this);
458 __pPresentationModel->AddContactChangeListener(*this);
460 SettingInfo::AddSettingEventListener(*this);
464 pArgs->RemoveAll(true);
470 ContactListPanel::OnSettingChanged(Tizen::Base::String &key)
472 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
473 TryReturnVoid(pContactsApp != null, "Unable to get ContactsApp instance.");
475 if(key == L"http://tizen.org/setting/contacts.order.firstname")
477 __pPresentationModel->InitializeContactList();
479 __pListView->SetFastScrollIndex(__pPresentationModel->GetAllKeys(), false);
480 __pListView->UpdateList();
482 if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
484 String searchText = __pSearchBar->GetText();
487 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
488 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
490 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_HAS_PHONE_ONLY);
492 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
494 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_HAS_EMAIL_ONLY);
498 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_NORMAL);
500 __pSearchListView->UpdateList();
506 ContactListPanel::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
507 const Tizen::Ui::Scenes::SceneId& nextSceneId)
509 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
511 Form* pForm = dynamic_cast<Form*>(GetParent());
514 Form *pEventForm = const_cast<Form*>(pForm);
515 pEventForm->SetFormMenuEventListener(null);
517 if (pForm->IsFooterVisible() == false)
519 pForm->SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
522 Header* pHeader = pForm->GetHeader();
523 pHeader->RemoveActionEventListener(*this);
525 Footer* pFooter = pForm->GetFooter();
526 pFooter->RemoveActionEventListener(*this);
528 __pPresentationModel->RemoveContactChangeListener(*this);
529 pContactsApp->RemoveContactsAppChangeEventListener(*this);
530 SettingInfo::RemoveSettingEventListener(*this);
532 delete __pAppControl;
533 __pAppControl = null;
537 ContactListPanel::GetGroupCount(void)
539 return __pPresentationModel->GetKeyCount();
543 ContactListPanel::GetItemCount(int groupIndex)
545 return __pPresentationModel->GetContactCount(groupIndex);
548 Tizen::Ui::Controls::ListItemBase*
549 ContactListPanel::CreateItem(int groupIndex, int itemIndex, int itemWidth)
552 Bitmap* pThumbnail = null;
554 ContactsApp *pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
555 CustomItem* pItem = new (std::nothrow) CustomItem();
556 pItem->Construct(Dimension(itemWidth, pContactsApp->GetListItemSingleLineHeight()), LIST_ANNEX_STYLE_NORMAL);
558 __pPresentationModel->GetContactItemInfoN(groupIndex, itemIndex, name, pThumbnail);
560 ContactListItem* pCustomElement = new (std::nothrow) ContactListItem(name, pThumbnail);
561 pItem->AddElement(Rectangle(0, 0, itemWidth, pContactsApp->GetListItemSingleLineHeight()), 0, *(static_cast<ICustomElement *>(pCustomElement)));
563 if (pContactsApp->GetOperationId().IsEmpty() == false)
568 bool isCallEnabled = true;
569 bool isMessageEnabled = true;
570 if (__pPresentationModel->GetDefaultPhoneNumber(groupIndex, itemIndex).IsEmpty())
572 isCallEnabled = false;
575 if ((__pPresentationModel->GetDefaultPhoneNumber(groupIndex, itemIndex).IsEmpty()) && (__pPresentationModel->GetDefaultEmail(groupIndex, itemIndex).IsEmpty()))
577 isMessageEnabled = false;
580 ListContextItem* pItemContext = new (std::nothrow) ListContextItem();
581 pItemContext->Construct();
582 pItemContext->AddElement(IDA_LIST_ELEMENT_CALL, ResourceManager::GetString(L"IDS_COM_BODY_CALL"), isCallEnabled);
583 pItemContext->AddElement(IDA_LIST_ELEMENT_MESSAGE, ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"), isMessageEnabled);
584 #if __SUPPORT_VIDEO_CALL
585 pItemContext->AddElement(IDA_LIST_ELEMENT_VIDEO_CALL, ResourceManager::GetString(L"IDS_COM_BODY_VIDEO_CALL"), isCallEnabled);
587 pItemContext->AddElement(IDA_LIST_ELEMENT_DELETE, ResourceManager::GetString(L"IDS_COM_SK_DELETE"));
588 pItemContext->SetElementBackgroundColor(IDA_LIST_ELEMENT_DELETE, LIST_CONTEXT_ITEM_ELEMENT_STATUS_NORMAL, COLOR_DELETE_ELEMENT_NORMAL);
589 pItemContext->SetElementBackgroundColor(IDA_LIST_ELEMENT_DELETE, LIST_CONTEXT_ITEM_ELEMENT_STATUS_PRESSED, COLOR_DELETE_ELEMENT_PRESSED);
590 pItemContext->SetElementTextColor(IDA_LIST_ELEMENT_DELETE, LIST_CONTEXT_ITEM_ELEMENT_STATUS_NORMAL, COLOR_DELETE_ELEMENT_TEXT);
592 pItem->SetContextItem(pItemContext);
597 Tizen::Ui::Controls::GroupItem*
598 ContactListPanel::CreateGroupItem(int groupIndex, int itemWidth)
600 GroupItem* pItem = new (std::nothrow) GroupItem();
601 pItem->Construct(Dimension(itemWidth, H_GROUP_ITEM));
602 pItem->SetElement(__pPresentationModel->GetKey(groupIndex), null);
608 ContactListPanel::DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
610 CustomItem* pCustomItem = static_cast<CustomItem *>(pItem);
611 pCustomItem->RemoveAllElements();
620 ContactListPanel::DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::GroupItem* pItem, int itemWidth)
629 ContactListPanel::OnContactsChanged(void)
631 Form* pForm = dynamic_cast<Form*>(GetParent());
634 HideContactValuePopup();
637 if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
639 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
643 __pPresentationModel->InitializeContactList();
645 if (__pPresentationModel->GetContactCount() > 0)
650 pForm->SetFormMenuEventListener(this);
651 __pSearchBar->SetShowState(true);
652 __pListView->SetShowState(true);
653 __pEmptyImageLabel->SetShowState(false);
654 __pEmptyCommentLabel->SetShowState(false);
656 __pListView->GetTopDrawnItemIndex(groupIndex, itemIndex);
657 __pListView->UpdateList();
658 __pListView->SetFastScrollIndex(__pPresentationModel->GetAllKeys(), false);
659 __pListView->Invalidate(true);
660 __pListView->ScrollToItem(groupIndex, itemIndex);
664 pForm->SetFormMenuEventListener(null);
665 __pSearchBar->SetShowState(false);
666 __pListView->SetShowState(false);
667 __pEmptyImageLabel->SetShowState(true);
668 __pEmptyCommentLabel->SetShowState(true);
673 ContactListPanel::OnCategoriesChanged(void)
678 ContactListPanel::OnSearchBarModeChanged(Tizen::Ui::Controls::SearchBar& source, Tizen::Ui::Controls::SearchBarMode mode)
680 if (mode == SEARCH_BAR_MODE_NORMAL)
682 __pListView->SetShowState(true);
683 __pSearchListView->SetShowState(false);
684 __pPresentationModel->ResetSearchedContactList();
685 __pSearchListView->UpdateList();
686 __pListView->UpdateList();
690 //[TODO] to restore swept item.
691 // need to be fixed with better idea..
692 Rectangle bounds = __pListView->GetBounds();
693 __pListView->SetBounds(bounds.x, bounds.y, bounds.width, bounds.height + 1);
694 __pListView->Invalidate(true);
695 __pListView->SetBounds(bounds);
700 ContactListPanel::OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
704 if (listView.Equals(*__pSearchListView) == true)
706 __pPresentationModel->GetItemMainIndex(itemIndex, groupIndex, itemIndex);
709 index |= groupIndex << LIST_VIEW_GROUP_INDEX_SHIFT;
712 __sweptItemIndex = index;
716 case IDA_LIST_ELEMENT_DELETE:
721 case IDA_LIST_ELEMENT_CALL:
723 String phoneNumber = __pPresentationModel->GetDefaultPhoneNumber(groupIndex, itemIndex);
724 LaunchAppControl(PROVIDER_ID_PHONE, OPERATION_ID_CALL, phoneNumber, INPUT_TYPE_VOICE);
727 case IDA_LIST_ELEMENT_MESSAGE:
729 if (!(__pPresentationModel->GetDefaultPhoneNumber(groupIndex, itemIndex).IsEmpty()))
731 String phoneNumber = __pPresentationModel->GetDefaultPhoneNumber(groupIndex, itemIndex);
732 LaunchAppControl(PROVIDER_ID_MESSAGE, OPERATION_ID_COMPOSE, phoneNumber, INPUT_TYPE_SMS);
734 else if (!(__pPresentationModel->GetDefaultEmail(groupIndex, itemIndex).IsEmpty()))
736 String emailId = __pPresentationModel->GetDefaultEmail(groupIndex, itemIndex);
737 LaunchAppControl(PROVIDER_ID_MESSAGE, OPERATION_ID_COMPOSE, emailId, null);
741 case IDA_LIST_ELEMENT_VIDEO_CALL:
743 String phoneNumber = __pPresentationModel->GetDefaultPhoneNumber(groupIndex, itemIndex);
744 LaunchAppControl(PROVIDER_ID_PHONE, OPERATION_ID_CALL, phoneNumber, INPUT_TYPE_VIDEO);
753 ContactListPanel::OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus state)
755 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
757 if (listView.Equals(*__pSearchListView) == true)
759 __pPresentationModel->GetItemMainIndex(itemIndex, groupIndex, itemIndex);
763 __selectedIndex |= groupIndex << LIST_VIEW_GROUP_INDEX_SHIFT;
764 __selectedIndex |= itemIndex;
766 if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
769 HashMap* pReturnValue = new (std::nothrow) HashMap();
770 pReturnValue->Construct();
772 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
774 pList = __pPresentationModel->GetAllPhoneNumbersN(groupIndex, itemIndex);
778 ReturnValues(pContactsApp->GetRequestId(), APP_CTRL_RESULT_FAILED, pReturnValue);
782 if (pList->GetCount() > 1)
784 __pContactValueListEvent = new (std::nothrow) ContactValueListItemProvider(pList);
785 ShowContactValuePopup(groupIndex, itemIndex);
787 else if (pList->GetCount() == 1)
789 AddContactValueOnList(pList, CONTACT_KEY_PHONE, 0, pReturnValue);
791 ReturnValues(pContactsApp->GetRequestId(), APP_CTRL_RESULT_SUCCEEDED, pReturnValue);
796 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
798 pList = __pPresentationModel->GetAllEmailsN(groupIndex, itemIndex);
802 ReturnValues(pContactsApp->GetRequestId(), APP_CTRL_RESULT_FAILED, pReturnValue);
806 if (pList->GetCount() > 1)
808 __pContactValueListEvent = new (std::nothrow) ContactValueListItemProvider(pList);
809 ShowContactValuePopup(groupIndex, itemIndex);
811 else if (pList->GetCount() == 1)
813 AddContactValueOnList(pList, CONTACT_KEY_EMAIL, 0, pReturnValue);
815 ReturnValues(pContactsApp->GetRequestId(), APP_CTRL_RESULT_SUCCEEDED, pReturnValue);
820 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_ITEM_ID)
822 AppCtrlResult appCtrlResult = APP_CTRL_RESULT_SUCCEEDED;
823 RecordId contactId = __pPresentationModel->GetContactId(groupIndex, itemIndex);
824 if (contactId == INVALID_RECORD_ID)
826 appCtrlResult = APP_CTRL_RESULT_FAILED;
831 ArrayList* pValueList = new (std::nothrow) ArrayList();
832 pValueList->Construct();
834 contactId.Append(__pPresentationModel->GetContactId(groupIndex, itemIndex));
835 pValueList->Add(new (std::nothrow) String(contactId));
837 pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_ITEM_ID), pValueList);
840 ReturnValues(pContactsApp->GetRequestId(), appCtrlResult, pReturnValue);
842 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_VCARD)
844 AppCtrlResult appCtrlResult = APP_CTRL_RESULT_SUCCEEDED;
845 String vCardPath = __pPresentationModel->ExportToVcard(groupIndex, itemIndex);
847 if (vCardPath.IsEmpty())
849 appCtrlResult = APP_CTRL_RESULT_FAILED;
853 pReturnValue->Add(new (std::nothrow) String(CONTACT_KEY_PATH), new (std::nothrow) String(vCardPath));
856 ReturnValues(pContactsApp->GetRequestId(), appCtrlResult, pReturnValue);
861 else if (pContactsApp->GetOperationId() == OPERATION_ID_EDIT)
863 ArrayList* pArgList = null;
864 SceneManager* pSceneManager = SceneManager::GetInstance();
866 if (__pArgList != null)
868 pArgList = new (std::nothrow) ArrayList();
869 pArgList->Construct();
871 for (int i = 0; i < __pArgList->GetCount(); i++)
873 pArgList->Add(new (std::nothrow) String(*static_cast<String*>(__pArgList->GetAt(i))));
876 String* pContactId = new (std::nothrow) String(RETURN_TYPE_ITEM_ID);
877 pContactId->Append(DELIMITER);
878 pContactId->Append(__pPresentationModel->GetContactId(groupIndex, itemIndex));
879 pArgList->InsertAt(pContactId, 0);
881 __pArgList->RemoveAll(true);
884 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgList);
888 ArrayList* pContactId = new (std::nothrow) ArrayList();
889 pContactId->Construct();
891 pContactId->Add(*(new (std::nothrow) Integer(__pPresentationModel->GetContactId(groupIndex, itemIndex))));
892 SceneManager* pSceneManager = SceneManager::GetInstance();
894 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_DETAILS, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pContactId);
899 ContactListPanel::OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction)
904 ContactListPanel::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
910 ContactListPanel::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
912 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
915 int groupIndex = (__selectedIndex >> LIST_VIEW_GROUP_INDEX_SHIFT) & LIST_VIEW_MASK;
916 int itemIndex = __selectedIndex & LIST_VIEW_MASK;
917 AppCtrlResult appCtrlResult = APP_CTRL_RESULT_SUCCEEDED;
919 HashMap* pReturnValue = new (std::nothrow) HashMap();
920 pReturnValue->Construct();
922 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
924 pList = __pPresentationModel->GetAllPhoneNumbersN(groupIndex, itemIndex);
927 appCtrlResult = APP_CTRL_RESULT_FAILED;
931 AddContactValueOnList(pList, CONTACT_KEY_PHONE, index, pReturnValue);
934 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
937 pList = __pPresentationModel->GetAllEmailsN(groupIndex, itemIndex);
940 appCtrlResult = APP_CTRL_RESULT_FAILED;
944 AddContactValueOnList(pList, CONTACT_KEY_EMAIL, index, pReturnValue);
949 ReturnValues(pContactsApp->GetRequestId(), appCtrlResult, pReturnValue);
953 ContactListPanel::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
959 ContactListPanel::OnTextValueChanged(const Tizen::Ui::Control& source)
961 String searchText = __pSearchBar->GetText();
964 ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
965 if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_PHONE)
967 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_HAS_PHONE_ONLY);
969 else if (pContactsApp->GetReturnType() == APP_CONTROL_RETURN_TYPE_EMAIL)
971 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_HAS_EMAIL_ONLY);
975 __pPresentationModel->SetSearchText(searchText, SEARCH_TYPE_NORMAL);
978 if (searchText.GetLength() != 0)
980 __pSearchListView->SetShowState(true);
981 __pListView->SetShowState(false);
985 __pSearchListView->SetShowState(false);
986 __pListView->SetShowState(true);
989 __pSearchListView->UpdateList();
993 ContactListPanel::OnTextValueChangeCanceled(const Tizen::Ui::Control& source)
998 ContactListPanel::ShowDeletePopup(void)
1000 if (__pDeletePopup == null)
1002 __pDeletePopup = new (std::nothrow) Popup();
1003 __pDeletePopup->Construct(false, Dimension(W_DELETE_POPUP, H_DELETE_POPUP));
1004 __pDeletePopup->SetPropagatedKeyEventListener(this);
1006 Rectangle popupClientBounds = __pDeletePopup->GetClientAreaBounds();
1008 Label* pLabel = new (std::nothrow) Label();
1009 pLabel->Construct(Rectangle(X_DELETE_LABEL, Y_DELETE_LABEL, W_DELETE_LABEL, H_DELETE_LABEL), ResourceManager::GetString(L"IDS_COM_POP_DELETE_Q"));
1010 pLabel->SetTextConfig(FONT_SIZE_DELETE_CONFIRM, LABEL_TEXT_STYLE_NORMAL);
1011 pLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1012 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1014 Button* pDeleteButton = new (std::nothrow) Button();
1015 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"));
1016 pDeleteButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_DELETE_BUTTON_NORMAL);
1017 pDeleteButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_DELETE_BUTTON_PRESSED);
1018 pDeleteButton->SetTextColor(COLOR_DELETE_BUTTON_TEXT);
1019 pDeleteButton->SetTextSize(FONT_SIZE_DELETE_BUTTON);
1020 pDeleteButton->SetActionId(IDA_POPUP_DELETE_OK);
1021 pDeleteButton->AddActionEventListener(*this);
1023 Button* pCancelButton = new (std::nothrow) Button();
1024 pCancelButton->Construct(Rectangle(X_DELETE_LABEL, Y_DELETE_BUTTON, W_DELETE_BUTTON, H_DELETE_BUTTON), ResourceManager::GetString(L"IDS_PB_SK_CANCEL"));
1025 pCancelButton->SetTextSize(FONT_SIZE_DELETE_BUTTON);
1026 pCancelButton->SetActionId(IDA_POPUP_DELETE_CANCEL);
1027 pCancelButton->AddActionEventListener(*this);
1029 __pDeletePopup->AddControl(pLabel);
1030 __pDeletePopup->AddControl(pDeleteButton);
1031 __pDeletePopup->AddControl(pCancelButton);
1034 __pDeletePopup->SetShowState(true);
1035 __pDeletePopup->Show();
1039 ContactListPanel::HideDeletePopup(void)
1041 if (__pDeletePopup != null)
1043 __pDeletePopup->SetShowState(false);
1049 ContactListPanel::ShowAccountPopup(void)
1051 if (__pAccountListEvent != null)
1053 delete __pAccountListEvent;
1054 __pAccountListEvent = null;
1057 if (__pAccountPopup != null)
1059 delete __pAccountPopup;
1060 __pAccountPopup = null;
1063 if (__pAccountPopup == null)
1065 __pAccountPopup = new (std::nothrow) Popup();
1066 __pAccountPopup->Construct(true, Dimension(W_ACCOUNT_POPUP, H_ACCOUNT_POPUP));
1067 __pAccountPopup->SetTitleText(ResourceManager::GetString(L"IDS_PB_OPT_VIEW"));
1069 Rectangle popupClientBounds = __pAccountPopup->GetClientAreaBounds();
1071 ListView* pAccountListView = new (std::nothrow) ListView();
1072 pAccountListView->Construct(Rectangle(0, 0, popupClientBounds.width, popupClientBounds.height - H_ACCOUNT_POPUP_BUTTON));
1074 __pAccountListEvent = new (std::nothrow) AccountListItemProvider(pAccountListView, __pPresentationModel);
1076 pAccountListView->SetItemProvider(*__pAccountListEvent);
1078 __pAccountPopup->AddControl(pAccountListView);
1080 Button* pViewButton = new (std::nothrow) Button();
1081 pViewButton->Construct(Rectangle(0, popupClientBounds.height - H_ACCOUNT_POPUP_BUTTON, popupClientBounds.width / 2 - W_POPUP_ITEM_GAP, H_ACCOUNT_POPUP_BUTTON),
1082 ResourceManager::GetString(L"IDS_PB_OPT_VIEW"));
1083 pViewButton->SetActionId(IDA_POPUP_VIEW_OK);
1084 pViewButton->AddActionEventListener(*this);
1086 Button* pCancelButton = new (std::nothrow) Button();
1087 pCancelButton->Construct(Rectangle(popupClientBounds.width / 2 + W_POPUP_ITEM_GAP, popupClientBounds.height - H_ACCOUNT_POPUP_BUTTON,
1088 popupClientBounds.width / 2 - W_POPUP_ITEM_GAP, H_ACCOUNT_POPUP_BUTTON), ResourceManager::GetString(L"IDS_PB_SK_CANCEL"));
1089 pCancelButton->SetActionId(IDA_POPUP_VIEW_CANCEL);
1090 pCancelButton->AddActionEventListener(*this);
1092 __pAccountPopup->AddControl(pViewButton);
1093 __pAccountPopup->AddControl(pCancelButton);
1096 __pAccountPopup->SetShowState(true);
1097 __pAccountPopup->Show();
1101 ContactListPanel::HideAccountPopup(void)
1103 delete __pAccountPopup;
1104 __pAccountPopup = null;
1110 ContactListPanel::OnFastScrollIndexSelected (Tizen::Ui::Control& source, Tizen::Base::String& index)
1112 __pListView->ScrollToItem(__pPresentationModel->GetKeyIndex(index), -1);
1113 __pListView->Invalidate(false);
1117 ContactListPanel::OnFocusGained(const Tizen::Ui::Control& source)
1119 if (source.Equals(*__pSearchBar))
1121 if (__pListView->GetShowState() == true )
1123 int groupCount = __pPresentationModel->GetKeyCount();
1124 bool isContextItemOpenend = false;
1126 for (int i = 0; i < groupCount; i++)
1128 int contactCount = __pPresentationModel->GetContactCount(i);
1129 for (int j = 0; j < contactCount; j++)
1131 if (__pListView->IsContextItemOpened(i, j) == true)
1133 isContextItemOpenend = true;
1139 if (isContextItemOpenend == true)
1141 __pListView->UpdateList();
1144 else if (__pSearchListView->GetShowState() == true )
1147 bool isContextItemOpenend = false;
1149 if (__pSearchListEvent == null)
1153 groupCount = __pSearchListEvent->GetGroupCount();
1154 for (int i = 0; i < groupCount; i++)
1156 int contactCount = __pSearchListEvent->GetItemCount(i);
1157 for (int j = 0; j < contactCount; j++)
1159 if (__pSearchListView->IsContextItemOpened(i, j) == true)
1161 isContextItemOpenend = true;
1167 if (isContextItemOpenend == true)
1169 __pSearchListView->UpdateList();
1176 ContactListPanel::OnFocusLost(const Tizen::Ui::Control& source)
1181 ContactListPanel::ShowContactValuePopup(int groupIndex, int itemIndex)
1183 delete __pMultipleContactValuePopup;
1184 __pMultipleContactValuePopup = new (std::nothrow) Popup();
1185 __pMultipleContactValuePopup->Construct(true, Dimension(W_CONTACT_VALUE_POPUP, H_CONTACT_VALUE_POPUP));
1186 __pMultipleContactValuePopup->SetTitleText(__pPresentationModel->GetName(groupIndex, itemIndex));
1187 __pMultipleContactValuePopup->SetPropagatedKeyEventListener(this);
1189 Rectangle popupClientBounds = __pMultipleContactValuePopup->GetClientAreaBounds();
1191 ListView* pListView = new (std::nothrow) ListView();
1192 pListView->Construct(Rectangle(0, 0, popupClientBounds.width, H_CONTACT_VALUE_POPUP_LIST_VIEW));
1193 pListView->SetItemProvider(*__pContactValueListEvent);
1194 pListView->AddListViewItemEventListener(*this);
1196 __pMultipleContactValuePopup->AddControl(pListView);
1198 Button* pCancelButton = new (std::nothrow) Button();
1199 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"));
1200 pCancelButton->SetActionId(IDA_POPUP_CONTACT_VALUE_CLOSE);
1201 pCancelButton->AddActionEventListener(*this);
1203 __pMultipleContactValuePopup->AddControl(pCancelButton);
1204 __pMultipleContactValuePopup->SetShowState(true);
1205 __pMultipleContactValuePopup->Show();
1209 ContactListPanel::HideContactValuePopup(void)
1211 if (__pMultipleContactValuePopup != null)
1213 __pMultipleContactValuePopup->SetShowState(false);
1219 ContactListPanel::ReturnValues(RequestId requestId, Tizen::App::AppCtrlResult appCtrlResult, const Tizen::Base::Collection::IMap* pReturnValue)
1221 AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance();
1222 result r = pAppManager->SendAppControlResult(requestId, appCtrlResult, pReturnValue);
1223 AppLogDebug("[%s] The return result from SendAppControlResult(), AppCtrlResult value : %d.", GetErrorMessage(r), appCtrlResult);
1225 UiApp::GetInstance()->Terminate();
1229 ContactListPanel::AddContactValueOnList(const Tizen::Base::Collection::IList* pList, const Tizen::Base::String& keyType, int index, Tizen::Base::Collection::HashMap* pReturnValue)
1233 String value(*(static_cast<const String *>(pList->GetAt(index))));
1234 value.LastIndexOf(CHARACTER_SPACE, value.GetLength()-1, blankIndex);
1235 value.Remove(0, blankIndex + 1);
1237 ArrayList* pValueList = new (std::nothrow) ArrayList();
1238 pValueList->Construct();
1239 pValueList->Add(new (std::nothrow) String(value));
1241 pReturnValue->Add(new (std::nothrow) String(keyType), pValueList);
1245 ContactListPanel::LaunchAppControl(const Tizen::App::AppId& appId, const Tizen::Base::String& operationId, const Tizen::Base::String& argument, const Tizen::Base::String& type)
1247 result r = E_SUCCESS;
1249 if (__pAppControl != null)
1256 extraData.Construct();
1258 if (appId.Equals(String(PROVIDER_ID_PHONE)))
1260 uri.Append(INPUT_URI_TEL);
1261 uri.Append(argument);
1262 extraData.Add(new (std::nothrow) String(INPUT_KEY_CALL_TYPE), new (std::nothrow) String(type));
1264 else if (appId.Equals(String(PROVIDER_ID_MESSAGE)))
1266 extraData.Add(new (std::nothrow) String(INPUT_KEY_MESSAGE_TO), new (std::nothrow) String(argument));
1267 extraData.Add(new (std::nothrow) String(INPUT_KEY_MESSAGE_TYPE), new (std::nothrow) String(type));
1270 __pAppControl = AppManager::FindAppControlN(appId, operationId);
1271 if (__pAppControl != null)
1273 r = __pAppControl->Start(&uri, null, &extraData, null);
1276 AppLogDebug("[%s] Unable to launch app control", GetErrorMessage(r));
1280 if (__pListView->GetShowState() == true)
1282 __pListView->SetEnabled(false);
1285 if (__pSearchListView->GetShowState() == true)
1287 __pSearchListView->SetEnabled(false);
1292 extraData.RemoveAll(true);
1298 ContactListPanel::OnKeypadWillOpen(Tizen::Ui::Control& source)
1303 ContactListPanel::OnKeypadOpened(Tizen::Ui::Control& source)
1305 const Form* pForm = dynamic_cast<Form*>(GetParent());
1308 Rectangle clientBounds = pForm->GetClientAreaBounds();
1309 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, clientBounds.width, clientBounds.height - H_SEARCHBAR));
1313 ContactListPanel::OnKeypadClosed(Tizen::Ui::Control& source)
1315 const Form* pForm = dynamic_cast<Form*>(GetParent());
1318 Rectangle clientBounds = pForm->GetClientAreaBounds();
1319 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, clientBounds.width, clientBounds.height - H_SEARCHBAR));
1323 ContactListPanel::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1325 const Form* pForm = dynamic_cast<Form*>(GetParent());
1328 Rectangle clientBounds = pForm->GetClientAreaBounds();
1329 __pSearchListView->SetBounds(Rectangle(0, H_SEARCHBAR, clientBounds.width, clientBounds.height - H_SEARCHBAR));
1333 ContactListPanel::OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction)
1335 if (keypadAction == KEYPAD_ACTION_SEARCH)
1337 __pSearchBar->HideKeypad();
1342 ContactListPanel::OnFormMenuRequested(Tizen::Ui::Controls::Form& source)
1344 if (__pListView->GetShowState() == true)
1346 __pListView->SetFocus();
1348 else if (__pSearchListView->GetShowState() == true)
1350 __pSearchListView->SetFocus();
1353 if(__pPresentationModel->GetContactCount() > 0)
1355 __pOptionMenu->SetShowState(true);
1356 __pOptionMenu->Show();
1361 ContactListPanel::OnForeground(void)
1363 delete __pAppControl;
1364 __pAppControl = null;
1366 if (__pListView->IsEnabled() == false)
1368 __pListView->SetEnabled(true);
1371 if (__pSearchListView->IsEnabled() == false)
1373 __pSearchListView->SetEnabled(true);
1378 ContactListPanel::OnBackground(void)
1383 ContactListPanel::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo & touchInfo)
1385 if (source.Equals(*__pListView))
1387 __pListView->SetFocus();
1389 else if (source.Equals(*__pSearchListView))
1391 __pSearchListView->SetFocus();
1396 ContactListPanel::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1401 ContactListPanel::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1406 ContactListPanel::OnTouchFocusIn(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1411 ContactListPanel::OnTouchFocusOut(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
1416 ContactListPanel::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
1422 ContactListPanel::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
1424 if (keyEventInfo.GetKeyCode() == KEY_BACK || keyEventInfo.GetKeyCode() == KEY_ESC)
1426 if (__pDeletePopup && __pDeletePopup->GetShowState() == true)
1431 else if (__pMultipleContactValuePopup && __pMultipleContactValuePopup->GetShowState() == true)
1433 HideContactValuePopup();
1441 ContactListPanel::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
1447 ContactListPanel::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)