merge with master
[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 #include <status.h>
27
28 #include "cal-svc.h"
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         app_device_orientation_e orientation;           // direction of device
160         Evas_Object *conform;                   //conformants
161         Evas_Object *base;                      //base layout
162         Evas_Object *naviframe;                         //naviframe
163         Evas_Object *title;                     //title
164         Evas_Object *main;                      //main view( has year, month, day, list tabs)
165         Evas_Object *bg;                                //background
166         Evas_Object *cbar;              //coontrol bar(calendar,today,delete,create)
167
168         Elm_Object_Item* main_navi_item;        //Naviframe item for main layout.
169
170         enum cld_view previous_tab;
171         enum cld_view current_tab;
172
173         enum cld_view request_view;     //initial or requested view to show, when app is relaunched,
174         enum cld_view current_view;
175         enum cld_view tapbar_focus_view;// only be CV_YEAR, CV_MONTH, CV_WEEK,CV_DAY,CV_LIST,CV_TODO.
176
177         Eina_Bool is_update_view;       //only update when it is needed
178         Eina_Bool is_pause;                     //prevent updating view during app pause state
179
180         struct tm base_tm;              //base time
181         int base_hour;                  // This can be replace to base_tm.tm_hour
182         struct tm today_tm;             //today time
183         Ecore_Timer *today_tmr;         //to update today when day is changed.
184         Evas_Object *today_edj;         //edj for content of month tab, Need to change name to calendar_edj.
185
186         int wday_start;                 //0~6, since sunday
187
188         int cid;                                        //calendar id. for detail, edit view
189         struct tm tm_start;             //for detail, edit view
190         struct tm tm_end;                       //for detail, edit view
191
192         int acct_id;                            //this variable always have ALL_VISIBLE_ACCOUT == -2
193
194         Evas_Object *new_event_button;  //button for "Create event"
195         Evas_Object *new_task_button;
196         Elm_Object_Item *bt_delete; //button for "Delete" in controlbar
197         Elm_Object_Item *bt_view; //button for "View" in controlbar
198         Elm_Object_Item *bt_search; //button for "Search" in controlbar
199         Elm_Object_Item *today_item;    // scroll to top item of today in list view.
200
201         Eina_Bool is_aul;                       //to check wheather launching with AUL
202         Elm_Object_Item* content;               //pop all aul content & jump to calendar content.
203
204         Eina_Bool daily_events_mode;                    //check whethere monthly tab is for weekly or not.
205
206         ui_gadget_h ug;         //can access to ui_gadget* from ug_data
207         ug_type u_type;                 //ug type
208         cal_appcontrol_item_type item_type;                     //request item type for appcontrol
209         calendar_record_h vcalendar;                            //for vcard raw data used in calendar viewer.
210
211         int tm_year;                            //It would be better, if these are changed to struct tm. to save event with specific time
212         int tm_mon;                             //It would be better, if these are changed to struct tm. to save event with specific time
213         int tm_mday;                            //It would be better, if these are changed to struct tm. to save event with specific time
214
215         char *strnote;                  //to save str  from memo
216         Eina_Bool show_save_popup;      //to show save popup when edit UG is destroyed
217
218         Elm_Theme *theme;               //theme customization
219
220         int account_id;                 //for email sharing feature
221         int mail_id;                            //for email sharing feature
222         char *src_box;                  //for email sharing feature
223
224         Eina_Bool is_magnifying;
225         Eina_Bool is_contracted;
226
227         Evas_Coord h_cur;
228
229         Eina_Bool is_display_complete_todo;
230
231         int is_display_weeknumber;
232
233         Eina_Bool is_landscape_mode;
234
235         Evas_Object *navi_title;
236
237         Eina_Bool need_to_show_popup;           // to keep popup for rotating
238
239 }ug_data;
240
241 int is_hour24;
242
243 #endif /* __CALENDAR_H__ */