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"I01_icon_bookmark_on_temp.png";
50 static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png";
53 const int HistoryListForm::IDA_TABBAR_ITEM_1 = 101;
54 const int HistoryListForm::IDA_TABBAR_ITEM_2 = 102;
55 const int HistoryListForm::IDA_EDIT_HISTORY_LIST_FORM = 103;
56 const int HistoryListForm::IDA_FORMAT_ICON = 104;
57 const int HistoryListForm::IDA_FORMAT_TITLE = 105;
58 const int HistoryListForm::IDA_FORMAT_URL = 106;
59 const int HistoryListForm::IDA_FORMAT_BOOKMARK = 107;
62 HistoryListForm::HistoryListForm(void)
64 __pBookmarkList = null;
65 __pGroupedListView =null;
66 __pSearchListView = null;
69 __pSearchedData = null ;
70 __searchHistory = false;
71 __isNoHistoryPresent = true;
73 __previousSceneId = L"";
76 HistoryListForm::~HistoryListForm(void)
78 if (__pGroupData != null)
80 __pGroupData->RemoveAll(false);
83 if(__pBookmarkList != null)
85 __pBookmarkList->RemoveAll(false);
86 delete __pBookmarkList;
88 if (__pSearchListView)
90 delete __pSearchListView;
91 __pSearchListView = null;
96 HistoryListForm::Initialize(void)
98 Construct(L"IDL_HISTORY_LIST");
104 HistoryListForm::OnInitializing(void)
106 AppLog("HistoryListForm::OnInitializing");
107 result r = E_SUCCESS;
108 SceneManager* pSceneManager = null;
111 Header *pHeader = GetHeader();
112 Bitmap *pIconBitmap = null;
113 AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
114 const Color brown = Color(32, 32, 32, 0xFF);
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));
382 r = pItem->Construct(Dimension(itemWidth, 48));
384 text = pGroupItemClass->GetTitleText();
386 if (__searchHistory == false)
390 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
393 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
394 if ( pGregorianCalendar != NULL)
396 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
403 delete pGregorianCalendar;
406 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
413 delete pGregorianCalendar;
416 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
423 delete pGregorianCalendar;
426 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
427 if (pGregorianCalendar != NULL)
429 delete pGregorianCalendar;
436 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
439 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
442 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
445 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
448 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
451 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
454 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
462 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
464 text.Append(pGroupItemClass->GetStartTime().GetDay());
466 strMonth = pGroupItemClass->GetStartTime().GetMonth();
467 month = GetMonth(strMonth);
477 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
478 || 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"))
481 text.Append(pGroupItemClass->GetEndTime().GetDay());
483 strMonth = pGroupItemClass->GetEndTime().GetMonth();
484 month = GetMonth(strMonth);
490 r = pItem->SetElement(text, null);
494 AppLogDebug("Failed with %s", GetErrorMessage(r));
497 r = pItem->SetTextSize(32);
508 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
510 AppLog("HistoryListForm::CreateItem");
511 result r = E_FAILURE;
512 History* pHistory = null;
513 Bitmap* pBitmap = null;
514 Bitmap* pBookmarkBitmap = null;
515 GroupItemClass* pGroupItemClass = null;
516 CustomItem* pItem = new(std::nothrow) CustomItem();
517 int bookmarkBtnWidth = 0;
520 Image* pImage = null;
521 pImage = new Image();
524 if(__pGroupData == null)
534 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
535 if (pGroupItemClass == null)
540 if (pGroupItemClass->GetHistoryData() == null)
545 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
546 if (pHistory == null)
551 r = pItem->Construct(Dimension(itemWidth, 128 - 44 + __fontSize), LIST_ANNEX_STYLE_NORMAL);
558 ByteBuffer* pFavIconBuffer = null;
559 pFavIconBuffer = pHistory->GetFavIconBuffer();
561 AppLog("BookmarkListForm::CreateItem check 0");
563 if (pFavIconBuffer != null)
565 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is not null");
569 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is null");
572 pBitmap = pImage->DecodeN(*pFavIconBuffer, IMG_FORMAT_PNG, BITMAP_PIXEL_FORMAT_ARGB8888);
574 AppLog("BookmarkListForm::CreateItem check 1");
576 //bitmapId = pHistory->GetFaviconId() ;
577 //pBitmap = pHistory->GetFavIconBitmap();
581 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
585 r = pItem->AddElement(Rectangle(16, 28 + (__fontSize - 44)/2,72, 72), IDA_FORMAT_ICON, *pBitmap, null);
590 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
594 bool urlFoundInBookmark = false;
596 // if(__pBookmarkList != null)
598 // for (int i = 0; i < __pBookmarkList->GetCount();i++)
600 // BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
601 // if(pBookMark != null && pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
603 // urlFoundInBookmark = true;
608 BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(pHistory->GetHistoryUrl(),urlFoundInBookmark);
609 if (urlFoundInBookmark == true)
611 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
615 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
617 bookmarkBtnWidth = 64;
620 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);
621 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
623 // if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
624 // 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);
626 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);
627 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
628 if ( pBookmarkBitmap != null)
630 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2 +(__fontSize - 44)/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
631 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
632 delete pBookmarkBitmap;
643 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
652 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
654 AppLog("HistoryListForm::DeleteItem");
655 result r = E_FAILURE;
656 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
657 if (pGroupItemClass == null)
662 // if (pGroupItemClass->__pData != null)
664 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
677 HistoryListForm::GetGroupCount(void)
679 __isNoHistoryPresent = true;
681 if (__pGroupData != null)
683 if (__searchHistory == false)
688 HistoryPresentationModel::GetCurrentDateTime(endTime);
690 startTime.SetValue(0,0,0);
692 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
697 return __pGroupData->GetCount();
702 if (__searchText.GetLength() > 0)
704 __searchText.Replace(L"%", L"/%");
705 __searchText.Replace(L"_", L"/_");
707 // String searchText = __pSearchBar->GetText();
708 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
722 HistoryListForm::GetItemCount(int groupIndex)
724 result r = E_FAILURE;
730 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
731 if (pGroupItemClass == null)
735 if (__searchHistory == false)
737 startTime = pGroupItemClass->GetStartTime();
738 endTime = pGroupItemClass->GetEndTime();
739 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
743 //text = __pSearchBar->GetText();
744 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
755 ArrayList* pData = new(std::nothrow) ArrayList();
760 r = pData->Construct();
768 if (__searchHistory == false)
770 startTime = pGroupItemClass->GetStartTime();
771 endTime = pGroupItemClass->GetEndTime();
772 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
773 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
777 //text = __pSearchBar->GetText() ;
778 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
785 pGroupItemClass->SetHistoryData(pData);
788 if (__isNoHistoryPresent == true && count == 0)
790 __isNoHistoryPresent = true;
791 GetFooter()->SetItemEnabled(0, false);
795 __isNoHistoryPresent = false;
796 GetFooter()->SetItemEnabled(0, true);
798 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
799 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
806 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
807 return pGroupItemClass->GetHistoryData()->GetCount();
812 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
815 GetHeader()->SetItemSelected(1);
816 // __previousSceneId = previousSceneId;
817 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
820 pList->GetAt(pList->GetCount()-1,__previousSceneId);
823 if(__pBookmarkList != null)
825 __pBookmarkList->RemoveAll(false);
828 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
830 AppLog("HistoryListForm::OnSceneActivatedN called");
831 //GetHeader()->Invalidate(true);
832 if (__pGroupData == null)
834 __pGroupData = new(std::nothrow) ArrayList();
835 __pGroupData->Construct();
837 if (__pGroupedListView != null)
839 __pGroupedListView->UpdateList();
841 if (__isNoHistoryPresent == true)
843 GetFooter()->SetItemEnabled(0, false);
847 GetFooter()->SetItemEnabled(0, true);
853 HistoryPresentationModel::GetCurrentDateTime(endTime);;
855 startTime.SetValue(0,0,0);
856 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
859 __pSearchBar->SetShowState(false);
860 __pSearchBar->Invalidate(true);
864 __pSearchBar->SetShowState(true);
865 __pSearchBar->Invalidate(true);
868 // if (__isNoHistoryPresent == true)
870 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
871 // __pGroupedListView->UpdateList();
874 result r = GetHeader()->SetItemSelected(1);
877 AppLog("HistoryListForm::OnSceneActivatedN header failed %s", GetErrorMessage(r));
888 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
890 AppLog("HistoryListForm::OnSceneDeactivated");
891 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
895 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
901 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
903 GroupItemClass* pGroupItemClass = null;
904 History* pHistory = null;
905 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
906 if (elementId == IDA_FORMAT_BOOKMARK)
908 String toggledUrl = L"";
909 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
910 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
911 if (pGroupItemClass == null)
915 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
916 if (pHistory == null)
920 toggledUrl = pHistory->GetHistoryUrl();
922 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
924 bool bookmarkFound = false;
925 BookmarkData* pBookMark = null;
926 // if(__pBookmarkList != null)
928 // for (int i = 0; i < __pBookmarkList->GetCount(); i++)
930 // pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
931 // if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
933 // bookmarkFound = true;
938 BookmarkPresentationModel::GetInstance()->DoesBookmarkExist(toggledUrl,bookmarkFound);
939 if(bookmarkFound == false)
941 // Add the history in bookmark database
942 result r = E_FAILURE;
943 BookmarkData bookmark;
945 String bookmarkTitle = pHistory->GetHistoryTitle();
947 bookmark.SetBookmarkTitle(bookmarkTitle);
948 bookmark.SetUrl(pHistory->GetHistoryUrl());
949 bookmark.SetFaviconId(pHistory->GetFaviconId());
950 if(pHistory->GetFavIconBuffer())
952 ByteBuffer *pBuffer = new ByteBuffer();
954 pBuffer->Construct(*pHistory->GetFavIconBuffer());
955 bookmark.SetFavIconBuffer(*pBuffer);
957 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
958 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(bookmark);
962 // remove the history from bookmark database
963 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
966 if(__pBookmarkList != null)
968 __pBookmarkList->RemoveAll(false);
969 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
971 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
972 listView.UpdateList();
976 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
977 if (pGroupItemClass == null)
982 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
983 if (pHistory1 == null)
987 SceneManager* pSceneManager = SceneManager::GetInstance();
988 ArrayList *pArgList = null;
989 result r = E_SUCCESS;
990 pArgList = new(std::nothrow) ArrayList();
991 if (pArgList != null)
993 r = pArgList->Construct();
1000 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
1001 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
1011 String scneId = L"";
1012 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
1014 if (pSceneManager != null)
1016 AppLog("pSceneManager exists");
1017 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
1020 pArgList->RemoveAll(false);
1033 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
1039 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
1041 result r = E_FAILURE;
1042 if (mode == SEARCH_BAR_MODE_NORMAL)
1044 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1046 __pSearchListView->SetEnabled(true);
1049 r = __pSearchListView->SetShowState(false);
1054 r = __pGroupedListView->SetShowState(true);
1060 __pSearchListView->SetEnabled(true);
1061 if(__pSearchBar != null)
1062 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1064 __searchHistory = false;
1065 r = __pGroupedListView->UpdateList();
1066 if (__isNoHistoryPresent == true)
1068 GetFooter()->SetItemEnabled(0, false);
1072 GetFooter()->SetItemEnabled(0, true);
1074 if(__pSearchBar != null)
1076 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1086 // __pSearchListView->SetEnabled(false);
1087 r = __pSearchListView->SetShowState(true);
1092 __pSearchListView->SetEnabled(false);
1093 r = __pSearchListView->UpdateList();
1098 r = __pGroupedListView->SetShowState(false);
1103 if(__pSearchBar != null)
1105 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1111 HistoryListForm::GetMonth(int month)
1113 String monthValue = L"";
1117 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1120 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1123 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1126 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APRIL"));
1129 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1132 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUNE"));
1135 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1138 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));
1141 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1144 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1147 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1150 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1161 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1163 result r = E_FAILURE;
1164 if (__pSearchBar != null)
1166 __pSearchBar->HideKeypad();
1169 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1171 __pSearchListView->SetEnabled(true);
1172 __searchHistory = true;
1173 __searchText =__pSearchBar->GetText();
1174 AppLog("SearchTextHistory %S errormsg %s",__searchText.GetPointer(),GetErrorMessage(GetLastResult()));
1176 r = __pGroupedListView->SetShowState(false);
1181 r = __pSearchListView->SetShowState(true);
1186 r= __pSearchListView->UpdateList();
1187 if (__isNoHistoryPresent == true)
1189 GetFooter()->SetItemEnabled(0, false);
1193 GetFooter()->SetItemEnabled(0, true);
1195 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1204 __searchHistory = false;
1210 HistoryListForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1212 FloatRectangle clientRect;
1213 clientRect = GetClientAreaBoundsF();
1214 AppLogDebug("SearchBarForm::OnKeypadBoundsChanged ClientBounds(%f, %f, %f, %f)",clientRect.x, clientRect.y, clientRect.width, clientRect.height);
1215 __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1216 __pSearchListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1217 __pGroupedListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1218 // __pGroupedListView->SetEnabled(false);
1223 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1225 result r = E_FAILURE;
1226 if (__pGroupedListView != null)
1228 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1229 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1230 else if(__pSearchBar != null)
1231 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1236 __pGroupedListView->UpdateList();
1238 if (__pSearchListView != null)
1240 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1246 __pSearchListView->UpdateList();
1248 if(__pSearchBar != null)
1249 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1254 if (__isNoHistoryPresent == true)
1256 GetFooter()->SetItemEnabled(0, false);
1260 GetFooter()->SetItemEnabled(0, true);
1265 HistoryListForm::OnKeypadWillOpen(Control& source)
1267 GetFooter()->SetShowState(false);
1268 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1269 __pSearchListView->SetEnabled(false);
1270 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1276 HistoryListForm::OnKeypadOpened(Control& source)
1278 // this is added because some time footer is shown when key pad is opened, do not remove
1279 GetFooter()->SetShowState(false);
1280 GetFooter()->Invalidate(true);
1281 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1285 HistoryListForm::OnKeypadClosed(Control& source)
1287 if(Clipboard::GetInstance()->IsPopupVisible() == true)
1291 GetFooter()->SetShowState(true);
1292 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1293 __pSearchListView->Invalidate(false);
1294 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1295 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1300 HistoryListForm::CreateGroupItems()
1302 result r = E_FAILURE;
1303 DateTime currentTime;
1305 GroupItemClass* pGroupItemClass = null;
1308 String weeksAgo2 = L"";
1309 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
1311 String weeksAgo3 = L"";
1312 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1314 if (__pGroupData != null)
1316 __pGroupData->RemoveAll(false);
1317 delete __pGroupData;
1318 __pGroupData = null;
1320 __pGroupData = new(std::nothrow) ArrayList();
1321 if (__pGroupData == null)
1325 r = __pGroupData->Construct();
1328 delete __pGroupData;
1329 __pGroupData = null;
1332 if (__searchHistory == true)
1334 pGroupItemClass = new(std::nothrow) GroupItemClass();
1335 if (pGroupItemClass == null)
1339 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCH");
1340 pGroupItemClass->SetTitleText(titleText);
1341 r = __pGroupData->Add(*pGroupItemClass);
1349 Calendar* pGregorianCalendar = null;
1352 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1353 pGroupItemClass = new(std::nothrow) GroupItemClass();
1354 if (pGroupItemClass == null)
1358 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1359 pGroupItemClass->SetTitleText(titleText);
1360 pGroupItemClass->SetEndTime(currentTime);
1361 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1362 pGroupItemClass->SetStartTime(dateTime);
1363 __pGroupData->Add(*pGroupItemClass);
1366 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1367 if ( pGregorianCalendar != NULL )
1369 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1370 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1371 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1372 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1373 delete pGregorianCalendar;
1378 pGroupItemClass = new(std::nothrow) GroupItemClass();
1379 if (pGroupItemClass == null)
1383 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1384 pGroupItemClass->SetTitleText(titleText);
1385 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1386 pGroupItemClass->SetEndTime(dateTime);
1387 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1388 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1389 pGroupItemClass->SetStartTime(dateTime);
1390 __pGroupData->Add(*pGroupItemClass);
1393 pGroupItemClass = new(std::nothrow) GroupItemClass();
1394 if (pGroupItemClass == null)
1398 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1399 pGroupItemClass->SetTitleText(titleText);
1400 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1401 pGroupItemClass->SetEndTime(dateTime);
1402 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1403 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1404 pGroupItemClass->SetStartTime(dateTime);
1405 __pGroupData->Add(*pGroupItemClass);
1408 pGroupItemClass = new(std::nothrow) GroupItemClass();
1409 if (pGroupItemClass == null)
1413 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1414 pGroupItemClass->SetTitleText(titleText);
1415 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1416 pGroupItemClass->SetEndTime(dateTime);
1417 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1418 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1419 pGroupItemClass->SetStartTime(dateTime);
1420 __pGroupData->Add(*pGroupItemClass);
1422 pGroupItemClass = new(std::nothrow) GroupItemClass();
1423 if (pGroupItemClass == null)
1427 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1428 pGroupItemClass->SetTitleText(titleText);
1429 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1430 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1431 pGroupItemClass->SetEndTime(dateTime);
1432 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1433 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1434 pGroupItemClass->SetStartTime(dateTime);
1435 __pGroupData->Add(*pGroupItemClass);
1438 pGroupItemClass = new(std::nothrow) GroupItemClass();
1439 if (pGroupItemClass == null)
1443 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1444 pGroupItemClass->SetTitleText(titleText);
1445 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1446 pGroupItemClass->SetEndTime(dateTime);
1447 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1448 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1449 pGroupItemClass->SetStartTime(dateTime);
1450 __pGroupData->Add(*pGroupItemClass);
1452 pGroupItemClass = new(std::nothrow) GroupItemClass();
1453 if (pGroupItemClass == null)
1457 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1458 pGroupItemClass->SetTitleText(titleText);
1459 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1460 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1461 pGroupItemClass->SetEndTime(dateTime);
1462 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1463 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1464 pGroupItemClass->SetStartTime(dateTime);
1465 __pGroupData->Add(*pGroupItemClass);
1467 pGroupItemClass = new(std::nothrow) GroupItemClass();
1468 if (pGroupItemClass == null)
1472 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1473 pGroupItemClass->SetTitleText(titleText);
1474 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1475 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1476 pGroupItemClass->SetEndTime(dateTime);
1477 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1478 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1479 pGroupItemClass->SetStartTime(dateTime);
1480 __pGroupData->Add(*pGroupItemClass);
1483 pGroupItemClass = new(std::nothrow) GroupItemClass();
1484 if (pGroupItemClass == null)
1488 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1489 pGroupItemClass->SetTitleText(titleText);
1490 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1491 pGroupItemClass->SetEndTime(dateTime);
1492 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1493 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1494 pGroupItemClass->SetStartTime(dateTime);
1495 __pGroupData->Add(*pGroupItemClass);
1497 pGroupItemClass = new(std::nothrow) GroupItemClass();
1498 if (pGroupItemClass == null)
1502 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1503 pGroupItemClass->SetTitleText(titleText);
1504 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1505 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1506 pGroupItemClass->SetEndTime(dateTime);
1507 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1508 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1509 pGroupItemClass->SetStartTime(dateTime);
1510 __pGroupData->Add(*pGroupItemClass);
1512 pGroupItemClass = new(std::nothrow) GroupItemClass();
1513 if (pGroupItemClass == null)
1517 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1518 pGroupItemClass->SetTitleText(titleText);
1519 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1520 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1521 pGroupItemClass->SetEndTime(dateTime);
1522 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1523 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1524 pGroupItemClass->SetStartTime(dateTime);
1525 __pGroupData->Add(*pGroupItemClass);
1527 pGroupItemClass = new(std::nothrow) GroupItemClass();
1528 if (pGroupItemClass == null)
1532 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1533 pGroupItemClass->SetTitleText(titleText);
1534 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1535 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1536 pGroupItemClass->SetEndTime(dateTime);
1537 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1538 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1539 pGroupItemClass->SetStartTime(dateTime);
1540 __pGroupData->Add(*pGroupItemClass);
1543 pGroupItemClass = new(std::nothrow) GroupItemClass();
1544 if (pGroupItemClass == null)
1548 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1549 pGroupItemClass->SetTitleText(titleText);
1550 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1551 pGroupItemClass->SetEndTime(dateTime);
1552 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1553 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1554 pGroupItemClass->SetStartTime(dateTime);
1555 __pGroupData->Add(*pGroupItemClass);
1557 pGroupItemClass = new(std::nothrow) GroupItemClass();
1558 if (pGroupItemClass == null)
1562 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1563 pGroupItemClass->SetTitleText(titleText);
1564 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1565 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1566 pGroupItemClass->SetEndTime(dateTime);
1567 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1568 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1569 pGroupItemClass->SetStartTime(dateTime);
1570 __pGroupData->Add(*pGroupItemClass);
1572 pGroupItemClass = new(std::nothrow) GroupItemClass();
1573 if (pGroupItemClass == null)
1577 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1578 pGroupItemClass->SetTitleText(titleText);
1579 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1580 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1581 pGroupItemClass->SetEndTime(dateTime);
1582 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1583 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1584 pGroupItemClass->SetStartTime(dateTime);
1585 __pGroupData->Add(*pGroupItemClass);
1587 pGroupItemClass = new(std::nothrow) GroupItemClass();
1588 if (pGroupItemClass == null)
1592 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1593 pGroupItemClass->SetTitleText(titleText);
1594 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1595 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1596 pGroupItemClass->SetEndTime(dateTime);
1597 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1598 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1599 pGroupItemClass->SetStartTime(dateTime);
1600 __pGroupData->Add(*pGroupItemClass);
1602 pGroupItemClass = new(std::nothrow) GroupItemClass();
1603 if (pGroupItemClass == null)
1607 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1608 pGroupItemClass->SetTitleText(titleText);
1609 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1610 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1611 pGroupItemClass->SetEndTime(dateTime);
1612 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1613 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1614 pGroupItemClass->SetStartTime(dateTime);
1615 __pGroupData->Add(*pGroupItemClass);
1618 pGroupItemClass = new(std::nothrow) GroupItemClass();
1619 if (pGroupItemClass == null)
1623 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1624 pGroupItemClass->SetTitleText(titleText);
1625 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1626 pGroupItemClass->SetEndTime(dateTime);
1627 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1628 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1629 pGroupItemClass->SetStartTime(dateTime);
1630 __pGroupData->Add(*pGroupItemClass);
1632 pGroupItemClass = new(std::nothrow) GroupItemClass();
1633 if (pGroupItemClass == null)
1637 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1638 pGroupItemClass->SetTitleText(titleText);
1639 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1640 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1641 pGroupItemClass->SetEndTime(dateTime);
1642 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1643 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1644 pGroupItemClass->SetStartTime(dateTime);
1645 __pGroupData->Add(*pGroupItemClass);
1647 pGroupItemClass = new(std::nothrow) GroupItemClass();
1648 if (pGroupItemClass == null)
1652 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1653 pGroupItemClass->SetTitleText(titleText);
1654 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1655 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1656 pGroupItemClass->SetEndTime(dateTime);
1657 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1658 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1659 pGroupItemClass->SetStartTime(dateTime);
1660 __pGroupData->Add(*pGroupItemClass);
1662 pGroupItemClass = new(std::nothrow) GroupItemClass();
1663 if (pGroupItemClass == null)
1667 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1668 pGroupItemClass->SetTitleText(titleText);
1669 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1670 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1671 pGroupItemClass->SetEndTime(dateTime);
1672 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1673 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1674 pGroupItemClass->SetStartTime(dateTime);
1675 __pGroupData->Add(*pGroupItemClass);
1677 pGroupItemClass = new(std::nothrow) GroupItemClass();
1678 if (pGroupItemClass == null)
1682 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1683 pGroupItemClass->SetTitleText(titleText);
1684 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1685 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1686 pGroupItemClass->SetEndTime(dateTime);
1687 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1688 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1689 pGroupItemClass->SetStartTime(dateTime);
1690 __pGroupData->Add(*pGroupItemClass);
1692 pGroupItemClass = new(std::nothrow) GroupItemClass();
1693 if (pGroupItemClass == null)
1697 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1698 pGroupItemClass->SetTitleText(titleText);
1699 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1700 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1701 pGroupItemClass->SetEndTime(dateTime);
1702 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1703 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1704 pGroupItemClass->SetStartTime(dateTime);
1705 __pGroupData->Add(*pGroupItemClass);
1711 day = currentTime.GetDay();
1715 pGroupItemClass = new(std::nothrow) GroupItemClass();
1716 if (pGroupItemClass == null)
1721 pGroupItemClass->SetTitleText(weeksAgo2);
1722 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1723 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1724 pGroupItemClass->SetEndTime(dateTime);
1725 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1726 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1727 pGroupItemClass->SetStartTime(dateTime);
1728 __pGroupData->Add(*pGroupItemClass);
1730 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1732 pGroupItemClass = new(std::nothrow) GroupItemClass();
1733 if (pGroupItemClass == null)
1737 String weeksAgo3 = L"";
1738 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1739 pGroupItemClass->SetTitleText(weeksAgo3);
1740 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1741 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1742 pGroupItemClass->SetEndTime(dateTime);
1743 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1744 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1745 pGroupItemClass->SetStartTime(dateTime);
1746 __pGroupData->Add(*pGroupItemClass);
1750 pGroupItemClass = new(std::nothrow) GroupItemClass();
1751 if (pGroupItemClass == null)
1755 pGroupItemClass->SetTitleText(weeksAgo2);
1756 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1757 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1758 pGroupItemClass->SetEndTime(dateTime);
1759 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1760 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1761 pGroupItemClass->SetStartTime(dateTime);
1762 __pGroupData->Add(*pGroupItemClass);
1764 pGroupItemClass = new(std::nothrow) GroupItemClass();
1765 if (pGroupItemClass == null)
1770 pGroupItemClass->SetTitleText(weeksAgo3);
1771 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1772 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1773 pGroupItemClass->SetEndTime(dateTime);
1774 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1775 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1776 pGroupItemClass->SetStartTime(dateTime);
1777 __pGroupData->Add(*pGroupItemClass);
1779 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1781 pGroupItemClass = new(std::nothrow) GroupItemClass();
1782 if (pGroupItemClass == null)
1786 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1787 pGroupItemClass->SetTitleText(titleText);
1788 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1789 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1790 pGroupItemClass->SetEndTime(dateTime);
1791 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1792 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1793 pGroupItemClass->SetStartTime(dateTime);
1794 __pGroupData->Add(*pGroupItemClass);
1798 pGroupItemClass = new(std::nothrow) GroupItemClass();
1799 if (pGroupItemClass == null)
1803 pGroupItemClass->SetTitleText(weeksAgo2);
1804 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1805 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1806 pGroupItemClass->SetEndTime(dateTime);
1807 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1808 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1809 pGroupItemClass->SetStartTime(dateTime);
1810 __pGroupData->Add(*pGroupItemClass);
1812 pGroupItemClass = new(std::nothrow) GroupItemClass();
1813 if (pGroupItemClass == null)
1817 pGroupItemClass->SetTitleText(weeksAgo3);
1818 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1819 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1820 pGroupItemClass->SetEndTime(dateTime);
1821 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1822 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1823 pGroupItemClass->SetStartTime(dateTime);
1824 __pGroupData->Add(*pGroupItemClass);
1826 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1828 pGroupItemClass = new(std::nothrow) GroupItemClass();
1829 if (pGroupItemClass == null)
1833 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1834 pGroupItemClass->SetTitleText(titleText);
1835 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1836 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1837 pGroupItemClass->SetEndTime(dateTime);
1838 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1839 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1840 pGroupItemClass->SetStartTime(dateTime);
1841 __pGroupData->Add(*pGroupItemClass);
1847 pGroupItemClass = new(std::nothrow) GroupItemClass();
1848 if (pGroupItemClass == null)
1852 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_MONTH");
1853 pGroupItemClass->SetTitleText(titleText);
1854 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1855 dateTime.AddDays(-1);
1856 pGroupItemClass->SetEndTime(dateTime);
1857 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1858 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1859 pGroupItemClass->SetStartTime(dateTime);
1860 __pGroupData->Add(*pGroupItemClass);
1862 pGroupItemClass = new(std::nothrow) GroupItemClass();
1863 if (pGroupItemClass == null)
1867 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1868 pGroupItemClass->SetTitleText(titleText);
1869 dateTime.SetValue(currentTime.GetYear(),1, 1);
1870 dateTime.AddMonths(currentTime.GetMonth() - 2);
1871 dateTime.AddDays(-1);
1872 pGroupItemClass->SetEndTime(dateTime);
1874 dateTime2.SetValue(0, 0, 0);
1875 pGroupItemClass->SetStartTime(dateTime2);
1876 __pGroupData->Add(*pGroupItemClass);
1880 GroupItemClass::GroupItemClass()
1886 GroupItemClass::operator =(const GroupItemClass& rhs)
1890 __pData = rhs.__pData;
1895 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1897 __pData = groupItem.__pData;
1900 GroupItemClass::~GroupItemClass()
1904 __pData->RemoveAll(true);
1910 GroupItemClass::SetStartTime(DateTime& startTime)
1912 __startTime = startTime;
1916 GroupItemClass::SetEndTime(DateTime& endTime)
1918 __endTime = endTime;
1922 GroupItemClass::SetTitleText(String& titleText)
1924 __titleText = titleText;
1928 GroupItemClass::SetHistoryData(ArrayList* pData)
1934 GroupItemClass::GetStartTime(void)
1940 GroupItemClass::GetEndTime(void)
1946 GroupItemClass::GetTitleText(void)
1952 GroupItemClass::GetHistoryData(void)
1958 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1960 if (__pGroupedListView)
1962 __pGroupedListView->UpdateList();