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 COMPOSER_CONTENT_CREATION_NONE,
289 COMPOSER_CONTENT_CREATION_ALLOWED,
290 COMPOSER_CONTENT_CREATION_ALLOWED_WITH_RESIZE,
291 COMPOSER_CONTENT_CREATION_NOT_ALLOWED,
292 } COMPOSER_CONTENT_CREATION_MODE_E;
294 /******************************
296 *******************************/
298 char m_szextend[COMPOSER_COMMON_EXT_MAX_LENGTH + 1];
299 char m_szmime_type[COMPOSER_COMMON_MIME_MAX_LEN + 1];
300 COMPOSER_MEDIA_TYPE_E m_ncontent_type;
301 } composer_mime_type_t;
304 Used change number for contact info
306 typedef struct _CONTACT_ITEM_S {
308 int type; /*COMPOSER_ADDR_TYPE_NUMBER:number, COMPOSER_ADDR_TYPE_EMAIL:email*/
309 int contact_type; /*number or email type of contact like Mobile, Home*/
310 char recipient[COMPOSER_RECIPIENT_ADDRESS_VAL_LEN_MAX+1];
314 Used MBE's data && PredictSearch
316 typedef struct _RECIPIENT_ITEM_S {
317 COMPOSER_RECP_ADDR_E type;
319 char recipient[COMPOSER_RECIPIENT_ADDRESS_VAL_LEN_MAX+1];
320 char display_name[COMPOSER_RECIPIENT_ADDRESS_VAL_LEN_MAX+1];
321 char image_path[COMPOSER_FILEPATH_LEN_MAX+1];
324 typedef struct _RECIPIENT_S {
329 bool is_required_address_popup;
332 Evas_Object *bx_main;
337 Evas_Object *popup_selected;
338 Elm_Object_Item *sel_mbe_item;
339 RECIPIENT_ITEM_S *sel_r_item;
341 Evas_Object *popup_change_number;
342 Elm_Genlist_Item_Class change_number_itc;
344 Ecore_Idler *scroll_down_idler;
346 COMPOSER_RECP_ADDR_E type;
347 Ecore_Idler *notify_popup_idler;
350 typedef struct _PREDICTSEARCH_S {
354 Evas_Object *glist_ps;
355 Elm_Genlist_Item_Class itc_1line;
356 Elm_Genlist_Item_Class itc_2line;
358 COMPOSER_PREDICTSEARCH_STATE_E state;
360 char txt_ps_keyword[COMPOSER_RECIPIENT_ADDRESS_VAL_LEN_MAX+1];
361 char txt_ps_reqkeyword[COMPOSER_RECIPIENT_ADDRESS_VAL_LEN_MAX+1];
363 contacts_list_h ct_list;
366 Ecore_Idler *idler_ps;
367 Ecore_Timer *timer_ps;
370 typedef struct _SUBJECT_S {
373 Evas_Object *del_icon;
376 typedef struct _MSG_COMPOSER_ATTACHITEM_S {
378 char file_path[COMPOSER_FILEPATH_LEN_MAX + 1];
379 char file_name[COMPOSER_FILEPATH_LEN_MAX + 1];
381 } MSG_COMPOSER_ATTACH_ITEM_S;
383 typedef struct _MSG_COMPOSER_ATTACH_S {
385 long long attachfileSize;
386 Eina_List *attachitem_list;
387 } MSG_COMPOSER_ATTACH_S;
389 typedef struct _text_info {
390 COMPOSER_CHAR_ENCODE_E encode;
395 typedef struct _MSG_COMPOSER_BODY_PAGE_S {
397 Evas_Object *page_main_box;
399 Evas_Object *upper_layout;
400 Evas_Object *page_box;
401 Evas_Object *del_icon;
405 Evas_Object *image_item;
406 char image_file_path[COMPOSER_FILEPATH_LEN_MAX + 1];
409 text_info_s text_info;
412 Evas_Object *sound_item;
413 char sound_file_path[COMPOSER_FILEPATH_LEN_MAX + 1];
416 } MSG_COMPOSER_BODY_PAGE_S;
418 typedef struct _MSG_COMPOSER_BODY_S {
420 Eina_List *page_list;
423 COMPOSER_CONTENT_CREATION_MODE_E creation_allowed;
424 } MSG_COMPOSER_BODY_S;
426 typedef struct _MSG_COMPOSER_DATA_S {
427 /*ug data & callback*/
429 ui_gadget_h loaded_ug;
432 /*composer mode & state*/
433 MSG_UG_MODE_E msg_ug_mode;
434 MSG_COMPOSER_MODE_E composer_mode;
435 COMPOSER_STATE_TYPE_E state;
436 COMPOSER_ROTATE_TYPE_E rotate;
437 COMPOSER_MSG_TYPE_E msg_type;
444 bool sending_success;
446 bool send_button_clicked;
447 bool add_button_clicked;
448 bool add_menu_clicked;
452 bool send_button_is_show;
453 bool isclosed; /* composer is closed */
454 bool loading_draft; /* draft msg loading status */
455 bool make_default_body_size;
456 bool is_default_body_size;
458 bool disable_auto_save_mode;
459 Elm_Win_Indicator_Mode indicator_mode;
461 int current_edit_entry;
468 int send_check_exception_type;
479 msg_handle_t msg_handle;
484 MSG_COMPOSER_BODY_S body_data;
485 MSG_COMPOSER_ATTACH_S attach_data;
487 Eina_List *recipient_list; /* recipient list for bubble composer */
488 RECIPIENT_S *recipient;
489 PREDICTSEARCH_S *predictsearch;
490 Eina_List *attachlist;
491 Eina_List *iter_list;
492 int attach_index; /*current added attach index*/
495 Evas_Object *main_window;
497 Evas_Object *navi_bar;
498 Evas_Object *navi_title_layout;
499 Evas_Object *title_menu_layout;
500 Evas_Object *more_btn;
501 Evas_Object *compose_btn;
502 Evas_Object *back_btn;
503 Evas_Object *toolbar_top;
504 Elm_Object_Item *navi_it;
506 Evas_Object *content_layout;
508 Evas_Object *ly_body;
509 Evas_Object *ly_recipient;
511 Evas_Object *add_button;
512 Evas_Object *send_button;
514 Evas_Object *body_scroll;
515 Evas_Object *body_box;
517 Evas_Object *ly_attach_main;
519 Evas_Object *add_popup;
520 Evas_Object *progress_popup;
521 Evas_Object *popup_end;
522 Evas_Object *ctx_popup;
523 Evas_Object *custom_popup;
524 Eina_List *popup_list;
526 Evas_Object *page_duration_entry;
528 Evas_Object *last_focus_entry;
529 Ecore_Idler *last_focus_idler;
531 Ecore_Thread *attach_thread;
532 Ecore_Job *job_thread_end;
533 Ecore_Timer *flight_mode_timer;
537 /* for use volume key setting */
538 Ecore_Event_Handler *volkey_release_handler;
539 Ecore_Event_Handler *volkey_press_handler;
540 Ecore_Timer *vol_up_key_longpress;
541 Ecore_Timer *vol_down_key_longpress;
542 Ecore_X_Display *xdisplay;
544 MSG_BUBBLE_DATA *bubble_data; /* For bubble data structure */
545 } MSG_COMPOSER_VIEW_DATA_S;
547 #endif /* __MSG_UI_COMPOSER_DATA_H_ */