* 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
+ * http://floralicense.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* limitations under the License.
*/
+
#include <Elementary.h>
#include <utilX.h>
#include <Ecore_X.h>
+#include <mmf/mm_error.h>
+#include <metadata_extractor.h>
+#include <image_util.h>
-#include <devman_haptic.h>
#include "msg-ui-composer-common.h"
+#include "msg-ui-composer-subject.h"
#include "msg-ui-composer-body.h"
+#include "msg-ui-composer-body-callback.h"
+#include "msg-ui-composer-attachment.h"
#include "msg-ui-composer-recipient.h"
#include "msg-ui-composer-popup.h"
#include "msg-ui-composer-data.h"
#include "msg-ui-composer-bubble.h"
#include "msg-ui-composer-main.h"
-/* vib feedback apply when message type change*/
-static bool bVibrating;
-static int dev_handle;
+/* MIME type table*/
+
+const composer_mime_type_t composer_mime_table[] = {
+/*audio*/
+ {"aac", "audio/aac", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"amr", "audio/amr", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"amr", "audio/x-amr", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"amr", "audio/amr-wb", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"imy", "audio/imelody", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"imy", "audio/imy", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"imy", "audio/iMelody", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"imy", "audio/melody", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"imy", "audio/x-iMelody", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"imy", "text/iMelody", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"imy", "text/x-iMelody", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"imy", "text/x-imelody", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mid", "audio/mid", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mid", "audio/midi", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mid", "audio/x-mid", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mid", "audio/x-midi", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"midi", "audio/mid", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mmf", "application/vnd.smaf", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mmf", "application/x-smaf", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mmf", "audio/mmf", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mmf", "audio/smaf", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mmf", "audio/x-mmf", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mmf", "audio/x-smaf", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mp3", "audio/mpeg", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mp3", "audio/mp3", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mp3", "audio/mpg3", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mp3", "audio/mpeg3", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mp3", "audio/mpg", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mp3", "audio/x-mp3", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mp3", "audio/x-mpeg", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mp3", "audio/x-mpeg3", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mp3", "audio/x-mpegaudio", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mp3", "audio/x-mpg", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mpg", "audio/x-mpeg", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"m4a", "audio/m4a", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"ra", "audio/x-pn-realaudio", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"rm", "audio/vnd.rn-realaudio", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"rm", "audio/x-pn-multirate-realaudio", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"rm", "audio/x-pn-multirate-realaudio-live", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"spm", "audio/sp-midi", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"wav", "audio/wav", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"wav", "audio/wave", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"wav", "audio/x-wav", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"wav", "audio/x-wave", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"wma", "audio/wma", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"wma", "audio/x-ms-wma", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"xmf", "audio/mobile-xmf", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"xmf", "audio/xmf", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"xmf", "audio/x-xmf", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"3gp", "audio/3gpp", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mp4", "audio/mp4", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mp4", "audio/MP4A-LATM", COMPOSER_MEDIA_TYPE_AUDIO},
+ {"mp4", "audio/mpeg4", COMPOSER_MEDIA_TYPE_AUDIO},
+/*image*/
+ {"bmp", "image/bmp", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"bmp", "image/x-bmp", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"gif", "image/gif", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"GIF", "image/gif", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"gif", "image/vnd.tmo.my5-gif", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"jpg", "image/jpg", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"jpg", "image/jpeg", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"jpg", "image/vnd.tmo.my5-jpg", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"jpeg", "image/jpeg", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"JPG", "image/jpeg", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"jpg", "image/pjpeg", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"jpe", "image/jpeg", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"png", "image/png", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"wbmp", "image/vnd.wap.wbmp", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"wbmp", "image/wbmp", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"swf", "application/x-shockwave-flash", COMPOSER_MEDIA_TYPE_UNKNOWN},
+ {"tif", "image/tiff", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"tif", "image/tif", COMPOSER_MEDIA_TYPE_IMAGE},
+ {"pmd", "audio/pmd", COMPOSER_MEDIA_TYPE_IMAGE},
+/*video*/
+ {"3gp", "video/3gpp", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"3gp", "video/3gp", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"3gp", "video/h263", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"3gp", "video/mp4v-es", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"asf", "audio/x-ms-asf", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"asf", "video/x-ms-asf", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"asx", "video/x-ms-asf", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"avi", "video/avi", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"mp2", "video/mpeg", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"mp4", "video/mp4", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"mp4", "video/mpeg4", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"mp4", "video/x-mp4", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"mp4", "video/x-pv-mp4", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"mpg", "video/mpeg", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"mpeg", "video/mpeg", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"rm", "video/x-pn-multirate-realvideo", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"rm", "video/vnd.rn-realmedia", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"rm", "video/vnd.rn-realvideo", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"rv", "video/x-pn-realvideo", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"sdp", "application/sdp", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"sdp", "video/sdp", COMPOSER_MEDIA_TYPE_VIDEO},
+ {"wmv", "video/x-ms-wmv", COMPOSER_MEDIA_TYPE_VIDEO},
+/*text*/
+ {"txt", "text/plain", COMPOSER_MEDIA_TYPE_TEXT},
+ {"text", "text/plain", COMPOSER_MEDIA_TYPE_TEXT},
+ {"html", "text/html", COMPOSER_MEDIA_TYPE_TEXT},
+ {"htm", "text/html", COMPOSER_MEDIA_TYPE_TEXT},
+ {"wml", "text/vnd.wap.wml", COMPOSER_MEDIA_TYPE_TEXT},
+ {"xml", "text/xml", COMPOSER_MEDIA_TYPE_TEXT},
+/*vObject*/
+ {"vbm", "text/x-vbookmark", COMPOSER_MEDIA_TYPE_UNKNOWN},
+ {"vcf", "text/x-vcard", COMPOSER_MEDIA_TYPE_UNKNOWN},
+ {"vcs", "text/x-vCalendar", COMPOSER_MEDIA_TYPE_UNKNOWN},
+ {"vnt", "text/x-vnote", COMPOSER_MEDIA_TYPE_UNKNOWN},
+/*drm*/
+ {"dcf", "application/vnd.oma.drm.content", COMPOSER_MEDIA_TYPE_DRM},
+ {"dm", "application/vnd.oma.drm.message", COMPOSER_MEDIA_TYPE_DRM},
+ {"odf", "application/vnd.oma.drm.dcf", COMPOSER_MEDIA_TYPE_DRM},
+ {"oro", "application/vnd.oma.drm.ro+xml", COMPOSER_MEDIA_TYPE_DRM},
+ {"ro", "application/vnd.oma.drm.rights+xml", COMPOSER_MEDIA_TYPE_DRM},
+ {"ro", "application/vnd.oma.drm.rights+wbxml", COMPOSER_MEDIA_TYPE_DRM},
+/*doc*/
+ {"doc", "application/msword", COMPOSER_MEDIA_TYPE_UNKNOWN},
+ {"doc", "applcation/vnd.ms-word", COMPOSER_MEDIA_TYPE_UNKNOWN},
+ {"xls", "application/vnd.ms-excel", COMPOSER_MEDIA_TYPE_UNKNOWN},
+ {"xls", "application/x-msexcel", COMPOSER_MEDIA_TYPE_UNKNOWN},
+ {"ppt", "application/vnd.ms-powerpoint", COMPOSER_MEDIA_TYPE_UNKNOWN},
+ {"ppt", "application/x-mspowerpoint", COMPOSER_MEDIA_TYPE_UNKNOWN},
+ {"pdf", "application/pdf", COMPOSER_MEDIA_TYPE_UNKNOWN},
+/*etc*/
+ {"rm ", "application/vnd.rn-realmedia", COMPOSER_MEDIA_TYPE_UNKNOWN},
+ {"smi", "application/smil", COMPOSER_MEDIA_TYPE_UNKNOWN},
+ {"smil", "application/smil", COMPOSER_MEDIA_TYPE_UNKNOWN},
+ {"xml", "application/vnd.oma.drm.roap-pdu+xml", COMPOSER_MEDIA_TYPE_UNKNOWN},
+ {"xml", "application/vnd.oma.drm.roap-trigger+xml", COMPOSER_MEDIA_TYPE_UNKNOWN},
+ {"xxx", "application/octet-stream", COMPOSER_MEDIA_TYPE_UNKNOWN},
+};
char *msg_ui_composer_edj_get(MSG_COMPOSER_VIEW_DATA_S *cd)
{
- if (cd->current_theme == MSG_UI_THEME_WHITE)
- return MSGC_UI_WHITE_EDJ;
-
- return MSGC_UI_DEFAULT_EDJ; /*black*/
+ return MSGC_UI_DEFAULT_EDJ;
}
Evas_Object *msg_ui_composer_load_edj(Evas_Object *parent, const char *edj_file, const char *group)
return layout;
}
-Evas_Object *msg_ui_composer_conformant_create(Evas_Object *parent_win, Evas_Object *inner)
-{
- D_ENTER;
- Evas_Object *conform;
- D_MSG_RETVM_IF(!parent_win, NULL,"Inputted Paremeter Window is Invalid");
- D_MSG_RETVM_IF(!inner, NULL,"Inputted Paremeter Content is Invalid");
-
- conform = elm_conformant_add(parent_win);
- D_MSG_RETVM_IF(!conform, NULL,"Fail to Create conformant object");
-
- elm_win_conformant_set(parent_win, EINA_TRUE);
- evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(conform, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_win_resize_object_add(parent_win, conform);
- evas_object_show(conform);
-
- elm_object_content_set(conform, inner);
- D_LEAVE;
- return conform;
-}
-
Evas_Object *msg_ui_composer_bg_create(Evas_Object *parent)
{
D_MSG_RETVM_IF(parent == NULL, NULL, "parent object == NULL");
return ecore_file_size(path);
}
-char *msg_common_get_file_ext(const char *a_pszfile_name)
+char *msg_composer_get_file_ext(const char *a_pszfile_name)
{
if (a_pszfile_name != NULL) {
int nlen = strlen(a_pszfile_name);
return NULL;
}
+COMPOSER_MEDIA_TRACK_TYPE_E msg_composer_get_media_track_type(const char *a_pszfile_name)
+{
+ D_ENTER;
+ D_MSG_RETVM_IF(a_pszfile_name == NULL, COMPOSER_MEDIA_TRACK_TYPE_NONE, "file path is null");
+
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ metadata_extractor_h metadata = NULL;
+
+ ret = metadata_extractor_create(&metadata);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE) {
+ D_EMSG("Fail metadata_extractor_create [%d]", ret);
+ return COMPOSER_MEDIA_TRACK_TYPE_NONE;
+ }
+
+ ret = metadata_extractor_set_path(metadata, a_pszfile_name);
+ if(ret != METADATA_EXTRACTOR_ERROR_NONE) {
+ D_EMSG("Fail metadata_extractor_set_path [%d]", ret);
+ metadata_extractor_destroy(metadata);
+ return COMPOSER_MEDIA_TRACK_TYPE_NONE;
+ }
+
+ /* check video first */
+ char *video_track_cnt = NULL;
+ metadata_extractor_get_metadata(metadata, METADATA_HAS_VIDEO, &video_track_cnt);
+ if (video_track_cnt) {
+ D_MSG("video_track_cnt = [%s]", video_track_cnt);
+ if (atoi(video_track_cnt) > 0) {
+ metadata_extractor_destroy(metadata);
+ return COMPOSER_MEDIA_TRACK_TYPE_VIDEO;
+ }
+ }
+
+ /* if curren meta_info has no video track, check audio again */
+ char *audio_track_cnt = NULL;
+ metadata_extractor_get_metadata(metadata, METADATA_HAS_AUDIO, &audio_track_cnt);
+ if (audio_track_cnt) {
+ D_MSG("audio_track_cnt = [%s]", audio_track_cnt);
+ if (atoi(audio_track_cnt) > 0) {
+ metadata_extractor_destroy(metadata);
+ return COMPOSER_MEDIA_TRACK_TYPE_AUDIO;
+ }
+ }
+
+ metadata_extractor_destroy(metadata);
+
+ return COMPOSER_MEDIA_TRACK_TYPE_NONE;
+}
+
+COMPOSER_MEDIA_TYPE_E msg_composer_get_media_type(const char *a_pszfile_path)
+{
+ char *pext = NULL;
+ unsigned int nmimeidx = 0;
+ unsigned int nmime_max = 0;
+ COMPOSER_MEDIA_TRACK_TYPE_E track_type = COMPOSER_MEDIA_TRACK_TYPE_NONE;
+
+ if (a_pszfile_path == NULL)
+ return COMPOSER_MEDIA_TYPE_UNKNOWN;
+
+ pext = msg_composer_get_file_ext(a_pszfile_path);
+ nmime_max = (sizeof(composer_mime_table) / sizeof(composer_mime_type_t));
+ track_type = msg_composer_get_media_track_type(a_pszfile_path);
+
+ for (; nmimeidx < nmime_max; nmimeidx++) {
+ int nlen = strlen(composer_mime_table[nmimeidx].m_szextend);
+
+ if (strncasecmp(composer_mime_table[nmimeidx].m_szextend, pext, nlen) == 0) {
+ if (track_type == COMPOSER_MEDIA_TRACK_TYPE_VIDEO) {
+ if (strstr(composer_mime_table[nmimeidx].m_szmime_type, "video") != NULL)
+ return composer_mime_table[nmimeidx].m_ncontent_type;
+ } else if (track_type == COMPOSER_MEDIA_TRACK_TYPE_AUDIO) {
+ if (strstr(composer_mime_table[nmimeidx].m_szmime_type, "audio") != NULL)
+ return composer_mime_table[nmimeidx].m_ncontent_type;
+ } else {
+ return composer_mime_table[nmimeidx].m_ncontent_type;
+ }
+ }
+ }
+
+ return COMPOSER_MEDIA_TYPE_UNKNOWN;
+}
+
+COMPOSER_RETURN_TYPE_E msg_composer_common_get_media_duration(const char *file_path, int *duration)
+{
+ D_ENTER;
+
+ metadata_extractor_h metadata_h = NULL;
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ char *value = NULL;
+
+ if (!file_path || !duration) {
+ D_EMSG("file_path or duration is not exist");
+ return COMPOSER_RETURN_FAIL;
+ }
+
+ ret = metadata_extractor_create(&metadata_h);
+ if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
+ D_EMSG("metadata_extractor_create is failed ret = %d", ret);
+ return COMPOSER_RETURN_FAIL;
+ }
+
+ ret = metadata_extractor_set_path(metadata_h, file_path);
+ if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
+ D_EMSG("metadata_extractor_set_path is failed ret = %d", ret);
+ metadata_extractor_destroy(metadata_h);
+ return COMPOSER_RETURN_FAIL;
+ }
+
+ ret = metadata_extractor_get_metadata(metadata_h, METADATA_DURATION, &value);
+ if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
+ D_EMSG("metadata_extractor_get_metadata is failed ret = %d", ret);
+ metadata_extractor_destroy(metadata_h);
+ return COMPOSER_RETURN_FAIL;
+ }
+
+ if (value) {
+ *duration = atoi(value);
+ free(value);
+ }
+
+ D_MSG("file : %s, duration : %d", file_path, *duration);
+
+ metadata_extractor_destroy(metadata_h);
+
+ D_LEAVE;
+
+ return COMPOSER_RETURN_SUCCESS;
+}
+
+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)
+{
+ D_ENTER;
+ COMPOSER_MEDIA_TYPE_E media_type;
+ int ret;
+ char temp_img_file[COMPOSER_FILEPATH_LEN_MAX] = {0,};
+ char *filename_without_ext = NULL;
+ const char *filename = NULL;
+
+ if (!src_file_path || !thumb_file_path) {
+ D_EMSG("file path or thumbnail path is NULL");
+ return COMPOSER_RETURN_NULL_POINTER;
+ }
+
+ if (!ecore_file_exists(src_file_path)) {
+ D_EMSG("file path is not exist");
+ return COMPOSER_RETURN_NULL_POINTER;
+ }
+
+ media_type = msg_composer_get_media_type(src_file_path);
+ if (media_type == COMPOSER_MEDIA_TYPE_VIDEO) {
+
+ filename = ecore_file_file_get(src_file_path);
+ if (filename) {
+ filename_without_ext = ecore_file_strip_ext(filename);
+
+ if (filename_without_ext) {
+ snprintf(temp_img_file, sizeof(temp_img_file)-1, "%s/temp_image_%s.jpg", cd->working_path, filename_without_ext);
+ g_free(filename_without_ext);
+ } else {
+ return COMPOSER_RETURN_FAIL;
+ }
+
+ } else {
+ return COMPOSER_RETURN_FAIL;
+ }
+
+ /* get image of video*/
+ ret = msg_composer_common_get_image_in_video(src_file_path, temp_img_file);
+ if (ret == COMPOSER_RETURN_SUCCESS) {
+ strncpy(thumb_file_path, temp_img_file, size_thumb_file_path);
+ }
+ } else {
+ D_EMSG("media type is not video type media_type = %d !!", media_type);
+ return COMPOSER_RETURN_FAIL;
+ }
+
+ D_LEAVE;
+ return COMPOSER_RETURN_SUCCESS;
+}
+
void msg_ui_composer_clear(MSG_COMPOSER_VIEW_DATA_S *cd)
{
D_ENTER;
if (cd->recipient)
msg_ui_composer_recipient_clear(cd->recipient);
+ /*Clear Body*/
+ if (cd->isSubject) {
+ msg_ui_composer_subject_clear(cd);
+ cd->isSubject = false;
+ }
+
+ if (cd->attach_data.attachment_Cnt > 0) {
+ msg_ui_composer_attachment_clear(cd);
+ }
+
msg_ui_composer_body_clear(cd);
D_LEAVE;
}
+static void __msg_ui_composer_change_to_sms(MSG_COMPOSER_VIEW_DATA_S *cd)
+{
+ D_ENTER;
+
+ if (!cd) {
+ MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] composer data is NULL");
+ return;
+ }
+
+ MSG_COMPOSER_BODY_PAGE_S *page_data = NULL;
+ MSG_COMPOSER_BODY_S *body_data = &cd->body_data;
+
+ /* reset region info */
+ body_data->region_order = COMPOSER_REGION_ORDER_UNDETERMINDED;
+
+ page_data = (MSG_COMPOSER_BODY_PAGE_S *)eina_list_nth(cd->body_data.page_list, 0);
+
+ char *body_text = elm_entry_markup_to_utf8(elm_entry_entry_get(page_data->entry));
+ if (body_text) {
+ msg_ui_composer_body_info_area_update(cd);
+ free(body_text);
+ }
+
+ D_LEAVE;
+}
+
+static void __msg_ui_composer_change_to_mms(MSG_COMPOSER_VIEW_DATA_S *cd)
+{
+ D_ENTER;
+ if (!cd) {
+ MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] composer data is NULL");
+ return;
+ }
+
+ msg_ui_composer_body_info_area_update(cd);
+ D_LEAVE;
+}
+
+COMPOSER_RETURN_TYPE_E msg_ui_composer_change_message_type(MSG_COMPOSER_VIEW_DATA_S *cd, COMPOSER_MSG_TYPE_E msg_type)
+{
+ D_ENTER;
+ if (!cd) {
+ MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] composer data is NULL");
+ return COMPOSER_RETURN_FAIL;
+ }
+
+ if (cd->msg_type == msg_type) {
+ MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "[DEBUG] it doesn't need to change message type");
+ return COMPOSER_RETURN_SUCCESS;
+ }
+
+ switch (msg_type) {
+ case COMPOSER_MSG_TYPE_SMS:
+ msg_ui_composer_common_tickernoti(cd, COMPOSER_TICKERNOTI_CHANGED_SMS);
+
+ cd->msg_type = COMPOSER_MSG_TYPE_SMS;
+ __msg_ui_composer_change_to_sms(cd);
+ break;
+ case COMPOSER_MSG_TYPE_MMS:
+ if (cd->loading_draft == false)
+ msg_ui_composer_common_tickernoti(cd, COMPOSER_TICKERNOTI_CHANGED_MMS);
+ else
+ cd->loading_draft = false;
+
+ cd->msg_type = COMPOSER_MSG_TYPE_MMS;
+ __msg_ui_composer_change_to_mms(cd);
+ break;
+ default:
+ MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "[DEBUG] invalid message type");
+ return COMPOSER_RETURN_FAIL;
+ }
+
+ bool ret = msg_ui_composer_common_is_send_possible(cd);
+ msg_ui_composer_body_update_send_btn_icon(cd, !ret);
+
+ if (cd->msg_type == COMPOSER_MSG_TYPE_SMS && cd->msg_ug_mode != MSG_UG_MODE_BUBBLE_COMPOSER)
+ elm_object_disabled_set(cd->more_btn, EINA_TRUE);
+ else if (cd->msg_type == COMPOSER_MSG_TYPE_MMS)
+ elm_object_disabled_set(cd->more_btn, EINA_FALSE);
+
+ D_LEAVE;
+ return COMPOSER_RETURN_SUCCESS;
+}
+
+COMPOSER_MSG_TYPE_E msg_ui_composer_check_message_type(MSG_COMPOSER_VIEW_DATA_S *cd)
+{
+ D_ENTER;
+
+ if (!cd) {
+ MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSSERT] composer data in NULL");
+ return COMPOSER_MSG_TYPE_INVALID;
+ }
+
+ if (cd->isSubject)
+ return COMPOSER_MSG_TYPE_MMS;
+
+ if (cd->attach_data.attachment_Cnt > 0)
+ return COMPOSER_MSG_TYPE_MMS;
+
+ if (msg_ui_composer_body_is_mms(cd) == EINA_TRUE)
+ return COMPOSER_MSG_TYPE_MMS;
+
+ if (msg_ui_composer_recipient_is_mms(cd) == EINA_TRUE)
+ return COMPOSER_MSG_TYPE_MMS;
+
+ return COMPOSER_MSG_TYPE_SMS;
+}
+
+void msg_ui_composer_message_type_check_and_change(MSG_COMPOSER_VIEW_DATA_S *cd)
+{
+ D_ENTER;
+
+ COMPOSER_MSG_TYPE_E checked_type;
+
+ checked_type = msg_ui_composer_check_message_type(cd);
+
+ if (cd->msg_type == COMPOSER_MSG_TYPE_SMS && checked_type == COMPOSER_MSG_TYPE_MMS) {
+ D_MSG("### Message Type Change from [SMS] to [MMS] ###");
+ msg_ui_composer_change_message_type(cd, COMPOSER_MSG_TYPE_MMS);
+ } else if (cd->msg_type == COMPOSER_MSG_TYPE_MMS && checked_type == COMPOSER_MSG_TYPE_SMS) {
+ D_MSG("### Message Type Change from [MMS] to [SMS] ###");
+ msg_ui_composer_change_message_type(cd, COMPOSER_MSG_TYPE_SMS);
+ } else {
+ D_MSG("Now msg type is [%d] & checked msg type is [%d](0: INVAILD, 1: SMS, 2: MMS)", cd->msg_type, checked_type);
+ }
+
+ D_LEAVE;
+}
+
Eina_Bool msg_ui_composer_last_focus_load(void *data)
{
D_ENTER;
return EINA_FALSE;
}
+Eina_Bool msg_ui_composer_last_body_page_focus_load(void *data)
+{
+ D_ENTER;
+
+ MSG_COMPOSER_VIEW_DATA_S *cd = (MSG_COMPOSER_VIEW_DATA_S *)data;
+
+ MSG_COMPOSER_BODY_PAGE_S *last_page_data = eina_list_nth(cd->body_data.page_list, cd->body_data.page_count-1);
+
+ if (last_page_data && last_page_data->entry) {
+ elm_object_focus_set(last_page_data->entry, EINA_TRUE);
+ D_MSG("### Last body page entry focused = %p",last_page_data->entry);
+ msg_ui_composer_last_focused_entry_set(cd, last_page_data->entry);
+ } else {
+ D_MSG("Failed to get last body page entry");
+ return EINA_FALSE;
+ }
+
+ D_LEAVE;
+ return EINA_TRUE;
+}
+
void msg_ui_composer_last_focused_entry_set(void *data, Evas_Object *entry)
{
MSG_COMPOSER_VIEW_DATA_S *cd;
return NULL;
}
-void bundle_send_to_result(void *data, char *key, char *val)
+void msg_ui_composer_set_body_keypad_layout(void *data, int mode)
{
D_ENTER;
- D_MSG("key = %s, val = %s", key, val);
-
+ D_MSG_RETM_IF(data == NULL, "data is NULL");
MSG_COMPOSER_VIEW_DATA_S *cd = (MSG_COMPOSER_VIEW_DATA_S *)data;
+ MSG_COMPOSER_BODY_PAGE_S *page_data = NULL;
- bundle *b;
- b = bundle_create();
- bundle_add(b, key, val);
-
- ug_send_result(cd->ug, b);
+ page_data = (MSG_COMPOSER_BODY_PAGE_S *)eina_list_nth(cd->body_data.page_list, 0);
- bundle_free(b);
+ if (page_data && page_data->entry)
+ elm_entry_input_panel_layout_set(page_data->entry, mode);
+ else
+ D_EMSG("entry is not found");
D_LEAVE;
}
-int msg_ui_composer_thread_id_get(MSG_HANDLE_T msg_handle, const char *recipient)
-{
- char tmp_recipient[DEF_BUF_LEN] = {0,};
- MSG_ERROR_T err = MSG_SUCCESS;
- MSG_SORT_RULE_S sortRule = {0, };
- MSG_THREAD_VIEW_LIST_S peerList = {0,};
- int row;
- char thread_addr_r[DEF_THREAD_ADDR_LEN] = {0};
-
- sortRule.sortType = MSG_SORT_BY_THREAD_DATE;
- sortRule.bAscending = false;
-
- strncpy(tmp_recipient, recipient, sizeof(tmp_recipient)-1);
- D_MSG("recipient = %s:%s, tmp recipient = %s", recipient, strdup(recipient), tmp_recipient);
- g_strreverse(tmp_recipient);
- D_MSG("tmp_recipient = %s", tmp_recipient);
- err = msg_get_thread_view_list(msg_handle, &sortRule, &peerList);
- for (row = 0; row < peerList.nCount; row++) {
- if (strlen(msg_thread_view_get_address(peerList.msgThreadInfo[row]))) {
- strncpy(thread_addr_r, msg_thread_view_get_address(peerList.msgThreadInfo[row]), strlen(msg_thread_view_get_address(peerList.msgThreadInfo[row])));
- g_strreverse(thread_addr_r);
- if (g_ascii_strncasecmp(thread_addr_r, tmp_recipient, COMPARE_STRING_NUM) == 0) {
- D_MSG("FIND THREAD ADDRESS = %s", msg_thread_view_get_address(peerList.msgThreadInfo[row]));
- break;
- }
- }
- }
+bool msg_ui_composer_last_focus_is_recipient(void *data)
+{
+ D_ENTER;
+ D_MSG_RETVM_IF(data == NULL, false, "data is NULL");
+
+ MSG_COMPOSER_VIEW_DATA_S *cd = (MSG_COMPOSER_VIEW_DATA_S *)data;
+ RECIPIENT_S *recipient = cd->recipient;
+ Evas_Object *last_focus = msg_ui_composer_last_focused_entry_get(cd);
- if (row >= peerList.nCount) {
- msg_release_thread_view_list(&peerList);
- D_MSG("CANNOT FIND THREAD");
- return 0;
+ if (last_focus && recipient) {
+ if (last_focus == recipient->mbe) {
+ return true;
+ }
}
- int retid = msg_thread_view_get_thread_id(peerList.msgThreadInfo[row]);
- msg_release_thread_view_list(&peerList);
- return retid;
+ D_LEAVE;
+ return false;
}
-char *msg_ui_composer_thread_recipient_get(MSG_HANDLE_T msg_handle, int inp_tid)
+void bundle_send_to_result(void *data, char *key, char *val)
{
- MSG_ERROR_T err = MSG_SUCCESS;
- MSG_SORT_RULE_S sortRule = {0, };
- MSG_THREAD_VIEW_LIST_S peerList = {0,};
- int row;
- char *ret_recipient = NULL;
- sortRule.sortType = MSG_SORT_BY_THREAD_DATE;
- sortRule.bAscending = false;
+ D_ENTER;
+ D_MSG("key = %s, val = %s", key, val);
- err = msg_get_thread_view_list(msg_handle, &sortRule, &peerList);
- for (row = 0; row < peerList.nCount; row++) {
- if (inp_tid == msg_thread_view_get_thread_id(peerList.msgThreadInfo[row])) {
- ret_recipient = strdup(msg_thread_view_get_address(peerList.msgThreadInfo[row]));
- break;
- }
+ MSG_COMPOSER_VIEW_DATA_S *cd = (MSG_COMPOSER_VIEW_DATA_S *)data;
+ service_h svc_handle;
+ if (service_create(&svc_handle) < 0 || svc_handle == NULL) {
+ D_EMSG("service_create() is failed !!");
+ } else {
+ service_add_extra_data(svc_handle, key, val);
+ ug_send_result(cd->ug, svc_handle);
+ service_destroy(svc_handle);
}
-
- msg_release_thread_view_list(&peerList);
- return ret_recipient;
+ D_LEAVE;
}
bool msg_ui_composer_common_is_send_possible(MSG_COMPOSER_VIEW_DATA_S *cd)
MSG_COMPOSER_BODY_S *body_data = &cd->body_data;
MSG_COMPOSER_BODY_PAGE_S *page_data = NULL;
- if (cd->msg_type == COMPOSER_MSG_TYPE_SMS) {
+ if (cd->msg_type == COMPOSER_MSG_TYPE_MMS) {
+ if (cd->isSubject) {
+ char *subject = elm_entry_markup_to_utf8(elm_entry_entry_get(cd->sub_data.entry));
+ if (subject && strlen(subject) > 0) {
+ g_free(subject);
+ return true;
+ } else {
+ g_free(subject);
+ }
+ }
+
+ if (cd->attach_data.attachment_Cnt > 0) {
+ return true;
+ }
+
+ int i = 0;
+ for (i = 0; i < cd->body_data.page_count; i++) {
+ page_data = (MSG_COMPOSER_BODY_PAGE_S *)eina_list_nth(body_data->page_list, i);
+
+ if (page_data->is_image_item)
+ return true;
+
+ if (page_data->is_sound_item)
+ return true;
+
+ char *body_text = elm_entry_markup_to_utf8(elm_entry_entry_get(page_data->entry));
+ if (body_text) {
+ if (strlen(body_text) > 0) {
+ g_free(body_text);
+ return true;
+ }
+ g_free(body_text);
+ }
+ }
+ } else if (cd->msg_type == COMPOSER_MSG_TYPE_SMS) {
page_data = (MSG_COMPOSER_BODY_PAGE_S *)eina_list_nth(body_data->page_list, 0);
if(page_data) {
char *body_text = elm_entry_markup_to_utf8(elm_entry_entry_get(page_data->entry));
return false;
}
-static gboolean __msg_ui_composer_vib_timeout_cb(gpointer data)
+COMPOSER_RETURN_TYPE_E msg_composer_common_get_image_in_video(const char *video_file_path, char *image_file_path)
{
D_ENTER;
- int ret = 0;
+ COMPOSER_MEDIA_TYPE_E media_type;
+ metadata_extractor_h metadata_h = NULL;
+ int ret = METADATA_EXTRACTOR_ERROR_NONE;
+ int video_w = 0;
+ int video_h = 0;
+ int thumbsize = 0;
+ void *thumbnail = NULL;
+ char *value = NULL;
+
+ media_type = msg_composer_get_media_type(video_file_path);
+ if (media_type != COMPOSER_MEDIA_TYPE_VIDEO) {
+ D_EMSG("It is not video file %s", video_file_path);
+ return COMPOSER_RETURN_FAIL;
+ }
+
+ ret = metadata_extractor_create(&metadata_h);
+ if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
+ D_EMSG("metadata_extractor_create is failed ret = %d", ret);
+ return COMPOSER_RETURN_FAIL;
+ }
+
+ ret = metadata_extractor_set_path(metadata_h, video_file_path);
+ if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
+ D_EMSG("metadata_extractor_set_path is failed ret = %d", ret);
+ metadata_extractor_destroy(metadata_h);
+ return COMPOSER_RETURN_FAIL;
+ }
+
+ ret = metadata_extractor_get_metadata(metadata_h, METADATA_VIDEO_WIDTH, &value);
+ if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
+ D_EMSG("metadata_extractor_get_metadata is failed ret = %d", ret);
+ metadata_extractor_destroy(metadata_h);
+ return COMPOSER_RETURN_FAIL;
+ }
+
+ if (value) {
+ video_w = atoi(value);
+ free(value);
+ value = NULL;
+ }
- if (bVibrating == true) {
- ret = device_haptic_stop_play(dev_handle);
+ ret = metadata_extractor_get_metadata(metadata_h, METADATA_VIDEO_HEIGHT, &value);
+ if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
+ D_EMSG("metadata_extractor_get_metadata is failed ret = %d", ret);
+ metadata_extractor_destroy(metadata_h);
+ return COMPOSER_RETURN_FAIL;
+ }
+
+ if (value) {
+ video_h = atoi(value);
+ free(value);
+ value = NULL;
+ }
- if (ret != 0) {
- MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] Fail to stop haptic : [%d]", ret);
+ ret = metadata_extractor_get_frame(metadata_h, &thumbnail, &thumbsize);
+ if (ret != METADATA_EXTRACTOR_ERROR_NONE) {
+ D_EMSG("metadata_extractor_get_frame is failed ret = %d", ret);
+ metadata_extractor_destroy(metadata_h);
+ return COMPOSER_RETURN_FAIL;
+ }
+
+ if (thumbnail) {
+ ret = image_util_encode_jpeg((unsigned char *)thumbnail, video_w, video_h, IMAGE_UTIL_COLORSPACE_RGB888, 100, image_file_path);
+
+ free(thumbnail);
+
+ if (ret != IMAGE_UTIL_ERROR_NONE) {
+ D_EMSG("image_util_encode_jpeg is failed ret = %d", ret);
+ metadata_extractor_destroy(metadata_h);
+ return COMPOSER_RETURN_FAIL;
}
+ }
+
+ metadata_extractor_destroy(metadata_h);
- ret = device_haptic_close(dev_handle);
+ D_LEAVE;
+ return COMPOSER_RETURN_SUCCESS;
+}
- if (ret != 0) {
- MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] Fail to close haptic : [%d]", ret);
+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)
+{
+ D_ENTER;
+ D_MSG_RETVM_IF(cd == NULL, COMPOSER_RETURN_FAIL, "cd is NULL");
+ D_MSG_RETVM_IF(src_file_path == NULL, COMPOSER_RETURN_FAIL, "src_file_path is NULL");
+ D_MSG_RETVM_IF(dst_file_path == NULL, COMPOSER_RETURN_FAIL, "dst_file_path is NULL");
+
+ const char *filename = NULL;
+ char *ext = NULL;
+ int i = 0;
+ char temp_file_path[COMPOSER_FILEPATH_LEN_MAX + 1] = {0,};
+ char file_name_without_ext[COMPOSER_FILENAME_LEN_MAX + 1] = {0};
+
+ if (ecore_file_exists(src_file_path) == EINA_FALSE) {
+ D_EMSG("file is not existed");
+ return COMPOSER_RETURN_FAIL;
+ }
+
+ filename = ecore_file_file_get(src_file_path);
+
+ if (filename) {
+ strncpy(file_name_without_ext, filename, COMPOSER_FILENAME_LEN_MAX);
+ ext = msg_composer_get_file_ext(filename);
+
+ if (ext)
+ file_name_without_ext[strlen(file_name_without_ext) - strlen(ext) - 1] = '\0';
+
+ /*make new filename*/
+ do {
+ memset(temp_file_path, 0x00, sizeof(temp_file_path));
+ if (i == 0) {
+ snprintf(temp_file_path, sizeof(temp_file_path), "%s%s", cd->working_path, filename);
+ } else {
+ if (ext && strlen(ext) > 0)
+ snprintf(temp_file_path, sizeof(temp_file_path), "%s%s_%02d.%s", cd->working_path, file_name_without_ext, i, ext);
+ else
+ snprintf(temp_file_path, sizeof(temp_file_path), "%s%s_%02d", cd->working_path, file_name_without_ext, i);
+ }
+
+ i++;
+
+ if (i > COMPOSER_MMS_MAX_MEDIA_COUNT) {
+ D_EMSG("maximum count is reached = %d", i);
+ return COMPOSER_RETURN_FAIL;
+ }
+ } while (ecore_file_exists(temp_file_path));
+
+
+ if (ecore_file_cp(src_file_path, temp_file_path) == EINA_FALSE) {
+ D_MSG("temp_file_path = %s", temp_file_path);
+ return COMPOSER_RETURN_FAIL;
}
- bVibrating = false;
+ strncpy(dst_file_path, temp_file_path, size_dst_file_path);
+ D_MSG("copy file from %s to %s", src_file_path, dst_file_path);
+ } else {
+ D_EMSG("filename is NULL");
+ return COMPOSER_RETURN_FAIL;
}
D_LEAVE;
+ return COMPOSER_RETURN_SUCCESS;
+}
+
+static char *__get_item_tag(char *text)
+{
+ char *fulltext = NULL;
+ char *tagStart = NULL;
+ char *tagEnd = NULL;
+ int tagStrLength = 0;
- return FALSE;
+ if (text == NULL)
+ return NULL;
+
+ fulltext = text;
+ D_MSG("text(%p)[%d] = %s", text, strlen(text), text);
+
+ tagStart = strstr(fulltext, "<item");
+ if (tagStart) {
+ tagEnd = strchr(tagStart, '>');
+ if (tagEnd) {
+ tagStrLength = tagEnd - tagStart + 1;
+ return strndup(tagStart, tagStrLength);
+ }
+ }
+
+ return NULL;
}
-void msg_ui_composer_common_play_vibration()
+static char *__remove_item_tag(char *text)
{
- D_ENTER;
+ char *fulltext = NULL;
+ char *tagStart = NULL;
+ char *tagEnd = NULL;
+ char *braceStart = NULL;
+ char *braceEnd = NULL;
+ char *postStr = NULL;
+
+ int strLength = 0;
+ int postStrLength = 0;
+ bool isitemTag = false;
+
+ if (text == NULL)
+ return NULL;
+
+ char *textBuf = strdup(text);
+
+ if (!textBuf) {
+ D_EMSG("strdup is failed");
+ return NULL;
+ }
+
+ fulltext = textBuf;
+ strLength = strlen(textBuf);
+ D_MSG("text length = %d, text = [%s]", strLength, textBuf);
+
+ while ((tagStart = strstr(fulltext, "<item"))) {
+ braceEnd = strchr(tagStart, '>');
+ if (braceEnd) {
+ braceStart = strstr(braceEnd, "</item>");
+ if (braceStart) {
+ tagEnd = (braceStart + strlen("</item>") - 1);
+ } else {
+ D_EMSG("There is no close item tag");
+ tagEnd = braceEnd;
+ }
+ } else {
+ D_EMSG("There is no close tag");
+ g_free(textBuf);
+ return NULL;
+ }
+
+ postStrLength = strLength - (tagEnd - fulltext + 1);
+ postStr = strndup(tagEnd + 1, postStrLength);
+ if (!postStr) {
+ D_EMSG("strndup is failed");
+ g_free(textBuf);
+ return NULL;
+ }
+
+ strncpy(tagStart, postStr, postStrLength);
+ *(tagStart + postStrLength) = '\0';
+ D_MSG("after textBuf = [%s]", textBuf);
+
+ g_free(postStr);
+ postStr = NULL;
+
+ isitemTag = true;
+ }
- int ret = 0;
- int vibPattern = EFFCTVIBE_NOTIFICATION;
+ if (isitemTag)
+ return textBuf;
- bVibrating = true;
- dev_handle = device_haptic_open(DEV_IDX_0, 0);
+ g_free(textBuf);
- g_timeout_add(150, __msg_ui_composer_vib_timeout_cb, NULL);
+ return NULL;
+}
- ret = device_haptic_play_pattern(dev_handle, vibPattern, 1, HAPTIC_FEEDBACK_LEVEL_5);
+static char *__get_tag_value(const char *tag_str, const char *tag_name)
+{
+ char *tag;
- if (ret != 0) {
- MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT, "[ASSERT] Fail to play haptic : [%d]", ret);
+ if (!tag_name || !tag_str)
+ return NULL;
+
+ if ((tag = strstr(tag_str, tag_name))) {
+ if (tag[strlen(tag_name)] == '_')
+ return NULL;
+ char *value = strchr(tag, '=');
+ if (value) {
+
+ do {
+ value++;
+ } while (!isalnum(*value) && *value != '#');
+
+ int spCnt = 5;
+ char *spArray[spCnt];
+ spArray[0] = strchr(value, '>');
+ spArray[1] = strchr(value, '\"');
+ spArray[2] = strchr(value, '\'');
+ spArray[3] = strchr(value, '\t');
+ spArray[4] = strchr(value, '\n');
+ char *valueEnd = strchr(value, '\0');
+
+ int i;
+ int start = 0;
+ if (!strcmp(tag_str, "item") && !strcmp(tag_name, "href"))
+ start = 1;
+
+ for (i = start; i < spCnt; i++) {
+ if (spArray[i] && spArray[i] < valueEnd) {
+ valueEnd = spArray[i];
+ }
+ }
+
+ int valueLength = valueEnd - value;
+ return strndup(value, valueLength);
+ }
}
+ return NULL;
+}
+
+void msg_composer_entry_filter_addimage(void *data, Evas_Object *entry, char **text)
+{
+ D_ENTER;
+
+ char *item_val = NULL;
+ char *item_tag = NULL;
+ char *filepath = NULL;
+ char *realpath = NULL;
+
+ MSG_COMPOSER_VIEW_DATA_S *cd = data;
+
+ D_MSG_RETM_IF(cd == NULL, "Composer Data is Invalid");
+ D_MSG_RETM_IF(entry == NULL,"Parameter Entry is Invalid");
+ D_MSG_RETM_IF((!text || !(*text)),"Parameter Text is Invalid");
+
+ /*get <item xxx> tag at insert text*/
+ item_tag = __get_item_tag(*text);
+
+ if (item_tag) {
+
+ D_MSG("item_tag = %s", item_tag);
+
+ /*get value of href in the item tag*/
+ item_val = __get_tag_value(item_tag, "href");
+ if (item_val) {
+ D_MSG("item_href_val = %s", item_val);
+ filepath = strstr(item_val, "file:");
+ if (filepath) {
+ realpath = filepath + 5;
+ } else {
+ realpath = filepath;
+ }
+
+ if (realpath) {
+ if (ecore_file_exists(realpath) == EINA_TRUE) {
+ char * list_item_data = g_strdup(realpath);
+ if (list_item_data) {
+ cd->attachlist= eina_list_append(cd->attachlist, list_item_data);
+ msg_ui_composer_body_items_add(data);
+ } else {
+ D_EMSG("Fail to g_strdup");
+ }
+ } else {
+ D_EMSG("File is NOT exist %s", realpath);
+ }
+ } else {
+ D_EMSG("File Path is NULL");
+ }
+
+ g_free(item_val);
+ }
+
+ g_free(item_tag);
+
+ /* remove item tag */
+ char *removed_text = __remove_item_tag(*text);
+ g_free(*text);
+
+ if (removed_text)
+ *text = removed_text;
+ else
+ *text = NULL;
+
+ }
D_LEAVE;
}
-void msg_composer_entry_filter_remove_markup(void *data, Evas_Object *entry, char **text)
+
+void
+msg_composer_entry_filter_remove_markup(void *data, Evas_Object *entry, char **text)
{
D_ENTER;
D_MSG_RETM_IF(text == NULL || *text == NULL, "New Text is NULL");
- char *preedit_str = NULL;
+ char *preedit_tag_start = NULL;
+ char *preedit_tag_end = NULL;
char *utf8_text = NULL;
char *convert_text = NULL;
- D_MSG("text %s", *text);
+ D_MSG("text [%s]", *text);
+
/* Check preeditting text and return if it exist*/
- preedit_str = strstr(*text, "<preedit_sel>");
- if (preedit_str) return;
+ preedit_tag_start = strstr(*text, "<preedit");
+ preedit_tag_end = strstr(*text, "</preedit");
+
+ if (preedit_tag_start && preedit_tag_end)
+ return;
/* convert from markup text to utf8 text from entry */
utf8_text = elm_entry_markup_to_utf8(*text);
- if (utf8_text) {
+ if (utf8_text) {
/* If the string contains "Carrage return ('\n'), it should be changed "<br>" to show properly*/
convert_text = elm_entry_utf8_to_markup(utf8_text);
if(convert_text) {
D_LEAVE;
}
-int msg_ui_composer_convert_UTF8ToUCS2(unsigned char *pDestText, int maxLength, const char *pSrcText, int srcTextLen)
+void msg_ui_composer_common_tickernoti(MSG_COMPOSER_VIEW_DATA_S *cd, COMPOSER_TICKERNOTI_TYPE_E tickertype)
{
- D_ENTER;
- int textLen = 0;
- unsigned char *unicodeTemp = (unsigned char*)pDestText;
+ char popup_msg[DEF_BUF_LEN_L] = {0,};
- int ucs2Length = 0;
- int remainedBuffer = maxLength;
+ D_MSG_RETM_IF(cd == NULL, "Composer Data is Invalid");
- if(maxLength == 0 || pSrcText == NULL || pDestText == NULL)
- {
- MSG_UI_DEBUG(MSG_UI_LEVEL_ASSERT,"[ASSERT]UTF8 to UCS2 Failed as text length is NULL \n");
- return -1;
+ if (tickertype == COMPOSER_TICKERNOTI_COUNT_MAX) {
+ const char *str = MSGC_STR_NOTI_RECIPIENT_MAX;
+ snprintf(popup_msg, sizeof(popup_msg), str, COMPOSER_RECIPIENT_COUNT_MAX);
+ } else if (tickertype == COMPOSER_TICKERNOTI_DUP_RECP) {
+ snprintf(popup_msg, sizeof(popup_msg), MSGC_STR_NOTI_RECIPIENT_DUP);
+ } else if (tickertype == COMPOSER_TICKERNOTI_INVALID_RECP) {
+ snprintf(popup_msg, sizeof(popup_msg), MSGC_STR_NOTI_RECIPIENT_INVALID);
+ } else if (tickertype == COMPOSER_TICKERNOTI_CHANGED_SMS) {
+ snprintf(popup_msg, sizeof(popup_msg), MSGC_STR_NOTI_CHANGE_SMS);
+ } else if (tickertype == COMPOSER_TICKERNOTI_CHANGED_MMS) {
+ snprintf(popup_msg, sizeof(popup_msg), MSGC_STR_NOTI_CHANGE_MMS);
+ } else if (tickertype == COMPOSER_TICKERNOTI_AUTO_SAVED) {
+ snprintf(popup_msg, sizeof(popup_msg), _MSGSTR("IDS_MSGC_POP_MESSAGE_SAVED_AS_DRAFT"));
+ } else if (tickertype == COMPOSER_TICKERNOTI_NO_RECIPIENT) {
+ snprintf(popup_msg, sizeof(popup_msg), _MSGSTR("IDS_MSGF_POP_NO_RECIPIENTS_ADDED_ENTER_RECIPIENTS"));
+ } else if (tickertype == COMPOSER_TICKERNOTI_MAXLENGHT_CHAR) {
+ snprintf(popup_msg, sizeof(popup_msg), _MSGSTR("IDS_MSGF_POP_MAXIMUM_CHARACTERS"));
+ } else {
+ return;
}
- // null terminated string
- if (srcTextLen == -1) {
- textLen = strlen((char*)pSrcText);
- srcTextLen = textLen;
+ msg_ui_composer_status_noti_show(popup_msg);
+}
+
+int msg_ui_composer_get_keypad_height(Evas_Object *entry)
+{
+ D_MSG_RETVM_IF(entry == NULL, 0, "param is NULL");
+ int keypad_x = 0;
+ int keypad_y = 0;
+ int keypad_w = 0;
+ int keypad_h = 0;
+
+ Ecore_IMF_Context *entry_ctx = elm_entry_imf_context_get(entry);
+ ecore_imf_context_input_panel_geometry_get(entry_ctx, &keypad_x, &keypad_y, &keypad_w, &keypad_h);
+
+ return keypad_h;
+}
+
+void msg_ui_composer_change_body_scroll_size(MSG_COMPOSER_VIEW_DATA_S *cd, int keypad_height)
+{
+ D_ENTER;
+ D_MSG_RETM_IF(cd == NULL, "Composer Data is Invalid");
+
+ int total_height = 0;
+ int scroll_height = 0;
+ int scroll_x = 0;
+ int scroll_y = 0;
+ int scroll_w = 0;
+ int scroll_h = 0;
+
+ elm_scroller_region_get(cd->body_scroll, &scroll_x, &scroll_y, &scroll_w, &scroll_h);
+ D_MSG("scroll region x=%d, y=%d, w=%d, h=%d", scroll_x, scroll_y, scroll_w, scroll_h);
+
+ if (cd->rotate == COMPOSER_ROTATE_PORTRAIT || cd->rotate == COMPOSER_ROTATE_PORTRAIT_UPSIDEDOWN)
+ total_height = (cd->window_h > cd->window_w) ? cd->window_h : cd->window_w;
+ else
+ total_height = (cd->window_h > cd->window_w) ? cd->window_w : cd->window_h;
+
+ if (cd->msg_ug_mode == MSG_UG_MODE_FULL_COMPOSER || cd->msg_ug_mode == MSG_UG_MODE_ONLY_COMPOSER) {
+ RECIPIENT_S *rd = cd->recipient;
+ D_MSG_RETM_IF(rd == NULL, "recipient Data is NULL");
+ int recipient_h = 0;
+
+ recipient_h = rd->recipient_h;
+
+ D_MSG("recipient_h = %d", recipient_h);
+ if (cd->rotate == COMPOSER_ROTATE_PORTRAIT || cd->rotate == COMPOSER_ROTATE_PORTRAIT_UPSIDEDOWN)
+ scroll_height = (total_height - keypad_height - recipient_h - MSGC_NAVIBAR_TITLE_H - MSGC_BODY_PADDING - MSGC_INDICATOR_H);
+ else
+ scroll_height = (total_height - keypad_height - recipient_h - MSGC_NAVIBAR_TITLE_H - MSGC_BODY_PADDING);
+
+ D_MSG("scroll_height = %d", scroll_height);
+
+ if (scroll_height <= COMPOSER_FRAME_BODY_LANDSCAPE_HEIGHT_MIN)
+ scroll_height = COMPOSER_FRAME_BODY_LANDSCAPE_HEIGHT_MIN;
+
+ if (scroll_h != scroll_height) {
+ evas_object_size_hint_max_set(cd->body_scroll, 9999, scroll_height);
+ elm_scroller_content_min_limit(cd->body_scroll, EINA_FALSE, EINA_TRUE);
+ D_MSG("scroll size updated w = %d, h = %d", scroll_w, scroll_height);
+ }
+ } else if (cd->msg_ug_mode == MSG_UG_MODE_BUBBLE_COMPOSER) {
+ scroll_height = (total_height - keypad_height - MSGC_NAVIBAR_TITLE_H - MSGC_INDICATOR_H - MSGC_BODY_PADDING);
+ D_MSG("scroll_height = %d", scroll_height);
+
+ if (scroll_height <= COMPOSER_FRAME_BODY_LANDSCAPE_HEIGHT_MIN)
+ scroll_height = COMPOSER_FRAME_BODY_LANDSCAPE_HEIGHT_MIN;
+
+ if (scroll_h != scroll_height) {
+ evas_object_size_hint_max_set(cd->body_scroll, 9999, scroll_height);
+ elm_scroller_content_min_limit(cd->body_scroll, EINA_FALSE, EINA_TRUE);
+ D_MSG("scroll size updated w = %d, h = %d", scroll_w, scroll_height);
+ }
} else {
- textLen = srcTextLen;
+ D_EMSG("Unknown Composer Mode");
}
- GIConv cd;
- int err=0;
+ D_LEAVE;
+}
- cd = g_iconv_open("UCS-2BE", "UTF8");
+void msg_ui_composer_make_default_body_size(MSG_COMPOSER_VIEW_DATA_S *cd)
+{
+ D_ENTER;
+ D_MSG_RETM_IF(cd == NULL, "Composer Data is NULL");
- if (cd > 0)
- {
- err = g_iconv(cd, (char**)&pSrcText, (gsize*)&textLen, (char**)&unicodeTemp, (gsize*)&remainedBuffer);
- }
+ int scroll_height = COMPOSER_FRAME_BODY_LANDSCAPE_HEIGHT_MIN;
+
+ cd->is_default_body_size = true;
+
+ msg_ui_composer_contract_attach_list(cd);
- ucs2Length = maxLength - remainedBuffer;
+ evas_object_size_hint_max_set(cd->body_scroll, 9999, scroll_height);
+ elm_scroller_content_min_limit(cd->body_scroll, EINA_FALSE, EINA_TRUE);
+ /* move scroll to top */
+ elm_scroller_region_show(cd->body_scroll, 0, 0, 0, 0);
- g_iconv_close(cd);
+ evas_object_event_callback_add(cd->body_box, EVAS_CALLBACK_MOUSE_UP, msg_ui_composer_body_body_layout_clicked_cb, cd);
D_LEAVE;
- return ucs2Length;
}
-void msg_ui_composer_common_tickernoti(MSG_COMPOSER_VIEW_DATA_S *cd, COMPOSER_TICKERNOTI_TYPE_E tickertype)
+void msg_ui_composer_entry_imf_resize_cb(void * data, Ecore_IMF_Context *ctx, int value)
{
- char popup_msg[DEF_BUF_LEN_L] = {0,};
- MSGC_NOTIFY_ORIENT orient;
- Evas_Object *parent_notify;
-
+ D_ENTER;
+ MSG_COMPOSER_VIEW_DATA_S *cd = (MSG_COMPOSER_VIEW_DATA_S *)data;
D_MSG_RETM_IF(cd == NULL, "Composer Data is Invalid");
-
- if (tickertype == COMPOSER_TICKERNOTI_COUNT_MAX) {
- snprintf(popup_msg, sizeof(popup_msg)-1, MSGC_STR_NOTI_RECIPIENT_MAX, COMPOSER_RECIPIENT_COUNT_MAX);
- parent_notify = cd->recipient->bx_main;
- orient = MSGC_NOTIFY_ORIENT_BOTTOM;
- } else if (tickertype == COMPOSER_TICKERNOTI_DUP_RECP) {
- snprintf(popup_msg, sizeof(popup_msg)-1, MSGC_STR_NOTI_RECIPIENT_DUP);
- parent_notify = cd->recipient->bx_main;
- orient = MSGC_NOTIFY_ORIENT_BOTTOM;
- } else if (tickertype == COMPOSER_TICKERNOTI_INVALID_RECP) {
- snprintf(popup_msg, sizeof(popup_msg)-1, MSGC_STR_NOTI_RECIPIENT_INVALID);
- parent_notify = cd->recipient->bx_main;
- orient = MSGC_NOTIFY_ORIENT_BOTTOM;
- } else if (tickertype == COMPOSER_TICKERNOTI_CHANGED_SMS) {
- snprintf(popup_msg, sizeof(popup_msg)-1, MSGC_STR_NOTI_CHANGE_SMS);
- parent_notify = cd->ly_body;
- orient = MSGC_NOTIFY_ORIENT_BOTTOM;
+ D_MSG_RETM_IF(ctx == NULL, "Ecore_IMF_Context is Invalid");
+ int keypad_x = 0;
+ int keypad_y = 0;
+ int keypad_w = 0;
+ int keypad_h = 0;
+
+ ecore_imf_context_input_panel_geometry_get(ctx, &keypad_x, &keypad_y, &keypad_w, &keypad_h);
+ D_MSG("keypad x = %d, y = %d, w = %d, h = %d", keypad_x, keypad_y, keypad_w, keypad_h);
+ D_MSG("cd->make_default_body_size = %d", cd->make_default_body_size);
+
+ if (cd->make_default_body_size) {
+ if (!cd->is_keypad_show)
+ cd->make_default_body_size = false;
} else {
- return;
+ if (keypad_w != 0 && keypad_h != 0)
+ msg_ui_composer_change_body_scroll_size(cd, keypad_h);
}
- if (cd->noti) {
- evas_object_del(cd->noti);
- }
-
- cd->noti = msg_ui_composer_notify_show(parent_notify, popup_msg, COMPOSER_STATUS_POPUP_DEFAULT_TIME, orient, false);
+ D_LEAVE;
}
void msg_ui_composer_entry_imf_state_cb(void * data, Ecore_IMF_Context *ctx, int value)
D_ENTER;
MSG_COMPOSER_VIEW_DATA_S *cd = (MSG_COMPOSER_VIEW_DATA_S *)data;
-
D_MSG_RETM_IF(cd == NULL, "Composer Data is Invalid");
D_MSG_RETM_IF(ctx == NULL, "Ecore_IMF_Context is Invalid");
if (value == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
+ int keypad_x = 0;
+ int keypad_y = 0;
+ int keypad_w = 0;
+ int keypad_h = 0;
+
D_MSG("Imf status SHOW");
- edje_object_signal_emit(_EDJ(cd->ly_body), "body_contract","*");
+
+ cd->is_keypad_show = true;
+
+ ecore_imf_context_input_panel_geometry_get(ctx, &keypad_x, &keypad_y, &keypad_w, &keypad_h);
+ D_MSG("keypad x = %d, y = %d, w = %d, h = %d", keypad_x, keypad_y, keypad_w, keypad_h);
+
+ msg_ui_composer_change_body_scroll_size(cd, keypad_h);
} else if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
D_MSG("Imf status HIDE");
- if (msg_ui_composer_common_is_send_possible(cd) == false) {
- D_MSG("body_EXPAND and send button HIDE ");
- edje_object_signal_emit(_EDJ(cd->ly_body), "body_expand","*");
+ cd->is_keypad_show = false;
+
+ D_MSG("cd->make_default_body_size = %d", cd->make_default_body_size);
+
+ if (cd->make_default_body_size) {
+ cd->make_default_body_size = false;
+ msg_ui_composer_make_default_body_size(cd);
+ } else {
+ msg_ui_composer_change_body_scroll_size(cd, 0);
}
} else {
D_EMSG("imf status INVALID");
D_LEAVE;
}
-void msg_ui_composer_evas_object_delete_cb(void *data, Evas * e, Evas_Object *obj, void *event_info)
+int msg_ui_composer_get_font_size(int type)
{
D_ENTER;
- if (!data || !obj)
+
+ int font_size = 0;
+ int converted_size = -1;
+
+ if (type == COMPOSER_TYPE_BODY) {
+ int index = 0;
+
+ if (msg_common_get_font_size(&index) == FALSE) {
+ D_EMSG("msg_common_get_font_size() is failed !!");
+ return -1;
+ } else {
+ D_MSG("selected font_size index = %d", index);
+ }
+
+ font_size = msg_common_get_font_size_from_index(index);
+
+ if (font_size == -1) {
+ D_EMSG("msg_common_get_font_size_from_index() is failed !!");
+ return -1;
+ }
+
+ converted_size = (MSGC_BODY_FONT_SIZE * font_size) / MSG_APP_FONT_SIZE_NORMAL;
+ } else if (type == COMPOSER_TYPE_SUBJECT) {
+ int access_font_index = 0;
+
+ /* get accessibility font index */
+ if (vconf_get_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &access_font_index) < 0) {
+ D_EMSG("vconf_get_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE) is failed !!");
+ access_font_index = MSG_SYS_FONT_SIZE_INDEX_NORMAL; /* 1 */
+ }
+
+ font_size = msg_common_get_font_size_from_index(access_font_index);
+ if (font_size == -1) {
+ D_EMSG("msg_common_get_font_size_from_index() is failed !!");
+ return -1;
+ }
+
+ converted_size = (MSGC_SUBJECT_FONT_SIZE * font_size) / MSG_APP_FONT_SIZE_NORMAL;
+ } else {
+ D_EMSG("Invalid type");
+ }
+
+ D_LEAVE;
+ return converted_size;
+}
+
+void msg_ui_composer_apply_font_size(MSG_COMPOSER_VIEW_DATA_S *cd, bool update_subject)
+{
+ D_ENTER;
+ D_MSG_RETM_IF(cd == NULL, "Composer Data is Invalid");
+
+ int index = 0;
+ int font_size = 0;
+ int converted_size = cd->font_size;
+
+ if (msg_common_get_font_size(&index) == FALSE) {
+ D_EMSG("msg_common_get_font_size() is failed !!");
return;
+ } else {
+ D_MSG("selected font_size index = %d", index);
+ }
+
+ font_size = msg_common_get_font_size_from_index(index);
+
+ if (font_size == -1) {
+ D_EMSG("msg_common_get_font_size_from_index() is failed !!");
+ return;
+ }
+
+ converted_size = (MSGC_BODY_FONT_SIZE * font_size) / MSG_APP_FONT_SIZE_NORMAL;
+
+ /* apply font size */
+ char font_style_str[DEF_BUF_LEN_S + 1] = {0,};
+ snprintf(font_style_str, sizeof(font_style_str), "DEFAULT='font_size=%d'", converted_size);
+ D_MSG("font_style_str = (%s)", font_style_str);
+
+ msg_ui_composer_recipient_apply_font_size(cd, font_style_str);
+ msg_ui_composer_body_apply_font_size(cd, font_style_str);
+
+ if (update_subject) {
+ int access_font_index = 0;
+ /* get accessibility font index */
+ if (vconf_get_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &access_font_index) < 0) {
+ D_EMSG("vconf_get_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE) is failed !!");
+ access_font_index = MSG_SYS_FONT_SIZE_INDEX_NORMAL; /* 1 */
+ }
+
+ font_size = msg_common_get_font_size_from_index(access_font_index);
+ if (font_size == -1) {
+ D_EMSG("msg_common_get_font_size_from_index() is failed !!");
+ return;
+ }
- D_PRINT("delete = %s[%p]", (char *)data, obj);
+ converted_size = (MSGC_SUBJECT_FONT_SIZE * font_size) / MSG_APP_FONT_SIZE_NORMAL;
+
+ /* apply font size */
+ memset(font_style_str, 0, sizeof(font_style_str));
+ snprintf(font_style_str, sizeof(font_style_str), "DEFAULT='font_size=%d'", converted_size);
+ D_MSG("subject font_style_str = (%s)", font_style_str);
+
+ msg_ui_composer_subject_apply_font_size(cd, font_style_str);
+ }
+
+ D_LEAVE;
+}
+
+void msg_ui_composer_naviframe_size_hints_changed(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ D_ENTER;
+ D_MSG_RETM_IF(data == NULL, "Composer Data is NULL");
+ MSG_COMPOSER_VIEW_DATA_S *cd = (MSG_COMPOSER_VIEW_DATA_S *)data;
+ Evas_Display_Mode dispmode;
+
+ dispmode = evas_object_size_hint_display_mode_get(obj);
+ if (dispmode == EVAS_DISPLAY_MODE_COMPRESS) {
+ D_MSG("dispmode = EVAS_DISPLAY_MODE_COMPRESS");
+ cd->is_keypad_show = true;
+ } else if (dispmode == EVAS_DISPLAY_MODE_NONE) {
+ D_MSG("dispmode = EVAS_DISPLAY_MODE_NONE");
+ cd->is_keypad_show = false;
+ }
D_LEAVE;
}
+