fix build break
[apps/core/preloaded/email.git] / viewer / include / email-viewer.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *    http://www.tizenopensource.org/license
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef _DEF_email_viewer_H_
18 #define _DEF_email_viewer_H_
19
20 #include <Elementary.h>
21 #include <libintl.h>
22 #include <appcore-efl.h>
23 #undef _
24 #include <ui-gadget-module.h>
25 #include <Evas.h>
26 #include <Ecore_X.h>
27 #include <Edje.h>
28 #include <Eina.h>
29 #include <stdio.h>
30 #include <string.h>
31 #include <stdlib.h>
32 #include <unistd.h>
33 #include <time.h>
34 #include <E_DBus.h>
35 #include <sysman.h>
36 #include <aul.h>
37 #include <db-util.h>
38 #include <vconf.h>
39 #include <vconf-keys.h>
40 #include <glib.h>
41 #include <glib-object.h>
42 #include <EWebKit2.h>
43
44 #include "email-viewer-logic.h"
45 #include <contacts-svc.h>
46 #include "email-utils.h"
47 #include "email-locale.h"
48
49 #define VIEWER_PACKAGE "email-viewer"
50 #define EV_THEME_PATH EDJDIR"/email-viewer-theme.edj"
51 #define PATH_VTCALL "/usr/bin/vtmain"
52
53 #define _EDJ(o) elm_layout_edje_get(o)
54
55 #define DEFAULT_CHARSET "UTF-8"
56
57 #define MAILBOX_STR_MAX         128
58 #define MAX_STR_LEN                     1024
59 #define MAX_LABEL_LEN           512
60
61 #define CONTACTUI_REQ_ADD_PHONE_NUMBER 19
62 #define CONTACTUI_REQ_ADD_EMAIL 20
63 #define CONTACTUI_REQ_ADD_URL 21
64 #define CONTACTUI_REQ_SELECT_UPDATE_ITEM 11
65 #define CONTACTUI_UPDATE_PHONE_NUMBER 0
66 #define CONTACTUI_UPDATE_EMAIL 1
67 #define CONTACTUI_UPDATE_HOMEPAGE 2
68 #define CONTACT_PHONE_CONTACT 0
69 #define CONTACTUI_REQ_CONTACT_DETAIL_INFO_VIEW 43
70
71 #define EMAIL_VIEW_MAX_TO_COUNT 50
72 #define EMAIL_VIEW_MAX_CC_COUNT 50
73 #define EMAIL_VIEW_MAX_BCC_COUNT 50
74
75 #define ICON_REPLY IMGDIR"/M02_controlbar_icon_reply.png"
76 #define ICON_REPLY_ALL IMGDIR"/M02_controlbar_icon_reply.png"
77 #define ICON_FORWARD IMGDIR"/M02_controlbar_icon_forward.png"
78 #define ICON_MOVE IMGDIR"/M02_controlbar_icon_move.png"
79 #define ICON_DELETE IMGDIR"/M02_controlbar_icon_delete.png"
80 #define ICON_RESEND IMGDIR"/M02_controlbar_icon_resend.png"
81 #define ICON_ADD_TO_CALENDAR IMGDIR"/M02_controlbar_icon_add_calendar.png"
82 #define ICON_CONTROLBAR_MORE IMGDIR"/M02_controlbar_icon_more.png"
83
84 #define EMAIL_DEFAULT_HTML "file://"DATADIR"/_email_default.html"
85
86 #define EMAIL_VIEWER_NOC_WIDTH 710.0
87 #define EMAIL_VIEWER_NOC_HIGHT 949.0
88
89 typedef enum {
90         EMAIL_POPUP_BODY_DN_OK = 10,
91         EMAIL_POPUP_EMAIL_DELETE_OK,
92         EMAIL_POPUP_EMAIL_MOVETO_SPAM_OK,
93         EMAIL_POPUP_EMAIL_MOVETO_INBOX_OK,
94         EMAIL_POPUP_BODY_DN_CANCEL,
95         EMAIL_POPUP_ATT_DN_CANCEL,
96         EMAIL_POPUP_ATT_ALL_DN_CANCEL,
97         EMAIL_POPUP_HTML_LOAD_CANCEL,
98         EMAIL_POPUP_MAX
99 } EV_POPUP_RESPONSE_ID;
100
101 typedef enum {
102         BODY_TYPE_TEXT = 0,
103         BODY_TYPE_HTML = 1,
104         BODY_TYPE_INVALID
105 } MESSAGE_BODY_TYPE;
106
107 typedef enum {
108         EMAIL_VIEWER_PROGRESSBAR_ATT = 0,
109         EMAIL_VIEWER_PROGRESSBAR_ATT_ALL,
110         EMAIL_VIEWER_PROGRESSBAR_BODY,
111         EMAIL_VIEWER_PROGRESSBAR_HTML,
112         EMAIL_VIEWER_PROGRESSBAR_MAX
113 } EMAIL_VIEWER_PROGRESSBAR_TYPE;
114
115 typedef struct list_data list_data;
116 struct list_data {
117         gchar *mailbox_ug;
118
119         gchar *from;
120         gchar *title;
121         gchar *timeordate;
122         gchar *group_title;
123         gboolean is_attachment;
124         gboolean is_seen;
125         gboolean is_sending_now;
126         gboolean is_body_download;
127         gint mail_id;
128         gint account_id;
129         gint chksel;
130         gint idx;
131         Elm_Object_Item *item;
132 };
133
134 typedef struct _EMAIL_CONTACT_LIST_INFO_S {
135         int index;
136 #ifndef _NEW_CT_SVC_API
137         char *first_name;
138         char *last_name;
139 #else
140         char *display;
141 #endif
142         char *email_address;
143         char display_name[40];
144 } EMAIL_CONTACT_LIST_INFO_S;
145
146 typedef struct _EmailViewerWebview EmailViewerWebview;
147 struct _EmailViewerWebview {
148         Evas_Coord minw, minh;
149         Evas_Coord w, h;
150         int content_w, content_h;
151         float zoom_rate;
152
153         MESSAGE_BODY_TYPE body_type;
154         MESSAGE_BODY_TYPE body_type_prev;
155
156         char *html_content;
157         char *text_content;
158         char *uri;
159         char *charset;
160 };
161
162 typedef struct ug_data EmailViewerUGD;
163 struct ug_data {
164         Evas_Object *base;
165         ui_gadget_h ug;
166
167         /* base */
168         Evas *evas;
169         Evas_Object *win_main;
170         Evas_Object *layout_main;
171         Evas_Object *sub_ly;
172         Evas_Object *bg;
173         Elm_Theme *theme;
174         int main_w;
175         int main_h;
176
177         /* arguments */
178         int account_id;
179         int account_type;
180         int mail_id;
181         char *mailbox_name;
182         int mailbox_id;
183         char account_email_address[MAX_STR_LEN];
184
185         /* for flick */
186         int prev_mail_id;
187         int next_mail_id;
188         int list_prev_idx;
189         int list_next_idx;
190         int mail_list_cur_idx;
191         GList *mail_list;
192
193         /* flags */
194         int got_att;
195         int b_internal;
196         int subject_onoff_flag;
197         int attach_onoff_flag;
198         int reset_view;
199         int b_noc;
200         int b_direct_destroy;
201         int b_partial_body;
202         int m_is_multi_touch;
203         int scroller_locked;
204         int b_contact_ug_launched;
205         int display_download_result;
206         int option_header_opened;
207         Eina_Bool b_load_finished;
208         Eina_Bool b_show_remote_images;
209         Eina_Bool is_webview_scrolling;
210         Eina_Bool is_main_scroller_scrolling;
211
212         /* for ug create */
213         int create_contact_arg;
214         int update_contact_type;
215
216         /* Scalable UI */
217         float scale_factor;
218         float webview_width;
219         float webview_height;
220         float webview_width_landscape;
221         float webview_height_landscape;
222         int webview_margin;
223         int webview_margin_landscape;
224
225         /* rotation */
226         int isRotate;
227
228         /* mailbox list */
229         email_mailbox_type_e mailbox_type;
230         GList *folder_list;
231         email_mailbox_t *move_mailbox_list;
232         int move_mailbox_count;
233
234         /* Evas Object */
235         Evas_Object *dg_subject;
236         Evas_Object *lb_subject;
237         Evas_Object *ly_subject;
238         Evas_Object *dg_attach;
239         Evas_Object *addrs;
240         Evas_Object *scroller;
241         Evas_Object *conformant;
242         Evas_Object *webview_bx;
243         Evas_Object *main_bx;
244         Evas_Object *navi_bar;
245         Evas_Object *ctr_bar;
246         Evas_Object *up_ctrl_bar;
247         Evas_Object *webview;
248         Evas_Object *webkit;
249         Evas_Object *con_popup;
250         Evas_Object *timeout_popup;
251         Evas_Object *select_info;
252         Evas_Object *selectioninfo_layout;
253         Evas_Object *notify;
254         Evas_Object *pb_notify;
255         Evas_Object *pb_notify_lb;
256         Evas_Object *dn_popup;
257         Evas_Object *dn_progress;
258         Evas_Object *att_progress;
259         Evas_Object *b_btn;
260         Evas_Object *prev_btn;
261         Evas_Object *more_btn;
262         Evas_Object *next_btn;
263         Evas_Object *dn_btn;
264         Evas_Object *partial_dn_btn;
265         Evas_Object *partial_dn_btn_bx;
266         Evas_Object *top_sp;
267         Evas_Object *noc_bx;
268         Evas_Object *noc;
269         Evas_Object *to_mbe;
270         Evas_Object *cc_mbe;
271         Evas_Object *bcc_mbe;
272
273         Evas_Object *opt_btn1;
274         Evas_Object *opt_btn2;
275         Evas_Object *opt_btn3;
276         Evas_Object *move_cbar;
277
278         Evas_Object *to_ly;
279         Evas_Object *cc_ly;
280         Evas_Object *bcc_ly;
281         Evas_Object *from_btn;
282         Evas_Object *attach_hd_ly;
283         Evas_Object **attach_ex_ly;
284         Evas_Object *attach_hd_bk;
285         Evas_Object **attach_ex_bk;
286
287         Evas_Object *progress_bar[ATTACH_MAX];
288         Evas_Object *progress_bar_ly[ATTACH_MAX];
289
290         Elm_Object_Item *reply_ctr_it;
291         Elm_Object_Item *replyall_ctr_it;
292         Elm_Object_Item *forward_ctr_it;
293         Elm_Object_Item *calendar_ctr_it;
294         Elm_Object_Item *resend_ctr_it;
295         Elm_Object_Item *move_ctr_it;
296         Elm_Object_Item *del_ctr_it;
297         Elm_Object_Item *more_ctr_it;
298
299         Elm_Object_Item *more_ctx_block_item;
300         Elm_Object_Item *ctx_block_item;
301
302         Elm_Object_Item *navi_main_it;
303         Elm_Object_Item *navi_move_it1;
304
305         E_DBus_Connection *edbus_conn;
306         EmailViewerWebview *webview_data;
307         EmailViewerPrivate *email_data;
308         EmailViewerProp *property;
309
310         Evas_Object *gl;
311         Elm_Genlist_Item_Class itc1;
312
313         GList *from_list;
314         GList *to_list;
315         GList *cc_list;
316         GList *bcc_list;
317
318         ui_gadget_h ug_composer;
319         ui_gadget_h ug_image_viewer;
320         ui_gadget_h ug_contacts_search;
321         ui_gadget_h ug_calendar_edit;
322
323         Ecore_Idler *idler;
324         Ecore_Timer *timer;
325         Ecore_Timer *waiting_timer;
326 };
327
328 void _hide_view(EmailViewerUGD *ug_data);
329 void _launch_composer(EmailViewerUGD *ug_data, int type);
330
331 #endif  /* __DEF_email-viewer_H__ */
332
333 /* EOF */