Appiled the latest codes
authorjc47.park <jc47.park@samsung.com>
Mon, 31 Dec 2012 01:35:50 +0000 (10:35 +0900)
committerjc47.park <jc47.park@samsung.com>
Mon, 31 Dec 2012 01:35:50 +0000 (10:35 +0900)
common/include/email-common-types.h
composer/include/email-composer-js.h
composer/include/email-composer-util.h
composer/include/email-composer.h
composer/src/email-composer-callback.c
composer/src/email-composer-contents.c
composer/src/email-composer-util.c
composer/src/email-composer.c
viewer/include/email-viewer.h
viewer/src/email-viewer-webview.c
viewer/src/email-viewer.c

index 9f34fda..2963a30 100755 (executable)
@@ -37,6 +37,8 @@
 #define EMAIL_BUNDLE_KEY_MAILBOX                       "MAILBOX_ID"
 #define EMAIL_BUNDLE_KEY_MAILBOX_ALIAS         "MAILBOX_ALIAS"
 #define EMAIL_BUNDLE_KEY_USER_EMAIL            "USER_EMAIL"
+#define EMAIL_BUNDLE_KEY_UPDATE                        "UPDATE"
+#define EMAIL_BUNDLE_KEY_CANCEL_ALL                    "CANCEL_ALL"
 #define EMAIL_BUNDLE_KEY_VIEW_TYPE                     "VIEW_TYPE"
 #define EMAIL_BUNDLE_KEY_RUN_TYPE                      "RUN_TYPE"
 #define EMAIL_BUNDLE_KEY_MAIL_ID                       "MAIL_ID"
index 6e31e42..9de5fb0 100755 (executable)
        "};" \
        "getHtmlContent();"
 
+#define COMPOSER_JS_GET_LATEST_HTML_CONTENT \
+       "function getHtmlOriginalContent() { " \
+               "console.log(\"Here getHtmlOriginalContent()\");" \
+               "var element = document.getElementById(\"origin_content\");" \
+               "console.log(\"element.innerHTML : \" + element.innerHTML);" \
+               "return element.innerHTML;" \
+       "};" \
+       "getHtmlOriginalContent();"
+
+#define COMPOSER_JS_GET_LATEST_INFO_CONTENT \
+       "function getHtmlOriginalInfo() { " \
+               "console.log(\"Here getHtmlOriginalInfo()\");" \
+               "var element = document.getElementById(\"origin_info\");" \
+               "console.log(\"element.innerHTML : \" + element.innerHTML);" \
+               "return element.innerHTML;" \
+       "};" \
+       "getHtmlOriginalInfo();"
+
 #define COMPOSER_JS_GET_IMAGE_LIST \
        "function getImgs() { " \
                "var imgs = document.getElementsByTagName(\"img\");" \
index 64246b8..246398c 100755 (executable)
@@ -70,6 +70,7 @@ void _composer_add_bcc_address(EmailComposerUGD *ugd);
 void _composer_add_from_address(EmailComposerUGD *ugd);
 void _composer_add_subject(EmailComposerUGD *ugd);
 void _composer_add_body(EmailComposerUGD *ugd);
+char *_composer_make_text_with_div_tag(char *origin_text, int div_tag);
 void _composer_add_origin_msg(EmailComposerUGD *ugd);
 void _composer_make_body_text(EmailComposerUGD *ugd);
 void _composer_add_attachment(EmailComposerUGD *ugd);
@@ -89,6 +90,7 @@ void _composer_show_download_attachment_popup(EmailComposerUGD *ugd);
 Eina_Bool _composer_show_progress_popup(void *data);
 void _composer_download_attachment(EmailComposerUGD *ugd);
 void _composer_update_attachment_info(EmailComposerUGD *ugd, int index);
+void _composer_attachment_cancel_download(EmailComposerUGD *ugd);
 void _composer_cancel_download_attachment(EmailComposerUGD *ugd);
 
 Evas_Object *_composer_create_noti_with_list(EmailComposerUGD *ugd, bool use_win, char *title, char *content,
@@ -102,6 +104,7 @@ void _composer_noti_response_cb(void *data, Evas_Object *obj, void *event_info);
 Evas_Object *_composer_create_popup(EmailComposerUGD *ugd, bool use_win, char *title, char *content,
                                                                                        int btn_num, char *btn1_lb, char *btn2_lb, char *btn3_lb,
                                                                                        double timeout, void (*response_cb) (void *data, Evas_Object *obj, void *event_info));
+void _composer_save_draft_mail(EmailComposerUGD * ugd);
 void _composer_save_popup_response_cb(void *data, Evas_Object *obj, void *event_info);
 void _composer_popup_response_cb(void *data, Evas_Object *obj, void *event_info);
 char *_composer_get_service_fail_type(int type);
index 2a94117..4abd15e 100755 (executable)
@@ -177,9 +177,11 @@ struct ug_data {
 
        Eina_Bool has_body_html;
        char *saved_html_path;
-       char *saved_html_content;
+       char *latest_info_content;
        char *latest_html_content;
        char *plain_content;
+       char *original_info_content;
+       char *original_html_content;
 
        int to_recipients_cnt;
        int cc_recipients_cnt;
@@ -206,6 +208,7 @@ struct ug_data {
        email_address_info_list_t *addrs_info_list;
 
        GList *fw_attachment_list;
+       int fw_attach_cnt;
        int fw_dn_cnt;
        int fw_dn_total_cnt;
        int fw_dn_idx;
index 53fe7eb..4627723 100755 (executable)
@@ -56,9 +56,8 @@ static void _composer_myemail_gl_sel(void *data, Evas_Object *obj, void *event_i
 
 static Eina_Bool _composer_cc_mbe_set_focus(void *data);
 Eina_Bool _composer_get_html_content_for_draft_cb(void *data);
-static void _composer_send_clicked_cb(Evas_Object *o, const char *result, void *data);
 static void _composer_plain_text_get_cb(Evas_Object *o, const char *plain_text, void *user_data);
-static void _composer_save_to_draft_cb(Evas_Object *o, const char *plain_text, void *user_data);
+static void _composer_get_latest_info_content_cb(Evas_Object *o, const char *result, void *data);
 static void _composer_get_latest_html_content_cb(Evas_Object *o, const char *result, void *data);
 
 void _composer_edit_field_changed_cb(void *data, Evas_Object *obj, void *event_info)
@@ -187,7 +186,13 @@ void _composer_back_button_cb(void *data, Evas_Object *obj, void *event_info)
 
        EmailComposerUGD *ugd = (EmailComposerUGD *)data;
 
-       elm_object_disabled_set(ugd->cancel_btn, EINA_TRUE); // It prevents clicking the cancel button several times
+       elm_object_tree_focus_allow_set(ugd->c_layout, EINA_FALSE); // block the focus not to open IME.
+
+       if (EINA_FALSE == ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_GET_LATEST_INFO_CONTENT, _composer_get_latest_info_content_cb, (void *)ugd))
+               debug_log("COMPOSER_JS_GET_LATEST_INFO_CONTENT failed.");
+
+       if (EINA_FALSE == ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_GET_LATEST_HTML_CONTENT, _composer_get_latest_html_content_cb, (void *)ugd))
+               debug_log("COMPOSER_JS_GET_LATEST_HTML_CONTENT failed.");
 
        ugd->bringin_timer = ecore_timer_add(0.5, _composer_get_html_content_for_draft_cb, ugd);
 
@@ -2184,47 +2189,17 @@ static void _composer_cbar_save_as_draft_cb(Evas_Object *o, const char *result,
                if (ret)
                        debug_log("status_message_post failed: %d", ret);
 
-               _composer_mbe_set_focus(ugd);
+               elm_object_tree_focus_allow_set(ugd->c_layout, EINA_TRUE); // block the focus not to open IME.
+               _composer_webkit_set_body_script(ugd);
+               if (ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_ENABLE_EDITABLE, _composer_script_executed_cb, ugd) == EINA_FALSE)
+                       debug_log("COMPOSER_JS_ENABLE_EDITABLE failed.");
                return;
        }
 
-       int ret = _composer_add_mailbox_folder(ugd, EMAIL_MAILBOX_TYPE_DRAFT, EINA_TRUE);
-
-       if (ret < COMPOSER_ERROR_NONE) {
-               debug_log("Failed save in Drafts(%d)", ret);
-
-               if (ugd->popup_list) {
-                       debug_log("popup count = %d", eina_list_count(ugd->popup_list));
-                       debug_log("obj: %p", o);
-                       debug_log("composer_noti: %p", ugd->composer_noti);
-
-                       ugd->popup_list = eina_list_remove(ugd->popup_list, ugd->composer_noti/*obj*/);
-               }
-
-               evas_object_del(ugd->composer_noti);
-               ugd->composer_noti = NULL;
-
-               ugd->idler_save_draft = ecore_idler_add(_composer_show_fail_to_save, ugd);
+       if (ugd->need_download == EINA_TRUE) {
+               _composer_download_attachment(ugd);
        } else {
-               debug_log("Succeed in saving in Drafts");
-
-               debug_log("composer_type:%d", ugd->composer_type);
-               if (ugd->composer_type == RUN_COMPOSER_EDIT) {
-                       //After a new draft mail is added, the old draft mail is deleted and synced to server
-                       debug_log("Account id [%d] mailbox id [%d] mail id [%d]", ugd->account_info->account->account_id, ugd->mailbox_info->mailbox_id, ugd->nExistingMailID);
-
-                       if (!email_engine_delete_mail(ugd->account_info->account->account_id, ugd->mailbox_info->mailbox_id, ugd->nExistingMailID, EMAIL_DELETE_LOCAL_AND_SERVER)) {
-                               debug_log("Deleting email is failed.");
-                       }
-               }
-
-               char str[128] = { 0, };
-               snprintf(str, sizeof(str), "%s", _("IDS_EMAIL_POP_SAVED_IN_DRAFTS"));
-               int ret = status_message_post(str);
-               if (ret)
-                       debug_log("status_message_post failed: %d", ret);
-
-               ug_destroy_me(ugd->ug_main);
+               _composer_save_draft_mail(ugd);
        }
 }
 
@@ -2244,8 +2219,20 @@ void _composer_cbar_save_as_draft_clicked(void *data, Evas_Object *obj, void *ev
                ugd->context_popup = NULL;
        }
 
-       if (EINA_FALSE == ewk_view_plain_text_get(ugd->body_ewkview, _composer_save_to_draft_cb, (void *)ugd))
+       if (EINA_FALSE == ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_GET_LATEST_INFO_CONTENT, _composer_get_latest_info_content_cb, (void *)ugd))
+               debug_log("COMPOSER_JS_GET_ORIGINAL_INFO_CONTENT failed.");
+
+       if (EINA_FALSE == ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_GET_LATEST_HTML_CONTENT, _composer_get_latest_html_content_cb, (void *)ugd))
+               debug_log("COMPOSER_JS_GET_ORIGINAL_HTML_CONTENT failed.");
+
+       if (EINA_FALSE == ewk_view_plain_text_get(ugd->body_ewkview, _composer_plain_text_get_cb, (void *)ugd))
                debug_log("ewk_view_plain_text_get 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.");
+
+       if (EINA_FALSE == ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_GET_LATEST_HTML_CONTENT, _composer_cbar_save_as_draft_cb, (void *)ugd))
+               debug_log("COMPOSER_JS_GET_HTML_CONTENT failed.");
 }
 
 static void _composer_priority_radio_cb(void *data, Evas_Object *obj, void *event_info)
@@ -2600,8 +2587,23 @@ void _composer_cbar_send_clicked(void *data, Evas_Object *obj, void *event_info)
        debug_log("Send Button Clicked");
        elm_object_tree_focus_allow_set(ugd->c_layout, EINA_FALSE); // block the focus not to open IME.
 
-       if (EINA_FALSE == ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_DISABLE_EDITABLE, _composer_send_clicked_cb, (void *)ugd))
-               debug_log("COMPOSER_JS_DISABLE_EDITABLE error");
+       if (ugd->fw_attach_cnt > 0) {
+               if (ugd->fw_attach_cnt != g_list_length(ugd->fw_attachment_list)) {
+                       if (ugd->account_info->account_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC) {
+                               ugd->need_download = EINA_TRUE;
+                       }
+               } else {
+                       if (ugd->account_info->account_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC) {
+                               ugd->need_download = EINA_FALSE;
+                       }
+               }
+       }
+
+       if (EINA_FALSE == ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_GET_LATEST_INFO_CONTENT, _composer_get_latest_info_content_cb, (void *)ugd))
+               debug_log("COMPOSER_JS_GET_ORIGINAL_INFO_CONTENT failed.");
+
+       if (EINA_FALSE == ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_GET_LATEST_HTML_CONTENT, _composer_get_latest_html_content_cb, (void *)ugd))
+               debug_log("COMPOSER_JS_GET_ORIGINAL_HTML_CONTENT failed.");
 
        if (EINA_FALSE == ewk_view_plain_text_get(ugd->body_ewkview, _composer_plain_text_get_cb, (void *)ugd))
                debug_log("ewk_view_plain_text_get Failed");
@@ -2649,6 +2651,11 @@ static Eina_Bool _composer_cc_mbe_set_focus(void *data)
 void _composer_script_executed_cb(Evas_Object *o, const char *result, void *data)
 {
        debug_log("");
+       EmailComposerUGD *ugd = (EmailComposerUGD *)data;
+
+       if (ugd) {
+               _composer_mbe_set_focus(ugd);
+       }
 }
 
 void _composer_focus_script_executed_cb(Evas_Object *o, const char *result, void *data)
@@ -2664,12 +2671,6 @@ Eina_Bool _composer_get_html_content_for_draft_cb(void *data)
 
        elm_object_disabled_set(ugd->cancel_btn, EINA_FALSE); // It prevents clicking the cancel button several times
        elm_object_disabled_set(ugd->cancel_btm_btn, EINA_FALSE);
-
-       if (NULL != ugd->latest_html_content) {
-               g_free(ugd->latest_html_content);
-               ugd->latest_html_content = NULL;
-       }
-
        if (EINA_FALSE == ewk_view_plain_text_get(ugd->body_ewkview, _composer_plain_text_get_cb, (void *)ugd)) {
                debug_log("ewk_view_plain_text_get Failed");
        }
@@ -2735,13 +2736,21 @@ Eina_Bool _composer_get_html_content_for_draft_cb(void *data)
        return ECORE_CALLBACK_CANCEL;
 }
 
-static void _composer_send_clicked_cb(Evas_Object *o, const char *result, void *data)
+void _composer_get_latest_info_content_cb(Evas_Object *o, const char *result, void *data)
 {
        debug_log("");
        EmailComposerUGD *ugd = (EmailComposerUGD *)data;
+       debug_log("result: \n%s", result);
 
-       if (EINA_FALSE == ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_GET_HTML_CONTENT, _composer_get_latest_html_content_cb, (void *)ugd))
-               debug_log("COMPOSER_JS_GET_HTML_CONTENT failed.");
+       if (NULL != ugd->latest_info_content) {
+               g_free(ugd->latest_info_content);
+               ugd->latest_info_content = NULL;
+       }
+
+       if (result != NULL) {
+               ugd->latest_info_content = g_strdup(result);
+               debug_log("ugd->latest_info_content : \n%s", ugd->latest_info_content);
+       }
 }
 
 static void _composer_get_latest_html_content_cb(Evas_Object *o, const char *result, void *data)
@@ -2761,27 +2770,6 @@ static void _composer_get_latest_html_content_cb(Evas_Object *o, const char *res
        }
 }
 
-static void _composer_save_to_draft_cb(Evas_Object *o, const char *plain_text, void *user_data)
-{
-       debug_log("");
-
-       EmailComposerUGD *ugd = (EmailComposerUGD *) user_data;
-
-       if (NULL != ugd->plain_content) {
-               g_free(ugd->plain_content);
-               ugd->plain_content = NULL;
-       }
-
-       ugd->plain_content = g_strdup(plain_text);
-       debug_log("ugd->plain_content => %s", ugd->plain_content);
-
-       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.");
-
-       if (EINA_FALSE == ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_GET_HTML_CONTENT, _composer_cbar_save_as_draft_cb, (void *)ugd))
-               debug_log("COMPOSER_JS_GET_HTML_CONTENT failed.");
-}
-
 static void _composer_plain_text_get_cb(Evas_Object *o, const char *plain_text, void *user_data)
 {
        debug_log("");
index 7f2d2b5..1ef6ece 100755 (executable)
@@ -34,10 +34,11 @@ void _composer_webview_mouse_move_cb(void *data, Evas * evas, Evas_Object *obj,
 void _composer_webview_mouse_up_cb(void *data, Evas * evas, Evas_Object *obj, void *event_info);
 void _composer_webkit_loadFinished_cb(void *data, Evas_Object *obj, void *event_info);
 
+static void _composer_webkit_script_executed_cb(Evas_Object *o, const char *result, void *data);
 static void _composer_webkit_focused_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
 static void _composer_webkit_unfocused_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
-static void _composer_get_html_content_cb(Evas_Object *o, const char *result, void *data);
-
+static void _composer_set_original_html_content_cb(Evas_Object *o, const char *result, void *data);
+static void _composer_set_original_info_content_cb(Evas_Object *o, const char *result, void *data);
 static void _composer_webkit_scroll_up_cb(void *data, Evas_Object *obj, void *event_info);
 static void _composer_webkit_scroll_down_cb(void *data, Evas_Object *obj, void *event_info);
 
@@ -217,11 +218,7 @@ void _composer_webkit_set_body_script(void *data)
        if (ugd == NULL)
                return;
 
-       if (ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_ENABLE_EDITABLE, _composer_script_executed_cb, NULL) == EINA_FALSE)
-               debug_log("COMPOSER_JS_ENABLE_EDITABLE failed.");
-
-       if (ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_GET_HTML_CONTENT, _composer_get_html_content_cb, (void *)ugd) == EINA_FALSE)
-               debug_log("COMPOSER_JS_GET_HTML_CONTENT failed.");
+       _composer_webkit_script_executed_cb(NULL, NULL, ugd);
 }
 
 Evas_Object *_composer_create_body_webview(Evas_Object *parent, char *title, EmailComposerUGD *ugd)
@@ -289,6 +286,18 @@ void _composer_webview_mouse_up_cb(void *data, Evas * evas, Evas_Object *obj, vo
        debug_log("");
 }
 
+static void _composer_webkit_script_executed_cb(Evas_Object *o, const char *result, void *data)
+{
+       debug_log("");
+
+       EmailComposerUGD *ugd = (EmailComposerUGD *)data;
+
+       if (ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_GET_LATEST_HTML_CONTENT, _composer_set_original_html_content_cb, (void *)ugd) == EINA_FALSE)
+               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.");
+}
+
 void _composer_webkit_loadFinished_cb(void *data, Evas_Object *obj, void *event_info)
 {
        debug_log("");
@@ -378,7 +387,6 @@ static void _composer_webkit_unfocused_cb(void *data, Evas *e, Evas_Object *obj,
 
                if (ugd->focus_status == COMPOSER_FOCUS_STATUS_SELECTED) {
                        elm_object_tree_focus_allow_set(ugd->c_layout, EINA_FALSE); // block the focus not to open IME.
-                       ugd->focus_status = COMPOSER_FOCUS_STATUS_NONE;
                }
        }
 }
@@ -423,15 +431,34 @@ void _composer_webview_reach_bottom_cb(void *data, Evas_Object *obj, void *event
        }
 }
 
-static void _composer_get_html_content_cb(Evas_Object *o, const char *result, void *data)
+static void _composer_set_original_html_content_cb(Evas_Object *o, const char *result, void *data)
+{
+       debug_log("");
+
+       EmailComposerUGD *ugd = (EmailComposerUGD *)data;
+
+       if (result != NULL) {
+               ugd->original_html_content = g_strdup(result);
+               debug_log("ugd->original_html_content => \n%s", ugd->original_html_content);
+       }
+
+       if (ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_ENABLE_EDITABLE, _composer_script_executed_cb, NULL) == EINA_FALSE)
+               debug_log("COMPOSER_JS_ENABLE_EDITABLE failed.");
+}
+
+static void _composer_set_original_info_content_cb(Evas_Object *o, const char *result, void *data)
 {
        debug_log("");
 
        EmailComposerUGD *ugd = (EmailComposerUGD *)data;
 
        if (result != NULL) {
-               ugd->saved_html_content = g_strdup(result);
-               debug_log("ugd->saved_html_content => %s", ugd->saved_html_content);
+               if (ugd->original_info_content) {
+                       g_free(ugd->original_info_content);
+                       ugd->original_info_content = NULL;
+               }
+               ugd->original_info_content = g_strdup(result);
+               debug_log("ugd->original_info_content => \n%s", ugd->original_info_content);
        }
 }
 
index 5986679..d356b3f 100755 (executable)
@@ -480,7 +480,13 @@ int _composer_add_mailbox_folder(EmailComposerUGD *ugd, email_mailbox_type_e mai
        debug_log("attachment_list = %x, attachment_count = %d",
                ugd->new_mail_info->attachment_list, ugd->new_mail_info->mail_data->attachment_count);
 
-       nResult = email_add_mail(ugd->new_mail_info->mail_data, ugd->new_mail_info->attachment_list, ugd->new_mail_info->mail_data->attachment_count, NULL, 0);
+
+       if (ugd->composer_type == RUN_COMPOSER_EDIT) {
+               nResult = email_update_mail(ugd->new_mail_info->mail_data, ugd->new_mail_info->attachment_list, ugd->new_mail_info->mail_data->attachment_count, NULL, 0);
+       } else {
+               nResult = email_add_mail(ugd->new_mail_info->mail_data, ugd->new_mail_info->attachment_list, ugd->new_mail_info->mail_data->attachment_count, NULL, 0);
+       }
+
        debug_log("result of email_add_mail: %d", nResult);
        if (nResult != EMAIL_ERROR_NONE) {
                debug_warning("email_add_mail failed! %d", nResult);
@@ -536,6 +542,29 @@ int _composer_move_mailbox_folder(EmailComposerUGD *ugd, email_mailbox_type_e ma
        return COMPOSER_ERROR_NONE;
 }
 
+static void _composer_make_draft_html_content(EmailComposerUGD *ugd, char **html_content, Eina_Bool b_save_to_draft)
+{
+       debug_log("");
+
+       char *latest_info_content = _composer_make_text_with_div_tag(ugd->latest_info_content, 0);
+       char *latest_html_content = _composer_make_text_with_div_tag(ugd->latest_html_content, 1);
+
+       if (b_save_to_draft == EINA_TRUE) {
+               *html_content = g_strconcat(BODY_TAG_START, latest_info_content, latest_html_content, BODY_TAG_END, NULL);
+       } else {
+               *html_content = g_strconcat(BODY_TAG_START, ugd->latest_info_content, ugd->latest_html_content, BODY_TAG_END, HTML_TAG_END, NULL);
+       }
+
+       if (latest_info_content) {
+               g_free(latest_info_content);
+               latest_info_content = NULL;
+       }
+       if (latest_html_content) {
+               g_free(latest_html_content);
+               latest_html_content = NULL;
+       }
+}
+
 int _composer_make_mail(EmailComposerUGD *ugd, Eina_Bool b_save_to_draft)
 {
        debug_log("");
@@ -575,6 +604,11 @@ int _composer_make_mail(EmailComposerUGD *ugd, Eina_Bool b_save_to_draft)
        debug_log("user_name = %s, %s", ugd->account_info->account->user_display_name, account->user_display_name);
        debug_log("email_addr = %s, %s", ugd->account_info->account->user_email_address, account->user_email_address);
 
+       if (ugd->composer_type == RUN_COMPOSER_EDIT) {
+               ugd->new_mail_info->mail_data->body_download_status = 1;
+               ugd->new_mail_info->mail_data->mail_id = ugd->existing_mail_info->mail_data->mail_id;
+       }
+
        char uc[MAX_STR_LEN];
        snprintf(uc, sizeof(uc), "\"%s\"<%s>", account->user_display_name, account->user_email_address);
        ugd->new_mail_info->mail_data->full_address_from = g_strdup(uc);
@@ -626,10 +660,10 @@ int _composer_make_mail(EmailComposerUGD *ugd, Eina_Bool b_save_to_draft)
                char *html_content_processed = NULL;
                char *plain_text_content = NULL;
 
-               html_content = g_strdup(ugd->latest_html_content);
+               _composer_make_draft_html_content(ugd, &html_content, b_save_to_draft);
 
                if (html_content == NULL) {
-                       debug_log("ugd->latest_html_content is null");
+                       debug_log("html_content is NULL.");
                        return COMPOSER_ERROR_MAKE_MAIL_FAIL;
                }
 
@@ -713,7 +747,7 @@ int _composer_make_mail(EmailComposerUGD *ugd, Eina_Bool b_save_to_draft)
 
                ugd->new_mail_info->mail_data->attachment_count = nAttachmentObjListCount;
 
-               debug_log("ugd->new_mail_info->attachment_count : %d", ugd->new_mail_info->mail_data->attachment_count);
+               debug_log("ugd->save_drafts : %d, ugd->new_mail_info->attachment_count : %d", ugd->save_drafts, ugd->new_mail_info->mail_data->attachment_count);
 
                ugd->new_mail_info->attachment_list = (email_attachment_data_t *)calloc(nAttachmentObjListCount, sizeof(email_attachment_data_t));
 
@@ -729,21 +763,23 @@ int _composer_make_mail(EmailComposerUGD *ugd, Eina_Bool b_save_to_draft)
                        attachment_data = evas_object_data_get(attachment_obj, "attachment_data");
 
                        if (attachment_data) {
-                               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++;
+                               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++;
+                               }
                        }
                }
        }
@@ -990,49 +1026,70 @@ int _composer_make_recipient_char_to_list(EmailComposerUGD *ugd, Evas_Object *ob
        return COMPOSER_ERROR_NONE;
 }
 
-void _composer_save_popup_response_cb(void *data, Evas_Object *obj, void *event_info)
+void _composer_save_draft_mail(EmailComposerUGD * ugd)
 {
        debug_log("");
-       if (!data) {
-               debug_log("data is NULL");
+
+       if (!ugd) {
+               debug_log("ugd is NULL");
                return;
        }
 
-       EmailComposerUGD *ugd = (EmailComposerUGD *)data;
+       if (ugd->send_timer) {
+               debug_log("delete send_timer");
+               ecore_timer_del(ugd->send_timer);
+               ugd->send_timer = NULL;
+       }
 
-       char *pszBtnText = (char *)elm_object_text_get(obj);
-       debug_log("selected button text = %s", pszBtnText);
+       int ret = _composer_add_mailbox_folder(ugd, EMAIL_MAILBOX_TYPE_DRAFT, EINA_TRUE);
 
-       if (pszBtnText && strcmp(pszBtnText, dgettext("sys_string", "IDS_COM_SK_YES")) == 0) {
-               int ret = _composer_add_mailbox_folder(ugd, EMAIL_MAILBOX_TYPE_DRAFT, EINA_TRUE);
+       if (ret < COMPOSER_ERROR_NONE) {
+               debug_log("Failed save in Drafts(%d)", ret);
 
-               if (ret < COMPOSER_ERROR_NONE) {
-                       debug_log("Failed save in Drafts(%d)", ret);
+               if (ugd->popup_list) {
+                       debug_log("popup count = %d", eina_list_count(ugd->popup_list));
+                       debug_log("composer_noti: %p", ugd->composer_noti);
 
-                       if (ugd->popup_list) {
-                               debug_log("popup count = %d", eina_list_count(ugd->popup_list));
-                               debug_log("obj: %p", obj);
-                               debug_log("composer_noti: %p", ugd->composer_noti);
+                       ugd->popup_list = eina_list_remove(ugd->popup_list, ugd->composer_noti/*obj*/);
+               }
 
-                               ugd->popup_list = eina_list_remove(ugd->popup_list, ugd->composer_noti/*obj*/);
-                       }
+               evas_object_del(ugd->composer_noti);
+               ugd->composer_noti = NULL;
 
-                       evas_object_del(ugd->composer_noti);
-                       ugd->composer_noti = NULL;
+               ugd->idler_save_draft = ecore_idler_add(_composer_show_fail_to_save, ugd);
+       } else {
+               debug_log("Succeed in saving in Drafts");
+               debug_log("Account id [%d] mailbox id [%d] mail id [%d]", ugd->account_info->account->account_id, ugd->mailbox_info->mailbox_id, ugd->nExistingMailID);
 
-                       ugd->idler_save_draft = ecore_idler_add(_composer_show_fail_to_save, ugd);
-               } else {
-                       debug_log("Succeed in saving in Drafts");
+               if (ugd->popup_list) {
+                       debug_log("popup count = %d", eina_list_count(ugd->popup_list));
+                       debug_log("composer_noti: %p", ugd->composer_noti);
 
-                       if (ugd->composer_type == RUN_COMPOSER_EDIT) {
-                               //After a new draft mail is added, the old draft mail is deleted and synced to server
-                               debug_log("Account id [%d] mailbox id [%d] mail id [%d]", ugd->account_info->account->account_id, ugd->mailbox_info->mailbox_id, ugd->nExistingMailID);
+                       ugd->popup_list = eina_list_remove(ugd->popup_list, ugd->composer_noti/*obj*/);
+               }
 
-                               if (!email_engine_delete_mail(ugd->account_info->account->account_id, ugd->mailbox_info->mailbox_id, ugd->nExistingMailID, EMAIL_DELETE_LOCAL_AND_SERVER)) {
-                                       debug_log("Deleting email is failed.");
-                               }
-                       }
+               evas_object_del(ugd->composer_noti);
+               ugd->composer_noti = NULL;
+
+               ugd->idler_save_draft = ecore_idler_add(_composer_show_success_to_save, ugd);
+       }
+}
+
+void _composer_save_popup_response_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       debug_log("");
+       if (!data) {
+               debug_log("data is NULL");
+               return;
+       }
 
+       EmailComposerUGD *ugd = (EmailComposerUGD *)data;
+
+       char *pszBtnText = (char *)elm_object_text_get(obj);
+       debug_log("selected button text = %s", pszBtnText);
+
+       if (pszBtnText && strcmp(pszBtnText, dgettext("sys_string", "IDS_COM_SK_YES")) == 0) {
+               if (ugd->need_download == EINA_TRUE) {
                        if (ugd->popup_list) {
                                debug_log("popup count = %d", eina_list_count(ugd->popup_list));
                                debug_log("composer_noti: %p", ugd->composer_noti);
@@ -1043,11 +1100,15 @@ void _composer_save_popup_response_cb(void *data, Evas_Object *obj, void *event_
                        evas_object_del(ugd->composer_noti);
                        ugd->composer_noti = NULL;
 
-                       ugd->idler_save_draft = ecore_idler_add(_composer_show_success_to_save, ugd);
+                       _composer_download_attachment(ugd);
+               } else {
+                       _composer_save_draft_mail(ugd);
                }
        } else if (pszBtnText && strcmp(pszBtnText, dgettext("sys_string", "IDS_COM_SK_NO")) == 0) {
                ugd->idler_save_draft = ecore_idler_add(_composer_idler_destroy, ugd);
-       } else {
+       } else if (pszBtnText && strcmp(pszBtnText, dgettext("sys_string", "IDS_COM_SK_CANCEL")) == 0) {
+               if (ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_ENABLE_EDITABLE, _composer_script_executed_cb, NULL) == EINA_FALSE)
+                       debug_log("COMPOSER_JS_ENABLE_EDITABLE failed.");
                _composer_noti_response_cb(data, obj, event_info);
        }
 }
@@ -1330,19 +1391,22 @@ void _composer_set_mail_info(EmailComposerUGD *ugd)
                                        ugd->need_download = EINA_TRUE;
                                        ugd->fw_dn_cnt++;
                                }
+                               ugd->fw_attach_cnt++;
                        }
-                       debug_log("need_download:%d, fw_dn_cnt:%d", ugd->need_download, ugd->fw_dn_cnt);
+                       debug_log("ugd->need_download:%d, fw_dn_cnt:%d, fw_attach_cnt:%d", ugd->need_download, ugd->fw_dn_cnt, ugd->fw_attach_cnt);
                }
        }
 
        _composer_add_attachment(ugd);
 
+       char *plain_charset = NULL;
+       char *charset = NULL;
        if ((EINA_TRUE == ugd->has_body_html) &&
                (ugd->composer_type == RUN_COMPOSER_EDIT || ugd->composer_type == RUN_COMPOSER_REPLY || ugd->composer_type == RUN_COMPOSER_REPLY_ALL || ugd->composer_type == RUN_COMPOSER_FORWARD)) {
                _composer_add_softlink_to_inline_images(ugd);
 
                if (ugd->existing_mail_info->mail_data && ugd->existing_mail_info->mail_data->file_path_plain) {
-                       char *plain_charset = email_parse_get_filename_from_path(ugd->existing_mail_info->mail_data->file_path_plain);
+                       plain_charset = email_parse_get_filename_from_path(ugd->existing_mail_info->mail_data->file_path_plain);
                        debug_log("plain_charset : %s", plain_charset);
                        if (plain_charset) {
                                Ewk_Settings *ewkSetting = ewk_view_settings_get(ugd->body_ewkview);
@@ -1351,11 +1415,10 @@ void _composer_set_mail_info(EmailComposerUGD *ugd)
                                        debug_log("ewkSetting is NULL.");
 
                                ewk_settings_default_encoding_set(ewkSetting, plain_charset);
-                               g_free(plain_charset);
                        }
                } else {
                        if (ugd->existing_mail_info->mail_data && ugd->existing_mail_info->mail_data->file_path_html) {
-                               char *charset = email_parse_get_filename_from_path(ugd->existing_mail_info->mail_data->file_path_html);
+                               charset = email_parse_get_filename_from_path(ugd->existing_mail_info->mail_data->file_path_html);
                                debug_log("body html filename charset:%s", charset);
                                if (charset) {
                                        Ewk_Settings *ewkSetting = ewk_view_settings_get(ugd->body_ewkview);
@@ -1364,7 +1427,6 @@ void _composer_set_mail_info(EmailComposerUGD *ugd)
                                                debug_log("ewkSetting is NULL.");
 
                                        ewk_settings_default_encoding_set(ewkSetting, charset);
-                                       g_free(charset);
                                }
                        }
                }
@@ -1378,6 +1440,10 @@ void _composer_set_mail_info(EmailComposerUGD *ugd)
                debug_log("file_path: (%s)", file_path);
 
                ewk_view_url_set(ugd->body_ewkview, file_path);
+               if (plain_charset)
+                       g_free(plain_charset);
+               if (charset)
+                       g_free(charset);
        }
 }
 
@@ -1576,16 +1642,30 @@ void _composer_download_attachment(EmailComposerUGD *ugd)
 {
        debug_log("");
        int i = 0;
-       int att_cnt = g_list_length(ugd->fw_attachment_list);
-
-       debug_log("att_cnt = %d", att_cnt);
 
-       ugd->fw_dn_cnt = att_cnt;
+       debug_log("ugd->fw_attach_cnt = %d", ugd->fw_attach_cnt);
 
-       if (att_cnt > 0) {
-               for ( i = 0 ; i < att_cnt ; i++ ) {
+       if (ugd->fw_attach_cnt > 0) {
+               for ( i = 0 ; i < ugd->fw_attach_cnt ; i++ ) {
                        if (_composer_save_attachment(ugd, i) == EINA_TRUE) {
-                               debug_log("_composer_save_attachment");
+                               int ret;
+                               service_h service = NULL;
+
+                               ret = service_create(&service);
+                               debug_log("service_create: %d", ret);
+                               if (!service) {
+                                       debug_log("service create failed");
+                                       return;
+                               }
+
+                               ret = service_add_extra_data(service, EMAIL_BUNDLE_KEY_UPDATE, EMAIL_BUNDLE_KEY_UPDATE);
+                               debug_log("service_add_extra_data: %d", ret);
+
+                               ret = ug_send_result(ugd->ug_main, service);
+                               debug_log("ug_send_result: %d", ret);
+
+                               ret = service_destroy(service);
+                               debug_log("service_destroy: %d", ret);
                        }
                }
        } else {
@@ -1661,7 +1741,7 @@ void _composer_update_attachment_info(EmailComposerUGD *ugd, int index)
        }
 }
 
-void _composer_cancel_download_attachment(EmailComposerUGD *ugd)
+void _composer_attachment_cancel_download(EmailComposerUGD *ugd)
 {
        debug_log("");
 
@@ -1676,6 +1756,31 @@ void _composer_cancel_download_attachment(EmailComposerUGD *ugd)
        }
 }
 
+void _composer_cancel_download_attachment(EmailComposerUGD *ugd)
+{
+       debug_log("");
+
+       int ret;
+       service_h service = NULL;
+
+       _composer_attachment_cancel_download(ugd);
+
+       ret = service_create(&service);
+       debug_log("service_create: %d", ret);
+       if (!service) {
+               debug_log("service create failed");
+               return;
+       }
+
+       ret = service_add_extra_data(service, EMAIL_BUNDLE_KEY_CANCEL_ALL, "CANCEL_ALL");
+       debug_log("service_add_extra_data: %d", ret);
+
+       ug_send_result(ugd->ug_main, service);
+
+       ret = service_destroy(service);
+       debug_log("service_destroy: %d", ret);
+}
+
 const char *_composer_get_sent_time(EmailComposerMail *mail_info)
 {
        debug_log("");
@@ -2495,116 +2600,80 @@ void _composer_add_body(EmailComposerUGD *ugd)
        }
 }
 
-void _composer_make_html_body(EmailComposerUGD *ugd)
+static char* _composer_get_recipients_list_for_original_body_info(EmailComposerUGD *ugd)
 {
        debug_log("");
 
-       char *full_text = NULL;
-       char *encoded_text = NULL;
-       char *html_text_for_body = NULL;
-       char *text_for_original_info = NULL;
-       char *recipients_list = NULL;
-
-       char text_for_from[MAX_STR_LEN] = { 0, };
-       char text_for_sent[MAX_STR_LEN] = { 0, };
-       char text_for_to[MAX_STR_LEN] = { 0, };
-       char text_for_subject[MAX_STR_LEN] = { 0, };
-
-       char szMetaViewportInfo[TEMP_BUFFER_SIZE + 1] = { 0x00, };
-
-       const char *sent_time = NULL;
-
+       char *temp = NULL;
+       char *token = NULL;
        char *temp_name[MAX_RECIPIENT_ADDRESS_LEN];
-       char *temp;
-       char *token;
-
-       if (((ugd->composer_type == RUN_COMPOSER_REPLY || ugd->composer_type == RUN_COMPOSER_REPLY_ALL) && ugd->account_info->account->options.reply_with_body) || ugd->composer_type == RUN_COMPOSER_FORWARD) {
-               if (ugd->existing_mail_info->mail_data->full_address_to) {
-                       temp = COMPOSER_STRDUP(ugd->existing_mail_info->mail_data->full_address_to);
-                       token = strtok(temp, ";");
-                       debug_log("to = %s\ntoken = %s", temp, token);
-
-                       int i = 0;
-
-                       while (token != NULL) {
-                               temp_name[i] = g_strdup(token);
-                               debug_log("temp_name[%d] = %s, token = %s", i, temp_name[i], token);
-
-                               token = strtok(NULL, ";");
-                               debug_log(">> temp_name[%d] = %s, token = %s", i, temp_name[i], token);
-
-                               if (i == MAX_RECIPIENT_COUNT)
-                                       break;
-
-                               i++;
-                       }
-
-                       int max = i;
-
-                       char *t = NULL;
-                       char *s = NULL;
-                       size_t s_len = 0;
-
-                       debug_log("To recipients count(%d)", max);
-                       for (i = 0; i < max; i++) {
-                               EmailRecpInfo *ri = _composer_separate_save_recipient_char(ugd, temp_name[i]);
-
-                               if (ri != NULL) {
-                                       debug_log("display_name = %s, email_address = %s", ri->display_name, ri->email_list[0].email_addr);
-                                       if (ri->display_name == NULL) {
-                                               debug_log("ri->display_name is NULL!");
-                                               g_free(ri);
-                                               ri = NULL;
-                                               continue;
-                                       }
-
-                                       s_len = strlen(ri->display_name) + (!t ? 1 : strlen(t) + 3);
-                                       debug_log("len = %d", s_len);
+       char *recipients_list = NULL;
 
-                                       if (t)
-                                               s = realloc(t, s_len);
-                                       else
-                                               s = (char *)malloc(s_len);
+       if (ugd->existing_mail_info->mail_data->full_address_to) {
+               temp = COMPOSER_STRDUP(ugd->existing_mail_info->mail_data->full_address_to);
+               token = strtok(temp, ";");
+               debug_log("to = %s\ntoken = %s", temp, token);
 
-                                       if (!s) {
-                                               debug_error("memory allocation failed");
-                                               if (ri->display_name) {
-                                                       free(ri->display_name);
-                                                       ri->display_name = NULL;
-                                               }
-                                               g_free(ri);
-                                               ri = NULL;
-                                               return;
-                                       }
+               int i = 0;
 
-                                       if (!t)
-                                               memset(s, 0x00, s_len);
-                                       else
-                                               memset(s + strlen(s), 0x00, s_len - strlen(s));
+               while (token != NULL) {
+                       temp_name[i] = g_strdup(token);
+                       debug_log("temp_name[%d] = %s, token = %s", i, temp_name[i], token);
 
-                                       sprintf(s + strlen(s), "%s%s", (t ? "; " : ""), ri->display_name);
+                       token = strtok(NULL, ";");
+                       debug_log(">> temp_name[%d] = %s, token = %s", i, temp_name[i], token);
 
-                                       t = s;
+                       if (i == MAX_RECIPIENT_COUNT)
+                               break;
 
-                                       recipients_list = t;
+                       i++;
+               }
 
-                                       debug_log("temp_name_list %d", strlen(recipients_list));
-                                       debug_log("recipients_list = %s", recipients_list);
-                                       debug_log("ugd->existing_mail_info->mail_data->full_address_to = %s", ugd->existing_mail_info->mail_data->full_address_to);
+               int max = i;
+               debug_log("To recipients count(%d)", max);
+               for (i = 0; i < max; i++) {
+                       EmailRecpInfo *ri = _composer_separate_save_recipient_char(ugd, temp_name[i]);
 
-                                       if (ri->display_name) {
-                                               free(ri->display_name);
-                                               ri->display_name = NULL;
-                                       }
+                       if (ri != NULL) {
+                               debug_log("display_name = %s, email_address = %s", ri->display_name, ri->email_list[0].email_addr);
+                               if (ri->display_name == NULL) {
+                                       debug_log("ri->display_name is NULL!");
                                        g_free(ri);
                                        ri = NULL;
+                                       continue;
                                }
+                               recipients_list = g_strconcat((recipients_list ? "; " : ""), ri->display_name, NULL);
+                               debug_log("recipients_list = %s", recipients_list);
+                               debug_log("ugd->existing_mail_info->mail_data->full_address_to = %s", ugd->existing_mail_info->mail_data->full_address_to);
+
+                               if (ri->display_name) {
+                                       free(ri->display_name);
+                                       ri->display_name = NULL;
+                               }
+                               g_free(ri);
+                               ri = NULL;
                        }
+               }
+               free(temp);
+       }
 
-                       free(temp);
+       return recipients_list ? g_strdup(recipients_list) : NULL;
+}
 
-               }
+static char* __composer_make_original_email_info(EmailComposerUGD *ugd)
+{
+       debug_log("");
+
+       char *recipients_list = NULL;
+       char *text_for_original_info = NULL;
+       const char *sent_time = NULL;
+
+       char text_for_from[MAX_STR_LEN] = { 0, };
+       char text_for_sent[MAX_STR_LEN] = { 0, };
+       char text_for_to[MAX_STR_LEN] = { 0, };
+       char text_for_subject[MAX_STR_LEN] = { 0, };
 
+       if (ugd->existing_mail_info && ugd->existing_mail_info->mail_data) {
                if (ugd->existing_mail_info->mail_data->full_address_from) {
                        char *from = NULL;
                        from = email_composer_get_parse_string(ugd->existing_mail_info->mail_data->full_address_from, STR_LEN(ugd->existing_mail_info->mail_data->full_address_from));
@@ -2617,8 +2686,12 @@ void _composer_make_html_body(EmailComposerUGD *ugd)
                        snprintf(text_for_sent, sizeof(text_for_sent), "<b>%s</b> %s<br>\n", _("IDS_EMAIL_BODY_SENT_C"), sent_time);
                }
 
-               if (recipients_list) {
+               recipients_list = _composer_get_recipients_list_for_original_body_info(ugd);
+
+               if (recipients_list != NULL) {
                        snprintf(text_for_to, sizeof(text_for_to), ADDED_TEXT, dgettext("sys_string", "IDS_COM_BODY_TO"), recipients_list);
+               } else {
+                       debug_log("recipients_list is NULL");
                }
 
                if (ugd->existing_mail_info->mail_data->subject) {
@@ -2627,94 +2700,168 @@ void _composer_make_html_body(EmailComposerUGD *ugd)
 
                text_for_original_info = g_strconcat(DIVIDE_LEFT_LINE_FOR_HTML, _("IDS_EMAIL_BODY_ORIGINAL_MESSAGE"), DIVIDE_RIGHT_LINE_FOR_HTML, text_for_from, text_for_sent, text_for_to, text_for_subject, NULL);
 
-               char *html_charset = email_parse_get_filename_from_path(ugd->existing_mail_info->mail_data->file_path_html);
-               debug_log("html_charset : %s", html_charset);
+               //debug_log("text_for_original_info: %s", text_for_original_info);
+
+               if (sent_time) {
+                       free((char *)sent_time);
+               }
+
+               if (recipients_list) {
+                       free(recipients_list);
+                       recipients_list = NULL;
+               }
+       }
+
+       return text_for_original_info ? g_strdup(text_for_original_info) : NULL;
+}
 
-               if (html_charset) {
-                       if ((g_strcmp0(html_charset, "ks_c_5601-1987") == 0) ||
-                               (g_strcmp0(html_charset, "KS_C_5601-1987") == 0) ||
-                               (g_strcmp0(html_charset, "EUCKR") == 0) ||
-                               (g_strcmp0(html_charset, "EUC-KR") == 0) ||
-                               (g_strcmp0(html_charset, "euckr") == 0) ||
-                               (g_strcmp0(html_charset, "euc-kr") == 0)) {
+static void _composer_get_original_body_info(EmailComposerUGD *ugd, char **text_for_original_info, char *signature_text)
+{
+       debug_log("");
 
-                               encoded_text = eina_str_convert("UTF-8", "EUC-KR", text_for_original_info);
+       char *encoded_text = NULL;
+       char *tmp_info_text = __composer_make_original_email_info(ugd);
 
-                               if (NULL != encoded_text) {
-                                       free(text_for_original_info);
-                                       text_for_original_info = encoded_text;
-                                       encoded_text = NULL;
+       if (((ugd->composer_type == RUN_COMPOSER_REPLY || ugd->composer_type == RUN_COMPOSER_REPLY_ALL) && ugd->account_info->account->options.reply_with_body) || ugd->composer_type == RUN_COMPOSER_FORWARD) {
+               if (tmp_info_text != NULL){
+                       char *html_charset = email_parse_get_filename_from_path(ugd->existing_mail_info->mail_data->file_path_html);
+                       debug_log("html_charset : %s", html_charset);
+
+                       if (html_charset) {
+                               if ((g_strcmp0(html_charset, "ks_c_5601-1987") == 0) ||
+                                       (g_strcmp0(html_charset, "KS_C_5601-1987") == 0) ||
+                                       (g_strcmp0(html_charset, "EUCKR") == 0) ||
+                                       (g_strcmp0(html_charset, "EUC-KR") == 0) ||
+                                       (g_strcmp0(html_charset, "euckr") == 0) ||
+                                       (g_strcmp0(html_charset, "euc-kr") == 0)) {
+
+                                       encoded_text = eina_str_convert("UTF-8", "EUC-KR", tmp_info_text);
+
+                                       if (NULL != encoded_text) {
+                                               free(tmp_info_text);
+                                               tmp_info_text = g_strdup(encoded_text);
+
+                                               free(encoded_text);
+                                               encoded_text = NULL;
+                                       }
                                }
+                               g_free(html_charset);
                        }
-                       g_free(html_charset);
+               } else {
+                       debug_log("text_for_original_info is NULL");
+                       tmp_info_text = g_strdup("\n");
                }
+       } else {
+               free(tmp_info_text);
+               tmp_info_text = g_strdup("\n");
+       }
 
+       *text_for_original_info = g_strconcat(DIV_TAG_START_ORIGIN_INFO, signature_text, tmp_info_text, DIV_TAG_END, NULL);
+       debug_log("text_for_original_info: \n%s", *text_for_original_info);
+
+       if (tmp_info_text) {
+               g_free(tmp_info_text);
+               tmp_info_text = NULL;
+       }
+}
+
+static void _composer_get_html_text_for_body(EmailComposerUGD *ugd, char **html_text_for_body)
+{
+       debug_log("");
+
+       char *tmp_html_text = NULL;
+
+       if (((ugd->composer_type == RUN_COMPOSER_REPLY || ugd->composer_type == RUN_COMPOSER_REPLY_ALL) && ugd->account_info->account->options.reply_with_body) || ugd->composer_type == RUN_COMPOSER_FORWARD) {
                if (ugd->existing_mail_info->mail_data->file_path_html) {
-                       html_text_for_body = (char *)email_get_buff_from_file(ugd->existing_mail_info->mail_data->file_path_html, 0);
+                       tmp_html_text = (char *)email_get_buff_from_file(ugd->existing_mail_info->mail_data->file_path_html, 0);
                } else if (ugd->existing_mail_info->mail_data->file_path_plain) {
                        char *temp_body_plain = (char *)email_get_buff_from_file(ugd->existing_mail_info->mail_data->file_path_plain, 0);
 
                        /*Convert plain-text to html content*/
-                       html_text_for_body = (char *)email_composer_get_parse_string(temp_body_plain, STR_LEN(temp_body_plain));
-                       debug_log("\nHTML-TEXT:\n%s", html_text_for_body);
+                       tmp_html_text = (char *)email_composer_get_parse_string(temp_body_plain, STR_LEN(temp_body_plain));
+                       debug_log("\nHTML-TEXT:\n%s", tmp_html_text);
                        free(temp_body_plain);
                } else {
-                       html_text_for_body = g_strdup("\n");
+                       tmp_html_text = g_strdup("\n");
                }
        } else if (ugd->composer_type == RUN_COMPOSER_EXTERNAL) {
                if (ugd->new_mail_info->mail_data && ugd->new_mail_info->mail_data->file_path_plain) {          /*For Text memo*/
                        debug_log("file_path_plain(%s)", ugd->new_mail_info->mail_data->file_path_plain);
-                       text_for_original_info = g_strdup("\n");
-                       html_text_for_body = (char *)email_composer_get_parse_string(ugd->new_mail_info->mail_data->file_path_plain, STR_LEN(ugd->new_mail_info->mail_data->file_path_plain));
-                       debug_log("html_text_for_body[%s]", html_text_for_body);
+                       tmp_html_text = (char *)email_composer_get_parse_string(ugd->new_mail_info->mail_data->file_path_plain, STR_LEN(ugd->new_mail_info->mail_data->file_path_plain));
                } else {
-                               debug_log("Empty html body");
-                               text_for_original_info = g_strdup("\n");
-                               html_text_for_body = g_strdup("\n");
+                       debug_log("Empty html body");
+                       tmp_html_text = g_strdup("\n");
                }
        } else {
-                       debug_log("Empty html body");           /*For RUN_COMPOSER_NEW*/
-                       text_for_original_info = g_strdup("\n");
-                       html_text_for_body = g_strdup("\n");
+               debug_log("Empty html body");           /*For RUN_COMPOSER_NEW*/
+               tmp_html_text = g_strdup("\n");
        }
 
+       *html_text_for_body = g_strconcat(DIV_TAG_START_ORIGIN_CONTENT, tmp_html_text, DIV_TAG_END, NULL);
+       debug_log("html_text_for_body: \n%s", *html_text_for_body);
+
+       if (tmp_html_text) {
+               g_free(tmp_html_text);
+               tmp_html_text = NULL;
+       }
+}
+
+char *_composer_make_text_with_div_tag(char *origin_text, int div_tag)
+{
+       debug_log("");
+
+       if (origin_text == NULL) {
+               return NULL;
+       }
+
+       if (div_tag == 0) {
+               return g_strconcat(DIV_TAG_START_ORIGIN_INFO, origin_text, DIV_TAG_END, NULL);
+       } else {
+               return g_strconcat(DIV_TAG_START_ORIGIN_CONTENT, origin_text, DIV_TAG_END, NULL);
+       }
+}
+
+void _composer_make_html_body(EmailComposerUGD *ugd)
+{
+       debug_log("");
+
+       char *full_text = NULL;
+       char *text_for_original_info = NULL;
+       char *html_text_for_body = NULL;
+       char szMetaViewportInfo[TEMP_BUFFER_SIZE + 1] = { 0x00, };
+
+       _composer_get_html_text_for_body(ugd, &html_text_for_body);
+
        strncpy(szMetaViewportInfo, HTML_META_INFORMATION, TEMP_BUFFER_SIZE);
 
        if ((ugd->account_info->account->options).add_signature) {
                char signature_text[128] = { 0, };
 
+               if ((ugd->account_info->account->options).signature) {
+                       snprintf(signature_text, sizeof(signature_text), "<br><br><br>%s<br><br>", (ugd->account_info->account->options).signature);
+               }
+
+               _composer_get_original_body_info(ugd, &text_for_original_info, signature_text);
+
                debug_log("composer_type:%d", ugd->composer_type);
                if (ugd->composer_type == RUN_COMPOSER_NEW || ugd->composer_type == RUN_COMPOSER_REPLY
                        || ugd->composer_type == RUN_COMPOSER_REPLY_ALL || ugd->composer_type == RUN_COMPOSER_FORWARD) {
-                       if ((ugd->account_info->account->options).signature) {
-                               snprintf(signature_text, sizeof(signature_text), "<br><br><br>%s<br><br>", (ugd->account_info->account->options).signature);
-                       }
 
-                       full_text = g_strconcat(szMetaViewportInfo, BODY_TAG_START, DIV_TAG_START_ORIGIN_INFO, signature_text, text_for_original_info, DIV_TAG_END,
-                                                                       DIV_TAG_START_ORIGIN_CONTENT, html_text_for_body, DIV_TAG_END, BODY_TAG_END, HTML_TAG_END, NULL);
+                       full_text = g_strconcat(szMetaViewportInfo, BODY_TAG_START, text_for_original_info, html_text_for_body, BODY_TAG_END, HTML_TAG_END, NULL);
                } else if (ugd->composer_type == RUN_COMPOSER_EXTERNAL) {
-                       if ((ugd->account_info->account->options).signature) {
-                               snprintf(signature_text, sizeof(signature_text), "<br><br><br>%s<br><br>", (ugd->account_info->account->options).signature);
-                       }
 
-                       full_text = g_strconcat(szMetaViewportInfo, BODY_TAG_START, html_text_for_body, DIV_TAG_START_ORIGIN_INFO, signature_text, text_for_original_info, DIV_TAG_END,
-                                                                       BODY_TAG_END, HTML_TAG_END, NULL);
+                       full_text = g_strconcat(szMetaViewportInfo, BODY_TAG_START, html_text_for_body, text_for_original_info, BODY_TAG_END, HTML_TAG_END, NULL);
                }
        } else {
-               full_text = g_strconcat(szMetaViewportInfo, DIV_TAG_START_ORIGIN_INFO, text_for_original_info, DIV_TAG_END,
-                                                               DIV_TAG_START_ORIGIN_CONTENT, html_text_for_body, DIV_TAG_END, NULL);
+               //ugd->original_info_content = g_strconcat(DIV_TAG_START_ORIGIN_INFO, text_for_original_info, DIV_TAG_END, NULL);
+               _composer_get_original_body_info(ugd, &text_for_original_info, NULL);
+               full_text = g_strconcat(szMetaViewportInfo, BODY_TAG_START, text_for_original_info, html_text_for_body, BODY_TAG_END, HTML_TAG_END, NULL);
        }
 
-       debug_log("text_for_original_info: %s", text_for_original_info);
-       debug_log("html_text_for_body: %s", html_text_for_body);
-       email_composer_save_file(ugd->saved_html_path, full_text, STR_LEN(full_text));
-
        debug_log("full text:\n%s", full_text);
+       email_composer_save_file(ugd->saved_html_path, full_text, STR_LEN(full_text));
 
-       free(recipients_list);
-       free((char *)sent_time);
        free(text_for_original_info);
-       free(encoded_text);
        free(html_text_for_body);
        free(full_text);
 }
@@ -2787,10 +2934,47 @@ void _composer_add_attachment(EmailComposerUGD *ugd)
                        }
 
                        for (i = 0; i < ugd->existing_mail_info->mail_data->attachment_count; i++) {
+                               index++;
 
                                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_data_t *attachment_data = (email_attachment_data_t *)calloc(1, sizeof(email_attachment_data_t));
+
+                               if (attachment_info) {
+                                       attachment_info->mail_id = ugd->nExistingMailID;
+                                       attachment_info->attach_id = fwd_attachment_data_list[i].attachment_id;
+                                       attachment_info->index = index;
+                                       attachment_info->size = fwd_attachment_data_list[i].attachment_size;
+                                       attachment_info->downloaded = fwd_attachment_data_list[i].save_status;
+                                       attachment_info->drm = fwd_attachment_data_list[i].drm_status;
+                                       attachment_info->inline_content = fwd_attachment_data_list[i].inline_content_status;
+                                       attachment_info->name = g_strdup(fwd_attachment_data_list[i].attachment_name);
+                                       attachment_info->path = g_strdup(fwd_attachment_data_list[i].attachment_path);
+
+                                       debug_log("mail id (%d)", attachment_info->mail_id);
+                                       debug_log("attachments index (%d)", attachment_info->index);
+                                       debug_log("attachments attach_id (%d)", attachment_info->attach_id);
+                                       debug_log("attachments name (%s)", attachment_info->name ? attachment_info->name : "@niL");
+                                       debug_log("attachments path (%s)", attachment_info->path ? attachment_info->path : "@niL");
+                                       debug_log("attachments size (%d)", attachment_info->size);
+                                       debug_log("attachments download (%d)", attachment_info->downloaded);
+                                       debug_log("attachments drm (%d)", attachment_info->drm);
+                                       debug_log("attachments inline? (%d)", attachment_info->inline_content);
+
+                                       ugd->fw_attachment_list = g_list_append(ugd->fw_attachment_list, attachment_info);
+
+                                       //email_attachment_data_t *attachment_data = (email_attachment_data_t *)calloc(1, sizeof(email_attachment_data_t));
+
+                                       attachment_data->attachment_id = attachment_info->attach_id;
+                                       attachment_data->attachment_name = COMPOSER_STRDUP(attachment_info->name);
+                                       attachment_data->attachment_path = COMPOSER_STRDUP(attachment_info->path);
+                                       attachment_data->save_status = 0;
+                                       attachment_data->attachment_size = attachment_info->size;
+                                       nTotalAttachmentSize = nTotalAttachmentSize + attachment_data->attachment_size;
+                               }
+
                                if (fwd_attachment_data_list[i].save_status && 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. */
                                {
@@ -2811,53 +2995,13 @@ void _composer_add_attachment(EmailComposerUGD *ugd)
                                                        msg, 0, NULL, NULL, 2.0, _composer_noti_response_cb);
                                                break;
                                        } else {
-                                               email_attachment_data_t *attachment_data = (email_attachment_data_t *)calloc(1, sizeof(email_attachment_data_t));
-
                                                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->attachment_size = fwd_attachment_data_list[i].attachment_size;
-
-                                               _composer_attachment_create_list_box(ugd, attachment_data);
-                                       }
-                               } else if (fwd_attachment_data_list[i].save_status == FALSE) {
-                                       EMAIL_ATTACHMENT_INFO_S *attachment_info = (EMAIL_ATTACHMENT_INFO_S *) calloc(1, sizeof(EMAIL_ATTACHMENT_INFO_S));
-
-                                       if (attachment_info) {
-                                               attachment_info->mail_id = ugd->nExistingMailID;
-                                               attachment_info->attach_id = fwd_attachment_data_list[i].attachment_id;
-                                               attachment_info->index = ++index;
-                                               attachment_info->size = fwd_attachment_data_list[i].attachment_size;
-                                               attachment_info->downloaded = fwd_attachment_data_list[i].save_status;
-                                               attachment_info->drm = fwd_attachment_data_list[i].drm_status;
-                                               attachment_info->inline_content = fwd_attachment_data_list[i].inline_content_status;
-                                               attachment_info->name = g_strdup(fwd_attachment_data_list[i].attachment_name);
-                                               attachment_info->path = g_strdup(fwd_attachment_data_list[i].attachment_path);
-
-                                               debug_log("mail id (%d)", attachment_info->mail_id);
-                                               debug_log("attachments index (%d)", attachment_info->index);
-                                               debug_log("attachments attach_id (%d)", attachment_info->attach_id);
-                                               debug_log("attachments name (%s)", attachment_info->name ? attachment_info->name : "@niL");
-                                               debug_log("attachments path (%s)", attachment_info->path ? attachment_info->path : "@niL");
-                                               debug_log("attachments size (%d)", attachment_info->size);
-                                               debug_log("attachments download (%d)", attachment_info->downloaded);
-                                               debug_log("attachments drm (%d)", attachment_info->drm);
-                                               debug_log("attachments inline? (%d)", attachment_info->inline_content);
-
-                                               ugd->fw_attachment_list = g_list_append(ugd->fw_attachment_list, attachment_info);
-
-                                               email_attachment_data_t *attachment_data = (email_attachment_data_t *)calloc(1, sizeof(email_attachment_data_t));
-
-                                               attachment_data->attachment_id = attachment_info->attach_id;
-                                               attachment_data->attachment_name = COMPOSER_STRDUP(attachment_info->name);
-                                               attachment_data->attachment_path = COMPOSER_STRDUP(attachment_info->path);
-                                               attachment_data->save_status = 0;
-                                               attachment_data->attachment_size = attachment_info->size;
-                                               nTotalAttachmentSize = nTotalAttachmentSize + attachment_data->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) {
@@ -3014,16 +3158,35 @@ bool _composer_check_mail_is_modified(void *data)
        }
 
        if (EINA_TRUE == ugd->has_body_html) {
+               if (ugd->latest_info_content == NULL) {
+                       debug_log("ugd->latest_info_content is NULL");
+                       is_modified = false;
+                       goto FINISH_OFF;
+               }
+
                if (ugd->latest_html_content == NULL) {
                        debug_log("ugd->latest_html_content is NULL");
                        is_modified = false;
                        goto FINISH_OFF;
                }
 
-               if (ugd->latest_html_content && ugd->saved_html_content) {
-                       debug_log("saved_html_content:\n%s", ugd->saved_html_content);
+               if (ugd->latest_info_content && ugd->original_info_content) {
+                       debug_log("original_info_content:\n%s", ugd->original_info_content);
+                       debug_log("latest_info_content:\n%s", ugd->latest_info_content);
+                       if (g_strcmp0(ugd->original_info_content, ugd->latest_info_content) != 0) {
+                               debug_log("diff => %d", g_strcmp0(ugd->original_info_content, ugd->latest_info_content));
+                               is_modified = true;
+                               goto FINISH_OFF;
+                       }
+               } else {
+                       is_modified = false;    /*if latest_html_content and/or saved_html_content is NULL,
+                                                               is_modified set to false; on return false, destroy composer is called*/
+               }
+
+               if (ugd->latest_html_content && ugd->original_html_content) {
+                       debug_log("original_html_content:\n%s", ugd->original_html_content);
                        debug_log("latest_html_content:\n%s", ugd->latest_html_content);
-                       if (g_strcmp0(ugd->saved_html_content, ugd->latest_html_content) != 0) {
+                       if (g_strcmp0(ugd->original_html_content, ugd->latest_html_content) != 0) {
                                is_modified = true;
                        }
                } else {
index f0ab283..c74a793 100755 (executable)
@@ -396,9 +396,9 @@ static void on_destroy(ui_gadget_h ug, service_h data, void *priv)
                        g_free(ugd->saved_html_path);
                        ugd->saved_html_path = NULL;
                }
-               if (ugd->saved_html_content) {
-                       g_free(ugd->saved_html_content);
-                       ugd->saved_html_content = NULL;
+               if (ugd->latest_info_content) {
+                       g_free(ugd->latest_info_content);
+                       ugd->latest_info_content = NULL;
                }
                if (ugd->latest_html_content) {
                        g_free(ugd->latest_html_content);
@@ -408,6 +408,14 @@ static void on_destroy(ui_gadget_h ug, service_h data, void *priv)
                        g_free(ugd->plain_content);
                        ugd->plain_content = NULL;
                }
+               if (ugd->original_info_content) {
+                       g_free(ugd->original_info_content);
+                       ugd->original_info_content = NULL;
+               }
+               if (ugd->original_html_content) {
+                       g_free(ugd->original_html_content);
+                       ugd->original_html_content = NULL;
+               }
        }
 
        _composer_remove_temp_folder();
@@ -871,10 +879,11 @@ static void _composer_init_data(void *data)
        ugd->body_ewkview = NULL;
        ugd->has_body_html = EINA_FALSE;
        ugd->saved_html_path = NULL;
-       ugd->saved_html_content = NULL;
+       ugd->latest_info_content = NULL;
        ugd->latest_html_content = NULL;
        ugd->plain_content = NULL;
-
+       ugd->original_info_content = NULL;
+       ugd->original_html_content = NULL;
        ugd->to_recipients_cnt = 0;
        ugd->cc_recipients_cnt = 0;
        ugd->bcc_recipients_cnt = 0;
@@ -901,6 +910,7 @@ static void _composer_init_data(void *data)
        ugd->dn_noti_popup = NULL;
        ugd->dn_prog_popup = NULL;
 
+       ugd->fw_attach_cnt = 0;
        ugd->fw_dn_cnt = 0;
        ugd->b_cc_ps_open = false;
        ugd->b_bcc_ps_open = false;
@@ -1003,9 +1013,9 @@ static void _composer_finish_service(void *data)
                        g_free(ugd->saved_html_path);
                        ugd->saved_html_path = NULL;
                }
-               if (ugd->saved_html_content) {
-                       g_free(ugd->saved_html_content);
-                       ugd->saved_html_content = NULL;
+               if (ugd->latest_info_content) {
+                       g_free(ugd->latest_info_content);
+                       ugd->latest_info_content = NULL;
                }
                if (ugd->latest_html_content) {
                        g_free(ugd->latest_html_content);
@@ -1015,6 +1025,14 @@ static void _composer_finish_service(void *data)
                        g_free(ugd->plain_content);
                        ugd->plain_content = NULL;
                }
+               if (ugd->original_info_content) {
+                       g_free(ugd->original_info_content);
+                       ugd->original_info_content = NULL;
+               }
+               if (ugd->original_html_content) {
+                       g_free(ugd->original_html_content);
+                       ugd->original_html_content = NULL;
+               }
        }
 
        _composer_remove_temp_folder();
@@ -1855,8 +1873,16 @@ static void _on_edbus_event_composer_receive(void *data, DBusMessage * message)
                                                _composer_update_attachment_info(ugd, data3);
 
                                                if (ugd->need_download == EINA_TRUE) {
-                                                       ugd->bSendBtnDisabled = true;
-                                                       ugd->send_timer = ecore_timer_add(0.5, _composer_send_mail_cb, ugd);            
+                                                       if (ugd->b_sending == true) {
+                                                               debug_log("send mail");
+                                                               ugd->bSendBtnDisabled = true;
+                                                               ugd->send_timer = ecore_timer_add(0.5, _composer_send_mail_cb, ugd);
+                                                       } else {
+                                                               if (ugd->save_drafts == 1) {
+                                                                       debug_log("draft mail");
+                                                                       ugd->send_timer = ecore_timer_add(0.5, _composer_save_draft_mail, ugd);
+                                                               }
+                                                       }                                                       
                                                        ugd->need_download = EINA_FALSE;
                                                }
                                        } else {
index 21c08c9..fe43382 100755 (executable)
@@ -183,6 +183,7 @@ struct ug_data {
        int option_header_opened;
        Eina_Bool b_load_finished;
        Eina_Bool b_show_remote_images;
+       Eina_Bool is_long_pressed;
        Eina_Bool is_webview_scrolling;
        Eina_Bool is_main_scroller_scrolling;
 
index dffcfb6..1c9bffd 100755 (executable)
@@ -397,11 +397,13 @@ static void _webview_scroll_down_cb(void *data, Evas_Object *obj, void *event_in
 static void _webview_mouse_down_cb(void *data, Evas * evas, Evas_Object *obj, void *event_info)
 {
        debug_log("");
+       EmailViewerUGD *ug_data = (EmailViewerUGD *)data;
 
        Evas_Event_Mouse_Down *mouse_info = (Evas_Event_Mouse_Down *)event_info;
        debug_log("output position: [%d, %d]", mouse_info->output.x, mouse_info->output.y);
        _g_pos_x = mouse_info->output.x;
        _g_pos_y = mouse_info->output.y;
+       ug_data->is_long_pressed = EINA_FALSE;
 }
 
 static int _send_read_report_mail(EmailViewerUGD *ug_data)
@@ -450,6 +452,8 @@ static void _webview_contextmenu_customize_cb(void *data, Evas_Object *obj, void
 {
        debug_log("");
 
+       EmailViewerUGD *ug_data = (EmailViewerUGD *)data;
+
        int i = 0, count = 0;
        Eina_Bool isText = EINA_TRUE, isImage = EINA_FALSE;
        Ewk_Context_Menu* contextmenu = (Ewk_Context_Menu*)event_info;
@@ -465,6 +469,7 @@ static void _webview_contextmenu_customize_cb(void *data, Evas_Object *obj, void
                case EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB: // text selection
                        isText = EINA_TRUE;
                break;
+               case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW: // fall through
                case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK:       // image or link selection
                        isText = EINA_FALSE;
                        isImage = EINA_TRUE;
@@ -494,6 +499,8 @@ static void _webview_contextmenu_customize_cb(void *data, Evas_Object *obj, void
                        ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG + 2, _("IDS_EMAIL_OPT_VIEW_IMAGE"), EINA_TRUE);
                }
        }
+
+       ug_data->is_long_pressed = EINA_TRUE;
 }
 
 static void _webview_contextmenu_selected_cb(void *data, Evas_Object *webview, void *event_info)
index d5513f9..b56ccaa 100755 (executable)
@@ -1333,6 +1333,7 @@ void _hide_view(EmailViewerUGD *ug_data)
        /* Double_Scroller */
        ug_data->b_noc = 1;
        ug_data->b_load_finished = EINA_FALSE;
+       ug_data->is_long_pressed = EINA_FALSE;
        ug_data->b_show_remote_images = EINA_FALSE;
        ug_data->is_webview_scrolling = EINA_FALSE;
        ug_data->is_main_scroller_scrolling = EINA_FALSE;
@@ -3997,6 +3998,13 @@ static void _webview_policy_navigation_decide_cb(void *data, Evas_Object *obj, v
        debug_log("ewk_view_url_get(%s)", uri);
 
        if (ug_data->b_load_finished == EINA_TRUE) {
+               if (ug_data->is_long_pressed == EINA_TRUE) {
+                       debug_log("Long pressed!!!");
+                       ug_data->is_long_pressed = EINA_FALSE;
+                       ewk_policy_decision_ignore(policy_decision);
+                       return;
+               }
+
                ewk_policy_decision_ignore(policy_decision);
 
                debug_log("url:%s", ewk_policy_decision_url_get(policy_decision));