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)
151 __pGroupedListView->AddGroupedListViewItemEventListener(*this);
152 r = __pGroupedListView->SetBounds(Rectangle(0,__pGroupedListView->GetY(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
157 r = __pSearchListView->Construct(Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height -__pSearchBar->GetHeight() - __pSearchBar->GetY()), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
162 r = __pSearchListView->SetItemProvider(*this);
167 r = __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND"));
174 __pSearchListView->SetBackgroundColor(GetBackgroundColor());
175 __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK));
176 __pSearchListView->AddGroupedListViewItemEventListener(*this);
177 r = __pSearchListView->SetShowState(false);
184 __pSearchBar->AddSearchBarEventListener(*this);
185 __pSearchBar->AddKeypadEventListener(*this);
186 r = __pSearchBar->SetContent(__pSearchListView);
190 pHeader->SetStyle(HEADER_STYLE_TAB);
191 bookmark.Construct(IDA_TABBAR_ITEM_1);
193 pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark);
194 bookmark.SetText(strbookmark);
195 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARKS);
196 bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
197 bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
198 pHeader->AddItem(bookmark);
206 history.Construct(IDA_TABBAR_ITEM_2);
208 pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory);
209 history.SetText(strhistory);
210 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY);
211 history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
212 history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
213 pHeader->AddItem(history);
214 pHeader->SetItemSelected(1);
215 pHeader->SetTabEditModeEnabled(false);
217 if (pIconBitmap != NULL)
223 __pBookmarkList = new(std::nothrow) Collection::ArrayList();
224 __pBookmarkList->Construct();
225 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
230 HistoryListForm::OnTerminating(void)
232 result r = E_SUCCESS;
238 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
240 AppLog("HistoryListForm::OnActionPerformed");
241 result r = E_FAILURE;
242 SceneManager* pSceneManager = SceneManager::GetInstance();
243 if (pSceneManager == null)
249 case IDA_EDIT_HISTORY_LIST_FORM:
251 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
252 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
259 case IDA_TABBAR_ITEM_1:
261 result r = GetHeader()->SetItemSelected(1);
262 AppLog("SetItemSelected result %s",GetErrorMessage(r));
263 GetHeader()->Invalidate(true);
265 if (pSceneManager != null)
267 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
269 if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)) != E_SUCCESS)
271 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
278 if(pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT))!= E_SUCCESS)
280 AppLogDebug("BookmarkListForm::OnActionPerformed GoBackward failed");
286 // r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
299 HistoryListForm::OnFormBackRequested(Form& source)
301 SceneManager* pSceneManager = SceneManager::GetInstance();
302 if (pSceneManager == null)
306 result r = E_FAILURE;
307 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
309 r = pSceneManager->GoBackward(BackwardSceneTransition());
313 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
317 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
322 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
324 result r = E_FAILURE;
330 GroupItem* pItem = null;
331 GroupItemClass* pGroupItemClass = null;
333 String weeksAgo2 = L"";
334 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
336 String weeksAgo3 = L"";
337 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
339 String weeksAgo4 = L"";
340 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),4);
342 pItem = new(std::nothrow) GroupItem();
347 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
349 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
351 AppLog("CreateGroupItem :: if history is null");
352 r = pItem->Construct(Dimension(itemWidth, 0));
357 r = pItem->Construct(Dimension(itemWidth, 48));
359 text = pGroupItemClass->GetTitleText();
361 if (__searchHistory == false)
365 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
368 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
369 if ( pGregorianCalendar != NULL)
371 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
378 delete pGregorianCalendar;
381 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
388 delete pGregorianCalendar;
391 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
398 delete pGregorianCalendar;
401 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
403 delete pGregorianCalendar;
409 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
412 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
415 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
418 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
421 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
424 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
427 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
435 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
437 text.Append(pGroupItemClass->GetStartTime().GetDay());
439 strMonth = pGroupItemClass->GetStartTime().GetMonth();
440 month = GetMonth(strMonth);
450 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
451 || 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"))
454 text.Append(pGroupItemClass->GetEndTime().GetDay());
456 strMonth = pGroupItemClass->GetEndTime().GetMonth();
457 month = GetMonth(strMonth);
463 r = pItem->SetElement(text, null);
467 AppLogDebug("Failed with %s", GetErrorMessage(r));
470 r = pItem->SetTextSize(32);
481 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
483 AppLog("HistoryListForm::CreateItem");
484 result r = E_FAILURE;
485 History* pHistory = null;
486 Bitmap* pBitmap = null;
487 Bitmap* pBookmarkBitmap = null;
488 GroupItemClass* pGroupItemClass = null;
489 CustomItem* pItem = new(std::nothrow) CustomItem();
490 int bookmarkBtnWidth = 0;
493 if(__pGroupData == null)
503 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
504 if (pGroupItemClass == null)
509 if (pGroupItemClass->GetHistoryData() == null)
514 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
515 if (pHistory == null)
520 r = pItem->Construct(Dimension(itemWidth, 128), LIST_ANNEX_STYLE_NORMAL);
527 bitmapId = pHistory->GetFaviconId() ;
529 pBitmap = pHistory->GetFavIconBitmap();
533 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
537 r = pItem->AddElement(Rectangle(16, 28, 72, 72), IDA_FORMAT_ICON, *pBitmap, null);
542 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
546 bool urlFoundInBookmark = false;
548 if(__pBookmarkList != null)
550 for (int i = 0; i < __pBookmarkList->GetCount();i++)
552 BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
553 if(pBookMark != null && pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
555 urlFoundInBookmark = true;
560 if (urlFoundInBookmark == true)
562 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
566 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
568 bookmarkBtnWidth = 64;
571 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);
572 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
574 if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
575 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);
577 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);
578 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
579 if ( pBookmarkBitmap != null)
581 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
582 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
583 delete pBookmarkBitmap;
593 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
602 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
604 AppLog("HistoryListForm::DeleteItem");
605 result r = E_FAILURE;
606 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
607 if (pGroupItemClass == null)
612 // if (pGroupItemClass->__pData != null)
614 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
627 HistoryListForm::GetGroupCount(void)
629 __isNoHistoryPresent = true;
631 if (__pGroupData != null)
633 if (__searchHistory == false)
636 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
641 return __pGroupData->GetCount();
646 // String searchText = __pSearchBar->GetText();
647 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
661 HistoryListForm::GetItemCount(int groupIndex)
663 result r = E_FAILURE;
669 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
670 if (pGroupItemClass == null)
674 if (__searchHistory == false)
676 startTime = pGroupItemClass->GetStartTime();
677 endTime = pGroupItemClass->GetEndTime();
678 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
682 //text = __pSearchBar->GetText();
683 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
694 ArrayList* pData = new(std::nothrow) ArrayList();
699 r = pData->Construct();
707 if (__searchHistory == false)
709 startTime = pGroupItemClass->GetStartTime();
710 endTime = pGroupItemClass->GetEndTime();
711 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
712 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
716 //text = __pSearchBar->GetText() ;
717 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
724 pGroupItemClass->SetHistoryData(pData);
727 if (__isNoHistoryPresent == true && count == 0)
729 __isNoHistoryPresent = true;
730 GetFooter()->SetItemEnabled(0, false);
734 __isNoHistoryPresent = false;
735 GetFooter()->SetItemEnabled(0, true);
737 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
738 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
745 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
746 return pGroupItemClass->GetHistoryData()->GetCount();
751 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
754 GetHeader()->SetItemSelected(1);
755 // __previousSceneId = previousSceneId;
756 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
759 pList->GetAt(pList->GetCount()-1,__previousSceneId);
762 AppLog("HistoryListForm::OnSceneActivatedN called");
763 //GetHeader()->Invalidate(true);
764 if (__pGroupData == null)
766 __pGroupData = new(std::nothrow) ArrayList();
767 __pGroupData->Construct();
769 if (__pGroupedListView != null)
771 __pGroupedListView->UpdateList();
773 if (__isNoHistoryPresent == true)
775 GetFooter()->SetItemEnabled(0, false);
779 GetFooter()->SetItemEnabled(0, true);
783 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
786 __pSearchBar->SetShowState(false);
787 __pSearchBar->Invalidate(true);
791 __pSearchBar->SetShowState(true);
792 __pSearchBar->Invalidate(true);
795 // if (__isNoHistoryPresent == true)
797 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
798 // __pGroupedListView->UpdateList();
801 result r = GetHeader()->SetItemSelected(2);
804 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
808 if(__pBookmarkList != null)
810 __pBookmarkList->RemoveAll(false);
813 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
820 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
822 AppLog("HistoryListForm::OnSceneDeactivated");
823 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
827 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
833 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
835 GroupItemClass* pGroupItemClass = null;
836 History* pHistory = null;
837 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
838 if (elementId == IDA_FORMAT_BOOKMARK)
840 String toggledUrl = L"";
841 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
842 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
843 if (pGroupItemClass == null)
847 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
848 if (pHistory == null)
852 toggledUrl = pHistory->GetHistoryUrl();
854 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
856 bool bookmarkFound = false;
857 BookmarkData* pBookMark = null;
858 if(__pBookmarkList != null)
860 for (int i = 0; i < __pBookmarkList->GetCount(); i++)
862 pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
863 if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
865 bookmarkFound = true;
870 if(bookmarkFound == false)
872 // Add the history in bookmark database
873 result r = E_FAILURE;
874 BookmarkData pBookmark;
876 String bookmarkTitle = pHistory->GetHistoryTitle();
878 pBookmark.SetBookmarkTitle(bookmarkTitle);
879 pBookmark.SetUrl(pHistory->GetHistoryUrl());
880 pBookmark.SetFaviconId(pHistory->GetFaviconId());
882 r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
886 // remove the history from bookmark database
887 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
890 if(__pBookmarkList != null)
892 __pBookmarkList->RemoveAll(false);
893 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
895 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
896 listView.UpdateList();
900 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
901 if (pGroupItemClass == null)
906 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
907 if (pHistory1 == null)
911 SceneManager* pSceneManager = SceneManager::GetInstance();
912 ArrayList *pArgList = null;
913 result r = E_SUCCESS;
914 pArgList = new(std::nothrow) ArrayList();
915 if (pArgList != null)
917 r = pArgList->Construct();
924 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
925 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
936 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
938 if (pSceneManager != null)
940 AppLog("pSceneManager exists");
941 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
944 pArgList->RemoveAll(false);
957 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
963 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
965 result r = E_FAILURE;
966 if (mode == SEARCH_BAR_MODE_NORMAL)
968 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
970 __pSearchListView->SetEnabled(true);
973 r = __pSearchListView->SetShowState(false);
978 r = __pGroupedListView->SetShowState(true);
983 __pSearchListView->SetEnabled(true);
984 if(__pSearchBar != null)
985 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
987 __searchHistory = false;
988 r = __pGroupedListView->UpdateList();
989 if (__isNoHistoryPresent == true)
991 GetFooter()->SetItemEnabled(0, false);
995 GetFooter()->SetItemEnabled(0, true);
997 if(__pSearchBar != null)
999 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1008 // __pSearchListView->SetEnabled(false);
1009 r = __pSearchListView->SetShowState(true);
1014 __pSearchListView->SetEnabled(false);
1015 r = __pSearchListView->UpdateList();
1020 r = __pGroupedListView->SetShowState(false);
1025 if(__pSearchBar != null)
1027 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1033 HistoryListForm::GetMonth(int month)
1035 String monthValue = L"";
1039 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1042 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1045 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1048 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1051 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1054 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN"));
1057 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1060 monthValue.Append(CommonUtil::GetString(L"DS_COM_BODY_AUG"));
1063 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1066 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1069 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1072 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1083 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1085 result r = E_FAILURE;
1086 if (__pSearchBar != null)
1088 __pSearchBar->HideKeypad();
1091 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1093 __pSearchListView->SetEnabled(true);
1094 __searchHistory = true;
1095 __searchText =__pSearchBar->GetText();
1097 r = __pGroupedListView->SetShowState(false);
1102 r = __pSearchListView->SetShowState(true);
1107 r= __pSearchListView->UpdateList();
1108 if (__isNoHistoryPresent == true)
1110 GetFooter()->SetItemEnabled(0, false);
1114 GetFooter()->SetItemEnabled(0, true);
1116 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1125 __searchHistory = false;
1131 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1133 result r = E_FAILURE;
1134 if (__pGroupedListView != null)
1136 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1137 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1138 else if(__pSearchBar != null)
1139 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1144 __pGroupedListView->UpdateList();
1146 if (__pSearchListView != null)
1148 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1154 __pSearchListView->UpdateList();
1156 if(__pSearchBar != null)
1157 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1162 if (__isNoHistoryPresent == true)
1164 GetFooter()->SetItemEnabled(0, false);
1168 GetFooter()->SetItemEnabled(0, true);
1173 HistoryListForm::OnKeypadWillOpen(Control& source)
1175 GetFooter()->SetShowState(false);
1176 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1177 __pSearchListView->SetEnabled(false);
1178 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1184 HistoryListForm::OnKeypadOpened(Control& source)
1186 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1190 HistoryListForm::OnKeypadClosed(Control& source)
1193 GetFooter()->SetShowState(true);
1194 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1195 __pSearchListView->Invalidate(false);
1196 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1197 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1202 HistoryListForm::CreateGroupItems()
1204 result r = E_FAILURE;
1205 DateTime currentTime;
1207 GroupItemClass* pGroupItemClass = null;
1210 String weeksAgo2 = L"";
1211 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
1213 String weeksAgo3 = L"";
1214 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1216 if (__pGroupData != null)
1218 __pGroupData->RemoveAll(false);
1219 delete __pGroupData;
1220 __pGroupData = null;
1222 __pGroupData = new(std::nothrow) ArrayList();
1223 if (__pGroupData == null)
1227 r = __pGroupData->Construct();
1230 delete __pGroupData;
1231 __pGroupData = null;
1234 if (__searchHistory == true)
1236 pGroupItemClass = new(std::nothrow) GroupItemClass();
1237 if (pGroupItemClass == null)
1241 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1242 pGroupItemClass->SetTitleText(titleText);
1243 r = __pGroupData->Add(*pGroupItemClass);
1251 Calendar* pGregorianCalendar = null;
1254 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1255 pGroupItemClass = new(std::nothrow) GroupItemClass();
1256 if (pGroupItemClass == null)
1260 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1261 pGroupItemClass->SetTitleText(titleText);
1262 pGroupItemClass->SetEndTime(currentTime);
1263 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1264 pGroupItemClass->SetStartTime(dateTime);
1265 __pGroupData->Add(*pGroupItemClass);
1268 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1269 if ( pGregorianCalendar != NULL )
1271 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1272 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1273 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1274 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1275 delete pGregorianCalendar;
1280 pGroupItemClass = new(std::nothrow) GroupItemClass();
1281 if (pGroupItemClass == null)
1285 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1286 pGroupItemClass->SetTitleText(titleText);
1287 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1288 pGroupItemClass->SetEndTime(dateTime);
1289 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1290 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1291 pGroupItemClass->SetStartTime(dateTime);
1292 __pGroupData->Add(*pGroupItemClass);
1295 pGroupItemClass = new(std::nothrow) GroupItemClass();
1296 if (pGroupItemClass == null)
1300 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1301 pGroupItemClass->SetTitleText(titleText);
1302 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1303 pGroupItemClass->SetEndTime(dateTime);
1304 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1305 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1306 pGroupItemClass->SetStartTime(dateTime);
1307 __pGroupData->Add(*pGroupItemClass);
1310 pGroupItemClass = new(std::nothrow) GroupItemClass();
1311 if (pGroupItemClass == null)
1315 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1316 pGroupItemClass->SetTitleText(titleText);
1317 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1318 pGroupItemClass->SetEndTime(dateTime);
1319 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1320 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1321 pGroupItemClass->SetStartTime(dateTime);
1322 __pGroupData->Add(*pGroupItemClass);
1324 pGroupItemClass = new(std::nothrow) GroupItemClass();
1325 if (pGroupItemClass == null)
1329 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1330 pGroupItemClass->SetTitleText(titleText);
1331 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1332 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1333 pGroupItemClass->SetEndTime(dateTime);
1334 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1335 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1336 pGroupItemClass->SetStartTime(dateTime);
1337 __pGroupData->Add(*pGroupItemClass);
1340 pGroupItemClass = new(std::nothrow) GroupItemClass();
1341 if (pGroupItemClass == null)
1345 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1346 pGroupItemClass->SetTitleText(titleText);
1347 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1348 pGroupItemClass->SetEndTime(dateTime);
1349 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1350 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1351 pGroupItemClass->SetStartTime(dateTime);
1352 __pGroupData->Add(*pGroupItemClass);
1354 pGroupItemClass = new(std::nothrow) GroupItemClass();
1355 if (pGroupItemClass == null)
1359 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1360 pGroupItemClass->SetTitleText(titleText);
1361 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1362 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1363 pGroupItemClass->SetEndTime(dateTime);
1364 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1365 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1366 pGroupItemClass->SetStartTime(dateTime);
1367 __pGroupData->Add(*pGroupItemClass);
1369 pGroupItemClass = new(std::nothrow) GroupItemClass();
1370 if (pGroupItemClass == null)
1374 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1375 pGroupItemClass->SetTitleText(titleText);
1376 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1377 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1378 pGroupItemClass->SetEndTime(dateTime);
1379 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1380 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1381 pGroupItemClass->SetStartTime(dateTime);
1382 __pGroupData->Add(*pGroupItemClass);
1385 pGroupItemClass = new(std::nothrow) GroupItemClass();
1386 if (pGroupItemClass == null)
1390 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1391 pGroupItemClass->SetTitleText(titleText);
1392 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1393 pGroupItemClass->SetEndTime(dateTime);
1394 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1395 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1396 pGroupItemClass->SetStartTime(dateTime);
1397 __pGroupData->Add(*pGroupItemClass);
1399 pGroupItemClass = new(std::nothrow) GroupItemClass();
1400 if (pGroupItemClass == null)
1404 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1405 pGroupItemClass->SetTitleText(titleText);
1406 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1407 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1408 pGroupItemClass->SetEndTime(dateTime);
1409 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1410 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1411 pGroupItemClass->SetStartTime(dateTime);
1412 __pGroupData->Add(*pGroupItemClass);
1414 pGroupItemClass = new(std::nothrow) GroupItemClass();
1415 if (pGroupItemClass == null)
1419 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1420 pGroupItemClass->SetTitleText(titleText);
1421 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1422 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1423 pGroupItemClass->SetEndTime(dateTime);
1424 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1425 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1426 pGroupItemClass->SetStartTime(dateTime);
1427 __pGroupData->Add(*pGroupItemClass);
1429 pGroupItemClass = new(std::nothrow) GroupItemClass();
1430 if (pGroupItemClass == null)
1434 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1435 pGroupItemClass->SetTitleText(titleText);
1436 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1437 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1438 pGroupItemClass->SetEndTime(dateTime);
1439 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1440 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1441 pGroupItemClass->SetStartTime(dateTime);
1442 __pGroupData->Add(*pGroupItemClass);
1445 pGroupItemClass = new(std::nothrow) GroupItemClass();
1446 if (pGroupItemClass == null)
1450 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1451 pGroupItemClass->SetTitleText(titleText);
1452 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1453 pGroupItemClass->SetEndTime(dateTime);
1454 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1455 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1456 pGroupItemClass->SetStartTime(dateTime);
1457 __pGroupData->Add(*pGroupItemClass);
1459 pGroupItemClass = new(std::nothrow) GroupItemClass();
1460 if (pGroupItemClass == null)
1464 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1465 pGroupItemClass->SetTitleText(titleText);
1466 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1467 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1468 pGroupItemClass->SetEndTime(dateTime);
1469 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1470 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1471 pGroupItemClass->SetStartTime(dateTime);
1472 __pGroupData->Add(*pGroupItemClass);
1474 pGroupItemClass = new(std::nothrow) GroupItemClass();
1475 if (pGroupItemClass == null)
1479 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1480 pGroupItemClass->SetTitleText(titleText);
1481 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1482 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1483 pGroupItemClass->SetEndTime(dateTime);
1484 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1485 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1486 pGroupItemClass->SetStartTime(dateTime);
1487 __pGroupData->Add(*pGroupItemClass);
1489 pGroupItemClass = new(std::nothrow) GroupItemClass();
1490 if (pGroupItemClass == null)
1494 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1495 pGroupItemClass->SetTitleText(titleText);
1496 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1497 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1498 pGroupItemClass->SetEndTime(dateTime);
1499 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1500 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1501 pGroupItemClass->SetStartTime(dateTime);
1502 __pGroupData->Add(*pGroupItemClass);
1504 pGroupItemClass = new(std::nothrow) GroupItemClass();
1505 if (pGroupItemClass == null)
1509 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1510 pGroupItemClass->SetTitleText(titleText);
1511 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1512 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1513 pGroupItemClass->SetEndTime(dateTime);
1514 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1515 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1516 pGroupItemClass->SetStartTime(dateTime);
1517 __pGroupData->Add(*pGroupItemClass);
1520 pGroupItemClass = new(std::nothrow) GroupItemClass();
1521 if (pGroupItemClass == null)
1525 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1526 pGroupItemClass->SetTitleText(titleText);
1527 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1528 pGroupItemClass->SetEndTime(dateTime);
1529 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1530 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1531 pGroupItemClass->SetStartTime(dateTime);
1532 __pGroupData->Add(*pGroupItemClass);
1534 pGroupItemClass = new(std::nothrow) GroupItemClass();
1535 if (pGroupItemClass == null)
1539 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1540 pGroupItemClass->SetTitleText(titleText);
1541 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1542 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1543 pGroupItemClass->SetEndTime(dateTime);
1544 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1545 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1546 pGroupItemClass->SetStartTime(dateTime);
1547 __pGroupData->Add(*pGroupItemClass);
1549 pGroupItemClass = new(std::nothrow) GroupItemClass();
1550 if (pGroupItemClass == null)
1554 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1555 pGroupItemClass->SetTitleText(titleText);
1556 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1557 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1558 pGroupItemClass->SetEndTime(dateTime);
1559 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1560 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1561 pGroupItemClass->SetStartTime(dateTime);
1562 __pGroupData->Add(*pGroupItemClass);
1564 pGroupItemClass = new(std::nothrow) GroupItemClass();
1565 if (pGroupItemClass == null)
1569 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1570 pGroupItemClass->SetTitleText(titleText);
1571 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1572 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1573 pGroupItemClass->SetEndTime(dateTime);
1574 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1575 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1576 pGroupItemClass->SetStartTime(dateTime);
1577 __pGroupData->Add(*pGroupItemClass);
1579 pGroupItemClass = new(std::nothrow) GroupItemClass();
1580 if (pGroupItemClass == null)
1584 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1585 pGroupItemClass->SetTitleText(titleText);
1586 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1587 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1588 pGroupItemClass->SetEndTime(dateTime);
1589 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1590 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1591 pGroupItemClass->SetStartTime(dateTime);
1592 __pGroupData->Add(*pGroupItemClass);
1594 pGroupItemClass = new(std::nothrow) GroupItemClass();
1595 if (pGroupItemClass == null)
1599 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1600 pGroupItemClass->SetTitleText(titleText);
1601 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1602 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1603 pGroupItemClass->SetEndTime(dateTime);
1604 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1605 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1606 pGroupItemClass->SetStartTime(dateTime);
1607 __pGroupData->Add(*pGroupItemClass);
1613 day = currentTime.GetDay();
1617 pGroupItemClass = new(std::nothrow) GroupItemClass();
1618 if (pGroupItemClass == null)
1623 pGroupItemClass->SetTitleText(weeksAgo2);
1624 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1625 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1626 pGroupItemClass->SetEndTime(dateTime);
1627 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1628 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1629 pGroupItemClass->SetStartTime(dateTime);
1630 __pGroupData->Add(*pGroupItemClass);
1632 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1634 pGroupItemClass = new(std::nothrow) GroupItemClass();
1635 if (pGroupItemClass == null)
1639 String weeksAgo3 = L"";
1640 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1641 pGroupItemClass->SetTitleText(weeksAgo3);
1642 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1643 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1644 pGroupItemClass->SetEndTime(dateTime);
1645 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1646 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1647 pGroupItemClass->SetStartTime(dateTime);
1648 __pGroupData->Add(*pGroupItemClass);
1652 pGroupItemClass = new(std::nothrow) GroupItemClass();
1653 if (pGroupItemClass == null)
1657 pGroupItemClass->SetTitleText(weeksAgo2);
1658 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1659 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1660 pGroupItemClass->SetEndTime(dateTime);
1661 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1662 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1663 pGroupItemClass->SetStartTime(dateTime);
1664 __pGroupData->Add(*pGroupItemClass);
1666 pGroupItemClass = new(std::nothrow) GroupItemClass();
1667 if (pGroupItemClass == null)
1672 pGroupItemClass->SetTitleText(weeksAgo3);
1673 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1674 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1675 pGroupItemClass->SetEndTime(dateTime);
1676 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1677 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1678 pGroupItemClass->SetStartTime(dateTime);
1679 __pGroupData->Add(*pGroupItemClass);
1681 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1683 pGroupItemClass = new(std::nothrow) GroupItemClass();
1684 if (pGroupItemClass == null)
1688 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1689 pGroupItemClass->SetTitleText(titleText);
1690 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1691 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1692 pGroupItemClass->SetEndTime(dateTime);
1693 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1694 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1695 pGroupItemClass->SetStartTime(dateTime);
1696 __pGroupData->Add(*pGroupItemClass);
1700 pGroupItemClass = new(std::nothrow) GroupItemClass();
1701 if (pGroupItemClass == null)
1705 pGroupItemClass->SetTitleText(weeksAgo2);
1706 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1707 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1708 pGroupItemClass->SetEndTime(dateTime);
1709 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1710 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1711 pGroupItemClass->SetStartTime(dateTime);
1712 __pGroupData->Add(*pGroupItemClass);
1714 pGroupItemClass = new(std::nothrow) GroupItemClass();
1715 if (pGroupItemClass == null)
1719 pGroupItemClass->SetTitleText(weeksAgo3);
1720 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1721 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1722 pGroupItemClass->SetEndTime(dateTime);
1723 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1724 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1725 pGroupItemClass->SetStartTime(dateTime);
1726 __pGroupData->Add(*pGroupItemClass);
1728 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1730 pGroupItemClass = new(std::nothrow) GroupItemClass();
1731 if (pGroupItemClass == null)
1735 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1736 pGroupItemClass->SetTitleText(titleText);
1737 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1738 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1739 pGroupItemClass->SetEndTime(dateTime);
1740 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1741 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1742 pGroupItemClass->SetStartTime(dateTime);
1743 __pGroupData->Add(*pGroupItemClass);
1749 pGroupItemClass = new(std::nothrow) GroupItemClass();
1750 if (pGroupItemClass == null)
1754 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1755 pGroupItemClass->SetTitleText(titleText);
1756 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1757 dateTime.AddDays(-1);
1758 pGroupItemClass->SetEndTime(dateTime);
1759 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1760 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1761 pGroupItemClass->SetStartTime(dateTime);
1762 __pGroupData->Add(*pGroupItemClass);
1764 pGroupItemClass = new(std::nothrow) GroupItemClass();
1765 if (pGroupItemClass == null)
1769 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1770 pGroupItemClass->SetTitleText(titleText);
1771 dateTime.SetValue(currentTime.GetYear(),1, 1);
1772 dateTime.AddMonths(currentTime.GetMonth() - 2);
1773 dateTime.AddDays(-1);
1774 pGroupItemClass->SetEndTime(dateTime);
1776 dateTime2.SetValue(0, 0, 0);
1777 pGroupItemClass->SetStartTime(dateTime2);
1778 __pGroupData->Add(*pGroupItemClass);
1782 GroupItemClass::GroupItemClass()
1788 GroupItemClass::operator =(const GroupItemClass& rhs)
1792 __pData = rhs.__pData;
1797 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1799 __pData = groupItem.__pData;
1802 GroupItemClass::~GroupItemClass()
1806 __pData->RemoveAll(true);
1812 GroupItemClass::SetStartTime(DateTime& startTime)
1814 __startTime = startTime;
1818 GroupItemClass::SetEndTime(DateTime& endTime)
1820 __endTime = endTime;
1824 GroupItemClass::SetTitleText(String& titleText)
1826 __titleText = titleText;
1830 GroupItemClass::SetHistoryData(ArrayList* pData)
1836 GroupItemClass::GetStartTime(void)
1842 GroupItemClass::GetEndTime(void)
1848 GroupItemClass::GetTitleText(void)
1854 GroupItemClass::GetHistoryData(void)