./src/email-view-sync-schedule.c
./src/email-view-sync-setup.c
./src/email-setting-utils.c
- ./src/email-view-priority-senders.c
- ./src/email-view-add-priority-sender.c
- ./src/email-view-notification-setting.c
)
SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.tizenopensource.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __EMAIL_VIEW_ADD_PRIORITY_SENDER_H__
-#define __EMAIL_VIEW_ADD_PRIORITY_SENDER_H__
-
-#include "email-setting-view.h"
-
-void setting_init_add_priority_sender_view(struct viewdata *vd);
-
-#endif /* __EMAIL_VIEW_ACCOUNT_EDIT_H__ */
-
-/* EOF */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.tizenopensource.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __EMAIL_VIEW_NOTIFICATION_SETTING_H__
-#define __EMAIL_VIEW_NOTIFICATION_SETTING_H__
-
-#include "email-setting-view.h"
-
-void setting_init_notification_setting_view(struct viewdata *vd);
-
-#endif /* __EMAIL_VIEW_NOTIFICATION_SETTING_H__ */
-
-/* EOF */
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.tizenopensource.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __EMAIL_VIEW_PRIORITY_SENDERS_H__
-#define __EMAIL_VIEW_PRIORITY_SENDERS_H__
-
-#include "email-setting-view.h"
-
-void setting_init_priority_senders_view(struct viewdata *vd);
-
-#endif /* __EMAIL_VIEW_SHOW_EMAIL_LIST_H__ */
-
-/* EOF */
#include "email-view-initial.h"
#include "email-view-sync-schedule.h"
#include "email-view-sync-setup.h"
-#include "email-view-priority-senders.h"
-#include "email-view-add-priority-sender.h"
-#include "email-view-notification-setting.h"
static void *on_create(ui_gadget_h ug, enum ug_mode mode, service_h service, void *priv);
static void on_event(ui_gadget_h ug, enum ug_event event, service_h service, void *priv);
struct viewdata *view_initial_access = (struct viewdata *)calloc(sizeof(struct viewdata), 1);
struct viewdata *view_sync_schedule = (struct viewdata *)calloc(sizeof(struct viewdata), 1);
struct viewdata *view_sync_setup = (struct viewdata *)calloc(sizeof(struct viewdata), 1);
- struct viewdata *view_priority_sender = (struct viewdata *)calloc(sizeof(struct viewdata), 1);
- struct viewdata *view_add_priority_sender = (struct viewdata *)calloc(sizeof(struct viewdata), 1);
- struct viewdata *view_notification = (struct viewdata *)calloc(sizeof(struct viewdata), 1);
setting_init_setting_view(view_setting);
setting_init_sp_select_view(view_sp_select);
setting_init_initial_access_view(view_initial_access);
setting_init_sync_schedule_view(view_sync_schedule);
setting_init_sync_setup_view(view_sync_setup);
- setting_init_priority_senders_view(view_priority_sender);
- setting_init_add_priority_sender_view(view_add_priority_sender);
- setting_init_notification_setting_view(view_notification);
ugd->view_top = -1;
_couple_data(ugd, VIEW_INITIAL_ACCESS, view_initial_access);
_couple_data(ugd, VIEW_SYNC_SCHEDULE, view_sync_schedule);
_couple_data(ugd, VIEW_SYNC_SETUP, view_sync_setup);
- _couple_data(ugd, VIEW_PRIORITY_SENDERS, view_priority_sender);
- _couple_data(ugd, VIEW_ADD_PRIORITY_SENDER, view_add_priority_sender);
- _couple_data(ugd, VIEW_NOTIFICATION_SETTING, view_notification);
/* add more views... */
}
static void _backup_input_cb(void *data, Evas_Object *obj, void *event_info);
static void _entry_focused_cb(void *data, Evas_Object *obj, void *event_info);
static void _entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info);
-static void _entry_theme_changed_cb(void *data, Evas_Object *obj, void *event_info);
static void _eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _input_panel_state_changed_cb(void *data, Ecore_IMF_Context *ctx, int value);
static void _gl_ef_sel_cb(void *data, Evas_Object *obj, void *event_info);
struct priv_data *p;
p = vd->priv;
- char *buf;
if (!p) {
debug_log("priv is NULL");
elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
}
-static void _entry_theme_changed_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
-
- if (!obj) {
- debug_log("obj is NULL");
- return;
- }
-
- struct viewdata *vd = (struct viewdata *)data;
-
- if (vd == NULL) {
- debug_log("vd is NULL");
- return;
- }
-
- struct priv_data *p = NULL;
- p = vd->priv;
-
- Ecore_IMF_Context *imf_context = NULL;
- imf_context = elm_entry_imf_context_get(p->entry_password);
- if (imf_context) {
- ecore_imf_context_input_panel_event_callback_del(imf_context,
- ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_state_changed_cb);
- ecore_imf_context_input_panel_event_callback_add(imf_context,
- ECORE_IMF_INPUT_PANEL_STATE_EVENT,
- _input_panel_state_changed_cb, (void *)vd);
- }
-}
-
static void _eraser_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
{
debug_log("");
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.tizenopensource.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "email-setting.h"
-#include "email-setting-utils.h"
-#include "email-view-add-priority-sender.h"
-
-#include <contacts-ug.h>
-
-static int _create(struct viewdata *vd);
-static int _update(struct viewdata *vd);
-static int _destroy(struct viewdata *vd);
-static int _show(struct viewdata *vd);
-static int _hide(struct viewdata *vd);
-
-static void _push_naviframe(struct viewdata *vd);
-static void _create_list(struct viewdata *vd);
-static Evas_Object *_gl_add_ef_icon_get(void *data, Evas_Object *obj, const char *part);
-
-static void _back_prev_view_cb(void *data, int refresh);
-static void _add_priority_sender_cancel_cb(void *data, Evas_Object *obj, void *event_info);
-static void _destroy_filter_add_view(void *data);
-static void _popup_block_clicked_cb(void *data, Evas_Object *obj, void *event_info);
-static void _rule_save_cb(void *data, Evas_Object *obj, void *event_info);
-static void _add_one_rule(struct viewdata *vd, char *buf);
-
-static void _cb_backup_input(void *data, Evas_Object *obj, void *event_info);
-static void _cb_entry_focused(void *data, Evas_Object *obj, void *event_info);
-static void _cb_entry_unfocused(void *data, Evas_Object *obj, void *event_info);
-static void _cb_eraser_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
-
-static ui_gadget_h create_ug(char *ug_name, service_h service, void *data);
-static void layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv);
-static void result_cb(ui_gadget_h ug, service_h service, void *priv);
-static void destroy_cb(ui_gadget_h ug, void *priv);
-static void _contact_button_cb(void *data, Evas_Object *obj, void *event_info);
-static void _get_contact_email_list(const char *val, char **result, struct viewdata *vd);
-
-static struct viewdata *g_vd = NULL;
-char *block_addr = NULL;
-
-#define MAX_RECIPIENT_ADDRESS_LEN 234
-#define MAX_RECIPIENT_COUNT 50
-
-typedef struct {
- gchar email_addr[MAX_RECIPIENT_ADDRESS_LEN];
-} EmailList;
-
-typedef struct {
- int selected_email_idx;
- int email_cnt;
- bool is_contact_info;
- gchar *display_name;
- EmailList email_list[MAX_RECIPIENT_COUNT];
-} EmailRecipientInfo;
-
-
-struct priv_data {
- struct viewdata *vd;
-
- Evas_Object *layout;
- Evas_Object *navi_bar;
- Evas_Object *l_button;
- Evas_Object *r_button;
- Evas_Object *back_btn_add;
-
- Evas_Object *gl_add_filter;
- Evas_Object *entry_filter_name;
- Evas_Object *ef_filter_name;
- Evas_Object *popup_empty;
- Evas_Object *timeout_popup;
-
- Elm_Object_Item *navi_it;
- char *str_filter_name;
- int edit_filter_id;
-
- Elm_Genlist_Item_Class itc1;
- Elm_Genlist_Item_Class itc2;
- Elm_Genlist_Item_Class itc3;
-
-};
-
-void setting_init_add_priority_sender_view(struct viewdata *vd)
-{
- debug_log("");
- vd->type = VIEW_ADD_PRIORITY_SENDER;
- vd->create = _create;
- vd->update = _update;
- vd->destroy = _destroy;
- vd->show = _show;
- vd->hide = _hide;
- vd->grp_nm = "setting_add_priority_sender";
-}
-
-static int _create(struct viewdata *vd)
-{
- debug_log("");
- struct priv_data *p;
- EmailSettingUGD *ugd;
-
- if (!vd) {
- debug_log("vd is NULL");
- return FALSE;
- }
-
- p = vd->priv;
- ugd = vd->ugd;
-
- if (p == NULL) {
- p = vd->priv = calloc(1, sizeof(struct priv_data));
- p->vd = vd;
- p->layout = setting_add_inner_layout(vd);
- _push_naviframe(vd);
- }
- g_vd = vd;
-
- _create_list(vd);
-
- return TRUE;
-}
-
-static int _update(struct viewdata *vd)
-{
- debug_log("");
-
- return TRUE;
-}
-
-static int _destroy(struct viewdata *vd)
-{
- debug_log("");
-
- if (!vd) {
- debug_log("vd is NULL");
- return FALSE;
- }
- struct priv_data *p = vd->priv;
-
- if (p->l_button) {
- evas_object_del(p->l_button);
- p->l_button = NULL;
- }
-
- if (p->r_button) {
- evas_object_del(p->r_button);
- p->r_button = NULL;
- }
-
- if (p->gl_add_filter) {
- evas_object_del(p->gl_add_filter);
- p->gl_add_filter = NULL;
- }
-
- if (p->r_button) {
- evas_object_del(p->r_button);
- p->r_button = NULL;
- }
-
- if (p->popup_empty) {
- evas_object_del(p->popup_empty);
- p->popup_empty = NULL;
- }
-
- if (p->timeout_popup) {
- evas_object_del(p->timeout_popup);
- p->timeout_popup = NULL;
- }
-
- return TRUE;
-}
-
-static int _show(struct viewdata *vd)
-{
- debug_log("");
-
- if (!vd) {
- debug_log("vd is NULL");
- return FALSE;
- }
-
- evas_object_show(vd->ly);
- /*elm_object_style_set(vd->ugd->bg, "email_default");*/
-
- return TRUE;
-}
-
-static int _hide(struct viewdata *vd)
-{
- debug_log("");
-
- if (!vd) {
- debug_log("vd is NULL");
- return FALSE;
- }
-
- evas_object_hide(vd->ly);
-
- return TRUE;
-}
-
-static void _push_naviframe(struct viewdata *vd)
-{
- debug_log("");
- struct priv_data *p = vd->priv;
- EmailSettingUGD *ugd = vd->ugd;
-
- p->l_button = elm_button_add(ugd->navi_bar);
- elm_object_text_set(p->l_button, dgettext("sys_string", "IDS_COM_SK_DONE"));
- evas_object_smart_callback_add(p->l_button, "clicked", _rule_save_cb, vd);
- evas_object_show(p->l_button);
-
- p->r_button = elm_button_add(ugd->navi_bar);
- elm_object_text_set(p->r_button, dgettext("sys_string", "IDS_COM_SK_CANCEL"));
- evas_object_smart_callback_add(p->r_button, "clicked", _add_priority_sender_cancel_cb, vd);
- evas_object_show(p->r_button);
-
- p->back_btn_add = elm_button_add(ugd->navi_bar);
- elm_object_style_set(p->back_btn_add, "naviframe/back_btn/default");
- evas_object_smart_callback_add(p->back_btn_add, "clicked", _add_priority_sender_cancel_cb, vd);
- evas_object_show(p->back_btn_add);
-
- if (ugd->rule) {
- p->navi_it = elm_naviframe_item_push(ugd->navi_bar, _("IDS_EMAIL_HEADER_EDIT_RULES"), p->back_btn_add, NULL, p->layout, NULL);
- } else {
- elm_object_disabled_set(p->l_button, EINA_TRUE);
- p->navi_it = elm_naviframe_item_push(ugd->navi_bar, _("IDS_EMAIL_BODY_ADD_ADDRESS"), p->back_btn_add, NULL, p->layout, NULL);
-
- }
-
- elm_object_item_part_content_set(p->navi_it, "title_right_btn", p->r_button);
- elm_object_item_part_content_set(p->navi_it, "title_left_btn", p->l_button);
-
-}
-
-static void _create_list(struct viewdata *vd)
-{
- debug_log("");
-
- struct priv_data *p;
- EmailSettingUGD *ugd;
-
- if (!vd) {
- debug_log("vd is null!");
- return;
- }
-
- ugd = vd->ugd;
- p = vd->priv;
-
- Elm_Object_Item *git = NULL;
-
- p->gl_add_filter = elm_genlist_add(ugd->navi_bar);
- elm_object_style_set(p->gl_add_filter, "dialogue");
- elm_scroller_bounce_set(p->gl_add_filter, EINA_FALSE, EINA_FALSE);
- elm_object_theme_set(p->gl_add_filter, ugd->theme);
-
- p->itc1.item_style = "dialogue/1icon";
- p->itc1.func.text_get = NULL;
- p->itc1.func.content_get = _gl_add_ef_icon_get;
- p->itc1.func.state_get = NULL;
- p->itc1.func.del = NULL;
-
- p->itc2.item_style = "dialogue/email.2icon";
- p->itc2.func.text_get = NULL;
- p->itc2.func.content_get = _gl_add_ef_icon_get;
- p->itc2.func.state_get = NULL;
- p->itc2.func.del = NULL;
-
- p->itc3.item_style = "dialogue/separator/21/with_line";
- p->itc3.func.text_get = NULL;
- p->itc3.func.content_get = NULL;
- p->itc3.func.state_get = NULL;
- p->itc3.func.del = NULL;
-
- git = elm_genlist_item_append(p->gl_add_filter, &p->itc3, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
- elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
-
- debug_log("ugd->mode : %d", ugd->mode);
- if (ugd->mode == PRIORITY_SENDER_MODE_ADD) {
- elm_genlist_item_append(p->gl_add_filter, &p->itc2, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
- } else {
- elm_genlist_item_append(p->gl_add_filter, &p->itc1, (void *)ugd->rule, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
- }
-
- elm_object_part_content_set(p->layout, "elm.swallow.content", p->gl_add_filter);
-
-}
-
-
-static void _rule_save_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
- EmailSettingUGD *ugd = vd->ugd;
- struct priv_data *p = vd->priv;
-
- if (block_addr) {
- g_free(block_addr);
- block_addr = NULL;
- }
-
- elm_object_disabled_set(p->r_button, EINA_TRUE);
- elm_object_disabled_set(p->l_button, EINA_TRUE);
- elm_object_disabled_set(p->back_btn_add, EINA_TRUE);
-
- char *buf_ = (char *)elm_entry_entry_get(p->entry_filter_name);
- char *buf = elm_entry_markup_to_utf8(buf_);
-
- if (!buf || !strlen(buf)) {
- p->popup_empty = elm_popup_add(ugd->layout_main);
- evas_object_size_hint_weight_set(p->popup_empty, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_popup_timeout_set(p->popup_empty, 2);
- elm_object_text_set(p->popup_empty, _("IDS_EMAIL_POP_PLEASE_FILL_ALL_THE_MANDATORY_FIELDS"));
- elm_object_part_text_set(p->popup_empty, "title,text", _("IDS_EMAIL_POP_ALERT"));
- evas_object_smart_callback_add(p->popup_empty, "block,clicked", _popup_block_clicked_cb, vd);
- evas_object_show(p->popup_empty);
-
- elm_object_disabled_set(p->r_button, EINA_FALSE);
- elm_object_disabled_set(p->l_button, EINA_FALSE);
- elm_object_disabled_set(p->back_btn_add, EINA_FALSE);
- return;
- }
-
- gchar **vector;
- char *item_str;
- int i = 0;
- int valid_vector_cnt = 0;
- vector = g_strsplit_set(buf, ";", -1);
- guint str_cnt = g_strv_length(vector);
- debug_log("addr_cnt: %d", str_cnt);
-
- for (i = 0; i < str_cnt; i++) {
- /* check if valid address */
- if (vector[i] != NULL && strlen(vector[i]) > 0) {
- if (email_get_address_validation(vector[i]) == FALSE) {
- valid_vector_cnt = 0;
- break;
- }
-
- valid_vector_cnt++;
- }
- }
-
- if (valid_vector_cnt == 0) {
- p->popup_empty = elm_popup_add(ugd->layout_main);
- evas_object_size_hint_weight_set(p->popup_empty, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_popup_timeout_set(p->popup_empty, 2);
- elm_object_text_set(p->popup_empty, _("IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"));
- elm_object_part_text_set(p->popup_empty, "title,text", _("IDS_EMAIL_POP_ALERT"));
- evas_object_smart_callback_add(p->popup_empty, "block,clicked", _popup_block_clicked_cb, vd);
- evas_object_show(p->popup_empty);
-
- g_strfreev(vector);
- elm_object_disabled_set(p->r_button, EINA_FALSE);
- elm_object_disabled_set(p->l_button, EINA_FALSE);
- elm_object_disabled_set(p->back_btn_add, EINA_FALSE);
- return;
- }
-
- for (i = 0; i < str_cnt; i++) {
- if (vector[i] != NULL && strlen(vector[i]) > 0) {
- item_str = g_strdup(vector[i]);
- _add_one_rule(vd, item_str);
- g_free(item_str);
- }
- }
-
- g_strfreev(vector);
- g_free(buf);
-
- _back_prev_view_cb(vd, 1);
-
-}
-static void _back_prev_view_cb(void *data, int refresh)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
- EmailSettingUGD *ugd = vd->ugd;
- struct viewdata *prev_vd = ugd->vd[VIEW_PRIORITY_SENDERS];
-
- if (block_addr) {
- g_free(block_addr);
- block_addr = NULL;
- }
-
- _destroy_filter_add_view(vd);
-
- if (prev_vd) {
- debug_log("prev_vd->refresh : %d", prev_vd->refresh);
- prev_vd->refresh = refresh;
- }
- setting_back_to_prev_view(vd);
-
-}
-static void _add_priority_sender_cancel_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
- EmailSettingUGD *ugd = vd->ugd;
- struct viewdata *prev_vd = ugd->vd[VIEW_PRIORITY_SENDERS];
-
- if (block_addr) {
- g_free(block_addr);
- block_addr = NULL;
- }
-
- _destroy_filter_add_view(vd);
-
- if (prev_vd) {
- debug_log("prev_vd->refresh : %d", prev_vd->refresh);
- prev_vd->refresh = 0;
- }
- setting_back_to_prev_view(vd);
-}
-
-static void _destroy_filter_add_view(void *data)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
- struct priv_data *p = vd->priv;
-
- if (p->str_filter_name) {
- g_free(p->str_filter_name);
- p->str_filter_name = NULL;
- }
-}
-static void _popup_block_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
- struct priv_data *p = vd->priv;
-
- if (p->popup_empty) {
- evas_object_del(p->popup_empty);
- p->popup_empty = NULL;
- }
-
- if (p->timeout_popup) {
- evas_object_del(p->timeout_popup);
- p->timeout_popup = NULL;
- }
-}
-
-static void _add_one_rule(struct viewdata *vd, char *buf)
-{
- debug_log("");
- struct priv_data *p = vd->priv;
- EmailSettingUGD *ugd = vd->ugd;
-
- int ret = EMAIL_ERROR_NONE;
- email_rule_t *rule = NULL;
-
- /* add filtering rule */
- rule = malloc(sizeof(email_rule_t));
- if (!rule)
- return;
- //todo
- rule->account_id = 0;
- rule->type = EMAIL_PRIORITY_SENDER;
- rule->value = g_strdup(buf);
- rule->faction = 2; /* BLOCK */
- rule->target_mailbox_id = 0;
- rule->flag1 = 1; /* on */
- rule->flag2 = 1;
-
- if (ugd->mode == PRIORITY_SENDER_MODE_ADD) {
- ret = email_add_rule(rule);
- if (ret < 0)
- debug_log("email_add_rule failed %d", ret);
- }
-
- else if (ugd->mode == PRIORITY_SENDER_MODE_EDIT) {
- ret = email_update_rule(p->edit_filter_id, rule);
- if (ret < 0)
- debug_log("email_update_rule failed");
- }
-
- if (ret == EMAIL_ERROR_ALREADY_EXISTS) {
- /* Should display error popup */
- p->timeout_popup = elm_popup_add(ugd->layout_main);
- evas_object_size_hint_weight_set(p->timeout_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_popup_timeout_set(p->timeout_popup, 2);
- //todo
- elm_object_text_set(p->timeout_popup, _("IDS_EMAIL_POP_ALREADY_BLOCKED"));
- elm_object_part_text_set(p->timeout_popup, "title,text", _("IDS_EMAIL_POP_ALERT"));
- evas_object_smart_callback_add(p->timeout_popup, "block,clicked", _popup_block_clicked_cb, vd);
- evas_object_show(p->timeout_popup);
- }
-
- email_free_rule(&rule, 1);
- g_free(rule);
-}
-
-static Evas_Object *_gl_add_ef_icon_get(void *data, Evas_Object *obj, const char *part)
-{
- debug_log("");
- struct viewdata *vd = g_vd;
- struct priv_data *p = vd->priv;
- email_rule_t *rule = (email_rule_t *) data;
-
- if (!strcmp(part, "elm.icon")) {
- p->ef_filter_name = elm_layout_add(obj);
- elm_layout_theme_set(p->ef_filter_name, "layout", "editfield", "title");
- p->entry_filter_name = elm_entry_add(obj);
- elm_entry_scrollable_set(p->entry_filter_name, EINA_TRUE);
- elm_entry_single_line_set(p->entry_filter_name, TRUE);
- elm_entry_cnp_mode_set(p->entry_filter_name, ELM_CNP_MODE_PLAINTEXT);
- elm_entry_input_panel_layout_set(p->entry_filter_name, ELM_INPUT_PANEL_LAYOUT_EMAIL);
-
- evas_object_smart_callback_add(p->entry_filter_name, "preedit,changed", _cb_backup_input, p->ef_filter_name);
- evas_object_smart_callback_add(p->entry_filter_name, "changed", _cb_backup_input, p->ef_filter_name);
- evas_object_smart_callback_add(p->entry_filter_name, "focused", _cb_entry_focused, p->ef_filter_name);
- evas_object_smart_callback_add(p->entry_filter_name, "unfocused", _cb_entry_unfocused, p->ef_filter_name);
- evas_object_show(p->entry_filter_name);
-
- elm_object_part_content_set(p->ef_filter_name, "elm.swallow.content", p->entry_filter_name);
- elm_object_part_text_set(p->ef_filter_name, "elm.text", _("IDS_EMAIL_BODY_ADDRESS"));
- elm_object_signal_callback_add(p->ef_filter_name, "elm,eraser,clicked", "elm", _cb_eraser_clicked, p->entry_filter_name);
-
- evas_object_size_hint_weight_set(p->ef_filter_name, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_show(p->ef_filter_name);
-
- if (p->str_filter_name)
- elm_entry_entry_set(p->entry_filter_name, p->str_filter_name);
-
- if (rule) { //edit case
- debug_log("edit case");
- elm_entry_entry_set(p->entry_filter_name, rule->value);
- elm_entry_cursor_end_set(p->entry_filter_name);
- block_addr = realloc(block_addr, strlen(rule->value) + 1);
- sprintf(block_addr, "%s", rule->value);
-
- p->edit_filter_id = rule->filter_id;
- }
- evas_object_show(p->entry_filter_name);
- elm_object_focus_set(p->entry_filter_name, EINA_TRUE);
-
- return p->ef_filter_name;
- } else if (!strcmp(part, "elm.icon2")) {
- char buf[MAX_STR_LEN] = { 0, };
- Evas_Object *btn = elm_button_add(obj);
- Evas_Object *ic = elm_icon_add(obj);
- snprintf(buf, sizeof(buf), "%s/M02_function_ccbcc.png", IMGDIR);
- elm_image_file_set(ic, buf, NULL);
- elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
- evas_object_show(ic);
- elm_object_style_set(btn, "circle/empty");
- evas_object_show(btn);
- elm_object_part_content_set(btn, "icon", ic);
- evas_object_smart_callback_add(btn, "clicked", _contact_button_cb, vd);
- return btn;
- }
-
- return NULL;
-}
-
-static void _cb_backup_input(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- struct viewdata *vd = g_vd;
- struct priv_data *p = vd->priv;
- Evas_Object *eo = (Evas_Object *)obj;
-
- if (elm_object_focus_get(data)) {
- if (elm_entry_is_empty(obj))
- elm_object_signal_emit(data, "elm,state,eraser,hide", "elm");
- else
- elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
- }
-
- if (eo == p->entry_filter_name) {
- if (p->str_filter_name) {
- g_free(p->str_filter_name);
- p->str_filter_name = NULL;
- }
-
- p->str_filter_name = g_strdup(elm_entry_entry_get(eo));
-
- if (!g_strcmp0(p->str_filter_name, "")) {
- elm_object_disabled_set(p->l_button, EINA_TRUE);
- } else {
- elm_object_disabled_set(p->l_button, EINA_FALSE);
- }
- }
-}
-
-static void _cb_entry_focused(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
-
- if (!data || !obj) {
- debug_log("data is NULL");
- return;
- }
-
- if (!elm_entry_is_empty(obj))
- elm_object_signal_emit(data, "elm,state,eraser,show", "elm");
- elm_object_signal_emit(data, "elm,state,guidetext,hide", "elm");
-}
-
-static void _cb_entry_unfocused(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
-
- if (!data || !obj) {
- debug_log("data is NULL");
- 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");
-}
-
-static void _cb_eraser_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
-{
- debug_log("");
-
- if (!data || !obj) {
- debug_log("data is NULL");
- return;
- }
-
- elm_entry_entry_set(data, "");
-}
-
-static void _contact_button_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
- struct priv_data *p = vd->priv;
-
- if (g_strcmp0("", p->str_filter_name) == 0) {
- g_free(block_addr);
- block_addr = NULL;
- } else if (g_strcmp0(block_addr, p->str_filter_name) != 0) {
- g_free(block_addr);
- block_addr = g_strdup(p->str_filter_name);
- }
-
- int ret;
- service_h service = NULL;
-
- ret = service_create(&service);
-
- if (service) {
- char contact_ug[255] = { 0, };
- snprintf(contact_ug, sizeof(contact_ug), "%d", CT_UG_REQUEST_CHECK_FOR_EMAIL);
-
- ret = service_add_extra_data(service, EMAIL_BUNDLE_KEY_CONTACT_TYPE, contact_ug);
- //ug_data->ug_contact = ug_create(ug_data->ug, UG_NAME_CONTACT, UG_MODE_FULLVIEW, service, &cbs);
- vd->ugd->ug_contact = create_ug(UG_NAME_CONTACT, service, data);
- ret = service_destroy(service);
- }
-}
-static ui_gadget_h create_ug(char *ug_name, service_h service, void *data)
-{
- debug_log("");
- ui_gadget_h ug;
- struct ug_cbs cbs = { 0, };
-
- struct viewdata *vd = (struct viewdata *)data;
-
- cbs.layout_cb = layout_cb;
- cbs.result_cb = result_cb;
- cbs.destroy_cb = destroy_cb;
- cbs.priv = data;
-
- ug = ug_create(vd->ugd->ug, ug_name, UG_MODE_FULLVIEW, service, &cbs);
-
- return ug;
-}
-static void layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
-{
- debug_log("");
- Evas_Object *base, *win;
-
- if (!ug || !priv)
- return;
-
- base = ug_get_layout(ug);
- if (!base)
- return;
-
- win = ug_get_window();
-
- switch (mode) {
- case UG_MODE_FULLVIEW:
- evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_show(base);
- break;
-
- default:
- break;
- }
-}
-
-static void result_cb(ui_gadget_h ug, service_h service, void *priv)
-{
- debug_log("");
-
- if (!ug || !priv)
- return;
- struct viewdata *vd = (struct viewdata *)priv;
- EmailSettingUGD *ugd = vd->ugd;
- struct priv_data *p = vd->priv;
-
- if (ug != ugd->ug_contact) {
- goto FINISH;
- }
-
- char *val = NULL;
- service_get_extra_data(service, CT_UG_BUNDLE_RESULT_EMAIL_ID_LIST, &val);
-
- if (!val) {
- debug_log("service_get_extra_data return NULL");
- goto FINISH;
- }
-
- char *result_address = NULL;
- _get_contact_email_list(val, &result_address, vd);
- g_free(val);
-
- if (!result_address) {
- p->popup_empty = elm_popup_add(ugd->layout_main);
- evas_object_size_hint_weight_set(p->popup_empty, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_popup_timeout_set(p->popup_empty, 1);
- elm_object_text_set(p->popup_empty, _("IDS_EMAIL_POP_NO_EMAIL_ADDRESS"));
- elm_object_part_text_set(p->popup_empty, "title,text", _("IDS_EMAIL_POP_ALERT"));
- evas_object_smart_callback_add(p->popup_empty, "block,clicked", _popup_block_clicked_cb, vd);
- evas_object_show(p->popup_empty);
- goto FINISH;
- }
-
- if (!block_addr) {
- block_addr = g_strdup(result_address);
- debug_log("Null block_addr = %s", block_addr);
- elm_entry_entry_set(p->entry_filter_name, block_addr);
- debug_log("entry set");
- } else {
- char *addr_tmp = block_addr;
- block_addr = g_strconcat(block_addr, ";", result_address, NULL);
- debug_log("Not Null block_addr = %s", block_addr);
- elm_entry_entry_set(p->entry_filter_name, block_addr);
- g_free(addr_tmp);
- }
-
- g_free(result_address);
-
-FINISH:
- evas_object_show(p->entry_filter_name);
- elm_object_focus_set(p->entry_filter_name, EINA_TRUE);
- debug_log("entry show");
- ug_destroy(ug);
-}
-
-static void destroy_cb(ui_gadget_h ug, void *priv)
-{
- debug_log("");
-
- if (!ug || !priv)
- return;
- struct viewdata *vd = (struct viewdata *)priv;
- EmailSettingUGD *ugd = vd->ugd;
- struct priv_data *p = vd->priv;
-
- if (ug == ugd->ug_contact) {
- evas_object_show(p->entry_filter_name);
- elm_object_focus_set(p->entry_filter_name, EINA_TRUE);
- }
-
- ug_destroy(ug);
-}
-static void _get_contact_email_list(const char *val, char **result, struct viewdata *vd)
-{
- debug_log("");
-
- if (contacts_connect2() != CONTACTS_ERROR_NONE) {
- debug_log("Fail of contacts_connect2 !!!");
- return;
- }
-
- int i = 0, j = 0;
- int *c_id_list = NULL;
- int ct_ret = CONTACTS_ERROR_NONE;
- gsize c_id_list_len = 0;
-
- char *result_address = NULL;
- char *result_address_ = NULL;
- char *email_addr = NULL;
- char *tmp_addr = NULL;
-
- c_id_list = (int *)g_base64_decode(val, &c_id_list_len);
-
- debug_log("c_id_list_len:%d", c_id_list_len);
-
- for (j = 0; j < c_id_list_len / sizeof(int); j++) {
- debug_log("selected contact id: %d", c_id_list[j]);
-
- if (c_id_list[j] > 0) {
- int index = 0;
- contacts_record_h ct_value = NULL;
-
- ct_ret = contacts_db_get_record(_contacts_email._uri, c_id_list[j], &ct_value);
- if ((ct_ret = contacts_record_get_str_p(ct_value, _contacts_email.email, &tmp_addr)) != CONTACTS_ERROR_NONE) {
- debug_log("email_get_contacts_email_address is failed error_code = %d", ct_ret);
- continue;
- }
- debug_log("addr = %s", tmp_addr);
-
- ct_ret = contacts_record_get_int(ct_value, _contacts_email.contact_id, &index);
- debug_log("index = %d", index);
-
- if (index < 0) {
- debug_log("CT ID is not valid");
- continue;
- }
-
- int cnt = 0;
- EmailRecipientInfo *ri = (EmailRecipientInfo *) calloc(1, sizeof(EmailRecipientInfo));
-
- if (ri != NULL) {
- contacts_list_h list = NULL;
- ct_ret = email_get_contacts_list(CONTACTS_MATCH_EXACTLY, &list, tmp_addr);
-
- while (CONTACTS_ERROR_NONE == ct_ret) {
- contacts_record_h record = NULL;
- ct_ret = contacts_list_get_current_record_p(list, &record);
- if (record) {
- ct_ret = contacts_record_get_str_p(record, _contacts_contact_email.email, &email_addr);
-
- debug_log("email_addr : %s", email_addr);
- debug_log("dest buf size (%d)", sizeof(ri->email_list[cnt].email_addr));
-
- snprintf(ri->email_list[cnt].email_addr, sizeof(ri->email_list[cnt].email_addr)/*MAX_RECIPIENT_ADDRESS_LEN*/, "%s", email_addr);
-
- cnt++;
- }
- ct_ret = contacts_list_next(list);
- }
-
- for (i = 0; i < cnt; i++) {
- debug_log("ri->email_list[i].email_addr : [%s]", ri->email_list[i].email_addr);
- if (result_address)
- result_address_ = g_strconcat(result_address, ";", ri->email_list[i].email_addr, NULL);
- else
- result_address_ = g_strdup(ri->email_list[i].email_addr);
-
- if (result_address)
- g_free(result_address);
- result_address = result_address_;
- }
-
- debug_log("result address : [%s]", result_address);
- free(ri);
- }
- }
- }
-
- contacts_disconnect2();
-
- g_free(c_id_list);
- *result = result_address;
-}
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.tizenopensource.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "email-setting.h"
-#include "email-setting-utils.h"
-#include "email-view-notification-setting.h"
-
-static struct viewdata *g_vd = NULL;
-
-static int _create(struct viewdata *vd);
-static int _update(struct viewdata *vd);
-static int _destroy(struct viewdata *vd);
-static int _show(struct viewdata *vd);
-static int _hide(struct viewdata *vd);
-
-static void _push_naviframe(struct viewdata *vd);
-static void _create_list(struct viewdata *vd);
-
-static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info);
-static void _gl_ex_sel_cb(void *data, Evas_Object *obj, void *event_info);
-static void _gl_ex_rep_sel_cb(void *data, Evas_Object *obj, void *event_info);
-
-static char *_gl_onoff_text_get_cb(void *data, Evas_Object *obj, const char *part);
-static char *_gl_ringtone_text_get_cb(void *data, Evas_Object *obj, const char *part);
-static char *_gl_rep_text_get_cb(void *data, Evas_Object *obj, const char *part);
-static char *_gl_ex_rep_text_get_cb(void *data, Evas_Object *obj, const char *part);
-
-static Evas_Object *_gl_onoff_content_get_cb(void *data, Evas_Object *obj, const char *part);
-static Evas_Object *_gl_ex_rep_content_get_cb(void *data, Evas_Object *obj, const char *part);
-
-static void _gl_exp_cb(void *data, Evas_Object *obj, void *event_info);
-static void _gl_con_cb(void *data, Evas_Object *obj, void *event_info);
-
-static void _alert_ringtone_setup_cb(void *data, Evas_Object *obj, void *event_info);
-static void destroy_cb(ui_gadget_h ug, void *priv);
-static void result_cb(ui_gadget_h ug, service_h service, void *priv);
-static void layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv);
-static ui_gadget_h create_ug(char *ug_name, service_h service, void *data);
-
-static void _onoff_cb(void *data, Evas_Object *obj, void *event_info);
-static void _back_cb(void *data, Evas_Object *obj, void *event_info);
-
-char *_file_basename(char *path);
-
-#define SETTING_DEFAULT_ALERT_PATH "/opt/share/settings/Alerts"
-#define DELIM "/"
-#define SETTING_DEFAULT_EMAIL_TONE SETTING_DEFAULT_ALERT_PATH""DELIM"Whistle.mp3"
-
-struct priv_data {
- struct viewdata *vd;
-
- Evas_Object *l_button;
- Evas_Object *layout;
- Evas_Object *onoff[3];
- Evas_Object *rep_radio_grp;
-
- Evas_Object *genlist;
- Elm_Genlist_Item_Class itc_onoff;
- Elm_Genlist_Item_Class itc_rep;
- Elm_Genlist_Item_Class itc_sound;
- Elm_Genlist_Item_Class itc_ex_rep;
- Elm_Genlist_Item_Class itc_sep;
- Elm_Genlist_Item_Class itc_sep2;
-
- Elm_Object_Item *gl_rep_item;
- Elm_Object_Item *gl_ringtone_item;
-
-};
-
-void setting_init_notification_setting_view(struct viewdata *vd)
-{
- debug_log("");
- vd->type = VIEW_NOTIFICATION_SETTING;
- vd->create = _create;
- vd->update = _update;
- vd->destroy = _destroy;
- vd->show = _show;
- vd->hide = _hide;
- vd->grp_nm = "setting_notification_options";
-}
-
-static int _create(struct viewdata *vd)
-{
- debug_log("");
-
- if (!vd) {
- debug_log("vd is NULL");
- return FALSE;
- }
-
- struct priv_data *p = vd->priv;
-
- if (p == NULL) {
- p = vd->priv = calloc(1, sizeof(struct priv_data));
- p->vd = vd;
- }
-
- p->layout = setting_add_inner_layout(vd);
- _push_naviframe(vd);
- g_vd = vd;
-
- _create_list(vd);
-
- return TRUE;
-}
-
-static int _update(struct viewdata *vd)
-{
- debug_log("");
-
- return TRUE;
-}
-
-static int _destroy(struct viewdata *vd)
-{
- debug_log("");
-
- if (!vd) {
- debug_log("vd is NULL");
- return FALSE;
- }
-
- struct priv_data *p = vd->priv;
- int i = 0;
-
- if (p == NULL) {
- debug_log("priv is NULL");
- return FALSE;
- }
- if(p->l_button) {
- evas_object_del(p->l_button);
- p->l_button = NULL;
- }
-
- for (i = 0; i < 3; i++)
- evas_object_del(p->onoff[i]);
-
- if(p->genlist) {
- evas_object_del(p->genlist);
- p->genlist = NULL;
- }
-
- if(p->rep_radio_grp) {
- evas_object_del(p->rep_radio_grp);
- p->rep_radio_grp = NULL;
- }
-
- return TRUE;
-}
-
-static int _show(struct viewdata *vd)
-{
- debug_log("");
-
- if (!vd) {
- debug_log("vd is NULL");
- return FALSE;
- }
-
- evas_object_show(vd->ly);
- return TRUE;
-}
-
-static int _hide(struct viewdata *vd)
-{
- debug_log("");
-
- if (!vd) {
- debug_log("vd is NULL");
- return FALSE;
- }
-
- evas_object_hide(vd->ly);
-
- return TRUE;
-}
-
-static void _push_naviframe(struct viewdata *vd)
-{
- debug_log("");
- struct priv_data *p = vd->priv;
-
- p->l_button = elm_button_add(vd->ugd->navi_bar);
- elm_object_style_set(p->l_button, "naviframe/back_btn/default");
- evas_object_smart_callback_add(p->l_button, "clicked", _back_cb, vd);
-
- elm_naviframe_item_push(vd->ugd->navi_bar, _("IDS_EMAIL_HEADER_NOTIFICATION_SETTINGS"), p->l_button, NULL, p->layout, NULL);
- evas_object_show(vd->ugd->navi_bar);
-}
-
-static void _create_list(struct viewdata *vd)
-{
- debug_log("");
-
- if (!vd) {
- debug_log("vd is NULL");
- return;
- }
-
- struct priv_data *p = vd->priv;
- EmailSettingUGD *ugd = vd->ugd;
- Elm_Object_Item *item = NULL;
- Elm_Object_Item *git = NULL;
- int i = 0;
-
- p->rep_radio_grp = elm_radio_add(ugd->navi_bar);
- elm_radio_value_set(p->rep_radio_grp, 0);
- evas_object_hide(p->rep_radio_grp);
-
- p->genlist = elm_genlist_add(ugd->navi_bar);
- elm_object_style_set(p->genlist, "dialogue");
-
-
- p->itc_onoff.item_style = "dialogue/1text.1icon";
- p->itc_onoff.func.text_get = _gl_onoff_text_get_cb;
- p->itc_onoff.func.content_get = _gl_onoff_content_get_cb;
- p->itc_onoff.func.state_get = NULL;
- p->itc_onoff.func.del = NULL;
-
-
- p->itc_rep.item_style = "dialogue/2text.3/expandable";
- p->itc_rep.func.text_get = _gl_rep_text_get_cb;
- p->itc_rep.func.content_get = NULL;
- p->itc_rep.func.state_get = NULL;
- p->itc_rep.func.del = NULL;
-
- p->itc_sound.item_style = "dialogue/2text.3";
- p->itc_sound.func.text_get = _gl_ringtone_text_get_cb;
- p->itc_sound.func.content_get = NULL;
- p->itc_sound.func.state_get = NULL;
- p->itc_sound.func.del = NULL;
-
- p->itc_ex_rep.item_style = "dialogue/1text.1icon/expandable2";
- p->itc_ex_rep.func.text_get = _gl_ex_rep_text_get_cb;
- p->itc_ex_rep.func.content_get = _gl_ex_rep_content_get_cb;
- p->itc_ex_rep.func.state_get = NULL;
- p->itc_ex_rep.func.del = NULL;
-
- p->itc_sep.item_style = "dialogue/separator";
- p->itc_sep.func.text_get = NULL;
- p->itc_sep.func.content_get = NULL;
- p->itc_sep.func.state_get = NULL;
- p->itc_sep.func.del = NULL;
-
- p->itc_sep2.item_style = "dialogue/separator/end";
- p->itc_sep2.func.text_get = NULL;
- p->itc_sep2.func.content_get = NULL;
- p->itc_sep2.func.state_get = NULL;
- p->itc_sep2.func.del = NULL;
-
- /*seperator*/
- git = elm_genlist_item_append(p->genlist, &(p->itc_sep), NULL, NULL,
- ELM_GENLIST_ITEM_GROUP, NULL, NULL);
- elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
-
- /*--Notification--*/
- i = 0;
- item = elm_genlist_item_append(p->genlist, &(p->itc_onoff), (void *)i,
- git, ELM_GENLIST_ITEM_NONE, _gl_sel_cb, (void *)i);
-
- /*--Display contents--*/
- i = 1;
- item = elm_genlist_item_append(p->genlist, &(p->itc_onoff), (void *)i,
- git, ELM_GENLIST_ITEM_NONE, _gl_sel_cb, (void *)i);
-
- /*--Badge--*/
- i = 2;
- item = elm_genlist_item_append(p->genlist, &(p->itc_onoff), (void *)i,
- git, ELM_GENLIST_ITEM_NONE, _gl_sel_cb, (void *)i);
-
- /*--Alert ringtone--*/
- i = 3;
- item = elm_genlist_item_append(p->genlist, &(p->itc_sound), (void *)i,
- git, ELM_GENLIST_ITEM_NONE, _alert_ringtone_setup_cb, (void *)vd);
- p->gl_ringtone_item = item;
-
- /*--Alert repetition--*/
- i = 4;
- item = elm_genlist_item_append(p->genlist, &(p->itc_rep), NULL,
- git, ELM_GENLIST_ITEM_TREE, _gl_ex_sel_cb, (void *)vd);
- p->gl_rep_item = item;
-
- git = elm_genlist_item_append(p->genlist, &(p->itc_sep2), NULL, NULL,
- ELM_GENLIST_ITEM_GROUP, NULL, NULL);
- elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
-
- evas_object_smart_callback_add(p->genlist, "expanded", _gl_exp_cb, (void *)vd);
- evas_object_smart_callback_add(p->genlist, "contracted", _gl_con_cb, (void *)vd);
-
- elm_object_part_content_set(p->layout, "elm.swallow.content", p->genlist);
-}
-static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- int index = (int)data;
- struct viewdata *vd = g_vd;
- struct priv_data *p = vd->priv;
- int err = 0;
-
- Elm_Object_Item *item = (Elm_Object_Item *)event_info;
- elm_genlist_item_selected_set(item, EINA_FALSE);
-
- switch (index) {
- case 0:
- {
- int notification = 0;
- vconf_get_int(VCONF_VIP_NOTI_NOTIFICATION_TICKER, ¬ification);
- debug_log("notification : %d", notification);
- err = vconf_set_int(VCONF_VIP_NOTI_NOTIFICATION_TICKER, !notification);
- elm_check_state_set(p->onoff[0], !notification);
- debug_log("p->onoff[0] : %d", p->onoff[0]);
- break;
- }
- case 1:
- {
- int disp_contents = 0;
- vconf_get_int(VCONF_VIP_NOTI_DISPLAY_CONTENT_TICKER, &disp_contents);
- debug_log("disp_contents : %d", disp_contents);
- err = vconf_set_int(VCONF_VIP_NOTI_DISPLAY_CONTENT_TICKER, !disp_contents);
- elm_check_state_set(p->onoff[1], !disp_contents);
- debug_log("p->onoff[1] : %d", p->onoff[1]);
- break;
- }
- case 2:
- {
- int badge = 0;
- vconf_get_int(VCONF_VIP_NOTI_BADGE_TICKER, &badge);
- debug_log("badge : %d", badge);
- err = vconf_set_int(VCONF_VIP_NOTI_BADGE_TICKER, !badge);
- elm_check_state_set(p->onoff[2], !badge);
- debug_log("p->onoff[2] : %d", p->onoff[2]);
- break;
- }
- default:
- break;
- }
- if(err != 0) {
- debug_log("vconf change is failed: index : %d, err : %d", index, err);
- }
-}
-
-static void _gl_ex_sel_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
-
- Elm_Object_Item *item = (Elm_Object_Item *)event_info;
- elm_genlist_item_selected_set(item, EINA_FALSE);
-
- if (!elm_genlist_item_expanded_get(item)) {
- elm_genlist_item_expanded_set(item, 1);
- } else {
- elm_genlist_item_expanded_set(item, 0);
- }
-}
-
-static char *_gl_onoff_text_get_cb(void *data, Evas_Object *obj, const char *part)
-{
- debug_log("");
- int index = (int)data;
-
- if (!g_strcmp0(part, "elm.text")) {
- char buf[MAX_STR_LEN] = { 0, };
-
- if (index == 0) {
- snprintf(buf, sizeof(buf), "%s", _("IDS_EMAIL_BODY_NOTIFICATION"));
- }
-
- if (index == 1) {
- snprintf(buf, sizeof(buf), "%s", _("IDS_EMAIL_BODY_DISPLAY_CONTENTS"));
- }
-
- if (index == 2) {
- snprintf(buf, sizeof(buf), "%s", _("IDS_EMAIL_BODY_BADGE"));
- }
-
- return g_strdup(buf);
- }
-
- return NULL;
-}
-
-static Evas_Object *_gl_onoff_content_get_cb(void *data, Evas_Object *obj, const char *part)
-{
- debug_log("");
- int index = (int)data;
- struct viewdata *vd = g_vd;
- EmailSettingUGD *ugd = vd->ugd;
- struct priv_data *p = vd->priv;
-
- if (!g_strcmp0(part, "elm.icon")) {
- Evas_Object *check = elm_check_add(ugd->navi_bar);
- elm_object_style_set(check, "on&off");
- evas_object_smart_callback_add(check, "changed", _onoff_cb, vd);
- evas_object_propagate_events_set(check, EINA_FALSE);
-
- if (index == 0) {
- int notification = 0;
- vconf_get_int(VCONF_VIP_NOTI_NOTIFICATION_TICKER, ¬ification);
- elm_check_state_set(check, notification);
- p->onoff[index] = check;
- }
-
- if (index == 1) {
- int disp_contents = 0;
- vconf_get_int(VCONF_VIP_NOTI_DISPLAY_CONTENT_TICKER, &disp_contents);
- elm_check_state_set(check, disp_contents);
- p->onoff[index] = check;
- }
-
- if (index == 2) {
- int badge = 0;
- vconf_get_int(VCONF_VIP_NOTI_BADGE_TICKER, &badge);
- elm_check_state_set(check, badge);
- p->onoff[index] = check;
- }
-
- return check;
- }
-
- return NULL;
-}
-
-static char *_gl_ringtone_text_get_cb(void *data, Evas_Object *obj, const char *part)
-{
- debug_log("");
-
- if (!g_strcmp0(part, "elm.text.1")) {
- char buf[MAX_STR_LEN] = { 0, };
-
- snprintf(buf, sizeof(buf), "%s", N_("Alert ringtone"));
- return g_strdup(buf);
- }
-
- if (!g_strcmp0(part, "elm.text.2")) {
- char* ringtone = vconf_get_str(VCONF_VIP_NOTI_RINGTONE_PATH);
- debug_log("ringtone : %s", ringtone);
- char *ringtone_file = NULL;
- ringtone_file = _file_basename(ringtone);
- debug_log("ringtone_file:%s", ringtone_file);
- return ringtone_file;
- }
-
- return NULL;
-}
-
-static char *_gl_rep_text_get_cb(void *data, Evas_Object *obj, const char *part)
-{
- debug_log("");
-
- if (!g_strcmp0(part, "elm.text.1")) {
- char buf[MAX_STR_LEN] = { 0, };
- snprintf(buf, sizeof(buf), "%s", _("IDS_EMAIL_BODY_ALERT_REPETITION"));
- return g_strdup(buf);
- }
-
- if (!g_strcmp0(part, "elm.text.2")) {
- char buf[MAX_STR_LEN] = { 0, };
-
- int rep_type = 0;
- vconf_get_int(VCONF_VIP_NOTI_REP_TYPE, &rep_type);
-
- switch (rep_type) {
- case 0:
- snprintf(buf, sizeof(buf), "%s", _("IDS_EMAIL_BODY_ONCE"));
- break;
- case 1:
- snprintf(buf, sizeof(buf), "%s", N_("Every 2 minutes"));
- break;
- case 2:
- snprintf(buf, sizeof(buf), "%s", _("IDS_EMAIL_BODY_EVERY_5_MINUTES"));
- break;
- case 3:
- snprintf(buf, sizeof(buf), "%s", _("IDS_EMAIL_BODY_EVERY_10_MINUTES"));
- break;
- default:
- break;
- }
-
- return g_strdup(buf);
- }
-
- return NULL;
-}
-
-static char *_gl_ex_rep_text_get_cb(void *data, Evas_Object *obj, const char *part)
-{
- debug_log("");
- int index = (int)data;
-
- if (!g_strcmp0(part, "elm.text")) {
- char buf[MAX_STR_LEN] = { 0, };
-
- if (index == 0) {
- snprintf(buf, sizeof(buf), "%s", _("IDS_EMAIL_BODY_ONCE"));
- } else if (index == 1) {
- snprintf(buf, sizeof(buf), "%s", N_("Every 2 minutes"));
- } else if (index == 2) {
- snprintf(buf, sizeof(buf), "%s", _("IDS_EMAIL_BODY_EVERY_5_MINUTES"));
- } else if (index == 3) {
- snprintf(buf, sizeof(buf), "%s", _("IDS_EMAIL_BODY_EVERY_10_MINUTES"));
- }
-
- return g_strdup(buf);
- }
-
- return NULL;
-}
-
-static Evas_Object *_gl_ex_rep_content_get_cb(void *data, Evas_Object *obj, const char *part)
-{
- debug_log("");
- int index = (int)data;
- struct viewdata *vd = g_vd;
- EmailSettingUGD *ugd = vd->ugd;
- struct priv_data *p = vd->priv;
-
- if (!g_strcmp0(part, "elm.icon")) {
- Evas_Object *radio = elm_radio_add(ugd->navi_bar);
- int rep_type = 0;
- elm_radio_group_add(radio, p->rep_radio_grp);
- elm_radio_state_value_set(radio, index);
-
- vconf_get_int(VCONF_VIP_NOTI_REP_TYPE, &rep_type);
-
- if (index == rep_type) {
- elm_radio_value_set(p->rep_radio_grp, rep_type);
- }
-
- return radio;
- }
-
- return NULL;
-}
-
-static void _onoff_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
-
- struct viewdata *vd = (struct viewdata *)data;
- struct priv_data *p = vd->priv;
- int err = 0;
-
- Eina_Bool state = elm_check_state_get(obj);
-
- if (obj == p->onoff[0]) {
- err = vconf_set_int(VCONF_VIP_NOTI_NOTIFICATION_TICKER, state);
- debug_log("p->onoff[0] state %d, vconf err : %d", state, err);
- }
-
- if (obj == p->onoff[1]) {
- err = vconf_set_int(VCONF_VIP_NOTI_DISPLAY_CONTENT_TICKER, state);
- debug_log("p->onoff[1] state %d, vconf err : %d", state, err);
- }
-
- if (obj == p->onoff[2]) {
- err = vconf_set_int(VCONF_VIP_NOTI_BADGE_TICKER, state);
- debug_log("p->onoff[2] state %d, vconf err : %d", state, err);
- }
-
-}
-
-static void _gl_exp_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- Elm_Object_Item *it = event_info;
-
- struct viewdata *vd = (struct viewdata *)data;
- struct priv_data *p = vd->priv;
- int i = 0;
-
- if (it == p->gl_rep_item) {
- for (i = 0; i < 4; i++) {
- elm_genlist_item_append(p->genlist, &(p->itc_ex_rep), (void *)i,
- it, ELM_GENLIST_ITEM_NONE, _gl_ex_rep_sel_cb, (void *)i);
- }
- }
-}
-
-static void _gl_con_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- Elm_Object_Item *item = event_info;
- elm_genlist_item_subitems_clear(item);
-
-}
-
-static void _gl_ex_rep_sel_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- int index = (int)data;
- struct viewdata *vd = g_vd;
- struct priv_data *p = vd->priv;
- int sel_radio = 0;
- int err = 0;
-
- Elm_Object_Item *item = (Elm_Object_Item *)event_info;
- elm_genlist_item_selected_set(item, EINA_FALSE);
-
- sel_radio = elm_radio_value_get(p->rep_radio_grp);
-
- if (sel_radio == index)
- return;
-
- switch (index) {
- case 0:
- case 1:
- case 2:
- case 3:
- err = vconf_set_int(VCONF_VIP_NOTI_REP_TYPE, index);
- debug_log("index = %d, err : %d", index, err);
- break;
-
- default:
- {
- debug_log("Unknown value: %d", sel_radio);
- break;
- }
- }
-
- elm_radio_value_set(p->rep_radio_grp, index);
- elm_genlist_item_update(p->gl_rep_item);
-}
-
-static void _alert_ringtone_setup_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
- EmailSettingUGD *ugd = vd->ugd;
-
- Elm_Object_Item *it = (Elm_Object_Item *)event_info;
- elm_genlist_item_selected_set(it, EINA_FALSE);
-
- Viewtype top = ugd->view_st[ugd->view_top];
- if (top != VIEW_NOTIFICATION_SETTING) {
- debug_log("**double clicked**");
- return;
- }
-
- int ret;
- service_h service = NULL;
-
- ret = service_create(&service);
-
- if (service) {
- const char *pa_cur_ringtone = NULL;
- const char *dir_path = NULL;
- pa_cur_ringtone = vconf_get_str(VCONF_VIP_NOTI_RINGTONE_PATH);
- if (pa_cur_ringtone == NULL)
- pa_cur_ringtone = SETTING_DEFAULT_EMAIL_TONE;
-
- debug_log("pa_cur_ringtone : %s", pa_cur_ringtone);
- dir_path = SETTING_DEFAULT_ALERT_PATH;
- service_add_extra_data(service, "marked_mode", pa_cur_ringtone);
- service_add_extra_data(service, "path", dir_path);
- service_add_extra_data(service, "select_type", "SINGLE_FILE");
- service_add_extra_data(service, "file_type", "SOUND");
- service_add_extra_data(service, "drm_type", "DRM_ALL");
-
- ugd->ug_myfiles = create_ug(UG_NAME_MY_FILE, service, data);
- ret = service_destroy(service);
- }
-
- return;
-}
-
-static ui_gadget_h create_ug(char *ug_name, service_h service, void *data)
-{
- debug_log("");
- ui_gadget_h ug;
- struct ug_cbs cbs = { 0, };
-
- struct viewdata *vd = (struct viewdata *)data;
-
- cbs.layout_cb = layout_cb;
- cbs.result_cb = result_cb;
- cbs.destroy_cb = destroy_cb;
- cbs.priv = data;
- ug = ug_create(vd->ugd->ug, ug_name, UG_MODE_FULLVIEW, service, &cbs);
-
- return ug;
-}
-
-static void layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
-{
- debug_log("");
- Evas_Object *base, *win;
-
- if (!ug || !priv)
- return;
-
- base = ug_get_layout(ug);
- if (!base)
- return;
-
- win = ug_get_window();
-
- switch (mode) {
- case UG_MODE_FULLVIEW:
- evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_show(base);
- break;
-
- default:
- break;
- }
-}
-
-static void result_cb(ui_gadget_h ug, service_h service, void *priv)
-{
- debug_log("");
-
- if (!ug || !priv)
- return;
- struct viewdata *vd = (struct viewdata *)priv;
- EmailSettingUGD *ugd = vd->ugd;
- struct priv_data *p = vd->priv;
-
- if (ug != ugd->ug_myfiles) {
- return;
- }
-
- char *ringtone_file = NULL;
- char *ringtone_path = NULL;
-
- service_get_extra_data(service, "result", &ringtone_path);
- if(!ringtone_path)
- return;
-
- debug_log("ringtone_path:%s", ringtone_path);
-
- if (ringtone_path != NULL) {
- int err = 0;
- ringtone_file = _file_basename(ringtone_path);
- debug_log("ringtone_file:%s", ringtone_file);
-
- err = vconf_set_str(VCONF_VIP_NOTI_RINGTONE_PATH, ringtone_path);
- if(err == 0) {
- elm_genlist_item_update(p->gl_ringtone_item);
- } else {
- debug_log("failed to change vconf(VCONF_VIP_NOTI_RINGTONE_PATH) err:%d", err);
- }
- }
-
- FREE(ringtone_file);
-
- return;
-}
-static void destroy_cb(ui_gadget_h ug, void *priv)
-{
- debug_log("");
-
- if (!ug || !priv)
- return;
- struct viewdata *vd = (struct viewdata *)priv;
- EmailSettingUGD *ugd = vd->ugd;
-
- if (ug) {
- ug_destroy(ug);
- ugd->ug_myfiles = NULL;
- }
-}
-char *_file_basename(char *path)
-{
- if (NULL == path || '\0' == path[0]) {
- return NULL; /* invalid arguement */
- }
- char *p = strrchr(path, '/');
- if (!p) {
- return (char *)g_strdup(path); /* cannot find '/' */
- }
- if ('\0' == p[1]) {
- return NULL; /* end with '/' */
- }
- return (char *)g_strdup(p + 1);
-}
-static void _back_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
-
- struct viewdata *vd = data;
- struct priv_data *p = NULL;
- p = vd->priv;
-
- setting_back_to_prev_view(vd);
-}
+++ /dev/null
-/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.tizenopensource.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "email-setting.h"
-#include "email-setting-utils.h"
-#include "email-view-priority-senders.h"
-
-static int _create(struct viewdata *vd);
-static int _update(struct viewdata *vd);
-static int _destroy(struct viewdata *vd);
-static int _show(struct viewdata *vd);
-static int _hide(struct viewdata *vd);
-
-static void _create_list(struct viewdata *vd);
-static void _free_list(struct viewdata *vd);
-static void _create_noc(struct viewdata *vd);
-static void _free_noc(struct viewdata *vd);
-static void _push_naviframe(struct viewdata *vd);
-static void _edit_cb(void *data, Evas_Object *obj, void *event_info);
-static void _add_filter_clicked_cb(void *data, Evas_Object *obj, void *event_info);
-static void _back_cb(void *data, Evas_Object *obj, void *event_info);
-static void _more_toolbar_clicked_cb(void *data, Evas_Object *obj, void *event_info);
-static void _dismissed_cb(void *data, Evas_Object *obj, void *event_info);
-static void _refresh_priority_sender_view(struct viewdata *vd, Evas_Object *obj, void *event_info);
-
-static char *_gl_label_get(void *data, Evas_Object *obj, const char *part);
-static Evas_Object *_gl_icon_get(void *data, Evas_Object *obj, const char *part);
-static void _gl_del(void *data, Evas_Object *obj);
-static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info);
-
-static void _sweep_delete_clicked_cb(void *data, Evas_Object *obj, void *event_info);
-static void _sweep_edit_clicked_cb(void *data, Evas_Object *obj, void *event_info);
-static void _my_gl_mode_right(void *data, Evas_Object *obj, void *event_info);
-static void _my_gl_mode_left(void *data, Evas_Object *obj, void *event_info);
-static void _my_gl_mode_cancel(void *data, Evas_Object *obj, void *event_info);
-
-static void _edit_item_check_changed_cb(void *data, Evas_Object *obj, void *event_info);
-static void _check_select_all(void *data);
-static void _select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info);
-static void _select_all_layout_mouse_down_cb(void *data, Evas * evas, Evas_Object *obj, void *event_info);
-static void _delete_rule_cb(void *data, Evas_Object *obj, void *event_info);
-static void _del_button_state_set(struct viewdata *vd);
-static void _show_selection_info(struct viewdata *vd);
-
-static void _notification_setting_clicked_cb(void *data, Evas_Object *obj, void *event_info);
-static void *_get_contact_info_by_email_address(struct viewdata *vd, const char *search_word);
-static void _copy_rule_info(email_rule_t *rule, void *data);
-
-
-static struct viewdata *g_vd = NULL;
-
-typedef struct {
- email_rule_t *rule;
- Elm_Object_Item *it;
- Eina_Bool checked;
- Evas_Object *genlist;
- void *contact_item_info;
-} ListItemData;
-
-struct priv_data {
- struct viewdata *vd;
-
- Evas_Object *layout;
- Evas_Object *main_box;
- Evas_Object *l_button;
- Evas_Object *tool_btn1;
- Evas_Object *tool_btn2;
- Evas_Object *more_btn;
- Evas_Object *ctxpopup;
- Evas_Object *gl_priority;
-
- Evas_Object *noc;
- Evas_Object *noc_ly;
-
- Elm_Object_Item *navi_it;
- Elm_Object_Item *selected_item;
-
- int priority_rule_count;
- int edit_checked_count;
- int edit_total_count;
- Eina_Bool select_all_checked;
-
- Evas_Object *edit_tool_btn1;
- Evas_Object *select_all_layout;;
- Evas_Object *select_all_checkbox;;
- Evas_Object *edit_select_info;
- Evas_Object *edit_select_info_ly;
-
- email_rule_t *rule_list;
-
- Elm_Genlist_Item_Class itc;
- Elm_Genlist_Item_Class itc2;
-
-};
-
-void setting_init_priority_senders_view(struct viewdata *vd)
-{
- debug_log("");
- vd->type = VIEW_PRIORITY_SENDERS;
- vd->create = _create;
- vd->update = _update;
- vd->destroy = _destroy;
- vd->show = _show;
- vd->hide = _hide;
- vd->grp_nm = "setting_priority_senders";
-}
-
-static int _create(struct viewdata *vd)
-{
- debug_log("");
-
- if (!vd) {
- debug_log("vd is NULL");
- return FALSE;
- }
-
- struct priv_data *p = vd->priv;
-
- if (p == NULL) {
- p = vd->priv = calloc(1, sizeof(struct priv_data));
- p->vd = vd;
- }
-
- p->layout = setting_add_inner_layout(vd);
- _push_naviframe(vd);
- g_vd = vd;
-
- return TRUE;
-}
-
-static int _update(struct viewdata *vd)
-{
- debug_log("");
-
- if (vd->refresh) {
- debug_log("");
- _refresh_priority_sender_view(vd, NULL, NULL);
- }
-
- return TRUE;
-}
-
-static int _destroy(struct viewdata *vd)
-{
- debug_log("");
- struct priv_data *p = vd->priv;
-
- if (p == NULL) {
- debug_log("priv is NULL");
- return FALSE;
- }
-
- _free_list(vd);
- _free_noc(vd);
-
- if(vd->ugd && vd->ugd->rule) {
- email_free_rule(&(vd->ugd->rule), 1);
- vd->ugd->rule = NULL;
- }
-
- if(p->l_button) {
- evas_object_del(p->l_button);
- p->l_button = NULL;
- }
-
- if(p->tool_btn1) {
- evas_object_del(p->tool_btn1);
- p->tool_btn1 = NULL;
- }
-
- if(p->tool_btn2) {
- evas_object_del(p->tool_btn2);
- p->tool_btn2 = NULL;
- }
-
- if(p->more_btn) {
- evas_object_del(p->more_btn);
- p->more_btn = NULL;
- }
-
- if(p->ctxpopup) {
- evas_object_del(p->ctxpopup);
- p->ctxpopup = NULL;
- }
-
- if(p->gl_priority) {
- evas_object_del(p->gl_priority);
- p->gl_priority = NULL;
- }
-
- return TRUE;
-}
-
-static int _show(struct viewdata *vd)
-{
- debug_log("");
-
- if (!vd) {
- debug_log("vd is NULL");
- return FALSE;
- }
-
- evas_object_show(vd->ly);
- return TRUE;
-}
-
-static int _hide(struct viewdata *vd)
-{
- debug_log("");
-
- if (!vd) {
- debug_log("vd is NULL");
- return FALSE;
- }
-
- evas_object_hide(vd->ly);
- return TRUE;
-}
-
-static void _create_list(struct viewdata *vd)
-{
- debug_log("");
- struct priv_data *p = vd->priv;
- int count, i;
- email_rule_t *rule_list = NULL;
-
- p->main_box = elm_box_add(vd->ugd->navi_bar);
- evas_object_size_hint_weight_set(p->main_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_show(p->main_box);
- elm_object_part_content_set(p->layout, "elm.swallow.content", p->main_box);
-
- p->gl_priority = elm_genlist_add(vd->ugd->navi_bar);
- elm_genlist_block_count_set(p->gl_priority, 25);
- evas_object_size_hint_weight_set(p->gl_priority, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(p->gl_priority, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_smart_callback_add(p->gl_priority, "drag,start,right", _my_gl_mode_right, NULL); /* sweep right */
- evas_object_smart_callback_add(p->gl_priority, "drag,start,left", _my_gl_mode_left, NULL); /* sweep left */
- evas_object_smart_callback_add(p->gl_priority, "drag,start,up", _my_gl_mode_cancel, NULL); /* flick */
- evas_object_smart_callback_add(p->gl_priority, "drag,start,down", _my_gl_mode_cancel, NULL); /* flick */
-
- elm_object_style_set(p->gl_priority, "1text");
-
- p->itc.item_style = "1text"; /* for upper layer */
- p->itc.decorate_item_style = "mode/slide2"; /* for lower layer */
- p->itc.func.text_get = _gl_label_get;
- p->itc.func.del = _gl_del;
- p->itc.func.content_get = _gl_icon_get;
- p->itc.decorate_all_item_style = "edit_default";
-
- p->itc2.item_style = "2text.1icon.12"; /* for upper layer */
- p->itc2.decorate_item_style = "mode/slide2"; /* for lower layer */
- p->itc2.func.text_get = _gl_label_get;
- p->itc2.func.del = _gl_del;
- p->itc2.func.content_get = _gl_icon_get;
- p->itc2.decorate_all_item_style = "edit_default";
-
- /* get the rule list from service */
- if (email_get_rule_list(&rule_list, &count) < 0) {
- debug_log("email_get_rule_list failed");
- }
-
- if (count > 0) {
- /* copy rule list */
- if (p->rule_list != NULL) {
- free(p->rule_list);
- p->rule_list = NULL;
- }
-
- p->rule_list = (email_rule_t *) malloc(sizeof(email_rule_t)*count);
- if (p->rule_list && rule_list)
- memcpy(p->rule_list, rule_list, sizeof(email_rule_t)*count);
- else
- goto FINISH_OFF;
-
- for (i = 0; i < count; i++) {
- ListItemData *item_data = NULL;
- if (p->rule_list[i].type == EMAIL_PRIORITY_SENDER) {
- item_data = calloc(1, sizeof(ListItemData));
- item_data->rule = &(p->rule_list[i]);
- item_data->rule->value = g_strdup(item_data->rule->value);
- item_data->genlist = p->gl_priority;
- item_data->contact_item_info = (EMAIL_CONTACT_LIST_INFO_S *)_get_contact_info_by_email_address(vd, item_data->rule->value);
- if(item_data->contact_item_info) {
- item_data->it = elm_genlist_item_append(p->gl_priority, &(p->itc2), (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel_cb, (void *)item_data);
- } else {
- item_data->it = elm_genlist_item_append(p->gl_priority, &(p->itc), (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, _gl_sel_cb, (void *)item_data);
- }
- p->priority_rule_count++;
- } else {
- debug_log("undefined rule type");
- }
-
- debug_log("p->priority_rule_count %d", p->priority_rule_count);
- }
- }
-
-FINISH_OFF:
- /* free emf rule_list */
- email_free_rule(&rule_list, count);
-}
-
-static void _create_noc(struct viewdata *vd)
-{
- debug_log("");
- struct priv_data *p = vd->priv;
-
- p->noc = elm_layout_add(vd->ugd->navi_bar);
- elm_layout_theme_set(p->noc, "layout", "nocontents", "text");
- elm_object_part_text_set(p->noc, "elm.text", dgettext("sys_string", "IDS_COM_BODY_NO_CONTENTS"));
-
- p->noc_ly = elm_layout_add(vd->ugd->navi_bar);
- elm_layout_file_set(p->noc_ly, EV_THEME_PATH, "email_block_noc");
- evas_object_size_hint_weight_set(p->noc_ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(p->noc_ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- elm_object_part_content_set(p->noc_ly, "contents", p->noc);
-}
-
-static void _refresh_priority_sender_view(struct viewdata *vd, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- struct priv_data *p = vd->priv;
-
- elm_object_part_content_unset(p->layout, "elm.swallow.content");
- _free_list(vd);
- _free_noc(vd);
-
- _create_list(vd);
-
- if (p->priority_rule_count > 0) {
- elm_box_pack_end(p->main_box, p->gl_priority);
- evas_object_show(p->gl_priority);
- elm_object_disabled_set(p->tool_btn1, EINA_FALSE);
- } else {
- _create_noc(vd);
- elm_object_part_text_set(p->noc, "elm.text", _("IDS_EMAIL_BODY_NO_ADDRESS"));
- elm_box_pack_end(p->main_box, p->noc_ly);
- evas_object_show(p->noc_ly);
- elm_object_disabled_set(p->tool_btn1, EINA_TRUE);
- }
-
-}
-
-static void _push_naviframe(struct viewdata *vd)
-{
- debug_log("");
-
- struct priv_data *p = vd->priv;
-
- p->more_btn = elm_button_add(vd->ugd->navi_bar);
- elm_object_style_set(p->more_btn, "naviframe/more/default");
- evas_object_smart_callback_add(p->more_btn, "clicked", _more_toolbar_clicked_cb, vd);
- debug_log("");
-
- p->tool_btn1 = elm_button_add(vd->ugd->navi_bar);
- elm_object_style_set(p->tool_btn1, "naviframe/toolbar/default");
- elm_object_text_set(p->tool_btn1, dgettext("sys_string", "IDS_COM_SK_DELETE"));
- evas_object_smart_callback_add(p->tool_btn1, "clicked", _edit_cb, vd);
-
- p->tool_btn2 = elm_button_add(vd->ugd->navi_bar);
- elm_object_style_set(p->tool_btn2, "naviframe/toolbar/default");
- elm_object_text_set(p->tool_btn2, dgettext("sys_string", "IDS_COM_SK_ADD"));
- evas_object_smart_callback_add(p->tool_btn2, "clicked", _add_filter_clicked_cb, vd);
-
- p->l_button = elm_button_add(vd->ugd->navi_bar);
- elm_object_style_set(p->l_button, "naviframe/back_btn/default");
- evas_object_smart_callback_add(p->l_button, "clicked", _back_cb, vd);
- evas_object_show(p->l_button);
-
- p->navi_it = elm_naviframe_item_push(vd->ugd->navi_bar, _("IDS_EMAIL_BODY_PRIORITY_SENDERS"), p->l_button, NULL, p->layout, NULL);
- _refresh_priority_sender_view(vd, NULL, NULL);
-
- elm_object_item_part_content_set(p->navi_it, "toolbar_more_btn", p->more_btn);
- elm_object_item_part_content_set(p->navi_it, "toolbar_button1", p->tool_btn1);
- elm_object_item_part_content_set(p->navi_it, "toolbar_button2", p->tool_btn2);
-
- evas_object_show(vd->ugd->navi_bar);
- debug_log("");
-}
-
-static void _more_toolbar_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
- struct priv_data *p = vd->priv;
- Evas_Coord x, y, w, h;
-
- p->ctxpopup = elm_ctxpopup_add(vd->ugd->navi_bar);
- evas_object_smart_callback_add(p->ctxpopup, "dismissed", _dismissed_cb, vd);
-
- elm_ctxpopup_item_append(p->ctxpopup, _("IDS_EMAIL_HEADER_NOTIFICATION_SETTINGS"), NULL, _notification_setting_clicked_cb, vd);
-
- evas_object_geometry_get(obj, &x, &y, &w, &h);
- evas_object_move(p->ctxpopup, x + (w / 2), y);
- evas_object_show(p->ctxpopup);
-}
-
-static void _dismissed_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
- struct priv_data *p = vd->priv;
-
- evas_object_del(p->ctxpopup);
- p->ctxpopup = NULL;
-}
-
-static void _edit_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
- struct priv_data *p = vd->priv;
-
- Evas_Object *genlist = NULL;
-
- genlist = p->gl_priority;
- p->edit_total_count = p->priority_rule_count;
-
-
- if (!elm_genlist_decorate_mode_get(genlist)) {
- p->edit_checked_count = 0;
- /* Change layout background color to edit_mode color */
- edje_object_signal_emit(_EDJ(vd->ugd->layout_main), "elm,bg,show,edit_mode", "elm");
-
- elm_object_item_part_content_unset(p->navi_it, "toolbar_button1");
- elm_object_item_part_content_unset(p->navi_it, "toolbar_button2");
- elm_object_item_part_content_unset(p->navi_it, "toolbar_more_btn");
- evas_object_hide(p->tool_btn1);
- evas_object_hide(p->tool_btn2);
- evas_object_hide(p->more_btn);
- elm_naviframe_item_style_set(p->navi_it, "basic");
-
- p->edit_tool_btn1 = elm_button_add(vd->ugd->navi_bar);
- elm_object_style_set(p->edit_tool_btn1, "naviframe/toolbar/default");
- elm_object_text_set(p->edit_tool_btn1, dgettext("sys_string", "IDS_COM_SK_DELETE"));
- evas_object_smart_callback_add(p->edit_tool_btn1, "clicked", _delete_rule_cb, vd);
- elm_object_disabled_set(p->edit_tool_btn1, EINA_TRUE);
- elm_object_item_part_content_set(p->navi_it, "toolbar_button1", p->edit_tool_btn1);
-
- /* Append 'Select All' layout */
- p->select_all_layout = elm_layout_add(p->main_box);
- elm_layout_theme_set(p->select_all_layout, "genlist", "item", "select_all/default");
- evas_object_size_hint_weight_set(p->select_all_layout, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
- evas_object_size_hint_align_set(p->select_all_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_event_callback_add(p->select_all_layout, EVAS_CALLBACK_MOUSE_DOWN, _select_all_layout_mouse_down_cb, vd);
-
- p->select_all_checkbox = elm_check_add(p->select_all_layout);
- elm_check_state_pointer_set(p->select_all_checkbox, &p->select_all_checked);
- evas_object_smart_callback_add(p->select_all_checkbox, "changed", _select_all_check_changed_cb, vd);
- evas_object_propagate_events_set(p->select_all_checkbox, EINA_FALSE);
- elm_object_part_content_set(p->select_all_layout, "elm.icon", p->select_all_checkbox);
-
- elm_object_part_text_set(p->select_all_layout, "elm.text", dgettext("sys_string", "IDS_COM_BODY_SELECT_ALL"));
- elm_box_pack_start(p->main_box, p->select_all_layout);
- evas_object_show(p->select_all_layout);
-
- /* Set reorder and edit mode */
- elm_genlist_reorder_mode_set(genlist, EINA_FALSE);
- elm_genlist_decorate_mode_set(genlist, EINA_TRUE);
-
- /* This means even if selected, every click will make the selected callbacks be called. */
- elm_genlist_select_mode_set(genlist, ELM_OBJECT_SELECT_MODE_ALWAYS);
-
- /* This disables sweep menu in edit mode */
- p->itc.decorate_item_style = NULL; /* for lower layer */
-
- elm_object_item_text_set(p->navi_it, _("IDS_EMAIL_HEADER_DELETE"));
- } else {
- /* Change layout background color to default background color */
- edje_object_signal_emit(_EDJ(vd->ugd->layout_main), "elm,bg,show,default", "elm");
-
- elm_object_item_part_content_unset(p->navi_it, "toolbar_button1");
- if (p->edit_tool_btn1) {
- evas_object_del(p->edit_tool_btn1);
- p->edit_tool_btn1 = NULL;
- }
-
- elm_object_item_part_content_set(p->navi_it, "toolbar_button1", p->tool_btn1);
- elm_object_item_part_content_set(p->navi_it, "toolbar_button2", p->tool_btn2);
- elm_object_item_part_content_set(p->navi_it, "toolbar_more_btn", p->more_btn);
- evas_object_show(p->tool_btn1);
- evas_object_show(p->tool_btn2);
- evas_object_show(p->more_btn);
-
- /* Remove 'Select All' layout. */
- elm_box_unpack(p->main_box, p->select_all_layout);
- evas_object_del(p->select_all_layout);
- p->select_all_layout = NULL;
-
- if (p->edit_select_info) {
- evas_object_del(p->edit_select_info);
- p->edit_select_info = NULL;
- }
-
- /* Unset edit mode */
- elm_genlist_decorate_mode_set(genlist, EINA_FALSE);
- elm_genlist_reorder_mode_set(genlist, EINA_FALSE);
- elm_genlist_select_mode_set(genlist, ELM_OBJECT_SELECT_MODE_DEFAULT);
-
- p->select_all_checked = EINA_FALSE;
- elm_check_state_pointer_set(p->select_all_checkbox, &p->select_all_checked);
- _refresh_priority_sender_view(vd, NULL, NULL);
-
- /* Set the navigation bar title */
- elm_object_item_text_set(p->navi_it, _("IDS_EMAIL_BODY_PRIORITY_SENDERS"));
- }
-}
-
-static void _add_filter_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
-
- EmailSettingUGD *ugd = vd->ugd;
- Viewtype top = ugd->view_st[ugd->view_top];
-
- if (top != VIEW_PRIORITY_SENDERS) {
- debug_log("**double clicked**");
- return;
- }
- vd->ugd->mode = PRIORITY_SENDER_MODE_ADD;
-
- setting_change_view(VIEW_ADD_PRIORITY_SENDER, ugd);
-
- return;
-}
-
-static void _delete_rule_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
- struct priv_data *p = vd->priv;
- Elm_Object_Item *it;
- ListItemData *item_data = NULL;
- Evas_Object *genlist = NULL;
-
- genlist = p->gl_priority;
-
- it = elm_genlist_first_item_get(genlist);
- while (it) {
- item_data = (ListItemData *) elm_object_item_data_get(it);
- it = elm_genlist_item_next_get(it);
-
- if ((item_data) && (item_data->checked)) {
- email_delete_rule(item_data->rule->filter_id);
- elm_object_item_del(item_data->it);
- p->edit_total_count--;
- p->edit_checked_count--;
- }
- }
-
- if (p->edit_select_info) {
- evas_object_del(p->edit_select_info);
- p->edit_select_info = NULL;
- }
-
- _del_button_state_set(vd);
-
- if (p->edit_total_count == 0) {
- p->select_all_checked = EINA_FALSE;
- elm_check_state_pointer_set(p->select_all_checkbox, &p->select_all_checked);
-
- _edit_cb(vd, NULL, NULL);
- }
-}
-
-static void _back_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
- struct priv_data *p = vd->priv;
-
- /* This avoids moving back to Email settings screen */
- Evas_Object *genlist = NULL;
- genlist = p->gl_priority;
-
- if (!elm_genlist_decorate_mode_get(genlist)) {
- setting_back_to_prev_view(vd);
- } else {
- _edit_cb(vd, NULL, NULL);
- }
-}
-
-
-static void _select_all_layout_mouse_down_cb(void *data, Evas * evas, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
- struct priv_data *p = vd->priv;
-
- p->select_all_checked = !p->select_all_checked;
- elm_check_state_pointer_set(p->select_all_checkbox, &p->select_all_checked);
-
- _check_select_all(vd);
-}
-
-static void _select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- _check_select_all(data);
-}
-
-static void _check_select_all(void *data)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
- struct priv_data *p = vd->priv;
- ListItemData *it_data;
- Elm_Object_Item *it;
-
- Evas_Object *genlist = NULL;
-
- genlist = p->gl_priority;
-
-
- if (p->select_all_checked)
- p->edit_checked_count = p->edit_total_count;
- else
- p->edit_checked_count = 0;
-
- it = elm_genlist_first_item_get(genlist);
- while (it) {
- it_data = elm_object_item_data_get(it);
- if (it_data)
- it_data->checked = p->select_all_checked;
- it = elm_genlist_item_next_get(it);
- }
-
- _del_button_state_set(vd);
- _show_selection_info(vd);
-
- /* Update all realized items */
- elm_genlist_realized_items_update(genlist);
-}
-
-static void _edit_item_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- ListItemData *item_data = (ListItemData *) data;
- struct viewdata *vd = g_vd;
- struct priv_data *p = vd->priv;
-
- if (item_data->checked)
- p->edit_checked_count++;
- else
- p->edit_checked_count--;
-
- /* update select all check button */
- if (p->select_all_layout) {
- if (p->edit_total_count == p->edit_checked_count)
- p->select_all_checked = EINA_TRUE;
- else
- p->select_all_checked = EINA_FALSE;
-
- elm_check_state_pointer_set(p->select_all_checkbox, &p->select_all_checked);
- }
- _del_button_state_set(vd);
- _show_selection_info(vd);
-}
-
-static void _del_button_state_set(struct viewdata *vd)
-{
- struct priv_data *p = vd->priv;
-
- if (p->edit_checked_count > 0)
- elm_object_disabled_set(p->edit_tool_btn1, EINA_FALSE);
- else
- elm_object_disabled_set(p->edit_tool_btn1, EINA_TRUE);
-}
-
-static void _show_selection_info(struct viewdata *vd)
-{
- struct priv_data *p = vd->priv;
-
- if (!p->edit_select_info) {
- p->edit_select_info = elm_notify_add(vd->ugd->layout_main);
- elm_notify_align_set(p->edit_select_info, ELM_NOTIFY_ALIGN_FILL, 1.0);
- p->edit_select_info_ly = elm_layout_add(vd->ugd->layout_main);
- elm_layout_theme_set(p->edit_select_info_ly, "standard", "selectioninfo", "vertical/bottom_64");
- elm_object_content_set(p->edit_select_info, p->edit_select_info_ly);
- }
- if (p->edit_checked_count == 0)
- evas_object_hide(p->edit_select_info);
- else {
- char text[128] = { '0', };
- if (p->edit_checked_count == 1)
- snprintf(text, 127, "%s (%d)", dgettext("sys_string", "IDS_COM_POP_SELECTED"), p->edit_checked_count);
- else
- snprintf(text, 127, "%s (%d)", dgettext("sys_string", "IDS_COM_POP_SELECTED"), p->edit_checked_count);
-
- edje_object_part_text_set(_EDJ(p->edit_select_info_ly), "elm.text", text);
- /*elm_notify_timeout_set(select_info, 1);*/
- evas_object_show(p->edit_select_info);
- }
-}
-
-static char *_gl_label_get(void *data, Evas_Object *obj, const char *part)
-{
- debug_log("");
- ListItemData *item_data = (ListItemData *) data;
-
- email_rule_t *rule = NULL;
- char buf[256];
- memset(buf, 0x00, 256);
-
- if ( g_strcmp0(part, "elm.text") == 0 || g_strcmp0(part, "elm.text.2") == 0) {
- rule = item_data->rule;
- debug_log("item_data : %p rule : %p", item_data, rule);
-
- if(rule->value) {
- debug_log("rule->value : %p rule->value : %s", rule->value, rule->value);
- }
- snprintf(buf, sizeof(buf), "%s", rule->value);
- return strdup(buf);
- } else if (g_strcmp0(part, "elm.text.1") == 0) {
- EMAIL_CONTACT_LIST_INFO_S *contact_item_info = (EMAIL_CONTACT_LIST_INFO_S *)item_data->contact_item_info;
- if(contact_item_info) {
- if(contact_item_info->display)
- return strdup(contact_item_info->display);
- else if (contact_item_info->display_name[0] != '\0')
- return strdup(contact_item_info->display_name);
- }
- }
-
- return NULL;
-}
-
-static Evas_Object *_gl_icon_get(void *data, Evas_Object *obj, const char *part)
-{
- debug_log("");
- ListItemData *item_data = (ListItemData *) data;
- Evas_Object *button;
- Evas_Object *check;
- debug_log("item_data : %p", item_data);
- if (elm_genlist_decorate_mode_get(obj)) {
- if (!strcmp(part, "elm.edit.icon.1")) {
- check = elm_check_add(obj);
- elm_check_state_pointer_set(check, &item_data->checked);
- evas_object_smart_callback_add(check, "changed", _edit_item_check_changed_cb, item_data);
- return check;
- }
- } else {
- if (!strcmp(part, "elm.icon"))
- {
- EMAIL_CONTACT_LIST_INFO_S *contact_item_info = (EMAIL_CONTACT_LIST_INFO_S *)item_data->contact_item_info;
- if(contact_item_info && contact_item_info->image_path) {
- Evas_Object *icon = elm_icon_add(obj);
- elm_image_file_set(icon, contact_item_info->image_path, NULL);
- debug_log("contact_item_info->image_path : %s", contact_item_info->image_path);
- evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
- return icon;
- }
- } else if (0 == strcmp(part, "elm.slide.swallow.1")) {
- button = elm_button_add(obj);
- elm_object_style_set(button, "text_only/sweep");
- elm_object_text_set(button, dgettext("sys_string", "IDS_COM_SK_EDIT"));
- evas_object_smart_callback_add(button, "clicked", _sweep_edit_clicked_cb, (void *)data);
- return button;
- } else if (0 == strcmp(part, "elm.slide.swallow.2")) {
- button = elm_button_add(obj);
- elm_object_style_set(button, "text_only/sweep");
- elm_object_text_set(button, dgettext("sys_string", "IDS_COM_SK_DELETE"));
- evas_object_smart_callback_add(button, "clicked", _sweep_delete_clicked_cb, (void *)data);
- return button;
- }
- }
-
- return NULL;
-}
-
-static void _gl_del(void *data, Evas_Object *obj)
-{
- debug_log("");
- ListItemData *item_data = (ListItemData *) data;
-
- if (item_data) {
- EMAIL_CONTACT_LIST_INFO_S *contact_item_info = (EMAIL_CONTACT_LIST_INFO_S *)item_data->contact_item_info;
- if(contact_item_info) {
- FREE(contact_item_info->display);
- FREE(contact_item_info->email_address);
- FREE(contact_item_info->image_path);
- }
- g_free(item_data);
- }
-}
-
-static void _gl_sel_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- Elm_Object_Item *item = (Elm_Object_Item *)event_info;
- elm_genlist_item_selected_set(item, EINA_FALSE);
- struct viewdata *vd = g_vd;
- struct priv_data *p = vd->priv;
- EmailSettingUGD *ugd = vd->ugd;
- ListItemData *item_data = (ListItemData *) data;
-
- if (item_data) {
- if (elm_genlist_decorate_mode_get(item_data->genlist)) {
- item_data->checked = !item_data->checked;
-
- if (item_data->checked)
- p->edit_checked_count++;
- else
- p->edit_checked_count--;
-
- if (p->select_all_layout) {
- if (p->edit_total_count == p->edit_checked_count)
- p->select_all_checked = EINA_TRUE;
- else
- p->select_all_checked = EINA_FALSE;
-
- elm_check_state_pointer_set(p->select_all_checkbox, &p->select_all_checked);
- }
-
- elm_genlist_item_update(item_data->it);
- _del_button_state_set(vd);
- _show_selection_info(vd);
-
- } else {
- email_rule_t *rule = NULL;
- Viewtype top = ugd->view_st[ugd->view_top];
- p->selected_item = elm_genlist_selected_item_get(obj);
- ugd->mode = PRIORITY_SENDER_MODE_EDIT;
-
- rule = item_data->rule;
- elm_genlist_item_selected_set(p->selected_item, EINA_FALSE);
-
- if (top != VIEW_PRIORITY_SENDERS) {
- debug_log("**double clicked**");
- return;
- }
-
- _copy_rule_info(rule, vd);
- setting_change_view(VIEW_ADD_PRIORITY_SENDER, ugd);
- }
- }
-}
-static void _sweep_edit_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- ListItemData *item_data = (ListItemData *) data;
- email_rule_t *rule = item_data->rule;
- struct viewdata *vd = g_vd;
- EmailSettingUGD *ugd = vd->ugd;
- Viewtype top = ugd->view_st[ugd->view_top];
-
- if (top != VIEW_PRIORITY_SENDERS) {
- debug_log("**double clicked**");
- return;
- }
- vd->ugd->mode = PRIORITY_SENDER_MODE_EDIT;
- _copy_rule_info(rule, vd);
-
- setting_change_view(VIEW_ADD_PRIORITY_SENDER, ugd);
-}
-
-static void _sweep_delete_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- ListItemData *item_data = (ListItemData *) data;
- email_rule_t *rule = item_data->rule;
-
- struct viewdata *vd = g_vd;
-
- if (EMAIL_ERROR_NONE != email_delete_rule(rule->filter_id)) {
- debug_critical("email_delete_rule fails");
- }
-
- _refresh_priority_sender_view(vd, NULL, NULL);
-}
-
-static void _my_gl_mode_right(void *data, Evas_Object *obj, void *event_info)
-{
- if (!event_info)
- return;
-
- /* Start genlist sweep */
- elm_genlist_item_decorate_mode_set(event_info, "slide", EINA_TRUE);
-}
-
-static void _my_gl_mode_left(void *data, Evas_Object *obj, void *event_info)
-{
- if (!event_info)
- return;
-
- /* Finish genlist sweep */
- elm_genlist_item_decorate_mode_set(event_info, "slide", EINA_FALSE);
-}
-
-static void _my_gl_mode_cancel(void *data, Evas_Object *obj, void *event_info)
-{
- if (!obj)
- return;
-
- /* Get sweeped item */
- Elm_Object_Item *it = (Elm_Object_Item *)elm_genlist_decorated_item_get(obj);
- /* Finish genlist sweep */
- if (it)
- elm_genlist_item_decorate_mode_set(it, "slide", EINA_FALSE);
-}
-
-static void _free_list(struct viewdata *vd)
-{
- debug_log("");
- struct priv_data *p = vd->priv;
-
- if (p->gl_priority != NULL) {
- elm_genlist_clear(p->gl_priority);
- evas_object_del(p->gl_priority);
- p->gl_priority = NULL;
- }
-
- p->priority_rule_count = 0;
-
- if (p->main_box) {
- evas_object_del(p->main_box);
- p->main_box = NULL;
- }
-}
-
-static void _free_noc(struct viewdata *vd)
-{
- debug_log("");
- struct priv_data *p = vd->priv;
-
- elm_object_part_content_unset(p->noc_ly, "contents");
- if (p->noc) {
- evas_object_del(p->noc);
- p->noc = NULL;
- }
-
- if (p->noc_ly) {
- evas_object_del(p->noc_ly);
- p->noc_ly = NULL;
- }
-}
-
-static void _notification_setting_clicked_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
- EmailSettingUGD *ugd = vd->ugd;
- struct priv_data *p = vd->priv;
- Viewtype top = ugd->view_st[ugd->view_top];
-
- if(p->ctxpopup) {
- evas_object_del(p->ctxpopup);
- p->ctxpopup = NULL;
- }
-
- if (top != VIEW_PRIORITY_SENDERS) {
- debug_log("**double clicked**");
- return;
- }
- setting_change_view(VIEW_NOTIFICATION_SETTING, ugd);
-
- return;
-}
-
-static void *_get_contact_info_by_email_address(struct viewdata *vd, const char *search_word)
-{
- debug_log("");
- if (!vd) {
- debug_log("vd is NULL");
- return NULL;
- }
-
- int ct_ret = CONTACTS_ERROR_NONE;
- EMAIL_CONTACT_LIST_INFO_S *contacts_list_item = NULL;
- contacts_list_h list = NULL;
-
- if (contacts_connect2() != CONTACTS_ERROR_NONE) {
- debug_log("Fail of contacts_connect2 !!!");
- return NULL;
- }
-
- ct_ret = email_get_contacts_list(CONTACTS_MATCH_EXACTLY, &list, search_word);
- debug_log("ct_ret : %d email_get_contacts_record: list : %d", ct_ret, list);
-
- if (!list) {
- debug_log("list is NULL");
- contacts_list_destroy(list, true);
- contacts_disconnect2();
- return NULL;
- }
-
- contacts_list_item = (EMAIL_CONTACT_LIST_INFO_S *)calloc(1, sizeof(EMAIL_CONTACT_LIST_INFO_S));
- contacts_list_item->ugd = vd;
-
- ct_ret = email_get_contacts_list_info(list, contacts_list_item);
- debug_log("email_get_contacts_list_info: contacts_list_item : %p", contacts_list_item);
-
- if(contacts_list_item->display || contacts_list_item->image_path) {
- contacts_list_destroy(list, true);
- contacts_disconnect2();
- return contacts_list_item;
- } else {
- debug_log("contact information is not found");
- contacts_list_destroy(list, true);
- contacts_disconnect2();
- }
-
- return NULL;
-}
-
-static void _copy_rule_info(email_rule_t *rule, void *data)
-{
- debug_log("");
- struct viewdata *vd = (struct viewdata *)data;
- EmailSettingUGD *ugd = vd->ugd;
-
- if(ugd && ugd->rule) {
- email_free_rule(&(ugd->rule), 1);
- ugd->rule = NULL;
- }
-
- ugd->rule = malloc(sizeof(email_rule_t));
-
- if(!ugd->rule)
- return;
-
- memset(ugd->rule, 0x00, sizeof(email_rule_t));
-
- if(rule) {
- ugd->rule->account_id = rule->account_id;
- ugd->rule->filter_id = rule->filter_id;
- ugd->rule->type = rule->type;
- ugd->rule->value = g_strdup(rule->value);
- ugd->rule->faction = rule->faction;
- ugd->rule->target_mailbox_id = rule->target_mailbox_id;
- ugd->rule->flag1 = rule->flag1;
- ugd->rule->flag2 = rule->flag2;
- }
-
- debug_log("rule->type : %d, rule->value : %s", rule->type, rule->value);
-}
static void _push_naviframe(struct viewdata *vd);
static void _create_list(struct viewdata *vd);
static void _get_default_account(struct viewdata *vd);
-static void _priority_senders_email_cb(void *data, Evas_Object *obj, void *event_info);
static void _back_cb(void *data, Evas_Object *obj, void *event_info);
static void _add_account_cb(void *data, Evas_Object *obj, void *event_info);
static void _color_rect_cb(void *data, Evas * evas, Evas_Object *obj, void *event_info);
}
}
-static void _priority_senders_email_cb(void *data, Evas_Object *obj, void *event_info)
-{
- debug_log("");
- struct viewdata *vd = data;
- EmailSettingUGD *ugd = vd->ugd;
- Elm_Object_Item *item = (Elm_Object_Item *)event_info;
-
- elm_genlist_item_selected_set(item, EINA_FALSE);
-
- Viewtype top = ugd->view_st[ugd->view_top];
- if (top != VIEW_SETTING) {
- debug_log("**double clicked**");
- return;
- }
-
- if (ugd->popup_color) {
- evas_object_del(ugd->popup_color);
- ugd->popup_color = NULL;
- }
-
- if (ugd->account_count == 0) {
- ugd->popup_one = setting_get_notify(vd, dgettext("sys_string", "IDS_COM_POP_WARNING"),
- _("IDS_EMAIL_POP_THERE_IS_NO_ACCOUNT_CREATE_A_NEW_ACCOUNT_FIRST"), 1,
- dgettext("sys_string", "IDS_COM_SK_OK"),
- _popup_ok_cb, NULL, NULL);
- } else {
- setting_change_view(VIEW_PRIORITY_SENDERS, ugd);
- }
-
- return;
-}
-
static void _back_cb(void *data, Evas_Object *obj, void *event_info)
{
debug_log("");