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)
65 __pEditDate = dynamic_cast<EditDate*>(GetControl(L"IDC_EDITDATE"));
66 __pEditDate->SetYearRange(Calendarbook::GetMinDateTime().GetYear() + 1, Calendarbook::GetMaxDateTime().GetYear() - 1);
67 __pEditDate->SetDate(__date);
69 Locales::DateTimeFormatter* pDateFormatter = ResourceManager::CreateDateFormatterN(Locales::DATE_TIME_STYLE_DEFAULT);
71 pDateFormatter->Format(__date, title);
72 delete pDateFormatter;
75 Button* pButtonDone = dynamic_cast<Button*>(GetControl(L"IDC_BUTTON_DONE"));
76 pButtonDone->SetActionId(IDA_GO_TO_DATE_POPUP_DONE);
77 pButtonDone->AddActionEventListener(*this);
79 Button* pButtonCancel = dynamic_cast<Button*>(GetControl(L"IDC_BUTTON_CANCEL"));
80 pButtonCancel->SetActionId(IDA_GO_TO_DATE_POPUP_CANCEL);
81 pButtonCancel->AddActionEventListener(*this);
87 GoToDatePopup::OnTerminating(void)
93 GoToDatePopup::OnActionPerformed(const Control& source, int actionId)
97 case IDA_GO_TO_DATE_POPUP_DONE:
98 __date = __pEditDate->GetDate();
101 LinkedList* pArgs = new (std::nothrow) LinkedList();
102 pArgs->Add(new (std::nothrow) DateTime(__date));
103 __pTarget->SendUserEvent(IDA_GO_TO_DATE_POPUP_DONE, pArgs);
107 case IDA_GO_TO_DATE_POPUP_CANCEL: