Applied the latest codes
authorjc47.park <jc47.park@samsung.com>
Thu, 6 Dec 2012 14:52:11 +0000 (23:52 +0900)
committerjc47.park <jc47.park@samsung.com>
Thu, 6 Dec 2012 14:52:11 +0000 (23:52 +0900)
32 files changed:
account/CMakeLists.txt
account/src/email-account-folder.c
account/src/email-account.c
common/CMakeLists.txt
common/include/email-common-types.h
common/include/email-utils.h
common/src/email-utils.c
composer/CMakeLists.txt
composer/include/email-composer-attachment.h
composer/include/email-composer-contents.h
composer/include/email-composer-js.h
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-recipient.c
composer/src/email-composer-util.c
composer/src/email-composer.c
images/M02_icon_favorite_off_74x74.png [new file with mode: 0755]
images/M02_icon_favorite_on_74x74.png [new file with mode: 0755]
mailbox/CMakeLists.txt
main/CMakeLists.txt
main/email.c
packaging/org.tizen.email.spec
setting/src/email-view-account-edit.c
viewer/CMakeLists.txt
viewer/include/email-viewer.h
viewer/src/email-viewer-utils.c
viewer/src/email-viewer-webview.c
viewer/src/email-viewer.c

index 41a99bc..7466f16 100755 (executable)
@@ -18,7 +18,7 @@ INCLUDE_DIRECTORIES(${CMAKE_ACCOUNT_SOURCE_DIR}/include)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/include)\r
 \r
 INCLUDE(FindPkgConfig)\r
-pkg_check_modules(pkgs-account REQUIRED appcore-efl ui-gadget-1 x11 elementary email-service bundle dlog capi-appfw-application status)\r
+pkg_check_modules(pkgs-account REQUIRED appcore-efl ui-gadget-1 x11 elementary email-service bundle dlog capi-appfw-application status contacts-service2)\r
 \r
 FOREACH(flag ${pkgs-account_CFLAGS})\r
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")\r
index 6865c97..2ea72c9 100755 (executable)
@@ -183,8 +183,6 @@ Evas_Object *create_fullview(EmailAccountUGD *ug_data)
        ug_data->sub_ly = elm_layout_add(ug_data->win);
        elm_layout_theme_set(ug_data->sub_ly, "layout", "application", "noindicator");
        evas_object_size_hint_weight_set(ug_data->sub_ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       /*elm_win_resize_object_add(ug_data->win, ug_data->sub_ly);*/
-
 #if 0  // 2line title text
        // push the content to naviframe.
        ug_data->navibar_item = elm_naviframe_item_push(ug_data->navi_bar, NULL, b_btn, NULL, ug_data->sub_ly, "empty");
index 5829de8..3cd0d10 100755 (executable)
@@ -334,7 +334,6 @@ static Evas_Object *create_frameview(EmailAccountUGD * ug_data)
 
        ug_data->bg = elm_bg_add(ug_data->win);
        evas_object_size_hint_weight_set(ug_data->bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_win_resize_object_add(ug_data->win, ug_data->bg);
        evas_object_show(ug_data->bg);
 
        ug_data->ly = elm_layout_add(ug_data->win);
index 03ef47b..6fbbb02 100755 (executable)
@@ -19,7 +19,7 @@ INCLUDE_DIRECTORIES(${CMAKE_COMMON_SOURCE_DIR}/include)
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(pkgs-common REQUIRED ecore ecore-imf appcore-common glib-2.0 gobject-2.0 email-service
-       capi-content-media-content dlog db-util elementary efreet-mime drm-client ecore-x sysman vconf evas eina edje icu-i18n ui-gadget-1)
+       contacts-service2 capi-content-media-content dlog db-util elementary efreet-mime drm-client ecore-x sysman vconf evas eina edje icu-i18n ui-gadget-1)
 
 FOREACH(flag ${pkgs-common_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index 4f8e15f..f8cf57e 100755 (executable)
@@ -37,6 +37,7 @@
 #define EMAIL_BUNDLE_KEY_MAILBOX                       "MAILBOX_ID"
 #define EMAIL_BUNDLE_KEY_MAILBOX_ALIAS         "MAILBOX_ALIAS"
 #define EMAIL_BUNDLE_KEY_USER_EMAIL            "USER_EMAIL"
+#define EMAIL_BUNDLE_KEY_UPDATE                        "UPDATE"
 #define EMAIL_BUNDLE_KEY_SAVE_ALL                      "SAVE_ALL"
 #define EMAIL_BUNDLE_KEY_CANCEL_ALL                    "CANCEL_ALL"
 #define EMAIL_BUNDLE_KEY_VIEW_TYPE                     "VIEW_TYPE"
@@ -72,6 +73,7 @@
 #define UG_NAME_EMAIL_ACCOUNT          "email-account-efl"
 #define UG_NAME_EMAIL_DOCUMENT         "email-docsearch-efl"
 #define UG_NAME_CONTACT                        "contacts-tabui-efl"
+#define UG_NAME_MESSAGE_COMPOSER       "msg-composer-efl"
 
 /* define bundle value */
 #define EMAIL_BUNDLE_VAL_ALL_ACCOUNT                   "ALL_ACCOUNT"
index 01f024f..4d9f3e2 100755 (executable)
@@ -32,6 +32,7 @@
 #include <unicode/udat.h>
 #include <unicode/udatpg.h>
 #include <unicode/ustring.h>
+#include <contacts.h>
 
 #define MAX_DEFAULT_DIR_PATH 256
 
@@ -161,6 +162,29 @@ int get_app_paused();
 char* email_util_strrtrim(char* s);
 char* email_util_strltrim(char* s);
 char* email_util_get_parent_folder(char *s);
+
+/*
+ * Contact service2
+ */
+ typedef struct _EMAIL_CONTACT_LIST_INFO_S {
+       int index;
+       char *display;
+       char *email_address;
+       char *image_path;
+       char display_name[234]; //MAX_RECIPIENT_ADDRESS_LEN
+       void *ugd;
+} EMAIL_CONTACT_LIST_INFO_S;
+
+int email_get_contacts_list(contacts_match_str_flag_e match, contacts_list_h *list, const char *search_word);
+int email_get_contacts_index(contacts_record_h record, int *index);
+int email_get_contacts_display_name(contacts_record_h record, char *display_name);
+int email_get_contacts_email_address(contacts_record_h record, char *email_addr);
+int email_get_contacts_image_thumbnail_path(contacts_record_h record, char *image_thumbnail_path);
+int email_get_contacts_first_name(contacts_record_h record, char *first_name);
+int email_get_contacts_last_name(contacts_record_h record, char *last_name);
+int email_get_contacts_list_info(contacts_list_h list, EMAIL_CONTACT_LIST_INFO_S *contact_list_info);
+int email_num_id_get_contacts_record(int num_id, contacts_record_h* out_record);
+
 G_END_DECLS
 #endif /* _EMAIL_UTILS_H_ */
 
index b10c2c5..d66632c 100755 (executable)
@@ -963,7 +963,9 @@ static gboolean _copy_actual_file(const char *src_full_path, const char *dest_fu
        fclose(fs);
 
        if (remove_dest && result == FALSE) {
-               remove(dest_full_path);
+               if (-1 == remove(dest_full_path)) {
+                       debug_log("Failed to remove dest_full_path");
+               }
                sync();
        }
 
@@ -1001,7 +1003,7 @@ gboolean email_drm_file_forward_lock_check(const gchar *path)
 
        drm_file_info_s drm_info;
 
-       memset(&drm_info, 0, sizeof(drm_file_info_s));
+//     memset(&drm_info, 0, sizeof(drm_file_info_s));
 
        if (drm_get_file_info(path, &drm_info)) {
                debug_log("drm_info.oma_info.method (%d)", drm_info.oma_info.method);
@@ -1045,17 +1047,14 @@ int get_app_paused()
 
 char* email_util_strrtrim(char* s)
 {
-       char t[MAX_STR_LEN];
        char *end;
 
-       strcpy(t, s);
-       end = t + strlen(t) - 1;
-       while (end != t && isspace(*end))
+       end = s + strlen(s) - 1;
+       while (end != s && isspace(*end))
        {
                end--;
        }
        *(end + 1) = '\0';
-       s = t;
 
        debug_log("result [%s]", s);
        return s;
@@ -1130,4 +1129,170 @@ int email_deregister_timezone_changed_callback(void *func)
        }
        return 0;
 }
+
+/* Contact service2 */
+int email_get_contacts_list(contacts_match_str_flag_e match, contacts_list_h *list, const char *search_word)
+{
+       debug_log("");
+
+       int ct_ret = CONTACTS_ERROR_NONE;
+
+       contacts_query_h query = NULL;
+       contacts_filter_h filter = NULL;
+       debug_log("search_word = %s", search_word);
+
+       /* get number list first */
+       ct_ret = contacts_query_create(_contacts_contact_email._uri, &query);
+       ct_ret = contacts_filter_create(_contacts_contact_email._uri, &filter);
+       ct_ret = contacts_filter_add_str(filter, _contacts_contact_email.email, match, search_word);
+       ct_ret = contacts_query_set_filter(query, filter);
+
+       ct_ret = contacts_db_get_records_with_query(query, 0, 0, list);
+       ct_ret = contacts_filter_destroy(filter);
+       ct_ret = contacts_query_destroy(query);
+
+       if (ct_ret != CONTACTS_ERROR_NONE) {
+               debug_log("contacts_db_get_records_with_query is failed error_code = %d", ct_ret);
+       }
+       return ct_ret;
+}
+
+int email_get_contacts_index(contacts_record_h record, int *index)
+{
+       debug_log("");
+       int ct_ret = CONTACTS_ERROR_NONE;
+       ct_ret = contacts_record_get_int(record, _contacts_contact_email.contact_id, index);
+       return ct_ret;
+}
+
+int email_get_contacts_display_name(contacts_record_h record, char *display_name)
+{
+       debug_log("");
+       int ct_ret = CONTACTS_ERROR_NONE;
+       ct_ret = contacts_record_get_str_p(record, _contacts_contact_email.display_name, &display_name);
+//     contacts_list_item->display = g_strdup(display_name);
+       return ct_ret;
+}
+
+int email_get_contacts_email_address(contacts_record_h record, char *email_addr)
+{
+       debug_log("");
+       int ct_ret = CONTACTS_ERROR_NONE;
+       ct_ret = contacts_record_get_str_p(record, _contacts_contact_email.email, &email_addr);
+//     contacts_list_item->email_address = g_strdup(email_addr);
+       return ct_ret;
+}
+
+int email_get_contacts_image_thumbnail_path(contacts_record_h record, char *image_thumbnail_path)
+{
+       debug_log("");
+       int ct_ret = CONTACTS_ERROR_NONE;
+       ct_ret = contacts_record_get_str_p(record, _contacts_contact_email.image_thumbnail_path, &image_thumbnail_path);
+//     contacts_list_item->image_path = g_strdup(image_path);
+       return ct_ret;
+}
+
+int email_get_contacts_first_name(contacts_record_h record, char *first_name)
+{
+       debug_log("");
+       int ct_ret = CONTACTS_ERROR_NONE;
+       ct_ret = contacts_record_get_str_p(record, _contacts_name.first, &first_name);
+//     contacts_list_item->image_path = g_strdup(first_name);
+       return ct_ret;
+}
+
+int email_get_contacts_last_name(contacts_record_h record, char *last_name)
+{
+       debug_log("");
+       int ct_ret = CONTACTS_ERROR_NONE;
+       ct_ret = contacts_record_get_str_p(record, _contacts_name.last, &last_name);
+//     contacts_list_item->image_path = g_strdup(last_name);
+       return ct_ret;
+}
+
+int email_get_contacts_list_info(contacts_list_h list, EMAIL_CONTACT_LIST_INFO_S *ct_list_info)
+{
+       debug_log("");
+       int index = 0;
+       int ct_ret = CONTACTS_ERROR_NONE;
+
+       while (CONTACTS_ERROR_NONE == ct_ret) {
+               contacts_record_h ct_value = NULL;
+               contacts_list_get_current_record_p(list, &ct_value);
+               debug_log("ct_ret = %d", ct_ret);
+               debug_log("ct_value = %d", (ct_value == NULL));
+               if (ct_value) {
+                       ct_ret = contacts_record_get_int(ct_value, _contacts_contact_email.contact_id, &index);
+                       if (index > 0) {
+                               char *display_name = NULL;
+                               char *image_path = NULL;
+                               char *email_addr = NULL;
+
+                               ct_list_info->index = index;
+                               if ((ct_ret = contacts_record_get_str_p(ct_value, _contacts_contact_email.display_name, &display_name)) == CONTACTS_ERROR_NONE) {
+                                       if (display_name != NULL) {
+                                               ct_list_info->display = g_strdup(display_name);
+                                       }
+                               } else {
+                                       debug_log("email_get_contacts_display_name is failed error_code = %d", ct_ret);
+                               }
+
+                               if ((ct_ret = contacts_record_get_str_p(ct_value, _contacts_contact_email.image_thumbnail_path, &image_path)) == CONTACTS_ERROR_NONE) {
+                                       if (image_path != NULL) {
+                                               ct_list_info->image_path = g_strdup(image_path);
+                                       }
+                               } else {
+                                       debug_log("email_get_contacts_image_thumbnail_path is failed error_code = %d", ct_ret);
+                               }
+
+                               if ((ct_ret = contacts_record_get_str_p(ct_value, _contacts_contact_email.email, &email_addr)) == CONTACTS_ERROR_NONE){
+//                             if ((ct_ret = email_get_contacts_email_address(ct_value, &email_addr)) == CONTACTS_ERROR_NONE) {
+                                       if (email_addr != NULL) {
+                                               ct_list_info->email_address = g_strdup(email_addr);
+                                       }
+                               } else {
+                                       debug_log("email_get_contacts_email_address is failed error_code = %d", ct_ret);
+                               }
+
+                               if (!ct_list_info->display && email_addr) {
+                                       strncpy(ct_list_info->display_name, email_addr, sizeof(ct_list_info->display_name) - 1);
+                                       //display_name = g_strdup(email_addr);
+                               } else {
+                                       if (strlen(ct_list_info->display) > 0) {
+                                               snprintf(ct_list_info->display_name, sizeof(ct_list_info->display_name), "%s", ct_list_info->display);
+                                       }
+                               }
+
+                               debug_log("index(%d), display(%s), image_path(%s), email(%s), display_name(%s)",
+                                       index, ct_list_info->display, ct_list_info->image_path, ct_list_info->email_address, ct_list_info->display_name);
+
+                               return ct_ret;
+                       }
+               }
+               ct_ret = contacts_list_next(list);
+       }
+       return ct_ret;
+}
+
+int email_num_id_get_contacts_record(int num_id, contacts_record_h* out_record)
+{
+       debug_log("");
+       int ct_ret = CONTACTS_ERROR_NONE;
+
+       /* get record email */
+       ct_ret = contacts_db_get_record(_contacts_contact_email._uri, num_id, out_record);
+       if (ct_ret != CONTACTS_ERROR_NONE) {
+               debug_log("_contacts_number, db_get_record is failed : ct_ret = [%d]", ct_ret);
+               return ct_ret;
+       }
+#if 0
+       /* get number str */
+       ct_ret = contacts_record_get_str_p(out_record, _contacts_contact_email.number, &number_str);
+       if (ct_ret != CONTACTS_ERROR_NONE) {
+               D_EMSG("contacts_record_get_str_p is failed : ct_ret = [%d]", ct_ret);
+               goto ERROR_EXIT;
+       }
+#endif
+       return ct_ret;
+}
 /* EOF */
index 695fead..80d5088 100755 (executable)
@@ -25,7 +25,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/include)
 INCLUDE(FindPkgConfig)
 pkg_check_modules(pkgs-composer REQUIRED ecore ecore-file glib-2.0 gobject-2.0 edbus
                                        appcore-common elementary capi-appfw-application capi-media-metadata-extractor capi-media-image-util status
-                                       sysman dlog email-service contacts-service
+                                       sysman dlog email-service contacts-service2
                                        efreet-mime ewebkit2 ui-gadget-1 bundle ethumb ecore-x)
 
 FOREACH(flag ${pkgs-composer_CFLAGS})
index 1de0005..11c3a65 100755 (executable)
@@ -23,6 +23,7 @@ void _composer_attachment_create_list(EmailComposerUGD *ugd, Eina_List *list, Ei
 void _composer_attachment_reset(EmailComposerUGD *ugd);
 int _composer_get_inline_images_size(EmailComposerUGD *ugd);
 void _composer_attachment_create_list_box(EmailComposerUGD *ugd, email_attachment_data_t *attachment_data);
+void _composer_attachment_update_thumbnail(EmailComposerUGD *ugd, Evas_Object *parent, char *filePath);
 void _composer_attachment_add_thumbnail(EmailComposerUGD *ugd, Evas_Object *parent, char *filePath);
 Evas_Object *_composer_attachment_add_delete_icon(EmailComposerUGD *ugd, Evas_Object *parent);
 void _composer_attachment_add_filename(EmailComposerUGD *ugd, email_attachment_data_t * attachment_data, Evas_Object *parent);
index d04414f..8e0e075 100755 (executable)
@@ -25,5 +25,5 @@ void _composer_create_body_field(Evas_Object *parent, EmailComposerUGD *ugd);
 Evas_Object *_composer_create_subject_editfield(Evas_Object *parent, char *title, EmailComposerUGD *ugd);
 Evas_Object *_composer_create_body_webview(Evas_Object *parent, char *title, EmailComposerUGD *ugd);
 void _composer_register_editfield_entry_callback(Evas_Object *obj, EmailComposerUGD *ugd);
-
+void _composer_webkit_set_body_script(void *data);
 #endif                         /* __EMAIL_COMPOSER_CONTENTS_H__ */
index 769d929..6e31e42 100755 (executable)
                "var imgs = document.getElementsByTagName(\"img\");" \
                "var srcs = \"\";" \
                "for (var i = 0; i < imgs.length; i++) {" \
-                       "srcs += imgs[i].src + \",\" ;" \
-                       "console.log(\"imgs[\" + i + \"].src : \" + imgs[i].src);" \
-                       "console.log(\"srcs : \" + srcs);" \
+                       "srcs += \"file://\" + imgs[i].getAttribute(\"src\") + \",\" ;" \
+                       "console.log(\"1.imgs[\" + i + \"].src : \" + imgs[i].src);" \
+                       "console.log(\"2.imgs[\" + i + \"].getAttribute(src) : \" + imgs[i].getAttribute(\"src\"));" \
+                       "console.log(\"3.srcs : \" + srcs);" \
                "}" \
                "return srcs;" \
        "};" \
index a96cf09..e273c4f 100755 (executable)
@@ -30,9 +30,9 @@ void _composer_popup_add(EmailComposerUGD *ugd, int type, char *text);
 void _composer_popup_end(EmailComposerUGD *ugd, int close_sg);
 void _composer_set_mail_info(EmailComposerUGD *ugd);
 
-int _composer_add_mailbox_folder(EmailComposerUGD *ugd, email_mailbox_type_e mailbox_type);
-int _composer_move_mailbox_folder(EmailComposerUGD *ugd, email_mailbox_type_e mailbox_type);
-int _composer_make_mail(EmailComposerUGD *ugd);
+int _composer_add_mailbox_folder(EmailComposerUGD *ugd, email_mailbox_type_e mailbox_type, Eina_Bool b_save_to_draft);
+int _composer_move_mailbox_folder(EmailComposerUGD *ugd, email_mailbox_type_e mailbox_type, Eina_Bool b_save_to_draft);
+int _composer_make_mail(EmailComposerUGD *ugd, Eina_Bool b_save_to_draft);
 int _composer_send_mail(EmailComposerUGD *ugd);
 int _composer_make_recipient_char_to_list(EmailComposerUGD *ugd, Evas_Object *obj, char **dest);
 
@@ -44,7 +44,7 @@ EmailRecpInfo *_composer_separate_save_recipient_char(EmailComposerUGD *ugd, cha
 
 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);
-Evas_Object *_composer_create_navigation_layout(Evas_Object *parent);
+Evas_Object *_composer_create_navigation_layout(EmailComposerUGD *ugd);
 Evas_Object *_composer_create_composer_layout(Evas_Object *parent);
 Evas_Object *_composer_create_outer_layout(Evas_Object *parent);
 Evas_Object *_composer_create_main_scroller(Evas_Object *parent);
@@ -105,6 +105,7 @@ Eina_Bool _composer_check_popup_exist(EmailComposerUGD *ugd);
 
 void _composer_resize_body_webview(EmailComposerUGD *ugd, int resize_height);
 
+void _composer_input_panel_resize_cb(void *data, Ecore_IMF_Context *ctx, int value);
 void _composer_input_panel_state_changed_cb(void *data, Ecore_IMF_Context *ctx, int value);
 void _composer_display_position(void *data);
 
index e3ed81a..61150fd 100755 (executable)
 #define COMPOSER_ICON_DIR IMGDIR
 
 #define COMPOSER_NAVI_HEIGHT 98 //108
+#define COMPOSER_INDI_HEIGHT 76
 #define COMPOSER_IME_HEIGHT_V 444
 #define COMPOSER_IME_HEIGHT_H 316
+#define COMPOSER_IME_PREDICTION_H 84
 
 #define COMPOSER_SP_H 10
 #define COMPOSER_EDIT_FIELD_H 80
@@ -77,7 +79,6 @@ struct ug_data {
        Elm_Object_Item *navi_item;
        Evas_Object *main_scroller;
        Evas_Object *c_layout;
-       Evas_Object *conform;
 
        Evas_Object *to_ly;
        Evas_Object *cc_ly;
@@ -96,7 +97,7 @@ struct ug_data {
        bool bcc_added;
        bool me_added;
 
-       int indicator_height;
+       Eina_Bool is_prediction;
        bool is_main_scroller_scrolling;
        bool is_webview_scrolling;
 
@@ -225,8 +226,9 @@ struct ug_data {
        Ecore_IMF_Context *imf_context;
 
        Evas_Object *account_gen_list;
-
+       bool b_launch_finished;
        bool isRotated;
+       bool isHorizontal;
 
        bool b_cc_bcc;
        bool clipboard_on;
@@ -237,17 +239,9 @@ struct ug_data {
        Eina_List *listOfImageUrls;
 
        Eina_Bool b_load_finished;
+       Eina_Bool need_download;
 };
 
-typedef struct _EMAIL_CONTACT_LIST_INFO_S {
-       int index;
-       char *display;
-       char *email_address;
-       char *image_path;
-       char display_name[MAX_RECIPIENT_ADDRESS_LEN];
-       EmailComposerUGD *ugd;
-} EMAIL_CONTACT_LIST_INFO_S;
-
 typedef struct _EMAIL_ATTACHMENT_INFO_S {
        int mail_id;
        int attach_id;
index 28a72c1..247565d 100755 (executable)
 #include "email-composer-recipient.h"
 #include "email-composer-js.h"
 
+#ifdef _ATTACHMENT_UI_
+static int toggle = 0;
+static Evas_Object *_g_attach_btn;
+#endif
 EmailComposerUGD *g_ugd;
 
 static void _composer_attachment_delete_icon_clicked_cb(void *data, Evas_Object *obj, void *event_info);
+#ifdef _ATTACHMENT_UI_
+static void _composer_attachment_contracted_item_clicked_cb(void *data, Evas_Object *obj, void *event_info);
+#else
 static void _composer_attachment_delete_all_icon_clicked_cb(void *data, Evas_Object *obj, void *event_info);
 static void _composer_attachment_contracted_item_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
+#endif
 static void _composer_attachment_unfocus(void *data, Evas_Object *obj, const char *emission, const char *source);
 static void _composer_attachment_mouse_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
 
@@ -70,6 +78,7 @@ int _composer_get_attachments_total_size(EmailComposerUGD *ugd)
 
                        if ((return_stat = stat(attachment_data->attachment_path, &file_info)) == -1) {
                                debug_error("stat Error(%d): %s", errno, strerror(errno));
+                               attach_size += attachment_data->attachment_size;
                                continue;
 //                             return COMPOSER_ERROR_INVALID_FILE;
                        }
@@ -397,13 +406,16 @@ void _composer_attachment_create_list(EmailComposerUGD *ugd, Eina_List *attachme
 
        eina_list_free(attachment_list);
        attachment_list = NULL;
+#ifdef _ATTACHMENT_UI_
+       _composer_attachment_contract_items(ugd);
+#endif
 }
 
 void _composer_attachment_create_list_box(EmailComposerUGD *ugd, email_attachment_data_t *attachment_data)
 {
-       debug_log("file name: %s", attachment_data->attachment_path);
+       debug_log("file path: %s", attachment_data->attachment_path);
 
-       if (attachment_data->attachment_path) {
+//     if (attachment_data->attachment_path) {
                if (attachment_data->inline_content_status == EINA_FALSE) {
                        g_ugd = ugd;
 
@@ -434,7 +446,9 @@ void _composer_attachment_create_list_box(EmailComposerUGD *ugd, email_attachmen
                        ugd->attachment_item_obj_list = eina_list_append(ugd->attachment_item_obj_list, attachment_base);
                        _composer_attachment_set_attach_data(ugd, attachment_base, attachment_data);
 
-                       edje_object_signal_callback_add(_EDJ(attachment_item), "clicked", "*", _composer_attachment_mouse_clicked, attachment_data);
+                       if (attachment_data->attachment_path) {
+                               edje_object_signal_callback_add(_EDJ(attachment_item), "clicked", "*", _composer_attachment_mouse_clicked, attachment_data);
+                       }
                        edje_object_signal_callback_add(_EDJ(attachment_item), "clicked", "*", _composer_attachment_unfocus, ugd);
                } else {
                        Evas_Object *attachment_base = elm_layout_add(ugd->attachment_item_box);
@@ -442,9 +456,47 @@ void _composer_attachment_create_list_box(EmailComposerUGD *ugd, email_attachmen
                        ugd->attachment_item_obj_list = eina_list_append(ugd->attachment_item_obj_list, attachment_base);
                        _composer_attachment_set_attach_data(ugd, attachment_base, attachment_data);
                }
+//     }
+}
+
+void _composer_attachment_update_thumbnail(EmailComposerUGD *ugd, Evas_Object *parent, char *filePath)
+{
+       debug_log("");
+
+       Evas_Object *thumb_nail;
+       const char *path = NULL;
+
+       thumb_nail = elm_object_part_content_get(parent, "attachment.thumbnail.icon");
+
+       if (thumb_nail != NULL) {
+               evas_object_del(thumb_nail);
+               thumb_nail = NULL;
        }
 
-       _composer_attachment_expand_items(ugd);
+       if (ugd->attachment_list_compressed) {
+               thumb_nail = elm_icon_add(parent);
+
+               path = g_strdup(COMPOSER_ICON_DIR "/05_email_icon_attach_40x40.png");
+               debug_log("path = %s", path);
+               elm_icon_file_set(thumb_nail, path, NULL);
+       } else {
+               if (!filePath) {
+                       debug_log("savename = %s", filePath);
+
+                       thumb_nail = elm_icon_add(parent);
+
+                       path = g_strdup(MYFILE_IMGE_PATH "/myfile_icon_etc.png");
+                       elm_icon_file_set(thumb_nail, path, NULL);
+               } else {
+                       thumb_nail = _composer_attachment_make_thumbnail(ugd, filePath, parent);
+               }
+       }
+
+       elm_object_part_content_set(parent, "attachment.thumbnail.icon", thumb_nail);
+       evas_object_show(thumb_nail);
+
+       if (path)
+               g_free((char *)path);
 }
 
 void _composer_attachment_add_thumbnail(EmailComposerUGD *ugd, Evas_Object *parent, char *filePath)
@@ -485,17 +537,30 @@ Evas_Object *_composer_attachment_add_delete_icon(EmailComposerUGD *ugd, Evas_Ob
        debug_log("");
 
        Evas_Object *delete_icon = elm_button_add(parent);
+       evas_object_show(delete_icon);
+#ifdef _ATTACHMENT_UI_
+       if (ugd->attachment_list_compressed) {
+               _g_attach_btn = delete_icon;
+               elm_object_style_set(delete_icon, "expand/closed");
+               elm_object_part_content_set(parent, "attachment.delete.icon", delete_icon);
+               toggle = 0;
+               evas_object_smart_callback_add(delete_icon, "clicked", _composer_attachment_contracted_item_clicked_cb, ugd);
+       } else {
+               elm_object_style_set(delete_icon, "minus");
+               elm_object_part_content_set(parent, "attachment.delete.icon", delete_icon);
+
+               evas_object_smart_callback_add(delete_icon, "clicked", _composer_attachment_delete_icon_clicked_cb, ugd);
+       }
+#else
        elm_object_style_set(delete_icon, "minus");
 //     elm_object_focus_allow_set(delete_icon, EINA_TRUE);
        elm_object_part_content_set(parent, "attachment.delete.icon", delete_icon);
 
-       evas_object_show(delete_icon);
-
        if (ugd->attachment_list_compressed)
                evas_object_smart_callback_add(delete_icon, "clicked", _composer_attachment_delete_all_icon_clicked_cb, ugd);
        else
                evas_object_smart_callback_add(delete_icon, "clicked", _composer_attachment_delete_icon_clicked_cb, ugd);
-
+#endif
        return delete_icon;
 }
 
@@ -815,6 +880,35 @@ void _composer_attachment_set_attach_data(EmailComposerUGD *ugd, Evas_Object *pa
        evas_object_data_set(parent, "attachment_data", attachment_data);
 }
 
+static void _composer_attachment_delete_item_from_fw_attachment_list(EmailComposerUGD *ugd, email_attachment_data_t *attachment_data)
+{
+       debug_log("");
+       int i = 0;
+       if(ugd == NULL) {
+               debug_log("ugd == NULL");
+               return;
+       }
+       debug_log("1. %d", g_list_length(ugd->fw_attachment_list));
+
+       for (i = 0; i < g_list_length(ugd->fw_attachment_list); ++i) {
+               EMAIL_ATTACHMENT_INFO_S *info = (EMAIL_ATTACHMENT_INFO_S *) g_list_nth_data(ugd->fw_attachment_list, i);
+               debug_log("%x", info);
+               if (info) {
+                       debug_log("%d , %d", info->attach_id, attachment_data->attachment_id);
+                       if (info->attach_id == attachment_data->attachment_id) {
+                               //info->downloaded = true;
+                               //info->path = email_engine_get_attachment_path(info->attach_id);
+                               ugd->fw_attachment_list = g_list_remove(ugd->fw_attachment_list, info);
+                               debug_log("2. %d", g_list_length(ugd->fw_attachment_list));
+                               ugd->fw_dn_cnt = g_list_length(ugd->fw_attachment_list);
+                       }
+               }
+       }
+
+       if (ugd->fw_dn_cnt == 0)
+               ugd->need_download = EINA_FALSE;
+}
+
 static void _composer_attachment_delete_icon_clicked_cb(void *data, Evas_Object *obj, void *event_info)
 {
        debug_log("");
@@ -839,23 +933,47 @@ static void _composer_attachment_delete_icon_clicked_cb(void *data, Evas_Object
        email_attachment_data_t *attachment_data = NULL;
        attachment_data = evas_object_data_get(object, "attachment_data");
 
-       if (attachment_data) {
-               debug_log("attachment_data file name = %s", attachment_data->attachment_path);
-
-               email_free_attachment_data(&attachment_data, 1);
-               attachment_data = NULL;
-       }
+       _composer_attachment_delete_item_from_fw_attachment_list(ugd, attachment_data);
 
        elm_box_unpack(ugd->attachment_item_box, object);
        evas_object_del(object);
 
+#ifdef _ATTACHMENT_UI_
+       if (ugd->attachment_contracted_item) {
+               Evas_Object *contracted_item = evas_object_data_get(ugd->attachment_contracted_item, "attachment_item");
+               debug_log("contracted_item = %p", contracted_item);
+               if (eina_list_count(ugd->attachment_item_obj_list) < 2) {
+                       elm_box_unpack(ugd->attachment_item_box, ugd->attachment_contracted_item);
+                       evas_object_del(ugd->attachment_contracted_item);
+                       ugd->attachment_contracted_item = NULL;
+                       ugd->attachment_list_compressed = FALSE;
+                       _composer_attachment_add_filename(ugd, attachment_data, contracted_item);
+               } else {
+                       ugd->attachment_list_compressed = TRUE;
+                       _composer_attachment_add_filename(ugd, attachment_data, contracted_item);
+                       ugd->attachment_list_compressed = FALSE;
+               }
+       }
+#endif
        if (ugd->attachment_item_obj_list == NULL) {
                ugd->selected_entry = ugd->priv_selected_entry;
                ugd->priv_selected_entry = NULL;
        }
+
+       if (attachment_data) {
+               debug_log("attachment_data file name = %s", attachment_data->attachment_path);
+
+               email_free_attachment_data(&attachment_data, 1);
+               attachment_data = NULL;
+       }
        _composer_mbe_set_focus(ugd);
+#ifdef _ATTACHMENT_UI_
+       elm_box_recalculate(ugd->attachment_item_box);
+       elm_layout_sizing_eval(ugd->main_layout);
+#endif
 }
 
+#ifndef _ATTACHMENT_UI_
 static void _composer_attachment_delete_all_icon_clicked_cb(void *data, Evas_Object *obj, void *event_info)
 {
        debug_log("");
@@ -928,6 +1046,7 @@ static void _composer_attachment_delete_all_icon_clicked_cb(void *data, Evas_Obj
                _composer_mbe_set_focus(ugd);
        }
 }
+#endif
 
 bool _composer_attachment_duplicate_check(EmailComposerUGD *ugd, char *pszAttachedFilePath)
 {
@@ -939,19 +1058,21 @@ bool _composer_attachment_duplicate_check(EmailComposerUGD *ugd, char *pszAttach
        bool bDuplicated = FALSE;
 
        Eina_Iterator *it = NULL;
-       Evas_Object *obj = NULL;
+       Evas_Object *attachment_obj = NULL;
        email_attachment_data_t *attachment_data = NULL;
 
        it = eina_list_iterator_new(ugd->attachment_item_obj_list);
 
-       while (eina_iterator_next(it, (void **)&obj)) {
-               attachment_data = evas_object_data_get(obj, "attachment_data");
-               debug_log("attachment_data->attachment_path = %s", attachment_data->attachment_path);
+       while (eina_iterator_next(it, (void **)&attachment_obj)) {
+               attachment_data = evas_object_data_get(attachment_obj, "attachment_data");
 
-               if (strcmp(pszAttachedFilePath, attachment_data->attachment_path) == 0) {
-                       debug_log("Attached file path is duplicated");
-                       bDuplicated = TRUE;
-                       break;
+               debug_log("attachment_data->attachment_path = %s", attachment_data->attachment_path);
+               if (attachment_data->attachment_path != NULL) {
+                       if (strcmp(pszAttachedFilePath, attachment_data->attachment_path) == 0) {
+                               debug_log("Attached file path is duplicated");
+                               bDuplicated = TRUE;
+                               break;
+                       }
                }
        }
 
@@ -968,12 +1089,12 @@ void _composer_attachment_expand_items(EmailComposerUGD *ugd)
 
        if (ugd->attachment_list_compressed == EINA_FALSE)
                return;
-
+#ifndef _ATTACHMENT_UI_
        if (ugd->attachment_contracted_item) {
                elm_box_unpack(ugd->attachment_item_box, ugd->attachment_contracted_item);
                evas_object_hide(ugd->attachment_contracted_item);
        }
-
+#endif
        Eina_List *list = NULL;
        Evas_Object *attachment_item = NULL;
 
@@ -985,6 +1106,10 @@ void _composer_attachment_expand_items(EmailComposerUGD *ugd)
        }
 
        ugd->attachment_list_compressed = EINA_FALSE;
+#ifdef _ATTACHMENT_UI_
+       elm_box_recalculate(ugd->attachment_item_box);
+       elm_layout_sizing_eval(ugd->main_layout);
+#endif
 }
 
 void _composer_attachment_contract_items(EmailComposerUGD *ugd)
@@ -1010,16 +1135,29 @@ void _composer_attachment_contract_items(EmailComposerUGD *ugd)
                }
 
                if (ugd->attachment_contracted_item) {
+#ifndef _ATTACHMENT_UI_
                        elm_box_pack_start(ugd->attachment_item_box, ugd->attachment_contracted_item);
                        evas_object_show(ugd->attachment_contracted_item);
-
+#endif
                        Evas_Object *contracted_item = evas_object_data_get(ugd->attachment_contracted_item, "attachment_item");
                        debug_log("contracted_item = %p", contracted_item);
                        _composer_attachment_add_filename(ugd, NULL, contracted_item);
                } else {
                        _composer_attachment_create_contracted_box(ugd);
                }
+#ifdef _ATTACHMENT_UI_
+               if (toggle == 0) {
+                       char buf[PATH_MAX];
+                       snprintf(buf, sizeof(buf), "expand/closed");
+                       elm_object_style_set(_g_attach_btn, buf);
+                       toggle = 1;
+               }
+#endif
        }
+#ifdef _ATTACHMENT_UI_
+       elm_box_recalculate(ugd->attachment_item_box);
+       elm_layout_sizing_eval(ugd->main_layout);
+#endif
 }
 
 void _composer_attachment_create_contracted_box(EmailComposerUGD *ugd)
@@ -1036,9 +1174,9 @@ void _composer_attachment_create_contracted_box(EmailComposerUGD *ugd)
        _composer_attachment_add_thumbnail(ugd, contracted_item, NULL);
        _composer_attachment_add_delete_icon(ugd, contracted_item);
        _composer_attachment_add_filename(ugd, NULL, contracted_item);
-
+#ifndef _ATTACHMENT_UI_
        edje_object_signal_callback_add(_EDJ(contracted_item), "clicked", "*", _composer_attachment_contracted_item_clicked_cb, ugd);
-
+#endif
        Evas_Object *contracted_base = elm_layout_add(ugd->attachment_item_box);
        elm_layout_theme_set(contracted_base, "layout", "application", "noindicator");
        evas_object_size_hint_weight_set(contracted_base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -1056,6 +1194,64 @@ void _composer_attachment_create_contracted_box(EmailComposerUGD *ugd)
        evas_object_data_set(ugd->attachment_contracted_item, "attachment_item", contracted_item);
 }
 
+#ifdef _ATTACHMENT_UI_
+static void _composer_attachment_contracted_item_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       debug_log("");
+
+       EmailComposerUGD *ugd = (EmailComposerUGD *)data;
+
+//     int param = (int)(long)(data);
+       char buf[PATH_MAX];
+       Evas_Object *btn = obj;
+
+       if (toggle == 1) {
+               /* expand button closed style */
+               snprintf(buf, sizeof(buf), "expand/opened");
+               elm_object_style_set(btn, buf);
+
+               if (ugd->selected_entry == ugd->body_ewkview) {
+                       debug_log("Webkit unfocused");
+                       evas_object_focus_set(ugd->body_ewkview, EINA_FALSE);
+                       email_composer_rte_set_buttons_dimmed(ugd);
+                       if (ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_SET_UNFOCUS, _composer_script_executed_cb, 0) == EINA_FALSE)
+                               debug_log("COMPOSER_JS_SET_UNFOCUS failed.");
+               }
+
+               elm_object_focus_set(obj, EINA_TRUE);
+
+               _composer_attachment_expand_items(ugd);
+
+               ugd->priv_selected_entry = ugd->selected_entry;
+               ugd->selected_entry = ugd->attachment_contracted_item;
+
+               toggle = 0;
+       } else {
+               /* expand button opened style */
+               snprintf(buf, sizeof(buf), "expand/closed");
+               elm_object_style_set(btn, buf);
+
+               if (ugd->selected_entry == ugd->body_ewkview) {
+                       debug_log("Webkit unfocused");
+                       evas_object_focus_set(ugd->body_ewkview, EINA_FALSE);
+                       email_composer_rte_set_buttons_dimmed(ugd);
+                       if (ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_SET_UNFOCUS, _composer_script_executed_cb, 0) == EINA_FALSE)
+                               debug_log("COMPOSER_JS_SET_UNFOCUS failed.");
+               }
+
+               elm_object_focus_set(obj, EINA_TRUE);
+
+               _composer_attachment_contract_items(ugd);
+
+               ugd->priv_selected_entry = ugd->selected_entry;
+               ugd->selected_entry = ugd->attachment_contracted_item;
+
+               toggle = 1;
+       }
+
+//     ugd->bringin_timer = ecore_timer_add(0.5f, _composer_bringin_cb, ugd);
+}
+#else
 static void _composer_attachment_contracted_item_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
 {
        debug_log("");
@@ -1077,6 +1273,7 @@ static void _composer_attachment_contracted_item_clicked_cb(void *data, Evas_Obj
        ugd->selected_entry = ugd->attachment_contracted_item;
 //     ugd->bringin_timer = ecore_timer_add(0.5f, _composer_bringin_cb, ugd);
 }
+#endif // _ATTACHMENT_UI_ end
 
 static void _composer_attachment_mouse_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
 {
index fd53ea6..2346b97 100755 (executable)
@@ -111,7 +111,7 @@ void _composer_more_button_cb(void *data, Evas_Object *obj, void *event_info)
                elm_object_item_signal_emit(ugd->navi_item, "elm,state,optionheader,open", "");
        }
 
-       if (ugd->isRotated == true) {
+       if (ugd->isHorizontal == true) {
                _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_H);
        } else {
                _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_V);
@@ -340,6 +340,11 @@ void _composer_mbe_deleted_cb(void *data, Evas_Object *obj, void *event_info)
 
                if (ugd->to_recipients_cnt > 0)
                        ugd->to_recipients_cnt--;
+
+               if (addr) {
+                       g_free(addr);
+                       addr = NULL;
+               }
        } else if (obj == ugd->cc_mbe) {
                debug_log("cc_mbe");
 
@@ -417,13 +422,6 @@ void _composer_mbe_selected_cb(void *data, Evas_Object *obj, void *event_info)
        } else {
                debug_log("");
 
-               Ecore_IMF_Context *imf_context = NULL;
-
-               imf_context = elm_entry_imf_context_get(ugd->selected_entry);
-
-               if (imf_context)
-                       ecore_imf_context_input_panel_hide(imf_context);
-
                ugd->is_mbe_selected = true;
 
                index = ri->selected_email_idx;
@@ -435,30 +433,31 @@ void _composer_mbe_selected_cb(void *data, Evas_Object *obj, void *event_info)
                        ugd->composer_popup = NULL;
                }
 
+               Evas_Object *   popup = elm_popup_add(ugd->win_main);
+               elm_object_style_set(popup, "min_menustyle");
+               evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+               ugd->popup_list = eina_list_append(ugd->popup_list, popup);
+
                debug_log("display_name:%s, index:%d", ri->display_name, index);
                if (ri->display_name) {
                        char *email_str = g_strconcat(ri->display_name, " <", ri->email_list[index].email_addr, ">", NULL);
                        char *contact_str = elm_entry_utf8_to_markup(email_str);
                        debug_log("email_str:%s", email_str);
                        debug_log("contact_str:%s", contact_str);
-                       ugd->composer_popup = _composer_create_noti(ugd, false, contact_str, NULL, 1,
-                               dgettext("sys_string", "IDS_COM_POP_CLOSE"), NULL, 0.0, _composer_popup_response_cb);
+                       elm_object_part_text_set(popup, "title,text", contact_str);
                        g_free(contact_str);
                } else {
-                       ugd->composer_popup = _composer_create_noti(ugd, false, ri->email_list[index].email_addr, NULL, 1,
-                               dgettext("sys_string", "IDS_COM_POP_CLOSE"), NULL, 0.0, _composer_popup_response_cb);
+                       elm_object_part_text_set(popup, "title,text", ri->email_list[index].email_addr);
                }
 
-#ifdef _POPUP_WITH_LIST
-               elm_object_style_set(ugd->composer_popup, "min_menustyle");
-#else
-               elm_object_style_set(ugd->composer_popup, "menustyle");
-#endif
-               elm_object_focus_allow_set(ugd->composer_popup, EINA_TRUE);
-
-               pu_list = elm_list_add(ugd->composer_popup);
+               Evas_Object *btn_close = elm_button_add(popup);
+               elm_object_style_set(btn_close, "popup_button/default");
+               elm_object_text_set(btn_close, dgettext("sys_string", "IDS_COM_POP_CLOSE"));
+               elm_object_part_content_set(popup, "button1", btn_close);
+               evas_object_smart_callback_add(btn_close, "clicked", _composer_popup_response_cb, ugd);
 
-               int item_count = 5;
+               pu_list = elm_list_add(popup);
+               elm_list_mode_set(pu_list, ELM_LIST_EXPAND);
 
                elm_list_item_append(pu_list, dgettext("sys_string", "IDS_COM_SK_DELETE"), NULL, NULL, _composer_mbe_popup_delete_cb, ugd);
                elm_list_item_append(pu_list, dgettext("sys_string", "IDS_COM_SK_EDIT"), NULL, NULL, _composer_mbe_popup_edit_cb, ugd);
@@ -471,21 +470,37 @@ void _composer_mbe_selected_cb(void *data, Evas_Object *obj, void *event_info)
                        elm_list_item_append(pu_list, _("IDS_EMAIL_OPT_MOVE_TO_BCC"), NULL, NULL, _composer_mbe_popup_move_to_bcc_cb, ugd);
 
                debug_log("email_cnt = %d", ri->email_cnt);
-               if (ri->is_contact_info == true) {
+/*             if (ri->is_contact_info == true) {
                        if (ri->email_cnt > 1) {
                                elm_list_item_append(pu_list, _("IDS_EMAIL_OPT_CHANGE_EMAIL_ADDRESS_ABB"), NULL, NULL, _composer_mbe_popup_change_addr_cb, ugd);
-                       }
-               }
+                       } else {
+                               g_ugd = ugd;
+                               EMAIL_CONTACT_LIST_INFO_S *contact_list_item = NULL;
+                               contact_list_item = (EMAIL_CONTACT_LIST_INFO_S *)_composer_contact_search_by_email(ugd, ri->email_list[index].email_addr);
 
-               elm_list_go(pu_list);
+                               if (contact_list_item) {
+                                       debug_log("Contact Item Exist: index[%d]", contact_list_item->index);
+                                       char ct_idx[10] = { 0, };
+                                       snprintf(ct_idx, sizeof(ct_idx), "%d", contact_list_item->index);
 
-#ifdef _POPUP_WITH_LIST
-               elm_list_mode_set(pu_list, ELM_LIST_EXPAND);
-               evas_object_size_hint_max_set(pu_list, -1, 114 * item_count * elm_scale_get());
-#endif
-               elm_object_content_set(ugd->composer_popup, pu_list);
+                                       elm_list_item_append(pu_list, _("IDS_EMAIL_OPT_VIEW_CONTACT"), NULL, NULL, _composer_mbe_popup_view_contact_detail_cb, g_strdup(ct_idx));
 
-               ugd->mbe_unfocus_timer = ecore_timer_add(0.1, _composer_unfocus_selected_mbe, ugd);
+                                       _composer_delete_contacts_list(contact_list_item);
+                               } else {
+                                       debug_log("contact_list_item is NULL");
+                                       elm_list_item_append(pu_list, dgettext("sys_string", "IDS_COM_OPT_ADD_TO_CONTACTS"), NULL, NULL, _composer_mbe_popup_add_to_contact_cb, ugd);
+                               }
+                       }
+               } else {
+                       elm_list_item_append(pu_list, dgettext("sys_string", "IDS_COM_OPT_ADD_TO_CONTACTS"), NULL, NULL, _composer_mbe_popup_add_to_contact_cb, ugd);
+               }
+*/
+               elm_list_go(pu_list);
+               elm_object_content_set(popup, pu_list);
+               evas_object_show(popup);
+               elm_object_focus_set(popup, EINA_TRUE);
+               
+               ugd->composer_popup = popup;
                debug_log("composer_popup = %x, is_mbe_selected = %d", ugd->composer_popup, ugd->is_mbe_selected);
        }
 }
@@ -501,15 +516,15 @@ void _composer_mbe_focused_cb(void *data, Evas_Object *obj, void *event_info)
        if (COMPOSER_FOCUS_STATUS_NONE == ugd->focus_status) {
                if (obj == ugd->to_mbe) {
                        edje_object_signal_emit(_EDJ(ugd->to_ly), "show.button", "*");
-                       edje_object_signal_emit(_EDJ(ugd->to_ly), "contract.recp", "*");
+//                     edje_object_signal_emit(_EDJ(ugd->to_ly), "contract.recp", "*");
                }
                else if (obj == ugd->cc_mbe) {
                        edje_object_signal_emit(_EDJ(ugd->cc_ly), "show.button", "*");
-                       edje_object_signal_emit(_EDJ(ugd->cc_ly), "contract.recp", "*");
+//                     edje_object_signal_emit(_EDJ(ugd->cc_ly), "contract.recp", "*");
                }
                else if (obj == ugd->bcc_mbe) {
                        edje_object_signal_emit(_EDJ(ugd->bcc_ly), "show.button", "*");
-                       edje_object_signal_emit(_EDJ(ugd->bcc_ly), "contract.recp", "*");
+//                     edje_object_signal_emit(_EDJ(ugd->bcc_ly), "contract.recp", "*");
                }
 
                _composer_attachment_contract_items(ugd);
@@ -518,6 +533,7 @@ void _composer_mbe_focused_cb(void *data, Evas_Object *obj, void *event_info)
                ugd->selected_entry = elm_multibuttonentry_entry_get(obj);
 //             ugd->bringin_timer = ecore_timer_add(0.5f, _composer_bringin_cb, ugd);
                debug_log("MBE editable:%d", elm_multibuttonentry_editable_get(obj));
+               elm_layout_sizing_eval(ugd->c_layout);
        } else {
                if (ugd->selected_entry == ugd->body_ewkview) {
                        if (EINA_TRUE == elm_object_focus_get(ugd->to_mbe))
@@ -544,18 +560,24 @@ void _composer_mbe_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
                        return;
        }
 
+       if (ugd->focus_status == COMPOSER_FOCUS_STATUS_SELECTED) {
+               elm_object_tree_focus_allow_set(ugd->c_layout, EINA_FALSE); // block the focus not to open IME.
+               ugd->focus_status = COMPOSER_FOCUS_STATUS_NONE;
+               return;
+       }
+
        debug_log("obj = %x, to_mbe = %x, cc_mbe = %x, bcc_mbe = %x", obj, ugd->to_mbe, ugd->cc_mbe, ugd->bcc_mbe);
        if (obj == ugd->to_mbe) {
                edje_object_signal_emit(_EDJ(ugd->to_ly), "hide.button", "*");
-               edje_object_signal_emit(_EDJ(ugd->to_ly), "extract.recp", "*");
+//             edje_object_signal_emit(_EDJ(ugd->to_ly), "extract.recp", "*");
        }
        else if (obj == ugd->cc_mbe) {
                edje_object_signal_emit(_EDJ(ugd->cc_ly), "hide.button", "*");
-               edje_object_signal_emit(_EDJ(ugd->cc_ly), "extract.recp", "*");
+//             edje_object_signal_emit(_EDJ(ugd->cc_ly), "extract.recp", "*");
        }
        else if (obj == ugd->bcc_mbe) {
                edje_object_signal_emit(_EDJ(ugd->bcc_ly), "hide.button", "*");
-               edje_object_signal_emit(_EDJ(ugd->bcc_ly), "extract.recp", "*");
+//             edje_object_signal_emit(_EDJ(ugd->bcc_ly), "extract.recp", "*");
        }
 
        elm_multibuttonentry_expanded_set(obj, FALSE);
@@ -665,11 +687,11 @@ Eina_Bool _composer_mbe_verified_item_cb(Evas_Object *obj, const char *item_labe
 err_return:
        debug_log("err-return");
 
-       elm_entry_entry_set(elm_multibuttonentry_entry_get(obj), NULL);
+//     elm_entry_entry_set(elm_multibuttonentry_entry_get(obj), NULL);
        elm_entry_cursor_end_set(elm_multibuttonentry_entry_get(obj));
 
        if (_composer_check_popup_exist(ugd))
-               elm_object_focus_set(obj, EINA_FALSE);
+               elm_object_focus_set(ugd->composer_noti, EINA_TRUE);
 
        return EINA_FALSE;
 }
@@ -696,9 +718,7 @@ void _composer_mbe_popup_delete_cb(void *data, Evas_Object *obj, void *event_inf
        Elm_Object_Item *item = elm_multibuttonentry_selected_item_get(mbe);
 
        if (item && mbe == ugd->bcc_mbe) {
-               EmailRecpInfo *bcc_ri_info;
-
-               bcc_ri_info = (EmailRecpInfo *) elm_object_item_data_get(item);
+               elm_object_item_data_get(item);
        }
 
        elm_object_item_del(item);
@@ -1065,8 +1085,6 @@ void _composer_mbe_change_addr_response_cb(void *data, Evas_Object *obj, void *e
 
        EmailComposerUGD *ugd = (EmailComposerUGD *)data;
 
-       EmailRecpInfo *ri = NULL;
-
        Evas_Object *mbe = NULL;
 
        if (ugd->selected_entry == ugd->to_mbe_entry) {
@@ -1077,7 +1095,7 @@ void _composer_mbe_change_addr_response_cb(void *data, Evas_Object *obj, void *e
                mbe = ugd->bcc_mbe;
        }
 
-       ri = (EmailRecpInfo *) elm_object_item_data_get(ugd->selected_item);
+       elm_object_item_data_get(ugd->selected_item);
 
        char *pszBtnText = (char *)elm_object_text_get(obj);
        debug_log("selected button text = %s", pszBtnText);
@@ -1108,6 +1126,11 @@ void _composer_cancel_send_mail_cb(void *data, Evas_Object *obj, void *event_inf
 
        int err = email_cancel_sending_mail(ugd->new_mail_info->mail_data->mail_id);
 
+       _composer_webkit_set_body_script(data);
+       elm_object_tree_focus_allow_set(ugd->c_layout, EINA_TRUE); // block the focus not to open IME.
+       elm_object_disabled_set(ugd->send_btn, EINA_FALSE);
+       elm_object_disabled_set(ugd->cancel_btn, EINA_FALSE);
+
        if (err != EMAIL_ERROR_NONE) {
                debug_warning("email_engine_cancel_send_mail failed - err(%d)", err);
        } else {
@@ -1347,12 +1370,6 @@ Eina_Bool _composer_mbe_create_change_addr_list(EmailComposerUGD *ugd)
        ugd->change_addr_noti = _composer_create_noti(ugd, false, _("IDS_EMAIL_HEADER_SELECT_EMAIL_ADDRESS"), NULL, 1,
                dgettext("sys_string", "IDS_COM_SK_CANCEL"), NULL, 0.0, _composer_mbe_change_addr_response_cb);
 
-#ifdef _POPUP_WITH_LIST
-       elm_object_style_set(ugd->change_addr_noti, "min_menustyle");
-#else
-       elm_object_style_set(ugd->change_addr_noti, "menustyle");
-#endif
-       elm_object_focus_allow_set(ugd->change_addr_noti, EINA_FALSE);
 
        Elm_Object_Item *gen_item;
        Evas_Object *genlist;
@@ -1411,6 +1428,8 @@ void _composer_fail_to_send_popup_cb(void *data, Evas_Object *obj, void *event_i
        debug_log("");
        EmailComposerUGD *ugd = (EmailComposerUGD *)data;
 
+       elm_object_tree_focus_allow_set(ugd->c_layout, EINA_TRUE);
+
        if (ugd->popup_list) {
                debug_log("popup count = %d", eina_list_count(ugd->popup_list));
                debug_log("obj: %p", obj);
@@ -1438,49 +1457,29 @@ static void *_composer_contact_search_by_email(EmailComposerUGD *ugd, const char
                return NULL;
        }
 
-       int ret = CTS_SUCCESS;
-       CTSiter *iter = NULL;
-
+       int ct_ret = CONTACTS_ERROR_NONE;
        EMAIL_CONTACT_LIST_INFO_S *contacts_list_item = NULL;
-       contacts_svc_connect();
+       Eina_List *contacts_list = NULL;
+       contacts_list_h list = NULL;
 
-       debug_log("search_word = %s", search_word);
+       ct_ret = email_get_contacts_list(CONTACTS_MATCH_EXACTLY, &list, search_word);
+       debug_log("email_get_contacts_record: list : %d", list);
 
-       if (contacts_svc_get_list_with_str(CTS_LIST_EMAILINFOS_WITH_EMAIL, search_word, &iter) != CTS_SUCCESS) {
-               return NULL;
+       if (!list) {
+               debug_log("list is NULL");
+               contacts_list_destroy(list, true);
+               return contacts_list;
        }
 
-       ret = contacts_svc_iter_next(iter);
-
-       if (CTS_SUCCESS == ret) {
-               CTSvalue *row_info = NULL;
+       contacts_list_item = (EMAIL_CONTACT_LIST_INFO_S *)calloc(1, sizeof(EMAIL_CONTACT_LIST_INFO_S));
+       contacts_list_item->ugd = ugd;
 
-               row_info = contacts_svc_iter_get_info(iter);
-               if (row_info) {
-                       contacts_list_item = (EMAIL_CONTACT_LIST_INFO_S *)calloc(1, sizeof(EMAIL_CONTACT_LIST_INFO_S));
-
-                       int index = contacts_svc_value_get_int(row_info, CTS_LIST_EMAIL_CONTACT_ID_INT);
-
-                       contacts_list_item->index = index;
-                       contacts_list_item->display = g_strdup(contacts_svc_value_get_str(row_info, CTS_LIST_EMAIL_CONTACT_DISPLAY_STR));
-                       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));
-
-                       snprintf(contacts_list_item->display_name, sizeof(contacts_list_item->display_name), "%s", contacts_list_item->display);
-
-                       /*contacts_list = eina_list_append(contacts_list, contacts_list_item);*/
-               }
-
-               contacts_svc_value_free(row_info);
-               row_info = NULL;
-
-               /*ret = contacts_svc_iter_next(iter);*/
-               contacts_svc_iter_remove(iter);
-       }
+       ct_ret = email_get_contacts_list_info(list, contacts_list_item);
+       debug_log("email_get_contacts_list_info: contacts_list_item : %d", contacts_list_item);
 
-       contacts_svc_disconnect();
+       contacts_list_destroy(list, true);
 
-       return contacts_list_item;
+       return contacts_list;
 }
 
 static void _composer_delete_contacts_list(EMAIL_CONTACT_LIST_INFO_S *contacts_list_item)
@@ -1564,7 +1563,6 @@ void _composer_from_show_popup(EmailComposerUGD *ugd)
 {
        debug_log("");
 
-       Elm_Object_Item *gen_item;
        int acc_index;
 
        g_ugd = ugd;
@@ -1575,13 +1573,6 @@ void _composer_from_show_popup(EmailComposerUGD *ugd)
        }
        ugd->composer_noti = _composer_create_noti(ugd, false, _("IDS_EMAIL_BODY_FROM"), NULL, 1, dgettext("sys_string", "IDS_COM_SK_OK"), NULL, 0.0, _composer_from_change_response_cb);
 
-#ifdef _POPUP_WITH_LIST
-       elm_object_style_set(ugd->composer_noti, "min_menustyle");
-#else
-       elm_object_style_set(ugd->composer_noti, "menustyle");
-#endif
-       elm_object_focus_allow_set(ugd->composer_noti, EINA_FALSE);
-
        from_itc.item_style = "email.2text.3icon.3";
        from_itc.func.text_get = _composer_from_gl_text_get;
        from_itc.func.content_get = _composer_from_gl_content_get;
@@ -1596,7 +1587,7 @@ void _composer_from_show_popup(EmailComposerUGD *ugd)
        evas_object_size_hint_align_set(ugd->account_gen_list, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
        for (acc_index = 0; acc_index < ugd->account_info->account_count; acc_index++) {
-               gen_item = elm_genlist_item_append(ugd->account_gen_list, &from_itc, (void *)acc_index, NULL, ELM_GENLIST_ITEM_NONE, _composer_from_gl_sel, (void *)acc_index);
+               elm_genlist_item_append(ugd->account_gen_list, &from_itc, (void *)acc_index, NULL, ELM_GENLIST_ITEM_NONE, _composer_from_gl_sel, (void *)acc_index);
        }
 
 //     elm_genlist_effect_set(ugd->account_gen_list, EINA_FALSE);
@@ -2116,7 +2107,7 @@ static void _composer_cbar_save_as_draft_cb(Evas_Object *o, const char *result,
 
        debug_log("account_type: %d", ugd->account_info->account_type);
 
-       int ret = _composer_add_mailbox_folder(ugd, EMAIL_MAILBOX_TYPE_DRAFT);
+       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);
@@ -2276,7 +2267,7 @@ void _composer_cbar_priority_clicked(void *data, Evas_Object *obj, void *event_i
        debug_log("");
 
        EmailComposerUGD *ugd = (EmailComposerUGD *)data;
-       Elm_Object_Item *gen_item[2];
+       Elm_Object_Item *gen_item[3];
        int index;
 
        g_ugd = ugd;
@@ -2313,13 +2304,6 @@ void _composer_cbar_priority_clicked(void *data, Evas_Object *obj, void *event_i
                ugd->b_bcc_ps_open = false;
        }
 
-#ifdef _POPUP_WITH_LIST
-       elm_object_style_set(ugd->composer_noti, "min_menustyle");
-#else
-       elm_object_style_set(ugd->composer_noti, "menustyle");
-#endif
-       elm_object_focus_allow_set(ugd->composer_noti, EINA_FALSE);
-
        priority_itc.item_style = "1text.1icon.2";
        priority_itc.func.text_get = _composer_priority_gl_text_get;
        priority_itc.func.content_get = _composer_priority_gl_content_get;
@@ -2467,13 +2451,6 @@ void _composer_cbar_tracking_clicked(void *data, Evas_Object *obj, void *event_i
                ugd->b_bcc_ps_open = false;
        }
 
-#ifdef _POPUP_WITH_LIST
-       elm_object_style_set(ugd->composer_noti, "min_menustyle");
-#else
-       elm_object_style_set(ugd->composer_noti, "menustyle");
-#endif
-       elm_object_focus_allow_set(ugd->composer_noti, EINA_FALSE);
-
        tracking_itc.item_style = "1text.1icon.2";
        tracking_itc.func.text_get = _composer_tracking_gl_text_get;
        tracking_itc.func.content_get = _composer_tracking_gl_content_get;
@@ -2511,6 +2488,7 @@ void _composer_cbar_send_clicked(void *data, Evas_Object *obj, void *event_info)
        EmailComposerUGD *ugd = (EmailComposerUGD *)data;
 
        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");
@@ -2527,9 +2505,12 @@ void _composer_cbar_send_clicked(void *data, Evas_Object *obj, void *event_info)
        elm_object_disabled_set(ugd->send_btn, EINA_TRUE);
        elm_object_disabled_set(ugd->cancel_btn, EINA_TRUE);
 
-       ugd->bSendBtnDisabled = true;
-
-       ugd->send_timer = ecore_timer_add(0.5, _composer_send_mail_cb, ugd);
+       if (ugd->need_download == EINA_TRUE) {
+               _composer_download_attachment(ugd);
+       } else {
+               ugd->bSendBtnDisabled = true;
+               ugd->send_timer = ecore_timer_add(0.5, _composer_send_mail_cb, ugd);
+       }
 }
 
 static Eina_Bool _composer_cc_mbe_set_focus(void *data)
index 450b93a..05777b7 100755 (executable)
@@ -41,13 +41,17 @@ static void _composer_get_html_content_cb(Evas_Object *o, const char *result, vo
 static void _composer_webkit_scroll_up_cb(void *data, Evas_Object *obj, void *event_info);
 static void _composer_webkit_scroll_down_cb(void *data, Evas_Object *obj, void *event_info);
 
+static void _composer_webkit_get_ime_rect_cb(void *data, Evas_Object *obj, void *event_info);
 static void _composer_webkit_ime_closed_cb(void *data, Evas_Object *obj, void *event_info);
 static void _composer_webkit_ime_opened_cb(void *data, Evas_Object *obj, void *event_info);
 static void _composer_webkit_resized_cb(void *data, Evas_Object *obj, void *event_info);
 static void _composer_webview_policy_navigation_decide_cb(void *data, Evas_Object *obj, void *event_info);
 static void _composer_webview_contextmenu_customize_cb(void *data, Evas_Object *webview, void *event_info);
 static void _composer_webview_contextmenu_selected_cb(void *data, Evas_Object *webview, void *event_info);
+static void _composer_webkit_get_text_status_cb(void *data, Evas_Object *obj, void *event_info);
 
+static int _g_pos_x;
+static int _g_pos_y;
 
 static void _changed_cb(void *data, Evas_Object *obj, void *event_info) // This callback is for showing(hiding) X marked button.
 {
@@ -79,11 +83,6 @@ static void _focused_cb(void *data, Evas_Object *obj, void *event_info) // Focus
                elm_entry_input_panel_show(obj);
 
                ugd->selected_entry = ugd->subject_entry;
-               if (ugd->isRotated == true) {
-                       _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_H);
-               } else {
-                       _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_V);
-               }
                elm_layout_sizing_eval(ugd->c_layout);
 //             ugd->bringin_timer = ecore_timer_add(0.5f, _composer_bringin_cb, ugd);
        } else {
@@ -96,10 +95,17 @@ static void _focused_cb(void *data, Evas_Object *obj, void *event_info) // Focus
 static void _unfocused_cb(void *data, Evas_Object *obj, void *event_info) // Unfocused callback will show guidetext and hide X marked button.
 {
        debug_log("");
+       EmailComposerUGD *ugd = (EmailComposerUGD *)data;       
+
+       if (ugd->focus_status == COMPOSER_FOCUS_STATUS_SELECTED) {
+               elm_object_tree_focus_allow_set(ugd->c_layout, EINA_FALSE); // block the focus not to open IME.
+               ugd->focus_status = COMPOSER_FOCUS_STATUS_NONE;
+               return;
+       }               
 
        if (elm_entry_is_empty(obj))
-               elm_object_signal_emit(data, "elm,state,guidetext,show", "elm");
-       elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
+               elm_object_signal_emit(ugd->subject_editfield, "elm,state,guidetext,show", "elm");
+       elm_object_signal_emit(ugd->subject_editfield, "elm,state,eraser,hide", "elm");
 
        elm_entry_input_panel_hide(obj);
 }
@@ -134,7 +140,7 @@ void _composer_create_subject_field(Evas_Object *parent, EmailComposerUGD *ugd)
 
        evas_object_smart_callback_add(ugd->subject_entry, "changed", _changed_cb, ugd->subject_editfield);
        evas_object_smart_callback_add(ugd->subject_entry, "focused", _focused_cb, ugd);
-       evas_object_smart_callback_add(ugd->subject_entry, "unfocused", _unfocused_cb, ugd->subject_editfield);
+       evas_object_smart_callback_add(ugd->subject_entry, "unfocused", _unfocused_cb, ugd);
        elm_object_signal_callback_add(ugd->subject_editfield, "elm,eraser,clicked", "elm", _eraser_clicked_cb, ugd->subject_entry);
 
        elm_object_part_content_set(parent, "subject_field", ly);
@@ -170,7 +176,7 @@ Evas_Object *_composer_create_subject_editfield(Evas_Object *parent, char *title
        entry = elm_entry_add(ef);
        elm_entry_scrollable_set(entry, EINA_TRUE);
        elm_entry_single_line_set(entry, EINA_TRUE);
-       elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
+//     elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
        elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_NORMAL);
        elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
        evas_object_show(entry);
@@ -198,6 +204,34 @@ void _composer_create_body_field(Evas_Object *parent, EmailComposerUGD *ugd)
        ugd->webkit_ly = body_ly;
 }
 
+void _composer_register_editfield_entry_callback(Evas_Object *obj, EmailComposerUGD *ugd)
+{
+       debug_log("");
+
+       evas_object_smart_callback_add(obj, "changed", _composer_edit_field_changed_cb, ugd);
+       evas_object_smart_callback_add(obj, "preedit,changed", _composer_edit_field_changed_cb, ugd);
+       Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(obj);
+       ecore_imf_context_input_panel_event_callback_add (imf_context, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, _composer_input_panel_resize_cb, ugd);
+       ecore_imf_context_input_panel_event_callback_add(imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _composer_input_panel_state_changed_cb, ugd);
+       debug_log("ugd->is_prediction: %d", ugd->is_prediction);
+}
+
+void _composer_webkit_set_body_script(void *data)
+{
+       debug_log("");
+       EmailComposerUGD *ugd = (EmailComposerUGD *)data;
+
+       if (ugd == NULL)
+               return;
+
+       if (ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_ENABLE_EDITABLE, _composer_script_executed_cb, 0) == EINA_FALSE)
+               debug_log("COMPOSER_JS_ENABLE_EDITABLE failed.");
+
+       if (ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_GET_HTML_CONTENT, _composer_get_html_content_cb, (void *)ugd) == EINA_FALSE)
+               debug_log("COMPOSER_JS_GET_HTML_CONTENT failed.");
+
+}
+
 Evas_Object *_composer_create_body_webview(Evas_Object *parent, char *title, EmailComposerUGD *ugd)
 {
        debug_log("");
@@ -212,7 +246,7 @@ Evas_Object *_composer_create_body_webview(Evas_Object *parent, char *title, Ema
        evas_object_show(ly);
 
        ugd->body_ewkview = ewk_view_add(evas_object_evas_get(parent));
-
+       evas_object_size_hint_weight_set(ugd->body_ewkview, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(ugd->body_ewkview, EVAS_HINT_FILL, EVAS_HINT_FILL);
        ewk_view_vertical_panning_hold_set(ugd->body_ewkview, EINA_TRUE);
        //elm_webview_input_field_zoom_set(ugd->body_webview, EINA_TRUE); //reviewing
@@ -234,7 +268,6 @@ Evas_Object *_composer_create_body_webview(Evas_Object *parent, char *title, Ema
 
        ewk_setting_uses_encoding_detector_set(ewkSetting, EINA_TRUE);
 
-       //ewk_view_show_ime_on_autofocus_set(ugd->body_ewkview, EINA_TRUE); // jcpark reviewing
        evas_object_smart_callback_add(ugd->body_ewkview, "load,finished", _composer_webkit_loadFinished_cb, ugd);
        evas_object_smart_callback_add(ugd->body_ewkview, "policy,navigation,decide", _composer_webview_policy_navigation_decide_cb, ugd);
        evas_object_smart_callback_add(ugd->body_ewkview, "scroll,up", _composer_webkit_scroll_up_cb, ugd);
@@ -243,6 +276,8 @@ Evas_Object *_composer_create_body_webview(Evas_Object *parent, char *title, Ema
        evas_object_smart_callback_add(ugd->body_ewkview, "contextmenu,selected", _composer_webview_contextmenu_selected_cb, ugd);
        evas_object_smart_callback_add(ugd->body_ewkview, "editorclient,ime,closed", _composer_webkit_ime_closed_cb, ugd);
        evas_object_smart_callback_add(ugd->body_ewkview, "editorclient,ime,opened", _composer_webkit_ime_opened_cb, ugd);
+       evas_object_smart_callback_add(ugd->body_ewkview, "text,style,state", _composer_webkit_get_text_status_cb, ugd);
+       evas_object_smart_callback_add(ugd->body_ewkview, "inputmethod,changed", _composer_webkit_get_ime_rect_cb, ugd);
 
        evas_object_event_callback_add(ugd->body_ewkview, EVAS_CALLBACK_FOCUS_IN, _composer_webkit_focused_cb, ugd);
        evas_object_event_callback_add(ugd->body_ewkview, EVAS_CALLBACK_FOCUS_OUT, _composer_webkit_unfocused_cb, ugd);
@@ -250,17 +285,6 @@ Evas_Object *_composer_create_body_webview(Evas_Object *parent, char *title, Ema
        return ly;
 }
 
-void _composer_register_editfield_entry_callback(Evas_Object *obj, EmailComposerUGD *ugd)
-{
-       debug_log("");
-
-       evas_object_smart_callback_add(obj, "changed", _composer_edit_field_changed_cb, ugd);
-       evas_object_smart_callback_add(obj, "preedit,changed", _composer_edit_field_changed_cb, ugd);
-
-//     Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(obj);
-//     ecore_imf_context_input_panel_event_callback_add(imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _composer_input_panel_state_changed_cb, ugd);
-}
-
 static Eina_Bool _composer_webkit_field_clicked_cb_hit_test_hash_fn(const Eina_Hash *hash, const void *key, void *data, void *fdata)
 {
        debug_log("Func data: %s, Hash entry: %s / %s\n", fdata, (const char *)key, data);
@@ -315,11 +339,7 @@ void _composer_webkit_loadFinished_cb(void *data, Evas_Object *obj, void *event_
 
        EmailComposerUGD *ugd = (EmailComposerUGD *)data;
 
-       if (ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_ENABLE_EDITABLE, _composer_script_executed_cb, 0) == EINA_FALSE)
-               debug_log("COMPOSER_JS_ENABLE_EDITABLE failed.");
-
-       if (ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_GET_HTML_CONTENT, _composer_get_html_content_cb, (void *)ugd) == EINA_FALSE)
-               debug_log("COMPOSER_JS_GET_HTML_CONTENT failed.");
+       _composer_webkit_set_body_script(data);
 
        Ewk_Setting *ewkSetting = NULL;
        ewkSetting = ewk_view_setting_get(ugd->body_ewkview);
@@ -331,12 +351,6 @@ void _composer_webkit_loadFinished_cb(void *data, Evas_Object *obj, void *event_
        //ewk_setting_auto_load_images_set(ewkSetting, EINA_TRUE);
        ewk_setting_editable_link_behavior_set(ewkSetting, EWK_EDITABLE_LINK_BEHAVIOR_NEVER_LIVE);
 
-       if (ugd->isRotated == true) {
-               _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_H);
-       } else {
-               _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_V);
-       }
-
        if (ugd->selected_entry == ugd->body_ewkview) {
                // focus to the body field when reply the email.
                evas_object_focus_set(ugd->body_ewkview, EINA_TRUE);
@@ -424,6 +438,10 @@ static void _composer_webkit_unfocused_cb(void *data, Evas *e, Evas_Object *obj,
                if (ewk_view_script_execute(ugd->body_ewkview, COMPOSER_JS_SET_UNFOCUS, _composer_script_executed_cb, 0) == EINA_FALSE)
                        debug_log("COMPOSER_JS_SET_UNFOCUS failed.");
 #endif
+               if (ugd->focus_status == COMPOSER_FOCUS_STATUS_SELECTED) {
+                       elm_object_tree_focus_allow_set(ugd->c_layout, EINA_FALSE); // block the focus not to open IME.
+                       ugd->focus_status = COMPOSER_FOCUS_STATUS_NONE;
+               }               
        }
 }
 
@@ -504,12 +522,11 @@ static void _composer_webkit_ime_closed_cb(void *data, Evas_Object *obj, void *e
 static void _composer_webkit_ime_opened_cb(void *data, Evas_Object *obj, void *event_info)
 {
        debug_log("");
-
        EmailComposerUGD *ugd = (EmailComposerUGD *)data;
+
        if (ugd->isRotated == true) {
-               _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_H);
-       } else {
-               _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_V);
+               _composer_region_show_cb(ugd);
+               ugd->isRotated = false;
        }
 }
 
@@ -523,6 +540,16 @@ static void _composer_webkit_resized_cb(void *data, Evas_Object *obj, void *even
        //ugd->idler_bringin = ecore_idler_add(_composer_bringin_cb, ugd);
 }
 
+static void _composer_webkit_get_ime_rect_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       debug_log("");
+       EmailComposerUGD *ugd = (EmailComposerUGD *)data;
+       Eina_Rectangle *rect = (Eina_Rectangle*)event_info;
+       debug_log("inputmethod,changed (x:%d,y:%d,w:%d,h:%d)\n", rect->x, rect->y, rect->w, rect->h);
+
+       _composer_resize_body_webview(ugd, rect->h);
+}
+
 static void _composer_webview_policy_navigation_decide_cb(void *data, Evas_Object *obj, void *event_info)
 {
        debug_log("");
@@ -671,3 +698,64 @@ static void _composer_webview_contextmenu_selected_cb(void *data, Evas_Object *w
                debug_log("Never here!");
        }
 }
+
+static void _composer_webkit_get_text_status_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       debug_log("");
+
+       EmailComposerUGD *ugd = (EmailComposerUGD *)data;
+       Ewk_Text_Style* textStyle = (Ewk_Text_Style *)event_info;
+
+       if ((ugd == NULL) || (textStyle == NULL)) {
+               return; 
+       }
+       
+       int ms_x, ms_y, ms_w, ms_h;
+       Evas_Point sp, ep;
+       ewk_text_style_position_get(textStyle, &sp, &ep);
+       debug_log("=================================================");
+       debug_log("1. Start Point : sp.x(%d), sp.y(%d)", sp.x, sp.y);
+       debug_log("1. End Point : ep.x(%d), ep.y(%d)", ep.x, ep.y);
+       debug_log("=================================================");
+
+       elm_scroller_region_get(ugd->main_scroller, &ms_x, &ms_y, &ms_w, &ms_h);
+       debug_log("1. main_scroller(ms_x:%d, ms_y:%d, ms_w:%d, ms_h:%d)", ms_x, ms_y, ms_w, ms_h);
+
+       int visible_area = 0;
+       int ewk_sc_x, ewk_sc_y;
+       Evas_Coord ewk_ct_w,ewk_ct_h;
+       ewk_view_scroll_pos_get(ugd->body_ewkview, &ewk_sc_x, &ewk_sc_y);
+       debug_log("ewk_view_scroll_pos_get(ewk_sc_x:%d, ewk_sc_y:%d)", ewk_sc_x, ewk_sc_y);
+
+       ewk_view_contents_size_get(ugd->body_ewkview, &ewk_ct_w, &ewk_ct_h);
+       debug_log("ewk_view_contents_size_get(ewk_ct_w:%d, ewk_ct_h:%d)", ewk_ct_w, ewk_ct_h);
+
+       if (ugd->isHorizontal == true) {
+               visible_area = 397;
+       } else {
+               visible_area = 830;
+       }
+
+       if (ugd->is_prediction == EINA_TRUE) {
+               visible_area = visible_area - COMPOSER_IME_PREDICTION_H;
+       }
+
+       debug_log("ugd->is_prediction : %d", ugd->is_prediction);
+
+       if (ms_y < 311 + COMPOSER_IME_PREDICTION_H) {
+               if (ep.y > visible_area) {
+                       if (ewk_sc_y > 0) {
+                               elm_scroller_region_show(ugd->main_scroller, ms_x, 10000, ms_w, ms_h);
+                               ewk_view_scroll_set(ugd->body_ewkview, 0, ep.y - visible_area + ewk_sc_y);
+                       } else {
+                               elm_scroller_region_bring_in(ugd->main_scroller, ms_x, ep.y - visible_area + ms_y, ms_w, ms_h);
+                       }
+               }
+       } else {
+               if (ep.y > visible_area) {
+                       elm_scroller_region_show(ugd->main_scroller, ms_x, 10000, ms_w, ms_h);
+                       ewk_view_scroll_set(ugd->body_ewkview, 0, ep.y - visible_area + ewk_sc_y);
+               }
+       }
+}
+
index 3ec4b92..3a9b650 100755 (executable)
@@ -277,75 +277,44 @@ Eina_List *composer_ps_search_contact(EmailComposerUGD *ugd, const char *search_
 {
        debug_log("");
 
-       int ret = CTS_SUCCESS;
-       CTSiter *iter = NULL;
-
+       int ct_ret = CONTACTS_ERROR_NONE;
        EMAIL_CONTACT_LIST_INFO_S *contacts_list_item = NULL;
        Eina_List *contacts_list = NULL;
+       contacts_list_h list = NULL;
 
-       contacts_svc_get_list(CTS_LIST_ALL_CONTACT_HAD_EMAIL, &iter);
-
-       while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
-               CTSvalue *contact = NULL;
-               CTSvalue *email = NULL;
-               const char *img_path, *email_addr;
-               char *display = NULL;
-
-               contact = contacts_svc_iter_get_info(iter);
-
-               if (contact == NULL)
-                       break;
-
-               int index = contacts_svc_value_get_int(contact, CTS_LIST_CONTACT_ID_INT);
-
-               ret = contacts_svc_get_contact_value(CTS_GET_DEFAULT_EMAIL_VALUE, index, &email);
-
-               if (ret != CTS_SUCCESS)
-                       goto LOOP_TAIL;
-
-               contacts_list_item = (EMAIL_CONTACT_LIST_INFO_S *) calloc(1, sizeof(EMAIL_CONTACT_LIST_INFO_S));
-
-               if (contacts_list_item != NULL) {
-                       contacts_list_item->ugd = ugd;
-                       contacts_list_item->index = index;
-
-                       display = g_strdup(contacts_svc_value_get_str(contact, CTS_LIST_CONTACT_DISPLAY_STR));
+       ct_ret = email_get_contacts_list(CONTACTS_MATCH_CONTAINS, &list, search_word);
+       debug_log("email_get_contacts_record: list : %d", list);
 
-                       img_path = contacts_svc_value_get_str(contact, CTS_LIST_CONTACT_IMG_PATH_STR);
-                       contacts_list_item->image_path = g_strdup(img_path);
-
-                       email_addr = contacts_svc_value_get_str(email, CTS_EMAIL_VAL_ADDR_STR);
-                       contacts_list_item->email_address = g_strdup(email_addr);
+       if (!list) {
+               debug_log("list is NULL");
+               contacts_list_destroy(list, true);
+               return contacts_list;
+       }
 
-                       if (display) {
-                               //debug_log("display = %s", display);
-                       } else {
-                               display = g_strdup(email_addr);
-                       }
+       contacts_list_item = (EMAIL_CONTACT_LIST_INFO_S *)calloc(1, sizeof(EMAIL_CONTACT_LIST_INFO_S));
 
-                       if (display && contacts_list_item->email_address && (strcasestr(display, search_word) || strcasestr(contacts_list_item->email_address, search_word))) {
-                               strncpy(contacts_list_item->display_name, display, sizeof(contacts_list_item->display_name) - 1);
+       if (contacts_list_item == NULL){
+               debug_log("contacts_list_item is NULL");
+               return contacts_list;
+       }
 
-                               contacts_list = eina_list_append(contacts_list, contacts_list_item);
-                       } else if (contacts_list_item) {
-                               Eina_List *free_contacts_list = NULL;   /* to use existing composer_ps_delete_contacts_list API, a temp list is used */
-                               free_contacts_list = eina_list_append(free_contacts_list, contacts_list_item);
-                               composer_ps_delete_contacts_list(free_contacts_list);
-                               free_contacts_list = eina_list_free(free_contacts_list);
-                       }
-               }
+       ct_ret = email_get_contacts_list_info(list, contacts_list_item);
+//     ct_ret = email_get_contacts_list_info2(CONTACTS_MATCH_CONTAINS, search_word, contacts_list_item);
+       debug_log("email_get_contacts_list_info: contacts_list_item : %d", contacts_list_item);
 
-               if (display) {
-                       g_free(display);
-                       display = NULL;
+       if (contacts_list_item->display_name && contacts_list_item->email_address && 
+               (strcasestr(contacts_list_item->display_name, search_word) || strcasestr(contacts_list_item->email_address, search_word))) {
+               contacts_list_item->ugd = ugd;
+               contacts_list = eina_list_append(contacts_list, contacts_list_item);
+       } else {
+               if (contacts_list_item) {
+                       Eina_List *free_contacts_list = NULL;   /* to use existing composer_ps_delete_contacts_list API, a temp list is used */
+                       free_contacts_list = eina_list_append(free_contacts_list, contacts_list_item);
+                       composer_ps_delete_contacts_list(free_contacts_list);
+                       free_contacts_list = eina_list_free(free_contacts_list);
                }
-
- LOOP_TAIL:
-               contacts_svc_value_free(contact);
-               contacts_svc_value_free(email);
        }
-
-       contacts_svc_iter_remove(iter);
+       contacts_list_destroy(list, true);
 
        return contacts_list;
 }
@@ -424,6 +393,7 @@ 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) {
+                       contacts_list_item->ugd = NULL;
                        g_free(contacts_list_item->display);
                        contacts_list_item->display = NULL;
                        g_free(contacts_list_item->email_address);
index 0ed5faf..7446d22 100755 (executable)
@@ -30,6 +30,35 @@ static Evas_Object *_composer_mbe_create_recp_scroll(Evas_Object *parent);
 static Evas_Object *_composer_mbe_create_recp_layout(Evas_Object *parent);
 static Evas_Object *_composer_mbe_create_recipient_layout(Evas_Object *parent, COMPOSER_RECIPIENT_TYPE_E recp_type, EmailComposerUGD *ugd);
 
+static void _composer_mbe_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       debug_log("");
+
+       EmailComposerUGD *ugd = (EmailComposerUGD *)data;
+       if (!ugd)
+               return;
+
+       if (ugd->popup_list && (eina_list_count(ugd->popup_list) > 0)) {
+               Evas_Object *p;
+               p = eina_list_nth(ugd->popup_list, 0);
+
+               if (!p)
+                       return;
+               elm_object_focus_set(p, EINA_TRUE);
+               return;
+       }
+}
+
+static void _composer_mbe_expanded_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       debug_log("");
+}
+
+static void _composer_mbe_contracted_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       debug_log("");
+}
+
 static void _composer_mbe_register_mbe_entry_callback(Evas_Object *parent, EmailComposerUGD *ugd)
 {
        debug_log("");
@@ -49,6 +78,9 @@ static void _composer_mbe_register_mbe_callback(Evas_Object *parent, EmailCompos
        evas_object_smart_callback_add(parent, "item,clicked", _composer_mbe_selected_cb, ugd);
        evas_object_smart_callback_add(parent, "focused", _composer_mbe_focused_cb, ugd);
        evas_object_smart_callback_add(parent, "unfocused", _composer_mbe_unfocused_cb, ugd);
+       evas_object_smart_callback_add(parent, "expanded", _composer_mbe_expanded_cb, ugd);
+       evas_object_smart_callback_add(parent, "contracted", _composer_mbe_contracted_cb, ugd);
+       evas_object_smart_callback_add(parent, "clicked", _composer_mbe_clicked_cb, ugd);
 }
 
 static Evas_Object *_composer_mbe_create_mbe(Evas_Object *parent, COMPOSER_RECIPIENT_TYPE_E recp_type, EmailComposerUGD *ugd)
@@ -83,10 +115,12 @@ static Evas_Object *_composer_mbe_create_mbe(Evas_Object *parent, COMPOSER_RECIP
        }
        elm_object_text_set(mbe, recp_string);
 
-//     if (recp_type != COMPOSER_RECIPIENT_TYPE_FROM) {
-//             Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(entry);
-//             ecore_imf_context_input_panel_event_callback_add(imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _composer_input_panel_state_changed_cb, ugd);
-//     }
+       if (recp_type != COMPOSER_RECIPIENT_TYPE_FROM) {
+               Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(entry);
+               ecore_imf_context_input_panel_event_callback_add(imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _composer_input_panel_state_changed_cb, ugd);
+               ecore_imf_context_input_panel_event_callback_add (imf_context, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, _composer_input_panel_resize_cb, ugd);
+               debug_log("ugd->is_prediction: %d", ugd->is_prediction);
+       }
 
        _composer_mbe_register_mbe_callback(mbe, ugd);
        _composer_mbe_register_mbe_entry_callback(entry, ugd);
index 1a82c95..f25d3af 100755 (executable)
@@ -285,7 +285,7 @@ Eina_Bool email_composer_save_file(const gchar *path, const gchar *buf, gsize le
 
        Eina_Bool success_flag = EINA_TRUE;
 
-       if (STR_LEN((gchar *)buf) >= 0 && len >= 0) {
+       if (STR_LEN((gchar *)buf) > 0 && len > 0) {
                int fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
                if (fd != -1) {
                        ssize_t nwrite = write(fd, (const void *)buf, (size_t) len);
@@ -376,7 +376,7 @@ Eina_List *email_composer_change_GList_to_EinaList(GList * l)
        return list;
 }
 
-int _composer_add_mailbox_folder(EmailComposerUGD *ugd, email_mailbox_type_e mailbox_type)
+int _composer_add_mailbox_folder(EmailComposerUGD *ugd, email_mailbox_type_e mailbox_type, Eina_Bool b_save_to_draft)
 {
        debug_log("");
 
@@ -391,7 +391,7 @@ int _composer_add_mailbox_folder(EmailComposerUGD *ugd, email_mailbox_type_e mai
        debug_log("mailbox = %s", ugd->mailbox_info->mail_box->mailbox_name);
        debug_log("mailbox_id = %d", ugd->mailbox_info->mail_box->mailbox_id);
 
-       nResult = _composer_make_mail(ugd);
+       nResult = _composer_make_mail(ugd, b_save_to_draft);
        if (nResult < COMPOSER_ERROR_NONE) {
                debug_log("error in _composer_make_mail(%d)", nResult);
                return nResult;
@@ -419,7 +419,7 @@ int _composer_add_mailbox_folder(EmailComposerUGD *ugd, email_mailbox_type_e mai
        return COMPOSER_ERROR_NONE;
 }
 
-int _composer_move_mailbox_folder(EmailComposerUGD *ugd, email_mailbox_type_e mailbox_type)
+int _composer_move_mailbox_folder(EmailComposerUGD *ugd, email_mailbox_type_e mailbox_type, Eina_Bool b_save_to_draft)
 {
        debug_log("");
 
@@ -436,7 +436,7 @@ int _composer_move_mailbox_folder(EmailComposerUGD *ugd, email_mailbox_type_e ma
                return nResult;
        }
 
-       nResult = _composer_make_mail(ugd);
+       nResult = _composer_make_mail(ugd, b_save_to_draft);
        if (nResult < COMPOSER_ERROR_NONE) {
                debug_log("error in _composer_make_mail(%d)", nResult);
                return nResult;
@@ -458,7 +458,7 @@ int _composer_move_mailbox_folder(EmailComposerUGD *ugd, email_mailbox_type_e ma
        return COMPOSER_ERROR_NONE;
 }
 
-int _composer_make_mail(EmailComposerUGD *ugd)
+int _composer_make_mail(EmailComposerUGD *ugd, Eina_Bool b_save_to_draft)
 {
        debug_log("");
 
@@ -813,8 +813,9 @@ int _composer_send_mail(EmailComposerUGD *ugd)
                1) Add new edited email to Outbox.
                2) Delete the old email from Drafts / Outbox */
 
-               if (0 < ugd->mailbox_info->mailbox_id) {
-                       int ret = _composer_add_mailbox_folder(ugd, EMAIL_MAILBOX_TYPE_OUTBOX);
+               if (0 < ugd->mailbox_info->mailbox_id)
+               {
+                       int ret = _composer_add_mailbox_folder(ugd, EMAIL_MAILBOX_TYPE_OUTBOX, EINA_FALSE);
 
                        if (ret < COMPOSER_ERROR_NONE) {
                                debug_log("error in _composer_add_mailbox_folder(%d)", ret);
@@ -842,7 +843,7 @@ int _composer_send_mail(EmailComposerUGD *ugd)
                }
 
        } else {
-               int ret = _composer_add_mailbox_folder(ugd, EMAIL_MAILBOX_TYPE_OUTBOX);
+               int ret = _composer_add_mailbox_folder(ugd, EMAIL_MAILBOX_TYPE_OUTBOX, EINA_FALSE);
 
                if (ret < COMPOSER_ERROR_NONE) {
                        debug_log("error in _composer_add_mailbox_folder(%d)", ret);
@@ -932,8 +933,7 @@ void _composer_save_popup_response_cb(void *data, Evas_Object *obj, void *event_
        debug_log("selected button text = %s", pszBtnText);
 
        if (pszBtnText && strcmp(pszBtnText, dgettext("sys_string", "IDS_COM_SK_YES")) == 0) {
-
-               int ret = _composer_add_mailbox_folder(ugd, EMAIL_MAILBOX_TYPE_DRAFT);
+               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);
@@ -1161,9 +1161,10 @@ Evas_Object *_composer_load_edj(Evas_Object *parent, const char *file, const cha
        return eo;
 }
 
-Evas_Object *_composer_create_navigation_layout(Evas_Object *parent)
+Evas_Object *_composer_create_navigation_layout(EmailComposerUGD *ugd)
 {
        debug_log("");
+       Evas_Object *parent = ugd->main_layout;
        Evas_Object *navi_bar;
 
        navi_bar = elm_naviframe_add(parent);
@@ -1199,7 +1200,6 @@ Evas_Object *_composer_create_outer_layout(Evas_Object *parent)
        elm_layout_theme_set(layout, "layout", "application", "noindicator");
        evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_win_resize_object_add(parent, layout);
        evas_object_show(layout);
 
        return layout;
@@ -1248,8 +1248,6 @@ void _composer_set_mail_info(EmailComposerUGD *ugd)
                _composer_add_origin_msg(ugd);
        }
 
-       bool need_download = 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);
@@ -1259,25 +1257,24 @@ void _composer_set_mail_info(EmailComposerUGD *ugd)
                        for (i = 0; i < ugd->existing_mail_info->mail_data->attachment_count; i++) {
                                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->need_download = EINA_TRUE;
                                        ugd->fw_dn_cnt++;
                                }
                        }
-                       debug_log("need_download:%d, fw_dn_cnt:%d", need_download, ugd->fw_dn_cnt);
+                       debug_log("ugd->need_download:%d, fw_dn_cnt:%d", ugd->need_download, ugd->fw_dn_cnt);
                }
        }
 
        _composer_add_attachment(ugd);
 
-       if (need_download) {
-               _composer_show_download_attachment_popup(ugd);
-       }
+//     _composer_download_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);
 
-               char *plain_charset = NULL;
                if (ugd->existing_mail_info->mail_data && 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);
@@ -1288,11 +1285,10 @@ void _composer_set_mail_info(EmailComposerUGD *ugd)
                                        debug_log("ewkSetting is NULL.");
 
                                ewk_setting_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_Setting *ewkSetting = ewk_view_setting_get(ugd->body_ewkview);
@@ -1301,7 +1297,6 @@ void _composer_set_mail_info(EmailComposerUGD *ugd)
                                                debug_log("ewkSetting is NULL.");
 
                                        ewk_setting_default_encoding_set(ewkSetting, charset);
-                                       g_free(charset);
                                }
                        }
                }
@@ -1456,6 +1451,11 @@ static void _composer_dn_prog_popup_response_cb(void *data, Evas_Object *obj, vo
                        ugd->dn_prog_popup = NULL;
                }
 
+               _composer_webkit_set_body_script(data);
+               elm_object_tree_focus_allow_set(ugd->c_layout, EINA_TRUE); // block the focus not to open IME.
+               elm_object_disabled_set(ugd->send_btn, EINA_FALSE);
+               elm_object_disabled_set(ugd->cancel_btn, EINA_FALSE);
+
                _composer_cancel_download_attachment(ugd);
 
                ugd->selected_entry = ugd->to_mbe_entry;
@@ -1464,52 +1464,154 @@ static void _composer_dn_prog_popup_response_cb(void *data, Evas_Object *obj, vo
        }
 }
 
-void _composer_download_attachment(EmailComposerUGD *ugd)
+static Eina_Bool _composer_save_attachment(EmailComposerUGD *ugd, int index)
 {
        debug_log("");
 
-       int att_cnt = g_list_length(ugd->fw_attachment_list);
+       if (ugd->fw_attachment_list == NULL) {
+               return EINA_FALSE;
+       }
 
-       debug_log("att_cnt = %d", att_cnt);
+       EMAIL_ATTACHMENT_INFO_S *info = (EMAIL_ATTACHMENT_INFO_S *) g_list_nth_data(ugd->fw_attachment_list, index);
 
-       ugd->fw_dn_cnt = att_cnt;
+       if (info == NULL) {
+               debug_log("EMAIL_ATTACHMENT_INFO_S *info is NULL");
+               return EINA_FALSE;
+       }
 
-       int ret;
-       service_h service = NULL;
+       if (!info->downloaded) {
+               int handle = 0;
+               gboolean res = FALSE;
 
-       ret = service_create(&service);
-       debug_log("service_create: %d", ret);
-       if (!service) {
-               debug_log("service create failed");
-               return;
-       }
+               debug_log("Need attachment download");
+               /* download attachment */
+               info->downloaded = true;
 
-       ret = service_add_extra_data(service, EMAIL_BUNDLE_KEY_SAVE_ALL, "SAVE_ALL");
-       debug_log("service_add_extra_data: %d", ret);
+               res = email_engine_attachment_download(ugd->existing_mail_info->mail_data->account_id, info->mail_id, info->index, &handle);
 
-       ug_send_result(ugd->ug_main, service);
+               if (res == TRUE) {
+                       ugd->fw_dn_handle[index] = handle;
+                       ugd->idler_show_progress = ecore_idler_add(_composer_show_progress_popup, ugd);
+               } else {
+                       info->downloaded = false;
+                       _composer_create_noti(ugd, false, dgettext("sys_string", "IDS_COM_POP_WARNING"),
+                                                       _("IDS_EMAIL_POP_UNABLE_TO_OPEN_ATTACHMENT"), 1,
+                                                       dgettext("sys_string", "IDS_COM_SK_OK"), NULL,
+                                                       0, _composer_popup_response_cb);
+               }
 
-       ret = service_destroy(service);
-       debug_log("service_destroy: %d", ret);
+               return (res ? EINA_TRUE : EINA_FALSE);
+       }
 
-       ugd->idler_show_progress = ecore_idler_add(_composer_show_progress_popup, ugd);
+       return EINA_FALSE;
 }
 
+void _composer_download_attachment(EmailComposerUGD *ugd)
+{
+       debug_log("");
+       int i = 0;
+       int att_cnt = g_list_length(ugd->fw_attachment_list);
+
+       debug_log("att_cnt = %d", att_cnt);
+
+       ugd->fw_dn_cnt = att_cnt;
+
+       if (att_cnt > 0) {
+               for ( i = 0 ; i < att_cnt ; i++ ) {
+                       if (_composer_save_attachment(ugd, i) == EINA_TRUE) {
+                               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 {
+               ugd->need_download == EINA_FALSE;
+               ugd->bSendBtnDisabled = true;
+               ugd->send_timer = ecore_timer_add(0.5, _composer_send_mail_cb, ugd);
+       }
+ }
+
 void _composer_update_attachment_info(EmailComposerUGD *ugd, int index)
 {
        debug_log("");
 
-       int i;
+       int nAttachmentObjListCount = eina_list_count(ugd->attachment_item_obj_list);
+       debug_log("nAttachmentObjListCount : %d", nAttachmentObjListCount);
 
-       for (i = 0; i < g_list_length(ugd->fw_attachment_list); ++i) {
-               EMAIL_ATTACHMENT_INFO_S *info = (EMAIL_ATTACHMENT_INFO_S *) g_list_nth_data(ugd->fw_attachment_list, i);
-               {
+       if (nAttachmentObjListCount > 0) {
+               int nCount = 0;
+               Eina_Iterator *it = NULL;
+               Evas_Object *attachment_obj = NULL;
+               email_attachment_data_t *attachment_data;
+
+               it = eina_list_iterator_new(ugd->attachment_item_obj_list);
+
+               while (eina_iterator_next(it, (void **)&attachment_obj)) {
+                       char *path = NULL;
+                       EMAIL_ATTACHMENT_INFO_S *info = (EMAIL_ATTACHMENT_INFO_S *) g_list_nth_data(ugd->fw_attachment_list, nCount);
+                       debug_log("info : %x", info);
                        if (info) {
+                               debug_log("info->path : %s", info->path);
+                               debug_log("info->downloaded : %d", info->downloaded);
+                               debug_log("info->attach_id : %d", info->attach_id);
                                if (info->index == index) {
+                                       char newpath[MAX_PATH_LEN] = { 0, };
                                        info->downloaded = true;
-                                       info->path = email_engine_get_attachment_path(info->attach_id);
+                                       path = email_engine_get_attachment_path(info->attach_id);
+
+                                       debug_log("info->downloaded : %d", info->downloaded);
+                                       debug_log("path : %s", path);
+
+                                       attachment_data = evas_object_data_get(attachment_obj, "attachment_data");
+
+                                       if (attachment_data && path && STR_VALID(path)) {
+                                               int ret;
+                                               debug_log("path[%s]", path);
+                                               ret = email_attachments_save_file(path, newpath, NULL);
+                                               if (ret == EMAIL_EXT_SAVE_ERR_NONE) {
+                                                       char str[128] = { 0, };
+                                                       snprintf(str, sizeof(str), "%s", dgettext("sys_string", "IDS_COM_POP_SAVED"));
+                                                       /*_show_select_info(ug_data, str);*/
+                                                       ret = status_message_post(str);
+                                                       if (ret) {
+                                                               debug_log("status_message_post failed: %d", ret);
+                                                       }
+                                               }
+
+                                               attachment_data->attachment_path = g_strdup(path);
+                                               attachment_data->save_status = info->downloaded;
+                                               debug_log("attachment_name : %s", attachment_data->attachment_name);
+                                               debug_log("attachment_path : %s", attachment_data->attachment_path);
+                                               debug_log("attachment_id : %d", attachment_data->attachment_id);
+                                               debug_log("attachment_size : %d", attachment_data->attachment_size);
+                                               debug_log("save_status : %d", attachment_data->save_status);
+                                               debug_log("inline_content_status : %d", attachment_data->inline_content_status);
+
+                                               //_composer_attachment_update_thumbnail(ugd, attachment_obj, path);
+                                       }
+
+                                       if (path != NULL) {
+                                               g_free(path);
+                                               path = NULL;
+                                       }
                                }
                        }
+                       nCount++;
                }
        }
 }
@@ -1536,6 +1638,8 @@ void _composer_cancel_download_attachment(EmailComposerUGD *ugd)
        int ret;
        service_h service = NULL;
 
+       _composer_attachment_cancel_download(ugd);
+
        ret = service_create(&service);
        debug_log("service_create: %d", ret);
        if (!service) {
@@ -1809,7 +1913,7 @@ void _composer_add_to_address(EmailComposerUGD *ugd)
 {
        debug_log("");
 
-       Elm_Object_Item *item;
+       //Elm_Object_Item *item;
        Eina_Bool overflow_flag = TRUE;
        Eina_Bool invalid_address_flag = FALSE;
 
@@ -1827,7 +1931,8 @@ void _composer_add_to_address(EmailComposerUGD *ugd)
                        debug_log("display_name = %s, email_address = %s", ri->display_name, ri->email_list[0].email_addr);
 
                        if (!_composer_check_recipient_is_duplicated(ugd, ugd->to_mbe, ri)) {
-                               item = elm_multibuttonentry_item_append(ugd->to_mbe, ri->display_name, NULL, ri);
+                               elm_multibuttonentry_item_append(ugd->to_mbe, ri->display_name, NULL, ri);
+                               ri_used = 1;
                        } else {
                                if (ugd->composer_noti) {
                                        evas_object_del(ugd->composer_noti);
@@ -1836,8 +1941,6 @@ void _composer_add_to_address(EmailComposerUGD *ugd)
                                ugd->composer_noti = _composer_create_noti(ugd, false, dgettext("sys_string", "IDS_COM_POP_WARNING"),
                                        dgettext("sys_string", "IDS_COM_POP_ALREDY_EXISTS"), 0, NULL, NULL, 1.0, _composer_noti_response_cb);
                        }
-
-                       ri_used = 1;
                }
 
                if (ri && !ri_used) {
@@ -1928,11 +2031,11 @@ void _composer_add_to_address(EmailComposerUGD *ugd)
                                                        addrs_info = (email_address_info_t *) g_list_nth_data(ugd->to_list, i);
 
                                                        if (addrs_info->display_name && strlen(addrs_info->display_name) > 0)
-                                                               item = elm_multibuttonentry_item_append(ugd->to_mbe, addrs_info->display_name, NULL, ri);
+                                                               elm_multibuttonentry_item_append(ugd->to_mbe, addrs_info->display_name, NULL, ri);
                                                        else
-                                                               item = elm_multibuttonentry_item_append(ugd->to_mbe, ri->display_name, NULL, ri);
+                                                               elm_multibuttonentry_item_append(ugd->to_mbe, ri->display_name, NULL, ri);
                                                } else
-                                                       item = elm_multibuttonentry_item_append(ugd->to_mbe, ri->display_name, NULL, ri);
+                                                       elm_multibuttonentry_item_append(ugd->to_mbe, ri->display_name, NULL, ri);
                                        }
                                        ri_used = 1;
                                } else
@@ -1944,10 +2047,12 @@ void _composer_add_to_address(EmailComposerUGD *ugd)
                                        free(ri->display_name);
                                        ri->display_name = NULL;
                                }
+                       }
+
+                       if (ri) {
                                free(ri);
                                ri = NULL;
                        }
-
                }
 
                if (duplicate_cnt) {
@@ -1980,8 +2085,6 @@ void _composer_add_cc_address(EmailComposerUGD *ugd)
 {
        debug_log("");
 
-       Elm_Object_Item *item;
-
        Eina_Bool overflow_flag = TRUE;
 
        if (ugd->composer_type == RUN_COMPOSER_EDIT || ugd->composer_type == RUN_COMPOSER_REPLY_ALL
@@ -2063,11 +2166,11 @@ void _composer_add_cc_address(EmailComposerUGD *ugd)
                                                addrs_info = (email_address_info_t *) g_list_nth_data(ugd->cc_list, i);
 
                                                if (addrs_info->display_name && strlen(addrs_info->display_name) > 0)
-                                                       item = elm_multibuttonentry_item_append(ugd->cc_mbe, addrs_info->display_name, NULL, (void *)ri);
+                                                       elm_multibuttonentry_item_append(ugd->cc_mbe, addrs_info->display_name, NULL, (void *)ri);
                                                else
-                                                       item = elm_multibuttonentry_item_append(ugd->cc_mbe, ri->display_name, NULL, (void *)ri);
+                                                       elm_multibuttonentry_item_append(ugd->cc_mbe, ri->display_name, NULL, (void *)ri);
                                        } else
-                                               item = elm_multibuttonentry_item_append(ugd->cc_mbe, ri->display_name, NULL, (void *)ri);
+                                               elm_multibuttonentry_item_append(ugd->cc_mbe, ri->display_name, NULL, (void *)ri);
                                } else {
                                        duplicate_cnt++;
                                        if (ri) {
@@ -2117,8 +2220,6 @@ void _composer_add_bcc_address(EmailComposerUGD *ugd)
 {
        debug_log("");
 
-       Elm_Object_Item *item;
-
        Eina_Bool overflow_flag = TRUE;
 
        if (ugd->composer_type == RUN_COMPOSER_EDIT || ugd->composer_type == RUN_COMPOSER_REPLY_ALL
@@ -2200,11 +2301,11 @@ void _composer_add_bcc_address(EmailComposerUGD *ugd)
                                                addrs_info = (email_address_info_t *) g_list_nth_data(ugd->bcc_list, i);
 
                                                if (addrs_info->display_name && strlen(addrs_info->display_name) > 0)
-                                                       item = elm_multibuttonentry_item_append(ugd->bcc_mbe, addrs_info->display_name, NULL, (void *)ri);
+                                                       elm_multibuttonentry_item_append(ugd->bcc_mbe, addrs_info->display_name, NULL, (void *)ri);
                                                else
-                                                       item = elm_multibuttonentry_item_append(ugd->bcc_mbe, ri->display_name, NULL, (void *)ri);
+                                                       elm_multibuttonentry_item_append(ugd->bcc_mbe, ri->display_name, NULL, (void *)ri);
                                        } else
-                                               item = elm_multibuttonentry_item_append(ugd->bcc_mbe, ri->display_name, NULL, (void *)ri);
+                                               elm_multibuttonentry_item_append(ugd->bcc_mbe, ri->display_name, NULL, (void *)ri);
                                } else {
                                        duplicate_cnt++;
                                        if (ri) {
@@ -2439,6 +2540,12 @@ void _composer_make_html_body(EmailComposerUGD *ugd)
 
                                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);
@@ -2719,6 +2826,17 @@ void _composer_add_attachment(EmailComposerUGD *ugd)
                                                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);
                                        }
                                }
                        }
@@ -3038,9 +3156,9 @@ Evas_Object *_composer_create_noti(EmailComposerUGD *ugd, bool use_win, char *ti
        Evas_Object *notify;
 
        if (use_win)
-               notify = _composer_popup_create(ugd->main_layout, ugd);
+               notify = _composer_popup_create(ugd->win_main, ugd);
        else
-               notify = elm_popup_add(ugd->main_layout);
+               notify = elm_popup_add(ugd->win_main);
 
        debug_log("notify: %p", notify);
        if (!notify) {
@@ -3057,6 +3175,12 @@ Evas_Object *_composer_create_noti(EmailComposerUGD *ugd, bool use_win, char *ti
                elm_object_text_set(notify, content);
        }
 
+#ifdef _POPUP_WITH_LIST
+       elm_object_style_set(notify, "min_menustyle");
+#else
+       elm_object_style_set(notify, "menustyle");
+#endif
+
        if (btn_num == 1) {
                Evas_Object *peoBtn1 = NULL;
                peoBtn1 = elm_button_add(notify);
@@ -3105,9 +3229,9 @@ Evas_Object *_composer_create_popup(EmailComposerUGD *ugd, bool use_win, char *t
        Evas_Object *notify;
 
        if (use_win)
-               notify = _composer_popup_create(ugd->main_layout, ugd);
+               notify = _composer_popup_create(ugd->win_main, ugd);
        else
-               notify = elm_popup_add(ugd->main_layout);
+               notify = elm_popup_add(ugd->win_main);
 
        debug_log("notify: %p", notify);
        if (!notify) {
@@ -3194,6 +3318,7 @@ void _composer_noti_response_cb(void *data, Evas_Object *obj, void *event_info)
        EmailComposerUGD *ugd = (EmailComposerUGD *)data;
 
        elm_object_tree_focus_allow_set(ugd->c_layout, EINA_TRUE); // block the focus not to open IME.
+       ugd->focus_status = COMPOSER_FOCUS_STATUS_NONE;
 
        Evas_Object *mbe = NULL;
 
@@ -3243,6 +3368,11 @@ void _composer_popup_response_cb(void *data, Evas_Object *obj, void *event_info)
                mbe = ugd->bcc_mbe;
        }
 
+       if (mbe) {
+               Elm_Object_Item *item = elm_multibuttonentry_selected_item_get(mbe);
+               elm_multibuttonentry_item_selected_set(item, EINA_FALSE);
+       }
+
 //     elm_multibuttonentry_item_unselect_all(mbe);
        elm_object_tree_focus_allow_set(ugd->c_layout, EINA_TRUE);
 
@@ -3418,7 +3548,6 @@ Eina_Bool _composer_mbe_set_focus(void *data)
 void _composer_resize_body_webview(EmailComposerUGD *ugd, int ime_height)
 {
        int nWidth, nHeight;
-//     Evas_Coord x = 0, y = 0, w = 0, h = 0;
 
        _composer_display_position(ugd);
 
@@ -3437,18 +3566,44 @@ void _composer_resize_body_webview(EmailComposerUGD *ugd, int ime_height)
        evas_object_geometry_get(ugd->webkit_ly, &x, &y, &w, &h);
        debug_log(" === resize webkit_ly x:%d, y:%d, w:%d, h:%d", x, y, w, h);
 
-       if (ugd->option_header_opened == true) {
-               ime_height += 122;
+       if (ugd->isHorizontal == false) {
+               ugd->is_prediction = ((ime_height - COMPOSER_IME_HEIGHT_V) == 0) ? EINA_FALSE : EINA_TRUE;
+       } else {
+               ugd->is_prediction = ((ime_height - COMPOSER_IME_HEIGHT_H) == 0) ? EINA_FALSE : EINA_TRUE;
        }
+       debug_log("ugd->is_prediction(%d) : %d", ugd->is_prediction, ime_height - COMPOSER_IME_HEIGHT_V);
 
-       if (ugd->isRotated == false) {
+       if (ugd->isHorizontal == false) {
                // Webkit should be resized after showing/hiding IME
-               debug_log("nHeight:%d, COMPOSER_NAVI_HEIGHT:%d, indicator_height:%d", nHeight, COMPOSER_NAVI_HEIGHT, ugd->indicator_height);
-               evas_object_size_hint_min_set(ugd->webkit_ly, 0, nHeight - COMPOSER_NAVI_HEIGHT - ugd->indicator_height - ime_height);
+               debug_log("nHeight:%d, COMPOSER_NAVI_HEIGHT:%d, indicator_height:%d", nHeight, COMPOSER_NAVI_HEIGHT, COMPOSER_INDI_HEIGHT);
+               evas_object_size_hint_min_set(ugd->webkit_ly, 0, nHeight - COMPOSER_NAVI_HEIGHT - COMPOSER_INDI_HEIGHT - ime_height);
        } else {
-               debug_log("nHeight:%d, COMPOSER_NAVI_HEIGHT:%d, indicator_height:%d", nWidth, COMPOSER_NAVI_HEIGHT, ugd->indicator_height);
+               debug_log("nHeight:%d, COMPOSER_NAVI_HEIGHT:%d, indicator_height:%d", nWidth, COMPOSER_NAVI_HEIGHT, COMPOSER_INDI_HEIGHT);
                evas_object_size_hint_min_set(ugd->webkit_ly, 0, nWidth - COMPOSER_NAVI_HEIGHT - ime_height);
        }
+
+       if ((ugd->from_mbe != NULL) && (ugd->b_launch_finished == false)) {
+               ugd->b_launch_finished = true;
+               ugd->bringin_timer = ecore_timer_add(0.5f, _composer_bringin_cb, ugd);
+       }
+}
+
+void _composer_input_panel_resize_cb(void *data, Ecore_IMF_Context *ctx, int value)
+{
+       debug_log("");
+       int x, y, w, h;
+       EmailComposerUGD *ugd = (EmailComposerUGD *)data;
+
+       ecore_imf_context_input_panel_geometry_get (ctx, &x, &y, &w, &h);
+       debug_log("imf = [x:%d, y:%d, w:%d, h:%d]", x, y, w, h);
+
+       if (ugd->isHorizontal == false) {
+               ugd->is_prediction = ((h - COMPOSER_IME_HEIGHT_V) == 0) ? EINA_FALSE : EINA_TRUE;
+       } else {
+               ugd->is_prediction = ((h - COMPOSER_IME_HEIGHT_H) == 0) ? EINA_FALSE : EINA_TRUE;
+       }
+       _composer_resize_body_webview(ugd, h);
+       elm_layout_sizing_eval(ugd->c_layout);
 }
 
 void _composer_input_panel_state_changed_cb(void *data, Ecore_IMF_Context *ctx, int value)
@@ -3463,7 +3618,7 @@ void _composer_input_panel_state_changed_cb(void *data, Ecore_IMF_Context *ctx,
                if (ctx) {
                        int x, y, w, h;
                        ecore_imf_context_input_panel_geometry_get(ctx, &x, &y, &w, &h);
-                       debug_log("imf = [x:%d, y:%d, h:%d, w:%d]", x, y, w, h);
+                       debug_log("imf = [x:%d, y:%d, w:%d, h:%d]", x, y, w, h);
 
                        debug_log("IME status changed to %d", value);
 
@@ -3492,10 +3647,6 @@ void _composer_display_position(void *data)
        debug_log("scroller   = [x:%d, y:%d, w:%d, h:%d]", x, y, w, h);
        x = y = w = h = 0;
 
-       evas_object_geometry_get(ugd->conform, &x, &y, &w, &h);
-       debug_log("conformant = [x:%d, y:%d, w:%d, h:%d]", x, y, w, h);
-       x = y = w = h = 0;
-
        if (ugd->from_ly) {
                evas_object_geometry_get(ugd->from_ly, &x, &y, &w, &h);
                debug_log("from       = [x:%d, y:%d, w:%d, h:%d]", x, y, w, h);
index 2b33c83..1f90457 100755 (executable)
@@ -386,7 +386,8 @@ static void on_destroy(ui_gadget_h ug, service_h data, void *priv)
        ethumb_shutdown();
 
        debug_log("contact service end");
-       contacts_svc_disconnect();
+       contacts_disconnect2();
+
        _on_edbus_remove_receiver(ugd);
 
        ret = e_dbus_shutdown();
@@ -445,53 +446,33 @@ static void on_event(ui_gadget_h ug, enum ug_event event, service_h data, void *
        case UG_EVENT_ROTATE_PORTRAIT:
                elm_layout_theme_set(ugd->main_layout, "layout", "application", "default");
 //             elm_win_indicator_mode_set(ugd->win_main, ELM_WIN_INDICATOR_SHOW);
-               if (ugd->option_header_opened) {
-                       elm_object_item_signal_emit(ugd->navi_item, "elm,state,optionheader,close", "");
-                       ugd->option_header_opened = FALSE;
-               }
-               ugd->isRotated = false;
+               ugd->isHorizontal = false;
                win_main_angle = 0;
-               _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_V);
                break;
        case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
                elm_layout_theme_set(ugd->main_layout, "layout", "application", "default");
 //             elm_win_indicator_mode_set(ugd->win_main, ELM_WIN_INDICATOR_SHOW);
-               if (ugd->option_header_opened) {
-                       elm_object_item_signal_emit(ugd->navi_item, "elm,state,optionheader,close", "");
-                       ugd->option_header_opened = FALSE;
-               }
-               ugd->isRotated = false;
+               ugd->isHorizontal = false;
                win_main_angle = 180;
-               _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_V);
                break;
        case UG_EVENT_ROTATE_LANDSCAPE:
                elm_layout_theme_set(ugd->main_layout, "layout", "application", "noindicator");
 //             elm_win_indicator_mode_set(ugd->win_main, ELM_WIN_INDICATOR_HIDE);
-               if (ugd->option_header_opened) {
-                       elm_object_item_signal_emit(ugd->navi_item, "elm,state,optionheader,close", "");
-                       ugd->option_header_opened = FALSE;
-               }
-               ugd->isRotated = true;
+               ugd->isHorizontal = true;
                win_main_angle = 270;
-               _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_H);
                break;
        case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
                elm_layout_theme_set(ugd->main_layout, "layout", "application", "noindicator");
 //             elm_win_indicator_mode_set(ugd->win_main, ELM_WIN_INDICATOR_HIDE);
-               if (ugd->option_header_opened) {
-                       elm_object_item_signal_emit(ugd->navi_item, "elm,state,optionheader,close", "");
-                       ugd->option_header_opened = FALSE;
-               }
-               ugd->isRotated = true;
+               ugd->isHorizontal = true;
                win_main_angle = 90;
-               _composer_resize_body_webview(ugd, COMPOSER_IME_HEIGHT_H);
                break;
        case UG_EVENT_REGION_CHANGE:
                break;
        default:
                break;
        }
-
+       _composer_resize_body_webview(ugd, 0);
        elm_layout_sizing_eval(ugd->c_layout);
 
        debug_log("win_main_angle: %d, win_rotation: %d, device_orientation: %d, event: %d", win_main_angle, elm_win_rotation_get(ugd->win_main), app_get_device_orientation(), event);
@@ -509,7 +490,7 @@ static void on_event(ui_gadget_h ug, enum ug_event event, service_h data, void *
        }
 #ifdef _TEMPORARY_FIX_FOR_ROTATION_
        else {
-               if (ugd->isRotated)
+               if (ugd->isHorizontal)
                        ugd->temporary_fix_for_rotation = true;
        }
 #else
@@ -518,10 +499,10 @@ static void on_event(ui_gadget_h ug, enum ug_event event, service_h data, void *
        // The bottom of the main scroller is below the screen.
        int nWidth, nHeight;
        ecore_x_window_size_get(ecore_x_window_root_first_get(), &nWidth, &nHeight);
-       if (ugd->isRotated) { // LANDSCAPE
+       if (ugd->isHorizontal) { // LANDSCAPE
                evas_object_size_hint_min_set(ugd->body_ewkview, nHeight, nWidth - COMPOSER_NAVI_HEIGHT); // screen doesn't have indicator in case of LANDSCAPRE mode
        } else { // PORTRAIT
-               evas_object_size_hint_min_set(ugd->body_ewkview, nWidth, nHeight - COMPOSER_NAVI_HEIGHT - ugd->indicator_height);
+               evas_object_size_hint_min_set(ugd->body_ewkview, nWidth, nHeight - COMPOSER_NAVI_HEIGHT - COMPOSER_INDI_HEIGHT);
        }
 #endif
 
@@ -530,6 +511,7 @@ static void on_event(ui_gadget_h ug, enum ug_event event, service_h data, void *
        }
 
        elm_win_rotation_with_resize_set(ugd->win_main, win_main_angle);
+       ugd->isRotated = true;
 
 //     ugd->bringin_timer = ecore_timer_add(0.1f, _composer_bringin_cb, ugd);
 }
@@ -616,7 +598,6 @@ static Evas_Object *create_fullview(Evas_Object *parent, EmailComposerUGD *ugd)
        elm_layout_theme_set(base, "layout", "application", "default");
        evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(base, EVAS_HINT_FILL, EVAS_HINT_FILL);
-       elm_win_resize_object_add(parent, base);
 
        bg = elm_bg_add(base);
        evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -693,7 +674,6 @@ static void _win_profile_changed_cb(void *data, Evas_Object *obj, void *event)
                elm_layout_theme_set(ugd->main_layout, "layout", "application", "default");
 
        evas_object_size_hint_weight_set(ugd->main_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_win_resize_object_add(ugd->win_main, ugd->main_layout);
        evas_object_show(ugd->main_layout);
 }
 
@@ -734,7 +714,9 @@ static void _composer_remove_temp_folder()
                if (g_strcmp0(".", dir_entry->d_name) == 0 || g_strcmp0("..", dir_entry->d_name) == 0)
                        continue;
                snprintf(buffer, 256, "%s/%s", EMAIL_TMP_FOLDER, dir_entry->d_name);
-               remove(buffer);
+               if (-1 == remove(buffer)) {
+                       debug_log("Failed to remove buffer");
+               }
        }
        closedir(dir);
        rmdir(EMAIL_TMP_FOLDER);
@@ -838,29 +820,21 @@ void create_composer_frame(EmailComposerUGD *ugd)
        Evas_Object *outer_layout;
        Evas_Object *inner_layout;
        Evas_Object *inner_sc;
-       Evas_Object *conform;
 
        win = ugd->win_main;
-       elm_win_conformant_set(win, EINA_TRUE);
        ugd->evas = evas_object_evas_get(win);
 
-       nf = _composer_create_navigation_layout(ugd->main_layout);
+       nf = _composer_create_navigation_layout(ugd);
        outer_layout = _composer_create_outer_layout(nf);
        inner_layout = _composer_create_composer_layout(nf);
        inner_sc = _composer_create_main_scroller(nf);
 
-       conform = elm_conformant_add(win);
-       evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_show(conform);
-
        elm_object_content_set(inner_sc, inner_layout);
-       elm_object_content_set(conform, inner_sc);
-       elm_object_part_content_set(outer_layout, "elm.swallow.content", conform);
+       elm_object_part_content_set(outer_layout, "elm.swallow.content", inner_sc);
 
        ugd->navi_bar = nf;
        ugd->main_scroller = inner_sc;
        ugd->c_layout = inner_layout;
-       ugd->conform = conform;
 
        _composer_create_view(inner_layout, ugd);
 
@@ -1029,17 +1003,19 @@ static void _composer_init_data(void *data)
        ugd->bcc_added = false;
        ugd->me_added = false;
        ugd->isRotated = false;
+       ugd->isHorizontal = false;
        ugd->is_recipient_duplicated = false;
 
        ugd->temporary_fix_for_rotation = false;
+       ugd->is_prediction = EINA_FALSE;
        ugd->is_main_scroller_scrolling = false;
        ugd->is_webview_scrolling = false;
-       ecore_x_e_illume_indicator_geometry_get(ecore_x_window_root_first_get(), NULL, NULL, NULL, &ugd->indicator_height);
 
        ugd->focus_status = COMPOSER_FOCUS_STATUS_NONE;
        ugd->listOfImageUrls = NULL;
 
        ugd->b_load_finished = EINA_FALSE;
+       ugd->need_download = EINA_FALSE;
 
        Elm_Theme *th = elm_theme_new();
        elm_theme_ref_set(th, NULL);
@@ -1076,7 +1052,7 @@ static int _composer_init_service(void *data)
        COMPOSER_ERROR_TYPE_E ret = COMPOSER_ERROR_NONE;
 
        debug_log("contact service begin");
-       contacts_svc_connect();
+       contacts_connect2();
 
        /* DBUS */
        if (_composer_dbus_receiver_setup(ugd) < 0)
@@ -1104,7 +1080,7 @@ static void _composer_finish_service(void *data)
        email_engine_finalize();
 
        debug_log("contact service end");
-       contacts_svc_disconnect();
+       contacts_disconnect2();
 
        _on_edbus_remove_receiver(ugd);
 
@@ -1974,11 +1950,6 @@ static void _on_edbus_event_composer_receive(void *data, DBusMessage * message)
                                /* DATA1[mail_id] DATA2[NULL] DATA3[attachment_id] */
                                debug_log("receive noti, DOWNLOAD_ATTACH_FINISH");
 
-                               int idx = 0;
-                               Eina_List *list = NULL;
-
-                               int att_cnt = g_list_length(ugd->fw_attachment_list);
-
                                if (ugd->fw_dn_cnt > 0) {
                                        ugd->fw_dn_cnt--;
 
@@ -1989,24 +1960,11 @@ static void _on_edbus_event_composer_receive(void *data, DBusMessage * message)
 
                                                _composer_update_attachment_info(ugd, data3);
 
-                                               for (idx = 0; idx < att_cnt; idx++) {
-                                                       EMAIL_ATTACHMENT_INFO_S *info = g_list_nth_data(ugd->fw_attachment_list, idx);
-
-                                                       if (info == NULL) {
-                                                               debug_log("Attachment is NULL");
-                                                               continue;
-                                                       }
-
-                                                       if (!info->inline_content) {
-                                                               if (info->downloaded) {
-                                                                       debug_log("path %s", info->path);
-                                                                       if (info->path)
-                                                                               list = eina_list_append(list, info->path);
-                                                               }
-                                                       }
+                                               if (ugd->need_download == EINA_TRUE) {
+                                                       ugd->bSendBtnDisabled = true;
+                                                       ugd->send_timer = ecore_timer_add(0.5, _composer_send_mail_cb, ugd);            
+                                                       ugd->need_download = EINA_FALSE;
                                                }
-
-                                               _composer_attachment_create_list(ugd, list, EINA_FALSE);
                                        } else {
                                                debug_log("Donwload Not Finished");
 
diff --git a/images/M02_icon_favorite_off_74x74.png b/images/M02_icon_favorite_off_74x74.png
new file mode 100755 (executable)
index 0000000..8cae127
Binary files /dev/null and b/images/M02_icon_favorite_off_74x74.png differ
diff --git a/images/M02_icon_favorite_on_74x74.png b/images/M02_icon_favorite_on_74x74.png
new file mode 100755 (executable)
index 0000000..03b7fe1
Binary files /dev/null and b/images/M02_icon_favorite_on_74x74.png differ
index 0fd91a8..15f4d88 100755 (executable)
@@ -25,7 +25,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/include)
 INCLUDE(FindPkgConfig)
 pkg_check_modules(pkgs-mailbox REQUIRED appcore-efl ui-gadget-1
                elementary email-service glib-2.0 edbus bundle dlog
-               capi-appfw-application status)
+               capi-appfw-application status contacts-service2)
 
 FOREACH(flag ${pkgs-mailbox_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index d37cda2..b22cea3 100755 (executable)
@@ -19,7 +19,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/include)
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs-email REQUIRED appcore-efl ui-gadget-1 elementary email-service bundle dlog ecore-input edbus)
+pkg_check_modules(pkgs-email REQUIRED appcore-efl ui-gadget-1 elementary email-service bundle dlog ecore-input edbus contacts-service2)
 
 FOREACH(flag ${pkgs-email_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index 25ca0ef..aaee93b 100755 (executable)
@@ -46,6 +46,7 @@ struct appdata {
 
        Evas *evas;
        Evas_Object *win_main;
+       Evas_Object *conform;
 
        int account_id;
        char *account_name;
@@ -106,7 +107,6 @@ static void layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
        switch (mode) {
        case UG_MODE_FULLVIEW:
                evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-               elm_win_resize_object_add(win, base);
                ug_disable_effect(ug);
                evas_object_show(base);
                break;
@@ -319,16 +319,20 @@ static bool app_create(void *data)
                return false;
        }
        ad->win_main = win;
+       elm_win_conformant_set(win, EINA_TRUE);
+
+       ad->conform = elm_conformant_add(ad->win_main);
+       evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(ad->win_main, ad->conform);
+       evas_object_show(ad->conform);
+
+       /*key_down_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _email_ui_keydown_cb, ad);*/
 
        UG_INIT_EFL(ad->win_main, UG_OPT_INDICATOR_ENABLE);
 
-       email_icu_mutex_init();
        /* icu */
        email_open_icu_pattern_generator();
 
-       //Register timezone changed callback
-       email_register_timezone_changed_callback(_email_timezone_change_cb, NULL);
-
        return true;
 }
 
@@ -338,11 +342,6 @@ static int app_terminate(void *data)
 
        set_app_terminated();
 
-       //email_close_icu_pattern_generator();
-       email_deregister_timezone_changed_callback(_email_timezone_change_cb);
-
-       email_icu_mutex_destroy();
-
        email_engine_finalize_force();
 
        int ret = e_dbus_shutdown();
@@ -873,8 +872,11 @@ static int check_aul_launch_operation(service_h b, struct appdata *ad)
                        }
 
                        int acc_id;
-                       email_engine_get_default_account(&acc_id);
-
+                       int err = 0;
+                       err = email_engine_get_default_account(&acc_id);
+                       if (err != EMAIL_ERROR_NONE) {
+                               debug_log("email_engine_get_default_account is failed");
+                       }
                        service_h service = NULL;
 
                        ret = service_create(&service);
@@ -1126,6 +1128,7 @@ static void popup_response_cb(void *data, Evas_Object *obj, void *event_info)
        debug_log("");
        elm_exit();
 }
+
 static void _email_timezone_change_cb(keynode_t *key, void *data)
 {
        debug_log("");
index 563a170..6f6e16b 100755 (executable)
@@ -30,6 +30,7 @@ BuildRequires:  pkgconfig(efreet)
 BuildRequires:  pkgconfig(capi-appfw-application)
 BuildRequires:  pkgconfig(capi-base-common)
 BuildRequires:  pkgconfig(contacts-service)
+BuildRequires:  pkgconfig(contacts-service2)
 BuildRequires:  pkgconfig(ethumb)
 BuildRequires:  pkgconfig(libmedia-utils)
 BuildRequires:  pkgconfig(calendar-service2)
index a1c5b4a..66af5dd 100755 (executable)
@@ -446,11 +446,7 @@ static void _push_naviframe(struct viewdata *vd)
        evas_object_size_hint_aspect_set(title_ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
        elm_icon_resizable_set(title_ic, EINA_TRUE, EINA_TRUE);
 
-       if (account_data->incoming_server_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC) {
-               elm_icon_file_set(title_ic, ACCOUNT_ICON_EXCHANGE, NULL);
-       } else {
-               elm_icon_file_set(title_ic, account_data->logo_icon_path, NULL);
-       }
+       elm_icon_file_set(title_ic, account_data->logo_icon_path, NULL);
 
        account_user_data_t *user_data = (account_user_data_t *)account_data->user_data;
 
index 17aa4ab..a3ac7bd 100755 (executable)
@@ -21,7 +21,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/include)
 INCLUDE(FindPkgConfig)
 pkg_check_modules(pkgs-viewer REQUIRED appcore-efl ui-gadget-1 x11 elementary ecore glib-2.0 gobject-2.0
                status capi-media-metadata-extractor capi-media-image-util capi-content-media-content
-               email-service edbus capi-appfw-application vconf ewebkit2 contacts-service sysman bundle dlog efreet-mime libmedia-utils calendar-service2 ethumb)
+               email-service edbus capi-appfw-application vconf ewebkit2 contacts-service2 sysman bundle dlog efreet-mime libmedia-utils calendar-service2 ethumb)
 
 FOREACH(flag ${pkgs-viewer_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index 4ce72bc..018f6bd 100755 (executable)
@@ -130,13 +130,6 @@ struct list_data {
        Elm_Object_Item *item;
 };
 
-typedef struct _EMAIL_CONTACT_LIST_INFO_S {
-       int index;
-       char *display;
-       char *email_address;
-       char display_name[40];
-} EMAIL_CONTACT_LIST_INFO_S;
-
 typedef struct _EmailViewerWebview EmailViewerWebview;
 struct _EmailViewerWebview {
        Evas_Coord minw, minh;
@@ -232,7 +225,6 @@ struct ug_data {
        Evas_Object *dg_attach;
        Evas_Object *addrs;
        Evas_Object *scroller;
-       Evas_Object *conformant;
        Evas_Object *webview_bx;
        Evas_Object *main_bx;
        Evas_Object *navi_bar;
@@ -281,14 +273,11 @@ struct ug_data {
        Evas_Object *progress_bar[ATTACH_MAX];
        Evas_Object *progress_bar_ly[ATTACH_MAX];
 
-       Elm_Object_Item *reply_ctr_it;
-       Elm_Object_Item *replyall_ctr_it;
-       Elm_Object_Item *forward_ctr_it;
-       Elm_Object_Item *calendar_ctr_it;
-       Elm_Object_Item *resend_ctr_it;
-       Elm_Object_Item *move_ctr_it;
-       Elm_Object_Item *del_ctr_it;
-       Elm_Object_Item *more_ctr_it;
+       Evas_Object *reply_btn;
+       Evas_Object *delete_btn;
+       Evas_Object *resend_btn;
+       Evas_Object *cancel_btn;
+       Evas_Object *move_btn;
 
        Elm_Object_Item *more_ctx_block_item;
        Elm_Object_Item *ctx_block_item;
@@ -317,6 +306,8 @@ struct ug_data {
        Ecore_Idler *idler;
        Ecore_Timer *timer;
        Ecore_Timer *waiting_timer;
+
+       Evas_Object *gesture_obj;
 };
 
 void _hide_view(EmailViewerUGD *ug_data);
index ff0bbd1..48cae75 100755 (executable)
@@ -532,10 +532,13 @@ void _delete_email(EmailViewerUGD *ug_data)
                                                sync = EMAIL_DELETE_LOCAL_AND_SERVER;
                                        }
                                }
-                               email_free_account(&account_data, 1);
-                               account_data = NULL;
                        }
                }
+
+               if (account_data) {
+                       email_free_account(&account_data, 1);
+                       account_data = NULL;
+               }
        }
 
        if (!email_engine_delete_mail(priv->account_id, priv->mailbox_id, priv->mail_id, sync)) {
@@ -679,7 +682,7 @@ Eina_Bool viewer_save_file(const gchar *path, const gchar *buf, gsize len)
 
        Eina_Bool success_flag = EINA_TRUE;
 
-       if (STR_LEN((gchar *)buf) >= 0 && len >= 0) {
+       if (STR_LEN((gchar *)buf) >= 0) {
                int fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
                if (fd != -1) {
                        ssize_t nwrite = write(fd, (const void *)buf, (size_t) len);
index 275fef3..d569186 100755 (executable)
@@ -265,13 +265,20 @@ static Eina_Bool _loading_prog_finish_cb(void *data)
 static void _webview_load_finished_cb(void *data, Evas_Object *obj, void *event_info)
 {
        debug_log("");
-       if (_g_ug_data == NULL) {
-               debug_log("_g_ug_data == NULL");
+       if (data == NULL) {
+               debug_log("data == NULL");
                return;
        }
 
        EmailViewerUGD *ug_data = (EmailViewerUGD *)data;
 
+       if (_g_ug_data == NULL) {
+               debug_log("_g_ug_data == NULL");
+               evas_object_del(ug_data->timeout_popup);
+               ug_data->timeout_popup = NULL;
+               return;
+       }
+
        ug_data->b_load_finished = EINA_TRUE;
 
        /*_measure_webview_xy(ug_data);*/
@@ -319,11 +326,14 @@ static void _webview_load_finished_cb(void *data, Evas_Object *obj, void *event_
                                debug_log("send_read_report: %d", ud->send_read_report);
                                send_read_report = ud->send_read_report;
                        }
-                       email_free_account(&account, 1);
-                       account = NULL;
                }
        }
 
+       if (account != NULL) {
+               email_free_account(&account, 1);
+               account = NULL;
+       }
+
        debug_log("flags_seen_field:%d, send_read_report:%d, request_report:%d, report_status:%d", ug_data->email_data->mail_info->flags_seen_field, send_read_report, ug_data->property->request_report, ug_data->email_data->mail_info->report_status & EMAIL_MAIL_REQUEST_MDN);
        if (!ug_data->email_data->mail_info->flags_seen_field && send_read_report && ug_data->property->request_report == TRUE && (ug_data->email_data->mail_info->report_status & EMAIL_MAIL_REQUEST_MDN)) {
                int send_result = _send_read_report_mail(ug_data);
@@ -516,7 +526,7 @@ static void _webview_contextmenu_selected_cb(void *data, Evas_Object *webview, v
        Ewk_Context_Menu_Item* menu_item = (Ewk_Context_Menu_Item*)event_info;
        Ewk_Context_Menu_Item_Tag menu_item_tag = EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION;
 
-       int img_buf_len = 0;
+       gsize img_buf_len = 0;
        gchar *img_buf = NULL;
        char *img_url = NULL;
        Ewk_Hit_Test *ewk_hit_test = NULL;
@@ -579,7 +589,7 @@ static void _webview_contextmenu_selected_cb(void *data, Evas_Object *webview, v
                                ret = media_content_scan_file(new_path);
                                debug_log("media_content_scan_file: %d", ret);
                        }
-                       
+
                        ret = media_content_disconnect();
                        if (ret) {
                                debug_log("media_content_disconnect() is failed!");
index 7f5758f..2c1d658 100755 (executable)
@@ -67,6 +67,7 @@ static void _create_view(EmailViewerUGD *ug_data);
 static void _reset_view(EmailViewerUGD *ug_data);
 
 static void _win_profile_changed_cb(void *data, Evas_Object *obj, void *event);
+static void _timezone_changed_cb(keynode_t *key, void *data);
 
 static Evas_Object *_create_navigation_bar(EmailViewerUGD *ug_data);
 static Evas_Object *_create_subject(EmailViewerUGD *ug_data);
@@ -77,14 +78,14 @@ static Evas_Object *_create_attach(EmailViewerUGD *ug_data);
 static Evas_Object *_create_attach_ex(EmailViewerUGD *ug_data);
 static Evas_Object *_create_body(EmailViewerUGD *ug_data);
 static Evas_Object *_create_tab_bar(EmailViewerUGD *ug_data);
-static Evas_Object *_update_tab_bar(EmailViewerUGD *ug_data);
+//static Evas_Object *_update_tab_bar(EmailViewerUGD *ug_data);
 static Evas_Object *_create_partial_body_dn_btn(EmailViewerUGD *ug_data);
 static Evas_Object *_create_bg(Evas_Object *win);
 
 static void _create_down_progress(char *message, popup_cb resp_cb);
 static void _create_down_progress_ex(int index, EMAIL_VIEWER_PROGRESSBAR_TYPE p_type);
 static void _destroy_down_progress_ex(void *data, Evas_Object *obj, void *event_info);
-static void _create_more_ctxpopup(EmailViewerUGD *ug_data);
+static void _create_more_ctxpopup(EmailViewerUGD *ug_data, Evas_Object *obj);
 static void _delete_evas_objects(EmailViewerUGD *ug_data);
 
 /* callback functions */
@@ -95,7 +96,10 @@ static void _reply_cb(void *data, Evas_Object *obj, void *event_info);
 static void _reply_all_cb(void *data, Evas_Object *obj, void *event_info);
 static void _reply_option_cb(void *data, Evas_Object *obj, void *event_info);
 static void _forward_cb(void *data, Evas_Object *obj, void *event_info);
+static void _launch_message_composer(EmailViewerUGD *ug_data);
 static void _resend_cb(void *data, Evas_Object *obj, void *event_info);
+static void _cancel_send_cb(void *data, Evas_Object *obj, void *event_info);
+static void _edit_email_cb(void *data, Evas_Object *obj, void *event_info);
 static void _delete_cb(void *data, Evas_Object *obj, void *event_info);
 static void _move_cb(void *data, Evas_Object *obj, void *event_info);
 static void _more_cb(void *data, Evas_Object *obj, void *event_info);
@@ -382,7 +386,7 @@ static void *on_create(ui_gadget_h ug, enum ug_mode mode, service_h data, void *
                ug_data->webview_margin_landscape = 379;
        } else if (w == 720) {
                ug_data->webview_width = 710.0;
-               ug_data->webview_height = 1021.0;
+               ug_data->webview_height = 1122.0;
                ug_data->webview_width_landscape = 710.0;
                ug_data->webview_height_landscape = 558.0;
                ug_data->webview_margin = 1029;
@@ -413,14 +417,19 @@ static void *on_create(ui_gadget_h ug, enum ug_mode mode, service_h data, void *
                                debug_log("show_images is %d", ud->show_images);
                                ug_data->b_show_remote_images = ud->show_images;
                        }
-                       email_free_account(&account, 1);
-                       account = NULL;
                }
        }
 
+       if (account) {
+               email_free_account(&account, 1);
+               account = NULL;
+       }
+
        /* DBUS */
        _dbus_receiver_setup(ug_data);
 
+       email_register_timezone_changed_callback(_timezone_changed_cb, ug_data);
+
        _init_viewer_data(ug_data->account_id, ug_data->mail_id, NULL, ug_data);
        _create_view(ug_data);
 
@@ -463,11 +472,18 @@ static void on_destroy(ui_gadget_h ug, service_h data, void *pd)
        if (ug_data->b_direct_destroy)
                return;
 
+       if (ug_data->email_data == NULL) {
+               debug_log("ug_data->email_data is NULL.");
+               return;
+       }
        /* stop engine */
        EmailViewerPrivate *priv = ug_data->email_data;
-       EmailViewerProp *prop = ug_data->property;
        int i = 0;
-       int att_len = g_list_length(prop->attachments);
+       int att_len = 0;
+
+       if (ug_data->property) {
+               att_len = g_list_length(ug_data->property->attachments);
+       }
 
        if (priv->email_handle != 0)
                email_engine_stop_working(ug_data->account_id, priv->email_handle);
@@ -520,29 +536,32 @@ static void on_destroy(ui_gadget_h ug, service_h data, void *pd)
        }
 
        debug_log("free attachment");
-       if (ug_data->property->attachments) {
-               int i = 0;
-               LIST_ITER_START(i, ug_data->property->attachments) {
-                       EmailAttachmentType *info = (EmailAttachmentType *)LIST_ITER_GET_DATA(i, ug_data->property->attachments);
-                       if (info->name)
-                               free(info->name);
-                       if (info->path)
-                               free(info->path);
-                       free(info);
+       if (ug_data->property) {
+               if (ug_data->property->attachments) {
+                       int i = 0;
+                       LIST_ITER_START(i, ug_data->property->attachments) {
+                               EmailAttachmentType *info = (EmailAttachmentType *)LIST_ITER_GET_DATA(i, ug_data->property->attachments);
+                               if (info->name)
+                                       free(info->name);
+                               if (info->path)
+                                       free(info->path);
+                               free(info);
+                       }
+                       g_list_free(ug_data->property->attachments);
+                       ug_data->property->attachments = NULL;
                }
-               g_list_free(ug_data->property->attachments);
-               ug_data->property->attachments = NULL;
-       }
 
-       debug_log("free property");
-       if (ug_data->property) {
-               free(ug_data->property);
-               ug_data->property = NULL;
+               debug_log("free property");
+               if (ug_data->property) {
+                       free(ug_data->property);
+                       ug_data->property = NULL;
+               }
        }
 
        ug_data->base = NULL;
 
        _viewer_remove_temp_folder();
+       email_deregister_timezone_changed_callback(_timezone_changed_cb);
 
        _dbus_receiver_remove(NULL);
        int ret = e_dbus_shutdown();
@@ -677,8 +696,6 @@ static void on_message(ui_gadget_h ug, service_h msg, service_h data, void *priv
                                debug_log("show_images is %d", ud->show_images);
                                ug_data->b_show_remote_images = ud->show_images;
                        }
-                       email_free_account(&account, 1);
-                       account = NULL;
                }
 
                Ewk_Setting *setting = ewk_view_setting_get(ug_data->webview);
@@ -689,6 +706,11 @@ static void on_message(ui_gadget_h ug, service_h msg, service_h data, void *priv
                }
        }
 
+       if (account) {
+               email_free_account(&account, 1);
+               account = NULL;
+       }
+
        _init_viewer_data(ug_data->account_id, ug_data->mail_id, NULL, ug_data);
 
        evas_object_show(ug_data->layout_main);
@@ -720,13 +742,30 @@ static void on_event(ui_gadget_h ug, enum ug_event event, service_h data, void *
        case UG_EVENT_LOW_BATTERY:
                break;
        case UG_EVENT_LANG_CHANGE:
+               if (ug_data->reply_btn)
+                       elm_object_text_set(ug_data->reply_btn, dgettext("sys_string", "IDS_COM_SK_REPLY"));
+               if (ug_data->delete_btn)
+                       elm_object_text_set(ug_data->delete_btn, dgettext("sys_string", "IDS_COM_SK_DELETE"));
+               if (ug_data->resend_btn)
+                       elm_object_text_set(ug_data->resend_btn, _("IDS_EMAIL_SK_RESEND"));
+               if (ug_data->cancel_btn)
+                       elm_object_text_set(ug_data->cancel_btn, dgettext("sys_string", "IDS_COM_SK_CANCEL"));
+               if (ug_data->move_btn)
+                       elm_object_text_set(ug_data->move_btn, _("IDS_EMAIL_SK_MOVE"));
+
+               if (ug_data->dn_btn) {
+                       elm_object_text_set(ug_data->dn_btn, _("IDS_EMAIL_BODY_DOWNLOAD_MESSAGE"));
+               }
+
+               if (ug_data->partial_dn_btn) {
+                       elm_object_text_set(ug_data->partial_dn_btn, _("IDS_EMAIL_BODY_DOWNLOAD_FULL_MESSAGE"));
+               }
                break;
        case UG_EVENT_ROTATE_PORTRAIT:
        case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
                if (ug_data->b_internal && ug_data->isRotate == true) {
                        ewk_view_command_execute(ug_data->webview, "Unselect", NULL);
                        debug_log("In Full view - Showing navi bar");
-                       elm_naviframe_item_title_visible_set(ug_data->navi_main_it, EINA_TRUE);
 
                        if (ug_data->con_popup) {
                                evas_object_del(ug_data->con_popup);
@@ -768,7 +807,6 @@ static void on_event(ui_gadget_h ug, enum ug_event event, service_h data, void *
                if (ug_data->b_internal && ug_data->isRotate == false) {
                        ewk_view_command_execute(ug_data->webview, "Unselect", NULL);
                        debug_log("In Split view - Hiding navi bar");
-                       elm_naviframe_item_title_visible_set(ug_data->navi_main_it, EINA_FALSE);
 
                        if (ug_data->con_popup) {
                                evas_object_del(ug_data->con_popup);
@@ -777,22 +815,16 @@ static void on_event(ui_gadget_h ug, enum ug_event event, service_h data, void *
 
                        if (ug_data->navi_move_it1) {
                                debug_log("move1");
-                               ug_data->move_cbar = elm_toolbar_add(ug_data->navi_bar);
-                               elm_toolbar_shrink_mode_set(ug_data->move_cbar, ELM_TOOLBAR_SHRINK_EXPAND);
-                               elm_object_style_set(ug_data->move_cbar, "naviframe");
-                               evas_object_show(ug_data->move_cbar);
-
-                               elm_object_item_disabled_set(elm_toolbar_item_append(ug_data->move_cbar, NULL, "", NULL, NULL), EINA_TRUE);
-                               elm_toolbar_item_append(ug_data->move_cbar, NULL, dgettext("sys_string", "IDS_COM_SK_CANCEL"), _move_back_cb, ug_data);
-                               elm_object_item_part_content_set(ug_data->navi_move_it1, "controlbar", ug_data->move_cbar);
-
-                               Evas_Object *move_back_btn = elm_object_item_part_content_get(ug_data->navi_move_it1, "prev_btn");
-                               if (move_back_btn) {
-                                       evas_object_smart_callback_del(move_back_btn, "clicked", _move_back_cb);
-                                       evas_object_del(move_back_btn);
-                                       elm_object_item_part_content_set(ug_data->navi_move_it1, "prev_btn", NULL);
-                               }
+                               Evas_Object *move_back_btn = elm_button_add(ug_data->navi_bar);
+                               elm_object_style_set(move_back_btn, "naviframe/back_btn/default");
+                               evas_object_smart_callback_add(move_back_btn, "clicked", _move_back_cb, ug_data);
+                               elm_object_item_part_content_set(ug_data->navi_move_it1, "prev_btn", move_back_btn);
                                elm_naviframe_item_title_visible_set(ug_data->navi_move_it1, EINA_FALSE);
+                               if (ug_data->move_cbar) {
+                                       elm_object_item_part_content_unset(ug_data->navi_move_it1, "controlbar");
+                                       evas_object_del(ug_data->move_cbar);
+                                       ug_data->move_cbar = NULL;
+                               }
                        }
 
                        if (ug_data->b_btn) {
@@ -927,7 +959,6 @@ static void layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
        switch (mode) {
        case UG_MODE_FULLVIEW:
                evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-               elm_win_resize_object_add(win, base);
                evas_object_show(base);
                break;
        default:
@@ -974,6 +1005,16 @@ static void result_cb(ui_gadget_h ug, service_h result, void *priv)
                        g_free(cmd);
                        return;
                }
+
+               ret = service_get_extra_data(result, EMAIL_BUNDLE_KEY_UPDATE, (char **)&cmd);
+               debug_log("service_get_extra_data: %d", ret);
+               debug_log("return of bundle_get_val for cancel all(%s)", cmd);
+               if (cmd) {
+                       debug_log("update attachments in viewer(%s)", cmd);
+                       //ancel_download_attachment(ug_data);
+                       g_free(cmd);
+                       return;
+               }
        }
 }
 
@@ -984,7 +1025,6 @@ static void destroy_cb(ui_gadget_h ug, void *priv)
                return;
 
        EmailViewerUGD *ug_data = (EmailViewerUGD *)priv;
-       EmailViewerProp *prop = ug_data->property;
        ug_data->display_download_result = TRUE;
 
        if (ug == ug_data->ug_composer) {
@@ -992,21 +1032,6 @@ static void destroy_cb(ui_gadget_h ug, void *priv)
        }
 
        ug_destroy(ug);
-
-       if (ug_data->b_contact_ug_launched) {
-               debug_log("change navibar title label");
-               EMAIL_CONTACT_LIST_INFO_S *contact_list_item = NULL;
-               contact_list_item = (EMAIL_CONTACT_LIST_INFO_S *)_contact_search_by_email(ug_data, prop->sender);
-
-               if (contact_list_item) {
-                       elm_object_item_text_set(ug_data->navi_main_it, contact_list_item->display_name);
-                       _delete_contacts_list(contact_list_item);
-               } else {
-                       elm_object_item_text_set(ug_data->navi_main_it, prop->sender_display_name);
-               }
-
-               ug_data->b_contact_ug_launched = FALSE;
-       }
 }
 
 static ui_gadget_h create_ug(char *ug_name, service_h bd, void *data)
@@ -1032,8 +1057,6 @@ static void _create_view(EmailViewerUGD *ug_data)
        debug_log("");
 
        Evas_Object *b_btn;
-       Evas_Object *prev_btn;
-       Evas_Object *next_btn;
        EmailViewerProp *prop = ug_data->property;
 
        ug_data->bg = _create_bg(ug_data->win_main);
@@ -1070,33 +1093,10 @@ static void _create_view(EmailViewerUGD *ug_data)
        evas_object_smart_callback_add(b_btn, "clicked", _back_cb, ug_data);
        ug_data->b_btn = b_btn;
 
-       ug_data->navi_main_it = elm_naviframe_item_push(ug_data->navi_bar, prop->sender_display_name, b_btn, NULL, ug_data->sub_ly, NULL);
+       ug_data->navi_main_it = elm_naviframe_item_push(ug_data->navi_bar, NULL/*prop->sender_display_name*/, b_btn, NULL, ug_data->sub_ly, NULL);
+       elm_naviframe_item_title_visible_set(ug_data->navi_main_it, EINA_FALSE);
 
-       if (ug_data->b_internal) {
-               /* Left : previous button */
-               prev_btn = elm_button_add(ug_data->navi_bar);
-               Evas_Object *prev_ic = elm_icon_add(prev_btn);
-               elm_icon_file_set(prev_ic, IMGDIR "/M02_icon_previous.png", NULL);
-               elm_object_style_set(prev_btn, "naviframe/title/default");
-               evas_object_size_hint_aspect_set(prev_ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
-               elm_icon_resizable_set(prev_ic, 0.8, 0.8);
-               elm_object_part_content_set(prev_btn, "icon", prev_ic);
-               elm_object_item_part_content_set(ug_data->navi_main_it, "title_left_btn", prev_btn);
-               evas_object_smart_callback_add(prev_btn, "clicked", _prev_mail_cb, ug_data);
-               ug_data->prev_btn = prev_btn;
-
-               /* Right : next button */
-               next_btn = elm_button_add(ug_data->navi_bar);
-               Evas_Object *next_ic = elm_icon_add(next_btn);
-               elm_icon_file_set(next_ic, IMGDIR "/M02_icon_next.png", NULL);
-               elm_object_style_set(next_btn, "naviframe/title/default");
-               evas_object_size_hint_aspect_set(next_ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
-               elm_icon_resizable_set(next_ic, 0.8, 0.8);
-               elm_object_part_content_set(next_btn, "icon", next_ic);
-               elm_object_item_part_content_set(ug_data->navi_main_it, "title_right_btn", next_btn);
-               evas_object_smart_callback_add(next_btn, "clicked", _next_mail_cb, ug_data);
-               ug_data->next_btn = next_btn;
-       }
+       _create_tab_bar(ug_data);
 
        /* create scroller */
        ug_data->scroller = elm_scroller_add(ug_data->navi_bar);
@@ -1108,39 +1108,7 @@ static void _create_view(EmailViewerUGD *ug_data)
        evas_object_smart_callback_add(ug_data->scroller, "edge,top", _outter_scroller_top_hit_cb, ug_data);
        evas_object_smart_callback_add(ug_data->scroller, "scroll,drag,start", _outter_scroller_scroll_cb, ug_data);
 
-       /* create conformant */
-       elm_win_conformant_set(ug_data->win_main, EINA_TRUE);
-       ug_data->conformant = elm_conformant_add(ug_data->sub_ly);
-       elm_object_style_set(ug_data->conformant, "internal_layout");
-       evas_object_size_hint_weight_set(ug_data->conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_size_hint_align_set(ug_data->conformant, EVAS_HINT_FILL, EVAS_HINT_FILL);
-       elm_object_content_set(ug_data->conformant, ug_data->scroller);
-       elm_object_part_content_set(ug_data->sub_ly, "elm.swallow.content", ug_data->conformant);
-       evas_object_show(ug_data->conformant);
-
-       if (ug_data->from_list != NULL) {
-               email_address_info_t *addrs_info = NULL;
-               int n_from_list = g_list_length(ug_data->from_list);
-               debug_log("from list count [%d]", n_from_list);
-
-               if (n_from_list > 0) {
-                       addrs_info = (email_address_info_t *) g_list_nth_data(ug_data->from_list, 0);
-                       debug_log("From Address:%s", addrs_info->address);
-                       debug_log("Display Name:%s", addrs_info->display_name);
-                       debug_log("Storage Type:%d", addrs_info->storage_type);
-                       debug_log("Contact ID:%d", addrs_info->contact_id);
-                       debug_log("");
-                       g_free(prop->sender_display_name);
-                       prop->sender_display_name = g_strdup(addrs_info->display_name);
-                       g_free(prop->sender);
-                       prop->sender = g_strdup(addrs_info->address);
-
-                       if (addrs_info->display_name && strlen(addrs_info->display_name) > 0)
-                               elm_object_item_text_set(ug_data->navi_main_it, addrs_info->display_name);
-                       else
-                               elm_object_item_text_set(ug_data->navi_main_it, addrs_info->address);
-               }
-       }
+       elm_object_part_content_set(ug_data->sub_ly, "elm.swallow.content", ug_data->scroller);
 
        /* create main box */
        ug_data->main_bx = elm_box_add(ug_data->navi_bar);
@@ -1163,7 +1131,6 @@ static void _create_view(EmailViewerUGD *ug_data)
 
        if (ug_data->isRotate == true) {
                debug_log("In Split view - Hiding navi bar");
-               elm_naviframe_item_title_visible_set(ug_data->navi_main_it, EINA_FALSE);
 
                if (ug_data->b_btn) {
                        debug_log("hiding back button");
@@ -1187,7 +1154,6 @@ static void _reset_view(EmailViewerUGD *ug_data)
        debug_log("@@@@@@@@@@ isRotate = %d", ug_data->isRotate);
        if (ug_data->isRotate == true) {
                debug_log("In Split view - Hiding navi bar");
-               elm_naviframe_item_title_visible_set(ug_data->navi_main_it, EINA_FALSE);
 
                if (ug_data->b_btn) {
                        debug_log("hiding back button");
@@ -1203,7 +1169,6 @@ static void _reset_view(EmailViewerUGD *ug_data)
                elm_scroller_region_show(ug_data->scroller, 0, 0, (int)((double)ug_data->main_h * 0.6), ug_data->main_w);
        } else {
                debug_log("In Full view - Showing navi bar");
-               elm_naviframe_item_title_visible_set(ug_data->navi_main_it, EINA_TRUE);
 
                if (ug_data->b_btn) {
 
@@ -1224,33 +1189,6 @@ static void _reset_view(EmailViewerUGD *ug_data)
                elm_scroller_region_show(ug_data->scroller, 0, 0, ug_data->main_w, ug_data->main_h);
        }
 
-       if (ug_data->from_list != NULL) {
-               email_address_info_t *addrs_info = NULL;
-               int n_from_list = g_list_length(ug_data->from_list);
-               debug_log("from list count [%d]", n_from_list);
-
-               if (n_from_list > 0) {
-                       addrs_info = (email_address_info_t *) g_list_nth_data(ug_data->from_list, 0);
-                       if (addrs_info) {
-                               debug_log("From Address:%s", addrs_info->address);
-                               debug_log("Display Name:%s", addrs_info->display_name);
-                               debug_log("Storage Type:%d", addrs_info->storage_type);
-                               debug_log("Contact ID:%d", addrs_info->contact_id);
-                               g_free(prop->sender_display_name);
-                               prop->sender_display_name = g_strdup(addrs_info->display_name);
-                               g_free(prop->sender);
-                               prop->sender = g_strdup(addrs_info->address);
-
-                               if (addrs_info->display_name && strlen(addrs_info->display_name) > 0)
-                                       elm_object_item_text_set(ug_data->navi_main_it, addrs_info->display_name);
-                               else
-                                       elm_object_item_text_set(ug_data->navi_main_it, addrs_info->address);
-                       }
-               }
-       } else {
-               elm_object_item_text_set(ug_data->navi_main_it, prop->sender_display_name);
-       }
-
        /* reset subject */
        char *_subject = elm_entry_utf8_to_markup(prop->subject);
        if (!g_strcmp0(_subject, "")) {
@@ -1278,14 +1216,22 @@ static void _reset_view(EmailViewerUGD *ug_data)
 
        elm_object_part_text_set(ug_data->ly_subject, "elm.text.sub", date_time);
 
+       /* reset icons */
+       /*Evas_Object *attach_icon = elm_icon_add(ug_data->ly_subject);
+       elm_icon_file_set(attach_icon, IMGDIR "/M02_email_icon_attach.png", NULL);
+       evas_object_size_hint_aspect_set(attach_icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+       elm_icon_resizable_set(attach_icon, 1, 1);
+       elm_object_part_content_set(ug_data->ly_subject, "elm.icon.attach", attach_icon);
+       evas_object_show(attach_icon);*/
+
        Evas_Object *favorite_icon = elm_icon_add(ug_data->ly_subject);
        switch(prop->favorite)
        {
                case EMAIL_FLAG_NONE:
-                       elm_icon_file_set(favorite_icon, IMGDIR "/M02_email_icon_favorite_off.png", NULL);
+                       elm_icon_file_set(favorite_icon, IMGDIR "/M02_icon_favorite_off_74x74.png", NULL);
                        break;
                case EMAIL_FLAG_FLAGED:
-                       elm_icon_file_set(favorite_icon, IMGDIR "/M02_email_icon_favorite_on.png", NULL);
+                       elm_icon_file_set(favorite_icon, IMGDIR "/M02_icon_favorite_on_74x74.png", NULL);
                        break;
                case EMAIL_FLAG_TASK_STATUS_CLEAR:
                        elm_icon_file_set(favorite_icon, IMGDIR "/M02_email_Flag_Clear.png", NULL);
@@ -1368,14 +1314,6 @@ void _hide_view(EmailViewerUGD *ug_data)
                elm_object_item_part_content_unset(ug_data->navi_main_it, "controlbar");
                evas_object_del(ug_data->ctr_bar);
                ug_data->ctr_bar = NULL;
-
-               ug_data->reply_ctr_it = NULL;
-               ug_data->replyall_ctr_it = NULL;
-               ug_data->forward_ctr_it = NULL;
-               ug_data->calendar_ctr_it = NULL;
-               ug_data->resend_ctr_it = NULL;
-               ug_data->move_ctr_it = NULL;
-               ug_data->del_ctr_it = NULL;
        }
 
        if (ug_data->to_ly) {
@@ -1452,6 +1390,39 @@ void _hide_view(EmailViewerUGD *ug_data)
 
        ewk_view_uri_set(ug_data->webview, EMAIL_DEFAULT_HTML);
 
+#ifdef _URI_SET
+       ewk_view_uri_set(ug_data->webview, EMAIL_DEFAULT_HTML/*""*/);
+#else
+       char tmp_file_path[MAX_PATH_LEN] = { 0, };
+       char *file_stream = NULL;
+       int file_size = 0;
+       FILE *fp = NULL;
+
+       fp = fopen(DATADIR"/_email_default.html", "r");
+       if (fp != NULL) {
+               fseek(fp, 0L, SEEK_END);
+               file_size = ftell(fp);
+               debug_log("file size: %d", file_size);
+               fseek(fp, 0L, SEEK_SET);
+
+               if (file_size > 0) {
+                       file_stream = calloc(file_size, sizeof(char));
+
+                       if (file_stream) {
+                               if (fread(file_stream, sizeof(char), file_size, fp) != file_size) {
+                                       debug_log("error in fread");
+                               }
+                       }
+               }
+
+               fclose(fp);
+       }
+
+       snprintf(tmp_file_path, sizeof(tmp_file_path), "file://%s", RESDIR);
+       debug_log("tmp_file_path [%s]", tmp_file_path);
+       ewk_view_contents_set(ug_data->webview, file_stream, file_size, NULL, DEFAULT_CHARSET, tmp_file_path);
+       g_free(file_stream);
+#endif
        _viewer_remove_temp_folder();
 
        debug_log("free address info list");
@@ -1496,10 +1467,47 @@ static void _win_profile_changed_cb(void *data, Evas_Object *obj, void *event)
                elm_layout_theme_set(ug_data->layout_main, "layout", "application", "default");
 
        evas_object_size_hint_weight_set(ug_data->layout_main, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_win_resize_object_add(ug_data->win_main, ug_data->layout_main);
        evas_object_show(ug_data->layout_main);
 }
 
+static void _timezone_changed_cb(keynode_t *key, void *data)
+{
+       debug_enter();
+       EmailViewerUGD *ug_data = (EmailViewerUGD *)data;
+       EmailViewerProp *prop = ug_data->property;
+       int ret;
+       char date_time[MAX_STR_LEN] = { 0, };
+
+       char *timezone_id = NULL;
+       UChar utimezone_id[512] = { 0, };
+       UErrorCode status = U_ZERO_ERROR;
+
+       timezone_id = vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID);
+
+       if (!timezone_id)
+               return;
+
+       u_uastrcpy(utimezone_id, timezone_id);
+
+       ucal_setDefaultTimeZone(utimezone_id, &status);
+
+       if (U_FAILURE(status))
+               return;
+
+       char *formatted_date = NULL;
+
+       if (icu_timeformat == APPCORE_TIME_FORMAT_12)
+               formatted_date = email_get_date_text(icu_locale, "yMdhms", &(prop->mktime));
+       else
+               formatted_date = email_get_date_text(icu_locale, "yMdHms", &(prop->mktime));
+       ret = snprintf(date_time, MAX_STR_LEN, "%s", formatted_date);
+       free(formatted_date);
+       formatted_date = NULL;
+
+       elm_object_part_text_set(ug_data->ly_subject, "elm.text.sub", date_time);
+       debug_leave();
+}
+
 static Evas_Object *_create_navigation_bar(EmailViewerUGD *ug_data)
 {
        debug_log("");
@@ -1558,14 +1566,21 @@ static Evas_Object *_create_subject(EmailViewerUGD *ug_data)
 
        elm_object_part_text_set(di, "elm.text.sub", date_time);
 
+       /*Evas_Object *attach_icon = elm_icon_add(di);
+       elm_icon_file_set(attach_icon, IMGDIR "/M02_email_icon_attach.png", NULL);
+       evas_object_size_hint_aspect_set(attach_icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+       elm_icon_resizable_set(attach_icon, 1, 1);
+       elm_object_part_content_set(di, "elm.icon.attach", attach_icon);
+       evas_object_show(attach_icon);*/
+
        Evas_Object *favorite_icon = elm_icon_add(di);
        switch(prop->favorite)
        {
                case EMAIL_FLAG_NONE:
-                       elm_icon_file_set(favorite_icon, IMGDIR "/M02_email_icon_favorite_off.png", NULL);
+                       elm_icon_file_set(favorite_icon, IMGDIR "/M02_icon_favorite_off_74x74.png", NULL);
                        break;
                case EMAIL_FLAG_FLAGED:
-                       elm_icon_file_set(favorite_icon, IMGDIR "/M02_email_icon_favorite_on.png", NULL);
+                       elm_icon_file_set(favorite_icon, IMGDIR "/M02_icon_favorite_on_74x74.png", NULL);
                        break;
                case EMAIL_FLAG_TASK_STATUS_CLEAR:
                        elm_icon_file_set(favorite_icon, IMGDIR "/M02_email_Flag_Clear.png", NULL);
@@ -1912,6 +1927,16 @@ static Evas_Object *_create_attach(EmailViewerUGD *ug_data)
                elm_box_pack_after(ug_data->main_bx, di, ug_data->ly_subject);
                ug_data->attach_hd_ly = di;
                ug_data->attach_hd_bk = di;
+
+               _create_attach_ex(ug_data);
+
+               for (i = 0; i < prop->real_att_len; i++) {
+                       if (ug_data->attach_ex_ly[i] != NULL) {
+                               debug_log("index %d", i);
+                               elm_box_unpack(ug_data->main_bx, ug_data->attach_ex_ly[i]);
+                               evas_object_hide(ug_data->attach_ex_ly[i]);
+                       }
+               }
        } else {
                debug_log("Attachment doesn't exist");
        }
@@ -2044,7 +2069,7 @@ static Evas_Object *_create_body(EmailViewerUGD *ug_data)
                evas_object_show(ug_data->webview);
                elm_box_pack_end(ug_data->main_bx, ug_data->webview_bx);
 
-               _update_tab_bar(ug_data);
+//             _update_tab_bar(ug_data);
        } else {
                /* create webview layout */
                ug_data->webview_bx = _load_edj(ug_data->navi_bar, EV_THEME_PATH, "layout.email.web_view");
@@ -2092,11 +2117,6 @@ static Evas_Object *_create_body(EmailViewerUGD *ug_data)
 
                /* set touch callbacks */
                evas_object_smart_callback_add(ug_data->webview, "policy,navigation,decide", _webview_policy_navigation_decide_cb, ug_data);
-               evas_object_event_callback_add(ug_data->webview, EVAS_CALLBACK_MULTI_DOWN, _webview_multi_down_cb, ug_data);
-               evas_object_event_callback_add(ug_data->webview, EVAS_CALLBACK_MULTI_UP, _webview_multi_up_cb, ug_data);
-
-               /* update control Bar */
-               _update_tab_bar(ug_data);
        }
 
        viewer_set_mail_seen(prop, priv->mail_info);
@@ -2112,59 +2132,77 @@ static Evas_Object *_create_body(EmailViewerUGD *ug_data)
        return ug_data->webview_bx;
 }
 
+static Evas_Object *_create_toolbar_btn(Evas_Object *parent, const char *text, Evas_Smart_Cb func, void *data, const char *style)
+{
+       debug_log("");
+       Evas_Object *btn = elm_button_add(parent);
+       if (!btn) return NULL;
+       if (style)
+               elm_object_style_set(btn, style);
+       else
+               elm_object_style_set(btn, "naviframe/toolbar/default");
+       elm_object_text_set(btn, text);
+       evas_object_smart_callback_add(btn, "clicked", func, data);
+       return btn;
+}
+
+static Evas_Object *_create_toolbar_more_btn(Evas_Object *parent, Evas_Smart_Cb func, void *data)
+{
+       debug_log("");
+       Evas_Object *btn = elm_button_add(parent);
+       if (!btn) return NULL;
+       elm_object_style_set(btn, "naviframe/more/default");
+       evas_object_smart_callback_add(btn, "clicked", func, data);
+       return btn;
+}
+
 static Evas_Object *_create_tab_bar(EmailViewerUGD *ug_data)
 {
        debug_log("mailbox_type:%d", ug_data->mailbox_type);
 
        EmailViewerProp *prop = ug_data->property;
-       Evas_Object *obj;
-       obj = elm_toolbar_add(ug_data->navi_bar);
-       elm_toolbar_shrink_mode_set(obj, ELM_TOOLBAR_SHRINK_EXPAND);
-       elm_object_style_set(obj, "naviframe");
+       Evas_Object *more_btn = NULL;
+
+       more_btn = _create_toolbar_more_btn(ug_data->navi_bar, _more_cb, ug_data);
+       elm_object_item_part_content_set(ug_data->navi_main_it, "toolbar_more_btn", more_btn);
 
        if (ug_data->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX || ug_data->mailbox_type == EMAIL_MAILBOX_TYPE_SENTBOX ||
                ug_data->mailbox_type == EMAIL_MAILBOX_TYPE_TRASH || ug_data->mailbox_type == EMAIL_MAILBOX_TYPE_SPAMBOX) {
+
                int n_to_list = g_list_length(ug_data->to_list);
                int n_cc_list = g_list_length(ug_data->cc_list);
                debug_log("to:%d, cc:%d", n_to_list, n_cc_list);
                if (n_to_list + n_cc_list >= 2) {
-                       ug_data->reply_ctr_it = elm_toolbar_item_append(obj, ICON_REPLY, dgettext("sys_string", "IDS_COM_SK_REPLY"), _reply_option_cb, ug_data);
+                       ug_data->reply_btn = _create_toolbar_btn(ug_data->navi_bar, dgettext("sys_string", "IDS_COM_SK_REPLY"), _reply_option_cb, ug_data, "naviframe/toolbar/left");
                } else {
-                       ug_data->reply_ctr_it = elm_toolbar_item_append(obj, ICON_REPLY, dgettext("sys_string", "IDS_COM_SK_REPLY"), _reply_cb, ug_data);
+                       ug_data->reply_btn = _create_toolbar_btn(ug_data->navi_bar, dgettext("sys_string", "IDS_COM_SK_REPLY"), _reply_cb, ug_data, "naviframe/toolbar/left");
                }
-               ug_data->forward_ctr_it = elm_toolbar_item_append(obj, ICON_FORWARD, dgettext("sys_string", "IDS_COM_BODY_FORWARD"), _forward_cb, ug_data);
-               ug_data->del_ctr_it = elm_toolbar_item_append(obj, ICON_DELETE, dgettext("sys_string", "IDS_COM_SK_DELETE"), _delete_cb, ug_data);
-               ug_data->more_ctr_it = elm_toolbar_item_append(obj, ICON_CONTROLBAR_MORE, dgettext("sys_string", "IDS_COM_SK_MORE"), _more_cb, ug_data);
-
-               elm_object_item_disabled_set(ug_data->reply_ctr_it, EINA_TRUE);
-               elm_object_item_disabled_set(ug_data->forward_ctr_it, EINA_TRUE);
+               elm_object_item_part_content_set(ug_data->navi_main_it, "toolbar_button1", ug_data->reply_btn);
+               ug_data->delete_btn = _create_toolbar_btn(ug_data->navi_bar, dgettext("sys_string", "IDS_COM_SK_DELETE"), _delete_cb, ug_data, "naviframe/toolbar/right");
+               elm_object_item_part_content_set(ug_data->navi_main_it, "toolbar_button2", ug_data->delete_btn);
        } else if (ug_data->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) {
                debug_log("save_status: %d", prop->status2);
-               if (prop->status2 == EMAIL_MAIL_STATUS_SEND_FAILURE) {
-                       ug_data->resend_ctr_it = elm_toolbar_item_append(obj, ICON_RESEND, _("IDS_EMAIL_SK_RESEND"), _resend_cb, ug_data);
-                       ug_data->del_ctr_it = elm_toolbar_item_append(obj, ICON_DELETE, dgettext("sys_string", "IDS_COM_SK_DELETE"), _delete_cb, ug_data);
+               if (prop->status2 == EMAIL_MAIL_STATUS_SEND_FAILURE || prop->status2 == EMAIL_MAIL_STATUS_SEND_CANCELED) {
+                       ug_data->resend_btn = _create_toolbar_btn(ug_data->navi_bar, _("IDS_EMAIL_SK_RESEND"), _resend_cb, ug_data, "naviframe/toolbar/left");
+                       elm_object_item_part_content_set(ug_data->navi_main_it, "toolbar_button1", ug_data->resend_btn);
+                       ug_data->delete_btn = _create_toolbar_btn(ug_data->navi_bar, dgettext("sys_string", "IDS_COM_SK_DELETE"), _delete_cb, ug_data, "naviframe/toolbar/right");
+                       elm_object_item_part_content_set(ug_data->navi_main_it, "toolbar_button2", ug_data->delete_btn);
+               } else if (prop->status2 == EMAIL_MAIL_STATUS_SEND_WAIT) {
+                       ug_data->cancel_btn = _create_toolbar_btn(ug_data->navi_bar, dgettext("sys_string", "IDS_COM_SK_CANCEL"), _cancel_send_cb, ug_data, "naviframe/toolbar/left");
+                       elm_object_item_part_content_set(ug_data->navi_main_it, "toolbar_button1", ug_data->cancel_btn);
+                       ug_data->delete_btn = _create_toolbar_btn(ug_data->navi_bar, dgettext("sys_string", "IDS_COM_SK_DELETE"), _delete_cb, ug_data, "naviframe/toolbar/right");
+                       elm_object_item_part_content_set(ug_data->navi_main_it, "toolbar_button2", ug_data->delete_btn);
                } else {
-                       ug_data->del_ctr_it = elm_toolbar_item_append(obj, ICON_DELETE, dgettext("sys_string", "IDS_COM_SK_DELETE"), _delete_cb, ug_data);
+                       ug_data->move_btn = _create_toolbar_btn(ug_data->navi_bar, _("IDS_EMAIL_SK_MOVE"), _move_cb, ug_data, "naviframe/toolbar/left");
+                       elm_object_item_part_content_set(ug_data->navi_main_it, "toolbar_button1", ug_data->move_btn);
+                       ug_data->delete_btn = _create_toolbar_btn(ug_data->navi_bar, dgettext("sys_string", "IDS_COM_SK_DELETE"), _delete_cb, ug_data, "naviframe/toolbar/right");
+                       elm_object_item_part_content_set(ug_data->navi_main_it, "toolbar_button1", ug_data->delete_btn);
                }
        } else {
-               ug_data->del_ctr_it = elm_toolbar_item_append(obj, ICON_DELETE, dgettext("sys_string", "IDS_COM_SK_DELETE"), _delete_cb, ug_data);
-               ug_data->move_ctr_it = elm_toolbar_item_append(obj, ICON_MOVE, _("IDS_EMAIL_SK_MOVE"), _move_cb, ug_data);
-       }
-
-       elm_object_item_part_content_set(ug_data->navi_main_it, "controlbar", obj);
-       ug_data->ctr_bar = obj;
-
-       return NULL;
-}
-
-static Evas_Object *_update_tab_bar(EmailViewerUGD *ug_data)
-{
-       debug_log("mailbox_type:%d", ug_data->mailbox_type);
-
-       if (ug_data->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX || ug_data->mailbox_type == EMAIL_MAILBOX_TYPE_SENTBOX ||
-                 ug_data->mailbox_type == EMAIL_MAILBOX_TYPE_TRASH || ug_data->mailbox_type == EMAIL_MAILBOX_TYPE_SPAMBOX) {
-               elm_object_item_disabled_set(ug_data->reply_ctr_it, EINA_FALSE);
-               elm_object_item_disabled_set(ug_data->forward_ctr_it, EINA_FALSE);
+               ug_data->move_btn = _create_toolbar_btn(ug_data->navi_bar, _("IDS_EMAIL_SK_MOVE"), _move_cb, ug_data, "naviframe/toolbar/left");
+               elm_object_item_part_content_set(ug_data->navi_main_it, "toolbar_button1", ug_data->move_btn);
+               ug_data->delete_btn = _create_toolbar_btn(ug_data->navi_bar, dgettext("sys_string", "IDS_COM_SK_DELETE"), _delete_cb, ug_data, "naviframe/toolbar/right");
+               elm_object_item_part_content_set(ug_data->navi_main_it, "toolbar_button2", ug_data->delete_btn);
        }
 
        return NULL;
@@ -2276,9 +2314,6 @@ static void _create_down_progress_ex(int index, EMAIL_VIEWER_PROGRESSBAR_TYPE p_
                return;
        }
 
-       if (ug_data->forward_ctr_it)
-               elm_object_item_disabled_set(ug_data->forward_ctr_it, EINA_TRUE);
-
        int scr_x = 0;
        int scr_y = 0;
        int scr_w = 0;
@@ -2502,14 +2537,17 @@ static void _destroy_down_progress_ex(void *data, Evas_Object *obj, void *event_
        }
 
        elm_scroller_region_show(ug_data->scroller, scr_x, scr_y, scr_w, scr_h);
+}
 
-       if (priv && priv->download_all_cnt <= 0) {
-               if (ug_data->forward_ctr_it)
-                       elm_object_item_disabled_set(ug_data->forward_ctr_it, EINA_FALSE);
-       }
+static void _move_ctxpopup(Evas_Object *ctxpopup, Evas_Object *win)
+{
+       Evas_Coord x, y, w, h;
+
+       evas_object_geometry_get(win, &x, &y, &w, &h);
+       evas_object_move(ctxpopup, x + (w / 2), y);
 }
 
-static void _create_more_ctxpopup(EmailViewerUGD *ug_data)
+static void _create_more_ctxpopup(EmailViewerUGD *ug_data, Evas_Object *obj)
 {
        debug_log("");
        if (!ug_data) {
@@ -2520,6 +2558,7 @@ static void _create_more_ctxpopup(EmailViewerUGD *ug_data)
        EmailViewerProp *prop = ug_data->property;
        EMAIL_CONTACT_LIST_INFO_S *contact_list_item = NULL;
        contact_list_item = (EMAIL_CONTACT_LIST_INFO_S *)_contact_search_by_email(ug_data, prop->sender);
+       Evas_Object* icon = NULL;
 
        if (ug_data->con_popup) {
                evas_object_del(ug_data->con_popup);
@@ -2532,65 +2571,69 @@ static void _create_more_ctxpopup(EmailViewerUGD *ug_data)
                return;
        }
 
-       if (contact_list_item) {
-               debug_log("Contact Item Exist: index[%d]", contact_list_item->index);
-               char index[10] = { 0, };
-               snprintf(index, sizeof(index), "%d", contact_list_item->index);
-
+       debug_log("mailbox_type:%d", ug_data->mailbox_type);
+       if (ug_data->mailbox_type == EMAIL_MAILBOX_TYPE_OUTBOX) {
+               elm_ctxpopup_item_append(ug_data->con_popup, dgettext("sys_string", "IDS_COM_SK_EDIT"), NULL, _edit_email_cb, ug_data);
                if (email_engine_check_seen_mail(ug_data->account_id, ug_data->mail_id))
                        elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_MARK_AS_UNREAD"), NULL, _mark_as_unread_cb, ug_data);
                else
                        elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_MARK_AS_READ"), NULL, _mark_as_read_cb, ug_data);
-
-               elm_ctxpopup_item_append(ug_data->con_popup, dgettext("sys_string", "IDS_COM_BODY_MOVE"), NULL, _move_cb, ug_data);
-               elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_SAVE_EMAIL_ABB"), NULL, _save_email_cb, ug_data);
-               elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_VIEW_CONTACT"), NULL, _ctxpopup_detail_contact_cb, g_strdup(index));
-               ug_data->more_ctx_block_item = elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_BLOCK"), NULL, _ctxpopup_add_block_rule_cb, prop->sender);
-
-               _delete_contacts_list(contact_list_item);
        } else {
+               elm_ctxpopup_item_append(ug_data->con_popup, dgettext("sys_string", "IDS_COM_BODY_FORWARD"), NULL, _forward_cb, ug_data);
+
                if (email_engine_check_seen_mail(ug_data->account_id, ug_data->mail_id))
                        elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_MARK_AS_UNREAD"), NULL, _mark_as_unread_cb, ug_data);
                else
                        elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_MARK_AS_READ"), NULL, _mark_as_read_cb, ug_data);
 
                elm_ctxpopup_item_append(ug_data->con_popup, dgettext("sys_string", "IDS_COM_BODY_MOVE"), NULL, _move_cb, ug_data);
-               elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_SAVE_EMAIL_ABB"), NULL, _save_email_cb, ug_data);
-               ug_data->create_contact_arg = CONTACTUI_REQ_ADD_EMAIL;
-               elm_ctxpopup_item_append(ug_data->con_popup, dgettext("sys_string", "IDS_COM_OPT_ADD_TO_CONTACTS"), NULL, _ctxpopup_add_contact_cb, prop->sender);
-               ug_data->more_ctx_block_item = elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_BLOCK"), NULL, _ctxpopup_add_block_rule_cb, prop->sender);
-       }
+               elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_SAVE_EMAIL_ABB"), icon, _save_email_cb, ug_data);
+/*
+               if (contact_list_item) {
+                       debug_log("Contact Item Exist: index[%d]", contact_list_item->index);
+                       char index[10] = { 0, };
+                       snprintf(index, sizeof(index), "%d", contact_list_item->index);
+                       elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_VIEW_CONTACT"), NULL, _ctxpopup_detail_contact_cb, g_strdup(index));
+                       _delete_contacts_list(contact_list_item);
+               } else {
+                       ug_data->create_contact_arg = CONTACTUI_REQ_ADD_EMAIL;
+                       elm_ctxpopup_item_append(ug_data->con_popup, dgettext("sys_string", "IDS_COM_OPT_ADD_TO_CONTACTS"), NULL, _ctxpopup_add_contact_cb, prop->sender);
+               }
+               elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_ADD_TO_CALENDAR"), NULL, _add_to_calendar_cb, ug_data);
+*/
+               if (ug_data->account_type != EMAIL_SERVER_TYPE_ACTIVE_SYNC) {
+                       if (ug_data->mailbox_type != EMAIL_MAILBOX_TYPE_SPAMBOX)
+                               ug_data->more_ctx_block_item = elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_BLOCK"), NULL, _ctxpopup_add_block_rule_cb, prop->sender);
+               }
 
-       int count, i;
-       email_rule_t *rule_list = NULL;
+               if (ug_data->mailbox_type != EMAIL_MAILBOX_TYPE_SPAMBOX) {
+                       int count, i;
+                       email_rule_t *rule_list = NULL;
 
-       /* get the rule list from service */
-       if (email_get_rule_list(&rule_list, &count) < 0) {
-               debug_log("email_get_rule_list failed");
-       } else {
-               if (count > 0) {
-                       for (i = 0; i < count; i++) {
-                               if (rule_list[i].type == EMAIL_FILTER_FROM) {
-                                       debug_log("block address %s", rule_list[i].value);
-
-                                       if (g_strcmp0(rule_list[i].value, prop->sender) == 0) {
-                                               debug_log("[%s] already blocked", rule_list[i].value);
-                                               if (ug_data->more_ctx_block_item)
-                                                       elm_object_item_disabled_set(ug_data->more_ctx_block_item, EINA_TRUE);
+                       /* get the rule list from service */
+                       if (email_get_rule_list(&rule_list, &count) < 0) {
+                               debug_log("email_get_rule_list failed");
+                       } else {
+                               if (count > 0) {
+                                       for (i = 0; i < count; i++) {
+                                               if (rule_list[i].type == EMAIL_FILTER_FROM/*TYPE_BLOCK_ADDRESS*/) {
+                                                       debug_log("block address %s", rule_list[i].value);
+
+                                                       if (g_strcmp0(rule_list[i].value, prop->sender) == 0) {
+                                                               debug_log("[%s] already blocked", rule_list[i].value);
+                                                               if (ug_data->more_ctx_block_item)
+                                                                       elm_object_item_disabled_set(ug_data->more_ctx_block_item, EINA_TRUE);
+                                                       }
+                                               }
                                        }
                                }
+                               /* free email rule_list */
+                               email_free_rule(&rule_list, count);
                        }
                }
-               /* free email rule_list */
-               email_free_rule(&rule_list, count);
        }
 
-       Evas_Coord x, y, w, h;
-       evas_pointer_canvas_xy_get(ug_data->evas, &x, &y);
-//     evas_object_move(ug_data->con_popup, x, y - 20);
-       evas_object_geometry_get(ug_data->ctr_bar, &x, &y, &w, &h);
-       debug_log("x:%d, y:%d, w:%d, h:%d, mx:%d", x, y, w, h, ((w - x) * 6) / 7);
-       evas_object_move(ug_data->con_popup, ((w - x) * 6) / 7, y);
+       _move_ctxpopup(ug_data->con_popup, obj);
        evas_object_show(ug_data->con_popup);
 }
 
@@ -2617,7 +2660,7 @@ static void _create_reply_ctxpopup(EmailViewerUGD *ug_data)
        elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_TO_ALL_ABB"), NULL, _reply_all_cb, ug_data);
 
        Evas_Coord x, y, w, h;
-       evas_object_geometry_get(ug_data->reply_ctr_it, &x, &y, &w, &h);
+       evas_object_geometry_get(ug_data->reply_btn, &x, &y, &w, &h);
        evas_object_move(ug_data->con_popup, x + (w / 2), y);
        evas_object_show(ug_data->con_popup);
 }
@@ -2920,9 +2963,13 @@ static void _reply_cb(void *data, Evas_Object *obj, void *event_info)
                ug_data->con_popup = NULL;
        }
 
-       ug_data->display_download_result = FALSE;
-
-       _launch_composer(ug_data, RUN_COMPOSER_REPLY);
+       debug_log("mailbox_type:%d, message_class:%d", ug_data->mailbox_type, ug_data->email_data->mail_info->message_class);
+       if (ug_data->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX && ug_data->email_data->mail_info->message_class == EMAIL_MESSAGE_CLASS_SMS) {
+               _launch_message_composer(ug_data);
+       } else {
+               ug_data->display_download_result = FALSE;
+               _launch_composer(ug_data, RUN_COMPOSER_REPLY);
+       }
 
        if (ug_data->notify) {
                evas_object_del(ug_data->notify);
@@ -2945,9 +2992,13 @@ static void _reply_all_cb(void *data, Evas_Object *obj, void *event_info)
                ug_data->con_popup = NULL;
        }
 
-       ug_data->display_download_result = FALSE;
-
-       _launch_composer(ug_data, RUN_COMPOSER_REPLY_ALL);
+       debug_log("mailbox_type:%d, message_class:%d", ug_data->mailbox_type, ug_data->email_data->mail_info->message_class);
+       if (ug_data->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX && ug_data->email_data->mail_info->message_class == EMAIL_MESSAGE_CLASS_SMS) {
+               _launch_message_composer(ug_data);
+       } else {
+               ug_data->display_download_result = FALSE;
+               _launch_composer(ug_data, RUN_COMPOSER_REPLY_ALL);
+       }
 
        if (ug_data->notify) {
                evas_object_del(ug_data->notify);
@@ -2978,14 +3029,190 @@ static void _forward_cb(void *data, Evas_Object *obj, void *event_info)
 
        EmailViewerUGD *ug_data = (EmailViewerUGD *)data;
 
-       ug_data->display_download_result = FALSE;
+       if (ug_data->con_popup) {
+               evas_object_del(ug_data->con_popup);
+               ug_data->con_popup = NULL;
+       }
 
-       _launch_composer(ug_data, RUN_COMPOSER_FORWARD);
+       debug_log("mailbox_type:%d, message_class:%d", ug_data->mailbox_type, ug_data->email_data->mail_info->message_class);
+       if (ug_data->mailbox_type == EMAIL_MAILBOX_TYPE_INBOX && ug_data->email_data->mail_info->message_class == EMAIL_MESSAGE_CLASS_SMS) {
+               _launch_message_composer(ug_data);
+       } else {
+               ug_data->display_download_result = FALSE;
+               _launch_composer(ug_data, RUN_COMPOSER_FORWARD);
+       }
 }
 
-static void _resend_cb(void *data, Evas_Object *obj, void *event_info)
+static void _launch_message_composer(EmailViewerUGD *ug_data)
 {
        debug_log("");
+
+       if (!ug_data) {
+               debug_log("ug_data is NULL");
+               return;
+       }
+
+       int ret;
+       service_h service = NULL;
+
+       ret = service_create(&service);
+       debug_log("service_create: %d", ret);
+       if (!service) {
+               debug_log("service create failed");
+               return;
+       }
+
+       debug_log("full_address_from [%s]", ug_data->email_data->mail_info->full_address_from);
+#ifndef _MSG_COMPOSER_BY_APP_CONTROL_
+       ret = service_add_extra_data(service, EMAIL_BUNDLE_KEY_TO, ug_data->email_data->mail_info->full_address_from);
+       debug_log("service_add_extra_data: %d", ret);
+
+       create_ug(UG_NAME_MESSAGE_COMPOSER, service, ug_data);
+#else
+       ret = service_set_window(service, elm_win_xwindow_get(ug_data->win_main));
+       debug_log("service_set_window: %d", ret);
+       ret = service_set_app_id(service, UG_NAME_MESSAGE_COMPOSER);
+       debug_log("service_set_app_id: %d", ret);
+       ret = service_set_operation(service, SERVICE_OPERATION_SEND_TEXT);
+       debug_log("service_set_operation: %d", ret);
+       ret = service_add_extra_data(service, SERVICE_DATA_TO, ug_data->email_data->mail_info->full_address_from);
+       debug_log("service_add_extra_data: %d", ret);
+       ret = service_send_launch_request(service, NULL, NULL);
+       debug_log("service_send_launch_request: %d", ret);
+#endif
+
+       ret = service_destroy(service);
+       debug_log("service_destroy: %d", ret);
+
+       if (ug_data->notify) {
+               evas_object_del(ug_data->notify);
+               ug_data->notify = NULL;
+       }
+}
+
+static void _resend_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       debug_enter();
+       if (data == NULL) {
+               debug_log("data is NULL");
+               return;
+       }
+
+       EmailViewerUGD *ug_data = (EmailViewerUGD *)data;
+       int handle = 0;
+
+       /* Send email again */
+       debug_log("ug_data->account_id(%d), priv->account_id(%d), mail_info->account_id(%d), prop->account_id(%d)", ug_data->account_id, ug_data->email_data->account_id, ug_data->email_data->mail_info->account_id, ug_data->property->account_id);
+       debug_log("ug_data->mail_id(%d), priv->mail_id(%d), mail_info->mail_id(%d), prop->mail_id(%d)", ug_data->mail_id, ug_data->email_data->mail_id, ug_data->email_data->mail_info->mail_id, ug_data->property->mail_id);
+
+       int err = email_send_mail(ug_data->mail_id, &handle);
+       if (err != EMAIL_ERROR_NONE) {
+               debug_warning("email_send_mail failed: handle(%d) - err(%d)", handle, err);
+       } else {
+               debug_log("sending: handle(%d)", handle);
+       }
+
+       if (ug_data->isRotate == false && ug_data->b_internal) {
+               /* Viewer to hide, so set left content (mailbox) size to full */
+               _notify_mailbox_size(ug_data, "MAILBOX_RESIZE_FULL");
+       }
+
+       /* close viewer */
+       if (ug_data->b_internal) {
+               _hide_view(ug_data);
+
+               /* send next or previous mail request to mailbox. */
+/*             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_MSG, EMAIL_BUNDLE_VAL_NEXT_MSG);
+               debug_log("service_add_extra_data: %d", ret);
+               ret = service_add_extra_data(service, EMAIL_BUNDLE_KEY_DO_DELETE, "1");
+               debug_log("service_add_extra_data: %d", ret);
+
+               ug_send_message(_g_mailbox_ug, service);
+
+               ret = service_destroy(service);
+               debug_log("service_destroy: %d", ret);*/
+       } else {
+               debug_log("ug_destory_me");
+               ug_destroy_me(ug_data->ug);
+       }
+}
+
+static void _cancel_send_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       debug_enter();
+       if (data == NULL) {
+               debug_log("data is NULL");
+               return;
+       }
+
+       EmailViewerUGD *ug_data = (EmailViewerUGD *)data;
+
+       debug_log("ug_data->account_id(%d), priv->account_id(%d), mail_info->account_id(%d), prop->account_id(%d)", ug_data->account_id, ug_data->email_data->account_id, ug_data->email_data->mail_info->account_id, ug_data->property->account_id);
+       debug_log("ug_data->mail_id(%d), priv->mail_id(%d), mail_info->mail_id(%d), prop->mail_id(%d)", ug_data->mail_id, ug_data->email_data->mail_id, ug_data->email_data->mail_info->mail_id, ug_data->property->mail_id);
+
+       int err = email_cancel_sending_mail(ug_data->mail_id);
+       if (err != EMAIL_ERROR_NONE) {
+               debug_warning("email_engine_cancel_send_mail failed - err(%d)", err);
+       }
+}
+
+static void _edit_email_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       debug_enter();
+       if (data == NULL) {
+               debug_log("data is NULL");
+               return;
+       }
+
+       EmailViewerUGD *ug_data = (EmailViewerUGD *)data;
+
+       if (ug_data->con_popup) {
+               evas_object_del(ug_data->con_popup);
+               ug_data->con_popup = NULL;
+       }
+
+       int ret;
+       service_h service = NULL;
+
+       ret = service_create(&service);
+       debug_log("service_create: %d", ret);
+       if (!service) {
+               debug_log("service create failed");
+               return;
+       }
+
+       char rtype[10] = { 0, };
+       snprintf(rtype, sizeof(rtype), "%d", RUN_COMPOSER_EDIT);
+       char acctid[10] = { 0, };
+       snprintf(acctid, sizeof(acctid), "%d", ug_data->account_id);
+       char mailboxid[10] = { 0, };
+       snprintf(mailboxid, sizeof(mailboxid), "%d", ug_data->mailbox_id);
+       char mailid[10] = { 0, };
+       snprintf(mailid, sizeof(mailid), "%d", ug_data->mail_id);
+
+       ret = service_add_extra_data(service, EMAIL_BUNDLE_KEY_RUN_TYPE, rtype);
+       debug_log("service_add_extra_data: %d", ret);
+       ret = service_add_extra_data(service, EMAIL_BUNDLE_KEY_ACCOUNT_ID, acctid);
+       debug_log("service_add_extra_data: %d", ret);
+       ret = service_add_extra_data(service, EMAIL_BUNDLE_KEY_MAILBOX, mailboxid);
+       debug_log("service_add_extra_data: %d", ret);
+       ret = service_add_extra_data(service, EMAIL_BUNDLE_KEY_MAIL_ID, mailid);
+       debug_log("service_add_extra_data: %d", ret);
+
+       ug_data->ug_composer = create_ug(UG_NAME_EMAIL_COMPOSER, service, ug_data);
+
+       ret = service_destroy(service);
+       debug_log("service_destroy: %d", ret);
 }
 
 static void _delete_cb(void *data, Evas_Object *obj, void *event_info)
@@ -3010,7 +3237,7 @@ static void _delete_cb(void *data, Evas_Object *obj, void *event_info)
                                                dgettext("sys_string", "IDS_COM_SK_CANCEL"), _popup_response_cb, NULL);
        } else {
                _create_notify_3btn(ug_data, NULL, dgettext("sys_string", "IDS_COM_POP_DELETE_Q"),
-                                               2, N_("Delete permanently"), _popup_response_delete_ok_cb,
+                                               2, dgettext("sys_string", "IDS_COM_SK_DELETE"), _popup_response_delete_ok_cb,
                                                dgettext("sys_string", "IDS_COM_SK_CANCEL"), _popup_response_cb, NULL, NULL, NULL);
        }
 }
@@ -3041,7 +3268,8 @@ static void _move_cb(void *data, Evas_Object *obj, void *event_info)
        ug_data->itc1.func.del = _gl_del;
 
        Elm_Object_Item *navi_it = NULL;
-       navi_it = elm_naviframe_item_push(ug_data->navi_bar, dgettext("sys_string", "IDS_COM_BODY_MOVE"), NULL, NULL, gl, NULL);
+       navi_it = elm_naviframe_top_item_get(ug_data->navi_bar);
+       navi_it = elm_naviframe_item_insert_after(ug_data->navi_bar, navi_it, dgettext("sys_string", "IDS_COM_BODY_MOVE"), NULL, NULL, gl, NULL);
        ug_data->navi_move_it1 = navi_it;
        if (ug_data->isRotate)
                elm_naviframe_item_title_visible_set(ug_data->navi_move_it1, EINA_FALSE);
@@ -3075,30 +3303,13 @@ static void _move_cb(void *data, Evas_Object *obj, void *event_info)
                elm_layout_theme_set(ug_data->layout_main, "layout", "application", "default");*/
 
        Evas_Object *move_back_btn = NULL;
-       if (ug_data->isRotate) {
-               ug_data->move_cbar = elm_toolbar_add(ug_data->navi_bar);
-               elm_toolbar_shrink_mode_set(ug_data->move_cbar, ELM_TOOLBAR_SHRINK_EXPAND);
-               elm_object_style_set(ug_data->move_cbar, "naviframe");
-               evas_object_show(ug_data->move_cbar);
-
-               elm_object_item_disabled_set(elm_toolbar_item_append(ug_data->move_cbar, NULL, "", NULL, NULL), EINA_TRUE);
-               elm_toolbar_item_append(ug_data->move_cbar, NULL, dgettext("sys_string", "IDS_COM_SK_CANCEL"), _move_back_cb, ug_data);
-               elm_object_item_part_content_set(navi_it, "controlbar", ug_data->move_cbar);
-
-               move_back_btn = elm_object_item_part_content_get(navi_it, "prev_btn");
-               if (move_back_btn) {
-                       evas_object_del(move_back_btn);
-                       elm_object_item_part_content_set(navi_it, "prev_btn", NULL);
-               }
-       } else {
-               move_back_btn = elm_object_item_part_content_get(navi_it, "prev_btn");
-               if (move_back_btn) {
-                       evas_object_del(move_back_btn);
-                       move_back_btn = elm_button_add(ug_data->navi_bar);
-                       elm_object_style_set(move_back_btn, "naviframe/back_btn/default");
-                       evas_object_smart_callback_add(move_back_btn, "clicked", _move_back_cb, ug_data);
-                       elm_object_item_part_content_set(navi_it, "prev_btn", move_back_btn);
-               }
+       move_back_btn = elm_object_item_part_content_get(navi_it, "prev_btn");
+       if (move_back_btn) {
+               evas_object_del(move_back_btn);
+               move_back_btn = elm_button_add(ug_data->navi_bar);
+               elm_object_style_set(move_back_btn, "naviframe/back_btn/default");
+               evas_object_smart_callback_add(move_back_btn, "clicked", _move_back_cb, ug_data);
+               elm_object_item_part_content_set(navi_it, "prev_btn", move_back_btn);
        }
 }
 
@@ -3112,7 +3323,7 @@ static void _more_cb(void *data, Evas_Object *obj, void *event_info)
 
        EmailViewerUGD *ug_data = (EmailViewerUGD *)data;
 
-       _create_more_ctxpopup(ug_data);
+       _create_more_ctxpopup(ug_data, obj);
 }
 
 static void _body_down_cb(void *data, Evas_Object *obj, void *event_info)
@@ -3196,7 +3407,7 @@ static void _body_down_cb(void *data, Evas_Object *obj, void *event_info)
 
        if (ret == TRUE) {
                priv->email_handle = handle;
-               debug_log("succeed in email_engine_body_download");
+               debug_log("succeed in email_engine_body_download(handle:%d)", priv->email_handle);
                _create_down_progress(dgettext("sys_string", "IDS_COM_POP_DOWNLOADING"), _destroy_down_progress_cb);
 
                /* If attachment download is in progress, first cancel to attachment download of the mail and then carry out body download */
@@ -3263,10 +3474,10 @@ static void _subject_favorite_clicked_cb(void *data, Evas_Object *obj, const cha
        switch(prop->favorite)
        {
                case EMAIL_FLAG_NONE:
-                       elm_icon_file_set(favorite_icon, IMGDIR "/M02_email_icon_favorite_off.png", NULL);
+                       elm_icon_file_set(favorite_icon, IMGDIR "/M02_icon_favorite_off_74x74.png", NULL);
                        break;
                case EMAIL_FLAG_FLAGED:
-                       elm_icon_file_set(favorite_icon, IMGDIR "/M02_email_icon_favorite_on.png", NULL);
+                       elm_icon_file_set(favorite_icon, IMGDIR "/M02_icon_favorite_on_74x74.png", NULL);
                        break;
                case EMAIL_FLAG_TASK_STATUS_CLEAR:
                        elm_icon_file_set(favorite_icon, IMGDIR "/M02_email_Flag_Clear.png", NULL);
@@ -3492,7 +3703,6 @@ static void _mark_as_unread_cb(void *data, Evas_Object *obj, void *event_info)
        }
 
        EmailViewerUGD *ug_data = (EmailViewerUGD *)data;
-       EmailViewerPrivate *priv = ug_data->email_data;
 
        if (ug_data->con_popup) {
                evas_object_del(ug_data->con_popup);
@@ -3500,7 +3710,7 @@ static void _mark_as_unread_cb(void *data, Evas_Object *obj, void *event_info)
        }
 
        int err = 0;
-       debug_log("ug_data->mail_id(%d), priv->mail_id(%d), mail_info->mail_id(%d))", ug_data->mail_id, priv->mail_id, priv->mail_info->mail_id);
+       debug_log("ug_data->mail_id(%d), priv->mail_id(%d), mail_info->mail_id(%d), prop->mail_id(%d)", ug_data->mail_id, ug_data->email_data->mail_id, ug_data->email_data->mail_info->mail_id, ug_data->property->mail_id);
 
        err = email_set_flags_field(ug_data->account_id, &ug_data->mail_id, 1, EMAIL_FLAGS_SEEN_FIELD, 0, 1);
        debug_log("email_set_flags_field - err(%d)", err);
@@ -3525,7 +3735,6 @@ static void _mark_as_read_cb(void *data, Evas_Object *obj, void *event_info)
        }
 
        EmailViewerUGD *ug_data = (EmailViewerUGD *)data;
-       EmailViewerPrivate *priv = ug_data->email_data;
 
        if (ug_data->con_popup) {
                evas_object_del(ug_data->con_popup);
@@ -3533,9 +3742,9 @@ static void _mark_as_read_cb(void *data, Evas_Object *obj, void *event_info)
        }
 
        int err = 0;
-       debug_log("ug_data->mail_id(%d), priv->mail_id(%d), mail_info->mail_id(%d))", ug_data->mail_id, priv->mail_id, priv->mail_info->mail_id);
+       debug_log("ug_data->mail_id(%d), priv->mail_id(%d), mail_info->mail_id(%d), prop->mail_id(%d)", ug_data->mail_id, ug_data->email_data->mail_id, ug_data->email_data->mail_info->mail_id, ug_data->property->mail_id);
 
-       err = email_set_flags_field(priv->mail_info->account_id, &ug_data->mail_id, 1, EMAIL_FLAGS_SEEN_FIELD, 1, 1);
+       err = email_set_flags_field(ug_data->account_id, &ug_data->mail_id, 1, EMAIL_FLAGS_SEEN_FIELD, 1, 1);
        debug_log("email_set_flags_field - err(%d)", err);
 
        if (err != EMAIL_ERROR_NONE) {
@@ -3615,7 +3824,7 @@ static Eina_Bool _save_email_prog_cb(void *data)
        EmailViewerUGD *ug_data = (EmailViewerUGD *)data;
 
        int err = 0;
-       debug_log("ug_data->mail_id(%d), priv->mail_id(%d), mail_info->mail_id(%d))", ug_data->mail_id, ug_data->email_data->mail_id, ug_data->email_data->mail_info->mail_id);
+       debug_log("ug_data->mail_id(%d), priv->mail_id(%d), mail_info->mail_id(%d), prop->mail_id(%d)", ug_data->mail_id, ug_data->email_data->mail_id, ug_data->email_data->mail_info->mail_id, ug_data->property->mail_id);
 
        email_mail_data_t *mail_t = NULL;
        err = email_get_mail_data(ug_data->email_data->mail_id, &mail_t);
@@ -3631,27 +3840,23 @@ static Eina_Bool _save_email_prog_cb(void *data)
        err = email_get_attachment_data_list(ug_data->email_data->mail_id, &attachment_t, &attachment_count);
        debug_log("email_get_attachment_data_list - err (%d)", err);
 
-       char file_name[MAX_PATH_LEN] = { 0, };
-       snprintf(file_name, sizeof(file_name), "%s_%d_%d.%s", DIR_DEFAULT_MEDIA_PHONE"/Downloads/email", ug_data->account_id, ug_data->mail_id, "eml");
-       char *output_file_path = g_strdup(file_name);
-       debug_log("output_file_path(%s)", file_name, output_file_path);
+       if (err == EMAIL_ERROR_NONE) {
+               char file_name[MAX_PATH_LEN] = { 0, };
+               snprintf(file_name, sizeof(file_name), "%s_%d_%d.%s", DIR_DEFAULT_MEDIA_PHONE"/Downloads/email", ug_data->account_id, ug_data->mail_id, "eml");
+               char *output_file_path = g_strdup(file_name);
+               debug_log("output_file_path(%s)", file_name, output_file_path);
 
-       err = email_write_mime_file(mail_t, attachment_t, attachment_count, &output_file_path);
-       debug_log("email_write_mime_file - err(%d)", err);
+               err = email_write_mime_file(mail_t, attachment_t, attachment_count, &output_file_path);
+               debug_log("email_write_mime_file - err(%d)", err);
 
-       g_free(output_file_path);
+               g_free(output_file_path);
+       }
 
        if (mail_t) {
                email_free_mail_data(&(mail_t), 1);
                mail_t = NULL;
        }
 
-       if (attachment_t && attachment_count > 0) {
-               email_free_attachment_data(&(attachment_t), attachment_count);
-               attachment_t = NULL;
-               attachment_count = 0;
-       }
-
        if (ug_data->timeout_popup) {
                evas_object_del(ug_data->timeout_popup);
                ug_data->timeout_popup = NULL;
@@ -3675,6 +3880,12 @@ static Eina_Bool _save_email_prog_cb(void *data)
 #endif
        }
 
+       if (attachment_t && attachment_count > 0) {
+               email_free_attachment_data(&(attachment_t), attachment_count);
+               attachment_t = NULL;
+               attachment_count = 0;
+       }
+
        if (ug_data->waiting_timer) {
                ecore_timer_del(ug_data->waiting_timer);
                ug_data->waiting_timer = NULL;
@@ -3916,16 +4127,23 @@ static void _ctxpopup_add_block_rule_cb(void *data, Evas_Object *obj, void *even
        }
 
        email_free_rule(&rule, 1);
+
+       if (ug_data->isRotate == false && ug_data->b_internal) {
+               _notify_mailbox_size(ug_data, "MAILBOX_RESIZE_FULL");
+       }
+
+       /* close viewer */
+       if (ug_data->b_internal) {
+               _hide_view(ug_data);
+       } else {
+               debug_log("ug_destory_me");
+               ug_destroy_me(ug_data->ug);
+       }
 }
 
 static void _popup_waiting_response_cb(void *data, Evas_Object *obj, void *event_info)
 {
        debug_log("");
-       if (!_g_ug_data) {
-               debug_log("_g_ug_data is NULL");
-               return;
-       }
-
        if (!data) {
                debug_log("data is NULL");
                return;
@@ -4184,7 +4402,7 @@ static void _webview_policy_navigation_decide_cb(void *data, Evas_Object *obj, v
 {
        debug_log("");
        if (!_g_ug_data) {
-               debug_log("data is NULL");
+               debug_log("_g_ug_data is NULL");
                return;
        }
 
@@ -4292,6 +4510,7 @@ static void _webview_policy_navigation_decide_cb(void *data, Evas_Object *obj, v
                        debug_log("service_destroy: %d", ret);
                }
        } else {
+               debug_log("Loading...");
                if (ug_data->timeout_popup) {
                        evas_object_del(ug_data->timeout_popup);
                        ug_data->timeout_popup = NULL;
@@ -4348,6 +4567,13 @@ static void _mbe_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
        debug_log("");
 }
 
+static void _mbe_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       debug_log("");
+       EmailViewerUGD *ug_data = (EmailViewerUGD *)data;
+       elm_object_focus_set(ug_data->con_popup, EINA_TRUE);
+}
+
 static void _mbe_added_cb(void *data, Evas_Object *obj, void *event_info)
 {
        debug_log("");
@@ -4389,7 +4615,7 @@ static void _mbe_selected_cb(void *data, Evas_Object *obj, void *event_info)
                _delete_contacts_list(contact_list_item);
        } else {
                ug_data->create_contact_arg = CONTACTUI_REQ_ADD_EMAIL;
-               elm_ctxpopup_item_append(ug_data->con_popup, dgettext("sys_string", "IDS_COM_OPT_ADD_TO_CONTACTS"), NULL, _ctxpopup_add_contact_cb, addrs_info->address);
+               elm_ctxpopup_item_append(ug_data->con_popup, dgettext("sys_string", "IDS_COM_OPT_ADD_TO_CONTACTS"), NULL, _ctxpopup_add_contact_cb/*_ctxpopup_select_contact_mode_email_cb*//*_ctxpopup_create_contact_cb*/, addrs_info->address);
                elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_SEND_EMAIL"), NULL, _ctxpopup_send_email_cb, addrs_info->address);
                ug_data->ctx_block_item = elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_BLOCK"), NULL, _ctxpopup_add_block_rule_cb, addrs_info->address);
        }
@@ -4399,7 +4625,7 @@ static void _mbe_selected_cb(void *data, Evas_Object *obj, void *event_info)
 
        /* get the rule list from service */
        if (email_get_rule_list(&rule_list, &count) < 0) {
-               debug_log("email_get_rule_list failed");
+                       debug_log("email_get_rule_list failed");
        } else {
                if (count > 0) {
                        for (i = 0; i < count; i++) {
@@ -4419,7 +4645,7 @@ static void _mbe_selected_cb(void *data, Evas_Object *obj, void *event_info)
        }
 
        evas_pointer_canvas_xy_get(ug_data->evas, &x, &y);
-               debug_log("canvas x:%d, y:%d", x, y);
+       debug_log("canvas x:%d, y:%d", x, y);
        evas_object_move(ug_data->con_popup, x, y);
        evas_object_show(ug_data->con_popup);
 }
@@ -4621,8 +4847,6 @@ static Eina_Bool _check_body_download(void *data)
 
        EmailViewerUGD *ug_data = (EmailViewerUGD *)data;
 
-       _create_tab_bar(ug_data);
-
        /* check mail body downloaded */
        int body_download_status = ug_data->property->body_download;
 
@@ -4770,12 +4994,12 @@ static void _show_select_info(EmailViewerUGD *ug_data, char *str)
        }
 
        ug_data->select_info = elm_notify_add(ug_data->win_main);
-       elm_notify_orient_set(ug_data->select_info, ELM_NOTIFY_ORIENT_BOTTOM);
+       elm_notify_align_set(ug_data->select_info, ELM_NOTIFY_ALIGN_FILL, 1.0);
 
        ug_data->selectioninfo_layout = elm_layout_add(ug_data->layout_main);
        elm_object_content_set(ug_data->select_info, ug_data->selectioninfo_layout);
 
-       elm_layout_theme_set(ug_data->selectioninfo_layout, "standard", "selectioninfo", "vertical/bottom_64");
+       elm_layout_theme_set(ug_data->selectioninfo_layout, "standard", "selectioninfo", "center_text");
 
        edje_object_part_text_set(_EDJ(ug_data->selectioninfo_layout), "elm.text", str);
        elm_notify_timeout_set(ug_data->select_info, 3);
@@ -5001,11 +5225,6 @@ static void _save_attachment_all(EmailViewerUGD *ug_data)
        if (priv->b_all_att_save)
                return;
 
-       if (att_len > 0) {
-               if (ug_data->forward_ctr_it)
-                       elm_object_item_disabled_set(ug_data->forward_ctr_it, EINA_TRUE);
-       }
-
        for (i = 0; i < att_len; i++) {
                info = g_list_nth_data(prop->attachments, i);
 
@@ -5413,6 +5632,9 @@ static void _on_edbus_event_email_viewer_receive(void *data, DBusMessage *messag
                                                        _destroy_down_progress_ex((void *)attach_index, NULL, NULL);
                                                        _show_attachment(ug_data, attach_index);
                                                }
+                                       } else { // for updating attachments
+                                               attach_index = _update_attachment_info(ug_data, attachment_id);
+                                               debug_log("attach_index [%d]", attach_index);
                                        }
                                } else {
                                        debug_log("mail_id or attachment_id is different");
@@ -5489,45 +5711,36 @@ static void *_contact_search_by_email(EmailViewerUGD *ug_data, const char *searc
                return NULL;
        }
 
-       int ret = CTS_SUCCESS;
-       CTSiter *iter = NULL;
-
-       EMAIL_CONTACT_LIST_INFO_S *contacts_list_item = NULL;
-       contacts_svc_connect();
-
-       debug_log("search_word = %s", search_word);
-
-       if (contacts_svc_get_list_with_str(CTS_LIST_EMAILINFOS_WITH_EMAIL, search_word, &iter) != CTS_SUCCESS) {
+       if (contacts_connect2() != CONTACTS_ERROR_NONE) {
+               debug_log("Fail of contacts_connect2 !!!");
                return NULL;
        }
 
-       ret = contacts_svc_iter_next(iter);
-
-       if (CTS_SUCCESS == ret) {
-               CTSvalue *row_info = NULL;
-
-               row_info = contacts_svc_iter_get_info(iter);
-               if (row_info) {
-                       contacts_list_item = (EMAIL_CONTACT_LIST_INFO_S *)calloc(1, sizeof(EMAIL_CONTACT_LIST_INFO_S));
-
-                       int index = contacts_svc_value_get_int(row_info, CTS_LIST_EMAIL_CONTACT_ID_INT);
+       int ct_ret = CONTACTS_ERROR_NONE;
+       EMAIL_CONTACT_LIST_INFO_S *contacts_list_item = NULL;
+       Eina_List *contacts_list = NULL;
+       contacts_list_h list = NULL;
 
-                       contacts_list_item->index = index;
-                       contacts_list_item->display = g_strdup(contacts_svc_value_get_str(row_info, CTS_LIST_EMAIL_CONTACT_DISPLAY_STR));
-                       contacts_list_item->email_address = g_strdup(contacts_svc_value_get_str(row_info, CTS_LIST_EMAIL_ADDR_STR));
+       ct_ret = email_get_contacts_list(CONTACTS_MATCH_EXACTLY, &list, search_word);
+       debug_log("email_get_contacts_record: list : %d", list);
 
-                       snprintf(contacts_list_item->display_name, sizeof(contacts_list_item->display_name), "%s", contacts_list_item->display);
-               }
+       if (!list) {
+               debug_log("list is NULL");
+               contacts_list_destroy(list, true);
+               contacts_disconnect2();
+               return contacts_list;
+       }
 
-               contacts_svc_value_free(row_info);
-               row_info = NULL;
+       contacts_list_item = (EMAIL_CONTACT_LIST_INFO_S *)calloc(1, sizeof(EMAIL_CONTACT_LIST_INFO_S));
+       contacts_list_item->ugd = ug_data;
 
-               contacts_svc_iter_remove(iter);
-       }
+       ct_ret = email_get_contacts_list_info(list, contacts_list_item);
+       debug_log("email_get_contacts_list_info: contacts_list_item : %d", contacts_list_item);
 
-       contacts_svc_disconnect();
+       contacts_list_destroy(list, true);
+       contacts_disconnect2();
 
-       return contacts_list_item;
+       return contacts_list;
 }
 
 static void _set_value_down_progress(double val)
@@ -5706,6 +5919,21 @@ static char *_get_service_fail_type(int type)
        } else if (type == EMAIL_ERROR_FAILED_BY_SECURITY_POLICY) {
                ret = _("IDS_EMAIL_POP_DOWNLOADING_ATTACHMENTS_ON_THE_MOBILE_DEVICE_IS_NOT_ALLOWED_BY_EXCHANGE_SERVER_POLICY");
                return g_strdup(ret);
+       } else if (type == EMAIL_ERROR_NETWORK_NOT_AVAILABLE) {
+               ret = N_("Network not available");
+               return g_strdup(ret);
+       } else if (type == EMAIL_ERROR_FLIGHT_MODE) {
+               ret = N_("Flight mode enabled");
+               return g_strdup(ret);
+       } else if (type == EMAIL_ERROR_NO_RESPONSE) {
+               ret = N_("No server response");
+               return g_strdup(ret);
+       } else if (type == EMAIL_ERROR_DISCONNECTED) {
+               ret = N_("Disconnected");
+               return g_strdup(ret);
+       } else if (type == EMAIL_ERROR_CONNECTION_BROKEN) {
+               ret = N_("Connection broken");
+               return g_strdup(ret);
        } else {
                snprintf(str, sizeof(str), "%s (%d)", dgettext("sys_string", "IDS_COM_POP_UNKNOWN_ERROR_OCCURRED"), type);
                return g_strdup(str);
@@ -5855,7 +6083,7 @@ static void _move_back_cb(void *data, Evas_Object *obj, void *event_info)
 
        EmailViewerUGD *ug_data = (EmailViewerUGD *)data;
 
-       elm_naviframe_item_pop(ug_data->navi_bar);
+       elm_object_item_del(ug_data->navi_move_it1);
        ug_data->navi_move_it1 = NULL;
 
        /*if (ug_data->b_internal)