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);
1013 __pSearchListView->SetEnabled(true);
1014 if(__pSearchBar != null)
1015 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1017 __searchHistory = false;
1018 r = __pGroupedListView->UpdateList();
1019 if (__isNoHistoryPresent == true)
1021 GetFooter()->SetItemEnabled(0, false);
1025 GetFooter()->SetItemEnabled(0, true);
1027 if(__pSearchBar != null)
1029 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1039 GetFooter()->SetShowState(false);
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"DS_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 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1235 HistoryListForm::OnKeypadClosed(Control& source)
1237 if(Clipboard::GetInstance()->IsPopupVisible() == true)
1241 GetFooter()->SetShowState(true);
1242 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1243 __pSearchListView->Invalidate(false);
1244 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1245 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1250 HistoryListForm::CreateGroupItems()
1252 result r = E_FAILURE;
1253 DateTime currentTime;
1255 GroupItemClass* pGroupItemClass = null;
1258 String weeksAgo2 = L"";
1259 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
1261 String weeksAgo3 = L"";
1262 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1264 if (__pGroupData != null)
1266 __pGroupData->RemoveAll(false);
1267 delete __pGroupData;
1268 __pGroupData = null;
1270 __pGroupData = new(std::nothrow) ArrayList();
1271 if (__pGroupData == null)
1275 r = __pGroupData->Construct();
1278 delete __pGroupData;
1279 __pGroupData = null;
1282 if (__searchHistory == true)
1284 pGroupItemClass = new(std::nothrow) GroupItemClass();
1285 if (pGroupItemClass == null)
1289 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1290 pGroupItemClass->SetTitleText(titleText);
1291 r = __pGroupData->Add(*pGroupItemClass);
1299 Calendar* pGregorianCalendar = null;
1302 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1303 pGroupItemClass = new(std::nothrow) GroupItemClass();
1304 if (pGroupItemClass == null)
1308 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1309 pGroupItemClass->SetTitleText(titleText);
1310 pGroupItemClass->SetEndTime(currentTime);
1311 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1312 pGroupItemClass->SetStartTime(dateTime);
1313 __pGroupData->Add(*pGroupItemClass);
1316 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1317 if ( pGregorianCalendar != NULL )
1319 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1320 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1321 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1322 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1323 delete pGregorianCalendar;
1328 pGroupItemClass = new(std::nothrow) GroupItemClass();
1329 if (pGroupItemClass == null)
1333 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1334 pGroupItemClass->SetTitleText(titleText);
1335 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1336 pGroupItemClass->SetEndTime(dateTime);
1337 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1338 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1339 pGroupItemClass->SetStartTime(dateTime);
1340 __pGroupData->Add(*pGroupItemClass);
1343 pGroupItemClass = new(std::nothrow) GroupItemClass();
1344 if (pGroupItemClass == null)
1348 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1349 pGroupItemClass->SetTitleText(titleText);
1350 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1351 pGroupItemClass->SetEndTime(dateTime);
1352 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1353 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1354 pGroupItemClass->SetStartTime(dateTime);
1355 __pGroupData->Add(*pGroupItemClass);
1358 pGroupItemClass = new(std::nothrow) GroupItemClass();
1359 if (pGroupItemClass == null)
1363 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1364 pGroupItemClass->SetTitleText(titleText);
1365 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1366 pGroupItemClass->SetEndTime(dateTime);
1367 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1368 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1369 pGroupItemClass->SetStartTime(dateTime);
1370 __pGroupData->Add(*pGroupItemClass);
1372 pGroupItemClass = new(std::nothrow) GroupItemClass();
1373 if (pGroupItemClass == null)
1377 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1378 pGroupItemClass->SetTitleText(titleText);
1379 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1380 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1381 pGroupItemClass->SetEndTime(dateTime);
1382 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1383 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1384 pGroupItemClass->SetStartTime(dateTime);
1385 __pGroupData->Add(*pGroupItemClass);
1388 pGroupItemClass = new(std::nothrow) GroupItemClass();
1389 if (pGroupItemClass == null)
1393 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1394 pGroupItemClass->SetTitleText(titleText);
1395 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1396 pGroupItemClass->SetEndTime(dateTime);
1397 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1398 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1399 pGroupItemClass->SetStartTime(dateTime);
1400 __pGroupData->Add(*pGroupItemClass);
1402 pGroupItemClass = new(std::nothrow) GroupItemClass();
1403 if (pGroupItemClass == null)
1407 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1408 pGroupItemClass->SetTitleText(titleText);
1409 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1410 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1411 pGroupItemClass->SetEndTime(dateTime);
1412 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1413 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1414 pGroupItemClass->SetStartTime(dateTime);
1415 __pGroupData->Add(*pGroupItemClass);
1417 pGroupItemClass = new(std::nothrow) GroupItemClass();
1418 if (pGroupItemClass == null)
1422 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1423 pGroupItemClass->SetTitleText(titleText);
1424 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1425 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1426 pGroupItemClass->SetEndTime(dateTime);
1427 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1428 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1429 pGroupItemClass->SetStartTime(dateTime);
1430 __pGroupData->Add(*pGroupItemClass);
1433 pGroupItemClass = new(std::nothrow) GroupItemClass();
1434 if (pGroupItemClass == null)
1438 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1439 pGroupItemClass->SetTitleText(titleText);
1440 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1441 pGroupItemClass->SetEndTime(dateTime);
1442 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1443 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1444 pGroupItemClass->SetStartTime(dateTime);
1445 __pGroupData->Add(*pGroupItemClass);
1447 pGroupItemClass = new(std::nothrow) GroupItemClass();
1448 if (pGroupItemClass == null)
1452 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1453 pGroupItemClass->SetTitleText(titleText);
1454 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1455 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1456 pGroupItemClass->SetEndTime(dateTime);
1457 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1458 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1459 pGroupItemClass->SetStartTime(dateTime);
1460 __pGroupData->Add(*pGroupItemClass);
1462 pGroupItemClass = new(std::nothrow) GroupItemClass();
1463 if (pGroupItemClass == null)
1467 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1468 pGroupItemClass->SetTitleText(titleText);
1469 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1470 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1471 pGroupItemClass->SetEndTime(dateTime);
1472 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1473 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1474 pGroupItemClass->SetStartTime(dateTime);
1475 __pGroupData->Add(*pGroupItemClass);
1477 pGroupItemClass = new(std::nothrow) GroupItemClass();
1478 if (pGroupItemClass == null)
1482 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1483 pGroupItemClass->SetTitleText(titleText);
1484 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1485 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1486 pGroupItemClass->SetEndTime(dateTime);
1487 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1488 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1489 pGroupItemClass->SetStartTime(dateTime);
1490 __pGroupData->Add(*pGroupItemClass);
1493 pGroupItemClass = new(std::nothrow) GroupItemClass();
1494 if (pGroupItemClass == null)
1498 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1499 pGroupItemClass->SetTitleText(titleText);
1500 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1501 pGroupItemClass->SetEndTime(dateTime);
1502 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1503 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1504 pGroupItemClass->SetStartTime(dateTime);
1505 __pGroupData->Add(*pGroupItemClass);
1507 pGroupItemClass = new(std::nothrow) GroupItemClass();
1508 if (pGroupItemClass == null)
1512 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1513 pGroupItemClass->SetTitleText(titleText);
1514 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1515 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1516 pGroupItemClass->SetEndTime(dateTime);
1517 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1518 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1519 pGroupItemClass->SetStartTime(dateTime);
1520 __pGroupData->Add(*pGroupItemClass);
1522 pGroupItemClass = new(std::nothrow) GroupItemClass();
1523 if (pGroupItemClass == null)
1527 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1528 pGroupItemClass->SetTitleText(titleText);
1529 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1530 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1531 pGroupItemClass->SetEndTime(dateTime);
1532 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1533 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1534 pGroupItemClass->SetStartTime(dateTime);
1535 __pGroupData->Add(*pGroupItemClass);
1537 pGroupItemClass = new(std::nothrow) GroupItemClass();
1538 if (pGroupItemClass == null)
1542 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1543 pGroupItemClass->SetTitleText(titleText);
1544 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1545 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1546 pGroupItemClass->SetEndTime(dateTime);
1547 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1548 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1549 pGroupItemClass->SetStartTime(dateTime);
1550 __pGroupData->Add(*pGroupItemClass);
1552 pGroupItemClass = new(std::nothrow) GroupItemClass();
1553 if (pGroupItemClass == null)
1557 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1558 pGroupItemClass->SetTitleText(titleText);
1559 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1560 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1561 pGroupItemClass->SetEndTime(dateTime);
1562 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1563 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1564 pGroupItemClass->SetStartTime(dateTime);
1565 __pGroupData->Add(*pGroupItemClass);
1568 pGroupItemClass = new(std::nothrow) GroupItemClass();
1569 if (pGroupItemClass == null)
1573 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1574 pGroupItemClass->SetTitleText(titleText);
1575 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1576 pGroupItemClass->SetEndTime(dateTime);
1577 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1578 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1579 pGroupItemClass->SetStartTime(dateTime);
1580 __pGroupData->Add(*pGroupItemClass);
1582 pGroupItemClass = new(std::nothrow) GroupItemClass();
1583 if (pGroupItemClass == null)
1587 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1588 pGroupItemClass->SetTitleText(titleText);
1589 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1590 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1591 pGroupItemClass->SetEndTime(dateTime);
1592 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1593 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1594 pGroupItemClass->SetStartTime(dateTime);
1595 __pGroupData->Add(*pGroupItemClass);
1597 pGroupItemClass = new(std::nothrow) GroupItemClass();
1598 if (pGroupItemClass == null)
1602 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1603 pGroupItemClass->SetTitleText(titleText);
1604 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1605 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1606 pGroupItemClass->SetEndTime(dateTime);
1607 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1608 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1609 pGroupItemClass->SetStartTime(dateTime);
1610 __pGroupData->Add(*pGroupItemClass);
1612 pGroupItemClass = new(std::nothrow) GroupItemClass();
1613 if (pGroupItemClass == null)
1617 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1618 pGroupItemClass->SetTitleText(titleText);
1619 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1620 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1621 pGroupItemClass->SetEndTime(dateTime);
1622 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1623 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1624 pGroupItemClass->SetStartTime(dateTime);
1625 __pGroupData->Add(*pGroupItemClass);
1627 pGroupItemClass = new(std::nothrow) GroupItemClass();
1628 if (pGroupItemClass == null)
1632 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1633 pGroupItemClass->SetTitleText(titleText);
1634 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1635 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1636 pGroupItemClass->SetEndTime(dateTime);
1637 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1638 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1639 pGroupItemClass->SetStartTime(dateTime);
1640 __pGroupData->Add(*pGroupItemClass);
1642 pGroupItemClass = new(std::nothrow) GroupItemClass();
1643 if (pGroupItemClass == null)
1647 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1648 pGroupItemClass->SetTitleText(titleText);
1649 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1650 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1651 pGroupItemClass->SetEndTime(dateTime);
1652 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1653 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1654 pGroupItemClass->SetStartTime(dateTime);
1655 __pGroupData->Add(*pGroupItemClass);
1661 day = currentTime.GetDay();
1665 pGroupItemClass = new(std::nothrow) GroupItemClass();
1666 if (pGroupItemClass == null)
1671 pGroupItemClass->SetTitleText(weeksAgo2);
1672 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1673 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1674 pGroupItemClass->SetEndTime(dateTime);
1675 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1676 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1677 pGroupItemClass->SetStartTime(dateTime);
1678 __pGroupData->Add(*pGroupItemClass);
1680 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1682 pGroupItemClass = new(std::nothrow) GroupItemClass();
1683 if (pGroupItemClass == null)
1687 String weeksAgo3 = L"";
1688 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1689 pGroupItemClass->SetTitleText(weeksAgo3);
1690 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1691 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1692 pGroupItemClass->SetEndTime(dateTime);
1693 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1694 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1695 pGroupItemClass->SetStartTime(dateTime);
1696 __pGroupData->Add(*pGroupItemClass);
1700 pGroupItemClass = new(std::nothrow) GroupItemClass();
1701 if (pGroupItemClass == null)
1705 pGroupItemClass->SetTitleText(weeksAgo2);
1706 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1707 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1708 pGroupItemClass->SetEndTime(dateTime);
1709 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1710 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1711 pGroupItemClass->SetStartTime(dateTime);
1712 __pGroupData->Add(*pGroupItemClass);
1714 pGroupItemClass = new(std::nothrow) GroupItemClass();
1715 if (pGroupItemClass == null)
1720 pGroupItemClass->SetTitleText(weeksAgo3);
1721 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1722 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1723 pGroupItemClass->SetEndTime(dateTime);
1724 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1725 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1726 pGroupItemClass->SetStartTime(dateTime);
1727 __pGroupData->Add(*pGroupItemClass);
1729 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1731 pGroupItemClass = new(std::nothrow) GroupItemClass();
1732 if (pGroupItemClass == null)
1736 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1737 pGroupItemClass->SetTitleText(titleText);
1738 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1739 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1740 pGroupItemClass->SetEndTime(dateTime);
1741 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1742 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1743 pGroupItemClass->SetStartTime(dateTime);
1744 __pGroupData->Add(*pGroupItemClass);
1748 pGroupItemClass = new(std::nothrow) GroupItemClass();
1749 if (pGroupItemClass == null)
1753 pGroupItemClass->SetTitleText(weeksAgo2);
1754 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1755 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1756 pGroupItemClass->SetEndTime(dateTime);
1757 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1758 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1759 pGroupItemClass->SetStartTime(dateTime);
1760 __pGroupData->Add(*pGroupItemClass);
1762 pGroupItemClass = new(std::nothrow) GroupItemClass();
1763 if (pGroupItemClass == null)
1767 pGroupItemClass->SetTitleText(weeksAgo3);
1768 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1769 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1770 pGroupItemClass->SetEndTime(dateTime);
1771 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1772 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1773 pGroupItemClass->SetStartTime(dateTime);
1774 __pGroupData->Add(*pGroupItemClass);
1776 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1778 pGroupItemClass = new(std::nothrow) GroupItemClass();
1779 if (pGroupItemClass == null)
1783 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1784 pGroupItemClass->SetTitleText(titleText);
1785 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1786 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1787 pGroupItemClass->SetEndTime(dateTime);
1788 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1789 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1790 pGroupItemClass->SetStartTime(dateTime);
1791 __pGroupData->Add(*pGroupItemClass);
1797 pGroupItemClass = new(std::nothrow) GroupItemClass();
1798 if (pGroupItemClass == null)
1802 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1803 pGroupItemClass->SetTitleText(titleText);
1804 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1805 dateTime.AddDays(-1);
1806 pGroupItemClass->SetEndTime(dateTime);
1807 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1808 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1809 pGroupItemClass->SetStartTime(dateTime);
1810 __pGroupData->Add(*pGroupItemClass);
1812 pGroupItemClass = new(std::nothrow) GroupItemClass();
1813 if (pGroupItemClass == null)
1817 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1818 pGroupItemClass->SetTitleText(titleText);
1819 dateTime.SetValue(currentTime.GetYear(),1, 1);
1820 dateTime.AddMonths(currentTime.GetMonth() - 2);
1821 dateTime.AddDays(-1);
1822 pGroupItemClass->SetEndTime(dateTime);
1824 dateTime2.SetValue(0, 0, 0);
1825 pGroupItemClass->SetStartTime(dateTime2);
1826 __pGroupData->Add(*pGroupItemClass);
1830 GroupItemClass::GroupItemClass()
1836 GroupItemClass::operator =(const GroupItemClass& rhs)
1840 __pData = rhs.__pData;
1845 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1847 __pData = groupItem.__pData;
1850 GroupItemClass::~GroupItemClass()
1854 __pData->RemoveAll(true);
1860 GroupItemClass::SetStartTime(DateTime& startTime)
1862 __startTime = startTime;
1866 GroupItemClass::SetEndTime(DateTime& endTime)
1868 __endTime = endTime;
1872 GroupItemClass::SetTitleText(String& titleText)
1874 __titleText = titleText;
1878 GroupItemClass::SetHistoryData(ArrayList* pData)
1884 GroupItemClass::GetStartTime(void)
1890 GroupItemClass::GetEndTime(void)
1896 GroupItemClass::GetTitleText(void)
1902 GroupItemClass::GetHistoryData(void)
1908 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1910 if (__pGroupedListView)
1912 __pGroupedListView->UpdateList();