From 81f0c318253c87820700a7330f974e2925ab3067 Mon Sep 17 00:00:00 2001 From: Amith Kumar Mahale Date: Mon, 24 Jun 2013 12:23:10 +0530 Subject: [PATCH] Fix for N_SE-42061 N_SE-41970 Change-Id: I3f2b9a4b650e012d13f2a49d173862fec2a04d6f Signed-off-by: Amith Kumar Mahale --- inc/ClEventDeleterForm.h | 2 +- src/ClEventDeleterForm.cpp | 76 ++++++++++++++++++++++++++++++++++------------ src/ClEventItem.cpp | 4 ++- 3 files changed, 61 insertions(+), 21 deletions(-) diff --git a/inc/ClEventDeleterForm.h b/inc/ClEventDeleterForm.h index f09258f..de64fe9 100644 --- a/inc/ClEventDeleterForm.h +++ b/inc/ClEventDeleterForm.h @@ -81,7 +81,7 @@ public: virtual void OnCalendarEventChanged(void); void SetAllSelectedEvents(Tizen::Ui::Controls::GroupedListView& listView, int groupIndex, int itemIndex, Tizen::Ui::Controls::ListItemStatus status); - + void AutoCheckSameEvents(int id_original,Tizen::Ui::Controls::ListItemStatus status); private: int GetSelectedEventCount(void); diff --git a/src/ClEventDeleterForm.cpp b/src/ClEventDeleterForm.cpp index a55107e..f7220a4 100644 --- a/src/ClEventDeleterForm.cpp +++ b/src/ClEventDeleterForm.cpp @@ -204,7 +204,7 @@ EventDeleterForm::OnTerminating(void) } __pPm->RemoveCalendarEventChangedEventListener(*this); - if(__pSelectedEvent) + if (__pSelectedEvent) { __pSelectedEvent->RemoveAll(true); delete __pSelectedEvent; @@ -310,7 +310,7 @@ EventDeleterForm::GetGroupCount(void) { groupCount += TOP_BOTTOM_GROUP_ITEM_COUNT; } - if(groupCount == 0 && __pTwoButtonPopup != NULL) + if (groupCount == 0 && __pTwoButtonPopup != NULL) { __pTwoButtonPopup->SetShowState(false); } @@ -489,10 +489,12 @@ void EventDeleterForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, int groupIndex, int itemIndex, int elementId, ListItemStatus status) { + int actualGroupIndex = groupIndex; if (__topBottomItemEnabled == true) { DateTime today = EventListPresentationModel::GetToday(); today.SetValue(today.GetYear(), today.GetMonth(), today.GetDay(), 0, 0, 0); + actualGroupIndex -= TOP_BOTTOM_ITEM_COUNT; if (groupIndex == 0) { @@ -598,6 +600,13 @@ EventDeleterForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, i Invalidate(true); } + const CalEventInstance* pEventInst = __pPm->GetEventWithWholeIndex(actualGroupIndex, itemIndex); + RecordId id; + if (pEventInst != null) + { + id = pEventInst->GetOriginalEventId(); + } + AutoCheckSameEvents(id,status); SetAllSelectedEvents(listView, groupIndex, itemIndex, status); UpdateSelectedLabel(); } @@ -681,7 +690,7 @@ EventDeleterForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneI __pPm->AddCalendarEventChangedEventListener(*this); UpdateSelectedLabel(); - if(__pSelectedEvent != null) + if (__pSelectedEvent != null) { __pSelectedEvent->RemoveAll(true); } @@ -740,10 +749,10 @@ EventDeleterForm::OnActionPerformed(const Control& source, int actionId) for (int j = 0; j < itemCount; j++) { const CalEventInstance* pEventInst = __pPm->GetEventWithWholeIndex(i - startGroupIndex, j); - if(pEventInst != null) + if (pEventInst != null) { RecordId id = pEventInst->GetOriginalEventId(); - __pSelectedEvent->Add(new (std::nothrow) Integer(id)); + __pSelectedEvent->Add(new (std::nothrow) Integer(id)); __pGroupedListViewDeleteList->SetItemChecked(i, j, true); } } @@ -759,7 +768,7 @@ EventDeleterForm::OnActionPerformed(const Control& source, int actionId) for (int j = 0; j < itemCount; j++) { const CalEventInstance* pEventInst = __pPm->GetEventWithWholeIndex(i - startGroupIndex, j); - if(pEventInst != null) + if (pEventInst != null) { RecordId id = pEventInst->GetOriginalEventId(); __pSelectedEvent->Remove(Integer(id)); @@ -814,7 +823,7 @@ EventDeleterForm::SetAllSelectedEvents(GroupedListView& listView, int groupIndex actualGroupIndex -= TOP_BOTTOM_ITEM_COUNT; } const CalEventInstance* pEventInst = __pPm->GetEventWithWholeIndex(actualGroupIndex, itemIndex); - if(pEventInst != null) + if (pEventInst != null) { RecordId id = pEventInst->GetOriginalEventId(); if (status == LIST_ITEM_STATUS_CHECKED) @@ -830,6 +839,38 @@ EventDeleterForm::SetAllSelectedEvents(GroupedListView& listView, int groupIndex } void +EventDeleterForm::AutoCheckSameEvents(RecordId id_original, ListItemStatus status) +{ + int startGroupIndex = 0; + int endGroupIndex = __pGroupedListViewDeleteList->GetGroupCount() - 1; + + if (__topBottomItemEnabled == true) + { + startGroupIndex = TOP_BOTTOM_ITEM_COUNT; + endGroupIndex -= TOP_BOTTOM_ITEM_COUNT; + } + + + for (int i = startGroupIndex; i <= endGroupIndex; i++) + { + int itemCount = __pGroupedListViewDeleteList->GetItemCountAt(i); + for (int j = 0; j < itemCount; j++) + { + const CalEventInstance* pEventInst = __pPm->GetEventWithWholeIndex(i - startGroupIndex, j); + if (pEventInst != null) + { + RecordId id = pEventInst->GetOriginalEventId(); + if (id == id_original) + { + __pGroupedListViewDeleteList->SetItemChecked(i, j, (status == LIST_ITEM_STATUS_CHECKED)?true:false); + } + } + } + } + + +} +void EventDeleterForm::OnCalendarEventChanged(void) { __pGroupedListViewDeleteList->UpdateList(); @@ -856,33 +897,30 @@ EventDeleterForm::OnCalendarEventChanged(void) int itemCount = __pGroupedListViewDeleteList->GetItemCountAt(i); for (int j = 0; j < itemCount; j++) { - if (__pGroupedListViewDeleteList->IsItemChecked(i, j) == true) + const CalEventInstance* pEventInst = __pPm->GetEventWithWholeIndex(i - startGroupIndex, j); + if (pEventInst != null) { - const CalEventInstance* pEventInst = __pPm->GetEventWithWholeIndex(i - startGroupIndex, j); - if(pEventInst != null) + RecordId id = pEventInst->GetOriginalEventId(); + if (__pSelectedEvent->Contains(Integer(id))) { - RecordId id = pEventInst->GetOriginalEventId(); - if (__pSelectedEvent->Contains(Integer(id))) - { - __pGroupedListViewDeleteList->SetItemChecked(i, j, true); - } + __pGroupedListViewDeleteList->SetItemChecked(i, j, true); } } } } - if(IsSelectedAllEvent()) + if (IsSelectedAllEvent()) { - __pSelectAll->SetSelected(true); + __pSelectAll->SetSelected(true); } else { - __pSelectAll->SetSelected(false); + __pSelectAll->SetSelected(false); } __pSelectBeforeToday->SetSelected(false); UpdateSelectedLabel(); - if(!IsSelectedAnyEvent() && __pTwoButtonPopup != null && __pTwoButtonPopup->GetShowState() == true) + if (!IsSelectedAnyEvent() && __pTwoButtonPopup != null && __pTwoButtonPopup->GetShowState() == true) { __pTwoButtonPopup->SetShowState(false); } diff --git a/src/ClEventItem.cpp b/src/ClEventItem.cpp index 78fbc4c..662b070 100644 --- a/src/ClEventItem.cpp +++ b/src/ClEventItem.cpp @@ -66,6 +66,7 @@ static const int W_ICON = 45; static const int H_ICON = 45; static const int W_RANGE_TO_LOCATION_MARGIN = 26; static const int LIST_ANNEX_MARGIN = 30; +static const int W_MIN_CHAR = 20; class EventTitleElement @@ -120,8 +121,9 @@ EventTitleElement::OnDraw(Canvas& canvas, const Rectangle& rect, ListItemDrawing { int startIndex = 0; lowerTitle.IndexOf(lowerSearchText, 0, startIndex); + int start =(startIndex/W_MIN_CHAR)*W_MIN_CHAR; String leftText; - __title.SubString(0, startIndex, leftText); + __title.SubString(start, startIndex - start, leftText); String searchText; __title.SubString(startIndex, __searchText.GetLength(), searchText); String rightText; -- 2.7.4