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;
72 HistoryListForm::~HistoryListForm(void)
74 if (__pGroupData != null)
76 __pGroupData->RemoveAll(false);
82 HistoryListForm::Initialize(void)
84 Construct(L"IDL_HISTORY_LIST");
90 HistoryListForm::OnInitializing(void)
92 AppLog("HistoryListForm::OnInitializing");
94 SceneManager* pSceneManager = null;
97 Header *pHeader = GetHeader();
98 Bitmap *pIconBitmap = null;
99 AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
100 const Color brown = Color(32, 32, 32, 0xFF);
102 // Setup back event listener
103 SetFormBackEventListener(this);
105 GetHeader()->AddActionEventListener(*this);
106 GetFooter()->AddActionEventListener(*this);
108 AddOrientationEventListener(*this);
109 pSceneManager = SceneManager::GetInstance();
110 if (pSceneManager != null)
112 pSceneManager->AddSceneEventListener(IDSCN_HISTORY_LIST, *this);
115 if (pAppResource == null)
120 __pGroupedListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1"));
121 if (__pGroupedListView == null)
126 r = __pGroupedListView->SetItemProvider(*this);
133 __pSearchBar = static_cast< SearchBar* >(GetControl(L"IDC_SEARCHBAR1"));
134 if (__pSearchBar == null)
138 __pSearchListView = new(std::nothrow) GroupedListView();
139 if (__pSearchListView == null)
143 __pGroupedListView->AddGroupedListViewItemEventListener(*this);
144 r = __pGroupedListView->SetBounds(Rectangle(0,__pGroupedListView->GetY(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
149 r = __pSearchListView->Construct(Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height -__pSearchBar->GetHeight() - __pSearchBar->GetY()), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
154 r = __pSearchListView->SetItemProvider(*this);
159 r = __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND"));
166 __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK));
167 __pSearchListView->AddGroupedListViewItemEventListener(*this);
168 r = __pSearchListView->SetShowState(false);
175 __pSearchBar->AddSearchBarEventListener(*this);
176 __pSearchBar->AddKeypadEventListener(*this);
177 r = __pSearchBar->SetContent(__pSearchListView);
181 pHeader->SetStyle(HEADER_STYLE_TAB);
182 bookmark.Construct(IDA_TABBAR_ITEM_1);
184 pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark);
185 bookmark.SetText(strbookmark);
186 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARKS);
187 bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
188 bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
189 pHeader->AddItem(bookmark);
197 history.Construct(IDA_TABBAR_ITEM_2);
199 pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory);
200 history.SetText(strhistory);
201 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY);
202 history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
203 history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
204 pHeader->AddItem(history);
205 pHeader->SetItemSelected(1);
207 if (pIconBitmap != NULL)
217 HistoryListForm::OnTerminating(void)
219 result r = E_SUCCESS;
225 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
227 AppLog("HistoryListForm::OnActionPerformed");
228 result r = E_FAILURE;
229 SceneManager* pSceneManager = SceneManager::GetInstance();
230 if (pSceneManager == null)
236 case IDA_EDIT_HISTORY_LIST_FORM:
238 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
239 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
246 case IDA_TABBAR_ITEM_1:
248 result r = GetHeader()->SetItemSelected(1);
249 AppLog("SetItemSelected result %s",GetErrorMessage(r));
250 GetHeader()->Invalidate(true);
251 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
264 HistoryListForm::OnFormBackRequested(Form& source)
266 SceneManager* pSceneManager = SceneManager::GetInstance();
267 if (pSceneManager == null)
271 result r = pSceneManager->GoBackward(BackwardSceneTransition());
274 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
279 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
281 result r = E_FAILURE;
287 GroupItem* pItem = null;
288 GroupItemClass* pGroupItemClass = null;
290 String weeksAgo2 = L"";
291 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
293 String weeksAgo3 = L"";
294 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
296 String weeksAgo4 = L"";
297 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),4);
299 pItem = new(std::nothrow) GroupItem();
304 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
306 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
308 AppLog("CreateGroupItem :: if history is null");
309 r = pItem->Construct(Dimension(itemWidth, 0));
314 r = pItem->Construct(Dimension(itemWidth, 48));
316 text = pGroupItemClass->GetTitleText();
318 if (__searchHistory == false)
322 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
325 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
326 if ( pGregorianCalendar != NULL)
328 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
335 delete pGregorianCalendar;
338 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
345 delete pGregorianCalendar;
348 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
355 delete pGregorianCalendar;
358 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
360 delete pGregorianCalendar;
366 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
369 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
372 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
375 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
378 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
381 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
384 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
392 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
394 text.Append(pGroupItemClass->GetStartTime().GetDay());
396 strMonth = pGroupItemClass->GetStartTime().GetMonth();
397 month = GetMonth(strMonth);
407 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
408 || 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"))
411 text.Append(pGroupItemClass->GetEndTime().GetDay());
413 strMonth = pGroupItemClass->GetEndTime().GetMonth();
414 month = GetMonth(strMonth);
420 r = pItem->SetElement(text, null);
424 AppLogDebug("Failed with %s", GetErrorMessage(r));
427 r = pItem->SetTextSize(32);
438 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
440 AppLog("HistoryListForm::CreateItem");
441 result r = E_FAILURE;
442 History* pHistory = null;
443 Bitmap* pBitmap = null;
444 GroupItemClass* pGroupItemClass = null;
445 CustomItem* pItem = new(std::nothrow) CustomItem();
446 int bookmarkBtnWidth = 0;
447 Bitmap* pBookmarkBitmap = null;
450 if(__pGroupData == null)
460 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
461 if (pGroupItemClass == null)
466 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
467 if (pHistory == null)
472 r = pItem->Construct(Dimension(itemWidth, 128), LIST_ANNEX_STYLE_NORMAL);
479 bitmapId = pHistory->GetFaviconId() ;
481 pBitmap = pHistory->GetFavIconBitmap();
485 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
489 r = pItem->AddElement(Rectangle(16, 28, 72, 72), IDA_FORMAT_ICON, *pBitmap, null);
494 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
498 // if (pHistory->GetBookmarkId().GetLength()>0)
500 // pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
504 // pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
506 bookmarkBtnWidth = 64;
509 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);
510 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
512 if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
513 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);
515 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);
516 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
517 // if ( pBookmarkBitmap != null)
519 // r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
520 // TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
521 // delete pBookmarkBitmap;
527 delete pBookmarkBitmap;
532 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
541 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
543 AppLog("HistoryListForm::DeleteItem");
544 result r = E_FAILURE;
545 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
546 if (pGroupItemClass == null)
551 // if (pGroupItemClass->__pData != null)
553 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
566 HistoryListForm::GetGroupCount(void)
568 __isNoHistoryPresent = true;
570 if (__pGroupData != null)
572 if (__searchHistory == false)
575 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
580 return __pGroupData->GetCount();
585 // String searchText = __pSearchBar->GetText();
586 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
600 HistoryListForm::GetItemCount(int groupIndex)
602 result r = E_FAILURE;
608 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
609 if (pGroupItemClass == null)
613 if (__searchHistory == false)
615 startTime = pGroupItemClass->GetStartTime();
616 endTime = pGroupItemClass->GetEndTime();
617 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
621 //text = __pSearchBar->GetText();
622 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
633 ArrayList* pData = new(std::nothrow) ArrayList();
638 r = pData->Construct();
646 if (__searchHistory == false)
648 startTime = pGroupItemClass->GetStartTime();
649 endTime = pGroupItemClass->GetEndTime();
650 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
651 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
655 //text = __pSearchBar->GetText() ;
656 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
663 pGroupItemClass->SetHistoryData(pData);
666 if (__isNoHistoryPresent == true && count == 0)
668 __isNoHistoryPresent = true;
669 GetFooter()->SetItemEnabled(0, false);
673 __isNoHistoryPresent = false;
674 GetFooter()->SetItemEnabled(0, true);
676 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
677 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
684 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
685 return pGroupItemClass->GetHistoryData()->GetCount();
690 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
693 GetHeader()->SetItemSelected(1);
695 AppLog("HistoryListForm::OnSceneActivatedN called");
696 //GetHeader()->Invalidate(true);
697 if (__pGroupData == null)
699 __pGroupData = new(std::nothrow) ArrayList();
700 __pGroupData->Construct();
702 if (__pGroupedListView != null)
704 __pGroupedListView->UpdateList();
706 if (__isNoHistoryPresent == true)
708 GetFooter()->SetItemEnabled(0, false);
712 GetFooter()->SetItemEnabled(0, true);
716 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
719 __pSearchBar->SetShowState(false);
720 __pSearchBar->Invalidate(true);
724 __pSearchBar->SetShowState(true);
725 __pSearchBar->Invalidate(true);
728 // if (__isNoHistoryPresent == true)
730 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
731 // __pGroupedListView->UpdateList();
734 result r = GetHeader()->SetItemSelected(2);
737 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
746 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
748 AppLog("HistoryListForm::OnSceneDeactivated");
749 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
753 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
759 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
761 GroupItemClass* pGroupItemClass = null;
762 History* pHistory = null;
763 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
764 if (elementId == IDA_FORMAT_BOOKMARK)
766 String toggledUrl = L"";
767 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
768 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
769 if (pGroupItemClass == null)
773 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
774 if (pHistory == null)
778 toggledUrl = pHistory->GetHistoryUrl();
780 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
781 if (pHistory->GetBookmarkId().GetLength() > 0)
783 AppLog("Already added to bookmark so will be removed");
784 String bookmarkId = L"";
787 bookmarkId = pHistory->GetBookmarkId();
788 Integer::Parse(bookmarkId,id);
789 BookmarkPresentationModel::GetInstance()->DeleteBookmark(id);
790 pHistory->SetBookmarkId(L"");
791 //listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
793 for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
795 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
796 if (pGroupItemClass == null)
800 for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
802 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
803 if (pHistory == null)
807 if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
809 pHistory->SetBookmarkId(L"");
810 AppLog("Already added to bookmark so will be removed");
811 String bookmarkId = L"";
814 bookmarkId = pHistory->GetBookmarkId();
815 Integer::Parse(bookmarkId,id);
816 BookmarkPresentationModel::GetInstance()->DeleteBookmark(id);
817 pHistory->SetBookmarkId(L"");
818 //listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
820 for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
822 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
823 if (pGroupItemClass == null)
827 for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
829 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
830 if (pHistory == null)
834 if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
836 pHistory->SetBookmarkId(L"");
837 //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
842 //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
846 listView.UpdateList();
851 AppLog("Adding history to bookmark");
852 result r = E_FAILURE;
853 BookmarkData pBookmark;
855 String bookmarkTitle = pHistory->GetHistoryTitle();
857 pBookmark.SetBookmarkTitle(bookmarkTitle);
858 pBookmark.SetUrl(pHistory->GetHistoryUrl());
859 pBookmark.SetFaviconId(pHistory->GetFaviconId());
861 r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
864 AppLog("History added to bookmark with ID %ls",pBookmark.GetBookmarkId().GetPointer());
865 pHistory->SetBookmarkId(pBookmark.GetBookmarkId());
868 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
870 for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
872 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
873 if (pGroupItemClass == null)
877 for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
879 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
880 if (pHistory == null)
884 if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
886 pHistory->SetBookmarkId(pBookmark.GetBookmarkId());
887 //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
891 listView.UpdateList();
897 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
898 if (pGroupItemClass == null)
903 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
904 if (pHistory1 == null)
908 SceneManager* pSceneManager = SceneManager::GetInstance();
909 ArrayList *pArgList = null;
910 result r = E_SUCCESS;
911 pArgList = new(std::nothrow) ArrayList();
912 if (pArgList != null)
914 r = pArgList->Construct();
921 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
922 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
933 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
935 if (pSceneManager != null)
937 AppLog("pSceneManager exists");
938 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
941 pArgList->RemoveAll(false);
954 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
960 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
962 result r = E_FAILURE;
963 if (mode == SEARCH_BAR_MODE_NORMAL)
965 // __pSearchBar->SetMode(SEARCH_BAR_MODE_INPUT);
966 r = __pSearchListView->SetShowState(false);
971 r = __pGroupedListView->SetShowState(true);
976 __pSearchListView->SetEnabled(true);
978 __searchHistory = false;
979 r = __pGroupedListView->UpdateList();
980 if (__isNoHistoryPresent == true)
982 GetFooter()->SetItemEnabled(0, false);
986 GetFooter()->SetItemEnabled(0, true);
988 if(__pSearchBar != null)
990 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
999 // __pSearchListView->SetEnabled(false);
1000 r = __pSearchListView->SetShowState(true);
1005 __pSearchListView->SetEnabled(false);
1006 r = __pSearchListView->UpdateList();
1011 r = __pGroupedListView->SetShowState(false);
1016 if(__pSearchBar != null)
1018 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1024 HistoryListForm::GetMonth(int month)
1026 String monthValue = L"";
1030 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1033 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1036 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1039 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1042 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1045 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN"));
1048 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1051 monthValue.Append(CommonUtil::GetString(L"DS_COM_BODY_AUG"));
1054 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1057 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1060 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1063 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1074 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1076 result r = E_FAILURE;
1077 if (__pSearchBar != null)
1079 __pSearchBar->HideKeypad();
1082 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1084 __pSearchListView->SetEnabled(true);
1085 __searchHistory = true;
1086 __searchText =__pSearchBar->GetText();
1088 r = __pGroupedListView->SetShowState(false);
1093 r = __pSearchListView->SetShowState(true);
1098 r= __pSearchListView->UpdateList();
1099 if (__isNoHistoryPresent == true)
1101 GetFooter()->SetItemEnabled(0, false);
1105 GetFooter()->SetItemEnabled(0, true);
1107 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1116 __searchHistory = false;
1122 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1124 result r = E_FAILURE;
1125 if (__pGroupedListView != null)
1127 AppLog("groupedlistview bounds %d,%d,%d",GetClientAreaBounds().height,__pSearchBar->GetHeight(),__pSearchBar->GetY());
1128 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1129 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1130 else if(__pSearchBar != null)
1131 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1134 AppLog("Error in OnOrientationChanged SetBounds %s values %d,%d,%d,%d",GetErrorMessage(r),0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY());
1137 __pGroupedListView->UpdateList();
1139 if (__pSearchListView != null)
1141 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1147 __pSearchListView->UpdateList();
1149 if(__pSearchBar != null)
1150 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1155 if (__isNoHistoryPresent == true)
1157 GetFooter()->SetItemEnabled(0, false);
1161 GetFooter()->SetItemEnabled(0, true);
1166 HistoryListForm::OnKeypadWillOpen(Control& source)
1168 GetFooter()->SetShowState(false);
1169 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1170 __pSearchListView->SetEnabled(false);
1171 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1177 HistoryListForm::OnKeypadOpened(Control& source)
1179 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1183 HistoryListForm::OnKeypadClosed(Control& source)
1185 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1187 // __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
1188 __pSearchListView->SetEnabled(true);
1191 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1192 __pSearchListView->Invalidate(false);
1193 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1194 GetFooter()->SetShowState(true);
1199 HistoryListForm::CreateGroupItems()
1201 result r = E_FAILURE;
1202 DateTime currentTime;
1204 GroupItemClass* pGroupItemClass = null;
1207 String weeksAgo2 = L"";
1208 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
1210 String weeksAgo3 = L"";
1211 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1213 if (__pGroupData != null)
1215 __pGroupData->RemoveAll(false);
1216 delete __pGroupData;
1217 __pGroupData = null;
1219 __pGroupData = new(std::nothrow) ArrayList();
1220 if (__pGroupData == null)
1224 r = __pGroupData->Construct();
1227 delete __pGroupData;
1228 __pGroupData = null;
1231 if (__searchHistory == true)
1233 pGroupItemClass = new(std::nothrow) GroupItemClass();
1234 if (pGroupItemClass == null)
1238 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1239 pGroupItemClass->SetTitleText(titleText);
1240 r = __pGroupData->Add(*pGroupItemClass);
1248 Calendar* pGregorianCalendar = null;
1251 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1252 pGroupItemClass = new(std::nothrow) GroupItemClass();
1253 if (pGroupItemClass == null)
1257 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1258 pGroupItemClass->SetTitleText(titleText);
1259 pGroupItemClass->SetEndTime(currentTime);
1260 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1261 pGroupItemClass->SetStartTime(dateTime);
1262 __pGroupData->Add(*pGroupItemClass);
1265 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1266 if ( pGregorianCalendar != NULL )
1268 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1269 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1270 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1271 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1272 delete pGregorianCalendar;
1277 pGroupItemClass = new(std::nothrow) GroupItemClass();
1278 if (pGroupItemClass == null)
1282 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1283 pGroupItemClass->SetTitleText(titleText);
1284 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1285 pGroupItemClass->SetEndTime(dateTime);
1286 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1287 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1288 pGroupItemClass->SetStartTime(dateTime);
1289 __pGroupData->Add(*pGroupItemClass);
1292 pGroupItemClass = new(std::nothrow) GroupItemClass();
1293 if (pGroupItemClass == null)
1297 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1298 pGroupItemClass->SetTitleText(titleText);
1299 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1300 pGroupItemClass->SetEndTime(dateTime);
1301 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1302 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1303 pGroupItemClass->SetStartTime(dateTime);
1304 __pGroupData->Add(*pGroupItemClass);
1307 pGroupItemClass = new(std::nothrow) GroupItemClass();
1308 if (pGroupItemClass == null)
1312 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1313 pGroupItemClass->SetTitleText(titleText);
1314 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1315 pGroupItemClass->SetEndTime(dateTime);
1316 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1317 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1318 pGroupItemClass->SetStartTime(dateTime);
1319 __pGroupData->Add(*pGroupItemClass);
1321 pGroupItemClass = new(std::nothrow) GroupItemClass();
1322 if (pGroupItemClass == null)
1326 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1327 pGroupItemClass->SetTitleText(titleText);
1328 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1329 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1330 pGroupItemClass->SetEndTime(dateTime);
1331 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1332 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1333 pGroupItemClass->SetStartTime(dateTime);
1334 __pGroupData->Add(*pGroupItemClass);
1337 pGroupItemClass = new(std::nothrow) GroupItemClass();
1338 if (pGroupItemClass == null)
1342 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1343 pGroupItemClass->SetTitleText(titleText);
1344 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1345 pGroupItemClass->SetEndTime(dateTime);
1346 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1347 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1348 pGroupItemClass->SetStartTime(dateTime);
1349 __pGroupData->Add(*pGroupItemClass);
1351 pGroupItemClass = new(std::nothrow) GroupItemClass();
1352 if (pGroupItemClass == null)
1356 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1357 pGroupItemClass->SetTitleText(titleText);
1358 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1359 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1360 pGroupItemClass->SetEndTime(dateTime);
1361 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1362 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1363 pGroupItemClass->SetStartTime(dateTime);
1364 __pGroupData->Add(*pGroupItemClass);
1366 pGroupItemClass = new(std::nothrow) GroupItemClass();
1367 if (pGroupItemClass == null)
1371 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1372 pGroupItemClass->SetTitleText(titleText);
1373 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1374 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1375 pGroupItemClass->SetEndTime(dateTime);
1376 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1377 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1378 pGroupItemClass->SetStartTime(dateTime);
1379 __pGroupData->Add(*pGroupItemClass);
1382 pGroupItemClass = new(std::nothrow) GroupItemClass();
1383 if (pGroupItemClass == null)
1387 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1388 pGroupItemClass->SetTitleText(titleText);
1389 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1390 pGroupItemClass->SetEndTime(dateTime);
1391 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1392 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1393 pGroupItemClass->SetStartTime(dateTime);
1394 __pGroupData->Add(*pGroupItemClass);
1396 pGroupItemClass = new(std::nothrow) GroupItemClass();
1397 if (pGroupItemClass == null)
1401 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1402 pGroupItemClass->SetTitleText(titleText);
1403 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1404 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1405 pGroupItemClass->SetEndTime(dateTime);
1406 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1407 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1408 pGroupItemClass->SetStartTime(dateTime);
1409 __pGroupData->Add(*pGroupItemClass);
1411 pGroupItemClass = new(std::nothrow) GroupItemClass();
1412 if (pGroupItemClass == null)
1416 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1417 pGroupItemClass->SetTitleText(titleText);
1418 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1419 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1420 pGroupItemClass->SetEndTime(dateTime);
1421 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1422 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1423 pGroupItemClass->SetStartTime(dateTime);
1424 __pGroupData->Add(*pGroupItemClass);
1426 pGroupItemClass = new(std::nothrow) GroupItemClass();
1427 if (pGroupItemClass == null)
1431 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1432 pGroupItemClass->SetTitleText(titleText);
1433 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1434 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1435 pGroupItemClass->SetEndTime(dateTime);
1436 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1437 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1438 pGroupItemClass->SetStartTime(dateTime);
1439 __pGroupData->Add(*pGroupItemClass);
1442 pGroupItemClass = new(std::nothrow) GroupItemClass();
1443 if (pGroupItemClass == null)
1447 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1448 pGroupItemClass->SetTitleText(titleText);
1449 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1450 pGroupItemClass->SetEndTime(dateTime);
1451 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1452 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1453 pGroupItemClass->SetStartTime(dateTime);
1454 __pGroupData->Add(*pGroupItemClass);
1456 pGroupItemClass = new(std::nothrow) GroupItemClass();
1457 if (pGroupItemClass == null)
1461 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1462 pGroupItemClass->SetTitleText(titleText);
1463 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1464 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1465 pGroupItemClass->SetEndTime(dateTime);
1466 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1467 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1468 pGroupItemClass->SetStartTime(dateTime);
1469 __pGroupData->Add(*pGroupItemClass);
1471 pGroupItemClass = new(std::nothrow) GroupItemClass();
1472 if (pGroupItemClass == null)
1476 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1477 pGroupItemClass->SetTitleText(titleText);
1478 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1479 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1480 pGroupItemClass->SetEndTime(dateTime);
1481 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1482 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1483 pGroupItemClass->SetStartTime(dateTime);
1484 __pGroupData->Add(*pGroupItemClass);
1486 pGroupItemClass = new(std::nothrow) GroupItemClass();
1487 if (pGroupItemClass == null)
1491 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1492 pGroupItemClass->SetTitleText(titleText);
1493 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1494 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1495 pGroupItemClass->SetEndTime(dateTime);
1496 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1497 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1498 pGroupItemClass->SetStartTime(dateTime);
1499 __pGroupData->Add(*pGroupItemClass);
1501 pGroupItemClass = new(std::nothrow) GroupItemClass();
1502 if (pGroupItemClass == null)
1506 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1507 pGroupItemClass->SetTitleText(titleText);
1508 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1509 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1510 pGroupItemClass->SetEndTime(dateTime);
1511 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1512 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1513 pGroupItemClass->SetStartTime(dateTime);
1514 __pGroupData->Add(*pGroupItemClass);
1517 pGroupItemClass = new(std::nothrow) GroupItemClass();
1518 if (pGroupItemClass == null)
1522 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1523 pGroupItemClass->SetTitleText(titleText);
1524 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1525 pGroupItemClass->SetEndTime(dateTime);
1526 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1527 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1528 pGroupItemClass->SetStartTime(dateTime);
1529 __pGroupData->Add(*pGroupItemClass);
1531 pGroupItemClass = new(std::nothrow) GroupItemClass();
1532 if (pGroupItemClass == null)
1536 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1537 pGroupItemClass->SetTitleText(titleText);
1538 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1539 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1540 pGroupItemClass->SetEndTime(dateTime);
1541 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1542 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1543 pGroupItemClass->SetStartTime(dateTime);
1544 __pGroupData->Add(*pGroupItemClass);
1546 pGroupItemClass = new(std::nothrow) GroupItemClass();
1547 if (pGroupItemClass == null)
1551 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1552 pGroupItemClass->SetTitleText(titleText);
1553 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1554 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1555 pGroupItemClass->SetEndTime(dateTime);
1556 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1557 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1558 pGroupItemClass->SetStartTime(dateTime);
1559 __pGroupData->Add(*pGroupItemClass);
1561 pGroupItemClass = new(std::nothrow) GroupItemClass();
1562 if (pGroupItemClass == null)
1566 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1567 pGroupItemClass->SetTitleText(titleText);
1568 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1569 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1570 pGroupItemClass->SetEndTime(dateTime);
1571 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1572 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1573 pGroupItemClass->SetStartTime(dateTime);
1574 __pGroupData->Add(*pGroupItemClass);
1576 pGroupItemClass = new(std::nothrow) GroupItemClass();
1577 if (pGroupItemClass == null)
1581 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1582 pGroupItemClass->SetTitleText(titleText);
1583 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1584 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1585 pGroupItemClass->SetEndTime(dateTime);
1586 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1587 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1588 pGroupItemClass->SetStartTime(dateTime);
1589 __pGroupData->Add(*pGroupItemClass);
1591 pGroupItemClass = new(std::nothrow) GroupItemClass();
1592 if (pGroupItemClass == null)
1596 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1597 pGroupItemClass->SetTitleText(titleText);
1598 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1599 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1600 pGroupItemClass->SetEndTime(dateTime);
1601 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1602 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1603 pGroupItemClass->SetStartTime(dateTime);
1604 __pGroupData->Add(*pGroupItemClass);
1610 day = currentTime.GetDay();
1614 pGroupItemClass = new(std::nothrow) GroupItemClass();
1615 if (pGroupItemClass == null)
1620 pGroupItemClass->SetTitleText(weeksAgo2);
1621 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1622 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1623 pGroupItemClass->SetEndTime(dateTime);
1624 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1625 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1626 pGroupItemClass->SetStartTime(dateTime);
1627 __pGroupData->Add(*pGroupItemClass);
1629 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1631 pGroupItemClass = new(std::nothrow) GroupItemClass();
1632 if (pGroupItemClass == null)
1636 String weeksAgo3 = L"";
1637 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1638 pGroupItemClass->SetTitleText(weeksAgo3);
1639 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1640 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1641 pGroupItemClass->SetEndTime(dateTime);
1642 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1643 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1644 pGroupItemClass->SetStartTime(dateTime);
1645 __pGroupData->Add(*pGroupItemClass);
1649 pGroupItemClass = new(std::nothrow) GroupItemClass();
1650 if (pGroupItemClass == null)
1654 pGroupItemClass->SetTitleText(weeksAgo2);
1655 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1656 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1657 pGroupItemClass->SetEndTime(dateTime);
1658 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1659 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1660 pGroupItemClass->SetStartTime(dateTime);
1661 __pGroupData->Add(*pGroupItemClass);
1663 pGroupItemClass = new(std::nothrow) GroupItemClass();
1664 if (pGroupItemClass == null)
1669 pGroupItemClass->SetTitleText(weeksAgo3);
1670 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1671 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1672 pGroupItemClass->SetEndTime(dateTime);
1673 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1674 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1675 pGroupItemClass->SetStartTime(dateTime);
1676 __pGroupData->Add(*pGroupItemClass);
1678 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1680 pGroupItemClass = new(std::nothrow) GroupItemClass();
1681 if (pGroupItemClass == null)
1685 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1686 pGroupItemClass->SetTitleText(titleText);
1687 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1688 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1689 pGroupItemClass->SetEndTime(dateTime);
1690 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1691 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1692 pGroupItemClass->SetStartTime(dateTime);
1693 __pGroupData->Add(*pGroupItemClass);
1697 pGroupItemClass = new(std::nothrow) GroupItemClass();
1698 if (pGroupItemClass == null)
1702 pGroupItemClass->SetTitleText(weeksAgo2);
1703 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1704 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1705 pGroupItemClass->SetEndTime(dateTime);
1706 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1707 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1708 pGroupItemClass->SetStartTime(dateTime);
1709 __pGroupData->Add(*pGroupItemClass);
1711 pGroupItemClass = new(std::nothrow) GroupItemClass();
1712 if (pGroupItemClass == null)
1716 pGroupItemClass->SetTitleText(weeksAgo3);
1717 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1718 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1719 pGroupItemClass->SetEndTime(dateTime);
1720 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1721 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1722 pGroupItemClass->SetStartTime(dateTime);
1723 __pGroupData->Add(*pGroupItemClass);
1725 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1727 pGroupItemClass = new(std::nothrow) GroupItemClass();
1728 if (pGroupItemClass == null)
1732 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1733 pGroupItemClass->SetTitleText(titleText);
1734 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1735 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1736 pGroupItemClass->SetEndTime(dateTime);
1737 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1738 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1739 pGroupItemClass->SetStartTime(dateTime);
1740 __pGroupData->Add(*pGroupItemClass);
1746 pGroupItemClass = new(std::nothrow) GroupItemClass();
1747 if (pGroupItemClass == null)
1751 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1752 pGroupItemClass->SetTitleText(titleText);
1753 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1754 dateTime.AddDays(-1);
1755 pGroupItemClass->SetEndTime(dateTime);
1756 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1757 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1758 pGroupItemClass->SetStartTime(dateTime);
1759 __pGroupData->Add(*pGroupItemClass);
1761 pGroupItemClass = new(std::nothrow) GroupItemClass();
1762 if (pGroupItemClass == null)
1766 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1767 pGroupItemClass->SetTitleText(titleText);
1768 dateTime.SetValue(currentTime.GetYear(),1, 1);
1769 dateTime.AddMonths(currentTime.GetMonth() - 2);
1770 dateTime.AddDays(-1);
1771 pGroupItemClass->SetEndTime(dateTime);
1773 dateTime2.SetValue(0, 0, 0);
1774 pGroupItemClass->SetStartTime(dateTime2);
1775 __pGroupData->Add(*pGroupItemClass);
1779 GroupItemClass::GroupItemClass()
1785 GroupItemClass::operator =(const GroupItemClass& rhs)
1789 __pData = rhs.__pData;
1794 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1796 __pData = groupItem.__pData;
1799 GroupItemClass::~GroupItemClass()
1803 __pData->RemoveAll(true);
1809 GroupItemClass::SetStartTime(DateTime& startTime)
1811 __startTime = startTime;
1815 GroupItemClass::SetEndTime(DateTime& endTime)
1817 __endTime = endTime;
1821 GroupItemClass::SetTitleText(String& titleText)
1823 __titleText = titleText;
1827 GroupItemClass::SetHistoryData(ArrayList* pData)
1833 GroupItemClass::GetStartTime(void)
1839 GroupItemClass::GetEndTime(void)
1845 GroupItemClass::GetTitleText(void)
1851 GroupItemClass::GetHistoryData(void)