bf91c219bfbb3d626a4ee7b4c76bca97f3190068
[apps/osp/Contacts.git] / src / CtGroupListPanel.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 /**
18  * @file        CtGroupListPanel.cpp
19  * @brief       This is the implementation file for the GroupListPanel class.
20  */
21
22 #include <FSocial.h>
23 #include "CtContactListItem.h"
24 #include "CtGroupListPanel.h"
25 #include "CtGroupListPresentationModel.h"
26 #include "CtContactsApp.h"
27 #include "CtMainForm.h"
28 #include "CtResourceManager.h"
29 #include "CtSceneRegister.h"
30 #include "CtTypes.h"
31
32 using namespace Tizen::App;
33 using namespace Tizen::Base;
34 using namespace Tizen::Base::Collection;
35 using namespace Tizen::Graphics;
36 using namespace Tizen::Ui;
37 using namespace Tizen::Ui::Controls;
38 using namespace Tizen::Ui::Scenes;
39 using namespace Tizen::Social;
40
41 static const int IDA_FOOTER_CREATE = 1;
42 static const int IDA_MORE_EDIT = 2;
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_LIST_ELEMENT_MESSAGE = 40;
47 static const int IDA_LIST_ELEMENT_EMAIL = 41;
48 static const int IDA_LIST_ELEMENT_ADD_MEMEBER = 42;
49
50 static const wchar_t* IDB_NO_GROUP = L"00_Nocontents_unnamed.png";
51
52 static const unsigned int COLOR_ITEM_TEXT_NORMAL = Color32<0, 0, 0>::Value;
53 static const unsigned int COLOR_ITEM_TEXT_PRESSED = Color32<255, 255, 255>::Value;
54 static const unsigned int COLOR_EMPTY_COMMENT = Color32<102, 102, 102>::Value;
55
56 static const int H_GROUP_ITEM = 76;
57 static const int W_INITIAL_PANEL = 10;
58 static const int H_INITIAL_PANEL = 10;
59 static const int W_THUMBNAIL = 108;
60 static const int H_THUMBNAIL = 108;
61 static const int X_TEXT = 26;
62 static const int W_ELEMENT_GAP = 16;
63
64 static const int X_EMPTY_IMAGE = 220;
65 static const int Y_EMPTY_IMAGE = 300;
66 static const int W_EMPTY_IMAGE = 280;
67 static const int H_EMPTY_IMAGE = 280;
68 static const int Y_EMPTY_COMMENT = 618;
69 static const int H_EMPTY_COMMENT = 38;
70
71 static const int FONT_SIZE_EMPTY_COMMENT = 32;
72
73 GroupListPanel::GroupListPanel(void)
74 : __sweptItemIndex(0)
75 , __pListView(null)
76 , __pOptionMenu(null)
77 , __pEmptyImageLabel(null)
78 , __pEmptyCommentLabel(null)
79 , __pPresentationModel(null)
80 {
81 }
82
83 GroupListPanel::~GroupListPanel(void)
84 {
85 }
86
87 void
88 GroupListPanel::Initialize(void)
89 {
90         Construct(Rectangle(0, 0, W_INITIAL_PANEL, H_INITIAL_PANEL));
91 }
92
93 result
94 GroupListPanel::OnInitializing(void)
95 {
96         const Form* pForm = dynamic_cast<Form*>(GetParent());
97         AppAssert(pForm);
98
99         Rectangle clientBounds = pForm->GetClientAreaBounds();
100         SetBounds(Rectangle(0, 0, clientBounds.width, clientBounds.height));
101
102         __pPresentationModel = GroupListPresentationModel::GetInstance();
103
104         __pListView = new (std::nothrow) GroupedListView();
105         __pListView->Construct(Rectangle(0, 0, clientBounds.width, clientBounds.height), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
106         __pListView->SetItemProvider(*this);
107         __pListView->AddGroupedListViewItemEventListener(*this);
108
109         AddControl(__pListView);
110
111         __pEmptyImageLabel = new (std::nothrow) Label();
112         __pEmptyImageLabel->Construct(Rectangle(X_EMPTY_IMAGE, Y_EMPTY_IMAGE, W_EMPTY_IMAGE, H_EMPTY_IMAGE), L"");
113         Bitmap* pBitmap = ResourceManager::GetBitmapN(IDB_NO_GROUP);
114         if (pBitmap != null)
115         {
116                 __pEmptyImageLabel->SetBackgroundBitmap(*pBitmap);
117                 delete pBitmap;
118         }
119         __pEmptyImageLabel->SetShowState(false);
120
121         AddControl(__pEmptyImageLabel);
122
123         __pEmptyCommentLabel = new (std::nothrow) Label();
124         __pEmptyCommentLabel->Construct(Rectangle(0, Y_EMPTY_COMMENT, clientBounds.width, H_EMPTY_COMMENT),
125                                                                                                                                 ResourceManager::GetString(L"IDS_PB_HEADER_NO_GROUP"));
126         __pEmptyCommentLabel->SetTextConfig(FONT_SIZE_EMPTY_COMMENT, LABEL_TEXT_STYLE_NORMAL);
127         __pEmptyCommentLabel->SetTextColor(Color(COLOR_EMPTY_COMMENT));
128         __pEmptyCommentLabel->SetShowState(false);
129
130         AddControl(__pEmptyCommentLabel);
131
132         __pOptionMenu = new (std::nothrow) OptionMenu();
133         __pOptionMenu->Construct();
134         __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_SK_EDIT"), IDA_MORE_EDIT);
135         __pOptionMenu->AddActionEventListener(*this);
136         __pOptionMenu->SetShowState(false);
137         return E_SUCCESS;
138 }
139
140 result
141 GroupListPanel::OnTerminating(void)
142 {
143         result r = E_SUCCESS;
144
145         if (__pPresentationModel != null)
146         {
147                 __pPresentationModel->RemoveGroupChangeListener(*this);
148         }
149
150         delete __pOptionMenu;
151
152         return r;
153 }
154
155 void
156 GroupListPanel::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
157 {
158         SceneManager* pSceneManager = SceneManager::GetInstance();
159         ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
160
161         switch (actionId)
162         {
163         case IDA_HEADER_CONTACTS:
164                 {
165                         if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
166                         {
167                                 if (pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_SINGLE)
168                                 {
169                                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_LIST));
170                                 }
171                                 else if (pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_MULTI)
172                                 {
173                                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_LIST_EDITOR));
174                                 }
175                         }
176                         else
177                         {
178                                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_LIST));
179                         }
180                 }
181                 break;
182         case IDA_HEADER_GROUPS:
183                 {
184                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_LIST));
185                 }
186                 break;
187         case IDA_HEADER_FAVORITES:
188                 {
189                         if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
190                         {
191                                 if (pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_SINGLE)
192                                 {
193                                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FAVORITE_LIST));
194                                 }
195                                 else if (pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_MULTI)
196                                 {
197                                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FAVORITE_LIST_EDITOR));
198                                 }
199                         }
200                         else
201                         {
202                                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_FAVORITE_LIST));
203                         }
204                 }
205                 break;
206         case IDA_FOOTER_CREATE:
207                 {
208                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
209                 }
210                 break;
211         case IDA_MORE_EDIT:
212                 {
213                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_LIST_EDITOR));
214                 }
215                 break;
216         default:
217                 break;
218         }
219 }
220
221 void
222 GroupListPanel::OnFormMenuRequested(Tizen::Ui::Controls::Form& source)
223 {
224         ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
225         if(__pPresentationModel->GetCategoryCount() > 0 && pContactsApp->GetOperationId() != OPERATION_ID_PICK)
226         {
227                 __pOptionMenu->SetShowState(true);
228                 __pOptionMenu->Show();
229         }
230 }
231
232 void
233 GroupListPanel::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
234                                                                    const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
235 {
236         ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
237
238         if (previousSceneId.Equals(IDSCN_CONTACT_SELECTOR, true))
239         {
240                 __pPresentationModel->AddContactToCategory(__sweptItemIndex, pArgs);
241         }
242
243         Form* pForm = dynamic_cast<Form*>(GetParent());
244         AppAssert(pForm);
245         Form *pEventForm = const_cast<Form*>(pForm);
246         pEventForm->SetFormMenuEventListener(this);
247
248         Header* pHeader = pForm->GetHeader();
249         pHeader->AddActionEventListener(*this);
250
251         Footer* pFooter = pForm->GetFooter();
252         pFooter->AddActionEventListener(*this);
253
254         if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
255         {
256                 pFooter->SetShowState(false);
257                 SetBounds(Rectangle(0, 0, pForm->GetClientAreaBounds().width, pForm->GetClientAreaBounds().height));
258                 __pListView->SetSize(__pListView->GetWidth(), pForm->GetClientAreaBounds().height);
259                 Invalidate(true);
260
261                 if (__pPresentationModel->GetCategoryCount() == 0)
262                 {
263                         pForm->SetFormMenuEventListener(null);
264                         __pListView->SetShowState(false);
265                         __pEmptyImageLabel->SetShowState(true);
266                         __pEmptyCommentLabel->SetShowState(true);
267                 }
268                 else
269                 {
270                         __pListView->SetShowState(true);
271                         __pEmptyImageLabel->SetShowState(false);
272                         __pEmptyCommentLabel->SetShowState(false);
273                 }
274         }
275         else
276         {
277                 FooterItem footerItemCreate;
278                 footerItemCreate.Construct(IDA_FOOTER_CREATE);
279                 footerItemCreate.SetText(ResourceManager::GetString(L"IDS_COM_BODY_CREATE"));
280                 int count = pFooter->GetItemCount();
281                 if (count == 0)
282                 {
283                         pFooter->AddItem(footerItemCreate);
284                 }
285                 else if (count == 1)
286                 {
287                         pFooter->SetItemAt(0, footerItemCreate);
288                 }
289                 else
290                 {
291                         pFooter->SetItemAt(0, footerItemCreate);
292                         pFooter->RemoveItemAt(1);
293                         pFooter->RemoveButtonAt(BUTTON_POSITION_LEFT);
294                 }
295                 pFooter->SetItemEnabled(0,true);
296                 pForm->SetFormMenuEventListener(null);
297
298                 if (__pPresentationModel->GetCategoryCount() > 0)
299                 {
300                         pForm->SetFormMenuEventListener(this);
301
302                         __pListView->SetShowState(true);
303                         __pEmptyImageLabel->SetShowState(false);
304                         __pEmptyCommentLabel->SetShowState(false);
305                 }
306                 else if (__pPresentationModel->GetContactCount() > 0)
307                 {
308                         __pListView->SetShowState(true);
309                         __pEmptyImageLabel->SetShowState(false);
310                         __pEmptyCommentLabel->SetShowState(false);
311                 }
312                 else
313                 {
314                         __pListView->SetShowState(false);
315                         __pEmptyImageLabel->SetShowState(true);
316                         __pEmptyCommentLabel->SetShowState(true);
317                 }
318         }
319
320         __pListView->UpdateList();
321         __pPresentationModel->AddGroupChangeListener(*this);
322
323         if (pArgs != null)
324         {
325                 pArgs->RemoveAll(true);
326                 delete pArgs;
327         }
328 }
329
330 void
331 GroupListPanel::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
332                                                                         const Tizen::Ui::Scenes::SceneId& nextSceneId)
333 {
334         const Form* pForm = dynamic_cast<Form*>(GetParent());
335         AppAssert(pForm);
336
337         Form *pEventForm = const_cast<Form*>(pForm);
338         pEventForm->SetFormMenuEventListener(null);
339
340         Header* pHeader = pForm->GetHeader();
341         pHeader->RemoveActionEventListener(*this);
342
343         Footer* pFooter = pForm->GetFooter();
344         pFooter->RemoveActionEventListener(*this);
345
346         __pPresentationModel->RemoveGroupChangeListener(*this);
347 }
348
349 int
350 GroupListPanel::GetGroupCount(void)
351 {
352         return 1;
353 }
354
355 int
356 GroupListPanel::GetItemCount(int groupIndex)
357 {
358         ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
359         int count = __pPresentationModel->GetCategoryCount();
360
361         if (__pPresentationModel->GetContactCountInNotAssignedCategory(pContactsApp->GetReturnType()))
362         {
363                 count++;
364         }
365
366         return count;
367 }
368
369 Tizen::Ui::Controls::ListItemBase*
370 GroupListPanel::CreateItem(int groupIndex, int itemIndex, int itemWidth)
371 {
372         ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
373         String groupNameString;
374         int contactCount = 0;
375         String contactCountString;
376         Bitmap* pThumbnail = null;
377         bool isNotAssinged = false;
378         int adjustedNameWidth;
379         Dimension countSize;
380         Dimension groupNameSize;
381         Font font;
382
383         CustomItem* pItem = new (std::nothrow) CustomItem();
384         pItem->Construct(Dimension(itemWidth, pContactsApp->GetListItemSingleLineHeight()), LIST_ANNEX_STYLE_NORMAL);
385
386         result r = __pPresentationModel->UpdatePersonList(itemIndex);
387         TryReturn(r == E_SUCCESS, null, "[%s] Unable to update person list", GetErrorMessage(r));
388
389         if (__pPresentationModel->GetCategoryCount() == itemIndex)
390         {
391                 isNotAssinged = true;
392                 groupNameString = ResourceManager::GetString(L"IDS_PB_BODY_NOT_ASSIGNED");
393                 contactCount = __pPresentationModel->GetContactCountInNotAssignedCategory(pContactsApp->GetReturnType());
394                 contactCountString = L"(" + Integer::ToString(contactCount) + L")";
395         }
396         else
397         {
398                 groupNameString = __pPresentationModel->GetCategoryName(itemIndex);
399                 contactCount = __pPresentationModel->GetContactCountInCategory(itemIndex, pContactsApp->GetReturnType());
400                 contactCountString = L"(" + Integer::ToString(contactCount) + L")";
401         }
402
403         font.Construct(FONT_STYLE_PLAIN, pContactsApp->GetFontSize());
404         font.GetTextExtent(contactCountString, contactCountString.GetLength(), countSize);
405         font.GetTextExtent(groupNameString, groupNameString.GetLength(), groupNameSize);
406
407         adjustedNameWidth = itemWidth - (W_THUMBNAIL + (X_TEXT * 2) + (countSize.width + W_ELEMENT_GAP * 2));
408         if (groupNameSize.width < adjustedNameWidth)
409         {
410                 adjustedNameWidth = groupNameSize.width + 1;
411         }
412
413         pItem->AddElement(Rectangle(X_TEXT, 0, adjustedNameWidth, pContactsApp->GetListItemSingleLineHeight()), 1, groupNameString, pContactsApp->GetFontSize(), COLOR_ITEM_TEXT_NORMAL, COLOR_ITEM_TEXT_PRESSED, COLOR_ITEM_TEXT_PRESSED, true);
414         pItem->AddElement(Rectangle(X_TEXT + adjustedNameWidth + W_ELEMENT_GAP, 0, countSize.width + 1, pContactsApp->GetListItemSingleLineHeight()), 2, contactCountString, pContactsApp->GetFontSize(), COLOR_ITEM_TEXT_NORMAL, COLOR_ITEM_TEXT_PRESSED, COLOR_ITEM_TEXT_PRESSED, true);
415
416         pThumbnail = __pPresentationModel->GetThumbnailN(itemIndex);
417         if (pThumbnail != null)
418         {
419                 pItem->AddElement(Rectangle(itemWidth - W_THUMBNAIL - X_TEXT, (pContactsApp->GetListItemSingleLineHeight() - H_THUMBNAIL)/2, W_THUMBNAIL, H_THUMBNAIL), 0, *pThumbnail);
420                 delete pThumbnail;
421         }
422
423         if (pContactsApp->GetOperationId().IsEmpty() == false)
424         {
425                 return pItem;
426         }
427
428         ListContextItem* pItemContext = new (std::nothrow) ListContextItem();
429         pItemContext->Construct();
430         if (contactCount == 0)
431         {
432                 pItemContext->AddElement(IDA_LIST_ELEMENT_MESSAGE, ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"), false);
433                 pItemContext->AddElement(IDA_LIST_ELEMENT_EMAIL, ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"), false);
434         }
435         else
436         {
437                 pItemContext->AddElement(IDA_LIST_ELEMENT_MESSAGE, ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"));
438                 pItemContext->AddElement(IDA_LIST_ELEMENT_EMAIL, ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"));
439         }
440
441         if (isNotAssinged == false && __pPresentationModel->GetContactCount() > __pPresentationModel->GetContactCountInCategory(itemIndex))
442         {
443                 pItemContext->AddElement(IDA_LIST_ELEMENT_ADD_MEMEBER, ResourceManager::GetString(L"IDS_PB_SK_ADD_MEMBER"));
444         }
445
446         pItem->SetContextItem(pItemContext);
447
448         return pItem;
449 }
450
451 Tizen::Ui::Controls::GroupItem*
452 GroupListPanel::CreateGroupItem(int groupIndex, int itemWidth)
453 {
454         GroupItem* pItem = new (std::nothrow) GroupItem();
455         pItem->Construct(Dimension(itemWidth, H_GROUP_ITEM));
456         pItem->SetElement(ResourceManager::GetString(L"IDS_PB_BODY_PHONE"));
457
458         return pItem;
459 }
460
461 bool
462 GroupListPanel::DeleteItem(int groupIndex, int itemIndex, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
463 {
464         CustomItem* pCustomItem = static_cast<CustomItem *>(pItem);
465         pCustomItem->RemoveAllElements();
466
467         delete pItem;
468         pItem = null;
469
470         return true;
471 }
472
473 bool
474 GroupListPanel::DeleteGroupItem(int groupIndex, Tizen::Ui::Controls::GroupItem* pItem, int itemWidth)
475 {
476         delete pItem;
477         pItem = null;
478
479         return true;
480 }
481
482 void
483 GroupListPanel::OnContactsChanged(void)
484 {
485         __pListView->UpdateList();
486 }
487
488 void
489 GroupListPanel::OnCategoriesChanged(void)
490 {
491         ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
492
493         Form* pForm = dynamic_cast<Form*>(GetParent());
494         AppAssert(pForm);
495
496         if (__pPresentationModel->GetCategoryCount()> 0)
497         {
498                 pForm->SetFormMenuEventListener(this);
499         }
500         else
501         {
502                 pForm->SetFormMenuEventListener(null);
503         }
504
505         if (pContactsApp->GetOperationId() == OPERATION_ID_PICK)
506         {
507                 if (__pPresentationModel->GetCategoryCount() == 0)
508                 {
509                         __pListView->SetShowState(false);
510                         __pEmptyImageLabel->SetShowState(true);
511                         __pEmptyCommentLabel->SetShowState(true);
512                 }
513                 else
514                 {
515                         __pListView->SetShowState(true);
516                         __pEmptyImageLabel->SetShowState(false);
517                         __pEmptyCommentLabel->SetShowState(false);
518                 }
519         }
520         else
521         {
522                 if (__pPresentationModel->GetCategoryCount() > 0)
523                 {
524                         __pListView->SetShowState(true);
525                         __pEmptyImageLabel->SetShowState(false);
526                         __pEmptyCommentLabel->SetShowState(false);
527                 }
528                 else if (__pPresentationModel->GetContactCount() > 0)
529                 {
530                         __pListView->SetShowState(true);
531                         __pEmptyImageLabel->SetShowState(false);
532                         __pEmptyCommentLabel->SetShowState(false);
533                 }
534                 else
535                 {
536                         __pListView->SetShowState(false);
537                         __pEmptyImageLabel->SetShowState(true);
538                         __pEmptyCommentLabel->SetShowState(true);
539                 }
540         }
541
542         __pListView->UpdateList();
543 }
544
545 void
546 GroupListPanel::OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
547 {
548         SceneManager* pSceneManager = SceneManager::GetInstance();
549
550         switch (elementId)
551         {
552         case IDA_LIST_ELEMENT_MESSAGE:
553                 {
554                         ArrayList* pList = new (std::nothrow) ArrayList();
555                         pList->Construct();
556
557                         if (__pPresentationModel->GetCategoryCount() == itemIndex)
558                         {
559                                 pList->Add(*(new (std::nothrow) Integer(ID_GROUP_CONTACT_NOT_ASSIGNED)));
560                         }
561                         else
562                         {
563                                 pList->Add(*(new (std::nothrow) Integer(__pPresentationModel->GetCategoryId(itemIndex))));
564                         }
565                         pList->Add(*(new (std::nothrow) Integer(ID_GROUP_CONTACT_SELECT_MESSAGE)));
566                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_CONTACT_LIST_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
567                 }
568                 break;
569         case IDA_LIST_ELEMENT_EMAIL:
570                 {
571                         ArrayList* pList = new (std::nothrow) ArrayList();
572                         pList->Construct();
573
574                         if (__pPresentationModel->GetCategoryCount() == itemIndex)
575                         {
576                                 pList->Add(*(new (std::nothrow) Integer(ID_GROUP_CONTACT_NOT_ASSIGNED)));
577                         }
578                         else
579                         {
580                                 pList->Add(*(new (std::nothrow) Integer(__pPresentationModel->GetCategoryId(itemIndex))));
581                         }
582                         pList->Add(*(new (std::nothrow) Integer(ID_GROUP_CONTACT_SELECT_EMAIL)));
583                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_GROUP_CONTACT_LIST_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
584                 }
585                 break;
586         case IDA_LIST_ELEMENT_ADD_MEMEBER:
587                 {
588                         IList* pArgList = __pPresentationModel->GetContactIdListInCategory(itemIndex);
589
590                         __sweptItemIndex = itemIndex;
591
592                         pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CONTACT_SELECTOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgList);
593                 }
594                 break;
595         default:
596                 break;
597         }
598 }
599
600 void
601 GroupListPanel::OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus state)
602 {
603         ContactsApp* pContactsApp = static_cast<ContactsApp*>(ContactsApp::GetInstance());
604         
605         ArrayList* pList = new (std::nothrow) ArrayList();
606         pList->Construct();
607
608         if (__pPresentationModel->GetCategoryCount() == itemIndex)
609         {
610                 pList->Add(*(new (std::nothrow) Integer(ID_GROUP_CONTACT_NOT_ASSIGNED)));
611         }
612         else
613         {
614                 pList->Add(*(new (std::nothrow) Integer(__pPresentationModel->GetCategoryId(itemIndex))));
615         }
616
617         if (pContactsApp->GetSelectionMode() == APP_CONTROL_SELECTION_MODE_MULTI)
618         {
619                 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_GROUP_CONTACT_LIST_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
620         }
621         else
622         {
623                 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_GROUP_CONTACT_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
624         }
625 }
626
627 void
628 GroupListPanel::OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction)
629 {
630 }