#endif
/* Header Include */
-#include <contacts-ug.h>
-#include <calendar-svc-provider.h>
-#include <media-util-register.h>
#include <app_service.h>
#include <status.h>
+#include <calendar2.h>
+#include <media-util-register.h>
+#include <contacts-ug.h>
#include "email-viewer.h"
#include "email-viewer-webview.h"
static void _ctxpopup_cutlink_update_contact_cb(void *data, Evas_Object *obj, void *event_info);
static void _ctxpopup_select_contact_mode_email_cb(void *data, Evas_Object *obj, void *event_info);
static void _ctxpopup_add_block_rule_cb(void *data, Evas_Object *obj, void *event_info);
+static void _popup_waiting_response_cb(void *data, Evas_Object *obj, void *event_info);
static void _popup_response_cb(void *data, Evas_Object *obj, void *event_info);
static void _popup_response_delete_ok_cb(void *data, Evas_Object *obj, void *event_info);
static void _popup_response_to_destroy_cb(void *data, Evas_Object *obj, void *event_info);
debug_log("mail_data is NULL");
}
- ug_data->mailbox_name = g_strdup(mail_data->server_mailbox_name);
+ if (mail_data->server_mailbox_name)
+ ug_data->mailbox_name = g_strdup(mail_data->server_mailbox_name);
ug_data->mailbox_type = mail_data->mailbox_type;
debug_log("server_mailbox_name:%s", mail_data->server_mailbox_name);
debug_log("mailbox_name:%s", ug_data->mailbox_name);
ug_data->property = NULL;
}
- email_engine_finalize();
+ ug_data->base = NULL;
_dbus_receiver_remove(NULL);
-
int ret = e_dbus_shutdown();
debug_log("ret: %d", ret);
- debug_log("~");
- ug_data->base = NULL;
+ email_engine_finalize();
+
+
+ debug_log("~");
}
static void on_message(ui_gadget_h ug, service_h msg, service_h data, void *priv)
debug_log("mail_data is NULL");
}
- ug_data->mailbox_name = g_strdup(mail_data->server_mailbox_name);
+ if (mail_data->server_mailbox_name)
+ ug_data->mailbox_name = g_strdup(mail_data->server_mailbox_name);
ug_data->mailbox_type = mail_data->mailbox_type;
debug_log("server_mailbox_name:%s", mail_data->server_mailbox_name);
debug_log("mailbox_name:%s", ug_data->mailbox_name);
debug_log("service_get_extra_data: %d", ret);
debug_log("return of bundle_get_val for save all(%s)", cmd);
if (cmd) {
- debug_log("save all from composer(%s)", cmd);
+ debug_log("save all from composer(%s), real_att_len(%d), att_len(%d)", cmd, prop->real_att_len, prop->att_len);
if (prop->real_att_len == 1) {
private->b_all_att_save = TRUE;
elm_naviframe_item_title_visible_set(ug_data->navi_main_it, EINA_FALSE);
if (ug_data->b_btn) {
-
debug_log("hiding back button");
evas_object_smart_callback_del(ug_data->b_btn, "clicked", _back_cb);
elm_naviframe_item_title_visible_set(ug_data->navi_main_it, EINA_FALSE);
if (ug_data->b_btn) {
-
debug_log("hiding back button");
evas_object_smart_callback_del(ug_data->b_btn, "clicked", _back_cb);
if (!ug_data->to_list && !ug_data->cc_list && !ug_data->bcc_list) {
edje_object_signal_emit(edje, "elm,state,arrow_hidden", "elm");
+ } else {
+ edje_object_signal_callback_add(edje, "elm,action,expand,toggle", "elm", _subject_detail_clicked_cb, ug_data->ly_subject);
}
if (prop->has_attachment)
}
edje_object_signal_emit(_EDJ(ug_data->ly_subject), "elm,state,contracted", "elm");
+ edje_object_signal_callback_del(_EDJ(ug_data->ly_subject), "elm,action,expand,toggle", "elm", _subject_detail_clicked_cb);
evas_object_hide(ug_data->noc_bx);
evas_object_hide(ug_data->dn_btn);
email_free_rule(&rule_list, count);
}
- Evas_Coord x, y;
+ 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_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);
evas_object_show(ug_data->con_popup);
}
int body_download_status = ug_data->property->body_download;
if (body_download_status == 0) { //EMAIL_BODY_DOWNLOAD_STATUS_NONE
- debug_log("need body download");
+ debug_log("only header downloaded -> need body download");
} else if (body_download_status == 1) { //EMAIL_BODY_DOWNLOAD_STATUS_FULLY_DOWNLOADED
- debug_log("already downloaded, create body directly");
+ debug_log("already downloaded fully, create body directly");
/* set property */
if (viewer_get_internal_mail_info(ug_data->property, ug_data->email_data)) {
return;
} else if (body_download_status == 2) { //EMAILL_BODY_DOWNLOAD_STATUS_PARTIALLY_DOWNLOADED
- debug_log("need full body download");
+ debug_log("body downloaded partially -> need full body download");
}
ret = email_engine_body_download(priv->account_id, priv->mail_id, &handle);
elm_icon_resizable_set(favorite_icon, 1, 1);
elm_object_part_content_set(ug_data->ly_subject, "elm.icon.favorite", favorite_icon);
evas_object_show(favorite_icon);
-
- /* send unread 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_READ);
- 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);
}
static void _subject_detail_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
char str[128] = { 0, };
snprintf(str, sizeof(str), "%s", _("IDS_EMAIL_POP_MARKED_AS_UNREAD"));
_show_select_info(ug_data, str);
-
- /* send unread 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_UNREAD);
- 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);
}
}
char str[128] = { 0, };
snprintf(str, sizeof(str), "%s", _("IDS_EMAIL_POP_MARKED_AS_READ"));
_show_select_info(ug_data, str);
-
- /* send unread 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_READ);
- 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);
}
}
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 *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);
+ Evas_Object *progress = elm_progressbar_add(popup);
elm_object_style_set(progress, style);
elm_progressbar_pulse_set(progress, EINA_TRUE);
elm_progressbar_pulse(progress, EINA_TRUE);
elm_object_content_set(popup, progress);
+ Evas_Object *btn1 = elm_button_add(popup);
+ elm_object_style_set(btn1, "popup_button/default");
+ elm_object_text_set(btn1, dgettext("sys_string", "IDS_COM_SK_CANCEL"));
+ elm_object_part_content_set(popup, "button1", btn1);
+ evas_object_smart_callback_add(btn1, "clicked", _popup_waiting_response_cb, ug_data);
+
ug_data->timeout_popup = popup;
evas_object_show(popup);
ug_data->con_popup = NULL;
}
+ if (ug_data->timeout_popup) {
+ evas_object_del(ug_data->timeout_popup);
+ ug_data->timeout_popup = NULL;
+ }
_create_waiting_popup(ug_data, dgettext("sys_string", "IDS_COM_POP_SAVING_ING"), "pending_list"); //"list_process"
if (ug_data->waiting_timer) {
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");
+ 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);
email_free_rule(&rule, 1);
}
+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;
+ }
+
+ EmailViewerUGD *ug_data = (EmailViewerUGD *)data;
+
+ if (ug_data->timeout_popup) {
+ evas_object_del(ug_data->timeout_popup);
+ ug_data->timeout_popup = NULL;
+ }
+}
+
static void _popup_response_cb(void *data, Evas_Object *obj, void *event_info)
{
debug_log("");
debug_log("");
EmailViewerPrivate *priv = ug_data->email_data;
EmailViewerProp *prop = ug_data->property;
- char newpath[MAX_STR_LEN] = { 0, };
+ char newpath[MAX_PATH_LEN] = { 0, };
RETURN_IF_FAIL(prop->attachments != NULL);
EmailAttachmentType *info = g_list_nth_data(prop->attachments, index);
EmailViewerPrivate *priv = ug_data->email_data;
EmailViewerProp *prop = ug_data->property;
EmailAttachmentType *info = g_list_nth_data(prop->attachments, index);
- char newpath[MAX_STR_LEN] = { 0, };
+ char newpath[MAX_PATH_LEN] = { 0, };
if (info == NULL) {
debug_log("EmailAttachmentType *info is NULL");
debug_log("status_message_post failed: %d", ret);
if (g_str_has_suffix(info->path, ".vcs")) {
- int nResult = -1;
- int calendar_id = 1;
- calendar_svc_connect();
- nResult = calendar_svc_calendar_import(newpath, calendar_id);
-
- debug_log("check return value of calendar_svc_util_register_vcs_file for %s - %d", newpath, nResult);
- if (nResult != CAL_SUCCESS) {
- debug_log("Failed to import path(%s) to id(%d)", newpath, calendar_id);
+ calendar_connect();
+
+ FILE * fp = NULL;
+ fp = fopen(newpath, "r");
+ if (!fp) {
+ debug_error("fopen(%s) is failed.", newpath);
+ calendar_disconnect();
+ return;
+ }
+
+ struct stat st;
+ if (stat(newpath, &st) == -1) {
+ debug_error("file(%s), stat Error(%d): %s", newpath, errno, strerror(errno));
+ fclose(fp);
+ calendar_disconnect();
+ return;
+ }
+
+ int size = st.st_size;
+ char *raw_data = calloc(size + 1, sizeof(char));
+ if (!raw_data) {
+ debug_error("calloc is failed.");
+ fclose(fp);
+ calendar_disconnect();
+ return;
+ }
+
+ size_t n = 0;
+ if ((n = fread(raw_data, 1, size, fp)) != size) {
+ debug_error("error in fread");
+ g_free(raw_data);
+ fclose(fp);
+ calendar_disconnect();
return;
}
- calendar_svc_close();
+
+ fclose(fp);
+
+ calendar_list_h list = NULL;
+
+ ret = calendar_vcalendar_parse_to_calendar(raw_data, &list);
+
+ if( list && ret == CALENDAR_ERROR_NONE) {
+ calendar_db_insert_records(list, NULL, NULL);
+ debug_log("vcalendar is registered to calendar");
+ }
+
+ g_free(raw_data);
+ calendar_disconnect();
} else
media_file_register(newpath);
} else if (res == EMAIL_EXT_SAVE_ERR_ALREADY_EXIST && !ug_data->display_download_result) {
debug_log("");
if (contacts_list_item) {
-#ifndef _NEW_CT_SVC_API
- g_free(contacts_list_item->first_name);
- contacts_list_item->first_name = NULL;
- g_free(contacts_list_item->last_name);
- contacts_list_item->last_name = NULL;
-#else
g_free(contacts_list_item->display);
contacts_list_item->display = NULL;
-#endif
g_free(contacts_list_item->email_address);
contacts_list_item->email_address = NULL;
g_free(contacts_list_item);
int index = contacts_svc_value_get_int(row_info, CTS_LIST_EMAIL_CONTACT_ID_INT);
contacts_list_item->index = index;
-#ifndef _NEW_CT_SVC_API
- contacts_list_item->first_name = g_strdup(contacts_svc_value_get_str(row_info, CTS_LIST_EMAIL_CONTACT_FIRST_STR));
- contacts_list_item->last_name = g_strdup(contacts_svc_value_get_str(row_info, CTS_LIST_EMAIL_CONTACT_LAST_STR));
-#else
contacts_list_item->display = g_strdup(contacts_svc_value_get_str(row_info, CTS_LIST_EMAIL_CONTACT_DISPLAY_STR));
-#endif
contacts_list_item->email_address = g_strdup(contacts_svc_value_get_str(row_info, CTS_LIST_EMAIL_ADDR_STR));
-#ifndef _NEW_CT_SVC_API
- char *first = contacts_list_item->first_name;
- char *last = contacts_list_item->last_name;
- char *display = g_strdup(contacts_svc_value_get_str(row_info, CTS_LIST_EMAIL_CONTACT_DISPLAY_STR));
-
- if (!display) {
- if (first != NULL && last != NULL) {
- if (CTS_ORDER_NAME_FIRSTLAST == contacts_svc_get_order(CTS_ORDER_OF_DISPLAY)) {
- display = g_strconcat(first, " ", last, NULL);
- } else {
- display = g_strconcat(last, " ", first, NULL);
- }
- } else if (first != NULL || last != NULL) {
- display = (first != NULL) ? g_strdup(first) : g_strdup(last);
- } else {
- display = g_strdup(" ");
- }
- }
-
- snprintf(contacts_list_item->display_name, sizeof(contacts_list_item->display_name), "%s", display);
- g_free(display);
-#else
snprintf(contacts_list_item->display_name, sizeof(contacts_list_item->display_name), "%s", contacts_list_item->display);
-#endif
-
}
contacts_svc_value_free(row_info);