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 ClGoToDatePopup.cpp
19 * @brief This is the implementation file for the GoToDatePopup class.
25 #include "ClGoToDatePopup.h"
26 #include "ClResourceManager.h"
29 using namespace Tizen;
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
32 using namespace Tizen::Social;
33 using namespace Tizen::Ui;
34 using namespace Tizen::Ui::Controls;
36 GoToDatePopup::GoToDatePopup(void)
42 GoToDatePopup::~GoToDatePopup(void)
47 GoToDatePopup::Initialize(void)
49 return Construct(L"IDL_GO_TO_DATE_POPUP");
53 GoToDatePopup::RequestPopup(const DateTime& initialDate, Control* pTarget)
63 GoToDatePopup::OnInitializing(void)
66 SetPropagatedKeyEventListener(this);
68 __pEditDate = dynamic_cast<EditDate*>(GetControl(L"IDC_EDITDATE"));
69 __pEditDate->SetYearRange(Calendarbook::GetMinDateTime().GetYear() + 1, Calendarbook::GetMaxDateTime().GetYear() - 1);
70 __pEditDate->SetDate(__date);
72 Locales::DateTimeFormatter* pDateFormatter = ResourceManager::CreateDateFormatterN(Locales::DATE_TIME_STYLE_DEFAULT);
74 pDateFormatter->Format(__date, title);
75 delete pDateFormatter;
78 Button* pButtonDone = dynamic_cast<Button*>(GetControl(L"IDC_BUTTON_DONE"));
79 pButtonDone->SetActionId(IDA_GO_TO_DATE_POPUP_DONE);
80 pButtonDone->AddActionEventListener(*this);
82 Button* pButtonCancel = dynamic_cast<Button*>(GetControl(L"IDC_BUTTON_CANCEL"));
83 pButtonCancel->SetActionId(IDA_GO_TO_DATE_POPUP_CANCEL);
84 pButtonCancel->AddActionEventListener(*this);
90 GoToDatePopup::OnTerminating(void)
93 SetPropagatedKeyEventListener(null);
98 GoToDatePopup::OnActionPerformed(const Control& source, int actionId)
102 case IDA_GO_TO_DATE_POPUP_DONE:
103 __date = __pEditDate->GetDate();
106 LinkedList* pArgs = new (std::nothrow) LinkedList();
107 pArgs->Add(new (std::nothrow) DateTime(__date));
108 __pTarget->SendUserEvent(IDA_GO_TO_DATE_POPUP_DONE, pArgs);
112 case IDA_GO_TO_DATE_POPUP_CANCEL:
119 GoToDatePopup::OnKeyReleased(Tizen::Ui::Control &source, const Tizen::Ui::KeyEventInfo &keyEventInfo)
121 AppLogDebug("%d", keyEventInfo.GetKeyCode());
122 if (keyEventInfo.GetKeyCode() == KEY_BACK || keyEventInfo.GetKeyCode() == KEY_ESC)