2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 //!Internet HistoryListForm class
18 /*@file: HistoryListForm.cpp
19 *@brief: This class defines HistoryListForm used define history
25 #include "IntBookmarkData.h"
26 #include "IntBookmarkPresentationModel.h"
27 #include "IntCommonLib.h"
28 #include "IntFaviconManager.h"
29 #include "IntHistoryListForm.h"
30 #include "IntHistoryPresentationModel.h"
31 #include "IntMultipleWindowPresentationModel.h"
32 #include "IntSceneRegister.h"
35 using namespace Tizen::App;
36 using namespace Tizen::Base;
37 using namespace Tizen::Base::Collection;
38 using namespace Tizen::Base::Runtime;
39 using namespace Tizen::Graphics;
40 using namespace Tizen::Locales;
41 using namespace Tizen::Media;
42 using namespace Tizen::Ui;
43 using namespace Tizen::Ui::Controls;
44 using namespace Tizen::Ui::Scenes;
45 using namespace Tizen::System;
47 static const wchar_t* IDB_TAB_ICON_BOOKMARKS = L"I01_tab_icon_bookmarks.png";
48 static const wchar_t* IDB_TAB_ICON_HISTORY = L"I01_tab_icon_history.png";
49 static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png";
50 static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png";
53 const int HistoryListForm::IDA_TABBAR_ITEM_1 = 101;
54 const int HistoryListForm::IDA_TABBAR_ITEM_2 = 102;
55 const int HistoryListForm::IDA_EDIT_HISTORY_LIST_FORM = 103;
56 const int HistoryListForm::IDA_FORMAT_ICON = 104;
57 const int HistoryListForm::IDA_FORMAT_TITLE = 105;
58 const int HistoryListForm::IDA_FORMAT_URL = 106;
59 const int HistoryListForm::IDA_FORMAT_BOOKMARK = 107;
62 HistoryListForm::HistoryListForm(void)
64 __pBookmarkList = null;
65 __pGroupedListView =null;
66 __pSearchListView = null;
69 __pSearchedData = null ;
70 __searchHistory = false;
71 __isNoHistoryPresent = true;
73 __previousSceneId = L"";
76 HistoryListForm::~HistoryListForm(void)
78 if (__pGroupData != null)
80 __pGroupData->RemoveAll(false);
83 if(__pBookmarkList != null)
85 __pBookmarkList->RemoveAll(false);
86 delete __pBookmarkList;
88 if (__pSearchListView)
90 delete __pSearchListView;
91 __pSearchListView = null;
96 HistoryListForm::Initialize(void)
98 Construct(L"IDL_HISTORY_LIST");
104 HistoryListForm::OnInitializing(void)
106 AppLog("HistoryListForm::OnInitializing");
107 result r = E_SUCCESS;
108 SceneManager* pSceneManager = null;
111 Header *pHeader = GetHeader();
112 Bitmap *pIconBitmap = null;
113 AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
114 const Color brown = Color(32, 32, 32, 0xFF);
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 if (urlFoundInBookmark == true)
610 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
614 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
616 bookmarkBtnWidth = 64;
619 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);
620 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
622 // if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
623 // 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);
625 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);
626 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
627 if ( pBookmarkBitmap != null)
629 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2 +(__fontSize - 44)/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
630 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
631 delete pBookmarkBitmap;
642 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
651 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
653 AppLog("HistoryListForm::DeleteItem");
654 result r = E_FAILURE;
655 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
656 if (pGroupItemClass == null)
661 // if (pGroupItemClass->__pData != null)
663 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
676 HistoryListForm::GetGroupCount(void)
678 __isNoHistoryPresent = true;
680 if (__pGroupData != null)
682 if (__searchHistory == false)
687 HistoryPresentationModel::GetCurrentDateTime(endTime);
689 startTime.SetValue(0,0,0);
691 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
696 return __pGroupData->GetCount();
701 if (__searchText.GetLength() > 0)
703 __searchText.Replace(L"%", L"/%");
704 __searchText.Replace(L"_", L"/_");
706 // String searchText = __pSearchBar->GetText();
707 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
721 HistoryListForm::GetItemCount(int groupIndex)
723 result r = E_FAILURE;
729 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
730 if (pGroupItemClass == null)
734 if (__searchHistory == false)
736 startTime = pGroupItemClass->GetStartTime();
737 endTime = pGroupItemClass->GetEndTime();
738 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
742 //text = __pSearchBar->GetText();
743 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
754 ArrayList* pData = new(std::nothrow) ArrayList();
759 r = pData->Construct();
767 if (__searchHistory == false)
769 startTime = pGroupItemClass->GetStartTime();
770 endTime = pGroupItemClass->GetEndTime();
771 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
772 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
776 //text = __pSearchBar->GetText() ;
777 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
784 pGroupItemClass->SetHistoryData(pData);
787 if (__isNoHistoryPresent == true && count == 0)
789 __isNoHistoryPresent = true;
790 GetFooter()->SetItemEnabled(0, false);
794 __isNoHistoryPresent = false;
795 GetFooter()->SetItemEnabled(0, true);
797 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
798 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
805 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
806 return pGroupItemClass->GetHistoryData()->GetCount();
811 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
814 GetHeader()->SetItemSelected(1);
815 // __previousSceneId = previousSceneId;
816 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
819 pList->GetAt(pList->GetCount()-1,__previousSceneId);
822 if(__pBookmarkList != null)
824 __pBookmarkList->RemoveAll(false);
827 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
829 AppLog("HistoryListForm::OnSceneActivatedN called");
830 //GetHeader()->Invalidate(true);
831 if (__pGroupData == null)
833 __pGroupData = new(std::nothrow) ArrayList();
834 __pGroupData->Construct();
836 if (__pGroupedListView != null)
838 __pGroupedListView->UpdateList();
840 if (__isNoHistoryPresent == true)
842 GetFooter()->SetItemEnabled(0, false);
846 GetFooter()->SetItemEnabled(0, true);
852 HistoryPresentationModel::GetCurrentDateTime(endTime);;
854 startTime.SetValue(0,0,0);
855 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
858 __pSearchBar->SetShowState(false);
859 __pSearchBar->Invalidate(true);
863 __pSearchBar->SetShowState(true);
864 __pSearchBar->Invalidate(true);
867 // if (__isNoHistoryPresent == true)
869 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
870 // __pGroupedListView->UpdateList();
873 result r = GetHeader()->SetItemSelected(2);
876 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
887 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
889 AppLog("HistoryListForm::OnSceneDeactivated");
890 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
894 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
900 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
902 GroupItemClass* pGroupItemClass = null;
903 History* pHistory = null;
904 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
905 if (elementId == IDA_FORMAT_BOOKMARK)
907 String toggledUrl = L"";
908 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
909 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
910 if (pGroupItemClass == null)
914 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
915 if (pHistory == null)
919 toggledUrl = pHistory->GetHistoryUrl();
921 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
923 bool bookmarkFound = false;
924 BookmarkData* pBookMark = null;
925 if(__pBookmarkList != null)
927 for (int i = 0; i < __pBookmarkList->GetCount(); i++)
929 pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
930 if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
932 bookmarkFound = true;
937 if(bookmarkFound == false)
939 // Add the history in bookmark database
940 result r = E_FAILURE;
941 BookmarkData bookmark;
943 String bookmarkTitle = pHistory->GetHistoryTitle();
945 bookmark.SetBookmarkTitle(bookmarkTitle);
946 bookmark.SetUrl(pHistory->GetHistoryUrl());
947 bookmark.SetFaviconId(pHistory->GetFaviconId());
948 bookmark.SetFavIconBuffer(*pHistory->GetFavIconBuffer());
949 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
950 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(bookmark);
954 // remove the history from bookmark database
955 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
958 if(__pBookmarkList != null)
960 __pBookmarkList->RemoveAll(false);
961 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
963 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
964 listView.UpdateList();
968 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
969 if (pGroupItemClass == null)
974 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
975 if (pHistory1 == null)
979 SceneManager* pSceneManager = SceneManager::GetInstance();
980 ArrayList *pArgList = null;
981 result r = E_SUCCESS;
982 pArgList = new(std::nothrow) ArrayList();
983 if (pArgList != null)
985 r = pArgList->Construct();
992 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
993 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
1003 String scneId = L"";
1004 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
1006 if (pSceneManager != null)
1008 AppLog("pSceneManager exists");
1009 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
1012 pArgList->RemoveAll(false);
1025 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
1031 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
1033 result r = E_FAILURE;
1034 if (mode == SEARCH_BAR_MODE_NORMAL)
1036 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1038 __pSearchListView->SetEnabled(true);
1041 r = __pSearchListView->SetShowState(false);
1046 r = __pGroupedListView->SetShowState(true);
1052 __pSearchListView->SetEnabled(true);
1053 if(__pSearchBar != null)
1054 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1056 __searchHistory = false;
1057 r = __pGroupedListView->UpdateList();
1058 if (__isNoHistoryPresent == true)
1060 GetFooter()->SetItemEnabled(0, false);
1064 GetFooter()->SetItemEnabled(0, true);
1066 if(__pSearchBar != null)
1068 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1078 // __pSearchListView->SetEnabled(false);
1079 r = __pSearchListView->SetShowState(true);
1084 __pSearchListView->SetEnabled(false);
1085 r = __pSearchListView->UpdateList();
1090 r = __pGroupedListView->SetShowState(false);
1095 if(__pSearchBar != null)
1097 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1103 HistoryListForm::GetMonth(int month)
1105 String monthValue = L"";
1109 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1112 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1115 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1118 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1121 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1124 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUNE"));
1127 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1130 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));
1133 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1136 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1139 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1142 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1153 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1155 result r = E_FAILURE;
1156 if (__pSearchBar != null)
1158 __pSearchBar->HideKeypad();
1161 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1163 __pSearchListView->SetEnabled(true);
1164 __searchHistory = true;
1165 __searchText =__pSearchBar->GetText();
1166 AppLog("SearchTextHistory %S errormsg %s",__searchText.GetPointer(),GetErrorMessage(GetLastResult()));
1168 r = __pGroupedListView->SetShowState(false);
1173 r = __pSearchListView->SetShowState(true);
1178 r= __pSearchListView->UpdateList();
1179 if (__isNoHistoryPresent == true)
1181 GetFooter()->SetItemEnabled(0, false);
1185 GetFooter()->SetItemEnabled(0, true);
1187 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1196 __searchHistory = false;
1202 HistoryListForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1204 FloatRectangle clientRect;
1205 clientRect = GetClientAreaBoundsF();
1206 AppLogDebug("SearchBarForm::OnKeypadBoundsChanged ClientBounds(%f, %f, %f, %f)",clientRect.x, clientRect.y, clientRect.width, clientRect.height);
1207 __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1208 __pSearchListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1209 __pGroupedListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1210 // __pGroupedListView->SetEnabled(false);
1215 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1217 result r = E_FAILURE;
1218 if (__pGroupedListView != null)
1220 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1221 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1222 else if(__pSearchBar != null)
1223 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1228 __pGroupedListView->UpdateList();
1230 if (__pSearchListView != null)
1232 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1238 __pSearchListView->UpdateList();
1240 if(__pSearchBar != null)
1241 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1246 if (__isNoHistoryPresent == true)
1248 GetFooter()->SetItemEnabled(0, false);
1252 GetFooter()->SetItemEnabled(0, true);
1257 HistoryListForm::OnKeypadWillOpen(Control& source)
1259 GetFooter()->SetShowState(false);
1260 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1261 __pSearchListView->SetEnabled(false);
1262 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1268 HistoryListForm::OnKeypadOpened(Control& source)
1270 // this is added because some time footer is shown when key pad is opened, do not remove
1271 GetFooter()->SetShowState(false);
1272 GetFooter()->Invalidate(true);
1273 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1277 HistoryListForm::OnKeypadClosed(Control& source)
1279 if(Clipboard::GetInstance()->IsPopupVisible() == true)
1283 GetFooter()->SetShowState(true);
1284 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1285 __pSearchListView->Invalidate(false);
1286 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1287 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1292 HistoryListForm::CreateGroupItems()
1294 result r = E_FAILURE;
1295 DateTime currentTime;
1297 GroupItemClass* pGroupItemClass = null;
1300 String weeksAgo2 = L"";
1301 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
1303 String weeksAgo3 = L"";
1304 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1306 if (__pGroupData != null)
1308 __pGroupData->RemoveAll(false);
1309 delete __pGroupData;
1310 __pGroupData = null;
1312 __pGroupData = new(std::nothrow) ArrayList();
1313 if (__pGroupData == null)
1317 r = __pGroupData->Construct();
1320 delete __pGroupData;
1321 __pGroupData = null;
1324 if (__searchHistory == true)
1326 pGroupItemClass = new(std::nothrow) GroupItemClass();
1327 if (pGroupItemClass == null)
1331 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCH");
1332 pGroupItemClass->SetTitleText(titleText);
1333 r = __pGroupData->Add(*pGroupItemClass);
1341 Calendar* pGregorianCalendar = null;
1344 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1345 pGroupItemClass = new(std::nothrow) GroupItemClass();
1346 if (pGroupItemClass == null)
1350 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1351 pGroupItemClass->SetTitleText(titleText);
1352 pGroupItemClass->SetEndTime(currentTime);
1353 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1354 pGroupItemClass->SetStartTime(dateTime);
1355 __pGroupData->Add(*pGroupItemClass);
1358 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1359 if ( pGregorianCalendar != NULL )
1361 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1362 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1363 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1364 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1365 delete pGregorianCalendar;
1370 pGroupItemClass = new(std::nothrow) GroupItemClass();
1371 if (pGroupItemClass == null)
1375 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1376 pGroupItemClass->SetTitleText(titleText);
1377 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1378 pGroupItemClass->SetEndTime(dateTime);
1379 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1380 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1381 pGroupItemClass->SetStartTime(dateTime);
1382 __pGroupData->Add(*pGroupItemClass);
1385 pGroupItemClass = new(std::nothrow) GroupItemClass();
1386 if (pGroupItemClass == null)
1390 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1391 pGroupItemClass->SetTitleText(titleText);
1392 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1393 pGroupItemClass->SetEndTime(dateTime);
1394 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1395 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1396 pGroupItemClass->SetStartTime(dateTime);
1397 __pGroupData->Add(*pGroupItemClass);
1400 pGroupItemClass = new(std::nothrow) GroupItemClass();
1401 if (pGroupItemClass == null)
1405 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1406 pGroupItemClass->SetTitleText(titleText);
1407 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1408 pGroupItemClass->SetEndTime(dateTime);
1409 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1410 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1411 pGroupItemClass->SetStartTime(dateTime);
1412 __pGroupData->Add(*pGroupItemClass);
1414 pGroupItemClass = new(std::nothrow) GroupItemClass();
1415 if (pGroupItemClass == null)
1419 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1420 pGroupItemClass->SetTitleText(titleText);
1421 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1422 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1423 pGroupItemClass->SetEndTime(dateTime);
1424 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1425 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1426 pGroupItemClass->SetStartTime(dateTime);
1427 __pGroupData->Add(*pGroupItemClass);
1430 pGroupItemClass = new(std::nothrow) GroupItemClass();
1431 if (pGroupItemClass == null)
1435 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1436 pGroupItemClass->SetTitleText(titleText);
1437 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1438 pGroupItemClass->SetEndTime(dateTime);
1439 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1440 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1441 pGroupItemClass->SetStartTime(dateTime);
1442 __pGroupData->Add(*pGroupItemClass);
1444 pGroupItemClass = new(std::nothrow) GroupItemClass();
1445 if (pGroupItemClass == null)
1449 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1450 pGroupItemClass->SetTitleText(titleText);
1451 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1452 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1453 pGroupItemClass->SetEndTime(dateTime);
1454 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1455 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1456 pGroupItemClass->SetStartTime(dateTime);
1457 __pGroupData->Add(*pGroupItemClass);
1459 pGroupItemClass = new(std::nothrow) GroupItemClass();
1460 if (pGroupItemClass == null)
1464 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1465 pGroupItemClass->SetTitleText(titleText);
1466 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1467 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1468 pGroupItemClass->SetEndTime(dateTime);
1469 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1470 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1471 pGroupItemClass->SetStartTime(dateTime);
1472 __pGroupData->Add(*pGroupItemClass);
1475 pGroupItemClass = new(std::nothrow) GroupItemClass();
1476 if (pGroupItemClass == null)
1480 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1481 pGroupItemClass->SetTitleText(titleText);
1482 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1483 pGroupItemClass->SetEndTime(dateTime);
1484 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1485 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1486 pGroupItemClass->SetStartTime(dateTime);
1487 __pGroupData->Add(*pGroupItemClass);
1489 pGroupItemClass = new(std::nothrow) GroupItemClass();
1490 if (pGroupItemClass == null)
1494 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1495 pGroupItemClass->SetTitleText(titleText);
1496 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1497 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1498 pGroupItemClass->SetEndTime(dateTime);
1499 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1500 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1501 pGroupItemClass->SetStartTime(dateTime);
1502 __pGroupData->Add(*pGroupItemClass);
1504 pGroupItemClass = new(std::nothrow) GroupItemClass();
1505 if (pGroupItemClass == null)
1509 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1510 pGroupItemClass->SetTitleText(titleText);
1511 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1512 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1513 pGroupItemClass->SetEndTime(dateTime);
1514 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1515 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1516 pGroupItemClass->SetStartTime(dateTime);
1517 __pGroupData->Add(*pGroupItemClass);
1519 pGroupItemClass = new(std::nothrow) GroupItemClass();
1520 if (pGroupItemClass == null)
1524 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1525 pGroupItemClass->SetTitleText(titleText);
1526 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1527 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1528 pGroupItemClass->SetEndTime(dateTime);
1529 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1530 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1531 pGroupItemClass->SetStartTime(dateTime);
1532 __pGroupData->Add(*pGroupItemClass);
1535 pGroupItemClass = new(std::nothrow) GroupItemClass();
1536 if (pGroupItemClass == null)
1540 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1541 pGroupItemClass->SetTitleText(titleText);
1542 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1543 pGroupItemClass->SetEndTime(dateTime);
1544 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1545 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1546 pGroupItemClass->SetStartTime(dateTime);
1547 __pGroupData->Add(*pGroupItemClass);
1549 pGroupItemClass = new(std::nothrow) GroupItemClass();
1550 if (pGroupItemClass == null)
1554 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1555 pGroupItemClass->SetTitleText(titleText);
1556 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1557 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1558 pGroupItemClass->SetEndTime(dateTime);
1559 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1560 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1561 pGroupItemClass->SetStartTime(dateTime);
1562 __pGroupData->Add(*pGroupItemClass);
1564 pGroupItemClass = new(std::nothrow) GroupItemClass();
1565 if (pGroupItemClass == null)
1569 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1570 pGroupItemClass->SetTitleText(titleText);
1571 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1572 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1573 pGroupItemClass->SetEndTime(dateTime);
1574 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1575 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1576 pGroupItemClass->SetStartTime(dateTime);
1577 __pGroupData->Add(*pGroupItemClass);
1579 pGroupItemClass = new(std::nothrow) GroupItemClass();
1580 if (pGroupItemClass == null)
1584 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1585 pGroupItemClass->SetTitleText(titleText);
1586 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1587 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1588 pGroupItemClass->SetEndTime(dateTime);
1589 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1590 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1591 pGroupItemClass->SetStartTime(dateTime);
1592 __pGroupData->Add(*pGroupItemClass);
1594 pGroupItemClass = new(std::nothrow) GroupItemClass();
1595 if (pGroupItemClass == null)
1599 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1600 pGroupItemClass->SetTitleText(titleText);
1601 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1602 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1603 pGroupItemClass->SetEndTime(dateTime);
1604 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1605 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1606 pGroupItemClass->SetStartTime(dateTime);
1607 __pGroupData->Add(*pGroupItemClass);
1610 pGroupItemClass = new(std::nothrow) GroupItemClass();
1611 if (pGroupItemClass == null)
1615 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1616 pGroupItemClass->SetTitleText(titleText);
1617 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1618 pGroupItemClass->SetEndTime(dateTime);
1619 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1620 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1621 pGroupItemClass->SetStartTime(dateTime);
1622 __pGroupData->Add(*pGroupItemClass);
1624 pGroupItemClass = new(std::nothrow) GroupItemClass();
1625 if (pGroupItemClass == null)
1629 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1630 pGroupItemClass->SetTitleText(titleText);
1631 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1632 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1633 pGroupItemClass->SetEndTime(dateTime);
1634 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1635 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1636 pGroupItemClass->SetStartTime(dateTime);
1637 __pGroupData->Add(*pGroupItemClass);
1639 pGroupItemClass = new(std::nothrow) GroupItemClass();
1640 if (pGroupItemClass == null)
1644 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1645 pGroupItemClass->SetTitleText(titleText);
1646 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1647 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1648 pGroupItemClass->SetEndTime(dateTime);
1649 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1650 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1651 pGroupItemClass->SetStartTime(dateTime);
1652 __pGroupData->Add(*pGroupItemClass);
1654 pGroupItemClass = new(std::nothrow) GroupItemClass();
1655 if (pGroupItemClass == null)
1659 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1660 pGroupItemClass->SetTitleText(titleText);
1661 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1662 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1663 pGroupItemClass->SetEndTime(dateTime);
1664 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1665 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1666 pGroupItemClass->SetStartTime(dateTime);
1667 __pGroupData->Add(*pGroupItemClass);
1669 pGroupItemClass = new(std::nothrow) GroupItemClass();
1670 if (pGroupItemClass == null)
1674 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1675 pGroupItemClass->SetTitleText(titleText);
1676 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1677 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1678 pGroupItemClass->SetEndTime(dateTime);
1679 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1680 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1681 pGroupItemClass->SetStartTime(dateTime);
1682 __pGroupData->Add(*pGroupItemClass);
1684 pGroupItemClass = new(std::nothrow) GroupItemClass();
1685 if (pGroupItemClass == null)
1689 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1690 pGroupItemClass->SetTitleText(titleText);
1691 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1692 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1693 pGroupItemClass->SetEndTime(dateTime);
1694 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1695 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1696 pGroupItemClass->SetStartTime(dateTime);
1697 __pGroupData->Add(*pGroupItemClass);
1703 day = currentTime.GetDay();
1707 pGroupItemClass = new(std::nothrow) GroupItemClass();
1708 if (pGroupItemClass == null)
1713 pGroupItemClass->SetTitleText(weeksAgo2);
1714 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1715 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1716 pGroupItemClass->SetEndTime(dateTime);
1717 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1718 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1719 pGroupItemClass->SetStartTime(dateTime);
1720 __pGroupData->Add(*pGroupItemClass);
1722 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1724 pGroupItemClass = new(std::nothrow) GroupItemClass();
1725 if (pGroupItemClass == null)
1729 String weeksAgo3 = L"";
1730 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1731 pGroupItemClass->SetTitleText(weeksAgo3);
1732 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1733 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1734 pGroupItemClass->SetEndTime(dateTime);
1735 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1736 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1737 pGroupItemClass->SetStartTime(dateTime);
1738 __pGroupData->Add(*pGroupItemClass);
1742 pGroupItemClass = new(std::nothrow) GroupItemClass();
1743 if (pGroupItemClass == null)
1747 pGroupItemClass->SetTitleText(weeksAgo2);
1748 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1749 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1750 pGroupItemClass->SetEndTime(dateTime);
1751 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1752 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1753 pGroupItemClass->SetStartTime(dateTime);
1754 __pGroupData->Add(*pGroupItemClass);
1756 pGroupItemClass = new(std::nothrow) GroupItemClass();
1757 if (pGroupItemClass == null)
1762 pGroupItemClass->SetTitleText(weeksAgo3);
1763 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1764 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1765 pGroupItemClass->SetEndTime(dateTime);
1766 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1767 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1768 pGroupItemClass->SetStartTime(dateTime);
1769 __pGroupData->Add(*pGroupItemClass);
1771 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1773 pGroupItemClass = new(std::nothrow) GroupItemClass();
1774 if (pGroupItemClass == null)
1778 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1779 pGroupItemClass->SetTitleText(titleText);
1780 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1781 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1782 pGroupItemClass->SetEndTime(dateTime);
1783 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1784 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1785 pGroupItemClass->SetStartTime(dateTime);
1786 __pGroupData->Add(*pGroupItemClass);
1790 pGroupItemClass = new(std::nothrow) GroupItemClass();
1791 if (pGroupItemClass == null)
1795 pGroupItemClass->SetTitleText(weeksAgo2);
1796 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1797 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1798 pGroupItemClass->SetEndTime(dateTime);
1799 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1800 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1801 pGroupItemClass->SetStartTime(dateTime);
1802 __pGroupData->Add(*pGroupItemClass);
1804 pGroupItemClass = new(std::nothrow) GroupItemClass();
1805 if (pGroupItemClass == null)
1809 pGroupItemClass->SetTitleText(weeksAgo3);
1810 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1811 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1812 pGroupItemClass->SetEndTime(dateTime);
1813 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1814 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1815 pGroupItemClass->SetStartTime(dateTime);
1816 __pGroupData->Add(*pGroupItemClass);
1818 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1820 pGroupItemClass = new(std::nothrow) GroupItemClass();
1821 if (pGroupItemClass == null)
1825 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1826 pGroupItemClass->SetTitleText(titleText);
1827 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1828 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1829 pGroupItemClass->SetEndTime(dateTime);
1830 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1831 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1832 pGroupItemClass->SetStartTime(dateTime);
1833 __pGroupData->Add(*pGroupItemClass);
1839 pGroupItemClass = new(std::nothrow) GroupItemClass();
1840 if (pGroupItemClass == null)
1844 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_MONTH");
1845 pGroupItemClass->SetTitleText(titleText);
1846 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1847 dateTime.AddDays(-1);
1848 pGroupItemClass->SetEndTime(dateTime);
1849 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1850 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1851 pGroupItemClass->SetStartTime(dateTime);
1852 __pGroupData->Add(*pGroupItemClass);
1854 pGroupItemClass = new(std::nothrow) GroupItemClass();
1855 if (pGroupItemClass == null)
1859 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1860 pGroupItemClass->SetTitleText(titleText);
1861 dateTime.SetValue(currentTime.GetYear(),1, 1);
1862 dateTime.AddMonths(currentTime.GetMonth() - 2);
1863 dateTime.AddDays(-1);
1864 pGroupItemClass->SetEndTime(dateTime);
1866 dateTime2.SetValue(0, 0, 0);
1867 pGroupItemClass->SetStartTime(dateTime2);
1868 __pGroupData->Add(*pGroupItemClass);
1872 GroupItemClass::GroupItemClass()
1878 GroupItemClass::operator =(const GroupItemClass& rhs)
1882 __pData = rhs.__pData;
1887 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1889 __pData = groupItem.__pData;
1892 GroupItemClass::~GroupItemClass()
1896 __pData->RemoveAll(true);
1902 GroupItemClass::SetStartTime(DateTime& startTime)
1904 __startTime = startTime;
1908 GroupItemClass::SetEndTime(DateTime& endTime)
1910 __endTime = endTime;
1914 GroupItemClass::SetTitleText(String& titleText)
1916 __titleText = titleText;
1920 GroupItemClass::SetHistoryData(ArrayList* pData)
1926 GroupItemClass::GetStartTime(void)
1932 GroupItemClass::GetEndTime(void)
1938 GroupItemClass::GetTitleText(void)
1944 GroupItemClass::GetHistoryData(void)
1950 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1952 if (__pGroupedListView)
1954 __pGroupedListView->UpdateList();