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_NONE:
241 case CALENDAR_TODO_PRIORITY_NORMAL:
242 priority = TODO_PRIORITY_NORMAL;
244 case CALENDAR_TODO_PRIORITY_HIGH:
245 priority = TODO_PRIORITY_HIGH;
248 SysLog(NID_SCL, "The priority value is invalid. priority = %d", srcPriority);
249 priority = TODO_PRIORITY_NORMAL;
257 _CalTodoImpl::GetStatus(void) const
259 int errorCode = CALENDAR_ERROR_NONE;
260 int srcStatus = CALENDAR_EVENT_STATUS_NONE;
262 TodoStatus status = TODO_STATUS_NONE;
264 errorCode = calendar_record_get_int(__todoRecord.GetHandle(), _calendar_todo.todo_status, &srcStatus);
268 case CALENDAR_TODO_STATUS_NONE:
269 status = TODO_STATUS_NONE;
271 case CALENDAR_TODO_STATUS_NEEDS_ACTION:
272 status = TODO_STATUS_NEEDS_ACTION;
274 case CALENDAR_TODO_STATUS_COMPLETED:
275 status = TODO_STATUS_COMPLETED;
277 case CALENDAR_TODO_STATUS_IN_PROCESS:
278 status = TODO_STATUS_IN_PROCESS;
280 case CALENDAR_TODO_STATUS_CANCELED:
281 status = TODO_STATUS_CANCELLED;
284 SysLog(NID_SCL, "The status value is invalid. status = %d", srcStatus);
285 status = TODO_STATUS_NONE;
293 _CalTodoImpl::GetSensitivity(void) const
295 int errorCode = CALENDAR_ERROR_NONE;
296 int srcSensitivity = CALENDAR_SENSITIVITY_PUBLIC;
297 RecordSensitivity sensitivity = SENSITIVITY_PUBLIC;
299 errorCode = calendar_record_get_int(__todoRecord.GetHandle(), _calendar_todo.sensitivity, &srcSensitivity);
301 switch (srcSensitivity)
303 case CALENDAR_SENSITIVITY_PUBLIC:
304 sensitivity = SENSITIVITY_PUBLIC;
306 case CALENDAR_SENSITIVITY_PRIVATE:
307 sensitivity = SENSITIVITY_PRIVATE;
309 case CALENDAR_SENSITIVITY_CONFIDENTIAL:
310 sensitivity = SENSITIVITY_CONFIDENTIAL;
313 SysLog(NID_SCL, "The sensitivity value is invalid. sensitivity = %d", srcSensitivity);
314 sensitivity = SENSITIVITY_PUBLIC;
322 _CalTodoImpl::GetLastRevisedTime(void) const
324 int errorCode = CALENDAR_ERROR_NONE;
325 long long lastModifiedTime = 0;
326 DateTime tmpLastRevisedTime;
328 errorCode = calendar_record_get_lli(__todoRecord.GetHandle(), _calendar_todo.last_modified_time, &lastModifiedTime);
330 tmpLastRevisedTime = _CalendarbookUtil::ConvertEpochTimeToDateTime(lastModifiedTime);
332 return tmpLastRevisedTime;
336 _CalTodoImpl::SetSubject(const String& subject)
338 if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
340 SysTryReturnResult(NID_SCL, subject.GetLength() <= MAX_TODO_SUBJECT_LENGTH,
341 E_INVALID_ARG, "Invalid argument is used. The length of the subject exceeds MAX_TODO_SUBJECT_LENGTH.");
344 std::unique_ptr<char[]> pConvertedSubject(_StringConverter::CopyToCharArrayN(subject));
345 SysTryReturnResult(NID_SCL, pConvertedSubject != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
347 int errorCode = CALENDAR_ERROR_NONE;
348 errorCode = calendar_record_set_str(__todoRecord.GetHandle(), _calendar_todo.summary, pConvertedSubject.get());
354 _CalTodoImpl::SetDescription(const String& description)
356 if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
358 SysTryReturnResult(NID_SCL, description.GetLength() <= MAX_TODO_DESCRIPTION_LENGTH,
359 E_INVALID_ARG, "Invalid argument is used. The length of the description exceeds MAX_TODO_SUBJECT_LENGTH.");
362 std::unique_ptr<char[]> pConvertedDescription(_StringConverter::CopyToCharArrayN(description));
363 SysTryReturnResult(NID_SCL, pConvertedDescription != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
365 int errorCode = CALENDAR_ERROR_NONE;
366 errorCode = calendar_record_set_str(__todoRecord.GetHandle(), _calendar_todo.description, pConvertedDescription.get());
372 _CalTodoImpl::SetStartAndDueDate(const DateTime& startDate, const DateTime& dueDate)
374 SysTryReturnResult(NID_SCL, _CalendarbookUtil::CheckValidDateTime(startDate), E_INVALID_ARG, "Invalid argument is used. The start date is invalid.");
375 SysTryReturnResult(NID_SCL, _CalendarbookUtil::CheckValidDateTime(dueDate), E_INVALID_ARG, "Invalid argument is used. The end date is invalid.");
376 SysTryReturnResult(NID_SCL, startDate <= dueDate, E_INVALID_ARG, "Invalid argument is used. The end date is earlier than the start date.");
378 int errorCode = CALENDAR_ERROR_NONE;
379 calendar_time_s convertedStartTime;
380 calendar_time_s convertedDueTime;
382 convertedStartTime.type = CALENDAR_TIME_UTIME;
383 convertedStartTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(startDate);
384 convertedDueTime.type = CALENDAR_TIME_UTIME;
385 convertedDueTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(dueDate);
387 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.start_time, convertedStartTime);
388 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.due_time, convertedDueTime);
394 _CalTodoImpl::SetStartDate(const DateTime& startDate)
396 int errorCode = CALENDAR_ERROR_NONE;
397 calendar_time_s convertedStartTime;
398 convertedStartTime.type = CALENDAR_TIME_UTIME;
400 if (startDate == DateTime::GetMinValue())
402 convertedStartTime.time.utime = _CALENDAR_TODO_NO_START_DATE;
404 else if (startDate < _CalendarbookImpl::GetMinDateTime() || startDate > _CalendarbookImpl::GetMaxDateTime())
406 SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The startDate is invalid.");
407 return E_INVALID_ARG;
411 calendar_time_s convertedDueTime;
412 errorCode = calendar_record_get_caltime(__todoRecord.GetHandle(), _calendar_todo.due_time, &convertedDueTime);
414 convertedStartTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(startDate);
416 if (convertedStartTime.time.utime > convertedDueTime.time.utime)
418 convertedDueTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(DateTime::GetMinValue());
419 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.due_time, convertedDueTime);
423 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.start_time, convertedStartTime);
430 _CalTodoImpl::SetDueDate(const DateTime& dueDate)
432 int errorCode = CALENDAR_ERROR_NONE;
433 calendar_time_s convertedDueTime;
434 convertedDueTime.type = CALENDAR_TIME_UTIME;
436 if (dueDate == DateTime::GetMinValue())
438 convertedDueTime.time.utime = _CALENDAR_TODO_NO_DUE_DATE;
440 else if (dueDate < _CalendarbookImpl::GetMinDateTime() || dueDate > _CalendarbookImpl::GetMaxDateTime())
442 SysLogException(NID_SCL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The dueDate is invalid.");
443 return E_INVALID_ARG;
447 calendar_time_s convertedStartTime;
448 errorCode = calendar_record_get_caltime(__todoRecord.GetHandle(), _calendar_todo.start_time, &convertedStartTime);
450 convertedDueTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(dueDate);
452 if (convertedStartTime.time.utime > convertedDueTime.time.utime)
454 convertedStartTime.time.utime = _CalendarbookUtil::ConvertDateTimeToEpochTime(DateTime::GetMinValue());
455 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.start_time, convertedStartTime);
459 errorCode = calendar_record_set_caltime(__todoRecord.GetHandle(), _calendar_todo.due_time, convertedDueTime);
465 _CalTodoImpl::SetPriority(TodoPriority priority)
467 int errorCode = CALENDAR_ERROR_NONE;
468 errorCode = calendar_record_set_int(__todoRecord.GetHandle(), _calendar_todo.priority, _CalendarbookUtil::ConvertTodoPriorityToCSTodoPriority(priority));
472 _CalTodoImpl::SetStatus(TodoStatus status)
474 int errorCode = CALENDAR_ERROR_NONE;
475 errorCode = calendar_record_set_int(__todoRecord.GetHandle(), _calendar_todo.todo_status, _CalendarbookUtil::ConvertTodoStatusToCSTodoStatus(status));
479 _CalTodoImpl::SetSensitivity(RecordSensitivity sensitivity)
481 int errorCode = CALENDAR_ERROR_NONE;
482 errorCode = calendar_record_set_int(__todoRecord.GetHandle(), _calendar_todo.sensitivity, _CalendarbookUtil::ConvertSensitivityToCSSensitivity(sensitivity));
486 _CalTodoImpl::SetLocation(const String& location)
488 std::unique_ptr<char[]> pConvertedLocation(_StringConverter::CopyToCharArrayN(location));
489 SysTryReturnVoidResult(NID_SCL, pConvertedLocation != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
491 int errorCode = CALENDAR_ERROR_NONE;
492 errorCode = calendar_record_set_str(__todoRecord.GetHandle(), _calendar_todo.location, pConvertedLocation.get());
496 _CalTodoImpl::GetLocation(void) const
498 int errorCode = CALENDAR_ERROR_NONE;
499 char* pLocation = null;
501 errorCode = calendar_record_get_str_p(__todoRecord.GetHandle(), _calendar_todo.location, &pLocation);
503 return String(pLocation);
507 _CalTodoImpl::SetCoordinates(double latitude, double longitude)
509 SysTryReturnResult(NID_SCL, latitude >= _MIN_LATITUDE && latitude <= _MAX_LATITUDE, E_INVALID_ARG, "Invalid argument is used. The latitude is out of range.");
510 SysTryReturnResult(NID_SCL, longitude >= _MIN_LONGITUDE && longitude <= _MAX_LONGITUDE, E_INVALID_ARG, "Invalid argument is used. The longitude is out of range.");
512 int errorCode = CALENDAR_ERROR_NONE;
514 errorCode = calendar_record_set_double(__todoRecord.GetHandle(), _calendar_todo.latitude, latitude);
515 errorCode = calendar_record_set_double(__todoRecord.GetHandle(), _calendar_todo.longitude, longitude);
521 _CalTodoImpl::GetCoordinates(double& latitude, double& longitude) const
523 int errorCode = CALENDAR_ERROR_NONE;
525 errorCode = calendar_record_get_double(__todoRecord.GetHandle(), _calendar_todo.latitude, &latitude);
526 errorCode = calendar_record_get_double(__todoRecord.GetHandle(), _calendar_todo.longitude, &longitude);
530 _CalTodoImpl::AddReminder(const Reminder& reminder)
532 int errorCode = CALENDAR_ERROR_NONE;
533 calendar_record_h tmpAlarmHandle = null;
535 std::unique_ptr<char[]> pTmpAlarmTone(_StringConverter::CopyToCharArrayN(reminder.GetSoundFile()));
536 SysTryReturnResult(NID_SCL, pTmpAlarmTone != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
538 errorCode = calendar_record_create(_calendar_alarm._uri, &tmpAlarmHandle);
539 SysTryReturnResult(NID_SCL, errorCode == CALENDAR_ERROR_NONE, E_OUT_OF_MEMORY, "Memory allocation failed.");
541 int convertedTimeUnit = 0;
543 ReminderTimeUnit timeUnit = reminder.GetTimeUnit();
546 case REMINDER_TIME_UNIT_MINUTE:
547 convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_MINUTE;
549 case REMINDER_TIME_UNIT_HOUR:
550 convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_HOUR;
552 case REMINDER_TIME_UNIT_DAY:
553 convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_DAY;
555 case REMINDER_TIME_UNIT_WEEK:
556 convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_WEEK;
558 case REMINDER_TIME_UNIT_NONE:
559 convertedTimeUnit = CALENDAR_ALARM_TIME_UNIT_SPECIFIC;
565 errorCode = calendar_record_set_int(tmpAlarmHandle, _calendar_alarm.tick_unit, convertedTimeUnit);
566 errorCode = calendar_record_set_int(tmpAlarmHandle, _calendar_alarm.tick, reminder.GetTimeOffset());
567 errorCode = calendar_record_set_str(tmpAlarmHandle, _calendar_alarm.tone, pTmpAlarmTone.get());
569 if (convertedTimeUnit == CALENDAR_ALARM_TIME_UNIT_SPECIFIC)
571 errorCode = calendar_record_set_lli(tmpAlarmHandle, _calendar_alarm.time, _CalendarbookUtil::ConvertDateTimeToEpochTime(reminder.GetAbsoluteTime()));
574 errorCode = calendar_record_add_child_record(__todoRecord.GetHandle(), _calendar_todo.calendar_alarm, tmpAlarmHandle);
576 __reminderList.RemoveAll(true);
577 __reminderListUpdated = false;
583 _CalTodoImpl::RemoveReminderAt(int index)
585 int errorCode = CALENDAR_ERROR_NONE;
586 calendar_record_h tmpAlarmHandle = null;
588 errorCode = calendar_record_get_child_record_at_p(__todoRecord.GetHandle(), _calendar_todo.calendar_alarm, index, &tmpAlarmHandle);
589 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.");
591 errorCode = calendar_record_remove_child_record(__todoRecord.GetHandle(), _calendar_todo.calendar_alarm, tmpAlarmHandle);
593 __reminderList.RemoveAll(true);
594 __reminderListUpdated = false;
600 _CalTodoImpl::GetAllReminders(void) const
604 if (__reminderListUpdated == false)
606 result r = _CalendarbookUtil::ConvertTodoAlarmsToReminderList(__todoRecord.GetHandle(), __reminderList);
607 SysTryReturn(NID_SCL, r == E_SUCCESS, __reminderList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
609 __reminderListUpdated = true;
612 return __reminderList;
616 _CalTodoImpl::GetCalendarId(void) const
618 int errorCode = CALENDAR_ERROR_NONE;
619 int srcCalendarbookId = 0;
621 errorCode = calendar_record_get_int(__todoRecord.GetHandle(), _calendar_todo.calendar_book_id, &srcCalendarbookId);
623 return srcCalendarbookId;
627 _CalTodoImpl::SetRecordHandle(calendar_record_h todoHandle)
629 __todoRecord.ResetHandle(todoHandle);
633 _CalTodoImpl::GetRecordHandle(void) const
635 return __todoRecord.GetHandle();
639 _CalTodoImpl::CreateDefaultInstanceN(void)
641 return new (std::nothrow) CalTodo();
645 _CalTodoImpl::GetInstance(CalTodo& todo)
647 return todo.__pCalTodoImpl;
651 _CalTodoImpl::GetInstance(const CalTodo& todo)
653 return todo.__pCalTodoImpl;