3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.1 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 /*@file: IntEditHistoryListForm
20 *@brief: This class defines EditHistoryListForm used to edit the history scene
24 #include <FAppUiApp.h>
26 #include "IntCommonLib.h"
27 #include "IntEditHistoryListForm.h"
28 #include "IntFaviconManager.h"
29 #include "IntHistoryPresentationModel.h"
30 #include "IntNotificationPanel.h"
31 #include "IntSceneRegister.h"
34 using namespace Tizen::App;
35 using namespace Tizen::Base;
36 using namespace Tizen::Base::Collection;
37 using namespace Tizen::Base::Runtime;
38 using namespace Tizen::Locales;
39 using namespace Tizen::Graphics;
40 using namespace Tizen::Ui;
41 using namespace Tizen::Ui::Controls;
42 using namespace Tizen::Ui::Scenes;
43 using namespace Tizen::System;
45 const int EditHistoryListForm::IDA_TABBAR_ITEM_1 = 101;
46 const int EditHistoryListForm::IDA_TABBAR_ITEM_2 = 102;
47 const int EditHistoryListForm::IDA_BUTTON_NEXT_FORM = 103;
48 const int EditHistoryListForm::IDA_FORMAT_ICON = 104;
49 const int EditHistoryListForm::IDA_FORMAT_TITLE = 105;
50 const int EditHistoryListForm::IDA_FORMAT_URL = 106;
51 const int EditHistoryListForm::IDA_SELECT_ALL_CHECKED = 107;
52 const int EditHistoryListForm::IDA_SELECT_ALL_UNCHECKED = 108;
53 const int EditHistoryListForm::IDA_DELETE_HISTORY = 109;
54 const int EditHistoryListForm::IDA_CANCEL = 110;
57 EditHistoryListForm::EditHistoryListForm(void)
61 ,__pSelectAllCheck(null)
62 ,__pSelectedLabel(null)
64 ,__isNoHistoryPresent(true)
66 ,__pConfirmationPopup(null)
70 EditHistoryListForm::~EditHistoryListForm(void)
72 AppLog("EditHistoryListForm::~EditHistoryListForm called");
74 if (__pGroupData != null)
76 AppLog("removing __pGroupData");
77 __pGroupData->RemoveAll(false);
83 EditHistoryListForm::Initialize(void)
85 Construct(L"IDL_EDIT_HISTORY_LIST");
91 EditHistoryListForm::OnInitializing(void)
95 SetFormBackEventListener(this);
97 AppLogDebug("EditHistoryListForm::OnInitializing");
98 SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR | FORM_STYLE_HEADER | FORM_STYLE_FOOTER);
100 __fontSize = CommonUtil::GetFontSize();
102 Header* pHeader = GetHeader();
109 pHeader->SetTitleText(CommonUtil::GetString("IDS_BR_SK_DELETE_ABB"));
111 GetFooter()->AddActionEventListener(*this);
112 AddOrientationEventListener(*this);
114 SceneManager::GetInstance()->AddSceneEventListener(IDSCN_EDIT_HISTORY_LIST, *this);
115 __pSelectedLabel = static_cast< Label* >(GetControl(L"IDC_LABEL1"));
117 if (__pSelectedLabel == null)
122 //selectedText.Append(L"\x200E"); // LEFT-TO-RIGHT MARK
123 //selectedText.Append(L"(0)");
124 selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , 0);
126 __pSelectedLabel->SetText(selectedText);
128 __pSelectAllCheck = static_cast< CheckButton* >(GetControl(L"IDC_SELECT_ALL",true));
130 if (__pSelectAllCheck != null)
132 __pSelectAllCheck->SetActionId(IDA_SELECT_ALL_CHECKED, IDA_SELECT_ALL_UNCHECKED);
133 __pSelectAllCheck->AddActionEventListener(*this);
140 __pListView = static_cast< GroupedListView* >(GetControl(L"IDC_GROUPEDLISTVIEW1"));
141 if( __pListView != NULL)
143 __pListView->SetItemProvider(*this);
144 __pListView->AddGroupedListViewItemEventListener(*this);
151 __pTimer = new (std::nothrow) Timer();
152 r = __pTimer->Construct(*this);
158 EditHistoryListForm::OnTerminating(void)
160 result r = E_SUCCESS;
166 EditHistoryListForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
169 SceneManager* pSceneManager = SceneManager::GetInstance();
171 if (pSceneManager == null)
178 case IDA_TABBAR_ITEM_1:
180 result r = pSceneManager->GoBackward(BackwardSceneTransition());
183 AppLogDebug("EditHistoryListForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r));
189 case IDA_SELECT_ALL_CHECKED:
191 int selectedCount = 0;
192 for (int groupIndex = 0 ; __pGroupData != null && groupIndex < __pGroupData->GetCount() ; groupIndex ++)
194 GroupItemClass* pGClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
199 for (int itemIndex = 0 ; itemIndex < pGClass->__pData->GetCount() ; itemIndex ++)
202 __pListView->SetItemChecked(groupIndex,itemIndex,true);
205 /*selectedText.Append(L"\x200E"); // LEFT-TO-RIGHT MARK
206 selectedText.Append(L"(");
207 selectedText.Append(selectedCount);
208 selectedText.Append(L")");*/
210 if (selectedCount >1)
212 selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_POP_PD_ITEMS_SELECTED").GetPointer() , selectedCount);
216 selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , selectedCount);
219 __selectedCount = selectedCount;
221 __pSelectedLabel->SetText(selectedText);
222 __pSelectedLabel->Invalidate(true);
224 if(__selectedCount > 0)
226 GetFooter()->SetItemEnabled(1, true);
227 GetFooter()->Invalidate(true);
230 __pListView->Invalidate(true);
234 case IDA_SELECT_ALL_UNCHECKED:
236 for (int groupIndex = 0 ; __pGroupData != null && groupIndex < __pGroupData->GetCount() ; groupIndex ++)
238 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
239 if(pGroupItemClass == null)
243 for (int itemIndex = 0 ; itemIndex < pGroupItemClass->__pData->GetCount() ; itemIndex ++)
245 __pListView->SetItemChecked(groupIndex,itemIndex,false);
248 //selectedText.Append(L"\x200E"); // LEFT-TO-RIGHT MARK
249 //selectedText.Append(L"(0)");
250 selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , 0);
252 __pSelectedLabel->SetText(selectedText);
254 __pSelectedLabel->Invalidate(true);
256 GetFooter()->SetItemEnabled(1, false);
257 GetFooter()->Invalidate(true);
259 __pListView->Invalidate(true);
262 case IDA_DELETE_HISTORY:
263 if(__pConfirmationPopup)
265 delete __pConfirmationPopup;
266 __pConfirmationPopup = null;
269 if (!__pConfirmationPopup)
271 String closeWarning = CommonUtil::GetString(L"IDS_BR_SK3_DELETE");
272 __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
273 __pConfirmationPopup->Initialize();
275 __pConfirmationPopup->RemoveActionListener(*this);
276 __pConfirmationPopup->AddActionListener(*this);
277 __pConfirmationPopup->setMessage(closeWarning);
278 __pConfirmationPopup->Show();
282 if(__pConfirmationPopup)
284 __pConfirmationPopup->SetShowState(false);
285 __pConfirmationPopup->Show();
286 delete __pConfirmationPopup;
287 __pConfirmationPopup = null;
292 ArrayList* pArrayList = new(std::nothrow) ArrayList();
297 pArrayList->Construct();
298 for (int groupIndex = 0 ; __pGroupData != null && groupIndex < __pGroupData->GetCount() ; groupIndex ++)
300 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
302 if (pGroupItemClass == null || pGroupItemClass->__pData == null)
304 AppLogDebug(" pGroupItemClass || __pData is null");
307 itemCount = pGroupItemClass->__pData->GetCount();
308 for (int itemIndex = 0 ; itemIndex < itemCount ; itemIndex++)
310 bool ret = __pListView->IsItemChecked(groupIndex,itemIndex);
315 AppLog("deleting history for groupId %d, item %d",groupIndex,itemIndex);
317 History* pHistory = dynamic_cast< History* >(pGroupItemClass->__pData->GetAt(itemIndex));
322 pArrayList->Add(*new(std::nothrow) String(pHistory->GetHistoryId()));
327 HistoryPresentationModel::GetInstance()->DeleteMultipleHistory(pArrayList);
329 if (pArrayList != null)
331 pArrayList->RemoveAll(true);
335 if(__pGroupData != null)
337 groupCount = __pGroupData->GetCount();
339 for(int groupIndex = 0 ; groupIndex < groupCount ; groupIndex ++ )
341 counter = __pListView->GetItemCountAt(groupIndex);
343 for(int index = 0 ; index < counter ; index++)
345 if(__pListView->IsItemChecked( groupIndex,index ) == true)
347 __pListView->SetItemChecked(groupIndex,index,false);
353 __pSelectAllCheck->SetSelected(false);
355 GetFooter()->SetItemEnabled(1,false);
356 GetFooter()->Invalidate(true);
357 //selectedText.Append(L"\x200E"); // LEFT-TO-RIGHT MARK
358 // selectedText.Append(L"(0)");
359 selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , 0);
360 __pSelectedLabel->SetText(selectedText);
362 __pSelectedLabel->Invalidate(true);
363 if (__pListView != null)
365 __pListView->UpdateList();
368 NotificationPanel* pNotification = new (std::nothrow) NotificationPanel(*this);
369 String notification = CommonUtil::GetString(L"IDS_BR_POP_DELETED");
370 pNotification->SetText(notification);
371 pNotification->ShowNotification();
372 if(__pConfirmationPopup)
374 delete __pConfirmationPopup;
375 __pConfirmationPopup = null;
382 if( __pTimer != NULL)
386 result r = pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
389 AppLogDebug("EditHistoryListForm::OnActionPerformed Failed to GoBackward %s",GetErrorMessage(r));
401 EditHistoryListForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
403 SceneManager* pSceneManager = SceneManager::GetInstance();
405 if (pSceneManager == null)
410 if( __pTimer != NULL)
414 result r = pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
417 AppLogDebug("EditHistoryListForm::OnFormBackRequested Failed to GoBackward %s",GetErrorMessage(r));
423 EditHistoryListForm::CreateGroupItem(int groupIndex, int itemWidth)
425 AppLogDebug("EditHistoryListForm::CreateGroupItem");
426 result r = E_FAILURE;
430 GroupItem* pItem = null;
433 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
434 if(pGroupItemClass == null)
436 pItem = new(std::nothrow) GroupItem();
443 if ( pGroupItemClass->__pData == null || pGroupItemClass->__pData->GetCount() == 0)
445 r = pItem->Construct(Dimension(itemWidth, 0));
449 r = pItem->Construct(Dimension(itemWidth, 48));
452 text = pGroupItemClass->__titleText;
456 if (pGroupItemClass->__titleText == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->__titleText == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
458 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
459 if (pGregorianCalendar != NULL)
461 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->__startTime.GetYear());
462 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->__startTime.GetMonth());
463 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->__startTime.GetDay());
464 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
466 if (pGregorianCalendar != NULL)
468 delete pGregorianCalendar;
475 r = text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
476 AppLog("dayOfWeek Append Result %s",GetErrorMessage(r));
480 r = text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
481 AppLog("dayOfWeek Append Result %s",GetErrorMessage(r));
485 r = text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
486 AppLog("dayOfWeek Append Result %s",GetErrorMessage(r));
490 r = text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
491 AppLog("dayOfWeek Append Result %s",GetErrorMessage(r));
495 AppLog("dayOfWeek Append Result yoyo");
496 r = text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
497 AppLog("dayOfWeek Append Result %s",GetErrorMessage(r));
501 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
505 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
515 if (pGroupItemClass->__titleText != L"Older")
517 text.Append(pGroupItemClass->__startTime.GetDay());
519 strMonth = pGroupItemClass->__startTime.GetMonth();
520 month = GetMonth(strMonth);
528 if (pGroupItemClass->__titleText == L"Last week" || pGroupItemClass->__titleText == L"Two weeks ago" || pGroupItemClass->__titleText == L"Three weeks ago" || pGroupItemClass->__titleText == L"Four weeks ago" || pGroupItemClass->__titleText == L"Last month" || pGroupItemClass->__titleText == L"Older")
531 text.Append(pGroupItemClass->__endTime.GetDay());
533 strMonth = pGroupItemClass->__endTime.GetMonth();
534 month = GetMonth(strMonth);
539 AppLogDebug("startTime day = %d month = %d year = %d",pGroupItemClass->__startTime.GetDay(),pGroupItemClass->__startTime.GetMonth(),pGroupItemClass->__startTime.GetYear());
541 pItem->SetElement(text, null);
542 pItem->SetTextSize(32);
548 EditHistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
550 AppLogDebug("EditHistoryListForm::CreateItem");
551 result r = E_FAILURE;
552 const int bookmarkBtnWidth = 64;
554 if (__pGroupData == null)
559 CustomItem* pItem = new(std::nothrow) CustomItem();
564 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
566 if (pGroupItemClass == null)
572 History* pHistory = dynamic_cast< History* >(pGroupItemClass->__pData->GetAt(itemIndex));
573 if ( pHistory == NULL )
578 Bitmap* pBitmap = null;
580 r = pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 128 + (__fontSize - 44)), LIST_ANNEX_STYLE_MARK);
584 pBitmap = pHistory->GetFavIconBitmap();
587 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
592 pItem->AddElement(Rectangle(16, 26 + (__fontSize - 44)/2, 60, 60), IDA_FORMAT_ICON, *pBitmap, null);
595 r = pItem->AddElement(Rectangle(92, 4, GetClientAreaBounds().width - 96 - 32 -64 -32, 60 + (__fontSize - 44)), IDA_FORMAT_TITLE, pHistory->GetHistoryTitle(), __fontSize,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true);
599 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
603 pItem->AddElement(Rectangle(92, 68 + (__fontSize - 44), GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 52), IDA_FORMAT_URL, pHistory->GetHistoryUrl(),32,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,true);
609 EditHistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
612 AppLogDebug("EditHistoryListForm::DeleteGroupItem");
614 if (__pGroupData == null)
627 EditHistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
630 if (__pGroupData == null)
635 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
636 if (pGroupItemClass == null)
647 EditHistoryListForm::GetGroupCount(void)
649 result r = E_FAILURE;
650 AppLogDebug("EditHistoryListForm::GetGroupCount");
652 __isNoHistoryPresent = true;
657 //HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
660 startTime.SetValue(0, 1, 1, 0, 0, 0);
662 SystemTime::GetCurrentTime(endTime);
663 endTime.SetValue(endTime.GetYear(), endTime.GetMonth(), endTime.GetDay(), 23,59,59);
665 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime ,endTime, count);
669 __isNoHistoryPresent = false;
670 AppLogDebug("the value of isNoHistoryPresent %d",__isNoHistoryPresent);
671 __pTimer->Start(1000);
672 __pSelectAllCheck->SetShowState(false);
673 __pSelectedLabel->SetShowState(false);
677 __isNoHistoryPresent = true;
678 __pSelectAllCheck->SetShowState(true);
679 __pSelectedLabel->SetShowState(true);
681 __pSelectAllCheck->Invalidate(true);
682 __pSelectedLabel->Invalidate(false);
683 GetFooter()->Invalidate(true);
685 if (__pGroupData != null)
687 AppLogDebug("GetGroupCount returning %d",__pGroupData->GetCount());
688 count = __pGroupData->GetCount();
692 AppLogDebug("GetGroupCount returning 0");
700 EditHistoryListForm::GetItemCount(int groupIndex)
702 AppLogDebug("EditHistoryListForm::GetItemCount");
703 result r = E_FAILURE;
706 if (__pGroupData == null)
708 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
712 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
714 if (pGroupItemClass == null)
716 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
721 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(pGroupItemClass->__startTime,pGroupItemClass->__endTime,count);
725 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
729 if (pGroupItemClass->__pData != null)
731 pGroupItemClass->__pData->RemoveAll(false);
732 delete pGroupItemClass->__pData;
734 pGroupItemClass->__pData = new(std::nothrow) Collection::ArrayList();
735 pGroupItemClass->__pData->Construct();
736 AppLog("Starttime %ls endtime %ls",pGroupItemClass->__startTime.ToString().GetPointer(),pGroupItemClass->__endTime.ToString().GetPointer());
737 HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(pGroupItemClass->__startTime,pGroupItemClass->__endTime, 0, count, *pGroupItemClass->__pData);
738 AppLogDebug("Count = %d ", count);
740 if (__pGroupData == null)
742 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
748 if (pGroupItemClass == null || pGroupItemClass->__pData == null)
750 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
755 AppLogDebug("EditHistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->__pData->GetCount(),groupIndex,pGroupItemClass->__titleText.GetPointer());
756 return pGroupItemClass->__pData->GetCount();
761 EditHistoryListForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
762 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
764 AppLogDebug("EditHistoryListForm::OnSceneActivatedN");
767 String selectedText = L"";
769 if(__pGroupData != null)
771 groupCount = __pGroupData->GetCount();
773 for(int groupIndex = 0 ; groupIndex < groupCount ; groupIndex ++ )
775 count = __pListView->GetItemCountAt(groupIndex);
777 for(int index = 0 ; index < count ; index++)
779 if(__pListView->IsItemChecked( groupIndex,index ) == true)
781 __pListView->SetItemChecked(groupIndex,index,false);
786 if (__pListView != null)
788 __pListView->UpdateList();
790 __pSelectAllCheck->SetSelected(false);
792 selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , __selectedCount);
793 __pSelectedLabel->SetText(selectedText);
794 __pSelectedLabel->Invalidate(true);
795 GetFooter()->SetItemEnabled(1, false);
800 EditHistoryListForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
801 const Tizen::Ui::Scenes::SceneId& nextSceneId)
803 AppLogDebug("EditHistoryListForm::OnSceneDeactivated");
807 EditHistoryListForm::OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
813 EditHistoryListForm::OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus status)
815 AppLogDebug("EditHistoryListForm::OnGroupedListViewItemStateChanged entered");
819 if (status == LIST_ITEM_STATUS_UNCHECKED)
828 if (__selectedCount == 0)
830 GetFooter()->SetItemEnabled(1,false);
834 GetFooter()->SetItemEnabled(1,true);
836 GetFooter()->Invalidate(true);
839 if (__selectedCount >1)
841 selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_POP_PD_ITEMS_SELECTED").GetPointer() , __selectedCount);
845 selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , __selectedCount);
848 __pSelectedLabel->SetText(selectedText);
849 __pSelectedLabel->Invalidate(true);
851 if (status == LIST_ITEM_STATUS_UNCHECKED)
853 __pSelectAllCheck->SetSelected(false);
855 else if (status == LIST_ITEM_STATUS_CHECKED && __pSelectAllCheck->IsSelected() == false && __pGroupData != null)
857 int itemCount = __pGroupData->GetCount();
858 for (int groupIndex = 0 ; groupIndex < itemCount ; groupIndex ++)
860 GroupItemClass* pGClass = (dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)));
865 for (int itemIndex = 0 ; itemIndex < pGClass->__pData->GetCount() ; itemIndex ++)
867 bool ret = __pListView->IsItemChecked(groupIndex,itemIndex);
871 __pSelectAllCheck->SetSelected(false);
876 __pSelectAllCheck->SetSelected(true);
882 EditHistoryListForm::OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction)
888 EditHistoryListForm::GetMonth(int month)
894 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));;
897 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));;
900 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));;
903 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APRIL"));;
906 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));;
909 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUNE"));;
912 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));;
915 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));;
918 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));;
921 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));;
924 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));;
927 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));;
937 EditHistoryListForm::CreateGroupItems(void)
939 AppLogDebug("EditHistoryListForm::createGroupItems entered");
940 if (__pGroupData != null)
942 __pGroupData->RemoveAll(true);
947 if (__pGroupData == null)
949 __pGroupData = new(std::nothrow) Collection::ArrayList();
950 __pGroupData->Construct();
953 DateTime currentTime;
955 HistoryPresentationModel::GetCurrentDateTime(currentTime);
956 GroupItemClass* pGroupItemClass = new(std::nothrow) GroupItemClass();
957 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
958 pGroupItemClass->__endTime = currentTime;
959 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
960 __pGroupData->Add(*pGroupItemClass);
962 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
964 if (pGregorianCalendar != NULL)
966 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
967 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
968 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
969 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
970 delete pGregorianCalendar;
977 pGroupItemClass = new(std::nothrow) GroupItemClass();
978 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
979 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
980 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
981 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 6 - 1);
982 __pGroupData->Add(*pGroupItemClass);
986 pGroupItemClass = new(std::nothrow) GroupItemClass();
987 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
988 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
989 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
990 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 7 - 1);
991 __pGroupData->Add(*pGroupItemClass);
995 pGroupItemClass = new(std::nothrow) GroupItemClass();
996 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
997 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
998 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
999 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
1000 __pGroupData->Add(*pGroupItemClass);
1001 pGroupItemClass = new(std::nothrow) GroupItemClass();
1002 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1003 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1004 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
1005 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1006 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 8 - 1);
1007 __pGroupData->Add(*pGroupItemClass);
1011 pGroupItemClass = new(std::nothrow) GroupItemClass();
1012 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1013 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1014 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1015 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
1016 __pGroupData->Add(*pGroupItemClass);
1018 pGroupItemClass = new(std::nothrow) GroupItemClass();
1019 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1020 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1021 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
1022 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1023 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1);
1024 __pGroupData->Add(*pGroupItemClass);
1026 pGroupItemClass = new(std::nothrow) GroupItemClass();
1027 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1028 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1029 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1);
1030 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1031 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 9 - 1);
1032 __pGroupData->Add(*pGroupItemClass);
1036 pGroupItemClass = new(std::nothrow) GroupItemClass();
1037 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1038 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1039 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1040 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
1041 __pGroupData->Add(*pGroupItemClass);
1043 pGroupItemClass = new(std::nothrow) GroupItemClass();
1044 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1045 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1046 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
1047 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1048 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1);
1049 __pGroupData->Add(*pGroupItemClass);
1051 pGroupItemClass = new(std::nothrow) GroupItemClass();
1052 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1053 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1054 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1);
1055 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1056 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 3 - 1);
1057 __pGroupData->Add(*pGroupItemClass);
1059 pGroupItemClass = new(std::nothrow) GroupItemClass();
1060 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1061 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1062 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 3 - 1);
1063 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1064 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 10 - 1);
1065 __pGroupData->Add(*pGroupItemClass);
1069 pGroupItemClass = new(std::nothrow) GroupItemClass();
1070 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1071 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1072 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1073 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
1074 __pGroupData->Add(*pGroupItemClass);
1076 pGroupItemClass = new(std::nothrow) GroupItemClass();
1077 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1078 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1079 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
1080 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1081 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1);
1082 __pGroupData->Add(*pGroupItemClass);
1084 pGroupItemClass = new(std::nothrow) GroupItemClass();
1085 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1086 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1087 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1);
1088 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1089 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 3 - 1);
1090 __pGroupData->Add(*pGroupItemClass);
1092 pGroupItemClass = new(std::nothrow) GroupItemClass();
1093 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1094 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1095 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 3 - 1);
1096 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1097 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 4 - 1);
1098 __pGroupData->Add(*pGroupItemClass);
1100 pGroupItemClass = new(std::nothrow) GroupItemClass();
1101 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1102 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1103 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 4 - 1);
1104 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1105 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 11 - 1);
1106 __pGroupData->Add(*pGroupItemClass);
1110 pGroupItemClass = new(std::nothrow) GroupItemClass();
1111 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1112 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1113 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1114 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
1115 __pGroupData->Add(*pGroupItemClass);
1117 pGroupItemClass = new(std::nothrow) GroupItemClass();
1118 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1119 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1120 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
1121 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1122 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1);
1123 __pGroupData->Add(*pGroupItemClass);
1125 pGroupItemClass = new(std::nothrow) GroupItemClass();
1126 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1127 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1128 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1);
1129 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1130 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 3 - 1);
1131 __pGroupData->Add(*pGroupItemClass);
1133 pGroupItemClass = new(std::nothrow) GroupItemClass();
1134 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1135 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1136 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 3 - 1);
1137 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1138 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 4 - 1);
1139 __pGroupData->Add(*pGroupItemClass);
1141 pGroupItemClass = new(std::nothrow) GroupItemClass();
1142 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1143 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1144 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 4 - 1);
1145 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1146 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 5 - 1);
1147 __pGroupData->Add(*pGroupItemClass);
1149 pGroupItemClass = new(std::nothrow) GroupItemClass();
1150 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1151 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1152 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 5 - 1);
1153 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1154 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 12 - 1);
1155 __pGroupData->Add(*pGroupItemClass);
1161 int day = currentTime.GetDay();
1165 pGroupItemClass = new(std::nothrow) GroupItemClass();
1166 pGroupItemClass->__titleText = L"Two weeks ago";
1167 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1168 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1169 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1170 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1171 __pGroupData->Add(*pGroupItemClass);
1175 pGroupItemClass = new(std::nothrow) GroupItemClass();
1176 pGroupItemClass->__titleText = L"Two weeks ago";
1177 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1178 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1179 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1180 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1181 __pGroupData->Add(*pGroupItemClass);
1183 pGroupItemClass = new(std::nothrow) GroupItemClass();
1184 pGroupItemClass->__titleText = L"Three weeks ago";
1185 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1186 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1187 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1188 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1189 __pGroupData->Add(*pGroupItemClass);
1193 pGroupItemClass = new(std::nothrow) GroupItemClass();
1194 pGroupItemClass->__titleText = L"Two weeks ago";
1195 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1196 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1197 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1198 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1199 __pGroupData->Add(*pGroupItemClass);
1201 pGroupItemClass = new(std::nothrow) GroupItemClass();
1202 pGroupItemClass->__titleText = L"Three weeks ago";
1203 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1204 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1205 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1206 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1207 __pGroupData->Add(*pGroupItemClass);
1209 pGroupItemClass = new(std::nothrow) GroupItemClass();
1210 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1211 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1212 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1213 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1214 __pGroupData->Add(*pGroupItemClass);
1220 pGroupItemClass = new(std::nothrow) GroupItemClass();
1221 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_MONTH");
1222 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1223 pGroupItemClass->__endTime.AddDays(-1);
1224 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(), 1, 1);
1225 pGroupItemClass->__startTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1226 __pGroupData->Add(*pGroupItemClass);
1228 pGroupItemClass = new(std::nothrow) GroupItemClass();
1229 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1230 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),1, 1);
1231 pGroupItemClass->__endTime.AddMonths(currentTime.GetMonth() - 2);
1232 pGroupItemClass->__endTime.AddDays(-1);
1233 pGroupItemClass->__startTime.SetValue(0, 0, 0);
1234 __pGroupData->Add(*pGroupItemClass);
1237 void EditHistoryListForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
1239 if (__pListView != null)
1241 __pListView->UpdateList();
1246 EditHistoryListForm::OnTimerExpired(Timer& timer)
1248 SceneManager* pSceneManager = SceneManager::GetInstance();
1250 if ( pSceneManager != NULL)
1252 pSceneManager->GoBackward(BackwardSceneTransition());