<li><a href="#make">Making a vCalendar</a></li>\r
<li><a href="#parse">Parsing a vCalendar</a></li>\r
</ul></li>\r
- </ul> \r
+ </ul>\r
<p class="toc-title">Related Info</p>\r
<ul class="toc">\r
<li><a href="../../../../org.tizen.guides/html/native/social/calendar_n.htm">Calendar Guide</a></li>\r
\r
<h1>Calendar: Managing Calendar Events and Accessing the Calendar Database</h1>\r
\r
- \r
+\r
<p>This tutorial demonstrates how you can manage events and todo tasks, and convert calendar details to and from the vCalendar format.</p>\r
\r
<p>This feature is supported in mobile applications only.</p>\r
- \r
+\r
<h2 id="warmup" name="warmup">Warm-up</h2>\r
<p>Become familiar with the Calendar API basics by learning about:</p>\r
<ul>\r
\r
\r
<h2 id="init" name="init">Initializing the Calendar</h2>\r
- \r
+\r
<p>To initialize the Calendar Service:</p>\r
-<ol><li> \r
+<ol><li>\r
<p>To use the functions and data types of the <a href="../../../../org.tizen.native.mobile.apireference/group__CAPI__SOCIAL__CALENDAR__SVC__MODULE.html">Calendar</a> API, include the <span style="font-family: Courier New,Courier,monospace"><calendar.h></span> header file in your application:</p>\r
<pre class="prettyprint">\r
#include <calendar.h>\r
-</pre></li> \r
- \r
-<li> \r
+</pre></li>\r
+\r
+<li>\r
<p>Most of API functions return error codes, so you must define at the beginning of your code the <span style="font-family: Courier New,Courier,monospace">int</span> type, which is used to store the error codes. Each time when a function returns error codes, verify the result of the operation.</p></li>\r
\r
<li><p>To connect to the Calendar Service, call the <span style="font-family: Courier New,Courier,monospace">calendar_connect()</span> function. Without this function, you cannot get access to the calendar database.</p>\r
\r
if (error_code != CALENDAR_ERROR_NONE)\r
dlog_print(DLOG_ERROR, LOG_TAG, "calendar add alarm failed \n");</pre>\r
-<p>The available alarm tick units are listed in the <a href="../../../../org.tizen.native.mobile.apireference/group__CAPI__SOCIAL__CALENDAR__SVC__RECORD__MODULE.html#ga631b1b606158479e3a14a921b006b4fe">calendar_alarm_time_unit_type_e</a> enumeration. Note that <span style="font-family: Courier New,Courier,monospace">CALENDAR_ALARM_TIME_UNIT_MONTH</span> is not recommended. With <span style="font-family: Courier New,Courier,monospace">CALENDAR_ALARM_TIME_UNIT_SPECIFIC</span> you must use specific unixtime.</p></li>\r
+<p>The available alarm tick units are listed in the <a href="../../../../org.tizen.native.mobile.apireference/group__CAPI__SOCIAL__CALENDAR__SVC__RECORD__MODULE.html#ga631b1b606158479e3a14a921b006b4fe">calendar_alarm_time_unit_type_e</a> enumeration. With <span style="font-family: Courier New,Courier,monospace">CALENDAR_ALARM_TIME_UNIT_SPECIFIC</span> you must use specific unixtime.</p></li>\r
<li>Add an attendee.\r
<p>To add an attendee, create an attendee handle and insert it as a child.</p>\r
<pre class="prettyprint">calendar_record_h attendee = NULL;\r
\r
<li>Iterate the list and read the records.\r
<ol type="a"><li>Get records from the list using <span style="font-family: Courier New,Courier,monospace">calendar_list_get_current_record_p()</span>, and <span style="font-family: Courier New,Courier,monospace">calendar_list_next()</span> or <span style="font-family: Courier New,Courier,monospace">calendar_list_prev()</span>. Inside the loop, get details of each record.\r
- <table class="note"> \r
- <tbody> \r
- <tr> \r
- <th class="note">Note</th> \r
- </tr> \r
- <tr> \r
- <td class="note">Some functions have the <span style="font-family: Courier New,Courier,monospace">_p</span> postfix. It means that the returned value must not be freed by the application, as it is a pointer to the data in an existing record.</td> \r
- </tr> \r
- </tbody> \r
- </table> \r
+ <table class="note">\r
+ <tbody>\r
+ <tr>\r
+ <th class="note">Note</th>\r
+ </tr>\r
+ <tr>\r
+ <td class="note">Some functions have the <span style="font-family: Courier New,Courier,monospace">_p</span> postfix. It means that the returned value must not be freed by the application, as it is a pointer to the data in an existing record.</td>\r
+ </tr>\r
+ </tbody>\r
+ </table>\r
\r
<pre class="prettyprint">calendar_record_h record;\r
while (calendar_list_get_current_record_p(list, &record) == CALENDAR_ERROR_NONE)\r
}</pre></li>\r
\r
<li>The memory for the record data is allocated, and the data is copied from the record by the functions listed further on in this tutorial.\r
-<pre class="prettyprint">typedef struct \r
+<pre class="prettyprint">typedef struct\r
_calendar_gl_event_data\r
{\r
int id;\r
calendar_time_s start_time;\r
} calendar_gl_event_data_t;\r
\r
-static void \r
+static void\r
_free_gl_event_data(calendar_gl_event_data_t *gl_event_data)\r
{\r
if (NULL == gl_event_data)\r
free(gl_event_data);\r
}\r
\r
-static calendar_gl_event_data_t* \r
+static calendar_gl_event_data_t*\r
_create_gl_event_data(calendar_record_h record)\r
{\r
calendar_gl_event_data_t *gl_event_data;\r
<li>Define the callback function.\r
<p>The callback function is called when an event changes. The following example shows how to get the new event details.</p>\r
<pre class="prettyprint">static calendar_gl_event_data_t *_gl_event_data = ...\r
-static void \r
+static void\r
_event_changed_callback(const char *view_uri, void *user_data)\r
{\r
if (0 != strcmp(view_uri, _calendar_event._uri))\r
</ol></li>\r
<li>Iterate the list and read the records.\r
<ol type="a"><li>Get records from the list using <span style="font-family: Courier New,Courier,monospace">calendar_list_get_current_record_p()</span>, and <span style="font-family: Courier New,Courier,monospace">calendar_list_next()</span> or <span style="font-family: Courier New,Courier,monospace">calendar_list_prev()</span>. Inside the loop, get details of each record.\r
- <table class="note"> \r
- <tbody> \r
- <tr> \r
- <th class="note">Note</th> \r
- </tr> \r
- <tr> \r
- <td class="note">Some functions have the <span style="font-family: Courier New,Courier,monospace">_p</span> postfix. It means that the returned value must not be freed by the application, as it is a pointer to the data in an existing record.</td> \r
- </tr> \r
- </tbody> \r
- </table> \r
+ <table class="note">\r
+ <tbody>\r
+ <tr>\r
+ <th class="note">Note</th>\r
+ </tr>\r
+ <tr>\r
+ <td class="note">Some functions have the <span style="font-family: Courier New,Courier,monospace">_p</span> postfix. It means that the returned value must not be freed by the application, as it is a pointer to the data in an existing record.</td>\r
+ </tr>\r
+ </tbody>\r
+ </table>\r
<pre class="prettyprint">calendar_record_h record;\r
while (calendar_list_get_current_record_p(list, &record) == CALENDAR_ERROR_NONE)\r
{\r
}</pre></li>\r
\r
<li>The memory for the record data is allocated, and the data is copied from the record by the functions listed further on in this document.\r
-<pre class="prettyprint">typedef struct \r
+<pre class="prettyprint">typedef struct\r
_calendar_gl_todo_data\r
{\r
int id;\r
calendar_time_s due_time;\r
} calendar_gl_todo_data_t;\r
\r
-static void \r
+static void\r
_free_gl_todo_data(calendar_gl_todo_data_t *gl_todo_data)\r
{\r
if (NULL == gl_todo_data)\r
free(gl_todo_data);\r
}\r
\r
-static calendar_gl_todo_data_t* \r
+static calendar_gl_todo_data_t*\r
_create_gl_todo_data(calendar_record_h record)\r
{\r
calendar_gl_todo_data_t *gl_todo_data;\r
<li>Define the callback function.\r
<p>The callback function is called when a todo changes. The following example shows how to get the new todo details.</p>\r
<pre class="prettyprint">static calendar_gl_todo_data_t *_gl_todo_data = ...\r
-static void \r
+static void\r
_todo_changed_callback(const char *view_uri, void *user_data)\r
{\r
if (0 != strcmp(view_uri, _calendar_todo._uri))\r
\r
<p>The vCalendar stream contains multiple event or todo objects. The callback function is called after parsing each event or todo. If you return <span style="font-family: Courier New,Courier,monospace">false</span> on the callback function, parsing stops.</p>\r
<pre class="prettyprint">\r
-static bool \r
+static bool\r
_vcalendar_parse_cb(calendar_record_h record, void *user_data)\r
{\r
if (NULL == record)\r
\r
return true;\r
}</pre>\r
- \r
+\r
<script type="text/javascript" src="../../scripts/jquery.zclip.min.js"></script>\r
<script type="text/javascript" src="../../scripts/showhide.js"></script>\r
\r
</script>\r
\r
</body>\r
-</html>
\ No newline at end of file
+</html>\r