From e8637b6127e12b19bba778519b44855adc75f31d Mon Sep 17 00:00:00 2001 From: Changyong Jeon Date: Mon, 20 May 2013 22:45:53 +0900 Subject: [PATCH] Resolved issue N_SE-39048 Change-Id: I350a42d26b76a4ebab125af30e1fe056d5c21b9d --- inc/ClDayPanel.h | 2 ++ inc/ClGoToDatePopup.h | 12 ++++++------ inc/ClListPanel.h | 2 ++ inc/ClMonthPanel.h | 2 ++ inc/ClTypes.h | 1 + inc/ClYearPanel.h | 2 ++ src/ClDayPanel.cpp | 12 +++++++++++- src/ClGoToDatePopup.cpp | 37 ++++++++++++++++++------------------- src/ClListPanel.cpp | 26 ++++++++++++++++++++++---- src/ClMonthPanel.cpp | 10 +++++++++- src/ClYearPanel.cpp | 11 ++++++++++- 11 files changed, 85 insertions(+), 32 deletions(-) diff --git a/inc/ClDayPanel.h b/inc/ClDayPanel.h index 25e7d69..214c2d3 100644 --- a/inc/ClDayPanel.h +++ b/inc/ClDayPanel.h @@ -27,6 +27,7 @@ #include #include +#include "ClGoToDatePopup.h" #include "ClICalendarEventChangedEventListener.h" #include "ClICurrentDateChangedEventListener.h" #include "ClIDateFocusEventListener.h" @@ -89,6 +90,7 @@ private: EventListPresentationModel* __pPm; Tizen::Ui::Controls::Panel* __pPanelDayEvent[VIEW_SCROLL_EFFECT_COUNT]; PanningAnimationManager* __pPanningAnimationManager; + GoToDatePopup* __pGoToDatePopup; }; // DayPanel #endif // _CL_DAY_PANEL_H_ diff --git a/inc/ClGoToDatePopup.h b/inc/ClGoToDatePopup.h index 70ec480..e3a88e0 100644 --- a/inc/ClGoToDatePopup.h +++ b/inc/ClGoToDatePopup.h @@ -30,17 +30,17 @@ class GoToDatePopup , public virtual Tizen::Ui::IActionEventListener { public: + GoToDatePopup(void); + virtual ~GoToDatePopup(void); + + result Initialize(void); + void RequestPopup(const Tizen::Base::DateTime& initialDate, Tizen::Ui::Control* pTarget); + virtual result OnInitializing(void); virtual result OnTerminating(void); virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); - static void RequestGoToDate(const Tizen::Base::DateTime& initialDate, Tizen::Ui::Control* pTarget); - -private: - GoToDatePopup(void); - virtual ~GoToDatePopup(void); - private: Tizen::Base::DateTime __date; Tizen::Ui::Controls::EditDate* __pEditDate; diff --git a/inc/ClListPanel.h b/inc/ClListPanel.h index deea348..fe7a278 100644 --- a/inc/ClListPanel.h +++ b/inc/ClListPanel.h @@ -27,6 +27,7 @@ #include #include +#include "ClGoToDatePopup.h" #include "ClICalendarEventChangedEventListener.h" #include "ClICurrentDateChangedEventListener.h" @@ -95,6 +96,7 @@ private: SharePopup* __pSharePopup; ThreeButtonPopup* __pThreeButtonPopup; TwoButtonPopup* __pTwoButtonPopup; + GoToDatePopup* __pGoToDatePopup; }; // ListPanel #endif // _CL_LIST_PANEL_H_ diff --git a/inc/ClMonthPanel.h b/inc/ClMonthPanel.h index 2986e7e..87e11cc 100644 --- a/inc/ClMonthPanel.h +++ b/inc/ClMonthPanel.h @@ -26,6 +26,7 @@ #include #include +#include "ClGoToDatePopup.h" #include "ClICalendarEventChangedEventListener.h" #include "ClICurrentDateChangedEventListener.h" #include "ClIDateFocusEventListener.h" @@ -102,6 +103,7 @@ private: SharePopup* __pSharePopup; ThreeButtonPopup* __pThreeButtonPopup; TwoButtonPopup* __pTwoButtonPopup; + GoToDatePopup* __pGoToDatePopup; }; // MonthPanel #endif // _CL_MONTH_PANEL_H_ diff --git a/inc/ClTypes.h b/inc/ClTypes.h index 43e1226..51459ba 100644 --- a/inc/ClTypes.h +++ b/inc/ClTypes.h @@ -370,6 +370,7 @@ enum IDA_SUB_MENU_SETTING = 10405, IDA_GO_TO_DATE_POPUP_DONE = 10801, + IDA_GO_TO_DATE_POPUP_CANCEL = 10902, IDA_EVENT_POPUP_DELETE = 10901, diff --git a/inc/ClYearPanel.h b/inc/ClYearPanel.h index 7b2dbfd..dd31724 100644 --- a/inc/ClYearPanel.h +++ b/inc/ClYearPanel.h @@ -26,6 +26,7 @@ #include #include +#include "ClGoToDatePopup.h" #include "ClICurrentDateChangedEventListener.h" #include "ClIDateFocusEventListener.h" #include "ClIPanningAnimationControlProvider.h" @@ -84,6 +85,7 @@ private: Tizen::Graphics::Bitmap* __pBitmapHolidayText[YEAR_PANEL_COUNT_OF_DAY]; Tizen::Graphics::Bitmap* __pBitmapTodayText[YEAR_PANEL_COUNT_OF_DAY]; Tizen::Graphics::Bitmap* __pBitmapFocus; + GoToDatePopup* __pGoToDatePopup; }; // YearPanel #endif // _CL_YEAR_PANEL_H_ diff --git a/src/ClDayPanel.cpp b/src/ClDayPanel.cpp index 5897a57..9d01b3d 100644 --- a/src/ClDayPanel.cpp +++ b/src/ClDayPanel.cpp @@ -1103,6 +1103,7 @@ DayEventPanel::CollapseAllDayEventList(void) DayPanel::DayPanel(void) : __pPm(null) , __pPanningAnimationManager(null) + , __pGoToDatePopup(null) { memset((void *)__pPanelDayEvent, 0, sizeof(Panel*) * VIEW_SCROLL_EFFECT_COUNT); } @@ -1146,6 +1147,9 @@ DayPanel::OnInitializing(void) pPanel->SetScrollEventListener(*this); __pPanelDayEvent[VIEW_SCROLL_EFFECT_CURRENT] = pPanel; + __pGoToDatePopup = new (std::nothrow) GoToDatePopup(); + __pGoToDatePopup->Initialize(); + return E_SUCCESS; } @@ -1155,6 +1159,12 @@ DayPanel::OnTerminating(void) AppLogDebug("Enter"); __pPm->RemoveCalendarEventChangedEventListener(*this); __pPm->RemoveCurrentDateChangedEventListener(*this); + + if (__pGoToDatePopup) + { + __pGoToDatePopup->Destroy(); + } + return E_SUCCESS; } @@ -1168,7 +1178,7 @@ DayPanel::OnUserEventReceivedN(RequestId requestId, IList* pArgs) __pPm->SetTodayToCurrentDate(); break; case IDA_SUB_MENU_GO_TO_DATE: - GoToDatePopup::RequestGoToDate(__pPm->GetCurrentDate(), this); + __pGoToDatePopup->RequestPopup(__pPm->GetCurrentDate(), this); break; case IDA_MAIN_FORM_FOOTER_CREATE: { diff --git a/src/ClGoToDatePopup.cpp b/src/ClGoToDatePopup.cpp index b41c546..4f2c730 100644 --- a/src/ClGoToDatePopup.cpp +++ b/src/ClGoToDatePopup.cpp @@ -33,8 +33,6 @@ using namespace Tizen::Social; using namespace Tizen::Ui; using namespace Tizen::Ui::Controls; -static const int IDA_GO_TO_DATE_POPUP_CANCEL = 10902; - GoToDatePopup::GoToDatePopup(void) : __pEditDate(null) , __pTarget(null) @@ -46,10 +44,25 @@ GoToDatePopup::~GoToDatePopup(void) } result +GoToDatePopup::Initialize(void) +{ + return Construct(L"IDL_GO_TO_DATE_POPUP"); +} + +void +GoToDatePopup::RequestPopup(const DateTime& initialDate, Control* pTarget) +{ + __date = initialDate; + __pTarget = pTarget; + + SetShowState(true); + Show(); +} + +result GoToDatePopup::OnInitializing(void) { __pEditDate = dynamic_cast(GetControl(L"IDC_EDITDATE")); - AppAssertf(__pEditDate != null, "[E_FAILURE] Unable to get button."); __pEditDate->SetYearRange(Calendarbook::GetMinDateTime().GetYear() + 1, Calendarbook::GetMaxDateTime().GetYear() - 1); __pEditDate->SetDate(__date); @@ -60,12 +73,10 @@ GoToDatePopup::OnInitializing(void) SetTitleText(title); Button* pButtonDone = dynamic_cast(GetControl(L"IDC_BUTTON_DONE")); - AppAssertf(pButtonDone != null, "[E_FAILURE] Unable to get button."); pButtonDone->SetActionId(IDA_GO_TO_DATE_POPUP_DONE); pButtonDone->AddActionEventListener(*this); Button* pButtonCancel = dynamic_cast(GetControl(L"IDC_BUTTON_CANCEL")); - AppAssertf(pButtonCancel != null, "[E_FAILURE] Unable to get button."); pButtonCancel->SetActionId(IDA_GO_TO_DATE_POPUP_CANCEL); pButtonCancel->AddActionEventListener(*this); @@ -85,28 +96,16 @@ GoToDatePopup::OnActionPerformed(const Control& source, int actionId) { case IDA_GO_TO_DATE_POPUP_DONE: __date = __pEditDate->GetDate(); - SetShowState(false); - if (__pTarget != null) + if (__pTarget) { LinkedList* pArgs = new (std::nothrow) LinkedList(); pArgs->Add(new (std::nothrow) DateTime(__date)); __pTarget->SendUserEvent(IDA_GO_TO_DATE_POPUP_DONE, pArgs); } - delete this; + SetShowState(false); break; case IDA_GO_TO_DATE_POPUP_CANCEL: SetShowState(false); - delete this; break; } } - -void -GoToDatePopup::RequestGoToDate(const DateTime& initialDate, Control* pTarget) -{ - GoToDatePopup* pPopup = new (std::nothrow) GoToDatePopup(); - pPopup->__date = initialDate; - pPopup->__pTarget = pTarget; - pPopup->Construct(L"IDL_GO_TO_DATE_POPUP"); - pPopup->Show(); -} diff --git a/src/ClListPanel.cpp b/src/ClListPanel.cpp index 4b455c1..c244931 100644 --- a/src/ClListPanel.cpp +++ b/src/ClListPanel.cpp @@ -81,6 +81,7 @@ ListPanel::ListPanel(void) , __pSharePopup(null) , __pThreeButtonPopup(null) , __pTwoButtonPopup(null) + , __pGoToDatePopup(null) { } @@ -132,6 +133,9 @@ ListPanel::OnInitializing(void) __pTwoButtonPopup = new (std::nothrow) TwoButtonPopup(); __pTwoButtonPopup->Initialize(); + __pGoToDatePopup = new (std::nothrow) GoToDatePopup(); + __pGoToDatePopup->Initialize(); + return E_SUCCESS; } @@ -144,9 +148,23 @@ ListPanel::OnTerminating(void) delete __pContextItem; delete __pContextItemNoEdit; delete __pDateFormatter; - delete __pSharePopup; - delete __pThreeButtonPopup; - delete __pTwoButtonPopup; + + if (__pSharePopup) + { + __pSharePopup->Destroy(); + } + if (__pThreeButtonPopup) + { + __pThreeButtonPopup->Destroy(); + } + if (__pTwoButtonPopup) + { + __pTwoButtonPopup->Destroy(); + } + if (__pGoToDatePopup) + { + __pGoToDatePopup->Destroy(); + } return E_SUCCESS; } @@ -184,7 +202,7 @@ ListPanel::OnUserEventReceivedN(RequestId requestId, IList* pArgs) } break; case IDA_SUB_MENU_GO_TO_DATE: - GoToDatePopup::RequestGoToDate(__pPm->GetCurrentDate(), this); + __pGoToDatePopup->RequestPopup(__pPm->GetCurrentDate(), this); break; case IDA_SUB_MENU_DELETE: SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_EVENT_DELETER, diff --git a/src/ClMonthPanel.cpp b/src/ClMonthPanel.cpp index 5ec059f..58d727a 100644 --- a/src/ClMonthPanel.cpp +++ b/src/ClMonthPanel.cpp @@ -645,6 +645,7 @@ MonthPanel::MonthPanel(void) , __pSharePopup(null) , __pThreeButtonPopup(null) , __pTwoButtonPopup(null) + , __pGoToDatePopup(null) { memset((void *)__pPanelMonthCalendar, 0, sizeof(Panel*) * VIEW_SCROLL_EFFECT_COUNT); } @@ -726,6 +727,9 @@ MonthPanel::OnInitializing(void) __pTwoButtonPopup = new (std::nothrow) TwoButtonPopup(); __pTwoButtonPopup->Initialize(); + __pGoToDatePopup = new (std::nothrow) GoToDatePopup(); + __pGoToDatePopup->Initialize(); + return E_SUCCESS; } @@ -747,6 +751,10 @@ MonthPanel::OnTerminating(void) { __pTwoButtonPopup->Destroy(); } + if (__pGoToDatePopup) + { + __pGoToDatePopup->Destroy(); + } delete __pContextItem; delete __pContextItemNoEdit; @@ -763,7 +771,7 @@ MonthPanel::OnUserEventReceivedN(RequestId requestId, IList* pArgs) __pPm->SetTodayToCurrentDate(); break; case IDA_SUB_MENU_GO_TO_DATE: - GoToDatePopup::RequestGoToDate(__pPm->GetCurrentDate(), this); + __pGoToDatePopup->RequestPopup(__pPm->GetCurrentDate(), this); break; case IDA_MAIN_FORM_FOOTER_CREATE: { diff --git a/src/ClYearPanel.cpp b/src/ClYearPanel.cpp index 2074eaa..5030066 100644 --- a/src/ClYearPanel.cpp +++ b/src/ClYearPanel.cpp @@ -322,6 +322,7 @@ YearPanel::YearPanel(void) : __pPm(null) , __pPanningAnimationManager(null) , __pBitmapFocus(null) + , __pGoToDatePopup(null) { memset((void *)__pPanelYearCalendar, 0, sizeof(Panel*) * VIEW_SCROLL_EFFECT_COUNT); memset((void *)__pBitmapWeekText, 0, sizeof(Bitmap*) * YEAR_PANEL_COUNT_OF_WEEK); @@ -371,6 +372,9 @@ YearPanel::OnInitializing(void) pCalendarPanel->SetDateFocusEventListener(*this); __pPanelYearCalendar[VIEW_SCROLL_EFFECT_CURRENT] = pCalendarPanel; + __pGoToDatePopup = new (std::nothrow) GoToDatePopup(); + __pGoToDatePopup->Initialize(); + return E_SUCCESS; } @@ -391,6 +395,11 @@ YearPanel::OnTerminating(void) } delete __pBitmapFocus; + if (__pGoToDatePopup) + { + __pGoToDatePopup->Destroy(); + } + return E_SUCCESS; } @@ -404,7 +413,7 @@ YearPanel::OnUserEventReceivedN(RequestId requestId, IList* pArgs) __pPm->SetTodayToCurrentDate(); break; case IDA_SUB_MENU_GO_TO_DATE: - GoToDatePopup::RequestGoToDate(__pPm->GetCurrentDate(), this); + __pGoToDatePopup->RequestPopup(__pPm->GetCurrentDate(), this); break; case IDA_MAIN_FORM_FOOTER_CREATE: { -- 2.7.4