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://www.tizenopensource.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 #include <Elementary.h>
21 #include <mmf/mm_error.h>
22 #include <metadata_extractor.h>
23 #include <image_util.h>
25 #include "msg-ui-composer-common.h"
26 #include "msg-ui-composer-subject.h"
27 #include "msg-ui-composer-body.h"
28 #include "msg-ui-composer-body-callback.h"
29 #include "msg-ui-composer-attachment.h"
30 #include "msg-ui-composer-recipient.h"
31 #include "msg-ui-composer-popup.h"
32 #include "msg-ui-composer-data.h"
33 #include "msg-ui-composer-bubble.h"
34 #include "msg-ui-composer-main.h"
38 const composer_mime_type_t composer_mime_table[] = {
40 {"aac", "audio/aac", COMPOSER_MEDIA_TYPE_AUDIO},
41 {"amr", "audio/amr", COMPOSER_MEDIA_TYPE_AUDIO},
42 {"amr", "audio/x-amr", COMPOSER_MEDIA_TYPE_AUDIO},
43 {"amr", "audio/amr-wb", COMPOSER_MEDIA_TYPE_AUDIO},
44 {"imy", "audio/imelody", COMPOSER_MEDIA_TYPE_AUDIO},
45 {"imy", "audio/imy", COMPOSER_MEDIA_TYPE_AUDIO},
46 {"imy", "audio/iMelody", COMPOSER_MEDIA_TYPE_AUDIO},
47 {"imy", "audio/melody", COMPOSER_MEDIA_TYPE_AUDIO},
48 {"imy", "audio/x-iMelody", COMPOSER_MEDIA_TYPE_AUDIO},
49 {"imy", "text/iMelody", COMPOSER_MEDIA_TYPE_AUDIO},
50 {"imy", "text/x-iMelody", COMPOSER_MEDIA_TYPE_AUDIO},
51 {"imy", "text/x-imelody", COMPOSER_MEDIA_TYPE_AUDIO},
52 {"mid", "audio/mid", COMPOSER_MEDIA_TYPE_AUDIO},
53 {"mid", "audio/midi", COMPOSER_MEDIA_TYPE_AUDIO},
54 {"mid", "audio/x-mid", COMPOSER_MEDIA_TYPE_AUDIO},
55 {"mid", "audio/x-midi", COMPOSER_MEDIA_TYPE_AUDIO},
56 {"midi", "audio/mid", COMPOSER_MEDIA_TYPE_AUDIO},
57 {"mmf", "application/vnd.smaf", COMPOSER_MEDIA_TYPE_AUDIO},
58 {"mmf", "application/x-smaf", COMPOSER_MEDIA_TYPE_AUDIO},
59 {"mmf", "audio/mmf", COMPOSER_MEDIA_TYPE_AUDIO},
60 {"mmf", "audio/smaf", COMPOSER_MEDIA_TYPE_AUDIO},
61 {"mmf", "audio/x-mmf", COMPOSER_MEDIA_TYPE_AUDIO},
62 {"mmf", "audio/x-smaf", COMPOSER_MEDIA_TYPE_AUDIO},
63 {"mp3", "audio/mpeg", COMPOSER_MEDIA_TYPE_AUDIO},
64 {"mp3", "audio/mp3", COMPOSER_MEDIA_TYPE_AUDIO},
65 {"mp3", "audio/mpg3", COMPOSER_MEDIA_TYPE_AUDIO},
66 {"mp3", "audio/mpeg3", COMPOSER_MEDIA_TYPE_AUDIO},
67 {"mp3", "audio/mpg", COMPOSER_MEDIA_TYPE_AUDIO},
68 {"mp3", "audio/x-mp3", COMPOSER_MEDIA_TYPE_AUDIO},
69 {"mp3", "audio/x-mpeg", COMPOSER_MEDIA_TYPE_AUDIO},
70 {"mp3", "audio/x-mpeg3", COMPOSER_MEDIA_TYPE_AUDIO},
71 {"mp3", "audio/x-mpegaudio", COMPOSER_MEDIA_TYPE_AUDIO},
72 {"mp3", "audio/x-mpg", COMPOSER_MEDIA_TYPE_AUDIO},
73 {"mpg", "audio/x-mpeg", COMPOSER_MEDIA_TYPE_AUDIO},
74 {"m4a", "audio/m4a", COMPOSER_MEDIA_TYPE_AUDIO},
75 {"ra", "audio/x-pn-realaudio", COMPOSER_MEDIA_TYPE_AUDIO},
76 {"rm", "audio/vnd.rn-realaudio", COMPOSER_MEDIA_TYPE_AUDIO},
77 {"rm", "audio/x-pn-multirate-realaudio", COMPOSER_MEDIA_TYPE_AUDIO},
78 {"rm", "audio/x-pn-multirate-realaudio-live", COMPOSER_MEDIA_TYPE_AUDIO},
79 {"spm", "audio/sp-midi", COMPOSER_MEDIA_TYPE_AUDIO},
80 {"wav", "audio/wav", COMPOSER_MEDIA_TYPE_AUDIO},
81 {"wav", "audio/wave", COMPOSER_MEDIA_TYPE_AUDIO},
82 {"wav", "audio/x-wav", COMPOSER_MEDIA_TYPE_AUDIO},
83 {"wav", "audio/x-wave", COMPOSER_MEDIA_TYPE_AUDIO},
84 {"wma", "audio/wma", COMPOSER_MEDIA_TYPE_AUDIO},
85 {"wma", "audio/x-ms-wma", COMPOSER_MEDIA_TYPE_AUDIO},
86 {"xmf", "audio/mobile-xmf", COMPOSER_MEDIA_TYPE_AUDIO},
87 {"xmf", "audio/xmf", COMPOSER_MEDIA_TYPE_AUDIO},
88 {"xmf", "audio/x-xmf", COMPOSER_MEDIA_TYPE_AUDIO},
90 {"bmp", "image/bmp", COMPOSER_MEDIA_TYPE_IMAGE},
91 {"bmp", "image/x-bmp", COMPOSER_MEDIA_TYPE_IMAGE},
92 {"gif", "image/gif", COMPOSER_MEDIA_TYPE_IMAGE},
93 {"GIF", "image/gif", COMPOSER_MEDIA_TYPE_IMAGE},
94 {"gif", "image/vnd.tmo.my5-gif", COMPOSER_MEDIA_TYPE_IMAGE},
95 {"jpg", "image/jpg", COMPOSER_MEDIA_TYPE_IMAGE},
96 {"jpg", "image/jpeg", COMPOSER_MEDIA_TYPE_IMAGE},
97 {"jpg", "image/vnd.tmo.my5-jpg", COMPOSER_MEDIA_TYPE_IMAGE},
98 {"jpeg", "image/jpeg", COMPOSER_MEDIA_TYPE_IMAGE},
99 {"JPG", "image/jpeg", COMPOSER_MEDIA_TYPE_IMAGE},
100 {"jpg", "image/pjpeg", COMPOSER_MEDIA_TYPE_IMAGE},
101 {"jpe", "image/jpeg", COMPOSER_MEDIA_TYPE_IMAGE},
102 {"png", "image/png", COMPOSER_MEDIA_TYPE_IMAGE},
103 {"wbmp", "image/vnd.wap.wbmp", COMPOSER_MEDIA_TYPE_IMAGE},
104 {"wbmp", "image/wbmp", COMPOSER_MEDIA_TYPE_IMAGE},
105 {"swf", "application/x-shockwave-flash", COMPOSER_MEDIA_TYPE_UNKNOWN},
106 {"tif", "image/tiff", COMPOSER_MEDIA_TYPE_IMAGE},
107 {"tif", "image/tif", COMPOSER_MEDIA_TYPE_IMAGE},
108 {"pmd", "audio/pmd", COMPOSER_MEDIA_TYPE_IMAGE},
110 {"3gp", "audio/3gpp", COMPOSER_MEDIA_TYPE_VIDEO},
111 {"3gp", "video/3gpp", COMPOSER_MEDIA_TYPE_VIDEO},
112 {"3gp", "video/3gp", COMPOSER_MEDIA_TYPE_VIDEO},
113 {"3gp", "video/h263", COMPOSER_MEDIA_TYPE_VIDEO},
114 {"3gp", "video/mp4v-es", COMPOSER_MEDIA_TYPE_VIDEO},
115 {"asf", "audio/x-ms-asf", COMPOSER_MEDIA_TYPE_VIDEO},
116 {"asf", "video/x-ms-asf", COMPOSER_MEDIA_TYPE_VIDEO},
117 {"asx", "video/x-ms-asf", COMPOSER_MEDIA_TYPE_VIDEO},
118 {"avi", "video/avi", COMPOSER_MEDIA_TYPE_VIDEO},
119 {"mp2", "video/mpeg", COMPOSER_MEDIA_TYPE_VIDEO},
120 {"mp4", "audio/mp4", COMPOSER_MEDIA_TYPE_VIDEO},
121 {"mp4", "audio/MP4A-LATM", COMPOSER_MEDIA_TYPE_VIDEO},
122 {"mp4", "audio/mpeg4", COMPOSER_MEDIA_TYPE_VIDEO},
123 {"mp4", "video/mp4", COMPOSER_MEDIA_TYPE_VIDEO},
124 {"mp4", "video/mpeg4", COMPOSER_MEDIA_TYPE_VIDEO},
125 {"mp4", "video/x-mp4", COMPOSER_MEDIA_TYPE_VIDEO},
126 {"mp4", "video/x-pv-mp4", COMPOSER_MEDIA_TYPE_VIDEO},
127 {"mpg", "video/mpeg", COMPOSER_MEDIA_TYPE_VIDEO},
128 {"mpeg", "video/mpeg", COMPOSER_MEDIA_TYPE_VIDEO},
129 {"rm", "video/x-pn-multirate-realvideo", COMPOSER_MEDIA_TYPE_VIDEO},
130 {"rm", "video/vnd.rn-realmedia", COMPOSER_MEDIA_TYPE_VIDEO},
131 {"rm", "video/vnd.rn-realvideo", COMPOSER_MEDIA_TYPE_VIDEO},
132 {"rv", "video/x-pn-realvideo", COMPOSER_MEDIA_TYPE_VIDEO},
133 {"sdp", "application/sdp", COMPOSER_MEDIA_TYPE_VIDEO},
134 {"sdp", "video/sdp", COMPOSER_MEDIA_TYPE_VIDEO},
135 {"wmv", "video/x-ms-wmv", COMPOSER_MEDIA_TYPE_VIDEO},
137 {"txt", "text/plain", COMPOSER_MEDIA_TYPE_TEXT},
138 {"text", "text/plain", COMPOSER_MEDIA_TYPE_TEXT},
139 {"html", "text/html", COMPOSER_MEDIA_TYPE_TEXT},
140 {"htm", "text/html", COMPOSER_MEDIA_TYPE_TEXT},
141 {"wml", "text/vnd.wap.wml", COMPOSER_MEDIA_TYPE_TEXT},
142 {"xml", "text/xml", COMPOSER_MEDIA_TYPE_TEXT},
144 {"vbm", "text/x-vbookmark", COMPOSER_MEDIA_TYPE_UNKNOWN},
145 {"vcf", "text/x-vcard", COMPOSER_MEDIA_TYPE_UNKNOWN},
146 {"vcs", "text/x-vCalendar", COMPOSER_MEDIA_TYPE_UNKNOWN},
147 {"vnt", "text/x-vnote", COMPOSER_MEDIA_TYPE_UNKNOWN},
149 {"dcf", "application/vnd.oma.drm.content", COMPOSER_MEDIA_TYPE_DRM},
150 {"dm", "application/vnd.oma.drm.message", COMPOSER_MEDIA_TYPE_DRM},
151 {"odf", "application/vnd.oma.drm.dcf", COMPOSER_MEDIA_TYPE_DRM},
152 {"oro", "application/vnd.oma.drm.ro+xml", COMPOSER_MEDIA_TYPE_DRM},
153 {"ro", "application/vnd.oma.drm.rights+xml", COMPOSER_MEDIA_TYPE_DRM},
154 {"ro", "application/vnd.oma.drm.rights+wbxml", COMPOSER_MEDIA_TYPE_DRM},
156 {"doc", "application/msword", COMPOSER_MEDIA_TYPE_UNKNOWN},
157 {"doc", "applcation/vnd.ms-word", COMPOSER_MEDIA_TYPE_UNKNOWN},
158 {"xls", "application/vnd.ms-excel", COMPOSER_MEDIA_TYPE_UNKNOWN},
159 {"xls", "application/x-msexcel", COMPOSER_MEDIA_TYPE_UNKNOWN},
160 {"ppt", "application/vnd.ms-powerpoint", COMPOSER_MEDIA_TYPE_UNKNOWN},
161 {"ppt", "application/x-mspowerpoint", COMPOSER_MEDIA_TYPE_UNKNOWN},
162 {"pdf", "application/pdf", COMPOSER_MEDIA_TYPE_UNKNOWN},
164 {"rm ", "application/vnd.rn-realmedia", COMPOSER_MEDIA_TYPE_UNKNOWN},
165 {"smi", "application/smil", COMPOSER_MEDIA_TYPE_UNKNOWN},
166 {"smil", "application/smil", COMPOSER_MEDIA_TYPE_UNKNOWN},
167 {"xml", "application/vnd.oma.drm.roap-pdu+xml", COMPOSER_MEDIA_TYPE_UNKNOWN},
168 {"xml", "application/vnd.oma.drm.roap-trigger+xml", COMPOSER_MEDIA_TYPE_UNKNOWN},
169 {"xxx", "application/octet-stream", COMPOSER_MEDIA_TYPE_UNKNOWN},
172 char *msg_ui_composer_edj_get(MSG_COMPOSER_VIEW_DATA_S *cd)
174 return MSGC_UI_DEFAULT_EDJ;
177 Evas_Object *msg_ui_composer_load_edj(Evas_Object *parent, const char *edj_file, const char *group)
180 layout = elm_layout_add(parent);
182 elm_layout_file_set(layout, edj_file, group);
186 Evas_Object *msg_ui_composer_layout_create(Evas_Object *parent, bool indicator)
189 D_MSG_RETVM_IF(parent == NULL, NULL, "parent object == NULL");
193 layout = elm_layout_add(parent);
194 if (layout == NULL) {
195 D_EMSG("[ASSERT] elm_layout_add failed!!");
199 if (indicator == true)
200 elm_layout_theme_set(layout, "layout", "application", "default");
202 elm_layout_theme_set(layout, "layout", "application", "noindicator");
204 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
205 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
206 evas_object_show(layout);
211 Evas_Object *msg_ui_composer_conformant_create(Evas_Object *parent_win, Evas_Object *inner)
214 Evas_Object *conform;
215 D_MSG_RETVM_IF(!parent_win, NULL,"Inputted Paremeter Window is Invalid");
216 D_MSG_RETVM_IF(!inner, NULL,"Inputted Paremeter Content is Invalid");
218 conform = elm_conformant_add(parent_win);
219 D_MSG_RETVM_IF(!conform, NULL,"Fail to Create conformant object");
221 elm_win_conformant_set(parent_win, EINA_TRUE);
222 evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
223 evas_object_size_hint_align_set(conform, EVAS_HINT_FILL, EVAS_HINT_FILL);
224 elm_win_resize_object_add(parent_win, conform);
225 evas_object_show(conform);
227 elm_object_content_set(conform, inner);
232 Evas_Object *msg_ui_composer_bg_create(Evas_Object *parent)
234 D_MSG_RETVM_IF(parent == NULL, NULL, "parent object == NULL");
235 Evas_Object *bg = elm_bg_add(parent);
236 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
237 evas_object_show(bg);
241 Evas_Object *msg_ui_composer_toolbar_create(Evas_Object *parent)
243 MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG);
245 Evas_Object *toolbar = NULL;
247 toolbar = elm_toolbar_add(parent);
248 elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND);
253 int64 msg_composer_get_file_size(const char *path)
255 return ecore_file_size(path);
258 char *msg_common_get_file_ext(const char *a_pszfile_name)
260 if (a_pszfile_name != NULL) {
261 int nlen = strlen(a_pszfile_name);
262 char *psztemp = (char *)a_pszfile_name + nlen;
266 if (*psztemp == '.') {
277 COMPOSER_MEDIA_TYPE_E msg_composer_get_media_type(const char *a_pszfile_path)
280 unsigned int nmimeidx = 0;
281 unsigned int nmime_max = 0;
283 if (a_pszfile_path == NULL)
284 return COMPOSER_MEDIA_TYPE_UNKNOWN;
286 pext = msg_common_get_file_ext(a_pszfile_path);
287 nmime_max = (sizeof(composer_mime_table) / sizeof(composer_mime_type_t));
289 for (; nmimeidx < nmime_max; nmimeidx++) {
290 int nlen = strlen(composer_mime_table[nmimeidx].m_szextend);
292 if (strncasecmp(composer_mime_table[nmimeidx].m_szextend, pext, nlen) == 0) {
293 return composer_mime_table[nmimeidx].m_ncontent_type;
297 return COMPOSER_MEDIA_TYPE_UNKNOWN;
300 COMPOSER_RETURN_TYPE_E msg_composer_common_get_media_duration(const char *file_path, int *duration)
304 metadata_extractor_h metadata_h = NULL;
305 int ret = METADATA_EXTRACTOR_ERROR_NONE;
308 if (!file_path || !duration) {
309 D_EMSG("file_path or duration is not exist");
310 return COMPOSER_RETURN_FAIL;
313 ret = metadata_extractor_create(&metadata_h);
314 if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
315 D_EMSG("metadata_extractor_create is failed ret = %d", ret);
316 return COMPOSER_RETURN_FAIL;
319 ret = metadata_extractor_set_path(metadata_h, file_path);
320 if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
321 D_EMSG("metadata_extractor_set_path is failed ret = %d", ret);
322 metadata_extractor_destroy(metadata_h);
323 return COMPOSER_RETURN_FAIL;
326 ret = metadata_extractor_get_metadata(metadata_h, METADATA_DURATION, &value);
327 if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
328 D_EMSG("metadata_extractor_get_metadata is failed ret = %d", ret);
329 metadata_extractor_destroy(metadata_h);
330 return COMPOSER_RETURN_FAIL;
334 *duration = atoi(value);
338 D_MSG("file : %s, duration : %d", file_path, *duration);
340 metadata_extractor_destroy(metadata_h);
344 return COMPOSER_RETURN_SUCCESS;
347 COMPOSER_RETURN_TYPE_E msg_composer_common_get_thumbnail(MSG_COMPOSER_VIEW_DATA_S *cd, const char *src_file_path, char *thumb_file_path, int size_thumb_file_path)
350 COMPOSER_MEDIA_TYPE_E media_type;
352 char temp_img_file[COMPOSER_FILEPATH_LEN_MAX] = {0,};
353 char *filename_without_ext = NULL;
354 const char *filename = NULL;
356 if (!src_file_path || !thumb_file_path) {
357 D_EMSG("file path or thumbnail path is NULL");
358 return COMPOSER_RETURN_NULL_POINTER;
361 if (!ecore_file_exists(src_file_path)) {
362 D_EMSG("file path is not exist");
363 return COMPOSER_RETURN_NULL_POINTER;
366 media_type = msg_composer_get_media_type(src_file_path);
367 if (media_type == COMPOSER_MEDIA_TYPE_VIDEO) {
369 filename = ecore_file_file_get(src_file_path);
371 filename_without_ext = ecore_file_strip_ext(filename);
373 if (filename_without_ext) {
374 snprintf(temp_img_file, sizeof(temp_img_file)-1, "%s/temp_image_%s.jpg", cd->working_path, filename_without_ext);
375 g_free(filename_without_ext);
377 return COMPOSER_RETURN_FAIL;
381 return COMPOSER_RETURN_FAIL;
384 /* get image of video*/
385 ret = msg_composer_common_get_image_in_video(src_file_path, temp_img_file);
386 if (ret == COMPOSER_RETURN_SUCCESS) {
387 strncpy(thumb_file_path, temp_img_file, size_thumb_file_path);
390 D_EMSG("media type is not video type media_type = %d !!", media_type);
391 return COMPOSER_RETURN_FAIL;
395 return COMPOSER_RETURN_SUCCESS;
398 void msg_ui_composer_clear(MSG_COMPOSER_VIEW_DATA_S *cd)
401 D_MSG_RETM_IF(cd == NULL, "Composer Data is NULL");
405 msg_ui_composer_recipient_clear(cd->recipient);
409 msg_ui_composer_subject_clear(cd);
410 cd->isSubject = false;
413 if (cd->attach_data.attachment_Cnt > 0) {
414 msg_ui_composer_attachment_clear(cd);
417 msg_ui_composer_body_clear(cd);
422 static void __msg_ui_composer_change_to_sms(MSG_COMPOSER_VIEW_DATA_S *cd)
427 MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] composer data is NULL");
431 MSG_COMPOSER_BODY_PAGE_S *page_data = NULL;
432 MSG_COMPOSER_BODY_S *body_data = &cd->body_data;
434 /* reset region info */
435 body_data->region_order = COMPOSER_REGION_ORDER_UNDETERMINDED;
437 page_data = (MSG_COMPOSER_BODY_PAGE_S *)eina_list_nth(cd->body_data.page_list, 0);
439 char *body_text = elm_entry_markup_to_utf8(elm_entry_entry_get(page_data->entry));
441 msg_ui_composer_body_info_area_update(cd);
448 static void __msg_ui_composer_change_to_mms(MSG_COMPOSER_VIEW_DATA_S *cd)
453 MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] composer data is NULL");
457 msg_ui_composer_body_info_area_update(cd);
461 COMPOSER_RETURN_TYPE_E msg_ui_composer_change_message_type(MSG_COMPOSER_VIEW_DATA_S *cd, COMPOSER_MSG_TYPE_E msg_type)
465 MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] composer data is NULL");
466 return COMPOSER_RETURN_FAIL;
469 if (cd->msg_type == msg_type) {
470 MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "[DEBUG] it doesn't need to change message type");
471 return COMPOSER_RETURN_SUCCESS;
475 case COMPOSER_MSG_TYPE_SMS:
476 msg_ui_composer_common_tickernoti(cd, COMPOSER_TICKERNOTI_CHANGED_SMS);
478 cd->msg_type = COMPOSER_MSG_TYPE_SMS;
479 __msg_ui_composer_change_to_sms(cd);
480 msg_ui_composer_toolbar_top_item_change(cd, true);
482 case COMPOSER_MSG_TYPE_MMS:
483 if (cd->loading_draft == false)
484 msg_ui_composer_common_tickernoti(cd, COMPOSER_TICKERNOTI_CHANGED_MMS);
486 cd->loading_draft = false;
488 cd->msg_type = COMPOSER_MSG_TYPE_MMS;
489 __msg_ui_composer_change_to_mms(cd);
490 msg_ui_composer_toolbar_top_item_change(cd, false);
493 MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "[DEBUG] invalid message type");
494 return COMPOSER_RETURN_FAIL;
497 bool ret = msg_ui_composer_common_is_send_possible(cd);
498 msg_ui_composer_body_update_send_btn_icon(cd, !ret);
501 return COMPOSER_RETURN_SUCCESS;
504 COMPOSER_MSG_TYPE_E msg_ui_composer_check_message_type(MSG_COMPOSER_VIEW_DATA_S *cd)
509 MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSSERT] composer data in NULL");
510 return COMPOSER_MSG_TYPE_INVALID;
514 return COMPOSER_MSG_TYPE_MMS;
516 if (cd->attach_data.attachment_Cnt > 0)
517 return COMPOSER_MSG_TYPE_MMS;
519 if (msg_ui_composer_body_is_mms(cd) == EINA_TRUE)
520 return COMPOSER_MSG_TYPE_MMS;
522 if (msg_ui_composer_recipient_is_mms(cd) == EINA_TRUE)
523 return COMPOSER_MSG_TYPE_MMS;
525 return COMPOSER_MSG_TYPE_SMS;
528 void msg_ui_composer_message_type_check_and_change(MSG_COMPOSER_VIEW_DATA_S *cd)
532 COMPOSER_MSG_TYPE_E checked_type;
534 checked_type = msg_ui_composer_check_message_type(cd);
536 if (cd->msg_type == COMPOSER_MSG_TYPE_SMS && checked_type == COMPOSER_MSG_TYPE_MMS) {
537 D_MSG("### Message Type Change from [SMS] to [MMS] ###");
538 msg_ui_composer_change_message_type(cd, COMPOSER_MSG_TYPE_MMS);
539 } else if (cd->msg_type == COMPOSER_MSG_TYPE_MMS && checked_type == COMPOSER_MSG_TYPE_SMS) {
540 D_MSG("### Message Type Change from [MMS] to [SMS] ###");
541 msg_ui_composer_change_message_type(cd, COMPOSER_MSG_TYPE_SMS);
543 D_MSG("Now msg type is [%d] & checked msg type is [%d](0: INVAILD, 1: SMS, 2: MMS)", cd->msg_type, checked_type);
549 Eina_Bool msg_ui_composer_last_focus_load(void *data)
552 MSG_COMPOSER_VIEW_DATA_S *cd = (MSG_COMPOSER_VIEW_DATA_S *)data;
553 if(!cd) return EINA_FALSE;
555 if (cd->last_focus_entry == NULL) {
556 D_MSG("NO ENTRY FOCUS");
560 elm_object_focus_set(cd->last_focus_entry, EINA_TRUE);
561 D_MSG("### Focused Entry Load = %p",cd->last_focus_entry);
566 void msg_ui_composer_last_focused_entry_set(void *data, Evas_Object *entry)
568 MSG_COMPOSER_VIEW_DATA_S *cd;
569 cd = (MSG_COMPOSER_VIEW_DATA_S *)data;
570 cd->last_focus_entry = entry;
573 Evas_Object *msg_ui_composer_last_focused_entry_get(void *data)
575 MSG_COMPOSER_VIEW_DATA_S *cd;
576 cd = (MSG_COMPOSER_VIEW_DATA_S *)data;
577 if (!cd) return NULL;
579 return cd->last_focus_entry;
582 Evas_Object *msg_ui_composer_last_body_entry_get(void *data)
586 MSG_COMPOSER_VIEW_DATA_S *cd = (MSG_COMPOSER_VIEW_DATA_S *)data;
588 MSG_COMPOSER_BODY_PAGE_S *page_data = eina_list_nth(cd->body_data.page_list, cd->current_edit_entry);
589 D_MSG("cd->current_edit_entry = %d", cd->current_edit_entry);
591 if (page_data && page_data->entry) {
592 return page_data->entry;
594 D_MSG("No Entry Saved");
602 bool msg_ui_composer_last_focus_is_recipient(void *data)
605 D_MSG_RETVM_IF(data == NULL, false, "data is NULL");
607 MSG_COMPOSER_VIEW_DATA_S *cd = (MSG_COMPOSER_VIEW_DATA_S *)data;
608 RECIPIENT_S *recipient = cd->recipient;
609 Evas_Object *last_focus = msg_ui_composer_last_focused_entry_get(cd);
611 if (last_focus && recipient) {
612 if (last_focus == recipient->mbe) {
621 void bundle_send_to_result(void *data, char *key, char *val)
624 D_MSG("key = %s, val = %s", key, val);
626 MSG_COMPOSER_VIEW_DATA_S *cd = (MSG_COMPOSER_VIEW_DATA_S *)data;
627 service_h svc_handle;
628 if (service_create(&svc_handle) < 0 || svc_handle == NULL) {
629 D_EMSG("service_create() is failed !!");
631 service_add_extra_data(svc_handle, key, val);
632 ug_send_result(cd->ug, svc_handle);
633 service_destroy(svc_handle);
638 bool msg_ui_composer_common_is_send_possible(MSG_COMPOSER_VIEW_DATA_S *cd)
643 MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] composer data is NULL");
647 MSG_COMPOSER_BODY_S *body_data = &cd->body_data;
648 MSG_COMPOSER_BODY_PAGE_S *page_data = NULL;
650 if (cd->msg_type == COMPOSER_MSG_TYPE_MMS) {
652 char *subject = elm_entry_markup_to_utf8(elm_entry_entry_get(cd->sub_data.entry));
653 if (subject && strlen(subject) > 0) {
661 if (cd->attach_data.attachment_Cnt > 0) {
666 for (i = 0; i < cd->body_data.page_count; i++) {
667 page_data = (MSG_COMPOSER_BODY_PAGE_S *)eina_list_nth(body_data->page_list, i);
669 if (page_data->is_image_item)
672 if (page_data->is_sound_item)
675 char *body_text = elm_entry_markup_to_utf8(elm_entry_entry_get(page_data->entry));
677 if (strlen(body_text) > 0) {
684 } else if (cd->msg_type == COMPOSER_MSG_TYPE_SMS) {
685 page_data = (MSG_COMPOSER_BODY_PAGE_S *)eina_list_nth(body_data->page_list, 0);
687 char *body_text = elm_entry_markup_to_utf8(elm_entry_entry_get(page_data->entry));
689 if (strlen(body_text) > 0) {
697 MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] invalid message type");
705 COMPOSER_RETURN_TYPE_E msg_composer_common_get_image_in_video(const char *video_file_path, char *image_file_path)
709 COMPOSER_MEDIA_TYPE_E media_type;
710 metadata_extractor_h metadata_h = NULL;
711 int ret = METADATA_EXTRACTOR_ERROR_NONE;
715 void *thumbnail = NULL;
718 media_type = msg_composer_get_media_type(video_file_path);
719 if (media_type != COMPOSER_MEDIA_TYPE_VIDEO) {
720 D_EMSG("It is not video file %s", video_file_path);
721 return COMPOSER_RETURN_FAIL;
724 ret = metadata_extractor_create(&metadata_h);
725 if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
726 D_EMSG("metadata_extractor_create is failed ret = %d", ret);
727 return COMPOSER_RETURN_FAIL;
730 ret = metadata_extractor_set_path(metadata_h, video_file_path);
731 if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
732 D_EMSG("metadata_extractor_set_path is failed ret = %d", ret);
733 metadata_extractor_destroy(metadata_h);
734 return COMPOSER_RETURN_FAIL;
737 ret = metadata_extractor_get_metadata(metadata_h, METADATA_VIDEO_WIDTH, &value);
738 if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
739 D_EMSG("metadata_extractor_get_metadata is failed ret = %d", ret);
740 metadata_extractor_destroy(metadata_h);
741 return COMPOSER_RETURN_FAIL;
745 video_w = atoi(value);
750 ret = metadata_extractor_get_metadata(metadata_h, METADATA_VIDEO_HEIGHT, &value);
751 if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
752 D_EMSG("metadata_extractor_get_metadata is failed ret = %d", ret);
753 metadata_extractor_destroy(metadata_h);
754 return COMPOSER_RETURN_FAIL;
758 video_h = atoi(value);
763 ret = metadata_extractor_get_frame(metadata_h, &thumbnail, &thumbsize);
764 if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
765 D_EMSG("metadata_extractor_get_frame is failed ret = %d", ret);
766 metadata_extractor_destroy(metadata_h);
767 return COMPOSER_RETURN_FAIL;
771 ret = image_util_encode_jpeg((unsigned char *)thumbnail, video_w, video_h, IMAGE_UTIL_COLORSPACE_RGB888, 100, image_file_path);
775 if (ret != IMAGE_UTIL_ERROR_NONE) {
776 D_EMSG("image_util_encode_jpeg is failed ret = %d", ret);
777 metadata_extractor_destroy(metadata_h);
778 return COMPOSER_RETURN_FAIL;
782 metadata_extractor_destroy(metadata_h);
785 return COMPOSER_RETURN_SUCCESS;
788 COMPOSER_RETURN_TYPE_E msg_ui_composer_common_get_file(MSG_COMPOSER_VIEW_DATA_S *cd, const char * src_file_path, char *dst_file_path, int size_dst_file_path)
791 const char *filename = NULL;
793 char temp_file_path[COMPOSER_FILEPATH_LEN_MAX] = {0,};
795 if (ecore_file_exists(src_file_path) == EINA_FALSE) {
796 return COMPOSER_RETURN_FAIL;
799 filename = ecore_file_file_get(src_file_path);
801 snprintf(temp_file_path, sizeof(temp_file_path)-1, "%s%s", cd->working_path, filename);
803 while(ecore_file_exists(temp_file_path)){
804 bzero(temp_file_path, sizeof(temp_file_path));
805 snprintf(temp_file_path, sizeof(temp_file_path)-1, "%s%d_%s", cd->working_path, i, filename);
808 if (i < 0) return COMPOSER_RETURN_FAIL;
812 if (ecore_file_cp(src_file_path, temp_file_path) == EINA_FALSE) {
813 D_MSG("temp_file_path = %s", temp_file_path);
814 return COMPOSER_RETURN_FAIL;
817 strncpy(dst_file_path, temp_file_path, size_dst_file_path);
818 D_MSG("copy file from %s to %s", src_file_path, dst_file_path);
821 return COMPOSER_RETURN_FAIL;
825 return COMPOSER_RETURN_SUCCESS;
828 static char *__get_item_tag(char *text)
833 int tagStrLength = 0;
839 D_MSG("text(%p)[%d] = %s", text, strlen(text),text);
841 tagStart = strstr(fulltext, "<item");
843 tagEnd = strchr(tagStart, '>');
845 tagStrLength = tagEnd - tagStart + 1;
846 return strndup(tagStart, tagStrLength);
853 static char *__remove_item_tag(char *text)
855 char *fulltext = NULL;
856 char *tagStart = NULL;
858 char *braceStart = NULL;
859 char *braceEnd = NULL;
860 char *postStr = NULL;
863 int postStrLength = 0;
864 bool isitemTag = false;
869 char *textBuf = strdup(text);
872 D_EMSG("strdup is failed");
877 strLength = strlen(textBuf);
878 D_MSG("text length = %d, text = [%s]", strLength, textBuf);
880 while ((tagStart = strstr(fulltext, "<item"))) {
881 braceEnd = strchr(tagStart, '>');
883 braceStart = strstr(braceEnd, "</item>");
885 tagEnd = (braceStart + strlen("</item>") - 1);
887 D_EMSG("There is no close item tag");
891 D_EMSG("There is no close tag");
896 postStrLength = strLength - (tagEnd - fulltext + 1);
897 postStr = strndup(tagEnd + 1, postStrLength);
899 D_EMSG("strndup is failed");
904 strncpy(tagStart, postStr, postStrLength);
905 *(tagStart + postStrLength) = '\0';
906 D_MSG("after textBuf = [%s]", textBuf);
922 static char *__get_tag_value(const char *tag_str, const char *tag_name)
926 if (!tag_name || !tag_str)
929 if ((tag = strstr(tag_str, tag_name))) {
930 if (tag[strlen(tag_name)] == '_')
932 char *value = strchr(tag, '=');
937 } while (!isalnum(*value) && *value != '#');
940 char *spArray[spCnt];
941 spArray[0] = strchr(value, '>');
942 spArray[1] = strchr(value, '\"');
943 spArray[2] = strchr(value, '\'');
944 spArray[3] = strchr(value, '\t');
945 spArray[4] = strchr(value, '\n');
946 char *valueEnd = strchr(value, '\0');
950 if (!strcmp(tag_str, "item") && !strcmp(tag_name, "href"))
953 for (i = start; i < spCnt; i++) {
954 if (spArray[i] && spArray[i] < valueEnd) {
955 valueEnd = spArray[i];
959 int valueLength = valueEnd - value;
960 return strndup(value, valueLength);
967 void msg_composer_entry_filter_addimage(void *data, Evas_Object *entry, char **text)
971 char *item_val = NULL;
972 char *item_tag = NULL;
973 char *filepath = NULL;
974 char *realpath = NULL;
976 MSG_COMPOSER_VIEW_DATA_S *cd = data;
978 D_MSG_RETM_IF(cd == NULL, "Composer Data is Invalid");
979 D_MSG_RETM_IF(entry == NULL,"Parameter Entry is Invalid");
980 D_MSG_RETM_IF((!text || !(*text)),"Parameter Text is Invalid");
982 /*get <item xxx> tag at insert text*/
983 item_tag = __get_item_tag(*text);
987 D_MSG("item_tag = %s", item_tag);
989 /*get value of href in the item tag*/
990 item_val = __get_tag_value(item_tag, "href");
992 D_MSG("item_href_val = %s", item_val);
993 filepath = strstr(item_val, "file:");
995 realpath = filepath + 5;
1001 if (ecore_file_exists(realpath) == EINA_TRUE) {
1002 char * list_item_data = g_strdup(realpath);
1003 if (list_item_data) {
1004 cd->attachlist= eina_list_append(cd->attachlist, list_item_data);
1005 msg_ui_composer_body_items_add(data);
1007 D_EMSG("Fail to g_strdup");
1010 D_EMSG("File is NOT exist %s", realpath);
1013 D_EMSG("File Path is NULL");
1021 /* remove item tag */
1022 char *removed_text = __remove_item_tag(*text);
1026 *text = removed_text;
1036 msg_composer_entry_filter_remove_markup(void *data, Evas_Object *entry, char **text)
1039 D_MSG_RETM_IF(text == NULL || *text == NULL, "New Text is NULL");
1041 char *preedit_str = NULL;
1042 char *utf8_text = NULL;
1043 char *convert_text = NULL;
1044 D_MSG("text [%s]", *text);
1045 /* Check preeditting text and return if it exist*/
1046 preedit_str = strstr(*text, "<preedit>");
1050 /* convert from markup text to utf8 text from entry */
1051 utf8_text = elm_entry_markup_to_utf8(*text);
1054 /* If the string contains "Carrage return ('\n'), it should be changed "<br>" to show properly*/
1055 convert_text = elm_entry_utf8_to_markup(utf8_text);
1058 *text = strdup(convert_text);
1067 int msg_ui_composer_convert_UTF8ToUCS2(unsigned char *pDestText, int maxLength, const char *pSrcText, int srcTextLen)
1071 unsigned char *unicodeTemp = (unsigned char*)pDestText;
1074 int remainedBuffer = maxLength;
1076 if(maxLength == 0 || pSrcText == NULL || pDestText == NULL)
1078 MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT,"[ASSERT]UTF8 to UCS2 Failed as text length is NULL \n");
1082 // null terminated string
1083 if (srcTextLen == -1) {
1084 textLen = strlen((char*)pSrcText);
1085 srcTextLen = textLen;
1087 textLen = srcTextLen;
1093 cd = g_iconv_open("UCS-2BE", "UTF8");
1097 err = g_iconv(cd, (char**)&pSrcText, (gsize*)&textLen, (char**)&unicodeTemp, (gsize*)&remainedBuffer);
1100 ucs2Length = maxLength - remainedBuffer;
1108 void msg_ui_composer_common_tickernoti(MSG_COMPOSER_VIEW_DATA_S *cd, COMPOSER_TICKERNOTI_TYPE_E tickertype)
1110 char popup_msg[DEF_BUF_LEN_L] = {0,};
1112 D_MSG_RETM_IF(cd == NULL, "Composer Data is Invalid");
1114 if (tickertype == COMPOSER_TICKERNOTI_COUNT_MAX) {
1115 const char *str = MSGC_STR_NOTI_RECIPIENT_MAX;
1116 snprintf(popup_msg, sizeof(popup_msg), str, COMPOSER_RECIPIENT_COUNT_MAX);
1117 } else if (tickertype == COMPOSER_TICKERNOTI_DUP_RECP) {
1118 snprintf(popup_msg, sizeof(popup_msg), MSGC_STR_NOTI_RECIPIENT_DUP);
1119 } else if (tickertype == COMPOSER_TICKERNOTI_INVALID_RECP) {
1120 snprintf(popup_msg, sizeof(popup_msg), MSGC_STR_NOTI_RECIPIENT_INVALID);
1121 } else if (tickertype == COMPOSER_TICKERNOTI_CHANGED_SMS) {
1122 snprintf(popup_msg, sizeof(popup_msg), MSGC_STR_NOTI_CHANGE_SMS);
1123 } else if (tickertype == COMPOSER_TICKERNOTI_CHANGED_MMS) {
1124 snprintf(popup_msg, sizeof(popup_msg), MSGC_STR_NOTI_CHANGE_MMS);
1125 } else if (tickertype == COMPOSER_TICKERNOTI_AUTO_SAVED) {
1126 snprintf(popup_msg, sizeof(popup_msg), _MSGSTR("IDS_MSGC_POP_MESSAGE_SAVED_AS_DRAFT"));
1127 } else if (tickertype == COMPOSER_TICKERNOTI_NO_RECIPIENT) {
1128 snprintf(popup_msg, sizeof(popup_msg), _MSGSTR("IDS_MSGF_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"));
1129 } else if (tickertype == COMPOSER_TICKERNOTI_MAXLENGHT_CHAR) {
1130 snprintf(popup_msg, sizeof(popup_msg), _MSGSTR("IDS_MSGF_POP_MAXIMUM_CHARACTERS"));
1135 msg_ui_composer_status_noti_show(popup_msg);
1138 int msg_ui_composer_get_keypad_height(Evas_Object *entry)
1140 D_MSG_RETVM_IF(entry == NULL, 0, "param is NULL");
1146 Ecore_IMF_Context *entry_ctx = elm_entry_imf_context_get(entry);
1147 ecore_imf_context_input_panel_geometry_get(entry_ctx, &keypad_x, &keypad_y, &keypad_w, &keypad_h);
1152 void msg_ui_composer_change_body_scroll_size(MSG_COMPOSER_VIEW_DATA_S *cd, int keypad_height)
1155 D_MSG_RETM_IF(cd == NULL, "Composer Data is Invalid");
1157 int total_height = 0;
1158 int scroll_height = 0;
1164 elm_scroller_region_get(cd->body_scroll, &scroll_x, &scroll_y, &scroll_w, &scroll_h);
1165 D_MSG("scroll region x=%d, y=%d, w=%d, h=%d", scroll_x, scroll_y, scroll_w, scroll_h);
1167 if (cd->rotate == COMPOSER_ROTATE_PORTRAIT || cd->rotate == COMPOSER_ROTATE_PORTRAIT_UPSIDEDOWN)
1168 total_height = (cd->window_h > cd->window_w) ? cd->window_h : cd->window_w;
1170 total_height = (cd->window_h > cd->window_w) ? cd->window_w : cd->window_h;
1172 if (cd->msg_ug_mode == MSG_UG_MODE_FULL_COMPOSER || cd->msg_ug_mode == MSG_UG_MODE_ONLY_COMPOSER) {
1173 RECIPIENT_S *rd = cd->recipient;
1174 D_MSG_RETM_IF(rd == NULL, "recipient Data is NULL");
1175 int recipient_h = 0;
1177 recipient_h = rd->recipient_h;
1179 D_MSG("recipient_h = %d", recipient_h);
1180 if (cd->rotate == COMPOSER_ROTATE_PORTRAIT || cd->rotate == COMPOSER_ROTATE_PORTRAIT_UPSIDEDOWN)
1181 scroll_height = (total_height - keypad_height - recipient_h - MSGC_NAVIBAR_TITLE_H - MSGC_BODY_PADDING - MSGC_INDICATOR_H);
1183 scroll_height = (total_height - keypad_height - recipient_h - MSGC_NAVIBAR_TITLE_H - MSGC_BODY_PADDING);
1185 D_MSG("scroll_height = %d", scroll_height);
1187 if (scroll_height <= COMPOSER_FRAME_BODY_LANDSCAPE_HEIGHT_MIN)
1188 scroll_height = COMPOSER_FRAME_BODY_LANDSCAPE_HEIGHT_MIN;
1190 if (scroll_h != scroll_height) {
1191 evas_object_size_hint_max_set(cd->body_scroll, 9999, scroll_height);
1192 elm_scroller_content_min_limit(cd->body_scroll, EINA_FALSE, EINA_TRUE);
1193 D_MSG("scroll size updated w = %d, h = %d", scroll_w, scroll_height);
1195 } else if (cd->msg_ug_mode == MSG_UG_MODE_BUBBLE_COMPOSER) {
1196 scroll_height = (total_height - keypad_height - MSGC_NAVIBAR_TITLE_H - MSGC_INDICATOR_H - MSGC_BODY_PADDING);
1197 D_MSG("scroll_height = %d", scroll_height);
1199 if (scroll_height <= COMPOSER_FRAME_BODY_LANDSCAPE_HEIGHT_MIN)
1200 scroll_height = COMPOSER_FRAME_BODY_LANDSCAPE_HEIGHT_MIN;
1202 if (scroll_h != scroll_height) {
1203 evas_object_size_hint_max_set(cd->body_scroll, 9999, scroll_height);
1204 elm_scroller_content_min_limit(cd->body_scroll, EINA_FALSE, EINA_TRUE);
1205 D_MSG("scroll size updated w = %d, h = %d", scroll_w, scroll_height);
1208 D_EMSG("Unknown Composer Mode");
1214 void msg_ui_composer_make_default_body_size(MSG_COMPOSER_VIEW_DATA_S *cd)
1217 D_MSG_RETM_IF(cd == NULL, "Composer Data is NULL");
1219 int scroll_height = COMPOSER_FRAME_BODY_LANDSCAPE_HEIGHT_MIN;
1221 cd->is_default_body_size = true;
1223 msg_ui_composer_contract_attach_list(cd);
1225 evas_object_size_hint_max_set(cd->body_scroll, 9999, scroll_height);
1226 elm_scroller_content_min_limit(cd->body_scroll, EINA_FALSE, EINA_TRUE);
1227 /* move scroll to top */
1228 elm_scroller_region_show(cd->body_scroll, 0, 0, 0, 0);
1230 evas_object_event_callback_add(cd->body_box, EVAS_CALLBACK_MOUSE_UP, msg_ui_composer_body_body_layout_clicked_cb, cd);
1235 void msg_ui_composer_entry_imf_resize_cb(void * data, Ecore_IMF_Context *ctx, int value)
1238 MSG_COMPOSER_VIEW_DATA_S *cd = (MSG_COMPOSER_VIEW_DATA_S *)data;
1239 D_MSG_RETM_IF(cd == NULL, "Composer Data is Invalid");
1240 D_MSG_RETM_IF(ctx == NULL, "Ecore_IMF_Context is Invalid");
1246 ecore_imf_context_input_panel_geometry_get(ctx, &keypad_x, &keypad_y, &keypad_w, &keypad_h);
1247 D_MSG("keypad x = %d, y = %d, w = %d, h = %d", keypad_x, keypad_y, keypad_w, keypad_h);
1248 D_MSG("cd->make_default_body_size = %d", cd->make_default_body_size);
1250 if (cd->make_default_body_size) {
1251 if (!cd->is_keypad_show)
1252 cd->make_default_body_size = false;
1254 if (keypad_w != 0 && keypad_h != 0)
1255 msg_ui_composer_change_body_scroll_size(cd, keypad_h);
1261 void msg_ui_composer_entry_imf_state_cb(void * data, Ecore_IMF_Context *ctx, int value)
1265 MSG_COMPOSER_VIEW_DATA_S *cd = (MSG_COMPOSER_VIEW_DATA_S *)data;
1266 D_MSG_RETM_IF(cd == NULL, "Composer Data is Invalid");
1267 D_MSG_RETM_IF(ctx == NULL, "Ecore_IMF_Context is Invalid");
1269 if (value == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
1275 D_MSG("Imf status SHOW");
1277 cd->is_keypad_show = true;
1279 ecore_imf_context_input_panel_geometry_get(ctx, &keypad_x, &keypad_y, &keypad_w, &keypad_h);
1280 D_MSG("keypad x = %d, y = %d, w = %d, h = %d", keypad_x, keypad_y, keypad_w, keypad_h);
1282 msg_ui_composer_change_body_scroll_size(cd, keypad_h);
1283 } else if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
1284 D_MSG("Imf status HIDE");
1286 cd->is_keypad_show = false;
1288 D_MSG("cd->make_default_body_size = %d", cd->make_default_body_size);
1290 if (cd->make_default_body_size) {
1291 cd->make_default_body_size = false;
1292 msg_ui_composer_make_default_body_size(cd);
1294 msg_ui_composer_change_body_scroll_size(cd, 0);
1297 D_EMSG("imf status INVALID");
1303 int msg_ui_composer_get_font_size(int index, int type)
1306 D_MSG("index = %d, type = %d", index, type);
1308 int font_size = MSG_APP_FONT_SIZE_NORMAL;
1310 if (type == COMPOSER_MSG_FONT_SIZE) {
1312 case MSG_APP_FONT_SIZE_INDEX_GIANT:
1313 font_size = MSG_APP_FONT_SIZE_GIANT;
1315 case MSG_APP_FONT_SIZE_INDEX_HUGE:
1316 font_size = MSG_APP_FONT_SIZE_HUGE;
1318 case MSG_APP_FONT_SIZE_INDEX_LARGE:
1319 font_size = MSG_APP_FONT_SIZE_LARGE;
1321 case MSG_APP_FONT_SIZE_INDEX_NORMAL:
1322 font_size = MSG_APP_FONT_SIZE_NORMAL;
1324 case MSG_APP_FONT_SIZE_INDEX_SMALL:
1325 font_size = MSG_APP_FONT_SIZE_SMALL;
1327 case MSG_APP_FONT_SIZE_INDEX_SYSTEM_FONT:
1329 D_MSG("get defulat size index = %d", index);
1330 font_size = MSG_APP_FONT_SIZE_NORMAL;
1333 } else if (type == COMPOSER_SYSTEM_FONT_SIZE) {
1335 case MSG_SYS_FONT_SIZE_INDEX_GIANT:
1336 font_size = MSG_APP_FONT_SIZE_HUGE + 4;
1338 case MSG_SYS_FONT_SIZE_INDEX_HUGE:
1339 font_size = MSG_APP_FONT_SIZE_HUGE;
1341 case MSG_SYS_FONT_SIZE_INDEX_LARGE:
1342 font_size = MSG_APP_FONT_SIZE_LARGE;
1344 case MSG_SYS_FONT_SIZE_INDEX_NORMAL:
1345 font_size = MSG_APP_FONT_SIZE_NORMAL;
1347 case MSG_SYS_FONT_SIZE_INDEX_SMALL:
1348 font_size = MSG_APP_FONT_SIZE_SMALL;
1351 D_MSG("get defulat size index = %d", index);
1352 font_size = MSG_APP_FONT_SIZE_NORMAL;
1356 D_EMSG("Invalid font type");
1364 void msg_ui_composer_apply_font_size(MSG_COMPOSER_VIEW_DATA_S *cd)
1367 D_MSG_RETM_IF(cd == NULL, "Composer Data is Invalid");
1369 int converted_size = 0;
1371 if (cd->font_size.last_updated_setting == COMPOSER_SYSTEM_FONT_SIZE) {
1372 converted_size = cd->font_size.sys_font_size;
1373 } else if (cd->font_size.last_updated_setting == COMPOSER_MSG_FONT_SIZE) {
1374 converted_size = cd->font_size.msg_font_size;
1376 D_EMSG("Invalid type");
1380 /* apply font size */
1381 char font_style_str[DEF_BUF_LEN_S + 1] = {0,};
1382 snprintf(font_style_str, sizeof(font_style_str), "DEFAULT='font_size=%d'", converted_size);
1383 D_MSG("font_style_str = (%s)", font_style_str);
1385 msg_ui_composer_body_apply_font_size(cd, font_style_str);