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)
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);
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);
}
}
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)
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");
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)
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");
}
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)
}
}
-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("");
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);
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("");
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);
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;
}
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));
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++;
+ }
}
}
}
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);
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);
}
}
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);
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);
debug_log("ewkSetting is NULL.");
ewk_settings_default_encoding_set(ewkSetting, charset);
- g_free(charset);
}
}
}
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);
}
}
{
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 {
}
}
-void _composer_cancel_download_attachment(EmailComposerUGD *ugd)
+void _composer_attachment_cancel_download(EmailComposerUGD *ugd)
{
debug_log("");
}
}
+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("");
}
}
-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));
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) {
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);
}
}
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. */
{
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) {
}
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 {