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 __pGroupedListView->UpdateList();
1246 if (__pSearchListView != null)
1248 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1254 __pSearchListView->UpdateList();
1256 if(__pSearchBar != null)
1257 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1262 if (__isNoHistoryPresent == true)
1264 GetFooter()->SetItemEnabled(0, false);
1268 GetFooter()->SetItemEnabled(0, true);
1273 HistoryListForm::OnKeypadWillOpen(Control& source)
1275 GetFooter()->SetShowState(false);
1276 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1277 __pSearchListView->SetEnabled(false);
1278 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1284 HistoryListForm::OnKeypadOpened(Control& source)
1286 // this is added because some time footer is shown when key pad is opened, do not remove
1287 GetFooter()->SetShowState(false);
1288 GetFooter()->Invalidate(true);
1289 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1293 HistoryListForm::OnKeypadClosed(Control& source)
1295 if(Clipboard::GetInstance()->IsPopupVisible() == true)
1299 GetFooter()->SetShowState(true);
1300 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1301 __pSearchListView->Invalidate(false);
1302 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1303 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1308 HistoryListForm::CreateGroupItems()
1310 result r = E_FAILURE;
1311 DateTime currentTime;
1313 GroupItemClass* pGroupItemClass = null;
1316 String weeksAgo2 = L"";
1317 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
1319 String weeksAgo3 = L"";
1320 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1322 if (__pGroupData != null)
1324 __pGroupData->RemoveAll(false);
1325 delete __pGroupData;
1326 __pGroupData = null;
1328 __pGroupData = new(std::nothrow) ArrayList();
1329 if (__pGroupData == null)
1333 r = __pGroupData->Construct();
1336 delete __pGroupData;
1337 __pGroupData = null;
1340 if (__searchHistory == true)
1342 pGroupItemClass = new(std::nothrow) GroupItemClass();
1343 if (pGroupItemClass == null)
1347 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCH");
1348 pGroupItemClass->SetTitleText(titleText);
1349 r = __pGroupData->Add(*pGroupItemClass);
1357 Calendar* pGregorianCalendar = null;
1360 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1361 pGroupItemClass = new(std::nothrow) GroupItemClass();
1362 if (pGroupItemClass == null)
1366 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1367 pGroupItemClass->SetTitleText(titleText);
1368 pGroupItemClass->SetEndTime(currentTime);
1369 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1370 pGroupItemClass->SetStartTime(dateTime);
1371 __pGroupData->Add(*pGroupItemClass);
1374 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1375 if ( pGregorianCalendar != NULL )
1377 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1378 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1379 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1380 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1381 delete pGregorianCalendar;
1386 pGroupItemClass = new(std::nothrow) GroupItemClass();
1387 if (pGroupItemClass == null)
1391 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1392 pGroupItemClass->SetTitleText(titleText);
1393 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1394 pGroupItemClass->SetEndTime(dateTime);
1395 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1396 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1397 pGroupItemClass->SetStartTime(dateTime);
1398 __pGroupData->Add(*pGroupItemClass);
1401 pGroupItemClass = new(std::nothrow) GroupItemClass();
1402 if (pGroupItemClass == null)
1406 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1407 pGroupItemClass->SetTitleText(titleText);
1408 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1409 pGroupItemClass->SetEndTime(dateTime);
1410 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1411 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1412 pGroupItemClass->SetStartTime(dateTime);
1413 __pGroupData->Add(*pGroupItemClass);
1416 pGroupItemClass = new(std::nothrow) GroupItemClass();
1417 if (pGroupItemClass == null)
1421 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1422 pGroupItemClass->SetTitleText(titleText);
1423 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1424 pGroupItemClass->SetEndTime(dateTime);
1425 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1426 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1427 pGroupItemClass->SetStartTime(dateTime);
1428 __pGroupData->Add(*pGroupItemClass);
1430 pGroupItemClass = new(std::nothrow) GroupItemClass();
1431 if (pGroupItemClass == null)
1435 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1436 pGroupItemClass->SetTitleText(titleText);
1437 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1438 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1439 pGroupItemClass->SetEndTime(dateTime);
1440 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1441 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1442 pGroupItemClass->SetStartTime(dateTime);
1443 __pGroupData->Add(*pGroupItemClass);
1446 pGroupItemClass = new(std::nothrow) GroupItemClass();
1447 if (pGroupItemClass == null)
1451 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1452 pGroupItemClass->SetTitleText(titleText);
1453 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1454 pGroupItemClass->SetEndTime(dateTime);
1455 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1456 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1457 pGroupItemClass->SetStartTime(dateTime);
1458 __pGroupData->Add(*pGroupItemClass);
1460 pGroupItemClass = new(std::nothrow) GroupItemClass();
1461 if (pGroupItemClass == null)
1465 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1466 pGroupItemClass->SetTitleText(titleText);
1467 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1468 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1469 pGroupItemClass->SetEndTime(dateTime);
1470 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1471 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1472 pGroupItemClass->SetStartTime(dateTime);
1473 __pGroupData->Add(*pGroupItemClass);
1475 pGroupItemClass = new(std::nothrow) GroupItemClass();
1476 if (pGroupItemClass == null)
1480 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1481 pGroupItemClass->SetTitleText(titleText);
1482 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1483 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1484 pGroupItemClass->SetEndTime(dateTime);
1485 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1486 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1487 pGroupItemClass->SetStartTime(dateTime);
1488 __pGroupData->Add(*pGroupItemClass);
1491 pGroupItemClass = new(std::nothrow) GroupItemClass();
1492 if (pGroupItemClass == null)
1496 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1497 pGroupItemClass->SetTitleText(titleText);
1498 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1499 pGroupItemClass->SetEndTime(dateTime);
1500 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1501 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1502 pGroupItemClass->SetStartTime(dateTime);
1503 __pGroupData->Add(*pGroupItemClass);
1505 pGroupItemClass = new(std::nothrow) GroupItemClass();
1506 if (pGroupItemClass == null)
1510 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1511 pGroupItemClass->SetTitleText(titleText);
1512 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1513 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1514 pGroupItemClass->SetEndTime(dateTime);
1515 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1516 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1517 pGroupItemClass->SetStartTime(dateTime);
1518 __pGroupData->Add(*pGroupItemClass);
1520 pGroupItemClass = new(std::nothrow) GroupItemClass();
1521 if (pGroupItemClass == null)
1525 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1526 pGroupItemClass->SetTitleText(titleText);
1527 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1528 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1529 pGroupItemClass->SetEndTime(dateTime);
1530 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1531 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1532 pGroupItemClass->SetStartTime(dateTime);
1533 __pGroupData->Add(*pGroupItemClass);
1535 pGroupItemClass = new(std::nothrow) GroupItemClass();
1536 if (pGroupItemClass == null)
1540 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1541 pGroupItemClass->SetTitleText(titleText);
1542 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1543 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1544 pGroupItemClass->SetEndTime(dateTime);
1545 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1546 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1547 pGroupItemClass->SetStartTime(dateTime);
1548 __pGroupData->Add(*pGroupItemClass);
1551 pGroupItemClass = new(std::nothrow) GroupItemClass();
1552 if (pGroupItemClass == null)
1556 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1557 pGroupItemClass->SetTitleText(titleText);
1558 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1559 pGroupItemClass->SetEndTime(dateTime);
1560 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1561 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1562 pGroupItemClass->SetStartTime(dateTime);
1563 __pGroupData->Add(*pGroupItemClass);
1565 pGroupItemClass = new(std::nothrow) GroupItemClass();
1566 if (pGroupItemClass == null)
1570 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1571 pGroupItemClass->SetTitleText(titleText);
1572 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1573 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1574 pGroupItemClass->SetEndTime(dateTime);
1575 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1576 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1577 pGroupItemClass->SetStartTime(dateTime);
1578 __pGroupData->Add(*pGroupItemClass);
1580 pGroupItemClass = new(std::nothrow) GroupItemClass();
1581 if (pGroupItemClass == null)
1585 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1586 pGroupItemClass->SetTitleText(titleText);
1587 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1588 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1589 pGroupItemClass->SetEndTime(dateTime);
1590 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1591 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1592 pGroupItemClass->SetStartTime(dateTime);
1593 __pGroupData->Add(*pGroupItemClass);
1595 pGroupItemClass = new(std::nothrow) GroupItemClass();
1596 if (pGroupItemClass == null)
1600 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1601 pGroupItemClass->SetTitleText(titleText);
1602 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1603 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1604 pGroupItemClass->SetEndTime(dateTime);
1605 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1606 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1607 pGroupItemClass->SetStartTime(dateTime);
1608 __pGroupData->Add(*pGroupItemClass);
1610 pGroupItemClass = new(std::nothrow) GroupItemClass();
1611 if (pGroupItemClass == null)
1615 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1616 pGroupItemClass->SetTitleText(titleText);
1617 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1618 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1619 pGroupItemClass->SetEndTime(dateTime);
1620 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1621 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1622 pGroupItemClass->SetStartTime(dateTime);
1623 __pGroupData->Add(*pGroupItemClass);
1626 pGroupItemClass = new(std::nothrow) GroupItemClass();
1627 if (pGroupItemClass == null)
1631 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1632 pGroupItemClass->SetTitleText(titleText);
1633 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1634 pGroupItemClass->SetEndTime(dateTime);
1635 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1636 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1637 pGroupItemClass->SetStartTime(dateTime);
1638 __pGroupData->Add(*pGroupItemClass);
1640 pGroupItemClass = new(std::nothrow) GroupItemClass();
1641 if (pGroupItemClass == null)
1645 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1646 pGroupItemClass->SetTitleText(titleText);
1647 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1648 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1649 pGroupItemClass->SetEndTime(dateTime);
1650 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1651 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1652 pGroupItemClass->SetStartTime(dateTime);
1653 __pGroupData->Add(*pGroupItemClass);
1655 pGroupItemClass = new(std::nothrow) GroupItemClass();
1656 if (pGroupItemClass == null)
1660 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1661 pGroupItemClass->SetTitleText(titleText);
1662 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1663 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1664 pGroupItemClass->SetEndTime(dateTime);
1665 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1666 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1667 pGroupItemClass->SetStartTime(dateTime);
1668 __pGroupData->Add(*pGroupItemClass);
1670 pGroupItemClass = new(std::nothrow) GroupItemClass();
1671 if (pGroupItemClass == null)
1675 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1676 pGroupItemClass->SetTitleText(titleText);
1677 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1678 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1679 pGroupItemClass->SetEndTime(dateTime);
1680 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1681 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1682 pGroupItemClass->SetStartTime(dateTime);
1683 __pGroupData->Add(*pGroupItemClass);
1685 pGroupItemClass = new(std::nothrow) GroupItemClass();
1686 if (pGroupItemClass == null)
1690 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1691 pGroupItemClass->SetTitleText(titleText);
1692 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1693 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1694 pGroupItemClass->SetEndTime(dateTime);
1695 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1696 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1697 pGroupItemClass->SetStartTime(dateTime);
1698 __pGroupData->Add(*pGroupItemClass);
1700 pGroupItemClass = new(std::nothrow) GroupItemClass();
1701 if (pGroupItemClass == null)
1705 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1706 pGroupItemClass->SetTitleText(titleText);
1707 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1708 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1709 pGroupItemClass->SetEndTime(dateTime);
1710 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1711 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1712 pGroupItemClass->SetStartTime(dateTime);
1713 __pGroupData->Add(*pGroupItemClass);
1719 day = currentTime.GetDay();
1723 pGroupItemClass = new(std::nothrow) GroupItemClass();
1724 if (pGroupItemClass == null)
1729 pGroupItemClass->SetTitleText(weeksAgo2);
1730 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1731 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1732 pGroupItemClass->SetEndTime(dateTime);
1733 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1734 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1735 pGroupItemClass->SetStartTime(dateTime);
1736 __pGroupData->Add(*pGroupItemClass);
1738 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1740 pGroupItemClass = new(std::nothrow) GroupItemClass();
1741 if (pGroupItemClass == null)
1745 String weeksAgo3 = L"";
1746 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1747 pGroupItemClass->SetTitleText(weeksAgo3);
1748 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1749 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1750 pGroupItemClass->SetEndTime(dateTime);
1751 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1752 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1753 pGroupItemClass->SetStartTime(dateTime);
1754 __pGroupData->Add(*pGroupItemClass);
1758 pGroupItemClass = new(std::nothrow) GroupItemClass();
1759 if (pGroupItemClass == null)
1763 pGroupItemClass->SetTitleText(weeksAgo2);
1764 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1765 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1766 pGroupItemClass->SetEndTime(dateTime);
1767 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1768 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1769 pGroupItemClass->SetStartTime(dateTime);
1770 __pGroupData->Add(*pGroupItemClass);
1772 pGroupItemClass = new(std::nothrow) GroupItemClass();
1773 if (pGroupItemClass == null)
1778 pGroupItemClass->SetTitleText(weeksAgo3);
1779 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1780 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1781 pGroupItemClass->SetEndTime(dateTime);
1782 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1783 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1784 pGroupItemClass->SetStartTime(dateTime);
1785 __pGroupData->Add(*pGroupItemClass);
1787 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1789 pGroupItemClass = new(std::nothrow) GroupItemClass();
1790 if (pGroupItemClass == null)
1794 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1795 pGroupItemClass->SetTitleText(titleText);
1796 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1797 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1798 pGroupItemClass->SetEndTime(dateTime);
1799 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1800 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1801 pGroupItemClass->SetStartTime(dateTime);
1802 __pGroupData->Add(*pGroupItemClass);
1806 pGroupItemClass = new(std::nothrow) GroupItemClass();
1807 if (pGroupItemClass == null)
1811 pGroupItemClass->SetTitleText(weeksAgo2);
1812 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1813 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1814 pGroupItemClass->SetEndTime(dateTime);
1815 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1816 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1817 pGroupItemClass->SetStartTime(dateTime);
1818 __pGroupData->Add(*pGroupItemClass);
1820 pGroupItemClass = new(std::nothrow) GroupItemClass();
1821 if (pGroupItemClass == null)
1825 pGroupItemClass->SetTitleText(weeksAgo3);
1826 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1827 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1828 pGroupItemClass->SetEndTime(dateTime);
1829 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1830 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1831 pGroupItemClass->SetStartTime(dateTime);
1832 __pGroupData->Add(*pGroupItemClass);
1834 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1836 pGroupItemClass = new(std::nothrow) GroupItemClass();
1837 if (pGroupItemClass == null)
1841 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1842 pGroupItemClass->SetTitleText(titleText);
1843 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1844 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1845 pGroupItemClass->SetEndTime(dateTime);
1846 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1847 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1848 pGroupItemClass->SetStartTime(dateTime);
1849 __pGroupData->Add(*pGroupItemClass);
1855 pGroupItemClass = new(std::nothrow) GroupItemClass();
1856 if (pGroupItemClass == null)
1860 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_MONTH");
1861 pGroupItemClass->SetTitleText(titleText);
1862 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1863 dateTime.AddDays(-1);
1864 pGroupItemClass->SetEndTime(dateTime);
1865 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1866 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1867 pGroupItemClass->SetStartTime(dateTime);
1868 __pGroupData->Add(*pGroupItemClass);
1870 pGroupItemClass = new(std::nothrow) GroupItemClass();
1871 if (pGroupItemClass == null)
1875 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1876 pGroupItemClass->SetTitleText(titleText);
1877 dateTime.SetValue(currentTime.GetYear(),1, 1);
1878 dateTime.AddMonths(currentTime.GetMonth() - 2);
1879 dateTime.AddDays(-1);
1880 pGroupItemClass->SetEndTime(dateTime);
1882 dateTime2.SetValue(0, 0, 0);
1883 pGroupItemClass->SetStartTime(dateTime2);
1884 __pGroupData->Add(*pGroupItemClass);
1888 GroupItemClass::GroupItemClass()
1894 GroupItemClass::operator =(const GroupItemClass& rhs)
1898 __pData = rhs.__pData;
1903 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1905 __pData = groupItem.__pData;
1908 GroupItemClass::~GroupItemClass()
1912 __pData->RemoveAll(true);
1918 GroupItemClass::SetStartTime(DateTime& startTime)
1920 __startTime = startTime;
1924 GroupItemClass::SetEndTime(DateTime& endTime)
1926 __endTime = endTime;
1930 GroupItemClass::SetTitleText(String& titleText)
1932 __titleText = titleText;
1936 GroupItemClass::SetHistoryData(ArrayList* pData)
1942 GroupItemClass::GetStartTime(void)
1948 GroupItemClass::GetEndTime(void)
1954 GroupItemClass::GetTitleText(void)
1960 GroupItemClass::GetHistoryData(void)
1966 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1968 if (__pGroupedListView)
1970 __pGroupedListView->UpdateList();