test
[apps/core/preloaded/calendar.git] / include / cal-svc.h
1 /*
2   *
3   *  Copyright 2012  Samsung Electronics Co., Ltd
4   *
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
8   *
9   *       http://www.tizenopensource.org/license
10   *
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.
16   */
17
18
19 #ifndef __CALENDAR_CAL_SVC_H__
20 #define __CALENDAR_CAL_SVC_H__
21
22 #include <time.h>
23 #include <Elementary.h>
24 #include <calendar-svc-provider.h>
25
26 struct _cs {
27         cal_struct* cs;
28         Evas_Object* check;
29         void* at;
30 };
31
32 typedef struct __cal_account_calendar_color Calendar_color;
33 struct __cal_account_calendar_color
34 {
35         int red;
36         int green;
37         int blue;
38         int alpha;
39 };
40
41 Eina_List *_calendar_svc_get_event_list(struct tm *tm_start, struct tm *tm_end);
42 Eina_List * _calendar_svc_get_task_list(struct tm *tm_start, struct tm *tm_end, int priority, cals_status_t status, cals_todo_list_order_t order);
43 Eina_List *_calendar_svc_event_search(int search_fields, const char *keyword);
44 Eina_List * _calendar_svc_get_all(int account_id, int calendar_id, const char *type);
45 void _calendar_svc_free_cslist(Eina_List **h);
46 int _calendar_svc_get_account_visibility(int account_id);
47 void _calendar_svc_set_account_visibility(int account_id, int value);
48 void _calendar_svc_set_calendar_visibility(cal_struct* cs, int value);
49 int _calendar_svc_get_calendar_visibility(cal_struct* cs);
50 Eina_List* _calendar_svc_find_event(int acct_id, const char *field, const void *val);
51 Eina_List *_calendar_svc_get_calendars(int acct_id);
52 Eina_List *_calendar_svc_get_calendars_with_account(int account_id, void* at);
53 int* _calendar_svc_get_simple_cs(int acct_id, struct tm *start, struct tm *end);
54 void _calendar_svc_set_calendar_color(cal_struct* cs, Calendar_color* color );
55 void _calendar_svc_get_calendar_color(cal_struct* cs, Calendar_color* calendar_color );
56 void _calendar_svc_add_event_changed_callback(void(*callback)(void *), void *user_data);
57 void _calendar_svc_del_event_changed_callback(void(*callback)(void *));
58 void _calendar_svc_add_calendar_changed_callback(const char *type, void(*callback)(void *), void *user_data);
59 void _calendar_svc_del_calendar_changed_callback(const char *type, void(*callback)(void *));
60 Eina_Bool _calendar_svc_is_allday_event(cal_struct *schedule);
61 Eina_List * _calendar_svc_get_allday_list(struct tm *tm_start, struct tm *tm_end);
62
63 #define CALENDAR_SVC_CONNECT() calendar_svc_connect()
64 #define CALENDAR_SVC_DISCONNECT() calendar_svc_close()
65
66 #define CALENDAR_SVC_STRUCT_GET_STR(cs, field) calendar_svc_struct_get_str(cs, field)
67 #define CALENDAR_SVC_STRUCT_GET_INT(cs, field) calendar_svc_struct_get_int(cs, field)
68 #define CALENDAR_SVC_STRUCT_GET_DOUBLE(cs, field) calendar_svc_struct_get_double(cs, field)
69 #define CALENDAR_SVC_STRUCT_GET_LLI(cs, field) calendar_svc_struct_get_lli(cs, field)
70 #define CALENDAR_SVC_STRUCT_GET_LIST(cs, field, list) calendar_svc_struct_get_list(cs, field, list)
71
72 #define CALENDAR_SVC_STRUCT_SET_STR(cs, field, val) calendar_svc_struct_set_str(cs, field, val)
73 #define CALENDAR_SVC_STRUCT_SET_INT(cs, field, val) calendar_svc_struct_set_int(cs, field, val)
74 #define CALENDAR_SVC_STRUCT_SET_DOUBLE(cs, field, val) calendar_svc_struct_set_double(cs, field, val)
75 #define CALENDAR_SVC_STRUCT_SET_LLI(cs, field, val) calendar_svc_struct_set_lli(cs, field, val)
76 #define CALENDAR_SVC_STRUCT_SET_LIST(cs, field, list) calendar_svc_struct_store_list(cs, field, list)
77
78 #define CALENDAR_SVC_STRUCT_FREE(cs) calendar_svc_struct_free(cs)
79 #define CALENDAR_SVC_STRUCT_NEW(type) calendar_svc_struct_new(type)
80
81 #define CALENDAR_SVC_VALUE_GET_STR(cs, field) calendar_svc_value_get_str(cs, field)
82 #define CALENDAR_SVC_VALUE_GET_INT(cs, field) calendar_svc_value_get_int(cs, field)
83 #define CALENDAR_SVC_VALUE_GET_LLI(cs, field, flag) calendar_svc_value_get_lli(cs, field, flag)
84
85 #define CALENDAR_SVC_VALUE_SET_STR(cs, field, val) calendar_svc_value_set_str(cs, field, val)
86 #define CALENDAR_SVC_VALUE_SET_INT(cs, field, val) calendar_svc_value_set_int(cs, field, val)
87 #define CALENDAR_SVC_VALUE_SET_LLI(cs, field, flag, val) calendar_svc_value_set_lli(cs, field, flag, val)
88
89 #define CALENDAR_SVC_VALUE_NEW(field) calendar_svc_value_new(field)
90 #define CALENDAR_SVC_VALUE_FREE(value) calendar_svc_value_free(value)
91
92 #define CALENDAR_SVC_FREE_CS_LIST(list) _calendar_svc_free_cslist(list)
93
94 #define CALENDAR_SVC_SET_CALENDAR_VISIBILITY(cs, visible) _calendar_svc_set_calendar_visibility(cs, visible)
95 #define CALENDAR_SVC_GET_CALENDAR_VIGIBILITY(cs) _calendar_svc_get_calendar_visibility(cs)
96
97 #define CALENDAR_SVC_GET_CALENDARS_WITH_ACCOUNT(account_id, at) _calendar_svc_get_calendars_with_account(account_id, at)
98 #define CALENDAR_SVC_SET_CALENDAR_COLOR(cs, color) _calendar_svc_set_calendar_color(cs, color)
99 #define CALENDAR_SVC_GET_CALENDAR_COLOR(cs, color) _calendar_svc_get_calendar_color(cs, color)
100
101 #define CALENDAR_SVC_ADD_EVENT_CHANGED_CALLBACK(callback, data)_calendar_svc_add_event_changed_callback(callback, data)
102 #define CALENDAR_SVC_ADD_CALENDAR_CHANGED_CALLBACK(type, callback, data) _calendar_svc_add_calendar_changed_callback(type, callback, data)
103
104 #define CALENDAR_SVC_DEL_EVENT_CHANGED_CALLBACK(callback) _calendar_svc_del_event_changed_callback(callback)
105 #define CALENDAR_SVC_DEL_CALENDAR_CHANGED_CALLBACK(type, callback) _calendar_svc_del_calendar_changed_callback(type, callback)
106
107 #define CALENDAR_SVC_INSERT(cs) calendar_svc_insert(cs)
108 #define CALENDAR_SVC_UPDATE(cs) calendar_svc_update(cs)
109 #define CALENDAR_SVC_DELETE(type, index) calendar_svc_delete(type, index)
110 #define CALENDAR_SVC_DELETE_ALL(account_id, type) calendar_svc_delete_all(account_id, type)
111
112 #define CALENDAR_SVC_GET(type, index, field, cs) calendar_svc_get(type, index, field, cs)
113 #define CALENDAR_SVC_GET_ALL(account_id, calendar_id, type) _calendar_svc_get_all(account_id, calendar_id, type)
114 #define CALENDAR_SVC_GET_COUNT(account_id, calendar_id, type) calendar_svc_get_count(account_id, calendar_id, type)
115 #define CALENDAR_SVC_GET_SIMPLE_CS(account_id, start, end) _calendar_svc_get_simple_cs(account_id, start, end)
116
117 #define CALENDAR_SVC_FIND_EVENT(account_id, field, value) _calendar_svc_find_event(account_id, field, value)
118 #define CALENDAR_SVC_FIND_EVENT_LIST(account_id, search_type, search_value, iter) calendar_svc_find_event_list(account_id, search_type, search_value, iter)
119
120 #define CALENDAR_SVC_EVENT_SEARCH(search_fields, keyword) _calendar_svc_event_search(search_fields, keyword)
121 #define CALENDAR_SVC_TODO_SEARCH(search_fields, keyword) _calendar_svc_todo_search(search_fields, keyword)
122
123 #define CALENDAR_SVC_ITER_NEXT(iter) calendar_svc_iter_next(iter)
124 #define CALENDAR_SVC_ITER_GET_INFO(iter, cs) calendar_svc_iter_get_info(iter, cs)
125 #define CALENDAR_SVC_ITER_REMOVE(iter) calendar_svc_iter_remove(iter)
126
127 #define CALENDAR_SVC_READ_SCHEDULES(stream, schedules) calendar_svc_read_schedules(stream, schedules)
128 #define CALENDAR_SVC_WRITE_SCHEDULES(schedules, stream)  calendar_svc_write_schedules(schedules, stream)
129 #define CALENDAR_SVC_CALENDAR_IMPORT(path, calendar_id) calendar_svc_calendar_import(path, calendar_id)
130 #define CALENDAR_SVC_CALENDAR_EXPORT(index, file) calendar_svc_calendar_export(index, file)
131
132 #define CALENDAR_SVC_IS_ALLDAY_EVENT(schedule) _calendar_svc_is_allday_event(schedule)
133
134 #define CALENDAR_SVC_GET_EVENT_LIST(tm_start, tm_end) _calendar_svc_get_event_list(tm_start, tm_end)
135 #define CALENDAR_SVC_GET_NORMAL_EVENT_LIST(tm_start, tm_end)_calendar_svc_get_normal_list(tm_start, tm_end)
136 #define CALENDAR_SVC_GET_ALLDAY_EVENT_LIST(tm_start, tm_end)_calendar_svc_get_allday_list(tm_start, tm_end)
137
138 #define CALENDAR_SVC_GET_TASK_LIST(tm_start, tm_end, priority, status, order) _calendar_svc_get_task_list(tm_start, tm_end, priority, status, order)
139
140 #endif /* __CALENDAR_CAL_SVC_H__ */
141