4abd15e050f296318347e84b70fdc51cf488d17c
[apps/core/preloaded/email.git] / composer / include / email-composer.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_composer_H_
18 #define __DEF_email_composer_H_
19
20 #include <utilX.h>
21 #include <bundle.h>
22 #include <ui-gadget.h>
23 #include <ui-gadget-module.h>
24 #include <E_DBus.h>
25 #include <EWebKit2.h>
26
27 #include "email-composer-type.h"
28 #include "email-common-types.h"
29 #include "email-locale.h"
30 #include "email-engine.h"
31 #include "email-utils.h"
32
33 #define _EDJ(o) elm_layout_edje_get(o)
34 #define COMPOSER_STRDUP(src) (((src)) ? g_strdup((src)) : NULL)
35
36 #define COMPOSER_ICON_DIR IMGDIR
37
38 #define COMPOSER_NAVI_HEIGHT 98 //108
39 #define COMPOSER_INDI_HEIGHT 76
40 #define COMPOSER_IME_HEIGHT_V 444
41 #define COMPOSER_IME_HEIGHT_H 316
42 #define COMPOSER_IME_PREDICTION_H 84
43
44 #define COMPOSER_SP_H 10
45 #define COMPOSER_EDIT_FIELD_H 80
46 #define COMPOSER_BUTTON_FIELD_H 80
47
48 #define _ENABLE_ENDKEY_ 0
49 #define MAX_RECENT_ITEM 100
50 #define TEMP_BUFFER_SIZE 1024
51
52 #define MAX_WEBVIEW_HEIGHT 88
53 #define IME_WEBVIEW_LANDSCAPE_HEIGHT 20
54
55 #define IME_WEBVIEW_PORTRAIT_HEIGHT 43
56 #define IME_WEBVIEW_PORTRAIT_HEIGHT_WITH_OPTION_HEADER 33
57
58
59 typedef struct ug_data EmailComposerUGD;
60 struct ug_data {
61         ui_gadget_h ug_main;
62         Evas_Object *base;
63
64         Evas_Object *win_main;
65         Evas *evas;
66
67         Evas_Object *bg;
68         Elm_Theme *th;
69
70         /* New notify - TODO: unify the popup usage */
71         Evas_Object *composer_noti;
72         Evas_Object *timeout_noti;
73         Evas_Object *change_addr_noti;
74         Evas_Object *composer_popup;
75
76         Evas_Object *popup_win;
77         Evas_Object *main_layout;
78         Evas_Object *navi_bar;
79         Elm_Object_Item *navi_item;
80         Evas_Object *main_scroller;
81         Evas_Object *c_layout;
82
83         Evas_Object *to_ly;
84         Evas_Object *cc_ly;
85         Evas_Object *bcc_ly;
86         Evas_Object *from_ly;
87         Evas_Object *subject_ly;
88         Evas_Object *webkit_ly;
89
90         Eina_Bool attachment_list_compressed;
91         Eina_List *attachment_item_obj_list;
92         Evas_Object *attachment_item_box;
93         Evas_Object *attachment_contracted_item;
94
95         bool bSendBtnDisabled;
96         bool cc_added;
97         bool bcc_added;
98         bool me_added;
99
100         Eina_Bool is_prediction;
101         bool is_main_scroller_scrolling;
102         bool is_webview_scrolling;
103
104         bool temporary_fix_for_rotation;
105
106         Evas_Object *priv_selected_entry;
107         Evas_Object *selected_entry;
108         Elm_Object_Item *selected_item;
109
110         Evas_Object *dummy_btn;
111         Evas_Object *add_me_btn;
112
113         int priority_option;
114         Evas_Object *priority_rdg;
115         Evas_Object *priority_rd[3];
116
117         Eina_Bool tracking_option[2];
118
119         Evas_Object *cc_btn;
120
121         Evas_Object *send_btn;
122         Evas_Object *cancel_btn;
123         Evas_Object *send_btm_btn;
124         Evas_Object *cancel_btm_btn;
125
126         bool is_hided;
127
128         Ecore_Idler *idler_save_draft;
129         Ecore_Idler *idler_set_focus;
130         Ecore_Idler *idler_show_progress;
131
132         Ecore_Timer *send_timer;
133         Ecore_Timer *bringin_timer;
134         Ecore_Timer *mbe_unfocus_timer;
135         Ecore_Timer *focus_timer;
136         Ecore_Timer *launch_timer;
137
138         /* Predictive Search */
139         Ecore_Timer *ps_timer;
140         Ecore_Timer *sc_timer;
141
142         Evas_Object *ps_list;
143         Elm_Genlist_Item_Class ps_itc_1;
144         Elm_Genlist_Item_Class ps_itc_2;
145         Eina_List *contacts_list_info;
146
147         char ps_keyword[MAX_RECIPIENT_ADDRESS_LEN];
148         bool b_cc_ps_open;
149         bool b_bcc_ps_open;
150         bool ps_on;
151         bool is_mbe_selected;
152         bool is_recipient_duplicated;
153
154         /* Multibutton Entry */
155         Evas_Object *to_mbe_entry;
156         Evas_Object *cc_mbe_entry;
157         Evas_Object *bcc_mbe_entry;
158         Evas_Object *from_mbe_entry;
159         Evas_Object *subject_editfield;
160         Evas_Object *subject_entry;
161
162         Evas_Object *to_mbe;
163         Evas_Object *cc_mbe;
164         Evas_Object *bcc_mbe;
165         Evas_Object *from_mbe;
166         Eina_List *to_mbe_initial_list;
167         Eina_List *cc_mbe_initial_list;
168         Eina_List *bcc_mbe_initial_list;
169         Eina_List *attach_initial_list;
170         char *saved_subject;
171
172         COMPOSER_FOCUS_STATUS_TYPE focus_status;
173
174         Evas_Object *body_ewkview;
175
176         Evas_Object *context_popup;
177
178         Eina_Bool has_body_html;
179         char *saved_html_path;
180         char *latest_info_content;
181         char *latest_html_content;
182         char *plain_content;
183         char *original_info_content;
184         char *original_html_content;
185
186         int to_recipients_cnt;
187         int cc_recipients_cnt;
188         int bcc_recipients_cnt;
189
190         Evas_Object *dn_noti_popup;
191         Evas_Object *dn_prog_popup;
192         Evas_Object *fw_dn_label;
193         Evas_Object *fw_dn_progress;
194
195         int composer_type;
196         int nExistingMailID;
197
198         EmailComposerAccount *account_info;
199         EmailComposerMailbox *mailbox_info;
200
201         EmailComposerMail *new_mail_info;
202         EmailComposerMail *existing_mail_info;
203
204         GList *from_list;
205         GList *to_list;
206         GList *cc_list;
207         GList *bcc_list;
208         email_address_info_list_t *addrs_info_list;
209
210         GList *fw_attachment_list;
211         int fw_attach_cnt;
212         int fw_dn_cnt;
213         int fw_dn_total_cnt;
214         int fw_dn_idx;
215         int fw_dn_handle[MAX_ATTACHMENT_ITEM];
216
217         int send_result;
218         int save_drafts;
219         bool b_sending;
220
221         Ecore_IMF_Context *imf_context;
222         bool is_ime_hided;
223
224         Evas_Object *account_gen_list;
225         bool b_launch_finished;
226         bool isRotated;
227         bool isHorizontal;
228
229         bool b_cc_bcc;
230         bool clipboard_on;
231         Eina_List *popup_list;
232
233         COMPOSER_ERROR_TYPE_E eComposerErrorType;
234
235         Eina_List *listOfImageUrls;
236
237         Eina_Bool b_load_finished;
238         Eina_Bool need_download;
239 };
240
241 typedef struct _EMAIL_ATTACHMENT_INFO_S {
242         int mail_id;
243         int attach_id;
244         int index;
245         char *name;
246         char *path;
247         int size;
248         bool downloaded;
249         bool drm;
250         int inline_content;
251 } EMAIL_ATTACHMENT_INFO_S;
252
253 typedef enum {
254         COMPOSER_RECIPIENT_TYPE_NONE = 0,
255         COMPOSER_RECIPIENT_TYPE_TO,
256         COMPOSER_RECIPIENT_TYPE_CC,
257         COMPOSER_RECIPIENT_TYPE_BCC,
258         COMPOSER_RECIPIENT_TYPE_FROM,
259         COMPOSER_RECIPIENT_TYPE_MAX,
260 } COMPOSER_RECIPIENT_TYPE_E;
261
262 /****************************************************/
263 /*                      Function Declaration                    */
264 /****************************************************/
265
266 void create_composer_frame(EmailComposerUGD *ugd);
267 void _composer_create_view(Evas_Object *parent, EmailComposerUGD *ugd);
268
269 #endif                          /* __DEF_email_composer_H__ */