2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 //!Internet HistoryListForm class
18 /*@file: HistoryListForm.cpp
19 *@brief: This class defines HistoryListForm used define history
25 #include "IntBookmarkData.h"
26 #include "IntBookmarkPresentationModel.h"
27 #include "IntCommonLib.h"
28 #include "IntFaviconManager.h"
29 #include "IntHistoryListForm.h"
30 #include "IntHistoryPresentationModel.h"
31 #include "IntMultipleWindowPresentationModel.h"
32 #include "IntSceneRegister.h"
35 using namespace Tizen::App;
36 using namespace Tizen::Base;
37 using namespace Tizen::Base::Collection;
38 using namespace Tizen::Base::Runtime;
39 using namespace Tizen::Graphics;
40 using namespace Tizen::Locales;
41 using namespace Tizen::Media;
42 using namespace Tizen::Ui;
43 using namespace Tizen::Ui::Controls;
44 using namespace Tizen::Ui::Scenes;
45 using namespace Tizen::System;
47 static const wchar_t* IDB_TAB_ICON_BOOKMARKS = L"I01_tab_icon_bookmarks.png";
48 static const wchar_t* IDB_TAB_ICON_HISTORY = L"I01_tab_icon_history.png";
49 static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png";
50 static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png";
53 const int HistoryListForm::IDA_TABBAR_ITEM_1 = 101;
54 const int HistoryListForm::IDA_TABBAR_ITEM_2 = 102;
55 const int HistoryListForm::IDA_EDIT_HISTORY_LIST_FORM = 103;
56 const int HistoryListForm::IDA_FORMAT_ICON = 104;
57 const int HistoryListForm::IDA_FORMAT_TITLE = 105;
58 const int HistoryListForm::IDA_FORMAT_URL = 106;
59 const int HistoryListForm::IDA_FORMAT_BOOKMARK = 107;
62 HistoryListForm::HistoryListForm(void)
64 __pBookmarkList = null;
65 __pGroupedListView =null;
66 __pSearchListView = null;
69 __pSearchedData = null ;
70 __searchHistory = false;
71 __isNoHistoryPresent = true;
73 __previousSceneId = L"";
76 HistoryListForm::~HistoryListForm(void)
78 if (__pGroupData != null)
80 __pGroupData->RemoveAll(false);
83 if(__pBookmarkList != null)
85 __pBookmarkList->RemoveAll(false);
86 delete __pBookmarkList;
88 if (__pSearchListView)
90 delete __pSearchListView;
91 __pSearchListView = null;
96 HistoryListForm::Initialize(void)
98 Construct(L"IDL_HISTORY_LIST");
104 HistoryListForm::OnInitializing(void)
106 AppLog("HistoryListForm::OnInitializing");
107 result r = E_SUCCESS;
108 SceneManager* pSceneManager = null;
111 Header *pHeader = GetHeader();
112 Bitmap *pIconBitmap = null;
113 AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
114 const Color brown = Color(32, 32, 32, 0xFF);
116 // Setup back event listener
117 SetFormBackEventListener(this);
119 GetHeader()->AddActionEventListener(*this);
120 GetFooter()->AddActionEventListener(*this);
122 AddOrientationEventListener(*this);
123 SettingInfo::AddSettingEventListener(*this);
125 pSceneManager = SceneManager::GetInstance();
126 if (pSceneManager != null)
128 pSceneManager->AddSceneEventListener(IDSCN_HISTORY_LIST, *this);
131 if (pAppResource == null)
136 __pGroupedListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1"));
137 if (__pGroupedListView == null)
142 r = __pGroupedListView->SetItemProvider(*this);
149 __pSearchBar = static_cast< SearchBar* >(GetControl(L"IDC_SEARCHBAR1"));
150 if (__pSearchBar == null)
154 __pSearchListView = new(std::nothrow) GroupedListView();
155 if (__pSearchListView == null)
160 __pGroupedListView->AddGroupedListViewItemEventListener(*this);
161 r = __pGroupedListView->SetBounds(Rectangle(0,__pGroupedListView->GetY(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
166 r = __pSearchListView->Construct(Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height -__pSearchBar->GetHeight() - __pSearchBar->GetY()), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
171 r = __pSearchListView->SetItemProvider(*this);
176 r = __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND"));
183 __pSearchListView->SetBackgroundColor(GetBackgroundColor());
184 __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK));
185 __pSearchListView->AddGroupedListViewItemEventListener(*this);
186 r = __pSearchListView->SetShowState(false);
193 __pSearchBar->AddSearchBarEventListener(*this);
194 __pSearchBar->AddKeypadEventListener(*this);
195 r = __pSearchBar->SetContent(__pSearchListView);
199 pHeader->SetStyle(HEADER_STYLE_TAB);
200 bookmark.Construct(IDA_TABBAR_ITEM_1);
202 pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark);
203 bookmark.SetText(strbookmark);
204 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARKS);
205 bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
206 bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
207 pHeader->AddItem(bookmark);
215 history.Construct(IDA_TABBAR_ITEM_2);
217 pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory);
218 history.SetText(strhistory);
219 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY);
220 history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
221 history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
222 pHeader->AddItem(history);
223 pHeader->SetItemSelected(1);
224 pHeader->SetTabEditModeEnabled(false);
226 if (pIconBitmap != NULL)
232 __pBookmarkList = new(std::nothrow) Collection::ArrayList();
233 __pBookmarkList->Construct();
234 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
239 HistoryListForm::OnTerminating(void)
241 result r = E_SUCCESS;
243 SettingInfo::RemoveSettingEventListener(*this);
248 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
250 AppLog("HistoryListForm::OnActionPerformed");
251 result r = E_FAILURE;
252 SceneManager* pSceneManager = SceneManager::GetInstance();
253 if (pSceneManager == null)
259 case IDA_EDIT_HISTORY_LIST_FORM:
261 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
262 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
269 case IDA_TABBAR_ITEM_1:
271 result r = GetHeader()->SetItemSelected(1);
272 AppLog("SetItemSelected result %s",GetErrorMessage(r));
273 GetHeader()->Invalidate(true);
275 if (pSceneManager != null)
277 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
279 if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)) != E_SUCCESS)
281 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
288 if(pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT))!= E_SUCCESS)
290 AppLogDebug("BookmarkListForm::OnActionPerformed GoBackward failed");
296 // r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
309 HistoryListForm::OnFormBackRequested(Form& source)
311 SceneManager* pSceneManager = SceneManager::GetInstance();
312 if (pSceneManager == null)
316 result r = E_FAILURE;
317 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
319 r = pSceneManager->GoBackward(BackwardSceneTransition());
323 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
327 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
332 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
334 result r = E_FAILURE;
340 GroupItem* pItem = null;
341 GroupItemClass* pGroupItemClass = null;
343 String weeksAgo2 = L"";
344 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
346 String weeksAgo3 = L"";
347 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
349 String weeksAgo4 = L"";
350 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),4);
352 pItem = new(std::nothrow) GroupItem();
357 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
359 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
361 AppLog("CreateGroupItem :: if history is null");
362 r = pItem->Construct(Dimension(itemWidth, 0));
367 r = pItem->Construct(Dimension(itemWidth, 48));
369 text = pGroupItemClass->GetTitleText();
371 if (__searchHistory == false)
375 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
378 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
379 if ( pGregorianCalendar != NULL)
381 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
388 delete pGregorianCalendar;
391 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
398 delete pGregorianCalendar;
401 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
408 delete pGregorianCalendar;
411 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
413 delete pGregorianCalendar;
419 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
422 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
425 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
428 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
431 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
434 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
437 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
445 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
447 text.Append(pGroupItemClass->GetStartTime().GetDay());
449 strMonth = pGroupItemClass->GetStartTime().GetMonth();
450 month = GetMonth(strMonth);
460 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
461 || pGroupItemClass->GetTitleText() == weeksAgo3 || pGroupItemClass->GetTitleText() == weeksAgo4 || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
464 text.Append(pGroupItemClass->GetEndTime().GetDay());
466 strMonth = pGroupItemClass->GetEndTime().GetMonth();
467 month = GetMonth(strMonth);
473 r = pItem->SetElement(text, null);
477 AppLogDebug("Failed with %s", GetErrorMessage(r));
480 r = pItem->SetTextSize(32);
491 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
493 AppLog("HistoryListForm::CreateItem");
494 result r = E_FAILURE;
495 History* pHistory = null;
496 Bitmap* pBitmap = null;
497 Bitmap* pBookmarkBitmap = null;
498 GroupItemClass* pGroupItemClass = null;
499 CustomItem* pItem = new(std::nothrow) CustomItem();
500 int bookmarkBtnWidth = 0;
503 Image* pImage = null;
504 pImage = new Image();
507 if(__pGroupData == null)
517 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
518 if (pGroupItemClass == null)
523 if (pGroupItemClass->GetHistoryData() == null)
528 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
529 if (pHistory == null)
534 r = pItem->Construct(Dimension(itemWidth, 128), LIST_ANNEX_STYLE_NORMAL);
541 ByteBuffer* pFavIconBuffer = null;
542 pFavIconBuffer = pHistory->GetFavIconBuffer();
544 AppLog("BookmarkListForm::CreateItem check 0");
546 if (pFavIconBuffer != null)
548 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is not null");
552 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is null");
555 pBitmap = pImage->DecodeN(*pFavIconBuffer, IMG_FORMAT_PNG, BITMAP_PIXEL_FORMAT_ARGB8888);
557 AppLog("BookmarkListForm::CreateItem check 1");
559 //bitmapId = pHistory->GetFaviconId() ;
560 //pBitmap = pHistory->GetFavIconBitmap();
564 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
568 r = pItem->AddElement(Rectangle(16, 28,72, 72), IDA_FORMAT_ICON, *pBitmap, null);
573 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
577 bool urlFoundInBookmark = false;
579 if(__pBookmarkList != null)
581 for (int i = 0; i < __pBookmarkList->GetCount();i++)
583 BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
584 if(pBookMark != null && pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
586 urlFoundInBookmark = true;
591 if (urlFoundInBookmark == true)
593 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
597 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
599 bookmarkBtnWidth = 64;
602 r = pItem->AddElement(Rectangle(104, 10, GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 60), IDA_FORMAT_TITLE, pHistory->GetHistoryTitle(), 44,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true);
603 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
605 // if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
606 // 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);
608 r = pItem->AddElement(Rectangle(104, 70, GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 48), IDA_FORMAT_URL, pHistory->GetHistoryUrl(),32,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,true);
609 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
610 if ( pBookmarkBitmap != null)
612 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
613 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
614 delete pBookmarkBitmap;
625 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
634 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
636 AppLog("HistoryListForm::DeleteItem");
637 result r = E_FAILURE;
638 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
639 if (pGroupItemClass == null)
644 // if (pGroupItemClass->__pData != null)
646 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
659 HistoryListForm::GetGroupCount(void)
661 __isNoHistoryPresent = true;
663 if (__pGroupData != null)
665 if (__searchHistory == false)
668 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
673 return __pGroupData->GetCount();
678 // String searchText = __pSearchBar->GetText();
679 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
693 HistoryListForm::GetItemCount(int groupIndex)
695 result r = E_FAILURE;
701 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
702 if (pGroupItemClass == null)
706 if (__searchHistory == false)
708 startTime = pGroupItemClass->GetStartTime();
709 endTime = pGroupItemClass->GetEndTime();
710 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
714 //text = __pSearchBar->GetText();
715 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
726 ArrayList* pData = new(std::nothrow) ArrayList();
731 r = pData->Construct();
739 if (__searchHistory == false)
741 startTime = pGroupItemClass->GetStartTime();
742 endTime = pGroupItemClass->GetEndTime();
743 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
744 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
748 //text = __pSearchBar->GetText() ;
749 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
756 pGroupItemClass->SetHistoryData(pData);
759 if (__isNoHistoryPresent == true && count == 0)
761 __isNoHistoryPresent = true;
762 GetFooter()->SetItemEnabled(0, false);
766 __isNoHistoryPresent = false;
767 GetFooter()->SetItemEnabled(0, true);
769 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
770 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
777 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
778 return pGroupItemClass->GetHistoryData()->GetCount();
783 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
786 GetHeader()->SetItemSelected(1);
787 // __previousSceneId = previousSceneId;
788 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
791 pList->GetAt(pList->GetCount()-1,__previousSceneId);
794 if(__pBookmarkList != null)
796 __pBookmarkList->RemoveAll(false);
799 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
801 AppLog("HistoryListForm::OnSceneActivatedN called");
802 //GetHeader()->Invalidate(true);
803 if (__pGroupData == null)
805 __pGroupData = new(std::nothrow) ArrayList();
806 __pGroupData->Construct();
808 if (__pGroupedListView != null)
810 __pGroupedListView->UpdateList();
812 if (__isNoHistoryPresent == true)
814 GetFooter()->SetItemEnabled(0, false);
818 GetFooter()->SetItemEnabled(0, true);
822 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
825 __pSearchBar->SetShowState(false);
826 __pSearchBar->Invalidate(true);
830 __pSearchBar->SetShowState(true);
831 __pSearchBar->Invalidate(true);
834 // if (__isNoHistoryPresent == true)
836 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
837 // __pGroupedListView->UpdateList();
840 result r = GetHeader()->SetItemSelected(2);
843 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
854 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
856 AppLog("HistoryListForm::OnSceneDeactivated");
857 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
861 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
867 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
869 GroupItemClass* pGroupItemClass = null;
870 History* pHistory = null;
871 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
872 if (elementId == IDA_FORMAT_BOOKMARK)
874 String toggledUrl = L"";
875 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
876 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
877 if (pGroupItemClass == null)
881 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
882 if (pHistory == null)
886 toggledUrl = pHistory->GetHistoryUrl();
888 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
890 bool bookmarkFound = false;
891 BookmarkData* pBookMark = null;
892 if(__pBookmarkList != null)
894 for (int i = 0; i < __pBookmarkList->GetCount(); i++)
896 pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
897 if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
899 bookmarkFound = true;
904 if(bookmarkFound == false)
906 // Add the history in bookmark database
907 result r = E_FAILURE;
908 BookmarkData bookmark;
910 String bookmarkTitle = pHistory->GetHistoryTitle();
912 bookmark.SetBookmarkTitle(bookmarkTitle);
913 bookmark.SetUrl(pHistory->GetHistoryUrl());
914 bookmark.SetFaviconId(pHistory->GetFaviconId());
915 bookmark.SetFavIconBuffer(*pHistory->GetFavIconBuffer());
916 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
917 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(bookmark);
921 // remove the history from bookmark database
922 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
925 if(__pBookmarkList != null)
927 __pBookmarkList->RemoveAll(false);
928 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
930 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
931 listView.UpdateList();
935 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
936 if (pGroupItemClass == null)
941 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
942 if (pHistory1 == null)
946 SceneManager* pSceneManager = SceneManager::GetInstance();
947 ArrayList *pArgList = null;
948 result r = E_SUCCESS;
949 pArgList = new(std::nothrow) ArrayList();
950 if (pArgList != null)
952 r = pArgList->Construct();
959 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
960 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
971 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
973 if (pSceneManager != null)
975 AppLog("pSceneManager exists");
976 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
979 pArgList->RemoveAll(false);
992 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
998 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
1000 result r = E_FAILURE;
1001 if (mode == SEARCH_BAR_MODE_NORMAL)
1003 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1005 __pSearchListView->SetEnabled(true);
1008 r = __pSearchListView->SetShowState(false);
1013 r = __pGroupedListView->SetShowState(true);
1019 __pSearchListView->SetEnabled(true);
1020 if(__pSearchBar != null)
1021 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1023 __searchHistory = false;
1024 r = __pGroupedListView->UpdateList();
1025 if (__isNoHistoryPresent == true)
1027 GetFooter()->SetItemEnabled(0, false);
1031 GetFooter()->SetItemEnabled(0, true);
1033 if(__pSearchBar != null)
1035 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1045 // __pSearchListView->SetEnabled(false);
1046 r = __pSearchListView->SetShowState(true);
1051 __pSearchListView->SetEnabled(false);
1052 r = __pSearchListView->UpdateList();
1057 r = __pGroupedListView->SetShowState(false);
1062 if(__pSearchBar != null)
1064 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1070 HistoryListForm::GetMonth(int month)
1072 String monthValue = L"";
1076 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1079 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1082 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1085 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1088 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1091 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN"));
1094 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1097 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));
1100 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1103 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1106 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1109 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1120 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1122 result r = E_FAILURE;
1123 if (__pSearchBar != null)
1125 __pSearchBar->HideKeypad();
1128 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1130 __pSearchListView->SetEnabled(true);
1131 __searchHistory = true;
1132 __searchText =__pSearchBar->GetText();
1134 r = __pGroupedListView->SetShowState(false);
1139 r = __pSearchListView->SetShowState(true);
1144 r= __pSearchListView->UpdateList();
1145 if (__isNoHistoryPresent == true)
1147 GetFooter()->SetItemEnabled(0, false);
1151 GetFooter()->SetItemEnabled(0, true);
1153 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1162 __searchHistory = false;
1168 HistoryListForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1170 FloatRectangle clientRect;
1171 clientRect = GetClientAreaBoundsF();
1172 AppLogDebug("SearchBarForm::OnKeypadBoundsChanged ClientBounds(%f, %f, %f, %f)",clientRect.x, clientRect.y, clientRect.width, clientRect.height);
1173 __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1174 __pSearchListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1175 __pGroupedListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1176 // __pGroupedListView->SetEnabled(false);
1181 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1183 result r = E_FAILURE;
1184 if (__pGroupedListView != null)
1186 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1187 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1188 else if(__pSearchBar != null)
1189 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1194 __pGroupedListView->UpdateList();
1196 if (__pSearchListView != null)
1198 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1204 __pSearchListView->UpdateList();
1206 if(__pSearchBar != null)
1207 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1212 if (__isNoHistoryPresent == true)
1214 GetFooter()->SetItemEnabled(0, false);
1218 GetFooter()->SetItemEnabled(0, true);
1223 HistoryListForm::OnKeypadWillOpen(Control& source)
1225 GetFooter()->SetShowState(false);
1226 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1227 __pSearchListView->SetEnabled(false);
1228 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1234 HistoryListForm::OnKeypadOpened(Control& source)
1236 // this is added because some time footer is shown when key pad is opened, do not remove
1237 GetFooter()->SetShowState(false);
1238 GetFooter()->Invalidate(true);
1239 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1243 HistoryListForm::OnKeypadClosed(Control& source)
1245 if(Clipboard::GetInstance()->IsPopupVisible() == true)
1249 GetFooter()->SetShowState(true);
1250 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1251 __pSearchListView->Invalidate(false);
1252 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1253 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1258 HistoryListForm::CreateGroupItems()
1260 result r = E_FAILURE;
1261 DateTime currentTime;
1263 GroupItemClass* pGroupItemClass = null;
1266 String weeksAgo2 = L"";
1267 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
1269 String weeksAgo3 = L"";
1270 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1272 if (__pGroupData != null)
1274 __pGroupData->RemoveAll(false);
1275 delete __pGroupData;
1276 __pGroupData = null;
1278 __pGroupData = new(std::nothrow) ArrayList();
1279 if (__pGroupData == null)
1283 r = __pGroupData->Construct();
1286 delete __pGroupData;
1287 __pGroupData = null;
1290 if (__searchHistory == true)
1292 pGroupItemClass = new(std::nothrow) GroupItemClass();
1293 if (pGroupItemClass == null)
1297 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1298 pGroupItemClass->SetTitleText(titleText);
1299 r = __pGroupData->Add(*pGroupItemClass);
1307 Calendar* pGregorianCalendar = null;
1310 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1311 pGroupItemClass = new(std::nothrow) GroupItemClass();
1312 if (pGroupItemClass == null)
1316 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1317 pGroupItemClass->SetTitleText(titleText);
1318 pGroupItemClass->SetEndTime(currentTime);
1319 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1320 pGroupItemClass->SetStartTime(dateTime);
1321 __pGroupData->Add(*pGroupItemClass);
1324 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1325 if ( pGregorianCalendar != NULL )
1327 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1328 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1329 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1330 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1331 delete pGregorianCalendar;
1336 pGroupItemClass = new(std::nothrow) GroupItemClass();
1337 if (pGroupItemClass == null)
1341 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1342 pGroupItemClass->SetTitleText(titleText);
1343 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1344 pGroupItemClass->SetEndTime(dateTime);
1345 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1346 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1347 pGroupItemClass->SetStartTime(dateTime);
1348 __pGroupData->Add(*pGroupItemClass);
1351 pGroupItemClass = new(std::nothrow) GroupItemClass();
1352 if (pGroupItemClass == null)
1356 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1357 pGroupItemClass->SetTitleText(titleText);
1358 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1359 pGroupItemClass->SetEndTime(dateTime);
1360 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1361 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1362 pGroupItemClass->SetStartTime(dateTime);
1363 __pGroupData->Add(*pGroupItemClass);
1366 pGroupItemClass = new(std::nothrow) GroupItemClass();
1367 if (pGroupItemClass == null)
1371 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1372 pGroupItemClass->SetTitleText(titleText);
1373 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1374 pGroupItemClass->SetEndTime(dateTime);
1375 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1376 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1377 pGroupItemClass->SetStartTime(dateTime);
1378 __pGroupData->Add(*pGroupItemClass);
1380 pGroupItemClass = new(std::nothrow) GroupItemClass();
1381 if (pGroupItemClass == null)
1385 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1386 pGroupItemClass->SetTitleText(titleText);
1387 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1388 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1389 pGroupItemClass->SetEndTime(dateTime);
1390 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1391 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1392 pGroupItemClass->SetStartTime(dateTime);
1393 __pGroupData->Add(*pGroupItemClass);
1396 pGroupItemClass = new(std::nothrow) GroupItemClass();
1397 if (pGroupItemClass == null)
1401 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1402 pGroupItemClass->SetTitleText(titleText);
1403 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1404 pGroupItemClass->SetEndTime(dateTime);
1405 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1406 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1407 pGroupItemClass->SetStartTime(dateTime);
1408 __pGroupData->Add(*pGroupItemClass);
1410 pGroupItemClass = new(std::nothrow) GroupItemClass();
1411 if (pGroupItemClass == null)
1415 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1416 pGroupItemClass->SetTitleText(titleText);
1417 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1418 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1419 pGroupItemClass->SetEndTime(dateTime);
1420 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1421 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1422 pGroupItemClass->SetStartTime(dateTime);
1423 __pGroupData->Add(*pGroupItemClass);
1425 pGroupItemClass = new(std::nothrow) GroupItemClass();
1426 if (pGroupItemClass == null)
1430 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1431 pGroupItemClass->SetTitleText(titleText);
1432 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1433 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1434 pGroupItemClass->SetEndTime(dateTime);
1435 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1436 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1437 pGroupItemClass->SetStartTime(dateTime);
1438 __pGroupData->Add(*pGroupItemClass);
1441 pGroupItemClass = new(std::nothrow) GroupItemClass();
1442 if (pGroupItemClass == null)
1446 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1447 pGroupItemClass->SetTitleText(titleText);
1448 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1449 pGroupItemClass->SetEndTime(dateTime);
1450 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1451 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1452 pGroupItemClass->SetStartTime(dateTime);
1453 __pGroupData->Add(*pGroupItemClass);
1455 pGroupItemClass = new(std::nothrow) GroupItemClass();
1456 if (pGroupItemClass == null)
1460 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1461 pGroupItemClass->SetTitleText(titleText);
1462 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1463 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1464 pGroupItemClass->SetEndTime(dateTime);
1465 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1466 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1467 pGroupItemClass->SetStartTime(dateTime);
1468 __pGroupData->Add(*pGroupItemClass);
1470 pGroupItemClass = new(std::nothrow) GroupItemClass();
1471 if (pGroupItemClass == null)
1475 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1476 pGroupItemClass->SetTitleText(titleText);
1477 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1478 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1479 pGroupItemClass->SetEndTime(dateTime);
1480 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1481 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1482 pGroupItemClass->SetStartTime(dateTime);
1483 __pGroupData->Add(*pGroupItemClass);
1485 pGroupItemClass = new(std::nothrow) GroupItemClass();
1486 if (pGroupItemClass == null)
1490 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1491 pGroupItemClass->SetTitleText(titleText);
1492 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1493 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1494 pGroupItemClass->SetEndTime(dateTime);
1495 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1496 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1497 pGroupItemClass->SetStartTime(dateTime);
1498 __pGroupData->Add(*pGroupItemClass);
1501 pGroupItemClass = new(std::nothrow) GroupItemClass();
1502 if (pGroupItemClass == null)
1506 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1507 pGroupItemClass->SetTitleText(titleText);
1508 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1509 pGroupItemClass->SetEndTime(dateTime);
1510 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1511 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1512 pGroupItemClass->SetStartTime(dateTime);
1513 __pGroupData->Add(*pGroupItemClass);
1515 pGroupItemClass = new(std::nothrow) GroupItemClass();
1516 if (pGroupItemClass == null)
1520 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1521 pGroupItemClass->SetTitleText(titleText);
1522 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1523 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1524 pGroupItemClass->SetEndTime(dateTime);
1525 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1526 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1527 pGroupItemClass->SetStartTime(dateTime);
1528 __pGroupData->Add(*pGroupItemClass);
1530 pGroupItemClass = new(std::nothrow) GroupItemClass();
1531 if (pGroupItemClass == null)
1535 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1536 pGroupItemClass->SetTitleText(titleText);
1537 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1538 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1539 pGroupItemClass->SetEndTime(dateTime);
1540 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1541 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1542 pGroupItemClass->SetStartTime(dateTime);
1543 __pGroupData->Add(*pGroupItemClass);
1545 pGroupItemClass = new(std::nothrow) GroupItemClass();
1546 if (pGroupItemClass == null)
1550 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1551 pGroupItemClass->SetTitleText(titleText);
1552 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1553 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1554 pGroupItemClass->SetEndTime(dateTime);
1555 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1556 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1557 pGroupItemClass->SetStartTime(dateTime);
1558 __pGroupData->Add(*pGroupItemClass);
1560 pGroupItemClass = new(std::nothrow) GroupItemClass();
1561 if (pGroupItemClass == null)
1565 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1566 pGroupItemClass->SetTitleText(titleText);
1567 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1568 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1569 pGroupItemClass->SetEndTime(dateTime);
1570 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1571 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1572 pGroupItemClass->SetStartTime(dateTime);
1573 __pGroupData->Add(*pGroupItemClass);
1576 pGroupItemClass = new(std::nothrow) GroupItemClass();
1577 if (pGroupItemClass == null)
1581 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1582 pGroupItemClass->SetTitleText(titleText);
1583 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1584 pGroupItemClass->SetEndTime(dateTime);
1585 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1586 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1587 pGroupItemClass->SetStartTime(dateTime);
1588 __pGroupData->Add(*pGroupItemClass);
1590 pGroupItemClass = new(std::nothrow) GroupItemClass();
1591 if (pGroupItemClass == null)
1595 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1596 pGroupItemClass->SetTitleText(titleText);
1597 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1598 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1599 pGroupItemClass->SetEndTime(dateTime);
1600 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1601 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1602 pGroupItemClass->SetStartTime(dateTime);
1603 __pGroupData->Add(*pGroupItemClass);
1605 pGroupItemClass = new(std::nothrow) GroupItemClass();
1606 if (pGroupItemClass == null)
1610 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1611 pGroupItemClass->SetTitleText(titleText);
1612 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1613 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1614 pGroupItemClass->SetEndTime(dateTime);
1615 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1616 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1617 pGroupItemClass->SetStartTime(dateTime);
1618 __pGroupData->Add(*pGroupItemClass);
1620 pGroupItemClass = new(std::nothrow) GroupItemClass();
1621 if (pGroupItemClass == null)
1625 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1626 pGroupItemClass->SetTitleText(titleText);
1627 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1628 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1629 pGroupItemClass->SetEndTime(dateTime);
1630 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1631 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1632 pGroupItemClass->SetStartTime(dateTime);
1633 __pGroupData->Add(*pGroupItemClass);
1635 pGroupItemClass = new(std::nothrow) GroupItemClass();
1636 if (pGroupItemClass == null)
1640 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1641 pGroupItemClass->SetTitleText(titleText);
1642 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1643 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1644 pGroupItemClass->SetEndTime(dateTime);
1645 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1646 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1647 pGroupItemClass->SetStartTime(dateTime);
1648 __pGroupData->Add(*pGroupItemClass);
1650 pGroupItemClass = new(std::nothrow) GroupItemClass();
1651 if (pGroupItemClass == null)
1655 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1656 pGroupItemClass->SetTitleText(titleText);
1657 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1658 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1659 pGroupItemClass->SetEndTime(dateTime);
1660 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1661 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1662 pGroupItemClass->SetStartTime(dateTime);
1663 __pGroupData->Add(*pGroupItemClass);
1669 day = currentTime.GetDay();
1673 pGroupItemClass = new(std::nothrow) GroupItemClass();
1674 if (pGroupItemClass == null)
1679 pGroupItemClass->SetTitleText(weeksAgo2);
1680 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1681 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1682 pGroupItemClass->SetEndTime(dateTime);
1683 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1684 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1685 pGroupItemClass->SetStartTime(dateTime);
1686 __pGroupData->Add(*pGroupItemClass);
1688 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1690 pGroupItemClass = new(std::nothrow) GroupItemClass();
1691 if (pGroupItemClass == null)
1695 String weeksAgo3 = L"";
1696 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1697 pGroupItemClass->SetTitleText(weeksAgo3);
1698 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1699 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1700 pGroupItemClass->SetEndTime(dateTime);
1701 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1702 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1703 pGroupItemClass->SetStartTime(dateTime);
1704 __pGroupData->Add(*pGroupItemClass);
1708 pGroupItemClass = new(std::nothrow) GroupItemClass();
1709 if (pGroupItemClass == null)
1713 pGroupItemClass->SetTitleText(weeksAgo2);
1714 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1715 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1716 pGroupItemClass->SetEndTime(dateTime);
1717 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1718 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1719 pGroupItemClass->SetStartTime(dateTime);
1720 __pGroupData->Add(*pGroupItemClass);
1722 pGroupItemClass = new(std::nothrow) GroupItemClass();
1723 if (pGroupItemClass == null)
1728 pGroupItemClass->SetTitleText(weeksAgo3);
1729 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1730 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1731 pGroupItemClass->SetEndTime(dateTime);
1732 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1733 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1734 pGroupItemClass->SetStartTime(dateTime);
1735 __pGroupData->Add(*pGroupItemClass);
1737 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1739 pGroupItemClass = new(std::nothrow) GroupItemClass();
1740 if (pGroupItemClass == null)
1744 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1745 pGroupItemClass->SetTitleText(titleText);
1746 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1747 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1748 pGroupItemClass->SetEndTime(dateTime);
1749 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1750 //dateTime.AddDays(currentTime.GetDay() - 28 - 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)
1775 pGroupItemClass->SetTitleText(weeksAgo3);
1776 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1777 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1778 pGroupItemClass->SetEndTime(dateTime);
1779 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1780 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1781 pGroupItemClass->SetStartTime(dateTime);
1782 __pGroupData->Add(*pGroupItemClass);
1784 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1786 pGroupItemClass = new(std::nothrow) GroupItemClass();
1787 if (pGroupItemClass == null)
1791 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1792 pGroupItemClass->SetTitleText(titleText);
1793 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1794 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1795 pGroupItemClass->SetEndTime(dateTime);
1796 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1797 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1798 pGroupItemClass->SetStartTime(dateTime);
1799 __pGroupData->Add(*pGroupItemClass);
1805 pGroupItemClass = new(std::nothrow) GroupItemClass();
1806 if (pGroupItemClass == null)
1810 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1811 pGroupItemClass->SetTitleText(titleText);
1812 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1813 dateTime.AddDays(-1);
1814 pGroupItemClass->SetEndTime(dateTime);
1815 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1816 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1817 pGroupItemClass->SetStartTime(dateTime);
1818 __pGroupData->Add(*pGroupItemClass);
1820 pGroupItemClass = new(std::nothrow) GroupItemClass();
1821 if (pGroupItemClass == null)
1825 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1826 pGroupItemClass->SetTitleText(titleText);
1827 dateTime.SetValue(currentTime.GetYear(),1, 1);
1828 dateTime.AddMonths(currentTime.GetMonth() - 2);
1829 dateTime.AddDays(-1);
1830 pGroupItemClass->SetEndTime(dateTime);
1832 dateTime2.SetValue(0, 0, 0);
1833 pGroupItemClass->SetStartTime(dateTime2);
1834 __pGroupData->Add(*pGroupItemClass);
1838 GroupItemClass::GroupItemClass()
1844 GroupItemClass::operator =(const GroupItemClass& rhs)
1848 __pData = rhs.__pData;
1853 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1855 __pData = groupItem.__pData;
1858 GroupItemClass::~GroupItemClass()
1862 __pData->RemoveAll(true);
1868 GroupItemClass::SetStartTime(DateTime& startTime)
1870 __startTime = startTime;
1874 GroupItemClass::SetEndTime(DateTime& endTime)
1876 __endTime = endTime;
1880 GroupItemClass::SetTitleText(String& titleText)
1882 __titleText = titleText;
1886 GroupItemClass::SetHistoryData(ArrayList* pData)
1892 GroupItemClass::GetStartTime(void)
1898 GroupItemClass::GetEndTime(void)
1904 GroupItemClass::GetTitleText(void)
1910 GroupItemClass::GetHistoryData(void)
1916 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1918 if (__pGroupedListView)
1920 __pGroupedListView->UpdateList();