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"
35 #define _calendar_show_error(error) \
38 case CALENDAR_ERROR_OUT_OF_MEMORY: \
39 ERR("CALENDAR_ERROR_OUT_OF_MEMORY"); \
41 case CALENDAR_ERROR_INVALID_PARAMETER: \
42 ERR("CALENDAR_ERROR_INVALID_PARAMETER"); \
44 case CALENDAR_ERROR_NO_DATA: \
45 ERR("CALENDAR_ERROR_NO_DATA"); \
47 case CALENDAR_ERROR_DB_RECORD_NOT_FOUND: \
48 ERR("CALENDAR_ERROR_DB_RECORD_NOT_FOUND"); \
50 case CALENDAR_ERROR_ITERATOR_END: \
51 ERR("CALENDAR_ERROR_ITERATOR_END"); \
53 case CALENDAR_ERROR_NOW_IN_PROGRESS: \
54 ERR("CALENDAR_ERROR_NOW_IN_PROGRESS"); \
56 case CALENDAR_ERROR_ALREADY_IN_PROGRESS: \
57 ERR("CALENDAR_ERROR_ALREADY_IN_PROGRESS"); \
59 case CALENDAR_ERROR_NOT_PERMITTED: \
60 ERR("CALENDAR_ERROR_NOT_PERMITTED"); \
62 case CALENDAR_ERROR_DB_FAILED: \
63 ERR("CALENDAR_ERROR_DB_FAILED"); \
65 case CALENDAR_ERROR_IPC: \
66 ERR("CALENDAR_ERROR_IPC"); \
68 case CALENDAR_ERROR_NONE: \
71 ERR("Unknown error!!!"); \
81 } _calendar_book_color;
84 _CALENDAR_RECORD_TYPE_CALENDARBOOK,
85 _CALENDAR_RECORD_TYPE_EVENT,
86 _CALENDAR_RECORD_TYPE_TODO,
87 _CALENDAR_RECORD_TYPE_TIMEZONE,
88 _CALENDAR_RECORD_TYPE_ATTENDEE,
89 _CALENDAR_RECORD_TYPE_ALARM,
90 _CALENDAR_RECORD_TYPE_UPDATED_INFO,
91 _CALENDAR_RECORD_TYPE_SEARCH_EVENT_CALENDAR,
92 _CALENDAR_RECORD_TYPE_SEARCH_TODO_CALENDAR,
93 _CALENDAR_RECORD_TYPE_SEARCH_EVENT_CALENDAR_ATTENDEE,
94 _CALENDAR_RECORD_TYPE_SEARCH_INSTANCE_NORMAL_CALENDAR,
95 _CALENDAR_RECORD_TYPE_SEARCH_INSTANCE_ALLDAY_CALENDAR,
96 _CALENDAR_RECORD_TYPE_EXTENDED_PROPERTY,
97 _CALENDAR_RECORD_TYPE_MAX,
98 }_calendar_record_type;
101 _CALENDAR_TASK_SORT_TYPE_NONE,
102 _CALENDAR_TASK_SORT_TYPE_DUEDATE_ASC,
103 _CALENDAR_TASK_SORT_TYPE_DUEDATE_DES,
104 _CALENDAR_TASK_SORT_TYPE_PRIORITY_ASC,
105 _CALENDAR_TASK_SORT_TYPE_PRIORITY_DES,
106 _CALENDAR_TASK_SORT_TYPE_STATUS_ASC,
107 _CALENDAR_TASK_SORT_TYPE_STATUS_DES,
108 _CALENDAR_TASK_SORT_TYPE_MAX,
109 }_calendar_task_sort_type;
111 void _calendar_init_hash();
113 int * _calendar_get_month(struct tm *start, struct tm *end, int is_display_completed_todo);
115 Eina_List * _calendar_get_normal_instance_list(struct tm *start, struct tm *end);
116 Eina_List * _calendar_get_allday_instance_list(struct tm *start, struct tm *end);
117 Eina_List * _calendar_get_all_instance_list(struct tm *start, struct tm *end);
118 Eina_List * _calendar_get_all_record_list(void);
119 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);
120 Eina_List * _calendar_get_calendar_book_list_with_account_id(int account_id);
122 void _calendar_free_record_list(Eina_List **record_list);
124 calendar_list_h _calendar_get_normal_instance_list_handler(struct tm *start, struct tm *end);
125 calendar_list_h _calendar_get_allday_instance_list_handler(struct tm *start, struct tm *end);
126 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);
127 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);
128 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);
129 calendar_list_h _calendar_search_event(const char *keyword);
130 calendar_list_h _calendar_search_task(const char *keyword);
132 _calendar_record_type _calendar_get_record_type(calendar_record_h record);
134 Eina_Bool _calendar_is_task_record(calendar_record_h record);
135 Eina_Bool _calendar_is_allday_record(calendar_record_h record);
136 Eina_Bool _calendar_is_recurrent_record(calendar_record_h record);
137 Eina_Bool _calendar_has_reminder(calendar_record_h record);
138 Eina_Bool _calendar_is_eas_record(calendar_record_h record);
139 Eina_Bool _calendar_is_facebook_record(calendar_record_h record);
141 char* _calendar_get_summary(calendar_record_h record);
142 char* _calendar_get_location(calendar_record_h record);
144 int _calendar_get_record_index(calendar_record_h record);
145 int _calendar_get_calendar_index(calendar_record_h record);
146 int _calendar_get_account_id(calendar_record_h record);
147 char * _calendar_get_calendar_name(calendar_record_h record);
148 void _calendar_get_calendar_color(calendar_record_h record, _calendar_book_color* calendar_color);
150 void _calendar_get_start_time(calendar_record_h record, calendar_time_s *start_time);
151 void _calendar_get_end_time(calendar_record_h record, calendar_time_s *end_time);
152 void _calendar_set_start_time(calendar_record_h record, calendar_time_s *start_time);
153 void _calendar_set_end_time(calendar_record_h record, calendar_time_s *end_time);
154 char * _calendar_get_time_str(calendar_time_s *time, const char *date_format, const char *time_format);
155 char * _calendar_get_time_str_for_genlist(calendar_record_h record);
156 void _calendar_convert_calendar_time_to_tm(calendar_time_s *time, struct tm *tm);
158 void _calendar_delete_record_with_index(int index);
159 void _calendar_delete_record(calendar_record_h record);
161 void _calendar_delete_recurrence_instance(calendar_record_h instance);
162 void _calendar_edit_recurrence_instance(calendar_record_h exception_record, int original_event_id);
164 void _calendar_clear_child_record(calendar_record_h record, unsigned int property_id);
166 calendar_record_h _calendar_get_record_with_index(int index);
167 calendar_record_h _calendar_get_instance_from_record(calendar_record_h record, struct tm *start, struct tm *end);
169 void _calendar_export_record_to_vcs(calendar_record_h record, const char *file_path);
171 void _calendar_get_recurrence_frequency_str(int freq, char *buf, int size);
173 void _calendar_set_coordinates(calendar_record_h record, double latitude, double longitude);
174 void _calendar_get_coordinates(calendar_record_h record, double *latitude, double *longitude);
176 #endif /* __CALENDAR_CAL_SVC_H__ */