2 * Copyright 2012 Samsung Electronics Co., Ltd
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
8 * http://floralicense.org/license
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.
18 #ifndef __MSG_UI_COMPOSER_DATA_H_
19 #define __MSG_UI_COMPOSER_DATA_H_
21 /***********************
23 ************************/
25 #include <msg_storage.h>
26 #include <msg_transport.h>
28 #include <Elementary.h>
30 #include <glib-object.h>
33 #include <ui-gadget-module.h>
40 #include "msg-ui-util.h"
41 #include "msg-ui-composer-string.h"
42 #include "msg-ui-composer-res.h"
43 #include "msg-ui-common-utility.h"
44 #include "msg-ui-composer-bubble.h"
46 /*********************
48 ************************/
50 #if !defined(__TYPEDEF_INT64__)
51 #define __TYPEDEF_INT64__
52 typedef long long int64;
55 #define TO_FIELD_LABEL_SIZE_MAX 512
56 #define COMPOSER_RECIPIENT_PORTRAIT_HEIGHT_MAX 188
57 #define COMPOSER_RECIPIENT_LANDSCAPE_HEIGHT_MAX 112
58 #define COMPARE_STRING_NUM 8
60 #ifndef MAX_TO_ADDRESS_CNT
61 #define MAX_TO_ADDRESS_CNT (10)
64 #define COMPOSER_RECIPIENT_COUNT_MAX MAX_TO_ADDRESS_CNT
66 #ifndef MAX_PHONE_NUMBER_LEN
67 #define MAX_PHONE_NUMBER_LEN (20)
70 #define COMPOSER_RECIPIENT_PHONE_NUMBER_LEN_MAX MAX_PHONE_NUMBER_LEN
71 #define COMPOSER_RECIPIENT_PHONE_NUMBER_LEN_MIN (3)
73 #ifndef MAX_ADDRESS_VAL_LEN
74 #define MAX_ADDRESS_VAL_LEN (254)
77 #define COMPOSER_RECIPIENT_ADDRESS_VAL_LEN_MAX MAX_ADDRESS_VAL_LEN
78 #define COMPOSER_SUBJECT_MAX_CHAR (40)
79 #define COMPOSER_SUBJECT_MAX_BYTE (COMPOSER_SUBJECT_MAX_CHAR * 3)
81 #define COMPOSER_MMS_TEXT_MAX_CHAR (3000)
82 #define COMPOSER_MMS_TEXT_MAX_BYTE (COMPOSER_MMS_TEXT_MAX_CHAR * 3)
84 #define COMPOSER_MMS_MAX_PAGE (20)
85 #define COMPOSER_MMS_MAX_ATTACH_COUNT (10)
86 #define COMPOSER_FILEPATH_LEN_MAX (1024)
87 #define COMPOSER_FILENAME_LEN_MAX (255)
88 #define COMPOSER_PAGE_DEFAULT_DURATION (5) //sec
90 #define COMPOSER_MMS_MAX_MEDIA_COUNT (COMPOSER_MMS_MAX_PAGE)
92 #define COMPOSER_COMMON_EXT_MAX_LENGTH (7)
93 #define COMPOSER_COMMON_MIME_MAX_LEN (64)
95 #define COMPOSER_SMS_UNICODE_MAX_LEN (70)
96 #define COMPOSER_SMS_GSM7_MAX_LEN (160)
98 #define COMPOSER_CMS_UNICODE_MAX_LEN (67)
99 #define COMPOSER_CMS_GSM7_MAX_LEN (153)
101 /* default 15 pages, it can be changed by operator spec. */
102 #define COMPOSER_CMS_MAX_PAGE (15)
104 #define COMPOSER_TMP_PATH "/tmp"
106 #define MSGC_1KB 1024
108 #define MSGC_RESTRICT_MAX_IMG_W 640
109 #define MSGC_RESTRICT_MAX_IMG_H 480
111 #define MSGC_INDICATOR_H 60
112 #define MSGC_NAVIBAR_TITLE_H 111
113 #define MSGC_BODY_TOP_PADDING 4
114 #define MSGC_BODY_BOTTOM_PADDING 20
115 #define MSGC_BODY_PADDING (MSGC_BODY_TOP_PADDING + MSGC_BODY_BOTTOM_PADDING)
117 #define MSGC_IMAGE_THUMB_WIDTH 132
118 #define MSGC_IMAGE_THUMB_HEIGHT 132
119 #define MSGC_SOUND_THUMB_WIDTH 48
120 #define MSGC_SOUND_THUMB_HEIGHT 48
122 #define MSGC_POPUP_GENLIST_H 128
123 #define MSGC_POPUP_LIST_H 112
125 #define MSGC_BODY_FONT_SIZE 36
126 #define MSGC_SUBJECT_FONT_SIZE 32
128 /*********************
130 ************************/
132 MSG_UG_MODE_FULL_COMPOSER,
133 MSG_UG_MODE_BUBBLE_COMPOSER,
134 MSG_UG_MODE_ONLY_COMPOSER, /*In this mode Composer should destroy after send message*/
139 MSG_COMPOSER_MODE_NORMAL,
140 MSG_COMPOSER_MODE_EDIT,
141 MSG_COMPOSER_MODE_FORWARD,
142 } MSG_COMPOSER_MODE_E;
145 COMPOSER_RETURN_SUCCESS = 0,
146 COMPOSER_RETURN_FAIL = -1,
147 COMPOSER_RETURN_NULL_POINTER = -2,
148 COMPOSER_RETURN_NO_SIM = -3,
149 COMPOSER_RETURN_HANDLE_NOT_EXIST = -4,
150 COMPOSER_RETURN_MAX_PAGE = -5,
151 COMPOSER_RETURN_INVALID_MSG_TYPE = -6,
152 COMPOSER_RETURN_INVALID_PAGE = -7,
153 COMPOSER_RETURN_INVALID_MEDIA_TYPE = -8,
154 COMPOSER_RETURN_ATTACHMENT_ALREADY_EXIST = -9,
155 COMPOSER_RETURN_LOW_RESOLUTION = -10,
156 COMPOSER_RETURN_HIGH_RESOLUTION = -11,
157 COMPOSER_RETURN_NONSTANDARD_FILE = -12,
158 COMPOSER_RETURN_RECIPIENT_INVALID = -13,
159 COMPOSER_RETURN_RECIPIENT_COUNTMAX = -14,
160 COMPOSER_RETURN_RECIPIENT_DUPLICATE = -15,
161 COMPOSER_RETURN_MSG_SIZE_OVER = -16,
162 COMPOSER_RETURN_RESIZE_IMAGE = -17,
163 COMPOSER_RETURN_DRM_FORWARDLOCK = -18,
164 COMPOSER_RETURN_OVERSIZE_FILE = -19,
165 COMPOSER_RETURN_CREATION_RESTRICTED_MODE_FAIL = -20,
166 COMPOSER_RETURN_CREATION_RESTRICTED_MODE_PASS = -21,
167 COMPOSER_RETURN_CREATION_WARINING_MODE_FAIL = -22,
168 COMPOSER_RETURN_CREATION_WARINING_MODE_PASS = -23,
169 } COMPOSER_RETURN_TYPE_E;
172 COMPOSER_MSG_TYPE_INVALID,
173 COMPOSER_MSG_TYPE_SMS,
174 COMPOSER_MSG_TYPE_MMS,
175 } COMPOSER_MSG_TYPE_E;
178 COMPOSER_RECP_TYPE_UNKOWN,
179 COMPOSER_RECP_TYPE_TO,
180 COMPOSER_RECP_TYPE_CC,
181 COMPOSER_RECP_TYPE_BCC,
182 COMPOSER_RECP_TYPE_FROM,
183 COMPOSER_RECP_TYPE_MAX,
184 } COMPOSER_RECP_TYPE_E;
187 COMPOSER_MEDIA_TYPE_UNKNOWN,
188 COMPOSER_MEDIA_TYPE_IMAGE,
189 COMPOSER_MEDIA_TYPE_VIDEO,
190 COMPOSER_MEDIA_TYPE_AUDIO,
191 COMPOSER_MEDIA_TYPE_TEXT,
192 COMPOSER_MEDIA_TYPE_ANIMATE,
193 COMPOSER_MEDIA_TYPE_DRM,
194 COMPOSER_MEDIA_TYPE_MAX = 0xff
195 } COMPOSER_MEDIA_TYPE_E;
198 COMPOSER_MEDIA_TRACK_TYPE_NONE,
199 COMPOSER_MEDIA_TRACK_TYPE_VIDEO,
200 COMPOSER_MEDIA_TRACK_TYPE_AUDIO,
201 } COMPOSER_MEDIA_TRACK_TYPE_E;
204 COMPOSER_REGION_ORDER_UNDETERMINDED = 0x00,
205 COMPOSER_REGION_ORDER_IMAGE_TOP,
206 COMPOSER_REGION_ORDER_TEXT_TOP,
207 } COMPOSER_MMS_REGION_ORDER_E;
210 COMPOSER_STATE_TYPE_INVALID = 0,
211 COMPOSER_STATE_TYPE_CREATE,
212 COMPOSER_STATE_TYPE_RUNNING,
213 COMPOSER_STATE_TYPE_PAUSE,
214 COMPOSER_STATE_TYPE_DESTROY,
215 COMPOSER_STATE_TYPE_MAX,
216 } COMPOSER_STATE_TYPE_E;
219 COMPOSER_STATUS_POPUP_BUTTON_NONE = 0,
220 COMPOSER_STATUS_POPUP_BUTTON_OK,
221 COMPOSER_STATUS_POPUP_BUTTON_CLOSE,
222 COMPOSER_STATUS_POPUP_BUTTON_OK_CANCEL,
223 COMPOSER_STATUS_POPUP_BUTTON_MAX,
224 } COMPOSER_POPUP_BUTTON_TYPE_E;
227 COMPOSER_CREATION_MODE_RESTRICTED = 0,
228 COMPOSER_CREATION_MODE_WARNING,
229 COMPOSER_CREATION_MODE_FREE,
230 COMPOSER_CREATION_MODE_MAX,
234 COMPOSER_FOCUS_RECIPIENT = 0,
236 COMPOSER_FOCUS_SUBJECT,
237 COMPOSER_FOCUS_DEFAULT,
241 COMPOSER_RECP_ADDR_NONE,
242 COMPOSER_RECP_ADDR_INVALID,
243 COMPOSER_RECP_ADDR_VALID_NUMBER,
244 COMPOSER_RECP_ADDR_VALID_EMAIL,
245 } COMPOSER_RECP_ADDR_E;
248 COMPOSER_CHAR_ENCODE_GSM7 = 0,
249 COMPOSER_CHAR_ENCODE_GSM7_ABNORMAL,
250 COMPOSER_CHAR_ENCODE_UNICODE,
251 COMPOSER_CHAR_ENCODE_MAX,
252 } COMPOSER_CHAR_ENCODE_E;
255 COMPOSER_PREDICTSEARCH_NONE = 0,
256 COMPOSER_PREDICTSEARCH_NAME_OR_NUMBER,
257 COMPOSER_PREDICTSEARCH_NAME_OR_EMAIL,
258 COMPOSER_PREDICTSEARCH_LOG,
259 COMPOSER_PREDICTSEARCH_END,
260 } COMPOSER_PREDICTSEARCH_STATE_E;
263 COMPOSER_ROTATE_UNKNOWN = 0,
264 COMPOSER_ROTATE_PORTRAIT = APP_DEVICE_ORIENTATION_0,
265 COMPOSER_ROTATE_PORTRAIT_UPSIDEDOWN = APP_DEVICE_ORIENTATION_180,
266 COMPOSER_ROTATE_LANDSCAPE = APP_DEVICE_ORIENTATION_270,
267 COMPOSER_ROTATE_LANDSCAPE_UPSIDEDOWN = APP_DEVICE_ORIENTATION_90,
268 } COMPOSER_ROTATE_TYPE_E;
272 COMPOSER_EDIT_RECIPIENT,
274 COMPOSER_EDIT_RECIPIENT_AND_BODY,
275 } COMPOSER_EDIT_STATE_E;
278 COMPOSER_ADDR_TYPE_NUMBER,
279 COMPOSER_ADDR_TYPE_EMAIL
283 COMPOSER_TYPE_SUBJECT = 0,
288 RECIPIENT_PARSING_TYPE_ADD_CHAR,
289 RECIPIENT_PARSING_TYPE_DELETE_CHAR,
290 RECIPIENT_PARSING_TYPE_ENTER_KEY,
291 RECIPIENT_PARSING_TYPE_MAX,
295 COMPOSER_CONTENT_CREATION_NONE,
296 COMPOSER_CONTENT_CREATION_ALLOWED,
297 COMPOSER_CONTENT_CREATION_ALLOWED_WITH_RESIZE,
298 COMPOSER_CONTENT_CREATION_NOT_ALLOWED,
299 } COMPOSER_CONTENT_CREATION_MODE_E;
301 /******************************
303 *******************************/
305 char m_szextend[COMPOSER_COMMON_EXT_MAX_LENGTH + 1];
306 char m_szmime_type[COMPOSER_COMMON_MIME_MAX_LEN + 1];
307 COMPOSER_MEDIA_TYPE_E m_ncontent_type;
308 } composer_mime_type_t;
311 Used change number for contact info
313 typedef struct _CONTACT_ITEM_S {
315 int type; /*COMPOSER_ADDR_TYPE_NUMBER:number, COMPOSER_ADDR_TYPE_EMAIL:email*/
316 int contact_type; /*number or email type of contact like Mobile, Home*/
317 char recipient[COMPOSER_RECIPIENT_ADDRESS_VAL_LEN_MAX+1];
321 Used MBE's data && PredictSearch
323 typedef struct _RECIPIENT_ITEM_S {
324 COMPOSER_RECP_ADDR_E type;
326 char recipient[COMPOSER_RECIPIENT_ADDRESS_VAL_LEN_MAX+1];
327 char display_name[COMPOSER_RECIPIENT_ADDRESS_VAL_LEN_MAX+1];
328 char image_path[COMPOSER_FILEPATH_LEN_MAX+1];
331 typedef struct _RECIPIENT_S {
336 bool is_required_address_popup;
339 Evas_Object *bx_main;
344 Evas_Object *popup_selected;
345 Elm_Object_Item *sel_mbe_item;
346 RECIPIENT_ITEM_S *sel_r_item;
348 Evas_Object *popup_change_number;
349 Elm_Genlist_Item_Class change_number_itc;
351 Ecore_Idler *scroll_down_idler;
353 COMPOSER_RECP_ADDR_E type;
354 Ecore_Idler *notify_popup_idler;
357 typedef struct _PREDICTSEARCH_S {
361 Evas_Object *glist_ps;
362 Elm_Genlist_Item_Class itc_1line;
363 Elm_Genlist_Item_Class itc_2line;
365 COMPOSER_PREDICTSEARCH_STATE_E state;
367 char txt_ps_keyword[COMPOSER_RECIPIENT_ADDRESS_VAL_LEN_MAX+1];
368 char txt_ps_reqkeyword[COMPOSER_RECIPIENT_ADDRESS_VAL_LEN_MAX+1];
370 contacts_list_h ct_list;
373 Ecore_Idler *idler_ps;
374 Ecore_Timer *timer_ps;
377 typedef struct _SUBJECT_S {
380 Evas_Object *del_icon;
383 typedef struct _MSG_COMPOSER_ATTACHITEM_S {
385 char file_path[COMPOSER_FILEPATH_LEN_MAX + 1];
386 char file_name[COMPOSER_FILEPATH_LEN_MAX + 1];
388 } MSG_COMPOSER_ATTACH_ITEM_S;
390 typedef struct _MSG_COMPOSER_ATTACH_S {
392 long long attachfileSize;
393 Eina_List *attachitem_list;
394 } MSG_COMPOSER_ATTACH_S;
396 typedef struct _text_info {
397 COMPOSER_CHAR_ENCODE_E encode;
402 typedef struct _MSG_COMPOSER_BODY_PAGE_S {
404 Evas_Object *page_main_box;
406 Evas_Object *upper_layout;
407 Evas_Object *page_box;
408 Evas_Object *del_icon;
412 Evas_Object *image_item;
413 char image_file_path[COMPOSER_FILEPATH_LEN_MAX + 1];
416 text_info_s text_info;
419 Evas_Object *sound_item;
420 char sound_file_path[COMPOSER_FILEPATH_LEN_MAX + 1];
423 } MSG_COMPOSER_BODY_PAGE_S;
425 typedef struct _MSG_COMPOSER_BODY_S {
427 Eina_List *page_list;
430 COMPOSER_CONTENT_CREATION_MODE_E creation_allowed;
431 } MSG_COMPOSER_BODY_S;
433 typedef struct _MSG_COMPOSER_DATA_S {
434 /*ug data & callback*/
436 ui_gadget_h loaded_ug;
439 /*composer mode & state*/
440 MSG_UG_MODE_E msg_ug_mode;
441 MSG_COMPOSER_MODE_E composer_mode;
442 COMPOSER_STATE_TYPE_E state;
443 COMPOSER_ROTATE_TYPE_E rotate;
444 COMPOSER_MSG_TYPE_E msg_type;
451 bool sending_success;
453 bool send_button_clicked;
454 bool add_button_clicked;
455 bool add_menu_clicked;
459 bool send_button_is_show;
460 bool isclosed; /* composer is closed */
461 bool hide_keypad_op; /* keypad hide operation by back button */
462 bool loading_draft; /* draft msg loading status */
463 bool make_default_body_size;
464 bool is_default_body_size;
466 bool disable_auto_save_mode;
467 Elm_Win_Indicator_Mode indicator_mode;
469 int current_edit_entry;
476 int send_check_exception_type;
488 msg_handle_t msg_handle;
493 MSG_COMPOSER_BODY_S body_data;
494 MSG_COMPOSER_ATTACH_S attach_data;
496 Eina_List *recipient_list; /* recipient list for bubble composer */
497 RECIPIENT_S *recipient;
498 PREDICTSEARCH_S *predictsearch;
499 Eina_List *attachlist;
500 Eina_List *iter_list;
501 int attach_index; /*current added attach index*/
504 Evas_Object *main_window;
506 Evas_Object *navi_bar;
507 Evas_Object *navi_title_layout;
508 Evas_Object *title_menu_layout;
509 Evas_Object *more_btn;
510 Evas_Object *compose_btn;
511 Evas_Object *back_btn;
512 Evas_Object *toolbar_top;
513 Elm_Object_Item *navi_it;
515 Evas_Object *content_layout;
517 Evas_Object *ly_body;
518 Evas_Object *ly_recipient;
520 Evas_Object *add_button;
521 Evas_Object *send_button;
523 Evas_Object *body_scroll;
524 Evas_Object *body_box;
526 Evas_Object *ly_attach_main;
528 Evas_Object *add_popup;
529 Evas_Object *progress_popup;
530 Evas_Object *popup_end;
531 Evas_Object *ctx_popup;
532 Evas_Object *custom_popup;
533 Eina_List *popup_list;
535 Evas_Object *page_duration_entry;
537 Evas_Object *last_focus_entry;
538 Ecore_Idler *last_focus_idler;
540 Ecore_Thread *attach_thread;
541 Ecore_Job *job_thread_end;
542 Ecore_Timer *flight_mode_timer;
546 /* for use volume key setting */
547 Ecore_Event_Handler *volkey_release_handler;
548 Ecore_Event_Handler *volkey_press_handler;
549 Ecore_Timer *vol_up_key_longpress;
550 Ecore_Timer *vol_down_key_longpress;
551 Ecore_X_Display *xdisplay;
553 MSG_BUBBLE_DATA *bubble_data; /* For bubble data structure */
554 } MSG_COMPOSER_VIEW_DATA_S;
556 #endif /* __MSG_UI_COMPOSER_DATA_H_ */