summaryrefslogtreecommitdiff
path: root/viewer/include/email-viewer.h
blob: 84ed1b96b6955491668cd4fe0fdf7979e79be4ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
/*
 * Copyright 2012  Samsung Electronics Co., Ltd
 *
 * Licensed under the Flora License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.tizenopensource.org/license
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _DEF_email_viewer_H_
#define _DEF_email_viewer_H_

#include <Elementary.h>
#include <libintl.h>
#include <appcore-efl.h>
#undef _
#include <ui-gadget-module.h>
#include <Evas.h>
#include <Ecore_X.h>
#include <Edje.h>
#include <Eina.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <E_DBus.h>
#include <sysman.h>
#include <aul.h>
#include <db-util.h>
#include <vconf.h>
#include <vconf-keys.h>
#include <glib.h>
#include <glib-object.h>
#include <EWebKit2.h>

#include "email-viewer-logic.h"
#include <contacts-svc.h>
#include "email-utils.h"
#include "email-locale.h"

#define VIEWER_PACKAGE "email-viewer"
#define EV_THEME_PATH EDJDIR"/email-viewer-theme.edj"
#define PATH_VTCALL "/usr/bin/vtmain"

#define _EDJ(o) elm_layout_edje_get(o)

#define DEFAULT_CHARSET "UTF-8"

#define MAILBOX_STR_MAX		128
#define MAX_STR_LEN			1024
#define MAX_LABEL_LEN		512

#define CONTACTUI_REQ_ADD_PHONE_NUMBER 19
#define CONTACTUI_REQ_ADD_EMAIL 20
#define CONTACTUI_REQ_ADD_URL 21
#define CONTACTUI_REQ_SELECT_UPDATE_ITEM 11
#define CONTACTUI_UPDATE_PHONE_NUMBER 0
#define CONTACTUI_UPDATE_EMAIL 1
#define CONTACTUI_UPDATE_HOMEPAGE 2
#define CONTACT_PHONE_CONTACT 0
#define CONTACTUI_REQ_CONTACT_DETAIL_INFO_VIEW 43

#define EMAIL_VIEW_MAX_TO_COUNT 50
#define EMAIL_VIEW_MAX_CC_COUNT 50
#define EMAIL_VIEW_MAX_BCC_COUNT 50

#define ICON_REPLY IMGDIR"/M02_controlbar_icon_reply.png"
#define ICON_REPLY_ALL IMGDIR"/M02_controlbar_icon_reply.png"
#define ICON_FORWARD IMGDIR"/M02_controlbar_icon_forward.png"
#define ICON_MOVE IMGDIR"/M02_controlbar_icon_move.png"
#define ICON_DELETE IMGDIR"/M02_controlbar_icon_delete.png"
#define ICON_RESEND IMGDIR"/M02_controlbar_icon_resend.png"
#define ICON_ADD_TO_CALENDAR IMGDIR"/M02_controlbar_icon_add_calendar.png"
#define ICON_CONTROLBAR_MORE IMGDIR"/M02_controlbar_icon_more.png"

#define EMAIL_DEFAULT_HTML "file://"DATADIR"/_email_default.html"

#define EMAIL_VIEWER_NOC_WIDTH 710.0
#define EMAIL_VIEWER_NOC_HIGHT 949.0

typedef enum {
	EMAIL_POPUP_BODY_DN_OK = 10,
	EMAIL_POPUP_EMAIL_DELETE_OK,
	EMAIL_POPUP_EMAIL_MOVETO_SPAM_OK,
	EMAIL_POPUP_EMAIL_MOVETO_INBOX_OK,
	EMAIL_POPUP_BODY_DN_CANCEL,
	EMAIL_POPUP_ATT_DN_CANCEL,
	EMAIL_POPUP_ATT_ALL_DN_CANCEL,
	EMAIL_POPUP_HTML_LOAD_CANCEL,
	EMAIL_POPUP_MAX
} EV_POPUP_RESPONSE_ID;

typedef enum {
	BODY_TYPE_TEXT = 0,
	BODY_TYPE_HTML = 1,
	BODY_TYPE_INVALID
} MESSAGE_BODY_TYPE;

typedef enum {
	EMAIL_VIEWER_PROGRESSBAR_ATT = 0,
	EMAIL_VIEWER_PROGRESSBAR_ATT_ALL,
	EMAIL_VIEWER_PROGRESSBAR_BODY,
	EMAIL_VIEWER_PROGRESSBAR_HTML,
	EMAIL_VIEWER_PROGRESSBAR_MAX
} EMAIL_VIEWER_PROGRESSBAR_TYPE;

typedef struct list_data list_data;
struct list_data {
	gchar *mailbox_ug;

	gchar *from;
	gchar *title;
	gchar *timeordate;
	gchar *group_title;
	gboolean is_attachment;
	gboolean is_seen;
	gboolean is_sending_now;
	gboolean is_body_download;
	gint mail_id;
	gint account_id;
	gint chksel;
	gint idx;
	Elm_Object_Item *item;
};

typedef struct _EMAIL_CONTACT_LIST_INFO_S {
	int index;
#ifndef _NEW_CT_SVC_API
	char *first_name;
	char *last_name;
#else
	char *display;
#endif
	char *email_address;
	char display_name[40];
} EMAIL_CONTACT_LIST_INFO_S;

typedef struct _EmailViewerWebview EmailViewerWebview;
struct _EmailViewerWebview {
	Evas_Coord minw, minh;
	Evas_Coord w, h;
	int content_w, content_h;
	float zoom_rate;

	MESSAGE_BODY_TYPE body_type;
	MESSAGE_BODY_TYPE body_type_prev;

	char *html_content;
	char *text_content;
	char *uri;
	char *charset;
};

typedef struct ug_data EmailViewerUGD;
struct ug_data {
	Evas_Object *base;
	ui_gadget_h ug;

	/* base */
	Evas *evas;
	Evas_Object *win_main;
	Evas_Object *layout_main;
	Evas_Object *sub_ly;
	Evas_Object *bg;
	Elm_Theme *theme;
	int main_w;
	int main_h;

	/* arguments */
	int account_id;
	int account_type;
	int mail_id;
	char *mailbox_name;
	int mailbox_id;
	char account_email_address[MAX_STR_LEN];

	/* for flick */
	int prev_mail_id;
	int next_mail_id;
	int list_prev_idx;
	int list_next_idx;
	int mail_list_cur_idx;
	GList *mail_list;

	/* flags */
	int got_att;
	int b_internal;
	int subject_onoff_flag;
	int attach_onoff_flag;
	int reset_view;
	int b_noc;
	int b_direct_destroy;
	int b_partial_body;
	int m_is_multi_touch;
	int scroller_locked;
	int b_contact_ug_launched;
	int display_download_result;
	int option_header_opened;
	Eina_Bool b_load_finished;
	Eina_Bool b_show_remote_images;
	Eina_Bool is_webview_scrolling;
	Eina_Bool is_main_scroller_scrolling;

	/* for ug create */
	int create_contact_arg;
	int update_contact_type;

	/* Scalable UI */
	float scale_factor;
	float webview_width;
	float webview_height;
	float webview_width_landscape;
	float webview_height_landscape;
	int webview_margin;
	int webview_margin_landscape;

	/* for cut link */
	Ecore_Timer *cutlink_timer;
	Eina_Bool last_click_have_link;
	Eina_Bool last_click_have_image;
	char *last_click_link_url;
	char *last_click_link_text;
	char *last_click_img_url;

	/* rotation */
	int isRotate;

	/* mailbox list */
	email_mailbox_type_e mailbox_type;
	GList *folder_list;
	email_mailbox_t *move_mailbox_list;
	int move_mailbox_count;

	/* Evas Object */
	Evas_Object *dg_subject;
	Evas_Object *lb_subject;
	Evas_Object *ly_subject;
	Evas_Object *dg_attach;
	Evas_Object *addrs;
	Evas_Object *scroller;
	Evas_Object *conformant;
	Evas_Object *webview_bx;
	Evas_Object *main_bx;
	Evas_Object *navi_bar;
	Evas_Object *ctr_bar;
	Evas_Object *up_ctrl_bar;
	Evas_Object *webview;
	Evas_Object *webkit;
	Evas_Object *con_popup;
	Evas_Object *timeout_popup;
	Evas_Object *select_info;
	Evas_Object *selectioninfo_layout;
	Evas_Object *notify;
	Evas_Object *pb_notify;
	Evas_Object *pb_notify_lb;
	Evas_Object *dn_popup;
	Evas_Object *dn_progress;
	Evas_Object *att_progress;
	Evas_Object *b_btn;
	Evas_Object *prev_btn;
	Evas_Object *more_btn;
	Evas_Object *next_btn;
	Evas_Object *dn_btn;
	Evas_Object *partial_dn_btn;
	Evas_Object *partial_dn_btn_bx;
	Evas_Object *top_sp;
	Evas_Object *noc_bx;
	Evas_Object *noc;
	Evas_Object *to_mbe;
	Evas_Object *cc_mbe;
	Evas_Object *bcc_mbe;

	Evas_Object *opt_btn1;
	Evas_Object *opt_btn2;
	Evas_Object *opt_btn3;
	Evas_Object *move_cbar;

	Evas_Object *to_ly;
	Evas_Object *cc_ly;
	Evas_Object *bcc_ly;
	Evas_Object *from_btn;
	Evas_Object *attach_hd_ly;
	Evas_Object **attach_ex_ly;
	Evas_Object *attach_hd_bk;
	Evas_Object **attach_ex_bk;

	Evas_Object *progress_bar[ATTACH_MAX];
	Evas_Object *progress_bar_ly[ATTACH_MAX];

	Elm_Object_Item *reply_ctr_it;
	Elm_Object_Item *replyall_ctr_it;
	Elm_Object_Item *forward_ctr_it;
	Elm_Object_Item *calendar_ctr_it;
	Elm_Object_Item *resend_ctr_it;
	Elm_Object_Item *move_ctr_it;
	Elm_Object_Item *del_ctr_it;
	Elm_Object_Item *more_ctr_it;

	Elm_Object_Item *more_ctx_block_item;

	Elm_Object_Item *navi_main_it;
	Elm_Object_Item *navi_move_it1;
	Elm_Object_Item *navi_move_it2;

	E_DBus_Connection *edbus_conn;
	EmailViewerWebview *webview_data;
	EmailViewerPrivate *email_data;
	EmailViewerProp *property;

	Evas_Object *gl;
	Elm_Genlist_Item_Class itc1;
	Elm_Genlist_Item_Class itc2;
	Elm_Genlist_Item_Class itc3;

	GList *from_list;
	GList *to_list;
	GList *cc_list;
	GList *bcc_list;

	ui_gadget_h ug_composer;
	ui_gadget_h ug_image_viewer;
	ui_gadget_h ug_contacts_search;
	ui_gadget_h ug_calendar_edit;

	Ecore_Idler *idler;
	Ecore_Timer *timer;
};

void _hide_view(EmailViewerUGD *ug_data);
void _launch_composer(EmailViewerUGD *ug_data, int type);

#endif	/* __DEF_email-viewer_H__ */

/* EOF */