summaryrefslogtreecommitdiff
path: root/composer/include/email-composer.h
blob: 28e9b93a7a65e104dba75750c8fb35955fe80c82 (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
/*
 * 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_composer_H_
#define __DEF_email_composer_H_

#include <utilX.h>
#include <bundle.h>
#include <ui-gadget.h>
#include <ui-gadget-module.h>
#include <E_DBus.h>
#include <EWebKit2.h>

#include "email-composer-type.h"
#include "email-common-types.h"
#include "email-locale.h"
#include "email-engine.h"
#include "email-utils.h"

#define _EDJ(o) elm_layout_edje_get(o)
#define COMPOSER_STRDUP(src) (((src)) ? g_strdup((src)) : NULL)

#define COMPOSER_ICON_DIR IMGDIR

#define COMPOSER_NAVI_HEIGHT 108

#define COMPOSER_SP_H 10
#define COMPOSER_EDIT_FIELD_H 80
#define COMPOSER_BUTTON_FIELD_H 80

#define _ENABLE_ENDKEY_ 0
#define MAX_RECENT_ITEM 100
#define MB_SVC_FILE_PATH_LEN_MAX 255
#define TEMP_BUFFER_SIZE 1024

#define MAX_WEBVIEW_HEIGHT 88
#define IME_WEBVIEW_LANDSCAPE_HEIGHT 20

#define IME_WEBVIEW_PORTRAIT_HEIGHT 43
#define IME_WEBVIEW_PORTRAIT_HEIGHT_WITH_OPTION_HEADER 33


typedef struct ug_data EmailComposerUGD;
struct ug_data {
	ui_gadget_h ug_main;
	Evas_Object *base;

	Evas_Object *win_main;
	Evas *evas;

	Evas_Object *bg;
	/*Elm_Theme *th;*/

	/* New notify - TODO: unify the popup usage */
	Evas_Object *composer_noti;
	Evas_Object *timeout_noti;
	Evas_Object *change_addr_noti;
	Evas_Object *composer_popup;

	Evas_Object *popup_win;
	Evas_Object *main_layout;
	Evas_Object *navi_bar;
	Elm_Object_Item *navi_item;
	Evas_Object *main_scroller;
	Evas_Object *c_layout;
	Evas_Object *conform;

	Evas_Object *to_ly;
	Evas_Object *cc_ly;
	Evas_Object *bcc_ly;
	Evas_Object *from_ly;
	Evas_Object *subject_ly;
	Evas_Object *webkit_ly;

	Eina_Bool attachment_list_compressed;
	Eina_List *attachment_item_obj_list;
	Evas_Object *attachment_item_box;
	Evas_Object *attachment_contracted_item;

	bool bSendBtnDisabled;
	bool cc_added;
	bool bcc_added;

	int indicator_height;
	bool is_main_scroller_scrolling;
	bool is_webview_scrolling;

#ifdef _TEMPORARY_FIX_FOR_ROTATION_
	bool temporary_fix_for_rotation;
#endif

	Evas_Object *priv_selected_entry;
	Evas_Object *selected_entry;
	Elm_Object_Item *selected_item;

	int option_header_opened;

#ifndef _CC_BCC
	Elm_Object_Item *controlbar_item[2];
#else
	Elm_Object_Item *controlbar_item[1];
#endif
	Evas_Object *cc_btn;
	Evas_Object *bcc_btn;

	Evas_Object *send_btn;
	Evas_Object *cancel_btn;

	bool is_hided;

	Ecore_Idler *idler_save_draft;
	Ecore_Idler *idler_set_focus;
	Ecore_Idler *idler_show_progress;

	Ecore_Timer *send_timer;
	Ecore_Timer *bringin_timer;
	Ecore_Timer *mbe_unfocus_timer;
	Ecore_Timer *focus_timer;

	/* Predictive Search */
	Ecore_Timer *ps_timer;
	Ecore_Timer *sc_timer;

	Evas_Object *ps_list;
	Elm_Genlist_Item_Class ps_itc_1;
	Elm_Genlist_Item_Class ps_itc_2;
	Eina_List *contacts_list_info;

	char ps_keyword[MAX_RECIPIENT_ADDRESS_LEN];
	bool b_cc_ps_open;
	bool b_bcc_ps_open;
	bool ps_on;
	bool is_mbe_selected;

	/* Multibutton Entry */
	Evas_Object *to_mbe_entry;
	Evas_Object *cc_mbe_entry;
	Evas_Object *bcc_mbe_entry;
	Evas_Object *from_mbe_entry;
	Evas_Object *subject_editfield;
	Evas_Object *subject_entry;

	Evas_Object *to_mbe;
	Evas_Object *cc_mbe;
	Evas_Object *bcc_mbe;
	Evas_Object *from_mbe;
	Eina_List *to_mbe_initial_list;
	Eina_List *cc_mbe_initial_list;
	Eina_List *bcc_mbe_initial_list;
	Eina_List *attach_initial_list;
	char *saved_subject;

	COMPOSER_FOCUS_STATUS_TYPE focus_status;

	Evas_Object *body_ewkview;

	Eina_Bool has_body_html;
	char *saved_html_path;
	char *saved_html_content;
	char *latest_html_content;
	char *plain_content;

	int to_recipients_cnt;
	int cc_recipients_cnt;
	int bcc_recipients_cnt;

	Evas_Object *dn_noti_popup;
	Evas_Object *dn_prog_popup;
	Evas_Object *fw_dn_label;
	Evas_Object *fw_dn_progress;

	int composer_type;
	int nExistingMailID;

	EmailComposerAccount *account_info;
	EmailComposerMailbox *mailbox_info;

	EmailComposerMail *new_mail_info;
	EmailComposerMail *existing_mail_info;

	GList *from_list;
	GList *to_list;
	GList *cc_list;
	GList *bcc_list;
	email_address_info_list_t *addrs_info_list;

	GList *fw_attachment_list;
	int fw_dn_cnt;
	int fw_dn_total_cnt;
	int fw_dn_idx;
	unsigned int fw_dn_handle[MAX_ATTACHMENT_ITEM];

	int send_result;
	int save_drafts;
	bool b_sending;

	Ecore_IMF_Context *imf_context;

	Evas_Object *account_gen_list;

	bool isRotated;

	bool b_cc_bcc;
	bool clipboard_on;
	Eina_List *popup_list;

	COMPOSER_ERROR_TYPE_E eComposerErrorType;
	int ime_height;

	Eina_List *listOfImageUrls;

	Eina_Bool b_load_finished;
};

typedef struct _EMAIL_CONTACT_LIST_INFO_S {
	int index;
	char *first_name;
	char *last_name;
	char *email_address;
	char *image_path;
	char display_name[MAX_RECIPIENT_ADDRESS_LEN];
	EmailComposerUGD *ugd;
} EMAIL_CONTACT_LIST_INFO_S;

typedef struct _EMAIL_ATTACHMENT_INFO_S {
	int mail_id;
	int attach_id;
	int index;
	char *name;
	char *path;
	int size;
	bool downloaded;
	bool drm;
	int inline_content;
} EMAIL_ATTACHMENT_INFO_S;

typedef enum {
	COMPOSER_RECIPIENT_TYPE_NONE = 0,
	COMPOSER_RECIPIENT_TYPE_TO,
	COMPOSER_RECIPIENT_TYPE_CC,
	COMPOSER_RECIPIENT_TYPE_BCC,
	COMPOSER_RECIPIENT_TYPE_FROM,
	COMPOSER_RECIPIENT_TYPE_MAX,
} COMPOSER_RECIPIENT_TYPE_E;

/****************************************************/
/*			Function Declaration			*/
/****************************************************/

void create_composer_frame(EmailComposerUGD *ugd);
void _composer_create_view(Evas_Object *parent, EmailComposerUGD *ugd);
#endif				/* __DEF_email_composer_H__ */