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");
297 if(pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT))!= E_SUCCESS)
299 AppLogDebug("BookmarkListForm::OnActionPerformed GoBackward failed");
314 HistoryListForm::OnFocusGained(const Tizen::Ui::Control& source)
316 __pSearchListView->SetEnabled(false);
320 HistoryListForm::OnFocusLost(const Tizen::Ui::Control& source)
322 __pSearchListView->SetEnabled(true);
323 __searchHistory = false;
326 HistoryListForm::OnFormBackRequested(Form& source)
328 SceneManager* pSceneManager = SceneManager::GetInstance();
329 if (pSceneManager == null)
333 result r = E_FAILURE;
334 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
336 r = pSceneManager->GoBackward(BackwardSceneTransition());
340 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
344 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
349 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
351 result r = E_FAILURE;
357 GroupItem* pItem = null;
358 GroupItemClass* pGroupItemClass = null;
360 String weeksAgo2 = L"";
361 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
363 String weeksAgo3 = L"";
364 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
366 String weeksAgo4 = L"";
367 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),4);
369 pItem = new(std::nothrow) GroupItem();
374 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
376 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
378 AppLog("CreateGroupItem :: if history is null");
379 r = pItem->Construct(Dimension(itemWidth, 0));
384 r = pItem->Construct(Dimension(itemWidth, 48));
386 text = pGroupItemClass->GetTitleText();
388 if (__searchHistory == false)
392 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
395 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
396 if ( pGregorianCalendar != NULL)
398 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
405 delete pGregorianCalendar;
408 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
415 delete pGregorianCalendar;
418 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
425 delete pGregorianCalendar;
428 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
429 if (pGregorianCalendar != NULL)
431 delete pGregorianCalendar;
438 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
441 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
444 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
447 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
450 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
453 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
456 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
464 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
466 text.Append(pGroupItemClass->GetStartTime().GetDay());
468 strMonth = pGroupItemClass->GetStartTime().GetMonth();
469 month = GetMonth(strMonth);
479 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
480 || 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"))
483 text.Append(pGroupItemClass->GetEndTime().GetDay());
485 strMonth = pGroupItemClass->GetEndTime().GetMonth();
486 month = GetMonth(strMonth);
492 r = pItem->SetElement(text, null);
496 AppLogDebug("Failed with %s", GetErrorMessage(r));
499 r = pItem->SetTextSize(32);
510 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
512 AppLog("HistoryListForm::CreateItem");
513 result r = E_FAILURE;
514 History* pHistory = null;
515 Bitmap* pBitmap = null;
516 Bitmap* pBookmarkBitmap = null;
517 GroupItemClass* pGroupItemClass = null;
518 CustomItem* pItem = new(std::nothrow) CustomItem();
519 int bookmarkBtnWidth = 0;
522 Image* pImage = null;
523 pImage = new Image();
526 if(__pGroupData == null)
536 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
537 if (pGroupItemClass == null)
542 if (pGroupItemClass->GetHistoryData() == null)
547 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
548 if (pHistory == null)
553 r = pItem->Construct(Dimension(itemWidth, 128 - 44 + __fontSize), LIST_ANNEX_STYLE_NORMAL);
560 ByteBuffer* pFavIconBuffer = null;
561 pFavIconBuffer = pHistory->GetFavIconBuffer();
563 AppLog("BookmarkListForm::CreateItem check 0");
565 if (pFavIconBuffer != null)
567 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is not null");
571 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is null");
574 pBitmap = pImage->DecodeN(*pFavIconBuffer, IMG_FORMAT_PNG, BITMAP_PIXEL_FORMAT_ARGB8888);
576 AppLog("BookmarkListForm::CreateItem check 1");
578 //bitmapId = pHistory->GetFaviconId() ;
579 //pBitmap = pHistory->GetFavIconBitmap();
583 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
587 r = pItem->AddElement(Rectangle(16, 28 + (__fontSize - 44)/2,72, 72), IDA_FORMAT_ICON, *pBitmap, null);
592 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
596 bool urlFoundInBookmark = false;
598 if(__pBookmarkList != null)
600 for (int i = 0; i < __pBookmarkList->GetCount();i++)
602 BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
603 if(pBookMark != null && pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
605 urlFoundInBookmark = true;
610 if (urlFoundInBookmark == true)
612 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
616 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
618 bookmarkBtnWidth = 64;
621 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);
622 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
624 // if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
625 // 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);
627 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);
628 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
629 if ( pBookmarkBitmap != null)
631 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2 +(__fontSize - 44)/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
632 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
633 delete pBookmarkBitmap;
644 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
653 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
655 AppLog("HistoryListForm::DeleteItem");
656 result r = E_FAILURE;
657 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
658 if (pGroupItemClass == null)
663 // if (pGroupItemClass->__pData != null)
665 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
678 HistoryListForm::GetGroupCount(void)
680 __isNoHistoryPresent = true;
682 if (__pGroupData != null)
684 if (__searchHistory == false)
689 HistoryPresentationModel::GetCurrentDateTime(endTime);
691 startTime.SetValue(0,0,0);
693 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
698 return __pGroupData->GetCount();
703 if (__searchText.GetLength() > 0)
705 __searchText.Replace(L"%", L"/%");
706 __searchText.Replace(L"_", L"/_");
708 // String searchText = __pSearchBar->GetText();
709 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
723 HistoryListForm::GetItemCount(int groupIndex)
725 result r = E_FAILURE;
731 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
732 if (pGroupItemClass == null)
737 if (__searchHistory == false)
739 startTime = pGroupItemClass->GetStartTime();
740 endTime = pGroupItemClass->GetEndTime();
741 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
745 //text = __pSearchBar->GetText();
746 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
757 ArrayList* pData = new(std::nothrow) ArrayList();
762 r = pData->Construct();
770 if (__searchHistory == false)
772 startTime = pGroupItemClass->GetStartTime();
773 endTime = pGroupItemClass->GetEndTime();
774 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
775 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
779 //text = __pSearchBar->GetText() ;
780 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
787 pGroupItemClass->SetHistoryData(pData);
790 if (__isNoHistoryPresent == true && count == 0)
792 __isNoHistoryPresent = true;
793 GetFooter()->SetItemEnabled(0, false);
797 __isNoHistoryPresent = false;
798 GetFooter()->SetItemEnabled(0, true);
800 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
801 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
808 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
809 return pGroupItemClass->GetHistoryData()->GetCount();
814 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
817 GetHeader()->SetItemSelected(1);
818 // __previousSceneId = previousSceneId;
819 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
822 pList->GetAt(pList->GetCount()-1,__previousSceneId);
825 if(__pBookmarkList != null)
827 __pBookmarkList->RemoveAll(false);
830 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
832 AppLog("HistoryListForm::OnSceneActivatedN called");
833 //GetHeader()->Invalidate(true);
834 if (__pGroupData == null)
836 __pGroupData = new(std::nothrow) ArrayList();
837 __pGroupData->Construct();
839 if (__pGroupedListView != null)
841 __pGroupedListView->UpdateList();
843 if (__isNoHistoryPresent == true)
845 GetFooter()->SetItemEnabled(0, false);
849 GetFooter()->SetItemEnabled(0, true);
855 HistoryPresentationModel::GetCurrentDateTime(endTime);;
857 startTime.SetValue(0,0,0);
858 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
861 __pSearchBar->SetShowState(false);
862 __pSearchBar->Invalidate(true);
866 __pSearchBar->SetShowState(true);
867 __pSearchBar->Invalidate(true);
870 // if (__isNoHistoryPresent == true)
872 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
873 // __pGroupedListView->UpdateList();
876 result r = GetHeader()->SetItemSelected(2);
879 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
890 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
892 AppLog("HistoryListForm::OnSceneDeactivated");
893 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
897 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
903 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
905 GroupItemClass* pGroupItemClass = null;
906 History* pHistory = null;
907 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
908 if (elementId == IDA_FORMAT_BOOKMARK)
910 String toggledUrl = L"";
911 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
912 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
913 if (pGroupItemClass == null)
917 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
918 if (pHistory == null)
922 toggledUrl = pHistory->GetHistoryUrl();
924 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
926 bool bookmarkFound = false;
927 BookmarkData* pBookMark = null;
928 if(__pBookmarkList != null)
930 for (int i = 0; i < __pBookmarkList->GetCount(); i++)
932 pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
933 if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
935 bookmarkFound = true;
940 if(bookmarkFound == false)
942 // Add the history in bookmark database
943 result r = E_FAILURE;
944 BookmarkData bookmark;
946 String bookmarkTitle = pHistory->GetHistoryTitle();
948 bookmark.SetBookmarkTitle(bookmarkTitle);
949 bookmark.SetUrl(pHistory->GetHistoryUrl());
950 bookmark.SetFaviconId(pHistory->GetFaviconId());
951 bookmark.SetFavIconBuffer(*pHistory->GetFavIconBuffer());
952 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
953 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(bookmark);
957 // remove the history from bookmark database
958 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
961 if(__pBookmarkList != null)
963 __pBookmarkList->RemoveAll(false);
964 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
966 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
967 listView.UpdateList();
971 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
972 if (pGroupItemClass == null)
977 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
978 if (pHistory1 == null)
982 SceneManager* pSceneManager = SceneManager::GetInstance();
983 ArrayList *pArgList = null;
984 result r = E_SUCCESS;
985 pArgList = new(std::nothrow) ArrayList();
986 if (pArgList != null)
988 r = pArgList->Construct();
995 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
996 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
1006 String scneId = L"";
1007 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
1009 if (pSceneManager != null)
1011 AppLog("pSceneManager exists");
1012 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
1015 pArgList->RemoveAll(false);
1028 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
1034 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
1036 result r = E_FAILURE;
1037 if (mode == SEARCH_BAR_MODE_NORMAL)
1039 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1041 __pSearchListView->SetEnabled(true);
1044 r = __pSearchListView->SetShowState(false);
1049 r = __pGroupedListView->SetShowState(true);
1055 __pSearchListView->SetEnabled(true);
1056 if(__pSearchBar != null)
1057 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1059 __searchHistory = false;
1060 r = __pGroupedListView->UpdateList();
1061 if (__isNoHistoryPresent == true)
1063 GetFooter()->SetItemEnabled(0, false);
1067 GetFooter()->SetItemEnabled(0, true);
1069 if(__pSearchBar != null)
1071 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1081 // __pSearchListView->SetEnabled(false);
1082 r = __pSearchListView->SetShowState(true);
1087 __pSearchListView->SetEnabled(false);
1088 r = __pSearchListView->UpdateList();
1093 r = __pGroupedListView->SetShowState(false);
1098 if(__pSearchBar != null)
1100 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1106 HistoryListForm::GetMonth(int month)
1108 String monthValue = L"";
1112 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1115 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1118 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1121 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1124 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1127 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUNE"));
1130 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1133 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));
1136 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1139 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1142 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1145 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1156 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1158 result r = E_FAILURE;
1159 if (__pSearchBar != null)
1161 __pSearchBar->HideKeypad();
1164 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1166 __pSearchListView->SetEnabled(true);
1167 __searchHistory = true;
1168 __searchText =__pSearchBar->GetText();
1169 AppLog("SearchTextHistory %S errormsg %s",__searchText.GetPointer(),GetErrorMessage(GetLastResult()));
1171 r = __pGroupedListView->SetShowState(false);
1176 r = __pSearchListView->SetShowState(true);
1181 r= __pSearchListView->UpdateList();
1182 if (__isNoHistoryPresent == true)
1184 GetFooter()->SetItemEnabled(0, false);
1188 GetFooter()->SetItemEnabled(0, true);
1190 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1199 __searchHistory = false;
1205 HistoryListForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1207 FloatRectangle clientRect;
1208 clientRect = GetClientAreaBoundsF();
1209 AppLogDebug("SearchBarForm::OnKeypadBoundsChanged ClientBounds(%f, %f, %f, %f)",clientRect.x, clientRect.y, clientRect.width, clientRect.height);
1210 __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1211 __pSearchListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1212 __pGroupedListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1213 // __pGroupedListView->SetEnabled(false);
1218 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1220 result r = E_FAILURE;
1221 if (__pGroupedListView != null)
1223 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1224 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1225 else if(__pSearchBar != null)
1226 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1231 __pGroupedListView->UpdateList();
1233 if (__pSearchListView != null)
1235 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1241 __pSearchListView->UpdateList();
1243 if(__pSearchBar != null)
1244 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1249 if (__isNoHistoryPresent == true)
1251 GetFooter()->SetItemEnabled(0, false);
1255 GetFooter()->SetItemEnabled(0, true);
1260 HistoryListForm::OnKeypadWillOpen(Control& source)
1262 GetFooter()->SetShowState(false);
1263 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1264 __pSearchListView->SetEnabled(false);
1265 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1271 HistoryListForm::OnKeypadOpened(Control& source)
1273 // this is added because some time footer is shown when key pad is opened, do not remove
1274 GetFooter()->SetShowState(false);
1275 GetFooter()->Invalidate(true);
1276 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1280 HistoryListForm::OnKeypadClosed(Control& source)
1282 if(Clipboard::GetInstance()->IsPopupVisible() == true)
1286 GetFooter()->SetShowState(true);
1287 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1288 __pSearchListView->Invalidate(false);
1289 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1290 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1295 HistoryListForm::CreateGroupItems()
1297 result r = E_FAILURE;
1298 DateTime currentTime;
1300 GroupItemClass* pGroupItemClass = null;
1303 String weeksAgo2 = L"";
1304 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
1306 String weeksAgo3 = L"";
1307 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1309 if (__pGroupData != null)
1311 __pGroupData->RemoveAll(false);
1312 delete __pGroupData;
1313 __pGroupData = null;
1315 __pGroupData = new(std::nothrow) ArrayList();
1316 if (__pGroupData == null)
1320 r = __pGroupData->Construct();
1323 delete __pGroupData;
1324 __pGroupData = null;
1327 if (__searchHistory == true)
1329 pGroupItemClass = new(std::nothrow) GroupItemClass();
1330 if (pGroupItemClass == null)
1334 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1335 pGroupItemClass->SetTitleText(titleText);
1336 r = __pGroupData->Add(*pGroupItemClass);
1344 Calendar* pGregorianCalendar = null;
1347 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1348 pGroupItemClass = new(std::nothrow) GroupItemClass();
1349 if (pGroupItemClass == null)
1353 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1354 pGroupItemClass->SetTitleText(titleText);
1355 pGroupItemClass->SetEndTime(currentTime);
1356 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1357 pGroupItemClass->SetStartTime(dateTime);
1358 __pGroupData->Add(*pGroupItemClass);
1361 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1362 if ( pGregorianCalendar != NULL )
1364 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1365 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1366 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1367 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1368 delete pGregorianCalendar;
1373 pGroupItemClass = new(std::nothrow) GroupItemClass();
1374 if (pGroupItemClass == null)
1378 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1379 pGroupItemClass->SetTitleText(titleText);
1380 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1381 pGroupItemClass->SetEndTime(dateTime);
1382 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1383 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1384 pGroupItemClass->SetStartTime(dateTime);
1385 __pGroupData->Add(*pGroupItemClass);
1388 pGroupItemClass = new(std::nothrow) GroupItemClass();
1389 if (pGroupItemClass == null)
1393 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1394 pGroupItemClass->SetTitleText(titleText);
1395 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1396 pGroupItemClass->SetEndTime(dateTime);
1397 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1398 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1399 pGroupItemClass->SetStartTime(dateTime);
1400 __pGroupData->Add(*pGroupItemClass);
1403 pGroupItemClass = new(std::nothrow) GroupItemClass();
1404 if (pGroupItemClass == null)
1408 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1409 pGroupItemClass->SetTitleText(titleText);
1410 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1411 pGroupItemClass->SetEndTime(dateTime);
1412 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1413 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1414 pGroupItemClass->SetStartTime(dateTime);
1415 __pGroupData->Add(*pGroupItemClass);
1417 pGroupItemClass = new(std::nothrow) GroupItemClass();
1418 if (pGroupItemClass == null)
1422 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1423 pGroupItemClass->SetTitleText(titleText);
1424 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1425 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1426 pGroupItemClass->SetEndTime(dateTime);
1427 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1428 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1429 pGroupItemClass->SetStartTime(dateTime);
1430 __pGroupData->Add(*pGroupItemClass);
1433 pGroupItemClass = new(std::nothrow) GroupItemClass();
1434 if (pGroupItemClass == null)
1438 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1439 pGroupItemClass->SetTitleText(titleText);
1440 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1441 pGroupItemClass->SetEndTime(dateTime);
1442 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1443 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1444 pGroupItemClass->SetStartTime(dateTime);
1445 __pGroupData->Add(*pGroupItemClass);
1447 pGroupItemClass = new(std::nothrow) GroupItemClass();
1448 if (pGroupItemClass == null)
1452 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1453 pGroupItemClass->SetTitleText(titleText);
1454 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1455 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1456 pGroupItemClass->SetEndTime(dateTime);
1457 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1458 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1459 pGroupItemClass->SetStartTime(dateTime);
1460 __pGroupData->Add(*pGroupItemClass);
1462 pGroupItemClass = new(std::nothrow) GroupItemClass();
1463 if (pGroupItemClass == null)
1467 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1468 pGroupItemClass->SetTitleText(titleText);
1469 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1470 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1471 pGroupItemClass->SetEndTime(dateTime);
1472 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1473 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1474 pGroupItemClass->SetStartTime(dateTime);
1475 __pGroupData->Add(*pGroupItemClass);
1478 pGroupItemClass = new(std::nothrow) GroupItemClass();
1479 if (pGroupItemClass == null)
1483 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1484 pGroupItemClass->SetTitleText(titleText);
1485 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1486 pGroupItemClass->SetEndTime(dateTime);
1487 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1488 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1489 pGroupItemClass->SetStartTime(dateTime);
1490 __pGroupData->Add(*pGroupItemClass);
1492 pGroupItemClass = new(std::nothrow) GroupItemClass();
1493 if (pGroupItemClass == null)
1497 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1498 pGroupItemClass->SetTitleText(titleText);
1499 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1500 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1501 pGroupItemClass->SetEndTime(dateTime);
1502 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1503 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1504 pGroupItemClass->SetStartTime(dateTime);
1505 __pGroupData->Add(*pGroupItemClass);
1507 pGroupItemClass = new(std::nothrow) GroupItemClass();
1508 if (pGroupItemClass == null)
1512 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1513 pGroupItemClass->SetTitleText(titleText);
1514 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1515 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1516 pGroupItemClass->SetEndTime(dateTime);
1517 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1518 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1519 pGroupItemClass->SetStartTime(dateTime);
1520 __pGroupData->Add(*pGroupItemClass);
1522 pGroupItemClass = new(std::nothrow) GroupItemClass();
1523 if (pGroupItemClass == null)
1527 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1528 pGroupItemClass->SetTitleText(titleText);
1529 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1530 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1531 pGroupItemClass->SetEndTime(dateTime);
1532 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1533 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1534 pGroupItemClass->SetStartTime(dateTime);
1535 __pGroupData->Add(*pGroupItemClass);
1538 pGroupItemClass = new(std::nothrow) GroupItemClass();
1539 if (pGroupItemClass == null)
1543 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1544 pGroupItemClass->SetTitleText(titleText);
1545 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1546 pGroupItemClass->SetEndTime(dateTime);
1547 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1548 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1549 pGroupItemClass->SetStartTime(dateTime);
1550 __pGroupData->Add(*pGroupItemClass);
1552 pGroupItemClass = new(std::nothrow) GroupItemClass();
1553 if (pGroupItemClass == null)
1557 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1558 pGroupItemClass->SetTitleText(titleText);
1559 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1560 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1561 pGroupItemClass->SetEndTime(dateTime);
1562 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1563 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1564 pGroupItemClass->SetStartTime(dateTime);
1565 __pGroupData->Add(*pGroupItemClass);
1567 pGroupItemClass = new(std::nothrow) GroupItemClass();
1568 if (pGroupItemClass == null)
1572 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1573 pGroupItemClass->SetTitleText(titleText);
1574 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1575 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1576 pGroupItemClass->SetEndTime(dateTime);
1577 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1578 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1579 pGroupItemClass->SetStartTime(dateTime);
1580 __pGroupData->Add(*pGroupItemClass);
1582 pGroupItemClass = new(std::nothrow) GroupItemClass();
1583 if (pGroupItemClass == null)
1587 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1588 pGroupItemClass->SetTitleText(titleText);
1589 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1590 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1591 pGroupItemClass->SetEndTime(dateTime);
1592 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1593 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1594 pGroupItemClass->SetStartTime(dateTime);
1595 __pGroupData->Add(*pGroupItemClass);
1597 pGroupItemClass = new(std::nothrow) GroupItemClass();
1598 if (pGroupItemClass == null)
1602 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1603 pGroupItemClass->SetTitleText(titleText);
1604 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1605 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1606 pGroupItemClass->SetEndTime(dateTime);
1607 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1608 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1609 pGroupItemClass->SetStartTime(dateTime);
1610 __pGroupData->Add(*pGroupItemClass);
1613 pGroupItemClass = new(std::nothrow) GroupItemClass();
1614 if (pGroupItemClass == null)
1618 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1619 pGroupItemClass->SetTitleText(titleText);
1620 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1621 pGroupItemClass->SetEndTime(dateTime);
1622 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1623 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1624 pGroupItemClass->SetStartTime(dateTime);
1625 __pGroupData->Add(*pGroupItemClass);
1627 pGroupItemClass = new(std::nothrow) GroupItemClass();
1628 if (pGroupItemClass == null)
1632 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1633 pGroupItemClass->SetTitleText(titleText);
1634 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1635 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1636 pGroupItemClass->SetEndTime(dateTime);
1637 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1638 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1639 pGroupItemClass->SetStartTime(dateTime);
1640 __pGroupData->Add(*pGroupItemClass);
1642 pGroupItemClass = new(std::nothrow) GroupItemClass();
1643 if (pGroupItemClass == null)
1647 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1648 pGroupItemClass->SetTitleText(titleText);
1649 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1650 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1651 pGroupItemClass->SetEndTime(dateTime);
1652 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1653 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1654 pGroupItemClass->SetStartTime(dateTime);
1655 __pGroupData->Add(*pGroupItemClass);
1657 pGroupItemClass = new(std::nothrow) GroupItemClass();
1658 if (pGroupItemClass == null)
1662 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1663 pGroupItemClass->SetTitleText(titleText);
1664 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1665 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1666 pGroupItemClass->SetEndTime(dateTime);
1667 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1668 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1669 pGroupItemClass->SetStartTime(dateTime);
1670 __pGroupData->Add(*pGroupItemClass);
1672 pGroupItemClass = new(std::nothrow) GroupItemClass();
1673 if (pGroupItemClass == null)
1677 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1678 pGroupItemClass->SetTitleText(titleText);
1679 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1680 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1681 pGroupItemClass->SetEndTime(dateTime);
1682 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1683 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1684 pGroupItemClass->SetStartTime(dateTime);
1685 __pGroupData->Add(*pGroupItemClass);
1687 pGroupItemClass = new(std::nothrow) GroupItemClass();
1688 if (pGroupItemClass == null)
1692 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1693 pGroupItemClass->SetTitleText(titleText);
1694 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1695 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1696 pGroupItemClass->SetEndTime(dateTime);
1697 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1698 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1699 pGroupItemClass->SetStartTime(dateTime);
1700 __pGroupData->Add(*pGroupItemClass);
1706 day = currentTime.GetDay();
1710 pGroupItemClass = new(std::nothrow) GroupItemClass();
1711 if (pGroupItemClass == null)
1716 pGroupItemClass->SetTitleText(weeksAgo2);
1717 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1718 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1719 pGroupItemClass->SetEndTime(dateTime);
1720 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1721 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1722 pGroupItemClass->SetStartTime(dateTime);
1723 __pGroupData->Add(*pGroupItemClass);
1725 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1727 pGroupItemClass = new(std::nothrow) GroupItemClass();
1728 if (pGroupItemClass == null)
1732 String weeksAgo3 = L"";
1733 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1734 pGroupItemClass->SetTitleText(weeksAgo3);
1735 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1736 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1737 pGroupItemClass->SetEndTime(dateTime);
1738 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1739 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1740 pGroupItemClass->SetStartTime(dateTime);
1741 __pGroupData->Add(*pGroupItemClass);
1745 pGroupItemClass = new(std::nothrow) GroupItemClass();
1746 if (pGroupItemClass == null)
1750 pGroupItemClass->SetTitleText(weeksAgo2);
1751 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1752 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1753 pGroupItemClass->SetEndTime(dateTime);
1754 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1755 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1756 pGroupItemClass->SetStartTime(dateTime);
1757 __pGroupData->Add(*pGroupItemClass);
1759 pGroupItemClass = new(std::nothrow) GroupItemClass();
1760 if (pGroupItemClass == null)
1765 pGroupItemClass->SetTitleText(weeksAgo3);
1766 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1767 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1768 pGroupItemClass->SetEndTime(dateTime);
1769 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1770 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1771 pGroupItemClass->SetStartTime(dateTime);
1772 __pGroupData->Add(*pGroupItemClass);
1774 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1776 pGroupItemClass = new(std::nothrow) GroupItemClass();
1777 if (pGroupItemClass == null)
1781 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1782 pGroupItemClass->SetTitleText(titleText);
1783 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1784 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1785 pGroupItemClass->SetEndTime(dateTime);
1786 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1787 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1788 pGroupItemClass->SetStartTime(dateTime);
1789 __pGroupData->Add(*pGroupItemClass);
1793 pGroupItemClass = new(std::nothrow) GroupItemClass();
1794 if (pGroupItemClass == null)
1798 pGroupItemClass->SetTitleText(weeksAgo2);
1799 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1800 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1801 pGroupItemClass->SetEndTime(dateTime);
1802 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1803 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1804 pGroupItemClass->SetStartTime(dateTime);
1805 __pGroupData->Add(*pGroupItemClass);
1807 pGroupItemClass = new(std::nothrow) GroupItemClass();
1808 if (pGroupItemClass == null)
1812 pGroupItemClass->SetTitleText(weeksAgo3);
1813 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1814 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1815 pGroupItemClass->SetEndTime(dateTime);
1816 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1817 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1818 pGroupItemClass->SetStartTime(dateTime);
1819 __pGroupData->Add(*pGroupItemClass);
1821 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1823 pGroupItemClass = new(std::nothrow) GroupItemClass();
1824 if (pGroupItemClass == null)
1828 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1829 pGroupItemClass->SetTitleText(titleText);
1830 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1831 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1832 pGroupItemClass->SetEndTime(dateTime);
1833 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1834 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1835 pGroupItemClass->SetStartTime(dateTime);
1836 __pGroupData->Add(*pGroupItemClass);
1842 pGroupItemClass = new(std::nothrow) GroupItemClass();
1843 if (pGroupItemClass == null)
1847 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_MONTH");
1848 pGroupItemClass->SetTitleText(titleText);
1849 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1850 dateTime.AddDays(-1);
1851 pGroupItemClass->SetEndTime(dateTime);
1852 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1853 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1854 pGroupItemClass->SetStartTime(dateTime);
1855 __pGroupData->Add(*pGroupItemClass);
1857 pGroupItemClass = new(std::nothrow) GroupItemClass();
1858 if (pGroupItemClass == null)
1862 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1863 pGroupItemClass->SetTitleText(titleText);
1864 dateTime.SetValue(currentTime.GetYear(),1, 1);
1865 dateTime.AddMonths(currentTime.GetMonth() - 2);
1866 dateTime.AddDays(-1);
1867 pGroupItemClass->SetEndTime(dateTime);
1869 dateTime2.SetValue(0, 0, 0);
1870 pGroupItemClass->SetStartTime(dateTime2);
1871 __pGroupData->Add(*pGroupItemClass);
1875 GroupItemClass::GroupItemClass()
1881 GroupItemClass::operator =(const GroupItemClass& rhs)
1885 __pData = rhs.__pData;
1890 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1892 __pData = groupItem.__pData;
1895 GroupItemClass::~GroupItemClass()
1899 __pData->RemoveAll(true);
1905 GroupItemClass::SetStartTime(DateTime& startTime)
1907 __startTime = startTime;
1911 GroupItemClass::SetEndTime(DateTime& endTime)
1913 __endTime = endTime;
1917 GroupItemClass::SetTitleText(String& titleText)
1919 __titleText = titleText;
1923 GroupItemClass::SetHistoryData(ArrayList* pData)
1929 GroupItemClass::GetStartTime(void)
1935 GroupItemClass::GetEndTime(void)
1941 GroupItemClass::GetTitleText(void)
1947 GroupItemClass::GetHistoryData(void)
1953 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1955 if (__pGroupedListView)
1957 __pGroupedListView->UpdateList();