merge with composer codes
authorSungbok Park <parksb@samsung.com>
Thu, 8 Nov 2012 21:45:54 +0000 (06:45 +0900)
committerSungbok Park <parksb@samsung.com>
Fri, 9 Nov 2012 11:30:50 +0000 (20:30 +0900)
Change-Id: Idbe2d6b913ad9b4cb182d8c2b3e4b6a49a8465e0

12 files changed:
common/include/email-common-types.h
composer/CMakeLists.txt
composer/include/email-composer-util.h
composer/include/email-composer.h
composer/src/email-composer-attachment.c
composer/src/email-composer-callback.c
composer/src/email-composer-contents.c
composer/src/email-composer-predictive-search.c
composer/src/email-composer-util.c
composer/src/email-composer.c
packaging/org.tizen.email.spec
viewer/src/email-viewer-logic.c

index b2f6a3f..9b358e8 100755 (executable)
@@ -114,6 +114,11 @@ typedef enum {
 } EmailRunType;
 
 typedef enum {
+       EMAIL_STATUS_REPLY = (1 << 3),
+       EMAIL_STATUS_FORWARD = (1 << 7)
+} EmailMailStatusType;
+
+typedef enum {
        EMAIL_SEARCH_NONE,
        EMAIL_SEARCH_ALL,
        EMAIL_SEARCH_SUBJECT,
index ae6ea07..695fead 100755 (executable)
@@ -50,7 +50,6 @@ ADD_DEFINITIONS("-DDEBUG")
 ADD_DEFINITIONS("-D_TEMPORARY_FIX_FOR_ROTATION_")
 ADD_DEFINITIONS("-D_POPUP_WITH_LIST")
 ADD_DEFINITIONS("-D_ALWAYS_CC_MYSELF")
-ADD_DEFINITIONS("-D_NEW_CT_SVC_API")
 
 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} email-common ${CMAKE_LDFLAGS} ${pkgs-composer_LDFLAGS})
index eafd435..a96cf09 100755 (executable)
@@ -41,7 +41,6 @@ Eina_Bool _composer_show_fail_to_save(void *data);
 Eina_Bool _composer_show_success_to_save(void *data);
 
 EmailRecpInfo *_composer_separate_save_recipient_char(EmailComposerUGD *ugd, char *recipient);
-email_attachment_data_t *_composer_attach_mail_body(EmailComposerUGD *ugd);
 
 void _composer_make_default_thumbnail(Evas_Object *eo, char *pszImgPath, int nItemType);
 Evas_Object *_composer_load_edj(Evas_Object *parent, const char *file, const char *group);
index daf9315..e3ed81a 100755 (executable)
@@ -241,12 +241,7 @@ struct ug_data {
 
 typedef struct _EMAIL_CONTACT_LIST_INFO_S {
        int index;
-#ifndef _NEW_CT_SVC_API
-       char *first_name;
-       char *last_name;
-#else
        char *display;
-#endif
        char *email_address;
        char *image_path;
        char display_name[MAX_RECIPIENT_ADDRESS_LEN];
index 9c4ebaf..28a72c1 100755 (executable)
@@ -69,11 +69,12 @@ int _composer_get_attachments_total_size(EmailComposerUGD *ugd)
                if (attachment_data) {
 
                        if ((return_stat = stat(attachment_data->attachment_path, &file_info)) == -1) {
-                               debug_log("stat Error(%d): %s", errno, strerror(errno));
-                               return COMPOSER_ERROR_INVALID_FILE;
+                               debug_error("stat Error(%d): %s", errno, strerror(errno));
+                               continue;
+//                             return COMPOSER_ERROR_INVALID_FILE;
                        }
 
-                       debug_log("attach_size in byte : %d", file_info.st_size);
+                       debug_log("file size in byte : %d", file_info.st_size);
 
 /*                     if (file_info.st_size / 1024 > 1)
                                temp_file_size = file_info.st_size / 1024;
@@ -130,7 +131,10 @@ int _composer_get_files_size(Eina_List *files_list)
        EINA_LIST_FOREACH(list, l, recv) {
                debug_log("File : %s", recv);
 
-               file_size = ecore_file_size(recv);
+               if (ecore_file_exists(recv))
+                       file_size = ecore_file_size(recv);
+               else
+                       file_size = 0;
                debug_log("file_size : %d", file_size);
                temp_size = temp_size + file_size;
                debug_log("total_size : %d", temp_size);
@@ -168,7 +172,7 @@ int _composer_get_inline_images_size(EmailComposerUGD *ugd)
                                        inline_list = eina_list_append(inline_list, recv + 7);
                                }
                        }
-                       if (eina_list_count(inline_list) > 0) {
+                       if (eina_list_count(inline_list) > 0 && (inline_list != NULL)) {
                                total_size = _composer_get_files_size(inline_list); // -1 on 'stat' error of inline image file
                        }
 
@@ -299,7 +303,7 @@ void _composer_attachment_create_list(EmailComposerUGD *ugd, Eina_List *attachme
                        continue;
 
                if ((return_stat = stat(recv, &file_info)) == -1) {
-                       debug_log("stat Error(%d): %s", errno, strerror(errno));
+                       debug_error("stat Error(%d): %s", errno, strerror(errno));
                        eina_list_free(attachment_list);
                        attachment_list = NULL;
 
@@ -472,6 +476,8 @@ void _composer_attachment_add_thumbnail(EmailComposerUGD *ugd, Evas_Object *pare
        elm_object_part_content_set(parent, "attachment.thumbnail.icon", thumb_nail);
        evas_object_show(thumb_nail);
 
+       if (path)
+               g_free((char *)path);
 }
 
 Evas_Object *_composer_attachment_add_delete_icon(EmailComposerUGD *ugd, Evas_Object *parent)
index a1145df..fd53ea6 100755 (executable)
 #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;
@@ -261,6 +257,30 @@ void _composer_mbe_added_cb(void *data, Evas_Object *obj, void *event_info)
                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);
        }
 
@@ -285,9 +305,38 @@ void _composer_mbe_deleted_cb(void *data, Evas_Object *obj, void *event_info)
        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--;
@@ -1047,6 +1096,31 @@ void _composer_mbe_change_addr_response_cb(void *data, Evas_Object *obj, void *e
        }
 }
 
+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("");
@@ -1098,6 +1172,12 @@ Eina_Bool _composer_send_mail_cb(void *data)
                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.
                */
@@ -1322,13 +1402,6 @@ Eina_Bool _composer_send_popup_finish_cb(void *data)
        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;
 }
@@ -1389,39 +1462,11 @@ static void *_composer_contact_search_by_email(EmailComposerUGD *ugd, const char
                        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);*/
                }
@@ -1443,15 +1488,8 @@ static void _composer_delete_contacts_list(EMAIL_CONTACT_LIST_INFO_S *contacts_l
        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);
@@ -1569,7 +1607,7 @@ void _composer_from_show_popup(EmailComposerUGD *ugd)
        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);
@@ -1623,36 +1661,11 @@ Evas_Object *_composer_from_gl_content_get(void *data, Evas_Object *obj, const c
        } 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;
@@ -1678,7 +1691,7 @@ Evas_Object *_composer_from_gl_content_get(void *data, Evas_Object *obj, const c
 
 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;
 
@@ -1697,157 +1710,7 @@ static void _composer_from_change_response_cb(void *data, Evas_Object *obj, void
        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);
        }
 }
 
@@ -1870,7 +1733,7 @@ static void _composer_from_close_response_cb(EmailComposerUGD *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);
@@ -1883,7 +1746,7 @@ static void _composer_from_close_response_cb(EmailComposerUGD *ugd)
                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");
@@ -1898,7 +1761,7 @@ static void _composer_from_close_response_cb(EmailComposerUGD *ugd)
 
                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);
@@ -1920,7 +1783,7 @@ static void _composer_from_close_response_cb(EmailComposerUGD *ugd)
 
                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);
@@ -1930,13 +1793,13 @@ static void _composer_from_close_response_cb(EmailComposerUGD *ugd)
                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;
@@ -1944,13 +1807,13 @@ static void _composer_from_close_response_cb(EmailComposerUGD *ugd)
 
                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;
@@ -2078,17 +1941,20 @@ void _composer_cbar_add_me_clicked(void *data, Evas_Object *obj, void *event_inf
        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);
 
@@ -2100,7 +1966,7 @@ void _composer_cbar_add_me_clicked(void *data, Evas_Object *obj, void *event_inf
 
                        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) {
@@ -2118,15 +1984,25 @@ void _composer_cbar_add_me_clicked(void *data, Evas_Object *obj, void *event_inf
                        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);
@@ -2134,14 +2010,44 @@ void _composer_cbar_add_me_clicked(void *data, Evas_Object *obj, void *event_inf
                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) {
index 46e3955..66f08ca 100755 (executable)
@@ -616,25 +616,25 @@ static void _composer_webview_contextmenu_customize_cb(void *data, Evas_Object *
                if (has_content == EINA_FALSE) {
                        ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_SELECT_WORD, _("IDS_EMAIL_OPT_SELECT"), EINA_TRUE);
                        ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL, _("IDS_EMAIL_OPT_SELECT_ALL"), EINA_TRUE);
-                       //ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG, _("IDS_EMAIL_HEADER_SEARCH"), EINA_TRUE); // Smart search
+                       ewk_context_menu_item_append(contextmenu, EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG, NULL, IMGDIR"/icon_search.png", EINA_TRUE);
                } else {
                        ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_SELECT_WORD, _("IDS_EMAIL_OPT_SELECT"), EINA_TRUE);
                        ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL, _("IDS_EMAIL_OPT_SELECT_ALL"), EINA_TRUE);
                        ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_PASTE, _("IDS_EMAIL_OPT_PASTE"), EINA_TRUE);
                        //ewk_context_menu_item_append_as_action(contextmenu, menu_item, menu_name, EINA_TRUE); // for Clipboard
-                       //ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG, _("IDS_EMAIL_HEADER_SEARCH"), EINA_TRUE); // Smart search
+                       ewk_context_menu_item_append(contextmenu, EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG, NULL, IMGDIR"/icon_search.png", EINA_TRUE);
                }
        } else {
                if (has_content == EINA_FALSE) {
                        ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_COPY, _("IDS_EMAIL_OPT_COPY"), EINA_TRUE);
                        ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_CUT, _("IDS_EMAIL_OPT_CUT"), EINA_TRUE);
-                       //ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG, _("IDS_EMAIL_HEADER_SEARCH"), EINA_TRUE); // Smart search
+                       ewk_context_menu_item_append(contextmenu, EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG, NULL, IMGDIR"/icon_search.png", EINA_TRUE);
                } else {
                        ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_COPY, _("IDS_EMAIL_OPT_COPY"), EINA_TRUE);
                        ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_CUT, _("IDS_EMAIL_OPT_CUT"), EINA_TRUE);
                        ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_TAG_PASTE, _("IDS_EMAIL_OPT_PASTE"), EINA_TRUE);
                        //ewk_context_menu_item_append_as_action(contextmenu, menu_item, menu_name, EINA_TRUE); // for Clipboard
-                       //ewk_context_menu_item_append_as_action(contextmenu, EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG, _("IDS_EMAIL_HEADER_SEARCH"), EINA_TRUE); // Smart search
+                       ewk_context_menu_item_append(contextmenu, EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG, NULL, IMGDIR"/icon_search.png", EINA_TRUE);
                }
        }
 }
index 672c3b9..3ec4b92 100755 (executable)
@@ -288,9 +288,6 @@ Eina_List *composer_ps_search_contact(EmailComposerUGD *ugd, const char *search_
        while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
                CTSvalue *contact = NULL;
                CTSvalue *email = NULL;
-#ifndef _NEW_CT_SVC_API
-               const char *first, *last;
-#endif
                const char *img_path, *email_addr;
                char *display = NULL;
 
@@ -323,35 +320,7 @@ Eina_List *composer_ps_search_contact(EmailComposerUGD *ugd, const char *search_
                        if (display) {
                                //debug_log("display = %s", display);
                        } else {
-#ifndef _NEW_CT_SVC_API
-                               first = contacts_svc_value_get_str(contact, CTS_LIST_CONTACT_FIRST_STR);
-                               last = contacts_svc_value_get_str(contact, CTS_LIST_CONTACT_LAST_STR);
-
-                               contacts_list_item->first_name = g_strdup(first);
-                               contacts_list_item->last_name = g_strdup(last);
-
-                               if (CTS_ORDER_NAME_FIRSTLAST == contacts_svc_get_order(CTS_ORDER_OF_DISPLAY)) {
-                                       if (!first && !last)
-                                               display = g_strdup(email_addr);
-                                       else if (!first)
-                                               display = g_strdup(last);
-                                       else if (!last)
-                                               display = g_strdup(first);
-                                       else
-                                               display = g_strconcat(first, " ", last, NULL);
-                               } else {
-                                       if (!first && !last)
-                                               display = g_strdup(email_addr);
-                                       else if (!first)
-                                               display = g_strdup(last);
-                                       else if (!last)
-                                               display = g_strdup(first);
-                                       else
-                                               display = g_strconcat(last, " ", first, NULL);
-                               }
-#else
                                display = g_strdup(email_addr);
-#endif
                        }
 
                        if (display && contacts_list_item->email_address && (strcasestr(display, search_word) || strcasestr(contacts_list_item->email_address, search_word))) {
@@ -455,15 +424,8 @@ void composer_ps_delete_contacts_list(Eina_List *predict_list)
        EMAIL_CONTACT_LIST_INFO_S *contacts_list_item = NULL;
        EINA_LIST_FOREACH(l, lt, contacts_list_item) {
                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);
index 9db4778..1a82c95 100755 (executable)
@@ -462,20 +462,17 @@ int _composer_make_mail(EmailComposerUGD *ugd)
 {
        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) {
@@ -491,14 +488,20 @@ int _composer_make_mail(EmailComposerUGD *ugd)
        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)
@@ -789,24 +792,6 @@ void _composer_convert_ps_to_br(char *input)
        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("");
@@ -1086,9 +1071,16 @@ void _composer_popup_end(EmailComposerUGD *ugd, int close_sg)
                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);
 
@@ -1260,15 +1252,18 @@ void _composer_set_mail_info(EmailComposerUGD *ugd)
 
        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);
                }
        }
 
@@ -1315,7 +1310,7 @@ void _composer_set_mail_info(EmailComposerUGD *ugd)
        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);
 
@@ -3594,7 +3589,11 @@ void _composer_set_option_tray_menu(int num, EmailComposerUGD *ugd)
                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;
@@ -3677,10 +3676,8 @@ void _composer_unset_option_tray_menu(int num, EmailComposerUGD *ugd)
                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);
index 2b580ca..56a1995 100755 (executable)
@@ -27,6 +27,7 @@
 #include "email-composer-predictive-search.h"
 #include "email-composer-js.h"
 
+#include <sys/vfs.h>
 #include "Ecore_X.h"
 
 static void *on_create(ui_gadget_h ug, enum ug_mode mode, service_h data, void *priv);
@@ -43,6 +44,7 @@ static void on_key_event(ui_gadget_h ug, enum ug_key_event event, service_h data
 static Evas_Object *create_fullview(Evas_Object *parent, EmailComposerUGD *ugd);
 static Evas_Object *create_frameview(Evas_Object *parent, EmailComposerUGD *ugd);
 static void _win_profile_changed_cb(void *data, Evas_Object *obj, void *event);
+static int _composer_check_storage_full(char *path, int mb_size);
 
 static void _composer_delete_evas_objects(EmailComposerUGD *ugd);
 static void _composer_delete_all_popup(EmailComposerUGD *ugd);
@@ -154,6 +156,12 @@ static void *on_create(ui_gadget_h ug, enum ug_mode mode, service_h data, void *
        ugd->composer_type = RUN_TYPE_UNKNOWN;
        ugd->eComposerErrorType = COMPOSER_ERROR_NONE;
 
+       if (_composer_check_storage_full(DIR_DEFAULT_EMAIL_STORAGE, MIN_FREE_SPACE)
+               /*|| _composer_check_storage_full(DIR_TMP_PREFIX, MIN_FREE_SPACE)*/) {
+               ugd->eComposerErrorType = COMPOSER_ERROR_STORAGE_FULL;
+               return ugd->main_layout;
+       }
+
        if (!email_engine_initialize()) {
                ugd->eComposerErrorType = COMPOSER_ERROR_ENGINE_INIT_FAILED;
                return ugd->main_layout;
@@ -209,6 +217,9 @@ static void *on_create(ui_gadget_h ug, enum ug_mode mode, service_h data, void *
                        if (NULL != ugd->existing_mail_info->mail_data->file_path_html) {
                                debug_log("original html file path(%s)", ugd->existing_mail_info->mail_data->file_path_html);
                        }
+
+                       debug_log("account_id:%d, original account_id:%d", ugd->account_info->account_id, ugd->existing_mail_info->mail_data->account_id);
+                       ugd->account_info->account_id = ugd->existing_mail_info->mail_data->account_id;
                }
 
                if (ugd->account_info->account_count > 0) {
@@ -254,6 +265,12 @@ static void on_start(ui_gadget_h ug, service_h data, void *priv)
        if (ugd->eComposerErrorType != COMPOSER_ERROR_NONE) {
 
                switch (ugd->eComposerErrorType) {
+                       case COMPOSER_ERROR_STORAGE_FULL:
+                               debug_log("Storage full error");
+                               _composer_popup_warning(ugd, dgettext("sys_string", "IDS_COM_POP_WARNING"), N_("Storage full"));
+                               elm_object_style_set(ugd->bg, "transparent");
+                               break;
+
                        case COMPOSER_ERROR_ENGINE_INIT_FAILED:
                                debug_log("Failed to initialize email engine");
                                _composer_popup_warning(ugd, dgettext("sys_string", "IDS_COM_POP_WARNING"), _("IDS_EMAIL_POP_FAILED_TO_START_EMAIL_APPLICATION"));
@@ -347,6 +364,7 @@ static void on_destroy(ui_gadget_h ug, service_h data, void *priv)
 {
        debug_log("");
        EmailComposerUGD *ugd;
+       service_h reply_service;
 
        if (!ug || !priv)
                return;
@@ -355,6 +373,16 @@ static void on_destroy(ui_gadget_h ug, service_h data, void *priv)
 
        int ret = 0;
 
+       ret = service_create(&reply_service);
+       debug_log("service_create: %d", ret);
+       if (!reply_service) {
+               debug_log("service create failed");
+       }
+       ret = service_reply_to_launch_request(reply_service, data, SERVICE_RESULT_SUCCEEDED);
+       debug_log("service_reply_to_launch_request: %d", ret);
+       ret = service_destroy(reply_service);
+       debug_log("service_destroy: %d", ret);
+
        ethumb_shutdown();
 
        debug_log("contact service end");
@@ -626,6 +654,30 @@ static Evas_Object *create_frameview(Evas_Object *parent, EmailComposerUGD *ugd)
        return base;
 }
 
+static int _composer_check_storage_full(char *path, int mb_size)
+{
+       debug_enter();
+
+       int ret = false;
+       struct statfs buf = { 0 };
+
+       debug_log("path(%s)", path);
+       if (statfs(path, &buf) == -1) {
+               debug_error("statfs Error: errno(%d), errmsg(%s)", errno, strerror(errno));
+               ret = false;
+       } else {
+               long i_free = (buf.f_bfree * buf.f_bsize) / (1024 * 1024);
+               debug_log("f_bfree[%d], f_bsize[%d]", buf.f_bfree, buf.f_bsize);
+               debug_log("Free space: [%ld]MB. Required min space: [%d]MB.", i_free, mb_size);
+               if (i_free < mb_size) { //Limited size is 5MB
+                       ret = true;
+                       debug_log("Storage is almost full.");
+               }
+       }
+
+       return ret;
+}
+
 static void _win_profile_changed_cb(void *data, Evas_Object *obj, void *event)
 {
        debug_log("");
index f885f16..cf7b32f 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       org.tizen.email
 Summary:    email application
-Version:    0.0.8
+Version:    0.0.7
 Release:    1
 Group:      devel
 License:    Flora
index 84eee84..a34835c 100755 (executable)
@@ -152,7 +152,6 @@ static void _set_status(EmailViewerProp *prop, email_mail_data_t *mail_info)
                return;
        }
 
-#if 0
        if (mail_info->flags_answered_field) {
                prop->status |= EMAIL_STATUS_REPLY;
                debug_log("status - set reply");
@@ -162,7 +161,6 @@ static void _set_status(EmailViewerProp *prop, email_mail_data_t *mail_info)
                prop->status |= EMAIL_STATUS_FORWARD;
                debug_log("status - set forward");
        }
-#endif
 
        prop->status2 = mail_info->save_status;
        debug_log("status2 (%d)", prop->status2);