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_search_list_icon_favorite.png";
48 static const wchar_t* IDB_TAB_ICON_HISTORY =L"I01_search_list_icon_history.png";
49 static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"00_icon_favorite_on_74x74.png";
50 static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"00_icon_favorite_off_74x74.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);
115 // bool isHwBackButtonExist = false;
116 // Tizen::System::SystemInfo::GetValue(L"http:://tizen.org/feature/input.back.key",isHwBackButtonExist);
118 // SetFormStyle(FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
119 // Setup back event listener
120 SetFormBackEventListener(this);
122 GetHeader()->AddActionEventListener(*this);
123 GetFooter()->AddActionEventListener(*this);
125 // if(isHwBackButtonExist)
127 // GetFooter()->SetBackButtonEnabled(false);
129 AddOrientationEventListener(*this);
130 SettingInfo::AddSettingEventListener(*this);
132 pSceneManager = SceneManager::GetInstance();
133 if (pSceneManager != null)
135 pSceneManager->AddSceneEventListener(IDSCN_HISTORY_LIST, *this);
138 __fontSize = CommonUtil::GetFontSize();
139 if (pAppResource == null)
144 __pGroupedListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1"));
145 if (__pGroupedListView == null)
150 r = __pGroupedListView->SetItemProvider(*this);
157 __pSearchBar = static_cast< SearchBar* >(GetControl(L"IDC_SEARCHBAR1"));
158 if (__pSearchBar == null)
162 __pSearchBar->AddFocusEventListener(*this);
163 __pSearchListView = new(std::nothrow) GroupedListView();
164 if (__pSearchListView == null)
169 __pGroupedListView->AddGroupedListViewItemEventListener(*this);
170 r = __pGroupedListView->SetBounds(Rectangle(0,__pGroupedListView->GetY(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
175 r = __pSearchListView->Construct(Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height -__pSearchBar->GetHeight() - __pSearchBar->GetY()), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
180 r = __pSearchListView->SetItemProvider(*this);
185 r = __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND"));
192 __pSearchListView->SetBackgroundColor(GetBackgroundColor());
193 __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK));
194 __pSearchListView->AddGroupedListViewItemEventListener(*this);
195 r = __pSearchListView->SetShowState(false);
202 __pSearchBar->AddSearchBarEventListener(*this);
203 __pSearchBar->AddKeypadEventListener(*this);
204 r = __pSearchBar->SetContent(__pSearchListView);
208 pHeader->SetStyle(HEADER_STYLE_TAB);
209 bookmark.Construct(IDA_TABBAR_ITEM_1);
211 pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark);
212 bookmark.SetText(strbookmark);
213 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARKS);
214 bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
215 bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
216 pHeader->AddItem(bookmark);
224 history.Construct(IDA_TABBAR_ITEM_2);
226 pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory);
227 history.SetText(strhistory);
228 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY);
229 history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
230 history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
231 pHeader->AddItem(history);
232 pHeader->SetItemSelected(1);
233 pHeader->SetTabEditModeEnabled(false);
235 if (pIconBitmap != NULL)
241 __pBookmarkList = new(std::nothrow) Collection::ArrayList();
242 __pBookmarkList->Construct();
243 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
248 HistoryListForm::OnTerminating(void)
250 result r = E_SUCCESS;
252 SettingInfo::RemoveSettingEventListener(*this);
257 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
259 AppLog("HistoryListForm::OnActionPerformed");
260 result r = E_FAILURE;
261 SceneManager* pSceneManager = SceneManager::GetInstance();
262 if (pSceneManager == null)
268 case IDA_EDIT_HISTORY_LIST_FORM:
270 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
271 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
278 case IDA_TABBAR_ITEM_1:
280 // result r = GetHeader()->SetItemSelected(1);
281 // AppLog("SetItemSelected result %s",GetErrorMessage(r));
282 // GetHeader()->Invalidate(true);
284 if (pSceneManager != null)
286 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
288 if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)) != E_SUCCESS)
290 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
296 if(pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT))!= E_SUCCESS)
298 AppLogDebug("BookmarkListForm::OnActionPerformed GoBackward failed");
312 HistoryListForm::OnFocusGained(const Tizen::Ui::Control& source)
314 __pSearchListView->SetEnabled(false);
318 HistoryListForm::OnFocusLost(const Tizen::Ui::Control& source)
320 __pSearchListView->SetEnabled(true);
321 __searchHistory = false;
324 HistoryListForm::OnFormBackRequested(Form& source)
326 SceneManager* pSceneManager = SceneManager::GetInstance();
327 if (pSceneManager == null)
331 result r = E_FAILURE;
332 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
334 r = pSceneManager->GoBackward(BackwardSceneTransition());
338 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
342 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
347 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
349 result r = E_FAILURE;
355 GroupItem* pItem = null;
356 GroupItemClass* pGroupItemClass = null;
358 String weeksAgo2 = L"";
359 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
361 String weeksAgo3 = L"";
362 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
364 String weeksAgo4 = L"";
365 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),4);
367 pItem = new(std::nothrow) GroupItem();
372 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
374 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
376 AppLog("CreateGroupItem :: if history is null");
377 r = pItem->Construct(Dimension(itemWidth, 0));
382 r = pItem->Construct(Dimension(itemWidth, 48));
384 text = pGroupItemClass->GetTitleText();
386 if (__searchHistory == false)
390 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
393 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
394 if ( pGregorianCalendar != NULL)
396 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
403 delete pGregorianCalendar;
406 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
413 delete pGregorianCalendar;
416 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
423 delete pGregorianCalendar;
426 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
427 if (pGregorianCalendar != NULL)
429 delete pGregorianCalendar;
436 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
439 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
442 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
445 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
448 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
451 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
454 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
462 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
464 text.Append(pGroupItemClass->GetStartTime().GetDay());
466 strMonth = pGroupItemClass->GetStartTime().GetMonth();
467 month = GetMonth(strMonth);
477 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
478 || pGroupItemClass->GetTitleText() == weeksAgo3 || pGroupItemClass->GetTitleText() == weeksAgo4 || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_LAST_MONTH") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
481 text.Append(pGroupItemClass->GetEndTime().GetDay());
483 strMonth = pGroupItemClass->GetEndTime().GetMonth();
484 month = GetMonth(strMonth);
490 r = pItem->SetElement(text, null);
494 AppLogDebug("Failed with %s", GetErrorMessage(r));
497 r = pItem->SetTextSize(32);
508 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
510 AppLog("HistoryListForm::CreateItem");
511 result r = E_FAILURE;
512 History* pHistory = null;
513 Bitmap* pBitmap = null;
514 Bitmap* pBookmarkBitmap = null;
515 GroupItemClass* pGroupItemClass = null;
516 CustomItem* pItem = new(std::nothrow) CustomItem();
517 int bookmarkBtnWidth = 0;
520 Image* pImage = null;
521 pImage = new Image();
524 if(__pGroupData == null)
536 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
537 if (pGroupItemClass == null)
543 if (pGroupItemClass->GetHistoryData() == null)
549 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
550 if (pHistory == null)
556 r = pItem->Construct(Dimension(itemWidth, 128 - 44 + __fontSize), LIST_ANNEX_STYLE_NORMAL);
564 ByteBuffer* pFavIconBuffer = null;
565 pFavIconBuffer = pHistory->GetFavIconBuffer();
567 AppLog("BookmarkListForm::CreateItem check 0");
569 if (pFavIconBuffer != null)
571 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is not null");
575 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is null");
578 pBitmap = pImage->DecodeN(*pFavIconBuffer, IMG_FORMAT_PNG, BITMAP_PIXEL_FORMAT_ARGB8888);
580 AppLog("BookmarkListForm::CreateItem check 1");
582 //bitmapId = pHistory->GetFaviconId() ;
583 //pBitmap = pHistory->GetFavIconBitmap();
587 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
591 r = pItem->AddElement(Rectangle(16, 28 + (__fontSize - 44)/2,72, 72), IDA_FORMAT_ICON, *pBitmap, null);
597 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
601 bool urlFoundInBookmark = false;
603 // if(__pBookmarkList != null)
605 // for (int i = 0; i < __pBookmarkList->GetCount();i++)
607 // BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
608 // if(pBookMark != null && pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
610 // urlFoundInBookmark = true;
615 BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(pHistory->GetHistoryUrl(),urlFoundInBookmark);
616 if (urlFoundInBookmark == true)
618 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
622 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
624 bookmarkBtnWidth = 74;
627 r = pItem->AddElement(Rectangle(104, 10, GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 60 - 44 + __fontSize), IDA_FORMAT_TITLE, pHistory->GetHistoryTitle(), __fontSize,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true);
628 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
630 // if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
631 // 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);
633 r = pItem->AddElement(Rectangle(104, 70 - 44 +__fontSize, GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 48), IDA_FORMAT_URL, pHistory->GetHistoryUrl(),32,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,true);
634 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
635 if ( pBookmarkBitmap != null)
637 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2 +(__fontSize - 44)/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
638 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
639 delete pBookmarkBitmap;
651 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
660 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
662 AppLog("HistoryListForm::DeleteItem");
663 result r = E_FAILURE;
664 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
665 if (pGroupItemClass == null)
670 // if (pGroupItemClass->__pData != null)
672 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
685 HistoryListForm::GetGroupCount(void)
687 __isNoHistoryPresent = true;
689 if (__pGroupData != null)
691 if (__searchHistory == false)
696 HistoryPresentationModel::GetCurrentDateTime(endTime);
698 startTime.SetValue(0,0,0);
700 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
705 return __pGroupData->GetCount();
710 if (__searchText.GetLength() > 0)
712 __searchText.Replace(L"%", L"/%");
713 __searchText.Replace(L"_", L"/_");
715 // String searchText = __pSearchBar->GetText();
716 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
730 HistoryListForm::GetItemCount(int groupIndex)
732 result r = E_FAILURE;
738 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
739 if (pGroupItemClass == null)
743 if (__searchHistory == false)
745 startTime = pGroupItemClass->GetStartTime();
746 endTime = pGroupItemClass->GetEndTime();
747 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
751 //text = __pSearchBar->GetText();
752 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
763 ArrayList* pData = new(std::nothrow) ArrayList();
768 r = pData->Construct();
776 if (__searchHistory == false)
778 startTime = pGroupItemClass->GetStartTime();
779 endTime = pGroupItemClass->GetEndTime();
780 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
781 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
785 //text = __pSearchBar->GetText() ;
786 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
793 pGroupItemClass->SetHistoryData(pData);
796 if (__isNoHistoryPresent == true && count == 0)
798 __isNoHistoryPresent = true;
799 GetFooter()->SetItemEnabled(0, false);
803 __isNoHistoryPresent = false;
804 GetFooter()->SetItemEnabled(0, true);
806 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
807 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
814 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
815 return pGroupItemClass->GetHistoryData()->GetCount();
820 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
823 GetHeader()->SetItemSelected(1);
824 // __previousSceneId = previousSceneId;
825 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
828 pList->GetAt(pList->GetCount()-1,__previousSceneId);
831 if(__pBookmarkList != null)
833 __pBookmarkList->RemoveAll(false);
836 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
838 AppLog("HistoryListForm::OnSceneActivatedN called");
839 //GetHeader()->Invalidate(true);
840 if (__pGroupData == null)
842 __pGroupData = new(std::nothrow) ArrayList();
843 __pGroupData->Construct();
845 if (__pGroupedListView != null)
847 __pGroupedListView->UpdateList();
849 if (__isNoHistoryPresent == true)
851 GetFooter()->SetItemEnabled(0, false);
855 GetFooter()->SetItemEnabled(0, true);
861 HistoryPresentationModel::GetCurrentDateTime(endTime);;
863 startTime.SetValue(0,0,0);
864 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
867 __pSearchBar->SetShowState(false);
868 __pSearchBar->Invalidate(true);
872 __pSearchBar->SetShowState(true);
873 __pSearchBar->Invalidate(true);
876 // if (__isNoHistoryPresent == true)
878 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
879 // __pGroupedListView->UpdateList();
882 result r = GetHeader()->SetItemSelected(1);
885 AppLog("HistoryListForm::OnSceneActivatedN header failed %s", GetErrorMessage(r));
896 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
898 AppLog("HistoryListForm::OnSceneDeactivated");
899 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
903 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
909 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
911 GroupItemClass* pGroupItemClass = null;
912 History* pHistory = null;
913 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
914 if (elementId == IDA_FORMAT_BOOKMARK)
916 String toggledUrl = L"";
917 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
918 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
919 if (pGroupItemClass == null)
923 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
924 if (pHistory == null)
928 toggledUrl = pHistory->GetHistoryUrl();
930 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
932 bool bookmarkFound = false;
933 BookmarkData* pBookMark = null;
934 // if(__pBookmarkList != null)
936 // for (int i = 0; i < __pBookmarkList->GetCount(); i++)
938 // pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
939 // if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
941 // bookmarkFound = true;
946 BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(toggledUrl,bookmarkFound);
947 if(bookmarkFound == false)
949 // Add the history in bookmark database
950 result r = E_FAILURE;
951 BookmarkData bookmark;
953 String bookmarkTitle = pHistory->GetHistoryTitle();
955 bookmark.SetBookmarkTitle(bookmarkTitle);
956 bookmark.SetUrl(pHistory->GetHistoryUrl());
957 bookmark.SetFaviconId(pHistory->GetFaviconId());
958 if(pHistory->GetFavIconBuffer())
960 ByteBuffer *pBuffer = new ByteBuffer();
962 pBuffer->Construct(*pHistory->GetFavIconBuffer());
963 bookmark.SetFavIconBuffer(*pBuffer);
965 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
966 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(bookmark);
970 // remove the history from bookmark database
971 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
974 if(__pBookmarkList != null)
976 __pBookmarkList->RemoveAll(false);
977 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
979 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
980 listView.UpdateList();
984 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
985 if (pGroupItemClass == null)
990 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
991 if (pHistory1 == null)
995 SceneManager* pSceneManager = SceneManager::GetInstance();
996 ArrayList *pArgList = null;
997 result r = E_SUCCESS;
998 pArgList = new(std::nothrow) ArrayList();
999 if (pArgList != null)
1001 r = pArgList->Construct();
1008 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
1009 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
1019 String scneId = L"";
1020 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
1022 if (pSceneManager != null)
1024 AppLog("pSceneManager exists");
1025 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
1028 pArgList->RemoveAll(false);
1041 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
1047 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
1049 result r = E_FAILURE;
1050 if (mode == SEARCH_BAR_MODE_NORMAL)
1052 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1054 __pSearchListView->SetEnabled(true);
1057 r = __pSearchListView->SetShowState(false);
1062 r = __pGroupedListView->SetShowState(true);
1068 __pSearchListView->SetEnabled(true);
1069 if(__pSearchBar != null)
1070 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1072 __searchHistory = false;
1073 r = __pGroupedListView->UpdateList();
1074 if (__isNoHistoryPresent == true)
1076 GetFooter()->SetItemEnabled(0, false);
1080 GetFooter()->SetItemEnabled(0, true);
1082 if(__pSearchBar != null)
1084 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1094 // __pSearchListView->SetEnabled(false);
1095 r = __pSearchListView->SetShowState(true);
1100 __pSearchListView->SetEnabled(false);
1101 r = __pSearchListView->UpdateList();
1106 r = __pGroupedListView->SetShowState(false);
1111 if(__pSearchBar != null)
1113 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1119 HistoryListForm::GetMonth(int month)
1121 String monthValue = L"";
1125 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1128 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1131 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1134 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APRIL"));
1137 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1140 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUNE"));
1143 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1146 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));
1149 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1152 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1155 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1158 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1169 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1171 result r = E_FAILURE;
1172 if (__pSearchBar != null)
1174 __pSearchBar->HideKeypad();
1177 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1179 __pSearchListView->SetEnabled(true);
1180 __searchHistory = true;
1181 __searchText =__pSearchBar->GetText();
1182 AppLog("SearchTextHistory %S errormsg %s",__searchText.GetPointer(),GetErrorMessage(GetLastResult()));
1184 r = __pGroupedListView->SetShowState(false);
1189 r = __pSearchListView->SetShowState(true);
1194 r= __pSearchListView->UpdateList();
1195 if (__isNoHistoryPresent == true)
1197 GetFooter()->SetItemEnabled(0, false);
1201 GetFooter()->SetItemEnabled(0, true);
1203 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1212 __searchHistory = false;
1218 HistoryListForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1220 FloatRectangle clientRect;
1221 clientRect = GetClientAreaBoundsF();
1222 AppLogDebug("SearchBarForm::OnKeypadBoundsChanged ClientBounds(%f, %f, %f, %f)",clientRect.x, clientRect.y, clientRect.width, clientRect.height);
1223 __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1224 __pSearchListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1225 __pGroupedListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1226 // __pGroupedListView->SetEnabled(false);
1231 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1233 result r = E_FAILURE;
1234 if (__pGroupedListView != null)
1236 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1237 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1238 else if(__pSearchBar != null)
1239 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1244 if (__pSearchListView != null)
1246 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1252 __pSearchListView->UpdateList();
1254 if(__pSearchBar != null)
1255 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1260 if (__isNoHistoryPresent == true)
1262 GetFooter()->SetItemEnabled(0, false);
1266 GetFooter()->SetItemEnabled(0, true);
1271 HistoryListForm::OnKeypadWillOpen(Control& source)
1273 GetFooter()->SetShowState(false);
1274 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1275 __pSearchListView->SetEnabled(false);
1276 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1282 HistoryListForm::OnKeypadOpened(Control& source)
1284 // this is added because some time footer is shown when key pad is opened, do not remove
1285 GetFooter()->SetShowState(false);
1286 GetFooter()->Invalidate(true);
1287 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1291 HistoryListForm::OnKeypadClosed(Control& source)
1293 if(Clipboard::GetInstance()->IsPopupVisible() == true)
1297 GetFooter()->SetShowState(true);
1298 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1299 __pSearchListView->Invalidate(false);
1300 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1301 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1306 HistoryListForm::CreateGroupItems()
1308 result r = E_FAILURE;
1309 DateTime currentTime;
1311 GroupItemClass* pGroupItemClass = null;
1314 String weeksAgo2 = L"";
1315 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
1317 String weeksAgo3 = L"";
1318 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1320 if (__pGroupData != null)
1322 __pGroupData->RemoveAll(false);
1323 delete __pGroupData;
1324 __pGroupData = null;
1326 __pGroupData = new(std::nothrow) ArrayList();
1327 if (__pGroupData == null)
1331 r = __pGroupData->Construct();
1334 delete __pGroupData;
1335 __pGroupData = null;
1338 if (__searchHistory == true)
1340 pGroupItemClass = new(std::nothrow) GroupItemClass();
1341 if (pGroupItemClass == null)
1345 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCH");
1346 pGroupItemClass->SetTitleText(titleText);
1347 r = __pGroupData->Add(*pGroupItemClass);
1355 Calendar* pGregorianCalendar = null;
1358 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1359 pGroupItemClass = new(std::nothrow) GroupItemClass();
1360 if (pGroupItemClass == null)
1364 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1365 pGroupItemClass->SetTitleText(titleText);
1366 pGroupItemClass->SetEndTime(currentTime);
1367 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1368 pGroupItemClass->SetStartTime(dateTime);
1369 __pGroupData->Add(*pGroupItemClass);
1372 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1373 if ( pGregorianCalendar != NULL )
1375 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1376 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1377 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1378 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1379 delete pGregorianCalendar;
1384 pGroupItemClass = new(std::nothrow) GroupItemClass();
1385 if (pGroupItemClass == null)
1389 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1390 pGroupItemClass->SetTitleText(titleText);
1391 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1392 pGroupItemClass->SetEndTime(dateTime);
1393 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1394 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1395 pGroupItemClass->SetStartTime(dateTime);
1396 __pGroupData->Add(*pGroupItemClass);
1399 pGroupItemClass = new(std::nothrow) GroupItemClass();
1400 if (pGroupItemClass == null)
1404 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1405 pGroupItemClass->SetTitleText(titleText);
1406 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1407 pGroupItemClass->SetEndTime(dateTime);
1408 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1409 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1410 pGroupItemClass->SetStartTime(dateTime);
1411 __pGroupData->Add(*pGroupItemClass);
1414 pGroupItemClass = new(std::nothrow) GroupItemClass();
1415 if (pGroupItemClass == null)
1419 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1420 pGroupItemClass->SetTitleText(titleText);
1421 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1422 pGroupItemClass->SetEndTime(dateTime);
1423 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1424 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1425 pGroupItemClass->SetStartTime(dateTime);
1426 __pGroupData->Add(*pGroupItemClass);
1428 pGroupItemClass = new(std::nothrow) GroupItemClass();
1429 if (pGroupItemClass == null)
1433 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1434 pGroupItemClass->SetTitleText(titleText);
1435 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1436 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1437 pGroupItemClass->SetEndTime(dateTime);
1438 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1439 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1440 pGroupItemClass->SetStartTime(dateTime);
1441 __pGroupData->Add(*pGroupItemClass);
1444 pGroupItemClass = new(std::nothrow) GroupItemClass();
1445 if (pGroupItemClass == null)
1449 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1450 pGroupItemClass->SetTitleText(titleText);
1451 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1452 pGroupItemClass->SetEndTime(dateTime);
1453 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1454 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1455 pGroupItemClass->SetStartTime(dateTime);
1456 __pGroupData->Add(*pGroupItemClass);
1458 pGroupItemClass = new(std::nothrow) GroupItemClass();
1459 if (pGroupItemClass == null)
1463 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1464 pGroupItemClass->SetTitleText(titleText);
1465 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1466 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1467 pGroupItemClass->SetEndTime(dateTime);
1468 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1469 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1470 pGroupItemClass->SetStartTime(dateTime);
1471 __pGroupData->Add(*pGroupItemClass);
1473 pGroupItemClass = new(std::nothrow) GroupItemClass();
1474 if (pGroupItemClass == null)
1478 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1479 pGroupItemClass->SetTitleText(titleText);
1480 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1481 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1482 pGroupItemClass->SetEndTime(dateTime);
1483 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1484 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1485 pGroupItemClass->SetStartTime(dateTime);
1486 __pGroupData->Add(*pGroupItemClass);
1489 pGroupItemClass = new(std::nothrow) GroupItemClass();
1490 if (pGroupItemClass == null)
1494 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1495 pGroupItemClass->SetTitleText(titleText);
1496 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1497 pGroupItemClass->SetEndTime(dateTime);
1498 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1499 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1500 pGroupItemClass->SetStartTime(dateTime);
1501 __pGroupData->Add(*pGroupItemClass);
1503 pGroupItemClass = new(std::nothrow) GroupItemClass();
1504 if (pGroupItemClass == null)
1508 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1509 pGroupItemClass->SetTitleText(titleText);
1510 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1511 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1512 pGroupItemClass->SetEndTime(dateTime);
1513 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1514 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1515 pGroupItemClass->SetStartTime(dateTime);
1516 __pGroupData->Add(*pGroupItemClass);
1518 pGroupItemClass = new(std::nothrow) GroupItemClass();
1519 if (pGroupItemClass == null)
1523 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1524 pGroupItemClass->SetTitleText(titleText);
1525 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1526 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1527 pGroupItemClass->SetEndTime(dateTime);
1528 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1529 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1530 pGroupItemClass->SetStartTime(dateTime);
1531 __pGroupData->Add(*pGroupItemClass);
1533 pGroupItemClass = new(std::nothrow) GroupItemClass();
1534 if (pGroupItemClass == null)
1538 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1539 pGroupItemClass->SetTitleText(titleText);
1540 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1541 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1542 pGroupItemClass->SetEndTime(dateTime);
1543 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1544 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1545 pGroupItemClass->SetStartTime(dateTime);
1546 __pGroupData->Add(*pGroupItemClass);
1549 pGroupItemClass = new(std::nothrow) GroupItemClass();
1550 if (pGroupItemClass == null)
1554 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1555 pGroupItemClass->SetTitleText(titleText);
1556 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1557 pGroupItemClass->SetEndTime(dateTime);
1558 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1559 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1560 pGroupItemClass->SetStartTime(dateTime);
1561 __pGroupData->Add(*pGroupItemClass);
1563 pGroupItemClass = new(std::nothrow) GroupItemClass();
1564 if (pGroupItemClass == null)
1568 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1569 pGroupItemClass->SetTitleText(titleText);
1570 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1571 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1572 pGroupItemClass->SetEndTime(dateTime);
1573 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1574 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1575 pGroupItemClass->SetStartTime(dateTime);
1576 __pGroupData->Add(*pGroupItemClass);
1578 pGroupItemClass = new(std::nothrow) GroupItemClass();
1579 if (pGroupItemClass == null)
1583 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1584 pGroupItemClass->SetTitleText(titleText);
1585 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1586 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1587 pGroupItemClass->SetEndTime(dateTime);
1588 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1589 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1590 pGroupItemClass->SetStartTime(dateTime);
1591 __pGroupData->Add(*pGroupItemClass);
1593 pGroupItemClass = new(std::nothrow) GroupItemClass();
1594 if (pGroupItemClass == null)
1598 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1599 pGroupItemClass->SetTitleText(titleText);
1600 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1601 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1602 pGroupItemClass->SetEndTime(dateTime);
1603 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1604 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1605 pGroupItemClass->SetStartTime(dateTime);
1606 __pGroupData->Add(*pGroupItemClass);
1608 pGroupItemClass = new(std::nothrow) GroupItemClass();
1609 if (pGroupItemClass == null)
1613 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1614 pGroupItemClass->SetTitleText(titleText);
1615 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1616 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1617 pGroupItemClass->SetEndTime(dateTime);
1618 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1619 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1620 pGroupItemClass->SetStartTime(dateTime);
1621 __pGroupData->Add(*pGroupItemClass);
1624 pGroupItemClass = new(std::nothrow) GroupItemClass();
1625 if (pGroupItemClass == null)
1629 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1630 pGroupItemClass->SetTitleText(titleText);
1631 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1632 pGroupItemClass->SetEndTime(dateTime);
1633 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1634 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1635 pGroupItemClass->SetStartTime(dateTime);
1636 __pGroupData->Add(*pGroupItemClass);
1638 pGroupItemClass = new(std::nothrow) GroupItemClass();
1639 if (pGroupItemClass == null)
1643 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1644 pGroupItemClass->SetTitleText(titleText);
1645 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1646 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1647 pGroupItemClass->SetEndTime(dateTime);
1648 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1649 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1650 pGroupItemClass->SetStartTime(dateTime);
1651 __pGroupData->Add(*pGroupItemClass);
1653 pGroupItemClass = new(std::nothrow) GroupItemClass();
1654 if (pGroupItemClass == null)
1658 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1659 pGroupItemClass->SetTitleText(titleText);
1660 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1661 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1662 pGroupItemClass->SetEndTime(dateTime);
1663 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1664 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1665 pGroupItemClass->SetStartTime(dateTime);
1666 __pGroupData->Add(*pGroupItemClass);
1668 pGroupItemClass = new(std::nothrow) GroupItemClass();
1669 if (pGroupItemClass == null)
1673 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1674 pGroupItemClass->SetTitleText(titleText);
1675 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1676 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1677 pGroupItemClass->SetEndTime(dateTime);
1678 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1679 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1680 pGroupItemClass->SetStartTime(dateTime);
1681 __pGroupData->Add(*pGroupItemClass);
1683 pGroupItemClass = new(std::nothrow) GroupItemClass();
1684 if (pGroupItemClass == null)
1688 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1689 pGroupItemClass->SetTitleText(titleText);
1690 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1691 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1692 pGroupItemClass->SetEndTime(dateTime);
1693 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1694 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1695 pGroupItemClass->SetStartTime(dateTime);
1696 __pGroupData->Add(*pGroupItemClass);
1698 pGroupItemClass = new(std::nothrow) GroupItemClass();
1699 if (pGroupItemClass == null)
1703 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1704 pGroupItemClass->SetTitleText(titleText);
1705 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1706 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1707 pGroupItemClass->SetEndTime(dateTime);
1708 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1709 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1710 pGroupItemClass->SetStartTime(dateTime);
1711 __pGroupData->Add(*pGroupItemClass);
1717 day = currentTime.GetDay();
1721 pGroupItemClass = new(std::nothrow) GroupItemClass();
1722 if (pGroupItemClass == null)
1727 pGroupItemClass->SetTitleText(weeksAgo2);
1728 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1729 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1730 pGroupItemClass->SetEndTime(dateTime);
1731 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1732 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1733 pGroupItemClass->SetStartTime(dateTime);
1734 __pGroupData->Add(*pGroupItemClass);
1736 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1738 pGroupItemClass = new(std::nothrow) GroupItemClass();
1739 if (pGroupItemClass == null)
1743 String weeksAgo3 = L"";
1744 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1745 pGroupItemClass->SetTitleText(weeksAgo3);
1746 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1747 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1748 pGroupItemClass->SetEndTime(dateTime);
1749 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1750 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1751 pGroupItemClass->SetStartTime(dateTime);
1752 __pGroupData->Add(*pGroupItemClass);
1756 pGroupItemClass = new(std::nothrow) GroupItemClass();
1757 if (pGroupItemClass == null)
1761 pGroupItemClass->SetTitleText(weeksAgo2);
1762 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1763 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1764 pGroupItemClass->SetEndTime(dateTime);
1765 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1766 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1767 pGroupItemClass->SetStartTime(dateTime);
1768 __pGroupData->Add(*pGroupItemClass);
1770 pGroupItemClass = new(std::nothrow) GroupItemClass();
1771 if (pGroupItemClass == null)
1776 pGroupItemClass->SetTitleText(weeksAgo3);
1777 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1778 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1779 pGroupItemClass->SetEndTime(dateTime);
1780 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1781 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1782 pGroupItemClass->SetStartTime(dateTime);
1783 __pGroupData->Add(*pGroupItemClass);
1785 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1787 pGroupItemClass = new(std::nothrow) GroupItemClass();
1788 if (pGroupItemClass == null)
1792 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1793 pGroupItemClass->SetTitleText(titleText);
1794 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1795 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1796 pGroupItemClass->SetEndTime(dateTime);
1797 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1798 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1799 pGroupItemClass->SetStartTime(dateTime);
1800 __pGroupData->Add(*pGroupItemClass);
1804 pGroupItemClass = new(std::nothrow) GroupItemClass();
1805 if (pGroupItemClass == null)
1809 pGroupItemClass->SetTitleText(weeksAgo2);
1810 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1811 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1812 pGroupItemClass->SetEndTime(dateTime);
1813 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1814 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1815 pGroupItemClass->SetStartTime(dateTime);
1816 __pGroupData->Add(*pGroupItemClass);
1818 pGroupItemClass = new(std::nothrow) GroupItemClass();
1819 if (pGroupItemClass == null)
1823 pGroupItemClass->SetTitleText(weeksAgo3);
1824 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1825 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1826 pGroupItemClass->SetEndTime(dateTime);
1827 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1828 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1829 pGroupItemClass->SetStartTime(dateTime);
1830 __pGroupData->Add(*pGroupItemClass);
1832 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1834 pGroupItemClass = new(std::nothrow) GroupItemClass();
1835 if (pGroupItemClass == null)
1839 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1840 pGroupItemClass->SetTitleText(titleText);
1841 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1842 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1843 pGroupItemClass->SetEndTime(dateTime);
1844 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1845 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1846 pGroupItemClass->SetStartTime(dateTime);
1847 __pGroupData->Add(*pGroupItemClass);
1853 pGroupItemClass = new(std::nothrow) GroupItemClass();
1854 if (pGroupItemClass == null)
1858 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_MONTH");
1859 pGroupItemClass->SetTitleText(titleText);
1860 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1861 dateTime.AddDays(-1);
1862 pGroupItemClass->SetEndTime(dateTime);
1863 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1864 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1865 pGroupItemClass->SetStartTime(dateTime);
1866 __pGroupData->Add(*pGroupItemClass);
1868 pGroupItemClass = new(std::nothrow) GroupItemClass();
1869 if (pGroupItemClass == null)
1873 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1874 pGroupItemClass->SetTitleText(titleText);
1875 dateTime.SetValue(currentTime.GetYear(),1, 1);
1876 dateTime.AddMonths(currentTime.GetMonth() - 2);
1877 dateTime.AddDays(-1);
1878 pGroupItemClass->SetEndTime(dateTime);
1880 dateTime2.SetValue(0, 0, 0);
1881 pGroupItemClass->SetStartTime(dateTime2);
1882 __pGroupData->Add(*pGroupItemClass);
1886 GroupItemClass::GroupItemClass()
1892 GroupItemClass::operator =(const GroupItemClass& rhs)
1896 __pData = rhs.__pData;
1901 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1903 __pData = groupItem.__pData;
1906 GroupItemClass::~GroupItemClass()
1910 __pData->RemoveAll(true);
1916 GroupItemClass::SetStartTime(DateTime& startTime)
1918 __startTime = startTime;
1922 GroupItemClass::SetEndTime(DateTime& endTime)
1924 __endTime = endTime;
1928 GroupItemClass::SetTitleText(String& titleText)
1930 __titleText = titleText;
1934 GroupItemClass::SetHistoryData(ArrayList* pData)
1940 GroupItemClass::GetStartTime(void)
1946 GroupItemClass::GetEndTime(void)
1952 GroupItemClass::GetTitleText(void)
1958 GroupItemClass::GetHistoryData(void)
1964 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1966 if (__pGroupedListView)
1968 __pGroupedListView->UpdateList();