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.
18 * @file ClListPanel.cpp
19 * @brief This is the implementation file for the ListPanel class.
24 #include "ClEventItem.h"
25 #include "ClEventListPresentationModel.h"
26 #include "ClGoToDatePopup.h"
27 #include "ClListPanel.h"
28 #include "ClMainForm.h"
29 #include "ClResourceManager.h"
30 #include "ClSharePopup.h"
31 #include "ClThreeButtonPopup.h"
32 #include "ClTwoButtonPopup.h"
35 using namespace Tizen::App;
36 using namespace Tizen::Base;
37 using namespace Tizen::Base::Collection;
38 using namespace Tizen::Graphics;
39 using namespace Tizen::Social;
40 using namespace Tizen::System;
41 using namespace Tizen::Ui;
42 using namespace Tizen::Ui::Controls;
43 using namespace Tizen::Ui::Scenes;
44 using namespace Tizen::Locales;
46 static const RecordId ID_DEFAULT_BIRTHDAY_CALENDAR = 3;
48 static const int IDA_LIST_PANEL_CONTEXT_MENU_EDIT = 11511;
49 static const int IDA_LIST_PANEL_CONTEXT_MENU_SHARE = 11512;
50 static const int IDA_LIST_PANEL_CONTEXT_MENU_DELETE = 11513;
52 static const int ID_LIST_ITEM_BEFORE_AFTER = 100;
54 static const int ITEM_HEIGHT = 128;
55 static const int GROUP_ITEM_HEIGHT = 76;
56 static const int LEFT_MARGIN = 16;
57 static const int TOTAL_MARGIN = 32;
58 static const int EVENT_SUB_LIST_TEXT_SIZE = 32;
59 static const int TOP_BOTTOM_GROUP_ITEM_COUNT = 2;
60 static const int TOP_BOTTOM_ITEM_COUNT = 1;
61 static const int GROUP_ITEM_MINIMUM_HEIGHT = 0;
62 static const int PREVIOUS_DATE = -1;
63 static const int NEXT_DATE = 1;
65 static const unsigned int COLOR_GROUP_ITEM_BACKGROUND = Color32<248, 246, 239>::Value;
66 static const unsigned int COLOR_GROUP_ITEM_TODAY_BACKGROUND = Color32<239, 236, 224>::Value;
67 static const unsigned int COLOR_GROUP_ITEM_TEXT = Color32<128, 128, 128>::Value;
68 static const unsigned int COLOR_GROUP_ITEM_TODAY_TEXT = Color32<59, 115, 182>::Value;
69 static const unsigned int COLOR_TOP_BOTTOM_ITEM_TEXT = Color32<42, 137, 194>::Value;
70 static const unsigned int COLOR_ITEM_BACKGROUND = Color32<248, 246, 239>::Value;
71 static const unsigned int COLOR_ITEM_TODAY_BACKGROUND = Color32<239, 236, 224>::Value;
72 static const unsigned int COLOR_ITEM_TEXT_PRESSED = Color32<255, 255, 255>::Value;
73 static const unsigned int COLOR_ITEM_DELETE_BACKGROUND = Color32<208, 82, 82>::Value;
74 static const unsigned int COLOR_ITEM_DELETE_PRESSED_BACKGROUND = Color32<194, 71, 71>::Value;
76 ListPanel::ListPanel(void)
78 , __pGroupedListViewEventsList(null)
79 , __pContextItem(null)
80 , __pContextItemNoEdit(null)
81 , __pDateFormatter(null)
83 , __pThreeButtonPopup(null)
84 , __pTwoButtonPopup(null)
85 , __pGoToDatePopup(null)
91 ListPanel::~ListPanel(void)
97 ListPanel::Initialize(void)
99 static const int _MIN_SIZE = 1;
100 return Construct(Rectangle(0, 0, _MIN_SIZE, _MIN_SIZE));
104 ListPanel::OnInitializing(void)
106 String fontSizeString;
107 SettingInfo::GetValue(L"http://tizen.org/setting/font.size", fontSizeString);
109 AppLogDebug("fontSize: %ls", fontSizeString.GetPointer());
110 if (fontSizeString == L"small")
113 __itemHeight = 120.f;
115 else if (fontSizeString == L"medium")
118 __itemHeight = 140.f;
120 else if (fontSizeString == L"large")
123 __itemHeight = 157.f;
125 else if (fontSizeString == L"huge")
128 __itemHeight = 176.f;
130 else if (fontSizeString == L"giant")
133 __itemHeight = 205.f;
136 __pPm = EventListPresentationModel::GetInstance();
138 Form* pForm = dynamic_cast<Form*>(GetParent());
139 AppAssertf(pForm != null, "[E_FAILURE] Unable to get Form.");
141 Rectangle clientAreaBounds = pForm->GetClientAreaBounds();
142 clientAreaBounds.x = 0;
143 clientAreaBounds.y = 0;
144 SetBounds(clientAreaBounds);
146 Rectangle bounds = GetBounds();
147 __pGroupedListViewEventsList = new (std::nothrow) GroupedListView();
148 __pGroupedListViewEventsList->Construct(Rectangle(0, 0, bounds.width, bounds.height),
149 GROUPED_LIST_VIEW_STYLE_INDEXED, true, SCROLL_STYLE_FADE_OUT);
150 __pGroupedListViewEventsList->SetItemProvider(*this);
152 AddControl(__pGroupedListViewEventsList);
154 __pGroupedListViewEventsList->SetTextOfEmptyList(ResourceManager::GetString(IDS_CLD_BODY_NO_EVENTS));
155 __pGroupedListViewEventsList->SetBitmapOfEmptyList(ResourceManager::GetBitmapN(IDB_LIST_VIEW_NO_CONTENTS_TEXT));
156 __pGroupedListViewEventsList->AddGroupedListViewItemEventListener(*this);
157 Tizen::System::SettingInfo::AddSettingEventListener(*this);
159 __pDateFormatter = ResourceManager::CreateDateFormatterN(DATE_TIME_STYLE_SHORT);
161 __pSharePopup = new (std::nothrow) SharePopup();
162 __pSharePopup->Initialize();
164 __pThreeButtonPopup = new (std::nothrow) ThreeButtonPopup();
165 __pThreeButtonPopup->Initialize();
167 __pTwoButtonPopup = new (std::nothrow) TwoButtonPopup();
168 __pTwoButtonPopup->Initialize();
170 __pGoToDatePopup = new (std::nothrow) GoToDatePopup();
171 __pGoToDatePopup->Initialize();
177 ListPanel::OnTerminating(void)
179 __pPm->RemoveCalendarEventChangedEventListener(*this);
180 __pPm->RemoveCurrentDateChangedEventListener(*this);
182 delete __pContextItem;
183 delete __pContextItemNoEdit;
184 delete __pDateFormatter;
188 __pSharePopup->Destroy();
190 if (__pThreeButtonPopup)
192 __pThreeButtonPopup->Destroy();
194 if (__pTwoButtonPopup)
196 __pTwoButtonPopup->Destroy();
198 if (__pGoToDatePopup)
200 __pGoToDatePopup->Destroy();
203 Tizen::System::SettingInfo::RemoveSettingEventListener(*this);
208 ListPanel::OnUserEventReceivedN(RequestId requestId, IList* pArgs)
215 case IDA_MAIN_FORM_HEADER_TODAY:
216 __pPm->SetTodayToCurrentDate();
218 minRange = __pPm->GetCurrentDate();
219 minRange.SetValue(minRange.GetYear(), minRange.GetMonth(), minRange.GetDay());
222 maxRange.AddMonths(NEXT_DATE);
223 maxRange.AddSeconds(PREVIOUS_DATE);
225 __pPm->SetViewType(VIEW_TYPE_LIST);
226 __pPm->SetViewRange(minRange, maxRange);
229 __pGroupedListViewEventsList->ScrollToItem(0,0);
231 case IDA_MAIN_FORM_FOOTER_CREATE:
233 LinkedList* pArgs = new (std::nothrow) LinkedList();
234 pArgs->Add(new (std::nothrow) DateTime(__pPm->GetCurrentDate()));
235 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_EVENT_EDITOR,
236 SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
240 case IDA_SUB_MENU_GO_TO_DATE:
241 __pGoToDatePopup->RequestPopup(__pPm->GetCurrentDate(), this);
243 case IDA_SUB_MENU_DELETE:
244 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_EVENT_DELETER,
245 SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
247 case IDA_SUB_MENU_SEARCH:
248 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_EVENT_SEARCHER,
249 SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
251 case IDA_SUB_MENU_CALENDARS:
252 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_CALENDAR_LIST,
253 SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
255 case IDA_SUB_MENU_SETTING:
256 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_SETTING,
257 SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
259 case IDA_VIEW_MENU_YEAR:
260 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_YEAR,
261 SCENE_TRANSITION_ANIMATION_TYPE_LEFT,
262 SCENE_HISTORY_OPTION_NO_HISTORY));
264 case IDA_VIEW_MENU_MONTH:
265 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_MONTH,
266 SCENE_TRANSITION_ANIMATION_TYPE_LEFT,
267 SCENE_HISTORY_OPTION_NO_HISTORY));
269 case IDA_VIEW_MENU_DAY:
270 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_DAY,
271 SCENE_TRANSITION_ANIMATION_TYPE_LEFT,
272 SCENE_HISTORY_OPTION_NO_HISTORY));
274 case IDA_GO_TO_DATE_POPUP_DONE:
276 DateTime selectedDate = *static_cast<DateTime*>(pArgs->GetAt(0));
277 DateTime currentDate = __pPm->GetCurrentDate();
278 currentDate.SetValue(selectedDate.GetYear(), selectedDate.GetMonth(), selectedDate.GetDay(), currentDate.GetHour(), currentDate.GetMinute());
279 __pPm->SetCurrentDate(currentDate);
281 minRange = __pPm->GetCurrentDate();
282 minRange.SetValue(minRange.GetYear(), minRange.GetMonth(), minRange.GetDay());
285 maxRange.AddMonths(NEXT_DATE);
286 maxRange.AddSeconds(PREVIOUS_DATE);
288 __pPm->SetViewType(VIEW_TYPE_LIST);
289 __pPm->SetViewRange(minRange, maxRange);
294 case IDA_EVENT_POPUP_DELETE:
295 __pPm->RemoveEvent(*static_cast<const CalEventInstance*>(pArgs->GetAt(0)), true);
297 case IDA_EVENT_POPUP_ONLY_THIS_EVENT_DELETE:
298 __pPm->RemoveEvent(*static_cast<const CalEventInstance*>(pArgs->GetAt(0)), false);
300 case IDA_EVENT_POPUP_ALL_REPETITIVE_EVENT_DELETE:
301 __pPm->RemoveEvent(*static_cast<const CalEventInstance*>(pArgs->GetAt(0)), true);
303 case IDA_EVENT_POPUP_ONLY_THIS_EVENT_EDIT:
304 pArgs->Add(new (std::nothrow) Boolean(false));
305 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_EVENT_EDITOR,
306 SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
309 case IDA_EVENT_POPUP_ALL_REPETITIVE_EVENT_EDIT:
310 pArgs->Add(new (std::nothrow) Boolean(true));
311 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_EVENT_EDITOR,
312 SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);
319 pArgs->RemoveAll(true);
325 ListPanel::GetGroupCount(void)
327 int groupCount = __pPm->GetWholeDayCount();
328 if (groupCount == 0 && __pPm->GetAllOriginalEventCount() == 0)
332 return groupCount + TOP_BOTTOM_GROUP_ITEM_COUNT;
336 ListPanel::GetItemCount(int groupIndex)
338 if (groupIndex == 0 || groupIndex == GetGroupCount() - 1)
340 return TOP_BOTTOM_ITEM_COUNT;
344 return __pPm->GetWholeEventCount(groupIndex - TOP_BOTTOM_ITEM_COUNT);
349 ListPanel::CreateGroupItem(int groupIndex, int itemWidth)
351 GroupItem* pItem = new (std::nothrow) GroupItem();
355 if (groupIndex == 0 || groupIndex == GetGroupCount() - 1)
357 pItem->Construct(Dimension(itemWidth, GROUP_ITEM_MINIMUM_HEIGHT));
358 __pGroupedListViewEventsList->SetItemEnabled(groupIndex, -1, false);
362 pItem->Construct(Dimension(itemWidth, GROUP_ITEM_HEIGHT));
364 date = __pPm->GetDateTimeFromGroupIndex(groupIndex - TOP_BOTTOM_ITEM_COUNT);
365 pItem->SetElement(__pPm->GetDateString(date));
367 if (EventListPresentationModel::IsToday(date) == true)
369 pItem->SetTextColor(Color(COLOR_GROUP_ITEM_TODAY_TEXT));
373 pItem->SetTextColor(Color(COLOR_GROUP_ITEM_TEXT));
375 __pGroupedListViewEventsList->SetItemEnabled(groupIndex, -1, true);
380 ListPanel::DeleteGroupItem(int groupIndex, GroupItem* pItem, int itemWidth)
387 ListPanel::CreateItem(int groupIndex, int itemIndex, int itemWidth)
389 if (groupIndex == 0 || groupIndex == GetGroupCount() - 1)
391 CustomItem* pItem = new (std::nothrow) CustomItem();
397 __pDateFormatter->Format(__pPm->GetViewMinRange(), dateString);
398 string = ResourceManager::GetString(IDS_LIST_VIEW_TAP_VIEW_BEFORE);
402 __pDateFormatter->Format(__pPm->GetViewMaxRange(), dateString);
403 string = ResourceManager::GetString(IDS_LIST_VIEW_TAP_VIEW_AFTER);
405 string.Format(string.GetLength() + dateString.GetLength(), string.GetPointer(), dateString.GetPointer());
407 pItem->Construct(Dimension(itemWidth, ITEM_HEIGHT), LIST_ANNEX_STYLE_NORMAL);
408 pItem->AddElement(Rectangle(LEFT_MARGIN, 0, itemWidth - TOTAL_MARGIN, ITEM_HEIGHT)
409 , ID_LIST_ITEM_BEFORE_AFTER, string, EVENT_SUB_LIST_TEXT_SIZE
410 , Color(COLOR_TOP_BOTTOM_ITEM_TEXT), Color(COLOR_ITEM_TEXT_PRESSED), Color(COLOR_ITEM_TEXT_PRESSED));
414 DateTime minDateTime = Calendarbook::GetMinDateTime();
415 minDateTime.AddYears(1);
416 __pGroupedListViewEventsList->SetItemEnabled(groupIndex, itemIndex, __pPm->GetViewMinRange() > minDateTime);
420 DateTime maxDateTime = Calendarbook::GetMaxDateTime();
421 maxDateTime.AddYears(-1);
422 __pGroupedListViewEventsList->SetItemEnabled(groupIndex, itemIndex, __pPm->GetViewMaxRange() < maxDateTime);
426 __pGroupedListViewEventsList->SetItemEnabled(groupIndex, itemIndex, true);
428 const CalEventInstance* pEvent = __pPm->GetEventWithWholeIndex(groupIndex - TOP_BOTTOM_ITEM_COUNT, itemIndex);
434 EventItem* pItem = new (std::nothrow) EventItem();
435 pItem->Initialize(EVENT_ITEM_STYLE_NORMAL, itemWidth, __itemHeight);
436 pItem->SetTitle(pEvent->GetSubject());
437 pItem->SetFontSize(__fontSize);
438 pItem->SetCalendarColor(__pPm->GetCalendarColor(pEvent->GetCalendarId()));
439 if (pEvent->IsAllDayEvent() == true)
441 pItem->SetAllDayEvent();
445 DateTime startTime = ResourceManager::ConvertUtcTimeToWallTime(pEvent->GetStartTime());
446 DateTime endTime = ResourceManager::ConvertUtcTimeToWallTime(pEvent->GetEndTime());
447 pItem->SetDateRange(startTime, endTime, __pPm->GetDateTimeFromGroupIndex(groupIndex - TOP_BOTTOM_ITEM_COUNT), __pPm->GetTimeFormatter());
450 pItem->SetLocation(pEvent->GetLocation());
451 pItem->SetReminder(pEvent->HasReminder());
452 pItem->SetRepeat(pEvent->IsRecurring());
453 pItem->SetPriority(pEvent->GetPriority());
455 if (__pContextItem == null)
457 ListContextItem* pContextItem = new (std::nothrow) ListContextItem();
458 pContextItem->Construct();
459 pContextItem->AddElement(IDA_LIST_PANEL_CONTEXT_MENU_EDIT,
460 ResourceManager::GetString(IDS_CLD_SK3_EDIT), true);
461 pContextItem->AddElement(IDA_LIST_PANEL_CONTEXT_MENU_SHARE,
462 ResourceManager::GetString(IDS_COM_SK4_SHARE), true);
463 pContextItem->AddElement(IDA_LIST_PANEL_CONTEXT_MENU_DELETE,
464 ResourceManager::GetString(IDS_CLD_SK3_DELETE), true);
465 pContextItem->SetElementBackgroundColor(IDA_LIST_PANEL_CONTEXT_MENU_DELETE, LIST_CONTEXT_ITEM_ELEMENT_STATUS_NORMAL, Color(COLOR_ITEM_DELETE_BACKGROUND));
466 pContextItem->SetElementBackgroundColor(IDA_LIST_PANEL_CONTEXT_MENU_DELETE, LIST_CONTEXT_ITEM_ELEMENT_STATUS_PRESSED, Color(COLOR_ITEM_DELETE_PRESSED_BACKGROUND));
467 pContextItem->SetElementTextColor(IDA_LIST_PANEL_CONTEXT_MENU_DELETE, LIST_CONTEXT_ITEM_ELEMENT_STATUS_NORMAL, Color(COLOR_ITEM_TEXT_PRESSED));
469 __pContextItem = pContextItem;
471 if (__pContextItemNoEdit == null)
473 ListContextItem* pContextItem = new (std::nothrow) ListContextItem();
474 pContextItem->Construct();
475 pContextItem->AddElement(IDA_LIST_PANEL_CONTEXT_MENU_SHARE,
476 ResourceManager::GetString(IDS_COM_SK4_SHARE), true);
478 __pContextItemNoEdit = pContextItem;
480 pItem->SetContextItem((pEvent->GetCalendarId() == ID_DEFAULT_BIRTHDAY_CALENDAR) ? __pContextItemNoEdit : __pContextItem);
482 pItem->UpdateElements();
487 ListPanel::DeleteItem(int groupIndex, int itemIndex, ListItemBase* pItem, int itemWidth)
494 ListPanel::OnGroupedListViewItemStateChanged(GroupedListView& listView,
495 int groupIndex, int itemIndex, int elementId, ListItemStatus status)
497 int lastGroupIndex = listView.GetGroupCount() - 1;
501 DateTime minRange = __pPm->GetViewMinRange();
502 minRange.AddMonths(PREVIOUS_DATE);
503 DateTime minDateTime = Calendarbook::GetMinDateTime();
504 minDateTime.AddYears(1);
505 if (minRange < minDateTime)
507 minRange = minDateTime;
510 __pPm->SetViewType(VIEW_TYPE_LIST);
511 __pPm->SetViewRange(minRange, __pPm->GetViewMaxRange());
516 else if (groupIndex == lastGroupIndex)
518 DateTime maxRange = __pPm->GetViewMaxRange();
519 maxRange.AddMonths(NEXT_DATE);
520 DateTime maxDateTime = Calendarbook::GetMaxDateTime();
521 maxDateTime.AddYears(-1);
522 if (maxRange > maxDateTime)
524 maxRange = maxDateTime;
527 __pPm->SetViewType(VIEW_TYPE_LIST);
528 __pPm->SetViewRange(__pPm->GetViewMinRange(), maxRange);
532 listView.ScrollToItem(listView.GetGroupCount() - 1, 0);
533 listView.Invalidate(false);
537 if (status == LIST_ITEM_STATUS_SELECTED)
539 LinkedList* pList = new (std::nothrow) LinkedList;
540 CalEventInstance* pEventInstance = new (std::nothrow) CalEventInstance(*__pPm->GetEventWithWholeIndex(groupIndex - (TOP_BOTTOM_GROUP_ITEM_COUNT / 2), itemIndex));
541 pList->Add(pEventInstance);
542 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_EVENT_DETAILS,
543 SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
548 ListPanel::OnGroupedListViewItemSwept(GroupedListView& listView, int groupIndex, int itemIndex, SweepDirection direction)
554 ListPanel::OnGroupedListViewContextItemStateChanged(GroupedListView& listView,
555 int groupIndex, int itemIndex, int elementId, ListContextItemStatus status)
557 if (status == LIST_CONTEXT_ITEM_STATUS_SELECTED)
559 int actualGroupIndex = groupIndex - (TOP_BOTTOM_GROUP_ITEM_COUNT / 2);
560 const CalEventInstance* pEventInstance = __pPm->GetEventWithWholeIndex(actualGroupIndex, itemIndex);
563 case IDA_LIST_PANEL_CONTEXT_MENU_EDIT:
564 if (__pPm->IsEditableAllEvent(*pEventInstance))
566 __pThreeButtonPopup->RequestPopup(THREE_BUTTON_POPUP_STYLE_EDIT, this, pEventInstance);
570 LinkedList* pList = new (std::nothrow) LinkedList(SingleObjectDeleter);
571 CalEventInstance* pEventInstance = new (std::nothrow) CalEventInstance(*__pPm->GetEventWithWholeIndex(groupIndex - (TOP_BOTTOM_GROUP_ITEM_COUNT / 2), itemIndex));
572 pList->Add(pEventInstance);
573 pList->Add(new (std::nothrow) Boolean(true));
574 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_EVENT_EDITOR,
575 SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
578 case IDA_LIST_PANEL_CONTEXT_MENU_SHARE:
579 __pSharePopup->RequestShare(__pPm->GetEventWithWholeIndex(groupIndex - (TOP_BOTTOM_GROUP_ITEM_COUNT / 2), itemIndex)->GetOriginalEventId());
581 case IDA_LIST_PANEL_CONTEXT_MENU_DELETE:
582 if (pEventInstance->IsRecurring())
584 __pThreeButtonPopup->RequestPopup(THREE_BUTTON_POPUP_STYLE_DELETE, this, pEventInstance);
588 __pTwoButtonPopup->RequestPopup(TWO_BUTTON_POPUP_STYLE_SINGLE_EVENT, this, pEventInstance);
596 ListPanel::OnGroupedListViewItemLongPressed(GroupedListView& listView,
597 int groupIndex, int itemIndex, int elementId, bool& invokeListViewItemCallback)
603 ListPanel::OnGroupedListViewGroupItemSelected(GroupedListView& listView, int groupIndex)
605 if (listView.IsGroupExpanded(groupIndex) == true)
607 listView.CollapseGroup(groupIndex);
611 listView.ExpandGroup(groupIndex);
616 ListPanel::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
618 AppLogDebug("Enter.");
621 pArgs->RemoveAll(true);
625 if (__pPm->GetViewType() != VIEW_TYPE_LIST)
627 DateTime minRange = __pPm->GetCurrentDate();
628 minRange.SetValue(minRange.GetYear(), minRange.GetMonth(), minRange.GetDay());
629 DateTime maxRange = minRange;
630 maxRange.AddMonths(NEXT_DATE);
631 maxRange.AddSeconds(PREVIOUS_DATE);
633 __pPm->SetViewType(VIEW_TYPE_LIST);
634 __pPm->SetViewRange(minRange, maxRange);
636 __pPm->AddCalendarEventChangedEventListener(*this);
637 __pPm->AddCurrentDateChangedEventListener(*this);
639 Form* pForm = dynamic_cast<Form*>(GetParent());
642 Header* pHeader = pForm->GetHeader();
645 pHeader->SetTitleText(__pPm->GetTitleString());
650 AppLogDebug("Exit.");
654 ListPanel::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
656 AppLogDebug("Enter.");
657 __pPm->RemoveCalendarEventChangedEventListener(*this);
658 __pPm->RemoveCurrentDateChangedEventListener(*this);
659 AppLogDebug("Exit.");
663 ListPanel::OnSettingChanged(Tizen::Base::String& key)
665 if (key.Equals(KEY_SYSTEM_DATE,false))
667 __pGroupedListViewEventsList->UpdateList();
672 ListPanel::OnActionPerformed(const Control& source, int actionId)
677 ListPanel::OnCalendarEventChanged(void)
679 AppLogDebug("Enter.");
680 if (__pPm->GetViewType() != VIEW_TYPE_LIST)
682 DateTime minRange = __pPm->GetCurrentDate();
683 minRange.SetValue(minRange.GetYear(), minRange.GetMonth(), minRange.GetDay());
684 DateTime maxRange = minRange;
686 maxRange.AddMonths(NEXT_DATE);
687 maxRange.AddSeconds(PREVIOUS_DATE);
688 __pPm->SetViewType(VIEW_TYPE_LIST);
689 __pPm->SetViewRange(minRange, maxRange);
693 AppLogDebug("Exit.");
697 ListPanel::OnCurrentDateChanged(const DateTime& currentDate, const DateTime& prevDate)
699 AppLogDebug("Enter.");
700 if (EventListPresentationModel::IsSameDay(currentDate, prevDate) == false)
704 AppLogDebug("Exit.");
708 ListPanel::Update(void)
710 result r = __pGroupedListViewEventsList->UpdateList();
714 if (__pGroupedListViewEventsList->IsGroupExpanded(GetGroupCount() - 1) == false)
716 __pGroupedListViewEventsList->ExpandGroup(GetGroupCount() - 1);