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