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.h
18 * @brief This is the header file for the _CalTodoImpl class.
20 * This header file contains the declarations of the _CalTodoImpl class.
23 #ifndef _FSCL_INTERNAL_CALTODO_IMPL_H_
24 #define _FSCL_INTERNAL_CALTODO_IMPL_H_
26 #include <unique_ptr.h>
27 #include <calendar2.h>
28 #include <FBaseColAllElementsDeleter.h>
29 #include <FBaseObject.h>
30 #include "FScl_CalendarbookUtil.h"
32 namespace Tizen { namespace Base
42 namespace Tizen { namespace Social
50 * @brief This class provides methods to manage the information of a calendarbook to-do.
53 : public Tizen::Base::Object
57 * This is the default constructor for this class.
62 * Copying of objects using this copy constructor is allowed.
64 * @param[in] rhs An instance of _CalTodoImpl
66 _CalTodoImpl(const _CalTodoImpl& rhs);
69 * This destructor overrides Tizen::Base::Object::~Object().
71 virtual ~_CalTodoImpl(void);
74 * Gets the subject of the current instance of _CalTodoImpl.
78 Tizen::Base::String GetSubject(void) const;
81 * Gets the description of the current instance of _CalTodoImpl.
83 * @return The description
85 Tizen::Base::String GetDescription(void) const;
88 * Gets the start date of the current instance of _CalTodoImpl. @n
90 * @return The start date
92 Tizen::Base::DateTime GetStartDate(void) const;
95 * Gets the due date of the current instance of _CalTodoImpl. @n
97 * @return The due date
99 Tizen::Base::DateTime GetDueDate(void) const;
102 * Gets the priority level of the current instance of _CalTodoImpl. @n
103 * The default priority level is #TODO_PRIORITY_LOW.
105 * @return The priority level
107 TodoPriority GetPriority(void) const;
110 * Gets the status of the current instance of _CalTodoImpl. @n
111 * The default status is #TODO_STATUS_NONE.
113 * @return The status of the to-do
115 TodoStatus GetStatus(void) const;
118 * Gets the sensitivity of the current instance of _CalTodoImpl. @n
119 * The default value is #SENSITIVITY_PUBLIC.
121 * @return The sensitivity of the to-do
123 RecordSensitivity GetSensitivity(void) const;
126 * Gets the last updated date and time of the current instance of _CalTodoImpl.
128 * @return The last updated date and time
130 Tizen::Base::DateTime GetLastRevisedTime(void) const;
133 * Sets the subject of the current instance of _CalTodoImpl.
135 * @return An error code
136 * @param[in] subject The subject of the to-do
137 * @exception E_SUCCESS The method was successful.
138 * @exception E_INVALID_ARG The length of the specified @c subject exceeds #MAX_TODO_SUBJECT_LENGTH.
140 result SetSubject(const Tizen::Base::String& subject);
143 * Sets the description of the current instance of _CalTodoImpl.
145 * @return An error code
146 * @param[in] description The description of the to-do @n
147 @c null to remove the existing value
148 * @exception E_SUCCESS The method was successful.
149 * @exception E_INVALID_ARG The length of the specified @c description exceeds #MAX_TODO_DESCRIPTION_LENGTH.
151 result SetDescription(const Tizen::Base::String& description);
154 * Sets the start date and due date for the current instance of _CalTodoImpl. @n
155 * If the start date is not set, the current date is considered as the start date.
156 * The due date must be later than or equal to the start Date. @n
158 * @return An error code
159 * @param[in] start The start date
160 * @param[in] due The due date
161 * @exception E_SUCCESS The method was successful.
162 * @exception E_INVALID_ARG The specified @c due value is earlier than the specified @c start value.
164 result SetStartAndDueDate(const Tizen::Base::DateTime& start, const Tizen::Base::DateTime& due);
167 * Sets the start date for the current instance of %CalTodo. @n
168 * If the startDate is minimum value of Tizen::Base::DateTime, the start date is changed to unset. @n
169 * And if the start date is later than due date, the due date will be changed to unset.
173 * @return An error code
174 * @param[in] startDate The start date
175 * @exception E_SUCCESS The method is successful.
176 * @exception E_INVALID_ARG The specified @c start date is invalid.
177 * The valid range of the date can be referenced from Calendarbook::GetMaxDateTime() and Calendarbook::GetMinDateTime() @n
178 * and The minimum value of Tizen::Base::DateTime is valid to unset the start date.
179 * @remarks Tizen::Base::DateTime::GetMinValue();
181 result SetStartDate(const Tizen::Base::DateTime& startDate);
184 * Sets the end date for the current instance of %CalTodo. @n
185 * If the dueDate is minimum value of Tizen::Base::DateTime, the due date is changed to unset. @n
186 * And if the due date is earlier than start date, the start date will be changed to unset.
190 * @return An error code
191 * @param[in] dueDate The due date
192 * @exception E_SUCCESS The method is successful.
193 * @exception E_INVALID_ARG The specified @c due date is invalid.
194 * The valid range of the date can be referenced from Calendarbook::GetMaxDateTime() and Calendarbook::GetMinDateTime() @n
195 * and The minimum value of Tizen::Base::DateTime is valid to unset the due date.
196 * @remarks Tizen::Base::DateTime::GetMinValue();
198 result SetDueDate(const Tizen::Base::DateTime& dueDate);
201 * Sets the priority level of the current instance of _CalTodoImpl.
203 * @param[in] priority The priority level to set
205 void SetPriority(TodoPriority priority);
208 * Sets the status of the current instance of _CalTodoImpl.
210 * @param[in] status The status to set
212 void SetStatus(TodoStatus status);
215 * Sets the sensitivity of the current instance of _CalTodoImpl.
217 * @param[in] sensitivity The sensitivity to set
219 void SetSensitivity(RecordSensitivity sensitivity);
222 * Sets the location of the current calendar event.
226 * @return An error code
227 * @param[in] location The location of the event
229 void SetLocation(const Tizen::Base::String& location);
232 * Gets the location of the calendar event.
236 * @return The location
238 Tizen::Base::String GetLocation(void) const;
241 * Sets the coordinates.
245 * @return An error code
246 * @param[in] latitude The latitude in the range. The valid range is [-90.0, 90.0]
247 * @param[in] longitude The longitude in the range. The valid range is [-180.0, 180.0]
248 * @exception E_SUCCESS The method is successful.
249 * @exception E_INVALID_ARG The latitude or longitude is out of the valid range.
251 result SetCoordinates(double latitude, double longitude);
254 * Gets the coordinates.
258 * @return An error code
259 * @param[out] latitude The latitude
260 * @param[out] longitude The longitude
262 void GetCoordinates(double& latitude, double& longitude) const;
269 * @return An error code
270 * @param[in] reminder The reminder to be added
271 * @exception E_SUCCESS The method is successful.
272 * @exception E_OUT_OF_MEMORY The memory is insufficient.
274 result AddReminder(const Reminder& reminder);
277 * Removes a reminder at the index.
281 * @return An error code
282 * @param[in] index The index of reminder to be removed
283 * @exception E_SUCCESS The method is successful.
284 * @exception E_OUT_OF_RANGE The index is either equal to or greater than the number of reminders or less than 0.
286 result RemoveReminderAt(int index);
289 * Gets a list of all the reminders.
293 * @return A list containing the Reminder instances, @n
294 * else an empty list if there are no reminders
296 const Tizen::Base::Collection::IList& GetAllReminders(void) const;
299 * Gets the ID of the calendar that this to-do belongs to. @n
301 * @return The calendar Id
303 RecordId GetCalendarId(void) const;
306 // Sets the record handle
308 void SetRecordHandle(calendar_record_h todoHandle);
311 // Gets the record handle
313 calendar_record_h GetRecordHandle(void) const;
315 static CalTodo* CreateDefaultInstanceN(void);
318 * Gets the Impl instance.
320 * @return The pointer to const _CalTodoImpl
321 * @param[in] todo A const instance of %CalTodo class
323 static _CalTodoImpl* GetInstance(CalTodo& todo);
326 * Gets the Impl instance.
328 * @return The pointer to const _CalTodoImpl
329 * @param[in] todo A const instance of %CalTodo class
331 static const _CalTodoImpl* GetInstance(const CalTodo& todo);
334 * Copying of objects using this copy assignment operator is allowed.
336 * @param[in] rhs An instance of _CalTodoImpl
338 _CalTodoImpl& operator =(const _CalTodoImpl& rhs);
341 mutable Tizen::Base::Collection::ArrayList __reminderList;
342 mutable bool __reminderListUpdated;
344 _CalendarRecord __todoRecord;
350 #endif //_FSCL_INTERNAL_CALTODO_IMPL_H_