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