3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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.
19 /*@file: IntEditHistoryListForm
20 *@brief: This class defines EditHistoryListForm used to edit the history scene
24 #include <FAppUiApp.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"
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;
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;
56 EditHistoryListForm::EditHistoryListForm(void)
60 ,__pSelectAllCheck(null)
61 ,__pSelectedLabel(null)
63 ,__isNoHistoryPresent(true)
67 EditHistoryListForm::~EditHistoryListForm(void)
69 AppLog("EditHistoryListForm::~EditHistoryListForm called");
71 if (__pGroupData != null)
73 AppLog("removing __pGroupData");
74 __pGroupData->RemoveAll(false);
80 EditHistoryListForm::Initialize(void)
82 Construct(L"IDL_EDIT_HISTORY_LIST");
88 EditHistoryListForm::OnInitializing(void)
92 SetFormBackEventListener(this);
94 AppLogDebug("EditHistoryListForm::OnInitializing");
95 SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
97 Header* pHeader = GetHeader();
104 pHeader->SetTitleText(CommonUtil::GetString("IDS_BR_SK_DELETE_ABB"));
106 GetFooter()->AddActionEventListener(*this);
107 AddOrientationEventListener(*this);
109 SceneManager::GetInstance()->AddSceneEventListener(IDSCN_EDIT_HISTORY_LIST, *this);
110 __pSelectedLabel = static_cast< Label* >(GetControl(L"IDC_LABEL1"));
112 if (__pSelectedLabel == null)
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);
121 __pSelectAllCheck = static_cast< CheckButton* >(GetControl(L"IDC_SELECT_ALL",true));
123 if (__pSelectAllCheck != null)
125 __pSelectAllCheck->SetActionId(IDA_SELECT_ALL_CHECKED, IDA_SELECT_ALL_UNCHECKED);
126 __pSelectAllCheck->AddActionEventListener(*this);
133 __pListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1"));
134 if( __pListView != NULL)
136 __pListView->SetItemProvider(*this);
137 __pListView->AddGroupedListViewItemEventListener(*this);
144 __pTimer = new (std::nothrow) Timer();
145 r = __pTimer->Construct(*this);
151 EditHistoryListForm::OnTerminating(void)
153 result r = E_SUCCESS;
159 EditHistoryListForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
161 String selectedText = CommonUtil::GetString(L"IDS_COM_OPT_SELECTED");
162 SceneManager* pSceneManager = SceneManager::GetInstance();
164 if (pSceneManager == null)
171 case IDA_TABBAR_ITEM_1:
173 result r = pSceneManager->GoBackward(BackwardSceneTransition());
176 AppLogDebug("EditHistoryListForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r));
182 case IDA_SELECT_ALL_CHECKED:
184 int selectedCount = 0;
185 for (int groupIndex = 0 ; __pGroupData != null && groupIndex < __pGroupData->GetCount() ; groupIndex ++)
187 GroupItemClass* pGClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
192 for (int itemIndex = 0 ; itemIndex < pGClass->__pData->GetCount() ; itemIndex ++)
195 __pListView->SetItemChecked(groupIndex,itemIndex,true);
198 selectedText.Append(L"\x200E"); // LEFT-TO-RIGHT MARK
199 selectedText.Append(L"(");
200 selectedText.Append(selectedCount);
201 selectedText.Append(L")");
202 __selectedCount = selectedCount;
204 __pSelectedLabel->SetText(selectedText);
205 __pSelectedLabel->Invalidate(true);
207 if(__selectedCount > 0)
209 GetFooter()->SetItemEnabled(0, true);
210 GetFooter()->Invalidate(true);
213 __pListView->Invalidate(true);
217 case IDA_SELECT_ALL_UNCHECKED:
219 for (int groupIndex = 0 ; __pGroupData != null && groupIndex < __pGroupData->GetCount() ; groupIndex ++)
221 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
222 if(pGroupItemClass == null)
226 for (int itemIndex = 0 ; itemIndex < pGroupItemClass->__pData->GetCount() ; itemIndex ++)
228 __pListView->SetItemChecked(groupIndex,itemIndex,false);
231 selectedText.Append(L"\x200E"); // LEFT-TO-RIGHT MARK
232 selectedText.Append(L"(0)");
233 __pSelectedLabel->SetText(selectedText);
235 __pSelectedLabel->Invalidate(true);
237 GetFooter()->SetItemEnabled(0, false);
238 GetFooter()->Invalidate(true);
240 __pListView->Invalidate(true);
243 case IDA_DELETE_HISTORY:
246 ArrayList* pArrayList = new(std::nothrow) ArrayList();
251 pArrayList->Construct();
252 for (int groupIndex = 0 ; __pGroupData != null && groupIndex < __pGroupData->GetCount() ; groupIndex ++)
254 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
256 if (pGroupItemClass == null || pGroupItemClass->__pData == null)
258 AppLogDebug(" pGroupItemClass || __pData is null");
261 itemCount = pGroupItemClass->__pData->GetCount();
262 for (int itemIndex = 0 ; itemIndex < itemCount ; itemIndex++)
264 bool ret = __pListView->IsItemChecked(groupIndex,itemIndex);
269 AppLog("deleting history for groupId %d, item %d",groupIndex,itemIndex);
271 History* pHistory = dynamic_cast< History* >(pGroupItemClass->__pData->GetAt(itemIndex));
276 pArrayList->Add(*new(std::nothrow) String(pHistory->GetHistoryId()));
281 HistoryPresentationModel::GetInstance()->DeleteMultipleHistory(pArrayList);
283 if (pArrayList != null)
285 pArrayList->RemoveAll(true);
289 if(__pGroupData != null)
291 groupCount = __pGroupData->GetCount();
293 for(int groupIndex = 0 ; groupIndex < groupCount ; groupIndex ++ )
295 counter = __pListView->GetItemCountAt(groupIndex);
297 for(int index = 0 ; index < counter ; index++)
299 if(__pListView->IsItemChecked( groupIndex,index ) == true)
301 __pListView->SetItemChecked(groupIndex,index,false);
309 __pSelectAllCheck->SetSelected(false);
311 GetFooter()->SetItemEnabled(0,false);
312 GetFooter()->Invalidate(true);
313 selectedText.Append(L"\x200E"); // LEFT-TO-RIGHT MARK
314 selectedText.Append(L"(0)");
315 __pSelectedLabel->SetText(selectedText);
317 __pSelectedLabel->Invalidate(true);
318 if (__pListView != null)
320 __pListView->UpdateList();
323 NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this);
324 String notification = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
325 pNotification->SetText(notification);
326 pNotification->ShowNotification();
331 if( __pTimer != NULL)
335 result r = pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
338 AppLogDebug("EditHistoryListForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r));
351 EditHistoryListForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
353 SceneManager* pSceneManager = SceneManager::GetInstance();
355 if (pSceneManager == null)
360 result r = pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
363 AppLogDebug("EditHistoryListForm::OnFormBackRequested Failed to GoBackward %s",GetErrorMessage(r));
369 EditHistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
371 AppLogDebug("EditHistoryListForm::CreateGroupItem");
372 result r = E_FAILURE;
376 GroupItem* pItem = null;
379 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
380 if(pGroupItemClass == null)
382 pItem = new(std::nothrow) GroupItem();
389 if ( pGroupItemClass->__pData == null || pGroupItemClass->__pData->GetCount() == 0)
391 r = pItem->Construct(Dimension(itemWidth, 0));
395 r = pItem->Construct(Dimension(itemWidth, 48));
398 text = pGroupItemClass->__titleText;
402 if (pGroupItemClass->__titleText == L"Today" || pGroupItemClass->__titleText == L"Yesterday")
404 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
405 if (pGregorianCalendar != NULL)
407 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->__startTime.GetYear());
408 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->__startTime.GetMonth());
409 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->__startTime.GetDay());
410 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
412 if (pGregorianCalendar != NULL)
414 delete pGregorianCalendar;
448 if (pGroupItemClass->__titleText != L"Older")
450 text.Append(pGroupItemClass->__startTime.GetDay());
452 strMonth = pGroupItemClass->__startTime.GetMonth();
453 month = GetMonth(strMonth);
461 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")
464 text.Append(pGroupItemClass->__endTime.GetDay());
466 strMonth = pGroupItemClass->__endTime.GetMonth();
467 month = GetMonth(strMonth);
472 AppLogDebug("startTime day = %d month = %d year = %d",pGroupItemClass->__startTime.GetDay(),pGroupItemClass->__startTime.GetMonth(),pGroupItemClass->__startTime.GetYear());
474 pItem->SetElement(text, null);
475 pItem->SetTextSize(32);
481 EditHistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
483 AppLogDebug("EditHistoryListForm::CreateItem");
484 result r = E_FAILURE;
485 const int bookmarkBtnWidth = 64;
487 if (__pGroupData == null)
492 CustomItem* pItem = new(std::nothrow) CustomItem();
497 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
499 if (pGroupItemClass == null)
505 History* pHistory = dynamic_cast< History* >(pGroupItemClass->__pData->GetAt(itemIndex));
506 if ( pHistory == NULL )
511 Bitmap* pBitmap = null;
513 r = pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 128), LIST_ANNEX_STYLE_MARK);
517 pBitmap = pHistory->GetFavIconBitmap();
520 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
525 pItem->AddElement(Rectangle(16, 26, 60, 60), IDA_FORMAT_ICON, *pBitmap, null);
528 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);
532 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
536 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);
542 EditHistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
545 AppLogDebug("EditHistoryListForm::DeleteGroupItem");
547 if (__pGroupData == null)
560 EditHistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
563 if (__pGroupData == null)
568 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
569 if (pGroupItemClass == null)
580 EditHistoryListForm::GetGroupCount(void)
582 AppLogDebug("EditHistoryListForm::GetGroupCount");
584 __isNoHistoryPresent = true;
589 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
592 __isNoHistoryPresent = false;
593 AppLogDebug("the value of isNoHistoryPresent %d",__isNoHistoryPresent);
594 __pTimer->Start(1000);
595 __pSelectAllCheck->SetShowState(false);
596 __pSelectedLabel->SetShowState(false);
600 __isNoHistoryPresent = true;
601 __pSelectAllCheck->SetShowState(true);
602 __pSelectedLabel->SetShowState(true);
604 __pSelectAllCheck->Invalidate(true);
605 __pSelectedLabel->Invalidate(false);
606 GetFooter()->Invalidate(true);
608 if (__pGroupData != null)
610 AppLogDebug("GetGroupCount returning %d",__pGroupData->GetCount());
611 count = __pGroupData->GetCount();
615 AppLogDebug("GetGroupCount returning 0");
623 EditHistoryListForm::GetItemCount(int groupIndex)
625 AppLogDebug("EditHistoryListForm::GetItemCount");
626 result r = E_FAILURE;
629 if (__pGroupData == null)
631 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
635 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
637 if (pGroupItemClass == null)
639 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
644 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(pGroupItemClass->__startTime,pGroupItemClass->__endTime,count);
648 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
652 if (pGroupItemClass->__pData != null)
654 pGroupItemClass->__pData->RemoveAll(false);
655 delete pGroupItemClass->__pData;
657 pGroupItemClass->__pData = new(std::nothrow) Collection::ArrayList();
658 pGroupItemClass->__pData->Construct();
659 AppLog("Starttime %ls endtime %ls",pGroupItemClass->__startTime.ToString().GetPointer(),pGroupItemClass->__endTime.ToString().GetPointer());
660 HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(pGroupItemClass->__startTime,pGroupItemClass->__endTime, 0, count, *pGroupItemClass->__pData);
661 AppLogDebug("Count = %d ", count);
663 if (__pGroupData == null)
665 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
671 if (pGroupItemClass == null || pGroupItemClass->__pData == null)
673 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
678 AppLogDebug("EditHistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->__pData->GetCount(),groupIndex,pGroupItemClass->__titleText.GetPointer());
679 return pGroupItemClass->__pData->GetCount();
684 EditHistoryListForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
685 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
687 AppLogDebug("EditHistoryListForm::OnSceneActivatedN");
691 if(__pGroupData != null)
693 groupCount = __pGroupData->GetCount();
695 for(int groupIndex = 0 ; groupIndex < groupCount ; groupIndex ++ )
697 count = __pListView->GetItemCountAt(groupIndex);
699 for(int index = 0 ; index < count ; index++)
701 if(__pListView->IsItemChecked( groupIndex,index ) == true)
703 __pListView->SetItemChecked(groupIndex,index,false);
708 if (__pListView != null)
710 __pListView->UpdateList();
712 __pSelectAllCheck->SetSelected(false);
714 GetFooter()->SetItemEnabled(0, false);
719 EditHistoryListForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
720 const Tizen::Ui::Scenes::SceneId& nextSceneId)
722 AppLogDebug("EditHistoryListForm::OnSceneDeactivated");
726 EditHistoryListForm::OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
732 EditHistoryListForm::OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus status)
734 AppLogDebug("EditHistoryListForm::OnGroupedListViewItemStateChanged entered");
735 String selectedText = CommonUtil::GetString(L"IDS_COM_OPT_SELECTED");
738 if (status == LIST_ITEM_STATUS_UNCHECKED)
747 if (__selectedCount == 0)
749 GetFooter()->SetItemEnabled(0,false);
753 GetFooter()->SetItemEnabled(0,true);
755 GetFooter()->Invalidate(true);
757 selectedText.Append(L"\x200E"); // LEFT-TO-RIGHT MARK
758 selectedText.Append(L"(");
759 selectedText.Append(__selectedCount);
760 selectedText.Append(L")");
762 __pSelectedLabel->SetText(selectedText);
763 __pSelectedLabel->Invalidate(true);
765 if (status == LIST_ITEM_STATUS_UNCHECKED)
767 __pSelectAllCheck->SetSelected(false);
769 else if (status == LIST_ITEM_STATUS_CHECKED && __pSelectAllCheck->IsSelected() == false && __pGroupData != null)
771 int itemCount = __pGroupData->GetCount();
772 for (int groupIndex = 0 ; groupIndex < itemCount ; groupIndex ++)
774 GroupItemClass* pGClass = (dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)));
779 for (int itemIndex = 0 ; itemIndex < pGClass->__pData->GetCount() ; itemIndex ++)
781 bool ret = __pListView->IsItemChecked(groupIndex,itemIndex);
785 __pSelectAllCheck->SetSelected(false);
790 __pSelectAllCheck->SetSelected(true);
796 EditHistoryListForm::OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction)
802 EditHistoryListForm::GetMonth(int month)
808 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));;
811 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));;
814 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));;
817 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));;
820 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));;
823 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN"));;
826 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));;
829 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));;
832 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));;
835 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));;
838 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));;
841 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));;
851 EditHistoryListForm::CreateGroupItems(void)
853 AppLogDebug("EditHistoryListForm::createGroupItems entered");
854 if (__pGroupData != null)
856 __pGroupData->RemoveAll(true);
861 if (__pGroupData == null)
863 __pGroupData = new(std::nothrow) Collection::ArrayList();
864 __pGroupData->Construct();
867 DateTime currentTime;
869 HistoryPresentationModel::GetCurrentDateTime(currentTime);
870 GroupItemClass* pGroupItemClass = new(std::nothrow) GroupItemClass();
871 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
872 pGroupItemClass->__endTime = currentTime;
873 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
874 __pGroupData->Add(*pGroupItemClass);
876 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
878 if (pGregorianCalendar != NULL)
880 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
881 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
882 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
883 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
884 delete pGregorianCalendar;
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() - 6 - 1);
896 __pGroupData->Add(*pGroupItemClass);
900 pGroupItemClass = new(std::nothrow) GroupItemClass();
901 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
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() - 7 - 1);
905 __pGroupData->Add(*pGroupItemClass);
909 pGroupItemClass = new(std::nothrow) GroupItemClass();
910 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
911 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
912 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
913 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
914 __pGroupData->Add(*pGroupItemClass);
915 pGroupItemClass = new(std::nothrow) GroupItemClass();
916 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
917 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
918 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
919 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
920 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 8 - 1);
921 __pGroupData->Add(*pGroupItemClass);
925 pGroupItemClass = new(std::nothrow) GroupItemClass();
926 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
927 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
928 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
929 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
930 __pGroupData->Add(*pGroupItemClass);
932 pGroupItemClass = new(std::nothrow) GroupItemClass();
933 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
934 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
935 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
936 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
937 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1);
938 __pGroupData->Add(*pGroupItemClass);
940 pGroupItemClass = new(std::nothrow) GroupItemClass();
941 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
942 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
943 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1);
944 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
945 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 9 - 1);
946 __pGroupData->Add(*pGroupItemClass);
950 pGroupItemClass = new(std::nothrow) GroupItemClass();
951 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
952 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
953 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
954 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
955 __pGroupData->Add(*pGroupItemClass);
957 pGroupItemClass = new(std::nothrow) GroupItemClass();
958 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
959 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
960 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
961 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
962 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1);
963 __pGroupData->Add(*pGroupItemClass);
965 pGroupItemClass = new(std::nothrow) GroupItemClass();
966 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
967 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
968 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1);
969 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
970 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 3 - 1);
971 __pGroupData->Add(*pGroupItemClass);
973 pGroupItemClass = new(std::nothrow) GroupItemClass();
974 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
975 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
976 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 3 - 1);
977 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
978 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 10 - 1);
979 __pGroupData->Add(*pGroupItemClass);
983 pGroupItemClass = new(std::nothrow) GroupItemClass();
984 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
985 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
986 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
987 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
988 __pGroupData->Add(*pGroupItemClass);
990 pGroupItemClass = new(std::nothrow) GroupItemClass();
991 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
992 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
993 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
994 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
995 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1);
996 __pGroupData->Add(*pGroupItemClass);
998 pGroupItemClass = new(std::nothrow) GroupItemClass();
999 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1000 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1001 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1);
1002 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1003 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 3 - 1);
1004 __pGroupData->Add(*pGroupItemClass);
1006 pGroupItemClass = new(std::nothrow) GroupItemClass();
1007 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1008 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1009 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 3 - 1);
1010 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1011 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 4 - 1);
1012 __pGroupData->Add(*pGroupItemClass);
1014 pGroupItemClass = new(std::nothrow) GroupItemClass();
1015 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1016 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1017 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 4 - 1);
1018 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1019 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 11 - 1);
1020 __pGroupData->Add(*pGroupItemClass);
1024 pGroupItemClass = new(std::nothrow) GroupItemClass();
1025 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1026 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1027 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1028 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
1029 __pGroupData->Add(*pGroupItemClass);
1031 pGroupItemClass = new(std::nothrow) GroupItemClass();
1032 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1033 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1034 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
1035 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1036 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1);
1037 __pGroupData->Add(*pGroupItemClass);
1039 pGroupItemClass = new(std::nothrow) GroupItemClass();
1040 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1041 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1042 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1);
1043 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1044 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 3 - 1);
1045 __pGroupData->Add(*pGroupItemClass);
1047 pGroupItemClass = new(std::nothrow) GroupItemClass();
1048 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1049 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1050 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 3 - 1);
1051 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1052 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 4 - 1);
1053 __pGroupData->Add(*pGroupItemClass);
1055 pGroupItemClass = new(std::nothrow) GroupItemClass();
1056 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1057 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1058 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 4 - 1);
1059 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1060 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 5 - 1);
1061 __pGroupData->Add(*pGroupItemClass);
1063 pGroupItemClass = new(std::nothrow) GroupItemClass();
1064 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1065 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1066 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 5 - 1);
1067 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1068 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 12 - 1);
1069 __pGroupData->Add(*pGroupItemClass);
1075 int day = currentTime.GetDay();
1079 pGroupItemClass = new(std::nothrow) GroupItemClass();
1080 pGroupItemClass->__titleText = L"Two weeks ago";
1081 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1082 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1083 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1084 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1085 __pGroupData->Add(*pGroupItemClass);
1089 pGroupItemClass = new(std::nothrow) GroupItemClass();
1090 pGroupItemClass->__titleText = L"Two weeks ago";
1091 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1092 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1093 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1094 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1095 __pGroupData->Add(*pGroupItemClass);
1097 pGroupItemClass = new(std::nothrow) GroupItemClass();
1098 pGroupItemClass->__titleText = L"Three weeks ago";
1099 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1100 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1101 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1102 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1103 __pGroupData->Add(*pGroupItemClass);
1107 pGroupItemClass = new(std::nothrow) GroupItemClass();
1108 pGroupItemClass->__titleText = L"Two weeks ago";
1109 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1110 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1111 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1112 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1113 __pGroupData->Add(*pGroupItemClass);
1115 pGroupItemClass = new(std::nothrow) GroupItemClass();
1116 pGroupItemClass->__titleText = L"Three weeks ago";
1117 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1118 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1119 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1120 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1121 __pGroupData->Add(*pGroupItemClass);
1123 pGroupItemClass = new(std::nothrow) GroupItemClass();
1124 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1125 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1126 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1127 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1128 __pGroupData->Add(*pGroupItemClass);
1134 pGroupItemClass = new(std::nothrow) GroupItemClass();
1135 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1136 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1137 pGroupItemClass->__endTime.AddDays(-1);
1138 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(), 1, 1);
1139 pGroupItemClass->__startTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1140 __pGroupData->Add(*pGroupItemClass);
1142 pGroupItemClass = new(std::nothrow) GroupItemClass();
1143 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1144 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),1, 1);
1145 pGroupItemClass->__endTime.AddMonths(currentTime.GetMonth() - 2);
1146 pGroupItemClass->__endTime.AddDays(-1);
1147 pGroupItemClass->__startTime.SetValue(0, 0, 0);
1148 __pGroupData->Add(*pGroupItemClass);
1151 void EditHistoryListForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
1153 if (__pListView != null)
1155 __pListView->UpdateList();
1160 EditHistoryListForm::OnTimerExpired(Timer& timer)
1162 SceneManager* pSceneManager = SceneManager::GetInstance();
1164 if ( pSceneManager != NULL)
1166 pSceneManager->GoBackward(BackwardSceneTransition());