diff options
Diffstat (limited to 'composer/src/email-composer-util.c')
-rwxr-xr-x | composer/src/email-composer-util.c | 227 |
1 files changed, 167 insertions, 60 deletions
diff --git a/composer/src/email-composer-util.c b/composer/src/email-composer-util.c index bceb935..204c793 100755 --- a/composer/src/email-composer-util.c +++ b/composer/src/email-composer-util.c @@ -462,41 +462,43 @@ int _composer_make_mail(EmailComposerUGD *ugd) { debug_log(""); - email_account_t *account = NULL; - if (!email_engine_get_account_full_data(ugd->account_info->account_id, &account)) - debug_log("Failed to Get account full data"); - if (ugd->composer_type == RUN_COMPOSER_EDIT || ugd->composer_type == RUN_COMPOSER_REPLY || ugd->composer_type == RUN_COMPOSER_REPLY_ALL || ugd->composer_type == RUN_COMPOSER_FORWARD) { - debug_log("acc id = %d, %d, %d", ugd->account_info->account_id, account->account_id, ugd->existing_mail_info->mail_data->account_id); - debug_log("priority = %d, %d", (*account).options.priority, ugd->existing_mail_info->mail_data->priority); + debug_log("acc id = %d, %d", ugd->account_info->account_id, ugd->existing_mail_info->mail_data->account_id); + debug_log("priority = %d, %d", (*ugd->account_info->account).options.priority, ugd->existing_mail_info->mail_data->priority); debug_log("mailbox = %s, %s", ugd->mailbox_info->mail_box->mailbox_name, ugd->existing_mail_info->mail_data->server_mailbox_name); ugd->new_mail_info->mail_data->account_id = ugd->existing_mail_info->mail_data->account_id; - ugd->new_mail_info->mail_data->priority = ugd->existing_mail_info->mail_data->priority; + //ugd->new_mail_info->mail_data->priority = ugd->existing_mail_info->mail_data->priority; } else { //RUN_COMPOSER_NEW || RUN_COMPOSER_EXTERNAL - debug_log("acc id = %d, %d", ugd->account_info->account_id, account->account_id); - debug_log("priority = %d", (*account).options.priority); + debug_log("acc id = %d", ugd->account_info->account_id); + debug_log("priority = %d", (*ugd->account_info->account).options.priority); debug_log("mailbox = %s", ugd->mailbox_info->mail_box->mailbox_name); ugd->new_mail_info->mail_data->account_id = ugd->account_info->account_id; - ugd->new_mail_info->mail_data->priority = (*account).options.priority; + //ugd->new_mail_info->mail_data->priority = (*account).options.priority; } + ugd->new_mail_info->mail_data->report_status = EMAIL_MAIL_REPORT_NONE; +/* + if (ugd->tracking_option[0] == 1) { + ugd->new_mail_info->mail_data->report_status |= EMAIL_MAIL_REQUEST_MDN; + } + if (ugd->tracking_option[1] == 1) { + ugd->new_mail_info->mail_data->report_status |= EMAIL_MAIL_REQUEST_DSN; + } + debug_log("ugd->new_mail_info->mail_data->report_status = %d", ugd->new_mail_info->mail_data->report_status); +*/ + ugd->new_mail_info->mail_data->priority = ugd->priority_option; + ugd->new_mail_info->mail_data->server_mailbox_name = strdup(ugd->mailbox_info->mail_box->mailbox_name); ugd->new_mail_info->mail_data->mailbox_id = ugd->mailbox_info->mail_box->mailbox_id; - debug_log("user_name = %s", account->user_display_name); - debug_log("email_addr = %s", account->user_email_address); + debug_log("user_name = %s", ugd->account_info->account->user_display_name); + debug_log("email_addr = %s", ugd->account_info->account->user_email_address); char uc[MAX_ACCOUNT_NAME_LEN + 20]; - snprintf(uc, sizeof(uc), "\"%s\"<%s>", account->user_display_name, account->user_email_address); + snprintf(uc, sizeof(uc), "\"%s\"<%s>", ugd->account_info->account->user_display_name, ugd->account_info->account->user_email_address); ugd->new_mail_info->mail_data->full_address_from = g_strdup(uc); debug_log("from = %s", uc); - if (account) { - debug_log("email_free_account is called"); - email_free_account(&account, 1); - account = NULL; - } - if (elm_object_item_text_get(elm_multibuttonentry_first_item_get(ugd->to_mbe)) != NULL) { debug_log("to mbe"); if (_composer_make_recipient_char_to_list(ugd, ugd->to_mbe, &(ugd->new_mail_info->mail_data->full_address_to)) < COMPOSER_ERROR_NONE) @@ -970,7 +972,7 @@ void _composer_save_popup_response_cb(void *data, Evas_Object *obj, void *event_ if (ugd->composer_type == RUN_COMPOSER_EDIT) { //After a new draft mail is added, the old draft mail is deleted and synced to server - debug_log("Account id [%d] mailbox id [%s] mail id [%d]", ugd->account_info->account->account_id, ugd->mailbox_info->mailbox_id, ugd->nExistingMailID); + debug_log("Account id [%d] mailbox id [%d] mail id [%d]", ugd->account_info->account->account_id, ugd->mailbox_info->mailbox_id, ugd->nExistingMailID); if (!email_engine_delete_mail(ugd->account_info->account->account_id, ugd->mailbox_info->mailbox_id, ugd->nExistingMailID, EMAIL_DELETE_LOCAL_AND_SERVER)) { debug_log("Deleting email is failed."); @@ -1247,8 +1249,7 @@ void _composer_set_mail_info(EmailComposerUGD *ugd) _composer_add_subject(ugd); _composer_add_body(ugd); - if (ugd->composer_type != RUN_COMPOSER_EDIT) - { + if (ugd->composer_type != RUN_COMPOSER_EDIT) { _composer_add_origin_msg(ugd); } @@ -1278,7 +1279,9 @@ void _composer_set_mail_info(EmailComposerUGD *ugd) (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 = email_parse_get_filename_from_path(ugd->existing_mail_info->mail_data->file_path_plain); + 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); if (plain_charset) { @@ -1306,8 +1309,7 @@ void _composer_set_mail_info(EmailComposerUGD *ugd) } } - if (EINA_TRUE == ugd->has_body_html) - { + if (EINA_TRUE == ugd->has_body_html) { debug_log(""); char file_path[100] = { 0, }; @@ -1416,12 +1418,7 @@ Eina_Bool _composer_show_progress_popup(void *data) progressbar = elm_progressbar_add(popup); - if (ugd->account_info->account_type == EMAIL_SERVER_TYPE_ACTIVE_SYNC) { - elm_object_style_set(progressbar, "pending_list"); - elm_progressbar_pulse(progressbar, EINA_TRUE); - } else { - elm_object_style_set(progressbar, "list_progress"); - } + elm_object_style_set(progressbar, "list_progress"); evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5); evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -1998,14 +1995,9 @@ void _composer_add_cc_address(EmailComposerUGD *ugd) if (ugd->cc_mbe == NULL) { edje_object_signal_emit(_EDJ(ugd->c_layout), "show.cc", "*"); email_composer_create_cc_field(ugd); - -#ifdef _CC_BCC edje_object_signal_emit(_EDJ(ugd->c_layout), "show.bcc", "*"); email_composer_create_bcc_field(ugd); - elm_object_text_set(ugd->cc_btn, N_("Remove Cc/Bcc")); -#endif - ugd->b_cc_bcc = false; } @@ -2112,14 +2104,9 @@ void _composer_add_cc_address(EmailComposerUGD *ugd) debug_log(""); edje_object_signal_emit(_EDJ(ugd->c_layout), "show.cc", "*"); email_composer_create_cc_field(ugd); - -#ifdef _CC_BCC edje_object_signal_emit(_EDJ(ugd->c_layout), "show.bcc", "*"); email_composer_create_bcc_field(ugd); - elm_object_text_set(ugd->cc_btn, N_("Remove Cc/Bcc")); -#endif - ugd->b_cc_bcc = false; } } @@ -2145,14 +2132,9 @@ void _composer_add_bcc_address(EmailComposerUGD *ugd) if (ugd->bcc_mbe == NULL) { edje_object_signal_emit(_EDJ(ugd->c_layout), "show.bcc", "*"); email_composer_create_bcc_field(ugd); - -#ifdef _CC_BCC edje_object_signal_emit(_EDJ(ugd->c_layout), "show.cc", "*"); email_composer_create_cc_field(ugd); - elm_object_text_set(ugd->cc_btn, N_("Remove Cc/Bcc")); -#endif - ugd->b_cc_bcc = false; } @@ -2259,14 +2241,9 @@ void _composer_add_bcc_address(EmailComposerUGD *ugd) debug_log(""); edje_object_signal_emit(_EDJ(ugd->c_layout), "show.bcc", "*"); email_composer_create_bcc_field(ugd); - -#ifdef _CC_BCC edje_object_signal_emit(_EDJ(ugd->c_layout), "show.cc", "*"); email_composer_create_cc_field(ugd); - elm_object_text_set(ugd->cc_btn, N_("Remove Cc/Bcc")); -#endif - ugd->b_cc_bcc = false; } } @@ -2366,8 +2343,7 @@ void _composer_add_body(EmailComposerUGD *ugd) if (ugd->existing_mail_info->mail_data && ugd->existing_mail_info->mail_data->body_download_status) { if (ugd->composer_type == RUN_COMPOSER_EDIT) { - if (ugd->has_body_html) - { + if (ugd->has_body_html) { debug_log("html composer_type: EDIT"); char *html_text_for_body = NULL; @@ -2380,14 +2356,23 @@ void _composer_add_body(EmailComposerUGD *ugd) debug_log("\nHTML-TEXT:\n%s", html_text_for_body); free(temp_body_plain); } + + char szMetaViewportInfo[TEMP_BUFFER_SIZE + 1] = { 0x00, }; + strncpy(szMetaViewportInfo, HTML_META_INFORMATION, TEMP_BUFFER_SIZE); + char *full_text = NULL; + full_text = g_strconcat(szMetaViewportInfo, html_text_for_body, NULL); + debug_log("html_text_for_body: %s", html_text_for_body); + if (html_text_for_body) { - email_composer_save_file(ugd->saved_html_path, html_text_for_body, STR_LEN(html_text_for_body)); + email_composer_save_file(ugd->saved_html_path, full_text, STR_LEN(full_text)); g_free(html_text_for_body); } else { html_text_for_body = (char *)email_get_buff_from_file(DATADIR"/_email_default.html", 0); - email_composer_save_file(ugd->saved_html_path, html_text_for_body, STR_LEN(html_text_for_body)); + email_composer_save_file(ugd->saved_html_path, full_text, STR_LEN(full_text)); g_free(html_text_for_body); } + + debug_log("full text:\n%s", full_text); } } } @@ -2422,8 +2407,7 @@ void _composer_make_html_body(EmailComposerUGD *ugd) char *temp; char *token; - if (((ugd->composer_type == RUN_COMPOSER_REPLY || ugd->composer_type == RUN_COMPOSER_REPLY_ALL) && ugd->account_info->account->options.reply_with_body) || ugd->composer_type == RUN_COMPOSER_FORWARD) - { + if (((ugd->composer_type == RUN_COMPOSER_REPLY || ugd->composer_type == RUN_COMPOSER_REPLY_ALL) && ugd->account_info->account->options.reply_with_body) || ugd->composer_type == RUN_COMPOSER_FORWARD) { if (ugd->existing_mail_info->mail_data->full_address_to) { temp = COMPOSER_STRDUP(ugd->existing_mail_info->mail_data->full_address_to); token = strtok(temp, ";"); @@ -3262,6 +3246,7 @@ void _composer_popup_response_cb(void *data, Evas_Object *obj, void *event_info) } // elm_multibuttonentry_item_unselect_all(mbe); + 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)); @@ -3454,9 +3439,12 @@ 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); - 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); + if (ugd->isRotated == false) { + 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); + } else { + evas_object_size_hint_min_set(ugd->webkit_ly, 0, nWidth - COMPOSER_NAVI_HEIGHT - ime_height); + } } void _composer_input_panel_state_changed_cb(void *data, Ecore_IMF_Context *ctx, int value) @@ -3584,3 +3572,122 @@ void _composer_coords_evas_to_ewk(Evas_Object *view, int evasX, int evasY, int * *ewkY = evasY + scrollY - viewY; } +void _composer_set_option_tray_menu(int num, EmailComposerUGD *ugd) +{ + debug_log(""); + + Evas_Object *btn = NULL; + + switch (num) { + case EMAIL_COMPOSER_ADD_ME_BTN : // Add me btn + btn = elm_button_add(ugd->cbar); + elm_object_style_set(btn, "naviframe_control/default"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0.5); + ugd->controlbar_item[EMAIL_COMPOSER_ADD_ME_BTN] = elm_toolbar_item_append(ugd->cbar, NULL, NULL, NULL, NULL); + elm_object_item_part_content_set(ugd->controlbar_item[EMAIL_COMPOSER_ADD_ME_BTN], "object", btn); + elm_object_text_set(btn, N_("Add me")); + ugd->add_me_btn = btn; + evas_object_smart_callback_add(ugd->add_me_btn, "clicked", _composer_cbar_add_me_clicked, ugd); + break; + case EMAIL_COMPOSER_ADD_CC_BCC_BTN : // Add Cc/Bcc btn + btn = elm_button_add(ugd->cbar); + elm_object_style_set(btn, "naviframe_control/default"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0.5); + ugd->controlbar_item[EMAIL_COMPOSER_ADD_CC_BCC_BTN] = elm_toolbar_item_append(ugd->cbar, NULL, NULL, NULL, NULL); + elm_object_item_part_content_set(ugd->controlbar_item[EMAIL_COMPOSER_ADD_CC_BCC_BTN], "object", btn); + if (ugd->cc_added) { + elm_object_text_set(btn, N_("Remove Cc/Bcc")); + } else { + elm_object_text_set(btn, _("IDS_EMAIL_OPT_ADD_CC_BCC")); + } + ugd->cc_btn = btn; + evas_object_smart_callback_add(ugd->cc_btn, "clicked", _composer_cbar_cc_clicked, ugd); + break; + case EMAIL_COMPOSER_SAVE_AS_DRAFT_BTN : // Save as draft btn + { + Evas_Object *cbar = NULL; + cbar = ugd->cbar; + btn = elm_button_add(cbar); + elm_object_style_set(btn, "naviframe_control/default"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0.5); + ugd->controlbar_item[EMAIL_COMPOSER_SAVE_AS_DRAFT_BTN] = elm_toolbar_item_append(cbar, NULL, NULL, NULL, NULL); + elm_object_item_part_content_set(ugd->controlbar_item[EMAIL_COMPOSER_SAVE_AS_DRAFT_BTN], "object", btn); + elm_object_text_set(btn, N_("Save as draft")); + ugd->save_as_draft_btn = btn; + evas_object_smart_callback_add(ugd->save_as_draft_btn, "clicked", _composer_cbar_save_as_draft_clicked, ugd); + } + break; + case EMAIL_COMPOSER_PRIORITY_BTN : // Priority btn + btn = elm_button_add(ugd->cbar2); + elm_object_style_set(btn, "naviframe_control/default"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0.5); + ugd->controlbar_item[EMAIL_COMPOSER_PRIORITY_BTN] = elm_toolbar_item_append(ugd->cbar2, NULL, NULL, NULL, NULL); + elm_object_item_part_content_set(ugd->controlbar_item[EMAIL_COMPOSER_PRIORITY_BTN], "object", btn); + elm_object_text_set(btn, _("IDS_EMAIL_BODY_PRIORITY")); + ugd->priority_btn = btn; + evas_object_smart_callback_add(ugd->priority_btn, "clicked", _composer_cbar_priority_clicked, ugd); + break; + case EMAIL_COMPOSER_TRACKING_BTN : // Tracking btn + btn = elm_button_add(ugd->cbar2); + elm_object_style_set(btn, "naviframe_control/default"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 0.5); + ugd->controlbar_item[EMAIL_COMPOSER_TRACKING_BTN] = elm_toolbar_item_append(ugd->cbar2, NULL, NULL, NULL, NULL); + elm_object_item_part_content_set(ugd->controlbar_item[EMAIL_COMPOSER_TRACKING_BTN], "object", btn); + elm_object_text_set(btn, N_("Tracking")); + ugd->tracking_btn = btn; + evas_object_smart_callback_add(ugd->tracking_btn, "clicked", _composer_cbar_tracking_clicked, ugd); + break; + case EMAIL_COMPOSER_DUMMY_BTN : // Dummy btn + ugd->dummy_btn = NULL; + break; + default : // never get here! + debug_log("default"); + } + + evas_object_show(btn); +} + +void _composer_unset_option_tray_menu(int num, EmailComposerUGD *ugd) +{ + debug_log(""); + + elm_object_item_del(ugd->controlbar_item[num]); + ugd->controlbar_item[num] = NULL; + + switch (num) { + case EMAIL_COMPOSER_ADD_ME_BTN : // Add me btn + evas_object_del(ugd->add_me_btn); + ugd->add_me_btn = NULL; + break; + case EMAIL_COMPOSER_ADD_CC_BCC_BTN : // Add Cc/Bcc btn + evas_object_del(ugd->cc_btn); + ugd->cc_btn = NULL; + break; + case EMAIL_COMPOSER_SAVE_AS_DRAFT_BTN : // Save as draft btn + { + evas_object_del(ugd->save_as_draft_btn); + ugd->save_as_draft_btn = NULL; + } + break; + case EMAIL_COMPOSER_PRIORITY_BTN : // Priority btn + evas_object_del(ugd->priority_btn); + ugd->priority_btn = NULL; + break; + case EMAIL_COMPOSER_TRACKING_BTN : // Tracking btn + evas_object_del(ugd->tracking_btn); + ugd->tracking_btn = NULL; + break; + case EMAIL_COMPOSER_DUMMY_BTN : // Dummy btn + evas_object_del(ugd->dummy_btn); + ugd->dummy_btn = NULL; + break; + default : // never get here! + debug_log("default"); + } +} + |