2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 //!Internet HistoryListForm class
18 /*@file: HistoryListForm.cpp
19 *@brief: This class defines HistoryListForm used define history
25 #include "IntBookmarkData.h"
26 #include "IntBookmarkPresentationModel.h"
27 #include "IntCommonLib.h"
28 #include "IntFaviconManager.h"
29 #include "IntHistoryListForm.h"
30 #include "IntHistoryPresentationModel.h"
31 #include "IntMultipleWindowPresentationModel.h"
32 #include "IntSceneRegister.h"
35 using namespace Tizen::App;
36 using namespace Tizen::Base;
37 using namespace Tizen::Base::Collection;
38 using namespace Tizen::Base::Runtime;
39 using namespace Tizen::Graphics;
40 using namespace Tizen::Locales;
41 using namespace Tizen::Ui;
42 using namespace Tizen::Ui::Controls;
43 using namespace Tizen::Ui::Scenes;
45 static const wchar_t* IDB_TAB_ICON_BOOKMARKS = L"I01_tab_icon_bookmarks.png";
46 static const wchar_t* IDB_TAB_ICON_HISTORY = L"I01_tab_icon_history.png";
47 static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png";
48 static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png";
51 const int HistoryListForm::IDA_TABBAR_ITEM_1 = 101;
52 const int HistoryListForm::IDA_TABBAR_ITEM_2 = 102;
53 const int HistoryListForm::IDA_EDIT_HISTORY_LIST_FORM = 103;
54 const int HistoryListForm::IDA_FORMAT_ICON = 104;
55 const int HistoryListForm::IDA_FORMAT_TITLE = 105;
56 const int HistoryListForm::IDA_FORMAT_URL = 106;
57 const int HistoryListForm::IDA_FORMAT_BOOKMARK = 107;
60 HistoryListForm::HistoryListForm(void)
62 __pGroupedListView =null;
63 __pSearchListView = null;
66 __pSearchedData = null ;
67 __searchHistory = false;
68 __isNoHistoryPresent = true;
70 __previousSceneId = L"";
73 HistoryListForm::~HistoryListForm(void)
75 if (__pGroupData != null)
77 __pGroupData->RemoveAll(false);
83 HistoryListForm::Initialize(void)
85 Construct(L"IDL_HISTORY_LIST");
91 HistoryListForm::OnInitializing(void)
93 AppLog("HistoryListForm::OnInitializing");
95 SceneManager* pSceneManager = null;
98 Header *pHeader = GetHeader();
99 Bitmap *pIconBitmap = null;
100 AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
101 const Color brown = Color(32, 32, 32, 0xFF);
103 // Setup back event listener
104 SetFormBackEventListener(this);
106 GetHeader()->AddActionEventListener(*this);
107 GetFooter()->AddActionEventListener(*this);
109 AddOrientationEventListener(*this);
110 pSceneManager = SceneManager::GetInstance();
111 if (pSceneManager != null)
113 pSceneManager->AddSceneEventListener(IDSCN_HISTORY_LIST, *this);
116 if (pAppResource == null)
121 __pGroupedListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1"));
122 if (__pGroupedListView == null)
127 r = __pGroupedListView->SetItemProvider(*this);
134 __pSearchBar = static_cast< SearchBar* >(GetControl(L"IDC_SEARCHBAR1"));
135 if (__pSearchBar == null)
139 __pSearchListView = new(std::nothrow) GroupedListView();
140 if (__pSearchListView == null)
144 __pGroupedListView->AddGroupedListViewItemEventListener(*this);
145 r = __pGroupedListView->SetBounds(Rectangle(0,__pGroupedListView->GetY(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
150 r = __pSearchListView->Construct(Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height -__pSearchBar->GetHeight() - __pSearchBar->GetY()), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
155 r = __pSearchListView->SetItemProvider(*this);
160 r = __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND"));
167 __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK));
168 __pSearchListView->AddGroupedListViewItemEventListener(*this);
169 r = __pSearchListView->SetShowState(false);
176 __pSearchBar->AddSearchBarEventListener(*this);
177 __pSearchBar->AddKeypadEventListener(*this);
178 r = __pSearchBar->SetContent(__pSearchListView);
182 pHeader->SetStyle(HEADER_STYLE_TAB);
183 bookmark.Construct(IDA_TABBAR_ITEM_1);
185 pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark);
186 bookmark.SetText(strbookmark);
187 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARKS);
188 bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
189 bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
190 pHeader->AddItem(bookmark);
198 history.Construct(IDA_TABBAR_ITEM_2);
200 pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory);
201 history.SetText(strhistory);
202 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY);
203 history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
204 history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
205 pHeader->AddItem(history);
206 pHeader->SetItemSelected(1);
208 if (pIconBitmap != NULL)
218 HistoryListForm::OnTerminating(void)
220 result r = E_SUCCESS;
226 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
228 AppLog("HistoryListForm::OnActionPerformed");
229 result r = E_FAILURE;
230 SceneManager* pSceneManager = SceneManager::GetInstance();
231 if (pSceneManager == null)
237 case IDA_EDIT_HISTORY_LIST_FORM:
239 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
240 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
247 case IDA_TABBAR_ITEM_1:
249 result r = GetHeader()->SetItemSelected(1);
250 AppLog("SetItemSelected result %s",GetErrorMessage(r));
251 GetHeader()->Invalidate(true);
253 if (pSceneManager != null)
255 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
257 if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)) != E_SUCCESS)
259 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
266 if(pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT))!= E_SUCCESS)
268 AppLogDebug("BookmarkListForm::OnActionPerformed GoBackward failed");
278 // r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
291 HistoryListForm::OnFormBackRequested(Form& source)
293 SceneManager* pSceneManager = SceneManager::GetInstance();
294 if (pSceneManager == null)
298 result r = E_FAILURE;
299 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
301 r = pSceneManager->GoBackward(BackwardSceneTransition());
305 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
309 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
314 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
316 result r = E_FAILURE;
322 GroupItem* pItem = null;
323 GroupItemClass* pGroupItemClass = null;
325 String weeksAgo2 = L"";
326 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
328 String weeksAgo3 = L"";
329 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
331 String weeksAgo4 = L"";
332 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),4);
334 pItem = new(std::nothrow) GroupItem();
339 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
341 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
343 AppLog("CreateGroupItem :: if history is null");
344 r = pItem->Construct(Dimension(itemWidth, 0));
349 r = pItem->Construct(Dimension(itemWidth, 48));
351 text = pGroupItemClass->GetTitleText();
353 if (__searchHistory == false)
357 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
360 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
361 if ( pGregorianCalendar != NULL)
363 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
370 delete pGregorianCalendar;
373 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
380 delete pGregorianCalendar;
383 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
390 delete pGregorianCalendar;
393 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
395 delete pGregorianCalendar;
401 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
404 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
407 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
410 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
413 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
416 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
419 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
427 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
429 text.Append(pGroupItemClass->GetStartTime().GetDay());
431 strMonth = pGroupItemClass->GetStartTime().GetMonth();
432 month = GetMonth(strMonth);
442 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
443 || pGroupItemClass->GetTitleText() == weeksAgo3 || pGroupItemClass->GetTitleText() == weeksAgo4 || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
446 text.Append(pGroupItemClass->GetEndTime().GetDay());
448 strMonth = pGroupItemClass->GetEndTime().GetMonth();
449 month = GetMonth(strMonth);
455 r = pItem->SetElement(text, null);
459 AppLogDebug("Failed with %s", GetErrorMessage(r));
462 r = pItem->SetTextSize(32);
473 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
475 AppLog("HistoryListForm::CreateItem");
476 result r = E_FAILURE;
477 History* pHistory = null;
478 Bitmap* pBitmap = null;
479 GroupItemClass* pGroupItemClass = null;
480 CustomItem* pItem = new(std::nothrow) CustomItem();
481 int bookmarkBtnWidth = 0;
482 Bitmap* pBookmarkBitmap = null;
485 if(__pGroupData == null)
495 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
496 if (pGroupItemClass == null)
501 if (pGroupItemClass->GetHistoryData() == null)
506 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
507 if (pHistory == null)
512 r = pItem->Construct(Dimension(itemWidth, 128), LIST_ANNEX_STYLE_NORMAL);
519 bitmapId = pHistory->GetFaviconId() ;
521 pBitmap = pHistory->GetFavIconBitmap();
525 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
529 r = pItem->AddElement(Rectangle(16, 28, 72, 72), IDA_FORMAT_ICON, *pBitmap, null);
534 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
538 // if (pHistory->GetBookmarkId().GetLength()>0)
540 // pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
544 // pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
546 bookmarkBtnWidth = 64;
549 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);
550 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
552 if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
553 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);
555 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);
556 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
557 // if ( pBookmarkBitmap != null)
559 // r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
560 // TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
561 // delete pBookmarkBitmap;
567 delete pBookmarkBitmap;
572 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
581 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
583 AppLog("HistoryListForm::DeleteItem");
584 result r = E_FAILURE;
585 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
586 if (pGroupItemClass == null)
591 // if (pGroupItemClass->__pData != null)
593 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
606 HistoryListForm::GetGroupCount(void)
608 __isNoHistoryPresent = true;
610 if (__pGroupData != null)
612 if (__searchHistory == false)
615 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
620 return __pGroupData->GetCount();
625 // String searchText = __pSearchBar->GetText();
626 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
640 HistoryListForm::GetItemCount(int groupIndex)
642 result r = E_FAILURE;
648 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
649 if (pGroupItemClass == null)
653 if (__searchHistory == false)
655 startTime = pGroupItemClass->GetStartTime();
656 endTime = pGroupItemClass->GetEndTime();
657 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
661 //text = __pSearchBar->GetText();
662 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
673 ArrayList* pData = new(std::nothrow) ArrayList();
678 r = pData->Construct();
686 if (__searchHistory == false)
688 startTime = pGroupItemClass->GetStartTime();
689 endTime = pGroupItemClass->GetEndTime();
690 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
691 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
695 //text = __pSearchBar->GetText() ;
696 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
703 pGroupItemClass->SetHistoryData(pData);
706 if (__isNoHistoryPresent == true && count == 0)
708 __isNoHistoryPresent = true;
709 GetFooter()->SetItemEnabled(0, false);
713 __isNoHistoryPresent = false;
714 GetFooter()->SetItemEnabled(0, true);
716 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
717 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
724 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
725 return pGroupItemClass->GetHistoryData()->GetCount();
730 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
733 GetHeader()->SetItemSelected(1);
734 // __previousSceneId = previousSceneId;
735 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
737 pList->GetAt(pList->GetCount()-1,__previousSceneId);
739 AppLog("HistoryListForm::OnSceneActivatedN called");
740 //GetHeader()->Invalidate(true);
741 if (__pGroupData == null)
743 __pGroupData = new(std::nothrow) ArrayList();
744 __pGroupData->Construct();
746 if (__pGroupedListView != null)
748 __pGroupedListView->UpdateList();
750 if (__isNoHistoryPresent == true)
752 GetFooter()->SetItemEnabled(0, false);
756 GetFooter()->SetItemEnabled(0, true);
760 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
763 __pSearchBar->SetShowState(false);
764 __pSearchBar->Invalidate(true);
768 __pSearchBar->SetShowState(true);
769 __pSearchBar->Invalidate(true);
772 // if (__isNoHistoryPresent == true)
774 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
775 // __pGroupedListView->UpdateList();
778 result r = GetHeader()->SetItemSelected(2);
781 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
790 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
792 AppLog("HistoryListForm::OnSceneDeactivated");
793 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
797 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
803 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
805 GroupItemClass* pGroupItemClass = null;
806 History* pHistory = null;
807 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
808 if (elementId == IDA_FORMAT_BOOKMARK)
810 String toggledUrl = L"";
811 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
812 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
813 if (pGroupItemClass == null)
817 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
818 if (pHistory == null)
822 toggledUrl = pHistory->GetHistoryUrl();
824 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
825 if (pHistory->GetBookmarkId().GetLength() > 0)
827 AppLog("Already added to bookmark so will be removed");
828 String bookmarkId = L"";
831 bookmarkId = pHistory->GetBookmarkId();
832 Integer::Parse(bookmarkId,id);
833 BookmarkPresentationModel::GetInstance()->DeleteBookmark(id);
834 pHistory->SetBookmarkId(L"");
835 //listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
837 for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
839 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
840 if (pGroupItemClass == null)
844 for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
846 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
847 if (pHistory == null)
851 if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
853 pHistory->SetBookmarkId(L"");
854 AppLog("Already added to bookmark so will be removed");
855 String bookmarkId = L"";
858 bookmarkId = pHistory->GetBookmarkId();
859 Integer::Parse(bookmarkId,id);
860 BookmarkPresentationModel::GetInstance()->DeleteBookmark(id);
861 pHistory->SetBookmarkId(L"");
862 //listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
864 for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
866 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
867 if (pGroupItemClass == null)
871 for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
873 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
874 if (pHistory == null)
878 if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
880 pHistory->SetBookmarkId(L"");
881 //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
886 //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
890 listView.UpdateList();
895 AppLog("Adding history to bookmark");
896 result r = E_FAILURE;
897 BookmarkData pBookmark;
899 String bookmarkTitle = pHistory->GetHistoryTitle();
901 pBookmark.SetBookmarkTitle(bookmarkTitle);
902 pBookmark.SetUrl(pHistory->GetHistoryUrl());
903 pBookmark.SetFaviconId(pHistory->GetFaviconId());
905 r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
908 AppLog("History added to bookmark with ID %ls",pBookmark.GetBookmarkId().GetPointer());
909 pHistory->SetBookmarkId(pBookmark.GetBookmarkId());
912 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
914 for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
916 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
917 if (pGroupItemClass == null)
921 for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
923 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
924 if (pHistory == null)
928 if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
930 pHistory->SetBookmarkId(pBookmark.GetBookmarkId());
931 //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
935 listView.UpdateList();
941 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
942 if (pGroupItemClass == null)
947 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
948 if (pHistory1 == null)
952 SceneManager* pSceneManager = SceneManager::GetInstance();
953 ArrayList *pArgList = null;
954 result r = E_SUCCESS;
955 pArgList = new(std::nothrow) ArrayList();
956 if (pArgList != null)
958 r = pArgList->Construct();
965 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
966 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
977 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
979 if (pSceneManager != null)
981 AppLog("pSceneManager exists");
982 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
985 pArgList->RemoveAll(false);
998 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
1004 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
1006 result r = E_FAILURE;
1007 if (mode == SEARCH_BAR_MODE_NORMAL)
1009 // __pSearchBar->SetMode(SEARCH_BAR_MODE_INPUT);
1010 r = __pSearchListView->SetShowState(false);
1015 r = __pGroupedListView->SetShowState(true);
1020 __pSearchListView->SetEnabled(true);
1022 __searchHistory = false;
1023 r = __pGroupedListView->UpdateList();
1024 if (__isNoHistoryPresent == true)
1026 GetFooter()->SetItemEnabled(0, false);
1030 GetFooter()->SetItemEnabled(0, true);
1032 if(__pSearchBar != null)
1034 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1043 // __pSearchListView->SetEnabled(false);
1044 r = __pSearchListView->SetShowState(true);
1049 __pSearchListView->SetEnabled(false);
1050 r = __pSearchListView->UpdateList();
1055 r = __pGroupedListView->SetShowState(false);
1060 if(__pSearchBar != null)
1062 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1068 HistoryListForm::GetMonth(int month)
1070 String monthValue = L"";
1074 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1077 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1080 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1083 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1086 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1089 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN"));
1092 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1095 monthValue.Append(CommonUtil::GetString(L"DS_COM_BODY_AUG"));
1098 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1101 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1104 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1107 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1118 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1120 result r = E_FAILURE;
1121 if (__pSearchBar != null)
1123 __pSearchBar->HideKeypad();
1126 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1128 __pSearchListView->SetEnabled(true);
1129 __searchHistory = true;
1130 __searchText =__pSearchBar->GetText();
1132 r = __pGroupedListView->SetShowState(false);
1137 r = __pSearchListView->SetShowState(true);
1142 r= __pSearchListView->UpdateList();
1143 if (__isNoHistoryPresent == true)
1145 GetFooter()->SetItemEnabled(0, false);
1149 GetFooter()->SetItemEnabled(0, true);
1151 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1160 __searchHistory = false;
1166 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1168 result r = E_FAILURE;
1169 if (__pGroupedListView != null)
1171 AppLog("groupedlistview bounds %d,%d,%d",GetClientAreaBounds().height,__pSearchBar->GetHeight(),__pSearchBar->GetY());
1172 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1173 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1174 else if(__pSearchBar != null)
1175 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1178 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());
1181 __pGroupedListView->UpdateList();
1183 if (__pSearchListView != null)
1185 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1191 __pSearchListView->UpdateList();
1193 if(__pSearchBar != null)
1194 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1199 if (__isNoHistoryPresent == true)
1201 GetFooter()->SetItemEnabled(0, false);
1205 GetFooter()->SetItemEnabled(0, true);
1210 HistoryListForm::OnKeypadWillOpen(Control& source)
1212 GetFooter()->SetShowState(false);
1213 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1214 __pSearchListView->SetEnabled(false);
1215 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1221 HistoryListForm::OnKeypadOpened(Control& source)
1223 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1227 HistoryListForm::OnKeypadClosed(Control& source)
1229 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1231 // __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
1232 __pSearchListView->SetEnabled(true);
1235 GetFooter()->SetShowState(true);
1236 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1237 __pSearchListView->Invalidate(false);
1238 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1243 HistoryListForm::CreateGroupItems()
1245 result r = E_FAILURE;
1246 DateTime currentTime;
1248 GroupItemClass* pGroupItemClass = null;
1251 String weeksAgo2 = L"";
1252 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
1254 String weeksAgo3 = L"";
1255 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1257 if (__pGroupData != null)
1259 __pGroupData->RemoveAll(false);
1260 delete __pGroupData;
1261 __pGroupData = null;
1263 __pGroupData = new(std::nothrow) ArrayList();
1264 if (__pGroupData == null)
1268 r = __pGroupData->Construct();
1271 delete __pGroupData;
1272 __pGroupData = null;
1275 if (__searchHistory == true)
1277 pGroupItemClass = new(std::nothrow) GroupItemClass();
1278 if (pGroupItemClass == null)
1282 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1283 pGroupItemClass->SetTitleText(titleText);
1284 r = __pGroupData->Add(*pGroupItemClass);
1292 Calendar* pGregorianCalendar = null;
1295 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1296 pGroupItemClass = new(std::nothrow) GroupItemClass();
1297 if (pGroupItemClass == null)
1301 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1302 pGroupItemClass->SetTitleText(titleText);
1303 pGroupItemClass->SetEndTime(currentTime);
1304 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1305 pGroupItemClass->SetStartTime(dateTime);
1306 __pGroupData->Add(*pGroupItemClass);
1309 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1310 if ( pGregorianCalendar != NULL )
1312 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1313 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1314 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1315 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1316 delete pGregorianCalendar;
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(), currentTime.GetDay());
1329 pGroupItemClass->SetEndTime(dateTime);
1330 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1331 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1332 pGroupItemClass->SetStartTime(dateTime);
1333 __pGroupData->Add(*pGroupItemClass);
1336 pGroupItemClass = new(std::nothrow) GroupItemClass();
1337 if (pGroupItemClass == null)
1341 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1342 pGroupItemClass->SetTitleText(titleText);
1343 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1344 pGroupItemClass->SetEndTime(dateTime);
1345 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1346 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1347 pGroupItemClass->SetStartTime(dateTime);
1348 __pGroupData->Add(*pGroupItemClass);
1351 pGroupItemClass = new(std::nothrow) GroupItemClass();
1352 if (pGroupItemClass == null)
1356 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1357 pGroupItemClass->SetTitleText(titleText);
1358 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1359 pGroupItemClass->SetEndTime(dateTime);
1360 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1361 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1362 pGroupItemClass->SetStartTime(dateTime);
1363 __pGroupData->Add(*pGroupItemClass);
1365 pGroupItemClass = new(std::nothrow) GroupItemClass();
1366 if (pGroupItemClass == null)
1370 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1371 pGroupItemClass->SetTitleText(titleText);
1372 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1373 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1374 pGroupItemClass->SetEndTime(dateTime);
1375 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1376 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1377 pGroupItemClass->SetStartTime(dateTime);
1378 __pGroupData->Add(*pGroupItemClass);
1381 pGroupItemClass = new(std::nothrow) GroupItemClass();
1382 if (pGroupItemClass == null)
1386 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1387 pGroupItemClass->SetTitleText(titleText);
1388 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1389 pGroupItemClass->SetEndTime(dateTime);
1390 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1391 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1392 pGroupItemClass->SetStartTime(dateTime);
1393 __pGroupData->Add(*pGroupItemClass);
1395 pGroupItemClass = new(std::nothrow) GroupItemClass();
1396 if (pGroupItemClass == null)
1400 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1401 pGroupItemClass->SetTitleText(titleText);
1402 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1403 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1404 pGroupItemClass->SetEndTime(dateTime);
1405 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1406 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1407 pGroupItemClass->SetStartTime(dateTime);
1408 __pGroupData->Add(*pGroupItemClass);
1410 pGroupItemClass = new(std::nothrow) GroupItemClass();
1411 if (pGroupItemClass == null)
1415 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1416 pGroupItemClass->SetTitleText(titleText);
1417 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1418 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1419 pGroupItemClass->SetEndTime(dateTime);
1420 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1421 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1422 pGroupItemClass->SetStartTime(dateTime);
1423 __pGroupData->Add(*pGroupItemClass);
1426 pGroupItemClass = new(std::nothrow) GroupItemClass();
1427 if (pGroupItemClass == null)
1431 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1432 pGroupItemClass->SetTitleText(titleText);
1433 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1434 pGroupItemClass->SetEndTime(dateTime);
1435 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1436 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1437 pGroupItemClass->SetStartTime(dateTime);
1438 __pGroupData->Add(*pGroupItemClass);
1440 pGroupItemClass = new(std::nothrow) GroupItemClass();
1441 if (pGroupItemClass == null)
1445 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1446 pGroupItemClass->SetTitleText(titleText);
1447 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1448 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1449 pGroupItemClass->SetEndTime(dateTime);
1450 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1451 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1452 pGroupItemClass->SetStartTime(dateTime);
1453 __pGroupData->Add(*pGroupItemClass);
1455 pGroupItemClass = new(std::nothrow) GroupItemClass();
1456 if (pGroupItemClass == null)
1460 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1461 pGroupItemClass->SetTitleText(titleText);
1462 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1463 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1464 pGroupItemClass->SetEndTime(dateTime);
1465 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1466 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1467 pGroupItemClass->SetStartTime(dateTime);
1468 __pGroupData->Add(*pGroupItemClass);
1470 pGroupItemClass = new(std::nothrow) GroupItemClass();
1471 if (pGroupItemClass == null)
1475 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1476 pGroupItemClass->SetTitleText(titleText);
1477 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1478 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1479 pGroupItemClass->SetEndTime(dateTime);
1480 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1481 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1482 pGroupItemClass->SetStartTime(dateTime);
1483 __pGroupData->Add(*pGroupItemClass);
1486 pGroupItemClass = new(std::nothrow) GroupItemClass();
1487 if (pGroupItemClass == null)
1491 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1492 pGroupItemClass->SetTitleText(titleText);
1493 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1494 pGroupItemClass->SetEndTime(dateTime);
1495 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1496 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1497 pGroupItemClass->SetStartTime(dateTime);
1498 __pGroupData->Add(*pGroupItemClass);
1500 pGroupItemClass = new(std::nothrow) GroupItemClass();
1501 if (pGroupItemClass == null)
1505 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1506 pGroupItemClass->SetTitleText(titleText);
1507 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1508 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1509 pGroupItemClass->SetEndTime(dateTime);
1510 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1511 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1512 pGroupItemClass->SetStartTime(dateTime);
1513 __pGroupData->Add(*pGroupItemClass);
1515 pGroupItemClass = new(std::nothrow) GroupItemClass();
1516 if (pGroupItemClass == null)
1520 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1521 pGroupItemClass->SetTitleText(titleText);
1522 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1523 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1524 pGroupItemClass->SetEndTime(dateTime);
1525 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1526 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1527 pGroupItemClass->SetStartTime(dateTime);
1528 __pGroupData->Add(*pGroupItemClass);
1530 pGroupItemClass = new(std::nothrow) GroupItemClass();
1531 if (pGroupItemClass == null)
1535 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1536 pGroupItemClass->SetTitleText(titleText);
1537 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1538 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1539 pGroupItemClass->SetEndTime(dateTime);
1540 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1541 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1542 pGroupItemClass->SetStartTime(dateTime);
1543 __pGroupData->Add(*pGroupItemClass);
1545 pGroupItemClass = new(std::nothrow) GroupItemClass();
1546 if (pGroupItemClass == null)
1550 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1551 pGroupItemClass->SetTitleText(titleText);
1552 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1553 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1554 pGroupItemClass->SetEndTime(dateTime);
1555 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1556 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1557 pGroupItemClass->SetStartTime(dateTime);
1558 __pGroupData->Add(*pGroupItemClass);
1561 pGroupItemClass = new(std::nothrow) GroupItemClass();
1562 if (pGroupItemClass == null)
1566 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1567 pGroupItemClass->SetTitleText(titleText);
1568 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1569 pGroupItemClass->SetEndTime(dateTime);
1570 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1571 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1572 pGroupItemClass->SetStartTime(dateTime);
1573 __pGroupData->Add(*pGroupItemClass);
1575 pGroupItemClass = new(std::nothrow) GroupItemClass();
1576 if (pGroupItemClass == null)
1580 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1581 pGroupItemClass->SetTitleText(titleText);
1582 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1583 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1584 pGroupItemClass->SetEndTime(dateTime);
1585 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1586 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1587 pGroupItemClass->SetStartTime(dateTime);
1588 __pGroupData->Add(*pGroupItemClass);
1590 pGroupItemClass = new(std::nothrow) GroupItemClass();
1591 if (pGroupItemClass == null)
1595 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1596 pGroupItemClass->SetTitleText(titleText);
1597 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1598 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1599 pGroupItemClass->SetEndTime(dateTime);
1600 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1601 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1602 pGroupItemClass->SetStartTime(dateTime);
1603 __pGroupData->Add(*pGroupItemClass);
1605 pGroupItemClass = new(std::nothrow) GroupItemClass();
1606 if (pGroupItemClass == null)
1610 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1611 pGroupItemClass->SetTitleText(titleText);
1612 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1613 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1614 pGroupItemClass->SetEndTime(dateTime);
1615 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1616 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1617 pGroupItemClass->SetStartTime(dateTime);
1618 __pGroupData->Add(*pGroupItemClass);
1620 pGroupItemClass = new(std::nothrow) GroupItemClass();
1621 if (pGroupItemClass == null)
1625 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1626 pGroupItemClass->SetTitleText(titleText);
1627 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1628 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1629 pGroupItemClass->SetEndTime(dateTime);
1630 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1631 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1632 pGroupItemClass->SetStartTime(dateTime);
1633 __pGroupData->Add(*pGroupItemClass);
1635 pGroupItemClass = new(std::nothrow) GroupItemClass();
1636 if (pGroupItemClass == null)
1640 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1641 pGroupItemClass->SetTitleText(titleText);
1642 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1643 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1644 pGroupItemClass->SetEndTime(dateTime);
1645 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1646 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1647 pGroupItemClass->SetStartTime(dateTime);
1648 __pGroupData->Add(*pGroupItemClass);
1654 day = currentTime.GetDay();
1658 pGroupItemClass = new(std::nothrow) GroupItemClass();
1659 if (pGroupItemClass == null)
1664 pGroupItemClass->SetTitleText(weeksAgo2);
1665 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1666 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1667 pGroupItemClass->SetEndTime(dateTime);
1668 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1669 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1670 pGroupItemClass->SetStartTime(dateTime);
1671 __pGroupData->Add(*pGroupItemClass);
1673 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1675 pGroupItemClass = new(std::nothrow) GroupItemClass();
1676 if (pGroupItemClass == null)
1680 String weeksAgo3 = L"";
1681 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1682 pGroupItemClass->SetTitleText(weeksAgo3);
1683 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1684 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1685 pGroupItemClass->SetEndTime(dateTime);
1686 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1687 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1688 pGroupItemClass->SetStartTime(dateTime);
1689 __pGroupData->Add(*pGroupItemClass);
1693 pGroupItemClass = new(std::nothrow) GroupItemClass();
1694 if (pGroupItemClass == null)
1698 pGroupItemClass->SetTitleText(weeksAgo2);
1699 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1700 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1701 pGroupItemClass->SetEndTime(dateTime);
1702 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1703 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1704 pGroupItemClass->SetStartTime(dateTime);
1705 __pGroupData->Add(*pGroupItemClass);
1707 pGroupItemClass = new(std::nothrow) GroupItemClass();
1708 if (pGroupItemClass == null)
1713 pGroupItemClass->SetTitleText(weeksAgo3);
1714 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1715 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1716 pGroupItemClass->SetEndTime(dateTime);
1717 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1718 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1719 pGroupItemClass->SetStartTime(dateTime);
1720 __pGroupData->Add(*pGroupItemClass);
1722 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1724 pGroupItemClass = new(std::nothrow) GroupItemClass();
1725 if (pGroupItemClass == null)
1729 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1730 pGroupItemClass->SetTitleText(titleText);
1731 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1732 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1733 pGroupItemClass->SetEndTime(dateTime);
1734 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1735 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1736 pGroupItemClass->SetStartTime(dateTime);
1737 __pGroupData->Add(*pGroupItemClass);
1741 pGroupItemClass = new(std::nothrow) GroupItemClass();
1742 if (pGroupItemClass == null)
1746 pGroupItemClass->SetTitleText(weeksAgo2);
1747 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1748 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1749 pGroupItemClass->SetEndTime(dateTime);
1750 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1751 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1752 pGroupItemClass->SetStartTime(dateTime);
1753 __pGroupData->Add(*pGroupItemClass);
1755 pGroupItemClass = new(std::nothrow) GroupItemClass();
1756 if (pGroupItemClass == null)
1760 pGroupItemClass->SetTitleText(weeksAgo3);
1761 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1762 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1763 pGroupItemClass->SetEndTime(dateTime);
1764 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1765 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1766 pGroupItemClass->SetStartTime(dateTime);
1767 __pGroupData->Add(*pGroupItemClass);
1769 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1771 pGroupItemClass = new(std::nothrow) GroupItemClass();
1772 if (pGroupItemClass == null)
1776 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1777 pGroupItemClass->SetTitleText(titleText);
1778 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1779 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1780 pGroupItemClass->SetEndTime(dateTime);
1781 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1782 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1783 pGroupItemClass->SetStartTime(dateTime);
1784 __pGroupData->Add(*pGroupItemClass);
1790 pGroupItemClass = new(std::nothrow) GroupItemClass();
1791 if (pGroupItemClass == null)
1795 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1796 pGroupItemClass->SetTitleText(titleText);
1797 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1798 dateTime.AddDays(-1);
1799 pGroupItemClass->SetEndTime(dateTime);
1800 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1801 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1802 pGroupItemClass->SetStartTime(dateTime);
1803 __pGroupData->Add(*pGroupItemClass);
1805 pGroupItemClass = new(std::nothrow) GroupItemClass();
1806 if (pGroupItemClass == null)
1810 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1811 pGroupItemClass->SetTitleText(titleText);
1812 dateTime.SetValue(currentTime.GetYear(),1, 1);
1813 dateTime.AddMonths(currentTime.GetMonth() - 2);
1814 dateTime.AddDays(-1);
1815 pGroupItemClass->SetEndTime(dateTime);
1817 dateTime2.SetValue(0, 0, 0);
1818 pGroupItemClass->SetStartTime(dateTime2);
1819 __pGroupData->Add(*pGroupItemClass);
1823 GroupItemClass::GroupItemClass()
1829 GroupItemClass::operator =(const GroupItemClass& rhs)
1833 __pData = rhs.__pData;
1838 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1840 __pData = groupItem.__pData;
1843 GroupItemClass::~GroupItemClass()
1847 __pData->RemoveAll(true);
1853 GroupItemClass::SetStartTime(DateTime& startTime)
1855 __startTime = startTime;
1859 GroupItemClass::SetEndTime(DateTime& endTime)
1861 __endTime = endTime;
1865 GroupItemClass::SetTitleText(String& titleText)
1867 __titleText = titleText;
1871 GroupItemClass::SetHistoryData(ArrayList* pData)
1877 GroupItemClass::GetStartTime(void)
1883 GroupItemClass::GetEndTime(void)
1889 GroupItemClass::GetTitleText(void)
1895 GroupItemClass::GetHistoryData(void)