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;
71 HistoryListForm::~HistoryListForm(void)
73 if (__pGroupData != null)
75 __pGroupData->RemoveAll(true);
81 HistoryListForm::Initialize(void)
83 Construct(L"IDL_HISTORY_LIST");
89 HistoryListForm::OnInitializing(void)
91 AppLog("HistoryListForm::OnInitializing");
93 SceneManager* pSceneManager = null;
96 Header *pHeader = GetHeader();
97 Bitmap *pIconBitmap = null;
98 AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
99 const Color brown = Color(32, 32, 32, 0xFF);
101 // Setup back event listener
102 SetFormBackEventListener(this);
104 GetHeader()->AddActionEventListener(*this);
105 GetFooter()->AddActionEventListener(*this);
107 AddOrientationEventListener(*this);
108 pSceneManager = SceneManager::GetInstance();
109 if (pSceneManager != null)
111 pSceneManager->AddSceneEventListener(IDSCN_HISTORY_LIST, *this);
114 if (pAppResource == null)
119 __pGroupedListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1"));
120 if (__pGroupedListView == null)
124 r = __pGroupedListView->SetItemProvider(*this);
131 __pSearchBar = static_cast< SearchBar* >(GetControl(L"IDC_SEARCHBAR1"));
132 if (__pSearchBar == null)
136 __pSearchListView = new(std::nothrow) GroupedListView();
137 if (__pSearchListView == null)
141 __pGroupedListView->AddGroupedListViewItemEventListener(*this);
142 r = __pGroupedListView->SetBounds(Rectangle(0,__pGroupedListView->GetY(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
147 r = __pSearchListView->Construct(Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height -__pSearchBar->GetHeight() - __pSearchBar->GetY()), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
152 r = __pSearchListView->SetItemProvider(*this);
157 r = __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND"));
164 __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK));
165 __pSearchListView->AddGroupedListViewItemEventListener(*this);
166 r = __pSearchListView->SetShowState(false);
173 __pSearchBar->AddSearchBarEventListener(*this);
174 __pSearchBar->AddKeypadEventListener(*this);
175 r = __pSearchBar->SetContent(__pSearchListView);
179 pHeader->SetStyle(HEADER_STYLE_TAB);
180 bookmark.Construct(IDA_TABBAR_ITEM_1);
182 pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark);
183 bookmark.SetText(strbookmark);
184 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARKS);
185 bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
186 bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
187 pHeader->AddItem(bookmark);
195 history.Construct(IDA_TABBAR_ITEM_2);
197 pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory);
198 history.SetText(strhistory);
199 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY);
200 history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
201 history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
202 pHeader->AddItem(history);
203 pHeader->SetItemSelected(1);
205 if (pIconBitmap != NULL)
215 HistoryListForm::OnTerminating(void)
217 result r = E_SUCCESS;
223 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
225 AppLog("HistoryListForm::OnActionPerformed");
226 result r = E_FAILURE;
227 SceneManager* pSceneManager = SceneManager::GetInstance();
228 if (pSceneManager == null)
234 case IDA_EDIT_HISTORY_LIST_FORM:
236 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
237 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
244 case IDA_TABBAR_ITEM_1:
246 result r = GetHeader()->SetItemSelected(1);
247 AppLog("SetItemSelected result %s",GetErrorMessage(r));
248 GetHeader()->Invalidate(true);
249 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
262 HistoryListForm::OnFormBackRequested(Form& source)
264 SceneManager* pSceneManager = SceneManager::GetInstance();
265 if (pSceneManager == null)
269 result r = pSceneManager->GoBackward(BackwardSceneTransition());
272 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
277 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
279 result r = E_FAILURE;
285 GroupItem* pItem = null;
286 GroupItemClass* pGroupItemClass = null;
288 String weeksAgo2 = L"";
289 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
291 String weeksAgo3 = L"";
292 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
294 String weeksAgo4 = L"";
295 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),4);
297 pItem = new(std::nothrow) GroupItem();
302 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
304 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
306 AppLog("CreateGroupItem :: if history is null");
307 r = pItem->Construct(Dimension(itemWidth, 0));
312 r = pItem->Construct(Dimension(itemWidth, 48));
314 text = pGroupItemClass->GetTitleText();
316 if (__searchHistory == false)
320 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
323 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
324 if ( pGregorianCalendar != NULL)
326 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
333 delete pGregorianCalendar;
336 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
343 delete pGregorianCalendar;
346 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
353 delete pGregorianCalendar;
356 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
358 delete pGregorianCalendar;
364 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
367 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
370 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
373 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
376 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
379 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
382 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
390 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
392 text.Append(pGroupItemClass->GetStartTime().GetDay());
394 strMonth = pGroupItemClass->GetStartTime().GetMonth();
395 month = GetMonth(strMonth);
405 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
406 || 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"))
409 text.Append(pGroupItemClass->GetEndTime().GetDay());
411 strMonth = pGroupItemClass->GetEndTime().GetMonth();
412 month = GetMonth(strMonth);
418 r = pItem->SetElement(text, null);
422 AppLogDebug("Failed with %s", GetErrorMessage(r));
425 r = pItem->SetTextSize(32);
436 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
438 AppLog("HistoryListForm::CreateItem");
439 result r = E_FAILURE;
440 History* pHistory = null;
441 Bitmap* pBitmap = null;
442 GroupItemClass* pGroupItemClass = null;
443 CustomItem* pItem = new(std::nothrow) CustomItem();
444 int bookmarkBtnWidth = 0;
445 Bitmap* pBookmarkBitmap = null;
452 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
453 if (pGroupItemClass == null)
458 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
459 if (pHistory == null)
464 r = pItem->Construct(Dimension(itemWidth, 128), LIST_ANNEX_STYLE_NORMAL);
471 bitmapId = pHistory->GetFaviconId() ;
473 pBitmap = FaviconManager::GetInstance()->GetFaviconN(bitmapId);
477 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
481 r = pItem->AddElement(Rectangle(16, 28, 72, 72), IDA_FORMAT_ICON, *pBitmap, null);
486 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
490 if (pHistory->GetBookmarkId().GetLength()>0)
492 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
496 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
498 bookmarkBtnWidth = 64;
501 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);
502 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
504 if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
505 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);
507 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);
508 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
509 if ( pBookmarkBitmap != null)
511 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
512 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
513 delete pBookmarkBitmap;
519 delete pBookmarkBitmap;
524 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
533 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
535 AppLog("HistoryListForm::DeleteItem");
536 result r = E_FAILURE;
537 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
538 if (pGroupItemClass == null)
543 // if (pGroupItemClass->__pData != null)
545 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
558 HistoryListForm::GetGroupCount(void)
560 __isNoHistoryPresent = true;
562 if (__pGroupData != null)
564 if (__searchHistory == false)
567 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
572 return __pGroupData->GetCount();
577 String searchText = __pSearchBar->GetText();
578 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, searchText);
592 HistoryListForm::GetItemCount(int groupIndex)
594 result r = E_FAILURE;
600 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
601 if (pGroupItemClass == null)
605 if (__searchHistory == false)
607 startTime = pGroupItemClass->GetStartTime();
608 endTime = pGroupItemClass->GetEndTime();
609 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
613 text = __pSearchBar->GetText();
614 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,text);
625 ArrayList* pData = new(std::nothrow) ArrayList();
630 r = pData->Construct();
638 if (__searchHistory == false)
640 startTime = pGroupItemClass->GetStartTime();
641 endTime = pGroupItemClass->GetEndTime();
642 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
643 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
647 text = __pSearchBar->GetText() ;
648 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,text );
655 pGroupItemClass->SetHistoryData(pData);
658 if (__isNoHistoryPresent == true && count == 0)
660 __isNoHistoryPresent = true;
661 GetFooter()->SetItemEnabled(0, false);
665 __isNoHistoryPresent = false;
666 GetFooter()->SetItemEnabled(0, true);
668 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
669 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
676 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
677 return pGroupItemClass->GetHistoryData()->GetCount();
682 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
685 GetHeader()->SetItemSelected(1);
687 AppLog("HistoryListForm::OnSceneActivatedN called");
688 //GetHeader()->Invalidate(true);
689 if (__pGroupData == null)
691 __pGroupData = new(std::nothrow) ArrayList();
692 __pGroupData->Construct();
694 if (__pGroupedListView != null)
696 __pGroupedListView->UpdateList();
697 __pGroupedListView->Invalidate(true);
699 if (__isNoHistoryPresent == true)
701 GetFooter()->SetItemEnabled(0, false);
705 GetFooter()->SetItemEnabled(0, true);
709 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
712 __pSearchBar->SetShowState(false);
713 __pSearchBar->Invalidate(true);
717 __pSearchBar->SetShowState(true);
718 __pSearchBar->Invalidate(true);
721 // if (__isNoHistoryPresent == true)
723 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
724 // __pGroupedListView->UpdateList();
727 result r = GetHeader()->SetItemSelected(2);
730 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
739 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
741 AppLog("HistoryListForm::OnSceneDeactivated");
742 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
746 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
752 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
754 GroupItemClass* pGroupItemClass = null;
755 History* pHistory = null;
756 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
757 if (elementId == IDA_FORMAT_BOOKMARK)
759 String toggledUrl = L"";
760 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
761 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
762 if (pGroupItemClass == null)
766 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
767 if (pHistory == null)
771 toggledUrl = pHistory->GetHistoryUrl();
773 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
774 if (pHistory->GetBookmarkId().GetLength() > 0)
776 AppLog("Already added to bookmark so will be removed");
777 String bookmarkId = L"";
780 bookmarkId = pHistory->GetBookmarkId();
781 Integer::Parse(bookmarkId,id);
782 BookmarkPresentationModel::GetInstance()->DeleteBookmark(id);
783 pHistory->SetBookmarkId(L"");
784 //listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
786 for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
788 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
789 if (pGroupItemClass == null)
793 for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
795 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
796 if (pHistory == null)
800 if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
802 pHistory->SetBookmarkId(L"");
803 AppLog("Already added to bookmark so will be removed");
804 String bookmarkId = L"";
807 bookmarkId = pHistory->GetBookmarkId();
808 Integer::Parse(bookmarkId,id);
809 BookmarkPresentationModel::GetInstance()->DeleteBookmark(id);
810 pHistory->SetBookmarkId(L"");
811 //listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
813 for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
815 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
816 if (pGroupItemClass == null)
820 for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
822 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
823 if (pHistory == null)
827 if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
829 pHistory->SetBookmarkId(L"");
830 //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
835 //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
839 listView.UpdateList();
844 AppLog("Adding history to bookmark");
845 result r = E_FAILURE;
846 BookmarkData pBookmark;
848 String bookmarkTitle = pHistory->GetHistoryTitle();
850 pBookmark.SetBookmarkTitle(bookmarkTitle);
851 pBookmark.SetUrl(pHistory->GetHistoryUrl());
852 pBookmark.SetFaviconId(pHistory->GetFaviconId());
854 r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
857 AppLog("History added to bookmark with ID %ls",pBookmark.GetBookmarkId().GetPointer());
858 pHistory->SetBookmarkId(pBookmark.GetBookmarkId());
861 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
863 for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
865 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
866 if (pGroupItemClass == null)
870 for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
872 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
873 if (pHistory == null)
877 if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
879 pHistory->SetBookmarkId(pBookmark.GetBookmarkId());
880 //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
884 listView.UpdateList();
890 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
891 if (pGroupItemClass == null)
896 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
897 if (pHistory1 == null)
901 SceneManager* pSceneManager = SceneManager::GetInstance();
902 ArrayList *pArgList = null;
903 result r = E_SUCCESS;
904 pArgList = new(std::nothrow) ArrayList();
905 if (pArgList != null)
907 r = pArgList->Construct();
914 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
915 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
926 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
928 if (pSceneManager != null)
930 AppLog("pSceneManager exists");
931 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
934 pArgList->RemoveAll(false);
947 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
953 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
955 result r = E_FAILURE;
956 if (mode == SEARCH_BAR_MODE_NORMAL)
958 // __pSearchBar->SetMode(SEARCH_BAR_MODE_INPUT);
959 r = __pSearchListView->SetShowState(false);
964 r = __pGroupedListView->SetShowState(true);
969 __pSearchListView->SetEnabled(true);
970 GetFooter()->SetShowState(true);
972 __searchHistory = false;
973 r = __pGroupedListView->UpdateList();
974 if (__isNoHistoryPresent == true)
976 GetFooter()->SetItemEnabled(0, false);
980 GetFooter()->SetItemEnabled(0, true);
990 // __pSearchListView->SetEnabled(false);
991 r = __pSearchListView->SetShowState(true);
996 __pSearchListView->SetEnabled(false);
997 r = __pSearchListView->UpdateList();
1002 r = __pGroupedListView->SetShowState(false);
1007 if(__pSearchBar != null)
1009 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1011 Footer* pFooter = GetFooter();
1012 pFooter->SetShowState(false);
1017 HistoryListForm::GetMonth(int month)
1019 String monthValue = L"";
1023 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1026 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1029 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1032 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1035 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1038 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN"));
1041 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1044 monthValue.Append(CommonUtil::GetString(L"DS_COM_BODY_AUG"));
1047 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1050 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1053 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1056 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1067 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1069 result r = E_FAILURE;
1070 if (__pSearchBar != null)
1072 __pSearchBar->HideKeypad();
1075 if (keypadAction == KEYPAD_ACTION_SEARCH)
1077 __pSearchListView->SetEnabled(true);
1078 __searchHistory = true;
1079 r = __pGroupedListView->SetShowState(false);
1084 r = __pSearchListView->SetShowState(true);
1089 r= __pSearchListView->UpdateList();
1090 if (__isNoHistoryPresent == true)
1092 GetFooter()->SetItemEnabled(0, false);
1096 GetFooter()->SetItemEnabled(0, true);
1105 __searchHistory = false;
1111 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1113 result r = E_FAILURE;
1114 if (__pGroupedListView != null)
1116 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1117 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1118 else if(__pSearchBar != null)
1119 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1124 __pGroupedListView->UpdateList();
1126 if (__pSearchListView != null)
1128 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1134 if ( __searchHistory == false)
1136 __pSearchListView->UpdateList();
1139 if(__pSearchBar != null)
1140 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1145 if (__isNoHistoryPresent == true)
1147 GetFooter()->SetItemEnabled(0, false);
1151 GetFooter()->SetItemEnabled(0, true);
1156 HistoryListForm::OnKeypadWillOpen(Control& source)
1158 GetFooter()->SetShowState(false);
1159 __pSearchListView->SetEnabled(false);
1163 HistoryListForm::OnKeypadOpened(Control& source)
1169 HistoryListForm::OnKeypadClosed(Control& source)
1171 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1173 // __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
1174 __pSearchListView->SetEnabled(true);
1176 GetFooter()->SetShowState(true);
1181 HistoryListForm::CreateGroupItems()
1183 result r = E_FAILURE;
1184 DateTime currentTime;
1186 GroupItemClass* pGroupItemClass = null;
1189 String weeksAgo2 = L"";
1190 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
1192 String weeksAgo3 = L"";
1193 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1195 if (__pGroupData != null)
1197 __pGroupData->RemoveAll(true);
1198 delete __pGroupData;
1199 __pGroupData = null;
1201 __pGroupData = new(std::nothrow) ArrayList();
1202 if (__pGroupData == null)
1206 r = __pGroupData->Construct();
1209 delete __pGroupData;
1210 __pGroupData = null;
1213 if (__searchHistory == true)
1215 pGroupItemClass = new(std::nothrow) GroupItemClass();
1216 if (pGroupItemClass == null)
1220 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1221 pGroupItemClass->SetTitleText(titleText);
1222 r = __pGroupData->Add(*pGroupItemClass);
1230 Calendar* pGregorianCalendar = null;
1233 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1234 pGroupItemClass = new(std::nothrow) GroupItemClass();
1235 if (pGroupItemClass == null)
1239 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1240 pGroupItemClass->SetTitleText(titleText);
1241 pGroupItemClass->SetEndTime(currentTime);
1242 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1243 pGroupItemClass->SetStartTime(dateTime);
1244 __pGroupData->Add(*pGroupItemClass);
1247 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1248 if ( pGregorianCalendar != NULL )
1250 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1251 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1252 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1253 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1254 delete pGregorianCalendar;
1259 pGroupItemClass = new(std::nothrow) GroupItemClass();
1260 if (pGroupItemClass == null)
1264 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1265 pGroupItemClass->SetTitleText(titleText);
1266 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1267 pGroupItemClass->SetEndTime(dateTime);
1268 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1269 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1270 pGroupItemClass->SetStartTime(dateTime);
1271 __pGroupData->Add(*pGroupItemClass);
1274 pGroupItemClass = new(std::nothrow) GroupItemClass();
1275 if (pGroupItemClass == null)
1279 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1280 pGroupItemClass->SetTitleText(titleText);
1281 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1282 pGroupItemClass->SetEndTime(dateTime);
1283 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1284 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1285 pGroupItemClass->SetStartTime(dateTime);
1286 __pGroupData->Add(*pGroupItemClass);
1289 pGroupItemClass = new(std::nothrow) GroupItemClass();
1290 if (pGroupItemClass == null)
1294 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1295 pGroupItemClass->SetTitleText(titleText);
1296 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1297 pGroupItemClass->SetEndTime(dateTime);
1298 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1299 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1300 pGroupItemClass->SetStartTime(dateTime);
1301 __pGroupData->Add(*pGroupItemClass);
1303 pGroupItemClass = new(std::nothrow) GroupItemClass();
1304 if (pGroupItemClass == null)
1308 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1309 pGroupItemClass->SetTitleText(titleText);
1310 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1311 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1312 pGroupItemClass->SetEndTime(dateTime);
1313 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1314 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1315 pGroupItemClass->SetStartTime(dateTime);
1316 __pGroupData->Add(*pGroupItemClass);
1319 pGroupItemClass = new(std::nothrow) GroupItemClass();
1320 if (pGroupItemClass == null)
1324 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1325 pGroupItemClass->SetTitleText(titleText);
1326 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1327 pGroupItemClass->SetEndTime(dateTime);
1328 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1329 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1330 pGroupItemClass->SetStartTime(dateTime);
1331 __pGroupData->Add(*pGroupItemClass);
1333 pGroupItemClass = new(std::nothrow) GroupItemClass();
1334 if (pGroupItemClass == null)
1338 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1339 pGroupItemClass->SetTitleText(titleText);
1340 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1341 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1342 pGroupItemClass->SetEndTime(dateTime);
1343 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1344 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1345 pGroupItemClass->SetStartTime(dateTime);
1346 __pGroupData->Add(*pGroupItemClass);
1348 pGroupItemClass = new(std::nothrow) GroupItemClass();
1349 if (pGroupItemClass == null)
1353 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1354 pGroupItemClass->SetTitleText(titleText);
1355 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1356 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1357 pGroupItemClass->SetEndTime(dateTime);
1358 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1359 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1360 pGroupItemClass->SetStartTime(dateTime);
1361 __pGroupData->Add(*pGroupItemClass);
1364 pGroupItemClass = new(std::nothrow) GroupItemClass();
1365 if (pGroupItemClass == null)
1369 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1370 pGroupItemClass->SetTitleText(titleText);
1371 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1372 pGroupItemClass->SetEndTime(dateTime);
1373 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1374 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1375 pGroupItemClass->SetStartTime(dateTime);
1376 __pGroupData->Add(*pGroupItemClass);
1378 pGroupItemClass = new(std::nothrow) GroupItemClass();
1379 if (pGroupItemClass == null)
1383 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1384 pGroupItemClass->SetTitleText(titleText);
1385 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1386 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1387 pGroupItemClass->SetEndTime(dateTime);
1388 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1389 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1390 pGroupItemClass->SetStartTime(dateTime);
1391 __pGroupData->Add(*pGroupItemClass);
1393 pGroupItemClass = new(std::nothrow) GroupItemClass();
1394 if (pGroupItemClass == null)
1398 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1399 pGroupItemClass->SetTitleText(titleText);
1400 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1401 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1402 pGroupItemClass->SetEndTime(dateTime);
1403 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1404 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1405 pGroupItemClass->SetStartTime(dateTime);
1406 __pGroupData->Add(*pGroupItemClass);
1408 pGroupItemClass = new(std::nothrow) GroupItemClass();
1409 if (pGroupItemClass == null)
1413 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1414 pGroupItemClass->SetTitleText(titleText);
1415 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1416 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1417 pGroupItemClass->SetEndTime(dateTime);
1418 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1419 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1420 pGroupItemClass->SetStartTime(dateTime);
1421 __pGroupData->Add(*pGroupItemClass);
1424 pGroupItemClass = new(std::nothrow) GroupItemClass();
1425 if (pGroupItemClass == null)
1429 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1430 pGroupItemClass->SetTitleText(titleText);
1431 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1432 pGroupItemClass->SetEndTime(dateTime);
1433 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1434 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1435 pGroupItemClass->SetStartTime(dateTime);
1436 __pGroupData->Add(*pGroupItemClass);
1438 pGroupItemClass = new(std::nothrow) GroupItemClass();
1439 if (pGroupItemClass == null)
1443 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1444 pGroupItemClass->SetTitleText(titleText);
1445 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1446 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1447 pGroupItemClass->SetEndTime(dateTime);
1448 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1449 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1450 pGroupItemClass->SetStartTime(dateTime);
1451 __pGroupData->Add(*pGroupItemClass);
1453 pGroupItemClass = new(std::nothrow) GroupItemClass();
1454 if (pGroupItemClass == null)
1458 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1459 pGroupItemClass->SetTitleText(titleText);
1460 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1461 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1462 pGroupItemClass->SetEndTime(dateTime);
1463 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1464 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1465 pGroupItemClass->SetStartTime(dateTime);
1466 __pGroupData->Add(*pGroupItemClass);
1468 pGroupItemClass = new(std::nothrow) GroupItemClass();
1469 if (pGroupItemClass == null)
1473 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1474 pGroupItemClass->SetTitleText(titleText);
1475 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1476 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1477 pGroupItemClass->SetEndTime(dateTime);
1478 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1479 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1480 pGroupItemClass->SetStartTime(dateTime);
1481 __pGroupData->Add(*pGroupItemClass);
1483 pGroupItemClass = new(std::nothrow) GroupItemClass();
1484 if (pGroupItemClass == null)
1488 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1489 pGroupItemClass->SetTitleText(titleText);
1490 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1491 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1492 pGroupItemClass->SetEndTime(dateTime);
1493 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1494 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1495 pGroupItemClass->SetStartTime(dateTime);
1496 __pGroupData->Add(*pGroupItemClass);
1499 pGroupItemClass = new(std::nothrow) GroupItemClass();
1500 if (pGroupItemClass == null)
1504 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1505 pGroupItemClass->SetTitleText(titleText);
1506 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1507 pGroupItemClass->SetEndTime(dateTime);
1508 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1509 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1510 pGroupItemClass->SetStartTime(dateTime);
1511 __pGroupData->Add(*pGroupItemClass);
1513 pGroupItemClass = new(std::nothrow) GroupItemClass();
1514 if (pGroupItemClass == null)
1518 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1519 pGroupItemClass->SetTitleText(titleText);
1520 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1521 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1522 pGroupItemClass->SetEndTime(dateTime);
1523 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1524 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1525 pGroupItemClass->SetStartTime(dateTime);
1526 __pGroupData->Add(*pGroupItemClass);
1528 pGroupItemClass = new(std::nothrow) GroupItemClass();
1529 if (pGroupItemClass == null)
1533 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1534 pGroupItemClass->SetTitleText(titleText);
1535 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1536 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1537 pGroupItemClass->SetEndTime(dateTime);
1538 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1539 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1540 pGroupItemClass->SetStartTime(dateTime);
1541 __pGroupData->Add(*pGroupItemClass);
1543 pGroupItemClass = new(std::nothrow) GroupItemClass();
1544 if (pGroupItemClass == null)
1548 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1549 pGroupItemClass->SetTitleText(titleText);
1550 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1551 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1552 pGroupItemClass->SetEndTime(dateTime);
1553 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1554 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1555 pGroupItemClass->SetStartTime(dateTime);
1556 __pGroupData->Add(*pGroupItemClass);
1558 pGroupItemClass = new(std::nothrow) GroupItemClass();
1559 if (pGroupItemClass == null)
1563 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1564 pGroupItemClass->SetTitleText(titleText);
1565 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1566 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1567 pGroupItemClass->SetEndTime(dateTime);
1568 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1569 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1570 pGroupItemClass->SetStartTime(dateTime);
1571 __pGroupData->Add(*pGroupItemClass);
1573 pGroupItemClass = new(std::nothrow) GroupItemClass();
1574 if (pGroupItemClass == null)
1578 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1579 pGroupItemClass->SetTitleText(titleText);
1580 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1581 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1582 pGroupItemClass->SetEndTime(dateTime);
1583 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1584 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1585 pGroupItemClass->SetStartTime(dateTime);
1586 __pGroupData->Add(*pGroupItemClass);
1592 day = currentTime.GetDay();
1596 pGroupItemClass = new(std::nothrow) GroupItemClass();
1597 if (pGroupItemClass == null)
1602 pGroupItemClass->SetTitleText(weeksAgo2);
1603 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1604 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1605 pGroupItemClass->SetEndTime(dateTime);
1606 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1607 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1608 pGroupItemClass->SetStartTime(dateTime);
1609 __pGroupData->Add(*pGroupItemClass);
1611 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1613 pGroupItemClass = new(std::nothrow) GroupItemClass();
1614 if (pGroupItemClass == null)
1618 String weeksAgo3 = L"";
1619 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1620 pGroupItemClass->SetTitleText(weeksAgo3);
1621 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1622 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1623 pGroupItemClass->SetEndTime(dateTime);
1624 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1625 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1626 pGroupItemClass->SetStartTime(dateTime);
1627 __pGroupData->Add(*pGroupItemClass);
1631 pGroupItemClass = new(std::nothrow) GroupItemClass();
1632 if (pGroupItemClass == null)
1636 pGroupItemClass->SetTitleText(weeksAgo2);
1637 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1638 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1639 pGroupItemClass->SetEndTime(dateTime);
1640 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1641 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1642 pGroupItemClass->SetStartTime(dateTime);
1643 __pGroupData->Add(*pGroupItemClass);
1645 pGroupItemClass = new(std::nothrow) GroupItemClass();
1646 if (pGroupItemClass == null)
1651 pGroupItemClass->SetTitleText(weeksAgo3);
1652 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1653 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1654 pGroupItemClass->SetEndTime(dateTime);
1655 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1656 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1657 pGroupItemClass->SetStartTime(dateTime);
1658 __pGroupData->Add(*pGroupItemClass);
1660 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1662 pGroupItemClass = new(std::nothrow) GroupItemClass();
1663 if (pGroupItemClass == null)
1667 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1668 pGroupItemClass->SetTitleText(titleText);
1669 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1670 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1671 pGroupItemClass->SetEndTime(dateTime);
1672 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1673 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1674 pGroupItemClass->SetStartTime(dateTime);
1675 __pGroupData->Add(*pGroupItemClass);
1679 pGroupItemClass = new(std::nothrow) GroupItemClass();
1680 if (pGroupItemClass == null)
1684 pGroupItemClass->SetTitleText(weeksAgo2);
1685 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1686 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1687 pGroupItemClass->SetEndTime(dateTime);
1688 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1689 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1690 pGroupItemClass->SetStartTime(dateTime);
1691 __pGroupData->Add(*pGroupItemClass);
1693 pGroupItemClass = new(std::nothrow) GroupItemClass();
1694 if (pGroupItemClass == null)
1698 pGroupItemClass->SetTitleText(weeksAgo3);
1699 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1700 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1701 pGroupItemClass->SetEndTime(dateTime);
1702 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1703 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1704 pGroupItemClass->SetStartTime(dateTime);
1705 __pGroupData->Add(*pGroupItemClass);
1707 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1709 pGroupItemClass = new(std::nothrow) GroupItemClass();
1710 if (pGroupItemClass == null)
1714 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1715 pGroupItemClass->SetTitleText(titleText);
1716 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1717 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1718 pGroupItemClass->SetEndTime(dateTime);
1719 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1720 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1721 pGroupItemClass->SetStartTime(dateTime);
1722 __pGroupData->Add(*pGroupItemClass);
1728 pGroupItemClass = new(std::nothrow) GroupItemClass();
1729 if (pGroupItemClass == null)
1733 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1734 pGroupItemClass->SetTitleText(titleText);
1735 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1736 dateTime.AddDays(-1);
1737 pGroupItemClass->SetEndTime(dateTime);
1738 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1739 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1740 pGroupItemClass->SetStartTime(dateTime);
1741 __pGroupData->Add(*pGroupItemClass);
1743 pGroupItemClass = new(std::nothrow) GroupItemClass();
1744 if (pGroupItemClass == null)
1748 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1749 pGroupItemClass->SetTitleText(titleText);
1750 dateTime.SetValue(currentTime.GetYear(),1, 1);
1751 dateTime.AddMonths(currentTime.GetMonth() - 2);
1752 dateTime.AddDays(-1);
1753 pGroupItemClass->SetEndTime(dateTime);
1755 dateTime2.SetValue(0, 0, 0);
1756 pGroupItemClass->SetStartTime(dateTime2);
1757 __pGroupData->Add(*pGroupItemClass);
1761 GroupItemClass::GroupItemClass()
1767 GroupItemClass::operator =(const GroupItemClass& rhs)
1771 __pData = rhs.__pData;
1776 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1778 __pData = groupItem.__pData;
1781 GroupItemClass::~GroupItemClass()
1785 __pData->RemoveAll(true);
1791 GroupItemClass::SetStartTime(DateTime& startTime)
1793 __startTime = startTime;
1797 GroupItemClass::SetEndTime(DateTime& endTime)
1799 __endTime = endTime;
1803 GroupItemClass::SetTitleText(String& titleText)
1805 __titleText = titleText;
1809 GroupItemClass::SetHistoryData(ArrayList* pData)
1815 GroupItemClass::GetStartTime(void)
1821 GroupItemClass::GetEndTime(void)
1827 GroupItemClass::GetTitleText(void)
1833 GroupItemClass::GetHistoryData(void)