From e58b4801ba7062a073d24be8e1641e9c08709660 Mon Sep 17 00:00:00 2001 From: Sungbok Park Date: Mon, 7 Jan 2013 17:48:57 +0900 Subject: [PATCH] Merged with latest common/composer/viewer code Change-Id: I6c04918dd28d9c8b714db4cd95e93291b17e762e --- account/src/email-account-folder.c | 22 ++--- account/src/email-account.c | 6 +- common/src/email-engine.c | 1 + composer/include/email-composer.h | 3 +- composer/src/email-composer-attachment.c | 164 ++++++++++++++----------------- composer/src/email-composer-callback.c | 57 ++++++++--- composer/src/email-composer-contents.c | 8 +- composer/src/email-composer-util.c | 71 +++++++------ composer/src/email-composer.c | 10 +- mailbox/src/email-mailbox-item.c | 4 +- mailbox/src/email-mailbox-list.c | 34 +++---- mailbox/src/email-mailbox-search.c | 26 ++--- mailbox/src/email-mailbox.c | 22 ++--- packaging/org.tizen.email.spec | 2 +- viewer/src/email-viewer.c | 41 +++++++- 15 files changed, 274 insertions(+), 197 deletions(-) diff --git a/account/src/email-account-folder.c b/account/src/email-account-folder.c index 9ab22f8..d44b488 100755 --- a/account/src/email-account-folder.c +++ b/account/src/email-account-folder.c @@ -200,8 +200,8 @@ Evas_Object *create_fullview(EmailAccountUGD *ug_data) ug_data->update_button = elm_button_add(ug_data->navi_bar); elm_object_style_set(ug_data->update_button, "naviframe/title/default"); Evas_Object *update_icon = elm_icon_add(ug_data->update_button); - elm_icon_file_set(update_icon, CONTROLBAR_ICON_UPDATE, NULL); - elm_icon_resizable_set(update_icon, 1, 1); + elm_image_file_set(update_icon, CONTROLBAR_ICON_UPDATE, NULL); + elm_image_resizable_set(update_icon, 1, 1); evas_object_image_smooth_scale_set(update_icon, 0); elm_object_content_set(ug_data->update_button, update_icon); evas_object_smart_callback_add(ug_data->update_button, "clicked", _update_all_account_cb, ug_data); @@ -220,8 +220,8 @@ Evas_Object *create_fullview(EmailAccountUGD *ug_data) ug_data->update_button = elm_button_add(ug_data->navi_bar); elm_object_style_set(ug_data->update_button, "naviframe/title_icon"); Evas_Object *update_icon = elm_icon_add(ug_data->update_button); - elm_icon_file_set(update_icon, CONTROLBAR_ICON_UPDATE, NULL); - elm_icon_resizable_set(update_icon, 1, 1); + elm_image_file_set(update_icon, CONTROLBAR_ICON_UPDATE, NULL); + elm_image_resizable_set(update_icon, 1, 1); evas_object_image_smooth_scale_set(update_icon, 0); elm_object_content_set(ug_data->update_button, update_icon); evas_object_smart_callback_add(ug_data->update_button, "clicked", _update_all_account_cb, ug_data); @@ -251,13 +251,13 @@ Evas_Object *create_fullview(EmailAccountUGD *ug_data) // 2line title text elm_object_part_text_set(ug_data->navi_title_ly, "txt_title", _("IDS_EMAIL_HEADER_FOLDERS")); if (ug_data->account_id == 0) { - elm_icon_file_set(ug_data->sp_icon, NULL, NULL); + elm_image_file_set(ug_data->sp_icon, NULL, NULL); elm_object_part_text_set(ug_data->navi_title_ly, "txt_sub", _("IDS_EMAIL_HEADER_ALL_ACCOUNTS")); } else{ email_account_t *account; email_get_account(ug_data->account_id, WITHOUT_OPTION, &account); - elm_icon_file_set(ug_data->sp_icon, account->logo_icon_path, NULL); + elm_image_file_set(ug_data->sp_icon, account->logo_icon_path, NULL); elm_object_part_text_set(ug_data->navi_title_ly, "txt_sub", account->account_name); @@ -915,7 +915,7 @@ static Evas_Object *_gl_icon_get_for_subitem(void *data, Evas_Object *obj, const if (!strcmp(part, "elm.icon") || !strcmp(part, "elm.icon.1")) { Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, FOLDER_ICON_PLUS_FOLDER_LIST, NULL); + elm_image_file_set(icon, FOLDER_ICON_PLUS_FOLDER_LIST, NULL); evas_object_smart_callback_add(icon, "clicked", _folder_icon_clicked_cb, data); evas_object_propagate_events_set(icon, EINA_FALSE); evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); @@ -957,7 +957,7 @@ static Evas_Object *_gl_icon_get_for_leafitem(void *data, Evas_Object *obj, cons if (!strcmp(part, "elm.icon") || !strcmp(part, "elm.icon.1")) { Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, FOLDER_ICON_FOLDER_LIST, NULL); + elm_image_file_set(icon, FOLDER_ICON_FOLDER_LIST, NULL); evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); return icon; @@ -1046,7 +1046,7 @@ static Evas_Object *_gl_icon_get(void *data, Evas_Object *obj, const char *part) { Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, alist->account_info->logo_icon_path, NULL); + elm_image_file_set(icon, alist->account_info->logo_icon_path, NULL); debug_log("logo_icon_path:%s", alist->account_info->logo_icon_path); evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); @@ -1226,9 +1226,9 @@ static void _folder_icon_clicked_cb(void *data, Evas_Object *obj, void *event_in elm_genlist_item_expanded_set(item_data->it, !expanded); if (expanded) { - elm_icon_file_set(obj, FOLDER_ICON_PLUS_FOLDER_LIST, NULL); + elm_image_file_set(obj, FOLDER_ICON_PLUS_FOLDER_LIST, NULL); } else { - elm_icon_file_set(obj, FOLDER_ICON_MINUS_FOLDER_LIST, NULL); + elm_image_file_set(obj, FOLDER_ICON_MINUS_FOLDER_LIST, NULL); } } diff --git a/account/src/email-account.c b/account/src/email-account.c index 3842da1..fe49638 100755 --- a/account/src/email-account.c +++ b/account/src/email-account.c @@ -644,7 +644,7 @@ static Evas_Object *_gl_icon_get_for_all_emails(void *data, Evas_Object *obj, co if (!strcmp(part, "elm.icon")) { Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, ACCOUNT_ICON_ALLACCOUNT, NULL); + elm_image_file_set(icon, ACCOUNT_ICON_ALLACCOUNT, NULL); evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); return icon; } @@ -688,7 +688,7 @@ static Evas_Object *_gl_icon_get_for_add_account(void *data, Evas_Object *obj, c if (!strcmp(part, "elm.icon")) { Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, ACCOUNT_ICON_ADDACCOUNT, NULL); + elm_image_file_set(icon, ACCOUNT_ICON_ADDACCOUNT, NULL); evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); return icon; } @@ -726,7 +726,7 @@ static Evas_Object *_gl_icon_get(void *data, Evas_Object *obj, const char *part) { Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, alist->account_info->logo_icon_path, NULL); + elm_image_file_set(icon, alist->account_info->logo_icon_path, NULL); debug_log("logo_icon_path:%s", alist->account_info->logo_icon_path); evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); diff --git a/common/src/email-engine.c b/common/src/email-engine.c index dd5ac37..b66170a 100755 --- a/common/src/email-engine.c +++ b/common/src/email-engine.c @@ -305,6 +305,7 @@ gboolean email_engine_get_default_account(gint *account_id) err = email_get_account_list(&_account, &count); if (err != EMAIL_ERROR_NONE) { debug_critical("fail to get account list - err(%d)", err); + email_free_account(&_account, 1); return FALSE; } diff --git a/composer/include/email-composer.h b/composer/include/email-composer.h index 4abd15e..9015fc7 100755 --- a/composer/include/email-composer.h +++ b/composer/include/email-composer.h @@ -232,7 +232,8 @@ struct ug_data { COMPOSER_ERROR_TYPE_E eComposerErrorType; - Eina_List *listOfImageUrls; + int inline_cnt; + Eina_List *attachment_inline_item_list; Eina_Bool b_load_finished; Eina_Bool need_download; diff --git a/composer/src/email-composer-attachment.c b/composer/src/email-composer-attachment.c index 221e20b..23eea8c 100755 --- a/composer/src/email-composer-attachment.c +++ b/composer/src/email-composer-attachment.c @@ -154,19 +154,21 @@ int _composer_get_inline_images_size(EmailComposerUGD *ugd) int total_size = 0; if (EINA_TRUE == ugd->has_body_html) { - debug_log("listOfImageUrls count : %d", eina_list_count(ugd->listOfImageUrls)); - if (eina_list_count(ugd->listOfImageUrls) > 0) { + debug_log("attachment_inline_item_list count : %d", eina_list_count(ugd->attachment_inline_item_list)); + if (eina_list_count(ugd->attachment_inline_item_list) > 0) { - Eina_List *list = ugd->listOfImageUrls; + Eina_List *list = ugd->attachment_inline_item_list; Eina_List *l = NULL; - char *recv = NULL; + email_attachment_data_t *attachment_data = NULL; Eina_List *inline_list = NULL; - EINA_LIST_FOREACH(list, l, recv) { - if (strncmp(recv, "file://", 7) == 0) { - debug_log("Inline image : %s", recv + 7); - inline_list = eina_list_append(inline_list, recv + 7); + EINA_LIST_FOREACH(list, l, attachment_data) { + if (attachment_data != NULL) { + if (attachment_data->attachment_path != NULL) { + debug_log("Inline image : %s", attachment_data->attachment_path); + inline_list = eina_list_append(inline_list, attachment_data->attachment_path); + } } } if (eina_list_count(inline_list) > 0 && (inline_list != NULL)) { @@ -620,7 +622,9 @@ Evas_Object *_composer_attachment_make_thumbnail(EmailComposerUGD *ugd, char *fi debug_log("file path : %s", filePath); - if (strncmp(type, ATTACHMENT_MEDIA_IMAGE, 5) == 0 || strncmp(type, ATTACHMENT_MEDIA_VIDEO, 5) == 0) { + if (strncmp(type, ATTACHMENT_MEDIA_IMAGE, 5) == 0) { + strncpy(thumb_path, filePath, MAX_ATTACHMENT_FILE_LEN); + } else if (strncmp(type, ATTACHMENT_MEDIA_VIDEO, 5) == 0) { int err = _composer_attachment_make_ethumb(filePath, thumb_path); if (err != COMPOSER_ERROR_NONE) @@ -731,7 +735,6 @@ Evas_Object *_composer_attachment_make_thumbnail(EmailComposerUGD *ugd, char *fi free(type); type = NULL; } - if (temp) { free(temp); temp = NULL; @@ -746,88 +749,73 @@ Evas_Object *_composer_attachment_make_thumbnail(EmailComposerUGD *ugd, char *fi int _composer_attachment_make_ethumb(const char *source, char *target) { - debug_log(""); - - debug_log("file path: %s", source); - efreet_mime_init(); - char *type = (char *)efreet_mime_type_get(ecore_file_file_get(source)); - char *mime_type = g_strdup(type); - debug_log("mime type: %s", mime_type); - efreet_mime_shutdown(); - - if (mime_type) { - if (strncmp(mime_type, "image", 5) == 0) { - strncpy(target, source, MAX_ATTACHMENT_FILE_LEN); - } else if (strncmp(mime_type, "video", 5) == 0) { - metadata_extractor_h metadata = NULL; - int ret = METADATA_EXTRACTOR_ERROR_NONE; - char *video_width = NULL; - char *video_height = NULL; - char *video_track_cnt = NULL; - void *video_thumbnail = NULL; - int video_thumbnail_len = 0; - int video_w = 0; - int video_h = 0; - - ret = metadata_extractor_create(&metadata); - debug_log("metadata_extractor_create: %d", ret); - if (!metadata) { - debug_log("metadata extractor create failed"); - return COMPOSER_ERROR_ETHUMB_FAIL; - } - - ret = metadata_extractor_set_path(metadata, source); - debug_log("metadata_extractor_set_path: %d", ret); - - ret = metadata_extractor_get_metadata(metadata, METADATA_VIDEO_WIDTH, &video_width); - debug_log("metadata_extractor_get_metadata: %d [video_width:%s]", ret, video_width); - ret = metadata_extractor_get_metadata(metadata, METADATA_VIDEO_HEIGHT, &video_height); - debug_log("metadata_extractor_get_metadata: %d [video_height:%s]", ret, video_height); - ret = metadata_extractor_get_metadata(metadata, METADATA_HAS_VIDEO, &video_track_cnt); - debug_log("metadata_extractor_get_metadata: %d [video_track_cnt:%s]", ret, video_track_cnt); - - ret = metadata_extractor_get_frame(metadata, &video_thumbnail, &video_thumbnail_len); - debug_log("metadata_extractor_get_frame: %d (video_thumbnail_len:%d)", ret, video_thumbnail_len); - - if (video_thumbnail) { - int mm_ret = 0; - char filename[MAX_ATTACHMENT_FILE_LEN] = { 0, }; - char *file_name = NULL; - char *file_ext = NULL; - - email_parse_get_filename_n_ext_from_path(source, &file_name, &file_ext); - snprintf(filename, sizeof(filename), "%s%s%s%s", EMAIL_TMP_FOLDER"/", file_name, file_ext, ".jpg"); - g_free(file_name); - g_free(file_ext); - - if (video_width) - video_w = atoi(video_width); - if (video_height) - video_h = atoi(video_height); - mm_ret = image_util_encode_jpeg(video_thumbnail, - video_w, video_h, - IMAGE_UTIL_COLORSPACE_RGB888, 70, filename); - - if (ecore_file_exists(filename)) { - strncpy(target, filename, MAX_ATTACHMENT_FILE_LEN); - debug_log("file : %s, thumb_path : %s", source, target); - } - g_free(video_thumbnail); - } - - if (video_width) - g_free(video_width); - if (video_height) - g_free(video_height); - if (video_track_cnt) - g_free(video_track_cnt); + debug_enter(); + + metadata_extractor_h metadata = NULL; + int ret = METADATA_EXTRACTOR_ERROR_NONE; + char *video_width = NULL; + char *video_height = NULL; + char *video_track_cnt = NULL; + void *video_thumbnail = NULL; + int video_thumbnail_len = 0; + int video_w = 0; + int video_h = 0; + + ret = metadata_extractor_create(&metadata); + debug_log("metadata_extractor_create: %d", ret); + if (!metadata) { + debug_log("metadata extractor create failed"); + return COMPOSER_ERROR_ETHUMB_FAIL; + } - ret = metadata_extractor_destroy(metadata); - debug_log("metadata_extractor_destroy: %d", ret); + ret = metadata_extractor_set_path(metadata, source); + debug_log("metadata_extractor_set_path: %d", ret); + + ret = metadata_extractor_get_metadata(metadata, METADATA_VIDEO_WIDTH, &video_width); + debug_log("metadata_extractor_get_metadata: %d [video_width:%s]", ret, video_width); + ret = metadata_extractor_get_metadata(metadata, METADATA_VIDEO_HEIGHT, &video_height); + debug_log("metadata_extractor_get_metadata: %d [video_height:%s]", ret, video_height); + ret = metadata_extractor_get_metadata(metadata, METADATA_HAS_VIDEO, &video_track_cnt); + debug_log("metadata_extractor_get_metadata: %d [video_track_cnt:%s]", ret, video_track_cnt); + + ret = metadata_extractor_get_frame(metadata, &video_thumbnail, &video_thumbnail_len); + debug_log("metadata_extractor_get_frame: %d (video_thumbnail_len:%d)", ret, video_thumbnail_len); + + if (video_thumbnail) { + int mm_ret = 0; + char filename[MAX_ATTACHMENT_FILE_LEN] = { 0, }; + char *file_name = NULL; + char *file_ext = NULL; + + email_parse_get_filename_n_ext_from_path(source, &file_name, &file_ext); + snprintf(filename, sizeof(filename), "%s%s%s%s", EMAIL_TMP_FOLDER"/", file_name, file_ext, ".jpg"); + g_free(file_name); + g_free(file_ext); + + if (video_width) + video_w = atoi(video_width); + if (video_height) + video_h = atoi(video_height); + mm_ret = image_util_encode_jpeg(video_thumbnail, + video_w, video_h, + IMAGE_UTIL_COLORSPACE_RGB888, 70, filename); + + if (ecore_file_exists(filename)) { + strncpy(target, filename, MAX_ATTACHMENT_FILE_LEN); + debug_log("file : %s, thumb_path : %s", source, target); } + g_free(video_thumbnail); } - g_free(mime_type); + if (video_width) + g_free(video_width); + if (video_height) + g_free(video_height); + if (video_track_cnt) + g_free(video_track_cnt); + + ret = metadata_extractor_destroy(metadata); + debug_log("metadata_extractor_destroy: %d", ret); return COMPOSER_ERROR_NONE; } diff --git a/composer/src/email-composer-callback.c b/composer/src/email-composer-callback.c index 7611aad..c29b991 100755 --- a/composer/src/email-composer-callback.c +++ b/composer/src/email-composer-callback.c @@ -71,7 +71,7 @@ void _composer_edit_field_changed_cb(void *data, Evas_Object *obj, void *event_i EmailComposerUGD *ugd = (EmailComposerUGD *)data; if (obj == ugd->subject_entry) { - _composer_check_entry_max(ugd, ugd->subject_entry, MAX_SUBJECT_LEN); + _composer_check_entry_max(ugd, ugd->subject_entry, MAX_SUBJECT_LEN + 1); if (_composer_check_recipient_is_empty(ugd)) { if (!ugd->bSendBtnDisabled) { @@ -2791,21 +2791,56 @@ void _composer_get_image_list_cb(Evas_Object *o, const char *result, void *data) char *list = NULL; EmailComposerUGD *ugd = (EmailComposerUGD *) data; - if (ugd->listOfImageUrls) { - eina_list_free(ugd->listOfImageUrls); - ugd->listOfImageUrls = NULL; + if (ugd->attachment_inline_item_list) { + eina_list_free(ugd->attachment_inline_item_list); + ugd->attachment_inline_item_list = NULL; } if (result != NULL) { - debug_log("listOFImageUrls => %s", result); + debug_log("attachment_inline_item_list => %s", result); list = g_strdup(result); - - char *token = strtok(list, ","); - while (token != NULL) { - if (token) { - ugd->listOfImageUrls = eina_list_append(ugd->listOfImageUrls, token); - token = strtok(NULL, ","); + char *url = strtok(list, ","); + while (url != NULL) { + if (url) { + if (strncmp(url, "file://", 7) == 0) { /* add only local images(file://), not web images(http://) */ + int return_stat; + gchar **tokens; + struct stat file_info; + debug_log("image = %s", url + 7); + + if ((return_stat = stat(url + 7, &file_info)) == -1) { + debug_error("stat Error(%d): %s", return_stat, strerror(return_stat)); + break; + } + + tokens = g_strsplit(url + 7, "/", -1); + + email_attachment_data_t *attachment_data = (email_attachment_data_t *)calloc(1, sizeof(email_attachment_data_t)); + attachment_data->account_id = ugd->account_info->account_id; + attachment_data->attachment_id = 0; + attachment_data->attachment_name = COMPOSER_STRDUP(tokens[g_strv_length(tokens) - 1]); + attachment_data->attachment_path = COMPOSER_STRDUP(url + 7); + attachment_data->attachment_size = file_info.st_size; + attachment_data->drm_status = 0; + attachment_data->inline_content_status = 1; + attachment_data->mailbox_id = NULL; + attachment_data->mail_id = 0; + attachment_data->save_status = 1; + attachment_data->attachment_mime_type = NULL; + debug_log("attachment_name = %s, attachment_path = %s", attachment_data->attachment_name, attachment_data->attachment_path); + ugd->attachment_inline_item_list = eina_list_append(ugd->attachment_inline_item_list, attachment_data); + g_strfreev(tokens); + } + url = strtok(NULL, ","); } } } + + ugd->inline_cnt = eina_list_count(ugd->attachment_inline_item_list); + debug_log("ugd->inline_cnt : %d", ugd->inline_cnt); + + if (list) { + free(list); + list = NULL; + } } diff --git a/composer/src/email-composer-contents.c b/composer/src/email-composer-contents.c index 0b37e23..4f6fe7c 100755 --- a/composer/src/email-composer-contents.c +++ b/composer/src/email-composer-contents.c @@ -62,6 +62,9 @@ static void _changed_cb(void *data, Evas_Object *obj, void *event_info) // This else elm_object_signal_emit(data, "elm,state,eraser,show", "elm"); } + + if (!elm_entry_is_empty(obj)) + elm_object_signal_emit(data, "elm,state,guidetext,hide", "elm"); } static void _focused_cb(void *data, Evas_Object *obj, void *event_info) // Focused callback will show X marked button and hide guidetext. @@ -299,6 +302,9 @@ static void _composer_webkit_script_executed_cb(Evas_Object *o, const char *resu debug_log("COMPOSER_JS_GET_ORIGINAL_HTML_CONTENT failed."); if (ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_GET_LATEST_INFO_CONTENT, _composer_set_original_info_content_cb, (void *)ugd) == EINA_FALSE) debug_log("COMPOSER_JS_GET_ORIGINAL_INFO_CONTENT failed."); + if (EINA_FALSE == ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_GET_IMAGE_LIST, _composer_get_image_list_cb, (void *)ugd)) { + debug_log("COMPOSER_JS_GET_IMAGE_LIST error."); + } } void _composer_webkit_loadFinished_cb(void *data, Evas_Object *obj, void *event_info) @@ -369,7 +375,7 @@ static void _composer_webkit_focused_cb(void *data, Evas *e, Evas_Object *obj, v ugd->selected_entry = ugd->body_ewkview; evas_object_focus_set(ugd->body_ewkview, EINA_TRUE); - ugd->focus_status = COMPOSER_FOCUS_STATUS_NONE; // focus handling when rte is clicked + ugd->focus_status = COMPOSER_FOCUS_STATUS_NONE; _composer_attachment_contract_items(ugd); elm_layout_sizing_eval(ugd->c_layout); diff --git a/composer/src/email-composer-util.c b/composer/src/email-composer-util.c index 2a31f25..b7aa0d4 100755 --- a/composer/src/email-composer-util.c +++ b/composer/src/email-composer-util.c @@ -669,39 +669,20 @@ int _composer_make_mail(EmailComposerUGD *ugd, Eina_Bool b_save_to_draft) debug_log("\nhtml_content:\n%s", html_content); - - if (ugd->listOfImageUrls == NULL) { + if (ugd->attachment_inline_item_list == NULL) { debug_log("No images found or ERROR"); html_content_processed = html_content; } else { - - Eina_List *l = NULL; - char *recv = NULL; - Eina_List *inline_list = NULL; - - EINA_LIST_FOREACH(ugd->listOfImageUrls, l, recv) { - debug_log("images_list: %s", recv); - if (strncmp(recv, "file://", 7) == 0) { /* add only local images(file://), not web images(http://) */ - debug_log("image = %s", recv + 7); - inline_list = eina_list_append(inline_list, recv + 7); - } - } - if (inline_list != NULL) { - if (!email_composer_change_image_paths_to_relative(html_content, &html_content_processed)) { - debug_log("email_composer_change_image_paths_to_relative Failed"); - g_free(html_content); - html_content = NULL; - return COMPOSER_ERROR_MAKE_MAIL_FAIL; - } - debug_log("\nhtml_source_processed:\n%s", html_content_processed); - - _composer_attachment_create_list(ugd, inline_list, EINA_TRUE); - + if (!email_composer_change_image_paths_to_relative(html_content, &html_content_processed)) { + debug_log("email_composer_change_image_paths_to_relative Failed"); g_free(html_content); html_content = NULL; - } else { - html_content_processed = html_content; + return COMPOSER_ERROR_MAKE_MAIL_FAIL; } + debug_log("\nhtml_source_processed:\n%s", html_content_processed); + + g_free(html_content); + html_content = NULL; } if (EINA_FALSE == email_composer_save_file(ugd->saved_html_path, html_content_processed, strlen(html_content_processed))) { @@ -737,7 +718,7 @@ int _composer_make_mail(EmailComposerUGD *ugd, Eina_Bool b_save_to_draft) int nAttachmentObjListCount = eina_list_count(ugd->attachment_item_obj_list); debug_log("nAttachmentObjListCount : %d", nAttachmentObjListCount); - if (nAttachmentObjListCount > 0) { + if ((nAttachmentObjListCount > 0) || (ugd->inline_cnt > 0)) { if (ugd->new_mail_info->attachment_list) { email_free_attachment_data(&ugd->new_mail_info->attachment_list, ugd->new_mail_info->mail_data->attachment_count); @@ -782,6 +763,32 @@ int _composer_make_mail(EmailComposerUGD *ugd, Eina_Bool b_save_to_draft) } } } + + it = eina_list_iterator_new(ugd->attachment_inline_item_list); + + ugd->new_mail_info->mail_data->attachment_count += ugd->inline_cnt; + + while (eina_iterator_next(it, (void **)&attachment_data)) { + if (attachment_data) { + if (attachment_data->save_status == 1) { + ugd->new_mail_info->attachment_list[nCount].inline_content_status = attachment_data->inline_content_status; + ugd->new_mail_info->attachment_list[nCount].attachment_id = attachment_data->attachment_id; + ugd->new_mail_info->attachment_list[nCount].attachment_size = attachment_data->attachment_size; + ugd->new_mail_info->attachment_list[nCount].save_status = attachment_data->save_status; + ugd->new_mail_info->attachment_list[nCount].attachment_name = COMPOSER_STRDUP(attachment_data->attachment_name); + ugd->new_mail_info->attachment_list[nCount].attachment_path = COMPOSER_STRDUP(attachment_data->attachment_path); + + debug_log("attachment_name : %s", ugd->new_mail_info->attachment_list[nCount].attachment_name); + debug_log("attachment_path : %s", ugd->new_mail_info->attachment_list[nCount].attachment_path); + debug_log("attachment_id : %d", ugd->new_mail_info->attachment_list[nCount].attachment_id); + debug_log("attachment_size : %d", ugd->new_mail_info->attachment_list[nCount].attachment_size); + debug_log("save_status : %d", ugd->new_mail_info->attachment_list[nCount].save_status); + debug_log("inline_content_status : %d", ugd->new_mail_info->attachment_list[nCount].inline_content_status); + + nCount++; + } + } + } } ugd->new_mail_info->mail_data->flags_draft_field = 1; @@ -2939,7 +2946,7 @@ void _composer_add_attachment(EmailComposerUGD *ugd) if (i >= MAX_ATTACHMENT_ITEM) break; - EMAIL_ATTACHMENT_INFO_S *attachment_info = (EMAIL_ATTACHMENT_INFO_S *) calloc(1, sizeof(EMAIL_ATTACHMENT_INFO_S)); + EMAIL_ATTACHMENT_INFO_S *attachment_info = (EMAIL_ATTACHMENT_INFO_S *)calloc(1, sizeof(EMAIL_ATTACHMENT_INFO_S)); email_attachment_data_t *attachment_data = (email_attachment_data_t *)calloc(1, sizeof(email_attachment_data_t)); if (attachment_info) { @@ -2975,7 +2982,7 @@ void _composer_add_attachment(EmailComposerUGD *ugd) nTotalAttachmentSize = nTotalAttachmentSize + attachment_data->attachment_size; } - if (fwd_attachment_data_list[i].save_status && fwd_attachment_data_list[i].inline_content_status == EINA_FALSE) + if (fwd_attachment_data_list[i].inline_content_status == EINA_FALSE) /* No need to add Inline images. They are added in _composer_attachment_create_list API. Line no:160. */ { debug_log("fwd_attachment_data_list[%d] = %x", i, &fwd_attachment_data_list[i]); @@ -2997,11 +3004,11 @@ void _composer_add_attachment(EmailComposerUGD *ugd) } else { attachment_data->attachment_name = COMPOSER_STRDUP(fwd_attachment_data_list[i].attachment_name); attachment_data->attachment_path = COMPOSER_STRDUP(fwd_attachment_data_list[i].attachment_path); - attachment_data->save_status = 1; + attachment_data->save_status = fwd_attachment_data_list[i].save_status; attachment_data->attachment_size = fwd_attachment_data_list[i].attachment_size; } + _composer_attachment_create_list_box(ugd, attachment_data); } - _composer_attachment_create_list_box(ugd, attachment_data); } if (ugd->existing_mail_info->mail_data->file_path_html) { diff --git a/composer/src/email-composer.c b/composer/src/email-composer.c index 10673d4..31bc1fa 100755 --- a/composer/src/email-composer.c +++ b/composer/src/email-composer.c @@ -498,6 +498,7 @@ static void on_event(ui_gadget_h ug, enum ug_event event, service_h data, void * snprintf(recp_string, sizeof(recp_string), "%s%s", _("IDS_EMAIL_BODY_FROM"), ":"); elm_object_text_set(ugd->from_mbe, recp_string); } + return; case UG_EVENT_REGION_CHANGE: case UG_EVENT_LOW_MEMORY: case UG_EVENT_LOW_BATTERY: @@ -723,9 +724,9 @@ void _composer_free_initial_email_content(EmailComposerUGD *ugd) g_free(ugd->saved_subject); ugd->saved_subject = NULL; } - if (ugd->listOfImageUrls) { - eina_list_free(ugd->listOfImageUrls); - ugd->listOfImageUrls = NULL; + if (ugd->attachment_inline_item_list) { + eina_list_free(ugd->attachment_inline_item_list); + ugd->attachment_inline_item_list = NULL; } } @@ -934,7 +935,8 @@ static void _composer_init_data(void *data) ugd->is_webview_scrolling = false; ugd->focus_status = COMPOSER_FOCUS_STATUS_NONE; - ugd->listOfImageUrls = NULL; + ugd->inline_cnt = 0; + ugd->attachment_inline_item_list = NULL; ugd->b_load_finished = EINA_FALSE; ugd->need_download = EINA_FALSE; diff --git a/mailbox/src/email-mailbox-item.c b/mailbox/src/email-mailbox-item.c index 55ae18b..0f96a24 100755 --- a/mailbox/src/email-mailbox-item.c +++ b/mailbox/src/email-mailbox-item.c @@ -220,8 +220,8 @@ static Evas_Object *_gl_mailbox_list_content_get(void *data, Evas_Object *obj, c char folder_icon_path[1024] = { 0, }; Evas_Object *ic = elm_icon_add(obj); snprintf(folder_icon_path, sizeof(folder_icon_path), IMGDIR "/U01_icon_folder.png"); - elm_icon_file_set(ic, folder_icon_path, NULL); - elm_icon_resizable_set(ic, 0, 0); + elm_image_file_set(ic, folder_icon_path, NULL); + elm_image_resizable_set(ic, 0, 0); evas_object_image_smooth_scale_set(ic, 0); evas_object_show(ic); diff --git a/mailbox/src/email-mailbox-list.c b/mailbox/src/email-mailbox-list.c index 456afd9..b17c700 100755 --- a/mailbox/src/email-mailbox-list.c +++ b/mailbox/src/email-mailbox-list.c @@ -503,15 +503,15 @@ static void _item_followup_flag_touched_cb(void *data, Evas * evas, Evas_Object { case EMAIL_FLAG_TASK_STATUS_CLEAR: ld->followup_flag = EMAIL_FLAG_TASK_STATUS_ACTIVE; - elm_icon_file_set(ld->flag_ic, IMGDIR "/M02_email_Flag_Active.png", NULL); + elm_image_file_set(ld->flag_ic, IMGDIR "/M02_email_Flag_Active.png", NULL); break; case EMAIL_FLAG_TASK_STATUS_ACTIVE: ld->followup_flag = EMAIL_FLAG_TASK_STATUS_COMPLETE; - elm_icon_file_set(ld->flag_ic, IMGDIR "/M02_email_Flag_Complete.png", NULL); + elm_image_file_set(ld->flag_ic, IMGDIR "/M02_email_Flag_Complete.png", NULL); break; case EMAIL_FLAG_TASK_STATUS_COMPLETE: ld->followup_flag = EMAIL_FLAG_TASK_STATUS_CLEAR; - elm_icon_file_set(ld->flag_ic, IMGDIR "/M02_email_Flag_Clear.png", NULL); + elm_image_file_set(ld->flag_ic, IMGDIR "/M02_email_Flag_Clear.png", NULL); break; default : debug_log("mail item has no followup flag"); @@ -553,22 +553,22 @@ static Evas_Object *_gl_mail_item_content_get(void *data, Evas_Object *obj, cons } else if(!g_strcmp0(source, "elm.icon.2")){ if(ld->priority == EMAIL_OPTION_PRIORITY_HIGH) { icon = elm_icon_add(obj); - elm_icon_file_set(icon, IMGDIR "/M02_email_icon_priority.png", NULL); - elm_icon_resizable_set(icon, 0, 0); + elm_image_file_set(icon, IMGDIR "/M02_email_icon_priority.png", NULL); + elm_image_resizable_set(icon, 0, 0); evas_object_image_smooth_scale_set(icon, 0); evas_object_show(icon); return (void *)icon; } else if(ld->reply_flag) { icon = elm_icon_add(obj); - elm_icon_file_set(icon, IMGDIR "/M02_email_icon_reply.png", NULL); - elm_icon_resizable_set(icon, 0, 0); + elm_image_file_set(icon, IMGDIR "/M02_email_icon_reply.png", NULL); + elm_image_resizable_set(icon, 0, 0); evas_object_image_smooth_scale_set(icon, 0); evas_object_show(icon); return (void *)icon; } else if (ld->forward_flag) { icon = elm_icon_add(obj); - elm_icon_file_set(icon, IMGDIR "/M02_email_icon_forward.png", NULL); - elm_icon_resizable_set(icon, 0, 0); + elm_image_file_set(icon, IMGDIR "/M02_email_icon_forward.png", NULL); + elm_image_resizable_set(icon, 0, 0); evas_object_image_smooth_scale_set(icon, 0); evas_object_show(icon); return (void *)icon; @@ -593,7 +593,7 @@ static Evas_Object *_gl_mail_item_content_get(void *data, Evas_Object *obj, cons if(ld->is_attachment == true) { icon = elm_icon_add(obj); - elm_icon_file_set(icon, IMGDIR "/M02_email_icon_attach.png", NULL); + elm_image_file_set(icon, IMGDIR "/M02_email_icon_attach.png", NULL); evas_object_size_hint_min_set(icon, 35, 35); evas_object_show(icon); elm_box_pack_start(box, icon); @@ -693,8 +693,8 @@ static Evas_Object *_gl_mail_item_content_get(void *data, Evas_Object *obj, cons { if(ld->priority == EMAIL_OPTION_PRIORITY_HIGH) { Evas_Object *ic = elm_icon_add(obj); - elm_icon_file_set(ic, IMGDIR "/M02_email_icon_priority.png", NULL); - elm_icon_resizable_set(ic, 0, 0); + elm_image_file_set(ic, IMGDIR "/M02_email_icon_priority.png", NULL); + elm_image_resizable_set(ic, 0, 0); evas_object_image_smooth_scale_set(ic, 0); evas_object_show(ic); return (void *)ic; @@ -703,8 +703,8 @@ static Evas_Object *_gl_mail_item_content_get(void *data, Evas_Object *obj, cons if(ld->item) edje_object_signal_emit((Evas_Object *)elm_genlist_item_object_get(ld->item), "elm,state,priority", "elm"); Evas_Object *ic = elm_icon_add(obj); - elm_icon_file_set(ic, IMGDIR "/M02_email_icon_priority.png", NULL); - elm_icon_resizable_set(ic, 0, 0); + elm_image_file_set(ic, IMGDIR "/M02_email_icon_priority.png", NULL); + elm_image_resizable_set(ic, 0, 0); evas_object_image_smooth_scale_set(ic, 0); evas_object_show(ic); return (void *)ic; @@ -2595,7 +2595,7 @@ void _make_account_mail_list(void *data) } break; } - elm_icon_file_set(mailbox_ugd->sp_icon, ICON_TITLE_ALL_ACC, NULL); + elm_image_file_set(mailbox_ugd->sp_icon, ICON_TITLE_ALL_ACC, NULL); elm_object_part_text_set(mailbox_ugd->navi_title_ly, "txt_sub", _("IDS_EMAIL_HEADER_ALL_ACCOUNTS")); } else { @@ -2609,13 +2609,13 @@ void _make_account_mail_list(void *data) int err = 0; err = email_get_account(mailbox_ugd->account_id, EMAIL_ACC_GET_OPT_DEFAULT, &account); if (err == EMAIL_ERROR_NONE) { - elm_icon_file_set(mailbox_ugd->sp_icon, account->logo_icon_path, NULL); + elm_image_file_set(mailbox_ugd->sp_icon, account->logo_icon_path, NULL); } elm_object_part_text_set(mailbox_ugd->navi_title_ly, "txt_sub", mailbox_ugd->user_email); if (account) { - elm_icon_file_set(mailbox_ugd->sp_icon, account->logo_icon_path, NULL); + elm_image_file_set(mailbox_ugd->sp_icon, account->logo_icon_path, NULL); email_free_account(&account, 1); } } diff --git a/mailbox/src/email-mailbox-search.c b/mailbox/src/email-mailbox-search.c index 03cba67..266180b 100755 --- a/mailbox/src/email-mailbox-search.c +++ b/mailbox/src/email-mailbox-search.c @@ -101,8 +101,8 @@ void mailbox_create_searchbar(EmailMailboxUGD *mailbox_ugd) //searchbar category button mailbox_ugd->searchby_button = elm_button_add(searchbar_layout); Evas_Object *searchby_icon = elm_icon_add(mailbox_ugd->searchby_button); - elm_icon_file_set(searchby_icon, IMGDIR"/M02_email_icon_popup_all_press.png", NULL); - elm_icon_resizable_set(searchby_icon, 0, 0); + elm_image_file_set(searchby_icon, IMGDIR"/M02_email_icon_popup_all_press.png", NULL); + elm_image_resizable_set(searchby_icon, 0, 0); evas_object_image_smooth_scale_set(searchby_icon, 0); elm_object_content_set(mailbox_ugd->searchby_button, searchby_icon); evas_object_smart_callback_add(mailbox_ugd->searchby_button, "clicked", _searchby_clicked_cb, mailbox_ugd); @@ -188,15 +188,15 @@ static void _searchby_clicked_cb(void *data, Evas_Object *obj, void *event_info) Evas_Object* icon; icon = elm_icon_add(mailbox_ugd->searchby_ctx_popup); - elm_icon_file_set(icon, IMGDIR "/M02_email_icon_popup_all.png", NULL); + elm_image_file_set(icon, IMGDIR "/M02_email_icon_popup_all.png", NULL); elm_ctxpopup_item_append(mailbox_ugd->searchby_ctx_popup, dgettext("sys_string", "IDS_COM_BODY_ALL"), icon, _searchby_ctxpopup_cb, mailbox_ugd); icon = elm_icon_add(mailbox_ugd->searchby_ctx_popup); - elm_icon_file_set(icon, IMGDIR "/M02_email_icon_popup_title.png", NULL); + elm_image_file_set(icon, IMGDIR "/M02_email_icon_popup_title.png", NULL); elm_ctxpopup_item_append(mailbox_ugd->searchby_ctx_popup, dgettext("sys_string", "IDS_COM_BODY_DETAILS_TITLE"), icon, _searchby_ctxpopup_cb, mailbox_ugd); icon = elm_icon_add(mailbox_ugd->searchby_ctx_popup); - elm_icon_file_set(icon, IMGDIR "/M02_email_icon_popup_sender.png", NULL); + elm_image_file_set(icon, IMGDIR "/M02_email_icon_popup_sender.png", NULL); if ((mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_SENTBOX) || (mailbox_ugd->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) @@ -207,11 +207,11 @@ static void _searchby_clicked_cb(void *data, Evas_Object *obj, void *event_info) } icon = elm_icon_add(mailbox_ugd->searchby_ctx_popup); - elm_icon_file_set(icon, IMGDIR "/M02_email_icon_popup_date.png", NULL); + elm_image_file_set(icon, IMGDIR "/M02_email_icon_popup_date.png", NULL); elm_ctxpopup_item_append(mailbox_ugd->searchby_ctx_popup, _("IDS_EMAIL_OPT_DATE"), icon, _searchby_ctxpopup_cb, mailbox_ugd); icon = elm_icon_add(mailbox_ugd->searchby_ctx_popup); - elm_icon_file_set(icon, IMGDIR "/M02_email_icon_popup_advanced.png", NULL); + elm_image_file_set(icon, IMGDIR "/M02_email_icon_popup_advanced.png", NULL); elm_ctxpopup_item_append(mailbox_ugd->searchby_ctx_popup, _("IDS_EMAIL_OPT_ADVANCED"), icon, _searchby_ctxpopup_cb, mailbox_ugd); _move_searchby_ctxpopup(mailbox_ugd->searchby_ctx_popup, obj); @@ -282,26 +282,26 @@ static void _searchby_ctxpopup_cb(void *data, Evas_Object *obj, void *event_info if (search_type == EMAIL_SEARCH_ALL) // All { - elm_icon_file_set(searchby_icon, IMGDIR"/M02_email_icon_popup_all_press.png", NULL); + elm_image_file_set(searchby_icon, IMGDIR"/M02_email_icon_popup_all_press.png", NULL); } else if (search_type == EMAIL_SEARCH_SUBJECT) // SUBJECT { - elm_icon_file_set(searchby_icon, IMGDIR"/M02_email_icon_popup_title_press.png", NULL); + elm_image_file_set(searchby_icon, IMGDIR"/M02_email_icon_popup_title_press.png", NULL); } else if (search_type == EMAIL_SEARCH_FROM || search_type == EMAIL_SEARCH_TO) // FROM or Recipient(TO) { - elm_icon_file_set(searchby_icon, IMGDIR"/M02_email_icon_popup_sender_press.png", NULL); + elm_image_file_set(searchby_icon, IMGDIR"/M02_email_icon_popup_sender_press.png", NULL); } else if (search_type == EMAIL_SEARCH_DATE) // Date { - elm_icon_file_set(searchby_icon, IMGDIR"/M02_email_icon_popup_date_press.png", NULL); + elm_image_file_set(searchby_icon, IMGDIR"/M02_email_icon_popup_date_press.png", NULL); } else if (search_type == EMAIL_SEARCH_ADVANCED) // Advanced { - elm_icon_file_set(searchby_icon, IMGDIR"/M02_email_icon_popup_advanced_press.png", NULL); + elm_image_file_set(searchby_icon, IMGDIR"/M02_email_icon_popup_advanced_press.png", NULL); } - elm_icon_resizable_set(searchby_icon, 0, 0); + elm_image_resizable_set(searchby_icon, 0, 0); evas_object_image_smooth_scale_set(searchby_icon, 0); elm_object_content_set(mailbox_ugd->searchby_button, searchby_icon); diff --git a/mailbox/src/email-mailbox.c b/mailbox/src/email-mailbox.c index 4acd2e7..99ad77b 100755 --- a/mailbox/src/email-mailbox.c +++ b/mailbox/src/email-mailbox.c @@ -1111,7 +1111,7 @@ void destroy_account_cb(ui_gadget_h ug, void *priv) if (oh_opened) { - elm_icon_file_set(mailbox_ugd->title_arrow, ICON_CLOSE, NULL); + elm_image_file_set(mailbox_ugd->title_arrow, ICON_CLOSE, NULL); elm_object_item_data_set(nf_it, (void *) (!oh_opened)); } @@ -1551,8 +1551,8 @@ static void _create_view(EmailMailboxUGD *mailbox_ugd) mailbox_ugd->folder_button = elm_button_add(mailbox_ugd->navi_bar); elm_object_style_set(mailbox_ugd->folder_button, "naviframe/title_icon"); Evas_Object *folder_icon = elm_icon_add(mailbox_ugd->folder_button); - elm_icon_file_set(folder_icon, ICON_FOLDERS, NULL); - elm_icon_resizable_set(folder_icon, 1, 1); + elm_image_file_set(folder_icon, ICON_FOLDERS, NULL); + elm_image_resizable_set(folder_icon, 1, 1); evas_object_image_smooth_scale_set(folder_icon, 0); elm_object_content_set(mailbox_ugd->folder_button, folder_icon); evas_object_smart_callback_add(mailbox_ugd->folder_button, "clicked", _folder_cb, mailbox_ugd); @@ -1562,8 +1562,8 @@ static void _create_view(EmailMailboxUGD *mailbox_ugd) mailbox_ugd->update_button = elm_button_add(mailbox_ugd->navi_bar); elm_object_style_set(mailbox_ugd->update_button, "naviframe/title_icon"); Evas_Object *update_icon = elm_icon_add(mailbox_ugd->update_button); - elm_icon_file_set(update_icon, ICON_UPDATE, NULL); - elm_icon_resizable_set(update_icon, 1, 1); + elm_image_file_set(update_icon, ICON_UPDATE, NULL); + elm_image_resizable_set(update_icon, 1, 1); evas_object_image_smooth_scale_set(update_icon, 0); elm_object_content_set(mailbox_ugd->update_button, update_icon); evas_object_smart_callback_add(mailbox_ugd->update_button, "clicked", _update_toolbar_clicked_cb, mailbox_ugd); @@ -1587,13 +1587,13 @@ static void _create_view(EmailMailboxUGD *mailbox_ugd) mailbox_ugd->sp_icon = elm_icon_add(mailbox_ugd->navi_title_ly); evas_object_show(mailbox_ugd->sp_icon); elm_object_part_content_set(mailbox_ugd->navi_title_ly, "sub_left_icon", mailbox_ugd->sp_icon); - elm_icon_file_set(mailbox_ugd->sp_icon, ICON_TITLE_ALL_ACC, NULL); + elm_image_file_set(mailbox_ugd->sp_icon, ICON_TITLE_ALL_ACC, NULL); // add expand/collapse icon mailbox_ugd->title_arrow = elm_icon_add(mailbox_ugd->navi_title_ly); evas_object_show(mailbox_ugd->title_arrow); elm_object_part_content_set(mailbox_ugd->navi_title_ly, "sub_right_icon", mailbox_ugd->title_arrow); - elm_icon_file_set(mailbox_ugd->title_arrow, ICON_CLOSE, NULL); + elm_image_file_set(mailbox_ugd->title_arrow, ICON_CLOSE, NULL); _create_controlbar(mailbox_ugd); @@ -1612,7 +1612,7 @@ static void _title_clicked_cb(void *data, Evas_Object *obj, const char *emission if (oh_opened) { - elm_icon_file_set(mailbox_ugd->title_arrow, ICON_CLOSE, NULL); + elm_image_file_set(mailbox_ugd->title_arrow, ICON_CLOSE, NULL); destroy_account_cb(mailbox_ugd->ug_account, mailbox_ugd); elm_object_item_data_set(nf_it, (void *) (!oh_opened)); } @@ -1620,7 +1620,7 @@ static void _title_clicked_cb(void *data, Evas_Object *obj, const char *emission { if (mailbox_ugd->view_type != EMAIL_VIEW_EDIT && mailbox_ugd->view_type != EMAIL_VIEW_SEARCH) { - elm_icon_file_set(mailbox_ugd->title_arrow, ICON_OPEN, NULL); + elm_image_file_set(mailbox_ugd->title_arrow, ICON_OPEN, NULL); _account_cb(data, obj, NULL); elm_object_item_data_set(nf_it, (void *) (!oh_opened)); } @@ -1997,7 +1997,7 @@ void _update_navigationbar_title(EmailMailboxUGD *mailbox_ugd) if (mailbox_ugd->mode == EMAIL_MAILBOX_MODE_ALL) { - elm_icon_file_set(mailbox_ugd->sp_icon, ICON_TITLE_ALL_ACC, NULL); + elm_image_file_set(mailbox_ugd->sp_icon, ICON_TITLE_ALL_ACC, NULL); switch(mailbox_ugd->mailbox_type) { @@ -2066,7 +2066,7 @@ void _update_navigationbar_title(EmailMailboxUGD *mailbox_ugd) email_account_t *account; email_get_account(mailbox_ugd->account_id, 0, &account); if (account) { - elm_icon_file_set(mailbox_ugd->sp_icon, account->logo_icon_path, NULL); + elm_image_file_set(mailbox_ugd->sp_icon, account->logo_icon_path, NULL); email_free_account(&account, 1); } } diff --git a/packaging/org.tizen.email.spec b/packaging/org.tizen.email.spec index 58385a3..12b950e 100755 --- a/packaging/org.tizen.email.spec +++ b/packaging/org.tizen.email.spec @@ -1,6 +1,6 @@ Name: org.tizen.email Summary: Native email application -Version: 0.0.13 +Version: 0.0.14 Release: 1 Group: devel License: Flora diff --git a/viewer/src/email-viewer.c b/viewer/src/email-viewer.c index 05349f2..85cb7ce 100755 --- a/viewer/src/email-viewer.c +++ b/viewer/src/email-viewer.c @@ -3554,8 +3554,44 @@ static Eina_Bool _save_email_prog_cb(void *data) debug_log("email_get_attachment_data_list - err (%d)", err); if (err == EMAIL_ERROR_NONE) { + if (!email_check_dir_exist(DIR_DEFAULT_MEDIA_PHONE"/Saved Email")) { + int nErr = -1; + nErr = mkdir(DIR_DEFAULT_MEDIA_PHONE"/Saved Email", 0755); + debug_log("errno: %d", nErr); + if (nErr == -1) { + debug_log("Eml file folder creation failed"); + return -1; + } + } else + debug_log("Eml file folder already exists."); + + char *subject = elm_entry_utf8_to_markup(ug_data->property->subject); + if (!g_strcmp0(subject, "")) { + g_free(subject); + subject = g_strdup(_("IDS_EMAIL_BODY_NO_SUBJECT")); + } + + tzset(); /* MUST BE. */ + + time_t now_time = time(NULL); + + struct tm *dummy = localtime(&now_time); + struct tm now_tm; + memcpy(&now_tm, dummy, sizeof(struct tm)); + + char date[9] = { 0, }; + if (now_tm.tm_mon + 1 < 10 && now_tm.tm_mday < 10) + snprintf(date, sizeof(date), "%d0%d0%d", now_tm.tm_year + 1900, now_tm.tm_mon + 1, now_tm.tm_mday); + else if (now_tm.tm_mon + 1 < 10 && now_tm.tm_mday >= 10) + snprintf(date, sizeof(date), "%d0%d%d", now_tm.tm_year + 1900, now_tm.tm_mon + 1, now_tm.tm_mday); + else if (now_tm.tm_mon + 1 >= 10 && now_tm.tm_mday < 10) + snprintf(date, sizeof(date), "%d%d0%d", now_tm.tm_year + 1900, now_tm.tm_mon + 1, now_tm.tm_mday); + else + snprintf(date, sizeof(date), "%d%d%d", now_tm.tm_year + 1900, now_tm.tm_mon + 1, now_tm.tm_mday); + debug_log("date(%s)", date); + char file_name[MAX_PATH_LEN] = { 0, }; - snprintf(file_name, sizeof(file_name), "%s_%d_%d.%s", DIR_DEFAULT_MEDIA_PHONE"/Downloads/email", ug_data->account_id, ug_data->mail_id, "eml"); + snprintf(file_name, sizeof(file_name), "%s/%s_%d_%d_%s.%s", DIR_DEFAULT_MEDIA_PHONE"/Saved Email", subject, ug_data->account_id, ug_data->mail_id, date, "eml"); char *output_file_path = g_strdup(file_name); debug_log("output_file_path(%s)", file_name, output_file_path); @@ -3563,6 +3599,7 @@ static Eina_Bool _save_email_prog_cb(void *data) debug_log("email_write_mime_file - err(%d)", err); g_free(output_file_path); + g_free(subject); } if (mail_t) { @@ -3603,7 +3640,7 @@ static Eina_Bool _save_email_prog_cb(void *data) static void _ctxpopup_detail_contact_cb(void *data, Evas_Object *obj, void *event_info) { - debug_log(""); + debug_log("data(%s)", data); if (data == NULL || _g_ug_data == NULL) { debug_log("data is NULL"); return; -- 2.7.4