#include "email-composer-predictive-search.h"
#include "email-composer-js.h"
-#define ACCOUNT_ICON_GMAIL IMGDIR"/M02_email_list_icon_gmail.png"
-#define ACCOUNT_ICON_HOTMAIL IMGDIR"/M02_email_list_icon_hotmail.png"
-#define ACCOUNT_ICON_YAHOO IMGDIR"/M02_email_list_icon_YahooMail.png"
-#define ACCOUNT_ICON_AOL IMGDIR"/M02_email_list_icon_AOL.png"
#define ACCOUNT_ICON_OTHERS IMGDIR"/icon_email.png"
static EmailComposerUGD *g_ugd = NULL;
new_ri->is_from_addr = false;
new_ri->is_always_bcc = false;
+ if ((ugd->me_added == false) && (obj == ugd->to_mbe)) {
+ debug_log("display_name = %s", ugd->account_info->account->user_display_name);
+ EmailRecpInfo *from_ri = NULL;
+ Elm_Object_Item *from_item = NULL;
+ from_item = elm_multibuttonentry_first_item_get(ugd->from_mbe);
+ if (from_item) {
+ from_ri = elm_object_item_data_get(from_item);
+ debug_log("from_ri = %s", from_ri->email_list[0].email_addr);
+ if (g_strcmp0(new_ri->email_list[0].email_addr, from_ri->email_list[0].email_addr) == 0) {
+ new_ri->display_name = ugd->account_info->account->user_display_name;
+ new_ri->is_from_addr = true;
+ elm_object_text_set(ugd->add_me_btn, N_("Remove me"));
+ ugd->me_added = true;
+ }
+ } else {
+ debug_log("account name = %s", ugd->account_info->account_name);
+ if (g_strcmp0(new_ri->email_list[0].email_addr, ugd->account_info->account_name) == 0) {
+ new_ri->display_name = ugd->account_info->account->user_display_name;
+ new_ri->is_from_addr = true;
+ elm_object_text_set(ugd->add_me_btn, N_("Remove me"));
+ ugd->me_added = true;
+ }
+ }
+ }
elm_object_item_data_set(item, new_ri);
}
debug_log("");
EmailComposerUGD *ugd = (EmailComposerUGD *)data;
+ Elm_Object_Item *item = (Elm_Object_Item *) event_info;
if (obj == ugd->to_mbe) {
debug_log("to_mbe");
+ char *addr = elm_entry_markup_to_utf8((char *)elm_object_item_text_get(item));
+ debug_log("utf8 address : %s", addr);
+
+ EmailRecpInfo *from_ri = NULL;
+ Elm_Object_Item *from_item = NULL;
+ from_item = elm_multibuttonentry_first_item_get(ugd->from_mbe);
+
+ if (from_item) {
+ from_ri = elm_object_item_data_get(from_item);
+
+ debug_log("from_ri = %s", from_ri->email_list[0].email_addr);
+ }
+
+ debug_log("ugd->me_added = %d", ugd->me_added);
+ if (ugd->me_added == true) {
+ debug_log("account name = %s", ugd->account_info->account_name);
+ if (from_ri) {
+ if (g_strcmp0(addr, from_ri->email_list[0].email_addr) == 0) {
+ ugd->me_added = false;
+ elm_object_text_set(ugd->add_me_btn, N_("Add me"));
+ }
+ } else {
+ if (g_strcmp0(addr, ugd->account_info->account_name) == 0) {
+ ugd->me_added = false;
+ elm_object_text_set(ugd->add_me_btn, N_("Add me"));
+ }
+ }
+ }
if (ugd->to_recipients_cnt > 0)
ugd->to_recipients_cnt--;
}
}
+void _composer_cancel_send_mail_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ debug_log("");
+ if (data == NULL) {
+ debug_log("data is NULL");
+ return;
+ }
+
+ EmailComposerUGD *ugd = (EmailComposerUGD *)data;
+
+ int err = email_cancel_sending_mail(ugd->new_mail_info->mail_data->mail_id);
+
+ if (err != EMAIL_ERROR_NONE) {
+ debug_warning("email_engine_cancel_send_mail failed - err(%d)", err);
+ } else {
+ if (ugd->composer_noti) {
+ evas_object_del(ugd->composer_noti);
+ ugd->composer_noti = NULL;
+ }
+
+ ugd->send_result = COMPOSER_ERROR_SEND_FAIL;
+ debug_log("Cancelled to send email");
+ }
+}
+
Eina_Bool _composer_send_mail_cb(void *data)
{
debug_log("");
elm_progressbar_pulse(progressbar, EINA_TRUE);
elm_object_content_set(ugd->composer_noti, progressbar);
+ Evas_Object *btn1 = elm_button_add(ugd->composer_noti);
+ elm_object_style_set(btn1, "popup_button/default");
+ elm_object_text_set(btn1, dgettext("sys_string", "IDS_COM_SK_CANCEL"));
+ elm_object_part_content_set(ugd->composer_noti, "button1", btn1);
+ evas_object_smart_callback_add(btn1, "clicked", _composer_cancel_send_mail_cb, ugd);
+
/*
After sending, not to focus mbe.
*/
debug_log("");
EmailComposerUGD *ugd = (EmailComposerUGD *)data;
- if (elm_multibuttonentry_first_item_get(ugd->to_mbe))
- elm_multibuttonentry_clear(ugd->to_mbe);
- if (elm_multibuttonentry_first_item_get(ugd->cc_mbe))
- elm_multibuttonentry_clear(ugd->cc_mbe);
- if (elm_multibuttonentry_first_item_get(ugd->bcc_mbe))
- elm_multibuttonentry_clear(ugd->bcc_mbe);
-
_composer_popup_end(ugd, ugd->send_result);
return EINA_TRUE;
}
int index = contacts_svc_value_get_int(row_info, CTS_LIST_EMAIL_CONTACT_ID_INT);
contacts_list_item->index = index;
-#ifndef _NEW_CT_SVC_API
- contacts_list_item->first_name = g_strdup(contacts_svc_value_get_str(row_info, CTS_LIST_EMAIL_CONTACT_FIRST_STR));
- contacts_list_item->last_name = g_strdup(contacts_svc_value_get_str(row_info, CTS_LIST_EMAIL_CONTACT_LAST_STR));
-#else
contacts_list_item->display = g_strdup(contacts_svc_value_get_str(row_info, CTS_LIST_EMAIL_CONTACT_DISPLAY_STR));
-#endif
contacts_list_item->image_path = g_strdup(contacts_svc_value_get_str(row_info, CTS_LIST_EMAIL_CONTACT_IMG_PATH_STR));
contacts_list_item->email_address = g_strdup(contacts_svc_value_get_str(row_info, CTS_LIST_EMAIL_ADDR_STR));
-#ifndef _NEW_CT_SVC_API
- char *first = contacts_list_item->first_name;
- char *last = contacts_list_item->last_name;
- char *display = g_strdup(contacts_svc_value_get_str(row_info, CTS_LIST_EMAIL_CONTACT_DISPLAY_STR));
-
- if (!display) {
- if (first != NULL && last != NULL) {
- if (CTS_ORDER_NAME_FIRSTLAST == contacts_svc_get_order(CTS_ORDER_OF_DISPLAY)) {
- display = g_strconcat(first, " ", last, NULL);
- } else {
- display = g_strconcat(last, " ", first, NULL);
- }
- } else if (first != NULL || last != NULL) {
- display = (first != NULL) ? g_strdup(first) : g_strdup(last);
- } else {
- display = g_strdup(" ");
- }
- }
-
- snprintf(contacts_list_item->display_name, sizeof(contacts_list_item->display_name), "%s", display);
- g_free(display);
-#else
snprintf(contacts_list_item->display_name, sizeof(contacts_list_item->display_name), "%s", contacts_list_item->display);
-#endif
/*contacts_list = eina_list_append(contacts_list, contacts_list_item);*/
}
debug_log("");
if (contacts_list_item) {
-#ifndef _NEW_CT_SVC_API
- g_free(contacts_list_item->first_name);
- contacts_list_item->first_name = NULL;
- g_free(contacts_list_item->last_name);
- contacts_list_item->last_name = NULL;
-#else
g_free(contacts_list_item->display);
contacts_list_item->display = NULL;
-#endif
g_free(contacts_list_item->email_address);
contacts_list_item->email_address = NULL;
g_free(contacts_list_item->image_path);
if (acc_index > 5)
acc_index = 5;
Evas_Object *box = elm_box_add(ugd->composer_noti);
- evas_object_size_hint_min_set(box, 610 * elm_scale_get(), 122 * acc_index * elm_scale_get());
+ evas_object_size_hint_min_set(box, 610 * elm_scale_get(), 120 * acc_index * elm_scale_get());
evas_object_show(ugd->account_gen_list);
elm_box_pack_end(box, ugd->account_gen_list);
elm_object_content_set(ugd->composer_noti, box);
} else if (!strncmp(part, "elm.icon.2", 10)) {
Evas_Object *icon = elm_icon_add(obj);
- // setting/include/email-setting.h
- typedef enum {
- HOTMAIL = 1,
- GMAIL,
- YAHOOMAIL,
- AOL,
- OTHERS
- } AccountInfo;
-
- account_user_data_t *ud = (account_user_data_t *)g_ugd->account_info->account_list[count].user_data;
- debug_log("is_preset_account:%d", ud->is_preset_account);
-
- switch (ud->is_preset_account) {
- case GMAIL:
- elm_icon_file_set(icon, ACCOUNT_ICON_GMAIL, NULL);
- break;
- case HOTMAIL:
- elm_icon_file_set(icon, ACCOUNT_ICON_HOTMAIL, NULL);
- break;
- case YAHOOMAIL:
- elm_icon_file_set(icon, ACCOUNT_ICON_YAHOO, NULL);
- break;
- case AOL:
- elm_icon_file_set(icon, ACCOUNT_ICON_AOL, NULL);
- break;
- case OTHERS:
- default:
+ debug_log("logo_icon_path:%s", g_ugd->account_info->account_list[count].logo_icon_path);
+ if (g_ugd->account_info->account_list[count].logo_icon_path)
+ elm_icon_file_set(icon, g_ugd->account_info->account_list[count].logo_icon_path, NULL);
+ else
elm_icon_file_set(icon, ACCOUNT_ICON_OTHERS, NULL);
- break;
- }
evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
return icon;
static void _composer_from_gl_sel(void *data, Evas_Object *obj, void *event_info)
{
- debug_log("");
+ debug_log("index:%d", (int)data);
int index = (int)data;
debug_log("selected button text = %s", pszBtnText);
if (pszBtnText && strcmp(pszBtnText, dgettext("sys_string", "IDS_COM_SK_OK")) == 0) {
- int set_val = elm_radio_value_get(ugd->account_info->account_rdg);
-
- debug_log("set_val = %d", set_val);
- debug_log("account_type: %d", ugd->account_info->account_list[set_val].incoming_server_type);
-
- ugd->account_info->account_id = ugd->account_info->account_list[set_val].account_id;
-
- if (ugd->account_info->account_name) {
- g_free(ugd->account_info->account_name);
- ugd->account_info->account_name = NULL;
- }
-
- ugd->account_info->account_name = g_strdup(ugd->account_info->account_list[set_val].user_email_address);
-
- debug_log("account_id = %d", ugd->account_info->account_id);
-
- debug_log("priority = %d", (*ugd->account_info->account).options.priority);
-
- Elm_Object_Item *from_item = NULL;
- from_item = elm_multibuttonentry_first_item_get(ugd->from_mbe);
-
- EmailRecpInfo *from_ri = NULL;
-
- if (from_item) {
- from_ri = elm_object_item_data_get(from_item);
-
- debug_log("from_ri = %s", from_ri->email_list[0].email_addr);
- }
-
- debug_log("add_my_address_to_bcc = %d", ugd->account_info->account->options.add_my_address_to_bcc);
-
-#ifdef _ALWAYS_CC_MYSELF
- debug_log("remove bcc myself if it is");
- Elm_Object_Item *bcc_item = NULL;
- bcc_item = elm_multibuttonentry_first_item_get(ugd->bcc_mbe);
-
- while (bcc_item) {
- EmailRecpInfo *bcc_ri = NULL;
- int index = 0;
-
- bcc_ri = (EmailRecpInfo *) elm_object_item_data_get(bcc_item);
-
- index = bcc_ri->selected_email_idx;
-
- debug_log("bcc_ri email_addr = %s", bcc_ri->email_list[index].email_addr);
-
- if ((g_strcmp0(bcc_ri->email_list[index].email_addr, from_ri->email_list[0].email_addr) == 0) && (bcc_ri->is_always_bcc == true)) {
- elm_object_item_del(bcc_item);
- break;
- }
-
- bcc_item = elm_multibuttonentry_item_next_get(bcc_item);
- }
-
- debug_log("remove cc myself if it is");
- Elm_Object_Item *cc_item = NULL;
- cc_item = elm_multibuttonentry_first_item_get(ugd->cc_mbe);
-
- while (cc_item) {
- EmailRecpInfo *cc_ri = NULL;
- int index = 0;
-
- cc_ri = (EmailRecpInfo *) elm_object_item_data_get(cc_item);
-
- index = cc_ri->selected_email_idx;
-
- debug_log("cc_ri email_addr = %s", cc_ri->email_list[index].email_addr);
-
- if ((g_strcmp0(cc_ri->email_list[index].email_addr, from_ri->email_list[0].email_addr) == 0) && (cc_ri->is_always_bcc == true)) {
- elm_object_item_del(cc_item);
- break;
- }
-
- cc_item = elm_multibuttonentry_item_next_get(cc_item);
- }
-
- if (ugd->account_info->account->options.add_my_address_to_bcc == EMAIL_ADD_MY_ADDRESS_OPTION_ALWAYS_ADD_TO_BCC) {
- debug_log("always bcc on");
- EmailRecpInfo *new_bcc_ri = (EmailRecpInfo *) calloc(1, sizeof(EmailRecpInfo));
-
- new_bcc_ri->selected_email_idx = 0;
- new_bcc_ri->display_name = ugd->account_info->account->user_display_name;
- snprintf(new_bcc_ri->email_list[0].email_addr, MAX_RECIPIENT_ADDRESS_LEN, "%s", ugd->account_info->account->user_email_address);
- new_bcc_ri->email_cnt = 1;
- new_bcc_ri->is_contact_info = false;
- new_bcc_ri->is_always_bcc = true;
- new_bcc_ri->is_from_addr = false;
-
- bcc_item = elm_multibuttonentry_first_item_get(ugd->bcc_mbe);
- elm_multibuttonentry_item_insert_before(ugd->bcc_mbe, bcc_item, g_strdup(new_bcc_ri->display_name), NULL, new_bcc_ri);
- } else if (ugd->account_info->account->options.add_my_address_to_bcc == EMAIL_ADD_MY_ADDRESS_OPTION_ALWAYS_ADD_TO_CC) {
- debug_log("always cc on");
- EmailRecpInfo *new_cc_ri = (EmailRecpInfo *) calloc(1, sizeof(EmailRecpInfo));
-
- new_cc_ri->selected_email_idx = 0;
- new_cc_ri->display_name = ugd->account_info->account->user_display_name;
- snprintf(new_cc_ri->email_list[0].email_addr, MAX_RECIPIENT_ADDRESS_LEN, "%s", ugd->account_info->account->user_email_address);
- new_cc_ri->email_cnt = 1;
- new_cc_ri->is_contact_info = false;
- new_cc_ri->is_always_bcc = true;
- new_cc_ri->is_from_addr = false;
-
- cc_item = elm_multibuttonentry_first_item_get(ugd->cc_mbe);
- elm_multibuttonentry_item_insert_before(ugd->cc_mbe, cc_item, g_strdup(new_cc_ri->display_name), NULL, new_cc_ri);
- } else {
- debug_log("always bcc/cc off");
- }
-#endif
-
- EmailRecpInfo *new_from_ri = (EmailRecpInfo *) calloc(1, sizeof(EmailRecpInfo));
-
- new_from_ri->selected_email_idx = 0;
- new_from_ri->display_name = ugd->account_info->account_list[set_val].user_display_name;
- snprintf(new_from_ri->email_list[0].email_addr, MAX_RECIPIENT_ADDRESS_LEN, "%s", ugd->account_info->account_list[set_val].user_email_address);
- new_from_ri->email_cnt = 1;
- new_from_ri->is_contact_info = false;
- new_from_ri->is_always_bcc = false;
- new_from_ri->is_from_addr = true;
-
- elm_object_item_del(from_item);
-
- elm_multibuttonentry_item_append(ugd->from_mbe, g_strdup(new_from_ri->display_name), NULL, new_from_ri);
-
- if (ugd->selected_entry == ugd->to_mbe_entry) {
- elm_object_focus_set(ugd->to_mbe, EINA_TRUE);
- } else if (ugd->selected_entry == ugd->cc_mbe_entry) {
- elm_object_focus_set(ugd->cc_mbe, EINA_TRUE);
- } else if (ugd->selected_entry == ugd->bcc_mbe_entry) {
- elm_object_focus_set(ugd->bcc_mbe, EINA_TRUE);
- }
-
- if (ugd->account_gen_list) {
- elm_genlist_clear(ugd->account_gen_list);
-
- evas_object_del(ugd->account_gen_list);
- ugd->account_gen_list = NULL;
- }
-
- 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*/);
- }
-
- if (ugd->composer_noti) {
- debug_log("@@@ ELM_POPUP_RESPONSE_CLOSE @@@");
- _composer_popup_delete(ugd->composer_noti);
- ugd->composer_noti = NULL;
- }
+ _composer_from_close_response_cb(ugd);
}
}
debug_log("account_id = %d", ugd->account_info->account_id);
- debug_log("priority = %d", (*ugd->account_info->account).options.priority);
+ debug_log("priority = %d, %d", (*ugd->account_info->account).options.priority, ugd->account_info->account_list[set_val].options.priority);
Elm_Object_Item *from_item = NULL;
from_item = elm_multibuttonentry_first_item_get(ugd->from_mbe);
debug_log("from_ri = %s", from_ri->email_list[0].email_addr);
}
- debug_log("add_my_address_to_bcc = %d", ugd->account_info->account->options.add_my_address_to_bcc);
+ debug_log("add_my_address_to_bcc = %d, %d", ugd->account_info->account->options.add_my_address_to_bcc, ugd->account_info->account_list[set_val].options.add_my_address_to_bcc);
#ifdef _ALWAYS_CC_MYSELF
debug_log("remove bcc myself if it is");
index = bcc_ri->selected_email_idx;
- debug_log("bcc_ri email_addr = %s", bcc_ri->email_list[index].email_addr);
+ debug_log("bcc_ri email_addr = %s, from_ri email_addr = %s, is_always_bcc = %d", bcc_ri->email_list[index].email_addr, from_ri->email_list[0].email_addr, bcc_ri->is_always_bcc);
if ((g_strcmp0(bcc_ri->email_list[index].email_addr, from_ri->email_list[0].email_addr) == 0) && (bcc_ri->is_always_bcc == true)) {
elm_object_item_del(bcc_item);
index = cc_ri->selected_email_idx;
- debug_log("cc_ri email_addr = %s", cc_ri->email_list[index].email_addr);
+ debug_log("cc_ri email_addr = %s, from_ri email_addr = %s, is_always_bcc = %d", cc_ri->email_list[index].email_addr, from_ri->email_list[0].email_addr, cc_ri->is_always_bcc);
if ((g_strcmp0(cc_ri->email_list[index].email_addr, from_ri->email_list[0].email_addr) == 0) && (cc_ri->is_always_bcc == true)) {
elm_object_item_del(cc_item);
cc_item = elm_multibuttonentry_item_next_get(cc_item);
}
- if (ugd->account_info->account->options.add_my_address_to_bcc == EMAIL_ADD_MY_ADDRESS_OPTION_ALWAYS_ADD_TO_BCC) {
+ if (ugd->account_info->account_list[set_val].options.add_my_address_to_bcc == EMAIL_ADD_MY_ADDRESS_OPTION_ALWAYS_ADD_TO_BCC) {
debug_log("always bcc on");
EmailRecpInfo *new_bcc_ri = (EmailRecpInfo *) calloc(1, sizeof(EmailRecpInfo));
new_bcc_ri->selected_email_idx = 0;
- new_bcc_ri->display_name = ugd->account_info->account->user_display_name;
- snprintf(new_bcc_ri->email_list[0].email_addr, MAX_RECIPIENT_ADDRESS_LEN, "%s", ugd->account_info->account->user_email_address);
+ new_bcc_ri->display_name = ugd->account_info->account_list[set_val].user_display_name;
+ snprintf(new_bcc_ri->email_list[0].email_addr, MAX_RECIPIENT_ADDRESS_LEN, "%s", ugd->account_info->account_list[set_val].user_email_address);
new_bcc_ri->email_cnt = 1;
new_bcc_ri->is_contact_info = false;
new_bcc_ri->is_always_bcc = true;
bcc_item = elm_multibuttonentry_first_item_get(ugd->bcc_mbe);
elm_multibuttonentry_item_insert_before(ugd->bcc_mbe, bcc_item, g_strdup(new_bcc_ri->display_name), NULL, new_bcc_ri);
- } else if (ugd->account_info->account->options.add_my_address_to_bcc == EMAIL_ADD_MY_ADDRESS_OPTION_ALWAYS_ADD_TO_CC) {
+ } else if (ugd->account_info->account_list[set_val].options.add_my_address_to_bcc == EMAIL_ADD_MY_ADDRESS_OPTION_ALWAYS_ADD_TO_CC) {
debug_log("always cc on");
EmailRecpInfo *new_cc_ri = (EmailRecpInfo *) calloc(1, sizeof(EmailRecpInfo));
new_cc_ri->selected_email_idx = 0;
- new_cc_ri->display_name = ugd->account_info->account->user_display_name;
- snprintf(new_cc_ri->email_list[0].email_addr, MAX_RECIPIENT_ADDRESS_LEN, "%s", ugd->account_info->account->user_email_address);
+ new_cc_ri->display_name = ugd->account_info->account_list[set_val].user_display_name;
+ snprintf(new_cc_ri->email_list[0].email_addr, MAX_RECIPIENT_ADDRESS_LEN, "%s", ugd->account_info->account_list[set_val].user_email_address);
new_cc_ri->email_cnt = 1;
new_cc_ri->is_contact_info = false;
new_cc_ri->is_always_bcc = true;
debug_log("");
EmailComposerUGD *ugd = (EmailComposerUGD *)data;
- if (ugd->me_added == false) {
- EmailRecpInfo *from_ri = NULL;
- Elm_Object_Item *from_item = NULL;
- from_item = elm_multibuttonentry_first_item_get(ugd->from_mbe);
+ debug_log("ugd->me_added = %d", ugd->me_added);
- if (from_item) {
- from_ri = elm_object_item_data_get(from_item);
+ EmailRecpInfo *from_ri = NULL;
+ Elm_Object_Item *from_item = NULL;
+ from_item = elm_multibuttonentry_first_item_get(ugd->from_mbe);
- debug_log("from_ri = %s", from_ri->email_list[0].email_addr);
- }
+ if (from_item) {
+ from_ri = elm_object_item_data_get(from_item);
+ debug_log("from_ri = %s", from_ri->email_list[0].email_addr);
+ }
+
+ if (ugd->me_added == false) {
+ debug_log("previous: not added -> now: being added");
Elm_Object_Item *to_item = NULL;
to_item = elm_multibuttonentry_first_item_get(ugd->to_mbe);
index = to_ri->selected_email_idx;
- debug_log("to_ri email_addr = %s", to_ri->email_list[index].email_addr);
+ debug_log("to_ri email_addr = %s, index = %d", to_ri->email_list[index].email_addr, index);
debug_log("account name = %s", ugd->account_info->account_name);
if (from_ri) {
to_item = elm_multibuttonentry_item_next_get(to_item);
}
+ email_account_t *account = NULL;
+ if (!email_engine_get_account_full_data(ugd->account_info->account_id, &account))
+ debug_log("Failed to Get account full data");
+
EmailRecpInfo *new_to_ri = (EmailRecpInfo *) calloc(1, sizeof(EmailRecpInfo));
new_to_ri->selected_email_idx = 0;
- new_to_ri->display_name = ugd->account_info->account->user_display_name;
- snprintf(new_to_ri->email_list[0].email_addr, MAX_RECIPIENT_ADDRESS_LEN, "%s", ugd->account_info->account->user_email_address);
+ if (account) {
+ new_to_ri->display_name = account->user_display_name;
+ snprintf(new_to_ri->email_list[0].email_addr, MAX_RECIPIENT_ADDRESS_LEN, "%s", account->user_email_address);
+ } else {
+ new_to_ri->display_name = ugd->account_info->account->user_display_name;
+ snprintf(new_to_ri->email_list[0].email_addr, MAX_RECIPIENT_ADDRESS_LEN, "%s", ugd->account_info->account->user_email_address);
+ }
new_to_ri->email_cnt = 1;
new_to_ri->is_contact_info = false;
new_to_ri->is_always_bcc = false;
new_to_ri->is_from_addr = true;
+ debug_log("my email_addr = %s, display_name = %s", new_to_ri->email_list[0].email_addr, new_to_ri->display_name);
to_item = elm_multibuttonentry_first_item_get(ugd->to_mbe);
elm_multibuttonentry_item_insert_before(ugd->to_mbe, to_item, g_strdup(new_to_ri->display_name), NULL, new_to_ri);
elm_object_text_set(ugd->add_me_btn, N_("Remove me"));
ugd->me_added = true;
+
+ if (account) {
+ debug_log("email_free_account is called");
+ email_free_account(&account, 1);
+ account = NULL;
+ }
} else {
+ debug_log("previous: me added -> now: being deleted");
Elm_Object_Item *to_item = NULL;
to_item = elm_multibuttonentry_first_item_get(ugd->to_mbe);
- if (to_item) {
- elm_object_item_del(to_item);
- ugd->me_added = false;
- elm_object_text_set(ugd->add_me_btn, N_("Add me"));
+
+ while (to_item) {
+ EmailRecpInfo *to_ri = NULL;
+ int index = 0;
+
+ to_ri = (EmailRecpInfo *) elm_object_item_data_get(to_item);
+
+ index = to_ri->selected_email_idx;
+
+ debug_log("to_ri email_addr = %s, index = %d", to_ri->email_list[index].email_addr, index);
+
+ debug_log("account name = %s", ugd->account_info->account_name);
+ if (from_ri) {
+ if (g_strcmp0(to_ri->email_list[index].email_addr, from_ri->email_list[0].email_addr) == 0) {
+ elm_object_item_del(to_item);
+ break;
+ }
+ } else {
+ if (g_strcmp0(to_ri->email_list[index].email_addr, ugd->account_info->account_name) == 0) {
+ elm_object_item_del(to_item);
+ break;
+ }
+ }
+ to_item = elm_multibuttonentry_item_next_get(to_item);
}
+
+ ugd->me_added = false;
+ elm_object_text_set(ugd->add_me_btn, N_("Add me"));
}
if (ugd->selected_entry == ugd->to_mbe_entry) {
{
debug_log("");
- if (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) {
- debug_log("acc id = %d, %d", ugd->account_info->account_id, ugd->existing_mail_info->mail_data->account_id);
- debug_log("priority = %d, %d", (*ugd->account_info->account).options.priority, ugd->existing_mail_info->mail_data->priority);
- debug_log("mailbox = %s, %s", ugd->mailbox_info->mail_box->mailbox_name, ugd->existing_mail_info->mail_data->server_mailbox_name);
- ugd->new_mail_info->mail_data->account_id = ugd->existing_mail_info->mail_data->account_id;
- //ugd->new_mail_info->mail_data->priority = ugd->existing_mail_info->mail_data->priority;
- } else { //RUN_COMPOSER_NEW || RUN_COMPOSER_EXTERNAL
- debug_log("acc id = %d", ugd->account_info->account_id);
- debug_log("priority = %d", (*ugd->account_info->account).options.priority);
- debug_log("mailbox = %s", ugd->mailbox_info->mail_box->mailbox_name);
- ugd->new_mail_info->mail_data->account_id = ugd->account_info->account_id;
- //ugd->new_mail_info->mail_data->priority = (*account).options.priority;
+ email_account_t *account = NULL;
+ if (!email_engine_get_account_full_data(ugd->account_info->account_id, &account)) {
+ debug_log("Failed to Get account full data");
+ return COMPOSER_ERROR_GET_DATA_FAIL;
}
+ debug_log("acc id = %d", ugd->account_info->account_id);
+ debug_log("priority = %d", (*ugd->account_info->account).options.priority);
+ debug_log("mailbox = %s", ugd->mailbox_info->mail_box->mailbox_name);
+ ugd->new_mail_info->mail_data->account_id = ugd->account_info->account_id;
+
ugd->new_mail_info->mail_data->report_status = EMAIL_MAIL_REPORT_NONE;
if (ugd->tracking_option[0] == 1) {
ugd->new_mail_info->mail_data->server_mailbox_name = strdup(ugd->mailbox_info->mail_box->mailbox_name);
ugd->new_mail_info->mail_data->mailbox_id = ugd->mailbox_info->mail_box->mailbox_id;
- debug_log("user_name = %s", ugd->account_info->account->user_display_name);
- debug_log("email_addr = %s", ugd->account_info->account->user_email_address);
+ 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);
- char uc[MAX_ACCOUNT_NAME_LEN + 20];
- snprintf(uc, sizeof(uc), "\"%s\"<%s>", ugd->account_info->account->user_display_name, ugd->account_info->account->user_email_address);
+ 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);
debug_log("from = %s", uc);
+ if (account) {
+ debug_log("email_free_account is called");
+ email_free_account(&account, 1);
+ account = NULL;
+ }
+
if (elm_object_item_text_get(elm_multibuttonentry_first_item_get(ugd->to_mbe)) != NULL) {
debug_log("to mbe");
if (_composer_make_recipient_char_to_list(ugd, ugd->to_mbe, &(ugd->new_mail_info->mail_data->full_address_to)) < COMPOSER_ERROR_NONE)
return;
}
-email_attachment_data_t *_composer_attach_mail_body(EmailComposerUGD *ugd)
-{
- email_attachment_data_t *body_attch = NULL;
-
- body_attch = (email_attachment_data_t *) calloc(1, sizeof(email_attachment_data_t));
- if (!body_attch) {
- debug_log("Memory allocation failed.");
- return NULL;
- }
-
- body_attch->attachment_name = COMPOSER_STRDUP(COMPOSER_ORINGIN_HTML_STR);
- body_attch->attachment_path = COMPOSER_STRDUP(ugd->new_mail_info->mail_data->file_path_html);
- body_attch->attachment_size = 1;
- body_attch->save_status = 1;
-
- return body_attch;
-}
-
int _composer_send_mail(EmailComposerUGD *ugd)
{
debug_log("");
ugd->composer_noti = NULL;
}
- if (close_sg == COMPOSER_ERROR_NONE)
+ if (close_sg == COMPOSER_ERROR_NONE) {
+ if (elm_multibuttonentry_first_item_get(ugd->to_mbe))
+ elm_multibuttonentry_clear(ugd->to_mbe);
+ if (elm_multibuttonentry_first_item_get(ugd->cc_mbe))
+ elm_multibuttonentry_clear(ugd->cc_mbe);
+ if (elm_multibuttonentry_first_item_get(ugd->bcc_mbe))
+ elm_multibuttonentry_clear(ugd->bcc_mbe);
+
ug_destroy_me(ugd->ug_main);
- else {
+ } else {
elm_object_disabled_set(ugd->send_btn, EINA_FALSE);
elm_object_disabled_set(ugd->cancel_btn, EINA_FALSE);
if (ugd->composer_type == RUN_COMPOSER_FORWARD && ugd->account_info->account->options.forward_with_files) {
+ debug_log("attachment_count:%d, inline_content_count:%d", ugd->existing_mail_info->mail_data->attachment_count, ugd->existing_mail_info->mail_data->inline_content_count);
if (ugd->existing_mail_info->mail_data->attachment_count > 0) {
int i = 0;
for (i = 0; i < ugd->existing_mail_info->mail_data->attachment_count; i++) {
- if (ugd->existing_mail_info->attachment_list[i].save_status == FALSE) {
+ debug_log("save_status:%d, inline_content_status:%d", ugd->existing_mail_info->attachment_list[i].save_status, ugd->existing_mail_info->attachment_list[i].inline_content_status);
+ if (ugd->existing_mail_info->attachment_list[i].save_status == FALSE && ugd->existing_mail_info->attachment_list[i].inline_content_status == FALSE) {
need_download = true;
ugd->fw_dn_cnt++;
}
}
+ debug_log("need_download:%d, fw_dn_cnt:%d", need_download, ugd->fw_dn_cnt);
}
}
if (EINA_TRUE == ugd->has_body_html) {
debug_log("");
- char file_path[MAX_STR_LEN] = { 0, };
+ char file_path[MAX_PATH_LEN] = { 0, };
snprintf(file_path, sizeof(file_path), "file://%s", ugd->saved_html_path);
debug_log("file_path: (%s)", file_path);
evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0.5);
ugd->controlbar_item[EMAIL_COMPOSER_ADD_ME_BTN] = elm_toolbar_item_append(ugd->cbar, NULL, NULL, NULL, NULL);
elm_object_item_part_content_set(ugd->controlbar_item[EMAIL_COMPOSER_ADD_ME_BTN], "object", btn);
- elm_object_text_set(btn, N_("Add me"));
+ if (!ugd->me_added) {
+ elm_object_text_set(btn, N_("Add me"));
+ } else {
+ elm_object_text_set(btn, N_("Remove me"));
+ }
ugd->add_me_btn = btn;
evas_object_smart_callback_add(ugd->add_me_btn, "clicked", _composer_cbar_add_me_clicked, ugd);
break;
ugd->cc_btn = NULL;
break;
case EMAIL_COMPOSER_SAVE_AS_DRAFT_BTN : // Save as draft btn
- {
evas_object_del(ugd->save_as_draft_btn);
ugd->save_as_draft_btn = NULL;
- }
break;
case EMAIL_COMPOSER_PRIORITY_BTN : // Priority btn
evas_object_del(ugd->priority_btn);