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 __pGroupedListView =null;
63 __pSearchListView = null;
66 __pSearchedData = null ;
67 __searchHistory = false;
68 __isNoHistoryPresent = true;
70 __previousSceneId = L"";
73 HistoryListForm::~HistoryListForm(void)
75 if (__pGroupData != null)
77 __pGroupData->RemoveAll(false);
83 HistoryListForm::Initialize(void)
85 Construct(L"IDL_HISTORY_LIST");
91 HistoryListForm::OnInitializing(void)
93 AppLog("HistoryListForm::OnInitializing");
95 SceneManager* pSceneManager = null;
98 Header *pHeader = GetHeader();
99 Bitmap *pIconBitmap = null;
100 AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
101 const Color brown = Color(32, 32, 32, 0xFF);
103 // Setup back event listener
104 SetFormBackEventListener(this);
106 GetHeader()->AddActionEventListener(*this);
107 GetFooter()->AddActionEventListener(*this);
109 AddOrientationEventListener(*this);
110 pSceneManager = SceneManager::GetInstance();
111 if (pSceneManager != null)
113 pSceneManager->AddSceneEventListener(IDSCN_HISTORY_LIST, *this);
116 if (pAppResource == null)
121 __pGroupedListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1"));
122 if (__pGroupedListView == null)
127 r = __pGroupedListView->SetItemProvider(*this);
134 __pSearchBar = static_cast< SearchBar* >(GetControl(L"IDC_SEARCHBAR1"));
135 if (__pSearchBar == null)
139 __pSearchListView = new(std::nothrow) GroupedListView();
140 if (__pSearchListView == null)
144 __pGroupedListView->AddGroupedListViewItemEventListener(*this);
145 r = __pGroupedListView->SetBounds(Rectangle(0,__pGroupedListView->GetY(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
150 r = __pSearchListView->Construct(Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height -__pSearchBar->GetHeight() - __pSearchBar->GetY()), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
155 r = __pSearchListView->SetItemProvider(*this);
160 r = __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND"));
167 __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK));
168 __pSearchListView->AddGroupedListViewItemEventListener(*this);
169 r = __pSearchListView->SetShowState(false);
176 __pSearchBar->AddSearchBarEventListener(*this);
177 __pSearchBar->AddKeypadEventListener(*this);
178 r = __pSearchBar->SetContent(__pSearchListView);
182 pHeader->SetStyle(HEADER_STYLE_TAB);
183 bookmark.Construct(IDA_TABBAR_ITEM_1);
185 pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark);
186 bookmark.SetText(strbookmark);
187 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARKS);
188 bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
189 bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
190 pHeader->AddItem(bookmark);
198 history.Construct(IDA_TABBAR_ITEM_2);
200 pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory);
201 history.SetText(strhistory);
202 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY);
203 history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
204 history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
205 pHeader->AddItem(history);
206 pHeader->SetItemSelected(1);
208 if (pIconBitmap != NULL)
218 HistoryListForm::OnTerminating(void)
220 result r = E_SUCCESS;
226 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
228 AppLog("HistoryListForm::OnActionPerformed");
229 result r = E_FAILURE;
230 SceneManager* pSceneManager = SceneManager::GetInstance();
231 if (pSceneManager == null)
237 case IDA_EDIT_HISTORY_LIST_FORM:
239 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
240 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
247 case IDA_TABBAR_ITEM_1:
249 result r = GetHeader()->SetItemSelected(1);
250 AppLog("SetItemSelected result %s",GetErrorMessage(r));
251 GetHeader()->Invalidate(true);
253 if (pSceneManager != null)
255 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
257 if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)) != E_SUCCESS)
259 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
266 if(pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT))!= E_SUCCESS)
268 AppLogDebug("BookmarkListForm::OnActionPerformed GoBackward failed");
278 // r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
291 HistoryListForm::OnFormBackRequested(Form& source)
293 SceneManager* pSceneManager = SceneManager::GetInstance();
294 if (pSceneManager == null)
298 result r = E_FAILURE;
299 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
301 r = pSceneManager->GoBackward(BackwardSceneTransition());
305 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
309 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
314 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
316 result r = E_FAILURE;
322 GroupItem* pItem = null;
323 GroupItemClass* pGroupItemClass = null;
325 String weeksAgo2 = L"";
326 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
328 String weeksAgo3 = L"";
329 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
331 String weeksAgo4 = L"";
332 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),4);
334 pItem = new(std::nothrow) GroupItem();
339 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
341 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
343 AppLog("CreateGroupItem :: if history is null");
344 r = pItem->Construct(Dimension(itemWidth, 0));
349 r = pItem->Construct(Dimension(itemWidth, 48));
351 text = pGroupItemClass->GetTitleText();
353 if (__searchHistory == false)
357 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
360 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
361 if ( pGregorianCalendar != NULL)
363 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
370 delete pGregorianCalendar;
373 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
380 delete pGregorianCalendar;
383 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
390 delete pGregorianCalendar;
393 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
395 delete pGregorianCalendar;
401 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
404 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
407 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
410 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
413 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
416 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
419 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
427 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
429 text.Append(pGroupItemClass->GetStartTime().GetDay());
431 strMonth = pGroupItemClass->GetStartTime().GetMonth();
432 month = GetMonth(strMonth);
442 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
443 || 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"))
446 text.Append(pGroupItemClass->GetEndTime().GetDay());
448 strMonth = pGroupItemClass->GetEndTime().GetMonth();
449 month = GetMonth(strMonth);
455 r = pItem->SetElement(text, null);
459 AppLogDebug("Failed with %s", GetErrorMessage(r));
462 r = pItem->SetTextSize(32);
473 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
475 AppLog("HistoryListForm::CreateItem");
476 result r = E_FAILURE;
477 History* pHistory = null;
478 Bitmap* pBitmap = null;
479 GroupItemClass* pGroupItemClass = null;
480 CustomItem* pItem = new(std::nothrow) CustomItem();
481 int bookmarkBtnWidth = 0;
484 if(__pGroupData == null)
494 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
495 if (pGroupItemClass == null)
500 if (pGroupItemClass->GetHistoryData() == null)
505 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
506 if (pHistory == null)
511 r = pItem->Construct(Dimension(itemWidth, 128), LIST_ANNEX_STYLE_NORMAL);
518 bitmapId = pHistory->GetFaviconId() ;
520 pBitmap = pHistory->GetFavIconBitmap();
524 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
528 r = pItem->AddElement(Rectangle(16, 28, 72, 72), IDA_FORMAT_ICON, *pBitmap, null);
533 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
537 // if (pHistory->GetBookmarkId().GetLength()>0)
539 // pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
543 // pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
545 bookmarkBtnWidth = 64;
548 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);
549 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
551 if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
552 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);
554 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);
555 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
556 // if ( pBookmarkBitmap != null)
558 // r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
559 // TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
560 // delete pBookmarkBitmap;
570 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
579 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
581 AppLog("HistoryListForm::DeleteItem");
582 result r = E_FAILURE;
583 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
584 if (pGroupItemClass == null)
589 // if (pGroupItemClass->__pData != null)
591 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
604 HistoryListForm::GetGroupCount(void)
606 __isNoHistoryPresent = true;
608 if (__pGroupData != null)
610 if (__searchHistory == false)
613 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
618 return __pGroupData->GetCount();
623 // String searchText = __pSearchBar->GetText();
624 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
638 HistoryListForm::GetItemCount(int groupIndex)
640 result r = E_FAILURE;
646 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
647 if (pGroupItemClass == null)
651 if (__searchHistory == false)
653 startTime = pGroupItemClass->GetStartTime();
654 endTime = pGroupItemClass->GetEndTime();
655 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
659 //text = __pSearchBar->GetText();
660 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
671 ArrayList* pData = new(std::nothrow) ArrayList();
676 r = pData->Construct();
684 if (__searchHistory == false)
686 startTime = pGroupItemClass->GetStartTime();
687 endTime = pGroupItemClass->GetEndTime();
688 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
689 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
693 //text = __pSearchBar->GetText() ;
694 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
701 pGroupItemClass->SetHistoryData(pData);
704 if (__isNoHistoryPresent == true && count == 0)
706 __isNoHistoryPresent = true;
707 GetFooter()->SetItemEnabled(0, false);
711 __isNoHistoryPresent = false;
712 GetFooter()->SetItemEnabled(0, true);
714 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
715 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
722 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
723 return pGroupItemClass->GetHistoryData()->GetCount();
728 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
731 GetHeader()->SetItemSelected(1);
732 // __previousSceneId = previousSceneId;
733 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
736 pList->GetAt(pList->GetCount()-1,__previousSceneId);
739 AppLog("HistoryListForm::OnSceneActivatedN called");
740 //GetHeader()->Invalidate(true);
741 if (__pGroupData == null)
743 __pGroupData = new(std::nothrow) ArrayList();
744 __pGroupData->Construct();
746 if (__pGroupedListView != null)
748 __pGroupedListView->UpdateList();
750 if (__isNoHistoryPresent == true)
752 GetFooter()->SetItemEnabled(0, false);
756 GetFooter()->SetItemEnabled(0, true);
760 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
763 __pSearchBar->SetShowState(false);
764 __pSearchBar->Invalidate(true);
768 __pSearchBar->SetShowState(true);
769 __pSearchBar->Invalidate(true);
772 // if (__isNoHistoryPresent == true)
774 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
775 // __pGroupedListView->UpdateList();
778 result r = GetHeader()->SetItemSelected(2);
781 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
790 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
792 AppLog("HistoryListForm::OnSceneDeactivated");
793 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
797 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
803 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
805 GroupItemClass* pGroupItemClass = null;
806 History* pHistory = null;
807 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
808 if (elementId == IDA_FORMAT_BOOKMARK)
810 String toggledUrl = L"";
811 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
812 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
813 if (pGroupItemClass == null)
817 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
818 if (pHistory == null)
822 toggledUrl = pHistory->GetHistoryUrl();
824 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
825 if (pHistory->GetBookmarkId().GetLength() > 0)
827 AppLog("Already added to bookmark so will be removed");
828 String bookmarkId = L"";
831 bookmarkId = pHistory->GetBookmarkId();
832 Integer::Parse(bookmarkId,id);
833 BookmarkPresentationModel::GetInstance()->DeleteBookmark(id);
834 pHistory->SetBookmarkId(L"");
835 //listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
837 for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
839 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
840 if (pGroupItemClass == null)
844 for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
846 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
847 if (pHistory == null)
851 if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
853 pHistory->SetBookmarkId(L"");
854 AppLog("Already added to bookmark so will be removed");
855 String bookmarkId = L"";
858 bookmarkId = pHistory->GetBookmarkId();
859 Integer::Parse(bookmarkId,id);
860 BookmarkPresentationModel::GetInstance()->DeleteBookmark(id);
861 pHistory->SetBookmarkId(L"");
862 //listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
864 for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
866 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
867 if (pGroupItemClass == null)
871 for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
873 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
874 if (pHistory == null)
878 if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
880 pHistory->SetBookmarkId(L"");
881 //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
886 //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
890 listView.UpdateList();
895 AppLog("Adding history to bookmark");
896 result r = E_FAILURE;
897 BookmarkData pBookmark;
899 String bookmarkTitle = pHistory->GetHistoryTitle();
901 pBookmark.SetBookmarkTitle(bookmarkTitle);
902 pBookmark.SetUrl(pHistory->GetHistoryUrl());
903 pBookmark.SetFaviconId(pHistory->GetFaviconId());
905 r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
908 AppLog("History added to bookmark with ID %ls",pBookmark.GetBookmarkId().GetPointer());
909 pHistory->SetBookmarkId(pBookmark.GetBookmarkId());
912 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
914 for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
916 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
917 if (pGroupItemClass == null)
921 for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
923 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
924 if (pHistory == null)
928 if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
930 pHistory->SetBookmarkId(pBookmark.GetBookmarkId());
931 //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
935 listView.UpdateList();
941 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
942 if (pGroupItemClass == null)
947 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
948 if (pHistory1 == null)
952 SceneManager* pSceneManager = SceneManager::GetInstance();
953 ArrayList *pArgList = null;
954 result r = E_SUCCESS;
955 pArgList = new(std::nothrow) ArrayList();
956 if (pArgList != null)
958 r = pArgList->Construct();
965 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
966 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
977 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
979 if (pSceneManager != null)
981 AppLog("pSceneManager exists");
982 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
985 pArgList->RemoveAll(false);
998 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
1004 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
1006 result r = E_FAILURE;
1007 if (mode == SEARCH_BAR_MODE_NORMAL)
1009 // __pSearchBar->SetMode(SEARCH_BAR_MODE_INPUT);
1010 r = __pSearchListView->SetShowState(false);
1015 r = __pGroupedListView->SetShowState(true);
1020 __pSearchListView->SetEnabled(true);
1021 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1023 __searchHistory = false;
1024 r = __pGroupedListView->UpdateList();
1025 if (__isNoHistoryPresent == true)
1027 GetFooter()->SetItemEnabled(0, false);
1031 GetFooter()->SetItemEnabled(0, true);
1033 if(__pSearchBar != null)
1035 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1044 // __pSearchListView->SetEnabled(false);
1045 r = __pSearchListView->SetShowState(true);
1050 __pSearchListView->SetEnabled(false);
1051 r = __pSearchListView->UpdateList();
1056 r = __pGroupedListView->SetShowState(false);
1061 if(__pSearchBar != null)
1063 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1069 HistoryListForm::GetMonth(int month)
1071 String monthValue = L"";
1075 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1078 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1081 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1084 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1087 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1090 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN"));
1093 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1096 monthValue.Append(CommonUtil::GetString(L"DS_COM_BODY_AUG"));
1099 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1102 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1105 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1108 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1119 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1121 result r = E_FAILURE;
1122 if (__pSearchBar != null)
1124 __pSearchBar->HideKeypad();
1127 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1129 __pSearchListView->SetEnabled(true);
1130 __searchHistory = true;
1131 __searchText =__pSearchBar->GetText();
1133 r = __pGroupedListView->SetShowState(false);
1138 r = __pSearchListView->SetShowState(true);
1143 r= __pSearchListView->UpdateList();
1144 if (__isNoHistoryPresent == true)
1146 GetFooter()->SetItemEnabled(0, false);
1150 GetFooter()->SetItemEnabled(0, true);
1152 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1161 __searchHistory = false;
1167 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1169 result r = E_FAILURE;
1170 if (__pGroupedListView != null)
1172 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1173 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1174 else if(__pSearchBar != null)
1175 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1180 __pGroupedListView->UpdateList();
1182 if (__pSearchListView != null)
1184 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1190 __pSearchListView->UpdateList();
1192 if(__pSearchBar != null)
1193 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1198 if (__isNoHistoryPresent == true)
1200 GetFooter()->SetItemEnabled(0, false);
1204 GetFooter()->SetItemEnabled(0, true);
1209 HistoryListForm::OnKeypadWillOpen(Control& source)
1211 GetFooter()->SetShowState(false);
1212 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1213 __pSearchListView->SetEnabled(false);
1214 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1220 HistoryListForm::OnKeypadOpened(Control& source)
1222 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1226 HistoryListForm::OnKeypadClosed(Control& source)
1228 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1230 // __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
1231 __pSearchListView->SetEnabled(true);
1234 GetFooter()->SetShowState(true);
1235 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1236 __pSearchListView->Invalidate(false);
1237 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1242 HistoryListForm::CreateGroupItems()
1244 result r = E_FAILURE;
1245 DateTime currentTime;
1247 GroupItemClass* pGroupItemClass = null;
1250 String weeksAgo2 = L"";
1251 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
1253 String weeksAgo3 = L"";
1254 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1256 if (__pGroupData != null)
1258 __pGroupData->RemoveAll(false);
1259 delete __pGroupData;
1260 __pGroupData = null;
1262 __pGroupData = new(std::nothrow) ArrayList();
1263 if (__pGroupData == null)
1267 r = __pGroupData->Construct();
1270 delete __pGroupData;
1271 __pGroupData = null;
1274 if (__searchHistory == true)
1276 pGroupItemClass = new(std::nothrow) GroupItemClass();
1277 if (pGroupItemClass == null)
1281 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1282 pGroupItemClass->SetTitleText(titleText);
1283 r = __pGroupData->Add(*pGroupItemClass);
1291 Calendar* pGregorianCalendar = null;
1294 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1295 pGroupItemClass = new(std::nothrow) GroupItemClass();
1296 if (pGroupItemClass == null)
1300 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1301 pGroupItemClass->SetTitleText(titleText);
1302 pGroupItemClass->SetEndTime(currentTime);
1303 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1304 pGroupItemClass->SetStartTime(dateTime);
1305 __pGroupData->Add(*pGroupItemClass);
1308 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1309 if ( pGregorianCalendar != NULL )
1311 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1312 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1313 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1314 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1315 delete pGregorianCalendar;
1320 pGroupItemClass = new(std::nothrow) GroupItemClass();
1321 if (pGroupItemClass == null)
1325 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1326 pGroupItemClass->SetTitleText(titleText);
1327 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1328 pGroupItemClass->SetEndTime(dateTime);
1329 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1330 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1331 pGroupItemClass->SetStartTime(dateTime);
1332 __pGroupData->Add(*pGroupItemClass);
1335 pGroupItemClass = new(std::nothrow) GroupItemClass();
1336 if (pGroupItemClass == null)
1340 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1341 pGroupItemClass->SetTitleText(titleText);
1342 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1343 pGroupItemClass->SetEndTime(dateTime);
1344 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1345 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1346 pGroupItemClass->SetStartTime(dateTime);
1347 __pGroupData->Add(*pGroupItemClass);
1350 pGroupItemClass = new(std::nothrow) GroupItemClass();
1351 if (pGroupItemClass == null)
1355 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1356 pGroupItemClass->SetTitleText(titleText);
1357 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1358 pGroupItemClass->SetEndTime(dateTime);
1359 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1360 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1361 pGroupItemClass->SetStartTime(dateTime);
1362 __pGroupData->Add(*pGroupItemClass);
1364 pGroupItemClass = new(std::nothrow) GroupItemClass();
1365 if (pGroupItemClass == null)
1369 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1370 pGroupItemClass->SetTitleText(titleText);
1371 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1372 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1373 pGroupItemClass->SetEndTime(dateTime);
1374 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1375 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1376 pGroupItemClass->SetStartTime(dateTime);
1377 __pGroupData->Add(*pGroupItemClass);
1380 pGroupItemClass = new(std::nothrow) GroupItemClass();
1381 if (pGroupItemClass == null)
1385 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1386 pGroupItemClass->SetTitleText(titleText);
1387 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1388 pGroupItemClass->SetEndTime(dateTime);
1389 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1390 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1391 pGroupItemClass->SetStartTime(dateTime);
1392 __pGroupData->Add(*pGroupItemClass);
1394 pGroupItemClass = new(std::nothrow) GroupItemClass();
1395 if (pGroupItemClass == null)
1399 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1400 pGroupItemClass->SetTitleText(titleText);
1401 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1402 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1403 pGroupItemClass->SetEndTime(dateTime);
1404 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1405 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1406 pGroupItemClass->SetStartTime(dateTime);
1407 __pGroupData->Add(*pGroupItemClass);
1409 pGroupItemClass = new(std::nothrow) GroupItemClass();
1410 if (pGroupItemClass == null)
1414 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1415 pGroupItemClass->SetTitleText(titleText);
1416 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1417 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1418 pGroupItemClass->SetEndTime(dateTime);
1419 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1420 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1421 pGroupItemClass->SetStartTime(dateTime);
1422 __pGroupData->Add(*pGroupItemClass);
1425 pGroupItemClass = new(std::nothrow) GroupItemClass();
1426 if (pGroupItemClass == null)
1430 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1431 pGroupItemClass->SetTitleText(titleText);
1432 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1433 pGroupItemClass->SetEndTime(dateTime);
1434 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1435 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1436 pGroupItemClass->SetStartTime(dateTime);
1437 __pGroupData->Add(*pGroupItemClass);
1439 pGroupItemClass = new(std::nothrow) GroupItemClass();
1440 if (pGroupItemClass == null)
1444 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1445 pGroupItemClass->SetTitleText(titleText);
1446 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1447 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1448 pGroupItemClass->SetEndTime(dateTime);
1449 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1450 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1451 pGroupItemClass->SetStartTime(dateTime);
1452 __pGroupData->Add(*pGroupItemClass);
1454 pGroupItemClass = new(std::nothrow) GroupItemClass();
1455 if (pGroupItemClass == null)
1459 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1460 pGroupItemClass->SetTitleText(titleText);
1461 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1462 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1463 pGroupItemClass->SetEndTime(dateTime);
1464 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1465 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1466 pGroupItemClass->SetStartTime(dateTime);
1467 __pGroupData->Add(*pGroupItemClass);
1469 pGroupItemClass = new(std::nothrow) GroupItemClass();
1470 if (pGroupItemClass == null)
1474 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1475 pGroupItemClass->SetTitleText(titleText);
1476 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1477 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1478 pGroupItemClass->SetEndTime(dateTime);
1479 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1480 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1481 pGroupItemClass->SetStartTime(dateTime);
1482 __pGroupData->Add(*pGroupItemClass);
1485 pGroupItemClass = new(std::nothrow) GroupItemClass();
1486 if (pGroupItemClass == null)
1490 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1491 pGroupItemClass->SetTitleText(titleText);
1492 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1493 pGroupItemClass->SetEndTime(dateTime);
1494 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1495 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1496 pGroupItemClass->SetStartTime(dateTime);
1497 __pGroupData->Add(*pGroupItemClass);
1499 pGroupItemClass = new(std::nothrow) GroupItemClass();
1500 if (pGroupItemClass == null)
1504 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1505 pGroupItemClass->SetTitleText(titleText);
1506 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1507 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1508 pGroupItemClass->SetEndTime(dateTime);
1509 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1510 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1511 pGroupItemClass->SetStartTime(dateTime);
1512 __pGroupData->Add(*pGroupItemClass);
1514 pGroupItemClass = new(std::nothrow) GroupItemClass();
1515 if (pGroupItemClass == null)
1519 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1520 pGroupItemClass->SetTitleText(titleText);
1521 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1522 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1523 pGroupItemClass->SetEndTime(dateTime);
1524 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1525 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1526 pGroupItemClass->SetStartTime(dateTime);
1527 __pGroupData->Add(*pGroupItemClass);
1529 pGroupItemClass = new(std::nothrow) GroupItemClass();
1530 if (pGroupItemClass == null)
1534 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1535 pGroupItemClass->SetTitleText(titleText);
1536 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1537 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1538 pGroupItemClass->SetEndTime(dateTime);
1539 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1540 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1541 pGroupItemClass->SetStartTime(dateTime);
1542 __pGroupData->Add(*pGroupItemClass);
1544 pGroupItemClass = new(std::nothrow) GroupItemClass();
1545 if (pGroupItemClass == null)
1549 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1550 pGroupItemClass->SetTitleText(titleText);
1551 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1552 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1553 pGroupItemClass->SetEndTime(dateTime);
1554 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1555 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1556 pGroupItemClass->SetStartTime(dateTime);
1557 __pGroupData->Add(*pGroupItemClass);
1560 pGroupItemClass = new(std::nothrow) GroupItemClass();
1561 if (pGroupItemClass == null)
1565 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1566 pGroupItemClass->SetTitleText(titleText);
1567 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1568 pGroupItemClass->SetEndTime(dateTime);
1569 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1570 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1571 pGroupItemClass->SetStartTime(dateTime);
1572 __pGroupData->Add(*pGroupItemClass);
1574 pGroupItemClass = new(std::nothrow) GroupItemClass();
1575 if (pGroupItemClass == null)
1579 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1580 pGroupItemClass->SetTitleText(titleText);
1581 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1582 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1583 pGroupItemClass->SetEndTime(dateTime);
1584 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1585 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1586 pGroupItemClass->SetStartTime(dateTime);
1587 __pGroupData->Add(*pGroupItemClass);
1589 pGroupItemClass = new(std::nothrow) GroupItemClass();
1590 if (pGroupItemClass == null)
1594 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1595 pGroupItemClass->SetTitleText(titleText);
1596 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1597 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1598 pGroupItemClass->SetEndTime(dateTime);
1599 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1600 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1601 pGroupItemClass->SetStartTime(dateTime);
1602 __pGroupData->Add(*pGroupItemClass);
1604 pGroupItemClass = new(std::nothrow) GroupItemClass();
1605 if (pGroupItemClass == null)
1609 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1610 pGroupItemClass->SetTitleText(titleText);
1611 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1612 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1613 pGroupItemClass->SetEndTime(dateTime);
1614 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1615 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1616 pGroupItemClass->SetStartTime(dateTime);
1617 __pGroupData->Add(*pGroupItemClass);
1619 pGroupItemClass = new(std::nothrow) GroupItemClass();
1620 if (pGroupItemClass == null)
1624 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1625 pGroupItemClass->SetTitleText(titleText);
1626 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1627 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1628 pGroupItemClass->SetEndTime(dateTime);
1629 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1630 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1631 pGroupItemClass->SetStartTime(dateTime);
1632 __pGroupData->Add(*pGroupItemClass);
1634 pGroupItemClass = new(std::nothrow) GroupItemClass();
1635 if (pGroupItemClass == null)
1639 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1640 pGroupItemClass->SetTitleText(titleText);
1641 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1642 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1643 pGroupItemClass->SetEndTime(dateTime);
1644 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1645 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1646 pGroupItemClass->SetStartTime(dateTime);
1647 __pGroupData->Add(*pGroupItemClass);
1653 day = currentTime.GetDay();
1657 pGroupItemClass = new(std::nothrow) GroupItemClass();
1658 if (pGroupItemClass == null)
1663 pGroupItemClass->SetTitleText(weeksAgo2);
1664 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1665 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1666 pGroupItemClass->SetEndTime(dateTime);
1667 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1668 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1669 pGroupItemClass->SetStartTime(dateTime);
1670 __pGroupData->Add(*pGroupItemClass);
1672 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1674 pGroupItemClass = new(std::nothrow) GroupItemClass();
1675 if (pGroupItemClass == null)
1679 String weeksAgo3 = L"";
1680 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1681 pGroupItemClass->SetTitleText(weeksAgo3);
1682 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1683 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1684 pGroupItemClass->SetEndTime(dateTime);
1685 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1686 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1687 pGroupItemClass->SetStartTime(dateTime);
1688 __pGroupData->Add(*pGroupItemClass);
1692 pGroupItemClass = new(std::nothrow) GroupItemClass();
1693 if (pGroupItemClass == null)
1697 pGroupItemClass->SetTitleText(weeksAgo2);
1698 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1699 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1700 pGroupItemClass->SetEndTime(dateTime);
1701 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1702 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1703 pGroupItemClass->SetStartTime(dateTime);
1704 __pGroupData->Add(*pGroupItemClass);
1706 pGroupItemClass = new(std::nothrow) GroupItemClass();
1707 if (pGroupItemClass == null)
1712 pGroupItemClass->SetTitleText(weeksAgo3);
1713 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1714 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1715 pGroupItemClass->SetEndTime(dateTime);
1716 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1717 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1718 pGroupItemClass->SetStartTime(dateTime);
1719 __pGroupData->Add(*pGroupItemClass);
1721 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1723 pGroupItemClass = new(std::nothrow) GroupItemClass();
1724 if (pGroupItemClass == null)
1728 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1729 pGroupItemClass->SetTitleText(titleText);
1730 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1731 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1732 pGroupItemClass->SetEndTime(dateTime);
1733 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1734 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1735 pGroupItemClass->SetStartTime(dateTime);
1736 __pGroupData->Add(*pGroupItemClass);
1740 pGroupItemClass = new(std::nothrow) GroupItemClass();
1741 if (pGroupItemClass == null)
1745 pGroupItemClass->SetTitleText(weeksAgo2);
1746 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1747 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1748 pGroupItemClass->SetEndTime(dateTime);
1749 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1750 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1751 pGroupItemClass->SetStartTime(dateTime);
1752 __pGroupData->Add(*pGroupItemClass);
1754 pGroupItemClass = new(std::nothrow) GroupItemClass();
1755 if (pGroupItemClass == null)
1759 pGroupItemClass->SetTitleText(weeksAgo3);
1760 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1761 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1762 pGroupItemClass->SetEndTime(dateTime);
1763 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1764 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1765 pGroupItemClass->SetStartTime(dateTime);
1766 __pGroupData->Add(*pGroupItemClass);
1768 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1770 pGroupItemClass = new(std::nothrow) GroupItemClass();
1771 if (pGroupItemClass == null)
1775 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1776 pGroupItemClass->SetTitleText(titleText);
1777 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1778 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1779 pGroupItemClass->SetEndTime(dateTime);
1780 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1781 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1782 pGroupItemClass->SetStartTime(dateTime);
1783 __pGroupData->Add(*pGroupItemClass);
1789 pGroupItemClass = new(std::nothrow) GroupItemClass();
1790 if (pGroupItemClass == null)
1794 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1795 pGroupItemClass->SetTitleText(titleText);
1796 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1797 dateTime.AddDays(-1);
1798 pGroupItemClass->SetEndTime(dateTime);
1799 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1800 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1801 pGroupItemClass->SetStartTime(dateTime);
1802 __pGroupData->Add(*pGroupItemClass);
1804 pGroupItemClass = new(std::nothrow) GroupItemClass();
1805 if (pGroupItemClass == null)
1809 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1810 pGroupItemClass->SetTitleText(titleText);
1811 dateTime.SetValue(currentTime.GetYear(),1, 1);
1812 dateTime.AddMonths(currentTime.GetMonth() - 2);
1813 dateTime.AddDays(-1);
1814 pGroupItemClass->SetEndTime(dateTime);
1816 dateTime2.SetValue(0, 0, 0);
1817 pGroupItemClass->SetStartTime(dateTime2);
1818 __pGroupData->Add(*pGroupItemClass);
1822 GroupItemClass::GroupItemClass()
1828 GroupItemClass::operator =(const GroupItemClass& rhs)
1832 __pData = rhs.__pData;
1837 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1839 __pData = groupItem.__pData;
1842 GroupItemClass::~GroupItemClass()
1846 __pData->RemoveAll(true);
1852 GroupItemClass::SetStartTime(DateTime& startTime)
1854 __startTime = startTime;
1858 GroupItemClass::SetEndTime(DateTime& endTime)
1860 __endTime = endTime;
1864 GroupItemClass::SetTitleText(String& titleText)
1866 __titleText = titleText;
1870 GroupItemClass::SetHistoryData(ArrayList* pData)
1876 GroupItemClass::GetStartTime(void)
1882 GroupItemClass::GetEndTime(void)
1888 GroupItemClass::GetTitleText(void)
1894 GroupItemClass::GetHistoryData(void)