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");
288 // r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
301 HistoryListForm::OnFormBackRequested(Form& source)
303 SceneManager* pSceneManager = SceneManager::GetInstance();
304 if (pSceneManager == null)
308 result r = E_FAILURE;
309 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
311 r = pSceneManager->GoBackward(BackwardSceneTransition());
315 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
319 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
324 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
326 result r = E_FAILURE;
332 GroupItem* pItem = null;
333 GroupItemClass* pGroupItemClass = null;
335 String weeksAgo2 = L"";
336 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
338 String weeksAgo3 = L"";
339 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
341 String weeksAgo4 = L"";
342 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),4);
344 pItem = new(std::nothrow) GroupItem();
349 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
351 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
353 AppLog("CreateGroupItem :: if history is null");
354 r = pItem->Construct(Dimension(itemWidth, 0));
359 r = pItem->Construct(Dimension(itemWidth, 48));
361 text = pGroupItemClass->GetTitleText();
363 if (__searchHistory == false)
367 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
370 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
371 if ( pGregorianCalendar != NULL)
373 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
380 delete pGregorianCalendar;
383 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
390 delete pGregorianCalendar;
393 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
400 delete pGregorianCalendar;
403 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
405 delete pGregorianCalendar;
411 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
414 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
417 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
420 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
423 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
426 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
429 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
437 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
439 text.Append(pGroupItemClass->GetStartTime().GetDay());
441 strMonth = pGroupItemClass->GetStartTime().GetMonth();
442 month = GetMonth(strMonth);
452 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
453 || 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"))
456 text.Append(pGroupItemClass->GetEndTime().GetDay());
458 strMonth = pGroupItemClass->GetEndTime().GetMonth();
459 month = GetMonth(strMonth);
465 r = pItem->SetElement(text, null);
469 AppLogDebug("Failed with %s", GetErrorMessage(r));
472 r = pItem->SetTextSize(32);
483 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
485 AppLog("HistoryListForm::CreateItem");
486 result r = E_FAILURE;
487 History* pHistory = null;
488 Bitmap* pBitmap = null;
489 Bitmap* pBookmarkBitmap = null;
490 GroupItemClass* pGroupItemClass = null;
491 CustomItem* pItem = new(std::nothrow) CustomItem();
492 int bookmarkBtnWidth = 0;
495 if(__pGroupData == null)
505 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
506 if (pGroupItemClass == null)
511 if (pGroupItemClass->GetHistoryData() == null)
516 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
517 if (pHistory == null)
522 r = pItem->Construct(Dimension(itemWidth, 128), LIST_ANNEX_STYLE_NORMAL);
529 bitmapId = pHistory->GetFaviconId() ;
531 pBitmap = pHistory->GetFavIconBitmap();
535 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
539 r = pItem->AddElement(Rectangle(16, 28, 72, 72), IDA_FORMAT_ICON, *pBitmap, null);
544 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
548 bool urlFoundInBookmark = false;
550 if(__pBookmarkList != null)
552 for (int i = 0; i < __pBookmarkList->GetCount();i++)
554 BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
555 if(pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
557 urlFoundInBookmark = true;
562 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
566 if (urlFoundInBookmark == true)
568 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
572 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
574 bookmarkBtnWidth = 64;
577 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);
578 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
580 if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
581 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);
583 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);
584 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
585 if ( pBookmarkBitmap != null)
587 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
588 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
589 delete pBookmarkBitmap;
599 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
608 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
610 AppLog("HistoryListForm::DeleteItem");
611 result r = E_FAILURE;
612 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
613 if (pGroupItemClass == null)
618 // if (pGroupItemClass->__pData != null)
620 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
633 HistoryListForm::GetGroupCount(void)
635 __isNoHistoryPresent = true;
637 if (__pGroupData != null)
639 if (__searchHistory == false)
642 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
647 return __pGroupData->GetCount();
652 // String searchText = __pSearchBar->GetText();
653 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
667 HistoryListForm::GetItemCount(int groupIndex)
669 result r = E_FAILURE;
675 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
676 if (pGroupItemClass == null)
680 if (__searchHistory == false)
682 startTime = pGroupItemClass->GetStartTime();
683 endTime = pGroupItemClass->GetEndTime();
684 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
688 //text = __pSearchBar->GetText();
689 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
700 ArrayList* pData = new(std::nothrow) ArrayList();
705 r = pData->Construct();
713 if (__searchHistory == false)
715 startTime = pGroupItemClass->GetStartTime();
716 endTime = pGroupItemClass->GetEndTime();
717 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
718 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
722 //text = __pSearchBar->GetText() ;
723 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
730 pGroupItemClass->SetHistoryData(pData);
733 if (__isNoHistoryPresent == true && count == 0)
735 __isNoHistoryPresent = true;
736 GetFooter()->SetItemEnabled(0, false);
740 __isNoHistoryPresent = false;
741 GetFooter()->SetItemEnabled(0, true);
743 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
744 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
751 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
752 return pGroupItemClass->GetHistoryData()->GetCount();
757 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
760 GetHeader()->SetItemSelected(1);
761 // __previousSceneId = previousSceneId;
762 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
765 pList->GetAt(pList->GetCount()-1,__previousSceneId);
768 AppLog("HistoryListForm::OnSceneActivatedN called");
769 //GetHeader()->Invalidate(true);
770 if (__pGroupData == null)
772 __pGroupData = new(std::nothrow) ArrayList();
773 __pGroupData->Construct();
775 if (__pGroupedListView != null)
777 __pGroupedListView->UpdateList();
779 if (__isNoHistoryPresent == true)
781 GetFooter()->SetItemEnabled(0, false);
785 GetFooter()->SetItemEnabled(0, true);
789 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
792 __pSearchBar->SetShowState(false);
793 __pSearchBar->Invalidate(true);
797 __pSearchBar->SetShowState(true);
798 __pSearchBar->Invalidate(true);
801 // if (__isNoHistoryPresent == true)
803 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
804 // __pGroupedListView->UpdateList();
807 result r = GetHeader()->SetItemSelected(2);
810 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
814 if(__pBookmarkList != null)
816 __pBookmarkList->RemoveAll(false);
819 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
826 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
828 AppLog("HistoryListForm::OnSceneDeactivated");
829 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
833 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
839 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
841 GroupItemClass* pGroupItemClass = null;
842 History* pHistory = null;
843 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
844 if (elementId == IDA_FORMAT_BOOKMARK)
846 String toggledUrl = L"";
847 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
848 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
849 if (pGroupItemClass == null)
853 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
854 if (pHistory == null)
858 toggledUrl = pHistory->GetHistoryUrl();
860 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
862 bool bookmarkFound = false;
863 BookmarkData* pBookMark = null;
864 if(__pBookmarkList != null)
866 for (int i = 0; i < __pBookmarkList->GetCount(); i++)
868 pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
869 if (toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
871 bookmarkFound = true;
876 if(bookmarkFound == false)
878 // Add the history in bookmark database
879 result r = E_FAILURE;
880 BookmarkData pBookmark;
882 String bookmarkTitle = pHistory->GetHistoryTitle();
884 pBookmark.SetBookmarkTitle(bookmarkTitle);
885 pBookmark.SetUrl(pHistory->GetHistoryUrl());
886 pBookmark.SetFaviconId(pHistory->GetFaviconId());
888 r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
892 // remove the history from bookmark database
893 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
896 if(__pBookmarkList != null)
898 __pBookmarkList->RemoveAll(false);
899 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
901 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
902 listView.UpdateList();
906 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
907 if (pGroupItemClass == null)
912 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
913 if (pHistory1 == null)
917 SceneManager* pSceneManager = SceneManager::GetInstance();
918 ArrayList *pArgList = null;
919 result r = E_SUCCESS;
920 pArgList = new(std::nothrow) ArrayList();
921 if (pArgList != null)
923 r = pArgList->Construct();
930 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
931 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
942 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
944 if (pSceneManager != null)
946 AppLog("pSceneManager exists");
947 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
950 pArgList->RemoveAll(false);
963 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
969 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
971 result r = E_FAILURE;
972 if (mode == SEARCH_BAR_MODE_NORMAL)
974 // __pSearchBar->SetMode(SEARCH_BAR_MODE_INPUT);
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)
1194 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1196 // __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
1197 __pSearchListView->SetEnabled(true);
1200 GetFooter()->SetShowState(true);
1201 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1202 __pSearchListView->Invalidate(false);
1203 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1204 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1209 HistoryListForm::CreateGroupItems()
1211 result r = E_FAILURE;
1212 DateTime currentTime;
1214 GroupItemClass* pGroupItemClass = null;
1217 String weeksAgo2 = L"";
1218 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
1220 String weeksAgo3 = L"";
1221 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1223 if (__pGroupData != null)
1225 __pGroupData->RemoveAll(false);
1226 delete __pGroupData;
1227 __pGroupData = null;
1229 __pGroupData = new(std::nothrow) ArrayList();
1230 if (__pGroupData == null)
1234 r = __pGroupData->Construct();
1237 delete __pGroupData;
1238 __pGroupData = null;
1241 if (__searchHistory == true)
1243 pGroupItemClass = new(std::nothrow) GroupItemClass();
1244 if (pGroupItemClass == null)
1248 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1249 pGroupItemClass->SetTitleText(titleText);
1250 r = __pGroupData->Add(*pGroupItemClass);
1258 Calendar* pGregorianCalendar = null;
1261 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1262 pGroupItemClass = new(std::nothrow) GroupItemClass();
1263 if (pGroupItemClass == null)
1267 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1268 pGroupItemClass->SetTitleText(titleText);
1269 pGroupItemClass->SetEndTime(currentTime);
1270 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1271 pGroupItemClass->SetStartTime(dateTime);
1272 __pGroupData->Add(*pGroupItemClass);
1275 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1276 if ( pGregorianCalendar != NULL )
1278 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1279 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1280 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1281 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1282 delete pGregorianCalendar;
1287 pGroupItemClass = new(std::nothrow) GroupItemClass();
1288 if (pGroupItemClass == null)
1292 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1293 pGroupItemClass->SetTitleText(titleText);
1294 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1295 pGroupItemClass->SetEndTime(dateTime);
1296 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1297 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1298 pGroupItemClass->SetStartTime(dateTime);
1299 __pGroupData->Add(*pGroupItemClass);
1302 pGroupItemClass = new(std::nothrow) GroupItemClass();
1303 if (pGroupItemClass == null)
1307 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1308 pGroupItemClass->SetTitleText(titleText);
1309 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1310 pGroupItemClass->SetEndTime(dateTime);
1311 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1312 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1313 pGroupItemClass->SetStartTime(dateTime);
1314 __pGroupData->Add(*pGroupItemClass);
1317 pGroupItemClass = new(std::nothrow) GroupItemClass();
1318 if (pGroupItemClass == null)
1322 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1323 pGroupItemClass->SetTitleText(titleText);
1324 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1325 pGroupItemClass->SetEndTime(dateTime);
1326 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1327 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1328 pGroupItemClass->SetStartTime(dateTime);
1329 __pGroupData->Add(*pGroupItemClass);
1331 pGroupItemClass = new(std::nothrow) GroupItemClass();
1332 if (pGroupItemClass == null)
1336 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1337 pGroupItemClass->SetTitleText(titleText);
1338 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1339 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1340 pGroupItemClass->SetEndTime(dateTime);
1341 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1342 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1343 pGroupItemClass->SetStartTime(dateTime);
1344 __pGroupData->Add(*pGroupItemClass);
1347 pGroupItemClass = new(std::nothrow) GroupItemClass();
1348 if (pGroupItemClass == null)
1352 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1353 pGroupItemClass->SetTitleText(titleText);
1354 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1355 pGroupItemClass->SetEndTime(dateTime);
1356 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1357 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1358 pGroupItemClass->SetStartTime(dateTime);
1359 __pGroupData->Add(*pGroupItemClass);
1361 pGroupItemClass = new(std::nothrow) GroupItemClass();
1362 if (pGroupItemClass == null)
1366 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1367 pGroupItemClass->SetTitleText(titleText);
1368 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1369 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1370 pGroupItemClass->SetEndTime(dateTime);
1371 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1372 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1373 pGroupItemClass->SetStartTime(dateTime);
1374 __pGroupData->Add(*pGroupItemClass);
1376 pGroupItemClass = new(std::nothrow) GroupItemClass();
1377 if (pGroupItemClass == null)
1381 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1382 pGroupItemClass->SetTitleText(titleText);
1383 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1384 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1385 pGroupItemClass->SetEndTime(dateTime);
1386 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1387 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1388 pGroupItemClass->SetStartTime(dateTime);
1389 __pGroupData->Add(*pGroupItemClass);
1392 pGroupItemClass = new(std::nothrow) GroupItemClass();
1393 if (pGroupItemClass == null)
1397 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1398 pGroupItemClass->SetTitleText(titleText);
1399 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1400 pGroupItemClass->SetEndTime(dateTime);
1401 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1402 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1403 pGroupItemClass->SetStartTime(dateTime);
1404 __pGroupData->Add(*pGroupItemClass);
1406 pGroupItemClass = new(std::nothrow) GroupItemClass();
1407 if (pGroupItemClass == null)
1411 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1412 pGroupItemClass->SetTitleText(titleText);
1413 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1414 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1415 pGroupItemClass->SetEndTime(dateTime);
1416 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1417 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1418 pGroupItemClass->SetStartTime(dateTime);
1419 __pGroupData->Add(*pGroupItemClass);
1421 pGroupItemClass = new(std::nothrow) GroupItemClass();
1422 if (pGroupItemClass == null)
1426 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1427 pGroupItemClass->SetTitleText(titleText);
1428 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1429 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1430 pGroupItemClass->SetEndTime(dateTime);
1431 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1432 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1433 pGroupItemClass->SetStartTime(dateTime);
1434 __pGroupData->Add(*pGroupItemClass);
1436 pGroupItemClass = new(std::nothrow) GroupItemClass();
1437 if (pGroupItemClass == null)
1441 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1442 pGroupItemClass->SetTitleText(titleText);
1443 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1444 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1445 pGroupItemClass->SetEndTime(dateTime);
1446 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1447 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1448 pGroupItemClass->SetStartTime(dateTime);
1449 __pGroupData->Add(*pGroupItemClass);
1452 pGroupItemClass = new(std::nothrow) GroupItemClass();
1453 if (pGroupItemClass == null)
1457 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1458 pGroupItemClass->SetTitleText(titleText);
1459 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1460 pGroupItemClass->SetEndTime(dateTime);
1461 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1462 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1463 pGroupItemClass->SetStartTime(dateTime);
1464 __pGroupData->Add(*pGroupItemClass);
1466 pGroupItemClass = new(std::nothrow) GroupItemClass();
1467 if (pGroupItemClass == null)
1471 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1472 pGroupItemClass->SetTitleText(titleText);
1473 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1474 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1475 pGroupItemClass->SetEndTime(dateTime);
1476 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1477 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1478 pGroupItemClass->SetStartTime(dateTime);
1479 __pGroupData->Add(*pGroupItemClass);
1481 pGroupItemClass = new(std::nothrow) GroupItemClass();
1482 if (pGroupItemClass == null)
1486 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1487 pGroupItemClass->SetTitleText(titleText);
1488 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1489 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1490 pGroupItemClass->SetEndTime(dateTime);
1491 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1492 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1493 pGroupItemClass->SetStartTime(dateTime);
1494 __pGroupData->Add(*pGroupItemClass);
1496 pGroupItemClass = new(std::nothrow) GroupItemClass();
1497 if (pGroupItemClass == null)
1501 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1502 pGroupItemClass->SetTitleText(titleText);
1503 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1504 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1505 pGroupItemClass->SetEndTime(dateTime);
1506 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1507 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1508 pGroupItemClass->SetStartTime(dateTime);
1509 __pGroupData->Add(*pGroupItemClass);
1511 pGroupItemClass = new(std::nothrow) GroupItemClass();
1512 if (pGroupItemClass == null)
1516 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1517 pGroupItemClass->SetTitleText(titleText);
1518 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1519 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1520 pGroupItemClass->SetEndTime(dateTime);
1521 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1522 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1523 pGroupItemClass->SetStartTime(dateTime);
1524 __pGroupData->Add(*pGroupItemClass);
1527 pGroupItemClass = new(std::nothrow) GroupItemClass();
1528 if (pGroupItemClass == null)
1532 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1533 pGroupItemClass->SetTitleText(titleText);
1534 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1535 pGroupItemClass->SetEndTime(dateTime);
1536 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1537 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1538 pGroupItemClass->SetStartTime(dateTime);
1539 __pGroupData->Add(*pGroupItemClass);
1541 pGroupItemClass = new(std::nothrow) GroupItemClass();
1542 if (pGroupItemClass == null)
1546 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1547 pGroupItemClass->SetTitleText(titleText);
1548 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1549 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1550 pGroupItemClass->SetEndTime(dateTime);
1551 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1552 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1553 pGroupItemClass->SetStartTime(dateTime);
1554 __pGroupData->Add(*pGroupItemClass);
1556 pGroupItemClass = new(std::nothrow) GroupItemClass();
1557 if (pGroupItemClass == null)
1561 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1562 pGroupItemClass->SetTitleText(titleText);
1563 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1564 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1565 pGroupItemClass->SetEndTime(dateTime);
1566 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1567 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1568 pGroupItemClass->SetStartTime(dateTime);
1569 __pGroupData->Add(*pGroupItemClass);
1571 pGroupItemClass = new(std::nothrow) GroupItemClass();
1572 if (pGroupItemClass == null)
1576 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1577 pGroupItemClass->SetTitleText(titleText);
1578 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1579 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1580 pGroupItemClass->SetEndTime(dateTime);
1581 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1582 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1583 pGroupItemClass->SetStartTime(dateTime);
1584 __pGroupData->Add(*pGroupItemClass);
1586 pGroupItemClass = new(std::nothrow) GroupItemClass();
1587 if (pGroupItemClass == null)
1591 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1592 pGroupItemClass->SetTitleText(titleText);
1593 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1594 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1595 pGroupItemClass->SetEndTime(dateTime);
1596 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1597 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1598 pGroupItemClass->SetStartTime(dateTime);
1599 __pGroupData->Add(*pGroupItemClass);
1601 pGroupItemClass = new(std::nothrow) GroupItemClass();
1602 if (pGroupItemClass == null)
1606 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1607 pGroupItemClass->SetTitleText(titleText);
1608 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1609 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1610 pGroupItemClass->SetEndTime(dateTime);
1611 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1612 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1613 pGroupItemClass->SetStartTime(dateTime);
1614 __pGroupData->Add(*pGroupItemClass);
1620 day = currentTime.GetDay();
1624 pGroupItemClass = new(std::nothrow) GroupItemClass();
1625 if (pGroupItemClass == null)
1630 pGroupItemClass->SetTitleText(weeksAgo2);
1631 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1632 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1633 pGroupItemClass->SetEndTime(dateTime);
1634 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1635 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1636 pGroupItemClass->SetStartTime(dateTime);
1637 __pGroupData->Add(*pGroupItemClass);
1639 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1641 pGroupItemClass = new(std::nothrow) GroupItemClass();
1642 if (pGroupItemClass == null)
1646 String weeksAgo3 = L"";
1647 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1648 pGroupItemClass->SetTitleText(weeksAgo3);
1649 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1650 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1651 pGroupItemClass->SetEndTime(dateTime);
1652 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1653 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1654 pGroupItemClass->SetStartTime(dateTime);
1655 __pGroupData->Add(*pGroupItemClass);
1659 pGroupItemClass = new(std::nothrow) GroupItemClass();
1660 if (pGroupItemClass == null)
1664 pGroupItemClass->SetTitleText(weeksAgo2);
1665 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1666 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1667 pGroupItemClass->SetEndTime(dateTime);
1668 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1669 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1670 pGroupItemClass->SetStartTime(dateTime);
1671 __pGroupData->Add(*pGroupItemClass);
1673 pGroupItemClass = new(std::nothrow) GroupItemClass();
1674 if (pGroupItemClass == null)
1679 pGroupItemClass->SetTitleText(weeksAgo3);
1680 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1681 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1682 pGroupItemClass->SetEndTime(dateTime);
1683 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1684 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1685 pGroupItemClass->SetStartTime(dateTime);
1686 __pGroupData->Add(*pGroupItemClass);
1688 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1690 pGroupItemClass = new(std::nothrow) GroupItemClass();
1691 if (pGroupItemClass == null)
1695 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1696 pGroupItemClass->SetTitleText(titleText);
1697 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1698 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1699 pGroupItemClass->SetEndTime(dateTime);
1700 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1701 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1702 pGroupItemClass->SetStartTime(dateTime);
1703 __pGroupData->Add(*pGroupItemClass);
1707 pGroupItemClass = new(std::nothrow) GroupItemClass();
1708 if (pGroupItemClass == null)
1712 pGroupItemClass->SetTitleText(weeksAgo2);
1713 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1714 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1715 pGroupItemClass->SetEndTime(dateTime);
1716 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1717 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1718 pGroupItemClass->SetStartTime(dateTime);
1719 __pGroupData->Add(*pGroupItemClass);
1721 pGroupItemClass = new(std::nothrow) GroupItemClass();
1722 if (pGroupItemClass == null)
1726 pGroupItemClass->SetTitleText(weeksAgo3);
1727 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1728 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1729 pGroupItemClass->SetEndTime(dateTime);
1730 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1731 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1732 pGroupItemClass->SetStartTime(dateTime);
1733 __pGroupData->Add(*pGroupItemClass);
1735 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1737 pGroupItemClass = new(std::nothrow) GroupItemClass();
1738 if (pGroupItemClass == null)
1742 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1743 pGroupItemClass->SetTitleText(titleText);
1744 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1745 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1746 pGroupItemClass->SetEndTime(dateTime);
1747 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1748 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1749 pGroupItemClass->SetStartTime(dateTime);
1750 __pGroupData->Add(*pGroupItemClass);
1756 pGroupItemClass = new(std::nothrow) GroupItemClass();
1757 if (pGroupItemClass == null)
1761 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1762 pGroupItemClass->SetTitleText(titleText);
1763 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1764 dateTime.AddDays(-1);
1765 pGroupItemClass->SetEndTime(dateTime);
1766 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1767 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1768 pGroupItemClass->SetStartTime(dateTime);
1769 __pGroupData->Add(*pGroupItemClass);
1771 pGroupItemClass = new(std::nothrow) GroupItemClass();
1772 if (pGroupItemClass == null)
1776 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1777 pGroupItemClass->SetTitleText(titleText);
1778 dateTime.SetValue(currentTime.GetYear(),1, 1);
1779 dateTime.AddMonths(currentTime.GetMonth() - 2);
1780 dateTime.AddDays(-1);
1781 pGroupItemClass->SetEndTime(dateTime);
1783 dateTime2.SetValue(0, 0, 0);
1784 pGroupItemClass->SetStartTime(dateTime2);
1785 __pGroupData->Add(*pGroupItemClass);
1789 GroupItemClass::GroupItemClass()
1795 GroupItemClass::operator =(const GroupItemClass& rhs)
1799 __pData = rhs.__pData;
1804 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1806 __pData = groupItem.__pData;
1809 GroupItemClass::~GroupItemClass()
1813 __pData->RemoveAll(true);
1819 GroupItemClass::SetStartTime(DateTime& startTime)
1821 __startTime = startTime;
1825 GroupItemClass::SetEndTime(DateTime& endTime)
1827 __endTime = endTime;
1831 GroupItemClass::SetTitleText(String& titleText)
1833 __titleText = titleText;
1837 GroupItemClass::SetHistoryData(ArrayList* pData)
1843 GroupItemClass::GetStartTime(void)
1849 GroupItemClass::GetEndTime(void)
1855 GroupItemClass::GetTitleText(void)
1861 GroupItemClass::GetHistoryData(void)