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 ClEventEditorForm.cpp
19 * @brief This is the implementation file for the EventEditorForm class.
24 #include "ClCalendarApp.h"
25 #include "ClCalendarSelectorPopup.h"
26 #include "ClEventEditorForm.h"
27 #include "ClEventPresentationModel.h"
28 #include "ClResourceManager.h"
31 using namespace Tizen::App;
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Collection;
34 using namespace Tizen::Graphics;
35 using namespace Tizen::Social;
36 using namespace Tizen::System;
37 using namespace Tizen::Ui;
38 using namespace Tizen::Ui::Animations;
39 using namespace Tizen::Ui::Controls;
40 using namespace Tizen::Ui::Scenes;
44 GROUP_TITLE_CONTENT = 0,
46 GROUP_INFORMATION_CONTENT,
47 GROUP_ADDITIONAL_CONTENT,
51 TITLE_CONTENT_ITEM_TITLE = 0,
52 TITLE_CONTENT_ITEM_COUNT,
54 FROM_DATE_SELECTOR_ITEM_START = 0,
55 TO_DATE_SELECTOR_ITEM_END,
56 // DATE_SELECTOR_ITEM_TIME_ZONE = 0,
57 DATE_SELECTOR_ITEM_ALL_DAY_EVENT,
58 DATE_SELECTOR_ITEM_COUNT,
60 INFORMATION_CONTENT_ITEM_DESCRIPTION = 0,
61 INFORMATION_CONTENT_ITEM_LOCATION,
62 INFORMATION_CONTENT_ITEM_COUNT,
64 ADDITIONAL_CONTENT_ITEM_REMINDER = 0,
65 ADDITIONAL_CONTENT_ITEM_REMINDER2,
66 ADDITIONAL_CONTENT_ITEM_REMINDER3,
67 ADDITIONAL_CONTENT_ITEM_REMINDER4,
68 ADDITIONAL_CONTENT_ITEM_REMINDER5,
69 ADDITIONAL_CONTENT_ITEM_REPEAT,
70 ADDITIONAL_CONTENT_ITEM_COUNT,
72 SAVE_TO_ITEM_SAVE_TO = 0,
76 static const int IDA_EVENT_EDITOR_FORM_SAVE = 20001;
77 static const int IDA_EVENT_EDITOR_FORM_CANCEL = 20002;
78 static const int IDA_EVENT_EDITOR_FORM_ADD_REMINDER = 20100;
79 static const int IDA_EVENT_EDITOR_FORM_REMOVE_REMINDER = 20101;
80 static const int IDA_EVENT_EDITOR_FORM_REMOVE_REMINDER2 = 20102;
81 static const int IDA_EVENT_EDITOR_FORM_REMOVE_REMINDER3 = 20103;
82 static const int IDA_EVENT_EDITOR_FORM_REMOVE_REMINDER4 = 20104;
83 static const int IDA_EVENT_EDITOR_FORM_REMOVE_REMINDER5 = 20105;
85 static const int H_ITEM = 112;
86 static const int H_ITEM_2LINE = 136;
87 static const int Y_ITEM_CONTENT01 = 22;
88 static const int H_ITEM_CONTENT01 = 38;
89 static const int Y_ITEM_CONTENT02 = 60;
90 static const int H_ITEM_CONTENT02 = 54;
91 static const int X_DATE_SELECTOR = 340;
92 static const int Y_DATE_SELECTOR = 0;
93 static const int H_DESCRIPTION = 80;
94 static const int W_REMINDER_ADD_BUTTON = 74;
95 static const int W_REMINDER_ADD_BUTTON_MARGIN = 94;
96 static const int H_REMINDER_ADD_BUTTON = 74;
97 static const int W_REMINDER_DELETE_BUTTON = 74;
98 static const int W_REMINDER_DELETE_BUTTON_MARGIN = 184;
99 static const int H_REMINDER_DELETE_BUTTON = 74;
100 static const int FONT_SIZE_DETAIL02 = 32;
101 static const unsigned int COLOR_DETAIL02 = Color32<128, 128, 128>::Value;
102 static const int FONT_SIZE_DETAIL03 = 44;
103 static const unsigned int COLOR_DISABLE = Color32<58, 58, 58, 77>::Value;
105 static const int EXPANDABLE_EDIT_MAX_LINE = 10;
106 static const int EDITFIELD_LIMIT_LENGTH = 500;
108 EventEditorForm::EventEditorForm(void)
110 , __style(EDIT_EVENT_FORM_STYLE_CREATE)
112 , __pEditFieldTitle(null)
113 , __pEditFieldLocation(null)
114 , __pEditDateStartDate(null)
115 , __pEditTimeStartTime(null)
116 , __pEditDateEndDate(null)
117 , __pEditTimeEndTime(null)
118 // , __pLabelTimeZone(null)
119 , __pLabelRepeat(null)
120 , __pTableViewItemNote(null)
121 , __pExpandableEditAreaNote(null)
122 , __pLabelSaveTo(null)
123 , __pButtonAddReminer(null)
124 , __pButtonDeleteReminder(null)
125 , __pCalendarSelectorPopup(null)
127 memset(__pLabelReminder, 0, sizeof(Label*) * MAX_COUNT_OF_REMINDER);
128 memset(__pItemReminder, 0, sizeof(TableViewItem*) * MAX_COUNT_OF_REMINDER);
131 EventEditorForm::~EventEditorForm(void)
136 EventEditorForm::Initialize(void)
138 return Construct(L"IDL_EVENT_EDITOR_FORM");
142 EventEditorForm::OnInitializing(void)
144 __pPm = new (std::nothrow) EventPresentationModel();
147 Footer* pFooter = GetFooter();
148 pFooter->AddActionEventListener(*this);
150 SetFormBackEventListener(this);
152 __pTableView = dynamic_cast<SectionTableView*>(GetControl(L"IDC_SECTIONTABLEVIEW"));
153 TryReturn(__pTableView != null, E_FAILURE, "[E_FAILURE] Unable to get sectiontableview.");
154 __pTableView->SetItemProvider(this);
155 __pTableView->AddSectionTableViewItemEventListener(*this);
156 __pTableView->SetGroupedLookEnabled(true);
158 __pCalendarSelectorPopup = new (std::nothrow) CalendarSelectorPopup();
159 __pCalendarSelectorPopup->Initialize();
165 EventEditorForm::OnTerminating(void)
168 if (__pCalendarSelectorPopup != null)
170 __pCalendarSelectorPopup->Destroy();
176 EventEditorForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
180 case IDA_CALENDAR_SELECTOR_POPUP_DONE:
183 __pPm->SetCalendar(static_cast<Integer*>(pArgs->GetAt(0))->value);
184 __pTableView->RefreshItem(GROUP_SAVE_TO, SAVE_TO_ITEM_SAVE_TO, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
191 pArgs->RemoveAll(true);
197 EventEditorForm::OnFormBackRequested(Form& source)
201 CalendarApp* pApp = static_cast<CalendarApp*>(UiApp::GetInstance());
204 if (pApp->GetOperationType() != OPERATION_TYPE_MAIN)
206 result r = SendAppControlResult(APP_CTRL_RESULT_CANCELED);
207 AppLogDebugIf(r != E_SUCCESS, "[%s] Unable to return result.", GetErrorMessage(r));
214 SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
218 EventEditorForm::OnExpandableEditAreaLineAdded(ExpandableEditArea& source, int newLineCount)
220 __pTableView->RefreshItem(GROUP_INFORMATION_CONTENT, INFORMATION_CONTENT_ITEM_DESCRIPTION, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
224 EventEditorForm::OnExpandableEditAreaLineRemoved(ExpandableEditArea& source, int newLineCount)
226 __pTableView->RefreshItem(GROUP_INFORMATION_CONTENT, INFORMATION_CONTENT_ITEM_DESCRIPTION, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
230 EventEditorForm::GetSectionCount(void)
236 EventEditorForm::GetItemCount(int sectionIndex)
238 switch (sectionIndex)
240 case GROUP_TITLE_CONTENT:
241 return TITLE_CONTENT_ITEM_COUNT;
242 case GROUP_DATE_SELECTOR:
243 return DATE_SELECTOR_ITEM_COUNT;
244 case GROUP_INFORMATION_CONTENT:
245 return INFORMATION_CONTENT_ITEM_COUNT;
246 case GROUP_ADDITIONAL_CONTENT:
247 return ADDITIONAL_CONTENT_ITEM_COUNT;
249 return SAVE_TO_ITEM_COUNT;
256 EventEditorForm::CreateItem(int sectionIndex, int itemIndex, int itemWidth)
258 TableViewItem* pItem = null;
259 switch (sectionIndex)
261 case GROUP_TITLE_CONTENT:
264 case TITLE_CONTENT_ITEM_TITLE:
265 pItem = CreateTitleItemN(itemWidth, __pPm->GetSubject());
269 case GROUP_DATE_SELECTOR:
272 case FROM_DATE_SELECTOR_ITEM_START:
273 pItem = CreateStartTimeItemN(itemWidth, __pPm->GetStartTime(), __pPm->IsAllDayEvent());
275 case TO_DATE_SELECTOR_ITEM_END:
276 pItem = CreateEndTimeItemN(itemWidth, __pPm->GetEndTime(), __pPm->IsAllDayEvent());
278 // case DATE_SELECTOR_ITEM_TIME_ZONE:
279 // pItem = CreateTimeZoneTimeN(itemWidth, __pPm->GetTimezone());
281 case DATE_SELECTOR_ITEM_ALL_DAY_EVENT:
282 pItem = CreateAllDayEventItemN(itemWidth);
286 case GROUP_INFORMATION_CONTENT:
289 case INFORMATION_CONTENT_ITEM_DESCRIPTION:
290 pItem = CreateDescriptionItemN(itemWidth, __pPm->GetDescription());
292 case INFORMATION_CONTENT_ITEM_LOCATION:
293 pItem = CreateLocationItemN(itemWidth, __pPm->GetLocation());
297 case GROUP_ADDITIONAL_CONTENT:
300 case ADDITIONAL_CONTENT_ITEM_REMINDER:
301 pItem = CreateReminderItemN(itemWidth, H_ITEM_2LINE, __pPm->GetReminderString(itemIndex), itemIndex, true, true);
302 if (__pPm->GetCountReminder() <= 0)
304 __pButtonAddReminer->SetShowState(false);
305 __pButtonDeleteReminder->SetShowState(false);
307 else if (__pPm->GetCountReminder() >= 5)
309 __pButtonAddReminer->SetShowState(false);
312 case ADDITIONAL_CONTENT_ITEM_REMINDER2:
314 case ADDITIONAL_CONTENT_ITEM_REMINDER3:
316 case ADDITIONAL_CONTENT_ITEM_REMINDER4:
318 case ADDITIONAL_CONTENT_ITEM_REMINDER5:
319 if (itemIndex < __pPm->GetCountReminder())
321 pItem = CreateReminderItemN(itemWidth, H_ITEM_2LINE, __pPm->GetReminderString(itemIndex), itemIndex);
325 pItem = CreateReminderItemN(itemWidth, 0, __pPm->GetReminderString(itemIndex), itemIndex, false);
328 case ADDITIONAL_CONTENT_ITEM_REPEAT:
329 pItem = CreateRepeatItemN(itemWidth, __pPm->GetRecurrenceString());
334 if (itemIndex == SAVE_TO_ITEM_SAVE_TO)
336 const Bitmap* pIcon = __pPm->GetCalendarIconN();
337 pItem = CreateSaveToItemN(itemWidth, __pPm->GetCalendarName(), pIcon);
347 EventEditorForm::DeleteItem(int sectionIndex, int itemIndex, TableViewItem* pItem)
349 switch (sectionIndex)
351 case GROUP_TITLE_CONTENT:
354 case TITLE_CONTENT_ITEM_TITLE:
355 if (__pEditFieldTitle != null)
357 __pPm->SetSubject(__pEditFieldTitle->GetText());
358 __pEditFieldTitle = null;
363 case GROUP_DATE_SELECTOR:
366 case FROM_DATE_SELECTOR_ITEM_START:
367 if (__pPm->IsAllDayEvent())
369 if (__pEditDateStartDate)
372 start.SetValue(__pEditDateStartDate->GetYear(), __pEditDateStartDate->GetMonth(), __pEditDateStartDate->GetDay());
373 __pPm->SetStartTime(start);
378 if (__pEditDateStartDate && __pEditTimeStartTime)
381 start.SetValue(__pEditDateStartDate->GetYear(), __pEditDateStartDate->GetMonth(), __pEditDateStartDate->GetDay(),
382 __pEditTimeStartTime->GetHour(), __pEditTimeStartTime->GetMinute());
383 __pPm->SetStartTime(start);
386 __pEditDateStartDate = null;
387 __pEditTimeStartTime = null;
389 case TO_DATE_SELECTOR_ITEM_END:
390 if (__pPm->IsAllDayEvent())
392 if (__pEditDateEndDate)
395 end.SetValue(__pEditDateEndDate->GetYear(), __pEditDateEndDate->GetMonth(), __pEditDateEndDate->GetDay());
396 __pPm->SetEndTime(end);
401 if (__pEditDateEndDate && __pEditTimeEndTime)
404 end.SetValue(__pEditDateEndDate->GetYear(), __pEditDateEndDate->GetMonth(), __pEditDateEndDate->GetDay(),
405 __pEditTimeEndTime->GetHour(), __pEditTimeEndTime->GetMinute());
406 __pPm->SetEndTime(end);
409 __pEditDateEndDate = null;
410 __pEditTimeEndTime = null;
412 // case DATE_SELECTOR_ITEM_TIME_ZONE:
413 // __pLabelTimeZone = null;
415 case DATE_SELECTOR_ITEM_ALL_DAY_EVENT:
419 case GROUP_INFORMATION_CONTENT:
422 case INFORMATION_CONTENT_ITEM_LOCATION:
423 if (__pEditFieldLocation != null)
425 __pPm->SetLocation(__pEditFieldLocation->GetText());
426 __pEditFieldLocation = null;
429 case INFORMATION_CONTENT_ITEM_DESCRIPTION:
430 if (__pExpandableEditAreaNote != null)
432 __pPm->SetDescription(__pExpandableEditAreaNote->GetText());
433 __pExpandableEditAreaNote = null;
438 case GROUP_ADDITIONAL_CONTENT:
441 case ADDITIONAL_CONTENT_ITEM_REMINDER:
442 __pButtonAddReminer = null;
443 __pButtonDeleteReminder = null;
445 case ADDITIONAL_CONTENT_ITEM_REMINDER2:
447 case ADDITIONAL_CONTENT_ITEM_REMINDER3:
449 case ADDITIONAL_CONTENT_ITEM_REMINDER4:
451 case ADDITIONAL_CONTENT_ITEM_REMINDER5:
452 __pLabelReminder[itemIndex] = null;
453 __pItemReminder[itemIndex] = null;
455 case ADDITIONAL_CONTENT_ITEM_REPEAT:
456 __pLabelRepeat = null;
461 __pLabelSaveTo = null;
471 EventEditorForm::UpdateItem(int sectionIndex, int itemIndex, TableViewItem* pItem)
473 switch (sectionIndex)
475 case GROUP_DATE_SELECTOR:
476 if (itemIndex == FROM_DATE_SELECTOR_ITEM_START)
478 bool is24HourNotationEnabled = false;
479 SettingInfo::GetValue(KEY_SYSTEM_24_HOUR_NOTATION_ENABLED, is24HourNotationEnabled);
480 __pEditTimeStartTime->Set24HourNotationEnabled(is24HourNotationEnabled);
481 __pEditTimeStartTime->Invalidate(true);
483 else if (itemIndex == TO_DATE_SELECTOR_ITEM_END)
485 bool is24HourNotationEnabled = false;
486 SettingInfo::GetValue(KEY_SYSTEM_24_HOUR_NOTATION_ENABLED, is24HourNotationEnabled);
487 __pEditTimeEndTime->Set24HourNotationEnabled(is24HourNotationEnabled);
488 __pEditTimeEndTime->Invalidate(true);
491 case GROUP_INFORMATION_CONTENT:
492 if (itemIndex == INFORMATION_CONTENT_ITEM_DESCRIPTION)
494 pItem->SetSize(pItem->GetWidthF(), __pExpandableEditAreaNote->GetHeightF());
497 case GROUP_ADDITIONAL_CONTENT:
500 case ADDITIONAL_CONTENT_ITEM_REMINDER:
501 __pLabelReminder[itemIndex]->SetText(__pPm->GetReminderString(itemIndex));
502 __pLabelReminder[itemIndex]->Invalidate(false);
503 if (__pPm->GetCountReminder() <= 0)
505 __pButtonAddReminer->SetShowState(false);
506 __pButtonDeleteReminder->SetShowState(false);
508 else if (__pPm->GetCountReminder() >= 5)
510 __pButtonAddReminer->SetShowState(false);
511 __pButtonDeleteReminder->SetShowState(true);
515 __pButtonAddReminer->SetShowState(true);
516 __pButtonDeleteReminder->SetShowState(true);
519 case ADDITIONAL_CONTENT_ITEM_REMINDER2:
521 case ADDITIONAL_CONTENT_ITEM_REMINDER3:
523 case ADDITIONAL_CONTENT_ITEM_REMINDER4:
525 case ADDITIONAL_CONTENT_ITEM_REMINDER5:
526 __pLabelReminder[itemIndex]->SetText(__pPm->GetReminderString(itemIndex));
527 __pLabelReminder[itemIndex]->Invalidate(false);
528 if (itemIndex < __pPm->GetCountReminder())
530 pItem->SetSize(pItem->GetWidth(), H_ITEM_2LINE);
531 pItem->SetShowState(true);
535 pItem->SetSize(pItem->GetWidth(), 0);
536 pItem->SetShowState(false);
539 // Reminder Max_Count is 5
540 if (__pPm->GetCountReminder() > 4)
542 __pButtonAddReminer->SetShowState(false);
546 __pButtonAddReminer->SetShowState(true);
549 case ADDITIONAL_CONTENT_ITEM_REPEAT:
550 __pLabelRepeat->SetText(__pPm->GetRecurrenceString());
551 pItem->SetEnabled(__pPm->IsEditableRecurrence());
552 pItem->Invalidate(true);
557 if (itemIndex == SAVE_TO_ITEM_SAVE_TO)
559 __pLabelSaveTo->SetText(__pPm->GetCalendarName());
560 pItem->SetEnabled(__pPm->IsEditableRecurrence());
561 pItem->Invalidate(true);
568 EventEditorForm::GetSectionHeader(int sectionIndex)
574 EventEditorForm::HasSectionHeader(int sectionIndex)
576 if (sectionIndex == 0)
584 EventEditorForm::GetSectionFooter(int sectionIndex)
590 EventEditorForm::HasSectionFooter(int sectionIndex)
596 EventEditorForm::GetDefaultItemHeight(void)
602 EventEditorForm::OnSectionTableViewItemStateChanged(SectionTableView& tableView, int sectionIndex, int itemIndex,
603 TableViewItem* pItem, TableViewItemStatus status)
606 LinkedList* pList = null;
607 switch (sectionIndex)
609 case GROUP_DATE_SELECTOR:
610 // if (itemIndex == DATE_SELECTOR_ITEM_TIME_ZONE)
612 // // Call Settings application.
615 if (itemIndex == DATE_SELECTOR_ITEM_ALL_DAY_EVENT)
617 if (status == TABLE_VIEW_ITEM_STATUS_CHECKED)
619 __pPm->SetAllDayEvent(true);
621 if (__pEditTimeStartTime)
623 __pEditTimeStartTime->SetShowState(false);
626 if (__pEditTimeEndTime)
628 __pEditTimeEndTime->SetShowState(false);
631 else if (status == TABLE_VIEW_ITEM_STATUS_UNCHECKED)
633 __pPm->SetAllDayEvent(false);
635 if (__pEditTimeStartTime)
637 __pEditTimeStartTime->SetShowState(true);
640 if (__pEditTimeEndTime)
642 __pEditTimeEndTime->SetShowState(true);
647 case GROUP_ADDITIONAL_CONTENT:
651 case ADDITIONAL_CONTENT_ITEM_REMINDER:
653 case ADDITIONAL_CONTENT_ITEM_REMINDER2:
655 case ADDITIONAL_CONTENT_ITEM_REMINDER3:
657 case ADDITIONAL_CONTENT_ITEM_REMINDER4:
659 case ADDITIONAL_CONTENT_ITEM_REMINDER5:
660 if (__pPm->GetReminder(itemIndex) != null)
663 pList = new (std::nothrow) LinkedList(SingleObjectDeleter);
664 pList->Add(new (std::nothrow) Reminder(*__pPm->GetReminder(itemIndex)));
665 pList->Add(new (std::nothrow) Integer(itemIndex));
667 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_REMINDER,
668 SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
672 if (itemIndex == ADDITIONAL_CONTENT_ITEM_REPEAT)
676 pList = new (std::nothrow) LinkedList(SingleObjectDeleter);
677 pList->Add(new (std::nothrow) DateTime(__pPm->GetStartTime()));
678 if (__pPm->GetRecurrence())
680 pList->Add(new (std::nothrow) Recurrence(*__pPm->GetRecurrence()));
683 SceneManager::GetInstance()->GoForward(ForwardSceneTransition(IDSCN_REPEAT,
684 SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pList);
688 if (itemIndex == SAVE_TO_ITEM_SAVE_TO)
690 __pCalendarSelectorPopup->RequestCalendar(CALENDAR_SELECTOR_POPUP_STYLE_EVENT, this);
697 EventEditorForm::OnSectionTableViewContextItemActivationStateChanged(SectionTableView& tableView, int sectionIndex, int itemIndex,
698 TableViewContextItem* pContextItem, bool activated)
703 EventEditorForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
705 AppLogDebug("Enter.");
706 if (previousSceneId == IDSCN_REMINDER)
711 Integer* pIndex = dynamic_cast<Integer*>(pArgs->GetAt(0));
714 index = pIndex->ToInt();
716 Reminder* pReminder = dynamic_cast<Reminder*>(pArgs->GetAt(1));
719 if (index < __pPm->GetCountReminder())
721 __pPm->SetReminderAt(*pReminder, index);
725 __pPm->AddReminder(*pReminder);
727 __pTableView->RefreshItem(GROUP_ADDITIONAL_CONTENT, index, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
731 int count = __pPm->GetCountReminder();
732 __pPm->RemoveReminderAt(index);
733 while (index < count)
735 __pTableView->RefreshItem(GROUP_ADDITIONAL_CONTENT, index++, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
740 else if (previousSceneId == IDSCN_REPEAT)
742 Recurrence* pRecurrence = null;
745 pRecurrence = dynamic_cast<Recurrence*>(pArgs->GetAt(0));
748 result r = E_FAILURE;
751 r = __pPm->SetRecurrence(null);
753 else if (pRecurrence->GetCounts() > 0)
755 r = __pPm->SetRecurrence(pRecurrence);
757 else if (pRecurrence->GetUntil())
759 DateTime untilDateChecker = __pPm->GetStartTime();
760 switch (pRecurrence->GetFrequency())
763 untilDateChecker.AddDays(pRecurrence->GetInterval());
766 untilDateChecker.AddDays(7 * pRecurrence->GetInterval());
769 untilDateChecker.AddMonths(pRecurrence->GetInterval());
772 untilDateChecker.AddYears(pRecurrence->GetInterval());
776 if (*pRecurrence->GetUntil() >= untilDateChecker)
778 r = __pPm->SetRecurrence(pRecurrence);
784 __pTableView->RefreshItem(GROUP_ADDITIONAL_CONTENT, ADDITIONAL_CONTENT_ITEM_REPEAT, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
785 __pTableView->RefreshItem(GROUP_DATE_SELECTOR, FROM_DATE_SELECTOR_ITEM_START, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
786 __pTableView->RefreshItem(GROUP_DATE_SELECTOR, TO_DATE_SELECTOR_ITEM_END, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
791 msgBox.Construct(L"", ResourceManager::GetString(IDS_CLD_BODY_REPEAT_WARNING), MSGBOX_STYLE_OK);
793 msgBox.ShowAndWait(modalResult);
798 CalendarApp* pApp = static_cast<CalendarApp*>(UiApp::GetInstance());
799 if (pApp->GetOperationType() == OPERATION_TYPE_MAIN)
803 CalEventInstance* pEvent = dynamic_cast<CalEventInstance*>(pArgs->GetAt(0));
804 DateTime* pStartTime = null;
808 bool allEventEditing = true;
809 Boolean* pAllEventEditing = dynamic_cast<Boolean*>(pArgs->GetAt(1));
810 if (pAllEventEditing)
812 allEventEditing = pAllEventEditing->value;
815 result r = __pPm->SetEventInstance(*pEvent, allEventEditing);
818 AppLogDebug("[%s] Unable to get event.", GetErrorMessage(r));
819 SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
820 AppLogDebug("Enter.");
823 if(pEvent->IsAllDayEvent() == true)
826 SystemTime::GetCurrentTime(TIME_MODE_WALL, startTime);
827 startTime.SetValue(__pPm->GetStartTime().GetYear(),__pPm->GetStartTime().GetMonth(),__pPm->GetStartTime().GetDay(),
828 startTime.GetHour(),startTime.GetMinute(), startTime.GetSecond());
829 startTime.AddHours(1);
830 startTime.AddMinutes(-startTime.GetMinute());
831 startTime.AddSeconds(-startTime.GetSecond());
833 end.SetValue(__pPm->GetEndTime().GetYear(),__pPm->GetEndTime().GetMonth(),__pPm->GetEndTime().GetDay(),
834 startTime.GetHour(),startTime.GetMinute(),startTime.GetSecond());
836 __pPm->SetStartTime(startTime);
837 __pPm->SetEndTime(end);
840 SetStyle(EDIT_EVENT_FORM_STYLE_EDIT);
843 pStartTime = dynamic_cast<DateTime*>(pArgs->GetAt(0));
846 pStartTime->AddHours(1);
847 pStartTime->AddMinutes(-pStartTime->GetMinute());
848 pStartTime->AddSeconds(-pStartTime->GetSecond());
849 DateTime end = *pStartTime;
851 __pPm->SetStartTime(*pStartTime);
852 __pPm->SetEndTime(end);
854 SetStyle(EDIT_EVENT_FORM_STYLE_CREATE);
856 /*if (__pEditFieldTitle)
858 __pEditFieldTitle->SetFocus();
866 CalendarApp* pApp = static_cast<CalendarApp*>(UiApp::GetInstance());
867 if (pApp->GetOperationType() == OPERATION_TYPE_EDIT)
869 const String* pItemType = pApp->GetArgument(KEY_SOCIAL_ITEM_TYPE);
870 const String* pEventId = pApp->GetArgument(KEY_SOCIAL_ITEM_ID);
871 if (pItemType != null && pItemType->Equals(VALUE_CALENDAR_EVENT_TYPE, false) == true && pEventId != null)
873 RecordId eventId = INVALID_RECORD_ID;
874 Integer::Parse(*pEventId, eventId);
875 result r = __pPm->SetEventId(eventId);
878 SetStyle(EDIT_EVENT_FORM_STYLE_EDIT);
882 r = SendAppControlResult(APP_CTRL_RESULT_FAILED);
883 AppLogDebugIf(r != E_SUCCESS, "[%s] Unable to return result.", GetErrorMessage(r));
892 __pTableView->SetItemChecked(GROUP_DATE_SELECTOR, DATE_SELECTOR_ITEM_ALL_DAY_EVENT, __pPm->IsAllDayEvent());
893 __pPm->AddCalendarEventChangedEventListener(*this);
897 pArgs->RemoveAll(true);
901 AppLogDebug("Exit.");
905 EventEditorForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
907 AppLogDebug("Enter.");
908 AppLogDebug("Exit.");
912 EventEditorForm::OnActionPerformed(const Control& source, int actionId)
914 AppLogDebug("Enter.");
916 result r = E_SUCCESS;
919 case IDA_EVENT_EDITOR_FORM_SAVE:
924 CalendarApp* pApp = static_cast<CalendarApp*>(UiApp::GetInstance());
925 if (pApp && pApp->GetOperationType() != OPERATION_TYPE_MAIN)
927 result r = SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED);
928 AppLogDebugIf(r != E_SUCCESS, "[%s] Unable to return result.", GetErrorMessage(r));
934 CalEventInstance* pEventInstance = __pPm->GetEventInstance();
937 LinkedList* pList = new (std::nothrow) LinkedList(SingleObjectDeleter);
938 pList->Add(new (std::nothrow) CalEventInstance(*pEventInstance));
939 SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), pList);
943 if (SceneManager::GetInstance()->IsSceneAlive(IDSCN_EVENT_DETAILS))
945 SceneId backSceneId = IDSCN_MONTH;
946 IListT<SceneId>* pHistory = SceneManager::GetInstance()->GetSceneHistoryN();
950 if (pHistory->IndexOf(SceneId(IDSCN_EVENT_DETAILS), index) == E_SUCCESS)
952 pHistory->GetAt(index - 1, backSceneId);
957 SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(backSceneId, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
958 SceneManager::GetInstance()->DestroyScene(IDSCN_EVENT_DETAILS);
962 SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
973 msgString = ResourceManager::GetString(IDS_CLD_POP_INVALID_TIME);
975 case E_INVALID_CONDITION:
976 msgString = ResourceManager::GetString(IDS_CLD_BODY_REPEAT_WARNING);
979 msgString = ResourceManager::GetString(IDS_COM_POP_SAVING_FAILED);
984 msgBox.Construct(L"", msgString, MSGBOX_STYLE_OK,300000);
986 msgBox.ShowAndWait(modalResult);
990 case IDA_EVENT_EDITOR_FORM_CANCEL:
991 SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT));
993 case IDA_EVENT_EDITOR_FORM_ADD_REMINDER:
996 __pPm->AddReminder(reminder);
998 __pTableView->RefreshItem(GROUP_ADDITIONAL_CONTENT, __pPm->GetCountReminder() - 1, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1001 case IDA_EVENT_EDITOR_FORM_REMOVE_REMINDER:
1003 case IDA_EVENT_EDITOR_FORM_REMOVE_REMINDER2:
1005 case IDA_EVENT_EDITOR_FORM_REMOVE_REMINDER3:
1007 case IDA_EVENT_EDITOR_FORM_REMOVE_REMINDER4:
1009 case IDA_EVENT_EDITOR_FORM_REMOVE_REMINDER5:
1011 int index = actionId - IDA_EVENT_EDITOR_FORM_REMOVE_REMINDER;
1012 int count = __pPm->GetCountReminder();
1013 __pPm->RemoveReminderAt(index);
1015 while (index < count)
1017 __pTableView->RefreshItem(GROUP_ADDITIONAL_CONTENT, index++, TABLE_VIEW_REFRESH_TYPE_ITEM_MODIFY);
1026 EventEditorForm::OnCalendarEventChanged(void)
1028 if(__style == EDIT_EVENT_FORM_STYLE_EDIT && __pPm->IsEventValid() == false)
1030 Tizen::Base::Collection::IListT<SceneId> *ptr = SceneManager::GetInstance()->GetSceneHistoryN();
1032 ptr->GetAt(0,original);
1033 SceneManager::GetInstance()->GoBackward(BackwardSceneTransition(original));
1038 EventEditorForm::CreateTitleItemN(int itemWidth, const String& title)
1043 TableViewItem* pItem = new (std::nothrow) TableViewItem();
1045 EditField* pTitle = null;
1046 pItem->Construct(layout, Dimension(itemWidth, H_ITEM));
1048 pTitle = new (std::nothrow) EditField();
1049 pTitle->Construct(Rectangle(0, 0, itemWidth, H_ITEM), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY,
1050 false, EDITFIELD_LIMIT_LENGTH);
1051 pTitle->SetColor(EDIT_STATUS_NORMAL, Color(0, 0, 0, 0));
1052 pItem->AddControl(pTitle);
1053 pItem->SetIndividualSelectionEnabled(pTitle, true);
1055 if (title.GetLength() > EDITFIELD_LIMIT_LENGTH)
1058 title.SubString(0, EDITFIELD_LIMIT_LENGTH, subString);
1059 pTitle->SetText(subString);
1063 pTitle->SetText(title);
1065 pTitle->SetGuideText(ResourceManager::GetString(IDS_CLD_BODY_TITLE));
1066 pTitle->AddActionEventListener(*this);
1068 __pEditFieldTitle = pTitle;
1074 EventEditorForm::CreateStartTimeItemN(int itemWidth, const DateTime& start, bool isAllDayEvent)
1076 TableViewItem* pItem = new (std::nothrow) TableViewItem();
1077 pItem->Construct(Dimension(itemWidth, H_ITEM));
1079 EditDate* pStartDate = new (std::nothrow) EditDate();
1080 pStartDate->Construct(Point(0, Y_DATE_SELECTOR), ResourceManager::GetString(IDS_EVENT_EDITOR_FROM));
1081 pItem->AddControl(pStartDate);
1083 pStartDate->SetYearRange(Calendarbook::GetMinDateTime().GetYear() + 1, Calendarbook::GetMaxDateTime().GetYear() - 1);
1084 pStartDate->SetDate(start);
1085 pItem->SetIndividualSelectionEnabled(pStartDate, true);
1087 __pEditDateStartDate = pStartDate;
1089 EditTime* pStartTime = new (std::nothrow) EditTime();
1090 pStartTime->Construct(Point(X_DATE_SELECTOR, Y_DATE_SELECTOR), L" ");
1092 pItem->AddControl(pStartTime);
1094 pStartTime->SetTime(start);
1095 pItem->SetIndividualSelectionEnabled(pStartTime, true);
1097 __pEditTimeStartTime = pStartTime;
1101 __pEditTimeStartTime->SetShowState(false);
1108 EventEditorForm::CreateEndTimeItemN(int itemWidth, const DateTime& end, bool isAllDayEvent)
1110 TableViewItem* pItem = new (std::nothrow) TableViewItem();
1112 EditDate* pEndDate = null;
1113 EditTime* pEndTime = null;
1115 pItem->Construct(Dimension(itemWidth, H_ITEM));
1117 pEndDate = new (std::nothrow) EditDate();
1118 pEndDate->Construct(Point(0, Y_DATE_SELECTOR), ResourceManager::GetString(IDS_EVENT_EDITOR_TO));
1120 pItem->AddControl(pEndDate);
1122 pEndDate->SetYearRange(Calendarbook::GetMinDateTime().GetYear() + 1, Calendarbook::GetMaxDateTime().GetYear() - 1);
1123 pEndDate->SetDate(end);
1124 pItem->SetIndividualSelectionEnabled(pEndDate, true);
1126 __pEditDateEndDate = pEndDate;
1128 pEndTime = new (std::nothrow) EditTime();
1129 pEndTime->Construct(Point(X_DATE_SELECTOR, Y_DATE_SELECTOR), L" ");
1131 pItem->AddControl(pEndTime);
1133 pEndTime->SetTime(end);
1134 pItem->SetIndividualSelectionEnabled(pEndTime, true);
1136 __pEditTimeEndTime = pEndTime;
1138 if (isAllDayEvent == true)
1140 __pEditTimeEndTime->SetShowState(false);
1147 //EventEditorForm::CreateTimeZoneTimeN(int itemWidth, const String& timeZone)
1149 // TableViewItem* pItem = new (std::nothrow) TableViewItem();
1151 // Label* pLabel = null;
1152 // Label* pContentLabel = null;
1154 // pItem->Construct(Dimension(itemWidth, H_ITEM_2LINE));
1155 // pItem->SetBackgroundColor(Color(COLOR_ITEM_BACKGROUND), TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
1157 // pLabel = new (std::nothrow) Label();
1158 // pLabel->Construct(Rectangle(0, Y_ITEM_CONTENT01, itemWidth, H_ITEM_CONTENT01),
1159 // ResourceManager::GetString(IDS_EVENT_EDITOR_TIME_ZONE));
1161 // pItem->AddControl(pLabel);
1163 // pLabel->SetTextColor(Color(COLOR_DETAIL02));
1164 // pLabel->SetTextConfig(FONT_SIZE_DETAIL02, LABEL_TEXT_STYLE_NORMAL);
1165 // pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1167 // pContentLabel = new (std::nothrow) Label();
1168 // pContentLabel->Construct(Rectangle(0, Y_ITEM_CONTENT02, itemWidth, H_ITEM_CONTENT02), timeZone);
1170 // pItem->AddControl(pContentLabel);
1172 // pContentLabel->SetTextColor(Color(COLOR_ADDITIONAL_CONTENT));
1173 // pContentLabel->SetTextConfig(FONT_SIZE_DETAIL03, LABEL_TEXT_STYLE_NORMAL);
1174 // pContentLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1176 // __pLabelTimeZone = pContentLabel;
1182 EventEditorForm::CreateAllDayEventItemN(int itemWidth)
1184 TableViewItem* pItem = new (std::nothrow) TableViewItem();
1186 Label* pLabel = null;
1188 pItem->Construct(Dimension(itemWidth, H_ITEM), TABLE_VIEW_ANNEX_STYLE_ONOFF_SLIDING);
1190 pLabel = new (std::nothrow) Label();
1191 pLabel->Construct(Rectangle(0, 0, itemWidth, H_ITEM), ResourceManager::GetString(IDS_CLD_BODY_ALL_DAY_EVENT));
1192 pLabel->SetTextConfig(FONT_SIZE_DETAIL03, LABEL_TEXT_STYLE_NORMAL);
1193 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1195 pItem->AddControl(pLabel);
1201 EventEditorForm::CreateDescriptionItemN(int itemWidth, const String& description)
1206 TableViewItem* pItem = new (std::nothrow) TableViewItem();
1207 pItem->Construct(layout, Dimension(itemWidth, H_ITEM));
1209 __pExpandableEditAreaNote = new (std::nothrow) ExpandableEditArea();
1210 __pExpandableEditAreaNote->Construct(Rectangle(0, 0, itemWidth, H_DESCRIPTION),
1211 EXPANDABLE_EDIT_AREA_STYLE_NORMAL, EXPANDABLE_EDIT_AREA_TITLE_STYLE_NONE, EXPANDABLE_EDIT_MAX_LINE);
1212 __pExpandableEditAreaNote->SetColor(EDIT_STATUS_NORMAL, Color(0, 0, 0, 0));
1213 __pExpandableEditAreaNote->AddExpandableEditAreaEventListener(*this);
1214 __pExpandableEditAreaNote->SetText(description);
1215 __pExpandableEditAreaNote->SetGuideText(ResourceManager::GetString(IDS_CLD_BODY_CREATE_DESCRIPTION));
1216 pItem->AddControl(__pExpandableEditAreaNote);
1217 pItem->SetIndividualSelectionEnabled(__pExpandableEditAreaNote, true);
1223 EventEditorForm::CreateLocationItemN(int itemWidth, const String& location)
1228 TableViewItem* pItem = new (std::nothrow) TableViewItem();
1229 pItem->Construct(layout, Dimension(itemWidth, H_ITEM));
1231 EditField* pLocation = new (std::nothrow) EditField();
1232 pLocation->Construct(Rectangle(0, 0, itemWidth, H_ITEM), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY,
1233 false, EDITFIELD_LIMIT_LENGTH);
1234 pLocation->SetColor(EDIT_STATUS_NORMAL, Color(0, 0, 0, 0));
1235 pItem->AddControl(pLocation);
1236 pItem->SetIndividualSelectionEnabled(pLocation, true);
1238 if (location.GetLength() > EDITFIELD_LIMIT_LENGTH)
1241 location.SubString(0, EDITFIELD_LIMIT_LENGTH, subString);
1242 pLocation->SetText(subString);
1246 pLocation->SetText(location);
1248 pLocation->SetGuideText(ResourceManager::GetString(IDS_CLD_BODY_LOCATION));
1249 pLocation->AddActionEventListener(*this);
1251 __pEditFieldLocation = pLocation;
1257 EventEditorForm::CreateReminderItemN(int itemWidth, int itemHeight, const String& reminder, int index, bool showItem, bool hasAddButton)
1259 TableViewItem* pItem = new (std::nothrow) TableViewItem();
1260 pItem->Construct(Dimension(itemWidth, itemHeight));
1261 Label* pLabel = new (std::nothrow) Label();
1262 pLabel->Construct(Rectangle(0, Y_ITEM_CONTENT01, itemWidth - W_REMINDER_DELETE_BUTTON_MARGIN, H_ITEM_CONTENT01),
1263 ResourceManager::GetString(IDS_CLD_BODY_REMINDER));
1265 pItem->AddControl(pLabel);
1267 pLabel->SetTextColor(Color(COLOR_DETAIL02));
1268 pLabel->SetTextConfig(FONT_SIZE_DETAIL02, LABEL_TEXT_STYLE_NORMAL);
1269 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1271 Label* pContentLabel = new (std::nothrow) Label();
1272 pContentLabel->Construct(Rectangle(0, Y_ITEM_CONTENT02, itemWidth - W_REMINDER_DELETE_BUTTON_MARGIN, H_ITEM_CONTENT02), reminder);
1274 pItem->AddControl(pContentLabel);
1276 pContentLabel->SetTextConfig(FONT_SIZE_DETAIL03, LABEL_TEXT_STYLE_NORMAL);
1277 pContentLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1279 // Add delete button
1280 Button* pButtonDeleteReminder = new (std::nothrow) Button();
1281 pButtonDeleteReminder->Construct(Rectangle(itemWidth - W_REMINDER_DELETE_BUTTON_MARGIN,
1282 (H_ITEM_2LINE - H_REMINDER_DELETE_BUTTON) / 2, W_REMINDER_DELETE_BUTTON, H_REMINDER_DELETE_BUTTON), L"");
1284 pItem->AddControl(pButtonDeleteReminder);
1285 pItem->SetIndividualSelectionEnabled(pButtonDeleteReminder, true);
1286 pButtonDeleteReminder->SetActionId(IDA_EVENT_EDITOR_FORM_REMOVE_REMINDER + index);
1287 pButtonDeleteReminder->AddActionEventListener(*this);
1288 if (index == ADDITIONAL_CONTENT_ITEM_REMINDER)
1290 __pButtonDeleteReminder = pButtonDeleteReminder;
1293 Bitmap* pBitmapBgDelete = ResourceManager::GetBitmapN(IDB_CIRCLE_BUTTON_DELETE);
1294 if (pBitmapBgDelete != null)
1296 pButtonDeleteReminder->SetNormalBackgroundBitmap(*pBitmapBgDelete);
1297 delete pBitmapBgDelete;
1299 Bitmap* pBitmapBgDeletePressed = ResourceManager::GetBitmapN(IDB_CIRCLE_BUTTON_DELETE_PRESS);
1300 if (pBitmapBgDeletePressed != null)
1302 pButtonDeleteReminder->SetPressedBackgroundBitmap(*pBitmapBgDeletePressed);
1303 delete pBitmapBgDeletePressed;
1305 Bitmap* pBitmapMinus = ResourceManager::GetBitmapN(IDB_BUTTON_MINUS);
1306 if (pBitmapMinus != null)
1308 pButtonDeleteReminder->SetNormalBitmap(Point(0, 0), *pBitmapMinus);
1309 delete pBitmapMinus;
1311 Bitmap* pBitmapMinusPressed = ResourceManager::GetBitmapN(IDB_BUTTON_MINUS_PRESS);
1312 if (pBitmapMinusPressed != null)
1314 pButtonDeleteReminder->SetPressedBitmap(Point(0, 0), *pBitmapMinusPressed);
1315 delete pBitmapMinusPressed;
1319 if (hasAddButton == true)
1321 Button* pButtonAddReminder = new (std::nothrow) Button();
1322 pButtonAddReminder->Construct(Rectangle(itemWidth - W_REMINDER_ADD_BUTTON_MARGIN,
1323 (H_ITEM_2LINE - H_REMINDER_ADD_BUTTON) / 2, W_REMINDER_ADD_BUTTON, H_REMINDER_ADD_BUTTON), L"");
1325 pItem->AddControl(pButtonAddReminder);
1326 pItem->SetIndividualSelectionEnabled(pButtonAddReminder, true);
1327 pButtonAddReminder->SetActionId(IDA_EVENT_EDITOR_FORM_ADD_REMINDER);
1328 pButtonAddReminder->AddActionEventListener(*this);
1329 __pButtonAddReminer = pButtonAddReminder;
1331 Bitmap* pBitmapBgButton = ResourceManager::GetBitmapN(IDB_CIRCLE_BUTTON);
1332 if (pBitmapBgButton != null)
1334 pButtonAddReminder->SetNormalBackgroundBitmap(*pBitmapBgButton);
1335 delete pBitmapBgButton;
1337 Bitmap* pBitmapBgButtonPressed = ResourceManager::GetBitmapN(IDB_CIRCLE_BUTTON_PRESS);
1338 if (pBitmapBgButtonPressed != null)
1340 pButtonAddReminder->SetPressedBackgroundBitmap(*pBitmapBgButtonPressed);
1341 delete pBitmapBgButtonPressed;
1343 Bitmap* pBitmapPlus = ResourceManager::GetBitmapN(IDB_BUTTON_PLUS);
1344 if (pBitmapPlus != null)
1346 pButtonAddReminder->SetNormalBitmap(Point(0, 0), *pBitmapPlus);
1349 Bitmap* pBitmapPlusPressed = ResourceManager::GetBitmapN(IDB_BUTTON_PLUS_PRESS);
1350 if (pBitmapPlusPressed != null)
1352 pButtonAddReminder->SetPressedBitmap(Point(0, 0), *pBitmapPlusPressed);
1353 delete pBitmapPlusPressed;
1357 pItem->SetShowState(showItem);
1358 __pLabelReminder[index] = pContentLabel;
1359 __pItemReminder[index] = pItem;
1365 EventEditorForm::CreateRepeatItemN(int itemWidth, const String& repeat)
1367 TableViewItem* pItem = new (std::nothrow) TableViewItem();
1369 Label* pLabel = null;
1370 Label* pContentLabel = null;
1372 pItem->Construct(Dimension(itemWidth, H_ITEM_2LINE));
1374 pLabel = new (std::nothrow) Label();
1375 pLabel->Construct(Rectangle(0, Y_ITEM_CONTENT01, itemWidth, H_ITEM_CONTENT01),
1376 ResourceManager::GetString(IDS_CLD_BODY_REPEAT));
1378 pItem->AddControl(pLabel);
1380 pLabel->SetTextColor(Color(COLOR_DETAIL02));
1381 pLabel->SetTextConfig(FONT_SIZE_DETAIL02, LABEL_TEXT_STYLE_NORMAL);
1382 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1384 pContentLabel = new (std::nothrow) Label();
1385 pContentLabel->Construct(Rectangle(0, Y_ITEM_CONTENT02, itemWidth, H_ITEM_CONTENT02), repeat);
1387 pItem->AddControl(pContentLabel);
1389 pContentLabel->SetTextConfig(FONT_SIZE_DETAIL03, LABEL_TEXT_STYLE_NORMAL);
1390 pContentLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1392 __pLabelRepeat = pContentLabel;
1394 if (!__pPm->IsEditableRecurrence())
1396 pItem->SetEnabled(false);
1397 pLabel->SetTextColor(Color(COLOR_DISABLE));
1398 pContentLabel->SetTextColor(Color(COLOR_DISABLE));
1405 EventEditorForm::CreateSaveToItemN(int itemWidth, const String& calendarName, const Bitmap* pCalendarIcon)
1407 TableViewItem* pItem = new (std::nothrow) TableViewItem();
1409 Label* pLabel = null;
1410 Label* pContentLabel = null;
1412 pItem->Construct(Dimension(itemWidth, H_ITEM_2LINE));
1414 pLabel = new (std::nothrow) Label();
1415 pLabel->Construct(Rectangle(0, Y_ITEM_CONTENT01, itemWidth, H_ITEM_CONTENT01),
1416 ResourceManager::GetString(IDS_ST_BODY_SAVE_TO));
1418 pItem->AddControl(pLabel);
1420 pLabel->SetTextColor(Color(COLOR_DETAIL02));
1421 pLabel->SetTextConfig(FONT_SIZE_DETAIL02, LABEL_TEXT_STYLE_NORMAL);
1422 pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1424 pContentLabel = new (std::nothrow) Label();
1425 pContentLabel->Construct(Rectangle(0, Y_ITEM_CONTENT02, itemWidth, H_ITEM_CONTENT02), calendarName);
1427 pItem->AddControl(pContentLabel);
1429 pContentLabel->SetTextConfig(FONT_SIZE_DETAIL03, LABEL_TEXT_STYLE_NORMAL);
1430 pContentLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
1432 __pLabelSaveTo = pContentLabel;
1434 if (!__pPm->IsEditableRecurrence())
1436 pItem->SetEnabled(false);
1437 pLabel->SetTextColor(Color(COLOR_DISABLE));
1438 pContentLabel->SetTextColor(Color(COLOR_DISABLE));
1445 EventEditorForm::SetStyle(EditEventFormStyle style)
1447 Header* pHeader = GetHeader();
1448 if (style == EDIT_EVENT_FORM_STYLE_CREATE)
1450 pHeader->SetTitleText(ResourceManager::GetString(IDS_CLD_HEADER_CREATE_EVENT));
1454 pHeader->SetTitleText(ResourceManager::GetString(IDS_CLD_HEADER_EDIT_EVENT));
1456 pHeader->Invalidate(false);
1458 if (__pTableView != null)
1460 __pEditFieldTitle = null;
1461 __pEditFieldLocation = null;
1462 __pEditDateStartDate = null;
1463 __pEditTimeStartTime = null;
1464 __pEditDateEndDate = null;
1465 __pEditTimeEndTime = null;
1466 __pExpandableEditAreaNote = null;
1467 __pTableView->UpdateTableView();
1472 if (__pPm->GetSubject().GetLength() > EDITFIELD_LIMIT_LENGTH
1473 || __pPm->GetLocation().GetLength() > EDITFIELD_LIMIT_LENGTH)
1476 msgBox.Construct(L"", ResourceManager::GetString(IDS_IMGE_POP_TEXT_TOO_LONG),
1477 MSGBOX_STYLE_NONE, MESSAGE_BOX_TIME_OUT);
1480 msgBox.ShowAndWait(modalResult);
1487 EventEditorForm::SendAppControlResult(AppCtrlResult appControlResult)
1489 CalendarApp* pApp = static_cast<CalendarApp*>(UiApp::GetInstance());
1490 TryReturn(pApp != null, E_FAILURE, "[E_FAILURE] Unable to get app instance.");
1492 result r = AppControlProviderManager::GetInstance()->SendAppControlResult(pApp->GetRequestId(), appControlResult, null);
1493 AppLogDebugIf(r != E_SUCCESS, "[%s] Unable to return result.", GetErrorMessage(r));
1499 EventEditorForm::UpdatePm(void)
1501 if (__pEditFieldTitle)
1503 __pPm->SetSubject(__pEditFieldTitle->GetText());
1508 if (__pEditDateStartDate && __pEditTimeStartTime)
1510 startTime.SetValue(__pEditDateStartDate->GetYear(), __pEditDateStartDate->GetMonth(), __pEditDateStartDate->GetDay(),
1511 __pEditTimeStartTime->GetHour(), __pEditTimeStartTime->GetMinute());
1513 if (__pEditDateEndDate && __pEditTimeEndTime)
1515 endTime.SetValue(__pEditDateEndDate->GetYear(), __pEditDateEndDate->GetMonth(), __pEditDateEndDate->GetDay(),
1516 __pEditTimeEndTime->GetHour(), __pEditTimeEndTime->GetMinute());
1519 __pPm->SetStartTime(startTime);
1520 __pPm->SetEndTime(endTime);
1522 if (__pExpandableEditAreaNote)
1524 __pPm->SetDescription(__pExpandableEditAreaNote->GetText());
1527 if (__pEditFieldLocation)
1529 __pPm->SetLocation(__pEditFieldLocation->GetText());