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 __pSearchListView = new(std::nothrow) GroupedListView();
163 if (__pSearchListView == null)
168 __pGroupedListView->AddGroupedListViewItemEventListener(*this);
169 r = __pGroupedListView->SetBounds(Rectangle(0,__pGroupedListView->GetY(),GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
174 r = __pSearchListView->Construct(Rectangle(0,0, GetClientAreaBounds().width, GetClientAreaBounds().height -__pSearchBar->GetHeight() - __pSearchBar->GetY()), GROUPED_LIST_VIEW_STYLE_INDEXED, true, false);
179 r = __pSearchListView->SetItemProvider(*this);
184 r = __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND"));
191 __pSearchListView->SetBackgroundColor(GetBackgroundColor());
192 __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK));
193 __pSearchListView->AddGroupedListViewItemEventListener(*this);
194 r = __pSearchListView->SetShowState(false);
201 __pSearchBar->AddSearchBarEventListener(*this);
202 __pSearchBar->AddKeypadEventListener(*this);
203 r = __pSearchBar->SetContent(__pSearchListView);
207 pHeader->SetStyle(HEADER_STYLE_TAB);
208 bookmark.Construct(IDA_TABBAR_ITEM_1);
210 pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark);
211 bookmark.SetText(strbookmark);
212 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARKS);
213 bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
214 bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
215 pHeader->AddItem(bookmark);
223 history.Construct(IDA_TABBAR_ITEM_2);
225 pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory);
226 history.SetText(strhistory);
227 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY);
228 history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
229 history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
230 pHeader->AddItem(history);
231 pHeader->SetItemSelected(1);
232 pHeader->SetTabEditModeEnabled(false);
234 if (pIconBitmap != NULL)
240 __pBookmarkList = new(std::nothrow) Collection::ArrayList();
241 __pBookmarkList->Construct();
242 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
247 HistoryListForm::OnTerminating(void)
249 result r = E_SUCCESS;
251 SettingInfo::RemoveSettingEventListener(*this);
256 HistoryListForm::OnActionPerformed(const Control& source, int actionId)
258 AppLog("HistoryListForm::OnActionPerformed");
259 result r = E_FAILURE;
260 SceneManager* pSceneManager = SceneManager::GetInstance();
261 if (pSceneManager == null)
267 case IDA_EDIT_HISTORY_LIST_FORM:
269 AppLog("ID_EDIT_HISTORY_LIST_FORM entered");
270 r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
277 case IDA_TABBAR_ITEM_1:
279 result r = GetHeader()->SetItemSelected(1);
280 AppLog("SetItemSelected result %s",GetErrorMessage(r));
281 GetHeader()->Invalidate(true);
283 if (pSceneManager != null)
285 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
287 if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_BOOKMARK_VIEW, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)) != E_SUCCESS)
289 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
296 if(pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT))!= E_SUCCESS)
298 AppLogDebug("BookmarkListForm::OnActionPerformed GoBackward failed");
304 // r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
317 HistoryListForm::OnFormBackRequested(Form& source)
319 SceneManager* pSceneManager = SceneManager::GetInstance();
320 if (pSceneManager == null)
324 result r = E_FAILURE;
325 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
327 r = pSceneManager->GoBackward(BackwardSceneTransition());
331 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
335 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
340 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
342 result r = E_FAILURE;
348 GroupItem* pItem = null;
349 GroupItemClass* pGroupItemClass = null;
351 String weeksAgo2 = L"";
352 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
354 String weeksAgo3 = L"";
355 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
357 String weeksAgo4 = L"";
358 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),4);
360 pItem = new(std::nothrow) GroupItem();
365 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
367 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
369 AppLog("CreateGroupItem :: if history is null");
370 r = pItem->Construct(Dimension(itemWidth, 0));
375 r = pItem->Construct(Dimension(itemWidth, 48));
377 text = pGroupItemClass->GetTitleText();
379 if (__searchHistory == false)
383 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
386 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
387 if ( pGregorianCalendar != NULL)
389 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
396 delete pGregorianCalendar;
399 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
406 delete pGregorianCalendar;
409 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
416 delete pGregorianCalendar;
419 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
420 if (pGregorianCalendar != NULL)
422 delete pGregorianCalendar;
429 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
432 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
435 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
438 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
441 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
444 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
447 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
455 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
457 text.Append(pGroupItemClass->GetStartTime().GetDay());
459 strMonth = pGroupItemClass->GetStartTime().GetMonth();
460 month = GetMonth(strMonth);
470 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
471 || pGroupItemClass->GetTitleText() == weeksAgo3 || pGroupItemClass->GetTitleText() == weeksAgo4 || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
474 text.Append(pGroupItemClass->GetEndTime().GetDay());
476 strMonth = pGroupItemClass->GetEndTime().GetMonth();
477 month = GetMonth(strMonth);
483 r = pItem->SetElement(text, null);
487 AppLogDebug("Failed with %s", GetErrorMessage(r));
490 r = pItem->SetTextSize(32);
501 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
503 AppLog("HistoryListForm::CreateItem");
504 result r = E_FAILURE;
505 History* pHistory = null;
506 Bitmap* pBitmap = null;
507 Bitmap* pBookmarkBitmap = null;
508 GroupItemClass* pGroupItemClass = null;
509 CustomItem* pItem = new(std::nothrow) CustomItem();
510 int bookmarkBtnWidth = 0;
513 Image* pImage = null;
514 pImage = new Image();
517 if(__pGroupData == null)
527 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
528 if (pGroupItemClass == null)
533 if (pGroupItemClass->GetHistoryData() == null)
538 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
539 if (pHistory == null)
544 r = pItem->Construct(Dimension(itemWidth, 128 - 44 + __fontSize), LIST_ANNEX_STYLE_NORMAL);
551 ByteBuffer* pFavIconBuffer = null;
552 pFavIconBuffer = pHistory->GetFavIconBuffer();
554 AppLog("BookmarkListForm::CreateItem check 0");
556 if (pFavIconBuffer != null)
558 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is not null");
562 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is null");
565 pBitmap = pImage->DecodeN(*pFavIconBuffer, IMG_FORMAT_PNG, BITMAP_PIXEL_FORMAT_ARGB8888);
567 AppLog("BookmarkListForm::CreateItem check 1");
569 //bitmapId = pHistory->GetFaviconId() ;
570 //pBitmap = pHistory->GetFavIconBitmap();
574 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
578 r = pItem->AddElement(Rectangle(16, 28 + (__fontSize - 44)/2,72, 72), IDA_FORMAT_ICON, *pBitmap, null);
583 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
587 bool urlFoundInBookmark = false;
589 if(__pBookmarkList != null)
591 for (int i = 0; i < __pBookmarkList->GetCount();i++)
593 BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
594 if(pBookMark != null && pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
596 urlFoundInBookmark = true;
601 if (urlFoundInBookmark == true)
603 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
607 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
609 bookmarkBtnWidth = 64;
612 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);
613 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
615 // if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
616 // 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);
618 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);
619 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
620 if ( pBookmarkBitmap != null)
622 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2 +(__fontSize - 44)/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
623 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
624 delete pBookmarkBitmap;
635 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
644 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
646 AppLog("HistoryListForm::DeleteItem");
647 result r = E_FAILURE;
648 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
649 if (pGroupItemClass == null)
654 // if (pGroupItemClass->__pData != null)
656 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
669 HistoryListForm::GetGroupCount(void)
671 __isNoHistoryPresent = true;
673 if (__pGroupData != null)
675 if (__searchHistory == false)
680 HistoryPresentationModel::GetCurrentDateTime(endTime);;
682 startTime.SetValue(0,0,0);
684 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
689 return __pGroupData->GetCount();
694 // String searchText = __pSearchBar->GetText();
695 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
709 HistoryListForm::GetItemCount(int groupIndex)
711 result r = E_FAILURE;
717 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
718 if (pGroupItemClass == null)
722 if (__searchHistory == false)
724 startTime = pGroupItemClass->GetStartTime();
725 endTime = pGroupItemClass->GetEndTime();
726 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
730 //text = __pSearchBar->GetText();
731 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
742 ArrayList* pData = new(std::nothrow) ArrayList();
747 r = pData->Construct();
755 if (__searchHistory == false)
757 startTime = pGroupItemClass->GetStartTime();
758 endTime = pGroupItemClass->GetEndTime();
759 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
760 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
764 //text = __pSearchBar->GetText() ;
765 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
772 pGroupItemClass->SetHistoryData(pData);
775 if (__isNoHistoryPresent == true && count == 0)
777 __isNoHistoryPresent = true;
778 GetFooter()->SetItemEnabled(0, false);
782 __isNoHistoryPresent = false;
783 GetFooter()->SetItemEnabled(0, true);
785 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
786 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
793 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
794 return pGroupItemClass->GetHistoryData()->GetCount();
799 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
802 GetHeader()->SetItemSelected(1);
803 // __previousSceneId = previousSceneId;
804 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
807 pList->GetAt(pList->GetCount()-1,__previousSceneId);
810 if(__pBookmarkList != null)
812 __pBookmarkList->RemoveAll(false);
815 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
817 AppLog("HistoryListForm::OnSceneActivatedN called");
818 //GetHeader()->Invalidate(true);
819 if (__pGroupData == null)
821 __pGroupData = new(std::nothrow) ArrayList();
822 __pGroupData->Construct();
824 if (__pGroupedListView != null)
826 __pGroupedListView->UpdateList();
828 if (__isNoHistoryPresent == true)
830 GetFooter()->SetItemEnabled(0, false);
834 GetFooter()->SetItemEnabled(0, true);
838 HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
841 __pSearchBar->SetShowState(false);
842 __pSearchBar->Invalidate(true);
846 __pSearchBar->SetShowState(true);
847 __pSearchBar->Invalidate(true);
850 // if (__isNoHistoryPresent == true)
852 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
853 // __pGroupedListView->UpdateList();
856 result r = GetHeader()->SetItemSelected(2);
859 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
870 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
872 AppLog("HistoryListForm::OnSceneDeactivated");
873 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
877 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
883 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
885 GroupItemClass* pGroupItemClass = null;
886 History* pHistory = null;
887 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
888 if (elementId == IDA_FORMAT_BOOKMARK)
890 String toggledUrl = L"";
891 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
892 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
893 if (pGroupItemClass == null)
897 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
898 if (pHistory == null)
902 toggledUrl = pHistory->GetHistoryUrl();
904 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
906 bool bookmarkFound = false;
907 BookmarkData* pBookMark = null;
908 if(__pBookmarkList != null)
910 for (int i = 0; i < __pBookmarkList->GetCount(); i++)
912 pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
913 if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
915 bookmarkFound = true;
920 if(bookmarkFound == false)
922 // Add the history in bookmark database
923 result r = E_FAILURE;
924 BookmarkData bookmark;
926 String bookmarkTitle = pHistory->GetHistoryTitle();
928 bookmark.SetBookmarkTitle(bookmarkTitle);
929 bookmark.SetUrl(pHistory->GetHistoryUrl());
930 bookmark.SetFaviconId(pHistory->GetFaviconId());
931 bookmark.SetFavIconBuffer(*pHistory->GetFavIconBuffer());
932 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
933 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(bookmark);
937 // remove the history from bookmark database
938 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
941 if(__pBookmarkList != null)
943 __pBookmarkList->RemoveAll(false);
944 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
946 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
947 listView.UpdateList();
951 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
952 if (pGroupItemClass == null)
957 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
958 if (pHistory1 == null)
962 SceneManager* pSceneManager = SceneManager::GetInstance();
963 ArrayList *pArgList = null;
964 result r = E_SUCCESS;
965 pArgList = new(std::nothrow) ArrayList();
966 if (pArgList != null)
968 r = pArgList->Construct();
975 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
976 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
987 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
989 if (pSceneManager != null)
991 AppLog("pSceneManager exists");
992 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
995 pArgList->RemoveAll(false);
1008 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
1014 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
1016 result r = E_FAILURE;
1017 if (mode == SEARCH_BAR_MODE_NORMAL)
1019 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1021 __pSearchListView->SetEnabled(true);
1024 r = __pSearchListView->SetShowState(false);
1029 r = __pGroupedListView->SetShowState(true);
1035 __pSearchListView->SetEnabled(true);
1036 if(__pSearchBar != null)
1037 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1039 __searchHistory = false;
1040 r = __pGroupedListView->UpdateList();
1041 if (__isNoHistoryPresent == true)
1043 GetFooter()->SetItemEnabled(0, false);
1047 GetFooter()->SetItemEnabled(0, true);
1049 if(__pSearchBar != null)
1051 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1061 // __pSearchListView->SetEnabled(false);
1062 r = __pSearchListView->SetShowState(true);
1067 __pSearchListView->SetEnabled(false);
1068 r = __pSearchListView->UpdateList();
1073 r = __pGroupedListView->SetShowState(false);
1078 if(__pSearchBar != null)
1080 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1086 HistoryListForm::GetMonth(int month)
1088 String monthValue = L"";
1092 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1095 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1098 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1101 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1104 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1107 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUNE"));
1110 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1113 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));
1116 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1119 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1122 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1125 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1136 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1138 result r = E_FAILURE;
1139 if (__pSearchBar != null)
1141 __pSearchBar->HideKeypad();
1144 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1146 __pSearchListView->SetEnabled(true);
1147 __searchHistory = true;
1148 __searchText =__pSearchBar->GetText();
1149 AppLog("SearchTextHistory %S errormsg %s",__searchText.GetPointer(),GetErrorMessage(GetLastResult()));
1151 r = __pGroupedListView->SetShowState(false);
1156 r = __pSearchListView->SetShowState(true);
1161 r= __pSearchListView->UpdateList();
1162 if (__isNoHistoryPresent == true)
1164 GetFooter()->SetItemEnabled(0, false);
1168 GetFooter()->SetItemEnabled(0, true);
1170 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1179 __searchHistory = false;
1185 HistoryListForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1187 FloatRectangle clientRect;
1188 clientRect = GetClientAreaBoundsF();
1189 AppLogDebug("SearchBarForm::OnKeypadBoundsChanged ClientBounds(%f, %f, %f, %f)",clientRect.x, clientRect.y, clientRect.width, clientRect.height);
1190 __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1191 __pSearchListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1192 __pGroupedListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1193 // __pGroupedListView->SetEnabled(false);
1198 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1200 result r = E_FAILURE;
1201 if (__pGroupedListView != null)
1203 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1204 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1205 else if(__pSearchBar != null)
1206 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1211 __pGroupedListView->UpdateList();
1213 if (__pSearchListView != null)
1215 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1221 __pSearchListView->UpdateList();
1223 if(__pSearchBar != null)
1224 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1229 if (__isNoHistoryPresent == true)
1231 GetFooter()->SetItemEnabled(0, false);
1235 GetFooter()->SetItemEnabled(0, true);
1240 HistoryListForm::OnKeypadWillOpen(Control& source)
1242 GetFooter()->SetShowState(false);
1243 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1244 __pSearchListView->SetEnabled(false);
1245 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1251 HistoryListForm::OnKeypadOpened(Control& source)
1253 // this is added because some time footer is shown when key pad is opened, do not remove
1254 GetFooter()->SetShowState(false);
1255 GetFooter()->Invalidate(true);
1256 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1260 HistoryListForm::OnKeypadClosed(Control& source)
1262 if(Clipboard::GetInstance()->IsPopupVisible() == true)
1266 GetFooter()->SetShowState(true);
1267 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1268 __pSearchListView->Invalidate(false);
1269 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1270 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1275 HistoryListForm::CreateGroupItems()
1277 result r = E_FAILURE;
1278 DateTime currentTime;
1280 GroupItemClass* pGroupItemClass = null;
1283 String weeksAgo2 = L"";
1284 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
1286 String weeksAgo3 = L"";
1287 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1289 if (__pGroupData != null)
1291 __pGroupData->RemoveAll(false);
1292 delete __pGroupData;
1293 __pGroupData = null;
1295 __pGroupData = new(std::nothrow) ArrayList();
1296 if (__pGroupData == null)
1300 r = __pGroupData->Construct();
1303 delete __pGroupData;
1304 __pGroupData = null;
1307 if (__searchHistory == true)
1309 pGroupItemClass = new(std::nothrow) GroupItemClass();
1310 if (pGroupItemClass == null)
1314 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1315 pGroupItemClass->SetTitleText(titleText);
1316 r = __pGroupData->Add(*pGroupItemClass);
1324 Calendar* pGregorianCalendar = null;
1327 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1328 pGroupItemClass = new(std::nothrow) GroupItemClass();
1329 if (pGroupItemClass == null)
1333 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1334 pGroupItemClass->SetTitleText(titleText);
1335 pGroupItemClass->SetEndTime(currentTime);
1336 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1337 pGroupItemClass->SetStartTime(dateTime);
1338 __pGroupData->Add(*pGroupItemClass);
1341 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1342 if ( pGregorianCalendar != NULL )
1344 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1345 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1346 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1347 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1348 delete pGregorianCalendar;
1353 pGroupItemClass = new(std::nothrow) GroupItemClass();
1354 if (pGroupItemClass == null)
1358 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1359 pGroupItemClass->SetTitleText(titleText);
1360 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1361 pGroupItemClass->SetEndTime(dateTime);
1362 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1363 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1364 pGroupItemClass->SetStartTime(dateTime);
1365 __pGroupData->Add(*pGroupItemClass);
1368 pGroupItemClass = new(std::nothrow) GroupItemClass();
1369 if (pGroupItemClass == null)
1373 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1374 pGroupItemClass->SetTitleText(titleText);
1375 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1376 pGroupItemClass->SetEndTime(dateTime);
1377 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1378 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1379 pGroupItemClass->SetStartTime(dateTime);
1380 __pGroupData->Add(*pGroupItemClass);
1383 pGroupItemClass = new(std::nothrow) GroupItemClass();
1384 if (pGroupItemClass == null)
1388 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1389 pGroupItemClass->SetTitleText(titleText);
1390 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1391 pGroupItemClass->SetEndTime(dateTime);
1392 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1393 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1394 pGroupItemClass->SetStartTime(dateTime);
1395 __pGroupData->Add(*pGroupItemClass);
1397 pGroupItemClass = new(std::nothrow) GroupItemClass();
1398 if (pGroupItemClass == null)
1402 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1403 pGroupItemClass->SetTitleText(titleText);
1404 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1405 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1406 pGroupItemClass->SetEndTime(dateTime);
1407 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1408 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1409 pGroupItemClass->SetStartTime(dateTime);
1410 __pGroupData->Add(*pGroupItemClass);
1413 pGroupItemClass = new(std::nothrow) GroupItemClass();
1414 if (pGroupItemClass == null)
1418 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1419 pGroupItemClass->SetTitleText(titleText);
1420 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1421 pGroupItemClass->SetEndTime(dateTime);
1422 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1423 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1424 pGroupItemClass->SetStartTime(dateTime);
1425 __pGroupData->Add(*pGroupItemClass);
1427 pGroupItemClass = new(std::nothrow) GroupItemClass();
1428 if (pGroupItemClass == null)
1432 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1433 pGroupItemClass->SetTitleText(titleText);
1434 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1435 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1436 pGroupItemClass->SetEndTime(dateTime);
1437 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1438 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1439 pGroupItemClass->SetStartTime(dateTime);
1440 __pGroupData->Add(*pGroupItemClass);
1442 pGroupItemClass = new(std::nothrow) GroupItemClass();
1443 if (pGroupItemClass == null)
1447 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1448 pGroupItemClass->SetTitleText(titleText);
1449 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1450 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1451 pGroupItemClass->SetEndTime(dateTime);
1452 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1453 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1454 pGroupItemClass->SetStartTime(dateTime);
1455 __pGroupData->Add(*pGroupItemClass);
1458 pGroupItemClass = new(std::nothrow) GroupItemClass();
1459 if (pGroupItemClass == null)
1463 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1464 pGroupItemClass->SetTitleText(titleText);
1465 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1466 pGroupItemClass->SetEndTime(dateTime);
1467 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1468 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1469 pGroupItemClass->SetStartTime(dateTime);
1470 __pGroupData->Add(*pGroupItemClass);
1472 pGroupItemClass = new(std::nothrow) GroupItemClass();
1473 if (pGroupItemClass == null)
1477 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1478 pGroupItemClass->SetTitleText(titleText);
1479 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1480 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1481 pGroupItemClass->SetEndTime(dateTime);
1482 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1483 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1484 pGroupItemClass->SetStartTime(dateTime);
1485 __pGroupData->Add(*pGroupItemClass);
1487 pGroupItemClass = new(std::nothrow) GroupItemClass();
1488 if (pGroupItemClass == null)
1492 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1493 pGroupItemClass->SetTitleText(titleText);
1494 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1495 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1496 pGroupItemClass->SetEndTime(dateTime);
1497 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1498 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1499 pGroupItemClass->SetStartTime(dateTime);
1500 __pGroupData->Add(*pGroupItemClass);
1502 pGroupItemClass = new(std::nothrow) GroupItemClass();
1503 if (pGroupItemClass == null)
1507 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1508 pGroupItemClass->SetTitleText(titleText);
1509 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1510 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1511 pGroupItemClass->SetEndTime(dateTime);
1512 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1513 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1514 pGroupItemClass->SetStartTime(dateTime);
1515 __pGroupData->Add(*pGroupItemClass);
1518 pGroupItemClass = new(std::nothrow) GroupItemClass();
1519 if (pGroupItemClass == null)
1523 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1524 pGroupItemClass->SetTitleText(titleText);
1525 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1526 pGroupItemClass->SetEndTime(dateTime);
1527 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1528 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1529 pGroupItemClass->SetStartTime(dateTime);
1530 __pGroupData->Add(*pGroupItemClass);
1532 pGroupItemClass = new(std::nothrow) GroupItemClass();
1533 if (pGroupItemClass == null)
1537 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1538 pGroupItemClass->SetTitleText(titleText);
1539 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1540 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1541 pGroupItemClass->SetEndTime(dateTime);
1542 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1543 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1544 pGroupItemClass->SetStartTime(dateTime);
1545 __pGroupData->Add(*pGroupItemClass);
1547 pGroupItemClass = new(std::nothrow) GroupItemClass();
1548 if (pGroupItemClass == null)
1552 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1553 pGroupItemClass->SetTitleText(titleText);
1554 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1555 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1556 pGroupItemClass->SetEndTime(dateTime);
1557 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1558 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1559 pGroupItemClass->SetStartTime(dateTime);
1560 __pGroupData->Add(*pGroupItemClass);
1562 pGroupItemClass = new(std::nothrow) GroupItemClass();
1563 if (pGroupItemClass == null)
1567 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1568 pGroupItemClass->SetTitleText(titleText);
1569 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1570 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1571 pGroupItemClass->SetEndTime(dateTime);
1572 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1573 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1574 pGroupItemClass->SetStartTime(dateTime);
1575 __pGroupData->Add(*pGroupItemClass);
1577 pGroupItemClass = new(std::nothrow) GroupItemClass();
1578 if (pGroupItemClass == null)
1582 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1583 pGroupItemClass->SetTitleText(titleText);
1584 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1585 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1586 pGroupItemClass->SetEndTime(dateTime);
1587 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1588 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1589 pGroupItemClass->SetStartTime(dateTime);
1590 __pGroupData->Add(*pGroupItemClass);
1593 pGroupItemClass = new(std::nothrow) GroupItemClass();
1594 if (pGroupItemClass == null)
1598 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1599 pGroupItemClass->SetTitleText(titleText);
1600 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1601 pGroupItemClass->SetEndTime(dateTime);
1602 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1603 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1604 pGroupItemClass->SetStartTime(dateTime);
1605 __pGroupData->Add(*pGroupItemClass);
1607 pGroupItemClass = new(std::nothrow) GroupItemClass();
1608 if (pGroupItemClass == null)
1612 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1613 pGroupItemClass->SetTitleText(titleText);
1614 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1615 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1616 pGroupItemClass->SetEndTime(dateTime);
1617 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1618 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1619 pGroupItemClass->SetStartTime(dateTime);
1620 __pGroupData->Add(*pGroupItemClass);
1622 pGroupItemClass = new(std::nothrow) GroupItemClass();
1623 if (pGroupItemClass == null)
1627 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1628 pGroupItemClass->SetTitleText(titleText);
1629 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1630 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1631 pGroupItemClass->SetEndTime(dateTime);
1632 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1633 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1634 pGroupItemClass->SetStartTime(dateTime);
1635 __pGroupData->Add(*pGroupItemClass);
1637 pGroupItemClass = new(std::nothrow) GroupItemClass();
1638 if (pGroupItemClass == null)
1642 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1643 pGroupItemClass->SetTitleText(titleText);
1644 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1645 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1646 pGroupItemClass->SetEndTime(dateTime);
1647 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1648 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1649 pGroupItemClass->SetStartTime(dateTime);
1650 __pGroupData->Add(*pGroupItemClass);
1652 pGroupItemClass = new(std::nothrow) GroupItemClass();
1653 if (pGroupItemClass == null)
1657 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1658 pGroupItemClass->SetTitleText(titleText);
1659 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1660 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1661 pGroupItemClass->SetEndTime(dateTime);
1662 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1663 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1664 pGroupItemClass->SetStartTime(dateTime);
1665 __pGroupData->Add(*pGroupItemClass);
1667 pGroupItemClass = new(std::nothrow) GroupItemClass();
1668 if (pGroupItemClass == null)
1672 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1673 pGroupItemClass->SetTitleText(titleText);
1674 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1675 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1676 pGroupItemClass->SetEndTime(dateTime);
1677 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1678 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1679 pGroupItemClass->SetStartTime(dateTime);
1680 __pGroupData->Add(*pGroupItemClass);
1686 day = currentTime.GetDay();
1690 pGroupItemClass = new(std::nothrow) GroupItemClass();
1691 if (pGroupItemClass == null)
1696 pGroupItemClass->SetTitleText(weeksAgo2);
1697 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1698 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1699 pGroupItemClass->SetEndTime(dateTime);
1700 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1701 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1702 pGroupItemClass->SetStartTime(dateTime);
1703 __pGroupData->Add(*pGroupItemClass);
1705 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1707 pGroupItemClass = new(std::nothrow) GroupItemClass();
1708 if (pGroupItemClass == null)
1712 String weeksAgo3 = L"";
1713 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1714 pGroupItemClass->SetTitleText(weeksAgo3);
1715 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1716 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1717 pGroupItemClass->SetEndTime(dateTime);
1718 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1719 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1720 pGroupItemClass->SetStartTime(dateTime);
1721 __pGroupData->Add(*pGroupItemClass);
1725 pGroupItemClass = new(std::nothrow) GroupItemClass();
1726 if (pGroupItemClass == null)
1730 pGroupItemClass->SetTitleText(weeksAgo2);
1731 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1732 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1733 pGroupItemClass->SetEndTime(dateTime);
1734 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1735 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1736 pGroupItemClass->SetStartTime(dateTime);
1737 __pGroupData->Add(*pGroupItemClass);
1739 pGroupItemClass = new(std::nothrow) GroupItemClass();
1740 if (pGroupItemClass == null)
1745 pGroupItemClass->SetTitleText(weeksAgo3);
1746 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1747 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1748 pGroupItemClass->SetEndTime(dateTime);
1749 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1750 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1751 pGroupItemClass->SetStartTime(dateTime);
1752 __pGroupData->Add(*pGroupItemClass);
1754 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1756 pGroupItemClass = new(std::nothrow) GroupItemClass();
1757 if (pGroupItemClass == null)
1761 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1762 pGroupItemClass->SetTitleText(titleText);
1763 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1764 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1765 pGroupItemClass->SetEndTime(dateTime);
1766 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1767 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1768 pGroupItemClass->SetStartTime(dateTime);
1769 __pGroupData->Add(*pGroupItemClass);
1773 pGroupItemClass = new(std::nothrow) GroupItemClass();
1774 if (pGroupItemClass == null)
1778 pGroupItemClass->SetTitleText(weeksAgo2);
1779 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1780 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1781 pGroupItemClass->SetEndTime(dateTime);
1782 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1783 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1784 pGroupItemClass->SetStartTime(dateTime);
1785 __pGroupData->Add(*pGroupItemClass);
1787 pGroupItemClass = new(std::nothrow) GroupItemClass();
1788 if (pGroupItemClass == null)
1792 pGroupItemClass->SetTitleText(weeksAgo3);
1793 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1794 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1795 pGroupItemClass->SetEndTime(dateTime);
1796 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1797 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1798 pGroupItemClass->SetStartTime(dateTime);
1799 __pGroupData->Add(*pGroupItemClass);
1801 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1803 pGroupItemClass = new(std::nothrow) GroupItemClass();
1804 if (pGroupItemClass == null)
1808 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1809 pGroupItemClass->SetTitleText(titleText);
1810 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1811 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1812 pGroupItemClass->SetEndTime(dateTime);
1813 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1814 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1815 pGroupItemClass->SetStartTime(dateTime);
1816 __pGroupData->Add(*pGroupItemClass);
1822 pGroupItemClass = new(std::nothrow) GroupItemClass();
1823 if (pGroupItemClass == null)
1827 titleText = CommonUtil::GetString(L"IDS_EMAIL_BODY_LAST_MONTH");
1828 pGroupItemClass->SetTitleText(titleText);
1829 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1830 dateTime.AddDays(-1);
1831 pGroupItemClass->SetEndTime(dateTime);
1832 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1833 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1834 pGroupItemClass->SetStartTime(dateTime);
1835 __pGroupData->Add(*pGroupItemClass);
1837 pGroupItemClass = new(std::nothrow) GroupItemClass();
1838 if (pGroupItemClass == null)
1842 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1843 pGroupItemClass->SetTitleText(titleText);
1844 dateTime.SetValue(currentTime.GetYear(),1, 1);
1845 dateTime.AddMonths(currentTime.GetMonth() - 2);
1846 dateTime.AddDays(-1);
1847 pGroupItemClass->SetEndTime(dateTime);
1849 dateTime2.SetValue(0, 0, 0);
1850 pGroupItemClass->SetStartTime(dateTime2);
1851 __pGroupData->Add(*pGroupItemClass);
1855 GroupItemClass::GroupItemClass()
1861 GroupItemClass::operator =(const GroupItemClass& rhs)
1865 __pData = rhs.__pData;
1870 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1872 __pData = groupItem.__pData;
1875 GroupItemClass::~GroupItemClass()
1879 __pData->RemoveAll(true);
1885 GroupItemClass::SetStartTime(DateTime& startTime)
1887 __startTime = startTime;
1891 GroupItemClass::SetEndTime(DateTime& endTime)
1893 __endTime = endTime;
1897 GroupItemClass::SetTitleText(String& titleText)
1899 __titleText = titleText;
1903 GroupItemClass::SetHistoryData(ArrayList* pData)
1909 GroupItemClass::GetStartTime(void)
1915 GroupItemClass::GetEndTime(void)
1921 GroupItemClass::GetTitleText(void)
1927 GroupItemClass::GetHistoryData(void)
1933 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1935 if (__pGroupedListView)
1937 __pGroupedListView->UpdateList();