Tizen 2.0 Release
[apps/osp/Internet.git] / src / IntEditHistoryListForm.cpp
1 //
2
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 //!Internet
19 /*@file:    IntEditHistoryListForm
20  *@brief:       This class defines EditHistoryListForm used to edit the history scene
21  *
22  */
23
24 #include <FAppUiApp.h>
25 #include <FUi.h>
26 #include "IntCommonLib.h"
27 #include "IntEditHistoryListForm.h"
28 #include "IntFaviconManager.h"
29 #include "IntHistoryPresentationModel.h"
30 #include "IntNotificationPanel.h"
31 #include "IntSceneRegister.h"
32 #include "IntTypes.h"
33
34 using namespace Tizen::App;
35 using namespace Tizen::Base;
36 using namespace Tizen::Base::Collection;
37 using namespace Tizen::Base::Runtime;
38 using namespace Tizen::Locales;
39 using namespace Tizen::Graphics;
40 using namespace Tizen::Ui;
41 using namespace Tizen::Ui::Controls;
42 using namespace Tizen::Ui::Scenes;
43
44 const int EditHistoryListForm::IDA_TABBAR_ITEM_1 = 101;
45 const int EditHistoryListForm::IDA_TABBAR_ITEM_2 = 102;
46 const int EditHistoryListForm::IDA_BUTTON_NEXT_FORM = 103;
47 const int EditHistoryListForm::IDA_FORMAT_ICON = 104;
48 const int EditHistoryListForm::IDA_FORMAT_TITLE = 105;
49 const int EditHistoryListForm::IDA_FORMAT_URL = 106;
50 const int EditHistoryListForm::IDA_SELECT_ALL_CHECKED = 107;
51 const int EditHistoryListForm::IDA_SELECT_ALL_UNCHECKED = 108;
52 const int EditHistoryListForm::IDA_DELETE_HISTORY = 109;
53 const int EditHistoryListForm::IDA_CANCEL = 110;
54
55
56 EditHistoryListForm::EditHistoryListForm(void)
57 :__pListView(null)
58 ,__pGroupData(null)
59 ,__pTimer(null)
60 ,__pSelectAllCheck(null)
61 ,__pSelectedLabel(null)
62 ,__selectedCount(0)
63 ,__isNoHistoryPresent(true)
64 {
65 }
66
67 EditHistoryListForm::~EditHistoryListForm(void)
68 {
69         AppLog("EditHistoryListForm::~EditHistoryListForm called");
70
71         if (__pGroupData != null)
72         {
73                 AppLog("removing __pGroupData");
74                 __pGroupData->RemoveAll(true);
75                 delete __pGroupData;
76         }
77 }
78
79 bool
80 EditHistoryListForm::Initialize(void)
81 {
82         Construct(L"IDL_EDIT_HISTORY_LIST");
83
84         return true;
85 }
86
87 result
88 EditHistoryListForm::OnInitializing(void)
89 {
90         result r = E_SUCCESS;
91
92         SetFormBackEventListener(this);
93
94         AppLogDebug("EditHistoryListForm::OnInitializing");
95         SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
96
97         Header* pHeader = GetHeader();
98
99         if (pHeader == NULL)
100         {
101                 return E_FAILURE;
102         }
103
104         pHeader->SetTitleText(CommonUtil::GetString("IDS_BR_SK_DELETE_ABB"));
105
106         GetFooter()->AddActionEventListener(*this);
107         AddOrientationEventListener(*this);
108
109         SceneManager::GetInstance()->AddSceneEventListener(IDSCN_EDIT_HISTORY_LIST, *this);
110         __pSelectedLabel = static_cast< Label* >(GetControl(L"IDC_LABEL1"));
111
112         if (__pSelectedLabel == null)
113         {
114                 return E_FAILURE;
115         }
116         String  selectedText = CommonUtil::GetString(L"IDS_COM_OPT_SELECTED") + "(0)";
117         __pSelectedLabel->SetText(selectedText);
118
119         __pSelectAllCheck = static_cast< CheckButton* >(GetControl(L"IDC_SELECT_ALL",true));
120
121         if (__pSelectAllCheck != null)
122         {
123                 __pSelectAllCheck->SetActionId(IDA_SELECT_ALL_CHECKED, IDA_SELECT_ALL_UNCHECKED);
124                 __pSelectAllCheck->AddActionEventListener(*this);
125         }
126         else
127         {
128                 return E_FAILURE;
129         }
130
131         __pListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1"));
132         if( __pListView != NULL)
133         {
134                 __pListView->SetItemProvider(*this);
135                 __pListView->AddGroupedListViewItemEventListener(*this);
136         }
137         else
138         {
139                 return E_FAILURE;
140         }
141
142         __pTimer = new (std::nothrow) Timer();
143         r = __pTimer->Construct(*this);
144
145         return r;
146 }
147
148 result
149 EditHistoryListForm::OnTerminating(void)
150 {
151         result r = E_SUCCESS;
152
153         return r;
154 }
155
156 void
157 EditHistoryListForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
158 {
159         String  selectedText = CommonUtil::GetString(L"IDS_COM_OPT_SELECTED");
160         SceneManager* pSceneManager = SceneManager::GetInstance();
161
162         if (pSceneManager == null)
163         {
164                 return;
165         }
166
167         switch (actionId)
168         {
169         case IDA_TABBAR_ITEM_1:
170         {
171                 result r = pSceneManager->GoBackward(BackwardSceneTransition());
172                 if (IsFailed(r))
173                 {
174                         AppLogDebug("EditHistoryListForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r));
175                         return;
176                 }
177         }
178
179         break;
180         case IDA_SELECT_ALL_CHECKED:
181         {
182                 int selectedCount = 0;
183                 for (int groupIndex = 0 ; __pGroupData != null && groupIndex < __pGroupData->GetCount() ; groupIndex ++)
184                 {
185                         GroupItemClass* pGClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
186                         if(pGClass == null)
187                         {
188                                 continue;
189                         }
190                         for (int itemIndex = 0 ; itemIndex < pGClass->__pData->GetCount() ; itemIndex ++)
191                         {
192                                 selectedCount++;
193                                 __pListView->SetItemChecked(groupIndex,itemIndex,true);
194                         }
195                 }
196                 selectedText.Append(L"(");
197                 selectedText.Append(selectedCount);
198                 selectedText.Append(L")");
199                 __selectedCount = selectedCount;
200
201                 __pSelectedLabel->SetText(selectedText);
202                 __pSelectedLabel->Invalidate(true);
203
204                 GetFooter()->SetItemEnabled(0, true);
205                 GetFooter()->Invalidate(true);
206
207                 __pListView->Invalidate(true);
208
209         }
210         break;
211         case IDA_SELECT_ALL_UNCHECKED:
212         {
213                 for (int groupIndex = 0 ; __pGroupData != null && groupIndex < __pGroupData->GetCount() ; groupIndex ++)
214                 {
215                         GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
216                         if(pGroupItemClass == null)
217                         {
218                                 continue;
219                         }
220                         for (int itemIndex = 0 ; itemIndex < pGroupItemClass->__pData->GetCount() ; itemIndex ++)
221                         {
222                                 __pListView->SetItemChecked(groupIndex,itemIndex,false);
223                         }
224                 }
225                 selectedText.Append(L"(0)");
226                 __pSelectedLabel->SetText(selectedText);
227                 __selectedCount = 0;
228                 __pSelectedLabel->Invalidate(true);
229
230                 GetFooter()->SetItemEnabled(0, false);
231                 GetFooter()->Invalidate(true);
232
233                 __pListView->Invalidate(true);
234         }
235         break;
236         case IDA_DELETE_HISTORY:
237         {
238
239                 ArrayList* pArrayList = new(std::nothrow) ArrayList();
240                 int itemCount = 0;
241                 int count = 0;
242                 int groupCount = 0;
243                 int counter = 0;
244                 pArrayList->Construct();
245                 for (int groupIndex = 0 ; __pGroupData != null && groupIndex < __pGroupData->GetCount() ; groupIndex ++)
246                 {
247                         GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
248
249                         if (pGroupItemClass == null || pGroupItemClass->__pData == null)
250                         {
251                                 AppLogDebug(" pGroupItemClass || __pData is null");
252                                 continue;
253                         }
254                         itemCount = pGroupItemClass->__pData->GetCount();
255                         for (int itemIndex = 0 ; itemIndex < itemCount ; itemIndex++)
256                         {
257                                 bool ret = __pListView->IsItemChecked(groupIndex,itemIndex);
258                                 if (ret == false)
259                                 {
260                                         continue;
261                                 }
262                                 AppLog("deleting history for groupId %d, item %d",groupIndex,itemIndex);
263                                 int hisId = -1;
264                                 History* pHistory = dynamic_cast< History* >(pGroupItemClass->__pData->GetAt(itemIndex));
265                                 if(pHistory == null)
266                                 {
267                                         continue;
268                                 }
269                                 pArrayList->Add(*new(std::nothrow) String(pHistory->GetHistoryId()));
270
271                         }
272                 }
273
274                 HistoryPresentationModel::GetInstance()->DeleteMultipleHistory(pArrayList);
275
276                 if (pArrayList != null)
277                 {
278                         pArrayList->RemoveAll(true);
279                         delete pArrayList;
280                 }
281
282                 if(__pGroupData != null)
283                 {
284                         groupCount =   __pGroupData->GetCount();
285
286                         for(int groupIndex = 0 ; groupIndex < groupCount ; groupIndex ++ )
287                         {
288                                 counter = __pListView->GetItemCountAt(groupIndex);
289
290                                 for(int index = 0 ; index < counter ; index++)
291                                 {
292                                         if(__pListView->IsItemChecked( groupIndex,index ) == true)
293                                         {
294                                                 __pListView->SetItemChecked(groupIndex,index,false);
295                                         }
296                                 }
297                         }
298                 }
299
300
301
302                 __pSelectAllCheck->SetSelected(false);
303
304                 GetFooter()->SetItemEnabled(0,false);
305                 GetFooter()->Invalidate(true);
306                 selectedText.Append(L"(0)");
307                 __pSelectedLabel->SetText(selectedText);
308                 __selectedCount = 0;
309                 __pSelectedLabel->Invalidate(true);
310                 if (__pListView != null)
311                 {
312                         __pListView->UpdateList();
313                 }
314
315                 NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this);
316                 String notification = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
317                 pNotification->SetText(notification);
318                 pNotification->ShowNotification();
319         }
320         break;
321         case IDA_CANCEL:
322         {
323                 if( __pTimer != NULL)
324                 {
325                         __pTimer->Cancel();
326                 }
327                 result r = pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
328                 if (IsFailed(r))
329                 {
330                         AppLogDebug("EditHistoryListForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r));
331                         return;
332                 }
333
334         }
335         break;
336
337         default:
338                 break;
339         }
340 }
341
342 void
343 EditHistoryListForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
344 {
345         SceneManager* pSceneManager = SceneManager::GetInstance();
346
347         if (pSceneManager == null)
348         {
349                 return;
350         }
351
352         result r = pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
353         if (IsFailed(r))
354         {
355                 AppLogDebug("EditHistoryListForm::OnFormBackRequested Failed to GoBackward %s",GetErrorMessage(r));
356                 return;
357         }
358 }
359
360 GroupItem*
361 EditHistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
362 {
363         AppLogDebug("EditHistoryListForm::CreateGroupItem");
364         result r = E_FAILURE;
365
366         int strMonth = 0;
367         String text;
368         GroupItem* pItem = null;
369         int count = 0;
370
371         GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
372         if(pGroupItemClass == null)
373                 return null;
374         pItem = new(std::nothrow) GroupItem();
375
376         if (pItem == null)
377         {
378                 return null;
379         }
380
381         if ( pGroupItemClass->__pData == null || pGroupItemClass->__pData->GetCount() == 0)
382         {
383                 r = pItem->Construct(Dimension(itemWidth, 0));
384         }
385         else
386         {
387                 r = pItem->Construct(Dimension(itemWidth, 48));
388         }
389
390         text = pGroupItemClass->__titleText;
391         text.Append(L" (");
392
393         int dayOfWeek = 0 ;
394         if (pGroupItemClass->__titleText == L"Today" || pGroupItemClass->__titleText == L"Yesterday")
395         {
396                 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
397                 if (pGregorianCalendar != NULL)
398                 {
399                         pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->__startTime.GetYear());
400                         pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->__startTime.GetMonth());
401                         pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->__startTime.GetDay());
402                         dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
403
404                         if (pGregorianCalendar != NULL)
405                         {
406                                 delete pGregorianCalendar;
407                         }
408                 }
409         }
410         switch(dayOfWeek)
411         {
412         case 1:
413                 text.Append(L"Sun");
414                 break;
415         case 2:
416                 text.Append(L"Mon");
417                 break;
418         case 3:
419                 text.Append(L"Tue");
420                 break;
421         case 4:
422                 text.Append(L"Wed");
423                 break;
424         case 5:
425                 text.Append(L"Thu");
426                 break;
427         case 6:
428                 text.Append(L"Fri");
429                 break;
430         case 7:
431                 text.Append(L"Sat");
432                 break;
433         default:
434                 break;
435         }
436         text.Append(L", ");
437
438         String month = L"";
439
440         if (pGroupItemClass->__titleText != L"Older")
441         {
442                 text.Append(pGroupItemClass->__startTime.GetDay());
443                 text.Append(L". ");
444                 strMonth = pGroupItemClass->__startTime.GetMonth();
445                 month = GetMonth(strMonth);
446                 text.Append(month);
447         }
448         else
449         {
450                 text.Append(L"~ ");
451         }
452
453         if (pGroupItemClass->__titleText == L"Last week" || pGroupItemClass->__titleText == L"Two weeks ago" || pGroupItemClass->__titleText == L"Three weeks ago" || pGroupItemClass->__titleText == L"Four weeks ago" || pGroupItemClass->__titleText == L"Last month" || pGroupItemClass->__titleText == L"Older")
454         {
455                 text.Append(L" - ");
456                 text.Append(pGroupItemClass->__endTime.GetDay());
457                 text.Append(L". ");
458                 strMonth = pGroupItemClass->__endTime.GetMonth();
459                 month = GetMonth(strMonth);
460                 text.Append(month);
461         }
462
463         text.Append(L".)");
464         AppLogDebug("startTime day = %d month = %d year = %d",pGroupItemClass->__startTime.GetDay(),pGroupItemClass->__startTime.GetMonth(),pGroupItemClass->__startTime.GetYear());
465
466         pItem->SetElement(text, null);
467         pItem->SetTextSize(32);
468
469         return pItem;
470 }
471
472 ListItemBase*
473 EditHistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
474 {
475         AppLogDebug("EditHistoryListForm::CreateItem");
476         result r = E_FAILURE;
477         const int bookmarkBtnWidth = 64;
478         String bitmapId;
479         if (__pGroupData == null)
480         {
481                 return null;
482         }
483
484         CustomItem* pItem = new(std::nothrow) CustomItem();
485         if ( pItem == NULL)
486         {
487                 return null ;
488         }
489         GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
490
491         if (pGroupItemClass == null)
492         {
493                 delete pItem;
494                 return null;
495         }
496
497         History* pHistory = dynamic_cast< History* >(pGroupItemClass->__pData->GetAt(itemIndex));
498         if ( pHistory == NULL )
499         {
500                 delete pItem;
501                 return null;
502         }
503         Bitmap* pBitmap = null;
504
505         r = pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 128), LIST_ANNEX_STYLE_MARK);
506
507         bitmapId = pHistory->GetFaviconId();
508
509         pBitmap = FaviconManager::GetInstance()->GetFaviconN(bitmapId);
510         if (pBitmap == null)
511         {
512                 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
513         }
514
515         if (pBitmap != null)
516         {
517                 pItem->AddElement(Rectangle(16, 26, 60, 60), IDA_FORMAT_ICON, *pBitmap, null);
518                 delete pBitmap;
519         }
520         r = pItem->AddElement(Rectangle(92, 4, GetClientAreaBounds().width - 96 - 32 -64 -32, 60), IDA_FORMAT_TITLE, pHistory->GetHistoryTitle(), 44,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true);
521         if (IsFailed(r))
522         {
523                 delete pItem;
524                 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
525                 return null;
526         }
527
528         pItem->AddElement(Rectangle(92, 68, GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 52), IDA_FORMAT_URL, pHistory->GetHistoryUrl(),32,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,true);
529
530         return pItem;
531 }
532
533 bool
534 EditHistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
535 {
536
537         AppLogDebug("EditHistoryListForm::DeleteGroupItem");
538
539         if (__pGroupData == null)
540         {
541                 return false;
542         }
543
544         delete pItem;
545         pItem = null;
546
547         return true;
548
549 }
550
551 bool
552 EditHistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
553 {
554
555         if (__pGroupData == null)
556         {
557                 return false;
558         }
559
560         GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
561         if (pGroupItemClass == null)
562         {
563                 return false;
564         }
565
566         delete pItem;
567         pItem = null;
568         return true;
569 }
570
571 int
572 EditHistoryListForm::GetGroupCount(void)
573 {
574         AppLogDebug("EditHistoryListForm::GetGroupCount");
575
576         __isNoHistoryPresent = true;
577
578         CreateGroupItems();
579
580         int count = 0;
581         HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
582         if(count == 0)
583         {
584                 __isNoHistoryPresent = false;
585                 AppLogDebug("the value of isNoHistoryPresent %d",__isNoHistoryPresent);
586                 __pTimer->Start(1000);
587                 __pSelectAllCheck->SetShowState(false);
588                 __pSelectedLabel->SetShowState(false);
589         }
590         else
591         {
592                 __isNoHistoryPresent = true;
593                 __pSelectAllCheck->SetShowState(true);
594                 __pSelectedLabel->SetShowState(true);
595         }
596         __pSelectAllCheck->Invalidate(true);
597         __pSelectedLabel->Invalidate(false);
598         GetFooter()->Invalidate(true);
599
600         if (__pGroupData != null)
601         {
602                 AppLogDebug("GetGroupCount returning %d",__pGroupData->GetCount());
603                 count = __pGroupData->GetCount();
604         }
605         else
606         {
607                 AppLogDebug("GetGroupCount returning 0");
608                 count = 0;
609         }
610
611         return count;
612 }
613
614 int
615 EditHistoryListForm::GetItemCount(int groupIndex)
616 {
617         AppLogDebug("EditHistoryListForm::GetItemCount");
618         result r = E_FAILURE;
619         int count = 0;
620
621         if (__pGroupData == null)
622         {
623                 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
624                 return 0;
625         }
626
627         GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
628
629         if (pGroupItemClass == null)
630         {
631                 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
632                 return 0;
633         }
634
635
636         r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(pGroupItemClass->__startTime,pGroupItemClass->__endTime,count);
637
638         if ( r != E_SUCCESS)
639         {
640                 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
641                 return 0;
642         }
643
644         if (pGroupItemClass->__pData != null)
645         {
646                 pGroupItemClass->__pData->RemoveAll(true);
647                 delete pGroupItemClass->__pData;
648         }
649         pGroupItemClass->__pData = new(std::nothrow) Collection::ArrayList();
650         pGroupItemClass->__pData->Construct();
651         AppLog("Starttime %ls endtime %ls",pGroupItemClass->__startTime.ToString().GetPointer(),pGroupItemClass->__endTime.ToString().GetPointer());
652         HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(pGroupItemClass->__startTime,pGroupItemClass->__endTime, 0, count, *pGroupItemClass->__pData);
653         AppLogDebug("Count = %d ", count);
654
655         if (__pGroupData == null)
656         {
657                 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
658                 return 0;
659         }
660
661
662
663         if (pGroupItemClass == null || pGroupItemClass->__pData == null)
664         {
665                 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
666                 return 0;
667         }
668         else
669         {
670                 AppLogDebug("EditHistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->__pData->GetCount(),groupIndex,pGroupItemClass->__titleText.GetPointer());
671                 return pGroupItemClass->__pData->GetCount();
672         }
673 }
674
675 void
676 EditHistoryListForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
677                 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
678 {
679         AppLogDebug("EditHistoryListForm::OnSceneActivatedN");
680         int groupCount = 0;
681         int count = 0;
682
683         if(__pGroupData != null)
684         {
685                 groupCount =   __pGroupData->GetCount();
686
687                 for(int groupIndex = 0 ; groupIndex < groupCount ; groupIndex ++ )
688                 {
689                         count = __pListView->GetItemCountAt(groupIndex);
690
691                         for(int index = 0 ; index < count ; index++)
692                         {
693                                 if(__pListView->IsItemChecked( groupIndex,index ) == true)
694                                 {
695                                         __pListView->SetItemChecked(groupIndex,index,false);
696                                 }
697                         }
698                 }
699         }
700         if (__pListView != null)
701         {
702                 __pListView->UpdateList();
703         }
704         __pSelectAllCheck->SetSelected(false);
705
706         GetFooter()->SetItemEnabled(0, false);
707         Invalidate(true);
708 }
709
710 void
711 EditHistoryListForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
712                 const Tizen::Ui::Scenes::SceneId& nextSceneId)
713 {
714         AppLogDebug("EditHistoryListForm::OnSceneDeactivated");
715 }
716
717 void
718 EditHistoryListForm::OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
719 {
720
721 }
722
723 void
724 EditHistoryListForm::OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus status)
725 {
726         AppLogDebug("EditHistoryListForm::OnGroupedListViewItemStateChanged entered");
727         String  selectedText = CommonUtil::GetString(L"IDS_COM_OPT_SELECTED");
728         bool flag = false;
729
730         if (status == LIST_ITEM_STATUS_UNCHECKED)
731         {
732                 __selectedCount--;
733         }
734         else
735         {
736                 __selectedCount++;
737         }
738
739         if (__selectedCount == 0)
740         {
741                 GetFooter()->SetItemEnabled(0,false);
742         }
743         else
744         {
745                 GetFooter()->SetItemEnabled(0,true);
746         }
747         GetFooter()->Invalidate(true);
748
749         selectedText.Append(L"(");
750         selectedText.Append(__selectedCount);
751         selectedText.Append(L")");
752
753         __pSelectedLabel->SetText(selectedText);
754         __pSelectedLabel->Invalidate(true);
755
756         if (status == LIST_ITEM_STATUS_UNCHECKED)
757         {
758                 __pSelectAllCheck->SetSelected(false);
759         }
760         else if (status == LIST_ITEM_STATUS_CHECKED && __pSelectAllCheck->IsSelected() == false && __pGroupData != null)
761         {
762                 int itemCount = __pGroupData->GetCount();
763                 for (int groupIndex = 0 ; groupIndex < itemCount ; groupIndex ++)
764                 {
765                         GroupItemClass* pGClass = (dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)));
766                         if(pGClass == null)
767                         {
768                                 continue;
769                         }
770                         for (int itemIndex = 0 ; itemIndex < pGClass->__pData->GetCount() ; itemIndex ++)
771                         {
772                                 bool ret = __pListView->IsItemChecked(groupIndex,itemIndex);
773
774                                 if (ret == false)
775                                 {
776                                         __pSelectAllCheck->SetSelected(false);
777                                         return;
778                                 }
779                         }
780                 }
781                 __pSelectAllCheck->SetSelected(true);
782         }
783
784 }
785
786 void
787 EditHistoryListForm::OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction)
788 {
789
790 }
791
792 String
793 EditHistoryListForm::GetMonth(int month)
794 {
795         String monthValue;
796         switch (month)
797         {
798         case 1:
799                 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));;
800                 break;
801         case 2:
802                 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));;
803                 break;
804         case 3:
805                 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));;
806                 break;
807         case 4:
808                 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));;
809                 break;
810         case 5:
811                 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));;
812                 break;
813         case 6:
814                 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN"));;
815                 break;
816         case 7:
817                 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));;
818                 break;
819         case 8:
820                 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));;
821                 break;
822         case 9:
823                 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));;
824                 break;
825         case 10:
826                 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));;
827                 break;
828         case 11:
829                 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));;
830                 break;
831         case 12:
832                 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));;
833                 break;
834         default:
835                 break;
836         }
837
838         return monthValue;
839 }
840
841 void
842 EditHistoryListForm::CreateGroupItems(void)
843 {
844         AppLogDebug("EditHistoryListForm::createGroupItems entered");
845         if (__pGroupData != null)
846         {
847                 __pGroupData->RemoveAll(true);
848                 delete __pGroupData;
849                 __pGroupData = null;
850         }
851
852         if (__pGroupData == null)
853         {
854                 __pGroupData = new(std::nothrow) Collection::ArrayList();
855                 __pGroupData->Construct();
856         }
857
858         DateTime currentTime;
859
860         HistoryPresentationModel::GetCurrentDateTime(currentTime);
861         GroupItemClass* pGroupItemClass = new(std::nothrow) GroupItemClass();
862         pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
863         pGroupItemClass->__endTime = currentTime;
864         pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
865         __pGroupData->Add(*pGroupItemClass);
866         int dayOfWeek = 0;
867         Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
868
869         if (pGregorianCalendar != NULL)
870         {
871                 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
872                 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
873                 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
874                 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
875                 delete pGregorianCalendar;
876         }
877
878
879         switch(dayOfWeek)
880         {
881         case SUNDAY:
882                 pGroupItemClass = new(std::nothrow) GroupItemClass();
883                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
884                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
885                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
886                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 6 - 1);
887                 __pGroupData->Add(*pGroupItemClass);
888                 break;
889
890         case MONDAY:
891                 pGroupItemClass = new(std::nothrow) GroupItemClass();
892                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
893                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
894                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
895                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 7 - 1);
896                 __pGroupData->Add(*pGroupItemClass);
897                 break;
898
899         case TUESDAY:
900                 pGroupItemClass = new(std::nothrow) GroupItemClass();
901                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
902                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
903                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
904                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
905                 __pGroupData->Add(*pGroupItemClass);
906                 pGroupItemClass = new(std::nothrow) GroupItemClass();
907                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
908                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
909                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
910                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
911                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 8 - 1);
912                 __pGroupData->Add(*pGroupItemClass);
913                 break;
914
915         case WEDNESDAY:
916                 pGroupItemClass = new(std::nothrow) GroupItemClass();
917                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
918                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
919                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
920                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
921                 __pGroupData->Add(*pGroupItemClass);
922
923                 pGroupItemClass = new(std::nothrow) GroupItemClass();
924                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
925                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
926                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
927                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
928                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1);
929                 __pGroupData->Add(*pGroupItemClass);
930
931                 pGroupItemClass = new(std::nothrow) GroupItemClass();
932                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
933                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
934                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1);
935                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
936                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 9 - 1);
937                 __pGroupData->Add(*pGroupItemClass);
938                 break;
939
940         case THURSDAY:
941                 pGroupItemClass = new(std::nothrow) GroupItemClass();
942                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
943                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
944                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
945                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
946                 __pGroupData->Add(*pGroupItemClass);
947
948                 pGroupItemClass = new(std::nothrow) GroupItemClass();
949                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
950                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
951                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
952                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
953                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1);
954                 __pGroupData->Add(*pGroupItemClass);
955
956                 pGroupItemClass = new(std::nothrow) GroupItemClass();
957                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
958                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
959                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1);
960                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
961                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 3 - 1);
962                 __pGroupData->Add(*pGroupItemClass);
963
964                 pGroupItemClass = new(std::nothrow) GroupItemClass();
965                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
966                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
967                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 3 - 1);
968                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
969                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 10 - 1);
970                 __pGroupData->Add(*pGroupItemClass);
971                 break;
972
973         case FRIDAY:
974                 pGroupItemClass = new(std::nothrow) GroupItemClass();
975                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
976                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
977                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
978                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
979                 __pGroupData->Add(*pGroupItemClass);
980
981                 pGroupItemClass = new(std::nothrow) GroupItemClass();
982                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
983                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
984                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
985                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
986                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1);
987                 __pGroupData->Add(*pGroupItemClass);
988
989                 pGroupItemClass = new(std::nothrow) GroupItemClass();
990                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
991                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
992                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1);
993                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
994                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 3 - 1);
995                 __pGroupData->Add(*pGroupItemClass);
996
997                 pGroupItemClass = new(std::nothrow) GroupItemClass();
998                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
999                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1000                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 3 - 1);
1001                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1002                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 4 - 1);
1003                 __pGroupData->Add(*pGroupItemClass);
1004
1005                 pGroupItemClass = new(std::nothrow) GroupItemClass();
1006                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1007                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1008                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 4 - 1);
1009                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1010                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 11 - 1);
1011                 __pGroupData->Add(*pGroupItemClass);
1012                 break;
1013
1014         case SATURDAY:
1015                 pGroupItemClass = new(std::nothrow) GroupItemClass();
1016                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1017                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1018                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1019                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
1020                 __pGroupData->Add(*pGroupItemClass);
1021
1022                 pGroupItemClass = new(std::nothrow) GroupItemClass();
1023                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1024                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1025                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
1026                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1027                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1);
1028                 __pGroupData->Add(*pGroupItemClass);
1029
1030                 pGroupItemClass = new(std::nothrow) GroupItemClass();
1031                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1032                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1033                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1);
1034                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1035                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 3 - 1);
1036                 __pGroupData->Add(*pGroupItemClass);
1037
1038                 pGroupItemClass = new(std::nothrow) GroupItemClass();
1039                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1040                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1041                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 3 - 1);
1042                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1043                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 4 - 1);
1044                 __pGroupData->Add(*pGroupItemClass);
1045
1046                 pGroupItemClass = new(std::nothrow) GroupItemClass();
1047                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1048                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1049                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 4 - 1);
1050                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1051                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 5 - 1);
1052                 __pGroupData->Add(*pGroupItemClass);
1053
1054                 pGroupItemClass = new(std::nothrow) GroupItemClass();
1055                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1056                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1057                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 5 - 1);
1058                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1059                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 12 - 1);
1060                 __pGroupData->Add(*pGroupItemClass);
1061                 break;
1062
1063         default:
1064                 break;
1065         }
1066         int day = currentTime.GetDay();
1067         switch(day/7)
1068         {
1069         case 2:
1070                 pGroupItemClass = new(std::nothrow) GroupItemClass();
1071                 pGroupItemClass->__titleText = L"Two weeks ago";
1072                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1073                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1074                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1075                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1076                 __pGroupData->Add(*pGroupItemClass);
1077                 break;
1078
1079         case 3:
1080                 pGroupItemClass = new(std::nothrow) GroupItemClass();
1081                 pGroupItemClass->__titleText = L"Two weeks ago";
1082                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1083                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1084                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1085                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1086                 __pGroupData->Add(*pGroupItemClass);
1087
1088                 pGroupItemClass = new(std::nothrow) GroupItemClass();
1089                 pGroupItemClass->__titleText = L"Three weeks ago";
1090                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1091                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1092                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1093                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1094                 __pGroupData->Add(*pGroupItemClass);
1095                 break;
1096
1097         case 4:
1098                 pGroupItemClass = new(std::nothrow) GroupItemClass();
1099                 pGroupItemClass->__titleText = L"Two weeks ago";
1100                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1101                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1102                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1103                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1104                 __pGroupData->Add(*pGroupItemClass);
1105
1106                 pGroupItemClass = new(std::nothrow) GroupItemClass();
1107                 pGroupItemClass->__titleText = L"Three weeks ago";
1108                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1109                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1110                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1111                 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1112                 __pGroupData->Add(*pGroupItemClass);
1113
1114                 pGroupItemClass = new(std::nothrow) GroupItemClass();
1115                 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1116                 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1117                 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1118                 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1119                 __pGroupData->Add(*pGroupItemClass);
1120                 break;
1121         default:
1122                 break;
1123         }
1124
1125         pGroupItemClass = new(std::nothrow) GroupItemClass();
1126         pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1127         pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1128         pGroupItemClass->__endTime.AddDays(-1);
1129         pGroupItemClass->__startTime.SetValue(currentTime.GetYear(), 1, 1);
1130         pGroupItemClass->__startTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1131         __pGroupData->Add(*pGroupItemClass);
1132
1133         pGroupItemClass = new(std::nothrow) GroupItemClass();
1134         pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1135         pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),1, 1);
1136         pGroupItemClass->__endTime.AddMonths(currentTime.GetMonth() - 2);
1137         pGroupItemClass->__endTime.AddDays(-1);
1138         pGroupItemClass->__startTime.SetValue(0, 0, 0);
1139         __pGroupData->Add(*pGroupItemClass);
1140 }
1141
1142 void EditHistoryListForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
1143 {
1144         if (__pListView != null)
1145         {
1146                 __pListView->UpdateList();
1147         }
1148 }
1149
1150 void
1151 EditHistoryListForm::OnTimerExpired(Timer&  timer)
1152 {
1153         SceneManager* pSceneManager = SceneManager::GetInstance();
1154
1155         if ( pSceneManager != NULL)
1156         {
1157                 pSceneManager->GoBackward(BackwardSceneTransition());
1158         }
1159 }