3 * Copyright 2012 Samsung Electronics Co., Ltd
5 * Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
19 #ifndef __CALENDAR_CAL_SVC_H__
20 #define __CALENDAR_CAL_SVC_H__
24 #include <Elementary.h>
26 #define _CALENDAR_ALL_ACCOUNT_ID 0
27 #define _CALENDAR_LOCAL_ACCOUNT_ID -1
29 #define CAL_REPEAT_EVERY_2_WEEK (CALENDAR_RECURRENCE_YEARLY+100)
30 #define CAL_REPEAT_EVERY_3_DAY (CAL_REPEAT_EVERY_2_WEEK+1)
32 #define CAL_GRID_ITEM_KEY_SNOTE "snote"
33 #define CAL_GRID_ITEM_KEY_PHOTO "photo"
34 #define CAL_EXTENDED_KEY_TIMEZONE_CITY "city"
36 #define _calendar_show_error(error) \
39 case CALENDAR_ERROR_OUT_OF_MEMORY: \
40 ERR("CALENDAR_ERROR_OUT_OF_MEMORY"); \
42 case CALENDAR_ERROR_INVALID_PARAMETER: \
43 ERR("CALENDAR_ERROR_INVALID_PARAMETER"); \
45 case CALENDAR_ERROR_NO_DATA: \
46 ERR("CALENDAR_ERROR_NO_DATA"); \
48 case CALENDAR_ERROR_DB_RECORD_NOT_FOUND: \
49 ERR("CALENDAR_ERROR_DB_RECORD_NOT_FOUND"); \
51 case CALENDAR_ERROR_ITERATOR_END: \
52 ERR("CALENDAR_ERROR_ITERATOR_END"); \
54 case CALENDAR_ERROR_NOW_IN_PROGRESS: \
55 ERR("CALENDAR_ERROR_NOW_IN_PROGRESS"); \
57 case CALENDAR_ERROR_ALREADY_IN_PROGRESS: \
58 ERR("CALENDAR_ERROR_ALREADY_IN_PROGRESS"); \
60 case CALENDAR_ERROR_NOT_PERMITTED: \
61 ERR("CALENDAR_ERROR_NOT_PERMITTED"); \
63 case CALENDAR_ERROR_DB_FAILED: \
64 ERR("CALENDAR_ERROR_DB_FAILED"); \
66 case CALENDAR_ERROR_IPC: \
67 ERR("CALENDAR_ERROR_IPC"); \
69 case CALENDAR_ERROR_NONE: \
72 ERR("Unknown error!!!"); \
82 } _calendar_book_color;
85 _CALENDAR_RECORD_TYPE_CALENDARBOOK,
86 _CALENDAR_RECORD_TYPE_EVENT,
87 _CALENDAR_RECORD_TYPE_TODO,
88 _CALENDAR_RECORD_TYPE_TIMEZONE,
89 _CALENDAR_RECORD_TYPE_ATTENDEE,
90 _CALENDAR_RECORD_TYPE_ALARM,
91 _CALENDAR_RECORD_TYPE_UPDATED_INFO,
92 _CALENDAR_RECORD_TYPE_SEARCH_EVENT_CALENDAR,
93 _CALENDAR_RECORD_TYPE_SEARCH_TODO_CALENDAR,
94 _CALENDAR_RECORD_TYPE_SEARCH_EVENT_CALENDAR_ATTENDEE,
95 _CALENDAR_RECORD_TYPE_SEARCH_INSTANCE_NORMAL_CALENDAR,
96 _CALENDAR_RECORD_TYPE_SEARCH_INSTANCE_ALLDAY_CALENDAR,
97 _CALENDAR_RECORD_TYPE_EXTENDED_PROPERTY,
98 _CALENDAR_RECORD_TYPE_MAX,
99 }_calendar_record_type;
102 _CALENDAR_TASK_SORT_TYPE_NONE,
103 _CALENDAR_TASK_SORT_TYPE_DUEDATE_ASC,
104 _CALENDAR_TASK_SORT_TYPE_DUEDATE_DES,
105 _CALENDAR_TASK_SORT_TYPE_PRIORITY_ASC,
106 _CALENDAR_TASK_SORT_TYPE_PRIORITY_DES,
107 _CALENDAR_TASK_SORT_TYPE_STATUS_ASC,
108 _CALENDAR_TASK_SORT_TYPE_STATUS_DES,
109 _CALENDAR_TASK_SORT_TYPE_MAX,
110 }_calendar_task_sort_type;
112 void _calendar_init_hash();
114 int * _calendar_get_month(struct tm *start, struct tm *end, int is_display_completed_todo);
116 Eina_List * _calendar_get_normal_instance_list(struct tm *start, struct tm *end);
117 Eina_List * _calendar_get_allday_instance_list(struct tm *start, struct tm *end);
118 Eina_List * _calendar_get_all_instance_list(struct tm *start, struct tm *end);
119 Eina_List * _calendar_get_all_record_list(void);
120 Eina_List * _calendar_get_due_date_task_list(struct tm *start, struct tm *end, Eina_Bool is_completed_todo, _calendar_task_sort_type sort_type);
121 Eina_List * _calendar_get_calendar_book_list_with_account_id(int account_id);
123 void _calendar_free_record_list(Eina_List **record_list);
125 calendar_list_h _calendar_get_normal_instance_list_handler(struct tm *start, struct tm *end);
126 calendar_list_h _calendar_get_allday_instance_list_handler(struct tm *start, struct tm *end);
127 calendar_list_h _calendar_get_all_task_list(struct tm *start, struct tm *end, Eina_Bool is_show_completed_task, _calendar_task_sort_type sort_type);
128 Eina_List* _calendar_get_all_task_list2(struct tm *start, struct tm *end, Eina_Bool is_show_completed_task, _calendar_task_sort_type sort_type);
129 calendar_list_h _calendar_get_task_list_handler(struct tm *start, struct tm *end, Eina_Bool is_show_completed_task, _calendar_task_sort_type sort_type);
130 calendar_list_h _calendar_search_event(const char *keyword);
131 calendar_list_h _calendar_search_task(const char *keyword);
133 _calendar_record_type _calendar_get_record_type(calendar_record_h record);
135 Eina_Bool _calendar_is_task_record(calendar_record_h record);
136 Eina_Bool _calendar_is_allday_record(calendar_record_h record);
137 Eina_Bool _calendar_is_recurrent_record(calendar_record_h record);
138 Eina_Bool _calendar_has_reminder(calendar_record_h record);
139 Eina_Bool _calendar_is_eas_record(calendar_record_h record);
140 Eina_Bool _calendar_is_facebook_record(calendar_record_h record);
142 char* _calendar_get_summary(calendar_record_h record);
143 char* _calendar_get_location(calendar_record_h record);
145 int _calendar_get_record_index(calendar_record_h record);
146 int _calendar_get_calendar_index(calendar_record_h record);
147 int _calendar_get_account_id(calendar_record_h record);
148 char * _calendar_get_calendar_name(calendar_record_h record);
149 void _calendar_get_calendar_color(calendar_record_h record, _calendar_book_color* calendar_color);
151 void _calendar_get_start_time(calendar_record_h record, calendar_time_s *start_time);
152 void _calendar_get_end_time(calendar_record_h record, calendar_time_s *end_time);
153 void _calendar_set_start_time(calendar_record_h record, calendar_time_s *start_time);
154 void _calendar_set_end_time(calendar_record_h record, calendar_time_s *end_time);
155 char * _calendar_get_time_str(calendar_time_s *time, const char *date_format, const char *time_format);
156 char * _calendar_get_time_str_for_genlist(calendar_record_h record);
157 void _calendar_convert_calendar_time_to_tm(calendar_time_s *time, struct tm *tm);
159 void _calendar_delete_record_with_index(int index);
160 void _calendar_delete_record(calendar_record_h record);
162 void _calendar_delete_recurrence_instance(calendar_record_h instance);
163 void _calendar_edit_recurrence_instance(calendar_record_h exception_record, int original_event_id);
165 void _calendar_clear_child_record(calendar_record_h record, unsigned int property_id);
167 calendar_record_h _calendar_get_record_with_index(int index);
168 calendar_record_h _calendar_get_instance_from_record(calendar_record_h record, struct tm *start, struct tm *end);
170 void _calendar_export_record_to_vcs(calendar_record_h record, const char *file_path);
172 void _calendar_get_recurrence_frequency_str(int freq, char *buf, int size);
174 void _calendar_set_coordinates(calendar_record_h record, double latitude, double longitude);
175 void _calendar_get_coordinates(calendar_record_h record, double *latitude, double *longitude);
177 void _calendar_set_timezone_city(calendar_record_h record, const char *city);
178 char * _calendar_get_timezone_city(calendar_record_h record);
179 Eina_Bool _calendar_is_event_or_task(calendar_record_h record);
180 #endif /* __CALENDAR_CAL_SVC_H__ */