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 r = pItem->AddElement(Rectangle(16, 28 + (__fontSize - 44)/2,72, 72), IDA_FORMAT_ICON, *pBitmap, null);
599 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
603 bool urlFoundInBookmark = false;
605 // if(__pBookmarkList != null)
607 // for (int i = 0; i < __pBookmarkList->GetCount();i++)
609 // BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
610 // if(pBookMark != null && pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
612 // urlFoundInBookmark = true;
617 BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(pHistory->GetHistoryUrl(),urlFoundInBookmark);
618 if (urlFoundInBookmark == true)
620 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
624 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
626 bookmarkBtnWidth = 74;
629 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);
630 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
632 // if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
633 // 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);
635 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);
636 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
637 if ( pBookmarkBitmap != null)
639 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2 +(__fontSize - 44)/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
640 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
641 delete pBookmarkBitmap;
653 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
662 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
664 AppLog("HistoryListForm::DeleteItem");
665 result r = E_FAILURE;
666 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
667 if (pGroupItemClass == null)
672 // if (pGroupItemClass->__pData != null)
674 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
687 HistoryListForm::GetGroupCount(void)
689 __isNoHistoryPresent = true;
691 if (__pGroupData != null)
693 if (__searchHistory == false)
698 HistoryPresentationModel::GetCurrentDateTime(endTime);
700 startTime.SetValue(0,0,0);
702 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
707 return __pGroupData->GetCount();
712 if (__searchText.GetLength() > 0)
714 __searchText.Replace(L"%", L"/%");
715 __searchText.Replace(L"_", L"/_");
717 // String searchText = __pSearchBar->GetText();
718 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
732 HistoryListForm::GetItemCount(int groupIndex)
734 result r = E_FAILURE;
740 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
741 if (pGroupItemClass == null)
745 if (__searchHistory == false)
747 startTime = pGroupItemClass->GetStartTime();
748 endTime = pGroupItemClass->GetEndTime();
749 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
753 //text = __pSearchBar->GetText();
754 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
765 ArrayList* pData = new(std::nothrow) ArrayList();
770 r = pData->Construct();
778 if (__searchHistory == false)
780 startTime = pGroupItemClass->GetStartTime();
781 endTime = pGroupItemClass->GetEndTime();
782 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
783 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
787 //text = __pSearchBar->GetText() ;
788 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
795 pGroupItemClass->SetHistoryData(pData);
798 if (__isNoHistoryPresent == true && count == 0)
800 __isNoHistoryPresent = true;
801 GetFooter()->SetItemEnabled(0, false);
805 __isNoHistoryPresent = false;
806 GetFooter()->SetItemEnabled(0, true);
808 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
809 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
816 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
817 return pGroupItemClass->GetHistoryData()->GetCount();
822 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
825 GetHeader()->SetItemSelected(1);
826 // __previousSceneId = previousSceneId;
827 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
830 pList->GetAt(pList->GetCount()-1,__previousSceneId);
833 if(__pBookmarkList != null)
835 __pBookmarkList->RemoveAll(false);
838 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
840 AppLog("HistoryListForm::OnSceneActivatedN called");
841 //GetHeader()->Invalidate(true);
842 if (__pGroupData == null)
844 __pGroupData = new(std::nothrow) ArrayList();
845 __pGroupData->Construct();
847 if (__pGroupedListView != null)
849 __pGroupedListView->UpdateList();
851 if (__isNoHistoryPresent == true)
853 GetFooter()->SetItemEnabled(0, false);
857 GetFooter()->SetItemEnabled(0, true);
863 HistoryPresentationModel::GetCurrentDateTime(endTime);;
865 startTime.SetValue(0,0,0);
866 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
869 __pSearchBar->SetShowState(false);
870 __pSearchBar->Invalidate(true);
874 __pSearchBar->SetShowState(true);
875 __pSearchBar->Invalidate(true);
878 // if (__isNoHistoryPresent == true)
880 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
881 // __pGroupedListView->UpdateList();
884 result r = GetHeader()->SetItemSelected(1);
887 AppLog("HistoryListForm::OnSceneActivatedN header failed %s", GetErrorMessage(r));
898 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
900 AppLog("HistoryListForm::OnSceneDeactivated");
901 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
905 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
911 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
913 GroupItemClass* pGroupItemClass = null;
914 History* pHistory = null;
915 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
916 if (elementId == IDA_FORMAT_BOOKMARK)
918 String toggledUrl = L"";
919 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
920 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
921 if (pGroupItemClass == null)
925 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
926 if (pHistory == null)
930 toggledUrl = pHistory->GetHistoryUrl();
932 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
934 bool bookmarkFound = false;
935 BookmarkData* pBookMark = null;
936 // if(__pBookmarkList != null)
938 // for (int i = 0; i < __pBookmarkList->GetCount(); i++)
940 // pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
941 // if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
943 // bookmarkFound = true;
948 BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(toggledUrl,bookmarkFound);
949 if(bookmarkFound == false)
951 // Add the history in bookmark database
952 result r = E_FAILURE;
953 BookmarkData bookmark;
955 String bookmarkTitle = pHistory->GetHistoryTitle();
957 bookmark.SetBookmarkTitle(bookmarkTitle);
958 bookmark.SetUrl(pHistory->GetHistoryUrl());
959 bookmark.SetFaviconId(pHistory->GetFaviconId());
960 if(pHistory->GetFavIconBuffer())
962 ByteBuffer *pBuffer = new ByteBuffer();
964 pBuffer->Construct(*pHistory->GetFavIconBuffer());
965 bookmark.SetFavIconBuffer(*pBuffer);
967 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
968 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(bookmark);
972 // remove the history from bookmark database
973 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
976 if(__pBookmarkList != null)
978 __pBookmarkList->RemoveAll(false);
979 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
981 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
982 listView.UpdateList();
986 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
987 if (pGroupItemClass == null)
992 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
993 if (pHistory1 == null)
997 SceneManager* pSceneManager = SceneManager::GetInstance();
998 ArrayList *pArgList = null;
999 result r = E_SUCCESS;
1000 pArgList = new(std::nothrow) ArrayList();
1001 if (pArgList != null)
1003 r = pArgList->Construct();
1010 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
1011 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
1021 String scneId = L"";
1022 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
1024 if (pSceneManager != null)
1026 AppLog("pSceneManager exists");
1027 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
1030 pArgList->RemoveAll(false);
1043 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
1049 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
1051 result r = E_FAILURE;
1052 if (mode == SEARCH_BAR_MODE_NORMAL)
1054 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1056 __pSearchListView->SetEnabled(true);
1059 r = __pSearchListView->SetShowState(false);
1064 r = __pGroupedListView->SetShowState(true);
1070 __pSearchListView->SetEnabled(true);
1071 if(__pSearchBar != null)
1072 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1074 __searchHistory = false;
1075 r = __pGroupedListView->UpdateList();
1076 if (__isNoHistoryPresent == true)
1078 GetFooter()->SetItemEnabled(0, false);
1082 GetFooter()->SetItemEnabled(0, true);
1084 if(__pSearchBar != null)
1086 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1096 // __pSearchListView->SetEnabled(false);
1097 r = __pSearchListView->SetShowState(true);
1102 __pSearchListView->SetEnabled(false);
1103 r = __pSearchListView->UpdateList();
1108 r = __pGroupedListView->SetShowState(false);
1113 if(__pSearchBar != null)
1115 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1121 HistoryListForm::GetMonth(int month)
1123 String monthValue = L"";
1127 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1130 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1133 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1136 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APRIL"));
1139 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1142 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUNE"));
1145 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1148 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));
1151 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1154 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1157 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1160 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1171 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1173 result r = E_FAILURE;
1174 if (__pSearchBar != null)
1176 __pSearchBar->HideKeypad();
1179 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1181 __pSearchListView->SetEnabled(true);
1182 __searchHistory = true;
1183 __searchText =__pSearchBar->GetText();
1184 AppLog("SearchTextHistory %S errormsg %s",__searchText.GetPointer(),GetErrorMessage(GetLastResult()));
1186 r = __pGroupedListView->SetShowState(false);
1191 r = __pSearchListView->SetShowState(true);
1196 r= __pSearchListView->UpdateList();
1197 if (__isNoHistoryPresent == true)
1199 GetFooter()->SetItemEnabled(0, false);
1203 GetFooter()->SetItemEnabled(0, true);
1205 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1214 __searchHistory = false;
1220 HistoryListForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1222 FloatRectangle clientRect;
1223 clientRect = GetClientAreaBoundsF();
1224 AppLogDebug("SearchBarForm::OnKeypadBoundsChanged ClientBounds(%f, %f, %f, %f)",clientRect.x, clientRect.y, clientRect.width, clientRect.height);
1225 __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1226 __pSearchListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1227 __pGroupedListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1228 // __pGroupedListView->SetEnabled(false);
1233 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1235 result r = E_FAILURE;
1236 if (__pGroupedListView != null)
1238 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1239 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1240 else if(__pSearchBar != null)
1241 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1247 if (__pSearchListView != null)
1249 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1255 __pSearchListView->UpdateList();
1257 if(__pSearchBar != null)
1258 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1261 if(__pGroupData != NULL)
1263 for (int groupIndex = 0; groupIndex < __pGroupData->GetCount(); groupIndex++)
1265 for (int itemIndex = 0; itemIndex < __pGroupedListView->GetItemCountAt(groupIndex); itemIndex++)
1267 __pGroupedListView->RefreshList(groupIndex, itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
1273 if (__isNoHistoryPresent == true)
1275 GetFooter()->SetItemEnabled(0, false);
1279 GetFooter()->SetItemEnabled(0, true);
1284 HistoryListForm::OnKeypadWillOpen(Control& source)
1286 GetFooter()->SetShowState(false);
1287 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1288 __pSearchListView->SetEnabled(false);
1289 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1295 HistoryListForm::OnKeypadOpened(Control& source)
1297 // this is added because some time footer is shown when key pad is opened, do not remove
1298 GetFooter()->SetShowState(false);
1299 GetFooter()->Invalidate(true);
1300 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1304 HistoryListForm::OnKeypadClosed(Control& source)
1306 if(Clipboard::GetInstance()->IsPopupVisible() == true)
1310 GetFooter()->SetShowState(true);
1311 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1312 __pSearchListView->Invalidate(false);
1313 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1314 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1319 HistoryListForm::CreateGroupItems()
1321 result r = E_FAILURE;
1322 DateTime currentTime;
1324 GroupItemClass* pGroupItemClass = null;
1327 String weeksAgo2 = L"";
1328 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
1330 String weeksAgo3 = L"";
1331 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1333 if (__pGroupData != null)
1335 __pGroupData->RemoveAll(false);
1336 delete __pGroupData;
1337 __pGroupData = null;
1339 __pGroupData = new(std::nothrow) ArrayList();
1340 if (__pGroupData == null)
1344 r = __pGroupData->Construct();
1347 delete __pGroupData;
1348 __pGroupData = null;
1351 if (__searchHistory == true)
1353 pGroupItemClass = new(std::nothrow) GroupItemClass();
1354 if (pGroupItemClass == null)
1358 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCH");
1359 pGroupItemClass->SetTitleText(titleText);
1360 r = __pGroupData->Add(*pGroupItemClass);
1368 Calendar* pGregorianCalendar = null;
1371 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1372 pGroupItemClass = new(std::nothrow) GroupItemClass();
1373 if (pGroupItemClass == null)
1377 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1378 pGroupItemClass->SetTitleText(titleText);
1379 pGroupItemClass->SetEndTime(currentTime);
1380 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1381 pGroupItemClass->SetStartTime(dateTime);
1382 __pGroupData->Add(*pGroupItemClass);
1385 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1386 if ( pGregorianCalendar != NULL )
1388 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1389 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1390 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1391 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1392 delete pGregorianCalendar;
1397 pGroupItemClass = new(std::nothrow) GroupItemClass();
1398 if (pGroupItemClass == null)
1402 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1403 pGroupItemClass->SetTitleText(titleText);
1404 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1405 pGroupItemClass->SetEndTime(dateTime);
1406 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1407 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1408 pGroupItemClass->SetStartTime(dateTime);
1409 __pGroupData->Add(*pGroupItemClass);
1412 pGroupItemClass = new(std::nothrow) GroupItemClass();
1413 if (pGroupItemClass == null)
1417 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1418 pGroupItemClass->SetTitleText(titleText);
1419 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1420 pGroupItemClass->SetEndTime(dateTime);
1421 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1422 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1423 pGroupItemClass->SetStartTime(dateTime);
1424 __pGroupData->Add(*pGroupItemClass);
1427 pGroupItemClass = new(std::nothrow) GroupItemClass();
1428 if (pGroupItemClass == null)
1432 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1433 pGroupItemClass->SetTitleText(titleText);
1434 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1435 pGroupItemClass->SetEndTime(dateTime);
1436 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1437 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1438 pGroupItemClass->SetStartTime(dateTime);
1439 __pGroupData->Add(*pGroupItemClass);
1441 pGroupItemClass = new(std::nothrow) GroupItemClass();
1442 if (pGroupItemClass == null)
1446 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1447 pGroupItemClass->SetTitleText(titleText);
1448 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1449 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1450 pGroupItemClass->SetEndTime(dateTime);
1451 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1452 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1453 pGroupItemClass->SetStartTime(dateTime);
1454 __pGroupData->Add(*pGroupItemClass);
1457 pGroupItemClass = new(std::nothrow) GroupItemClass();
1458 if (pGroupItemClass == null)
1462 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1463 pGroupItemClass->SetTitleText(titleText);
1464 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1465 pGroupItemClass->SetEndTime(dateTime);
1466 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1467 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1468 pGroupItemClass->SetStartTime(dateTime);
1469 __pGroupData->Add(*pGroupItemClass);
1471 pGroupItemClass = new(std::nothrow) GroupItemClass();
1472 if (pGroupItemClass == null)
1476 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1477 pGroupItemClass->SetTitleText(titleText);
1478 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1479 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1480 pGroupItemClass->SetEndTime(dateTime);
1481 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1482 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1483 pGroupItemClass->SetStartTime(dateTime);
1484 __pGroupData->Add(*pGroupItemClass);
1486 pGroupItemClass = new(std::nothrow) GroupItemClass();
1487 if (pGroupItemClass == null)
1491 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1492 pGroupItemClass->SetTitleText(titleText);
1493 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1494 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1495 pGroupItemClass->SetEndTime(dateTime);
1496 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1497 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1498 pGroupItemClass->SetStartTime(dateTime);
1499 __pGroupData->Add(*pGroupItemClass);
1502 pGroupItemClass = new(std::nothrow) GroupItemClass();
1503 if (pGroupItemClass == null)
1507 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1508 pGroupItemClass->SetTitleText(titleText);
1509 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1510 pGroupItemClass->SetEndTime(dateTime);
1511 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1512 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1513 pGroupItemClass->SetStartTime(dateTime);
1514 __pGroupData->Add(*pGroupItemClass);
1516 pGroupItemClass = new(std::nothrow) GroupItemClass();
1517 if (pGroupItemClass == null)
1521 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1522 pGroupItemClass->SetTitleText(titleText);
1523 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1524 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1525 pGroupItemClass->SetEndTime(dateTime);
1526 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1527 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1528 pGroupItemClass->SetStartTime(dateTime);
1529 __pGroupData->Add(*pGroupItemClass);
1531 pGroupItemClass = new(std::nothrow) GroupItemClass();
1532 if (pGroupItemClass == null)
1536 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1537 pGroupItemClass->SetTitleText(titleText);
1538 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1539 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1540 pGroupItemClass->SetEndTime(dateTime);
1541 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1542 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1543 pGroupItemClass->SetStartTime(dateTime);
1544 __pGroupData->Add(*pGroupItemClass);
1546 pGroupItemClass = new(std::nothrow) GroupItemClass();
1547 if (pGroupItemClass == null)
1551 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1552 pGroupItemClass->SetTitleText(titleText);
1553 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1554 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1555 pGroupItemClass->SetEndTime(dateTime);
1556 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1557 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1558 pGroupItemClass->SetStartTime(dateTime);
1559 __pGroupData->Add(*pGroupItemClass);
1562 pGroupItemClass = new(std::nothrow) GroupItemClass();
1563 if (pGroupItemClass == null)
1567 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1568 pGroupItemClass->SetTitleText(titleText);
1569 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1570 pGroupItemClass->SetEndTime(dateTime);
1571 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1572 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1573 pGroupItemClass->SetStartTime(dateTime);
1574 __pGroupData->Add(*pGroupItemClass);
1576 pGroupItemClass = new(std::nothrow) GroupItemClass();
1577 if (pGroupItemClass == null)
1581 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1582 pGroupItemClass->SetTitleText(titleText);
1583 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1584 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1585 pGroupItemClass->SetEndTime(dateTime);
1586 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1587 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1588 pGroupItemClass->SetStartTime(dateTime);
1589 __pGroupData->Add(*pGroupItemClass);
1591 pGroupItemClass = new(std::nothrow) GroupItemClass();
1592 if (pGroupItemClass == null)
1596 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1597 pGroupItemClass->SetTitleText(titleText);
1598 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1599 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1600 pGroupItemClass->SetEndTime(dateTime);
1601 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1602 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1603 pGroupItemClass->SetStartTime(dateTime);
1604 __pGroupData->Add(*pGroupItemClass);
1606 pGroupItemClass = new(std::nothrow) GroupItemClass();
1607 if (pGroupItemClass == null)
1611 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1612 pGroupItemClass->SetTitleText(titleText);
1613 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1614 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1615 pGroupItemClass->SetEndTime(dateTime);
1616 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1617 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1618 pGroupItemClass->SetStartTime(dateTime);
1619 __pGroupData->Add(*pGroupItemClass);
1621 pGroupItemClass = new(std::nothrow) GroupItemClass();
1622 if (pGroupItemClass == null)
1626 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1627 pGroupItemClass->SetTitleText(titleText);
1628 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1629 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1630 pGroupItemClass->SetEndTime(dateTime);
1631 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1632 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1633 pGroupItemClass->SetStartTime(dateTime);
1634 __pGroupData->Add(*pGroupItemClass);
1637 pGroupItemClass = new(std::nothrow) GroupItemClass();
1638 if (pGroupItemClass == null)
1642 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1643 pGroupItemClass->SetTitleText(titleText);
1644 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1645 pGroupItemClass->SetEndTime(dateTime);
1646 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1647 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1648 pGroupItemClass->SetStartTime(dateTime);
1649 __pGroupData->Add(*pGroupItemClass);
1651 pGroupItemClass = new(std::nothrow) GroupItemClass();
1652 if (pGroupItemClass == null)
1656 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1657 pGroupItemClass->SetTitleText(titleText);
1658 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1659 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1660 pGroupItemClass->SetEndTime(dateTime);
1661 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1662 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1663 pGroupItemClass->SetStartTime(dateTime);
1664 __pGroupData->Add(*pGroupItemClass);
1666 pGroupItemClass = new(std::nothrow) GroupItemClass();
1667 if (pGroupItemClass == null)
1671 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1672 pGroupItemClass->SetTitleText(titleText);
1673 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1674 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1675 pGroupItemClass->SetEndTime(dateTime);
1676 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1677 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1678 pGroupItemClass->SetStartTime(dateTime);
1679 __pGroupData->Add(*pGroupItemClass);
1681 pGroupItemClass = new(std::nothrow) GroupItemClass();
1682 if (pGroupItemClass == null)
1686 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1687 pGroupItemClass->SetTitleText(titleText);
1688 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1689 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1690 pGroupItemClass->SetEndTime(dateTime);
1691 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1692 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1693 pGroupItemClass->SetStartTime(dateTime);
1694 __pGroupData->Add(*pGroupItemClass);
1696 pGroupItemClass = new(std::nothrow) GroupItemClass();
1697 if (pGroupItemClass == null)
1701 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1702 pGroupItemClass->SetTitleText(titleText);
1703 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1704 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1705 pGroupItemClass->SetEndTime(dateTime);
1706 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1707 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1708 pGroupItemClass->SetStartTime(dateTime);
1709 __pGroupData->Add(*pGroupItemClass);
1711 pGroupItemClass = new(std::nothrow) GroupItemClass();
1712 if (pGroupItemClass == null)
1716 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1717 pGroupItemClass->SetTitleText(titleText);
1718 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1719 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1720 pGroupItemClass->SetEndTime(dateTime);
1721 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1722 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1723 pGroupItemClass->SetStartTime(dateTime);
1724 __pGroupData->Add(*pGroupItemClass);
1730 day = currentTime.GetDay();
1734 pGroupItemClass = new(std::nothrow) GroupItemClass();
1735 if (pGroupItemClass == null)
1740 pGroupItemClass->SetTitleText(weeksAgo2);
1741 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1742 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1743 pGroupItemClass->SetEndTime(dateTime);
1744 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1745 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1746 pGroupItemClass->SetStartTime(dateTime);
1747 __pGroupData->Add(*pGroupItemClass);
1749 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1751 pGroupItemClass = new(std::nothrow) GroupItemClass();
1752 if (pGroupItemClass == null)
1756 String weeksAgo3 = L"";
1757 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1758 pGroupItemClass->SetTitleText(weeksAgo3);
1759 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1760 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1761 pGroupItemClass->SetEndTime(dateTime);
1762 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1763 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1764 pGroupItemClass->SetStartTime(dateTime);
1765 __pGroupData->Add(*pGroupItemClass);
1769 pGroupItemClass = new(std::nothrow) GroupItemClass();
1770 if (pGroupItemClass == null)
1774 pGroupItemClass->SetTitleText(weeksAgo2);
1775 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1776 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1777 pGroupItemClass->SetEndTime(dateTime);
1778 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1779 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1780 pGroupItemClass->SetStartTime(dateTime);
1781 __pGroupData->Add(*pGroupItemClass);
1783 pGroupItemClass = new(std::nothrow) GroupItemClass();
1784 if (pGroupItemClass == null)
1789 pGroupItemClass->SetTitleText(weeksAgo3);
1790 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1791 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1792 pGroupItemClass->SetEndTime(dateTime);
1793 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1794 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1795 pGroupItemClass->SetStartTime(dateTime);
1796 __pGroupData->Add(*pGroupItemClass);
1798 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1800 pGroupItemClass = new(std::nothrow) GroupItemClass();
1801 if (pGroupItemClass == null)
1805 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1806 pGroupItemClass->SetTitleText(titleText);
1807 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1808 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1809 pGroupItemClass->SetEndTime(dateTime);
1810 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1811 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1812 pGroupItemClass->SetStartTime(dateTime);
1813 __pGroupData->Add(*pGroupItemClass);
1817 pGroupItemClass = new(std::nothrow) GroupItemClass();
1818 if (pGroupItemClass == null)
1822 pGroupItemClass->SetTitleText(weeksAgo2);
1823 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1824 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1825 pGroupItemClass->SetEndTime(dateTime);
1826 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1827 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1828 pGroupItemClass->SetStartTime(dateTime);
1829 __pGroupData->Add(*pGroupItemClass);
1831 pGroupItemClass = new(std::nothrow) GroupItemClass();
1832 if (pGroupItemClass == null)
1836 pGroupItemClass->SetTitleText(weeksAgo3);
1837 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1838 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1839 pGroupItemClass->SetEndTime(dateTime);
1840 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1841 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1842 pGroupItemClass->SetStartTime(dateTime);
1843 __pGroupData->Add(*pGroupItemClass);
1845 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1847 pGroupItemClass = new(std::nothrow) GroupItemClass();
1848 if (pGroupItemClass == null)
1852 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1853 pGroupItemClass->SetTitleText(titleText);
1854 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1855 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1856 pGroupItemClass->SetEndTime(dateTime);
1857 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1858 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1859 pGroupItemClass->SetStartTime(dateTime);
1860 __pGroupData->Add(*pGroupItemClass);
1866 pGroupItemClass = new(std::nothrow) GroupItemClass();
1867 if (pGroupItemClass == null)
1871 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_MONTH");
1872 pGroupItemClass->SetTitleText(titleText);
1873 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1874 dateTime.AddDays(-1);
1875 pGroupItemClass->SetEndTime(dateTime);
1876 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1877 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1878 pGroupItemClass->SetStartTime(dateTime);
1879 __pGroupData->Add(*pGroupItemClass);
1881 pGroupItemClass = new(std::nothrow) GroupItemClass();
1882 if (pGroupItemClass == null)
1886 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1887 pGroupItemClass->SetTitleText(titleText);
1888 dateTime.SetValue(currentTime.GetYear(),1, 1);
1889 dateTime.AddMonths(currentTime.GetMonth() - 2);
1890 dateTime.AddDays(-1);
1891 pGroupItemClass->SetEndTime(dateTime);
1893 dateTime2.SetValue(0, 0, 0);
1894 pGroupItemClass->SetStartTime(dateTime2);
1895 __pGroupData->Add(*pGroupItemClass);
1899 GroupItemClass::GroupItemClass()
1905 GroupItemClass::operator =(const GroupItemClass& rhs)
1909 __pData = rhs.__pData;
1914 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1916 __pData = groupItem.__pData;
1919 GroupItemClass::~GroupItemClass()
1923 __pData->RemoveAll(true);
1929 GroupItemClass::SetStartTime(DateTime& startTime)
1931 __startTime = startTime;
1935 GroupItemClass::SetEndTime(DateTime& endTime)
1937 __endTime = endTime;
1941 GroupItemClass::SetTitleText(String& titleText)
1943 __titleText = titleText;
1947 GroupItemClass::SetHistoryData(ArrayList* pData)
1953 GroupItemClass::GetStartTime(void)
1959 GroupItemClass::GetEndTime(void)
1965 GroupItemClass::GetTitleText(void)
1971 GroupItemClass::GetHistoryData(void)
1977 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1979 if (__pGroupedListView)
1981 __pGroupedListView->UpdateList();