From d68421f1d5f7c2b09d12c50a4f114ae724982ed5 Mon Sep 17 00:00:00 2001 From: Kim Jinho Date: Tue, 23 Oct 2012 18:04:55 +0900 Subject: [PATCH] Apply mailbox latest codes --- account/include/email-account.h | 4 +- account/src/email-account-folder.c | 114 +++++++++++++++++++++++---------- account/src/email-account.c | 2 +- mailbox/src/email-mailbox-controlbar.c | 2 +- mailbox/src/email-mailbox-list.c | 22 ++++--- mailbox/src/email-mailbox-noti-mgr.c | 6 +- mailbox/src/email-mailbox.c | 8 +-- 7 files changed, 106 insertions(+), 52 deletions(-) diff --git a/account/include/email-account.h b/account/include/email-account.h index 6eddf13..941360f 100755 --- a/account/include/email-account.h +++ b/account/include/email-account.h @@ -70,7 +70,7 @@ #define MAX_STR_LEN 1024 #define NUM_STR_LEN 20 -#define EMAIL_HANDLE_INVALID -1 +#define EMAIL_HANDLE_INVALID 0 typedef enum { @@ -204,7 +204,7 @@ struct ug_data { ({\ email_account_t *email_account = NULL;\ int server_type = 0;\ - int e = email_get_account(account_id, 0, &email_account);\ + int e = email_get_account(account_id, EMAIL_ACC_GET_OPT_DEFAULT, &email_account);\ if (e != EMAIL_ERROR_NONE || !email_account) {\ debug_warning("email_get_account acct(%d) - err(%d) or acct NULL(%p)",\ account_id, e, email_account);\ diff --git a/account/src/email-account-folder.c b/account/src/email-account-folder.c index 0f77bfe..6d30ec0 100755 --- a/account/src/email-account-folder.c +++ b/account/src/email-account-folder.c @@ -2247,14 +2247,7 @@ static void _delete_con_cb(void *data, Evas_Object *obj, void *event_info) else { debug_log("\n email_delete_mailbox succeed : handle[%d]\n", handle); ug_data->emf_handle = handle; - if(ug_data->emf_handle == 0) - { - _popup_success_cb(ug_data, NULL, NULL); - } - else - { - _popup_progress_cb(ug_data, obj, event_info); - } + _popup_progress_cb(ug_data, obj, event_info); } } @@ -2391,14 +2384,7 @@ static void _create_con_cb(void *data, Evas_Object *obj, void *event_info) else { debug_log("\n email_add_mailbox succeed : handle[%d]\n", handle); alist->ug_data->emf_handle = handle; - if(alist->ug_data->emf_handle == 0) - { - _popup_success_cb(alist->ug_data, NULL, NULL); - } - else - { - _popup_progress_cb(alist->ug_data, obj, event_info); - } + _popup_progress_cb(alist->ug_data, obj, event_info); } } @@ -2548,14 +2534,7 @@ static void _rename_con_cb(void *data, Evas_Object *obj, void *event_info) else { debug_log("email_rename_mailbox succeed[%d]", handle); alist->ug_data->emf_handle = handle; - if(alist->ug_data->emf_handle == 0) - { - _popup_success_cb(alist->ug_data, NULL, NULL); - } - else - { - _popup_progress_cb(alist->ug_data, obj, event_info); - } + _popup_progress_cb(alist->ug_data, obj, event_info); } g_free(parent_path); @@ -2625,6 +2604,8 @@ static void _popup_rename_cb(void *data, Evas_Object *obj, void *event_info) elm_entry_scrollable_set(entry, EINA_TRUE); // Make entry as scrollable single line. elm_entry_single_line_set(entry, EINA_TRUE); elm_entry_entry_set(entry, mlist->alias); // set current folder name + elm_entry_cursor_end_set(entry); + evas_object_smart_callback_add(entry, "changed", _entry_changed_cb, layout); evas_object_smart_callback_add(entry, "focused", _entry_focused_cb, layout); evas_object_smart_callback_add(entry, "unfocused", _entry_unfocused_cb, layout); @@ -2690,10 +2671,25 @@ static void _move_con_cb(void *data, Evas_Object *obj, void *event_info) int handle; int on_server = (EMAIL_SERVER_TYPE_POP3 == GET_ACCOUNT_SERVER_TYPE(alist->ug_data->account_id)?0:1); + gchar* ptr = g_strrstr_len(mlist_from->mailbox_name, -1, "/"); + gchar* from_mailbox_name = NULL; + + if(ptr) { + ptr++; + from_mailbox_name = g_strdup(ptr); + } + else { + from_mailbox_name = g_strdup(mlist_from->mailbox_name); + } + + debug_log("from mailbox_name : %s", from_mailbox_name); + if(strlen(mlist_to->mailbox_name) > 0) - snprintf(arg1, sizeof(arg1), "%s/%s", mlist_to->mailbox_name, mlist_from->alias); + snprintf(arg1, sizeof(arg1), "%s/%s", mlist_to->mailbox_name, from_mailbox_name); else - snprintf(arg1, sizeof(arg1), "%s", mlist_from->alias); + snprintf(arg1, sizeof(arg1), "%s", from_mailbox_name); + + g_free(from_mailbox_name); debug_log("move_to folder from[%s], to[%s], new_name[%s], on_server[%d]", mlist_from->mailbox_name, mlist_to->mailbox_name, arg1, on_server); @@ -2757,10 +2753,51 @@ static void _popup_movefolder_cb(void *data, Evas_Object *obj, void *event_info) debug_log("item_data is NULL"); return; } + + int to_depth = elm_genlist_item_expanded_depth_get(it); + Elm_Object_Item *parent_to = it; + char* to_string = g_strdup(mlist->alias); + int i = 1; + + for (i = 1; i < to_depth; i++) { + parent_to = elm_genlist_item_parent_get(parent_to); + Item_Data *parent_to_item_data = elm_object_item_data_get((const Elm_Object_Item *)parent_to); + if(parent_to_item_data) { + GNode *node_parent = (GNode *)parent_to_item_data->child; + if(node_parent) { + email_mailbox_t *mlist_parent = (email_mailbox_t *)(node_parent->data); + char temp[MAX_STR_LEN] = { 0, }; + snprintf(temp, sizeof(temp), "%s/%s", mlist_parent->alias, to_string); + g_free(to_string); + to_string = g_strdup(temp); + } + } + } + GNode *node_from = (GNode *)item_data_from->child; email_mailbox_t *mlist_from = (email_mailbox_t *)(node_from->data); - snprintf(arg1, sizeof(arg1), "Move folder [%s] to [%s]", mlist_from->mailbox_name, mlist->mailbox_name); + int from_depth = elm_genlist_item_expanded_depth_get(it_from); + Elm_Object_Item *parent_from = it_from; + char* from_string = g_strdup(mlist_from->alias); + + for (i = 1; i < from_depth; i++) { + parent_from = elm_genlist_item_parent_get(parent_from); + Item_Data *parent_from_item_data = elm_object_item_data_get((const Elm_Object_Item *)parent_from); + if(parent_from_item_data) { + GNode *node_from_parent = (GNode *)parent_from_item_data->child; + if(node_from_parent) { + email_mailbox_t *mlist_from_parent = (email_mailbox_t *)(node_from_parent->data); + char temp[MAX_STR_LEN] = { 0, }; + snprintf(temp, sizeof(temp), "%s/%s", mlist_from_parent->alias, from_string); + g_free(from_string); + from_string = g_strdup(temp); + } + } + } + snprintf(arg1, sizeof(arg1), "Move folder [%s] to [%s]", from_string, to_string); + + char *popup_text = elm_entry_utf8_to_markup(arg1); Evas_Object *notify = elm_popup_add(alist->ug_data->win); evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -3297,6 +3334,21 @@ static void _edbus_event_account_receive(void *local_data, DBusMessage *message) } break; + case NOTI_MAILBOX_RENAME: + account_id = data1; + //In case of native email-service, rename notification is handled here + debug_log("NOTI_MAILBOX_RENAME"); + _popup_success_cb(ug_data, NULL, NULL); + + break; + + case NOTI_MAILBOX_RENAME_FAIL: + account_id = data1; + debug_log("NOTI_MAILBOX_RENAME_FAIL"); + _popup_fail_cb(ug_data, NULL, NULL); + + break; + default: debug_log("Uninterested notification"); break; @@ -3412,12 +3464,8 @@ static void _stop_emf_job(EmailAccountUGD *ug_data, int handle) gint account_id = ug_data->account_id; - if (handle > 0) { - debug_log("stop job - handle (%d)", handle); - email_engine_stop_working(account_id, handle); - } else { - debug_warning("handle1 is %d. so we can't call email_engine_stop_working()", handle); - } + debug_log("stop job - handle (%d)", handle); + email_engine_stop_working(account_id, handle); ug_data->emf_handle = EMAIL_HANDLE_INVALID; } diff --git a/account/src/email-account.c b/account/src/email-account.c index 2c1bc94..f70751d 100755 --- a/account/src/email-account.c +++ b/account/src/email-account.c @@ -324,7 +324,7 @@ 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); + evas_object_show(ug_data->bg); ug_data->ly = elm_layout_add(ug_data->win); if (ug_data->ly == NULL) { diff --git a/mailbox/src/email-mailbox-controlbar.c b/mailbox/src/email-mailbox-controlbar.c index 8e7865a..d253306 100755 --- a/mailbox/src/email-mailbox-controlbar.c +++ b/mailbox/src/email-mailbox-controlbar.c @@ -651,7 +651,7 @@ static void _viewby_cb(void *data, Evas_Object *obj, void *event_info) if (index > 4) index = 4; Evas_Object *box = elm_box_add(mailbox_ugd->viewby_popup); - evas_object_size_hint_min_set(box, 610 * elm_scale_get(), 114 * index * elm_scale_get()); + evas_object_size_hint_min_set(box, 610 * elm_scale_get(), 113 * index * elm_scale_get()); evas_object_show(genlist); elm_box_pack_end(box, genlist); elm_object_content_set(mailbox_ugd->viewby_popup, box); diff --git a/mailbox/src/email-mailbox-list.c b/mailbox/src/email-mailbox-list.c index 2c4b984..0b6bbe9 100755 --- a/mailbox/src/email-mailbox-list.c +++ b/mailbox/src/email-mailbox-list.c @@ -461,10 +461,13 @@ static void _realized_cb(void *data, Evas_Object *obj, void *event_info) if (ld->is_attachment == true) { elm_object_item_signal_emit(ld->item, "elm,state,attach", "elm"); } +#if 0 // priority icon position is the same with the lastverb icon position if(ld->priority != EMAIL_OPTION_PRIORITY_NORMAL) { elm_object_item_signal_emit(ld->item, "elm,state,priority", "elm"); } - if(ld->reply_flag || ld->forward_flag) { +#endif + + if( ld->priority == EMAIL_OPTION_PRIORITY_HIGH || ld->reply_flag || ld->forward_flag) { elm_object_item_signal_emit(ld->item, "elm,state,lastverb", "elm"); } @@ -747,7 +750,7 @@ static Evas_Object *_gl_mail_item_content_get(void *data, Evas_Object *obj, cons return (void *)ic; } } - +#if 0 // support low priority message, priority icon postion is changed else if(!g_strcmp0(source, "elm.icon.priority")) { if(ld->priority == EMAIL_OPTION_PRIORITY_HIGH) { @@ -758,7 +761,6 @@ static Evas_Object *_gl_mail_item_content_get(void *data, Evas_Object *obj, cons evas_object_show(ic); return (void *)ic; } -#if 0 // support low priority message else if(ld->priority == EMAIL_OPTION_PRIORITY_LOW) { if(ld->item) edje_object_signal_emit((Evas_Object *)elm_genlist_item_object_get(ld->item), "elm,state,priority", "elm"); @@ -769,14 +771,18 @@ static Evas_Object *_gl_mail_item_content_get(void *data, Evas_Object *obj, cons evas_object_show(ic); return (void *)ic; } -#endif } - +#endif else if(!g_strcmp0(source, "elm.icon.lastverb")) { - - if(ld->reply_flag || ld->forward_flag) - { + if(ld->priority == EMAIL_OPTION_PRIORITY_HIGH) { + Evas_Object *ic = elm_icon_add(obj); + elm_icon_file_set(ic, IMGDIR "/M02_email_icon_priority.png", NULL); + elm_icon_resizable_set(ic, 0, 0); + evas_object_image_smooth_scale_set(ic, 0); + evas_object_show(ic); + return (void *)ic; + } else if(ld->reply_flag || ld->forward_flag) { Evas_Object *ic = elm_icon_add(obj); if(ld->reply_flag == true) diff --git a/mailbox/src/email-mailbox-noti-mgr.c b/mailbox/src/email-mailbox-noti-mgr.c index 9e92343..e0cb85f 100755 --- a/mailbox/src/email-mailbox-noti-mgr.c +++ b/mailbox/src/email-mailbox-noti-mgr.c @@ -622,7 +622,7 @@ static void _edbus_event_mailbox_receive(void *local_data, DBusMessage *message) mailid = data2; int type = data4; - if(type == UPDATE_PARTIAL_BODY_DOWNLOAD) { + if(type == UPDATE_PARTIAL_BODY_DOWNLOAD || type == APPEND_BODY) { list_data *ld = _find_mailinfo_by_mailid(mailid, mailbox_ugd->list_data[view_type]); if(ld) { email_mail_list_item_t* mail_info = NULL; @@ -654,6 +654,10 @@ static void _edbus_event_mailbox_receive(void *local_data, DBusMessage *message) email_mail_list_item_t* mail_info = NULL; mail_info = get_mail_info(mailid); if(!mail_info) break; + ld->is_attachment = mail_info->attachment_count; + if (ld->preview_body) + FREE(ld->preview_body); + ld->preview_body = STRNDUP(mail_info->preview_text, MAX_PREVIEW_TEXT_LENGTH - 1); ld->is_seen = mail_info->flags_seen_field; ld->followup_flag = mail_info->flags_flagged_field; ld->reply_flag = mail_info->flags_answered_field; diff --git a/mailbox/src/email-mailbox.c b/mailbox/src/email-mailbox.c index 617d528..55049e3 100755 --- a/mailbox/src/email-mailbox.c +++ b/mailbox/src/email-mailbox.c @@ -1241,12 +1241,8 @@ void _stop_emf_job(EmailMailboxUGD *mailbox_ugd, int handle, gboolean change_dow debug_log(""); gint account_id = mailbox_ugd->account_id; - if (handle > 0) { - debug_log("stop job - handle (%d)", handle); - email_engine_stop_working(account_id, handle); - } else { - debug_warning("handle1 is %d. so we can't call email_engine_stop_working()", handle); - } + debug_log("stop job - handle (%d)", handle); + email_engine_stop_working(account_id, handle); mailbox_ugd->emf_handle = 0; _reset_refer_item_and_idx(mailbox_ugd); -- 2.7.4