Initialize Tizen 2.3
[framework/osp/social.git] / src / inc / FScl_CalTodoImpl.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16 /**
17  * @file                FScl_CalTodoImpl.h
18  * @brief       This is the header file for the _CalTodoImpl class.
19  *
20  * This header file contains the declarations of the _CalTodoImpl class.
21  */
22
23 #ifndef _FSCL_INTERNAL_CALTODO_IMPL_H_
24 #define _FSCL_INTERNAL_CALTODO_IMPL_H_
25
26 #include <unique_ptr.h>
27 #include <calendar2.h>
28 #include <FBaseColAllElementsDeleter.h>
29 #include <FBaseObject.h>
30 #include "FScl_CalendarbookUtil.h"
31
32 namespace Tizen { namespace Base
33 {
34 class String;
35 class DateTime;
36 namespace Collection
37 {
38 class IList;
39 }
40 }}
41
42 namespace Tizen { namespace Social
43 {
44
45 class CalTodo;
46 class Reminder;
47
48 /**
49  *      @class  _CalTodoImpl
50  *      @brief  This class provides methods to manage the information of a calendarbook to-do.
51  */
52 class _CalTodoImpl
53         : public Tizen::Base::Object
54 {
55 public:
56         /**
57          * This is the default constructor for this class.
58          */
59         _CalTodoImpl(void);
60
61         /**
62          * Copying of objects using this copy constructor is allowed.
63          *
64          * @param[in]   rhs             An instance of _CalTodoImpl
65          */
66         _CalTodoImpl(const _CalTodoImpl& rhs);
67
68         /**
69          * This destructor overrides Tizen::Base::Object::~Object().
70          */
71         virtual ~_CalTodoImpl(void);
72
73         /**
74          * Gets the subject of the current instance of _CalTodoImpl.
75          *
76          * @return              The subject
77          */
78         Tizen::Base::String GetSubject(void) const;
79
80         /**
81          * Gets the description of the current instance of _CalTodoImpl.
82          *
83          * @return       The description
84          */
85         Tizen::Base::String GetDescription(void) const;
86
87         /**
88          * Gets the start date of the current instance of _CalTodoImpl. @n
89          *
90          * @return              The start date
91          */
92         Tizen::Base::DateTime GetStartDate(void) const;
93
94         /**
95          * Gets the due date of the current instance of _CalTodoImpl. @n
96          *
97          * @return              The due date
98          */
99         Tizen::Base::DateTime GetDueDate(void) const;
100
101         /**
102          * Gets the priority level of the current instance of _CalTodoImpl. @n
103          * The default priority level is #TODO_PRIORITY_LOW.
104          *
105          * @return              The priority level
106          */
107         TodoPriority GetPriority(void) const;
108
109         /**
110          * Gets the status of the current instance of _CalTodoImpl. @n
111          * The default status is #TODO_STATUS_NONE.
112          *
113          * @return              The status of the to-do
114          */
115         TodoStatus GetStatus(void) const;
116
117         /**
118          * Gets the sensitivity of the current instance of _CalTodoImpl. @n
119          * The default value is #SENSITIVITY_PUBLIC.
120          *
121          * @return              The sensitivity of the to-do
122          */
123         RecordSensitivity GetSensitivity(void) const;
124
125         /**
126          * Gets the last updated date and time of the current instance of _CalTodoImpl.
127          *
128          * @return              The last updated date and time
129          */
130         Tizen::Base::DateTime GetLastRevisedTime(void) const;
131
132         /**
133          * Sets the subject of the current instance of _CalTodoImpl.
134          *
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.
139          */
140         result SetSubject(const Tizen::Base::String& subject);
141
142         /**
143          * Sets the description of the current instance of _CalTodoImpl.
144          *
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.
150          */
151         result SetDescription(const Tizen::Base::String& description);
152
153         /**
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
157          *
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.
163          */
164         result SetStartAndDueDate(const Tizen::Base::DateTime& start, const Tizen::Base::DateTime& due);
165
166         /**
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.
170          *
171          * @since       2.0
172          *
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();
180          */
181         result SetStartDate(const Tizen::Base::DateTime& startDate);
182
183         /**
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.
187          *
188          * @since       2.0
189          *
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();
197          */
198         result SetDueDate(const Tizen::Base::DateTime& dueDate);
199
200         /**
201          * Sets the priority level of the current instance of _CalTodoImpl.
202          *
203          * @param[in]   priority                The priority level to set
204          */
205         void SetPriority(TodoPriority priority);
206
207         /**
208          * Sets the status of the current instance of _CalTodoImpl.
209          *
210          * @param[in]   status                  The status to set
211          */
212         void SetStatus(TodoStatus status);
213
214         /**
215          * Sets the sensitivity of the current instance of _CalTodoImpl.
216          *
217          * @param[in]   sensitivity             The sensitivity to set
218          */
219         void SetSensitivity(RecordSensitivity sensitivity);
220
221         /**
222          * Sets the location of the current calendar event.
223          *
224          * @since       2.0
225          *
226          * @return              An error code
227          * @param[in]   location                        The location of the event
228          */
229         void SetLocation(const Tizen::Base::String& location);
230
231         /**
232          * Gets the location of the calendar event.
233          *
234          * @since       2.0
235          *
236          * @return              The location
237          */
238         Tizen::Base::String GetLocation(void) const;
239
240         /**
241          * Sets the coordinates.
242          *
243          * @since       2.0
244          *
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.
250          */
251         result SetCoordinates(double latitude, double longitude);
252
253         /**
254          * Gets the coordinates.
255          *
256          * @since       2.0
257          *
258          * @return              An error code
259          * @param[out]  latitude                The latitude
260          * @param[out]  longitude               The longitude
261          */
262         void GetCoordinates(double& latitude, double& longitude) const;
263
264         /**
265          * Adds a reminder.
266          *
267          * @since       2.0
268          *
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.
273          */
274         result AddReminder(const Reminder& reminder);
275
276         /**
277          * Removes a reminder at the index.
278          *
279          * @since       2.0
280          *
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.
285          */
286         result RemoveReminderAt(int index);
287
288         /**
289          * Gets a list of all the reminders.
290          *
291          * @since       2.0
292          *
293          * @return              A list containing the Reminder instances, @n
294          *                              else an empty list if there are no reminders
295          */
296         const Tizen::Base::Collection::IList& GetAllReminders(void) const;
297
298         /**
299          * Gets the ID of the calendar that this to-do belongs to. @n
300          *
301          * @return              The calendar Id
302          */
303         RecordId GetCalendarId(void) const;
304
305         //
306         // Sets the record handle
307         //
308         void SetRecordHandle(calendar_record_h todoHandle);
309
310         //
311         // Gets the record handle
312         //
313         calendar_record_h GetRecordHandle(void) const;
314
315         static CalTodo* CreateDefaultInstanceN(void);
316
317         /**
318          * Gets the Impl instance.
319          *
320          * @return                      The pointer to const _CalTodoImpl
321          * @param[in]   todo            A const instance of %CalTodo class
322          */
323         static _CalTodoImpl* GetInstance(CalTodo& todo);
324
325         /**
326          * Gets the Impl instance.
327          *
328          * @return                      The pointer to const _CalTodoImpl
329          * @param[in]   todo            A const instance of %CalTodo class
330          */
331         static const _CalTodoImpl* GetInstance(const CalTodo& todo);
332
333         /**
334          * Copying of objects using this copy assignment operator is allowed.
335          *
336          * @param[in]   rhs             An instance of _CalTodoImpl
337          */
338         _CalTodoImpl& operator =(const _CalTodoImpl& rhs);
339
340 private:
341         mutable Tizen::Base::Collection::ArrayList __reminderList;
342         mutable bool __reminderListUpdated;
343
344         _CalendarRecord __todoRecord;
345
346 };      // _CalTodoImpl
347
348 }}      // Tizen::Social
349
350 #endif //_FSCL_INTERNAL_CALTODO_IMPL_H_