2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 //!Internet HistoryListForm class
18 /*@file: HistoryListForm.cpp
19 *@brief: This class defines HistoryListForm used define history
25 #include "IntBookmarkData.h"
26 #include "IntBookmarkPresentationModel.h"
27 #include "IntCommonLib.h"
28 #include "IntFaviconManager.h"
29 #include "IntHistoryListForm.h"
30 #include "IntHistoryPresentationModel.h"
31 #include "IntMultipleWindowPresentationModel.h"
32 #include "IntSceneRegister.h"
35 using namespace Tizen::App;
36 using namespace Tizen::Base;
37 using namespace Tizen::Base::Collection;
38 using namespace Tizen::Base::Runtime;
39 using namespace Tizen::Graphics;
40 using namespace Tizen::Locales;
41 using namespace Tizen::Ui;
42 using namespace Tizen::Ui::Controls;
43 using namespace Tizen::Ui::Scenes;
45 static const wchar_t* IDB_TAB_ICON_BOOKMARKS = L"I01_tab_icon_bookmarks.png";
46 static const wchar_t* IDB_TAB_ICON_HISTORY = L"I01_tab_icon_history.png";
47 static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png";
48 static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png";
51 const int HistoryListForm::IDA_TABBAR_ITEM_1 = 101;
52 const int HistoryListForm::IDA_TABBAR_ITEM_2 = 102;
53 const int HistoryListForm::IDA_EDIT_HISTORY_LIST_FORM = 103;
54 const int HistoryListForm::IDA_FORMAT_ICON = 104;
55 const int HistoryListForm::IDA_FORMAT_TITLE = 105;
56 const int HistoryListForm::IDA_FORMAT_URL = 106;
57 const int HistoryListForm::IDA_FORMAT_BOOKMARK = 107;
60 HistoryListForm::HistoryListForm(void)
62 __pGroupedListView =null;
63 __pSearchListView = null;
66 __pSearchedData = null ;
67 __searchHistory = false;
68 __isNoHistoryPresent = true;
72 HistoryListForm::~HistoryListForm(void)
74 if (__pGroupData != null)
76 __pGroupData->RemoveAll(true);
82 HistoryListForm::Initialize(void)
84 Construct(L"IDL_HISTORY_LIST");
90 HistoryListForm::OnInitializing(void)
92 AppLog("HistoryListForm::OnInitializing");
94 SceneManager* pSceneManager = null;
97 Header *pHeader = GetHeader();
98 Bitmap *pIconBitmap = null;
99 AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
100 const Color brown = Color(32, 32, 32, 0xFF);
102 // Setup back event listener
103 SetFormBackEventListener(this);
105 GetHeader()->AddActionEventListener(*this);
106 GetFooter()->AddActionEventListener(*this);
108 AddOrientationEventListener(*this);
109 pSceneManager = SceneManager::GetInstance();
110 if (pSceneManager != null)
112 pSceneManager->AddSceneEventListener(IDSCN_HISTORY_LIST, *this);
115 if (pAppResource == null)
120 __pGroupedListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1"));
121 if (__pGroupedListView == null)
126 r = __pGroupedListView->SetItemProvider(*this);
133 __pSearchBar = static_cast< SearchBar* >(GetControl(L"IDC_SEARCHBAR1"));
134 if (__pSearchBar == null)
138 __pSearchListView = new(std::nothrow) GroupedListView();
139 if (__pSearchListView == null)
143 __pGroupedListView->AddGroupedListViewItemEventListener(*this);
144 r = __pGroupedListView->SetBounds(Rectangle(0,__pGroupedListView->GetY(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
149 r = __pSearchListView->Construct(Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height -__pSearchBar->GetHeight() - __pSearchBar->GetY()), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
154 r = __pSearchListView->SetItemProvider(*this);
159 r = __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND"));
166 __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK));
167 __pSearchListView->AddGroupedListViewItemEventListener(*this);
168 r = __pSearchListView->SetShowState(false);
175 __pSearchBar->AddSearchBarEventListener(*this);
176 __pSearchBar->AddKeypadEventListener(*this);
177 r = __pSearchBar->SetContent(__pSearchListView);
181 pHeader->SetStyle(HEADER_STYLE_TAB);
182 bookmark.Construct(IDA_TABBAR_ITEM_1);
184 pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark);
185 bookmark.SetText(strbookmark);
186 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARKS);
187 bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
188 bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
189 pHeader->AddItem(bookmark);
197 history.Construct(IDA_TABBAR_ITEM_2);
199 pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory);
200 history.SetText(strhistory);
201 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY);
202 history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
203 history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
204 pHeader->AddItem(history);
205 pHeader->SetItemSelected(1);
207 if (pIconBitmap != NULL)
217 HistoryListForm::OnTerminating(void)
219 result r = E_SUCCESS;
225 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
227 AppLog("HistoryListForm::OnActionPerformed");
228 result r = E_FAILURE;
229 SceneManager* pSceneManager = SceneManager::GetInstance();
230 if (pSceneManager == null)
236 case IDA_EDIT_HISTORY_LIST_FORM:
238 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
239 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
246 case IDA_TABBAR_ITEM_1:
248 result r = GetHeader()->SetItemSelected(1);
249 AppLog("SetItemSelected result %s",GetErrorMessage(r));
250 GetHeader()->Invalidate(true);
251 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
264 HistoryListForm::OnFormBackRequested(Form& source)
266 SceneManager* pSceneManager = SceneManager::GetInstance();
267 if (pSceneManager == null)
271 result r = pSceneManager->GoBackward(BackwardSceneTransition());
274 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
279 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
281 result r = E_FAILURE;
287 GroupItem* pItem = null;
288 GroupItemClass* pGroupItemClass = null;
290 String weeksAgo2 = L"";
291 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
293 String weeksAgo3 = L"";
294 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
296 String weeksAgo4 = L"";
297 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),4);
299 pItem = new(std::nothrow) GroupItem();
304 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
306 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
308 AppLog("CreateGroupItem :: if history is null");
309 r = pItem->Construct(Dimension(itemWidth, 0));
314 r = pItem->Construct(Dimension(itemWidth, 48));
316 text = pGroupItemClass->GetTitleText();
318 if (__searchHistory == false)
322 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
325 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
326 if ( pGregorianCalendar != NULL)
328 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
335 delete pGregorianCalendar;
338 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
345 delete pGregorianCalendar;
348 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
355 delete pGregorianCalendar;
358 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
360 delete pGregorianCalendar;
366 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
369 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
372 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
375 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
378 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
381 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
384 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
392 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
394 text.Append(pGroupItemClass->GetStartTime().GetDay());
396 strMonth = pGroupItemClass->GetStartTime().GetMonth();
397 month = GetMonth(strMonth);
407 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
408 || pGroupItemClass->GetTitleText() == weeksAgo3 || pGroupItemClass->GetTitleText() == weeksAgo4 || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
411 text.Append(pGroupItemClass->GetEndTime().GetDay());
413 strMonth = pGroupItemClass->GetEndTime().GetMonth();
414 month = GetMonth(strMonth);
420 r = pItem->SetElement(text, null);
424 AppLogDebug("Failed with %s", GetErrorMessage(r));
427 r = pItem->SetTextSize(32);
438 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
440 AppLog("HistoryListForm::CreateItem");
441 result r = E_FAILURE;
442 History* pHistory = null;
443 Bitmap* pBitmap = null;
444 GroupItemClass* pGroupItemClass = null;
445 CustomItem* pItem = new(std::nothrow) CustomItem();
446 int bookmarkBtnWidth = 0;
447 Bitmap* pBookmarkBitmap = null;
454 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
455 if (pGroupItemClass == null)
460 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
461 if (pHistory == null)
466 r = pItem->Construct(Dimension(itemWidth, 128), LIST_ANNEX_STYLE_NORMAL);
473 bitmapId = pHistory->GetFaviconId() ;
475 pBitmap = FaviconManager::GetInstance()->GetFaviconN(bitmapId);
479 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
483 r = pItem->AddElement(Rectangle(16, 28, 72, 72), IDA_FORMAT_ICON, *pBitmap, null);
488 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
492 // if (pHistory->GetBookmarkId().GetLength()>0)
494 // pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
498 // pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
500 bookmarkBtnWidth = 64;
503 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);
504 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
506 if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
507 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);
509 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);
510 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
511 // if ( pBookmarkBitmap != null)
513 // r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
514 // TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
515 // delete pBookmarkBitmap;
521 delete pBookmarkBitmap;
526 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
535 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
537 AppLog("HistoryListForm::DeleteItem");
538 result r = E_FAILURE;
539 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
540 if (pGroupItemClass == null)
545 // if (pGroupItemClass->__pData != null)
547 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
560 HistoryListForm::GetGroupCount(void)
562 __isNoHistoryPresent = true;
564 if (__pGroupData != null)
566 if (__searchHistory == false)
569 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
574 return __pGroupData->GetCount();
579 // String searchText = __pSearchBar->GetText();
580 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
594 HistoryListForm::GetItemCount(int groupIndex)
596 result r = E_FAILURE;
602 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
603 if (pGroupItemClass == null)
607 if (__searchHistory == false)
609 startTime = pGroupItemClass->GetStartTime();
610 endTime = pGroupItemClass->GetEndTime();
611 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
615 //text = __pSearchBar->GetText();
616 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
627 ArrayList* pData = new(std::nothrow) ArrayList();
632 r = pData->Construct();
640 if (__searchHistory == false)
642 startTime = pGroupItemClass->GetStartTime();
643 endTime = pGroupItemClass->GetEndTime();
644 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
645 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
649 //text = __pSearchBar->GetText() ;
650 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
657 pGroupItemClass->SetHistoryData(pData);
660 if (__isNoHistoryPresent == true && count == 0)
662 __isNoHistoryPresent = true;
663 GetFooter()->SetItemEnabled(0, false);
667 __isNoHistoryPresent = false;
668 GetFooter()->SetItemEnabled(0, true);
670 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
671 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
678 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
679 return pGroupItemClass->GetHistoryData()->GetCount();
684 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
687 GetHeader()->SetItemSelected(1);
689 AppLog("HistoryListForm::OnSceneActivatedN called");
690 //GetHeader()->Invalidate(true);
691 if (__pGroupData == null)
693 __pGroupData = new(std::nothrow) ArrayList();
694 __pGroupData->Construct();
696 if (__pGroupedListView != null)
698 __pGroupedListView->UpdateList();
700 if (__isNoHistoryPresent == true)
702 GetFooter()->SetItemEnabled(0, false);
706 GetFooter()->SetItemEnabled(0, true);
710 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
713 __pSearchBar->SetShowState(false);
714 __pSearchBar->Invalidate(true);
718 __pSearchBar->SetShowState(true);
719 __pSearchBar->Invalidate(true);
722 // if (__isNoHistoryPresent == true)
724 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
725 // __pGroupedListView->UpdateList();
728 result r = GetHeader()->SetItemSelected(2);
731 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
740 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
742 AppLog("HistoryListForm::OnSceneDeactivated");
743 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
747 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
753 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
755 GroupItemClass* pGroupItemClass = null;
756 History* pHistory = null;
757 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
758 if (elementId == IDA_FORMAT_BOOKMARK)
760 String toggledUrl = L"";
761 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
762 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
763 if (pGroupItemClass == null)
767 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
768 if (pHistory == null)
772 toggledUrl = pHistory->GetHistoryUrl();
774 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
775 if (pHistory->GetBookmarkId().GetLength() > 0)
777 AppLog("Already added to bookmark so will be removed");
778 String bookmarkId = L"";
781 bookmarkId = pHistory->GetBookmarkId();
782 Integer::Parse(bookmarkId,id);
783 BookmarkPresentationModel::GetInstance()->DeleteBookmark(id);
784 pHistory->SetBookmarkId(L"");
785 //listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
787 for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
789 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
790 if (pGroupItemClass == null)
794 for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
796 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
797 if (pHistory == null)
801 if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
803 pHistory->SetBookmarkId(L"");
804 AppLog("Already added to bookmark so will be removed");
805 String bookmarkId = L"";
808 bookmarkId = pHistory->GetBookmarkId();
809 Integer::Parse(bookmarkId,id);
810 BookmarkPresentationModel::GetInstance()->DeleteBookmark(id);
811 pHistory->SetBookmarkId(L"");
812 //listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
814 for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
816 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
817 if (pGroupItemClass == null)
821 for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
823 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
824 if (pHistory == null)
828 if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
830 pHistory->SetBookmarkId(L"");
831 //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
836 //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
840 listView.UpdateList();
845 AppLog("Adding history to bookmark");
846 result r = E_FAILURE;
847 BookmarkData pBookmark;
849 String bookmarkTitle = pHistory->GetHistoryTitle();
851 pBookmark.SetBookmarkTitle(bookmarkTitle);
852 pBookmark.SetUrl(pHistory->GetHistoryUrl());
853 pBookmark.SetFaviconId(pHistory->GetFaviconId());
855 r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
858 AppLog("History added to bookmark with ID %ls",pBookmark.GetBookmarkId().GetPointer());
859 pHistory->SetBookmarkId(pBookmark.GetBookmarkId());
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(pBookmark.GetBookmarkId());
881 //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
885 listView.UpdateList();
891 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
892 if (pGroupItemClass == null)
897 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
898 if (pHistory1 == null)
902 SceneManager* pSceneManager = SceneManager::GetInstance();
903 ArrayList *pArgList = null;
904 result r = E_SUCCESS;
905 pArgList = new(std::nothrow) ArrayList();
906 if (pArgList != null)
908 r = pArgList->Construct();
915 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
916 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
927 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
929 if (pSceneManager != null)
931 AppLog("pSceneManager exists");
932 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
935 pArgList->RemoveAll(false);
948 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
954 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
956 result r = E_FAILURE;
957 if (mode == SEARCH_BAR_MODE_NORMAL)
959 // __pSearchBar->SetMode(SEARCH_BAR_MODE_INPUT);
960 r = __pSearchListView->SetShowState(false);
965 r = __pGroupedListView->SetShowState(true);
970 __pSearchListView->SetEnabled(true);
972 __searchHistory = false;
973 r = __pGroupedListView->UpdateList();
974 if (__isNoHistoryPresent == true)
976 GetFooter()->SetItemEnabled(0, false);
980 GetFooter()->SetItemEnabled(0, true);
982 if(__pSearchBar != null)
984 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
993 // __pSearchListView->SetEnabled(false);
994 r = __pSearchListView->SetShowState(true);
999 __pSearchListView->SetEnabled(false);
1000 r = __pSearchListView->UpdateList();
1005 r = __pGroupedListView->SetShowState(false);
1010 if(__pSearchBar != null)
1012 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1018 HistoryListForm::GetMonth(int month)
1020 String monthValue = L"";
1024 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1027 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1030 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1033 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1036 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1039 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUN"));
1042 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1045 monthValue.Append(CommonUtil::GetString(L"DS_COM_BODY_AUG"));
1048 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1051 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1054 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1057 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1068 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1070 result r = E_FAILURE;
1071 if (__pSearchBar != null)
1073 __pSearchBar->HideKeypad();
1076 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1078 __pSearchListView->SetEnabled(true);
1079 __searchHistory = true;
1080 __searchText =__pSearchBar->GetText();
1082 r = __pGroupedListView->SetShowState(false);
1087 r = __pSearchListView->SetShowState(true);
1092 r= __pSearchListView->UpdateList();
1093 if (__isNoHistoryPresent == true)
1095 GetFooter()->SetItemEnabled(0, false);
1099 GetFooter()->SetItemEnabled(0, true);
1101 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1110 __searchHistory = false;
1116 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1118 result r = E_FAILURE;
1119 if (__pGroupedListView != null)
1121 AppLog("groupedlistview bounds %d,%d,%d",GetClientAreaBounds().height,__pSearchBar->GetHeight(),__pSearchBar->GetY());
1122 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1123 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1124 else if(__pSearchBar != null)
1125 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1128 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());
1131 __pGroupedListView->UpdateList();
1133 if (__pSearchListView != null)
1135 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1141 __pSearchListView->UpdateList();
1143 if(__pSearchBar != null)
1144 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1149 if (__isNoHistoryPresent == true)
1151 GetFooter()->SetItemEnabled(0, false);
1155 GetFooter()->SetItemEnabled(0, true);
1160 HistoryListForm::OnKeypadWillOpen(Control& source)
1162 GetFooter()->SetShowState(false);
1163 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1164 __pSearchListView->SetEnabled(false);
1165 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1171 HistoryListForm::OnKeypadOpened(Control& source)
1173 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1177 HistoryListForm::OnKeypadClosed(Control& source)
1179 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1181 // __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
1182 __pSearchListView->SetEnabled(true);
1185 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1186 __pSearchListView->Invalidate(false);
1187 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1188 GetFooter()->SetShowState(true);
1193 HistoryListForm::CreateGroupItems()
1195 result r = E_FAILURE;
1196 DateTime currentTime;
1198 GroupItemClass* pGroupItemClass = null;
1201 String weeksAgo2 = L"";
1202 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),2);
1204 String weeksAgo3 = L"";
1205 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1207 if (__pGroupData != null)
1209 __pGroupData->RemoveAll(true);
1210 delete __pGroupData;
1211 __pGroupData = null;
1213 __pGroupData = new(std::nothrow) ArrayList();
1214 if (__pGroupData == null)
1218 r = __pGroupData->Construct();
1221 delete __pGroupData;
1222 __pGroupData = null;
1225 if (__searchHistory == true)
1227 pGroupItemClass = new(std::nothrow) GroupItemClass();
1228 if (pGroupItemClass == null)
1232 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1233 pGroupItemClass->SetTitleText(titleText);
1234 r = __pGroupData->Add(*pGroupItemClass);
1242 Calendar* pGregorianCalendar = null;
1245 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1246 pGroupItemClass = new(std::nothrow) GroupItemClass();
1247 if (pGroupItemClass == null)
1251 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1252 pGroupItemClass->SetTitleText(titleText);
1253 pGroupItemClass->SetEndTime(currentTime);
1254 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1255 pGroupItemClass->SetStartTime(dateTime);
1256 __pGroupData->Add(*pGroupItemClass);
1259 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1260 if ( pGregorianCalendar != NULL )
1262 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1263 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1264 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1265 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1266 delete pGregorianCalendar;
1271 pGroupItemClass = new(std::nothrow) GroupItemClass();
1272 if (pGroupItemClass == null)
1276 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1277 pGroupItemClass->SetTitleText(titleText);
1278 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1279 pGroupItemClass->SetEndTime(dateTime);
1280 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1281 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1282 pGroupItemClass->SetStartTime(dateTime);
1283 __pGroupData->Add(*pGroupItemClass);
1286 pGroupItemClass = new(std::nothrow) GroupItemClass();
1287 if (pGroupItemClass == null)
1291 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1292 pGroupItemClass->SetTitleText(titleText);
1293 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1294 pGroupItemClass->SetEndTime(dateTime);
1295 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1296 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1297 pGroupItemClass->SetStartTime(dateTime);
1298 __pGroupData->Add(*pGroupItemClass);
1301 pGroupItemClass = new(std::nothrow) GroupItemClass();
1302 if (pGroupItemClass == null)
1306 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1307 pGroupItemClass->SetTitleText(titleText);
1308 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1309 pGroupItemClass->SetEndTime(dateTime);
1310 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1311 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1312 pGroupItemClass->SetStartTime(dateTime);
1313 __pGroupData->Add(*pGroupItemClass);
1315 pGroupItemClass = new(std::nothrow) GroupItemClass();
1316 if (pGroupItemClass == null)
1320 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1321 pGroupItemClass->SetTitleText(titleText);
1322 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1323 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1324 pGroupItemClass->SetEndTime(dateTime);
1325 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1326 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1327 pGroupItemClass->SetStartTime(dateTime);
1328 __pGroupData->Add(*pGroupItemClass);
1331 pGroupItemClass = new(std::nothrow) GroupItemClass();
1332 if (pGroupItemClass == null)
1336 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1337 pGroupItemClass->SetTitleText(titleText);
1338 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1339 pGroupItemClass->SetEndTime(dateTime);
1340 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1341 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1342 pGroupItemClass->SetStartTime(dateTime);
1343 __pGroupData->Add(*pGroupItemClass);
1345 pGroupItemClass = new(std::nothrow) GroupItemClass();
1346 if (pGroupItemClass == null)
1350 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1351 pGroupItemClass->SetTitleText(titleText);
1352 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1353 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1354 pGroupItemClass->SetEndTime(dateTime);
1355 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1356 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1357 pGroupItemClass->SetStartTime(dateTime);
1358 __pGroupData->Add(*pGroupItemClass);
1360 pGroupItemClass = new(std::nothrow) GroupItemClass();
1361 if (pGroupItemClass == null)
1365 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1366 pGroupItemClass->SetTitleText(titleText);
1367 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1368 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1369 pGroupItemClass->SetEndTime(dateTime);
1370 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1371 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1372 pGroupItemClass->SetStartTime(dateTime);
1373 __pGroupData->Add(*pGroupItemClass);
1376 pGroupItemClass = new(std::nothrow) GroupItemClass();
1377 if (pGroupItemClass == null)
1381 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1382 pGroupItemClass->SetTitleText(titleText);
1383 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1384 pGroupItemClass->SetEndTime(dateTime);
1385 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1386 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1387 pGroupItemClass->SetStartTime(dateTime);
1388 __pGroupData->Add(*pGroupItemClass);
1390 pGroupItemClass = new(std::nothrow) GroupItemClass();
1391 if (pGroupItemClass == null)
1395 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1396 pGroupItemClass->SetTitleText(titleText);
1397 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1398 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1399 pGroupItemClass->SetEndTime(dateTime);
1400 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1401 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1402 pGroupItemClass->SetStartTime(dateTime);
1403 __pGroupData->Add(*pGroupItemClass);
1405 pGroupItemClass = new(std::nothrow) GroupItemClass();
1406 if (pGroupItemClass == null)
1410 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1411 pGroupItemClass->SetTitleText(titleText);
1412 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1413 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1414 pGroupItemClass->SetEndTime(dateTime);
1415 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1416 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1417 pGroupItemClass->SetStartTime(dateTime);
1418 __pGroupData->Add(*pGroupItemClass);
1420 pGroupItemClass = new(std::nothrow) GroupItemClass();
1421 if (pGroupItemClass == null)
1425 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1426 pGroupItemClass->SetTitleText(titleText);
1427 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1428 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1429 pGroupItemClass->SetEndTime(dateTime);
1430 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1431 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1432 pGroupItemClass->SetStartTime(dateTime);
1433 __pGroupData->Add(*pGroupItemClass);
1436 pGroupItemClass = new(std::nothrow) GroupItemClass();
1437 if (pGroupItemClass == null)
1441 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1442 pGroupItemClass->SetTitleText(titleText);
1443 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1444 pGroupItemClass->SetEndTime(dateTime);
1445 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1446 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1447 pGroupItemClass->SetStartTime(dateTime);
1448 __pGroupData->Add(*pGroupItemClass);
1450 pGroupItemClass = new(std::nothrow) GroupItemClass();
1451 if (pGroupItemClass == null)
1455 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1456 pGroupItemClass->SetTitleText(titleText);
1457 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1458 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1459 pGroupItemClass->SetEndTime(dateTime);
1460 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1461 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1462 pGroupItemClass->SetStartTime(dateTime);
1463 __pGroupData->Add(*pGroupItemClass);
1465 pGroupItemClass = new(std::nothrow) GroupItemClass();
1466 if (pGroupItemClass == null)
1470 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1471 pGroupItemClass->SetTitleText(titleText);
1472 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1473 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1474 pGroupItemClass->SetEndTime(dateTime);
1475 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1476 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1477 pGroupItemClass->SetStartTime(dateTime);
1478 __pGroupData->Add(*pGroupItemClass);
1480 pGroupItemClass = new(std::nothrow) GroupItemClass();
1481 if (pGroupItemClass == null)
1485 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1486 pGroupItemClass->SetTitleText(titleText);
1487 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1488 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1489 pGroupItemClass->SetEndTime(dateTime);
1490 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1491 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1492 pGroupItemClass->SetStartTime(dateTime);
1493 __pGroupData->Add(*pGroupItemClass);
1495 pGroupItemClass = new(std::nothrow) GroupItemClass();
1496 if (pGroupItemClass == null)
1500 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1501 pGroupItemClass->SetTitleText(titleText);
1502 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1503 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1504 pGroupItemClass->SetEndTime(dateTime);
1505 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1506 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1507 pGroupItemClass->SetStartTime(dateTime);
1508 __pGroupData->Add(*pGroupItemClass);
1511 pGroupItemClass = new(std::nothrow) GroupItemClass();
1512 if (pGroupItemClass == null)
1516 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1517 pGroupItemClass->SetTitleText(titleText);
1518 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1519 pGroupItemClass->SetEndTime(dateTime);
1520 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1521 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1522 pGroupItemClass->SetStartTime(dateTime);
1523 __pGroupData->Add(*pGroupItemClass);
1525 pGroupItemClass = new(std::nothrow) GroupItemClass();
1526 if (pGroupItemClass == null)
1530 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1531 pGroupItemClass->SetTitleText(titleText);
1532 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1533 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1534 pGroupItemClass->SetEndTime(dateTime);
1535 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1536 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1537 pGroupItemClass->SetStartTime(dateTime);
1538 __pGroupData->Add(*pGroupItemClass);
1540 pGroupItemClass = new(std::nothrow) GroupItemClass();
1541 if (pGroupItemClass == null)
1545 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1546 pGroupItemClass->SetTitleText(titleText);
1547 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1548 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1549 pGroupItemClass->SetEndTime(dateTime);
1550 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1551 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1552 pGroupItemClass->SetStartTime(dateTime);
1553 __pGroupData->Add(*pGroupItemClass);
1555 pGroupItemClass = new(std::nothrow) GroupItemClass();
1556 if (pGroupItemClass == null)
1560 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1561 pGroupItemClass->SetTitleText(titleText);
1562 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1563 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1564 pGroupItemClass->SetEndTime(dateTime);
1565 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1566 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1567 pGroupItemClass->SetStartTime(dateTime);
1568 __pGroupData->Add(*pGroupItemClass);
1570 pGroupItemClass = new(std::nothrow) GroupItemClass();
1571 if (pGroupItemClass == null)
1575 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1576 pGroupItemClass->SetTitleText(titleText);
1577 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1578 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1579 pGroupItemClass->SetEndTime(dateTime);
1580 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1581 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1582 pGroupItemClass->SetStartTime(dateTime);
1583 __pGroupData->Add(*pGroupItemClass);
1585 pGroupItemClass = new(std::nothrow) GroupItemClass();
1586 if (pGroupItemClass == null)
1590 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_WEEK");
1591 pGroupItemClass->SetTitleText(titleText);
1592 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1593 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1594 pGroupItemClass->SetEndTime(dateTime);
1595 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1596 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1597 pGroupItemClass->SetStartTime(dateTime);
1598 __pGroupData->Add(*pGroupItemClass);
1604 day = currentTime.GetDay();
1608 pGroupItemClass = new(std::nothrow) GroupItemClass();
1609 if (pGroupItemClass == null)
1614 pGroupItemClass->SetTitleText(weeksAgo2);
1615 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1616 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1617 pGroupItemClass->SetEndTime(dateTime);
1618 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1619 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1620 pGroupItemClass->SetStartTime(dateTime);
1621 __pGroupData->Add(*pGroupItemClass);
1623 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1625 pGroupItemClass = new(std::nothrow) GroupItemClass();
1626 if (pGroupItemClass == null)
1630 String weeksAgo3 = L"";
1631 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_BR_BODY_PD_WEEKS_AGO").GetPointer(),3);
1632 pGroupItemClass->SetTitleText(weeksAgo3);
1633 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1634 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1635 pGroupItemClass->SetEndTime(dateTime);
1636 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1637 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1638 pGroupItemClass->SetStartTime(dateTime);
1639 __pGroupData->Add(*pGroupItemClass);
1643 pGroupItemClass = new(std::nothrow) GroupItemClass();
1644 if (pGroupItemClass == null)
1648 pGroupItemClass->SetTitleText(weeksAgo2);
1649 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1650 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1651 pGroupItemClass->SetEndTime(dateTime);
1652 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1653 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1654 pGroupItemClass->SetStartTime(dateTime);
1655 __pGroupData->Add(*pGroupItemClass);
1657 pGroupItemClass = new(std::nothrow) GroupItemClass();
1658 if (pGroupItemClass == null)
1663 pGroupItemClass->SetTitleText(weeksAgo3);
1664 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1665 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1666 pGroupItemClass->SetEndTime(dateTime);
1667 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1668 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1669 pGroupItemClass->SetStartTime(dateTime);
1670 __pGroupData->Add(*pGroupItemClass);
1672 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1674 pGroupItemClass = new(std::nothrow) GroupItemClass();
1675 if (pGroupItemClass == null)
1679 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1680 pGroupItemClass->SetTitleText(titleText);
1681 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1682 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1683 pGroupItemClass->SetEndTime(dateTime);
1684 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1685 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1686 pGroupItemClass->SetStartTime(dateTime);
1687 __pGroupData->Add(*pGroupItemClass);
1691 pGroupItemClass = new(std::nothrow) GroupItemClass();
1692 if (pGroupItemClass == null)
1696 pGroupItemClass->SetTitleText(weeksAgo2);
1697 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1698 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1699 pGroupItemClass->SetEndTime(dateTime);
1700 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1701 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1702 pGroupItemClass->SetStartTime(dateTime);
1703 __pGroupData->Add(*pGroupItemClass);
1705 pGroupItemClass = new(std::nothrow) GroupItemClass();
1706 if (pGroupItemClass == null)
1710 pGroupItemClass->SetTitleText(weeksAgo3);
1711 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1712 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1713 pGroupItemClass->SetEndTime(dateTime);
1714 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1715 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1716 pGroupItemClass->SetStartTime(dateTime);
1717 __pGroupData->Add(*pGroupItemClass);
1719 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1721 pGroupItemClass = new(std::nothrow) GroupItemClass();
1722 if (pGroupItemClass == null)
1726 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1727 pGroupItemClass->SetTitleText(titleText);
1728 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1729 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1730 pGroupItemClass->SetEndTime(dateTime);
1731 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1732 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1733 pGroupItemClass->SetStartTime(dateTime);
1734 __pGroupData->Add(*pGroupItemClass);
1740 pGroupItemClass = new(std::nothrow) GroupItemClass();
1741 if (pGroupItemClass == null)
1745 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1746 pGroupItemClass->SetTitleText(titleText);
1747 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1748 dateTime.AddDays(-1);
1749 pGroupItemClass->SetEndTime(dateTime);
1750 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1751 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1752 pGroupItemClass->SetStartTime(dateTime);
1753 __pGroupData->Add(*pGroupItemClass);
1755 pGroupItemClass = new(std::nothrow) GroupItemClass();
1756 if (pGroupItemClass == null)
1760 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1761 pGroupItemClass->SetTitleText(titleText);
1762 dateTime.SetValue(currentTime.GetYear(),1, 1);
1763 dateTime.AddMonths(currentTime.GetMonth() - 2);
1764 dateTime.AddDays(-1);
1765 pGroupItemClass->SetEndTime(dateTime);
1767 dateTime2.SetValue(0, 0, 0);
1768 pGroupItemClass->SetStartTime(dateTime2);
1769 __pGroupData->Add(*pGroupItemClass);
1773 GroupItemClass::GroupItemClass()
1779 GroupItemClass::operator =(const GroupItemClass& rhs)
1783 __pData = rhs.__pData;
1788 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1790 __pData = groupItem.__pData;
1793 GroupItemClass::~GroupItemClass()
1797 __pData->RemoveAll(true);
1803 GroupItemClass::SetStartTime(DateTime& startTime)
1805 __startTime = startTime;
1809 GroupItemClass::SetEndTime(DateTime& endTime)
1811 __endTime = endTime;
1815 GroupItemClass::SetTitleText(String& titleText)
1817 __titleText = titleText;
1821 GroupItemClass::SetHistoryData(ArrayList* pData)
1827 GroupItemClass::GetStartTime(void)
1833 GroupItemClass::GetEndTime(void)
1839 GroupItemClass::GetTitleText(void)
1845 GroupItemClass::GetHistoryData(void)