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");
305 // r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
318 HistoryListForm::OnFocusGained(const Tizen::Ui::Control& source)
320 __pSearchListView->SetEnabled(false);
324 HistoryListForm::OnFocusLost(const Tizen::Ui::Control& source)
326 __pSearchListView->SetEnabled(true);
327 __searchHistory = false;
330 HistoryListForm::OnFormBackRequested(Form& source)
332 SceneManager* pSceneManager = SceneManager::GetInstance();
333 if (pSceneManager == null)
337 result r = E_FAILURE;
338 if(__previousSceneId.CompareTo(IDSCN_BOOKMARK_VIEW) != 0)
340 r = pSceneManager->GoBackward(BackwardSceneTransition());
344 r = pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
348 AppLogDebug("HistoryListForm::OnFormBackRequested GoForward failed %s",GetErrorMessage(r));
353 HistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
355 result r = E_FAILURE;
361 GroupItem* pItem = null;
362 GroupItemClass* pGroupItemClass = null;
364 String weeksAgo2 = L"";
365 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
367 String weeksAgo3 = L"";
368 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
370 String weeksAgo4 = L"";
371 weeksAgo4.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),4);
373 pItem = new(std::nothrow) GroupItem();
378 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
380 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null || pGroupItemClass->GetHistoryData()->GetCount() == 0)
382 AppLog("CreateGroupItem :: if history is null");
383 r = pItem->Construct(Dimension(itemWidth, 0));
388 r = pItem->Construct(Dimension(itemWidth, 48));
390 text = pGroupItemClass->GetTitleText();
392 if (__searchHistory == false)
396 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
399 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
400 if ( pGregorianCalendar != NULL)
402 r = pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->GetStartTime().GetYear());
409 delete pGregorianCalendar;
412 r = pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->GetStartTime().GetMonth());
419 delete pGregorianCalendar;
422 r = pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->GetStartTime().GetDay());
429 delete pGregorianCalendar;
432 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
433 if (pGregorianCalendar != NULL)
435 delete pGregorianCalendar;
442 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
445 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
448 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
451 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
454 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
457 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
460 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
468 if (pGroupItemClass->GetTitleText() != CommonUtil::GetString(L"IDS_BR_BODY_OLDER"))
470 text.Append(pGroupItemClass->GetStartTime().GetDay());
472 strMonth = pGroupItemClass->GetStartTime().GetMonth();
473 month = GetMonth(strMonth);
483 if (pGroupItemClass->GetTitleText() == CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK") || pGroupItemClass->GetTitleText() == weeksAgo2
484 || 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"))
487 text.Append(pGroupItemClass->GetEndTime().GetDay());
489 strMonth = pGroupItemClass->GetEndTime().GetMonth();
490 month = GetMonth(strMonth);
496 r = pItem->SetElement(text, null);
500 AppLogDebug("Failed with %s", GetErrorMessage(r));
503 r = pItem->SetTextSize(32);
514 HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
516 AppLog("HistoryListForm::CreateItem");
517 result r = E_FAILURE;
518 History* pHistory = null;
519 Bitmap* pBitmap = null;
520 Bitmap* pBookmarkBitmap = null;
521 GroupItemClass* pGroupItemClass = null;
522 CustomItem* pItem = new(std::nothrow) CustomItem();
523 int bookmarkBtnWidth = 0;
526 Image* pImage = null;
527 pImage = new Image();
530 if(__pGroupData == null)
540 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
541 if (pGroupItemClass == null)
546 if (pGroupItemClass->GetHistoryData() == null)
551 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
552 if (pHistory == null)
557 r = pItem->Construct(Dimension(itemWidth, 128 - 44 + __fontSize), LIST_ANNEX_STYLE_NORMAL);
564 ByteBuffer* pFavIconBuffer = null;
565 pFavIconBuffer = pHistory->GetFavIconBuffer();
567 AppLog("BookmarkListForm::CreateItem check 0");
569 if (pFavIconBuffer != null)
571 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is not null");
575 AppLog("BookmarkListForm::CreateItem pFavIconBuffer is null");
578 pBitmap = pImage->DecodeN(*pFavIconBuffer, IMG_FORMAT_PNG, BITMAP_PIXEL_FORMAT_ARGB8888);
580 AppLog("BookmarkListForm::CreateItem check 1");
582 //bitmapId = pHistory->GetFaviconId() ;
583 //pBitmap = pHistory->GetFavIconBitmap();
587 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
591 r = pItem->AddElement(Rectangle(16, 28 + (__fontSize - 44)/2,72, 72), IDA_FORMAT_ICON, *pBitmap, null);
596 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
600 bool urlFoundInBookmark = false;
602 if(__pBookmarkList != null)
604 for (int i = 0; i < __pBookmarkList->GetCount();i++)
606 BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
607 if(pBookMark != null && pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
609 urlFoundInBookmark = true;
614 if (urlFoundInBookmark == true)
616 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
620 pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
622 bookmarkBtnWidth = 64;
625 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);
626 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
628 // if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
629 // 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);
631 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);
632 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
633 if ( pBookmarkBitmap != null)
635 r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2 +(__fontSize - 44)/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
636 TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
637 delete pBookmarkBitmap;
648 HistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
657 HistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
659 AppLog("HistoryListForm::DeleteItem");
660 result r = E_FAILURE;
661 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
662 if (pGroupItemClass == null)
667 // if (pGroupItemClass->__pData != null)
669 // r = pGroupItemClass->__pData->RemoveAt(itemIndex);
682 HistoryListForm::GetGroupCount(void)
684 __isNoHistoryPresent = true;
686 if (__pGroupData != null)
688 if (__searchHistory == false)
693 HistoryPresentationModel::GetCurrentDateTime(endTime);
695 startTime.SetValue(0,0,0);
697 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
702 return __pGroupData->GetCount();
707 // String searchText = __pSearchBar->GetText();
708 result r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count, __searchText);
722 HistoryListForm::GetItemCount(int groupIndex)
724 result r = E_FAILURE;
730 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
731 if (pGroupItemClass == null)
735 if (__searchHistory == false)
737 startTime = pGroupItemClass->GetStartTime();
738 endTime = pGroupItemClass->GetEndTime();
739 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
743 //text = __pSearchBar->GetText();
744 r = HistoryPresentationModel::GetInstance()->GetSearchHistoryCount(count,__searchText);
755 ArrayList* pData = new(std::nothrow) ArrayList();
760 r = pData->Construct();
768 if (__searchHistory == false)
770 startTime = pGroupItemClass->GetStartTime();
771 endTime = pGroupItemClass->GetEndTime();
772 AppLog("Starttime %ls endtime %ls",startTime.ToString().GetPointer(),endTime.ToString().GetPointer());
773 r = HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(startTime,endTime, 0, count, *pData);
777 //text = __pSearchBar->GetText() ;
778 r = HistoryPresentationModel::GetInstance()->GetSearchHistory(0, count, *pData,__searchText );
785 pGroupItemClass->SetHistoryData(pData);
788 if (__isNoHistoryPresent == true && count == 0)
790 __isNoHistoryPresent = true;
791 GetFooter()->SetItemEnabled(0, false);
795 __isNoHistoryPresent = false;
796 GetFooter()->SetItemEnabled(0, true);
798 // pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
799 if (pGroupItemClass == null || pGroupItemClass->GetHistoryData() == null)
806 AppLogDebug("HistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->GetHistoryData()->GetCount(),groupIndex,pGroupItemClass->GetTitleText().GetPointer());
807 return pGroupItemClass->GetHistoryData()->GetCount();
812 HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
815 GetHeader()->SetItemSelected(1);
816 // __previousSceneId = previousSceneId;
817 ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
820 pList->GetAt(pList->GetCount()-1,__previousSceneId);
823 if(__pBookmarkList != null)
825 __pBookmarkList->RemoveAll(false);
828 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
830 AppLog("HistoryListForm::OnSceneActivatedN called");
831 //GetHeader()->Invalidate(true);
832 if (__pGroupData == null)
834 __pGroupData = new(std::nothrow) ArrayList();
835 __pGroupData->Construct();
837 if (__pGroupedListView != null)
839 __pGroupedListView->UpdateList();
841 if (__isNoHistoryPresent == true)
843 GetFooter()->SetItemEnabled(0, false);
847 GetFooter()->SetItemEnabled(0, true);
853 HistoryPresentationModel::GetCurrentDateTime(endTime);;
855 startTime.SetValue(0,0,0);
856 HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime,endTime,count);
859 __pSearchBar->SetShowState(false);
860 __pSearchBar->Invalidate(true);
864 __pSearchBar->SetShowState(true);
865 __pSearchBar->Invalidate(true);
868 // if (__isNoHistoryPresent == true)
870 // // __pGroupedListView->SetBitmapOfEmptyList(AppResource::GetInstance()->GetBitmapN(L"I01_Nocontents_Bookmarks.png"));
871 // __pGroupedListView->UpdateList();
874 result r = GetHeader()->SetItemSelected(2);
877 AppLog("HistoryListForm::OnSceneActivatedN header failed %ls", GetErrorMessage(r));
888 HistoryListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
890 AppLog("HistoryListForm::OnSceneDeactivated");
891 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
895 HistoryListForm::OnGroupedListViewContextItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
901 HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status)
903 GroupItemClass* pGroupItemClass = null;
904 History* pHistory = null;
905 AppLog("int groupIndex %d, int itemIndex %d, int elementId %d, ListItemStatus status %d",groupIndex,itemIndex,elementId,status);
906 if (elementId == IDA_FORMAT_BOOKMARK)
908 String toggledUrl = L"";
909 AppLog("BookMarkStatusChanged ID_FORMAT_BOOKMARK");
910 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
911 if (pGroupItemClass == null)
915 pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
916 if (pHistory == null)
920 toggledUrl = pHistory->GetHistoryUrl();
922 AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
924 bool bookmarkFound = false;
925 BookmarkData* pBookMark = null;
926 if(__pBookmarkList != null)
928 for (int i = 0; i < __pBookmarkList->GetCount(); i++)
930 pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
931 if (pBookMark != null && toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
933 bookmarkFound = true;
938 if(bookmarkFound == false)
940 // Add the history in bookmark database
941 result r = E_FAILURE;
942 BookmarkData bookmark;
944 String bookmarkTitle = pHistory->GetHistoryTitle();
946 bookmark.SetBookmarkTitle(bookmarkTitle);
947 bookmark.SetUrl(pHistory->GetHistoryUrl());
948 bookmark.SetFaviconId(pHistory->GetFaviconId());
949 bookmark.SetFavIconBuffer(*pHistory->GetFavIconBuffer());
950 //r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
951 r = BookmarkPresentationModel::GetInstance()->SaveTempBookmark(bookmark);
955 // remove the history from bookmark database
956 BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
959 if(__pBookmarkList != null)
961 __pBookmarkList->RemoveAll(false);
962 BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
964 listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
965 listView.UpdateList();
969 pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
970 if (pGroupItemClass == null)
975 History* pHistory1 = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(itemIndex));
976 if (pHistory1 == null)
980 SceneManager* pSceneManager = SceneManager::GetInstance();
981 ArrayList *pArgList = null;
982 result r = E_SUCCESS;
983 pArgList = new(std::nothrow) ArrayList();
984 if (pArgList != null)
986 r = pArgList->Construct();
993 r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
994 r = pArgList->Add(*new(std::nothrow) String(pHistory1->GetHistoryUrl()));
1004 String scneId = L"";
1005 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(scneId);
1007 if (pSceneManager != null)
1009 AppLog("pSceneManager exists");
1010 r = SceneManager::GetInstance()->GoForward(ForwardSceneTransition(scneId), pArgList);
1013 pArgList->RemoveAll(false);
1026 HistoryListForm::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
1032 HistoryListForm::OnSearchBarModeChanged(SearchBar& source, SearchBarMode mode)
1034 result r = E_FAILURE;
1035 if (mode == SEARCH_BAR_MODE_NORMAL)
1037 if ( Clipboard::GetInstance()->IsPopupVisible() == false && __searchHistory == false)
1039 __pSearchListView->SetEnabled(true);
1042 r = __pSearchListView->SetShowState(false);
1047 r = __pGroupedListView->SetShowState(true);
1053 __pSearchListView->SetEnabled(true);
1054 if(__pSearchBar != null)
1055 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1057 __searchHistory = false;
1058 r = __pGroupedListView->UpdateList();
1059 if (__isNoHistoryPresent == true)
1061 GetFooter()->SetItemEnabled(0, false);
1065 GetFooter()->SetItemEnabled(0, true);
1067 if(__pSearchBar != null)
1069 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1079 // __pSearchListView->SetEnabled(false);
1080 r = __pSearchListView->SetShowState(true);
1085 __pSearchListView->SetEnabled(false);
1086 r = __pSearchListView->UpdateList();
1091 r = __pGroupedListView->SetShowState(false);
1096 if(__pSearchBar != null)
1098 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1104 HistoryListForm::GetMonth(int month)
1106 String monthValue = L"";
1110 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));
1113 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));
1116 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));
1119 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APR"));
1122 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));
1125 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUNE"));
1128 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));
1131 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));
1134 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));
1137 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));
1140 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));
1143 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));
1154 HistoryListForm::OnKeypadActionPerformed(Control &source, KeypadAction keypadAction)
1156 result r = E_FAILURE;
1157 if (__pSearchBar != null)
1159 __pSearchBar->HideKeypad();
1162 if (__pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1164 __pSearchListView->SetEnabled(true);
1165 __searchHistory = true;
1166 __searchText =__pSearchBar->GetText();
1167 AppLog("SearchTextHistory %S errormsg %s",__searchText.GetPointer(),GetErrorMessage(GetLastResult()));
1169 r = __pGroupedListView->SetShowState(false);
1174 r = __pSearchListView->SetShowState(true);
1179 r= __pSearchListView->UpdateList();
1180 if (__isNoHistoryPresent == true)
1182 GetFooter()->SetItemEnabled(0, false);
1186 GetFooter()->SetItemEnabled(0, true);
1188 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1197 __searchHistory = false;
1203 HistoryListForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1205 FloatRectangle clientRect;
1206 clientRect = GetClientAreaBoundsF();
1207 AppLogDebug("SearchBarForm::OnKeypadBoundsChanged ClientBounds(%f, %f, %f, %f)",clientRect.x, clientRect.y, clientRect.width, clientRect.height);
1208 __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1209 __pSearchListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1210 __pGroupedListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1211 // __pGroupedListView->SetEnabled(false);
1216 HistoryListForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
1218 result r = E_FAILURE;
1219 if (__pGroupedListView != null)
1221 if(__pSearchBar != null &&__pSearchBar->GetShowState())
1222 r = __pGroupedListView->SetBounds(Rectangle(0,__pSearchBar->GetY() + __pSearchBar->GetHeight()/*72 + 30*/,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1223 else if(__pSearchBar != null)
1224 r = __pGroupedListView->SetBounds(Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pSearchBar->GetHeight() - __pSearchBar->GetY()));
1229 __pGroupedListView->UpdateList();
1231 if (__pSearchListView != null)
1233 r = __pSearchListView->SetBounds(Rectangle(0, 0, GetClientAreaBounds().width, __pGroupedListView->GetHeight()));
1239 __pSearchListView->UpdateList();
1241 if(__pSearchBar != null)
1242 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1247 if (__isNoHistoryPresent == true)
1249 GetFooter()->SetItemEnabled(0, false);
1253 GetFooter()->SetItemEnabled(0, true);
1258 HistoryListForm::OnKeypadWillOpen(Control& source)
1260 GetFooter()->SetShowState(false);
1261 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1262 __pSearchListView->SetEnabled(false);
1263 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1269 HistoryListForm::OnKeypadOpened(Control& source)
1271 // this is added because some time footer is shown when key pad is opened, do not remove
1272 GetFooter()->SetShowState(false);
1273 GetFooter()->Invalidate(true);
1274 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1278 HistoryListForm::OnKeypadClosed(Control& source)
1280 if(Clipboard::GetInstance()->IsPopupVisible() == true)
1284 GetFooter()->SetShowState(true);
1285 __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1286 __pSearchListView->Invalidate(false);
1287 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1288 __pGroupedListView->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1293 HistoryListForm::CreateGroupItems()
1295 result r = E_FAILURE;
1296 DateTime currentTime;
1298 GroupItemClass* pGroupItemClass = null;
1301 String weeksAgo2 = L"";
1302 weeksAgo2.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),2);
1304 String weeksAgo3 = L"";
1305 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1307 if (__pGroupData != null)
1309 __pGroupData->RemoveAll(false);
1310 delete __pGroupData;
1311 __pGroupData = null;
1313 __pGroupData = new(std::nothrow) ArrayList();
1314 if (__pGroupData == null)
1318 r = __pGroupData->Construct();
1321 delete __pGroupData;
1322 __pGroupData = null;
1325 if (__searchHistory == true)
1327 pGroupItemClass = new(std::nothrow) GroupItemClass();
1328 if (pGroupItemClass == null)
1332 titleText = CommonUtil::GetString(L"IDS_BR_BODY_SEARCHED_ITEMS");
1333 pGroupItemClass->SetTitleText(titleText);
1334 r = __pGroupData->Add(*pGroupItemClass);
1342 Calendar* pGregorianCalendar = null;
1345 HistoryPresentationModel::GetCurrentDateTime(currentTime);
1346 pGroupItemClass = new(std::nothrow) GroupItemClass();
1347 if (pGroupItemClass == null)
1351 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
1352 pGroupItemClass->SetTitleText(titleText);
1353 pGroupItemClass->SetEndTime(currentTime);
1354 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1355 pGroupItemClass->SetStartTime(dateTime);
1356 __pGroupData->Add(*pGroupItemClass);
1359 pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
1360 if ( pGregorianCalendar != NULL )
1362 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
1363 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
1364 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
1365 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
1366 delete pGregorianCalendar;
1371 pGroupItemClass = new(std::nothrow) GroupItemClass();
1372 if (pGroupItemClass == null)
1376 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1377 pGroupItemClass->SetTitleText(titleText);
1378 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1379 pGroupItemClass->SetEndTime(dateTime);
1380 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1381 dateTime.AddDays(currentTime.GetDay() - 6 - 1);
1382 pGroupItemClass->SetStartTime(dateTime);
1383 __pGroupData->Add(*pGroupItemClass);
1386 pGroupItemClass = new(std::nothrow) GroupItemClass();
1387 if (pGroupItemClass == null)
1391 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1392 pGroupItemClass->SetTitleText(titleText);
1393 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1394 pGroupItemClass->SetEndTime(dateTime);
1395 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1396 dateTime.AddDays(currentTime.GetDay() - 7 - 1);
1397 pGroupItemClass->SetStartTime(dateTime);
1398 __pGroupData->Add(*pGroupItemClass);
1401 pGroupItemClass = new(std::nothrow) GroupItemClass();
1402 if (pGroupItemClass == null)
1406 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1407 pGroupItemClass->SetTitleText(titleText);
1408 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1409 pGroupItemClass->SetEndTime(dateTime);
1410 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1411 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1412 pGroupItemClass->SetStartTime(dateTime);
1413 __pGroupData->Add(*pGroupItemClass);
1415 pGroupItemClass = new(std::nothrow) GroupItemClass();
1416 if (pGroupItemClass == null)
1420 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1421 pGroupItemClass->SetTitleText(titleText);
1422 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1423 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1424 pGroupItemClass->SetEndTime(dateTime);
1425 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1426 dateTime.AddDays(currentTime.GetDay() - 8 - 1);
1427 pGroupItemClass->SetStartTime(dateTime);
1428 __pGroupData->Add(*pGroupItemClass);
1431 pGroupItemClass = new(std::nothrow) GroupItemClass();
1432 if (pGroupItemClass == null)
1436 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1437 pGroupItemClass->SetTitleText(titleText);
1438 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1439 pGroupItemClass->SetEndTime(dateTime);
1440 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1441 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1442 pGroupItemClass->SetStartTime(dateTime);
1443 __pGroupData->Add(*pGroupItemClass);
1445 pGroupItemClass = new(std::nothrow) GroupItemClass();
1446 if (pGroupItemClass == null)
1450 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1451 pGroupItemClass->SetTitleText(titleText);
1452 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1453 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1454 pGroupItemClass->SetEndTime(dateTime);
1455 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1456 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1457 pGroupItemClass->SetStartTime(dateTime);
1458 __pGroupData->Add(*pGroupItemClass);
1460 pGroupItemClass = new(std::nothrow) GroupItemClass();
1461 if (pGroupItemClass == null)
1465 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1466 pGroupItemClass->SetTitleText(titleText);
1467 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1468 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1469 pGroupItemClass->SetEndTime(dateTime);
1470 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1471 dateTime.AddDays(currentTime.GetDay() - 9 - 1);
1472 pGroupItemClass->SetStartTime(dateTime);
1473 __pGroupData->Add(*pGroupItemClass);
1476 pGroupItemClass = new(std::nothrow) GroupItemClass();
1477 if (pGroupItemClass == null)
1481 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1482 pGroupItemClass->SetTitleText(titleText);
1483 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1484 pGroupItemClass->SetEndTime(dateTime);
1485 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1486 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1487 pGroupItemClass->SetStartTime(dateTime);
1488 __pGroupData->Add(*pGroupItemClass);
1490 pGroupItemClass = new(std::nothrow) GroupItemClass();
1491 if (pGroupItemClass == null)
1495 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1496 pGroupItemClass->SetTitleText(titleText);
1497 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1498 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1499 pGroupItemClass->SetEndTime(dateTime);
1500 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1501 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1502 pGroupItemClass->SetStartTime(dateTime);
1503 __pGroupData->Add(*pGroupItemClass);
1505 pGroupItemClass = new(std::nothrow) GroupItemClass();
1506 if (pGroupItemClass == null)
1510 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1511 pGroupItemClass->SetTitleText(titleText);
1512 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1513 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1514 pGroupItemClass->SetEndTime(dateTime);
1515 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1516 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1517 pGroupItemClass->SetStartTime(dateTime);
1518 __pGroupData->Add(*pGroupItemClass);
1520 pGroupItemClass = new(std::nothrow) GroupItemClass();
1521 if (pGroupItemClass == null)
1525 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1526 pGroupItemClass->SetTitleText(titleText);
1527 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1528 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1529 pGroupItemClass->SetEndTime(dateTime);
1530 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1531 dateTime.AddDays(currentTime.GetDay() - 10 - 1);
1532 pGroupItemClass->SetStartTime(dateTime);
1533 __pGroupData->Add(*pGroupItemClass);
1536 pGroupItemClass = new(std::nothrow) GroupItemClass();
1537 if (pGroupItemClass == null)
1541 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1542 pGroupItemClass->SetTitleText(titleText);
1543 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1544 pGroupItemClass->SetEndTime(dateTime);
1545 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1546 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1547 pGroupItemClass->SetStartTime(dateTime);
1548 __pGroupData->Add(*pGroupItemClass);
1550 pGroupItemClass = new(std::nothrow) GroupItemClass();
1551 if (pGroupItemClass == null)
1555 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1556 pGroupItemClass->SetTitleText(titleText);
1557 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1558 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1559 pGroupItemClass->SetEndTime(dateTime);
1560 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1561 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1562 pGroupItemClass->SetStartTime(dateTime);
1563 __pGroupData->Add(*pGroupItemClass);
1565 pGroupItemClass = new(std::nothrow) GroupItemClass();
1566 if (pGroupItemClass == null)
1570 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1571 pGroupItemClass->SetTitleText(titleText);
1572 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1573 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1574 pGroupItemClass->SetEndTime(dateTime);
1575 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1576 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1577 pGroupItemClass->SetStartTime(dateTime);
1578 __pGroupData->Add(*pGroupItemClass);
1580 pGroupItemClass = new(std::nothrow) GroupItemClass();
1581 if (pGroupItemClass == null)
1585 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1586 pGroupItemClass->SetTitleText(titleText);
1587 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1588 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1589 pGroupItemClass->SetEndTime(dateTime);
1590 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1591 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1592 pGroupItemClass->SetStartTime(dateTime);
1593 __pGroupData->Add(*pGroupItemClass);
1595 pGroupItemClass = new(std::nothrow) GroupItemClass();
1596 if (pGroupItemClass == null)
1600 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1601 pGroupItemClass->SetTitleText(titleText);
1602 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1603 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1604 pGroupItemClass->SetEndTime(dateTime);
1605 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1606 dateTime.AddDays(currentTime.GetDay() - 11 - 1);
1607 pGroupItemClass->SetStartTime(dateTime);
1608 __pGroupData->Add(*pGroupItemClass);
1611 pGroupItemClass = new(std::nothrow) GroupItemClass();
1612 if (pGroupItemClass == null)
1616 titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1617 pGroupItemClass->SetTitleText(titleText);
1618 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1619 pGroupItemClass->SetEndTime(dateTime);
1620 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1621 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1622 pGroupItemClass->SetStartTime(dateTime);
1623 __pGroupData->Add(*pGroupItemClass);
1625 pGroupItemClass = new(std::nothrow) GroupItemClass();
1626 if (pGroupItemClass == null)
1630 titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1631 pGroupItemClass->SetTitleText(titleText);
1632 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1633 dateTime.AddDays(currentTime.GetDay() - 1 - 1);
1634 pGroupItemClass->SetEndTime(dateTime);
1635 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1636 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1637 pGroupItemClass->SetStartTime(dateTime);
1638 __pGroupData->Add(*pGroupItemClass);
1640 pGroupItemClass = new(std::nothrow) GroupItemClass();
1641 if (pGroupItemClass == null)
1645 titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1646 pGroupItemClass->SetTitleText(titleText);
1647 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1648 dateTime.AddDays(currentTime.GetDay() - 2 - 1);
1649 pGroupItemClass->SetEndTime(dateTime);
1650 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1651 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1652 pGroupItemClass->SetStartTime(dateTime);
1653 __pGroupData->Add(*pGroupItemClass);
1655 pGroupItemClass = new(std::nothrow) GroupItemClass();
1656 if (pGroupItemClass == null)
1660 titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1661 pGroupItemClass->SetTitleText(titleText);
1662 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1663 dateTime.AddDays(currentTime.GetDay() - 3 - 1);
1664 pGroupItemClass->SetEndTime(dateTime);
1665 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1666 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1667 pGroupItemClass->SetStartTime(dateTime);
1668 __pGroupData->Add(*pGroupItemClass);
1670 pGroupItemClass = new(std::nothrow) GroupItemClass();
1671 if (pGroupItemClass == null)
1675 titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1676 pGroupItemClass->SetTitleText(titleText);
1677 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1678 dateTime.AddDays(currentTime.GetDay() - 4 - 1);
1679 pGroupItemClass->SetEndTime(dateTime);
1680 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1681 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1682 pGroupItemClass->SetStartTime(dateTime);
1683 __pGroupData->Add(*pGroupItemClass);
1685 pGroupItemClass = new(std::nothrow) GroupItemClass();
1686 if (pGroupItemClass == null)
1690 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1691 pGroupItemClass->SetTitleText(titleText);
1692 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1693 dateTime.AddDays(currentTime.GetDay() - 5 - 1);
1694 pGroupItemClass->SetEndTime(dateTime);
1695 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1696 dateTime.AddDays(currentTime.GetDay() - 12 - 1);
1697 pGroupItemClass->SetStartTime(dateTime);
1698 __pGroupData->Add(*pGroupItemClass);
1704 day = currentTime.GetDay();
1708 pGroupItemClass = new(std::nothrow) GroupItemClass();
1709 if (pGroupItemClass == null)
1714 pGroupItemClass->SetTitleText(weeksAgo2);
1715 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1716 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1717 pGroupItemClass->SetEndTime(dateTime);
1718 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1719 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1720 pGroupItemClass->SetStartTime(dateTime);
1721 __pGroupData->Add(*pGroupItemClass);
1723 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1725 pGroupItemClass = new(std::nothrow) GroupItemClass();
1726 if (pGroupItemClass == null)
1730 String weeksAgo3 = L"";
1731 weeksAgo3.Format(25,CommonUtil::GetString(L"IDS_EMAIL_BODY_PD_WEEKS_AGO").GetPointer(),3);
1732 pGroupItemClass->SetTitleText(weeksAgo3);
1733 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1734 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1735 pGroupItemClass->SetEndTime(dateTime);
1736 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1737 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1738 pGroupItemClass->SetStartTime(dateTime);
1739 __pGroupData->Add(*pGroupItemClass);
1743 pGroupItemClass = new(std::nothrow) GroupItemClass();
1744 if (pGroupItemClass == null)
1748 pGroupItemClass->SetTitleText(weeksAgo2);
1749 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1750 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1751 pGroupItemClass->SetEndTime(dateTime);
1752 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1753 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1754 pGroupItemClass->SetStartTime(dateTime);
1755 __pGroupData->Add(*pGroupItemClass);
1757 pGroupItemClass = new(std::nothrow) GroupItemClass();
1758 if (pGroupItemClass == null)
1763 pGroupItemClass->SetTitleText(weeksAgo3);
1764 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1765 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1766 pGroupItemClass->SetEndTime(dateTime);
1767 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1768 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1769 pGroupItemClass->SetStartTime(dateTime);
1770 __pGroupData->Add(*pGroupItemClass);
1772 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1774 pGroupItemClass = new(std::nothrow) GroupItemClass();
1775 if (pGroupItemClass == null)
1779 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1780 pGroupItemClass->SetTitleText(titleText);
1781 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1782 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1783 pGroupItemClass->SetEndTime(dateTime);
1784 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1785 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1786 pGroupItemClass->SetStartTime(dateTime);
1787 __pGroupData->Add(*pGroupItemClass);
1791 pGroupItemClass = new(std::nothrow) GroupItemClass();
1792 if (pGroupItemClass == null)
1796 pGroupItemClass->SetTitleText(weeksAgo2);
1797 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1798 dateTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1799 pGroupItemClass->SetEndTime(dateTime);
1800 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1801 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1802 pGroupItemClass->SetStartTime(dateTime);
1803 __pGroupData->Add(*pGroupItemClass);
1805 pGroupItemClass = new(std::nothrow) GroupItemClass();
1806 if (pGroupItemClass == null)
1810 pGroupItemClass->SetTitleText(weeksAgo3);
1811 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1812 dateTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1813 pGroupItemClass->SetEndTime(dateTime);
1814 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1815 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1816 pGroupItemClass->SetStartTime(dateTime);
1817 __pGroupData->Add(*pGroupItemClass);
1819 if (pGroupItemClass->GetStartTime().GetDay() > 1 && pGroupItemClass->GetStartTime().GetDay() < 8)
1821 pGroupItemClass = new(std::nothrow) GroupItemClass();
1822 if (pGroupItemClass == null)
1826 titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1827 pGroupItemClass->SetTitleText(titleText);
1828 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1829 dateTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1830 pGroupItemClass->SetEndTime(dateTime);
1831 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1832 //dateTime.AddDays(currentTime.GetDay() - 28 - dayOfWeek + 2 - 1);
1833 pGroupItemClass->SetStartTime(dateTime);
1834 __pGroupData->Add(*pGroupItemClass);
1840 pGroupItemClass = new(std::nothrow) GroupItemClass();
1841 if (pGroupItemClass == null)
1845 titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_MONTH");
1846 pGroupItemClass->SetTitleText(titleText);
1847 dateTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1848 dateTime.AddDays(-1);
1849 pGroupItemClass->SetEndTime(dateTime);
1850 dateTime.SetValue(currentTime.GetYear(), 1, 1);
1851 dateTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1852 pGroupItemClass->SetStartTime(dateTime);
1853 __pGroupData->Add(*pGroupItemClass);
1855 pGroupItemClass = new(std::nothrow) GroupItemClass();
1856 if (pGroupItemClass == null)
1860 titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1861 pGroupItemClass->SetTitleText(titleText);
1862 dateTime.SetValue(currentTime.GetYear(),1, 1);
1863 dateTime.AddMonths(currentTime.GetMonth() - 2);
1864 dateTime.AddDays(-1);
1865 pGroupItemClass->SetEndTime(dateTime);
1867 dateTime2.SetValue(0, 0, 0);
1868 pGroupItemClass->SetStartTime(dateTime2);
1869 __pGroupData->Add(*pGroupItemClass);
1873 GroupItemClass::GroupItemClass()
1879 GroupItemClass::operator =(const GroupItemClass& rhs)
1883 __pData = rhs.__pData;
1888 GroupItemClass::GroupItemClass(const GroupItemClass& groupItem)
1890 __pData = groupItem.__pData;
1893 GroupItemClass::~GroupItemClass()
1897 __pData->RemoveAll(true);
1903 GroupItemClass::SetStartTime(DateTime& startTime)
1905 __startTime = startTime;
1909 GroupItemClass::SetEndTime(DateTime& endTime)
1911 __endTime = endTime;
1915 GroupItemClass::SetTitleText(String& titleText)
1917 __titleText = titleText;
1921 GroupItemClass::SetHistoryData(ArrayList* pData)
1927 GroupItemClass::GetStartTime(void)
1933 GroupItemClass::GetEndTime(void)
1939 GroupItemClass::GetTitleText(void)
1945 GroupItemClass::GetHistoryData(void)
1951 HistoryListForm::OnSettingChanged(Tizen::Base::String& key)
1953 if (__pGroupedListView)
1955 __pGroupedListView->UpdateList();