ab070a34e23067dfc23e5df731c61382ba0264d9
[apps/core/preloaded/calendar.git] / include / cld.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://floralicense.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_H__
20 #define __CALENDAR_H__
21
22 #include <Elementary.h>
23 #include <contacts.h>
24 #include <calendar2.h>
25 #include <ui-gadget.h>
26
27 #include "cal-svc.h"
28
29 #include "cld-log.h"
30 #include "cld-utils.h"
31
32 #define CAL_QUICKADD_LONG_PRESS_TIME 0.5
33
34 #if !defined(CALENDAR_RING)
35 #define CALENDAR_RING "calendar-ring"
36 #endif
37
38 #ifndef API
39 #define API __attribute__ ((visibility("default")))
40 #endif
41
42 #if !defined(CALENDAR)
43 #  define CALENDAR "calendar"
44 #endif
45
46 #if !defined(VENDOR)
47 # define VENDOR "org.tizen"
48 #endif
49
50 #if !defined(CALENDAR_PACKAGE)
51 #  define CALENDAR_PACKAGE VENDOR"."CALENDAR
52 #endif
53
54 #if !defined(RESDIR)
55 #  define RESDIR "/usr/apps/"CALENDAR_PACKAGE"/res/"
56 #endif
57
58 #if !defined(LOCALEDIR)
59 #  define LOCALEDIR "/usr/apps/"CALENDAR_PACKAGE"/res/locale"
60 #endif
61
62 #if !defined(VCALENDAR_DATA_LEN)
63 #define VCALENDAR_DATA_LEN 3000
64 #endif
65
66 #if !defined(EMAIL_LINK_FLAG)
67 #define EMAIL_LINK_FLAG "#email_viewer_link#"
68 #endif
69
70 #define CAL_APPCONTROL_ITEM_TYPE "itemType"
71 #define CAL_APPCONTROL_ITEM_TYPE_EVENT "event"
72 #define CAL_APPCONTROL_ITEM_TYPE_TODO "todo"
73 #define CAL_APPCONTROL_ITEM_TYPE_VCS "vcs"
74 #define CAL_APPCONTROL_EVENT_ID "eventId"
75 #define CAL_APPCONTROL_TODO_ID "todoId"
76 #define CAL_APPCONTROL_VCS_PATH "path"
77
78 #define CAL_APPSVC_PARAM_CALLER "caller"
79 #define CAL_APPSVC_PARAM_COUNT "count"
80 #define CAL_APPSVC_PARAM_TYPE "type"
81 #define CAL_APPSVC_PARAM_INDEX "index"
82 #define CAL_APPSVC_PARAM_REMINDER_ID "calendar-service/id"
83 #define CAL_APPSVC_PARAM_LOCATION_REMINDER "location_reminder"
84
85 enum cld_view {
86         CV_UNKNOWN = 0,
87         CV_YEAR,
88         CV_MONTH,
89         CV_WEEK,
90         CV_DAY,
91         CV_LIST,
92         CV_TODO,
93         CV_EDIT,
94         CV_DETAIL,
95         CV_NOTI,
96         CV_DELETE,
97         CV_SEARCH,
98         CV_ACCT,
99 };
100
101 typedef enum ug_type {
102         UG_UNKNOWN = 0,
103         UG_DETAIL,
104         UG_EDIT,
105         UG_MAX,
106 }ug_type;
107
108 typedef enum {
109         ITEM_TYPE_UNKNOWN = 0,
110         ITEM_TYPE_EVENT,
111         ITEM_TYPE_TODO,
112         ITEM_TYPE_VCS,
113         ITEM_TYPE_MAX
114 }cal_appcontrol_item_type;
115
116 typedef struct {
117         struct tm stm;
118         struct tm etm;
119         struct appdata *ad;
120         Evas_Object *ly; //content
121         char *stitle;
122         Evas_Object *entry; //for title
123         bool is_hold_press;
124         Evas_Object *title;
125         Evas_Object *start_time;
126         Evas_Object *end_time;
127         Ecore_Timer *hold_timer;
128         Evas_Object *popup;
129         Evas_Object *segment;
130         Elm_Object_Item *event_item;
131         Elm_Object_Item *task_item;
132         Eina_Bool is_task_selected;
133         Evas_Object *genlist;
134 }cal_quick_add;
135
136 typedef struct
137 {
138         int person_id;
139         char *image;
140         char *name;
141
142         char *email;
143         int email_id;
144
145         char *number;
146
147         int status;
148         int role;
149         int response;
150
151         Eina_Bool is_deleted;
152 }cal_participant;
153
154 typedef struct appdata
155 {
156         Evas_Object *win;                       //window
157         Evas_Coord win_w;                               //width of window
158         Evas_Coord win_h;                                       //height of window
159         Evas_Object *conform;                   //conformants
160         Evas_Object *base;                      //base layout
161         Evas_Object *naviframe;                         //naviframe
162         Evas_Object *title;                     //title
163         Evas_Object *main;                      //main view( has year, month, day, list tabs)
164         Evas_Object *bg;                                //background
165         Evas_Object *cbar;              //coontrol bar(calendar,today,delete,create)
166
167         Elm_Object_Item* main_navi_item;        //Naviframe item for main layout.
168
169         enum cld_view previous_tab;
170         enum cld_view current_tab;
171
172         enum cld_view request_view;     //initial or requested view to show, when app is relaunched,
173         enum cld_view current_view;
174         enum cld_view tapbar_focus_view;// only be CV_YEAR, CV_MONTH, CV_WEEK,CV_DAY,CV_LIST,CV_TODO.
175
176         Eina_Bool is_update_view;       //only update when it is needed
177         Eina_Bool is_pause;                     //prevent updating view during app pause state
178
179         struct tm base_tm;              //base time
180         int base_hour;                  // This can be replace to base_tm.tm_hour
181         struct tm today_tm;             //today time
182         Ecore_Timer *today_tmr;         //to update today when day is changed.
183         Evas_Object *today_edj;         //edj for content of month tab, Need to change name to calendar_edj.
184
185         int wday_start;                 //0~6, since sunday
186
187         int cid;                                        //calendar id. for detail, edit view
188         struct tm tm_start;             //for detail, edit view
189         struct tm tm_end;                       //for detail, edit view
190
191         int acct_id;                            //this variable always have ALL_VISIBLE_ACCOUT == -2
192
193         Evas_Object *new_event_button;  //button for "Create event"
194         Evas_Object *new_task_button;
195         Elm_Object_Item *bt_delete; //button for "Delete" in controlbar
196         Elm_Object_Item *bt_view; //button for "View" in controlbar
197         Elm_Object_Item *bt_search; //button for "Search" in controlbar
198         Elm_Object_Item *today_item;    // scroll to top item of today in list view.
199
200         Eina_Bool is_aul;                       //to check wheather launching with AUL
201         Elm_Object_Item* content;               //pop all aul content & jump to calendar content.
202
203         Eina_Bool daily_events_mode;                    //check whethere monthly tab is for weekly or not.
204
205         ui_gadget_h ug;         //can access to ui_gadget* from ug_data
206         ug_type u_type;                 //ug type
207         cal_appcontrol_item_type item_type;                     //request item type for appcontrol
208         calendar_record_h vcalendar;                            //for vcard raw data used in calendar viewer.
209
210         int tm_year;                            //It would be better, if these are changed to struct tm. to save event with specific time
211         int tm_mon;                             //It would be better, if these are changed to struct tm. to save event with specific time
212         int tm_mday;                            //It would be better, if these are changed to struct tm. to save event with specific time
213
214         char *strnote;                  //to save str  from memo
215         Eina_Bool show_save_popup;      //to show save popup when edit UG is destroyed
216
217         Elm_Theme *theme;               //theme customization
218
219         int account_id;                 //for email sharing feature
220         int mail_id;                            //for email sharing feature
221         char *src_box;                  //for email sharing feature
222
223         Eina_Bool is_magnifying;
224         Eina_Bool is_contracted;
225
226         Evas_Coord h_cur;
227
228         Eina_Bool is_display_complete_todo;
229
230         int is_display_weeknumber;
231
232         Eina_Bool is_landscape_mode;
233
234         Evas_Object *navi_title;
235
236         Eina_Bool need_to_show_popup;           // to keep popup for rotating
237
238 }ug_data;
239
240 int is_hour24;
241
242 #endif /* __CALENDAR_H__ */