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));
446 __pListView->SetItemEnabled(groupIndex, -1, false);
450 r = pItem->Construct(Dimension(itemWidth, 48));
453 text = pGroupItemClass->__titleText;
457 if (pGroupItemClass->__titleText == CommonUtil::GetString(L"IDS_COM_BODY_TODAY") || pGroupItemClass->__titleText == CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY"))
459 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
460 if (pGregorianCalendar != NULL)
462 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, pGroupItemClass->__startTime.GetYear());
463 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, pGroupItemClass->__startTime.GetMonth());
464 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, pGroupItemClass->__startTime.GetDay());
465 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
467 if (pGregorianCalendar != NULL)
469 delete pGregorianCalendar;
476 r = text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SUN"));
477 AppLog("dayOfWeek Append Result %s",GetErrorMessage(r));
481 r = text.Append(CommonUtil::GetString(L"IDS_COM_BODY_MON"));
482 AppLog("dayOfWeek Append Result %s",GetErrorMessage(r));
486 r = text.Append(CommonUtil::GetString(L"IDS_COM_BODY_TUE"));
487 AppLog("dayOfWeek Append Result %s",GetErrorMessage(r));
491 r = text.Append(CommonUtil::GetString(L"IDS_COM_BODY_WED"));
492 AppLog("dayOfWeek Append Result %s",GetErrorMessage(r));
496 AppLog("dayOfWeek Append Result yoyo");
497 r = text.Append(CommonUtil::GetString(L"IDS_COM_BODY_THU"));
498 AppLog("dayOfWeek Append Result %s",GetErrorMessage(r));
502 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_FRI"));
506 text.Append(CommonUtil::GetString(L"IDS_COM_BODY_SAT"));
516 if (pGroupItemClass->__titleText != L"Older")
518 text.Append(pGroupItemClass->__startTime.GetDay());
520 strMonth = pGroupItemClass->__startTime.GetMonth();
521 month = GetMonth(strMonth);
529 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")
532 text.Append(pGroupItemClass->__endTime.GetDay());
534 strMonth = pGroupItemClass->__endTime.GetMonth();
535 month = GetMonth(strMonth);
540 AppLogDebug("startTime day = %d month = %d year = %d",pGroupItemClass->__startTime.GetDay(),pGroupItemClass->__startTime.GetMonth(),pGroupItemClass->__startTime.GetYear());
542 pItem->SetElement(text, null);
543 pItem->SetTextSize(32);
549 EditHistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
551 AppLogDebug("EditHistoryListForm::CreateItem");
552 result r = E_FAILURE;
553 const int bookmarkBtnWidth = 64;
555 if (__pGroupData == null)
560 CustomItem* pItem = new(std::nothrow) CustomItem();
565 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
567 if (pGroupItemClass == null)
573 History* pHistory = dynamic_cast< History* >(pGroupItemClass->__pData->GetAt(itemIndex));
574 if ( pHistory == NULL )
579 Bitmap* pBitmap = null;
581 r = pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 128 + (__fontSize - 44)), LIST_ANNEX_STYLE_MARK);
585 pBitmap = pHistory->GetFavIconBitmap();
588 pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
593 pItem->AddElement(Rectangle(16, 26 + (__fontSize - 44)/2, 60, 60), IDA_FORMAT_ICON, *pBitmap, null);
596 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);
600 AppLogException("CreateItem failed with %s", GetErrorMessage(r));
604 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);
610 EditHistoryListForm::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
613 AppLogDebug("EditHistoryListForm::DeleteGroupItem");
615 if (__pGroupData == null)
628 EditHistoryListForm::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
631 if (__pGroupData == null)
636 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
637 if (pGroupItemClass == null)
648 EditHistoryListForm::GetGroupCount(void)
650 result r = E_FAILURE;
651 AppLogDebug("EditHistoryListForm::GetGroupCount");
653 __isNoHistoryPresent = true;
658 //HistoryPresentationModel::GetInstance()->GetHistoryCount(count);
661 startTime.SetValue(0, 1, 1, 0, 0, 0);
663 SystemTime::GetCurrentTime(endTime);
664 endTime.SetValue(endTime.GetYear(), endTime.GetMonth(), endTime.GetDay(), 23,59,59);
666 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(startTime ,endTime, count);
670 __isNoHistoryPresent = false;
671 AppLogDebug("the value of isNoHistoryPresent %d",__isNoHistoryPresent);
672 __pTimer->Start(1000);
673 __pSelectAllCheck->SetShowState(false);
674 __pSelectedLabel->SetShowState(false);
678 __isNoHistoryPresent = true;
679 __pSelectAllCheck->SetShowState(true);
680 __pSelectedLabel->SetShowState(true);
682 __pSelectAllCheck->Invalidate(true);
683 __pSelectedLabel->Invalidate(false);
684 GetFooter()->Invalidate(true);
686 if (__pGroupData != null)
688 AppLogDebug("GetGroupCount returning %d",__pGroupData->GetCount());
689 count = __pGroupData->GetCount();
693 AppLogDebug("GetGroupCount returning 0");
701 EditHistoryListForm::GetItemCount(int groupIndex)
703 AppLogDebug("EditHistoryListForm::GetItemCount");
704 result r = E_FAILURE;
707 if (__pGroupData == null)
709 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
713 GroupItemClass* pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
715 if (pGroupItemClass == null)
717 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
722 r = HistoryPresentationModel::GetInstance()->GetHistoryCountWithTimeRange(pGroupItemClass->__startTime,pGroupItemClass->__endTime,count);
726 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
730 if (pGroupItemClass->__pData != null)
732 pGroupItemClass->__pData->RemoveAll(false);
733 delete pGroupItemClass->__pData;
735 pGroupItemClass->__pData = new(std::nothrow) Collection::ArrayList();
736 pGroupItemClass->__pData->Construct();
737 AppLog("Starttime %ls endtime %ls",pGroupItemClass->__startTime.ToString().GetPointer(),pGroupItemClass->__endTime.ToString().GetPointer());
738 HistoryPresentationModel::GetInstance()->GetHistoryWithTimeRange(pGroupItemClass->__startTime,pGroupItemClass->__endTime, 0, count, *pGroupItemClass->__pData);
739 AppLogDebug("Count = %d ", count);
741 if (__pGroupData == null)
743 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
749 if (pGroupItemClass == null || pGroupItemClass->__pData == null)
751 AppLogDebug("EditHistoryListForm::GetItemCount returning 0");
756 AppLogDebug("EditHistoryListForm::GetItemCount returning %d for %d title %ls",pGroupItemClass->__pData->GetCount(),groupIndex,pGroupItemClass->__titleText.GetPointer());
757 return pGroupItemClass->__pData->GetCount();
762 EditHistoryListForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
763 const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)
765 AppLogDebug("EditHistoryListForm::OnSceneActivatedN");
768 String selectedText = L"";
770 if(__pGroupData != null)
772 groupCount = __pGroupData->GetCount();
774 for(int groupIndex = 0 ; groupIndex < groupCount ; groupIndex ++ )
776 count = __pListView->GetItemCountAt(groupIndex);
778 for(int index = 0 ; index < count ; index++)
780 if(__pListView->IsItemChecked( groupIndex,index ) == true)
782 __pListView->SetItemChecked(groupIndex,index,false);
787 if (__pListView != null)
789 __pListView->UpdateList();
791 __pSelectAllCheck->SetSelected(false);
793 selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , __selectedCount);
794 __pSelectedLabel->SetText(selectedText);
795 __pSelectedLabel->Invalidate(true);
796 GetFooter()->SetItemEnabled(1, false);
801 EditHistoryListForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
802 const Tizen::Ui::Scenes::SceneId& nextSceneId)
804 AppLogDebug("EditHistoryListForm::OnSceneDeactivated");
808 EditHistoryListForm::OnGroupedListViewContextItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
814 EditHistoryListForm::OnGroupedListViewItemStateChanged(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, int elementId, Tizen::Ui::Controls::ListItemStatus status)
816 AppLogDebug("EditHistoryListForm::OnGroupedListViewItemStateChanged entered");
820 if (status == LIST_ITEM_STATUS_UNCHECKED)
829 if (__selectedCount == 0)
831 GetFooter()->SetItemEnabled(1,false);
835 GetFooter()->SetItemEnabled(1,true);
837 GetFooter()->Invalidate(true);
840 if (__selectedCount >1)
842 selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_POP_PD_ITEMS_SELECTED").GetPointer() , __selectedCount);
846 selectedText.Format(25, CommonUtil::GetString(L"IDS_BR_BODY_PD_ITEM_SELECTED").GetPointer() , __selectedCount);
849 __pSelectedLabel->SetText(selectedText);
850 __pSelectedLabel->Invalidate(true);
852 if (status == LIST_ITEM_STATUS_UNCHECKED)
854 __pSelectAllCheck->SetSelected(false);
856 else if (status == LIST_ITEM_STATUS_CHECKED && __pSelectAllCheck->IsSelected() == false && __pGroupData != null)
858 int itemCount = __pGroupData->GetCount();
859 for (int groupIndex = 0 ; groupIndex < itemCount ; groupIndex ++)
861 GroupItemClass* pGClass = (dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex)));
866 for (int itemIndex = 0 ; itemIndex < pGClass->__pData->GetCount() ; itemIndex ++)
868 bool ret = __pListView->IsItemChecked(groupIndex,itemIndex);
872 __pSelectAllCheck->SetSelected(false);
877 __pSelectAllCheck->SetSelected(true);
883 EditHistoryListForm::OnGroupedListViewItemSwept(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::SweepDirection direction)
889 EditHistoryListForm::GetMonth(int month)
895 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JAN"));;
898 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_FEB"));;
901 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAR"));;
904 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_APRIL"));;
907 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_MAY"));;
910 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUNE"));;
913 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_JUL"));;
916 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_AUG"));;
919 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_SEP"));;
922 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_OCT"));;
925 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_NOV"));;
928 monthValue.Append(CommonUtil::GetString(L"IDS_COM_BODY_DEC"));;
938 EditHistoryListForm::CreateGroupItems(void)
940 AppLogDebug("EditHistoryListForm::createGroupItems entered");
941 if (__pGroupData != null)
943 __pGroupData->RemoveAll(true);
948 if (__pGroupData == null)
950 __pGroupData = new(std::nothrow) Collection::ArrayList();
951 __pGroupData->Construct();
954 DateTime currentTime;
956 HistoryPresentationModel::GetCurrentDateTime(currentTime);
957 GroupItemClass* pGroupItemClass = new(std::nothrow) GroupItemClass();
958 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TODAY");
959 pGroupItemClass->__endTime = currentTime;
960 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
961 __pGroupData->Add(*pGroupItemClass);
963 Calendar* pGregorianCalendar = Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
965 if (pGregorianCalendar != NULL)
967 pGregorianCalendar->SetTimeField(TIME_FIELD_YEAR, currentTime.GetYear());
968 pGregorianCalendar->SetTimeField(TIME_FIELD_MONTH, currentTime.GetMonth());
969 pGregorianCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, currentTime.GetDay());
970 dayOfWeek = pGregorianCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK);
971 delete pGregorianCalendar;
978 pGroupItemClass = new(std::nothrow) GroupItemClass();
979 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
980 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
981 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
982 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 6 - 1);
983 __pGroupData->Add(*pGroupItemClass);
987 pGroupItemClass = new(std::nothrow) GroupItemClass();
988 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
989 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
990 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
991 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 7 - 1);
992 __pGroupData->Add(*pGroupItemClass);
996 pGroupItemClass = new(std::nothrow) GroupItemClass();
997 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
998 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
999 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1000 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
1001 __pGroupData->Add(*pGroupItemClass);
1002 pGroupItemClass = new(std::nothrow) GroupItemClass();
1003 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1004 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1005 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
1006 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1007 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 8 - 1);
1008 __pGroupData->Add(*pGroupItemClass);
1012 pGroupItemClass = new(std::nothrow) GroupItemClass();
1013 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1014 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1015 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1016 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
1017 __pGroupData->Add(*pGroupItemClass);
1019 pGroupItemClass = new(std::nothrow) GroupItemClass();
1020 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1021 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1022 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
1023 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1024 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1);
1025 __pGroupData->Add(*pGroupItemClass);
1027 pGroupItemClass = new(std::nothrow) GroupItemClass();
1028 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1029 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1030 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1);
1031 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1032 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 9 - 1);
1033 __pGroupData->Add(*pGroupItemClass);
1037 pGroupItemClass = new(std::nothrow) GroupItemClass();
1038 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1039 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1040 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1041 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
1042 __pGroupData->Add(*pGroupItemClass);
1044 pGroupItemClass = new(std::nothrow) GroupItemClass();
1045 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1046 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1047 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
1048 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1049 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1);
1050 __pGroupData->Add(*pGroupItemClass);
1052 pGroupItemClass = new(std::nothrow) GroupItemClass();
1053 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1054 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1055 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1);
1056 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1057 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 3 - 1);
1058 __pGroupData->Add(*pGroupItemClass);
1060 pGroupItemClass = new(std::nothrow) GroupItemClass();
1061 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1062 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1063 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 3 - 1);
1064 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1065 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 10 - 1);
1066 __pGroupData->Add(*pGroupItemClass);
1070 pGroupItemClass = new(std::nothrow) GroupItemClass();
1071 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1072 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1073 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1074 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
1075 __pGroupData->Add(*pGroupItemClass);
1077 pGroupItemClass = new(std::nothrow) GroupItemClass();
1078 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1079 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1080 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
1081 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1082 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1);
1083 __pGroupData->Add(*pGroupItemClass);
1085 pGroupItemClass = new(std::nothrow) GroupItemClass();
1086 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1087 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1088 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1);
1089 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1090 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 3 - 1);
1091 __pGroupData->Add(*pGroupItemClass);
1093 pGroupItemClass = new(std::nothrow) GroupItemClass();
1094 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1095 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1096 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 3 - 1);
1097 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1098 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 4 - 1);
1099 __pGroupData->Add(*pGroupItemClass);
1101 pGroupItemClass = new(std::nothrow) GroupItemClass();
1102 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1103 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1104 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 4 - 1);
1105 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1106 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 11 - 1);
1107 __pGroupData->Add(*pGroupItemClass);
1111 pGroupItemClass = new(std::nothrow) GroupItemClass();
1112 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_YESTERDAY");
1113 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), currentTime.GetDay());
1114 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1115 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 1 - 1);
1116 __pGroupData->Add(*pGroupItemClass);
1118 pGroupItemClass = new(std::nothrow) GroupItemClass();
1119 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_THU");
1120 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1121 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 1 - 1);
1122 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1123 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 2 - 1);
1124 __pGroupData->Add(*pGroupItemClass);
1126 pGroupItemClass = new(std::nothrow) GroupItemClass();
1127 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_WED");
1128 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1129 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 2 - 1);
1130 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1131 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 3 - 1);
1132 __pGroupData->Add(*pGroupItemClass);
1134 pGroupItemClass = new(std::nothrow) GroupItemClass();
1135 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_TUE");
1136 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1137 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 3 - 1);
1138 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1139 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 4 - 1);
1140 __pGroupData->Add(*pGroupItemClass);
1142 pGroupItemClass = new(std::nothrow) GroupItemClass();
1143 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_COM_BODY_MON");
1144 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1145 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 4 - 1);
1146 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1147 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 5 - 1);
1148 __pGroupData->Add(*pGroupItemClass);
1150 pGroupItemClass = new(std::nothrow) GroupItemClass();
1151 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_WEEK");
1152 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1153 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 5 - 1);
1154 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1155 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 12 - 1);
1156 __pGroupData->Add(*pGroupItemClass);
1162 int day = currentTime.GetDay();
1166 pGroupItemClass = new(std::nothrow) GroupItemClass();
1167 pGroupItemClass->__titleText = L"Two weeks ago";
1168 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1169 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1170 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1171 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1172 __pGroupData->Add(*pGroupItemClass);
1176 pGroupItemClass = new(std::nothrow) GroupItemClass();
1177 pGroupItemClass->__titleText = L"Two weeks ago";
1178 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1179 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1180 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1181 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1182 __pGroupData->Add(*pGroupItemClass);
1184 pGroupItemClass = new(std::nothrow) GroupItemClass();
1185 pGroupItemClass->__titleText = L"Three weeks ago";
1186 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1187 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1188 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1189 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1190 __pGroupData->Add(*pGroupItemClass);
1194 pGroupItemClass = new(std::nothrow) GroupItemClass();
1195 pGroupItemClass->__titleText = L"Two weeks ago";
1196 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1197 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 7 - dayOfWeek + 2 - 1);
1198 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1199 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1200 __pGroupData->Add(*pGroupItemClass);
1202 pGroupItemClass = new(std::nothrow) GroupItemClass();
1203 pGroupItemClass->__titleText = L"Three weeks ago";
1204 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1205 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 14 - dayOfWeek + 2 - 1);
1206 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1207 pGroupItemClass->__startTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1208 __pGroupData->Add(*pGroupItemClass);
1210 pGroupItemClass = new(std::nothrow) GroupItemClass();
1211 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_EARLIER_THIS_MONTH");
1212 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1213 pGroupItemClass->__endTime.AddDays(currentTime.GetDay() - 21 - dayOfWeek + 2 - 1);
1214 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1215 __pGroupData->Add(*pGroupItemClass);
1221 pGroupItemClass = new(std::nothrow) GroupItemClass();
1222 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_LAST_MONTH");
1223 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),currentTime.GetMonth(), 1);
1224 pGroupItemClass->__endTime.AddDays(-1);
1225 pGroupItemClass->__startTime.SetValue(currentTime.GetYear(), 1, 1);
1226 pGroupItemClass->__startTime.AddMonths(currentTime.GetMonth() - 1 - 1);
1227 __pGroupData->Add(*pGroupItemClass);
1229 pGroupItemClass = new(std::nothrow) GroupItemClass();
1230 pGroupItemClass->__titleText = CommonUtil::GetString(L"IDS_BR_BODY_OLDER");
1231 pGroupItemClass->__endTime.SetValue(currentTime.GetYear(),1, 1);
1232 pGroupItemClass->__endTime.AddMonths(currentTime.GetMonth() - 2);
1233 pGroupItemClass->__endTime.AddDays(-1);
1234 pGroupItemClass->__startTime.SetValue(0, 0, 0);
1235 __pGroupData->Add(*pGroupItemClass);
1238 void EditHistoryListForm::OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus)
1240 if (__pListView != null)
1242 __pListView->UpdateList();
1247 EditHistoryListForm::OnTimerExpired(Timer& timer)
1249 SceneManager* pSceneManager = SceneManager::GetInstance();
1251 if ( pSceneManager != NULL)
1253 pSceneManager->GoBackward(BackwardSceneTransition());
1258 EditHistoryListForm::OnUserEventReceivedN (RequestId requestId, Tizen::Base::Collection::IList *pArgs)
1260 AppLog("receiving userevent for appcontrol %d",requestId);
1261 if (requestId == APPCONTROL_LAUNCH_MAX_LIMIT_REACHED)
1263 AppLog("receiving userevent for appcontrol %d ",requestId);
1264 if(__pConfirmationPopup)
1266 __pConfirmationPopup->SetShowState(false);
1267 delete __pConfirmationPopup;
1268 __pConfirmationPopup = null;