2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (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::Media;
42 using namespace Tizen::Ui;
43 using namespace Tizen::Ui::Controls;
44 using namespace Tizen::Ui::Scenes;
45 using namespace Tizen::System;
47 static const wchar_t* IDB_TAB_ICON_BOOKMARKS = L"I01_tab_icon_bookmarks.png";
48 static const wchar_t* IDB_TAB_ICON_HISTORY = L"I01_tab_icon_history.png";
49 static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png";
50 static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png";
53 const int HistoryListForm::IDA_TABBAR_ITEM_1 = 101;
54 const int HistoryListForm::IDA_TABBAR_ITEM_2 = 102;
55 const int HistoryListForm::IDA_EDIT_HISTORY_LIST_FORM = 103;
56 const int HistoryListForm::IDA_FORMAT_ICON = 104;
57 const int HistoryListForm::IDA_FORMAT_TITLE = 105;
58 const int HistoryListForm::IDA_FORMAT_URL = 106;
59 const int HistoryListForm::IDA_FORMAT_BOOKMARK = 107;
62 HistoryListForm::HistoryListForm(void)
64 __pBookmarkList = null;
65 __pGroupedListView =null;
66 __pSearchListView = null;
69 __pSearchedData = null ;
70 __searchHistory = false;
71 __isNoHistoryPresent = true;
73 __previousSceneId = L"";
76 HistoryListForm::~HistoryListForm(void)
78 if (__pGroupData != null)
80 __pGroupData->RemoveAll(false);
83 if(__pBookmarkList != null)
85 __pBookmarkList->RemoveAll(false);
86 delete __pBookmarkList;
88 if (__pSearchListView)
90 delete __pSearchListView;
91 __pSearchListView = null;
96 HistoryListForm::Initialize(void)
98 Construct(L"IDL_HISTORY_LIST");
104 HistoryListForm::OnInitializing(void)
106 AppLog("HistoryListForm::OnInitializing");
107 result r = E_SUCCESS;
108 SceneManager* pSceneManager = null;
111 Header *pHeader = GetHeader();
112 Bitmap *pIconBitmap = null;
113 AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
114 const Color brown = Color(32, 32, 32, 0xFF);
116 // Setup back event listener
117 SetFormBackEventListener(this);
119 GetHeader()->AddActionEventListener(*this);
120 GetFooter()->AddActionEventListener(*this);
122 AddOrientationEventListener(*this);
123 SettingInfo::AddSettingEventListener(*this);
125 pSceneManager = SceneManager::GetInstance();
126 if (pSceneManager != null)
128 pSceneManager->AddSceneEventListener(IDSCN_HISTORY_LIST, *this);
131 __fontSize = CommonUtil::GetFontSize();
132 if (pAppResource == null)
137 __pGroupedListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1"));
138 if (__pGroupedListView == null)
143 r = __pGroupedListView->SetItemProvider(*this);
150 __pSearchBar = static_cast< SearchBar* >(GetControl(L"IDC_SEARCHBAR1"));
151 if (__pSearchBar == null)
155 __pSearchListView = new(std::nothrow) GroupedListView();
156 if (__pSearchListView == null)
161 __pGroupedListView->AddGroupedListViewItemEventListener(*this);
162 r = __pGroupedListView->SetBounds(Rectangle(0,__pGroupedListView->GetY(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
167 r = __pSearchListView->Construct(Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height -__pSearchBar->GetHeight() - __pSearchBar->GetY()), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
172 r = __pSearchListView->SetItemProvider(*this);
177 r = __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND"));
184 __pSearchListView->SetBackgroundColor(GetBackgroundColor());
185 __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK));
186 __pSearchListView->AddGroupedListViewItemEventListener(*this);
187 r = __pSearchListView->SetShowState(false);
194 __pSearchBar->AddSearchBarEventListener(*this);
195 __pSearchBar->AddKeypadEventListener(*this);
196 r = __pSearchBar->SetContent(__pSearchListView);
200 pHeader->SetStyle(HEADER_STYLE_TAB);
201 bookmark.Construct(IDA_TABBAR_ITEM_1);
203 pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark);
204 bookmark.SetText(strbookmark);
205 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARKS);
206 bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
207 bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
208 pHeader->AddItem(bookmark);
216 history.Construct(IDA_TABBAR_ITEM_2);
218 pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory);
219 history.SetText(strhistory);
220 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY);
221 history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
222 history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
223 pHeader->AddItem(history);
224 pHeader->SetItemSelected(1);
225 pHeader->SetTabEditModeEnabled(false);
227 if (pIconBitmap != NULL)
233 __pBookmarkList = new(std::nothrow) Collection::ArrayList();
234 __pBookmarkList->Construct();
235 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
240 HistoryListForm::OnTerminating(void)
242 result r = E_SUCCESS;
244 SettingInfo::RemoveSettingEventListener(*this);
249 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
251 AppLog("HistoryListForm::OnActionPerformed");
252 result r = E_FAILURE;
253 SceneManager* pSceneManager = SceneManager::GetInstance();
254 if (pSceneManager == null)
260 case IDA_EDIT_HISTORY_LIST_FORM:
262 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
263 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
270 case IDA_TABBAR_ITEM_1:
272 result r = GetHeader()->SetItemSelected(1);
273 AppLog("SetItemSelected result %s",GetErrorMessage(r));
274 GetHeader()->Invalidate(true);
276 if (pSceneManager != null)
278 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
280 if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)) != E_SUCCESS)
282 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
289 if(pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT))!= E_SUCCESS)
291 AppLogDebug("BookmarkListForm::OnActionPerformed GoBackward failed");
297 // r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
310 HistoryListForm::OnFormBackRequested(Form& source)
312 SceneManager* pSceneManager = SceneManager::GetInstance();
313 if (pSceneManager == null)
317 result r = E_FAILURE;
318 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
320 r = pSceneManager->GoBackward(BackwardSceneTransition());
324 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
328 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
333 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
335 result r = E_FAILURE;
341 GroupItem* pItem = null;
342 GroupItemClass* pGroupItemClass = null;
344 String weeksAgo2 = L"";
345 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
347 String weeksAgo3 = L"";
348 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
350 String weeksAgo4 = L"";
351 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),4);
353 pItem = new(std::nothrow) GroupItem();
358 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
360 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
362 AppLog("CreateGroupItem :: if history is null");
363 r = pItem->Construct(Dimension(itemWidth, 0));
368 r = pItem->Construct(Dimension(itemWidth, 48));
370 text = pGroupItemClass->GetTitleText();
372 if (__searchHistory == false)
376 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
379 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
380 if ( pGregorianCalendar != NULL)
382 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
389 delete pGregorianCalendar;
392 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
399 delete pGregorianCalendar;
402 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
409 delete pGregorianCalendar;
412 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
413 if (pGregorianCalendar != NULL)
415 delete pGregorianCalendar;
422 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
425 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
428 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
431 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
434 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
437 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
440 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
448 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
450 text.Append(pGroupItemClass->GetStartTime().GetDay());
452 strMonth = pGroupItemClass->GetStartTime().GetMonth();
453 month = GetMonth(strMonth);
463 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
464 || 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"))
467 text.Append(pGroupItemClass->GetEndTime().GetDay());
469 strMonth = pGroupItemClass->GetEndTime().GetMonth();
470 month = GetMonth(strMonth);
476 r = pItem->SetElement(text, null);
480 AppLogDebug("Failed with %s", GetErrorMessage(r));
483 r = pItem->SetTextSize(32);
494 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
496 AppLog("HistoryListForm::CreateItem");
497 result r = E_FAILURE;
498 History* pHistory = null;
499 Bitmap* pBitmap = null;
500 Bitmap* pBookmarkBitmap = null;
501 GroupItemClass* pGroupItemClass = null;
502 CustomItem* pItem = new(std::nothrow) CustomItem();
503 int bookmarkBtnWidth = 0;
506 Image* pImage = null;
507 pImage = new Image();
510 if(__pGroupData == null)
520 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
521 if (pGroupItemClass == null)
526 if (pGroupItemClass->GetHistoryData() == null)
531 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
532 if (pHistory == null)
537 r = pItem->Construct(Dimension(itemWidth, 128 - 44 + __fontSize), LIST_ANNEX_STYLE_NORMAL);
544 ByteBuffer* pFavIconBuffer = null;
545 pFavIconBuffer = pHistory->GetFavIconBuffer();
547 AppLog("BookmarkListForm::CreateItem check 0");
549 if (pFavIconBuffer != null)
551 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is not null");
555 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is null");
558 pBitmap = pImage->DecodeN(*pFavIconBuffer, IMG_FORMAT_PNG, BITMAP_PIXEL_FORMAT_ARGB8888);
560 AppLog("BookmarkListForm::CreateItem check 1");
562 //bitmapId = pHistory->GetFaviconId() ;
563 //pBitmap = pHistory->GetFavIconBitmap();
567 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
571 r = pItem->AddElement(Rectangle(16, 28 + (__fontSize - 44)/2,72, 72), IDA_FORMAT_ICON, *pBitmap, null);
576 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
580 bool urlFoundInBookmark = false;
582 if(__pBookmarkList != null)
584 for (int i = 0; i < __pBookmarkList->GetCount();i++)
586 BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
587 if(pBookMark != null && pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
589 urlFoundInBookmark = true;
594 if (urlFoundInBookmark == true)
596 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
600 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
602 bookmarkBtnWidth = 64;
605 r = pItem->AddElement(Rectangle(104, 10, GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 60 - 44 + __fontSize), IDA_FORMAT_TITLE, pHistory->GetHistoryTitle(), __fontSize,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true);
606 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
608 // if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
609 // 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);
611 r = pItem->AddElement(Rectangle(104, 70 - 44 +__fontSize, GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 48), IDA_FORMAT_URL, pHistory->GetHistoryUrl(),32,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,true);
612 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
613 if ( pBookmarkBitmap != null)
615 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2 +(__fontSize - 44)/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
616 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
617 delete pBookmarkBitmap;
628 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
637 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
639 AppLog("HistoryListForm::DeleteItem");
640 result r = E_FAILURE;
641 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
642 if (pGroupItemClass == null)
647 // if (pGroupItemClass->__pData != null)
649 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
662 HistoryListForm::GetGroupCount(void)
664 __isNoHistoryPresent = true;
666 if (__pGroupData != null)
668 if (__searchHistory == false)
673 HistoryPresentationModel::GetCurrentDateTime(endTime);;
675 startTime.SetValue(0,0,0);
677 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
682 return __pGroupData->GetCount();
687 // String searchText = __pSearchBar->GetText();
688 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
702 HistoryListForm::GetItemCount(int groupIndex)
704 result r = E_FAILURE;
710 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
711 if (pGroupItemClass == null)
715 if (__searchHistory == false)
717 startTime = pGroupItemClass->GetStartTime();
718 endTime = pGroupItemClass->GetEndTime();
719 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
723 //text = __pSearchBar->GetText();
724 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
735 ArrayList* pData = new(std::nothrow) ArrayList();
740 r = pData->Construct();
748 if (__searchHistory == false)
750 startTime = pGroupItemClass->GetStartTime();
751 endTime = pGroupItemClass->GetEndTime();
752 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
753 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
757 //text = __pSearchBar->GetText() ;
758 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
765 pGroupItemClass->SetHistoryData(pData);
768 if (__isNoHistoryPresent == true && count == 0)
770 __isNoHistoryPresent = true;
771 GetFooter()->SetItemEnabled(0, false);
775 __isNoHistoryPresent = false;
776 GetFooter()->SetItemEnabled(0, true);
778 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
779 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
786 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
787 return pGroupItemClass->GetHistoryData()->GetCount();
792 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
795 GetHeader()->SetItemSelected(1);
796 // __previousSceneId = previousSceneId;
797 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
800 pList->GetAt(pList->GetCount()-1,__previousSceneId);
803 if(__pBookmarkList != null)
805 __pBookmarkList->RemoveAll(false);
808 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
810 AppLog("HistoryListForm::OnSceneActivatedN called");
811 //GetHeader()->Invalidate(true);
812 if (__pGroupData == null)
814 __pGroupData = new(std::nothrow) ArrayList();
815 __pGroupData->Construct();
817 if (__pGroupedListView != null)
819 __pGroupedListView->UpdateList();
821 if (__isNoHistoryPresent == true)
823 GetFooter()->SetItemEnabled(0, false);
827 GetFooter()->SetItemEnabled(0, true);
831 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
834 __pSearchBar->SetShowState(false);
835 __pSearchBar->Invalidate(true);
839 __pSearchBar->SetShowState(true);
840 __pSearchBar->Invalidate(true);
843 // if (__isNoHistoryPresent == true)
845 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
846 // __pGroupedListView->UpdateList();
849 result r = GetHeader()->SetItemSelected(2);
852 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
863 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
865 AppLog("HistoryListForm::OnSceneDeactivated");
866 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
870 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
876 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
878 GroupItemClass* pGroupItemClass = null;
879 History* pHistory = null;
880 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
881 if (elementId == IDA_FORMAT_BOOKMARK)
883 String toggledUrl = L"";
884 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
885 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
886 if (pGroupItemClass == null)
890 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
891 if (pHistory == null)
895 toggledUrl = pHistory->GetHistoryUrl();
897 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
899 bool bookmarkFound = false;
900 BookmarkData* pBookMark = null;
901 if(__pBookmarkList != null)
903 for (int i = 0; i < __pBookmarkList->GetCount(); i++)
905 pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
906 if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
908 bookmarkFound = true;
913 if(bookmarkFound == false)
915 // Add the history in bookmark database
916 result r = E_FAILURE;
917 BookmarkData bookmark;
919 String bookmarkTitle = pHistory->GetHistoryTitle();
921 bookmark.SetBookmarkTitle(bookmarkTitle);
922 bookmark.SetUrl(pHistory->GetHistoryUrl());
923 bookmark.SetFaviconId(pHistory->GetFaviconId());
924 bookmark.SetFavIconBuffer(*pHistory->GetFavIconBuffer());
925 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
926 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(bookmark);
930 // remove the history from bookmark database
931 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
934 if(__pBookmarkList != null)
936 __pBookmarkList->RemoveAll(false);
937 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
939 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
940 listView.UpdateList();
944 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
945 if (pGroupItemClass == null)
950 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
951 if (pHistory1 == null)
955 SceneManager* pSceneManager = SceneManager::GetInstance();
956 ArrayList *pArgList = null;
957 result r = E_SUCCESS;
958 pArgList = new(std::nothrow) ArrayList();
959 if (pArgList != null)
961 r = pArgList->Construct();
968 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
969 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
980 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
982 if (pSceneManager != null)
984 AppLog("pSceneManager exists");
985 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
988 pArgList->RemoveAll(false);
1001 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
1007 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
1009 result r = E_FAILURE;
1010 if (mode == SEARCH_BAR_MODE_NORMAL)
1012 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1014 __pSearchListView->SetEnabled(true);
1017 r = __pSearchListView->SetShowState(false);
1022 r = __pGroupedListView->SetShowState(true);
1028 __pSearchListView->SetEnabled(true);
1029 if(__pSearchBar != null)
1030 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1032 __searchHistory = false;
1033 r = __pGroupedListView->UpdateList();
1034 if (__isNoHistoryPresent == true)
1036 GetFooter()->SetItemEnabled(0, false);
1040 GetFooter()->SetItemEnabled(0, true);
1042 if(__pSearchBar != null)
1044 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1054 // __pSearchListView->SetEnabled(false);
1055 r = __pSearchListView->SetShowState(true);
1060 __pSearchListView->SetEnabled(false);
1061 r = __pSearchListView->UpdateList();
1066 r = __pGroupedListView->SetShowState(false);
1071 if(__pSearchBar != null)
1073 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1079 HistoryListForm::GetMonth(int month)
1081 String monthValue = L"";
1085 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1088 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1091 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1094 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1097 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1100 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUNE"));
1103 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1106 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));
1109 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1112 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1115 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1118 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1129 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1131 result r = E_FAILURE;
1132 if (__pSearchBar != null)
1134 __pSearchBar->HideKeypad();
1137 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1139 __pSearchListView->SetEnabled(true);
1140 __searchHistory = true;
1141 __searchText =__pSearchBar->GetText();
1142 AppLog("SearchTextHistory %S errormsg %s",__searchText.GetPointer(),GetErrorMessage(GetLastResult()));
1144 r = __pGroupedListView->SetShowState(false);
1149 r = __pSearchListView->SetShowState(true);
1154 r= __pSearchListView->UpdateList();
1155 if (__isNoHistoryPresent == true)
1157 GetFooter()->SetItemEnabled(0, false);
1161 GetFooter()->SetItemEnabled(0, true);
1163 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1172 __searchHistory = false;
1178 HistoryListForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1180 FloatRectangle clientRect;
1181 clientRect = GetClientAreaBoundsF();
1182 AppLogDebug("SearchBarForm::OnKeypadBoundsChanged ClientBounds(%f, %f, %f, %f)",clientRect.x, clientRect.y, clientRect.width, clientRect.height);
1183 __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1184 __pSearchListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1185 __pGroupedListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1186 // __pGroupedListView->SetEnabled(false);
1191 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1193 result r = E_FAILURE;
1194 if (__pGroupedListView != null)
1196 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1197 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1198 else if(__pSearchBar != null)
1199 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1204 __pGroupedListView->UpdateList();
1206 if (__pSearchListView != null)
1208 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1214 __pSearchListView->UpdateList();
1216 if(__pSearchBar != null)
1217 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1222 if (__isNoHistoryPresent == true)
1224 GetFooter()->SetItemEnabled(0, false);
1228 GetFooter()->SetItemEnabled(0, true);
1233 HistoryListForm::OnKeypadWillOpen(Control& source)
1235 GetFooter()->SetShowState(false);
1236 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1237 __pSearchListView->SetEnabled(false);
1238 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1244 HistoryListForm::OnKeypadOpened(Control& source)
1246 // this is added because some time footer is shown when key pad is opened, do not remove
1247 GetFooter()->SetShowState(false);
1248 GetFooter()->Invalidate(true);
1249 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1253 HistoryListForm::OnKeypadClosed(Control& source)
1255 if(Clipboard::GetInstance()->IsPopupVisible() == true)
1259 GetFooter()->SetShowState(true);
1260 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1261 __pSearchListView->Invalidate(false);
1262 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1263 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1268 HistoryListForm::CreateGroupItems()
1270 result r = E_FAILURE;
1271 DateTime currentTime;
1273 GroupItemClass* pGroupItemClass = null;
1276 String weeksAgo2 = L"";
1277 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
1279 String weeksAgo3 = L"";
1280 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1282 if (__pGroupData != null)
1284 __pGroupData->RemoveAll(false);
1285 delete __pGroupData;
1286 __pGroupData = null;
1288 __pGroupData = new(std::nothrow) ArrayList();
1289 if (__pGroupData == null)
1293 r = __pGroupData->Construct();
1296 delete __pGroupData;
1297 __pGroupData = null;
1300 if (__searchHistory == true)
1302 pGroupItemClass = new(std::nothrow) GroupItemClass();
1303 if (pGroupItemClass == null)
1307 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1308 pGroupItemClass->SetTitleText(titleText);
1309 r = __pGroupData->Add(*pGroupItemClass);
1317 Calendar* pGregorianCalendar = null;
1320 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1321 pGroupItemClass = new(std::nothrow) GroupItemClass();
1322 if (pGroupItemClass == null)
1326 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1327 pGroupItemClass->SetTitleText(titleText);
1328 pGroupItemClass->SetEndTime(currentTime);
1329 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1330 pGroupItemClass->SetStartTime(dateTime);
1331 __pGroupData->Add(*pGroupItemClass);
1334 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1335 if ( pGregorianCalendar != NULL )
1337 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1338 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1339 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1340 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1341 delete pGregorianCalendar;
1346 pGroupItemClass = new(std::nothrow) GroupItemClass();
1347 if (pGroupItemClass == null)
1351 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1352 pGroupItemClass->SetTitleText(titleText);
1353 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1354 pGroupItemClass->SetEndTime(dateTime);
1355 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1356 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1357 pGroupItemClass->SetStartTime(dateTime);
1358 __pGroupData->Add(*pGroupItemClass);
1361 pGroupItemClass = new(std::nothrow) GroupItemClass();
1362 if (pGroupItemClass == null)
1366 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1367 pGroupItemClass->SetTitleText(titleText);
1368 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1369 pGroupItemClass->SetEndTime(dateTime);
1370 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1371 dateTime.AddDays(currentTime.GetDay() - 7 - 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_BR_BODY_LAST_WEEK");
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() - 8 - 1);
1402 pGroupItemClass->SetStartTime(dateTime);
1403 __pGroupData->Add(*pGroupItemClass);
1406 pGroupItemClass = new(std::nothrow) GroupItemClass();
1407 if (pGroupItemClass == null)
1411 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1412 pGroupItemClass->SetTitleText(titleText);
1413 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1414 pGroupItemClass->SetEndTime(dateTime);
1415 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1416 dateTime.AddDays(currentTime.GetDay() - 1 - 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_COM_BODY_MON");
1426 pGroupItemClass->SetTitleText(titleText);
1427 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1428 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1429 pGroupItemClass->SetEndTime(dateTime);
1430 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1431 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1432 pGroupItemClass->SetStartTime(dateTime);
1433 __pGroupData->Add(*pGroupItemClass);
1435 pGroupItemClass = new(std::nothrow) GroupItemClass();
1436 if (pGroupItemClass == null)
1440 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1441 pGroupItemClass->SetTitleText(titleText);
1442 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1443 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1444 pGroupItemClass->SetEndTime(dateTime);
1445 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1446 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1447 pGroupItemClass->SetStartTime(dateTime);
1448 __pGroupData->Add(*pGroupItemClass);
1451 pGroupItemClass = new(std::nothrow) GroupItemClass();
1452 if (pGroupItemClass == null)
1456 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1457 pGroupItemClass->SetTitleText(titleText);
1458 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1459 pGroupItemClass->SetEndTime(dateTime);
1460 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1461 dateTime.AddDays(currentTime.GetDay() - 1 - 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() - 1 - 1);
1474 pGroupItemClass->SetEndTime(dateTime);
1475 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1476 dateTime.AddDays(currentTime.GetDay() - 2 - 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() - 2 - 1);
1489 pGroupItemClass->SetEndTime(dateTime);
1490 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1491 dateTime.AddDays(currentTime.GetDay() - 3 - 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_BR_BODY_LAST_WEEK");
1501 pGroupItemClass->SetTitleText(titleText);
1502 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1503 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1504 pGroupItemClass->SetEndTime(dateTime);
1505 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1506 dateTime.AddDays(currentTime.GetDay() - 10 - 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_WED");
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_TUE");
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_MON");
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_BR_BODY_LAST_WEEK");
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() - 11 - 1);
1582 pGroupItemClass->SetStartTime(dateTime);
1583 __pGroupData->Add(*pGroupItemClass);
1586 pGroupItemClass = new(std::nothrow) GroupItemClass();
1587 if (pGroupItemClass == null)
1591 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1592 pGroupItemClass->SetTitleText(titleText);
1593 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1594 pGroupItemClass->SetEndTime(dateTime);
1595 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1596 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1597 pGroupItemClass->SetStartTime(dateTime);
1598 __pGroupData->Add(*pGroupItemClass);
1600 pGroupItemClass = new(std::nothrow) GroupItemClass();
1601 if (pGroupItemClass == null)
1605 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1606 pGroupItemClass->SetTitleText(titleText);
1607 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1608 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1609 pGroupItemClass->SetEndTime(dateTime);
1610 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1611 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1612 pGroupItemClass->SetStartTime(dateTime);
1613 __pGroupData->Add(*pGroupItemClass);
1615 pGroupItemClass = new(std::nothrow) GroupItemClass();
1616 if (pGroupItemClass == null)
1620 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1621 pGroupItemClass->SetTitleText(titleText);
1622 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1623 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1624 pGroupItemClass->SetEndTime(dateTime);
1625 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1626 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1627 pGroupItemClass->SetStartTime(dateTime);
1628 __pGroupData->Add(*pGroupItemClass);
1630 pGroupItemClass = new(std::nothrow) GroupItemClass();
1631 if (pGroupItemClass == null)
1635 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1636 pGroupItemClass->SetTitleText(titleText);
1637 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1638 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1639 pGroupItemClass->SetEndTime(dateTime);
1640 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1641 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1642 pGroupItemClass->SetStartTime(dateTime);
1643 __pGroupData->Add(*pGroupItemClass);
1645 pGroupItemClass = new(std::nothrow) GroupItemClass();
1646 if (pGroupItemClass == null)
1650 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1651 pGroupItemClass->SetTitleText(titleText);
1652 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1653 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1654 pGroupItemClass->SetEndTime(dateTime);
1655 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1656 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1657 pGroupItemClass->SetStartTime(dateTime);
1658 __pGroupData->Add(*pGroupItemClass);
1660 pGroupItemClass = new(std::nothrow) GroupItemClass();
1661 if (pGroupItemClass == null)
1665 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1666 pGroupItemClass->SetTitleText(titleText);
1667 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1668 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1669 pGroupItemClass->SetEndTime(dateTime);
1670 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1671 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1672 pGroupItemClass->SetStartTime(dateTime);
1673 __pGroupData->Add(*pGroupItemClass);
1679 day = currentTime.GetDay();
1683 pGroupItemClass = new(std::nothrow) GroupItemClass();
1684 if (pGroupItemClass == null)
1689 pGroupItemClass->SetTitleText(weeksAgo2);
1690 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1691 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1692 pGroupItemClass->SetEndTime(dateTime);
1693 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1694 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1695 pGroupItemClass->SetStartTime(dateTime);
1696 __pGroupData->Add(*pGroupItemClass);
1698 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1700 pGroupItemClass = new(std::nothrow) GroupItemClass();
1701 if (pGroupItemClass == null)
1705 String weeksAgo3 = L"";
1706 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1707 pGroupItemClass->SetTitleText(weeksAgo3);
1708 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1709 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1710 pGroupItemClass->SetEndTime(dateTime);
1711 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1712 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1713 pGroupItemClass->SetStartTime(dateTime);
1714 __pGroupData->Add(*pGroupItemClass);
1718 pGroupItemClass = new(std::nothrow) GroupItemClass();
1719 if (pGroupItemClass == null)
1723 pGroupItemClass->SetTitleText(weeksAgo2);
1724 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1725 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1726 pGroupItemClass->SetEndTime(dateTime);
1727 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1728 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1729 pGroupItemClass->SetStartTime(dateTime);
1730 __pGroupData->Add(*pGroupItemClass);
1732 pGroupItemClass = new(std::nothrow) GroupItemClass();
1733 if (pGroupItemClass == null)
1738 pGroupItemClass->SetTitleText(weeksAgo3);
1739 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1740 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1741 pGroupItemClass->SetEndTime(dateTime);
1742 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1743 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1744 pGroupItemClass->SetStartTime(dateTime);
1745 __pGroupData->Add(*pGroupItemClass);
1747 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1749 pGroupItemClass = new(std::nothrow) GroupItemClass();
1750 if (pGroupItemClass == null)
1754 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1755 pGroupItemClass->SetTitleText(titleText);
1756 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1757 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1758 pGroupItemClass->SetEndTime(dateTime);
1759 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1760 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1761 pGroupItemClass->SetStartTime(dateTime);
1762 __pGroupData->Add(*pGroupItemClass);
1766 pGroupItemClass = new(std::nothrow) GroupItemClass();
1767 if (pGroupItemClass == null)
1771 pGroupItemClass->SetTitleText(weeksAgo2);
1772 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1773 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1774 pGroupItemClass->SetEndTime(dateTime);
1775 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1776 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1777 pGroupItemClass->SetStartTime(dateTime);
1778 __pGroupData->Add(*pGroupItemClass);
1780 pGroupItemClass = new(std::nothrow) GroupItemClass();
1781 if (pGroupItemClass == null)
1785 pGroupItemClass->SetTitleText(weeksAgo3);
1786 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1787 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1788 pGroupItemClass->SetEndTime(dateTime);
1789 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1790 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1791 pGroupItemClass->SetStartTime(dateTime);
1792 __pGroupData->Add(*pGroupItemClass);
1794 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1796 pGroupItemClass = new(std::nothrow) GroupItemClass();
1797 if (pGroupItemClass == null)
1801 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1802 pGroupItemClass->SetTitleText(titleText);
1803 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1804 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1805 pGroupItemClass->SetEndTime(dateTime);
1806 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1807 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1808 pGroupItemClass->SetStartTime(dateTime);
1809 __pGroupData->Add(*pGroupItemClass);
1815 pGroupItemClass = new(std::nothrow) GroupItemClass();
1816 if (pGroupItemClass == null)
1820 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1821 pGroupItemClass->SetTitleText(titleText);
1822 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1823 dateTime.AddDays(-1);
1824 pGroupItemClass->SetEndTime(dateTime);
1825 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1826 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1827 pGroupItemClass->SetStartTime(dateTime);
1828 __pGroupData->Add(*pGroupItemClass);
1830 pGroupItemClass = new(std::nothrow) GroupItemClass();
1831 if (pGroupItemClass == null)
1835 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1836 pGroupItemClass->SetTitleText(titleText);
1837 dateTime.SetValue(currentTime.GetYear(),1, 1);
1838 dateTime.AddMonths(currentTime.GetMonth() - 2);
1839 dateTime.AddDays(-1);
1840 pGroupItemClass->SetEndTime(dateTime);
1842 dateTime2.SetValue(0, 0, 0);
1843 pGroupItemClass->SetStartTime(dateTime2);
1844 __pGroupData->Add(*pGroupItemClass);
1848 GroupItemClass::GroupItemClass()
1854 GroupItemClass::operator =(const GroupItemClass& rhs)
1858 __pData = rhs.__pData;
1863 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1865 __pData = groupItem.__pData;
1868 GroupItemClass::~GroupItemClass()
1872 __pData->RemoveAll(true);
1878 GroupItemClass::SetStartTime(DateTime& startTime)
1880 __startTime = startTime;
1884 GroupItemClass::SetEndTime(DateTime& endTime)
1886 __endTime = endTime;
1890 GroupItemClass::SetTitleText(String& titleText)
1892 __titleText = titleText;
1896 GroupItemClass::SetHistoryData(ArrayList* pData)
1902 GroupItemClass::GetStartTime(void)
1908 GroupItemClass::GetEndTime(void)
1914 GroupItemClass::GetTitleText(void)
1920 GroupItemClass::GetHistoryData(void)
1926 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1928 if (__pGroupedListView)
1930 __pGroupedListView->UpdateList();