X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=viewer%2Fsrc%2Femail-viewer.c;h=73ff494141a87a1e3e6cd6f15b0f9824ad4cb990;hb=0fd87892d4cc2e6c286a2920d8e130fd886a49dc;hp=36315b294cdddb50f9261308cdde5c770d31e62e;hpb=20faabe48c932382b820c3d80f1a501517e3cbe5;p=apps%2Fcore%2Fpreloaded%2Femail.git diff --git a/viewer/src/email-viewer.c b/viewer/src/email-viewer.c index 36315b2..73ff494 100755 --- a/viewer/src/email-viewer.c +++ b/viewer/src/email-viewer.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -114,6 +113,8 @@ static void _attachment_bg_set_cb(void *data, Evas * evas, Evas_Object *obj, voi static void _attachment_bg_unset_cb(void *data, Evas * evas, Evas_Object *obj, void *event_info); static void _mark_as_unread_cb(void *data, Evas_Object *obj, void *event_info); static void _mark_as_read_cb(void *data, Evas_Object *obj, void *event_info); +static void _save_email_cb(void *data, Evas_Object *obj, void *event_info); +static Eina_Bool _save_email_prog_cb(void *data); static void _ctxpopup_detail_contact_cb(void *data, Evas_Object *obj, void *event_info); static void _ctxpopup_send_email_cb(void *data, Evas_Object *obj, void *event_info); @@ -133,6 +134,8 @@ static void _outter_scroller_bottom_hit_cb(void *data, Evas_Object *obj, void *e static void _outter_scroller_top_hit_cb(void *data, Evas_Object *obj, void *event_info); static void _outter_scroller_scroll_cb(void *data, Evas_Object *obj, void *event_info); +static void _mbe_focused_cb(void *data, Evas_Object *obj, void *event_info); +static void _mbe_unfocused_cb(void *data, Evas_Object *obj, void *event_info); static void _mbe_added_cb(void *data, Evas_Object *obj, void *event_info); static void _mbe_selected_cb(void *data, Evas_Object *obj, void *event_info); static void _destroy_down_progress_cb(void *data, Evas_Object *obj, void *event_info); @@ -166,13 +169,8 @@ static Eina_Bool _gl_state_get(void *data, Evas_Object *obj, const char *part); static void _gl_del(void *data, Evas_Object *obj); static char *_gl_text_get(void *data, Evas_Object *obj, const char *part); static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *part); -static void _gl_sel(void *data, Evas_Object *obj, void *event_info); -static char *_gl_sub_upper_text_get(void *data, Evas_Object *obj, const char *part); -static Evas_Object *_gl_sub_upper_icon_get(void *data, Evas_Object *obj, const char *part); -static void _gl_sub_upper_sel(void *data, Evas_Object *obj, void *event_info); static void _move_here_cb(void *data, Evas_Object *obj, void *event_info); static void _move_back_cb(void *data, Evas_Object *obj, void *event_info); -static void _move_back_cb2(void *data, Evas_Object *obj, void *event_info); UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops) @@ -373,7 +371,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 = 1009.0; + ug_data->webview_height = 1021.0; ug_data->webview_width_landscape = 710.0; ug_data->webview_height_landscape = 558.0; ug_data->webview_margin = 1029; @@ -699,6 +697,7 @@ static void on_event(ui_gadget_h ug, enum ug_event event, service_h data, void * 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); @@ -720,14 +719,6 @@ static void on_event(ui_gadget_h ug, enum ug_event event, service_h data, void * ug_data->move_cbar = NULL; } } - if (ug_data->navi_move_it2) { - debug_log("move2"); - 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_cb2, ug_data); - elm_object_item_part_content_set(ug_data->navi_move_it2, "prev_btn", move_back_btn); - elm_naviframe_item_title_visible_set(ug_data->navi_move_it2, EINA_TRUE); - } if (ug_data->b_btn) { evas_object_smart_callback_del(ug_data->b_btn, "clicked", _back_cb); @@ -740,10 +731,6 @@ static void on_event(ui_gadget_h ug, enum ug_event event, service_h data, void * evas_object_smart_callback_add(ug_data->b_btn, "clicked", _back_cb, ug_data); elm_object_item_part_content_set(ug_data->navi_main_it, "prev_btn", ug_data->b_btn); - int resized_w = ug_data->webview_width * ug_data->scale_factor; - int resized_h = ug_data->webview_height * ug_data->scale_factor; - evas_object_size_hint_min_set(ug_data->webview, resized_w, resized_h); - ug_data->isRotate = false; } @@ -752,6 +739,7 @@ static void on_event(ui_gadget_h ug, enum ug_event event, service_h data, void * case UG_EVENT_ROTATE_LANDSCAPE: case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN: 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); @@ -779,16 +767,6 @@ static void on_event(ui_gadget_h ug, enum ug_event event, service_h data, void * } elm_naviframe_item_title_visible_set(ug_data->navi_move_it1, EINA_FALSE); } - if (ug_data->navi_move_it2) { - debug_log("move2"); - Evas_Object *move_back_btn = elm_object_item_part_content_get(ug_data->navi_move_it2, "prev_btn"); - if (move_back_btn) { - evas_object_smart_callback_del(move_back_btn, "clicked", _move_back_cb2); - evas_object_del(move_back_btn); - elm_object_item_part_content_set(ug_data->navi_move_it2, "prev_btn", NULL); - } - elm_naviframe_item_title_visible_set(ug_data->navi_move_it2, EINA_FALSE); - } if (ug_data->b_btn) { evas_object_smart_callback_del(ug_data->b_btn, "clicked", _back_cb); @@ -797,10 +775,6 @@ static void on_event(ui_gadget_h ug, enum ug_event event, service_h data, void * elm_object_item_part_content_set(ug_data->navi_main_it, "prev_btn", NULL); } - int resized_w = ug_data->webview_width_landscape * ug_data->scale_factor; - int resized_h = ug_data->webview_height_landscape * ug_data->scale_factor; - evas_object_size_hint_min_set(ug_data->webview, resized_w, resized_h); - ug_data->isRotate = true; } @@ -1254,6 +1228,10 @@ static void _reset_view(EmailViewerUGD *ug_data) /* reset subject */ char *_subject = elm_entry_utf8_to_markup(prop->subject); + if (!g_strcmp0(_subject, "")) { + g_free(_subject); + _subject = g_strdup(_("IDS_EMAIL_BODY_NO_SUBJECT")); + } char *_subject_concated = g_strconcat("", _subject, "", NULL); elm_object_text_set(ug_data->lb_subject, _subject_concated); elm_label_wrap_width_set(ug_data->lb_subject, ug_data->main_w - (int)(110 * ug_data->scale_factor)); @@ -1303,6 +1281,12 @@ static void _reset_view(EmailViewerUGD *ug_data) evas_object_show(ug_data->ly_subject); elm_box_pack_end(ug_data->main_bx, ug_data->ly_subject); + Evas_Object *edje = elm_layout_edje_get(ug_data->ly_subject); + + if (!ug_data->to_list && !ug_data->cc_list && !ug_data->bcc_list) { + edje_object_signal_emit(edje, "elm,state,arrow_hidden", "elm"); + } + if (prop->has_attachment) ug_data->got_att = 1; else @@ -1331,7 +1315,6 @@ void _hide_view(EmailViewerUGD *ug_data) if (elm_naviframe_top_item_get(ug_data->navi_bar) != ug_data->navi_main_it) { ug_data->navi_move_it1 = NULL; - ug_data->navi_move_it2 = NULL; elm_naviframe_item_pop_to(ug_data->navi_main_it); } @@ -1451,7 +1434,6 @@ void _hide_view(EmailViewerUGD *ug_data) ug_data->m_is_multi_touch = 0; ug_data->navi_move_it1 = NULL; - ug_data->navi_move_it2 = NULL; /* Double_Scroller */ ug_data->b_noc = 1; @@ -1516,6 +1498,10 @@ static Evas_Object *_create_subject(EmailViewerUGD *ug_data) subject_label = elm_label_add(di); elm_object_part_content_set(di, "elm.text", subject_label); char *subject = elm_entry_utf8_to_markup(prop->subject); + if (!g_strcmp0(subject, "")) { + g_free(subject); + subject = g_strdup(_("IDS_EMAIL_BODY_NO_SUBJECT")); + } char *subject_tagged = g_strconcat("", subject, "", NULL); elm_object_text_set(subject_label, subject_tagged); elm_label_wrap_width_set(subject_label, ug_data->main_w - (int)(110 * ug_data->scale_factor)); @@ -1568,10 +1554,10 @@ static Evas_Object *_create_subject(EmailViewerUGD *ug_data) if (ug_data->to_list || ug_data->cc_list || ug_data->bcc_list) { edje_object_signal_callback_add(edje, "elm,action,expand,toggle", "elm", _subject_detail_clicked_cb, di); - edje_object_signal_callback_add(edje, "elm,action,toggle", "elm", _subject_favorite_clicked_cb, di); } else { edje_object_signal_emit(edje, "elm,state,arrow_hidden", "elm"); } + edje_object_signal_callback_add(edje, "elm,action,toggle", "elm", _subject_favorite_clicked_cb, di); return di; } @@ -1611,6 +1597,8 @@ static Evas_Object *_create_to_addrs(EmailViewerUGD *ug_data) evas_object_smart_callback_add(to_mbe, "item,clicked", _mbe_selected_cb, ug_data); evas_object_smart_callback_add(to_mbe, "item,added", _mbe_added_cb, ug_data); + evas_object_smart_callback_add(to_mbe, "focused", _mbe_focused_cb, ug_data); + evas_object_smart_callback_add(to_mbe, "unfocused", _mbe_unfocused_cb, ug_data); elm_object_part_content_set(di, "elm.icon", to_mbe); ug_data->to_mbe = to_mbe; @@ -1677,6 +1665,8 @@ static Evas_Object *_create_cc_addrs(EmailViewerUGD *ug_data) g_free(cc_str); evas_object_smart_callback_add(cc_mbe, "item,clicked", _mbe_selected_cb, ug_data); evas_object_smart_callback_add(cc_mbe, "item,added", _mbe_added_cb, ug_data); + evas_object_smart_callback_add(cc_mbe, "focused", _mbe_focused_cb, ug_data); + evas_object_smart_callback_add(cc_mbe, "unfocused", _mbe_unfocused_cb, ug_data); elm_object_part_content_set(di, "elm.icon", cc_mbe); ug_data->cc_mbe = cc_mbe; @@ -1743,6 +1733,8 @@ static Evas_Object *_create_bcc_addrs(EmailViewerUGD *ug_data) g_free(bcc_str); evas_object_smart_callback_add(bcc_mbe, "item,clicked", _mbe_selected_cb, ug_data); evas_object_smart_callback_add(bcc_mbe, "item,added", _mbe_added_cb, ug_data); + evas_object_smart_callback_add(bcc_mbe, "focused", _mbe_focused_cb, ug_data); + evas_object_smart_callback_add(bcc_mbe, "unfocused", _mbe_unfocused_cb, ug_data); elm_object_part_content_set(di, "elm.icon", bcc_mbe); ug_data->bcc_mbe = bcc_mbe; @@ -1996,6 +1988,8 @@ static Evas_Object *_create_body(EmailViewerUGD *ug_data) if (ug_data->webview_bx) { _init_webview_data(ug_data); + ewk_view_scale_set(ug_data->webview, 1.0f, 0, 0); + if (prop->has_html) { /* html mail */ ug_data->webview_data->body_type_prev = BODY_TYPE_HTML; @@ -2056,6 +2050,7 @@ static Evas_Object *_create_body(EmailViewerUGD *ug_data) resized_w = ug_data->webview_width * ug_data->scale_factor; resized_h = ug_data->webview_height * ug_data->scale_factor; } + debug_log("resized_w:%d, resized_h:%d", resized_w, resized_h); evas_object_size_hint_min_set(ug_data->webview, resized_w, resized_h); @@ -2393,7 +2388,7 @@ static void _destroy_down_progress_ex(void *data, Evas_Object *obj, void *event_ /* Cancel the download in email-service */ if (index >= 0) { debug_log("index[%d] download_all_cnt[%d] email_handle[%d]", index, priv->download_all_cnt, priv->download_all_email_handle[index]); - if (priv->download_all_email_handle[index] > 0) { + if (priv->download_all_email_handle[index] != 0) { email_engine_stop_working(ug_data->account_id, priv->download_all_email_handle[index]); priv->download_all_email_handle[index] = 0; } @@ -2407,7 +2402,7 @@ static void _destroy_down_progress_ex(void *data, Evas_Object *obj, void *event_ EmailAttachmentType *info = (EmailAttachmentType *)LIST_ITER_GET_DATA(i, attachment_list); if (info && !info->inline_content) { debug_log("index[%d] download_all_cnt[%d] email_handle[%d]", i, priv->download_all_cnt, priv->download_all_email_handle[i]); - if (priv->download_all_email_handle[i] > 0) { + if (priv->download_all_email_handle[i] != 0) { email_engine_stop_working(ug_data->account_id, priv->download_all_email_handle[i]); } } @@ -2511,6 +2506,7 @@ static void _create_more_ctxpopup(EmailViewerUGD *ug_data) 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)); elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_ADD_TO_CALENDAR"), NULL, _add_to_calendar_cb, ug_data); 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); @@ -2523,6 +2519,7 @@ static void _create_more_ctxpopup(EmailViewerUGD *ug_data) 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, dgettext("sys_string", "IDS_COM_OPT_ADD_TO_CONTACTS"), NULL, _ctxpopup_select_contact_mode_email_cb, prop->sender); elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_ADD_TO_CALENDAR"), NULL, _add_to_calendar_cb, ug_data); 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); @@ -2676,9 +2673,9 @@ static void _delete_evas_objects(EmailViewerUGD *ug_data) ug_data->partial_dn_btn_bx = NULL; } - if (ug_data->cutlink_timer) { - ecore_timer_del(ug_data->cutlink_timer); - ug_data->cutlink_timer = NULL; + if (ug_data->waiting_timer) { + ecore_timer_del(ug_data->waiting_timer); + ug_data->waiting_timer = NULL; } if (ug_data->timer) { @@ -3050,7 +3047,6 @@ static void _move_cb(void *data, Evas_Object *obj, void *event_info) ug_data->con_popup = NULL; } - Elm_Object_Item *git = NULL; Evas_Object *gl = elm_genlist_add(ug_data->navi_bar); evas_object_show(gl); @@ -3060,18 +3056,6 @@ static void _move_cb(void *data, Evas_Object *obj, void *event_info) ug_data->itc1.func.state_get = _gl_state_get; ug_data->itc1.func.del = _gl_del; - ug_data->itc2.item_style = "1text.1icon.2"; - ug_data->itc2.func.text_get = _gl_sub_upper_text_get; - ug_data->itc2.func.content_get = _gl_sub_upper_icon_get; - ug_data->itc2.func.state_get = _gl_state_get; - ug_data->itc2.func.del = NULL; - - ug_data->itc3.item_style = "grouptitle.dialogue.seperator"; - ug_data->itc3.func.text_get = NULL; - ug_data->itc3.func.content_get = NULL; - ug_data->itc3.func.state_get = _gl_state_get; - ug_data->itc3.func.del = NULL; - 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); ug_data->navi_move_it1 = navi_it; @@ -3087,9 +3071,6 @@ static void _move_cb(void *data, Evas_Object *obj, void *event_info) ug_data->move_mailbox_list = mailbox_list; ug_data->move_mailbox_count = mailbox_count; - git = elm_genlist_item_append(gl, &(ug_data->itc3), NULL, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL); - elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - for (i = 0; i < mailbox_count; i++) { if (g_strcmp0(ug_data->mailbox_name, mailbox_list[i].mailbox_name) != 0) { if (mailbox_list[i].mailbox_type != EMAIL_MAILBOX_TYPE_OUTBOX && @@ -3099,7 +3080,7 @@ static void _move_cb(void *data, Evas_Object *obj, void *event_info) mailbox_list[i].mailbox_type != EMAIL_MAILBOX_TYPE_ALL_EMAILS && mailbox_list[i].mailbox_type != EMAIL_MAILBOX_TYPE_SEARCH_RESULT) if (g_strcmp0(mailbox_list[i].alias, "[Gmail]")) { - elm_genlist_item_append(gl, &ug_data->itc1, (void *)&(mailbox_list[i]), git, ELM_GENLIST_ITEM_NONE, _gl_sel, (void *)&(mailbox_list[i])); + elm_genlist_item_append(gl, &ug_data->itc1, (void *)&(mailbox_list[i]), NULL, ELM_GENLIST_ITEM_NONE, _move_here_cb, (void *)&(mailbox_list[i])); } } } @@ -3158,7 +3139,7 @@ static void _body_down_cb(void *data, Evas_Object *obj, void *event_info) return; } - unsigned int handle; + int handle; gboolean ret = 0; EmailViewerUGD *ug_data = (EmailViewerUGD *)data; EmailViewerPrivate *priv = ug_data->email_data; @@ -3355,9 +3336,9 @@ static void _subject_detail_clicked_cb(void *data, Evas_Object *obj, const char edje_object_signal_emit(_EDJ(item), "elm,state,expanded", "elm"); (ug_data->subject_onoff_flag)++; - _create_to_addrs(_g_ug_data); - _create_cc_addrs(_g_ug_data); - _create_bcc_addrs(_g_ug_data); + _create_to_addrs(ug_data); + _create_cc_addrs(ug_data); + _create_bcc_addrs(ug_data); } else { edje_object_signal_emit(_EDJ(item), "elm,state,contracted", "elm"); (ug_data->subject_onoff_flag)--; @@ -3641,6 +3622,133 @@ static void _mark_as_read_cb(void *data, Evas_Object *obj, void *event_info) } } +static void _create_waiting_popup(EmailViewerUGD *ug_data, const char *title_text, const char *style) +{ + debug_enter(); + Evas_Object *popup; + Evas_Object *progress; + + if (title_text == NULL) { + debug_log("popup text is null"); + return; + } + + popup = elm_popup_add(ug_data->win_main); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_part_text_set(popup, "title,text", title_text); + + progress = elm_progressbar_add(popup); + elm_object_style_set(progress, style); + elm_progressbar_pulse_set(progress, EINA_TRUE); + elm_progressbar_pulse(progress, EINA_TRUE); + evas_object_show(progress); + + elm_object_content_set(popup, progress); + + ug_data->timeout_popup = popup; + + evas_object_show(popup); +} + +static void _save_email_cb(void *data, Evas_Object *obj, void *event_info) +{ + debug_log(""); + if (!data) { + 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; + } + + _create_waiting_popup(ug_data, dgettext("sys_string", "IDS_COM_POP_SAVING_ING"), "pending_list"); //"list_process" + + if (ug_data->waiting_timer) { + ecore_timer_del(ug_data->waiting_timer); + ug_data->waiting_timer = NULL; + } + ug_data->waiting_timer = ecore_timer_add(0.2, _save_email_prog_cb, ug_data); +} + +static Eina_Bool _save_email_prog_cb(void *data) +{ + debug_log(""); + + 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); + + email_mail_data_t *mail_t = NULL; + err = email_get_mail_data(ug_data->email_data->mail_id, &mail_t); + debug_log("email_get_mail_data - err (%d)", err); + + if (mail_t == NULL) { + debug_log("mail_t is NULL"); + return EINA_FALSE; + } + + email_attachment_data_t *attachment_t = NULL; + int attachment_count = 0; + 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/Others/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); + + 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; + } + + if (err != EMAIL_ERROR_NONE) { + _create_notify(ug_data, _("IDS_EMAIL_POP_ALERT"), + dgettext("sys_string", "IDS_COM_POP_UNABLE_TO_SAVE"), 0, + NULL, NULL, NULL, NULL, _popup_response_cb); + } else { +#ifdef _SMALL_NOTI + char str[128] = { 0, }; + snprintf(str, sizeof(str), "%s", N_("Saved in My files")); + int ret = status_message_post(str); + if (ret) + debug_log("status_message_post failed: %d", ret); +#else + _create_notify(ug_data, dgettext("sys_string", "IDS_COM_OPT_INFORMATION"), + N_("Saved in My files"), 0, + NULL, NULL, NULL, NULL, _popup_response_cb); +#endif + } + + if (ug_data->waiting_timer) { + ecore_timer_del(ug_data->waiting_timer); + ug_data->waiting_timer = NULL; + } + + return EINA_FALSE; +} + static void _ctxpopup_detail_contact_cb(void *data, Evas_Object *obj, void *event_info) { debug_log(""); @@ -4094,7 +4202,6 @@ static void _webview_multi_down_cb(void *data, Evas * evas, Evas_Object *obj, vo EmailViewerUGD *ug_data = (EmailViewerUGD *)data; ug_data->m_is_multi_touch = TRUE; - if (ug_data->scroller_locked == FALSE) { ug_data->scroller_locked = TRUE; debug_log("<>"); @@ -4111,9 +4218,15 @@ static void _webview_policy_navigation_decide_cb(void *data, Evas_Object *obj, v } EmailViewerUGD *ug_data = (EmailViewerUGD *)data; + Ewk_Policy_Decision *policy_decision = (Ewk_Policy_Decision *)event_info; + Ewk_Policy_Navigation_Type pd_type = ewk_policy_decision_navigation_type_get(policy_decision); + debug_log("Ewk_Policy_Navigation_Type:%d", pd_type); + + const char *uri = NULL; + uri = ewk_view_uri_get(ug_data->webview); + debug_log("ewk_view_uri_get(%s)", uri); if (ug_data->b_load_finished == EINA_TRUE) { - Ewk_Policy_Decision *policy_decision = (Ewk_Policy_Decision *)event_info; ewk_policy_decision_ignore(policy_decision); debug_log("url:%s", ewk_policy_decision_url_get(policy_decision)); @@ -4207,6 +4320,18 @@ static void _webview_policy_navigation_decide_cb(void *data, Evas_Object *obj, v ret = service_destroy(service); debug_log("service_destroy: %d", ret); } + } else { + if (ug_data->timeout_popup) { + evas_object_del(ug_data->timeout_popup); + ug_data->timeout_popup = NULL; + } + _create_waiting_popup(ug_data, _("IDS_EMAIL_POP_LOADING_CONTENTS_ING"), "list_process"); + + if (pd_type == EWK_POLICY_NAVIGATION_TYPE_LINK_CLICKED) { + debug_log("Link click is ignored."); + ewk_policy_decision_ignore(policy_decision); + return; + } } } @@ -4240,6 +4365,18 @@ static void _outter_scroller_scroll_cb(void *data, Evas_Object *obj, void *event ug_data->is_main_scroller_scrolling = EINA_TRUE; } +static void _mbe_focused_cb(void *data, Evas_Object *obj, void *event_info) +{ + debug_log(""); + Elm_Object_Item *item = elm_multibuttonentry_selected_item_get(obj); + elm_multibuttonentry_item_selected_set(item, EINA_FALSE); +} + +static void _mbe_unfocused_cb(void *data, Evas_Object *obj, void *event_info) +{ + debug_log(""); +} + static void _mbe_added_cb(void *data, Evas_Object *obj, void *event_info) { debug_log(""); @@ -4277,15 +4414,40 @@ static void _mbe_selected_cb(void *data, Evas_Object *obj, void *event_info) elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_VIEW_CONTACT"), NULL, _ctxpopup_detail_contact_cb, g_strdup(index)); elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_SEND_EMAIL"), NULL, _ctxpopup_send_email_cb, addrs_info->address); - elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_BLOCK"), NULL, _ctxpopup_add_block_rule_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); _delete_contacts_list(contact_list_item); } else { elm_ctxpopup_item_append(ug_data->con_popup, dgettext("sys_string", "IDS_COM_OPT_ADD_TO_CONTACTS"), NULL, _ctxpopup_select_contact_mode_email_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); - elm_ctxpopup_item_append(ug_data->con_popup, _("IDS_EMAIL_OPT_BLOCK"), NULL, _ctxpopup_add_block_rule_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); + } + + 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/*TYPE_BLOCK_ADDRESS*/) { + debug_log("block address %s", rule_list[i].value); + + if (g_strcmp0(rule_list[i].value, addrs_info->address) == 0) { + debug_log("[%s] already blocked", rule_list[i].value); + if (ug_data->ctx_block_item) + elm_object_item_disabled_set(ug_data->ctx_block_item, EINA_TRUE); + } + } + } + } + /* free email rule_list */ + email_free_rule(&rule_list, count); } evas_pointer_canvas_xy_get(ug_data->evas, &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); } @@ -4618,7 +4780,7 @@ static void _save_attachment(EmailViewerUGD *ug_data, int index) } if (!info->download_yn) { - unsigned handle = 0; + int handle = 0; gboolean res = FALSE; if (ug_data->progress_bar[index + 1] != NULL) { @@ -4660,7 +4822,6 @@ static void _save_attachment(EmailViewerUGD *ug_data, int index) 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); @@ -4685,7 +4846,7 @@ static void _show_attachment(EmailViewerUGD *ug_data, int index) info->attach_id, info->index, info->name, info->path, (gint) info->size, info->download_yn, info->drm, info->inline_content); if (!info->download_yn) { - unsigned handle = 0; + int handle = 0; gboolean res = FALSE; debug_log("Need attachment download"); @@ -4714,7 +4875,6 @@ static void _show_attachment(EmailViewerUGD *ug_data, int index) if (res == 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);*/ int ret = status_message_post(str); if (ret) debug_log("status_message_post failed: %d", ret); @@ -4795,7 +4955,7 @@ static void _save_attachment_all(EmailViewerUGD *ug_data) if (info && !info->inline_content) { if (!info->download_yn) { if (ug_data->progress_bar_ly[i + 1] == NULL) { - unsigned handle = 0; + int handle = 0; gboolean res = FALSE; debug_log("Need attachment [%d] download", i); @@ -5068,7 +5228,6 @@ static void _on_edbus_event_email_viewer_receive(void *data, DBusMessage *messag char str[128] = { 0, }; snprintf(str, sizeof(str), "%s", dgettext("sys_string", "IDS_COM_BODY_DOWNLOADED")); - /*_show_select_info(ug_data, str);*/ int ret = status_message_post(str); if (ret) debug_log("status_message_post failed: %d", ret); @@ -5382,12 +5541,12 @@ static void _set_value_down_progress_by_index(double val, int index) EmailViewerProp *prop = ug_data->property; if (val < 0.0) { - debug_log("val(%f) is MINUS"); + debug_log("val(%f) is MINUS", val); return; } if (index < 0 || index >= ATTACH_MAX) { - debug_log("index(%d) is overflowed"); + debug_log("index(%d) is overflowed", index); return; } @@ -5611,103 +5770,6 @@ static Evas_Object *_gl_content_get(void *data, Evas_Object *obj, const char *pa return NULL; } -static void _gl_sel(void *data, Evas_Object *obj, void *event_info) -{ - debug_log(""); - - EmailViewerUGD *ug_data = _g_ug_data; - email_mailbox_t *mailbox_list = NULL; - mailbox_list = (email_mailbox_t *) data; - Elm_Object_Item *item = (Elm_Object_Item *)event_info; - elm_genlist_item_selected_set(item, EINA_FALSE); - - Elm_Object_Item *git = NULL; - Evas_Object *gl = elm_genlist_add(ug_data->navi_bar); - evas_object_show(gl); - - git = elm_genlist_item_append(gl, &(ug_data->itc3), NULL, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL); - elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - elm_genlist_item_append(gl, &ug_data->itc2, NULL, git, ELM_GENLIST_ITEM_NONE, _gl_sub_upper_sel, NULL); - - Evas_Object *cbar = elm_toolbar_add(ug_data->navi_bar); - elm_toolbar_shrink_mode_set(cbar, ELM_TOOLBAR_SHRINK_EXPAND); - elm_object_style_set(cbar, "naviframe"); - evas_object_show(cbar); - - elm_toolbar_item_append(cbar, NULL, _("IDS_EMAIL_SK3_MOVE_HERE"), _move_here_cb, mailbox_list); - elm_object_item_disabled_set(elm_toolbar_item_append(cbar, NULL, "", NULL, NULL), EINA_TRUE); - - 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); - elm_object_item_part_content_set(navi_it, "controlbar", cbar); - ug_data->navi_move_it2 = navi_it; - - Evas_Object *move_back_btn = NULL; - if (ug_data->isRotate) { - elm_naviframe_item_title_visible_set(navi_it, EINA_FALSE); - 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_cb2, ug_data); - elm_object_item_part_content_set(navi_it, "prev_btn", move_back_btn); - } - } - return; -} - -static char *_gl_sub_upper_text_get(void *data, Evas_Object *obj, const char *part) -{ - debug_log(""); - email_mailbox_t *mailbox_list = NULL; - mailbox_list = (email_mailbox_t *) data; - - if (g_strcmp0(part, "elm.text") == 0) { - char buf[MAX_STR_LEN] = { 0, }; - snprintf(buf, sizeof(buf), "%s", _("IDS_EMAIL_MBODY_MAILBOX_LIST")); - return g_strdup(buf); - } - - return NULL; -} - -static Evas_Object *_gl_sub_upper_icon_get(void *data, Evas_Object *obj, const char *part) -{ - debug_log(""); - - if (g_strcmp0(part, "elm.icon") == 0) { - Evas_Object *icon = elm_icon_add(obj); - elm_icon_file_set(icon, IMGDIR "/U01_icon_upper_folder_focus.png", NULL); - evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); - - return icon; - } - - return NULL; -} - -static void _gl_sub_upper_sel(void *data, Evas_Object *obj, void *event_info) -{ - debug_log(""); - - EmailViewerUGD *ug_data = _g_ug_data; - - Elm_Object_Item *item = (Elm_Object_Item *)event_info; - elm_genlist_item_selected_set(item, EINA_FALSE); - - ug_data->navi_move_it2 = NULL; - elm_naviframe_item_pop(ug_data->navi_bar); - - return; -} - static void _move_here_cb(void *data, Evas_Object *obj, void *event_info) { debug_log(""); @@ -5726,7 +5788,6 @@ static void _move_here_cb(void *data, Evas_Object *obj, void *event_info) _move_email(ug_data, folder_id, FALSE); ug_data->navi_move_it1 = NULL; - ug_data->navi_move_it2 = NULL; elm_naviframe_item_pop_to(ug_data->navi_main_it); if (ug_data->isRotate == false && ug_data->b_internal) { @@ -5775,7 +5836,6 @@ static void _move_back_cb(void *data, Evas_Object *obj, void *event_info) elm_naviframe_item_pop(ug_data->navi_bar); ug_data->navi_move_it1 = NULL; - ug_data->navi_move_it2 = NULL; /*if (ug_data->b_internal) elm_layout_theme_set(ug_data->layout_main, "layout", "controlbar", "default"); @@ -5783,19 +5843,4 @@ static void _move_back_cb(void *data, Evas_Object *obj, void *event_info) elm_layout_theme_set(ug_data->layout_main, "layout", "application", "controlbar");*/ } -static void _move_back_cb2(void *data, Evas_Object *obj, void *event_info) -{ - debug_log(""); - - if (data == NULL || _g_ug_data == NULL) { - debug_log("data is NULL"); - return; - } - - EmailViewerUGD *ug_data = (EmailViewerUGD *)data; - - elm_naviframe_item_pop(ug_data->navi_bar); - ug_data->navi_move_it2 = NULL; -} - /* EOF */