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);
214 if (pIconBitmap != NULL)
220 __pBookmarkList = new(std::nothrow) Collection::ArrayList();
221 __pBookmarkList->Construct();
222 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
227 HistoryListForm::OnTerminating(void)
229 result r = E_SUCCESS;
235 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
237 AppLog("HistoryListForm::OnActionPerformed");
238 result r = E_FAILURE;
239 SceneManager* pSceneManager = SceneManager::GetInstance();
240 if (pSceneManager == null)
246 case IDA_EDIT_HISTORY_LIST_FORM:
248 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
249 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
256 case IDA_TABBAR_ITEM_1:
258 result r = GetHeader()->SetItemSelected(1);
259 AppLog("SetItemSelected result %s",GetErrorMessage(r));
260 GetHeader()->Invalidate(true);
262 if (pSceneManager != null)
264 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
266 if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)) != E_SUCCESS)
268 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
275 if(pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT))!= E_SUCCESS)
277 AppLogDebug("BookmarkListForm::OnActionPerformed GoBackward failed");
287 // r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
300 HistoryListForm::OnFormBackRequested(Form& source)
302 SceneManager* pSceneManager = SceneManager::GetInstance();
303 if (pSceneManager == null)
307 result r = E_FAILURE;
308 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
310 r = pSceneManager->GoBackward(BackwardSceneTransition());
314 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
318 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
323 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
325 result r = E_FAILURE;
331 GroupItem* pItem = null;
332 GroupItemClass* pGroupItemClass = null;
334 String weeksAgo2 = L"";
335 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
337 String weeksAgo3 = L"";
338 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
340 String weeksAgo4 = L"";
341 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),4);
343 pItem = new(std::nothrow) GroupItem();
348 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
350 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
352 AppLog("CreateGroupItem :: if history is null");
353 r = pItem->Construct(Dimension(itemWidth, 0));
358 r = pItem->Construct(Dimension(itemWidth, 48));
360 text = pGroupItemClass->GetTitleText();
362 if (__searchHistory == false)
366 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
369 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
370 if ( pGregorianCalendar != NULL)
372 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
379 delete pGregorianCalendar;
382 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
389 delete pGregorianCalendar;
392 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
399 delete pGregorianCalendar;
402 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
404 delete pGregorianCalendar;
410 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
413 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
416 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
419 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
422 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
425 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
428 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
436 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
438 text.Append(pGroupItemClass->GetStartTime().GetDay());
440 strMonth = pGroupItemClass->GetStartTime().GetMonth();
441 month = GetMonth(strMonth);
451 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
452 || 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"))
455 text.Append(pGroupItemClass->GetEndTime().GetDay());
457 strMonth = pGroupItemClass->GetEndTime().GetMonth();
458 month = GetMonth(strMonth);
464 r = pItem->SetElement(text, null);
468 AppLogDebug("Failed with %s", GetErrorMessage(r));
471 r = pItem->SetTextSize(32);
482 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
484 AppLog("HistoryListForm::CreateItem");
485 result r = E_FAILURE;
486 History* pHistory = null;
487 Bitmap* pBitmap = null;
488 Bitmap* pBookmarkBitmap = null;
489 GroupItemClass* pGroupItemClass = null;
490 CustomItem* pItem = new(std::nothrow) CustomItem();
491 int bookmarkBtnWidth = 0;
494 if(__pGroupData == null)
504 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
505 if (pGroupItemClass == null)
510 if (pGroupItemClass->GetHistoryData() == null)
515 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
516 if (pHistory == null)
521 r = pItem->Construct(Dimension(itemWidth, 128), LIST_ANNEX_STYLE_NORMAL);
528 bitmapId = pHistory->GetFaviconId() ;
530 pBitmap = pHistory->GetFavIconBitmap();
534 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
538 r = pItem->AddElement(Rectangle(16, 28, 72, 72), IDA_FORMAT_ICON, *pBitmap, null);
543 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
547 bool urlFoundInBookmark = false;
549 if(__pBookmarkList != null)
551 for (int i = 0; i < __pBookmarkList->GetCount();i++)
553 BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
554 if(pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
556 urlFoundInBookmark = true;
561 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
565 if (urlFoundInBookmark == true)
567 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
571 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
573 bookmarkBtnWidth = 64;
576 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);
577 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
579 if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
580 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);
582 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);
583 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
584 if ( pBookmarkBitmap != null)
586 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
587 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
588 delete pBookmarkBitmap;
598 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
607 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
609 AppLog("HistoryListForm::DeleteItem");
610 result r = E_FAILURE;
611 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
612 if (pGroupItemClass == null)
617 // if (pGroupItemClass->__pData != null)
619 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
632 HistoryListForm::GetGroupCount(void)
634 __isNoHistoryPresent = true;
636 if (__pGroupData != null)
638 if (__searchHistory == false)
641 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
646 return __pGroupData->GetCount();
651 // String searchText = __pSearchBar->GetText();
652 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
666 HistoryListForm::GetItemCount(int groupIndex)
668 result r = E_FAILURE;
674 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
675 if (pGroupItemClass == null)
679 if (__searchHistory == false)
681 startTime = pGroupItemClass->GetStartTime();
682 endTime = pGroupItemClass->GetEndTime();
683 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
687 //text = __pSearchBar->GetText();
688 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
699 ArrayList* pData = new(std::nothrow) ArrayList();
704 r = pData->Construct();
712 if (__searchHistory == false)
714 startTime = pGroupItemClass->GetStartTime();
715 endTime = pGroupItemClass->GetEndTime();
716 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
717 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
721 //text = __pSearchBar->GetText() ;
722 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
729 pGroupItemClass->SetHistoryData(pData);
732 if (__isNoHistoryPresent == true && count == 0)
734 __isNoHistoryPresent = true;
735 GetFooter()->SetItemEnabled(0, false);
739 __isNoHistoryPresent = false;
740 GetFooter()->SetItemEnabled(0, true);
742 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
743 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
750 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
751 return pGroupItemClass->GetHistoryData()->GetCount();
756 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
759 GetHeader()->SetItemSelected(1);
760 // __previousSceneId = previousSceneId;
761 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
764 pList->GetAt(pList->GetCount()-1,__previousSceneId);
767 AppLog("HistoryListForm::OnSceneActivatedN called");
768 //GetHeader()->Invalidate(true);
769 if (__pGroupData == null)
771 __pGroupData = new(std::nothrow) ArrayList();
772 __pGroupData->Construct();
774 if (__pGroupedListView != null)
776 __pGroupedListView->UpdateList();
778 if (__isNoHistoryPresent == true)
780 GetFooter()->SetItemEnabled(0, false);
784 GetFooter()->SetItemEnabled(0, true);
788 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
791 __pSearchBar->SetShowState(false);
792 __pSearchBar->Invalidate(true);
796 __pSearchBar->SetShowState(true);
797 __pSearchBar->Invalidate(true);
800 // if (__isNoHistoryPresent == true)
802 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
803 // __pGroupedListView->UpdateList();
806 result r = GetHeader()->SetItemSelected(2);
809 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
813 if(__pBookmarkList != null)
815 __pBookmarkList->RemoveAll(false);
818 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
825 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
827 AppLog("HistoryListForm::OnSceneDeactivated");
828 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
832 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
838 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
840 GroupItemClass* pGroupItemClass = null;
841 History* pHistory = null;
842 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
843 if (elementId == IDA_FORMAT_BOOKMARK)
845 String toggledUrl = L"";
846 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
847 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
848 if (pGroupItemClass == null)
852 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
853 if (pHistory == null)
857 toggledUrl = pHistory->GetHistoryUrl();
859 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
861 bool bookmarkFound = false;
862 BookmarkData* pBookMark = null;
863 if(__pBookmarkList != null)
865 for (int i = 0; i < __pBookmarkList->GetCount(); i++)
867 pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
868 if (toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
870 bookmarkFound = true;
875 if(bookmarkFound == false)
877 // Add the history in bookmark database
878 result r = E_FAILURE;
879 BookmarkData pBookmark;
881 String bookmarkTitle = pHistory->GetHistoryTitle();
883 pBookmark.SetBookmarkTitle(bookmarkTitle);
884 pBookmark.SetUrl(pHistory->GetHistoryUrl());
885 pBookmark.SetFaviconId(pHistory->GetFaviconId());
887 r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
891 // remove the history from bookmark database
892 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
895 if(__pBookmarkList != null)
897 __pBookmarkList->RemoveAll(false);
898 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
900 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
901 listView.UpdateList();
905 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
906 if (pGroupItemClass == null)
911 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
912 if (pHistory1 == null)
916 SceneManager* pSceneManager = SceneManager::GetInstance();
917 ArrayList *pArgList = null;
918 result r = E_SUCCESS;
919 pArgList = new(std::nothrow) ArrayList();
920 if (pArgList != null)
922 r = pArgList->Construct();
929 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
930 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
941 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
943 if (pSceneManager != null)
945 AppLog("pSceneManager exists");
946 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
949 pArgList->RemoveAll(false);
962 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
968 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
970 result r = E_FAILURE;
971 if (mode == SEARCH_BAR_MODE_NORMAL)
973 // __pSearchBar->SetMode(SEARCH_BAR_MODE_INPUT);
974 r = __pSearchListView->SetShowState(false);
979 r = __pGroupedListView->SetShowState(true);
984 __pSearchListView->SetEnabled(true);
985 if(__pSearchBar != null)
986 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
988 __searchHistory = false;
989 r = __pGroupedListView->UpdateList();
990 if (__isNoHistoryPresent == true)
992 GetFooter()->SetItemEnabled(0, false);
996 GetFooter()->SetItemEnabled(0, true);
998 if(__pSearchBar != null)
1000 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1009 // __pSearchListView->SetEnabled(false);
1010 r = __pSearchListView->SetShowState(true);
1015 __pSearchListView->SetEnabled(false);
1016 r = __pSearchListView->UpdateList();
1021 r = __pGroupedListView->SetShowState(false);
1026 if(__pSearchBar != null)
1028 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1034 HistoryListForm::GetMonth(int month)
1036 String monthValue = L"";
1040 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1043 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1046 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1049 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1052 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1055 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN"));
1058 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1061 monthValue.Append(CommonUtil::GetString(L"DS_COM_BODY_AUG"));
1064 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1067 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1070 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1073 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1084 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1086 result r = E_FAILURE;
1087 if (__pSearchBar != null)
1089 __pSearchBar->HideKeypad();
1092 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1094 __pSearchListView->SetEnabled(true);
1095 __searchHistory = true;
1096 __searchText =__pSearchBar->GetText();
1098 r = __pGroupedListView->SetShowState(false);
1103 r = __pSearchListView->SetShowState(true);
1108 r= __pSearchListView->UpdateList();
1109 if (__isNoHistoryPresent == true)
1111 GetFooter()->SetItemEnabled(0, false);
1115 GetFooter()->SetItemEnabled(0, true);
1117 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1126 __searchHistory = false;
1132 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1134 result r = E_FAILURE;
1135 if (__pGroupedListView != null)
1137 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1138 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1139 else if(__pSearchBar != null)
1140 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1145 __pGroupedListView->UpdateList();
1147 if (__pSearchListView != null)
1149 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1155 __pSearchListView->UpdateList();
1157 if(__pSearchBar != null)
1158 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1163 if (__isNoHistoryPresent == true)
1165 GetFooter()->SetItemEnabled(0, false);
1169 GetFooter()->SetItemEnabled(0, true);
1174 HistoryListForm::OnKeypadWillOpen(Control& source)
1176 GetFooter()->SetShowState(false);
1177 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1178 __pSearchListView->SetEnabled(false);
1179 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1185 HistoryListForm::OnKeypadOpened(Control& source)
1187 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1191 HistoryListForm::OnKeypadClosed(Control& source)
1193 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1195 // __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
1196 __pSearchListView->SetEnabled(true);
1199 GetFooter()->SetShowState(true);
1200 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1201 __pSearchListView->Invalidate(false);
1202 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1203 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1208 HistoryListForm::CreateGroupItems()
1210 result r = E_FAILURE;
1211 DateTime currentTime;
1213 GroupItemClass* pGroupItemClass = null;
1216 String weeksAgo2 = L"";
1217 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
1219 String weeksAgo3 = L"";
1220 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1222 if (__pGroupData != null)
1224 __pGroupData->RemoveAll(false);
1225 delete __pGroupData;
1226 __pGroupData = null;
1228 __pGroupData = new(std::nothrow) ArrayList();
1229 if (__pGroupData == null)
1233 r = __pGroupData->Construct();
1236 delete __pGroupData;
1237 __pGroupData = null;
1240 if (__searchHistory == true)
1242 pGroupItemClass = new(std::nothrow) GroupItemClass();
1243 if (pGroupItemClass == null)
1247 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1248 pGroupItemClass->SetTitleText(titleText);
1249 r = __pGroupData->Add(*pGroupItemClass);
1257 Calendar* pGregorianCalendar = null;
1260 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1261 pGroupItemClass = new(std::nothrow) GroupItemClass();
1262 if (pGroupItemClass == null)
1266 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1267 pGroupItemClass->SetTitleText(titleText);
1268 pGroupItemClass->SetEndTime(currentTime);
1269 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1270 pGroupItemClass->SetStartTime(dateTime);
1271 __pGroupData->Add(*pGroupItemClass);
1274 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1275 if ( pGregorianCalendar != NULL )
1277 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1278 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1279 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1280 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1281 delete pGregorianCalendar;
1286 pGroupItemClass = new(std::nothrow) GroupItemClass();
1287 if (pGroupItemClass == null)
1291 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1292 pGroupItemClass->SetTitleText(titleText);
1293 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1294 pGroupItemClass->SetEndTime(dateTime);
1295 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1296 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1297 pGroupItemClass->SetStartTime(dateTime);
1298 __pGroupData->Add(*pGroupItemClass);
1301 pGroupItemClass = new(std::nothrow) GroupItemClass();
1302 if (pGroupItemClass == null)
1306 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1307 pGroupItemClass->SetTitleText(titleText);
1308 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1309 pGroupItemClass->SetEndTime(dateTime);
1310 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1311 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1312 pGroupItemClass->SetStartTime(dateTime);
1313 __pGroupData->Add(*pGroupItemClass);
1316 pGroupItemClass = new(std::nothrow) GroupItemClass();
1317 if (pGroupItemClass == null)
1321 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1322 pGroupItemClass->SetTitleText(titleText);
1323 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1324 pGroupItemClass->SetEndTime(dateTime);
1325 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1326 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1327 pGroupItemClass->SetStartTime(dateTime);
1328 __pGroupData->Add(*pGroupItemClass);
1330 pGroupItemClass = new(std::nothrow) GroupItemClass();
1331 if (pGroupItemClass == null)
1335 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1336 pGroupItemClass->SetTitleText(titleText);
1337 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1338 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1339 pGroupItemClass->SetEndTime(dateTime);
1340 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1341 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1342 pGroupItemClass->SetStartTime(dateTime);
1343 __pGroupData->Add(*pGroupItemClass);
1346 pGroupItemClass = new(std::nothrow) GroupItemClass();
1347 if (pGroupItemClass == null)
1351 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1352 pGroupItemClass->SetTitleText(titleText);
1353 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1354 pGroupItemClass->SetEndTime(dateTime);
1355 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1356 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1357 pGroupItemClass->SetStartTime(dateTime);
1358 __pGroupData->Add(*pGroupItemClass);
1360 pGroupItemClass = new(std::nothrow) GroupItemClass();
1361 if (pGroupItemClass == null)
1365 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1366 pGroupItemClass->SetTitleText(titleText);
1367 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1368 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1369 pGroupItemClass->SetEndTime(dateTime);
1370 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1371 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1372 pGroupItemClass->SetStartTime(dateTime);
1373 __pGroupData->Add(*pGroupItemClass);
1375 pGroupItemClass = new(std::nothrow) GroupItemClass();
1376 if (pGroupItemClass == null)
1380 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1381 pGroupItemClass->SetTitleText(titleText);
1382 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1383 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1384 pGroupItemClass->SetEndTime(dateTime);
1385 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1386 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1387 pGroupItemClass->SetStartTime(dateTime);
1388 __pGroupData->Add(*pGroupItemClass);
1391 pGroupItemClass = new(std::nothrow) GroupItemClass();
1392 if (pGroupItemClass == null)
1396 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1397 pGroupItemClass->SetTitleText(titleText);
1398 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1399 pGroupItemClass->SetEndTime(dateTime);
1400 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1401 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1402 pGroupItemClass->SetStartTime(dateTime);
1403 __pGroupData->Add(*pGroupItemClass);
1405 pGroupItemClass = new(std::nothrow) GroupItemClass();
1406 if (pGroupItemClass == null)
1410 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1411 pGroupItemClass->SetTitleText(titleText);
1412 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1413 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1414 pGroupItemClass->SetEndTime(dateTime);
1415 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1416 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1417 pGroupItemClass->SetStartTime(dateTime);
1418 __pGroupData->Add(*pGroupItemClass);
1420 pGroupItemClass = new(std::nothrow) GroupItemClass();
1421 if (pGroupItemClass == null)
1425 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1426 pGroupItemClass->SetTitleText(titleText);
1427 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1428 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1429 pGroupItemClass->SetEndTime(dateTime);
1430 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1431 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1432 pGroupItemClass->SetStartTime(dateTime);
1433 __pGroupData->Add(*pGroupItemClass);
1435 pGroupItemClass = new(std::nothrow) GroupItemClass();
1436 if (pGroupItemClass == null)
1440 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1441 pGroupItemClass->SetTitleText(titleText);
1442 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1443 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1444 pGroupItemClass->SetEndTime(dateTime);
1445 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1446 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1447 pGroupItemClass->SetStartTime(dateTime);
1448 __pGroupData->Add(*pGroupItemClass);
1451 pGroupItemClass = new(std::nothrow) GroupItemClass();
1452 if (pGroupItemClass == null)
1456 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1457 pGroupItemClass->SetTitleText(titleText);
1458 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1459 pGroupItemClass->SetEndTime(dateTime);
1460 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1461 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1462 pGroupItemClass->SetStartTime(dateTime);
1463 __pGroupData->Add(*pGroupItemClass);
1465 pGroupItemClass = new(std::nothrow) GroupItemClass();
1466 if (pGroupItemClass == null)
1470 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1471 pGroupItemClass->SetTitleText(titleText);
1472 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1473 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1474 pGroupItemClass->SetEndTime(dateTime);
1475 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1476 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1477 pGroupItemClass->SetStartTime(dateTime);
1478 __pGroupData->Add(*pGroupItemClass);
1480 pGroupItemClass = new(std::nothrow) GroupItemClass();
1481 if (pGroupItemClass == null)
1485 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1486 pGroupItemClass->SetTitleText(titleText);
1487 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1488 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1489 pGroupItemClass->SetEndTime(dateTime);
1490 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1491 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1492 pGroupItemClass->SetStartTime(dateTime);
1493 __pGroupData->Add(*pGroupItemClass);
1495 pGroupItemClass = new(std::nothrow) GroupItemClass();
1496 if (pGroupItemClass == null)
1500 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1501 pGroupItemClass->SetTitleText(titleText);
1502 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1503 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1504 pGroupItemClass->SetEndTime(dateTime);
1505 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1506 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1507 pGroupItemClass->SetStartTime(dateTime);
1508 __pGroupData->Add(*pGroupItemClass);
1510 pGroupItemClass = new(std::nothrow) GroupItemClass();
1511 if (pGroupItemClass == null)
1515 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1516 pGroupItemClass->SetTitleText(titleText);
1517 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1518 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1519 pGroupItemClass->SetEndTime(dateTime);
1520 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1521 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1522 pGroupItemClass->SetStartTime(dateTime);
1523 __pGroupData->Add(*pGroupItemClass);
1526 pGroupItemClass = new(std::nothrow) GroupItemClass();
1527 if (pGroupItemClass == null)
1531 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1532 pGroupItemClass->SetTitleText(titleText);
1533 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1534 pGroupItemClass->SetEndTime(dateTime);
1535 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1536 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1537 pGroupItemClass->SetStartTime(dateTime);
1538 __pGroupData->Add(*pGroupItemClass);
1540 pGroupItemClass = new(std::nothrow) GroupItemClass();
1541 if (pGroupItemClass == null)
1545 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1546 pGroupItemClass->SetTitleText(titleText);
1547 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1548 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1549 pGroupItemClass->SetEndTime(dateTime);
1550 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1551 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1552 pGroupItemClass->SetStartTime(dateTime);
1553 __pGroupData->Add(*pGroupItemClass);
1555 pGroupItemClass = new(std::nothrow) GroupItemClass();
1556 if (pGroupItemClass == null)
1560 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1561 pGroupItemClass->SetTitleText(titleText);
1562 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1563 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1564 pGroupItemClass->SetEndTime(dateTime);
1565 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1566 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1567 pGroupItemClass->SetStartTime(dateTime);
1568 __pGroupData->Add(*pGroupItemClass);
1570 pGroupItemClass = new(std::nothrow) GroupItemClass();
1571 if (pGroupItemClass == null)
1575 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1576 pGroupItemClass->SetTitleText(titleText);
1577 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1578 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1579 pGroupItemClass->SetEndTime(dateTime);
1580 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1581 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1582 pGroupItemClass->SetStartTime(dateTime);
1583 __pGroupData->Add(*pGroupItemClass);
1585 pGroupItemClass = new(std::nothrow) GroupItemClass();
1586 if (pGroupItemClass == null)
1590 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1591 pGroupItemClass->SetTitleText(titleText);
1592 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1593 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1594 pGroupItemClass->SetEndTime(dateTime);
1595 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1596 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1597 pGroupItemClass->SetStartTime(dateTime);
1598 __pGroupData->Add(*pGroupItemClass);
1600 pGroupItemClass = new(std::nothrow) GroupItemClass();
1601 if (pGroupItemClass == null)
1605 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1606 pGroupItemClass->SetTitleText(titleText);
1607 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1608 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1609 pGroupItemClass->SetEndTime(dateTime);
1610 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1611 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1612 pGroupItemClass->SetStartTime(dateTime);
1613 __pGroupData->Add(*pGroupItemClass);
1619 day = currentTime.GetDay();
1623 pGroupItemClass = new(std::nothrow) GroupItemClass();
1624 if (pGroupItemClass == null)
1629 pGroupItemClass->SetTitleText(weeksAgo2);
1630 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1631 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1632 pGroupItemClass->SetEndTime(dateTime);
1633 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1634 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1635 pGroupItemClass->SetStartTime(dateTime);
1636 __pGroupData->Add(*pGroupItemClass);
1638 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1640 pGroupItemClass = new(std::nothrow) GroupItemClass();
1641 if (pGroupItemClass == null)
1645 String weeksAgo3 = L"";
1646 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1647 pGroupItemClass->SetTitleText(weeksAgo3);
1648 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1649 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1650 pGroupItemClass->SetEndTime(dateTime);
1651 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1652 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1653 pGroupItemClass->SetStartTime(dateTime);
1654 __pGroupData->Add(*pGroupItemClass);
1658 pGroupItemClass = new(std::nothrow) GroupItemClass();
1659 if (pGroupItemClass == null)
1663 pGroupItemClass->SetTitleText(weeksAgo2);
1664 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1665 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1666 pGroupItemClass->SetEndTime(dateTime);
1667 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1668 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1669 pGroupItemClass->SetStartTime(dateTime);
1670 __pGroupData->Add(*pGroupItemClass);
1672 pGroupItemClass = new(std::nothrow) GroupItemClass();
1673 if (pGroupItemClass == null)
1678 pGroupItemClass->SetTitleText(weeksAgo3);
1679 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1680 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1681 pGroupItemClass->SetEndTime(dateTime);
1682 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1683 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1684 pGroupItemClass->SetStartTime(dateTime);
1685 __pGroupData->Add(*pGroupItemClass);
1687 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1689 pGroupItemClass = new(std::nothrow) GroupItemClass();
1690 if (pGroupItemClass == null)
1694 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1695 pGroupItemClass->SetTitleText(titleText);
1696 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1697 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1698 pGroupItemClass->SetEndTime(dateTime);
1699 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1700 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1701 pGroupItemClass->SetStartTime(dateTime);
1702 __pGroupData->Add(*pGroupItemClass);
1706 pGroupItemClass = new(std::nothrow) GroupItemClass();
1707 if (pGroupItemClass == null)
1711 pGroupItemClass->SetTitleText(weeksAgo2);
1712 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1713 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1714 pGroupItemClass->SetEndTime(dateTime);
1715 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1716 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1717 pGroupItemClass->SetStartTime(dateTime);
1718 __pGroupData->Add(*pGroupItemClass);
1720 pGroupItemClass = new(std::nothrow) GroupItemClass();
1721 if (pGroupItemClass == null)
1725 pGroupItemClass->SetTitleText(weeksAgo3);
1726 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1727 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1728 pGroupItemClass->SetEndTime(dateTime);
1729 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1730 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1731 pGroupItemClass->SetStartTime(dateTime);
1732 __pGroupData->Add(*pGroupItemClass);
1734 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1736 pGroupItemClass = new(std::nothrow) GroupItemClass();
1737 if (pGroupItemClass == null)
1741 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1742 pGroupItemClass->SetTitleText(titleText);
1743 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1744 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1745 pGroupItemClass->SetEndTime(dateTime);
1746 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1747 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1748 pGroupItemClass->SetStartTime(dateTime);
1749 __pGroupData->Add(*pGroupItemClass);
1755 pGroupItemClass = new(std::nothrow) GroupItemClass();
1756 if (pGroupItemClass == null)
1760 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1761 pGroupItemClass->SetTitleText(titleText);
1762 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1763 dateTime.AddDays(-1);
1764 pGroupItemClass->SetEndTime(dateTime);
1765 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1766 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1767 pGroupItemClass->SetStartTime(dateTime);
1768 __pGroupData->Add(*pGroupItemClass);
1770 pGroupItemClass = new(std::nothrow) GroupItemClass();
1771 if (pGroupItemClass == null)
1775 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1776 pGroupItemClass->SetTitleText(titleText);
1777 dateTime.SetValue(currentTime.GetYear(),1, 1);
1778 dateTime.AddMonths(currentTime.GetMonth() - 2);
1779 dateTime.AddDays(-1);
1780 pGroupItemClass->SetEndTime(dateTime);
1782 dateTime2.SetValue(0, 0, 0);
1783 pGroupItemClass->SetStartTime(dateTime2);
1784 __pGroupData->Add(*pGroupItemClass);
1788 GroupItemClass::GroupItemClass()
1794 GroupItemClass::operator =(const GroupItemClass& rhs)
1798 __pData = rhs.__pData;
1803 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1805 __pData = groupItem.__pData;
1808 GroupItemClass::~GroupItemClass()
1812 __pData->RemoveAll(true);
1818 GroupItemClass::SetStartTime(DateTime& startTime)
1820 __startTime = startTime;
1824 GroupItemClass::SetEndTime(DateTime& endTime)
1826 __endTime = endTime;
1830 GroupItemClass::SetTitleText(String& titleText)
1832 __titleText = titleText;
1836 GroupItemClass::SetHistoryData(ArrayList* pData)
1842 GroupItemClass::GetStartTime(void)
1848 GroupItemClass::GetEndTime(void)
1854 GroupItemClass::GetTitleText(void)
1860 GroupItemClass::GetHistoryData(void)