2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FScl_CalTodoImpl.cpp
19 * @brief This is the implementation for _CalTodoImpl class.
21 * This file contains definitions of @e CalTodoImpl class.
24 #include <FBaseDateTime.h>
25 #include <FBaseColArrayList.h>
26 #include <FSysSystemTime.h>
27 #include <FSclTypes.h>
28 #include <FSclRecord.h>
29 #include <FSclCalTodo.h>
30 #include <FSclReminder.h>
31 #include <FSclRecurrence.h>
32 #include <FBaseSysLog.h>
33 #include <FApp_AppInfo.h>
34 #include <FBase_StringConverter.h>
35 #include "FScl_CalTodoImpl.h"
36 #include "FScl_RecordImpl.h"
37 #include "FScl_CalendarbookImpl.h"
38 #include "FScl_CalendarbookDbConnector.h"
40 using namespace Tizen::Base;
41 using namespace Tizen::Base::Collection;
42 using namespace Tizen::App;
44 namespace Tizen { namespace Social
46 static const double _MIN_LATITUDE = -90.0;
47 static const double _MAX_LATITUDE = 90.0;
48 static const double _MIN_LONGITUDE = -180.0;
49 static const double _MAX_LONGITUDE = 180.0;
51 static const long long _CALENDAR_TODO_NO_START_DATE = -0x7fffffffffffffffLL;
52 static const long long _CALENDAR_TODO_NO_DUE_DATE = 0x7fffffffffffffffLL;
54 _CalTodoImpl::_CalTodoImpl(void)
55 : __reminderListUpdated(false)
57 int errorCode = CALENDAR_ERROR_NONE;
58 calendar_record_h todoHandle = null;
60 result r = _CalendarbookDbConnector::Connect();
61 SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
63 errorCode = calendar_record_create(_calendar_todo._uri, &todoHandle);
64 SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
66 if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
70 // Set start date to current date
71 Tizen::System::SystemTime::GetCurrentTime(tmpDateTime);
72 if (IsFailed(GetLastResult()))
74 tmpDateTime = _CalendarbookImpl::GetMinDateTime();
77 r = tmpDateTime.SetValue(tmpDateTime.GetYear(), tmpDateTime.GetMonth(), tmpDateTime.GetDay(), 0, 0, 0);
79 calendar_time_s convertedCalendarTime;
81 convertedCalendarTime.type = CALENDAR_TIME_UTIME;
82 convertedCalendarTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(tmpDateTime);
84 errorCode = calendar_record_set_caltime(todoHandle, _calendar_todo.start_time, convertedCalendarTime);
85 errorCode = calendar_record_set_caltime(todoHandle, _calendar_todo.due_time, convertedCalendarTime);
89 calendar_time_s convertedStartTime;
90 convertedStartTime.type = CALENDAR_TIME_UTIME;
91 convertedStartTime.time.utime = _CALENDAR_TODO_NO_START_DATE;
93 calendar_time_s convertedDueTime;
94 convertedDueTime.type = CALENDAR_TIME_UTIME;
95 convertedDueTime.time.utime = _CALENDAR_TODO_NO_DUE_DATE;
97 errorCode = calendar_record_set_caltime(todoHandle, _calendar_todo.start_time, convertedStartTime);
98 errorCode = calendar_record_set_caltime(todoHandle, _calendar_todo.due_time, convertedDueTime);
102 errorCode = calendar_record_set_int(todoHandle, _calendar_todo.todo_status, CALENDAR_TODO_STATUS_NONE);
103 errorCode = calendar_record_set_int(todoHandle, _calendar_todo.priority, CALENDAR_TODO_PRIORITY_NORMAL);
104 errorCode = calendar_record_set_int(todoHandle, _calendar_todo.sensitivity, CALENDAR_SENSITIVITY_PUBLIC);
106 __todoRecord.ResetHandle(todoHandle);
108 r = __reminderList.Construct();
109 SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
112 _CalTodoImpl::_CalTodoImpl(const _CalTodoImpl& rhs)
113 : __reminderListUpdated(false)
115 int errorCode = CALENDAR_ERROR_NONE;
116 calendar_record_h todoHandle = null;
118 result r = _CalendarbookDbConnector::Connect();
119 SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
121 errorCode = calendar_record_clone(rhs.__todoRecord.GetHandle(), &todoHandle);
122 SysTryReturnVoidResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
124 __todoRecord.ResetHandle(todoHandle);
126 r = __reminderList.Construct();
127 SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
130 _CalTodoImpl::~_CalTodoImpl(void)
132 __reminderList.RemoveAll(true);
134 result r = _CalendarbookDbConnector::Disconnect();
135 SysTryReturnVoidResult(NID_SCL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.");
139 _CalTodoImpl::operator =(const _CalTodoImpl& rhs)
146 __reminderList.RemoveAll(true);
147 __reminderListUpdated = false;
149 int errorCode = CALENDAR_ERROR_NONE;
150 calendar_record_h todoHandle = null;
152 errorCode = calendar_record_clone(rhs.__todoRecord.GetHandle(), &todoHandle);
153 SysTryReturn(NID_SCL, errorCode == CALENDAR_ERROR_NONE, *this, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
155 __todoRecord.ResetHandle(todoHandle);
161 _CalTodoImpl::GetSubject(void) const
163 int errorCode = CALENDAR_ERROR_NONE;
164 char* pSubject = null;
166 errorCode = calendar_record_get_str_p(__todoRecord.GetHandle(), _calendar_todo.summary, &pSubject);
168 return String(pSubject);
172 _CalTodoImpl::GetDescription(void) const
174 int errorCode = CALENDAR_ERROR_NONE;
175 char* pDescription = null;
177 errorCode = calendar_record_get_str_p(__todoRecord.GetHandle(), _calendar_todo.description, &pDescription);
179 return String(pDescription);
183 _CalTodoImpl::GetStartDate(void) const
187 int errorCode = CALENDAR_ERROR_NONE;
188 calendar_time_s tmpCalendarTime;
190 errorCode = calendar_record_get_caltime(__todoRecord.GetHandle(), _calendar_todo.start_time, &tmpCalendarTime);
192 if (tmpCalendarTime.time.utime == _CALENDAR_TODO_NO_START_DATE)
194 SetLastResult(E_DATA_NOT_FOUND);
195 return DateTime::GetMinValue();
198 DateTime tmpDateTime = _CalendarbookUtil::ConvertEpochTimeToDateTime(tmpCalendarTime.time.utime);
204 _CalTodoImpl::GetDueDate(void) const
208 int errorCode = CALENDAR_ERROR_NONE;
209 calendar_time_s tmpCalendarTime;
211 errorCode = calendar_record_get_caltime(__todoRecord.GetHandle(), _calendar_todo.due_time, &tmpCalendarTime);
213 if (tmpCalendarTime.time.utime == _CALENDAR_TODO_NO_DUE_DATE)
215 SetLastResult(E_DATA_NOT_FOUND);
216 return DateTime::GetMinValue();
219 DateTime tmpDateTime = _CalendarbookUtil::ConvertEpochTimeToDateTime(tmpCalendarTime.time.utime);
225 _CalTodoImpl::GetPriority(void) const
227 int errorCode = CALENDAR_ERROR_NONE;
228 int srcPriority = CALENDAR_EVENT_PRIORITY_LOW;
230 TodoPriority priority = TODO_PRIORITY_NORMAL;
232 errorCode = calendar_record_get_int(__todoRecord.GetHandle(), _calendar_todo.priority, &srcPriority);
236 case CALENDAR_TODO_PRIORITY_LOW:
237 priority = TODO_PRIORITY_LOW;
239 case CALENDAR_TODO_PRIORITY_NORMAL:
240 priority = TODO_PRIORITY_NORMAL;
242 case CALENDAR_TODO_PRIORITY_HIGH:
243 priority = TODO_PRIORITY_HIGH;
246 SysLog(NID_SCL, "The priority value is invalid. priority = %d", srcPriority);
247 priority = TODO_PRIORITY_NORMAL;
255 _CalTodoImpl::GetStatus(void) const
257 int errorCode = CALENDAR_ERROR_NONE;
258 int srcStatus = CALENDAR_EVENT_STATUS_NONE;
260 TodoStatus status = TODO_STATUS_NONE;
262 errorCode = calendar_record_get_int(__todoRecord.GetHandle(), _calendar_todo.todo_status, &srcStatus);
266 case CALENDAR_TODO_STATUS_NONE:
267 status = TODO_STATUS_NONE;
269 case CALENDAR_TODO_STATUS_NEEDS_ACTION:
270 status = TODO_STATUS_NEEDS_ACTION;
272 case CALENDAR_TODO_STATUS_COMPLETED:
273 status = TODO_STATUS_COMPLETED;
275 case CALENDAR_TODO_STATUS_IN_PROCESS:
276 status = TODO_STATUS_IN_PROCESS;
278 case CALENDAR_TODO_STATUS_CANCELED:
279 status = TODO_STATUS_CANCELLED;
282 SysLog(NID_SCL, "The status value is invalid. status = %d", srcStatus);
283 status = TODO_STATUS_NONE;
291 _CalTodoImpl::GetSensitivity(void) const
293 int errorCode = CALENDAR_ERROR_NONE;
294 int srcSensitivity = CALENDAR_SENSITIVITY_PUBLIC;
295 RecordSensitivity sensitivity = SENSITIVITY_PUBLIC;
297 errorCode = calendar_record_get_int(__todoRecord.GetHandle(), _calendar_todo.sensitivity, &srcSensitivity);
299 switch (srcSensitivity)
301 case CALENDAR_SENSITIVITY_PUBLIC:
302 sensitivity = SENSITIVITY_PUBLIC;
304 case CALENDAR_SENSITIVITY_PRIVATE:
305 sensitivity = SENSITIVITY_PRIVATE;
307 case CALENDAR_SENSITIVITY_CONFIDENTIAL:
308 sensitivity = SENSITIVITY_CONFIDENTIAL;
311 SysLog(NID_SCL, "The sensitivity value is invalid. sensitivity = %d", srcSensitivity);
312 sensitivity = SENSITIVITY_PUBLIC;
320 _CalTodoImpl::GetLastRevisedTime(void) const
322 int errorCode = CALENDAR_ERROR_NONE;
323 long long lastModifiedTime = 0;
324 DateTime tmpLastRevisedTime;
326 errorCode = calendar_record_get_lli(__todoRecord.GetHandle(), _calendar_todo.last_modified_time, &lastModifiedTime);
328 tmpLastRevisedTime = _CalendarbookUtil::ConvertEpochTimeToDateTime(lastModifiedTime);
330 return tmpLastRevisedTime;
334 _CalTodoImpl::SetSubject(const String& subject)
336 if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
338 SysTryReturnResult(NID_SCL, subject.GetLength() <= MAX_TODO_SUBJECT_LENGTH,
339 E_INVALID_ARG, "Invalid argument is used. The length of the subject exceeds MAX_TODO_SUBJECT_LENGTH.");
342 std::unique_ptr<char[]> pConvertedSubject(_StringConverter::CopyToCharArrayN(subject));
343 SysTryReturnResult(NID_SCL, pConvertedSubject != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
345 int errorCode = CALENDAR_ERROR_NONE;
346 errorCode = calendar_record_set_str(__todoRecord.GetHandle(), _calendar_todo.summary, pConvertedSubject.get());
352 _CalTodoImpl::SetDescription(const String& description)
354 if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
356 SysTryReturnResult(NID_SCL, description.GetLength() <= MAX_TODO_DESCRIPTION_LENGTH,
357 E_INVALID_ARG, "Invalid argument is used. The length of the description exceeds MAX_TODO_SUBJECT_LENGTH.");
360 std::unique_ptr<char[]> pConvertedDescription(_StringConverter::CopyToCharArrayN(description));
361 SysTryReturnResult(NID_SCL, pConvertedDescription != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
363 int errorCode = CALENDAR_ERROR_NONE;
364 errorCode = calendar_record_set_str(__todoRecord.GetHandle(), _calendar_todo.description, pConvertedDescription.get());
370 _CalTodoImpl::SetStartAndDueDate(const DateTime& startDate, const DateTime& dueDate)
372 SysTryReturnResult(NID_SCL, _CalendarbookUtil::CheckValidDateTime(startDate), E_INVALID_ARG, "Invalid argument is used. The start date is invalid.");
373 SysTryReturnResult(NID_SCL, _CalendarbookUtil::CheckValidDateTime(dueDate), E_INVALID_ARG, "Invalid argument is used. The end date is invalid.");
374 SysTryReturnResult(NID_SCL, startDate <= dueDate, E_INVALID_ARG, "Invalid argument is used. The end date is earlier than the start date.");
376 int errorCode = CALENDAR_ERROR_NONE;
377 calendar_time_s convertedStartTime;
378 calendar_time_s convertedDueTime;
380 convertedStartTime.type = CALENDAR_TIME_UTIME;
381 convertedStartTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(startDate);
382 convertedDueTime.type = CALENDAR_TIME_UTIME;
383 convertedDueTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(dueDate);
385 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.start_time, convertedStartTime);
386 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.due_time, convertedDueTime);
392 _CalTodoImpl::SetStartDate(const DateTime& startDate)
394 int errorCode = CALENDAR_ERROR_NONE;
395 calendar_time_s convertedStartTime;
396 convertedStartTime.type = CALENDAR_TIME_UTIME;
398 if (startDate == DateTime::GetMinValue())
400 convertedStartTime.time.utime = _CALENDAR_TODO_NO_START_DATE;
402 else if (startDate < _CalendarbookImpl::GetMinDateTime() || startDate > _CalendarbookImpl::GetMaxDateTime())
404 SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The startDate is invalid.");
405 return E_INVALID_ARG;
409 calendar_time_s convertedDueTime;
410 errorCode = calendar_record_get_caltime(__todoRecord.GetHandle(), _calendar_todo.due_time, &convertedDueTime);
412 convertedStartTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(startDate);
414 if (convertedStartTime.time.utime > convertedDueTime.time.utime)
416 convertedDueTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(DateTime::GetMinValue());
417 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.due_time, convertedDueTime);
421 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.start_time, convertedStartTime);
428 _CalTodoImpl::SetDueDate(const DateTime& dueDate)
430 int errorCode = CALENDAR_ERROR_NONE;
431 calendar_time_s convertedDueTime;
432 convertedDueTime.type = CALENDAR_TIME_UTIME;
434 if (dueDate == DateTime::GetMinValue())
436 convertedDueTime.time.utime = _CALENDAR_TODO_NO_DUE_DATE;
438 else if (dueDate < _CalendarbookImpl::GetMinDateTime() || dueDate > _CalendarbookImpl::GetMaxDateTime())
440 SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The dueDate is invalid.");
441 return E_INVALID_ARG;
445 calendar_time_s convertedStartTime;
446 errorCode = calendar_record_get_caltime(__todoRecord.GetHandle(), _calendar_todo.start_time, &convertedStartTime);
448 convertedDueTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(dueDate);
450 if (convertedStartTime.time.utime > convertedDueTime.time.utime)
452 convertedStartTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(DateTime::GetMinValue());
453 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.start_time, convertedStartTime);
457 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.due_time, convertedDueTime);
463 _CalTodoImpl::SetPriority(TodoPriority priority)
465 int errorCode = CALENDAR_ERROR_NONE;
466 errorCode = calendar_record_set_int(__todoRecord.GetHandle(), _calendar_todo.priority, _CalendarbookUtil::ConvertTodoPriorityToCSTodoPriority(priority));
470 _CalTodoImpl::SetStatus(TodoStatus status)
472 int errorCode = CALENDAR_ERROR_NONE;
473 errorCode = calendar_record_set_int(__todoRecord.GetHandle(), _calendar_todo.todo_status, _CalendarbookUtil::ConvertTodoStatusToCSTodoStatus(status));
477 _CalTodoImpl::SetSensitivity(RecordSensitivity sensitivity)
479 int errorCode = CALENDAR_ERROR_NONE;
480 errorCode = calendar_record_set_int(__todoRecord.GetHandle(), _calendar_todo.sensitivity, _CalendarbookUtil::ConvertSensitivityToCSSensitivity(sensitivity));
484 _CalTodoImpl::SetLocation(const String& location)
486 std::unique_ptr<char[]> pConvertedLocation(_StringConverter::CopyToCharArrayN(location));
487 SysTryReturnVoidResult(NID_SCL, pConvertedLocation != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
489 int errorCode = CALENDAR_ERROR_NONE;
490 errorCode = calendar_record_set_str(__todoRecord.GetHandle(), _calendar_todo.location, pConvertedLocation.get());
494 _CalTodoImpl::GetLocation(void) const
496 int errorCode = CALENDAR_ERROR_NONE;
497 char* pLocation = null;
499 errorCode = calendar_record_get_str_p(__todoRecord.GetHandle(), _calendar_todo.location, &pLocation);
501 return String(pLocation);
505 _CalTodoImpl::SetCoordinates(double latitude, double longitude)
507 SysTryReturnResult(NID_SCL, latitude >= _MIN_LATITUDE && latitude <= _MAX_LATITUDE, E_INVALID_ARG, "Invalid argument is used. The latitude is out of range.");
508 SysTryReturnResult(NID_SCL, longitude >= _MIN_LONGITUDE && longitude <= _MAX_LONGITUDE, E_INVALID_ARG, "Invalid argument is used. The longitude is out of range.");
510 int errorCode = CALENDAR_ERROR_NONE;
512 errorCode = calendar_record_set_double(__todoRecord.GetHandle(), _calendar_todo.latitude, latitude);
513 errorCode = calendar_record_set_double(__todoRecord.GetHandle(), _calendar_todo.longitude, longitude);
519 _CalTodoImpl::GetCoordinates(double& latitude, double& longitude) const
521 int errorCode = CALENDAR_ERROR_NONE;
523 errorCode = calendar_record_get_double(__todoRecord.GetHandle(), _calendar_todo.latitude, &latitude);
524 errorCode = calendar_record_get_double(__todoRecord.GetHandle(), _calendar_todo.longitude, &longitude);
528 _CalTodoImpl::AddReminder(const Reminder& reminder)
530 int errorCode = CALENDAR_ERROR_NONE;
531 calendar_record_h tmpAlarmHandle = null;
533 std::unique_ptr<char[]> pTmpAlarmTone(_StringConverter::CopyToCharArrayN(reminder.GetSoundFile()));
534 SysTryReturnResult(NID_SCL, pTmpAlarmTone != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
536 errorCode = calendar_record_create(_calendar_alarm._uri, &tmpAlarmHandle);
537 SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
539 int convertedTimeUnit = 0;
541 ReminderTimeUnit timeUnit = reminder.GetTimeUnit();
544 case REMINDER_TIME_UNIT_MINUTE:
545 convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_MINUTE;
547 case REMINDER_TIME_UNIT_HOUR:
548 convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_HOUR;
550 case REMINDER_TIME_UNIT_DAY:
551 convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_DAY;
553 case REMINDER_TIME_UNIT_WEEK:
554 convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_WEEK;
556 case REMINDER_TIME_UNIT_NONE:
557 convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_SPECIFIC;
563 errorCode = calendar_record_set_int(tmpAlarmHandle, _calendar_alarm.tick_unit, convertedTimeUnit);
564 errorCode = calendar_record_set_int(tmpAlarmHandle, _calendar_alarm.tick, reminder.GetTimeOffset());
565 errorCode = calendar_record_set_str(tmpAlarmHandle, _calendar_alarm.tone, pTmpAlarmTone.get());
567 if (convertedTimeUnit == CALENDAR_ALARM_TIME_UNIT_SPECIFIC)
569 errorCode = calendar_record_set_lli(tmpAlarmHandle, _calendar_alarm.time, _CalendarbookUtil::ConvertDateTimeToEpochTime(reminder.GetAbsoluteTime()));
572 errorCode = calendar_record_add_child_record(__todoRecord.GetHandle(), _calendar_todo.calendar_alarm, tmpAlarmHandle);
574 __reminderList.RemoveAll(true);
575 __reminderListUpdated = false;
581 _CalTodoImpl::RemoveReminderAt(int index)
583 int errorCode = CALENDAR_ERROR_NONE;
584 calendar_record_h tmpAlarmHandle = null;
586 errorCode = calendar_record_get_child_record_at_p(__todoRecord.GetHandle(), _calendar_todo.calendar_alarm, index, &tmpAlarmHandle);
587 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.");
589 errorCode = calendar_record_remove_child_record(__todoRecord.GetHandle(), _calendar_todo.calendar_alarm, tmpAlarmHandle);
591 __reminderList.RemoveAll(true);
592 __reminderListUpdated = false;
598 _CalTodoImpl::GetAllReminders(void) const
602 if (__reminderListUpdated == false)
604 result r = _CalendarbookUtil::ConvertTodoAlarmsToReminderList(__todoRecord.GetHandle(), __reminderList);
605 SysTryReturn(NID_SCL, r == E_SUCCESS, __reminderList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
607 __reminderListUpdated = true;
610 return __reminderList;
614 _CalTodoImpl::GetCalendarId(void) const
616 int errorCode = CALENDAR_ERROR_NONE;
617 int srcCalendarbookId = 0;
619 errorCode = calendar_record_get_int(__todoRecord.GetHandle(), _calendar_todo.calendar_book_id, &srcCalendarbookId);
621 return srcCalendarbookId;
625 _CalTodoImpl::SetRecordHandle(calendar_record_h todoHandle)
627 __todoRecord.ResetHandle(todoHandle);
631 _CalTodoImpl::GetRecordHandle(void) const
633 return __todoRecord.GetHandle();
637 _CalTodoImpl::CreateDefaultInstanceN(void)
639 return new (std::nothrow) CalTodo();
643 _CalTodoImpl::GetInstance(CalTodo& todo)
645 return todo.__pCalTodoImpl;
649 _CalTodoImpl::GetInstance(const CalTodo& todo)
651 return todo.__pCalTodoImpl;