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;
88 if (__pSearchListView)
90 delete __pSearchListView;
91 __pSearchListView = null;
96 HistoryListForm::Initialize(void)
98 Construct(L"IDL_HISTORY_LIST");
104 HistoryListForm::OnInitializing(void)
106 AppLog("HistoryListForm::OnInitializing");
107 result r = E_SUCCESS;
108 SceneManager* pSceneManager = null;
111 Header *pHeader = GetHeader();
112 Bitmap *pIconBitmap = null;
113 AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
114 const Color brown = Color(32, 32, 32, 0xFF);
116 // Setup back event listener
117 SetFormBackEventListener(this);
119 GetHeader()->AddActionEventListener(*this);
120 GetFooter()->AddActionEventListener(*this);
122 AddOrientationEventListener(*this);
123 SettingInfo::AddSettingEventListener(*this);
125 pSceneManager = SceneManager::GetInstance();
126 if (pSceneManager != null)
128 pSceneManager->AddSceneEventListener(IDSCN_HISTORY_LIST, *this);
131 if (pAppResource == null)
136 __pGroupedListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1"));
137 if (__pGroupedListView == null)
142 r = __pGroupedListView->SetItemProvider(*this);
149 __pSearchBar = static_cast< SearchBar* >(GetControl(L"IDC_SEARCHBAR1"));
150 if (__pSearchBar == null)
154 __pSearchListView = new(std::nothrow) GroupedListView();
155 if (__pSearchListView == null)
160 __pGroupedListView->AddGroupedListViewItemEventListener(*this);
161 r = __pGroupedListView->SetBounds(Rectangle(0,__pGroupedListView->GetY(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
166 r = __pSearchListView->Construct(Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height -__pSearchBar->GetHeight() - __pSearchBar->GetY()), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
171 r = __pSearchListView->SetItemProvider(*this);
176 r = __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND"));
183 __pSearchListView->SetBackgroundColor(GetBackgroundColor());
184 __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK));
185 __pSearchListView->AddGroupedListViewItemEventListener(*this);
186 r = __pSearchListView->SetShowState(false);
193 __pSearchBar->AddSearchBarEventListener(*this);
194 __pSearchBar->AddKeypadEventListener(*this);
195 r = __pSearchBar->SetContent(__pSearchListView);
199 pHeader->SetStyle(HEADER_STYLE_TAB);
200 bookmark.Construct(IDA_TABBAR_ITEM_1);
202 pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark);
203 bookmark.SetText(strbookmark);
204 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARKS);
205 bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
206 bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
207 pHeader->AddItem(bookmark);
215 history.Construct(IDA_TABBAR_ITEM_2);
217 pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory);
218 history.SetText(strhistory);
219 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY);
220 history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
221 history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
222 pHeader->AddItem(history);
223 pHeader->SetItemSelected(1);
224 pHeader->SetTabEditModeEnabled(false);
226 if (pIconBitmap != NULL)
232 __pBookmarkList = new(std::nothrow) Collection::ArrayList();
233 __pBookmarkList->Construct();
234 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
239 HistoryListForm::OnTerminating(void)
241 result r = E_SUCCESS;
243 SettingInfo::RemoveSettingEventListener(*this);
248 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
250 AppLog("HistoryListForm::OnActionPerformed");
251 result r = E_FAILURE;
252 SceneManager* pSceneManager = SceneManager::GetInstance();
253 if (pSceneManager == null)
259 case IDA_EDIT_HISTORY_LIST_FORM:
261 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
262 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
269 case IDA_TABBAR_ITEM_1:
271 result r = GetHeader()->SetItemSelected(1);
272 AppLog("SetItemSelected result %s",GetErrorMessage(r));
273 GetHeader()->Invalidate(true);
275 if (pSceneManager != null)
277 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
279 if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)) != E_SUCCESS)
281 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
288 if(pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT))!= E_SUCCESS)
290 AppLogDebug("BookmarkListForm::OnActionPerformed GoBackward failed");
296 // r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
309 HistoryListForm::OnFormBackRequested(Form& source)
311 SceneManager* pSceneManager = SceneManager::GetInstance();
312 if (pSceneManager == null)
316 result r = E_FAILURE;
317 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
319 r = pSceneManager->GoBackward(BackwardSceneTransition());
323 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
327 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
332 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
334 result r = E_FAILURE;
340 GroupItem* pItem = null;
341 GroupItemClass* pGroupItemClass = null;
343 String weeksAgo2 = L"";
344 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
346 String weeksAgo3 = L"";
347 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
349 String weeksAgo4 = L"";
350 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),4);
352 pItem = new(std::nothrow) GroupItem();
357 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
359 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
361 AppLog("CreateGroupItem :: if history is null");
362 r = pItem->Construct(Dimension(itemWidth, 0));
367 r = pItem->Construct(Dimension(itemWidth, 48));
369 text = pGroupItemClass->GetTitleText();
371 if (__searchHistory == false)
375 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
378 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
379 if ( pGregorianCalendar != NULL)
381 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
388 delete pGregorianCalendar;
391 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
398 delete pGregorianCalendar;
401 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
408 delete pGregorianCalendar;
411 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
412 if (pGregorianCalendar != NULL)
414 delete pGregorianCalendar;
421 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
424 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
427 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
430 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
433 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
436 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
439 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
447 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
449 text.Append(pGroupItemClass->GetStartTime().GetDay());
451 strMonth = pGroupItemClass->GetStartTime().GetMonth();
452 month = GetMonth(strMonth);
462 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
463 || 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"))
466 text.Append(pGroupItemClass->GetEndTime().GetDay());
468 strMonth = pGroupItemClass->GetEndTime().GetMonth();
469 month = GetMonth(strMonth);
475 r = pItem->SetElement(text, null);
479 AppLogDebug("Failed with %s", GetErrorMessage(r));
482 r = pItem->SetTextSize(32);
493 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
495 AppLog("HistoryListForm::CreateItem");
496 result r = E_FAILURE;
497 History* pHistory = null;
498 Bitmap* pBitmap = null;
499 Bitmap* pBookmarkBitmap = null;
500 GroupItemClass* pGroupItemClass = null;
501 CustomItem* pItem = new(std::nothrow) CustomItem();
502 int bookmarkBtnWidth = 0;
505 Image* pImage = null;
506 pImage = new Image();
509 if(__pGroupData == null)
519 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
520 if (pGroupItemClass == null)
525 if (pGroupItemClass->GetHistoryData() == null)
530 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
531 if (pHistory == null)
536 r = pItem->Construct(Dimension(itemWidth, 128), LIST_ANNEX_STYLE_NORMAL);
543 ByteBuffer* pFavIconBuffer = null;
544 pFavIconBuffer = pHistory->GetFavIconBuffer();
546 AppLog("BookmarkListForm::CreateItem check 0");
548 if (pFavIconBuffer != null)
550 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is not null");
554 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is null");
557 pBitmap = pImage->DecodeN(*pFavIconBuffer, IMG_FORMAT_PNG, BITMAP_PIXEL_FORMAT_ARGB8888);
559 AppLog("BookmarkListForm::CreateItem check 1");
561 //bitmapId = pHistory->GetFaviconId() ;
562 //pBitmap = pHistory->GetFavIconBitmap();
566 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
570 r = pItem->AddElement(Rectangle(16, 28,72, 72), IDA_FORMAT_ICON, *pBitmap, null);
575 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
579 bool urlFoundInBookmark = false;
581 if(__pBookmarkList != null)
583 for (int i = 0; i < __pBookmarkList->GetCount();i++)
585 BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
586 if(pBookMark != null && pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
588 urlFoundInBookmark = true;
593 if (urlFoundInBookmark == true)
595 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
599 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
601 bookmarkBtnWidth = 64;
604 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);
605 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
607 // if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
608 // 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);
610 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);
611 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
612 if ( pBookmarkBitmap != null)
614 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
615 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
616 delete pBookmarkBitmap;
627 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
636 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
638 AppLog("HistoryListForm::DeleteItem");
639 result r = E_FAILURE;
640 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
641 if (pGroupItemClass == null)
646 // if (pGroupItemClass->__pData != null)
648 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
661 HistoryListForm::GetGroupCount(void)
663 __isNoHistoryPresent = true;
665 if (__pGroupData != null)
667 if (__searchHistory == false)
672 HistoryPresentationModel::GetCurrentDateTime(endTime);;
674 startTime.SetValue(0,0,0);
676 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
681 return __pGroupData->GetCount();
686 // String searchText = __pSearchBar->GetText();
687 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
701 HistoryListForm::GetItemCount(int groupIndex)
703 result r = E_FAILURE;
709 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
710 if (pGroupItemClass == null)
714 if (__searchHistory == false)
716 startTime = pGroupItemClass->GetStartTime();
717 endTime = pGroupItemClass->GetEndTime();
718 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
722 //text = __pSearchBar->GetText();
723 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
734 ArrayList* pData = new(std::nothrow) ArrayList();
739 r = pData->Construct();
747 if (__searchHistory == false)
749 startTime = pGroupItemClass->GetStartTime();
750 endTime = pGroupItemClass->GetEndTime();
751 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
752 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
756 //text = __pSearchBar->GetText() ;
757 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
764 pGroupItemClass->SetHistoryData(pData);
767 if (__isNoHistoryPresent == true && count == 0)
769 __isNoHistoryPresent = true;
770 GetFooter()->SetItemEnabled(0, false);
774 __isNoHistoryPresent = false;
775 GetFooter()->SetItemEnabled(0, true);
777 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
778 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
785 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
786 return pGroupItemClass->GetHistoryData()->GetCount();
791 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
794 GetHeader()->SetItemSelected(1);
795 // __previousSceneId = previousSceneId;
796 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
799 pList->GetAt(pList->GetCount()-1,__previousSceneId);
802 if(__pBookmarkList != null)
804 __pBookmarkList->RemoveAll(false);
807 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
809 AppLog("HistoryListForm::OnSceneActivatedN called");
810 //GetHeader()->Invalidate(true);
811 if (__pGroupData == null)
813 __pGroupData = new(std::nothrow) ArrayList();
814 __pGroupData->Construct();
816 if (__pGroupedListView != null)
818 __pGroupedListView->UpdateList();
820 if (__isNoHistoryPresent == true)
822 GetFooter()->SetItemEnabled(0, false);
826 GetFooter()->SetItemEnabled(0, true);
830 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
833 __pSearchBar->SetShowState(false);
834 __pSearchBar->Invalidate(true);
838 __pSearchBar->SetShowState(true);
839 __pSearchBar->Invalidate(true);
842 // if (__isNoHistoryPresent == true)
844 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
845 // __pGroupedListView->UpdateList();
848 result r = GetHeader()->SetItemSelected(2);
851 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
862 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
864 AppLog("HistoryListForm::OnSceneDeactivated");
865 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
869 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
875 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
877 GroupItemClass* pGroupItemClass = null;
878 History* pHistory = null;
879 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
880 if (elementId == IDA_FORMAT_BOOKMARK)
882 String toggledUrl = L"";
883 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
884 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
885 if (pGroupItemClass == null)
889 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
890 if (pHistory == null)
894 toggledUrl = pHistory->GetHistoryUrl();
896 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
898 bool bookmarkFound = false;
899 BookmarkData* pBookMark = null;
900 if(__pBookmarkList != null)
902 for (int i = 0; i < __pBookmarkList->GetCount(); i++)
904 pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
905 if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
907 bookmarkFound = true;
912 if(bookmarkFound == false)
914 // Add the history in bookmark database
915 result r = E_FAILURE;
916 BookmarkData bookmark;
918 String bookmarkTitle = pHistory->GetHistoryTitle();
920 bookmark.SetBookmarkTitle(bookmarkTitle);
921 bookmark.SetUrl(pHistory->GetHistoryUrl());
922 bookmark.SetFaviconId(pHistory->GetFaviconId());
923 bookmark.SetFavIconBuffer(*pHistory->GetFavIconBuffer());
924 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
925 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(bookmark);
929 // remove the history from bookmark database
930 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
933 if(__pBookmarkList != null)
935 __pBookmarkList->RemoveAll(false);
936 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
938 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
939 listView.UpdateList();
943 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
944 if (pGroupItemClass == null)
949 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
950 if (pHistory1 == null)
954 SceneManager* pSceneManager = SceneManager::GetInstance();
955 ArrayList *pArgList = null;
956 result r = E_SUCCESS;
957 pArgList = new(std::nothrow) ArrayList();
958 if (pArgList != null)
960 r = pArgList->Construct();
967 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
968 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
979 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
981 if (pSceneManager != null)
983 AppLog("pSceneManager exists");
984 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
987 pArgList->RemoveAll(false);
1000 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
1006 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
1008 result r = E_FAILURE;
1009 if (mode == SEARCH_BAR_MODE_NORMAL)
1011 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1013 __pSearchListView->SetEnabled(true);
1016 r = __pSearchListView->SetShowState(false);
1021 r = __pGroupedListView->SetShowState(true);
1027 __pSearchListView->SetEnabled(true);
1028 if(__pSearchBar != null)
1029 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1031 __searchHistory = false;
1032 r = __pGroupedListView->UpdateList();
1033 if (__isNoHistoryPresent == true)
1035 GetFooter()->SetItemEnabled(0, false);
1039 GetFooter()->SetItemEnabled(0, true);
1041 if(__pSearchBar != null)
1043 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1053 // __pSearchListView->SetEnabled(false);
1054 r = __pSearchListView->SetShowState(true);
1059 __pSearchListView->SetEnabled(false);
1060 r = __pSearchListView->UpdateList();
1065 r = __pGroupedListView->SetShowState(false);
1070 if(__pSearchBar != null)
1072 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1078 HistoryListForm::GetMonth(int month)
1080 String monthValue = L"";
1084 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1087 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1090 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1093 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1096 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1099 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUNE"));
1102 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1105 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));
1108 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1111 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1114 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1117 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1128 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1130 result r = E_FAILURE;
1131 if (__pSearchBar != null)
1133 __pSearchBar->HideKeypad();
1136 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1138 __pSearchListView->SetEnabled(true);
1139 __searchHistory = true;
1140 __searchText =__pSearchBar->GetText();
1142 r = __pGroupedListView->SetShowState(false);
1147 r = __pSearchListView->SetShowState(true);
1152 r= __pSearchListView->UpdateList();
1153 if (__isNoHistoryPresent == true)
1155 GetFooter()->SetItemEnabled(0, false);
1159 GetFooter()->SetItemEnabled(0, true);
1161 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1170 __searchHistory = false;
1176 HistoryListForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1178 FloatRectangle clientRect;
1179 clientRect = GetClientAreaBoundsF();
1180 AppLogDebug("SearchBarForm::OnKeypadBoundsChanged ClientBounds(%f, %f, %f, %f)",clientRect.x, clientRect.y, clientRect.width, clientRect.height);
1181 __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1182 __pSearchListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1183 __pGroupedListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1184 // __pGroupedListView->SetEnabled(false);
1189 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1191 result r = E_FAILURE;
1192 if (__pGroupedListView != null)
1194 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1195 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1196 else if(__pSearchBar != null)
1197 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1202 __pGroupedListView->UpdateList();
1204 if (__pSearchListView != null)
1206 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1212 __pSearchListView->UpdateList();
1214 if(__pSearchBar != null)
1215 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1220 if (__isNoHistoryPresent == true)
1222 GetFooter()->SetItemEnabled(0, false);
1226 GetFooter()->SetItemEnabled(0, true);
1231 HistoryListForm::OnKeypadWillOpen(Control& source)
1233 GetFooter()->SetShowState(false);
1234 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1235 __pSearchListView->SetEnabled(false);
1236 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1242 HistoryListForm::OnKeypadOpened(Control& source)
1244 // this is added because some time footer is shown when key pad is opened, do not remove
1245 GetFooter()->SetShowState(false);
1246 GetFooter()->Invalidate(true);
1247 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1251 HistoryListForm::OnKeypadClosed(Control& source)
1253 if(Clipboard::GetInstance()->IsPopupVisible() == true)
1257 GetFooter()->SetShowState(true);
1258 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1259 __pSearchListView->Invalidate(false);
1260 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1261 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1266 HistoryListForm::CreateGroupItems()
1268 result r = E_FAILURE;
1269 DateTime currentTime;
1271 GroupItemClass* pGroupItemClass = null;
1274 String weeksAgo2 = L"";
1275 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
1277 String weeksAgo3 = L"";
1278 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1280 if (__pGroupData != null)
1282 __pGroupData->RemoveAll(false);
1283 delete __pGroupData;
1284 __pGroupData = null;
1286 __pGroupData = new(std::nothrow) ArrayList();
1287 if (__pGroupData == null)
1291 r = __pGroupData->Construct();
1294 delete __pGroupData;
1295 __pGroupData = null;
1298 if (__searchHistory == true)
1300 pGroupItemClass = new(std::nothrow) GroupItemClass();
1301 if (pGroupItemClass == null)
1305 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1306 pGroupItemClass->SetTitleText(titleText);
1307 r = __pGroupData->Add(*pGroupItemClass);
1315 Calendar* pGregorianCalendar = null;
1318 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1319 pGroupItemClass = new(std::nothrow) GroupItemClass();
1320 if (pGroupItemClass == null)
1324 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1325 pGroupItemClass->SetTitleText(titleText);
1326 pGroupItemClass->SetEndTime(currentTime);
1327 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1328 pGroupItemClass->SetStartTime(dateTime);
1329 __pGroupData->Add(*pGroupItemClass);
1332 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1333 if ( pGregorianCalendar != NULL )
1335 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1336 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1337 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1338 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1339 delete pGregorianCalendar;
1344 pGroupItemClass = new(std::nothrow) GroupItemClass();
1345 if (pGroupItemClass == null)
1349 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1350 pGroupItemClass->SetTitleText(titleText);
1351 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1352 pGroupItemClass->SetEndTime(dateTime);
1353 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1354 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1355 pGroupItemClass->SetStartTime(dateTime);
1356 __pGroupData->Add(*pGroupItemClass);
1359 pGroupItemClass = new(std::nothrow) GroupItemClass();
1360 if (pGroupItemClass == null)
1364 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1365 pGroupItemClass->SetTitleText(titleText);
1366 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1367 pGroupItemClass->SetEndTime(dateTime);
1368 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1369 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1370 pGroupItemClass->SetStartTime(dateTime);
1371 __pGroupData->Add(*pGroupItemClass);
1374 pGroupItemClass = new(std::nothrow) GroupItemClass();
1375 if (pGroupItemClass == null)
1379 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1380 pGroupItemClass->SetTitleText(titleText);
1381 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1382 pGroupItemClass->SetEndTime(dateTime);
1383 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1384 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1385 pGroupItemClass->SetStartTime(dateTime);
1386 __pGroupData->Add(*pGroupItemClass);
1388 pGroupItemClass = new(std::nothrow) GroupItemClass();
1389 if (pGroupItemClass == null)
1393 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1394 pGroupItemClass->SetTitleText(titleText);
1395 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1396 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1397 pGroupItemClass->SetEndTime(dateTime);
1398 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1399 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1400 pGroupItemClass->SetStartTime(dateTime);
1401 __pGroupData->Add(*pGroupItemClass);
1404 pGroupItemClass = new(std::nothrow) GroupItemClass();
1405 if (pGroupItemClass == null)
1409 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1410 pGroupItemClass->SetTitleText(titleText);
1411 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1412 pGroupItemClass->SetEndTime(dateTime);
1413 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1414 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1415 pGroupItemClass->SetStartTime(dateTime);
1416 __pGroupData->Add(*pGroupItemClass);
1418 pGroupItemClass = new(std::nothrow) GroupItemClass();
1419 if (pGroupItemClass == null)
1423 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1424 pGroupItemClass->SetTitleText(titleText);
1425 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1426 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1427 pGroupItemClass->SetEndTime(dateTime);
1428 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1429 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1430 pGroupItemClass->SetStartTime(dateTime);
1431 __pGroupData->Add(*pGroupItemClass);
1433 pGroupItemClass = new(std::nothrow) GroupItemClass();
1434 if (pGroupItemClass == null)
1438 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1439 pGroupItemClass->SetTitleText(titleText);
1440 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1441 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1442 pGroupItemClass->SetEndTime(dateTime);
1443 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1444 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1445 pGroupItemClass->SetStartTime(dateTime);
1446 __pGroupData->Add(*pGroupItemClass);
1449 pGroupItemClass = new(std::nothrow) GroupItemClass();
1450 if (pGroupItemClass == null)
1454 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1455 pGroupItemClass->SetTitleText(titleText);
1456 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1457 pGroupItemClass->SetEndTime(dateTime);
1458 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1459 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1460 pGroupItemClass->SetStartTime(dateTime);
1461 __pGroupData->Add(*pGroupItemClass);
1463 pGroupItemClass = new(std::nothrow) GroupItemClass();
1464 if (pGroupItemClass == null)
1468 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1469 pGroupItemClass->SetTitleText(titleText);
1470 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1471 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1472 pGroupItemClass->SetEndTime(dateTime);
1473 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1474 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1475 pGroupItemClass->SetStartTime(dateTime);
1476 __pGroupData->Add(*pGroupItemClass);
1478 pGroupItemClass = new(std::nothrow) GroupItemClass();
1479 if (pGroupItemClass == null)
1483 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1484 pGroupItemClass->SetTitleText(titleText);
1485 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1486 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1487 pGroupItemClass->SetEndTime(dateTime);
1488 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1489 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1490 pGroupItemClass->SetStartTime(dateTime);
1491 __pGroupData->Add(*pGroupItemClass);
1493 pGroupItemClass = new(std::nothrow) GroupItemClass();
1494 if (pGroupItemClass == null)
1498 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1499 pGroupItemClass->SetTitleText(titleText);
1500 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1501 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1502 pGroupItemClass->SetEndTime(dateTime);
1503 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1504 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1505 pGroupItemClass->SetStartTime(dateTime);
1506 __pGroupData->Add(*pGroupItemClass);
1509 pGroupItemClass = new(std::nothrow) GroupItemClass();
1510 if (pGroupItemClass == null)
1514 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1515 pGroupItemClass->SetTitleText(titleText);
1516 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1517 pGroupItemClass->SetEndTime(dateTime);
1518 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1519 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1520 pGroupItemClass->SetStartTime(dateTime);
1521 __pGroupData->Add(*pGroupItemClass);
1523 pGroupItemClass = new(std::nothrow) GroupItemClass();
1524 if (pGroupItemClass == null)
1528 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1529 pGroupItemClass->SetTitleText(titleText);
1530 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1531 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1532 pGroupItemClass->SetEndTime(dateTime);
1533 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1534 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1535 pGroupItemClass->SetStartTime(dateTime);
1536 __pGroupData->Add(*pGroupItemClass);
1538 pGroupItemClass = new(std::nothrow) GroupItemClass();
1539 if (pGroupItemClass == null)
1543 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1544 pGroupItemClass->SetTitleText(titleText);
1545 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1546 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1547 pGroupItemClass->SetEndTime(dateTime);
1548 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1549 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1550 pGroupItemClass->SetStartTime(dateTime);
1551 __pGroupData->Add(*pGroupItemClass);
1553 pGroupItemClass = new(std::nothrow) GroupItemClass();
1554 if (pGroupItemClass == null)
1558 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1559 pGroupItemClass->SetTitleText(titleText);
1560 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1561 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1562 pGroupItemClass->SetEndTime(dateTime);
1563 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1564 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1565 pGroupItemClass->SetStartTime(dateTime);
1566 __pGroupData->Add(*pGroupItemClass);
1568 pGroupItemClass = new(std::nothrow) GroupItemClass();
1569 if (pGroupItemClass == null)
1573 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1574 pGroupItemClass->SetTitleText(titleText);
1575 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1576 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1577 pGroupItemClass->SetEndTime(dateTime);
1578 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1579 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1580 pGroupItemClass->SetStartTime(dateTime);
1581 __pGroupData->Add(*pGroupItemClass);
1584 pGroupItemClass = new(std::nothrow) GroupItemClass();
1585 if (pGroupItemClass == null)
1589 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1590 pGroupItemClass->SetTitleText(titleText);
1591 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1592 pGroupItemClass->SetEndTime(dateTime);
1593 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1594 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1595 pGroupItemClass->SetStartTime(dateTime);
1596 __pGroupData->Add(*pGroupItemClass);
1598 pGroupItemClass = new(std::nothrow) GroupItemClass();
1599 if (pGroupItemClass == null)
1603 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1604 pGroupItemClass->SetTitleText(titleText);
1605 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1606 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1607 pGroupItemClass->SetEndTime(dateTime);
1608 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1609 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1610 pGroupItemClass->SetStartTime(dateTime);
1611 __pGroupData->Add(*pGroupItemClass);
1613 pGroupItemClass = new(std::nothrow) GroupItemClass();
1614 if (pGroupItemClass == null)
1618 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1619 pGroupItemClass->SetTitleText(titleText);
1620 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1621 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1622 pGroupItemClass->SetEndTime(dateTime);
1623 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1624 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1625 pGroupItemClass->SetStartTime(dateTime);
1626 __pGroupData->Add(*pGroupItemClass);
1628 pGroupItemClass = new(std::nothrow) GroupItemClass();
1629 if (pGroupItemClass == null)
1633 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1634 pGroupItemClass->SetTitleText(titleText);
1635 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1636 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1637 pGroupItemClass->SetEndTime(dateTime);
1638 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1639 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1640 pGroupItemClass->SetStartTime(dateTime);
1641 __pGroupData->Add(*pGroupItemClass);
1643 pGroupItemClass = new(std::nothrow) GroupItemClass();
1644 if (pGroupItemClass == null)
1648 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1649 pGroupItemClass->SetTitleText(titleText);
1650 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1651 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1652 pGroupItemClass->SetEndTime(dateTime);
1653 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1654 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1655 pGroupItemClass->SetStartTime(dateTime);
1656 __pGroupData->Add(*pGroupItemClass);
1658 pGroupItemClass = new(std::nothrow) GroupItemClass();
1659 if (pGroupItemClass == null)
1663 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1664 pGroupItemClass->SetTitleText(titleText);
1665 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1666 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1667 pGroupItemClass->SetEndTime(dateTime);
1668 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1669 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1670 pGroupItemClass->SetStartTime(dateTime);
1671 __pGroupData->Add(*pGroupItemClass);
1677 day = currentTime.GetDay();
1681 pGroupItemClass = new(std::nothrow) GroupItemClass();
1682 if (pGroupItemClass == null)
1687 pGroupItemClass->SetTitleText(weeksAgo2);
1688 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1689 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1690 pGroupItemClass->SetEndTime(dateTime);
1691 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1692 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1693 pGroupItemClass->SetStartTime(dateTime);
1694 __pGroupData->Add(*pGroupItemClass);
1696 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1698 pGroupItemClass = new(std::nothrow) GroupItemClass();
1699 if (pGroupItemClass == null)
1703 String weeksAgo3 = L"";
1704 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1705 pGroupItemClass->SetTitleText(weeksAgo3);
1706 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1707 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1708 pGroupItemClass->SetEndTime(dateTime);
1709 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1710 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1711 pGroupItemClass->SetStartTime(dateTime);
1712 __pGroupData->Add(*pGroupItemClass);
1716 pGroupItemClass = new(std::nothrow) GroupItemClass();
1717 if (pGroupItemClass == null)
1721 pGroupItemClass->SetTitleText(weeksAgo2);
1722 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1723 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1724 pGroupItemClass->SetEndTime(dateTime);
1725 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1726 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1727 pGroupItemClass->SetStartTime(dateTime);
1728 __pGroupData->Add(*pGroupItemClass);
1730 pGroupItemClass = new(std::nothrow) GroupItemClass();
1731 if (pGroupItemClass == null)
1736 pGroupItemClass->SetTitleText(weeksAgo3);
1737 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1738 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1739 pGroupItemClass->SetEndTime(dateTime);
1740 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1741 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1742 pGroupItemClass->SetStartTime(dateTime);
1743 __pGroupData->Add(*pGroupItemClass);
1745 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1747 pGroupItemClass = new(std::nothrow) GroupItemClass();
1748 if (pGroupItemClass == null)
1752 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1753 pGroupItemClass->SetTitleText(titleText);
1754 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1755 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1756 pGroupItemClass->SetEndTime(dateTime);
1757 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1758 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1759 pGroupItemClass->SetStartTime(dateTime);
1760 __pGroupData->Add(*pGroupItemClass);
1764 pGroupItemClass = new(std::nothrow) GroupItemClass();
1765 if (pGroupItemClass == null)
1769 pGroupItemClass->SetTitleText(weeksAgo2);
1770 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1771 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1772 pGroupItemClass->SetEndTime(dateTime);
1773 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1774 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1775 pGroupItemClass->SetStartTime(dateTime);
1776 __pGroupData->Add(*pGroupItemClass);
1778 pGroupItemClass = new(std::nothrow) GroupItemClass();
1779 if (pGroupItemClass == null)
1783 pGroupItemClass->SetTitleText(weeksAgo3);
1784 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1785 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1786 pGroupItemClass->SetEndTime(dateTime);
1787 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1788 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1789 pGroupItemClass->SetStartTime(dateTime);
1790 __pGroupData->Add(*pGroupItemClass);
1792 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1794 pGroupItemClass = new(std::nothrow) GroupItemClass();
1795 if (pGroupItemClass == null)
1799 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1800 pGroupItemClass->SetTitleText(titleText);
1801 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1802 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1803 pGroupItemClass->SetEndTime(dateTime);
1804 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1805 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1806 pGroupItemClass->SetStartTime(dateTime);
1807 __pGroupData->Add(*pGroupItemClass);
1813 pGroupItemClass = new(std::nothrow) GroupItemClass();
1814 if (pGroupItemClass == null)
1818 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1819 pGroupItemClass->SetTitleText(titleText);
1820 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1821 dateTime.AddDays(-1);
1822 pGroupItemClass->SetEndTime(dateTime);
1823 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1824 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1825 pGroupItemClass->SetStartTime(dateTime);
1826 __pGroupData->Add(*pGroupItemClass);
1828 pGroupItemClass = new(std::nothrow) GroupItemClass();
1829 if (pGroupItemClass == null)
1833 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1834 pGroupItemClass->SetTitleText(titleText);
1835 dateTime.SetValue(currentTime.GetYear(),1, 1);
1836 dateTime.AddMonths(currentTime.GetMonth() - 2);
1837 dateTime.AddDays(-1);
1838 pGroupItemClass->SetEndTime(dateTime);
1840 dateTime2.SetValue(0, 0, 0);
1841 pGroupItemClass->SetStartTime(dateTime2);
1842 __pGroupData->Add(*pGroupItemClass);
1846 GroupItemClass::GroupItemClass()
1852 GroupItemClass::operator =(const GroupItemClass& rhs)
1856 __pData = rhs.__pData;
1861 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1863 __pData = groupItem.__pData;
1866 GroupItemClass::~GroupItemClass()
1870 __pData->RemoveAll(true);
1876 GroupItemClass::SetStartTime(DateTime& startTime)
1878 __startTime = startTime;
1882 GroupItemClass::SetEndTime(DateTime& endTime)
1884 __endTime = endTime;
1888 GroupItemClass::SetTitleText(String& titleText)
1890 __titleText = titleText;
1894 GroupItemClass::SetHistoryData(ArrayList* pData)
1900 GroupItemClass::GetStartTime(void)
1906 GroupItemClass::GetEndTime(void)
1912 GroupItemClass::GetTitleText(void)
1918 GroupItemClass::GetHistoryData(void)
1924 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1926 if (__pGroupedListView)
1928 __pGroupedListView->UpdateList();