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;
45 static const wchar_t* IDB_TAB_ICON_BOOKMARKS = L"I01_tab_icon_bookmarks.png";
46 static const wchar_t* IDB_TAB_ICON_HISTORY = L"I01_tab_icon_history.png";
47 static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png";
48 static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png";
51 const int HistoryListForm::IDA_TABBAR_ITEM_1 = 101;
52 const int HistoryListForm::IDA_TABBAR_ITEM_2 = 102;
53 const int HistoryListForm::IDA_EDIT_HISTORY_LIST_FORM = 103;
54 const int HistoryListForm::IDA_FORMAT_ICON = 104;
55 const int HistoryListForm::IDA_FORMAT_TITLE = 105;
56 const int HistoryListForm::IDA_FORMAT_URL = 106;
57 const int HistoryListForm::IDA_FORMAT_BOOKMARK = 107;
60 HistoryListForm::HistoryListForm(void)
62 __pBookmarkList = null;
63 __pGroupedListView =null;
64 __pSearchListView = null;
67 __pSearchedData = null ;
68 __searchHistory = false;
69 __isNoHistoryPresent = true;
71 __previousSceneId = L"";
74 HistoryListForm::~HistoryListForm(void)
76 if (__pGroupData != null)
78 __pGroupData->RemoveAll(false);
81 if(__pBookmarkList != null)
83 __pBookmarkList->RemoveAll(false);
84 delete __pBookmarkList;
89 HistoryListForm::Initialize(void)
91 Construct(L"IDL_HISTORY_LIST");
97 HistoryListForm::OnInitializing(void)
99 AppLog("HistoryListForm::OnInitializing");
100 result r = E_SUCCESS;
101 SceneManager* pSceneManager = null;
104 Header *pHeader = GetHeader();
105 Bitmap *pIconBitmap = null;
106 AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
107 const Color brown = Color(32, 32, 32, 0xFF);
109 // Setup back event listener
110 SetFormBackEventListener(this);
112 GetHeader()->AddActionEventListener(*this);
113 GetFooter()->AddActionEventListener(*this);
115 AddOrientationEventListener(*this);
116 pSceneManager = SceneManager::GetInstance();
117 if (pSceneManager != null)
119 pSceneManager->AddSceneEventListener(IDSCN_HISTORY_LIST, *this);
122 if (pAppResource == null)
127 __pGroupedListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1"));
128 if (__pGroupedListView == null)
133 r = __pGroupedListView->SetItemProvider(*this);
140 __pSearchBar = static_cast< SearchBar* >(GetControl(L"IDC_SEARCHBAR1"));
141 if (__pSearchBar == null)
145 __pSearchListView = new(std::nothrow) GroupedListView();
146 if (__pSearchListView == null)
150 __pGroupedListView->AddGroupedListViewItemEventListener(*this);
151 r = __pGroupedListView->SetBounds(Rectangle(0,__pGroupedListView->GetY(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
156 r = __pSearchListView->Construct(Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height -__pSearchBar->GetHeight() - __pSearchBar->GetY()), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
161 r = __pSearchListView->SetItemProvider(*this);
166 r = __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND"));
173 __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK));
174 __pSearchListView->AddGroupedListViewItemEventListener(*this);
175 r = __pSearchListView->SetShowState(false);
182 __pSearchBar->AddSearchBarEventListener(*this);
183 __pSearchBar->AddKeypadEventListener(*this);
184 r = __pSearchBar->SetContent(__pSearchListView);
188 pHeader->SetStyle(HEADER_STYLE_TAB);
189 bookmark.Construct(IDA_TABBAR_ITEM_1);
191 pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark);
192 bookmark.SetText(strbookmark);
193 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARKS);
194 bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
195 bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
196 pHeader->AddItem(bookmark);
204 history.Construct(IDA_TABBAR_ITEM_2);
206 pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory);
207 history.SetText(strhistory);
208 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY);
209 history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
210 history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
211 pHeader->AddItem(history);
212 pHeader->SetItemSelected(1);
213 pHeader->SetTabEditModeEnabled(false);
215 if (pIconBitmap != NULL)
221 __pBookmarkList = new(std::nothrow) Collection::ArrayList();
222 __pBookmarkList->Construct();
223 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
228 HistoryListForm::OnTerminating(void)
230 result r = E_SUCCESS;
236 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
238 AppLog("HistoryListForm::OnActionPerformed");
239 result r = E_FAILURE;
240 SceneManager* pSceneManager = SceneManager::GetInstance();
241 if (pSceneManager == null)
247 case IDA_EDIT_HISTORY_LIST_FORM:
249 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
250 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
257 case IDA_TABBAR_ITEM_1:
259 result r = GetHeader()->SetItemSelected(1);
260 AppLog("SetItemSelected result %s",GetErrorMessage(r));
261 GetHeader()->Invalidate(true);
263 if (pSceneManager != null)
265 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
267 if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)) != E_SUCCESS)
269 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
276 if(pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT))!= E_SUCCESS)
278 AppLogDebug("BookmarkListForm::OnActionPerformed GoBackward failed");
284 // r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
297 HistoryListForm::OnFormBackRequested(Form& source)
299 SceneManager* pSceneManager = SceneManager::GetInstance();
300 if (pSceneManager == null)
304 result r = E_FAILURE;
305 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
307 r = pSceneManager->GoBackward(BackwardSceneTransition());
311 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
315 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
320 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
322 result r = E_FAILURE;
328 GroupItem* pItem = null;
329 GroupItemClass* pGroupItemClass = null;
331 String weeksAgo2 = L"";
332 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
334 String weeksAgo3 = L"";
335 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
337 String weeksAgo4 = L"";
338 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),4);
340 pItem = new(std::nothrow) GroupItem();
345 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
347 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
349 AppLog("CreateGroupItem :: if history is null");
350 r = pItem->Construct(Dimension(itemWidth, 0));
355 r = pItem->Construct(Dimension(itemWidth, 48));
357 text = pGroupItemClass->GetTitleText();
359 if (__searchHistory == false)
363 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
366 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
367 if ( pGregorianCalendar != NULL)
369 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
376 delete pGregorianCalendar;
379 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
386 delete pGregorianCalendar;
389 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
396 delete pGregorianCalendar;
399 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
401 delete pGregorianCalendar;
407 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
410 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
413 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
416 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
419 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
422 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
425 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
433 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
435 text.Append(pGroupItemClass->GetStartTime().GetDay());
437 strMonth = pGroupItemClass->GetStartTime().GetMonth();
438 month = GetMonth(strMonth);
448 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
449 || 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"))
452 text.Append(pGroupItemClass->GetEndTime().GetDay());
454 strMonth = pGroupItemClass->GetEndTime().GetMonth();
455 month = GetMonth(strMonth);
461 r = pItem->SetElement(text, null);
465 AppLogDebug("Failed with %s", GetErrorMessage(r));
468 r = pItem->SetTextSize(32);
479 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
481 AppLog("HistoryListForm::CreateItem");
482 result r = E_FAILURE;
483 History* pHistory = null;
484 Bitmap* pBitmap = null;
485 Bitmap* pBookmarkBitmap = null;
486 GroupItemClass* pGroupItemClass = null;
487 CustomItem* pItem = new(std::nothrow) CustomItem();
488 int bookmarkBtnWidth = 0;
491 if(__pGroupData == null)
501 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
502 if (pGroupItemClass == null)
507 if (pGroupItemClass->GetHistoryData() == null)
512 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
513 if (pHistory == null)
518 r = pItem->Construct(Dimension(itemWidth, 128), LIST_ANNEX_STYLE_NORMAL);
525 bitmapId = pHistory->GetFaviconId() ;
527 pBitmap = pHistory->GetFavIconBitmap();
531 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
535 r = pItem->AddElement(Rectangle(16, 28, 72, 72), IDA_FORMAT_ICON, *pBitmap, null);
540 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
544 bool urlFoundInBookmark = false;
546 if(__pBookmarkList != null)
548 for (int i = 0; i < __pBookmarkList->GetCount();i++)
550 BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
551 if(pBookMark != null && pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
553 urlFoundInBookmark = true;
558 if (urlFoundInBookmark == true)
560 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
564 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
566 bookmarkBtnWidth = 64;
569 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);
570 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
572 if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
573 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);
575 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);
576 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
577 if ( pBookmarkBitmap != null)
579 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
580 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
581 delete pBookmarkBitmap;
591 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
600 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
602 AppLog("HistoryListForm::DeleteItem");
603 result r = E_FAILURE;
604 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
605 if (pGroupItemClass == null)
610 // if (pGroupItemClass->__pData != null)
612 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
625 HistoryListForm::GetGroupCount(void)
627 __isNoHistoryPresent = true;
629 if (__pGroupData != null)
631 if (__searchHistory == false)
634 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
639 return __pGroupData->GetCount();
644 // String searchText = __pSearchBar->GetText();
645 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
659 HistoryListForm::GetItemCount(int groupIndex)
661 result r = E_FAILURE;
667 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
668 if (pGroupItemClass == null)
672 if (__searchHistory == false)
674 startTime = pGroupItemClass->GetStartTime();
675 endTime = pGroupItemClass->GetEndTime();
676 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
680 //text = __pSearchBar->GetText();
681 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
692 ArrayList* pData = new(std::nothrow) ArrayList();
697 r = pData->Construct();
705 if (__searchHistory == false)
707 startTime = pGroupItemClass->GetStartTime();
708 endTime = pGroupItemClass->GetEndTime();
709 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
710 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
714 //text = __pSearchBar->GetText() ;
715 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
722 pGroupItemClass->SetHistoryData(pData);
725 if (__isNoHistoryPresent == true && count == 0)
727 __isNoHistoryPresent = true;
728 GetFooter()->SetItemEnabled(0, false);
732 __isNoHistoryPresent = false;
733 GetFooter()->SetItemEnabled(0, true);
735 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
736 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
743 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
744 return pGroupItemClass->GetHistoryData()->GetCount();
749 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
752 GetHeader()->SetItemSelected(1);
753 // __previousSceneId = previousSceneId;
754 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
757 pList->GetAt(pList->GetCount()-1,__previousSceneId);
760 AppLog("HistoryListForm::OnSceneActivatedN called");
761 //GetHeader()->Invalidate(true);
762 if (__pGroupData == null)
764 __pGroupData = new(std::nothrow) ArrayList();
765 __pGroupData->Construct();
767 if (__pGroupedListView != null)
769 __pGroupedListView->UpdateList();
771 if (__isNoHistoryPresent == true)
773 GetFooter()->SetItemEnabled(0, false);
777 GetFooter()->SetItemEnabled(0, true);
781 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
784 __pSearchBar->SetShowState(false);
785 __pSearchBar->Invalidate(true);
789 __pSearchBar->SetShowState(true);
790 __pSearchBar->Invalidate(true);
793 // if (__isNoHistoryPresent == true)
795 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
796 // __pGroupedListView->UpdateList();
799 result r = GetHeader()->SetItemSelected(2);
802 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
806 if(__pBookmarkList != null)
808 __pBookmarkList->RemoveAll(false);
811 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
818 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
820 AppLog("HistoryListForm::OnSceneDeactivated");
821 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
825 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
831 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
833 GroupItemClass* pGroupItemClass = null;
834 History* pHistory = null;
835 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
836 if (elementId == IDA_FORMAT_BOOKMARK)
838 String toggledUrl = L"";
839 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
840 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
841 if (pGroupItemClass == null)
845 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
846 if (pHistory == null)
850 toggledUrl = pHistory->GetHistoryUrl();
852 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
854 bool bookmarkFound = false;
855 BookmarkData* pBookMark = null;
856 if(__pBookmarkList != null)
858 for (int i = 0; i < __pBookmarkList->GetCount(); i++)
860 pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
861 if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
863 bookmarkFound = true;
868 if(bookmarkFound == false)
870 // Add the history in bookmark database
871 result r = E_FAILURE;
872 BookmarkData pBookmark;
874 String bookmarkTitle = pHistory->GetHistoryTitle();
876 pBookmark.SetBookmarkTitle(bookmarkTitle);
877 pBookmark.SetUrl(pHistory->GetHistoryUrl());
878 pBookmark.SetFaviconId(pHistory->GetFaviconId());
880 r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
884 // remove the history from bookmark database
885 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
888 if(__pBookmarkList != null)
890 __pBookmarkList->RemoveAll(false);
891 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
893 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
894 listView.UpdateList();
898 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
899 if (pGroupItemClass == null)
904 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
905 if (pHistory1 == null)
909 SceneManager* pSceneManager = SceneManager::GetInstance();
910 ArrayList *pArgList = null;
911 result r = E_SUCCESS;
912 pArgList = new(std::nothrow) ArrayList();
913 if (pArgList != null)
915 r = pArgList->Construct();
922 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
923 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
934 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
936 if (pSceneManager != null)
938 AppLog("pSceneManager exists");
939 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
942 pArgList->RemoveAll(false);
955 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
961 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
963 result r = E_FAILURE;
964 if (mode == SEARCH_BAR_MODE_NORMAL)
966 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
968 __pSearchListView->SetEnabled(true);
971 r = __pSearchListView->SetShowState(false);
976 r = __pGroupedListView->SetShowState(true);
981 __pSearchListView->SetEnabled(true);
982 if(__pSearchBar != null)
983 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
985 __searchHistory = false;
986 r = __pGroupedListView->UpdateList();
987 if (__isNoHistoryPresent == true)
989 GetFooter()->SetItemEnabled(0, false);
993 GetFooter()->SetItemEnabled(0, true);
995 if(__pSearchBar != null)
997 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1006 // __pSearchListView->SetEnabled(false);
1007 r = __pSearchListView->SetShowState(true);
1012 __pSearchListView->SetEnabled(false);
1013 r = __pSearchListView->UpdateList();
1018 r = __pGroupedListView->SetShowState(false);
1023 if(__pSearchBar != null)
1025 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1031 HistoryListForm::GetMonth(int month)
1033 String monthValue = L"";
1037 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1040 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1043 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1046 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1049 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1052 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN"));
1055 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1058 monthValue.Append(CommonUtil::GetString(L"DS_COM_BODY_AUG"));
1061 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1064 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1067 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1070 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1081 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1083 result r = E_FAILURE;
1084 if (__pSearchBar != null)
1086 __pSearchBar->HideKeypad();
1089 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1091 __pSearchListView->SetEnabled(true);
1092 __searchHistory = true;
1093 __searchText =__pSearchBar->GetText();
1095 r = __pGroupedListView->SetShowState(false);
1100 r = __pSearchListView->SetShowState(true);
1105 r= __pSearchListView->UpdateList();
1106 if (__isNoHistoryPresent == true)
1108 GetFooter()->SetItemEnabled(0, false);
1112 GetFooter()->SetItemEnabled(0, true);
1114 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1123 __searchHistory = false;
1129 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1131 result r = E_FAILURE;
1132 if (__pGroupedListView != null)
1134 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1135 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1136 else if(__pSearchBar != null)
1137 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1142 __pGroupedListView->UpdateList();
1144 if (__pSearchListView != null)
1146 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1152 __pSearchListView->UpdateList();
1154 if(__pSearchBar != null)
1155 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1160 if (__isNoHistoryPresent == true)
1162 GetFooter()->SetItemEnabled(0, false);
1166 GetFooter()->SetItemEnabled(0, true);
1171 HistoryListForm::OnKeypadWillOpen(Control& source)
1173 GetFooter()->SetShowState(false);
1174 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1175 __pSearchListView->SetEnabled(false);
1176 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1182 HistoryListForm::OnKeypadOpened(Control& source)
1184 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1188 HistoryListForm::OnKeypadClosed(Control& source)
1191 GetFooter()->SetShowState(true);
1192 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1193 __pSearchListView->Invalidate(false);
1194 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1195 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1200 HistoryListForm::CreateGroupItems()
1202 result r = E_FAILURE;
1203 DateTime currentTime;
1205 GroupItemClass* pGroupItemClass = null;
1208 String weeksAgo2 = L"";
1209 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
1211 String weeksAgo3 = L"";
1212 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1214 if (__pGroupData != null)
1216 __pGroupData->RemoveAll(false);
1217 delete __pGroupData;
1218 __pGroupData = null;
1220 __pGroupData = new(std::nothrow) ArrayList();
1221 if (__pGroupData == null)
1225 r = __pGroupData->Construct();
1228 delete __pGroupData;
1229 __pGroupData = null;
1232 if (__searchHistory == true)
1234 pGroupItemClass = new(std::nothrow) GroupItemClass();
1235 if (pGroupItemClass == null)
1239 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1240 pGroupItemClass->SetTitleText(titleText);
1241 r = __pGroupData->Add(*pGroupItemClass);
1249 Calendar* pGregorianCalendar = null;
1252 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1253 pGroupItemClass = new(std::nothrow) GroupItemClass();
1254 if (pGroupItemClass == null)
1258 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1259 pGroupItemClass->SetTitleText(titleText);
1260 pGroupItemClass->SetEndTime(currentTime);
1261 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1262 pGroupItemClass->SetStartTime(dateTime);
1263 __pGroupData->Add(*pGroupItemClass);
1266 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1267 if ( pGregorianCalendar != NULL )
1269 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1270 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1271 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1272 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1273 delete pGregorianCalendar;
1278 pGroupItemClass = new(std::nothrow) GroupItemClass();
1279 if (pGroupItemClass == null)
1283 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1284 pGroupItemClass->SetTitleText(titleText);
1285 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1286 pGroupItemClass->SetEndTime(dateTime);
1287 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1288 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1289 pGroupItemClass->SetStartTime(dateTime);
1290 __pGroupData->Add(*pGroupItemClass);
1293 pGroupItemClass = new(std::nothrow) GroupItemClass();
1294 if (pGroupItemClass == null)
1298 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1299 pGroupItemClass->SetTitleText(titleText);
1300 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1301 pGroupItemClass->SetEndTime(dateTime);
1302 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1303 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1304 pGroupItemClass->SetStartTime(dateTime);
1305 __pGroupData->Add(*pGroupItemClass);
1308 pGroupItemClass = new(std::nothrow) GroupItemClass();
1309 if (pGroupItemClass == null)
1313 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1314 pGroupItemClass->SetTitleText(titleText);
1315 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1316 pGroupItemClass->SetEndTime(dateTime);
1317 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1318 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1319 pGroupItemClass->SetStartTime(dateTime);
1320 __pGroupData->Add(*pGroupItemClass);
1322 pGroupItemClass = new(std::nothrow) GroupItemClass();
1323 if (pGroupItemClass == null)
1327 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1328 pGroupItemClass->SetTitleText(titleText);
1329 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1330 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1331 pGroupItemClass->SetEndTime(dateTime);
1332 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1333 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1334 pGroupItemClass->SetStartTime(dateTime);
1335 __pGroupData->Add(*pGroupItemClass);
1338 pGroupItemClass = new(std::nothrow) GroupItemClass();
1339 if (pGroupItemClass == null)
1343 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1344 pGroupItemClass->SetTitleText(titleText);
1345 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1346 pGroupItemClass->SetEndTime(dateTime);
1347 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1348 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1349 pGroupItemClass->SetStartTime(dateTime);
1350 __pGroupData->Add(*pGroupItemClass);
1352 pGroupItemClass = new(std::nothrow) GroupItemClass();
1353 if (pGroupItemClass == null)
1357 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1358 pGroupItemClass->SetTitleText(titleText);
1359 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1360 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1361 pGroupItemClass->SetEndTime(dateTime);
1362 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1363 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1364 pGroupItemClass->SetStartTime(dateTime);
1365 __pGroupData->Add(*pGroupItemClass);
1367 pGroupItemClass = new(std::nothrow) GroupItemClass();
1368 if (pGroupItemClass == null)
1372 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1373 pGroupItemClass->SetTitleText(titleText);
1374 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1375 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1376 pGroupItemClass->SetEndTime(dateTime);
1377 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1378 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1379 pGroupItemClass->SetStartTime(dateTime);
1380 __pGroupData->Add(*pGroupItemClass);
1383 pGroupItemClass = new(std::nothrow) GroupItemClass();
1384 if (pGroupItemClass == null)
1388 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1389 pGroupItemClass->SetTitleText(titleText);
1390 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1391 pGroupItemClass->SetEndTime(dateTime);
1392 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1393 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1394 pGroupItemClass->SetStartTime(dateTime);
1395 __pGroupData->Add(*pGroupItemClass);
1397 pGroupItemClass = new(std::nothrow) GroupItemClass();
1398 if (pGroupItemClass == null)
1402 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1403 pGroupItemClass->SetTitleText(titleText);
1404 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1405 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1406 pGroupItemClass->SetEndTime(dateTime);
1407 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1408 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1409 pGroupItemClass->SetStartTime(dateTime);
1410 __pGroupData->Add(*pGroupItemClass);
1412 pGroupItemClass = new(std::nothrow) GroupItemClass();
1413 if (pGroupItemClass == null)
1417 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1418 pGroupItemClass->SetTitleText(titleText);
1419 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1420 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1421 pGroupItemClass->SetEndTime(dateTime);
1422 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1423 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1424 pGroupItemClass->SetStartTime(dateTime);
1425 __pGroupData->Add(*pGroupItemClass);
1427 pGroupItemClass = new(std::nothrow) GroupItemClass();
1428 if (pGroupItemClass == null)
1432 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1433 pGroupItemClass->SetTitleText(titleText);
1434 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1435 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1436 pGroupItemClass->SetEndTime(dateTime);
1437 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1438 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1439 pGroupItemClass->SetStartTime(dateTime);
1440 __pGroupData->Add(*pGroupItemClass);
1443 pGroupItemClass = new(std::nothrow) GroupItemClass();
1444 if (pGroupItemClass == null)
1448 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1449 pGroupItemClass->SetTitleText(titleText);
1450 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1451 pGroupItemClass->SetEndTime(dateTime);
1452 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1453 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1454 pGroupItemClass->SetStartTime(dateTime);
1455 __pGroupData->Add(*pGroupItemClass);
1457 pGroupItemClass = new(std::nothrow) GroupItemClass();
1458 if (pGroupItemClass == null)
1462 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1463 pGroupItemClass->SetTitleText(titleText);
1464 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1465 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1466 pGroupItemClass->SetEndTime(dateTime);
1467 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1468 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1469 pGroupItemClass->SetStartTime(dateTime);
1470 __pGroupData->Add(*pGroupItemClass);
1472 pGroupItemClass = new(std::nothrow) GroupItemClass();
1473 if (pGroupItemClass == null)
1477 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1478 pGroupItemClass->SetTitleText(titleText);
1479 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1480 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1481 pGroupItemClass->SetEndTime(dateTime);
1482 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1483 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1484 pGroupItemClass->SetStartTime(dateTime);
1485 __pGroupData->Add(*pGroupItemClass);
1487 pGroupItemClass = new(std::nothrow) GroupItemClass();
1488 if (pGroupItemClass == null)
1492 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1493 pGroupItemClass->SetTitleText(titleText);
1494 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1495 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1496 pGroupItemClass->SetEndTime(dateTime);
1497 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1498 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1499 pGroupItemClass->SetStartTime(dateTime);
1500 __pGroupData->Add(*pGroupItemClass);
1502 pGroupItemClass = new(std::nothrow) GroupItemClass();
1503 if (pGroupItemClass == null)
1507 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1508 pGroupItemClass->SetTitleText(titleText);
1509 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1510 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1511 pGroupItemClass->SetEndTime(dateTime);
1512 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1513 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1514 pGroupItemClass->SetStartTime(dateTime);
1515 __pGroupData->Add(*pGroupItemClass);
1518 pGroupItemClass = new(std::nothrow) GroupItemClass();
1519 if (pGroupItemClass == null)
1523 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1524 pGroupItemClass->SetTitleText(titleText);
1525 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1526 pGroupItemClass->SetEndTime(dateTime);
1527 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1528 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1529 pGroupItemClass->SetStartTime(dateTime);
1530 __pGroupData->Add(*pGroupItemClass);
1532 pGroupItemClass = new(std::nothrow) GroupItemClass();
1533 if (pGroupItemClass == null)
1537 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1538 pGroupItemClass->SetTitleText(titleText);
1539 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1540 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1541 pGroupItemClass->SetEndTime(dateTime);
1542 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1543 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1544 pGroupItemClass->SetStartTime(dateTime);
1545 __pGroupData->Add(*pGroupItemClass);
1547 pGroupItemClass = new(std::nothrow) GroupItemClass();
1548 if (pGroupItemClass == null)
1552 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1553 pGroupItemClass->SetTitleText(titleText);
1554 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1555 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1556 pGroupItemClass->SetEndTime(dateTime);
1557 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1558 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1559 pGroupItemClass->SetStartTime(dateTime);
1560 __pGroupData->Add(*pGroupItemClass);
1562 pGroupItemClass = new(std::nothrow) GroupItemClass();
1563 if (pGroupItemClass == null)
1567 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1568 pGroupItemClass->SetTitleText(titleText);
1569 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1570 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1571 pGroupItemClass->SetEndTime(dateTime);
1572 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1573 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1574 pGroupItemClass->SetStartTime(dateTime);
1575 __pGroupData->Add(*pGroupItemClass);
1577 pGroupItemClass = new(std::nothrow) GroupItemClass();
1578 if (pGroupItemClass == null)
1582 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1583 pGroupItemClass->SetTitleText(titleText);
1584 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1585 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1586 pGroupItemClass->SetEndTime(dateTime);
1587 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1588 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1589 pGroupItemClass->SetStartTime(dateTime);
1590 __pGroupData->Add(*pGroupItemClass);
1592 pGroupItemClass = new(std::nothrow) GroupItemClass();
1593 if (pGroupItemClass == null)
1597 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1598 pGroupItemClass->SetTitleText(titleText);
1599 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1600 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1601 pGroupItemClass->SetEndTime(dateTime);
1602 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1603 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1604 pGroupItemClass->SetStartTime(dateTime);
1605 __pGroupData->Add(*pGroupItemClass);
1611 day = currentTime.GetDay();
1615 pGroupItemClass = new(std::nothrow) GroupItemClass();
1616 if (pGroupItemClass == null)
1621 pGroupItemClass->SetTitleText(weeksAgo2);
1622 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1623 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1624 pGroupItemClass->SetEndTime(dateTime);
1625 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1626 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1627 pGroupItemClass->SetStartTime(dateTime);
1628 __pGroupData->Add(*pGroupItemClass);
1630 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1632 pGroupItemClass = new(std::nothrow) GroupItemClass();
1633 if (pGroupItemClass == null)
1637 String weeksAgo3 = L"";
1638 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1639 pGroupItemClass->SetTitleText(weeksAgo3);
1640 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1641 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1642 pGroupItemClass->SetEndTime(dateTime);
1643 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1644 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1645 pGroupItemClass->SetStartTime(dateTime);
1646 __pGroupData->Add(*pGroupItemClass);
1650 pGroupItemClass = new(std::nothrow) GroupItemClass();
1651 if (pGroupItemClass == null)
1655 pGroupItemClass->SetTitleText(weeksAgo2);
1656 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1657 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1658 pGroupItemClass->SetEndTime(dateTime);
1659 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1660 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1661 pGroupItemClass->SetStartTime(dateTime);
1662 __pGroupData->Add(*pGroupItemClass);
1664 pGroupItemClass = new(std::nothrow) GroupItemClass();
1665 if (pGroupItemClass == null)
1670 pGroupItemClass->SetTitleText(weeksAgo3);
1671 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1672 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1673 pGroupItemClass->SetEndTime(dateTime);
1674 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1675 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1676 pGroupItemClass->SetStartTime(dateTime);
1677 __pGroupData->Add(*pGroupItemClass);
1679 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1681 pGroupItemClass = new(std::nothrow) GroupItemClass();
1682 if (pGroupItemClass == null)
1686 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1687 pGroupItemClass->SetTitleText(titleText);
1688 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1689 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1690 pGroupItemClass->SetEndTime(dateTime);
1691 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1692 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1693 pGroupItemClass->SetStartTime(dateTime);
1694 __pGroupData->Add(*pGroupItemClass);
1698 pGroupItemClass = new(std::nothrow) GroupItemClass();
1699 if (pGroupItemClass == null)
1703 pGroupItemClass->SetTitleText(weeksAgo2);
1704 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1705 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1706 pGroupItemClass->SetEndTime(dateTime);
1707 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1708 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1709 pGroupItemClass->SetStartTime(dateTime);
1710 __pGroupData->Add(*pGroupItemClass);
1712 pGroupItemClass = new(std::nothrow) GroupItemClass();
1713 if (pGroupItemClass == null)
1717 pGroupItemClass->SetTitleText(weeksAgo3);
1718 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1719 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1720 pGroupItemClass->SetEndTime(dateTime);
1721 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1722 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1723 pGroupItemClass->SetStartTime(dateTime);
1724 __pGroupData->Add(*pGroupItemClass);
1726 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1728 pGroupItemClass = new(std::nothrow) GroupItemClass();
1729 if (pGroupItemClass == null)
1733 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1734 pGroupItemClass->SetTitleText(titleText);
1735 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1736 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1737 pGroupItemClass->SetEndTime(dateTime);
1738 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1739 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1740 pGroupItemClass->SetStartTime(dateTime);
1741 __pGroupData->Add(*pGroupItemClass);
1747 pGroupItemClass = new(std::nothrow) GroupItemClass();
1748 if (pGroupItemClass == null)
1752 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1753 pGroupItemClass->SetTitleText(titleText);
1754 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1755 dateTime.AddDays(-1);
1756 pGroupItemClass->SetEndTime(dateTime);
1757 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1758 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1759 pGroupItemClass->SetStartTime(dateTime);
1760 __pGroupData->Add(*pGroupItemClass);
1762 pGroupItemClass = new(std::nothrow) GroupItemClass();
1763 if (pGroupItemClass == null)
1767 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1768 pGroupItemClass->SetTitleText(titleText);
1769 dateTime.SetValue(currentTime.GetYear(),1, 1);
1770 dateTime.AddMonths(currentTime.GetMonth() - 2);
1771 dateTime.AddDays(-1);
1772 pGroupItemClass->SetEndTime(dateTime);
1774 dateTime2.SetValue(0, 0, 0);
1775 pGroupItemClass->SetStartTime(dateTime2);
1776 __pGroupData->Add(*pGroupItemClass);
1780 GroupItemClass::GroupItemClass()
1786 GroupItemClass::operator =(const GroupItemClass& rhs)
1790 __pData = rhs.__pData;
1795 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1797 __pData = groupItem.__pData;
1800 GroupItemClass::~GroupItemClass()
1804 __pData->RemoveAll(true);
1810 GroupItemClass::SetStartTime(DateTime& startTime)
1812 __startTime = startTime;
1816 GroupItemClass::SetEndTime(DateTime& endTime)
1818 __endTime = endTime;
1822 GroupItemClass::SetTitleText(String& titleText)
1824 __titleText = titleText;
1828 GroupItemClass::SetHistoryData(ArrayList* pData)
1834 GroupItemClass::GetStartTime(void)
1840 GroupItemClass::GetEndTime(void)
1846 GroupItemClass::GetTitleText(void)
1852 GroupItemClass::GetHistoryData(void)