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(pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
553 urlFoundInBookmark = true;
558 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
562 if (urlFoundInBookmark == true)
564 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
568 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
570 bookmarkBtnWidth = 64;
573 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);
574 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
576 if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
577 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);
579 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);
580 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
581 if ( pBookmarkBitmap != null)
583 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
584 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
585 delete pBookmarkBitmap;
595 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
604 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
606 AppLog("HistoryListForm::DeleteItem");
607 result r = E_FAILURE;
608 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
609 if (pGroupItemClass == null)
614 // if (pGroupItemClass->__pData != null)
616 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
629 HistoryListForm::GetGroupCount(void)
631 __isNoHistoryPresent = true;
633 if (__pGroupData != null)
635 if (__searchHistory == false)
638 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
643 return __pGroupData->GetCount();
648 // String searchText = __pSearchBar->GetText();
649 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
663 HistoryListForm::GetItemCount(int groupIndex)
665 result r = E_FAILURE;
671 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
672 if (pGroupItemClass == null)
676 if (__searchHistory == false)
678 startTime = pGroupItemClass->GetStartTime();
679 endTime = pGroupItemClass->GetEndTime();
680 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
684 //text = __pSearchBar->GetText();
685 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
696 ArrayList* pData = new(std::nothrow) ArrayList();
701 r = pData->Construct();
709 if (__searchHistory == false)
711 startTime = pGroupItemClass->GetStartTime();
712 endTime = pGroupItemClass->GetEndTime();
713 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
714 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
718 //text = __pSearchBar->GetText() ;
719 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
726 pGroupItemClass->SetHistoryData(pData);
729 if (__isNoHistoryPresent == true && count == 0)
731 __isNoHistoryPresent = true;
732 GetFooter()->SetItemEnabled(0, false);
736 __isNoHistoryPresent = false;
737 GetFooter()->SetItemEnabled(0, true);
739 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
740 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
747 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
748 return pGroupItemClass->GetHistoryData()->GetCount();
753 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
756 GetHeader()->SetItemSelected(1);
757 // __previousSceneId = previousSceneId;
758 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
761 pList->GetAt(pList->GetCount()-1,__previousSceneId);
764 AppLog("HistoryListForm::OnSceneActivatedN called");
765 //GetHeader()->Invalidate(true);
766 if (__pGroupData == null)
768 __pGroupData = new(std::nothrow) ArrayList();
769 __pGroupData->Construct();
771 if (__pGroupedListView != null)
773 __pGroupedListView->UpdateList();
775 if (__isNoHistoryPresent == true)
777 GetFooter()->SetItemEnabled(0, false);
781 GetFooter()->SetItemEnabled(0, true);
785 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
788 __pSearchBar->SetShowState(false);
789 __pSearchBar->Invalidate(true);
793 __pSearchBar->SetShowState(true);
794 __pSearchBar->Invalidate(true);
797 // if (__isNoHistoryPresent == true)
799 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
800 // __pGroupedListView->UpdateList();
803 result r = GetHeader()->SetItemSelected(2);
806 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
810 if(__pBookmarkList != null)
812 __pBookmarkList->RemoveAll(false);
815 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
822 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
824 AppLog("HistoryListForm::OnSceneDeactivated");
825 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
829 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
835 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
837 GroupItemClass* pGroupItemClass = null;
838 History* pHistory = null;
839 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
840 if (elementId == IDA_FORMAT_BOOKMARK)
842 String toggledUrl = L"";
843 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
844 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
845 if (pGroupItemClass == null)
849 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
850 if (pHistory == null)
854 toggledUrl = pHistory->GetHistoryUrl();
856 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
858 bool bookmarkFound = false;
859 BookmarkData* pBookMark = null;
860 if(__pBookmarkList != null)
862 for (int i = 0; i < __pBookmarkList->GetCount(); i++)
864 pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
865 if (toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
867 bookmarkFound = true;
872 if(bookmarkFound == false)
874 // Add the history in bookmark database
875 result r = E_FAILURE;
876 BookmarkData pBookmark;
878 String bookmarkTitle = pHistory->GetHistoryTitle();
880 pBookmark.SetBookmarkTitle(bookmarkTitle);
881 pBookmark.SetUrl(pHistory->GetHistoryUrl());
882 pBookmark.SetFaviconId(pHistory->GetFaviconId());
884 r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
888 // remove the history from bookmark database
889 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
892 if(__pBookmarkList != null)
894 __pBookmarkList->RemoveAll(false);
895 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
897 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
898 listView.UpdateList();
902 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
903 if (pGroupItemClass == null)
908 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
909 if (pHistory1 == null)
913 SceneManager* pSceneManager = SceneManager::GetInstance();
914 ArrayList *pArgList = null;
915 result r = E_SUCCESS;
916 pArgList = new(std::nothrow) ArrayList();
917 if (pArgList != null)
919 r = pArgList->Construct();
926 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
927 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
938 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
940 if (pSceneManager != null)
942 AppLog("pSceneManager exists");
943 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
946 pArgList->RemoveAll(false);
959 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
965 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
967 result r = E_FAILURE;
968 if (mode == SEARCH_BAR_MODE_NORMAL)
970 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
972 __pSearchListView->SetEnabled(true);
975 r = __pSearchListView->SetShowState(false);
980 r = __pGroupedListView->SetShowState(true);
985 __pSearchListView->SetEnabled(true);
986 if(__pSearchBar != null)
987 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
989 __searchHistory = false;
990 r = __pGroupedListView->UpdateList();
991 if (__isNoHistoryPresent == true)
993 GetFooter()->SetItemEnabled(0, false);
997 GetFooter()->SetItemEnabled(0, true);
999 if(__pSearchBar != null)
1001 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1010 // __pSearchListView->SetEnabled(false);
1011 r = __pSearchListView->SetShowState(true);
1016 __pSearchListView->SetEnabled(false);
1017 r = __pSearchListView->UpdateList();
1022 r = __pGroupedListView->SetShowState(false);
1027 if(__pSearchBar != null)
1029 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1035 HistoryListForm::GetMonth(int month)
1037 String monthValue = L"";
1041 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1044 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1047 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1050 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1053 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1056 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN"));
1059 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1062 monthValue.Append(CommonUtil::GetString(L"DS_COM_BODY_AUG"));
1065 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1068 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1071 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1074 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1085 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1087 result r = E_FAILURE;
1088 if (__pSearchBar != null)
1090 __pSearchBar->HideKeypad();
1093 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1095 __pSearchListView->SetEnabled(true);
1096 __searchHistory = true;
1097 __searchText =__pSearchBar->GetText();
1099 r = __pGroupedListView->SetShowState(false);
1104 r = __pSearchListView->SetShowState(true);
1109 r= __pSearchListView->UpdateList();
1110 if (__isNoHistoryPresent == true)
1112 GetFooter()->SetItemEnabled(0, false);
1116 GetFooter()->SetItemEnabled(0, true);
1118 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1127 __searchHistory = false;
1133 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1135 result r = E_FAILURE;
1136 if (__pGroupedListView != null)
1138 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1139 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1140 else if(__pSearchBar != null)
1141 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1146 __pGroupedListView->UpdateList();
1148 if (__pSearchListView != null)
1150 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1156 __pSearchListView->UpdateList();
1158 if(__pSearchBar != null)
1159 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1164 if (__isNoHistoryPresent == true)
1166 GetFooter()->SetItemEnabled(0, false);
1170 GetFooter()->SetItemEnabled(0, true);
1175 HistoryListForm::OnKeypadWillOpen(Control& source)
1177 GetFooter()->SetShowState(false);
1178 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1179 __pSearchListView->SetEnabled(false);
1180 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1186 HistoryListForm::OnKeypadOpened(Control& source)
1188 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1192 HistoryListForm::OnKeypadClosed(Control& source)
1195 GetFooter()->SetShowState(true);
1196 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1197 __pSearchListView->Invalidate(false);
1198 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1199 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1204 HistoryListForm::CreateGroupItems()
1206 result r = E_FAILURE;
1207 DateTime currentTime;
1209 GroupItemClass* pGroupItemClass = null;
1212 String weeksAgo2 = L"";
1213 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
1215 String weeksAgo3 = L"";
1216 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1218 if (__pGroupData != null)
1220 __pGroupData->RemoveAll(false);
1221 delete __pGroupData;
1222 __pGroupData = null;
1224 __pGroupData = new(std::nothrow) ArrayList();
1225 if (__pGroupData == null)
1229 r = __pGroupData->Construct();
1232 delete __pGroupData;
1233 __pGroupData = null;
1236 if (__searchHistory == true)
1238 pGroupItemClass = new(std::nothrow) GroupItemClass();
1239 if (pGroupItemClass == null)
1243 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1244 pGroupItemClass->SetTitleText(titleText);
1245 r = __pGroupData->Add(*pGroupItemClass);
1253 Calendar* pGregorianCalendar = null;
1256 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1257 pGroupItemClass = new(std::nothrow) GroupItemClass();
1258 if (pGroupItemClass == null)
1262 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1263 pGroupItemClass->SetTitleText(titleText);
1264 pGroupItemClass->SetEndTime(currentTime);
1265 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1266 pGroupItemClass->SetStartTime(dateTime);
1267 __pGroupData->Add(*pGroupItemClass);
1270 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1271 if ( pGregorianCalendar != NULL )
1273 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1274 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1275 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1276 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1277 delete pGregorianCalendar;
1282 pGroupItemClass = new(std::nothrow) GroupItemClass();
1283 if (pGroupItemClass == null)
1287 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1288 pGroupItemClass->SetTitleText(titleText);
1289 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1290 pGroupItemClass->SetEndTime(dateTime);
1291 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1292 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1293 pGroupItemClass->SetStartTime(dateTime);
1294 __pGroupData->Add(*pGroupItemClass);
1297 pGroupItemClass = new(std::nothrow) GroupItemClass();
1298 if (pGroupItemClass == null)
1302 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1303 pGroupItemClass->SetTitleText(titleText);
1304 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1305 pGroupItemClass->SetEndTime(dateTime);
1306 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1307 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1308 pGroupItemClass->SetStartTime(dateTime);
1309 __pGroupData->Add(*pGroupItemClass);
1312 pGroupItemClass = new(std::nothrow) GroupItemClass();
1313 if (pGroupItemClass == null)
1317 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1318 pGroupItemClass->SetTitleText(titleText);
1319 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1320 pGroupItemClass->SetEndTime(dateTime);
1321 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1322 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1323 pGroupItemClass->SetStartTime(dateTime);
1324 __pGroupData->Add(*pGroupItemClass);
1326 pGroupItemClass = new(std::nothrow) GroupItemClass();
1327 if (pGroupItemClass == null)
1331 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1332 pGroupItemClass->SetTitleText(titleText);
1333 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1334 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1335 pGroupItemClass->SetEndTime(dateTime);
1336 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1337 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1338 pGroupItemClass->SetStartTime(dateTime);
1339 __pGroupData->Add(*pGroupItemClass);
1342 pGroupItemClass = new(std::nothrow) GroupItemClass();
1343 if (pGroupItemClass == null)
1347 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1348 pGroupItemClass->SetTitleText(titleText);
1349 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1350 pGroupItemClass->SetEndTime(dateTime);
1351 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1352 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1353 pGroupItemClass->SetStartTime(dateTime);
1354 __pGroupData->Add(*pGroupItemClass);
1356 pGroupItemClass = new(std::nothrow) GroupItemClass();
1357 if (pGroupItemClass == null)
1361 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1362 pGroupItemClass->SetTitleText(titleText);
1363 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1364 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1365 pGroupItemClass->SetEndTime(dateTime);
1366 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1367 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1368 pGroupItemClass->SetStartTime(dateTime);
1369 __pGroupData->Add(*pGroupItemClass);
1371 pGroupItemClass = new(std::nothrow) GroupItemClass();
1372 if (pGroupItemClass == null)
1376 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1377 pGroupItemClass->SetTitleText(titleText);
1378 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1379 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1380 pGroupItemClass->SetEndTime(dateTime);
1381 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1382 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1383 pGroupItemClass->SetStartTime(dateTime);
1384 __pGroupData->Add(*pGroupItemClass);
1387 pGroupItemClass = new(std::nothrow) GroupItemClass();
1388 if (pGroupItemClass == null)
1392 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1393 pGroupItemClass->SetTitleText(titleText);
1394 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1395 pGroupItemClass->SetEndTime(dateTime);
1396 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1397 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1398 pGroupItemClass->SetStartTime(dateTime);
1399 __pGroupData->Add(*pGroupItemClass);
1401 pGroupItemClass = new(std::nothrow) GroupItemClass();
1402 if (pGroupItemClass == null)
1406 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1407 pGroupItemClass->SetTitleText(titleText);
1408 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1409 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1410 pGroupItemClass->SetEndTime(dateTime);
1411 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1412 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1413 pGroupItemClass->SetStartTime(dateTime);
1414 __pGroupData->Add(*pGroupItemClass);
1416 pGroupItemClass = new(std::nothrow) GroupItemClass();
1417 if (pGroupItemClass == null)
1421 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1422 pGroupItemClass->SetTitleText(titleText);
1423 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1424 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1425 pGroupItemClass->SetEndTime(dateTime);
1426 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1427 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1428 pGroupItemClass->SetStartTime(dateTime);
1429 __pGroupData->Add(*pGroupItemClass);
1431 pGroupItemClass = new(std::nothrow) GroupItemClass();
1432 if (pGroupItemClass == null)
1436 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1437 pGroupItemClass->SetTitleText(titleText);
1438 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1439 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1440 pGroupItemClass->SetEndTime(dateTime);
1441 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1442 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1443 pGroupItemClass->SetStartTime(dateTime);
1444 __pGroupData->Add(*pGroupItemClass);
1447 pGroupItemClass = new(std::nothrow) GroupItemClass();
1448 if (pGroupItemClass == null)
1452 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1453 pGroupItemClass->SetTitleText(titleText);
1454 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1455 pGroupItemClass->SetEndTime(dateTime);
1456 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1457 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1458 pGroupItemClass->SetStartTime(dateTime);
1459 __pGroupData->Add(*pGroupItemClass);
1461 pGroupItemClass = new(std::nothrow) GroupItemClass();
1462 if (pGroupItemClass == null)
1466 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1467 pGroupItemClass->SetTitleText(titleText);
1468 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1469 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1470 pGroupItemClass->SetEndTime(dateTime);
1471 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1472 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1473 pGroupItemClass->SetStartTime(dateTime);
1474 __pGroupData->Add(*pGroupItemClass);
1476 pGroupItemClass = new(std::nothrow) GroupItemClass();
1477 if (pGroupItemClass == null)
1481 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1482 pGroupItemClass->SetTitleText(titleText);
1483 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1484 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1485 pGroupItemClass->SetEndTime(dateTime);
1486 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1487 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1488 pGroupItemClass->SetStartTime(dateTime);
1489 __pGroupData->Add(*pGroupItemClass);
1491 pGroupItemClass = new(std::nothrow) GroupItemClass();
1492 if (pGroupItemClass == null)
1496 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1497 pGroupItemClass->SetTitleText(titleText);
1498 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1499 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1500 pGroupItemClass->SetEndTime(dateTime);
1501 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1502 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1503 pGroupItemClass->SetStartTime(dateTime);
1504 __pGroupData->Add(*pGroupItemClass);
1506 pGroupItemClass = new(std::nothrow) GroupItemClass();
1507 if (pGroupItemClass == null)
1511 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1512 pGroupItemClass->SetTitleText(titleText);
1513 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1514 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1515 pGroupItemClass->SetEndTime(dateTime);
1516 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1517 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1518 pGroupItemClass->SetStartTime(dateTime);
1519 __pGroupData->Add(*pGroupItemClass);
1522 pGroupItemClass = new(std::nothrow) GroupItemClass();
1523 if (pGroupItemClass == null)
1527 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1528 pGroupItemClass->SetTitleText(titleText);
1529 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1530 pGroupItemClass->SetEndTime(dateTime);
1531 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1532 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1533 pGroupItemClass->SetStartTime(dateTime);
1534 __pGroupData->Add(*pGroupItemClass);
1536 pGroupItemClass = new(std::nothrow) GroupItemClass();
1537 if (pGroupItemClass == null)
1541 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1542 pGroupItemClass->SetTitleText(titleText);
1543 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1544 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1545 pGroupItemClass->SetEndTime(dateTime);
1546 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1547 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1548 pGroupItemClass->SetStartTime(dateTime);
1549 __pGroupData->Add(*pGroupItemClass);
1551 pGroupItemClass = new(std::nothrow) GroupItemClass();
1552 if (pGroupItemClass == null)
1556 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1557 pGroupItemClass->SetTitleText(titleText);
1558 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1559 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1560 pGroupItemClass->SetEndTime(dateTime);
1561 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1562 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1563 pGroupItemClass->SetStartTime(dateTime);
1564 __pGroupData->Add(*pGroupItemClass);
1566 pGroupItemClass = new(std::nothrow) GroupItemClass();
1567 if (pGroupItemClass == null)
1571 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1572 pGroupItemClass->SetTitleText(titleText);
1573 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1574 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1575 pGroupItemClass->SetEndTime(dateTime);
1576 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1577 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1578 pGroupItemClass->SetStartTime(dateTime);
1579 __pGroupData->Add(*pGroupItemClass);
1581 pGroupItemClass = new(std::nothrow) GroupItemClass();
1582 if (pGroupItemClass == null)
1586 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1587 pGroupItemClass->SetTitleText(titleText);
1588 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1589 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1590 pGroupItemClass->SetEndTime(dateTime);
1591 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1592 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1593 pGroupItemClass->SetStartTime(dateTime);
1594 __pGroupData->Add(*pGroupItemClass);
1596 pGroupItemClass = new(std::nothrow) GroupItemClass();
1597 if (pGroupItemClass == null)
1601 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1602 pGroupItemClass->SetTitleText(titleText);
1603 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1604 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1605 pGroupItemClass->SetEndTime(dateTime);
1606 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1607 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1608 pGroupItemClass->SetStartTime(dateTime);
1609 __pGroupData->Add(*pGroupItemClass);
1615 day = currentTime.GetDay();
1619 pGroupItemClass = new(std::nothrow) GroupItemClass();
1620 if (pGroupItemClass == null)
1625 pGroupItemClass->SetTitleText(weeksAgo2);
1626 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1627 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1628 pGroupItemClass->SetEndTime(dateTime);
1629 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1630 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1631 pGroupItemClass->SetStartTime(dateTime);
1632 __pGroupData->Add(*pGroupItemClass);
1634 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1636 pGroupItemClass = new(std::nothrow) GroupItemClass();
1637 if (pGroupItemClass == null)
1641 String weeksAgo3 = L"";
1642 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1643 pGroupItemClass->SetTitleText(weeksAgo3);
1644 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1645 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1646 pGroupItemClass->SetEndTime(dateTime);
1647 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1648 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1649 pGroupItemClass->SetStartTime(dateTime);
1650 __pGroupData->Add(*pGroupItemClass);
1654 pGroupItemClass = new(std::nothrow) GroupItemClass();
1655 if (pGroupItemClass == null)
1659 pGroupItemClass->SetTitleText(weeksAgo2);
1660 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1661 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1662 pGroupItemClass->SetEndTime(dateTime);
1663 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1664 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1665 pGroupItemClass->SetStartTime(dateTime);
1666 __pGroupData->Add(*pGroupItemClass);
1668 pGroupItemClass = new(std::nothrow) GroupItemClass();
1669 if (pGroupItemClass == null)
1674 pGroupItemClass->SetTitleText(weeksAgo3);
1675 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1676 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1677 pGroupItemClass->SetEndTime(dateTime);
1678 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1679 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1680 pGroupItemClass->SetStartTime(dateTime);
1681 __pGroupData->Add(*pGroupItemClass);
1683 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1685 pGroupItemClass = new(std::nothrow) GroupItemClass();
1686 if (pGroupItemClass == null)
1690 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1691 pGroupItemClass->SetTitleText(titleText);
1692 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1693 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1694 pGroupItemClass->SetEndTime(dateTime);
1695 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1696 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1697 pGroupItemClass->SetStartTime(dateTime);
1698 __pGroupData->Add(*pGroupItemClass);
1702 pGroupItemClass = new(std::nothrow) GroupItemClass();
1703 if (pGroupItemClass == null)
1707 pGroupItemClass->SetTitleText(weeksAgo2);
1708 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1709 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1710 pGroupItemClass->SetEndTime(dateTime);
1711 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1712 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1713 pGroupItemClass->SetStartTime(dateTime);
1714 __pGroupData->Add(*pGroupItemClass);
1716 pGroupItemClass = new(std::nothrow) GroupItemClass();
1717 if (pGroupItemClass == null)
1721 pGroupItemClass->SetTitleText(weeksAgo3);
1722 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1723 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1724 pGroupItemClass->SetEndTime(dateTime);
1725 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1726 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1727 pGroupItemClass->SetStartTime(dateTime);
1728 __pGroupData->Add(*pGroupItemClass);
1730 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1732 pGroupItemClass = new(std::nothrow) GroupItemClass();
1733 if (pGroupItemClass == null)
1737 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1738 pGroupItemClass->SetTitleText(titleText);
1739 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1740 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1741 pGroupItemClass->SetEndTime(dateTime);
1742 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1743 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1744 pGroupItemClass->SetStartTime(dateTime);
1745 __pGroupData->Add(*pGroupItemClass);
1751 pGroupItemClass = new(std::nothrow) GroupItemClass();
1752 if (pGroupItemClass == null)
1756 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1757 pGroupItemClass->SetTitleText(titleText);
1758 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1759 dateTime.AddDays(-1);
1760 pGroupItemClass->SetEndTime(dateTime);
1761 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1762 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1763 pGroupItemClass->SetStartTime(dateTime);
1764 __pGroupData->Add(*pGroupItemClass);
1766 pGroupItemClass = new(std::nothrow) GroupItemClass();
1767 if (pGroupItemClass == null)
1771 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1772 pGroupItemClass->SetTitleText(titleText);
1773 dateTime.SetValue(currentTime.GetYear(),1, 1);
1774 dateTime.AddMonths(currentTime.GetMonth() - 2);
1775 dateTime.AddDays(-1);
1776 pGroupItemClass->SetEndTime(dateTime);
1778 dateTime2.SetValue(0, 0, 0);
1779 pGroupItemClass->SetStartTime(dateTime2);
1780 __pGroupData->Add(*pGroupItemClass);
1784 GroupItemClass::GroupItemClass()
1790 GroupItemClass::operator =(const GroupItemClass& rhs)
1794 __pData = rhs.__pData;
1799 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1801 __pData = groupItem.__pData;
1804 GroupItemClass::~GroupItemClass()
1808 __pData->RemoveAll(true);
1814 GroupItemClass::SetStartTime(DateTime& startTime)
1816 __startTime = startTime;
1820 GroupItemClass::SetEndTime(DateTime& endTime)
1822 __endTime = endTime;
1826 GroupItemClass::SetTitleText(String& titleText)
1828 __titleText = titleText;
1832 GroupItemClass::SetHistoryData(ArrayList* pData)
1838 GroupItemClass::GetStartTime(void)
1844 GroupItemClass::GetEndTime(void)
1850 GroupItemClass::GetTitleText(void)
1856 GroupItemClass::GetHistoryData(void)