2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 //!Internet HistoryListForm class
18 /*@file: HistoryListForm.cpp
19 *@brief: This class defines HistoryListForm used define history
25 #include "IntBookmarkData.h"
26 #include "IntBookmarkPresentationModel.h"
27 #include "IntCommonLib.h"
28 #include "IntFaviconManager.h"
29 #include "IntHistoryListForm.h"
30 #include "IntHistoryPresentationModel.h"
31 #include "IntMultipleWindowPresentationModel.h"
32 #include "IntSceneRegister.h"
35 using namespace Tizen::App;
36 using namespace Tizen::Base;
37 using namespace Tizen::Base::Collection;
38 using namespace Tizen::Base::Runtime;
39 using namespace Tizen::Graphics;
40 using namespace Tizen::Locales;
41 using namespace Tizen::Media;
42 using namespace Tizen::Ui;
43 using namespace Tizen::Ui::Controls;
44 using namespace Tizen::Ui::Scenes;
45 using namespace Tizen::System;
47 static const wchar_t* IDB_TAB_ICON_BOOKMARKS = L"I01_tab_icon_bookmarks.png";
48 static const wchar_t* IDB_TAB_ICON_HISTORY = L"I01_tab_icon_history.png";
49 static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png";
50 static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png";
53 const int HistoryListForm::IDA_TABBAR_ITEM_1 = 101;
54 const int HistoryListForm::IDA_TABBAR_ITEM_2 = 102;
55 const int HistoryListForm::IDA_EDIT_HISTORY_LIST_FORM = 103;
56 const int HistoryListForm::IDA_FORMAT_ICON = 104;
57 const int HistoryListForm::IDA_FORMAT_TITLE = 105;
58 const int HistoryListForm::IDA_FORMAT_URL = 106;
59 const int HistoryListForm::IDA_FORMAT_BOOKMARK = 107;
62 HistoryListForm::HistoryListForm(void)
64 __pBookmarkList = null;
65 __pGroupedListView =null;
66 __pSearchListView = null;
69 __pSearchedData = null ;
70 __searchHistory = false;
71 __isNoHistoryPresent = true;
73 __previousSceneId = L"";
76 HistoryListForm::~HistoryListForm(void)
78 if (__pGroupData != null)
80 __pGroupData->RemoveAll(false);
83 if(__pBookmarkList != null)
85 __pBookmarkList->RemoveAll(false);
86 delete __pBookmarkList;
91 HistoryListForm::Initialize(void)
93 Construct(L"IDL_HISTORY_LIST");
99 HistoryListForm::OnInitializing(void)
101 AppLog("HistoryListForm::OnInitializing");
102 result r = E_SUCCESS;
103 SceneManager* pSceneManager = null;
106 Header *pHeader = GetHeader();
107 Bitmap *pIconBitmap = null;
108 AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
109 const Color brown = Color(32, 32, 32, 0xFF);
111 // Setup back event listener
112 SetFormBackEventListener(this);
114 GetHeader()->AddActionEventListener(*this);
115 GetFooter()->AddActionEventListener(*this);
117 AddOrientationEventListener(*this);
118 SettingInfo::AddSettingEventListener(*this);
120 pSceneManager = SceneManager::GetInstance();
121 if (pSceneManager != null)
123 pSceneManager->AddSceneEventListener(IDSCN_HISTORY_LIST, *this);
126 if (pAppResource == null)
131 __pGroupedListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1"));
132 if (__pGroupedListView == null)
137 r = __pGroupedListView->SetItemProvider(*this);
144 __pSearchBar = static_cast< SearchBar* >(GetControl(L"IDC_SEARCHBAR1"));
145 if (__pSearchBar == null)
149 __pSearchListView = new(std::nothrow) GroupedListView();
150 if (__pSearchListView == null)
155 __pGroupedListView->AddGroupedListViewItemEventListener(*this);
156 r = __pGroupedListView->SetBounds(Rectangle(0,__pGroupedListView->GetY(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
161 r = __pSearchListView->Construct(Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height -__pSearchBar->GetHeight() - __pSearchBar->GetY()), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
166 r = __pSearchListView->SetItemProvider(*this);
171 r = __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND"));
178 __pSearchListView->SetBackgroundColor(GetBackgroundColor());
179 __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK));
180 __pSearchListView->AddGroupedListViewItemEventListener(*this);
181 r = __pSearchListView->SetShowState(false);
188 __pSearchBar->AddSearchBarEventListener(*this);
189 __pSearchBar->AddKeypadEventListener(*this);
190 r = __pSearchBar->SetContent(__pSearchListView);
194 pHeader->SetStyle(HEADER_STYLE_TAB);
195 bookmark.Construct(IDA_TABBAR_ITEM_1);
197 pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark);
198 bookmark.SetText(strbookmark);
199 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARKS);
200 bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
201 bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
202 pHeader->AddItem(bookmark);
210 history.Construct(IDA_TABBAR_ITEM_2);
212 pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory);
213 history.SetText(strhistory);
214 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY);
215 history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
216 history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
217 pHeader->AddItem(history);
218 pHeader->SetItemSelected(1);
219 pHeader->SetTabEditModeEnabled(false);
221 if (pIconBitmap != NULL)
227 __pBookmarkList = new(std::nothrow) Collection::ArrayList();
228 __pBookmarkList->Construct();
229 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
234 HistoryListForm::OnTerminating(void)
236 result r = E_SUCCESS;
238 SettingInfo::RemoveSettingEventListener(*this);
243 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
245 AppLog("HistoryListForm::OnActionPerformed");
246 result r = E_FAILURE;
247 SceneManager* pSceneManager = SceneManager::GetInstance();
248 if (pSceneManager == null)
254 case IDA_EDIT_HISTORY_LIST_FORM:
256 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
257 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
264 case IDA_TABBAR_ITEM_1:
266 result r = GetHeader()->SetItemSelected(1);
267 AppLog("SetItemSelected result %s",GetErrorMessage(r));
268 GetHeader()->Invalidate(true);
270 if (pSceneManager != null)
272 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
274 if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)) != E_SUCCESS)
276 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
283 if(pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT))!= E_SUCCESS)
285 AppLogDebug("BookmarkListForm::OnActionPerformed GoBackward failed");
291 // r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
304 HistoryListForm::OnFormBackRequested(Form& source)
306 SceneManager* pSceneManager = SceneManager::GetInstance();
307 if (pSceneManager == null)
311 result r = E_FAILURE;
312 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
314 r = pSceneManager->GoBackward(BackwardSceneTransition());
318 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
322 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
327 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
329 result r = E_FAILURE;
335 GroupItem* pItem = null;
336 GroupItemClass* pGroupItemClass = null;
338 String weeksAgo2 = L"";
339 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
341 String weeksAgo3 = L"";
342 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
344 String weeksAgo4 = L"";
345 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),4);
347 pItem = new(std::nothrow) GroupItem();
352 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
354 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
356 AppLog("CreateGroupItem :: if history is null");
357 r = pItem->Construct(Dimension(itemWidth, 0));
362 r = pItem->Construct(Dimension(itemWidth, 48));
364 text = pGroupItemClass->GetTitleText();
366 if (__searchHistory == false)
370 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
373 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
374 if ( pGregorianCalendar != NULL)
376 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
383 delete pGregorianCalendar;
386 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
393 delete pGregorianCalendar;
396 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
403 delete pGregorianCalendar;
406 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
408 delete pGregorianCalendar;
414 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
417 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
420 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
423 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
426 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
429 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
432 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
440 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
442 text.Append(pGroupItemClass->GetStartTime().GetDay());
444 strMonth = pGroupItemClass->GetStartTime().GetMonth();
445 month = GetMonth(strMonth);
455 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
456 || pGroupItemClass->GetTitleText() == weeksAgo3 || pGroupItemClass->GetTitleText() == weeksAgo4 || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
459 text.Append(pGroupItemClass->GetEndTime().GetDay());
461 strMonth = pGroupItemClass->GetEndTime().GetMonth();
462 month = GetMonth(strMonth);
468 r = pItem->SetElement(text, null);
472 AppLogDebug("Failed with %s", GetErrorMessage(r));
475 r = pItem->SetTextSize(32);
486 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
488 AppLog("HistoryListForm::CreateItem");
489 result r = E_FAILURE;
490 History* pHistory = null;
491 Bitmap* pBitmap = null;
492 Bitmap* pBookmarkBitmap = null;
493 GroupItemClass* pGroupItemClass = null;
494 CustomItem* pItem = new(std::nothrow) CustomItem();
495 int bookmarkBtnWidth = 0;
498 Image* pImage = null;
499 pImage = new Image();
502 if(__pGroupData == null)
512 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
513 if (pGroupItemClass == null)
518 if (pGroupItemClass->GetHistoryData() == null)
523 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
524 if (pHistory == null)
529 r = pItem->Construct(Dimension(itemWidth, 128), LIST_ANNEX_STYLE_NORMAL);
536 ByteBuffer* pFavIconBuffer = null;
537 pFavIconBuffer = pHistory->GetFavIconBuffer();
539 AppLog("BookmarkListForm::CreateItem check 0");
541 if (pFavIconBuffer != null)
543 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is not null");
547 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is null");
550 pBitmap = pImage->DecodeN(*pFavIconBuffer, IMG_FORMAT_PNG, BITMAP_PIXEL_FORMAT_ARGB8888);
552 AppLog("BookmarkListForm::CreateItem check 1");
554 //bitmapId = pHistory->GetFaviconId() ;
555 //pBitmap = pHistory->GetFavIconBitmap();
559 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
563 r = pItem->AddElement(Rectangle(16, 28,72, 72), IDA_FORMAT_ICON, *pBitmap, null);
568 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
572 bool urlFoundInBookmark = false;
574 if(__pBookmarkList != null)
576 for (int i = 0; i < __pBookmarkList->GetCount();i++)
578 BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
579 if(pBookMark != null && pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
581 urlFoundInBookmark = true;
586 if (urlFoundInBookmark == true)
588 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
592 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
594 bookmarkBtnWidth = 64;
597 r = pItem->AddElement(Rectangle(104, 10, GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 60), IDA_FORMAT_TITLE, pHistory->GetHistoryTitle(), 44,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true);
598 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
600 if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
601 r = pItem->AddElement(Rectangle(104, 70, GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 48), IDA_FORMAT_URL, pHistory->GetHistoryUrl(),32,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true);
603 r = pItem->AddElement(Rectangle(104, 70, GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 48), IDA_FORMAT_URL, pHistory->GetHistoryUrl(),32,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,true);
604 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
605 if ( pBookmarkBitmap != null)
607 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
608 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
609 delete pBookmarkBitmap;
620 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
629 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
631 AppLog("HistoryListForm::DeleteItem");
632 result r = E_FAILURE;
633 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
634 if (pGroupItemClass == null)
639 // if (pGroupItemClass->__pData != null)
641 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
654 HistoryListForm::GetGroupCount(void)
656 __isNoHistoryPresent = true;
658 if (__pGroupData != null)
660 if (__searchHistory == false)
663 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
668 return __pGroupData->GetCount();
673 // String searchText = __pSearchBar->GetText();
674 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
688 HistoryListForm::GetItemCount(int groupIndex)
690 result r = E_FAILURE;
696 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
697 if (pGroupItemClass == null)
701 if (__searchHistory == false)
703 startTime = pGroupItemClass->GetStartTime();
704 endTime = pGroupItemClass->GetEndTime();
705 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
709 //text = __pSearchBar->GetText();
710 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
721 ArrayList* pData = new(std::nothrow) ArrayList();
726 r = pData->Construct();
734 if (__searchHistory == false)
736 startTime = pGroupItemClass->GetStartTime();
737 endTime = pGroupItemClass->GetEndTime();
738 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
739 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
743 //text = __pSearchBar->GetText() ;
744 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
751 pGroupItemClass->SetHistoryData(pData);
754 if (__isNoHistoryPresent == true && count == 0)
756 __isNoHistoryPresent = true;
757 GetFooter()->SetItemEnabled(0, false);
761 __isNoHistoryPresent = false;
762 GetFooter()->SetItemEnabled(0, true);
764 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
765 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
772 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
773 return pGroupItemClass->GetHistoryData()->GetCount();
778 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
781 GetHeader()->SetItemSelected(1);
782 // __previousSceneId = previousSceneId;
783 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
786 pList->GetAt(pList->GetCount()-1,__previousSceneId);
789 if(__pBookmarkList != null)
791 __pBookmarkList->RemoveAll(false);
794 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
796 AppLog("HistoryListForm::OnSceneActivatedN called");
797 //GetHeader()->Invalidate(true);
798 if (__pGroupData == null)
800 __pGroupData = new(std::nothrow) ArrayList();
801 __pGroupData->Construct();
803 if (__pGroupedListView != null)
805 __pGroupedListView->UpdateList();
807 if (__isNoHistoryPresent == true)
809 GetFooter()->SetItemEnabled(0, false);
813 GetFooter()->SetItemEnabled(0, true);
817 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
820 __pSearchBar->SetShowState(false);
821 __pSearchBar->Invalidate(true);
825 __pSearchBar->SetShowState(true);
826 __pSearchBar->Invalidate(true);
829 // if (__isNoHistoryPresent == true)
831 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
832 // __pGroupedListView->UpdateList();
835 result r = GetHeader()->SetItemSelected(2);
838 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
849 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
851 AppLog("HistoryListForm::OnSceneDeactivated");
852 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
856 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
862 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
864 GroupItemClass* pGroupItemClass = null;
865 History* pHistory = null;
866 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
867 if (elementId == IDA_FORMAT_BOOKMARK)
869 String toggledUrl = L"";
870 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
871 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
872 if (pGroupItemClass == null)
876 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
877 if (pHistory == null)
881 toggledUrl = pHistory->GetHistoryUrl();
883 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
885 bool bookmarkFound = false;
886 BookmarkData* pBookMark = null;
887 if(__pBookmarkList != null)
889 for (int i = 0; i < __pBookmarkList->GetCount(); i++)
891 pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
892 if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
894 bookmarkFound = true;
899 if(bookmarkFound == false)
901 // Add the history in bookmark database
902 result r = E_FAILURE;
903 BookmarkData bookmark;
905 String bookmarkTitle = pHistory->GetHistoryTitle();
907 bookmark.SetBookmarkTitle(bookmarkTitle);
908 bookmark.SetUrl(pHistory->GetHistoryUrl());
909 bookmark.SetFaviconId(pHistory->GetFaviconId());
910 bookmark.SetFavIconBuffer(*pHistory->GetFavIconBuffer());
911 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
912 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(bookmark);
916 // remove the history from bookmark database
917 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
920 if(__pBookmarkList != null)
922 __pBookmarkList->RemoveAll(false);
923 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
925 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
926 listView.UpdateList();
930 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
931 if (pGroupItemClass == null)
936 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
937 if (pHistory1 == null)
941 SceneManager* pSceneManager = SceneManager::GetInstance();
942 ArrayList *pArgList = null;
943 result r = E_SUCCESS;
944 pArgList = new(std::nothrow) ArrayList();
945 if (pArgList != null)
947 r = pArgList->Construct();
954 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
955 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
966 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
968 if (pSceneManager != null)
970 AppLog("pSceneManager exists");
971 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
974 pArgList->RemoveAll(false);
987 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
993 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
995 result r = E_FAILURE;
996 if (mode == SEARCH_BAR_MODE_NORMAL)
998 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1000 __pSearchListView->SetEnabled(true);
1003 r = __pSearchListView->SetShowState(false);
1008 r = __pGroupedListView->SetShowState(true);
1014 __pSearchListView->SetEnabled(true);
1015 if(__pSearchBar != null)
1016 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1018 __searchHistory = false;
1019 r = __pGroupedListView->UpdateList();
1020 if (__isNoHistoryPresent == true)
1022 GetFooter()->SetItemEnabled(0, false);
1026 GetFooter()->SetItemEnabled(0, true);
1028 if(__pSearchBar != null)
1030 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1040 // __pSearchListView->SetEnabled(false);
1041 r = __pSearchListView->SetShowState(true);
1046 __pSearchListView->SetEnabled(false);
1047 r = __pSearchListView->UpdateList();
1052 r = __pGroupedListView->SetShowState(false);
1057 if(__pSearchBar != null)
1059 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1065 HistoryListForm::GetMonth(int month)
1067 String monthValue = L"";
1071 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1074 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1077 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1080 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1083 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1086 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN"));
1089 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1092 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));
1095 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1098 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1101 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1104 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1115 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1117 result r = E_FAILURE;
1118 if (__pSearchBar != null)
1120 __pSearchBar->HideKeypad();
1123 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1125 __pSearchListView->SetEnabled(true);
1126 __searchHistory = true;
1127 __searchText =__pSearchBar->GetText();
1129 r = __pGroupedListView->SetShowState(false);
1134 r = __pSearchListView->SetShowState(true);
1139 r= __pSearchListView->UpdateList();
1140 if (__isNoHistoryPresent == true)
1142 GetFooter()->SetItemEnabled(0, false);
1146 GetFooter()->SetItemEnabled(0, true);
1148 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1157 __searchHistory = false;
1163 HistoryListForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1165 FloatRectangle clientRect;
1166 clientRect = GetClientAreaBoundsF();
1167 AppLogDebug("SearchBarForm::OnKeypadBoundsChanged ClientBounds(%f, %f, %f, %f)",clientRect.x, clientRect.y, clientRect.width, clientRect.height);
1168 __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1169 __pSearchListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1170 __pGroupedListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1171 // __pGroupedListView->SetEnabled(false);
1176 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1178 result r = E_FAILURE;
1179 if (__pGroupedListView != null)
1181 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1182 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1183 else if(__pSearchBar != null)
1184 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1189 __pGroupedListView->UpdateList();
1191 if (__pSearchListView != null)
1193 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1199 __pSearchListView->UpdateList();
1201 if(__pSearchBar != null)
1202 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1207 if (__isNoHistoryPresent == true)
1209 GetFooter()->SetItemEnabled(0, false);
1213 GetFooter()->SetItemEnabled(0, true);
1218 HistoryListForm::OnKeypadWillOpen(Control& source)
1220 GetFooter()->SetShowState(false);
1221 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1222 __pSearchListView->SetEnabled(false);
1223 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1229 HistoryListForm::OnKeypadOpened(Control& source)
1231 // this is added because some time footer is shown when key pad is opened, do not remove
1232 GetFooter()->SetShowState(false);
1233 GetFooter()->Invalidate(true);
1234 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1238 HistoryListForm::OnKeypadClosed(Control& source)
1240 if(Clipboard::GetInstance()->IsPopupVisible() == true)
1244 GetFooter()->SetShowState(true);
1245 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1246 __pSearchListView->Invalidate(false);
1247 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1248 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1253 HistoryListForm::CreateGroupItems()
1255 result r = E_FAILURE;
1256 DateTime currentTime;
1258 GroupItemClass* pGroupItemClass = null;
1261 String weeksAgo2 = L"";
1262 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
1264 String weeksAgo3 = L"";
1265 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1267 if (__pGroupData != null)
1269 __pGroupData->RemoveAll(false);
1270 delete __pGroupData;
1271 __pGroupData = null;
1273 __pGroupData = new(std::nothrow) ArrayList();
1274 if (__pGroupData == null)
1278 r = __pGroupData->Construct();
1281 delete __pGroupData;
1282 __pGroupData = null;
1285 if (__searchHistory == true)
1287 pGroupItemClass = new(std::nothrow) GroupItemClass();
1288 if (pGroupItemClass == null)
1292 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1293 pGroupItemClass->SetTitleText(titleText);
1294 r = __pGroupData->Add(*pGroupItemClass);
1302 Calendar* pGregorianCalendar = null;
1305 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1306 pGroupItemClass = new(std::nothrow) GroupItemClass();
1307 if (pGroupItemClass == null)
1311 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1312 pGroupItemClass->SetTitleText(titleText);
1313 pGroupItemClass->SetEndTime(currentTime);
1314 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1315 pGroupItemClass->SetStartTime(dateTime);
1316 __pGroupData->Add(*pGroupItemClass);
1319 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1320 if ( pGregorianCalendar != NULL )
1322 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1323 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1324 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1325 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1326 delete pGregorianCalendar;
1331 pGroupItemClass = new(std::nothrow) GroupItemClass();
1332 if (pGroupItemClass == null)
1336 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1337 pGroupItemClass->SetTitleText(titleText);
1338 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1339 pGroupItemClass->SetEndTime(dateTime);
1340 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1341 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1342 pGroupItemClass->SetStartTime(dateTime);
1343 __pGroupData->Add(*pGroupItemClass);
1346 pGroupItemClass = new(std::nothrow) GroupItemClass();
1347 if (pGroupItemClass == null)
1351 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1352 pGroupItemClass->SetTitleText(titleText);
1353 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1354 pGroupItemClass->SetEndTime(dateTime);
1355 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1356 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1357 pGroupItemClass->SetStartTime(dateTime);
1358 __pGroupData->Add(*pGroupItemClass);
1361 pGroupItemClass = new(std::nothrow) GroupItemClass();
1362 if (pGroupItemClass == null)
1366 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1367 pGroupItemClass->SetTitleText(titleText);
1368 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1369 pGroupItemClass->SetEndTime(dateTime);
1370 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1371 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1372 pGroupItemClass->SetStartTime(dateTime);
1373 __pGroupData->Add(*pGroupItemClass);
1375 pGroupItemClass = new(std::nothrow) GroupItemClass();
1376 if (pGroupItemClass == null)
1380 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1381 pGroupItemClass->SetTitleText(titleText);
1382 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1383 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1384 pGroupItemClass->SetEndTime(dateTime);
1385 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1386 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1387 pGroupItemClass->SetStartTime(dateTime);
1388 __pGroupData->Add(*pGroupItemClass);
1391 pGroupItemClass = new(std::nothrow) GroupItemClass();
1392 if (pGroupItemClass == null)
1396 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1397 pGroupItemClass->SetTitleText(titleText);
1398 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1399 pGroupItemClass->SetEndTime(dateTime);
1400 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1401 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1402 pGroupItemClass->SetStartTime(dateTime);
1403 __pGroupData->Add(*pGroupItemClass);
1405 pGroupItemClass = new(std::nothrow) GroupItemClass();
1406 if (pGroupItemClass == null)
1410 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1411 pGroupItemClass->SetTitleText(titleText);
1412 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1413 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1414 pGroupItemClass->SetEndTime(dateTime);
1415 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1416 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1417 pGroupItemClass->SetStartTime(dateTime);
1418 __pGroupData->Add(*pGroupItemClass);
1420 pGroupItemClass = new(std::nothrow) GroupItemClass();
1421 if (pGroupItemClass == null)
1425 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1426 pGroupItemClass->SetTitleText(titleText);
1427 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1428 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1429 pGroupItemClass->SetEndTime(dateTime);
1430 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1431 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1432 pGroupItemClass->SetStartTime(dateTime);
1433 __pGroupData->Add(*pGroupItemClass);
1436 pGroupItemClass = new(std::nothrow) GroupItemClass();
1437 if (pGroupItemClass == null)
1441 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1442 pGroupItemClass->SetTitleText(titleText);
1443 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1444 pGroupItemClass->SetEndTime(dateTime);
1445 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1446 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1447 pGroupItemClass->SetStartTime(dateTime);
1448 __pGroupData->Add(*pGroupItemClass);
1450 pGroupItemClass = new(std::nothrow) GroupItemClass();
1451 if (pGroupItemClass == null)
1455 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1456 pGroupItemClass->SetTitleText(titleText);
1457 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1458 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1459 pGroupItemClass->SetEndTime(dateTime);
1460 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1461 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1462 pGroupItemClass->SetStartTime(dateTime);
1463 __pGroupData->Add(*pGroupItemClass);
1465 pGroupItemClass = new(std::nothrow) GroupItemClass();
1466 if (pGroupItemClass == null)
1470 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1471 pGroupItemClass->SetTitleText(titleText);
1472 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1473 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1474 pGroupItemClass->SetEndTime(dateTime);
1475 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1476 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1477 pGroupItemClass->SetStartTime(dateTime);
1478 __pGroupData->Add(*pGroupItemClass);
1480 pGroupItemClass = new(std::nothrow) GroupItemClass();
1481 if (pGroupItemClass == null)
1485 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1486 pGroupItemClass->SetTitleText(titleText);
1487 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1488 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1489 pGroupItemClass->SetEndTime(dateTime);
1490 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1491 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1492 pGroupItemClass->SetStartTime(dateTime);
1493 __pGroupData->Add(*pGroupItemClass);
1496 pGroupItemClass = new(std::nothrow) GroupItemClass();
1497 if (pGroupItemClass == null)
1501 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1502 pGroupItemClass->SetTitleText(titleText);
1503 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1504 pGroupItemClass->SetEndTime(dateTime);
1505 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1506 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1507 pGroupItemClass->SetStartTime(dateTime);
1508 __pGroupData->Add(*pGroupItemClass);
1510 pGroupItemClass = new(std::nothrow) GroupItemClass();
1511 if (pGroupItemClass == null)
1515 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1516 pGroupItemClass->SetTitleText(titleText);
1517 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1518 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1519 pGroupItemClass->SetEndTime(dateTime);
1520 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1521 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1522 pGroupItemClass->SetStartTime(dateTime);
1523 __pGroupData->Add(*pGroupItemClass);
1525 pGroupItemClass = new(std::nothrow) GroupItemClass();
1526 if (pGroupItemClass == null)
1530 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1531 pGroupItemClass->SetTitleText(titleText);
1532 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1533 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1534 pGroupItemClass->SetEndTime(dateTime);
1535 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1536 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1537 pGroupItemClass->SetStartTime(dateTime);
1538 __pGroupData->Add(*pGroupItemClass);
1540 pGroupItemClass = new(std::nothrow) GroupItemClass();
1541 if (pGroupItemClass == null)
1545 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1546 pGroupItemClass->SetTitleText(titleText);
1547 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1548 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1549 pGroupItemClass->SetEndTime(dateTime);
1550 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1551 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1552 pGroupItemClass->SetStartTime(dateTime);
1553 __pGroupData->Add(*pGroupItemClass);
1555 pGroupItemClass = new(std::nothrow) GroupItemClass();
1556 if (pGroupItemClass == null)
1560 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1561 pGroupItemClass->SetTitleText(titleText);
1562 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1563 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1564 pGroupItemClass->SetEndTime(dateTime);
1565 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1566 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1567 pGroupItemClass->SetStartTime(dateTime);
1568 __pGroupData->Add(*pGroupItemClass);
1571 pGroupItemClass = new(std::nothrow) GroupItemClass();
1572 if (pGroupItemClass == null)
1576 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1577 pGroupItemClass->SetTitleText(titleText);
1578 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1579 pGroupItemClass->SetEndTime(dateTime);
1580 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1581 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1582 pGroupItemClass->SetStartTime(dateTime);
1583 __pGroupData->Add(*pGroupItemClass);
1585 pGroupItemClass = new(std::nothrow) GroupItemClass();
1586 if (pGroupItemClass == null)
1590 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1591 pGroupItemClass->SetTitleText(titleText);
1592 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1593 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1594 pGroupItemClass->SetEndTime(dateTime);
1595 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1596 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1597 pGroupItemClass->SetStartTime(dateTime);
1598 __pGroupData->Add(*pGroupItemClass);
1600 pGroupItemClass = new(std::nothrow) GroupItemClass();
1601 if (pGroupItemClass == null)
1605 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1606 pGroupItemClass->SetTitleText(titleText);
1607 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1608 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1609 pGroupItemClass->SetEndTime(dateTime);
1610 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1611 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1612 pGroupItemClass->SetStartTime(dateTime);
1613 __pGroupData->Add(*pGroupItemClass);
1615 pGroupItemClass = new(std::nothrow) GroupItemClass();
1616 if (pGroupItemClass == null)
1620 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1621 pGroupItemClass->SetTitleText(titleText);
1622 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1623 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1624 pGroupItemClass->SetEndTime(dateTime);
1625 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1626 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1627 pGroupItemClass->SetStartTime(dateTime);
1628 __pGroupData->Add(*pGroupItemClass);
1630 pGroupItemClass = new(std::nothrow) GroupItemClass();
1631 if (pGroupItemClass == null)
1635 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1636 pGroupItemClass->SetTitleText(titleText);
1637 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1638 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1639 pGroupItemClass->SetEndTime(dateTime);
1640 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1641 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1642 pGroupItemClass->SetStartTime(dateTime);
1643 __pGroupData->Add(*pGroupItemClass);
1645 pGroupItemClass = new(std::nothrow) GroupItemClass();
1646 if (pGroupItemClass == null)
1650 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1651 pGroupItemClass->SetTitleText(titleText);
1652 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1653 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1654 pGroupItemClass->SetEndTime(dateTime);
1655 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1656 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1657 pGroupItemClass->SetStartTime(dateTime);
1658 __pGroupData->Add(*pGroupItemClass);
1664 day = currentTime.GetDay();
1668 pGroupItemClass = new(std::nothrow) GroupItemClass();
1669 if (pGroupItemClass == null)
1674 pGroupItemClass->SetTitleText(weeksAgo2);
1675 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1676 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1677 pGroupItemClass->SetEndTime(dateTime);
1678 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1679 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1680 pGroupItemClass->SetStartTime(dateTime);
1681 __pGroupData->Add(*pGroupItemClass);
1683 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1685 pGroupItemClass = new(std::nothrow) GroupItemClass();
1686 if (pGroupItemClass == null)
1690 String weeksAgo3 = L"";
1691 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1692 pGroupItemClass->SetTitleText(weeksAgo3);
1693 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1694 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1695 pGroupItemClass->SetEndTime(dateTime);
1696 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1697 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1698 pGroupItemClass->SetStartTime(dateTime);
1699 __pGroupData->Add(*pGroupItemClass);
1703 pGroupItemClass = new(std::nothrow) GroupItemClass();
1704 if (pGroupItemClass == null)
1708 pGroupItemClass->SetTitleText(weeksAgo2);
1709 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1710 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1711 pGroupItemClass->SetEndTime(dateTime);
1712 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1713 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1714 pGroupItemClass->SetStartTime(dateTime);
1715 __pGroupData->Add(*pGroupItemClass);
1717 pGroupItemClass = new(std::nothrow) GroupItemClass();
1718 if (pGroupItemClass == null)
1723 pGroupItemClass->SetTitleText(weeksAgo3);
1724 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1725 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1726 pGroupItemClass->SetEndTime(dateTime);
1727 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1728 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1729 pGroupItemClass->SetStartTime(dateTime);
1730 __pGroupData->Add(*pGroupItemClass);
1732 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1734 pGroupItemClass = new(std::nothrow) GroupItemClass();
1735 if (pGroupItemClass == null)
1739 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1740 pGroupItemClass->SetTitleText(titleText);
1741 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1742 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1743 pGroupItemClass->SetEndTime(dateTime);
1744 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1745 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1746 pGroupItemClass->SetStartTime(dateTime);
1747 __pGroupData->Add(*pGroupItemClass);
1751 pGroupItemClass = new(std::nothrow) GroupItemClass();
1752 if (pGroupItemClass == null)
1756 pGroupItemClass->SetTitleText(weeksAgo2);
1757 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1758 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1759 pGroupItemClass->SetEndTime(dateTime);
1760 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1761 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1762 pGroupItemClass->SetStartTime(dateTime);
1763 __pGroupData->Add(*pGroupItemClass);
1765 pGroupItemClass = new(std::nothrow) GroupItemClass();
1766 if (pGroupItemClass == null)
1770 pGroupItemClass->SetTitleText(weeksAgo3);
1771 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1772 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1773 pGroupItemClass->SetEndTime(dateTime);
1774 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1775 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1776 pGroupItemClass->SetStartTime(dateTime);
1777 __pGroupData->Add(*pGroupItemClass);
1779 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1781 pGroupItemClass = new(std::nothrow) GroupItemClass();
1782 if (pGroupItemClass == null)
1786 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1787 pGroupItemClass->SetTitleText(titleText);
1788 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1789 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1790 pGroupItemClass->SetEndTime(dateTime);
1791 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1792 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1793 pGroupItemClass->SetStartTime(dateTime);
1794 __pGroupData->Add(*pGroupItemClass);
1800 pGroupItemClass = new(std::nothrow) GroupItemClass();
1801 if (pGroupItemClass == null)
1805 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1806 pGroupItemClass->SetTitleText(titleText);
1807 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1808 dateTime.AddDays(-1);
1809 pGroupItemClass->SetEndTime(dateTime);
1810 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1811 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1812 pGroupItemClass->SetStartTime(dateTime);
1813 __pGroupData->Add(*pGroupItemClass);
1815 pGroupItemClass = new(std::nothrow) GroupItemClass();
1816 if (pGroupItemClass == null)
1820 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1821 pGroupItemClass->SetTitleText(titleText);
1822 dateTime.SetValue(currentTime.GetYear(),1, 1);
1823 dateTime.AddMonths(currentTime.GetMonth() - 2);
1824 dateTime.AddDays(-1);
1825 pGroupItemClass->SetEndTime(dateTime);
1827 dateTime2.SetValue(0, 0, 0);
1828 pGroupItemClass->SetStartTime(dateTime2);
1829 __pGroupData->Add(*pGroupItemClass);
1833 GroupItemClass::GroupItemClass()
1839 GroupItemClass::operator =(const GroupItemClass& rhs)
1843 __pData = rhs.__pData;
1848 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1850 __pData = groupItem.__pData;
1853 GroupItemClass::~GroupItemClass()
1857 __pData->RemoveAll(true);
1863 GroupItemClass::SetStartTime(DateTime& startTime)
1865 __startTime = startTime;
1869 GroupItemClass::SetEndTime(DateTime& endTime)
1871 __endTime = endTime;
1875 GroupItemClass::SetTitleText(String& titleText)
1877 __titleText = titleText;
1881 GroupItemClass::SetHistoryData(ArrayList* pData)
1887 GroupItemClass::GetStartTime(void)
1893 GroupItemClass::GetEndTime(void)
1899 GroupItemClass::GetTitleText(void)
1905 GroupItemClass::GetHistoryData(void)
1911 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1913 if (__pGroupedListView)
1915 __pGroupedListView->UpdateList();