2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (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://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file FScl_CalTodoImpl.cpp
18 * @brief This is the implementation for _CalTodoImpl class.
20 * This file contains definitions of @e CalTodoImpl class.
23 #include <FBaseDateTime.h>
24 #include <FBaseColArrayList.h>
25 #include <FSysSystemTime.h>
26 #include <FSclTypes.h>
27 #include <FSclRecord.h>
28 #include <FSclCalTodo.h>
29 #include <FSclReminder.h>
30 #include <FSclRecurrence.h>
31 #include <FBaseSysLog.h>
32 #include <FApp_AppInfo.h>
33 #include <FBase_StringConverter.h>
34 #include "FScl_CalTodoImpl.h"
35 #include "FScl_RecordImpl.h"
36 #include "FScl_CalendarbookImpl.h"
37 #include "FScl_CalendarbookDbConnector.h"
39 using namespace Tizen::Base;
40 using namespace Tizen::Base::Collection;
41 using namespace Tizen::App;
43 namespace Tizen { namespace Social
45 static const double _MIN_LATITUDE = -90.0;
46 static const double _MAX_LATITUDE = 90.0;
47 static const double _MIN_LONGITUDE = -180.0;
48 static const double _MAX_LONGITUDE = 180.0;
50 static const long long _CALENDAR_TODO_NO_START_DATE = -0x7fffffffffffffffLL;
51 static const long long _CALENDAR_TODO_NO_DUE_DATE = 0x7fffffffffffffffLL;
53 _CalTodoImpl::_CalTodoImpl(void)
54 : __reminderListUpdated(false)
56 int errorCode = CALENDAR_ERROR_NONE;
57 calendar_record_h todoHandle = null;
59 result r = _CalendarbookDbConnector::Connect();
60 SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
62 errorCode = calendar_record_create(_calendar_todo._uri, &todoHandle);
63 SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
65 if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
69 // Set start date to current date
70 Tizen::System::SystemTime::GetCurrentTime(tmpDateTime);
71 if (IsFailed(GetLastResult()))
73 tmpDateTime = _CalendarbookImpl::GetMinDateTime();
76 r = tmpDateTime.SetValue(tmpDateTime.GetYear(), tmpDateTime.GetMonth(), tmpDateTime.GetDay(), 0, 0, 0);
78 calendar_time_s convertedCalendarTime;
80 convertedCalendarTime.type = CALENDAR_TIME_UTIME;
81 convertedCalendarTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(tmpDateTime);
83 errorCode = calendar_record_set_caltime(todoHandle, _calendar_todo.start_time, convertedCalendarTime);
84 errorCode = calendar_record_set_caltime(todoHandle, _calendar_todo.due_time, convertedCalendarTime);
88 calendar_time_s convertedStartTime;
89 convertedStartTime.type = CALENDAR_TIME_UTIME;
90 convertedStartTime.time.utime = _CALENDAR_TODO_NO_START_DATE;
92 calendar_time_s convertedDueTime;
93 convertedDueTime.type = CALENDAR_TIME_UTIME;
94 convertedDueTime.time.utime = _CALENDAR_TODO_NO_DUE_DATE;
96 errorCode = calendar_record_set_caltime(todoHandle, _calendar_todo.start_time, convertedStartTime);
97 errorCode = calendar_record_set_caltime(todoHandle, _calendar_todo.due_time, convertedDueTime);
101 errorCode = calendar_record_set_int(todoHandle, _calendar_todo.todo_status, CALENDAR_TODO_STATUS_NONE);
102 errorCode = calendar_record_set_int(todoHandle, _calendar_todo.priority, CALENDAR_TODO_PRIORITY_NORMAL);
103 errorCode = calendar_record_set_int(todoHandle, _calendar_todo.sensitivity, CALENDAR_SENSITIVITY_PUBLIC);
105 __todoRecord.ResetHandle(todoHandle);
107 r = __reminderList.Construct();
108 SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
111 _CalTodoImpl::_CalTodoImpl(const _CalTodoImpl& rhs)
112 : __reminderListUpdated(false)
114 int errorCode = CALENDAR_ERROR_NONE;
115 calendar_record_h todoHandle = null;
117 result r = _CalendarbookDbConnector::Connect();
118 SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
120 errorCode = calendar_record_clone(rhs.__todoRecord.GetHandle(), &todoHandle);
121 SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
123 __todoRecord.ResetHandle(todoHandle);
125 r = __reminderList.Construct();
126 SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
129 _CalTodoImpl::~_CalTodoImpl(void)
131 __reminderList.RemoveAll(true);
133 result r = _CalendarbookDbConnector::Disconnect();
134 SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
138 _CalTodoImpl::operator =(const _CalTodoImpl& rhs)
145 __reminderList.RemoveAll(true);
146 __reminderListUpdated = false;
148 int errorCode = CALENDAR_ERROR_NONE;
149 calendar_record_h todoHandle = null;
151 errorCode = calendar_record_clone(rhs.__todoRecord.GetHandle(), &todoHandle);
152 SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, *this, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
154 __todoRecord.ResetHandle(todoHandle);
160 _CalTodoImpl::GetSubject(void) const
162 int errorCode = CALENDAR_ERROR_NONE;
163 char* pSubject = null;
165 errorCode = calendar_record_get_str_p(__todoRecord.GetHandle(), _calendar_todo.summary, &pSubject);
167 return String(pSubject);
171 _CalTodoImpl::GetDescription(void) const
173 int errorCode = CALENDAR_ERROR_NONE;
174 char* pDescription = null;
176 errorCode = calendar_record_get_str_p(__todoRecord.GetHandle(), _calendar_todo.description, &pDescription);
178 return String(pDescription);
182 _CalTodoImpl::GetStartDate(void) const
186 int errorCode = CALENDAR_ERROR_NONE;
187 calendar_time_s tmpCalendarTime;
189 errorCode = calendar_record_get_caltime(__todoRecord.GetHandle(), _calendar_todo.start_time, &tmpCalendarTime);
191 if (tmpCalendarTime.time.utime == _CALENDAR_TODO_NO_START_DATE)
193 SetLastResult(E_DATA_NOT_FOUND);
194 return DateTime::GetMinValue();
197 DateTime tmpDateTime = _CalendarbookUtil::ConvertEpochTimeToDateTime(tmpCalendarTime.time.utime);
203 _CalTodoImpl::GetDueDate(void) const
207 int errorCode = CALENDAR_ERROR_NONE;
208 calendar_time_s tmpCalendarTime;
210 errorCode = calendar_record_get_caltime(__todoRecord.GetHandle(), _calendar_todo.due_time, &tmpCalendarTime);
212 if (tmpCalendarTime.time.utime == _CALENDAR_TODO_NO_DUE_DATE)
214 SetLastResult(E_DATA_NOT_FOUND);
215 return DateTime::GetMinValue();
218 DateTime tmpDateTime = _CalendarbookUtil::ConvertEpochTimeToDateTime(tmpCalendarTime.time.utime);
224 _CalTodoImpl::GetPriority(void) const
226 int errorCode = CALENDAR_ERROR_NONE;
227 int srcPriority = CALENDAR_EVENT_PRIORITY_LOW;
229 TodoPriority priority = TODO_PRIORITY_NORMAL;
231 errorCode = calendar_record_get_int(__todoRecord.GetHandle(), _calendar_todo.priority, &srcPriority);
235 case CALENDAR_TODO_PRIORITY_LOW:
236 priority = TODO_PRIORITY_LOW;
238 case CALENDAR_TODO_PRIORITY_NONE:
240 case CALENDAR_TODO_PRIORITY_NORMAL:
241 priority = TODO_PRIORITY_NORMAL;
243 case CALENDAR_TODO_PRIORITY_HIGH:
244 priority = TODO_PRIORITY_HIGH;
247 SysLog(NID_SCL, "The priority value is invalid. priority = %d", srcPriority);
248 priority = TODO_PRIORITY_NORMAL;
256 _CalTodoImpl::GetStatus(void) const
258 int errorCode = CALENDAR_ERROR_NONE;
259 int srcStatus = CALENDAR_EVENT_STATUS_NONE;
261 TodoStatus status = TODO_STATUS_NONE;
263 errorCode = calendar_record_get_int(__todoRecord.GetHandle(), _calendar_todo.todo_status, &srcStatus);
267 case CALENDAR_TODO_STATUS_NONE:
268 status = TODO_STATUS_NONE;
270 case CALENDAR_TODO_STATUS_NEEDS_ACTION:
271 status = TODO_STATUS_NEEDS_ACTION;
273 case CALENDAR_TODO_STATUS_COMPLETED:
274 status = TODO_STATUS_COMPLETED;
276 case CALENDAR_TODO_STATUS_IN_PROCESS:
277 status = TODO_STATUS_IN_PROCESS;
279 case CALENDAR_TODO_STATUS_CANCELED:
280 status = TODO_STATUS_CANCELLED;
283 SysLog(NID_SCL, "The status value is invalid. status = %d", srcStatus);
284 status = TODO_STATUS_NONE;
292 _CalTodoImpl::GetSensitivity(void) const
294 int errorCode = CALENDAR_ERROR_NONE;
295 int srcSensitivity = CALENDAR_SENSITIVITY_PUBLIC;
296 RecordSensitivity sensitivity = SENSITIVITY_PUBLIC;
298 errorCode = calendar_record_get_int(__todoRecord.GetHandle(), _calendar_todo.sensitivity, &srcSensitivity);
300 switch (srcSensitivity)
302 case CALENDAR_SENSITIVITY_PUBLIC:
303 sensitivity = SENSITIVITY_PUBLIC;
305 case CALENDAR_SENSITIVITY_PRIVATE:
306 sensitivity = SENSITIVITY_PRIVATE;
308 case CALENDAR_SENSITIVITY_CONFIDENTIAL:
309 sensitivity = SENSITIVITY_CONFIDENTIAL;
312 SysLog(NID_SCL, "The sensitivity value is invalid. sensitivity = %d", srcSensitivity);
313 sensitivity = SENSITIVITY_PUBLIC;
321 _CalTodoImpl::GetLastRevisedTime(void) const
323 int errorCode = CALENDAR_ERROR_NONE;
324 long long lastModifiedTime = 0;
325 DateTime tmpLastRevisedTime;
327 errorCode = calendar_record_get_lli(__todoRecord.GetHandle(), _calendar_todo.last_modified_time, &lastModifiedTime);
329 tmpLastRevisedTime = _CalendarbookUtil::ConvertEpochTimeToDateTime(lastModifiedTime);
331 return tmpLastRevisedTime;
335 _CalTodoImpl::SetSubject(const String& subject)
337 if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
339 SysTryReturnResult(NID_SCL, subject.GetLength() <= MAX_TODO_SUBJECT_LENGTH,
340 E_INVALID_ARG, "Invalid argument is used. The length of the subject exceeds MAX_TODO_SUBJECT_LENGTH.");
343 std::unique_ptr<char[]> pConvertedSubject(_StringConverter::CopyToCharArrayN(subject));
344 SysTryReturnResult(NID_SCL, pConvertedSubject != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
346 int errorCode = CALENDAR_ERROR_NONE;
347 errorCode = calendar_record_set_str(__todoRecord.GetHandle(), _calendar_todo.summary, pConvertedSubject.get());
353 _CalTodoImpl::SetDescription(const String& description)
355 if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
357 SysTryReturnResult(NID_SCL, description.GetLength() <= MAX_TODO_DESCRIPTION_LENGTH,
358 E_INVALID_ARG, "Invalid argument is used. The length of the description exceeds MAX_TODO_SUBJECT_LENGTH.");
361 std::unique_ptr<char[]> pConvertedDescription(_StringConverter::CopyToCharArrayN(description));
362 SysTryReturnResult(NID_SCL, pConvertedDescription != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
364 int errorCode = CALENDAR_ERROR_NONE;
365 errorCode = calendar_record_set_str(__todoRecord.GetHandle(), _calendar_todo.description, pConvertedDescription.get());
371 _CalTodoImpl::SetStartAndDueDate(const DateTime& startDate, const DateTime& dueDate)
373 SysTryReturnResult(NID_SCL, _CalendarbookUtil::CheckValidDateTime(startDate), E_INVALID_ARG, "Invalid argument is used. The start date is invalid.");
374 SysTryReturnResult(NID_SCL, _CalendarbookUtil::CheckValidDateTime(dueDate), E_INVALID_ARG, "Invalid argument is used. The end date is invalid.");
375 SysTryReturnResult(NID_SCL, startDate <= dueDate, E_INVALID_ARG, "Invalid argument is used. The end date is earlier than the start date.");
377 int errorCode = CALENDAR_ERROR_NONE;
378 calendar_time_s convertedStartTime;
379 calendar_time_s convertedDueTime;
381 convertedStartTime.type = CALENDAR_TIME_UTIME;
382 convertedStartTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(startDate);
383 convertedDueTime.type = CALENDAR_TIME_UTIME;
384 convertedDueTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(dueDate);
386 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.start_time, convertedStartTime);
387 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.due_time, convertedDueTime);
393 _CalTodoImpl::SetStartDate(const DateTime& startDate)
395 int errorCode = CALENDAR_ERROR_NONE;
396 calendar_time_s convertedStartTime;
397 convertedStartTime.type = CALENDAR_TIME_UTIME;
399 if (startDate == DateTime::GetMinValue())
401 convertedStartTime.time.utime = _CALENDAR_TODO_NO_START_DATE;
403 else if (startDate < _CalendarbookImpl::GetMinDateTime() || startDate > _CalendarbookImpl::GetMaxDateTime())
405 SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The startDate is invalid.");
406 return E_INVALID_ARG;
410 calendar_time_s convertedDueTime;
411 errorCode = calendar_record_get_caltime(__todoRecord.GetHandle(), _calendar_todo.due_time, &convertedDueTime);
413 convertedStartTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(startDate);
415 if (convertedStartTime.time.utime > convertedDueTime.time.utime)
417 convertedDueTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(DateTime::GetMinValue());
418 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.due_time, convertedDueTime);
422 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.start_time, convertedStartTime);
429 _CalTodoImpl::SetDueDate(const DateTime& dueDate)
431 int errorCode = CALENDAR_ERROR_NONE;
432 calendar_time_s convertedDueTime;
433 convertedDueTime.type = CALENDAR_TIME_UTIME;
435 if (dueDate == DateTime::GetMinValue())
437 convertedDueTime.time.utime = _CALENDAR_TODO_NO_DUE_DATE;
439 else if (dueDate < _CalendarbookImpl::GetMinDateTime() || dueDate > _CalendarbookImpl::GetMaxDateTime())
441 SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The dueDate is invalid.");
442 return E_INVALID_ARG;
446 calendar_time_s convertedStartTime;
447 errorCode = calendar_record_get_caltime(__todoRecord.GetHandle(), _calendar_todo.start_time, &convertedStartTime);
449 convertedDueTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(dueDate);
451 if (convertedStartTime.time.utime > convertedDueTime.time.utime)
453 convertedStartTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(DateTime::GetMinValue());
454 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.start_time, convertedStartTime);
458 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.due_time, convertedDueTime);
464 _CalTodoImpl::SetPriority(TodoPriority priority)
466 int errorCode = CALENDAR_ERROR_NONE;
467 errorCode = calendar_record_set_int(__todoRecord.GetHandle(), _calendar_todo.priority, _CalendarbookUtil::ConvertTodoPriorityToCSTodoPriority(priority));
471 _CalTodoImpl::SetStatus(TodoStatus status)
473 int errorCode = CALENDAR_ERROR_NONE;
474 errorCode = calendar_record_set_int(__todoRecord.GetHandle(), _calendar_todo.todo_status, _CalendarbookUtil::ConvertTodoStatusToCSTodoStatus(status));
478 _CalTodoImpl::SetSensitivity(RecordSensitivity sensitivity)
480 int errorCode = CALENDAR_ERROR_NONE;
481 errorCode = calendar_record_set_int(__todoRecord.GetHandle(), _calendar_todo.sensitivity, _CalendarbookUtil::ConvertSensitivityToCSSensitivity(sensitivity));
485 _CalTodoImpl::SetLocation(const String& location)
487 std::unique_ptr<char[]> pConvertedLocation(_StringConverter::CopyToCharArrayN(location));
488 SysTryReturnVoidResult(NID_SCL, pConvertedLocation != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
490 int errorCode = CALENDAR_ERROR_NONE;
491 errorCode = calendar_record_set_str(__todoRecord.GetHandle(), _calendar_todo.location, pConvertedLocation.get());
495 _CalTodoImpl::GetLocation(void) const
497 int errorCode = CALENDAR_ERROR_NONE;
498 char* pLocation = null;
500 errorCode = calendar_record_get_str_p(__todoRecord.GetHandle(), _calendar_todo.location, &pLocation);
502 return String(pLocation);
506 _CalTodoImpl::SetCoordinates(double latitude, double longitude)
508 SysTryReturnResult(NID_SCL, latitude >= _MIN_LATITUDE && latitude <= _MAX_LATITUDE, E_INVALID_ARG, "Invalid argument is used. The latitude is out of range.");
509 SysTryReturnResult(NID_SCL, longitude >= _MIN_LONGITUDE && longitude <= _MAX_LONGITUDE, E_INVALID_ARG, "Invalid argument is used. The longitude is out of range.");
511 int errorCode = CALENDAR_ERROR_NONE;
513 errorCode = calendar_record_set_double(__todoRecord.GetHandle(), _calendar_todo.latitude, latitude);
514 errorCode = calendar_record_set_double(__todoRecord.GetHandle(), _calendar_todo.longitude, longitude);
520 _CalTodoImpl::GetCoordinates(double& latitude, double& longitude) const
522 int errorCode = CALENDAR_ERROR_NONE;
524 errorCode = calendar_record_get_double(__todoRecord.GetHandle(), _calendar_todo.latitude, &latitude);
525 errorCode = calendar_record_get_double(__todoRecord.GetHandle(), _calendar_todo.longitude, &longitude);
529 _CalTodoImpl::AddReminder(const Reminder& reminder)
531 int errorCode = CALENDAR_ERROR_NONE;
532 calendar_record_h tmpAlarmHandle = null;
534 std::unique_ptr<char[]> pTmpAlarmTone(_StringConverter::CopyToCharArrayN(reminder.GetSoundFile()));
535 SysTryReturnResult(NID_SCL, pTmpAlarmTone != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
537 errorCode = calendar_record_create(_calendar_alarm._uri, &tmpAlarmHandle);
538 SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
540 int convertedTimeUnit = 0;
542 ReminderTimeUnit timeUnit = reminder.GetTimeUnit();
545 case REMINDER_TIME_UNIT_MINUTE:
546 convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_MINUTE;
548 case REMINDER_TIME_UNIT_HOUR:
549 convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_HOUR;
551 case REMINDER_TIME_UNIT_DAY:
552 convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_DAY;
554 case REMINDER_TIME_UNIT_WEEK:
555 convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_WEEK;
557 case REMINDER_TIME_UNIT_NONE:
558 convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_SPECIFIC;
564 errorCode = calendar_record_set_int(tmpAlarmHandle, _calendar_alarm.tick_unit, convertedTimeUnit);
565 errorCode = calendar_record_set_int(tmpAlarmHandle, _calendar_alarm.tick, reminder.GetTimeOffset());
566 errorCode = calendar_record_set_str(tmpAlarmHandle, _calendar_alarm.tone, pTmpAlarmTone.get());
568 if (convertedTimeUnit == CALENDAR_ALARM_TIME_UNIT_SPECIFIC)
570 errorCode = calendar_record_set_lli(tmpAlarmHandle, _calendar_alarm.time, _CalendarbookUtil::ConvertDateTimeToEpochTime(reminder.GetAbsoluteTime()));
573 errorCode = calendar_record_add_child_record(__todoRecord.GetHandle(), _calendar_todo.calendar_alarm, tmpAlarmHandle);
575 __reminderList.RemoveAll(true);
576 __reminderListUpdated = false;
582 _CalTodoImpl::RemoveReminderAt(int index)
584 int errorCode = CALENDAR_ERROR_NONE;
585 calendar_record_h tmpAlarmHandle = null;
587 errorCode = calendar_record_get_child_record_at_p(__todoRecord.GetHandle(), _calendar_todo.calendar_alarm, index, &tmpAlarmHandle);
588 SysTryReturnResult(NID_SCL, tmpAlarmHandle != null, E_OUT_OF_RANGE, "The index is either equal to or greater than the number of reminders or less than 0.");
590 errorCode = calendar_record_remove_child_record(__todoRecord.GetHandle(), _calendar_todo.calendar_alarm, tmpAlarmHandle);
592 __reminderList.RemoveAll(true);
593 __reminderListUpdated = false;
599 _CalTodoImpl::GetAllReminders(void) const
603 if (__reminderListUpdated == false)
605 result r = _CalendarbookUtil::ConvertTodoAlarmsToReminderList(__todoRecord.GetHandle(), __reminderList);
606 SysTryReturn(NID_SCL, r == E_SUCCESS, __reminderList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
608 __reminderListUpdated = true;
611 return __reminderList;
615 _CalTodoImpl::GetCalendarId(void) const
617 int errorCode = CALENDAR_ERROR_NONE;
618 int srcCalendarbookId = 0;
620 errorCode = calendar_record_get_int(__todoRecord.GetHandle(), _calendar_todo.calendar_book_id, &srcCalendarbookId);
622 return srcCalendarbookId;
626 _CalTodoImpl::SetRecordHandle(calendar_record_h todoHandle)
628 __todoRecord.ResetHandle(todoHandle);
632 _CalTodoImpl::GetRecordHandle(void) const
634 return __todoRecord.GetHandle();
638 _CalTodoImpl::CreateDefaultInstanceN(void)
640 return new (std::nothrow) CalTodo();
644 _CalTodoImpl::GetInstance(CalTodo& todo)
646 return todo.__pCalTodoImpl;
650 _CalTodoImpl::GetInstance(const CalTodo& todo)
652 return todo.__pCalTodoImpl;