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::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;
237 SettingInfo::RemoveSettingEventListener(*this);
242 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
244 AppLog("HistoryListForm::OnActionPerformed");
245 result r = E_FAILURE;
246 SceneManager* pSceneManager = SceneManager::GetInstance();
247 if (pSceneManager == null)
253 case IDA_EDIT_HISTORY_LIST_FORM:
255 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
256 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
263 case IDA_TABBAR_ITEM_1:
265 result r = GetHeader()->SetItemSelected(1);
266 AppLog("SetItemSelected result %s",GetErrorMessage(r));
267 GetHeader()->Invalidate(true);
269 if (pSceneManager != null)
271 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
273 if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)) != E_SUCCESS)
275 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
282 if(pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT))!= E_SUCCESS)
284 AppLogDebug("BookmarkListForm::OnActionPerformed GoBackward failed");
290 // r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
303 HistoryListForm::OnFormBackRequested(Form& source)
305 SceneManager* pSceneManager = SceneManager::GetInstance();
306 if (pSceneManager == null)
310 result r = E_FAILURE;
311 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
313 r = pSceneManager->GoBackward(BackwardSceneTransition());
317 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
321 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
326 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
328 result r = E_FAILURE;
334 GroupItem* pItem = null;
335 GroupItemClass* pGroupItemClass = null;
337 String weeksAgo2 = L"";
338 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
340 String weeksAgo3 = L"";
341 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
343 String weeksAgo4 = L"";
344 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),4);
346 pItem = new(std::nothrow) GroupItem();
351 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
353 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
355 AppLog("CreateGroupItem :: if history is null");
356 r = pItem->Construct(Dimension(itemWidth, 0));
361 r = pItem->Construct(Dimension(itemWidth, 48));
363 text = pGroupItemClass->GetTitleText();
365 if (__searchHistory == false)
369 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
372 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
373 if ( pGregorianCalendar != NULL)
375 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
382 delete pGregorianCalendar;
385 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
392 delete pGregorianCalendar;
395 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
402 delete pGregorianCalendar;
405 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
407 delete pGregorianCalendar;
413 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
416 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
419 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
422 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
425 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
428 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
431 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
439 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
441 text.Append(pGroupItemClass->GetStartTime().GetDay());
443 strMonth = pGroupItemClass->GetStartTime().GetMonth();
444 month = GetMonth(strMonth);
454 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
455 || 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"))
458 text.Append(pGroupItemClass->GetEndTime().GetDay());
460 strMonth = pGroupItemClass->GetEndTime().GetMonth();
461 month = GetMonth(strMonth);
467 r = pItem->SetElement(text, null);
471 AppLogDebug("Failed with %s", GetErrorMessage(r));
474 r = pItem->SetTextSize(32);
485 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
487 AppLog("HistoryListForm::CreateItem");
488 result r = E_FAILURE;
489 History* pHistory = null;
490 Bitmap* pBitmap = null;
491 Bitmap* pBookmarkBitmap = null;
492 GroupItemClass* pGroupItemClass = null;
493 CustomItem* pItem = new(std::nothrow) CustomItem();
494 int bookmarkBtnWidth = 0;
497 if(__pGroupData == null)
507 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
508 if (pGroupItemClass == null)
513 if (pGroupItemClass->GetHistoryData() == null)
518 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
519 if (pHistory == null)
524 r = pItem->Construct(Dimension(itemWidth, 128), LIST_ANNEX_STYLE_NORMAL);
531 bitmapId = pHistory->GetFaviconId() ;
533 pBitmap = pHistory->GetFavIconBitmap();
537 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
541 r = pItem->AddElement(Rectangle(16, 28, 72, 72), IDA_FORMAT_ICON, *pBitmap, null);
546 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
550 bool urlFoundInBookmark = false;
552 if(__pBookmarkList != null)
554 for (int i = 0; i < __pBookmarkList->GetCount();i++)
556 BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
557 if(pBookMark != null && pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
559 urlFoundInBookmark = true;
564 if (urlFoundInBookmark == true)
566 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
570 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
572 bookmarkBtnWidth = 64;
575 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);
576 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
578 if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
579 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);
581 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);
582 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
583 if ( pBookmarkBitmap != null)
585 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
586 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
587 delete pBookmarkBitmap;
597 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
606 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
608 AppLog("HistoryListForm::DeleteItem");
609 result r = E_FAILURE;
610 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
611 if (pGroupItemClass == null)
616 // if (pGroupItemClass->__pData != null)
618 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
631 HistoryListForm::GetGroupCount(void)
633 __isNoHistoryPresent = true;
635 if (__pGroupData != null)
637 if (__searchHistory == false)
640 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
645 return __pGroupData->GetCount();
650 // String searchText = __pSearchBar->GetText();
651 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
665 HistoryListForm::GetItemCount(int groupIndex)
667 result r = E_FAILURE;
673 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
674 if (pGroupItemClass == null)
678 if (__searchHistory == false)
680 startTime = pGroupItemClass->GetStartTime();
681 endTime = pGroupItemClass->GetEndTime();
682 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
686 //text = __pSearchBar->GetText();
687 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
698 ArrayList* pData = new(std::nothrow) ArrayList();
703 r = pData->Construct();
711 if (__searchHistory == false)
713 startTime = pGroupItemClass->GetStartTime();
714 endTime = pGroupItemClass->GetEndTime();
715 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
716 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
720 //text = __pSearchBar->GetText() ;
721 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
728 pGroupItemClass->SetHistoryData(pData);
731 if (__isNoHistoryPresent == true && count == 0)
733 __isNoHistoryPresent = true;
734 GetFooter()->SetItemEnabled(0, false);
738 __isNoHistoryPresent = false;
739 GetFooter()->SetItemEnabled(0, true);
741 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
742 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
749 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
750 return pGroupItemClass->GetHistoryData()->GetCount();
755 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
758 GetHeader()->SetItemSelected(1);
759 // __previousSceneId = previousSceneId;
760 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
763 pList->GetAt(pList->GetCount()-1,__previousSceneId);
766 if(__pBookmarkList != null)
768 __pBookmarkList->RemoveAll(false);
771 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
773 AppLog("HistoryListForm::OnSceneActivatedN called");
774 //GetHeader()->Invalidate(true);
775 if (__pGroupData == null)
777 __pGroupData = new(std::nothrow) ArrayList();
778 __pGroupData->Construct();
780 if (__pGroupedListView != null)
782 __pGroupedListView->UpdateList();
784 if (__isNoHistoryPresent == true)
786 GetFooter()->SetItemEnabled(0, false);
790 GetFooter()->SetItemEnabled(0, true);
794 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
797 __pSearchBar->SetShowState(false);
798 __pSearchBar->Invalidate(true);
802 __pSearchBar->SetShowState(true);
803 __pSearchBar->Invalidate(true);
806 // if (__isNoHistoryPresent == true)
808 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
809 // __pGroupedListView->UpdateList();
812 result r = GetHeader()->SetItemSelected(2);
815 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
826 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
828 AppLog("HistoryListForm::OnSceneDeactivated");
829 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
833 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
839 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
841 GroupItemClass* pGroupItemClass = null;
842 History* pHistory = null;
843 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
844 if (elementId == IDA_FORMAT_BOOKMARK)
846 String toggledUrl = L"";
847 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
848 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
849 if (pGroupItemClass == null)
853 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
854 if (pHistory == null)
858 toggledUrl = pHistory->GetHistoryUrl();
860 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
862 bool bookmarkFound = false;
863 BookmarkData* pBookMark = null;
864 if(__pBookmarkList != null)
866 for (int i = 0; i < __pBookmarkList->GetCount(); i++)
868 pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
869 if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
871 bookmarkFound = true;
876 if(bookmarkFound == false)
878 // Add the history in bookmark database
879 result r = E_FAILURE;
880 BookmarkData pBookmark;
882 String bookmarkTitle = pHistory->GetHistoryTitle();
884 pBookmark.SetBookmarkTitle(bookmarkTitle);
885 pBookmark.SetUrl(pHistory->GetHistoryUrl());
886 pBookmark.SetFaviconId(pHistory->GetFaviconId());
888 r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
892 // remove the history from bookmark database
893 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
896 if(__pBookmarkList != null)
898 __pBookmarkList->RemoveAll(false);
899 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
901 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
902 listView.UpdateList();
906 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
907 if (pGroupItemClass == null)
912 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
913 if (pHistory1 == null)
917 SceneManager* pSceneManager = SceneManager::GetInstance();
918 ArrayList *pArgList = null;
919 result r = E_SUCCESS;
920 pArgList = new(std::nothrow) ArrayList();
921 if (pArgList != null)
923 r = pArgList->Construct();
930 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
931 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
942 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
944 if (pSceneManager != null)
946 AppLog("pSceneManager exists");
947 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
950 pArgList->RemoveAll(false);
963 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
969 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
971 result r = E_FAILURE;
972 if (mode == SEARCH_BAR_MODE_NORMAL)
974 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
976 __pSearchListView->SetEnabled(true);
979 r = __pSearchListView->SetShowState(false);
984 r = __pGroupedListView->SetShowState(true);
989 __pSearchListView->SetEnabled(true);
990 if(__pSearchBar != null)
991 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
993 __searchHistory = false;
994 r = __pGroupedListView->UpdateList();
995 if (__isNoHistoryPresent == true)
997 GetFooter()->SetItemEnabled(0, false);
1001 GetFooter()->SetItemEnabled(0, true);
1003 if(__pSearchBar != null)
1005 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1015 GetFooter()->SetShowState(false);
1016 // __pSearchListView->SetEnabled(false);
1017 r = __pSearchListView->SetShowState(true);
1022 __pSearchListView->SetEnabled(false);
1023 r = __pSearchListView->UpdateList();
1028 r = __pGroupedListView->SetShowState(false);
1033 if(__pSearchBar != null)
1035 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1041 HistoryListForm::GetMonth(int month)
1043 String monthValue = L"";
1047 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1050 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1053 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1056 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1059 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1062 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN"));
1065 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1068 monthValue.Append(CommonUtil::GetString(L"DS_COM_BODY_AUG"));
1071 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1074 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1077 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1080 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1091 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1093 result r = E_FAILURE;
1094 if (__pSearchBar != null)
1096 __pSearchBar->HideKeypad();
1099 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1101 __pSearchListView->SetEnabled(true);
1102 __searchHistory = true;
1103 __searchText =__pSearchBar->GetText();
1105 r = __pGroupedListView->SetShowState(false);
1110 r = __pSearchListView->SetShowState(true);
1115 r= __pSearchListView->UpdateList();
1116 if (__isNoHistoryPresent == true)
1118 GetFooter()->SetItemEnabled(0, false);
1122 GetFooter()->SetItemEnabled(0, true);
1124 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1133 __searchHistory = false;
1139 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1141 result r = E_FAILURE;
1142 if (__pGroupedListView != null)
1144 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1145 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1146 else if(__pSearchBar != null)
1147 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1152 __pGroupedListView->UpdateList();
1154 if (__pSearchListView != null)
1156 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1162 __pSearchListView->UpdateList();
1164 if(__pSearchBar != null)
1165 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1170 if (__isNoHistoryPresent == true)
1172 GetFooter()->SetItemEnabled(0, false);
1176 GetFooter()->SetItemEnabled(0, true);
1181 HistoryListForm::OnKeypadWillOpen(Control& source)
1183 GetFooter()->SetShowState(false);
1184 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1185 __pSearchListView->SetEnabled(false);
1186 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1192 HistoryListForm::OnKeypadOpened(Control& source)
1194 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1198 HistoryListForm::OnKeypadClosed(Control& source)
1201 GetFooter()->SetShowState(true);
1202 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1203 __pSearchListView->Invalidate(false);
1204 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1205 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1210 HistoryListForm::CreateGroupItems()
1212 result r = E_FAILURE;
1213 DateTime currentTime;
1215 GroupItemClass* pGroupItemClass = null;
1218 String weeksAgo2 = L"";
1219 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
1221 String weeksAgo3 = L"";
1222 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1224 if (__pGroupData != null)
1226 __pGroupData->RemoveAll(false);
1227 delete __pGroupData;
1228 __pGroupData = null;
1230 __pGroupData = new(std::nothrow) ArrayList();
1231 if (__pGroupData == null)
1235 r = __pGroupData->Construct();
1238 delete __pGroupData;
1239 __pGroupData = null;
1242 if (__searchHistory == true)
1244 pGroupItemClass = new(std::nothrow) GroupItemClass();
1245 if (pGroupItemClass == null)
1249 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1250 pGroupItemClass->SetTitleText(titleText);
1251 r = __pGroupData->Add(*pGroupItemClass);
1259 Calendar* pGregorianCalendar = null;
1262 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1263 pGroupItemClass = new(std::nothrow) GroupItemClass();
1264 if (pGroupItemClass == null)
1268 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1269 pGroupItemClass->SetTitleText(titleText);
1270 pGroupItemClass->SetEndTime(currentTime);
1271 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1272 pGroupItemClass->SetStartTime(dateTime);
1273 __pGroupData->Add(*pGroupItemClass);
1276 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1277 if ( pGregorianCalendar != NULL )
1279 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1280 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1281 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1282 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1283 delete pGregorianCalendar;
1288 pGroupItemClass = new(std::nothrow) GroupItemClass();
1289 if (pGroupItemClass == null)
1293 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1294 pGroupItemClass->SetTitleText(titleText);
1295 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1296 pGroupItemClass->SetEndTime(dateTime);
1297 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1298 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1299 pGroupItemClass->SetStartTime(dateTime);
1300 __pGroupData->Add(*pGroupItemClass);
1303 pGroupItemClass = new(std::nothrow) GroupItemClass();
1304 if (pGroupItemClass == null)
1308 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1309 pGroupItemClass->SetTitleText(titleText);
1310 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1311 pGroupItemClass->SetEndTime(dateTime);
1312 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1313 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1314 pGroupItemClass->SetStartTime(dateTime);
1315 __pGroupData->Add(*pGroupItemClass);
1318 pGroupItemClass = new(std::nothrow) GroupItemClass();
1319 if (pGroupItemClass == null)
1323 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1324 pGroupItemClass->SetTitleText(titleText);
1325 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1326 pGroupItemClass->SetEndTime(dateTime);
1327 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1328 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1329 pGroupItemClass->SetStartTime(dateTime);
1330 __pGroupData->Add(*pGroupItemClass);
1332 pGroupItemClass = new(std::nothrow) GroupItemClass();
1333 if (pGroupItemClass == null)
1337 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1338 pGroupItemClass->SetTitleText(titleText);
1339 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1340 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1341 pGroupItemClass->SetEndTime(dateTime);
1342 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1343 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1344 pGroupItemClass->SetStartTime(dateTime);
1345 __pGroupData->Add(*pGroupItemClass);
1348 pGroupItemClass = new(std::nothrow) GroupItemClass();
1349 if (pGroupItemClass == null)
1353 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1354 pGroupItemClass->SetTitleText(titleText);
1355 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1356 pGroupItemClass->SetEndTime(dateTime);
1357 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1358 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1359 pGroupItemClass->SetStartTime(dateTime);
1360 __pGroupData->Add(*pGroupItemClass);
1362 pGroupItemClass = new(std::nothrow) GroupItemClass();
1363 if (pGroupItemClass == null)
1367 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1368 pGroupItemClass->SetTitleText(titleText);
1369 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1370 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1371 pGroupItemClass->SetEndTime(dateTime);
1372 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1373 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1374 pGroupItemClass->SetStartTime(dateTime);
1375 __pGroupData->Add(*pGroupItemClass);
1377 pGroupItemClass = new(std::nothrow) GroupItemClass();
1378 if (pGroupItemClass == null)
1382 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1383 pGroupItemClass->SetTitleText(titleText);
1384 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1385 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1386 pGroupItemClass->SetEndTime(dateTime);
1387 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1388 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1389 pGroupItemClass->SetStartTime(dateTime);
1390 __pGroupData->Add(*pGroupItemClass);
1393 pGroupItemClass = new(std::nothrow) GroupItemClass();
1394 if (pGroupItemClass == null)
1398 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1399 pGroupItemClass->SetTitleText(titleText);
1400 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1401 pGroupItemClass->SetEndTime(dateTime);
1402 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1403 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1404 pGroupItemClass->SetStartTime(dateTime);
1405 __pGroupData->Add(*pGroupItemClass);
1407 pGroupItemClass = new(std::nothrow) GroupItemClass();
1408 if (pGroupItemClass == null)
1412 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1413 pGroupItemClass->SetTitleText(titleText);
1414 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1415 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1416 pGroupItemClass->SetEndTime(dateTime);
1417 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1418 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1419 pGroupItemClass->SetStartTime(dateTime);
1420 __pGroupData->Add(*pGroupItemClass);
1422 pGroupItemClass = new(std::nothrow) GroupItemClass();
1423 if (pGroupItemClass == null)
1427 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1428 pGroupItemClass->SetTitleText(titleText);
1429 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1430 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1431 pGroupItemClass->SetEndTime(dateTime);
1432 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1433 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1434 pGroupItemClass->SetStartTime(dateTime);
1435 __pGroupData->Add(*pGroupItemClass);
1437 pGroupItemClass = new(std::nothrow) GroupItemClass();
1438 if (pGroupItemClass == null)
1442 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1443 pGroupItemClass->SetTitleText(titleText);
1444 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1445 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1446 pGroupItemClass->SetEndTime(dateTime);
1447 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1448 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1449 pGroupItemClass->SetStartTime(dateTime);
1450 __pGroupData->Add(*pGroupItemClass);
1453 pGroupItemClass = new(std::nothrow) GroupItemClass();
1454 if (pGroupItemClass == null)
1458 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1459 pGroupItemClass->SetTitleText(titleText);
1460 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1461 pGroupItemClass->SetEndTime(dateTime);
1462 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1463 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1464 pGroupItemClass->SetStartTime(dateTime);
1465 __pGroupData->Add(*pGroupItemClass);
1467 pGroupItemClass = new(std::nothrow) GroupItemClass();
1468 if (pGroupItemClass == null)
1472 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1473 pGroupItemClass->SetTitleText(titleText);
1474 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1475 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1476 pGroupItemClass->SetEndTime(dateTime);
1477 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1478 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1479 pGroupItemClass->SetStartTime(dateTime);
1480 __pGroupData->Add(*pGroupItemClass);
1482 pGroupItemClass = new(std::nothrow) GroupItemClass();
1483 if (pGroupItemClass == null)
1487 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1488 pGroupItemClass->SetTitleText(titleText);
1489 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1490 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1491 pGroupItemClass->SetEndTime(dateTime);
1492 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1493 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1494 pGroupItemClass->SetStartTime(dateTime);
1495 __pGroupData->Add(*pGroupItemClass);
1497 pGroupItemClass = new(std::nothrow) GroupItemClass();
1498 if (pGroupItemClass == null)
1502 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1503 pGroupItemClass->SetTitleText(titleText);
1504 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1505 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1506 pGroupItemClass->SetEndTime(dateTime);
1507 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1508 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1509 pGroupItemClass->SetStartTime(dateTime);
1510 __pGroupData->Add(*pGroupItemClass);
1512 pGroupItemClass = new(std::nothrow) GroupItemClass();
1513 if (pGroupItemClass == null)
1517 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1518 pGroupItemClass->SetTitleText(titleText);
1519 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1520 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1521 pGroupItemClass->SetEndTime(dateTime);
1522 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1523 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1524 pGroupItemClass->SetStartTime(dateTime);
1525 __pGroupData->Add(*pGroupItemClass);
1528 pGroupItemClass = new(std::nothrow) GroupItemClass();
1529 if (pGroupItemClass == null)
1533 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1534 pGroupItemClass->SetTitleText(titleText);
1535 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1536 pGroupItemClass->SetEndTime(dateTime);
1537 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1538 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1539 pGroupItemClass->SetStartTime(dateTime);
1540 __pGroupData->Add(*pGroupItemClass);
1542 pGroupItemClass = new(std::nothrow) GroupItemClass();
1543 if (pGroupItemClass == null)
1547 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1548 pGroupItemClass->SetTitleText(titleText);
1549 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1550 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1551 pGroupItemClass->SetEndTime(dateTime);
1552 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1553 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1554 pGroupItemClass->SetStartTime(dateTime);
1555 __pGroupData->Add(*pGroupItemClass);
1557 pGroupItemClass = new(std::nothrow) GroupItemClass();
1558 if (pGroupItemClass == null)
1562 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1563 pGroupItemClass->SetTitleText(titleText);
1564 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1565 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1566 pGroupItemClass->SetEndTime(dateTime);
1567 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1568 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1569 pGroupItemClass->SetStartTime(dateTime);
1570 __pGroupData->Add(*pGroupItemClass);
1572 pGroupItemClass = new(std::nothrow) GroupItemClass();
1573 if (pGroupItemClass == null)
1577 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1578 pGroupItemClass->SetTitleText(titleText);
1579 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1580 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1581 pGroupItemClass->SetEndTime(dateTime);
1582 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1583 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1584 pGroupItemClass->SetStartTime(dateTime);
1585 __pGroupData->Add(*pGroupItemClass);
1587 pGroupItemClass = new(std::nothrow) GroupItemClass();
1588 if (pGroupItemClass == null)
1592 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1593 pGroupItemClass->SetTitleText(titleText);
1594 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1595 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1596 pGroupItemClass->SetEndTime(dateTime);
1597 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1598 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1599 pGroupItemClass->SetStartTime(dateTime);
1600 __pGroupData->Add(*pGroupItemClass);
1602 pGroupItemClass = new(std::nothrow) GroupItemClass();
1603 if (pGroupItemClass == null)
1607 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1608 pGroupItemClass->SetTitleText(titleText);
1609 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1610 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1611 pGroupItemClass->SetEndTime(dateTime);
1612 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1613 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1614 pGroupItemClass->SetStartTime(dateTime);
1615 __pGroupData->Add(*pGroupItemClass);
1621 day = currentTime.GetDay();
1625 pGroupItemClass = new(std::nothrow) GroupItemClass();
1626 if (pGroupItemClass == null)
1631 pGroupItemClass->SetTitleText(weeksAgo2);
1632 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1633 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1634 pGroupItemClass->SetEndTime(dateTime);
1635 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1636 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1637 pGroupItemClass->SetStartTime(dateTime);
1638 __pGroupData->Add(*pGroupItemClass);
1640 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1642 pGroupItemClass = new(std::nothrow) GroupItemClass();
1643 if (pGroupItemClass == null)
1647 String weeksAgo3 = L"";
1648 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1649 pGroupItemClass->SetTitleText(weeksAgo3);
1650 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1651 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1652 pGroupItemClass->SetEndTime(dateTime);
1653 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1654 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1655 pGroupItemClass->SetStartTime(dateTime);
1656 __pGroupData->Add(*pGroupItemClass);
1660 pGroupItemClass = new(std::nothrow) GroupItemClass();
1661 if (pGroupItemClass == null)
1665 pGroupItemClass->SetTitleText(weeksAgo2);
1666 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1667 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1668 pGroupItemClass->SetEndTime(dateTime);
1669 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1670 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1671 pGroupItemClass->SetStartTime(dateTime);
1672 __pGroupData->Add(*pGroupItemClass);
1674 pGroupItemClass = new(std::nothrow) GroupItemClass();
1675 if (pGroupItemClass == null)
1680 pGroupItemClass->SetTitleText(weeksAgo3);
1681 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1682 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1683 pGroupItemClass->SetEndTime(dateTime);
1684 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1685 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1686 pGroupItemClass->SetStartTime(dateTime);
1687 __pGroupData->Add(*pGroupItemClass);
1689 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1691 pGroupItemClass = new(std::nothrow) GroupItemClass();
1692 if (pGroupItemClass == null)
1696 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1697 pGroupItemClass->SetTitleText(titleText);
1698 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1699 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1700 pGroupItemClass->SetEndTime(dateTime);
1701 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1702 //dateTime.AddDays(currentTime.GetDay() - 28 - 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)
1727 pGroupItemClass->SetTitleText(weeksAgo3);
1728 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1729 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1730 pGroupItemClass->SetEndTime(dateTime);
1731 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1732 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1733 pGroupItemClass->SetStartTime(dateTime);
1734 __pGroupData->Add(*pGroupItemClass);
1736 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1738 pGroupItemClass = new(std::nothrow) GroupItemClass();
1739 if (pGroupItemClass == null)
1743 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1744 pGroupItemClass->SetTitleText(titleText);
1745 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1746 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1747 pGroupItemClass->SetEndTime(dateTime);
1748 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1749 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1750 pGroupItemClass->SetStartTime(dateTime);
1751 __pGroupData->Add(*pGroupItemClass);
1757 pGroupItemClass = new(std::nothrow) GroupItemClass();
1758 if (pGroupItemClass == null)
1762 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1763 pGroupItemClass->SetTitleText(titleText);
1764 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1765 dateTime.AddDays(-1);
1766 pGroupItemClass->SetEndTime(dateTime);
1767 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1768 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1769 pGroupItemClass->SetStartTime(dateTime);
1770 __pGroupData->Add(*pGroupItemClass);
1772 pGroupItemClass = new(std::nothrow) GroupItemClass();
1773 if (pGroupItemClass == null)
1777 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1778 pGroupItemClass->SetTitleText(titleText);
1779 dateTime.SetValue(currentTime.GetYear(),1, 1);
1780 dateTime.AddMonths(currentTime.GetMonth() - 2);
1781 dateTime.AddDays(-1);
1782 pGroupItemClass->SetEndTime(dateTime);
1784 dateTime2.SetValue(0, 0, 0);
1785 pGroupItemClass->SetStartTime(dateTime2);
1786 __pGroupData->Add(*pGroupItemClass);
1790 GroupItemClass::GroupItemClass()
1796 GroupItemClass::operator =(const GroupItemClass& rhs)
1800 __pData = rhs.__pData;
1805 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1807 __pData = groupItem.__pData;
1810 GroupItemClass::~GroupItemClass()
1814 __pData->RemoveAll(true);
1820 GroupItemClass::SetStartTime(DateTime& startTime)
1822 __startTime = startTime;
1826 GroupItemClass::SetEndTime(DateTime& endTime)
1828 __endTime = endTime;
1832 GroupItemClass::SetTitleText(String& titleText)
1834 __titleText = titleText;
1838 GroupItemClass::SetHistoryData(ArrayList* pData)
1844 GroupItemClass::GetStartTime(void)
1850 GroupItemClass::GetEndTime(void)
1856 GroupItemClass::GetTitleText(void)
1862 GroupItemClass::GetHistoryData(void)
1868 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1870 if (__pGroupedListView)
1872 __pGroupedListView->UpdateList();