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_search_list_icon_favorite.png";
48 static const wchar_t* IDB_TAB_ICON_HISTORY =L"I01_search_list_icon_history.png";
49 static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"00_icon_favorite_on_74x74.png";
50 static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"00_icon_favorite_off_74x74.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);
115 // bool isHwBackButtonExist = false;
116 // Tizen::System::SystemInfo::GetValue(L"http:://tizen.org/feature/input.back.key",isHwBackButtonExist);
118 // SetFormStyle(FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
119 // Setup back event listener
120 SetFormBackEventListener(this);
122 GetHeader()->AddActionEventListener(*this);
123 GetFooter()->AddActionEventListener(*this);
125 // if(isHwBackButtonExist)
127 // GetFooter()->SetBackButtonEnabled(false);
129 AddOrientationEventListener(*this);
130 SettingInfo::AddSettingEventListener(*this);
132 pSceneManager = SceneManager::GetInstance();
133 if (pSceneManager != null)
135 pSceneManager->AddSceneEventListener(IDSCN_HISTORY_LIST, *this);
138 __fontSize = CommonUtil::GetFontSize();
139 if (pAppResource == null)
144 __pGroupedListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1"));
145 if (__pGroupedListView == null)
150 r = __pGroupedListView->SetItemProvider(*this);
157 __pSearchBar = static_cast< SearchBar* >(GetControl(L"IDC_SEARCHBAR1"));
158 if (__pSearchBar == null)
162 __pSearchBar->AddFocusEventListener(*this);
163 __pSearchListView = new(std::nothrow) GroupedListView();
164 if (__pSearchListView == null)
169 __pGroupedListView->AddGroupedListViewItemEventListener(*this);
170 r = __pGroupedListView->SetBounds(Rectangle(0,__pGroupedListView->GetY(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
175 r = __pSearchListView->Construct(Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height -__pSearchBar->GetHeight() - __pSearchBar->GetY()), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
180 r = __pSearchListView->SetItemProvider(*this);
185 r = __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND"));
192 __pSearchListView->SetBackgroundColor(GetBackgroundColor());
193 __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK));
194 __pSearchListView->AddGroupedListViewItemEventListener(*this);
195 r = __pSearchListView->SetShowState(false);
202 __pSearchBar->AddSearchBarEventListener(*this);
203 __pSearchBar->AddKeypadEventListener(*this);
204 r = __pSearchBar->SetContent(__pSearchListView);
208 pHeader->SetStyle(HEADER_STYLE_TAB);
209 bookmark.Construct(IDA_TABBAR_ITEM_1);
211 pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark);
212 bookmark.SetText(strbookmark);
213 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARKS);
214 bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
215 bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
216 pHeader->AddItem(bookmark);
224 history.Construct(IDA_TABBAR_ITEM_2);
226 pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory);
227 history.SetText(strhistory);
228 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY);
229 history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
230 history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
231 pHeader->AddItem(history);
232 pHeader->SetItemSelected(1);
233 pHeader->SetTabEditModeEnabled(false);
235 if (pIconBitmap != NULL)
241 __pBookmarkList = new(std::nothrow) Collection::ArrayList();
242 __pBookmarkList->Construct();
243 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
248 HistoryListForm::OnTerminating(void)
250 result r = E_SUCCESS;
252 SettingInfo::RemoveSettingEventListener(*this);
257 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
259 AppLog("HistoryListForm::OnActionPerformed");
260 result r = E_FAILURE;
261 SceneManager* pSceneManager = SceneManager::GetInstance();
262 if (pSceneManager == null)
268 case IDA_EDIT_HISTORY_LIST_FORM:
270 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
271 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
278 case IDA_TABBAR_ITEM_1:
280 // result r = GetHeader()->SetItemSelected(1);
281 // AppLog("SetItemSelected result %s",GetErrorMessage(r));
282 // GetHeader()->Invalidate(true);
284 if (pSceneManager != null)
286 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
288 if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)) != E_SUCCESS)
290 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
296 if(pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT))!= E_SUCCESS)
298 AppLogDebug("BookmarkListForm::OnActionPerformed GoBackward failed");
312 HistoryListForm::OnFocusGained(const Tizen::Ui::Control& source)
314 __pSearchListView->SetEnabled(false);
318 HistoryListForm::OnFocusLost(const Tizen::Ui::Control& source)
320 __pSearchListView->SetEnabled(true);
321 __searchHistory = false;
324 HistoryListForm::OnFormBackRequested(Form& source)
326 SceneManager* pSceneManager = SceneManager::GetInstance();
327 if (pSceneManager == null)
331 result r = E_FAILURE;
332 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
334 r = pSceneManager->GoBackward(BackwardSceneTransition());
338 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
342 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
347 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
349 result r = E_FAILURE;
355 GroupItem* pItem = null;
356 GroupItemClass* pGroupItemClass = null;
358 String weeksAgo2 = L"";
359 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
361 String weeksAgo3 = L"";
362 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
364 String weeksAgo4 = L"";
365 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),4);
367 pItem = new(std::nothrow) GroupItem();
372 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
374 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
376 AppLog("CreateGroupItem :: if history is null");
377 r = pItem->Construct(Dimension(itemWidth, 0));
378 __pGroupedListView->SetItemEnabled(groupIndex, -1, false);
383 r = pItem->Construct(Dimension(itemWidth, 48));
385 text = pGroupItemClass->GetTitleText();
387 if (__searchHistory == false)
391 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
394 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
395 if ( pGregorianCalendar != NULL)
397 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
404 delete pGregorianCalendar;
407 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
414 delete pGregorianCalendar;
417 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
424 delete pGregorianCalendar;
427 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
428 if (pGregorianCalendar != NULL)
430 delete pGregorianCalendar;
437 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
440 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
443 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
446 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
449 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
452 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
455 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
463 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
465 text.Append(pGroupItemClass->GetStartTime().GetDay());
467 strMonth = pGroupItemClass->GetStartTime().GetMonth();
468 month = GetMonth(strMonth);
478 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
479 || pGroupItemClass->GetTitleText() == weeksAgo3 || pGroupItemClass->GetTitleText() == weeksAgo4 || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_LAST_MONTH") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
482 text.Append(pGroupItemClass->GetEndTime().GetDay());
484 strMonth = pGroupItemClass->GetEndTime().GetMonth();
485 month = GetMonth(strMonth);
491 r = pItem->SetElement(text, null);
495 AppLogDebug("Failed with %s", GetErrorMessage(r));
498 r = pItem->SetTextSize(32);
504 __pGroupedListView->SetItemEnabled(groupIndex, -1, false);
510 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
512 AppLog("HistoryListForm::CreateItem");
513 result r = E_FAILURE;
514 History* pHistory = null;
515 Bitmap* pBitmap = null;
516 Bitmap* pBookmarkBitmap = null;
517 GroupItemClass* pGroupItemClass = null;
518 CustomItem* pItem = new(std::nothrow) CustomItem();
519 int bookmarkBtnWidth = 0;
522 Image* pImage = null;
523 pImage = new Image();
526 if(__pGroupData == null)
538 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
539 if (pGroupItemClass == null)
545 if (pGroupItemClass->GetHistoryData() == null)
551 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
552 if (pHistory == null)
558 r = pItem->Construct(Dimension(itemWidth, 128 - 44 + __fontSize), LIST_ANNEX_STYLE_NORMAL);
566 ByteBuffer* pFavIconBuffer = null;
567 pFavIconBuffer = pHistory->GetFavIconBuffer();
569 AppLog("BookmarkListForm::CreateItem check 0");
571 if (pFavIconBuffer != null)
573 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is not null");
577 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is null");
580 pBitmap = pImage->DecodeN(*pFavIconBuffer, IMG_FORMAT_PNG, BITMAP_PIXEL_FORMAT_ARGB8888);
582 AppLog("BookmarkListForm::CreateItem check 1");
584 //bitmapId = pHistory->GetFaviconId() ;
585 //pBitmap = pHistory->GetFavIconBitmap();
589 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
593 AppLog("rrrr:: width %d height %d of the faviconbitmap",pBitmap->GetWidth(),pBitmap->GetHeight());
594 r = pItem->AddElement(Rectangle(16, 28 + (__fontSize - 44)/2,72, 72), IDA_FORMAT_ICON, *pBitmap, null);
600 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
604 bool urlFoundInBookmark = false;
606 // if(__pBookmarkList != null)
608 // for (int i = 0; i < __pBookmarkList->GetCount();i++)
610 // BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
611 // if(pBookMark != null && pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
613 // urlFoundInBookmark = true;
618 BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(pHistory->GetHistoryUrl(),urlFoundInBookmark);
619 if (urlFoundInBookmark == true)
621 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
625 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
627 bookmarkBtnWidth = 74;
630 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);
631 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
633 // if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
634 // 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);
636 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);
637 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
638 if ( pBookmarkBitmap != null)
640 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2 +(__fontSize - 44)/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
641 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
642 delete pBookmarkBitmap;
654 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
663 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
665 AppLog("HistoryListForm::DeleteItem");
666 result r = E_FAILURE;
667 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
668 if (pGroupItemClass == null)
673 // if (pGroupItemClass->__pData != null)
675 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
688 HistoryListForm::GetGroupCount(void)
690 __isNoHistoryPresent = true;
692 if (__pGroupData != null)
694 if (__searchHistory == false)
699 HistoryPresentationModel::GetCurrentDateTime(endTime);
701 startTime.SetValue(0,0,0);
703 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
708 return __pGroupData->GetCount();
713 if (__searchText.GetLength() > 0)
715 __searchText.Replace(L"%", L"/%");
716 __searchText.Replace(L"_", L"/_");
718 // String searchText = __pSearchBar->GetText();
719 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
733 HistoryListForm::GetItemCount(int groupIndex)
735 result r = E_FAILURE;
741 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
742 if (pGroupItemClass == null)
746 if (__searchHistory == false)
748 startTime = pGroupItemClass->GetStartTime();
749 endTime = pGroupItemClass->GetEndTime();
750 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
754 //text = __pSearchBar->GetText();
755 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
766 ArrayList* pData = new(std::nothrow) ArrayList();
771 r = pData->Construct();
779 if (__searchHistory == false)
781 startTime = pGroupItemClass->GetStartTime();
782 endTime = pGroupItemClass->GetEndTime();
783 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
784 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
788 //text = __pSearchBar->GetText() ;
789 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
796 pGroupItemClass->SetHistoryData(pData);
799 if (__isNoHistoryPresent == true && count == 0)
801 __isNoHistoryPresent = true;
802 GetFooter()->SetItemEnabled(0, false);
806 __isNoHistoryPresent = false;
807 GetFooter()->SetItemEnabled(0, true);
809 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
810 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
817 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
818 return pGroupItemClass->GetHistoryData()->GetCount();
823 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
826 GetHeader()->SetItemSelected(1);
827 // __previousSceneId = previousSceneId;
828 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
831 pList->GetAt(pList->GetCount()-1,__previousSceneId);
834 if(__pBookmarkList != null)
836 __pBookmarkList->RemoveAll(false);
839 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
841 AppLog("HistoryListForm::OnSceneActivatedN called");
842 //GetHeader()->Invalidate(true);
843 if (__pGroupData == null)
845 __pGroupData = new(std::nothrow) ArrayList();
846 __pGroupData->Construct();
848 if (__pGroupedListView != null)
850 __pGroupedListView->UpdateList();
852 if (__isNoHistoryPresent == true)
854 GetFooter()->SetItemEnabled(0, false);
858 GetFooter()->SetItemEnabled(0, true);
864 HistoryPresentationModel::GetCurrentDateTime(endTime);;
866 startTime.SetValue(0,0,0);
867 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
870 __pSearchBar->SetShowState(false);
871 __pSearchBar->Invalidate(true);
875 __pSearchBar->SetShowState(true);
876 __pSearchBar->Invalidate(true);
879 // if (__isNoHistoryPresent == true)
881 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
882 // __pGroupedListView->UpdateList();
885 result r = GetHeader()->SetItemSelected(1);
888 AppLog("HistoryListForm::OnSceneActivatedN header failed %s", GetErrorMessage(r));
899 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
901 AppLog("HistoryListForm::OnSceneDeactivated");
902 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
906 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
912 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
914 GroupItemClass* pGroupItemClass = null;
915 History* pHistory = null;
916 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
917 if (elementId == IDA_FORMAT_BOOKMARK)
919 String toggledUrl = L"";
920 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
921 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
922 if (pGroupItemClass == null)
926 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
927 if (pHistory == null)
931 toggledUrl = pHistory->GetHistoryUrl();
933 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
935 bool bookmarkFound = false;
936 BookmarkData* pBookMark = null;
937 // if(__pBookmarkList != null)
939 // for (int i = 0; i < __pBookmarkList->GetCount(); i++)
941 // pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
942 // if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
944 // bookmarkFound = true;
949 BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(toggledUrl,bookmarkFound);
950 if(bookmarkFound == false)
952 // Add the history in bookmark database
953 result r = E_FAILURE;
954 BookmarkData bookmark;
956 String bookmarkTitle = pHistory->GetHistoryTitle();
958 bookmark.SetBookmarkTitle(bookmarkTitle);
959 bookmark.SetUrl(pHistory->GetHistoryUrl());
960 bookmark.SetFaviconId(pHistory->GetFaviconId());
961 if(pHistory->GetFavIconBuffer())
963 ByteBuffer *pBuffer = new ByteBuffer();
965 pBuffer->Construct(*pHistory->GetFavIconBuffer());
966 bookmark.SetFavIconBuffer(*pBuffer);
968 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
969 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(bookmark);
973 // remove the history from bookmark database
974 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
977 if(__pBookmarkList != null)
979 __pBookmarkList->RemoveAll(false);
980 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
982 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
983 listView.UpdateList();
987 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
988 if (pGroupItemClass == null)
993 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
994 if (pHistory1 == null)
998 SceneManager* pSceneManager = SceneManager::GetInstance();
999 ArrayList *pArgList = null;
1000 result r = E_SUCCESS;
1001 pArgList = new(std::nothrow) ArrayList();
1002 if (pArgList != null)
1004 r = pArgList->Construct();
1011 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
1012 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
1022 String scneId = L"";
1023 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
1025 if (pSceneManager != null)
1027 AppLog("pSceneManager exists");
1028 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
1031 pArgList->RemoveAll(false);
1044 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
1050 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
1052 result r = E_FAILURE;
1053 if (mode == SEARCH_BAR_MODE_NORMAL)
1055 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1057 __pSearchListView->SetEnabled(true);
1060 r = __pSearchListView->SetShowState(false);
1065 r = __pGroupedListView->SetShowState(true);
1071 __pSearchListView->SetEnabled(true);
1072 if(__pSearchBar != null)
1073 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1075 __searchHistory = false;
1076 r = __pGroupedListView->UpdateList();
1077 if (__isNoHistoryPresent == true)
1079 GetFooter()->SetItemEnabled(0, false);
1083 GetFooter()->SetItemEnabled(0, true);
1085 if(__pSearchBar != null)
1087 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1097 // __pSearchListView->SetEnabled(false);
1098 r = __pSearchListView->SetShowState(true);
1103 __pSearchListView->SetEnabled(false);
1104 r = __pSearchListView->UpdateList();
1109 r = __pGroupedListView->SetShowState(false);
1114 if(__pSearchBar != null)
1116 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1122 HistoryListForm::GetMonth(int month)
1124 String monthValue = L"";
1128 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1131 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1134 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1137 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APRIL"));
1140 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1143 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUNE"));
1146 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1149 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));
1152 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1155 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1158 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1161 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1172 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1174 result r = E_FAILURE;
1175 if (__pSearchBar != null)
1177 __pSearchBar->HideKeypad();
1180 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1182 __pSearchListView->SetEnabled(true);
1183 __searchHistory = true;
1184 __searchText =__pSearchBar->GetText();
1185 AppLog("SearchTextHistory %S errormsg %s",__searchText.GetPointer(),GetErrorMessage(GetLastResult()));
1187 r = __pGroupedListView->SetShowState(false);
1192 r = __pSearchListView->SetShowState(true);
1197 r= __pSearchListView->UpdateList();
1198 if (__isNoHistoryPresent == true)
1200 GetFooter()->SetItemEnabled(0, false);
1204 GetFooter()->SetItemEnabled(0, true);
1206 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1215 __searchHistory = false;
1221 HistoryListForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1223 FloatRectangle clientRect;
1224 clientRect = GetClientAreaBoundsF();
1225 AppLogDebug("SearchBarForm::OnKeypadBoundsChanged ClientBounds(%f, %f, %f, %f)",clientRect.x, clientRect.y, clientRect.width, clientRect.height);
1226 __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1227 __pSearchListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1228 __pGroupedListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1229 // __pGroupedListView->SetEnabled(false);
1234 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1236 result r = E_FAILURE;
1237 if (__pGroupedListView != null)
1239 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1240 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1241 else if(__pSearchBar != null)
1242 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1248 if (__pSearchListView != null)
1250 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1256 __pSearchListView->UpdateList();
1258 if(__pSearchBar != null)
1259 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1262 if(__pGroupData != NULL)
1264 for (int groupIndex = 0; groupIndex < __pGroupData->GetCount(); groupIndex++)
1266 for (int itemIndex = 0; itemIndex < __pGroupedListView->GetItemCountAt(groupIndex); itemIndex++)
1268 __pGroupedListView->RefreshList(groupIndex, itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
1274 if (__isNoHistoryPresent == true)
1276 GetFooter()->SetItemEnabled(0, false);
1280 GetFooter()->SetItemEnabled(0, true);
1285 HistoryListForm::OnKeypadWillOpen(Control& source)
1287 GetFooter()->SetShowState(false);
1288 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1289 __pSearchListView->SetEnabled(false);
1290 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1296 HistoryListForm::OnKeypadOpened(Control& source)
1298 // this is added because some time footer is shown when key pad is opened, do not remove
1299 GetFooter()->SetShowState(false);
1300 GetFooter()->Invalidate(true);
1301 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1305 HistoryListForm::OnKeypadClosed(Control& source)
1307 if(Clipboard::GetInstance()->IsPopupVisible() == true)
1311 GetFooter()->SetShowState(true);
1312 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1313 __pSearchListView->Invalidate(false);
1314 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1315 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1320 HistoryListForm::CreateGroupItems()
1322 result r = E_FAILURE;
1323 DateTime currentTime;
1325 GroupItemClass* pGroupItemClass = null;
1328 String weeksAgo2 = L"";
1329 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
1331 String weeksAgo3 = L"";
1332 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1334 if (__pGroupData != null)
1336 __pGroupData->RemoveAll(false);
1337 delete __pGroupData;
1338 __pGroupData = null;
1340 __pGroupData = new(std::nothrow) ArrayList();
1341 if (__pGroupData == null)
1345 r = __pGroupData->Construct();
1348 delete __pGroupData;
1349 __pGroupData = null;
1352 if (__searchHistory == true)
1354 pGroupItemClass = new(std::nothrow) GroupItemClass();
1355 if (pGroupItemClass == null)
1359 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCH");
1360 pGroupItemClass->SetTitleText(titleText);
1361 r = __pGroupData->Add(*pGroupItemClass);
1369 Calendar* pGregorianCalendar = null;
1372 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1373 pGroupItemClass = new(std::nothrow) GroupItemClass();
1374 if (pGroupItemClass == null)
1378 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1379 pGroupItemClass->SetTitleText(titleText);
1380 pGroupItemClass->SetEndTime(currentTime);
1381 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1382 pGroupItemClass->SetStartTime(dateTime);
1383 __pGroupData->Add(*pGroupItemClass);
1386 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1387 if ( pGregorianCalendar != NULL )
1389 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1390 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1391 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1392 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1393 delete pGregorianCalendar;
1398 pGroupItemClass = new(std::nothrow) GroupItemClass();
1399 if (pGroupItemClass == null)
1403 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1404 pGroupItemClass->SetTitleText(titleText);
1405 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1406 pGroupItemClass->SetEndTime(dateTime);
1407 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1408 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1409 pGroupItemClass->SetStartTime(dateTime);
1410 __pGroupData->Add(*pGroupItemClass);
1413 pGroupItemClass = new(std::nothrow) GroupItemClass();
1414 if (pGroupItemClass == null)
1418 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1419 pGroupItemClass->SetTitleText(titleText);
1420 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1421 pGroupItemClass->SetEndTime(dateTime);
1422 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1423 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1424 pGroupItemClass->SetStartTime(dateTime);
1425 __pGroupData->Add(*pGroupItemClass);
1428 pGroupItemClass = new(std::nothrow) GroupItemClass();
1429 if (pGroupItemClass == null)
1433 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1434 pGroupItemClass->SetTitleText(titleText);
1435 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1436 pGroupItemClass->SetEndTime(dateTime);
1437 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1438 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1439 pGroupItemClass->SetStartTime(dateTime);
1440 __pGroupData->Add(*pGroupItemClass);
1442 pGroupItemClass = new(std::nothrow) GroupItemClass();
1443 if (pGroupItemClass == null)
1447 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1448 pGroupItemClass->SetTitleText(titleText);
1449 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1450 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1451 pGroupItemClass->SetEndTime(dateTime);
1452 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1453 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1454 pGroupItemClass->SetStartTime(dateTime);
1455 __pGroupData->Add(*pGroupItemClass);
1458 pGroupItemClass = new(std::nothrow) GroupItemClass();
1459 if (pGroupItemClass == null)
1463 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1464 pGroupItemClass->SetTitleText(titleText);
1465 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1466 pGroupItemClass->SetEndTime(dateTime);
1467 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1468 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1469 pGroupItemClass->SetStartTime(dateTime);
1470 __pGroupData->Add(*pGroupItemClass);
1472 pGroupItemClass = new(std::nothrow) GroupItemClass();
1473 if (pGroupItemClass == null)
1477 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1478 pGroupItemClass->SetTitleText(titleText);
1479 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1480 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1481 pGroupItemClass->SetEndTime(dateTime);
1482 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1483 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1484 pGroupItemClass->SetStartTime(dateTime);
1485 __pGroupData->Add(*pGroupItemClass);
1487 pGroupItemClass = new(std::nothrow) GroupItemClass();
1488 if (pGroupItemClass == null)
1492 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1493 pGroupItemClass->SetTitleText(titleText);
1494 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1495 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1496 pGroupItemClass->SetEndTime(dateTime);
1497 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1498 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1499 pGroupItemClass->SetStartTime(dateTime);
1500 __pGroupData->Add(*pGroupItemClass);
1503 pGroupItemClass = new(std::nothrow) GroupItemClass();
1504 if (pGroupItemClass == null)
1508 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1509 pGroupItemClass->SetTitleText(titleText);
1510 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1511 pGroupItemClass->SetEndTime(dateTime);
1512 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1513 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1514 pGroupItemClass->SetStartTime(dateTime);
1515 __pGroupData->Add(*pGroupItemClass);
1517 pGroupItemClass = new(std::nothrow) GroupItemClass();
1518 if (pGroupItemClass == null)
1522 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1523 pGroupItemClass->SetTitleText(titleText);
1524 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1525 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1526 pGroupItemClass->SetEndTime(dateTime);
1527 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1528 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1529 pGroupItemClass->SetStartTime(dateTime);
1530 __pGroupData->Add(*pGroupItemClass);
1532 pGroupItemClass = new(std::nothrow) GroupItemClass();
1533 if (pGroupItemClass == null)
1537 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1538 pGroupItemClass->SetTitleText(titleText);
1539 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1540 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1541 pGroupItemClass->SetEndTime(dateTime);
1542 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1543 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1544 pGroupItemClass->SetStartTime(dateTime);
1545 __pGroupData->Add(*pGroupItemClass);
1547 pGroupItemClass = new(std::nothrow) GroupItemClass();
1548 if (pGroupItemClass == null)
1552 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1553 pGroupItemClass->SetTitleText(titleText);
1554 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1555 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1556 pGroupItemClass->SetEndTime(dateTime);
1557 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1558 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1559 pGroupItemClass->SetStartTime(dateTime);
1560 __pGroupData->Add(*pGroupItemClass);
1563 pGroupItemClass = new(std::nothrow) GroupItemClass();
1564 if (pGroupItemClass == null)
1568 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1569 pGroupItemClass->SetTitleText(titleText);
1570 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1571 pGroupItemClass->SetEndTime(dateTime);
1572 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1573 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1574 pGroupItemClass->SetStartTime(dateTime);
1575 __pGroupData->Add(*pGroupItemClass);
1577 pGroupItemClass = new(std::nothrow) GroupItemClass();
1578 if (pGroupItemClass == null)
1582 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1583 pGroupItemClass->SetTitleText(titleText);
1584 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1585 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1586 pGroupItemClass->SetEndTime(dateTime);
1587 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1588 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1589 pGroupItemClass->SetStartTime(dateTime);
1590 __pGroupData->Add(*pGroupItemClass);
1592 pGroupItemClass = new(std::nothrow) GroupItemClass();
1593 if (pGroupItemClass == null)
1597 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1598 pGroupItemClass->SetTitleText(titleText);
1599 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1600 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1601 pGroupItemClass->SetEndTime(dateTime);
1602 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1603 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1604 pGroupItemClass->SetStartTime(dateTime);
1605 __pGroupData->Add(*pGroupItemClass);
1607 pGroupItemClass = new(std::nothrow) GroupItemClass();
1608 if (pGroupItemClass == null)
1612 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1613 pGroupItemClass->SetTitleText(titleText);
1614 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1615 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1616 pGroupItemClass->SetEndTime(dateTime);
1617 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1618 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1619 pGroupItemClass->SetStartTime(dateTime);
1620 __pGroupData->Add(*pGroupItemClass);
1622 pGroupItemClass = new(std::nothrow) GroupItemClass();
1623 if (pGroupItemClass == null)
1627 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1628 pGroupItemClass->SetTitleText(titleText);
1629 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1630 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1631 pGroupItemClass->SetEndTime(dateTime);
1632 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1633 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1634 pGroupItemClass->SetStartTime(dateTime);
1635 __pGroupData->Add(*pGroupItemClass);
1638 pGroupItemClass = new(std::nothrow) GroupItemClass();
1639 if (pGroupItemClass == null)
1643 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1644 pGroupItemClass->SetTitleText(titleText);
1645 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1646 pGroupItemClass->SetEndTime(dateTime);
1647 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1648 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1649 pGroupItemClass->SetStartTime(dateTime);
1650 __pGroupData->Add(*pGroupItemClass);
1652 pGroupItemClass = new(std::nothrow) GroupItemClass();
1653 if (pGroupItemClass == null)
1657 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1658 pGroupItemClass->SetTitleText(titleText);
1659 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1660 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1661 pGroupItemClass->SetEndTime(dateTime);
1662 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1663 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1664 pGroupItemClass->SetStartTime(dateTime);
1665 __pGroupData->Add(*pGroupItemClass);
1667 pGroupItemClass = new(std::nothrow) GroupItemClass();
1668 if (pGroupItemClass == null)
1672 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1673 pGroupItemClass->SetTitleText(titleText);
1674 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1675 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1676 pGroupItemClass->SetEndTime(dateTime);
1677 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1678 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1679 pGroupItemClass->SetStartTime(dateTime);
1680 __pGroupData->Add(*pGroupItemClass);
1682 pGroupItemClass = new(std::nothrow) GroupItemClass();
1683 if (pGroupItemClass == null)
1687 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1688 pGroupItemClass->SetTitleText(titleText);
1689 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1690 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1691 pGroupItemClass->SetEndTime(dateTime);
1692 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1693 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1694 pGroupItemClass->SetStartTime(dateTime);
1695 __pGroupData->Add(*pGroupItemClass);
1697 pGroupItemClass = new(std::nothrow) GroupItemClass();
1698 if (pGroupItemClass == null)
1702 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1703 pGroupItemClass->SetTitleText(titleText);
1704 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1705 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1706 pGroupItemClass->SetEndTime(dateTime);
1707 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1708 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1709 pGroupItemClass->SetStartTime(dateTime);
1710 __pGroupData->Add(*pGroupItemClass);
1712 pGroupItemClass = new(std::nothrow) GroupItemClass();
1713 if (pGroupItemClass == null)
1717 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1718 pGroupItemClass->SetTitleText(titleText);
1719 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1720 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1721 pGroupItemClass->SetEndTime(dateTime);
1722 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1723 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1724 pGroupItemClass->SetStartTime(dateTime);
1725 __pGroupData->Add(*pGroupItemClass);
1731 day = currentTime.GetDay();
1735 pGroupItemClass = new(std::nothrow) GroupItemClass();
1736 if (pGroupItemClass == null)
1741 pGroupItemClass->SetTitleText(weeksAgo2);
1742 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1743 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1744 pGroupItemClass->SetEndTime(dateTime);
1745 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1746 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1747 pGroupItemClass->SetStartTime(dateTime);
1748 __pGroupData->Add(*pGroupItemClass);
1750 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1752 pGroupItemClass = new(std::nothrow) GroupItemClass();
1753 if (pGroupItemClass == null)
1757 String weeksAgo3 = L"";
1758 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1759 pGroupItemClass->SetTitleText(weeksAgo3);
1760 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1761 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1762 pGroupItemClass->SetEndTime(dateTime);
1763 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1764 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1765 pGroupItemClass->SetStartTime(dateTime);
1766 __pGroupData->Add(*pGroupItemClass);
1770 pGroupItemClass = new(std::nothrow) GroupItemClass();
1771 if (pGroupItemClass == null)
1775 pGroupItemClass->SetTitleText(weeksAgo2);
1776 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1777 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1778 pGroupItemClass->SetEndTime(dateTime);
1779 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1780 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1781 pGroupItemClass->SetStartTime(dateTime);
1782 __pGroupData->Add(*pGroupItemClass);
1784 pGroupItemClass = new(std::nothrow) GroupItemClass();
1785 if (pGroupItemClass == null)
1790 pGroupItemClass->SetTitleText(weeksAgo3);
1791 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1792 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1793 pGroupItemClass->SetEndTime(dateTime);
1794 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1795 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1796 pGroupItemClass->SetStartTime(dateTime);
1797 __pGroupData->Add(*pGroupItemClass);
1799 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1801 pGroupItemClass = new(std::nothrow) GroupItemClass();
1802 if (pGroupItemClass == null)
1806 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1807 pGroupItemClass->SetTitleText(titleText);
1808 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1809 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1810 pGroupItemClass->SetEndTime(dateTime);
1811 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1812 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1813 pGroupItemClass->SetStartTime(dateTime);
1814 __pGroupData->Add(*pGroupItemClass);
1818 pGroupItemClass = new(std::nothrow) GroupItemClass();
1819 if (pGroupItemClass == null)
1823 pGroupItemClass->SetTitleText(weeksAgo2);
1824 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1825 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1826 pGroupItemClass->SetEndTime(dateTime);
1827 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1828 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1829 pGroupItemClass->SetStartTime(dateTime);
1830 __pGroupData->Add(*pGroupItemClass);
1832 pGroupItemClass = new(std::nothrow) GroupItemClass();
1833 if (pGroupItemClass == null)
1837 pGroupItemClass->SetTitleText(weeksAgo3);
1838 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1839 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1840 pGroupItemClass->SetEndTime(dateTime);
1841 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1842 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1843 pGroupItemClass->SetStartTime(dateTime);
1844 __pGroupData->Add(*pGroupItemClass);
1846 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1848 pGroupItemClass = new(std::nothrow) GroupItemClass();
1849 if (pGroupItemClass == null)
1853 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1854 pGroupItemClass->SetTitleText(titleText);
1855 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1856 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1857 pGroupItemClass->SetEndTime(dateTime);
1858 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1859 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1860 pGroupItemClass->SetStartTime(dateTime);
1861 __pGroupData->Add(*pGroupItemClass);
1867 pGroupItemClass = new(std::nothrow) GroupItemClass();
1868 if (pGroupItemClass == null)
1872 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_MONTH");
1873 pGroupItemClass->SetTitleText(titleText);
1874 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1875 dateTime.AddDays(-1);
1876 pGroupItemClass->SetEndTime(dateTime);
1877 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1878 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1879 pGroupItemClass->SetStartTime(dateTime);
1880 __pGroupData->Add(*pGroupItemClass);
1882 pGroupItemClass = new(std::nothrow) GroupItemClass();
1883 if (pGroupItemClass == null)
1887 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1888 pGroupItemClass->SetTitleText(titleText);
1889 dateTime.SetValue(currentTime.GetYear(),1, 1);
1890 dateTime.AddMonths(currentTime.GetMonth() - 2);
1891 dateTime.AddDays(-1);
1892 pGroupItemClass->SetEndTime(dateTime);
1894 dateTime2.SetValue(0, 0, 0);
1895 pGroupItemClass->SetStartTime(dateTime2);
1896 __pGroupData->Add(*pGroupItemClass);
1900 GroupItemClass::GroupItemClass()
1906 GroupItemClass::operator =(const GroupItemClass& rhs)
1910 __pData = rhs.__pData;
1915 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1917 __pData = groupItem.__pData;
1920 GroupItemClass::~GroupItemClass()
1924 __pData->RemoveAll(true);
1930 GroupItemClass::SetStartTime(DateTime& startTime)
1932 __startTime = startTime;
1936 GroupItemClass::SetEndTime(DateTime& endTime)
1938 __endTime = endTime;
1942 GroupItemClass::SetTitleText(String& titleText)
1944 __titleText = titleText;
1948 GroupItemClass::SetHistoryData(ArrayList* pData)
1954 GroupItemClass::GetStartTime(void)
1960 GroupItemClass::GetEndTime(void)
1966 GroupItemClass::GetTitleText(void)
1972 GroupItemClass::GetHistoryData(void)
1978 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1980 if (__pGroupedListView)
1982 __pGroupedListView->UpdateList();
1984 if (__isNoHistoryPresent == true )
1987 __pSearchBar->SetShowState(false);
1988 GetFooter()->SetItemEnabled(0, false);
1993 __pSearchBar->SetShowState(true);
1994 GetFooter()->SetItemEnabled(0, true);
1996 GetFooter()->Invalidate(true);