2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (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::Ui;
42 using namespace Tizen::Ui::Controls;
43 using namespace Tizen::Ui::Scenes;
44 using namespace Tizen::System;
46 static const wchar_t* IDB_TAB_ICON_BOOKMARKS = L"I01_tab_icon_bookmarks.png";
47 static const wchar_t* IDB_TAB_ICON_HISTORY = L"I01_tab_icon_history.png";
48 static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png";
49 static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png";
52 const int HistoryListForm::IDA_TABBAR_ITEM_1 = 101;
53 const int HistoryListForm::IDA_TABBAR_ITEM_2 = 102;
54 const int HistoryListForm::IDA_EDIT_HISTORY_LIST_FORM = 103;
55 const int HistoryListForm::IDA_FORMAT_ICON = 104;
56 const int HistoryListForm::IDA_FORMAT_TITLE = 105;
57 const int HistoryListForm::IDA_FORMAT_URL = 106;
58 const int HistoryListForm::IDA_FORMAT_BOOKMARK = 107;
61 HistoryListForm::HistoryListForm(void)
63 __pBookmarkList = null;
64 __pGroupedListView =null;
65 __pSearchListView = null;
68 __pSearchedData = null ;
69 __searchHistory = false;
70 __isNoHistoryPresent = true;
72 __previousSceneId = L"";
75 HistoryListForm::~HistoryListForm(void)
77 if (__pGroupData != null)
79 __pGroupData->RemoveAll(false);
82 if(__pBookmarkList != null)
84 __pBookmarkList->RemoveAll(false);
85 delete __pBookmarkList;
90 HistoryListForm::Initialize(void)
92 Construct(L"IDL_HISTORY_LIST");
98 HistoryListForm::OnInitializing(void)
100 AppLog("HistoryListForm::OnInitializing");
101 result r = E_SUCCESS;
102 SceneManager* pSceneManager = null;
105 Header *pHeader = GetHeader();
106 Bitmap *pIconBitmap = null;
107 AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
108 const Color brown = Color(32, 32, 32, 0xFF);
110 // Setup back event listener
111 SetFormBackEventListener(this);
113 GetHeader()->AddActionEventListener(*this);
114 GetFooter()->AddActionEventListener(*this);
116 AddOrientationEventListener(*this);
117 SettingInfo::AddSettingEventListener(*this);
119 pSceneManager = SceneManager::GetInstance();
120 if (pSceneManager != null)
122 pSceneManager->AddSceneEventListener(IDSCN_HISTORY_LIST, *this);
125 if (pAppResource == null)
130 __pGroupedListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1"));
131 if (__pGroupedListView == null)
136 r = __pGroupedListView->SetItemProvider(*this);
143 __pSearchBar = static_cast< SearchBar* >(GetControl(L"IDC_SEARCHBAR1"));
144 if (__pSearchBar == null)
148 __pSearchListView = new(std::nothrow) GroupedListView();
149 if (__pSearchListView == null)
154 __pGroupedListView->AddGroupedListViewItemEventListener(*this);
155 r = __pGroupedListView->SetBounds(Rectangle(0,__pGroupedListView->GetY(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
160 r = __pSearchListView->Construct(Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height -__pSearchBar->GetHeight() - __pSearchBar->GetY()), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
165 r = __pSearchListView->SetItemProvider(*this);
170 r = __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND"));
177 __pSearchListView->SetBackgroundColor(GetBackgroundColor());
178 __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK));
179 __pSearchListView->AddGroupedListViewItemEventListener(*this);
180 r = __pSearchListView->SetShowState(false);
187 __pSearchBar->AddSearchBarEventListener(*this);
188 __pSearchBar->AddKeypadEventListener(*this);
189 r = __pSearchBar->SetContent(__pSearchListView);
193 pHeader->SetStyle(HEADER_STYLE_TAB);
194 bookmark.Construct(IDA_TABBAR_ITEM_1);
196 pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark);
197 bookmark.SetText(strbookmark);
198 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARKS);
199 bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
200 bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
201 pHeader->AddItem(bookmark);
209 history.Construct(IDA_TABBAR_ITEM_2);
211 pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory);
212 history.SetText(strhistory);
213 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY);
214 history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
215 history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
216 pHeader->AddItem(history);
217 pHeader->SetItemSelected(1);
218 pHeader->SetTabEditModeEnabled(false);
220 if (pIconBitmap != NULL)
226 __pBookmarkList = new(std::nothrow) Collection::ArrayList();
227 __pBookmarkList->Construct();
228 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
233 HistoryListForm::OnTerminating(void)
235 result r = E_SUCCESS;
241 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
243 AppLog("HistoryListForm::OnActionPerformed");
244 result r = E_FAILURE;
245 SceneManager* pSceneManager = SceneManager::GetInstance();
246 if (pSceneManager == null)
252 case IDA_EDIT_HISTORY_LIST_FORM:
254 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
255 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
262 case IDA_TABBAR_ITEM_1:
264 result r = GetHeader()->SetItemSelected(1);
265 AppLog("SetItemSelected result %s",GetErrorMessage(r));
266 GetHeader()->Invalidate(true);
268 if (pSceneManager != null)
270 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
272 if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)) != E_SUCCESS)
274 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
281 if(pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT))!= E_SUCCESS)
283 AppLogDebug("BookmarkListForm::OnActionPerformed GoBackward failed");
289 // r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
302 HistoryListForm::OnFormBackRequested(Form& source)
304 SceneManager* pSceneManager = SceneManager::GetInstance();
305 if (pSceneManager == null)
309 result r = E_FAILURE;
310 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
312 r = pSceneManager->GoBackward(BackwardSceneTransition());
316 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
320 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
325 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
327 result r = E_FAILURE;
333 GroupItem* pItem = null;
334 GroupItemClass* pGroupItemClass = null;
336 String weeksAgo2 = L"";
337 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
339 String weeksAgo3 = L"";
340 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
342 String weeksAgo4 = L"";
343 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),4);
345 pItem = new(std::nothrow) GroupItem();
350 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
352 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
354 AppLog("CreateGroupItem :: if history is null");
355 r = pItem->Construct(Dimension(itemWidth, 0));
360 r = pItem->Construct(Dimension(itemWidth, 48));
362 text = pGroupItemClass->GetTitleText();
364 if (__searchHistory == false)
368 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
371 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
372 if ( pGregorianCalendar != NULL)
374 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
381 delete pGregorianCalendar;
384 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
391 delete pGregorianCalendar;
394 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
401 delete pGregorianCalendar;
404 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
406 delete pGregorianCalendar;
412 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
415 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
418 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
421 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
424 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
427 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
430 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
438 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
440 text.Append(pGroupItemClass->GetStartTime().GetDay());
442 strMonth = pGroupItemClass->GetStartTime().GetMonth();
443 month = GetMonth(strMonth);
453 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
454 || 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"))
457 text.Append(pGroupItemClass->GetEndTime().GetDay());
459 strMonth = pGroupItemClass->GetEndTime().GetMonth();
460 month = GetMonth(strMonth);
466 r = pItem->SetElement(text, null);
470 AppLogDebug("Failed with %s", GetErrorMessage(r));
473 r = pItem->SetTextSize(32);
484 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
486 AppLog("HistoryListForm::CreateItem");
487 result r = E_FAILURE;
488 History* pHistory = null;
489 Bitmap* pBitmap = null;
490 Bitmap* pBookmarkBitmap = null;
491 GroupItemClass* pGroupItemClass = null;
492 CustomItem* pItem = new(std::nothrow) CustomItem();
493 int bookmarkBtnWidth = 0;
496 if(__pGroupData == null)
506 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
507 if (pGroupItemClass == null)
512 if (pGroupItemClass->GetHistoryData() == null)
517 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
518 if (pHistory == null)
523 r = pItem->Construct(Dimension(itemWidth, 128), LIST_ANNEX_STYLE_NORMAL);
530 bitmapId = pHistory->GetFaviconId() ;
532 pBitmap = pHistory->GetFavIconBitmap();
536 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
540 r = pItem->AddElement(Rectangle(16, 28, 72, 72), IDA_FORMAT_ICON, *pBitmap, null);
545 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
549 bool urlFoundInBookmark = false;
551 if(__pBookmarkList != null)
553 for (int i = 0; i < __pBookmarkList->GetCount();i++)
555 BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
556 if(pBookMark != null && pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
558 urlFoundInBookmark = true;
563 if (urlFoundInBookmark == true)
565 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
569 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
571 bookmarkBtnWidth = 64;
574 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);
575 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
577 if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
578 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);
580 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);
581 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
582 if ( pBookmarkBitmap != null)
584 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
585 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
586 delete pBookmarkBitmap;
596 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
605 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
607 AppLog("HistoryListForm::DeleteItem");
608 result r = E_FAILURE;
609 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
610 if (pGroupItemClass == null)
615 // if (pGroupItemClass->__pData != null)
617 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
630 HistoryListForm::GetGroupCount(void)
632 __isNoHistoryPresent = true;
634 if (__pGroupData != null)
636 if (__searchHistory == false)
639 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
644 return __pGroupData->GetCount();
649 // String searchText = __pSearchBar->GetText();
650 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
664 HistoryListForm::GetItemCount(int groupIndex)
666 result r = E_FAILURE;
672 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
673 if (pGroupItemClass == null)
677 if (__searchHistory == false)
679 startTime = pGroupItemClass->GetStartTime();
680 endTime = pGroupItemClass->GetEndTime();
681 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
685 //text = __pSearchBar->GetText();
686 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
697 ArrayList* pData = new(std::nothrow) ArrayList();
702 r = pData->Construct();
710 if (__searchHistory == false)
712 startTime = pGroupItemClass->GetStartTime();
713 endTime = pGroupItemClass->GetEndTime();
714 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
715 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
719 //text = __pSearchBar->GetText() ;
720 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
727 pGroupItemClass->SetHistoryData(pData);
730 if (__isNoHistoryPresent == true && count == 0)
732 __isNoHistoryPresent = true;
733 GetFooter()->SetItemEnabled(0, false);
737 __isNoHistoryPresent = false;
738 GetFooter()->SetItemEnabled(0, true);
740 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
741 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
748 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
749 return pGroupItemClass->GetHistoryData()->GetCount();
754 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
757 GetHeader()->SetItemSelected(1);
758 // __previousSceneId = previousSceneId;
759 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
762 pList->GetAt(pList->GetCount()-1,__previousSceneId);
765 AppLog("HistoryListForm::OnSceneActivatedN called");
766 //GetHeader()->Invalidate(true);
767 if (__pGroupData == null)
769 __pGroupData = new(std::nothrow) ArrayList();
770 __pGroupData->Construct();
772 if (__pGroupedListView != null)
774 __pGroupedListView->UpdateList();
776 if (__isNoHistoryPresent == true)
778 GetFooter()->SetItemEnabled(0, false);
782 GetFooter()->SetItemEnabled(0, true);
786 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
789 __pSearchBar->SetShowState(false);
790 __pSearchBar->Invalidate(true);
794 __pSearchBar->SetShowState(true);
795 __pSearchBar->Invalidate(true);
798 // if (__isNoHistoryPresent == true)
800 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
801 // __pGroupedListView->UpdateList();
804 result r = GetHeader()->SetItemSelected(2);
807 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
811 if(__pBookmarkList != null)
813 __pBookmarkList->RemoveAll(false);
816 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
823 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
825 AppLog("HistoryListForm::OnSceneDeactivated");
826 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
830 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
836 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
838 GroupItemClass* pGroupItemClass = null;
839 History* pHistory = null;
840 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
841 if (elementId == IDA_FORMAT_BOOKMARK)
843 String toggledUrl = L"";
844 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
845 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
846 if (pGroupItemClass == null)
850 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
851 if (pHistory == null)
855 toggledUrl = pHistory->GetHistoryUrl();
857 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
859 bool bookmarkFound = false;
860 BookmarkData* pBookMark = null;
861 if(__pBookmarkList != null)
863 for (int i = 0; i < __pBookmarkList->GetCount(); i++)
865 pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
866 if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
868 bookmarkFound = true;
873 if(bookmarkFound == false)
875 // Add the history in bookmark database
876 result r = E_FAILURE;
877 BookmarkData pBookmark;
879 String bookmarkTitle = pHistory->GetHistoryTitle();
881 pBookmark.SetBookmarkTitle(bookmarkTitle);
882 pBookmark.SetUrl(pHistory->GetHistoryUrl());
883 pBookmark.SetFaviconId(pHistory->GetFaviconId());
885 r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
889 // remove the history from bookmark database
890 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
893 if(__pBookmarkList != null)
895 __pBookmarkList->RemoveAll(false);
896 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
898 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
899 listView.UpdateList();
903 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
904 if (pGroupItemClass == null)
909 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
910 if (pHistory1 == null)
914 SceneManager* pSceneManager = SceneManager::GetInstance();
915 ArrayList *pArgList = null;
916 result r = E_SUCCESS;
917 pArgList = new(std::nothrow) ArrayList();
918 if (pArgList != null)
920 r = pArgList->Construct();
927 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
928 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
939 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
941 if (pSceneManager != null)
943 AppLog("pSceneManager exists");
944 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
947 pArgList->RemoveAll(false);
960 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
966 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
968 result r = E_FAILURE;
969 if (mode == SEARCH_BAR_MODE_NORMAL)
971 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
973 __pSearchListView->SetEnabled(true);
976 r = __pSearchListView->SetShowState(false);
981 r = __pGroupedListView->SetShowState(true);
986 __pSearchListView->SetEnabled(true);
987 if(__pSearchBar != null)
988 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
990 __searchHistory = false;
991 r = __pGroupedListView->UpdateList();
992 if (__isNoHistoryPresent == true)
994 GetFooter()->SetItemEnabled(0, false);
998 GetFooter()->SetItemEnabled(0, true);
1000 if(__pSearchBar != null)
1002 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1011 // __pSearchListView->SetEnabled(false);
1012 r = __pSearchListView->SetShowState(true);
1017 __pSearchListView->SetEnabled(false);
1018 r = __pSearchListView->UpdateList();
1023 r = __pGroupedListView->SetShowState(false);
1028 if(__pSearchBar != null)
1030 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1036 HistoryListForm::GetMonth(int month)
1038 String monthValue = L"";
1042 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1045 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1048 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1051 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1054 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1057 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN"));
1060 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1063 monthValue.Append(CommonUtil::GetString(L"DS_COM_BODY_AUG"));
1066 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1069 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1072 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1075 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1086 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1088 result r = E_FAILURE;
1089 if (__pSearchBar != null)
1091 __pSearchBar->HideKeypad();
1094 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1096 __pSearchListView->SetEnabled(true);
1097 __searchHistory = true;
1098 __searchText =__pSearchBar->GetText();
1100 r = __pGroupedListView->SetShowState(false);
1105 r = __pSearchListView->SetShowState(true);
1110 r= __pSearchListView->UpdateList();
1111 if (__isNoHistoryPresent == true)
1113 GetFooter()->SetItemEnabled(0, false);
1117 GetFooter()->SetItemEnabled(0, true);
1119 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1128 __searchHistory = false;
1134 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1136 result r = E_FAILURE;
1137 if (__pGroupedListView != null)
1139 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1140 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1141 else if(__pSearchBar != null)
1142 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1147 __pGroupedListView->UpdateList();
1149 if (__pSearchListView != null)
1151 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1157 __pSearchListView->UpdateList();
1159 if(__pSearchBar != null)
1160 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1165 if (__isNoHistoryPresent == true)
1167 GetFooter()->SetItemEnabled(0, false);
1171 GetFooter()->SetItemEnabled(0, true);
1176 HistoryListForm::OnKeypadWillOpen(Control& source)
1178 GetFooter()->SetShowState(false);
1179 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1180 __pSearchListView->SetEnabled(false);
1181 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1187 HistoryListForm::OnKeypadOpened(Control& source)
1189 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1193 HistoryListForm::OnKeypadClosed(Control& source)
1196 GetFooter()->SetShowState(true);
1197 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1198 __pSearchListView->Invalidate(false);
1199 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1200 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1205 HistoryListForm::CreateGroupItems()
1207 result r = E_FAILURE;
1208 DateTime currentTime;
1210 GroupItemClass* pGroupItemClass = null;
1213 String weeksAgo2 = L"";
1214 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
1216 String weeksAgo3 = L"";
1217 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1219 if (__pGroupData != null)
1221 __pGroupData->RemoveAll(false);
1222 delete __pGroupData;
1223 __pGroupData = null;
1225 __pGroupData = new(std::nothrow) ArrayList();
1226 if (__pGroupData == null)
1230 r = __pGroupData->Construct();
1233 delete __pGroupData;
1234 __pGroupData = null;
1237 if (__searchHistory == true)
1239 pGroupItemClass = new(std::nothrow) GroupItemClass();
1240 if (pGroupItemClass == null)
1244 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1245 pGroupItemClass->SetTitleText(titleText);
1246 r = __pGroupData->Add(*pGroupItemClass);
1254 Calendar* pGregorianCalendar = null;
1257 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1258 pGroupItemClass = new(std::nothrow) GroupItemClass();
1259 if (pGroupItemClass == null)
1263 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1264 pGroupItemClass->SetTitleText(titleText);
1265 pGroupItemClass->SetEndTime(currentTime);
1266 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1267 pGroupItemClass->SetStartTime(dateTime);
1268 __pGroupData->Add(*pGroupItemClass);
1271 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1272 if ( pGregorianCalendar != NULL )
1274 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1275 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1276 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1277 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1278 delete pGregorianCalendar;
1283 pGroupItemClass = new(std::nothrow) GroupItemClass();
1284 if (pGroupItemClass == null)
1288 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1289 pGroupItemClass->SetTitleText(titleText);
1290 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1291 pGroupItemClass->SetEndTime(dateTime);
1292 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1293 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1294 pGroupItemClass->SetStartTime(dateTime);
1295 __pGroupData->Add(*pGroupItemClass);
1298 pGroupItemClass = new(std::nothrow) GroupItemClass();
1299 if (pGroupItemClass == null)
1303 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1304 pGroupItemClass->SetTitleText(titleText);
1305 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1306 pGroupItemClass->SetEndTime(dateTime);
1307 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1308 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1309 pGroupItemClass->SetStartTime(dateTime);
1310 __pGroupData->Add(*pGroupItemClass);
1313 pGroupItemClass = new(std::nothrow) GroupItemClass();
1314 if (pGroupItemClass == null)
1318 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1319 pGroupItemClass->SetTitleText(titleText);
1320 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1321 pGroupItemClass->SetEndTime(dateTime);
1322 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1323 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1324 pGroupItemClass->SetStartTime(dateTime);
1325 __pGroupData->Add(*pGroupItemClass);
1327 pGroupItemClass = new(std::nothrow) GroupItemClass();
1328 if (pGroupItemClass == null)
1332 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1333 pGroupItemClass->SetTitleText(titleText);
1334 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1335 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1336 pGroupItemClass->SetEndTime(dateTime);
1337 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1338 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1339 pGroupItemClass->SetStartTime(dateTime);
1340 __pGroupData->Add(*pGroupItemClass);
1343 pGroupItemClass = new(std::nothrow) GroupItemClass();
1344 if (pGroupItemClass == null)
1348 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1349 pGroupItemClass->SetTitleText(titleText);
1350 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1351 pGroupItemClass->SetEndTime(dateTime);
1352 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1353 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1354 pGroupItemClass->SetStartTime(dateTime);
1355 __pGroupData->Add(*pGroupItemClass);
1357 pGroupItemClass = new(std::nothrow) GroupItemClass();
1358 if (pGroupItemClass == null)
1362 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1363 pGroupItemClass->SetTitleText(titleText);
1364 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1365 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1366 pGroupItemClass->SetEndTime(dateTime);
1367 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1368 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1369 pGroupItemClass->SetStartTime(dateTime);
1370 __pGroupData->Add(*pGroupItemClass);
1372 pGroupItemClass = new(std::nothrow) GroupItemClass();
1373 if (pGroupItemClass == null)
1377 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1378 pGroupItemClass->SetTitleText(titleText);
1379 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1380 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1381 pGroupItemClass->SetEndTime(dateTime);
1382 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1383 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1384 pGroupItemClass->SetStartTime(dateTime);
1385 __pGroupData->Add(*pGroupItemClass);
1388 pGroupItemClass = new(std::nothrow) GroupItemClass();
1389 if (pGroupItemClass == null)
1393 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1394 pGroupItemClass->SetTitleText(titleText);
1395 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1396 pGroupItemClass->SetEndTime(dateTime);
1397 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1398 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1399 pGroupItemClass->SetStartTime(dateTime);
1400 __pGroupData->Add(*pGroupItemClass);
1402 pGroupItemClass = new(std::nothrow) GroupItemClass();
1403 if (pGroupItemClass == null)
1407 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1408 pGroupItemClass->SetTitleText(titleText);
1409 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1410 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1411 pGroupItemClass->SetEndTime(dateTime);
1412 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1413 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1414 pGroupItemClass->SetStartTime(dateTime);
1415 __pGroupData->Add(*pGroupItemClass);
1417 pGroupItemClass = new(std::nothrow) GroupItemClass();
1418 if (pGroupItemClass == null)
1422 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1423 pGroupItemClass->SetTitleText(titleText);
1424 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1425 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1426 pGroupItemClass->SetEndTime(dateTime);
1427 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1428 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1429 pGroupItemClass->SetStartTime(dateTime);
1430 __pGroupData->Add(*pGroupItemClass);
1432 pGroupItemClass = new(std::nothrow) GroupItemClass();
1433 if (pGroupItemClass == null)
1437 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1438 pGroupItemClass->SetTitleText(titleText);
1439 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1440 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1441 pGroupItemClass->SetEndTime(dateTime);
1442 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1443 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1444 pGroupItemClass->SetStartTime(dateTime);
1445 __pGroupData->Add(*pGroupItemClass);
1448 pGroupItemClass = new(std::nothrow) GroupItemClass();
1449 if (pGroupItemClass == null)
1453 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1454 pGroupItemClass->SetTitleText(titleText);
1455 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1456 pGroupItemClass->SetEndTime(dateTime);
1457 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1458 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1459 pGroupItemClass->SetStartTime(dateTime);
1460 __pGroupData->Add(*pGroupItemClass);
1462 pGroupItemClass = new(std::nothrow) GroupItemClass();
1463 if (pGroupItemClass == null)
1467 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1468 pGroupItemClass->SetTitleText(titleText);
1469 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1470 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1471 pGroupItemClass->SetEndTime(dateTime);
1472 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1473 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1474 pGroupItemClass->SetStartTime(dateTime);
1475 __pGroupData->Add(*pGroupItemClass);
1477 pGroupItemClass = new(std::nothrow) GroupItemClass();
1478 if (pGroupItemClass == null)
1482 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1483 pGroupItemClass->SetTitleText(titleText);
1484 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1485 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1486 pGroupItemClass->SetEndTime(dateTime);
1487 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1488 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1489 pGroupItemClass->SetStartTime(dateTime);
1490 __pGroupData->Add(*pGroupItemClass);
1492 pGroupItemClass = new(std::nothrow) GroupItemClass();
1493 if (pGroupItemClass == null)
1497 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1498 pGroupItemClass->SetTitleText(titleText);
1499 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1500 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1501 pGroupItemClass->SetEndTime(dateTime);
1502 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1503 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1504 pGroupItemClass->SetStartTime(dateTime);
1505 __pGroupData->Add(*pGroupItemClass);
1507 pGroupItemClass = new(std::nothrow) GroupItemClass();
1508 if (pGroupItemClass == null)
1512 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1513 pGroupItemClass->SetTitleText(titleText);
1514 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1515 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1516 pGroupItemClass->SetEndTime(dateTime);
1517 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1518 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1519 pGroupItemClass->SetStartTime(dateTime);
1520 __pGroupData->Add(*pGroupItemClass);
1523 pGroupItemClass = new(std::nothrow) GroupItemClass();
1524 if (pGroupItemClass == null)
1528 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1529 pGroupItemClass->SetTitleText(titleText);
1530 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1531 pGroupItemClass->SetEndTime(dateTime);
1532 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1533 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1534 pGroupItemClass->SetStartTime(dateTime);
1535 __pGroupData->Add(*pGroupItemClass);
1537 pGroupItemClass = new(std::nothrow) GroupItemClass();
1538 if (pGroupItemClass == null)
1542 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1543 pGroupItemClass->SetTitleText(titleText);
1544 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1545 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1546 pGroupItemClass->SetEndTime(dateTime);
1547 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1548 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1549 pGroupItemClass->SetStartTime(dateTime);
1550 __pGroupData->Add(*pGroupItemClass);
1552 pGroupItemClass = new(std::nothrow) GroupItemClass();
1553 if (pGroupItemClass == null)
1557 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1558 pGroupItemClass->SetTitleText(titleText);
1559 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1560 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1561 pGroupItemClass->SetEndTime(dateTime);
1562 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1563 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1564 pGroupItemClass->SetStartTime(dateTime);
1565 __pGroupData->Add(*pGroupItemClass);
1567 pGroupItemClass = new(std::nothrow) GroupItemClass();
1568 if (pGroupItemClass == null)
1572 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1573 pGroupItemClass->SetTitleText(titleText);
1574 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1575 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1576 pGroupItemClass->SetEndTime(dateTime);
1577 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1578 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1579 pGroupItemClass->SetStartTime(dateTime);
1580 __pGroupData->Add(*pGroupItemClass);
1582 pGroupItemClass = new(std::nothrow) GroupItemClass();
1583 if (pGroupItemClass == null)
1587 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1588 pGroupItemClass->SetTitleText(titleText);
1589 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1590 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1591 pGroupItemClass->SetEndTime(dateTime);
1592 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1593 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1594 pGroupItemClass->SetStartTime(dateTime);
1595 __pGroupData->Add(*pGroupItemClass);
1597 pGroupItemClass = new(std::nothrow) GroupItemClass();
1598 if (pGroupItemClass == null)
1602 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1603 pGroupItemClass->SetTitleText(titleText);
1604 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1605 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1606 pGroupItemClass->SetEndTime(dateTime);
1607 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1608 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1609 pGroupItemClass->SetStartTime(dateTime);
1610 __pGroupData->Add(*pGroupItemClass);
1616 day = currentTime.GetDay();
1620 pGroupItemClass = new(std::nothrow) GroupItemClass();
1621 if (pGroupItemClass == null)
1626 pGroupItemClass->SetTitleText(weeksAgo2);
1627 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1628 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1629 pGroupItemClass->SetEndTime(dateTime);
1630 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1631 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1632 pGroupItemClass->SetStartTime(dateTime);
1633 __pGroupData->Add(*pGroupItemClass);
1635 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1637 pGroupItemClass = new(std::nothrow) GroupItemClass();
1638 if (pGroupItemClass == null)
1642 String weeksAgo3 = L"";
1643 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1644 pGroupItemClass->SetTitleText(weeksAgo3);
1645 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1646 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1647 pGroupItemClass->SetEndTime(dateTime);
1648 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1649 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1650 pGroupItemClass->SetStartTime(dateTime);
1651 __pGroupData->Add(*pGroupItemClass);
1655 pGroupItemClass = new(std::nothrow) GroupItemClass();
1656 if (pGroupItemClass == null)
1660 pGroupItemClass->SetTitleText(weeksAgo2);
1661 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1662 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1663 pGroupItemClass->SetEndTime(dateTime);
1664 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1665 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1666 pGroupItemClass->SetStartTime(dateTime);
1667 __pGroupData->Add(*pGroupItemClass);
1669 pGroupItemClass = new(std::nothrow) GroupItemClass();
1670 if (pGroupItemClass == null)
1675 pGroupItemClass->SetTitleText(weeksAgo3);
1676 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1677 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1678 pGroupItemClass->SetEndTime(dateTime);
1679 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1680 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1681 pGroupItemClass->SetStartTime(dateTime);
1682 __pGroupData->Add(*pGroupItemClass);
1684 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1686 pGroupItemClass = new(std::nothrow) GroupItemClass();
1687 if (pGroupItemClass == null)
1691 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1692 pGroupItemClass->SetTitleText(titleText);
1693 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1694 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1695 pGroupItemClass->SetEndTime(dateTime);
1696 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1697 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1698 pGroupItemClass->SetStartTime(dateTime);
1699 __pGroupData->Add(*pGroupItemClass);
1703 pGroupItemClass = new(std::nothrow) GroupItemClass();
1704 if (pGroupItemClass == null)
1708 pGroupItemClass->SetTitleText(weeksAgo2);
1709 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1710 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1711 pGroupItemClass->SetEndTime(dateTime);
1712 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1713 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1714 pGroupItemClass->SetStartTime(dateTime);
1715 __pGroupData->Add(*pGroupItemClass);
1717 pGroupItemClass = new(std::nothrow) GroupItemClass();
1718 if (pGroupItemClass == null)
1722 pGroupItemClass->SetTitleText(weeksAgo3);
1723 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1724 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1725 pGroupItemClass->SetEndTime(dateTime);
1726 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1727 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1728 pGroupItemClass->SetStartTime(dateTime);
1729 __pGroupData->Add(*pGroupItemClass);
1731 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1733 pGroupItemClass = new(std::nothrow) GroupItemClass();
1734 if (pGroupItemClass == null)
1738 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1739 pGroupItemClass->SetTitleText(titleText);
1740 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1741 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1742 pGroupItemClass->SetEndTime(dateTime);
1743 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1744 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1745 pGroupItemClass->SetStartTime(dateTime);
1746 __pGroupData->Add(*pGroupItemClass);
1752 pGroupItemClass = new(std::nothrow) GroupItemClass();
1753 if (pGroupItemClass == null)
1757 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1758 pGroupItemClass->SetTitleText(titleText);
1759 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1760 dateTime.AddDays(-1);
1761 pGroupItemClass->SetEndTime(dateTime);
1762 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1763 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1764 pGroupItemClass->SetStartTime(dateTime);
1765 __pGroupData->Add(*pGroupItemClass);
1767 pGroupItemClass = new(std::nothrow) GroupItemClass();
1768 if (pGroupItemClass == null)
1772 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1773 pGroupItemClass->SetTitleText(titleText);
1774 dateTime.SetValue(currentTime.GetYear(),1, 1);
1775 dateTime.AddMonths(currentTime.GetMonth() - 2);
1776 dateTime.AddDays(-1);
1777 pGroupItemClass->SetEndTime(dateTime);
1779 dateTime2.SetValue(0, 0, 0);
1780 pGroupItemClass->SetStartTime(dateTime2);
1781 __pGroupData->Add(*pGroupItemClass);
1785 GroupItemClass::GroupItemClass()
1791 GroupItemClass::operator =(const GroupItemClass& rhs)
1795 __pData = rhs.__pData;
1800 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1802 __pData = groupItem.__pData;
1805 GroupItemClass::~GroupItemClass()
1809 __pData->RemoveAll(true);
1815 GroupItemClass::SetStartTime(DateTime& startTime)
1817 __startTime = startTime;
1821 GroupItemClass::SetEndTime(DateTime& endTime)
1823 __endTime = endTime;
1827 GroupItemClass::SetTitleText(String& titleText)
1829 __titleText = titleText;
1833 GroupItemClass::SetHistoryData(ArrayList* pData)
1839 GroupItemClass::GetStartTime(void)
1845 GroupItemClass::GetEndTime(void)
1851 GroupItemClass::GetTitleText(void)
1857 GroupItemClass::GetHistoryData(void)
1863 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1865 if (__pGroupedListView)
1867 __pGroupedListView->UpdateList();