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_LISTVIEW_TEXT,CUSTOM_COLOR_LISTVIEW_TEXT,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)
825 AppLog("HistoryListForm::OnSceneActivatedN called");
827 GetHeader()->SetItemSelected(1);
828 // __previousSceneId = previousSceneId;
829 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
832 pList->GetAt(pList->GetCount()-1,__previousSceneId);
835 if(__pBookmarkList != null)
837 __pBookmarkList->RemoveAll(false);
840 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
842 AppLog("HistoryListForm::OnSceneActivatedN called");
843 //GetHeader()->Invalidate(true);
844 if (__pGroupData == null)
846 __pGroupData = new(std::nothrow) ArrayList();
847 __pGroupData->Construct();
849 if (__pGroupedListView != null)
851 __pGroupedListView->UpdateList();
853 if (__isNoHistoryPresent == true)
855 GetFooter()->SetItemEnabled(0, false);
859 GetFooter()->SetItemEnabled(0, true);
865 HistoryPresentationModel::GetCurrentDateTime(endTime);;
867 startTime.SetValue(0,0,0);
868 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
871 __pSearchBar->SetShowState(false);
872 __pSearchBar->Invalidate(true);
876 __pSearchBar->SetShowState(true);
877 __pSearchBar->Invalidate(true);
880 // if (__isNoHistoryPresent == true)
882 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
883 // __pGroupedListView->UpdateList();
886 result r = GetHeader()->SetItemSelected(1);
889 AppLog("HistoryListForm::OnSceneActivatedN header failed %s", GetErrorMessage(r));
900 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
902 AppLog("HistoryListForm::OnSceneDeactivated");
903 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
907 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
913 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
915 GroupItemClass* pGroupItemClass = null;
916 History* pHistory = null;
917 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
918 if (elementId == IDA_FORMAT_BOOKMARK)
920 String toggledUrl = L"";
921 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
922 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
923 if (pGroupItemClass == null)
927 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
928 if (pHistory == null)
932 toggledUrl = pHistory->GetHistoryUrl();
934 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
936 bool bookmarkFound = false;
937 BookmarkData* pBookMark = null;
938 // if(__pBookmarkList != null)
940 // for (int i = 0; i < __pBookmarkList->GetCount(); i++)
942 // pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
943 // if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
945 // bookmarkFound = true;
950 BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(toggledUrl,bookmarkFound);
951 if(bookmarkFound == false)
953 // Add the history in bookmark database
954 result r = E_FAILURE;
955 BookmarkData bookmark;
957 String bookmarkTitle = pHistory->GetHistoryTitle();
959 bookmark.SetBookmarkTitle(bookmarkTitle);
960 bookmark.SetUrl(pHistory->GetHistoryUrl());
961 bookmark.SetFaviconId(pHistory->GetFaviconId());
962 if(pHistory->GetFavIconBuffer())
964 ByteBuffer *pBuffer = new ByteBuffer();
966 pBuffer->Construct(*pHistory->GetFavIconBuffer());
967 bookmark.SetFavIconBuffer(*pBuffer);
969 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
970 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(bookmark);
974 // remove the history from bookmark database
975 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
978 if(__pBookmarkList != null)
980 __pBookmarkList->RemoveAll(false);
981 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
983 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
984 listView.UpdateList();
988 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
989 if (pGroupItemClass == null)
994 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
995 if (pHistory1 == null)
999 SceneManager* pSceneManager = SceneManager::GetInstance();
1000 ArrayList *pArgList = null;
1001 result r = E_SUCCESS;
1002 pArgList = new(std::nothrow) ArrayList();
1003 if (pArgList != null)
1005 r = pArgList->Construct();
1012 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
1013 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
1023 String scneId = L"";
1024 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
1026 if (pSceneManager != null)
1028 AppLog("pSceneManager exists");
1029 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
1032 pArgList->RemoveAll(false);
1045 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
1051 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
1053 result r = E_FAILURE;
1054 if (mode == SEARCH_BAR_MODE_NORMAL)
1056 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1058 __pSearchListView->SetEnabled(true);
1061 r = __pSearchListView->SetShowState(false);
1066 r = __pGroupedListView->SetShowState(true);
1072 __pSearchListView->SetEnabled(true);
1073 if(__pSearchBar != null)
1074 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1076 __searchHistory = false;
1077 r = __pGroupedListView->UpdateList();
1078 if (__isNoHistoryPresent == true)
1080 GetFooter()->SetItemEnabled(0, false);
1084 GetFooter()->SetItemEnabled(0, true);
1086 if(__pSearchBar != null)
1088 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1098 // __pSearchListView->SetEnabled(false);
1099 r = __pSearchListView->SetShowState(true);
1104 __pSearchListView->SetEnabled(false);
1105 r = __pSearchListView->UpdateList();
1110 r = __pGroupedListView->SetShowState(false);
1115 if(__pSearchBar != null)
1117 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1123 HistoryListForm::GetMonth(int month)
1125 String monthValue = L"";
1129 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1132 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1135 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1138 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APRIL"));
1141 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1144 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUNE"));
1147 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1150 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));
1153 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1156 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1159 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1162 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1173 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1175 result r = E_FAILURE;
1176 if (__pSearchBar != null)
1178 __pSearchBar->HideKeypad();
1181 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1183 __pSearchListView->SetEnabled(true);
1184 __searchHistory = true;
1185 __searchText =__pSearchBar->GetText();
1186 AppLog("SearchTextHistory %S errormsg %s",__searchText.GetPointer(),GetErrorMessage(GetLastResult()));
1188 r = __pGroupedListView->SetShowState(false);
1193 r = __pSearchListView->SetShowState(true);
1198 r= __pSearchListView->UpdateList();
1199 if (__isNoHistoryPresent == true)
1201 GetFooter()->SetItemEnabled(0, false);
1205 GetFooter()->SetItemEnabled(0, true);
1207 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1216 __searchHistory = false;
1222 HistoryListForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1224 FloatRectangle clientRect;
1225 clientRect = GetClientAreaBoundsF();
1226 AppLogDebug("SearchBarForm::OnKeypadBoundsChanged ClientBounds(%f, %f, %f, %f)",clientRect.x, clientRect.y, clientRect.width, clientRect.height);
1227 __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1228 __pSearchListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1229 __pGroupedListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1230 // __pGroupedListView->SetEnabled(false);
1235 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1237 result r = E_FAILURE;
1238 if (__pGroupedListView != null)
1240 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1241 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1242 else if(__pSearchBar != null)
1243 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1248 //__pGroupedListView->UpdateList();
1249 if (__pSearchListView != null)
1251 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1257 __pSearchListView->UpdateList();
1259 if(__pSearchBar != null)
1260 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1263 __pGroupedListView->UpdateList();//this change is as suggested by platform team for issue N_SE-52111
1264 // if(__pGroupData != NULL)
1266 // for (int groupIndex = 0; groupIndex < __pGroupData->GetCount(); groupIndex++)
1268 // for (int itemIndex = 0; itemIndex < __pGroupedListView->GetItemCountAt(groupIndex); itemIndex++)
1270 // __pGroupedListView->RefreshList(groupIndex, itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
1276 if (__isNoHistoryPresent == true)
1278 GetFooter()->SetItemEnabled(0, false);
1282 GetFooter()->SetItemEnabled(0, true);
1287 HistoryListForm::OnKeypadWillOpen(Control& source)
1289 GetFooter()->SetShowState(false);
1290 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1291 __pSearchListView->SetEnabled(false);
1292 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1298 HistoryListForm::OnKeypadOpened(Control& source)
1300 // this is added because some time footer is shown when key pad is opened, do not remove
1301 GetFooter()->SetShowState(false);
1302 GetFooter()->Invalidate(true);
1303 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1307 HistoryListForm::OnKeypadClosed(Control& source)
1309 if(Clipboard::GetInstance()->IsPopupVisible() == true)
1313 GetFooter()->SetShowState(true);
1314 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1315 __pSearchListView->Invalidate(false);
1316 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1317 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1322 HistoryListForm::CreateGroupItems()
1324 result r = E_FAILURE;
1325 DateTime currentTime;
1327 GroupItemClass* pGroupItemClass = null;
1330 String weeksAgo2 = L"";
1331 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
1333 String weeksAgo3 = L"";
1334 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1336 if (__pGroupData != null)
1338 __pGroupData->RemoveAll(false);
1339 delete __pGroupData;
1340 __pGroupData = null;
1342 __pGroupData = new(std::nothrow) ArrayList();
1343 if (__pGroupData == null)
1347 r = __pGroupData->Construct();
1350 delete __pGroupData;
1351 __pGroupData = null;
1354 if (__searchHistory == true)
1356 pGroupItemClass = new(std::nothrow) GroupItemClass();
1357 if (pGroupItemClass == null)
1361 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCH");
1362 pGroupItemClass->SetTitleText(titleText);
1363 r = __pGroupData->Add(*pGroupItemClass);
1371 Calendar* pGregorianCalendar = null;
1374 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1375 pGroupItemClass = new(std::nothrow) GroupItemClass();
1376 if (pGroupItemClass == null)
1380 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1381 pGroupItemClass->SetTitleText(titleText);
1382 pGroupItemClass->SetEndTime(currentTime);
1383 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1384 pGroupItemClass->SetStartTime(dateTime);
1385 __pGroupData->Add(*pGroupItemClass);
1388 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1389 if ( pGregorianCalendar != NULL )
1391 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1392 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1393 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1394 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1395 delete pGregorianCalendar;
1400 pGroupItemClass = new(std::nothrow) GroupItemClass();
1401 if (pGroupItemClass == null)
1405 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1406 pGroupItemClass->SetTitleText(titleText);
1407 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1408 pGroupItemClass->SetEndTime(dateTime);
1409 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1410 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1411 pGroupItemClass->SetStartTime(dateTime);
1412 __pGroupData->Add(*pGroupItemClass);
1415 pGroupItemClass = new(std::nothrow) GroupItemClass();
1416 if (pGroupItemClass == null)
1420 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1421 pGroupItemClass->SetTitleText(titleText);
1422 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1423 pGroupItemClass->SetEndTime(dateTime);
1424 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1425 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1426 pGroupItemClass->SetStartTime(dateTime);
1427 __pGroupData->Add(*pGroupItemClass);
1430 pGroupItemClass = new(std::nothrow) GroupItemClass();
1431 if (pGroupItemClass == null)
1435 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1436 pGroupItemClass->SetTitleText(titleText);
1437 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1438 pGroupItemClass->SetEndTime(dateTime);
1439 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1440 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1441 pGroupItemClass->SetStartTime(dateTime);
1442 __pGroupData->Add(*pGroupItemClass);
1444 pGroupItemClass = new(std::nothrow) GroupItemClass();
1445 if (pGroupItemClass == null)
1449 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1450 pGroupItemClass->SetTitleText(titleText);
1451 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1452 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1453 pGroupItemClass->SetEndTime(dateTime);
1454 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1455 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1456 pGroupItemClass->SetStartTime(dateTime);
1457 __pGroupData->Add(*pGroupItemClass);
1460 pGroupItemClass = new(std::nothrow) GroupItemClass();
1461 if (pGroupItemClass == null)
1465 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1466 pGroupItemClass->SetTitleText(titleText);
1467 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1468 pGroupItemClass->SetEndTime(dateTime);
1469 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1470 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1471 pGroupItemClass->SetStartTime(dateTime);
1472 __pGroupData->Add(*pGroupItemClass);
1474 pGroupItemClass = new(std::nothrow) GroupItemClass();
1475 if (pGroupItemClass == null)
1479 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1480 pGroupItemClass->SetTitleText(titleText);
1481 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1482 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1483 pGroupItemClass->SetEndTime(dateTime);
1484 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1485 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1486 pGroupItemClass->SetStartTime(dateTime);
1487 __pGroupData->Add(*pGroupItemClass);
1489 pGroupItemClass = new(std::nothrow) GroupItemClass();
1490 if (pGroupItemClass == null)
1494 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1495 pGroupItemClass->SetTitleText(titleText);
1496 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1497 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1498 pGroupItemClass->SetEndTime(dateTime);
1499 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1500 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1501 pGroupItemClass->SetStartTime(dateTime);
1502 __pGroupData->Add(*pGroupItemClass);
1505 pGroupItemClass = new(std::nothrow) GroupItemClass();
1506 if (pGroupItemClass == null)
1510 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1511 pGroupItemClass->SetTitleText(titleText);
1512 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1513 pGroupItemClass->SetEndTime(dateTime);
1514 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1515 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1516 pGroupItemClass->SetStartTime(dateTime);
1517 __pGroupData->Add(*pGroupItemClass);
1519 pGroupItemClass = new(std::nothrow) GroupItemClass();
1520 if (pGroupItemClass == null)
1524 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1525 pGroupItemClass->SetTitleText(titleText);
1526 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1527 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1528 pGroupItemClass->SetEndTime(dateTime);
1529 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1530 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1531 pGroupItemClass->SetStartTime(dateTime);
1532 __pGroupData->Add(*pGroupItemClass);
1534 pGroupItemClass = new(std::nothrow) GroupItemClass();
1535 if (pGroupItemClass == null)
1539 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1540 pGroupItemClass->SetTitleText(titleText);
1541 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1542 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1543 pGroupItemClass->SetEndTime(dateTime);
1544 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1545 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1546 pGroupItemClass->SetStartTime(dateTime);
1547 __pGroupData->Add(*pGroupItemClass);
1549 pGroupItemClass = new(std::nothrow) GroupItemClass();
1550 if (pGroupItemClass == null)
1554 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1555 pGroupItemClass->SetTitleText(titleText);
1556 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1557 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1558 pGroupItemClass->SetEndTime(dateTime);
1559 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1560 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1561 pGroupItemClass->SetStartTime(dateTime);
1562 __pGroupData->Add(*pGroupItemClass);
1565 pGroupItemClass = new(std::nothrow) GroupItemClass();
1566 if (pGroupItemClass == null)
1570 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1571 pGroupItemClass->SetTitleText(titleText);
1572 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1573 pGroupItemClass->SetEndTime(dateTime);
1574 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1575 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1576 pGroupItemClass->SetStartTime(dateTime);
1577 __pGroupData->Add(*pGroupItemClass);
1579 pGroupItemClass = new(std::nothrow) GroupItemClass();
1580 if (pGroupItemClass == null)
1584 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1585 pGroupItemClass->SetTitleText(titleText);
1586 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1587 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1588 pGroupItemClass->SetEndTime(dateTime);
1589 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1590 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1591 pGroupItemClass->SetStartTime(dateTime);
1592 __pGroupData->Add(*pGroupItemClass);
1594 pGroupItemClass = new(std::nothrow) GroupItemClass();
1595 if (pGroupItemClass == null)
1599 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1600 pGroupItemClass->SetTitleText(titleText);
1601 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1602 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1603 pGroupItemClass->SetEndTime(dateTime);
1604 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1605 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1606 pGroupItemClass->SetStartTime(dateTime);
1607 __pGroupData->Add(*pGroupItemClass);
1609 pGroupItemClass = new(std::nothrow) GroupItemClass();
1610 if (pGroupItemClass == null)
1614 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1615 pGroupItemClass->SetTitleText(titleText);
1616 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1617 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1618 pGroupItemClass->SetEndTime(dateTime);
1619 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1620 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1621 pGroupItemClass->SetStartTime(dateTime);
1622 __pGroupData->Add(*pGroupItemClass);
1624 pGroupItemClass = new(std::nothrow) GroupItemClass();
1625 if (pGroupItemClass == null)
1629 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1630 pGroupItemClass->SetTitleText(titleText);
1631 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1632 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1633 pGroupItemClass->SetEndTime(dateTime);
1634 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1635 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1636 pGroupItemClass->SetStartTime(dateTime);
1637 __pGroupData->Add(*pGroupItemClass);
1640 pGroupItemClass = new(std::nothrow) GroupItemClass();
1641 if (pGroupItemClass == null)
1645 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1646 pGroupItemClass->SetTitleText(titleText);
1647 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1648 pGroupItemClass->SetEndTime(dateTime);
1649 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1650 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1651 pGroupItemClass->SetStartTime(dateTime);
1652 __pGroupData->Add(*pGroupItemClass);
1654 pGroupItemClass = new(std::nothrow) GroupItemClass();
1655 if (pGroupItemClass == null)
1659 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1660 pGroupItemClass->SetTitleText(titleText);
1661 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1662 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1663 pGroupItemClass->SetEndTime(dateTime);
1664 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1665 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1666 pGroupItemClass->SetStartTime(dateTime);
1667 __pGroupData->Add(*pGroupItemClass);
1669 pGroupItemClass = new(std::nothrow) GroupItemClass();
1670 if (pGroupItemClass == null)
1674 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1675 pGroupItemClass->SetTitleText(titleText);
1676 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1677 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1678 pGroupItemClass->SetEndTime(dateTime);
1679 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1680 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1681 pGroupItemClass->SetStartTime(dateTime);
1682 __pGroupData->Add(*pGroupItemClass);
1684 pGroupItemClass = new(std::nothrow) GroupItemClass();
1685 if (pGroupItemClass == null)
1689 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1690 pGroupItemClass->SetTitleText(titleText);
1691 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1692 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1693 pGroupItemClass->SetEndTime(dateTime);
1694 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1695 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1696 pGroupItemClass->SetStartTime(dateTime);
1697 __pGroupData->Add(*pGroupItemClass);
1699 pGroupItemClass = new(std::nothrow) GroupItemClass();
1700 if (pGroupItemClass == null)
1704 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1705 pGroupItemClass->SetTitleText(titleText);
1706 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1707 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1708 pGroupItemClass->SetEndTime(dateTime);
1709 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1710 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1711 pGroupItemClass->SetStartTime(dateTime);
1712 __pGroupData->Add(*pGroupItemClass);
1714 pGroupItemClass = new(std::nothrow) GroupItemClass();
1715 if (pGroupItemClass == null)
1719 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1720 pGroupItemClass->SetTitleText(titleText);
1721 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1722 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1723 pGroupItemClass->SetEndTime(dateTime);
1724 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1725 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1726 pGroupItemClass->SetStartTime(dateTime);
1727 __pGroupData->Add(*pGroupItemClass);
1733 day = currentTime.GetDay();
1737 pGroupItemClass = new(std::nothrow) GroupItemClass();
1738 if (pGroupItemClass == null)
1743 pGroupItemClass->SetTitleText(weeksAgo2);
1744 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1745 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1746 pGroupItemClass->SetEndTime(dateTime);
1747 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1748 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1749 pGroupItemClass->SetStartTime(dateTime);
1750 __pGroupData->Add(*pGroupItemClass);
1752 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1754 pGroupItemClass = new(std::nothrow) GroupItemClass();
1755 if (pGroupItemClass == null)
1759 String weeksAgo3 = L"";
1760 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1761 pGroupItemClass->SetTitleText(weeksAgo3);
1762 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1763 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1764 pGroupItemClass->SetEndTime(dateTime);
1765 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1766 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1767 pGroupItemClass->SetStartTime(dateTime);
1768 __pGroupData->Add(*pGroupItemClass);
1772 pGroupItemClass = new(std::nothrow) GroupItemClass();
1773 if (pGroupItemClass == null)
1777 pGroupItemClass->SetTitleText(weeksAgo2);
1778 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1779 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1780 pGroupItemClass->SetEndTime(dateTime);
1781 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1782 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1783 pGroupItemClass->SetStartTime(dateTime);
1784 __pGroupData->Add(*pGroupItemClass);
1786 pGroupItemClass = new(std::nothrow) GroupItemClass();
1787 if (pGroupItemClass == null)
1792 pGroupItemClass->SetTitleText(weeksAgo3);
1793 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1794 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1795 pGroupItemClass->SetEndTime(dateTime);
1796 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1797 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1798 pGroupItemClass->SetStartTime(dateTime);
1799 __pGroupData->Add(*pGroupItemClass);
1801 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1803 pGroupItemClass = new(std::nothrow) GroupItemClass();
1804 if (pGroupItemClass == null)
1808 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1809 pGroupItemClass->SetTitleText(titleText);
1810 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1811 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1812 pGroupItemClass->SetEndTime(dateTime);
1813 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1814 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1815 pGroupItemClass->SetStartTime(dateTime);
1816 __pGroupData->Add(*pGroupItemClass);
1820 pGroupItemClass = new(std::nothrow) GroupItemClass();
1821 if (pGroupItemClass == null)
1825 pGroupItemClass->SetTitleText(weeksAgo2);
1826 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1827 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1828 pGroupItemClass->SetEndTime(dateTime);
1829 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1830 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1831 pGroupItemClass->SetStartTime(dateTime);
1832 __pGroupData->Add(*pGroupItemClass);
1834 pGroupItemClass = new(std::nothrow) GroupItemClass();
1835 if (pGroupItemClass == null)
1839 pGroupItemClass->SetTitleText(weeksAgo3);
1840 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1841 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1842 pGroupItemClass->SetEndTime(dateTime);
1843 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1844 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1845 pGroupItemClass->SetStartTime(dateTime);
1846 __pGroupData->Add(*pGroupItemClass);
1848 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1850 pGroupItemClass = new(std::nothrow) GroupItemClass();
1851 if (pGroupItemClass == null)
1855 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1856 pGroupItemClass->SetTitleText(titleText);
1857 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1858 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1859 pGroupItemClass->SetEndTime(dateTime);
1860 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1861 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1862 pGroupItemClass->SetStartTime(dateTime);
1863 __pGroupData->Add(*pGroupItemClass);
1869 pGroupItemClass = new(std::nothrow) GroupItemClass();
1870 if (pGroupItemClass == null)
1874 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_MONTH");
1875 pGroupItemClass->SetTitleText(titleText);
1876 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1877 dateTime.AddDays(-1);
1878 pGroupItemClass->SetEndTime(dateTime);
1879 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1880 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1881 pGroupItemClass->SetStartTime(dateTime);
1882 __pGroupData->Add(*pGroupItemClass);
1884 pGroupItemClass = new(std::nothrow) GroupItemClass();
1885 if (pGroupItemClass == null)
1889 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1890 pGroupItemClass->SetTitleText(titleText);
1891 dateTime.SetValue(currentTime.GetYear(),1, 1);
1892 dateTime.AddMonths(currentTime.GetMonth() - 2);
1893 dateTime.AddDays(-1);
1894 pGroupItemClass->SetEndTime(dateTime);
1896 dateTime2.SetValue(0, 0, 0);
1897 pGroupItemClass->SetStartTime(dateTime2);
1898 __pGroupData->Add(*pGroupItemClass);
1902 GroupItemClass::GroupItemClass()
1908 GroupItemClass::operator =(const GroupItemClass& rhs)
1912 __pData = rhs.__pData;
1917 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1919 __pData = groupItem.__pData;
1922 GroupItemClass::~GroupItemClass()
1926 __pData->RemoveAll(true);
1932 GroupItemClass::SetStartTime(DateTime& startTime)
1934 __startTime = startTime;
1938 GroupItemClass::SetEndTime(DateTime& endTime)
1940 __endTime = endTime;
1944 GroupItemClass::SetTitleText(String& titleText)
1946 __titleText = titleText;
1950 GroupItemClass::SetHistoryData(ArrayList* pData)
1956 GroupItemClass::GetStartTime(void)
1962 GroupItemClass::GetEndTime(void)
1968 GroupItemClass::GetTitleText(void)
1974 GroupItemClass::GetHistoryData(void)
1980 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1982 if (__pGroupedListView)
1984 __pGroupedListView->UpdateList();
1986 if (__isNoHistoryPresent == true )
1989 __pSearchBar->SetShowState(false);
1990 GetFooter()->SetItemEnabled(0, false);
1995 __pSearchBar->SetShowState(true);
1996 GetFooter()->SetItemEnabled(0, true);
1998 GetFooter()->Invalidate(true);