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://www.tizenopensource.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_H__
20 #define __CALENDAR_H__
22 #include <Elementary.h>
23 #include <contacts-svc.h>
24 #include <ui-gadget.h>
28 #include "cld-utils.h"
30 #define CAL_QUICKADD_LONG_PRESS_TIME 0.5
32 #if !defined(CALENDAR_RING)
33 #define CALENDAR_RING "calendar-ring"
37 #define API __attribute__ ((visibility("default")))
40 #if !defined(CALENDAR_PACKAGE)
41 # define CALENDAR_PACKAGE "calendar"
45 # define RESDIR "/opt/apps/org.tizen."CALENDAR_PACKAGE"/res/"
48 #if !defined(LOCALEDIR)
49 # define LOCALEDIR "/opt/apps/org.tizen."CALENDAR_PACKAGE"/res/locale"
52 #if !defined(VCALENDAR_DATA_LEN)
53 #define VCALENDAR_DATA_LEN 3000
56 #if !defined(EMAIL_LINK_FLAG)
57 #define EMAIL_LINK_FLAG "#email_viewer_link#"
60 #define CAL_CBAR_ICON_DELETE RESDIR"/icons/T01_controlbar_icon_delete.png"
61 #define CAL_CBAR_ICON_CREAT RESDIR"/icons/01_controlbar_icon_create.png"
62 #define CAL_CBAR_ICON_SHARE RESDIR"/icons/T01_controlbar_icon_share02.png"
63 #define CAL_CBAR_ICON_EDIT RESDIR"/icons/T01_controlbar_icon_edit.png"
64 #define CAL_CBAR_ICON_TODAY RESDIR"/icons/01_controlbar_icon_today.png"
65 #define CAL_CBAR_ICON_VIEW RESDIR"/icons/01_controlbar_icon_View.png"
66 #define CAL_CBAR_ICON_CALENDARS RESDIR"/icons/01_controlbar_icon_calendars.png"
67 #define CAL_EVENT_LIST_ICON_ALARM RESDIR"/icons/P01_event_list_icon_alarm.png"
68 #define CAL_EVENT_LIST_ICON_PRIORITY RESDIR"/icons/P01_event_list_icon_priority.png"
69 #define CAL_EVENT_LIST_ICON_REPEAT RESDIR"/icons/P01_event_list_icon_reapeat.png"
70 #define CAL_EVENT_LIST_ICON_REMINDER RESDIR"/icons/P01_event_list_icon_reminder.png"
71 #define CAL_EVENT_LIST_ICON_FACEBOOK RESDIR"/icons/P01_event_list_icon_facebook.png"
72 #define CAL_TASK_EVENT_HIGH_ICON RESDIR"/icons/P01_Task_event.png"
73 #define CAL_TASK_EVENT_UNCOMPLETED_ICON RESDIR"/icons/P01_Task_event_completion.png"
74 #define CAL_TASK_EVENT_COMPLETED_ICON RESDIR"/icons/P01_Task_event_completion_press.png"
76 #define CAL_APPCONTROL_ITEM_TYPE "itemType"
77 #define CAL_APPCONTROL_ITEM_TYPE_EVENT "event"
78 #define CAL_APPCONTROL_ITEM_TYPE_TODO "todo"
79 #define CAL_APPCONTROL_ITEM_TYPE_VCS "vcs"
80 #define CAL_APPCONTROL_EVENT_ID "eventId"
81 #define CAL_APPCONTROL_TODO_ID "todoId"
82 #define CAL_APPCONTROL_VCS_PATH "path"
97 typedef enum ug_type {
105 ITEM_TYPE_UNKNOWN = 0,
110 }cal_appcontrol_item_type;
116 const Evas_Object *entry; //for title
119 Evas_Object *start_time;
120 Evas_Object *end_time;
121 Ecore_Timer *hold_timer;
140 Eina_Bool is_deleted;
143 typedef struct appdata
145 Evas_Object *win; //window
146 Evas_Coord win_w; //width of window
147 Evas_Coord win_h; //height of window
148 Evas_Object *base; //base layout
149 Evas_Object *nv; //naviframe
150 Evas_Object *title; //title
151 Evas_Object *main; //main view( has year, month, day, list tabs)
152 Evas_Object *bg; //background
153 Evas_Object *cbar; //coontrol bar(calendar,today,delete,create)
155 Elm_Object_Item* main_navi_item; //Naviframe item for main layout.
157 enum cld_view request_view; //initial or requested view to show, when app is relaunched,
158 enum cld_view current_view;
160 Eina_Bool is_update_view; //only update when it is needed
161 Eina_Bool is_pause; //prevent updating view during app pause state
163 struct tm base_tm; //base time
164 int base_hour; // This can be replace to base_tm.tm_hour
165 struct tm today_tm; //today time
166 Ecore_Timer *today_tmr; //to update today when day is changed.
167 Evas_Object *today_edj; //edj for content of month tab, Need to change name to calendar_edj.
169 int wday_start; //0~6, since sunday
171 int cid; //calendar id. for detail, edit view
172 struct tm tm_start; //for detail, edit view
173 struct tm tm_end; //for detail, edit view
175 int acct_id; //this variable always have ALL_VISIBLE_ACCOUT == -2
177 Elm_Object_Item *bt_new; //button for "Create event" in controlbar
178 Elm_Object_Item *bt_delete; //button for "Delete" in controlbar
179 Elm_Object_Item *bt_view; //button for "View" in controlbar
180 Elm_Object_Item *bt_today; //button for "Today" in controlbar
181 Elm_Object_Item *today_item; // scroll to top item of today in list view.
182 cals_todo_list_order_t todo_sort_type;
184 int notifd; //for heynoti
186 Eina_Bool is_aul; //to check wheather launching with AUL
187 Elm_Object_Item* content; //pop all aul content & jump to calendar content.
189 Eina_Bool edit_special_one; //to remove this, cal_edit_create_view should have 1 more parameter.
190 Eina_Bool is_weekly; //check whethere monthly tab is for weekly or not.
192 ui_gadget_h ug; //can access to ui_gadget* from ug_data
193 ug_type u_type; //ug type
194 cal_appcontrol_item_type item_type; //request item type for appcontrol
195 cal_struct* ical; //for vcard raw data used in calendar viewer.
197 int tm_year; //It would be better, if these are changed to struct tm. to save event with specific time
198 int tm_mon; //It would be better, if these are changed to struct tm. to save event with specific time
199 int tm_mday; //It would be better, if these are changed to struct tm. to save event with specific time
201 char *strnote; //to save str from memo
202 Eina_Bool show_save_popup; //to show save popup when edit UG is destroyed
203 int is_hour24; //to show time as 12 or 24 format
205 Elm_Theme *theme; //theme customization
207 int account_id; //for email sharing feature
208 int mail_id; //for email sharing feature
209 char *src_box; //for email sharing feature
213 Eina_Bool is_display_complete_todo;
215 int is_display_weeknumber;
217 Eina_Bool is_landscape_mode;
219 int calendar_facebook_id;
222 static inline void cal_main_set_cs(struct appdata *ad, cal_struct *cs)
227 ad->cid = CALENDAR_SVC_STRUCT_GET_INT(cs, CAL_VALUE_INT_INDEX);
229 if (CALENDAR_SVC_IS_ALLDAY_EVENT(cs)) {
231 ad->tm_start.tm_year = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTSTART_YEAR) - 1900;
232 ad->tm_start.tm_mon = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTSTART_MONTH) - 1;
233 ad->tm_start.tm_mday = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTSTART_MDAY);
235 ad->tm_end.tm_year = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTEND_YEAR) - 1900;
236 ad->tm_end.tm_mon = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTEND_MONTH) - 1;
237 ad->tm_end.tm_mday = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTEND_MDAY);
241 cal_util_convert_lli_to_tm(NULL, CALENDAR_SVC_STRUCT_GET_LLI(cs, CALS_VALUE_LLI_DTSTART_UTIME), &ad->tm_start);
242 cal_util_convert_lli_to_tm(NULL, CALENDAR_SVC_STRUCT_GET_LLI(cs, CALS_VALUE_LLI_DTEND_UTIME), &ad->tm_end);
246 static inline void cal_main_set_cs_tm(struct tm *tm, cal_struct *cs)
251 if (CALENDAR_SVC_IS_ALLDAY_EVENT(cs)) {
252 tm->tm_year = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTSTART_YEAR) - 1900;
253 tm->tm_mon = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTSTART_MONTH) - 1;
254 tm->tm_mday = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTSTART_MDAY);
257 cal_util_convert_lli_to_tm(NULL, CALENDAR_SVC_STRUCT_GET_LLI(cs, CALS_VALUE_LLI_DTSTART_UTIME), tm);
261 #endif /* __CALENDAR_H__ */