merge with latest code
authorMinsoo Kim <minnsoo.kim@samsung.com>
Fri, 21 Dec 2012 11:16:54 +0000 (20:16 +0900)
committerMinsoo Kim <minnsoo.kim@samsung.com>
Fri, 21 Dec 2012 11:16:54 +0000 (20:16 +0900)
22 files changed:
main/org.tizen.email.xml
packaging/org.tizen.email.spec
setting/CMakeLists.txt
setting/include/email-setting-view.h
setting/include/email-view-add-priority-sender.h [new file with mode: 0644]
setting/include/email-view-notification-setting.h [new file with mode: 0644]
setting/include/email-view-priority-senders.h [new file with mode: 0644]
setting/src/email-setting-account-set.c
setting/src/email-setting.c
setting/src/email-view-account-edit.c
setting/src/email-view-account-options.c
setting/src/email-view-account-setup.c
setting/src/email-view-add-priority-sender.c [new file with mode: 0644]
setting/src/email-view-initial.c
setting/src/email-view-manual-setup.c
setting/src/email-view-notification-setting.c [new file with mode: 0644]
setting/src/email-view-priority-senders.c [new file with mode: 0644]
setting/src/email-view-setting.c
setting/src/email-view-sp-select.c
setting/src/email-view-sync-schedule.c
setting/src/email-view-sync-setup.c
setting/theme/email-setting-theme.edc

index ee68cdd..32b00a9 100755 (executable)
                        <uri name="mailto"/>
                </application-service>
        </ui-application>
+       <ui-application appid="email-setting-efl" exec="/usr/ug/bin/email-setting-efl" nodisplay="true" multiple="true" type="capp" taskmanage="false">
+               <label>Email</label>
+               <icon>/usr/share/icons/default/small/com.samsung.email.png</icon>
+               <application-service>
+                       <operation name="http://tizen.org/account/operation/signin"/>
+               </application-service>
+               <application-service>
+                       <operation name="http://tizen.org/account/operation/view"/>
+               </application-service>
+       </ui-application>
 </manifest>
index 0ddbaf2..198aaaa 100755 (executable)
@@ -85,6 +85,7 @@ chown -R 5000:5000 %{_pkgdir}/data
 
 mkdir -p %{_ugdir}/bin/
 ln -sf /usr/bin/ug-client %{_ugdir}/bin/email-composer-efl
+ln -sf /usr/bin/ug-client %{_ugdir}/bin/email-setting-efl
 
 
 %files
index 4eaede7..70798c2 100755 (executable)
@@ -16,6 +16,9 @@ SET(SRCS
        ./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)
 
@@ -31,7 +34,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/include)
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(pkgs-setting REQUIRED ecore glib-2.0 gobject-2.0 elementary utilX vconf
-               appcore-efl email-service ui-gadget-1 bundle dlog edbus capi-appfw-application status libxml-2.0 contacts-service2)
+               appcore-efl email-service ui-gadget-1 bundle dlog edbus capi-appfw-application status libxml-2.0 contacts-service2 accounts-svc)
 
 FOREACH(flag ${pkgs-setting_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index 3b4835d..0b0ca92 100755 (executable)
@@ -30,6 +30,9 @@ typedef enum {
        VIEW_SYNC_SCHEDULE,
        VIEW_SYNC_SETUP,
        VIEW_SECURITY_OPTIONS,
+       VIEW_PRIORITY_SENDERS,
+       VIEW_ADD_PRIORITY_SENDER,
+       VIEW_NOTIFICATION_SETTING,
        VIEW_END
 } Viewtype;
 
diff --git a/setting/include/email-view-add-priority-sender.h b/setting/include/email-view-add-priority-sender.h
new file mode 100644 (file)
index 0000000..b5a56aa
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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 */
diff --git a/setting/include/email-view-notification-setting.h b/setting/include/email-view-notification-setting.h
new file mode 100644 (file)
index 0000000..528047d
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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 */
diff --git a/setting/include/email-view-priority-senders.h b/setting/include/email-view-priority-senders.h
new file mode 100644 (file)
index 0000000..8df7d4b
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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 */
index a5ce007..6a7b14e 100755 (executable)
@@ -60,7 +60,9 @@ void setting_set_account_with_server_info(email_protocol_config_t *incomming,
        int rgb = 0x006400ff;
 
        debug_log("service_name (%s)", service_name);
-       if (g_strcmp0(service_name, "Hotmail") == 0 || g_strcmp0(service_name, "AOL") == 0)
+       //In case of GMX account, full email address should be set on user name field.
+       if (g_strcmp0(service_name, "Hotmail") == 0 || g_strcmp0(service_name, "AOL") == 0
+                       || g_strcmp0(service_name, "GMX.com") == 0)
                account->incoming_server_user_name = g_strdup(account->user_email_address);
        else
                _set_user_name_with_email_addr(account->user_email_address, &(account->incoming_server_user_name));
index edb8fa5..dea15d0 100755 (executable)
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <getopt.h>
 #include <utilX.h>
+#include <account.h>
 
 #include "email-debug.h"
 #include "email-setting.h"
@@ -36,6 +37,9 @@
 #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);
@@ -56,6 +60,7 @@ static int _parse_option(service_h service, struct ug_data *ugd);
 static void _dispatch_view(struct ug_data *ugd);
 static void _create_navigationbar(struct ug_data *ugd);
 static Evas_Object *_create_layout(Evas_Object *parent, struct ug_data *ugd);
+static void _win_profile_changed_cb(void *data, Evas_Object *obj, void *event);
 
 static void _layout_block_cb(ui_gadget_h ug, enum ug_mode mode, void *priv);
 static void _result_block_cb(ui_gadget_h ug, service_h service, void *priv);
@@ -140,11 +145,12 @@ static void *on_create(ui_gadget_h ug, enum ug_mode mode, service_h service, voi
        _dbus_receiver_setup(ugd);
 
        /* theme extension */
-       /*ugd->theme = elm_theme_new();
+       ugd->theme = elm_theme_new();
        elm_theme_ref_set(ugd->theme, NULL);
-       elm_theme_extension_add(ugd->theme, EV_THEME_PATH);*/
+       elm_theme_extension_add(ugd->theme, EV_BLOCK_THEME_PATH); //Use block theme
 
        ugd->layout_main = _create_layout(parent, ugd);
+       evas_object_smart_callback_add(ugd->win, "profile,changed", _win_profile_changed_cb, ugd);
        _create_navigationbar(ugd);
        ugd->base = ugd->layout_main;
        elm_win_indicator_mode_set(ugd->win, ELM_WIN_INDICATOR_SHOW);
@@ -298,8 +304,8 @@ static void on_destroy(ui_gadget_h ug, service_h service, void *priv)
        setting_free_sp_desc(ugd);
 
        /* theme extension */
-       /*elm_theme_extension_del(ugd->theme, EV_THEME_PATH);
-       elm_theme_free(ugd->theme);*/
+       elm_theme_extension_del(ugd->theme, EV_BLOCK_THEME_PATH);
+       elm_theme_free(ugd->theme);
 
        /* Free Viewdata's memory */
        for (i = VIEW_SETTING; i < VIEW_END; i++) {
@@ -433,6 +439,9 @@ static void _init_data(struct ug_data *ugd)
        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);
@@ -444,6 +453,9 @@ static void _init_data(struct ug_data *ugd)
        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;
 
@@ -457,6 +469,9 @@ static void _init_data(struct ug_data *ugd)
        _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... */
 }
@@ -614,7 +629,100 @@ static int _parse_option(service_h service, struct ug_data *ugd)
 {
        debug_log("");
 
-       if (service) {
+       if (!service) {
+               debug_log("service is NULL");
+               return FALSE;
+       }
+
+       int ret;
+       char *operation = NULL;
+       ret = service_get_operation(service, &operation);
+       debug_log("service_get_operation: %d", ret);
+       debug_log("operation = %s", operation);
+
+       if (operation) {
+               if (g_strcmp0(operation, ACCOUNT_OPERATION_SIGNIN) == 0) {
+                       char *email_sp = NULL;
+                       debug_log("Operation ACCOUNT_OPERATION_SIGNIN");
+                       service_get_extra_data(service, /*ACCOUNT_DATA_SERVICE_PROVIDER*/ "http://tizen.org/account/data/service_provider", &email_sp);
+
+                       if (!email_sp) {
+                               return FALSE;
+                       }
+                       debug_log("SP:%s", email_sp);
+
+                       if (ugd->start_view_type)
+                               g_free(ugd->start_view_type);
+
+                       ugd->start_view_type = g_strdup(EMAIL_BUNDLE_VAL_VIEW_ACCOUNT_ADD);
+
+                       EmailSpDesc *desc = NULL;
+                       if (g_strcmp0(email_sp, "gmail") == 0)
+                               desc = setting_find_sp_desc("Gmail", ugd);
+                       else if (g_strcmp0(email_sp, "msn") == 0)
+                               desc = setting_find_sp_desc("Hotmail", ugd);
+                       else
+                               desc = NULL;
+
+                       if (desc)
+                               ugd->account_info = desc;
+                       else
+                               ugd->account_info = NULL;
+
+                       g_free(email_sp);
+                       return TRUE;
+
+               } else if (g_strcmp0(operation, ACCOUNT_OPERATION_VIEW) == 0) {
+                       char *account_id = NULL;
+                       char *username = NULL;
+                       debug_log("Operation ACCOUNT_OPERATION_VIEW");
+
+                       service_get_extra_data(service, ACCOUNT_DATA_ID, &account_id);
+                       service_get_extra_data(service, ACCOUNT_DATA_USERNAME, &username);
+
+                       if (!account_id) {
+                               return FALSE;
+                       }
+
+                       int my_account_id = 0;
+                       my_account_id = atoi(account_id);
+                       g_free(account_id);
+                       debug_log("MY_ACCOUNT_ID:%d", my_account_id);
+
+                       if (ugd->start_view_type)
+                               g_free(ugd->start_view_type);
+
+                       ugd->start_view_type = g_strdup(EMAIL_BUNDLE_VAL_VIEW_ACCOUNT_EDIT);
+
+                       int i = 0;
+
+                       if (ugd->account_list == NULL || ugd->account_count == 0) {
+                               debug_critical("account info is @niL");
+                               Evas_Object *popup = elm_popup_add(ugd->layout_main);
+                               evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+                               elm_object_part_text_set(popup, "title,text", dgettext("sys_string", "IDS_COM_POP_WARNING"));
+                               elm_object_text_set(popup, _("IDS_EMAIL_POP_ACCOUNT_LIST_NOT_FOUND"));
+
+                               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_OK"));
+                               elm_object_part_content_set(popup, "button1", btn1);
+                               evas_object_smart_callback_add(btn1, "clicked", _popup_ok_cb, ugd);
+                               evas_object_show(popup);
+                               return FALSE;
+                       }
+
+                       for (i = 0; i < ugd->account_count; i++) {
+                               if (ugd->account_list[i].account_svc_id == my_account_id) {
+                                       ugd->account_id = ugd->account_list[i].account_id;
+                                       debug_log("ACCOUNT_ID:%d", ugd->account_id);
+                               }
+                       }
+
+                       return TRUE;
+
+               }
+       } else {
                service_get_extra_data(service, EMAIL_BUNDLE_KEY_VIEW_TYPE, &(ugd->start_view_type));
                debug_log("VIEW TYPE:%s", ugd->start_view_type);
 
@@ -743,6 +851,26 @@ static Evas_Object *_create_layout(Evas_Object *parent, struct ug_data *ugd)
        return base;
 }
 
+static void _win_profile_changed_cb(void *data, Evas_Object *obj, void *event)
+{
+       debug_log("");
+       if (!data) {
+               debug_log("data is NULL");
+               return;
+       }
+
+       EmailSettingUGD *ugd = (EmailSettingUGD *)data;
+
+       const char *profile = elm_config_profile_get();
+       if (!g_strcmp0(profile, "desktop"))
+               elm_layout_theme_set(ugd->layout_main, "layout", "application", "noindicator");
+       else
+               elm_layout_theme_set(ugd->layout_main, "layout", "application", "default");
+
+       evas_object_size_hint_weight_set(ugd->layout_main, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_show(ugd->layout_main);
+}
+
 static void _layout_block_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
 {
        debug_log("");
index 66af5dd..3b5f99f 100755 (executable)
@@ -178,6 +178,8 @@ void setting_edit_validation_success_cb(EmailSettingUGD *ugd)
                ugd->popup_validate = NULL;
        }
 
+       _update_account_info(vd);
+
        ugd->edit_vc_timer = ecore_timer_add(0.5, _after_save_cb, vd);
 }
 
@@ -444,9 +446,9 @@ static void _push_naviframe(struct viewdata *vd)
 
        Evas_Object *title_ic = elm_icon_add(vd->ugd->navi_bar);
        evas_object_size_hint_aspect_set(title_ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
-       elm_icon_resizable_set(title_ic, EINA_TRUE, EINA_TRUE);
+       elm_image_resizable_set(title_ic, EINA_TRUE, EINA_TRUE);
 
-       elm_icon_file_set(title_ic, account_data->logo_icon_path, NULL);
+       elm_image_file_set(title_ic, account_data->logo_icon_path, NULL);
 
        account_user_data_t *user_data = (account_user_data_t *)account_data->user_data;
 
@@ -997,7 +999,7 @@ static void _onoff_cb(void *data, Evas_Object *obj, void *event_info)
                }
        }
 
-       _update_account_info(vd);
+       //_update_account_info(vd);
 }
 
 static void _back_cb(void *data, Evas_Object *obj, void *event_info)
@@ -1968,7 +1970,7 @@ static void _gl_onoff_sel_cb(void *data, Evas_Object *obj, void *event_info)
                break;
        }
 
-       _update_account_info(vd);
+       //_update_account_info(vd);
 }
 
 static void _gl_exp_cb(void *data, Evas_Object *obj, void *event_info)
index db06993..948879e 100755 (executable)
@@ -1186,7 +1186,7 @@ static Evas_Object *_gl_account_content_get_cb(void *data, Evas_Object *obj, con
        if (!g_strcmp0(part, "elm.icon.1")) {
                Evas_Object *icon = elm_icon_add(ugd->navi_bar);
 
-               elm_icon_file_set(icon, account_data->logo_icon_path, NULL);
+               elm_image_file_set(icon, account_data->logo_icon_path, NULL);
                evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
 
                p->account_icon = icon;
index 54038c9..6a07691 100755 (executable)
@@ -59,6 +59,7 @@ static void _entry_theme_changed_cb(void *data, Evas_Object *obj, void *event_in
 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);
+static char *_gl_group_text_get(void *data, Evas_Object *obj, const char *part);
 static Evas_Object *_gl_ef_content_get_cb(void *data, Evas_Object *obj, const char *part);
 
 static struct viewdata *g_vd = NULL;
@@ -102,6 +103,7 @@ struct priv_data {
        Evas_Object *genlist;
        Elm_Genlist_Item_Class itc1;
        Elm_Genlist_Item_Class itc2;
+       Elm_Genlist_Item_Class itc3;
 
        Evas_Object *cbar;
        Elm_Object_Item * c_item[4];
@@ -326,24 +328,8 @@ static void _push_naviframe(struct viewdata *vd)
        debug_log("");
        struct priv_data *p = vd->priv;
 
-       /*p->cbar = elm_toolbar_add(vd->ugd->navi_bar);
-       elm_toolbar_shrink_mode_set(p->cbar, ELM_TOOLBAR_SHRINK_EXPAND);
-       elm_object_style_set(p->cbar, "naviframe");
-       evas_object_show(p->cbar);
-
-       if (vd->ugd->account_info == NULL) {
-               p->c_item[0] = elm_toolbar_item_append(p->cbar, NULL,
-                               dgettext("sys_string", "IDS_COM_BUTTON_LOGIN"), _next_cb, vd);
-       } else {
-               p->c_item[0] = elm_toolbar_item_append(p->cbar, NULL,
-                               dgettext("sys_string", "IDS_COM_BUTTON_LOGIN"), _save_cb, vd);
-       }
-       elm_object_item_disabled_set(p->c_item[0], EINA_TRUE);
-       elm_object_item_disabled_set(elm_toolbar_item_append(p->cbar, NULL, "", NULL, NULL), EINA_TRUE);
-       elm_object_item_disabled_set(elm_toolbar_item_append(p->cbar, NULL, "", NULL, NULL), EINA_TRUE);*/
-
        p->l_button = elm_button_add(vd->ugd->navi_bar);
-       //elm_object_style_set(p->l_button, "naviframe/title/default");
+       elm_object_style_set(p->l_button, "naviframe/toolbar/default");
        elm_object_focus_allow_set(p->l_button, EINA_FALSE);
        evas_object_show(p->l_button);
 
@@ -358,15 +344,13 @@ static void _push_naviframe(struct viewdata *vd)
        elm_object_disabled_set(p->l_button, EINA_TRUE);
 
        p->r_button = elm_button_add(vd->ugd->navi_bar);
-       //elm_object_style_set(p->r_button, "naviframe/title1/default");
-       elm_object_text_set(p->r_button, dgettext("sys_string", "IDS_COM_SK_CANCEL"));
+       elm_object_style_set(p->r_button, "naviframe/end_btn/default");
+       /*elm_object_text_set(p->r_button, dgettext("sys_string", "IDS_COM_SK_CANCEL"));*/
        evas_object_smart_callback_add(p->r_button, "clicked", _back_cb, vd);
        evas_object_show(p->r_button);
 
        p->r_button2 = elm_button_add(vd->ugd->navi_bar);
-       //elm_object_style_set(p->r_button2, "naviframe/title1/default");
-       elm_object_style_set(p->r_button2, "naviframe/back_btn/default");
-       //elm_object_text_set(p->r_button2, dgettext("sys_string", "IDS_COM_SK_CANCEL"));
+       elm_object_style_set(p->r_button2, "naviframe/end_btn/default");
        evas_object_smart_callback_add(p->r_button2, "clicked", _back_cb, vd);
        evas_object_show(p->r_button2);
 
@@ -379,30 +363,12 @@ static void _push_naviframe(struct viewdata *vd)
                evas_object_smart_callback_add(p->tool_btn, "clicked", _save_cb, vd);
        }
 
-       Evas_Object *title_ic = elm_icon_add(vd->ugd->navi_bar);
-       evas_object_size_hint_aspect_set(title_ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
-       elm_icon_resizable_set(title_ic, EINA_TRUE, EINA_TRUE);
-
        Elm_Object_Item *navi_it = NULL;
-       char title_str[50] = { 0, };
-       if (vd->ugd->account_info) {
-               if (g_str_has_prefix(vd->ugd->account_info->name_str_id, "IDS_EMAIL"))
-                       snprintf(title_str, sizeof(title_str), "%s", _(vd->ugd->account_info->name_str_id));
-               else
-                       snprintf(title_str, sizeof(title_str), "%s", dgettext("sys_string", vd->ugd->account_info->name_str_id));
-
-               elm_icon_file_set(title_ic, vd->ugd->account_info->icon_path, NULL);
-       } else {
-               snprintf(title_str, sizeof(title_str), "%s", dgettext("sys_string", "IDS_COM_BODY_OTHERS"));
-               elm_icon_file_set(title_ic, ACCOUNT_ICON_OTHERS, NULL);
-       }
-
-       navi_it = elm_naviframe_item_push(vd->ugd->navi_bar, title_str, p->r_button2, NULL, p->layout, NULL);
-       elm_object_item_part_content_set(navi_it, "icon", title_ic);
-
-       elm_object_item_part_content_set(navi_it, "title_left_btn", p->l_button);
-       elm_object_item_part_content_set(navi_it, "title_right_btn", p->r_button);
+       navi_it = elm_naviframe_item_push(vd->ugd->navi_bar, _("IDS_EMAIL_HEADER_ADD_ACCOUNT"), NULL, NULL, p->layout, NULL);
+       elm_object_item_part_content_set(navi_it, "title_toolbar_button1", p->l_button);
+       elm_object_item_part_content_set(navi_it, "title_prev_btn", p->r_button);
        elm_object_item_part_content_set(navi_it, "toolbar_button1", p->tool_btn);
+       elm_object_item_part_content_set(navi_it, "prev_btn", p->r_button2);
        p->navi_it = navi_it;
        evas_object_show(vd->ugd->navi_bar);
 }
@@ -469,7 +435,7 @@ static void _create_view(struct viewdata *vd)
 
        char *desc = g_strdup(_("IDS_EMAIL_BODY_SEND_EMAIL_FROM_THIS_ACCOUNT_BY_DEFAULT"));
        Evas_Object *label1 = elm_label_add(checkbox_set);
-       elm_label_wrap_width_set(label1, 600*elm_scale_get());
+       elm_label_wrap_width_set(label1, 600*elm_config_scale_get());
        elm_label_line_wrap_set(label1, ELM_WRAP_WORD);
        char *text = g_strconcat("<color=#838B8BFF><font_size=32><align=left>",
                                desc, "</align></font_size></color>", NULL);
@@ -483,7 +449,7 @@ static void _create_view(struct viewdata *vd)
 
        desc = g_strdup(_("IDS_EMAIL_BODY_SHOW_PASSWORD"));
        Evas_Object *label2 = elm_label_add(checkbox_set);
-       elm_label_wrap_width_set(label2, 600*elm_scale_get());
+       elm_label_wrap_width_set(label2, 600*elm_config_scale_get());
        elm_label_line_wrap_set(label2, ELM_WRAP_WORD);
        text = g_strconcat("<color=#838B8BFF><font_size=32><align=left>",
                                desc, "</align></font_size></color>", NULL);
@@ -555,8 +521,14 @@ static void _create_list(struct viewdata *vd)
        p->itc2.func.state_get = NULL;
        p->itc2.func.del = NULL;
 
-       git = elm_genlist_item_append(p->genlist, &(p->itc1), NULL, NULL,
-                       ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+       p->itc3.item_style = "dialogue/grouptitle";
+       p->itc3.func.text_get = _gl_group_text_get;
+       p->itc3.func.content_get = NULL;
+       p->itc3.func.state_get = NULL;
+       p->itc3.func.del = NULL;
+
+       git = elm_genlist_item_append(p->genlist, &(p->itc3), NULL, NULL,
+                       ELM_GENLIST_ITEM_NONE, NULL, NULL);
        elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
 
        if (ugd->account_info == NULL) {
@@ -733,10 +705,10 @@ static int _check_preset_isp_name(char *addr, EmailSpDesc *desc)
 
                if (ptr1 != NULL || ptr2 != NULL)
                        ret = TRUE;
-       } else if (g_strcmp0(desc->id, "Gmail") == 0) {
+       } /*else if (g_strcmp0(desc->id, "Gmail") == 0) {
                ret = g_str_has_suffix(addr, "@gmail.com") ||
                                g_str_has_suffix(addr, "@googlemail.com");
-       } else if (g_strcmp0(desc->id, "AOL") == 0) {
+       }*/ else if (g_strcmp0(desc->id, "AOL") == 0) {
                char *ptr1 = NULL;
                char *ptr2 = NULL;
                ptr1 = g_strrstr(addr, "@aol.");
@@ -773,28 +745,32 @@ static void _read_all_entries(struct viewdata *vd)
        if (vd->ugd->account_info == NULL) {
                /*buf = elm_entry_markup_to_utf8(elm_entry_entry_get(p->entry_account_name));*/
                if (p->entry_account_name) {
-                       buf = (char *)elm_entry_entry_get(p->entry_account_name);
+                       /*buf = (char *)elm_entry_entry_get(p->entry_account_name);
                        debug_log("account name : %s", buf);
                        if (buf)
-                               account->account_name = g_strdup(buf);
+                               account->account_name = g_strdup(buf);*/
+                       account->account_name = g_strdup(p->str_account_name);
                }
        }
 
        /*buf = elm_entry_markup_to_utf8(elm_entry_entry_get(p->entry_email_address));*/
        if (p->entry_email_address) {
-               buf = (char *)elm_entry_entry_get(p->entry_email_address);
+               /*buf = (char *)elm_entry_entry_get(p->entry_email_address);
                debug_log("email addr : %s", buf);
                if (buf)
-               account->user_email_address = g_strdup(buf);
+               account->user_email_address = g_strdup(buf);*/
+               account->user_email_address = g_strdup(p->str_email_address);
        }
 
        if (p->entry_password) {
-               buf = (char *)elm_entry_markup_to_utf8(elm_entry_entry_get(p->entry_password));
+               /*buf = (char *)elm_entry_markup_to_utf8(elm_entry_entry_get(p->entry_password));
                debug_log("password : %s", buf);
                if (buf) {
                        account->incoming_server_password = g_strdup(buf);
                        g_free(buf);
-               }
+               }*/
+
+               account->incoming_server_password = g_strdup(p->str_password);
        }
 }
 
@@ -1202,10 +1178,7 @@ static void _check2_clicked_cb(void *data, Evas_Object *obj, void *event_info)
 
                if (state == ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW || state == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
                        debug_log("input panel show");
-                       evas_object_show(p->l_button);
-                       evas_object_show(p->r_button);
-                       elm_object_item_part_content_set(p->navi_it, "title_left_btn", p->l_button);
-                       elm_object_item_part_content_set(p->navi_it, "title_right_btn", p->r_button);
+                       elm_object_item_signal_emit(p->navi_it, "elm,state,sip,shown", "");
                }
        }
 }
@@ -1247,10 +1220,7 @@ static void _check2_clicked_cb2(void *data, Evas_Object *obj, const char *emissi
 
                if (state == ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW || state == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
                        debug_log("input panel show");
-                       evas_object_show(p->l_button);
-                       evas_object_show(p->r_button);
-                       elm_object_item_part_content_set(p->navi_it, "title_left_btn", p->l_button);
-                       elm_object_item_part_content_set(p->navi_it, "title_right_btn", p->r_button);
+                       elm_object_item_signal_emit(p->navi_it, "elm,state,sip,shown", "");
                }
        }
 }
@@ -1515,7 +1485,7 @@ static void _backup_input_cb(void *data, Evas_Object *obj, void *event_info)
                        p->str_password = NULL;
                }
 
-               p->str_password = g_strdup(elm_entry_entry_get(eo));
+               p->str_password = g_strdup((char *)elm_entry_markup_to_utf8(elm_entry_entry_get(eo)));
        }
 
        if (ugd->account_info == NULL) {
@@ -1663,16 +1633,10 @@ static void _input_panel_state_changed_cb(void *data, Ecore_IMF_Context *ctx, in
 
        if (state == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
                debug_log("input panel show");
-               evas_object_show(p->l_button);
-               evas_object_show(p->r_button);
-               elm_object_item_part_content_set(p->navi_it, "title_left_btn", p->l_button);
-               elm_object_item_part_content_set(p->navi_it, "title_right_btn", p->r_button);
+               elm_object_item_signal_emit(p->navi_it, "elm,state,sip,shown", "");
        } else if (state == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
                debug_log("input panel hide");
-               elm_object_item_part_content_unset(p->navi_it, "title_left_btn");
-               elm_object_item_part_content_unset(p->navi_it, "title_right_btn");
-               evas_object_hide(p->l_button);
-               evas_object_hide(p->r_button);
+               elm_object_item_signal_emit(p->navi_it, "elm,state,sip,hidden", "");
        }
 }
 
@@ -1699,6 +1663,29 @@ static void _gl_ef_sel_cb(void *data, Evas_Object *obj, void *event_info)
        }
 }
 
+static char *_gl_group_text_get(void *data, Evas_Object *obj, const char *part)
+{
+       debug_log("");
+
+       struct viewdata *vd = g_vd;
+
+       if (!strcmp(part, "elm.text")) {
+               char title_str[MAX_STR_LEN] = { 0, };
+               if (vd->ugd->account_info) {
+                       if (g_str_has_prefix(vd->ugd->account_info->name_str_id, "IDS_EMAIL"))
+                               snprintf(title_str, sizeof(title_str), "%s", _(vd->ugd->account_info->name_str_id));
+                       else
+                               snprintf(title_str, sizeof(title_str), "%s", dgettext("sys_string", vd->ugd->account_info->name_str_id));
+               } else {
+                       snprintf(title_str, sizeof(title_str), "%s", dgettext("sys_string", "IDS_COM_BODY_OTHERS"));
+               }
+
+               return g_strdup(title_str);
+       }
+
+       return NULL;
+}
+
 static Evas_Object *_gl_ef_content_get_cb(void *data, Evas_Object *obj, const char *part)
 {
        debug_log("");
diff --git a/setting/src/email-view-add-priority-sender.c b/setting/src/email-view-add-priority-sender.c
new file mode 100644 (file)
index 0000000..b71af1c
--- /dev/null
@@ -0,0 +1,877 @@
+/*
+ * 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;
+}
index b6e9526..64e80f5 100755 (executable)
@@ -320,9 +320,9 @@ static Evas_Object *_gl_content_get_cb(void *data, Evas_Object *obj, const char
        EmailSpDesc *desc = (EmailSpDesc *)data;
 
        if (desc) {
-               elm_icon_file_set(icon, desc->icon_path, NULL);
+               elm_image_file_set(icon, desc->icon_path, NULL);
        } else {
-               elm_icon_file_set(icon, ACCOUNT_ICON_OTHERS, NULL);
+               elm_image_file_set(icon, ACCOUNT_ICON_OTHERS, NULL);
        }
 
        evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
index 0aaa791..87f12b2 100755 (executable)
@@ -333,34 +333,21 @@ static void _push_naviframe(struct viewdata *vd)
        debug_log("");
        struct priv_data *p = vd->priv;
 
-       /*p->cbar = elm_toolbar_add(vd->ugd->navi_bar);
-       elm_toolbar_shrink_mode_set(p->cbar, ELM_TOOLBAR_SHRINK_EXPAND);
-       elm_object_style_set(p->cbar, "naviframe");
-       evas_object_show(p->cbar);
-
-       p->c_item[0] = elm_toolbar_item_append(p->cbar, NULL,
-                               dgettext("sys_string", "IDS_COM_SK_SET"), _save_cb, vd);
-       elm_object_item_disabled_set(p->c_item[0], EINA_TRUE);
-       elm_object_item_disabled_set(elm_toolbar_item_append(p->cbar, NULL, "", NULL, NULL), EINA_TRUE);
-       elm_object_item_disabled_set(elm_toolbar_item_append(p->cbar, NULL, "", NULL, NULL), EINA_TRUE);*/
-
        p->r_button = elm_button_add(vd->ugd->navi_bar);
-       //elm_object_style_set(p->r_button, "naviframe/title/default");
+       elm_object_style_set(p->r_button, "naviframe/toolbar/default");
        elm_object_text_set(p->r_button, dgettext("sys_string", "IDS_COM_SK_SET"));
        evas_object_smart_callback_add(p->r_button, "clicked", _save_cb, vd);
        elm_object_disabled_set(p->r_button, EINA_TRUE);
-       evas_object_hide(p->r_button);
+       evas_object_show(p->r_button);
 
        p->l_button = elm_button_add(vd->ugd->navi_bar);
-       //elm_object_style_set(p->l_button, "naviframe/title/default");
-       elm_object_text_set(p->l_button, dgettext("sys_string", "IDS_COM_SK_CANCEL"));
+       elm_object_style_set(p->l_button, "naviframe/end_btn/default");
+       /*elm_object_text_set(p->l_button, dgettext("sys_string", "IDS_COM_SK_CANCEL"));*/
        evas_object_smart_callback_add(p->l_button, "clicked", _back_cb, vd);
-       evas_object_hide(p->l_button);
+       evas_object_show(p->l_button);
 
        p->l_button2 = elm_button_add(vd->ugd->navi_bar);
-       //elm_object_style_set(p->l_button2, "naviframe/title/default");
-       elm_object_style_set(p->l_button2, "naviframe/back_btn/default");
-       //elm_object_text_set(p->l_button2, dgettext("sys_string", "IDS_COM_SK_CANCEL"));
+       elm_object_style_set(p->l_button2, "naviframe/end_btn/default");
        evas_object_smart_callback_add(p->l_button2, "clicked", _back_cb, vd);
        evas_object_show(p->l_button2);
 
@@ -371,7 +358,7 @@ static void _push_naviframe(struct viewdata *vd)
 
        Evas_Object *title_ic = elm_icon_add(vd->ugd->navi_bar);
        evas_object_size_hint_aspect_set(title_ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
-       elm_icon_resizable_set(title_ic, EINA_TRUE, EINA_TRUE);
+       elm_image_resizable_set(title_ic, EINA_TRUE, EINA_TRUE);
 
        char title_str[50] = { 0, };
        if (vd->ugd->account_info) {
@@ -380,19 +367,21 @@ static void _push_naviframe(struct viewdata *vd)
                else
                        snprintf(title_str, sizeof(title_str), "%s", dgettext("sys_string", vd->ugd->account_info->name_str_id));
 
-               elm_icon_file_set(title_ic, vd->ugd->account_info->icon_path, NULL);
+               elm_image_file_set(title_ic, vd->ugd->account_info->icon_path, NULL);
        } else {
                snprintf(title_str, sizeof(title_str), "%s", dgettext("sys_string", "IDS_COM_BODY_OTHERS"));
        }
 
        Elm_Object_Item *navi_it = NULL;
-       navi_it = elm_naviframe_item_push(vd->ugd->navi_bar, title_str, p->l_button2, NULL, p->layout, NULL);
+       navi_it = elm_naviframe_item_push(vd->ugd->navi_bar, title_str, NULL, NULL, p->layout, NULL);
+
        if (vd->ugd->account_info) {
                elm_object_item_part_content_set(navi_it, "icon", title_ic);
        }
-       /*elm_object_item_part_content_set(navi_it, "title_left_btn", p->r_button);
-       elm_object_item_part_content_set(navi_it, "title_right_btn", p->l_button);*/
+       elm_object_item_part_content_set(navi_it, "title_toolbar_button1", p->r_button);
+       elm_object_item_part_content_set(navi_it, "title_prev_btn", p->l_button);
        elm_object_item_part_content_set(navi_it, "toolbar_button1", p->tool_btn);
+       elm_object_item_part_content_set(navi_it, "prev_btn", p->l_button2);
        p->navi_it = navi_it;
        evas_object_show(vd->ugd->navi_bar);
 }
@@ -1145,16 +1134,10 @@ static void _input_panel_state_changed_cb(void *data, Ecore_IMF_Context *ctx, in
 
        if (value == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
                debug_log("input panel show");
-               evas_object_show(p->l_button);
-               evas_object_show(p->r_button);
-               elm_object_item_part_content_set(p->navi_it, "title_left_btn", p->r_button);
-               elm_object_item_part_content_set(p->navi_it, "title_right_btn", p->l_button);
+               elm_object_item_signal_emit(p->navi_it, "elm,state,sip,shown", "");
        } else if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
                debug_log("input panel hide");
-               elm_object_item_part_content_unset(p->navi_it, "title_left_btn");
-               elm_object_item_part_content_unset(p->navi_it, "title_right_btn");
-               evas_object_hide(p->l_button);
-               evas_object_hide(p->r_button);
+               elm_object_item_signal_emit(p->navi_it, "elm,state,sip,hidden", "");
        }
 }
 
diff --git a/setting/src/email-view-notification-setting.c b/setting/src/email-view-notification-setting.c
new file mode 100644 (file)
index 0000000..2c908c9
--- /dev/null
@@ -0,0 +1,798 @@
+/*
+ * 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, &notification);
+               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, &notification);
+                       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);
+}
diff --git a/setting/src/email-view-priority-senders.c b/setting/src/email-view-priority-senders.c
new file mode 100644 (file)
index 0000000..c501bc2
--- /dev/null
@@ -0,0 +1,1049 @@
+/*
+ * 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);
+}
index cb800bc..824c9c6 100755 (executable)
@@ -26,6 +26,7 @@ static int _hide(struct viewdata *vd);
 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);
@@ -355,8 +356,17 @@ static void _create_list(struct viewdata *vd)
        else
                p->default_account_item = elm_genlist_item_append(p->genlist, &(p->itc6), (void *)i, git,
                                ELM_GENLIST_ITEM_NONE, _gl_sel_cb, NULL);
-
+/* setting UI is implemented.
        i = 4;
+       elm_genlist_item_append(p->genlist, &(p->itc3), (void *)i, git,
+                       ELM_GENLIST_ITEM_NONE, _priority_senders_email_cb, (void *)vd);
+*/
+/* For Text templates
+       i = 5;
+       elm_genlist_item_append(p->genlist, &(p->itc3), (void *)i, git,
+                       ELM_GENLIST_ITEM_NONE, NULL, (void *)vd);
+*/
+       i = 6;
        git = elm_genlist_item_append(p->genlist, &(p->itc5), (void *)i, NULL,
                        ELM_GENLIST_ITEM_GROUP, NULL, NULL);
        elm_genlist_item_select_mode_set(git, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
@@ -428,6 +438,38 @@ static void _get_default_account(struct viewdata *vd)
        }
 }
 
+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("");
@@ -673,6 +715,18 @@ static char *_gl_text_get_cb(void *data, Evas_Object *obj, const char *part)
 
                if (index == 4) {
                        char buf[MAX_STR_LEN] = { 0, };
+                       snprintf(buf, sizeof(buf), "%s", _("IDS_EMAIL_BODY_PRIORITY_SENDERS"));
+                       return g_strdup(buf);
+               }
+
+               if (index == 5) {
+                       char buf[MAX_STR_LEN] = { 0, };
+                       snprintf(buf, sizeof(buf), "%s", N_("Text templates"));
+                       return g_strdup(buf);
+               }
+
+               if (index == 6) {
+                       char buf[MAX_STR_LEN] = { 0, };
                        snprintf(buf, sizeof(buf), "%s", dgettext("sys_string", "IDS_COM_BODY_ACCOUNTS"));
                        return g_strdup(buf);
                }
@@ -768,7 +822,7 @@ static Evas_Object *_gl_account_content_get_cb(void *data, Evas_Object *obj, con
 
        if (!strcmp(part, "elm.icon.1")) {
                icon = elm_icon_add(obj);
-               elm_icon_file_set(icon, account_data->logo_icon_path, NULL);
+               elm_image_file_set(icon, account_data->logo_icon_path, NULL);
                evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
                return icon;
        }
index 11de7fb..477ea8f 100755 (executable)
@@ -287,9 +287,9 @@ static Evas_Object *_gl_content_get_cb(void *data, Evas_Object *obj, const char
        EmailSpDesc *desc = (EmailSpDesc *)data;
 
        if (desc) {
-               elm_icon_file_set(icon, desc->icon_path, NULL);
+               elm_image_file_set(icon, desc->icon_path, NULL);
        } else {
-               elm_icon_file_set(icon, ACCOUNT_ICON_OTHERS, NULL);
+               elm_image_file_set(icon, ACCOUNT_ICON_OTHERS, NULL);
        }
 
        evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
index e75f361..4b117d2 100755 (executable)
@@ -334,8 +334,8 @@ static void _push_naviframe(struct viewdata *vd)
        elm_object_style_set(p->r_button, "naviframe/title_icon");
        /*elm_object_text_set(p->r_button, _("IDS_EMAIL_OPT_REFRESH"));*/
        Evas_Object *ic = elm_icon_add(p->r_button);
-       elm_icon_file_set(ic, TITLE_ICON_REFRESH, NULL);
-       elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE);
+       elm_image_file_set(ic, TITLE_ICON_REFRESH, NULL);
+       elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
        evas_object_image_smooth_scale_set(ic, 0);
        elm_object_content_set(p->r_button, ic);
        evas_object_smart_callback_add(p->r_button, "clicked", _refresh_cb, vd);
@@ -358,11 +358,11 @@ static void _push_naviframe(struct viewdata *vd)
        account_user_data_t *user_data = (account_user_data_t *)account_data->user_data;
        Evas_Object *title_ic = elm_icon_add(vd->ugd->navi_bar);
        evas_object_size_hint_aspect_set(title_ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
-       elm_icon_resizable_set(title_ic, EINA_TRUE, EINA_TRUE);
+       elm_image_resizable_set(title_ic, EINA_TRUE, EINA_TRUE);
        if (user_data->is_preset_account > 0) {
-               elm_icon_file_set(title_ic, account_data->logo_icon_path, NULL);
+               elm_image_file_set(title_ic, account_data->logo_icon_path, NULL);
        } else {
-               elm_icon_file_set(title_ic, ACCOUNT_ICON_OTHERS, NULL);
+               elm_image_file_set(title_ic, ACCOUNT_ICON_OTHERS, NULL);
        }
 
        Elm_Object_Item *navi_it = NULL;
index 211082c..1987e09 100755 (executable)
@@ -334,8 +334,8 @@ static void _push_naviframe(struct viewdata *vd)
        elm_object_style_set(p->r_button, "naviframe/title_icon");
        /*elm_object_text_set(p->r_button, _("IDS_EMAIL_OPT_REFRESH"));*/
        Evas_Object *ic = elm_icon_add(p->r_button);
-       elm_icon_file_set(ic, TITLE_ICON_REFRESH, NULL);
-       elm_icon_resizable_set(ic, EINA_TRUE, EINA_TRUE);
+       elm_image_file_set(ic, TITLE_ICON_REFRESH, NULL);
+       elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
        evas_object_image_smooth_scale_set(ic, 0);
        elm_object_content_set(p->r_button, ic);
        evas_object_smart_callback_add(p->r_button, "clicked", _refresh_cb, vd);
@@ -358,11 +358,11 @@ static void _push_naviframe(struct viewdata *vd)
        account_user_data_t *user_data = (account_user_data_t *)account_data->user_data;
        Evas_Object *title_ic = elm_icon_add(vd->ugd->navi_bar);
        evas_object_size_hint_aspect_set(title_ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
-       elm_icon_resizable_set(title_ic, EINA_TRUE, EINA_TRUE);
+       elm_image_resizable_set(title_ic, EINA_TRUE, EINA_TRUE);
        if (user_data->is_preset_account > 0) {
-               elm_icon_file_set(title_ic, account_data->logo_icon_path, NULL);
+               elm_image_file_set(title_ic, account_data->logo_icon_path, NULL);
        } else {
-               elm_icon_file_set(title_ic, ACCOUNT_ICON_OTHERS, NULL);
+               elm_image_file_set(title_ic, ACCOUNT_ICON_OTHERS, NULL);
        }
 
        Elm_Object_Item *navi_it = NULL;
index 0556598..19222b4 100755 (executable)
@@ -615,10 +615,8 @@ collections {
                                        visible: 0;
                                        min: 20 0;
                                        fixed: 1 0;
-                                       rel1.relative: 0.0 1.0;
-                                       rel2.relative: 0.0 1.0;
-                                       rel1.to: "bg";
-                                       rel2.to: "bg";
+                                       rel1 { to: "bg"; relative: 0 0; }
+                                       rel2 { to: "bg"; relative: 0 1; }
                                        align: 0.0 0.0;
                                }
                        }
@@ -631,10 +629,8 @@ collections {
                                        visible: 0;
                                        min: 20 0;
                                        fixed: 1 0;
-                                       rel1.relative: 1.0 1.0;
-                                       rel2.relative: 1.0 1.0;
-                                       rel1.to: "bg";
-                                       rel2.to: "bg";
+                                       rel1 { to: "bg"; relative: 1 0; }
+                                       rel2 { to: "bg"; relative: 1 1; }
                                        align: 1.0 0.0;
                                }
                        }
@@ -679,14 +675,10 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 0 1;
-                                       rel1.relative: 1.0 1.0;
-                                       rel1.to_x: "left_padding";
-                                       rel1.to_y: "bottom_padding";
-                                       rel2.relative: 0.0 1.0;
-                                       rel2.to_x: "right_padding";
-                                       rel2.to_y: "bg";
-                                       align: 0.5 0.5;
+                                       fixed: 1 1;
+                                       rel1 { relative: 0 1; to_x: "bg"; to_y: "bottom_padding"; offset: 25 0; }
+                                       rel2 { relative: 1 1; to_x: "bg"; to_y: "bg"; offset: -20 0; }
+                                       align: 0.0 0.0;
                                }
                        }
                }
@@ -716,18 +708,29 @@ collections {
 
                parts {
                        part {
+                               name: "bg";
+                               type: RECT;
+                               scale: 1;
+                               mouse_events: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 0.0;}
+                                       rel2 { relative: 1.0 1.0;}
+                               }
+                       }
+                       
+                       part {
                                name: "top_padding";
                                type: RECT;
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       min: 440 50;
-                                       max: 440 50;
+                                       min: 0 50;
                                        fixed: 0 1;
-                                       rel1 { relative: 0 0; }
-                                       rel2 { relative: 1 0; }
-                                       color: 0 0 0 0;
-                                       align: 0.5 0;
+                                       rel1 { relative: 0 0; to: "bg"; }
+                                       rel2 { relative: 1 0; to: "bg"; }
+                                       align: 0.0 0.0;
+                                       visible: 0;
                                }
                        }
 
@@ -737,42 +740,38 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
-                                       min: 440 50;
-                                       max: 440 50;
-                                       rel1 { relative: 0 1.0; to_y: "top_padding"; }
-                                       align: 0.0;
-                                       color: 0 0 0 0;
+                                       fixed: 0 1;
+                                       min: 0 80;
+                                       rel1 { relative: 0 1; to: "top_padding"; }
+                                       rel2 { relative: 1 1; to: "top_padding"; }
+                                       align: 0.0 0.0;
+                                       visible: 0;
                                }
                        }
-
+                       
                        part {
-                               name: "sp1";
+                               name: "sp2";
                                type: IMAGE;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
-                                       min: 50 50;
-                                       max: 50 50;
-                                       rel1 { relative: 0 0; offset: 10 0; to: "bg_for_sp"; }
-                                       rel2 { relative: 0 1; offset: 60 0; to: "bg_for_sp"; }
-                                       align: 0.5 0;
-                                       image.normal: "M02_email_list_icon_exchange.png";
+                                       min: 80 80;
+                                       rel1 { relative: 0.5 0.5; offset: -52 0; to: "bg_for_sp"; }
+                                       rel2 { relative: 0.5 0.5; offset: -52 0; to: "bg_for_sp"; }
+                                       align: 0.5 0.5;
+                                       image.normal: "M02_email_list_icon_gmail.png";
                                }
                        }
 
                        part {
-                               name: "sp2";
+                               name: "sp1";
                                type: IMAGE;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
-                                       min: 50 50;
-                                       max: 50 50;
-                                       rel1 { relative: 0 0; offset: 84 0; to: "bg_for_sp"; }
-                                       rel2 { relative: 0 1; offset: 134 0; to: "bg_for_sp"; }
-                                       align: 0.5 0;
-                                       image.normal: "M02_email_list_icon_gmail.png";
+                                       min: 80 80;
+                                       rel1 { relative: 0.0 0.5; offset: -64 0; to: "sp2"; }
+                                       rel2 { relative: 0.0 0.5; offset: -64 0; to: "sp2"; }
+                                       align: 0.5 0.5;
+                                       image.normal: "M02_email_list_icon_exchange.png";
                                }
                        }
 
@@ -781,12 +780,10 @@ collections {
                                type: IMAGE;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
-                                       min: 50 50;
-                                       max: 50 50;
-                                       rel1 { relative: 0 0; offset: 158 0; to: "bg_for_sp"; }
-                                       rel2 { relative: 0 1; offset: 208 0; to: "bg_for_sp"; }
-                                       align: 0.5 0;
+                                       min: 80 80;
+                                       rel1 { relative: 0.5 0.5; offset: 52 0; to: "bg_for_sp"; }
+                                       rel2 { relative: 0.5 0.5; offset: 52 0; to: "bg_for_sp"; }
+                                       align: 0.5 0.5;
                                        image.normal: "M02_email_list_icon_hotmail.png";
                                }
                        }
@@ -796,12 +793,10 @@ collections {
                                type: IMAGE;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
-                                       min: 50 50;
-                                       max: 50 50;
-                                       rel1 { relative: 0 0; offset: 232 0; to: "bg_for_sp"; }
-                                       rel2 { relative: 0 1; offset: 282 0; to: "bg_for_sp"; }
-                                       align: 0.5 0;
+                                       min: 80 80;
+                                       rel1 { relative: 1.0 0.5; offset: 64 0; to: "sp3"; }
+                                       rel2 { relative: 1.0 0.5; offset: 64 0; to: "sp3"; }
+                                       align: 0.5 0.5;
                                        image.normal: "M02_email_list_icon_AOL.png";
                                }
                        }
@@ -812,13 +807,12 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       min: 440 52;
-                                       max: 440 52;
-                                       fixed: 1 1;
-                                       align: 0.5 0;
-                                       rel1 { relative: 0 1.0; to_y: "bg_for_sp"; }
-                                       rel2 { relative: 1 1.0; to_y: "bg_for_sp"; }
-                                       color: 0 0 0 0;
+                                       min: 0 52;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 1.0; to_y: "bg_for_sp"; }
+                                       rel2 { relative: 1.0 1.0; to_y: "bg_for_sp"; }
+                                       align: 0.0 0.0;
+                                       visible: 0;
                                }
                        }
 
@@ -828,11 +822,26 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
-                                       min: 440 150;
-                                       max: 440 150;
-                                       rel1 { relative: 0 1.0; to_y: "middle_padding2"; }
-                                       align: 0.5 0;
+                                       fixed: 0 1;
+                                       min: 0 200;
+                                       rel1 { relative: 0.0 1.0; to_y: "middle_padding2"; offset: 50 0; }
+                                       rel2 { relative: 1.0 1.0; to_y: "middle_padding2"; offset: -50 0; }
+                                       align: 0.5 0.0;
+                               }
+                       }
+                       
+                       part {
+                               name: "middle_padding3";
+                               type: RECT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       min: 0 16;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 1.0; to_y: "label"; }
+                                       rel2 { relative: 1.0 1.0; to_y: "label"; }
+                                       align: 0.0 0.0;
+                                       visible: 0;
                                }
                        }
 
@@ -842,7 +851,8 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       rel1 { relative: 0 1.0; to_y: "label"; }
+                                       rel1 { relative: 0.0 1.0; to: "middle_padding3"; }
+                                       rel2 { relative: 1.0 1.0; to: "bg"; }
                                }
                        }
                }
@@ -858,18 +868,29 @@ collections {
 
                parts {
                        part {
+                               name: "bg";
+                               type: RECT;
+                               scale: 1;
+                               mouse_events: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 0.0;}
+                                       rel2 { relative: 1.0 1.0;}
+                               }
+                       }
+                       
+                       part {
                                name: "top_padding";
                                type: RECT;
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       min: 440 50;
-                                       max: 440 50;
+                                       min: 0 50;
                                        fixed: 0 1;
-                                       rel1 { relative: 0 0; }
-                                       rel2 { relative: 1 0; }
-                                       color: 0 0 0 0;
-                                       align: 0.5 0;
+                                       rel1 { relative: 0 0; to: "bg"; }
+                                       rel2 { relative: 1 0; to: "bg"; }
+                                       align: 0.0 0.0;
+                                       visible: 0;
                                }
                        }
 
@@ -879,42 +900,38 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
-                                       min: 440 50;
-                                       max: 440 50;
-                                       rel1 { relative: 0 1.0; to_y: "top_padding"; }
-                                       align: 0.0;
-                                       color: 0 0 0 0;
+                                       fixed: 0 1;
+                                       min: 0 80;
+                                       rel1 { relative: 0 1; to: "top_padding"; }
+                                       rel2 { relative: 1 1; to: "top_padding"; }
+                                       align: 0.0 0.0;
+                                       visible: 0;
                                }
                        }
-
+                       
                        part {
-                               name: "sp1";
+                               name: "sp2";
                                type: IMAGE;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
-                                       min: 50 50;
-                                       max: 50 50;
-                                       rel1 { relative: 0 0; offset: 50 0; to: "bg_for_sp"; }
-                                       rel2 { relative: 0 1; offset: 100 0; to: "bg_for_sp"; }
-                                       align: 0.5 0;
-                                       image.normal: "M02_email_list_icon_gmail.png";
+                                       min: 80 80;
+                                       rel1 { relative: 0.5 0.5; to: "bg_for_sp"; }
+                                       rel2 { relative: 0.5 0.5; to: "bg_for_sp"; }
+                                       align: 0.5 0.5;
+                                       image.normal: "M02_email_list_icon_hotmail.png";
                                }
                        }
 
                        part {
-                               name: "sp2";
+                               name: "sp1";
                                type: IMAGE;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
-                                       min: 50 50;
-                                       max: 50 50;
-                                       rel1 { relative: 0 0; offset: 125 0; to: "bg_for_sp"; }
-                                       rel2 { relative: 0 1; offset: 175 0; to: "bg_for_sp"; }
-                                       align: 0.5 0;
-                                       image.normal: "M02_email_list_icon_hotmail.png";
+                                       min: 80 80;
+                                       rel1 { relative: 0.0 0.5; offset: -64 0; to: "sp2"; }
+                                       rel2 { relative: 0.0 0.5; offset: -64 0; to: "sp2"; }
+                                       align: 0.5 0.5;
+                                       image.normal: "M02_email_list_icon_gmail.png";
                                }
                        }
 
@@ -923,12 +940,10 @@ collections {
                                type: IMAGE;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
-                                       min: 50 50;
-                                       max: 50 50;
-                                       rel1 { relative: 0 0; offset: 200 0; to: "bg_for_sp"; }
-                                       rel2 { relative: 0 1; offset: 250 0; to: "bg_for_sp"; }
-                                       align: 0.5 0;
+                                       min: 80 80;
+                                       rel1 { relative: 1.0 0.5; offset: 64 0; to: "sp2"; }
+                                       rel2 { relative: 1.0 0.5; offset: 64 0; to: "sp2"; }
+                                       align: 0.5 0.5;
                                        image.normal: "M02_email_list_icon_AOL.png";
                                }
                        }
@@ -939,13 +954,12 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       min: 440 52;
-                                       max: 440 52;
-                                       fixed: 1 1;
-                                       align: 0.5 0;
-                                       rel1 { relative: 0 1.0; to_y: "bg_for_sp"; }
-                                       rel2 { relative: 1 1.0; to_y: "bg_for_sp"; }
-                                       color: 0 0 0 0;
+                                       min: 0 52;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 1.0; to_y: "bg_for_sp"; }
+                                       rel2 { relative: 1.0 1.0; to_y: "bg_for_sp"; }
+                                       align: 0.0 0.0;
+                                       visible: 0;
                                }
                        }
 
@@ -955,11 +969,11 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
-                                       min: 440 200;
-                                       max: 440 200;
-                                       rel1 { relative: 0 1.0; to_y: "middle_padding2"; }
-                                       align: 0.5 0;
+                                       fixed: 0 1;
+                                       min: 0 200;
+                                       rel1 { relative: 0.0 1.0; to_y: "middle_padding2"; offset: 50 0; }
+                                       rel2 { relative: 1.0 1.0; to_y: "middle_padding2"; offset: -50 0; }
+                                       align: 0.5 0.0;
                                }
                        }
                        
@@ -969,13 +983,12 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       min: 440 16;
-                                       max: 440 16;
-                                       fixed: 1 1;
-                                       align: 0.5 0;
-                                       rel1 { relative: 0 1.0; to_y: "label"; }
-                                       rel2 { relative: 1 1.0; to_y: "label"; }
-                                       color: 0 0 0 0;
+                                       min: 0 16;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 1.0; to_y: "label"; }
+                                       rel2 { relative: 1.0 1.0; to_y: "label"; }
+                                       align: 0.0 0.0;
+                                       visible: 0;
                                }
                        }
 
@@ -985,7 +998,8 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       rel1 { relative: 0 1.0; to_y: "middle_padding3"; }
+                                       rel1 { relative: 0.0 1.0; to: "middle_padding3"; }
+                                       rel2 { relative: 1.0 1.0; to: "bg"; }
                                }
                        }
                }
@@ -1001,18 +1015,29 @@ collections {
 
                parts {
                        part {
+                               name: "bg";
+                               type: RECT;
+                               scale: 1;
+                               mouse_events: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 0.0;}
+                                       rel2 { relative: 1.0 1.0;}
+                               }
+                       }
+                       
+                       part {
                                name: "top_padding";
                                type: RECT;
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       min: 720 26;
-                                       max: 720 26;
+                                       min: 0 26;
                                        fixed: 0 1;
-                                       rel1 { relative: 0 0; }
-                                       rel2 { relative: 1 0; }
-                                       color: 0 0 0 0;
-                                       align: 0.5 0;
+                                       rel1 { relative: 0 0; to: "bg"; }
+                                       rel2 { relative: 1 0; to: "bg"; }
+                                       align: 0.0 0.0;
+                                       visible: 0;
                                }
                        }
 
@@ -1022,42 +1047,38 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
-                                       min: 720 248;
-                                       max: 720 248;
-                                       rel1 { relative: 0 1.0; to_y: "top_padding"; }
-                                       align: 0.0;
-                                       color: 0 0 0 0;
+                                       fixed: 0 1;
+                                       min: 0 248;
+                                       rel1 { relative: 0 1; to: "top_padding"; }
+                                       rel2 { relative: 1 1; to: "top_padding"; }
+                                       align: 0.0 0.0;
+                                       visible: 0;
                                }
                        }
-
+                       
                        part {
-                               name: "sp1";
+                               name: "sp2";
                                type: IMAGE;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
                                        min: 80 80;
-                                       max: 80 80;
-                                       rel1 { relative: 0 0; offset: 180 0; to: "bg_for_sp"; }
-                                       rel2 { relative: 0 1; offset: 260 0; to: "bg_for_sp"; }
+                                       rel1 { relative: 0.5 0.5; to: "bg_for_sp"; }
+                                       rel2 { relative: 0.5 0.5; to: "bg_for_sp"; }
                                        align: 0.5 0.5;
-                                       image.normal: "M02_email_list_icon_gmail.png";
+                                       image.normal: "M02_email_list_icon_hotmail.png";
                                }
                        }
 
                        part {
-                               name: "sp2";
+                               name: "sp1";
                                type: IMAGE;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
                                        min: 80 80;
-                                       max: 80 80;
-                                       rel1 { relative: 0 0; offset: 320 0; to: "bg_for_sp"; }
-                                       rel2 { relative: 0 1; offset: 400 0; to: "bg_for_sp"; }
+                                       rel1 { relative: 0.0 0.5; offset: -100 0; to: "sp2"; }
+                                       rel2 { relative: 0.0 0.5; offset: -100 0; to: "sp2"; }
                                        align: 0.5 0.5;
-                                       image.normal: "M02_email_list_icon_hotmail.png";
+                                       image.normal: "M02_email_list_icon_gmail.png";
                                }
                        }
 
@@ -1066,29 +1087,26 @@ collections {
                                type: IMAGE;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
                                        min: 80 80;
-                                       max: 80 80;
-                                       rel1 { relative: 0 0; offset: 460 0; to: "bg_for_sp"; }
-                                       rel2 { relative: 0 1; offset: 540 0; to: "bg_for_sp"; }
+                                       rel1 { relative: 1.0 0.5; offset: 100 0; to: "sp2"; }
+                                       rel2 { relative: 1.0 0.5; offset: 100 0; to: "sp2"; }
                                        align: 0.5 0.5;
                                        image.normal: "M02_email_list_icon_AOL.png";
                                }
                        }
-
+                       
                        part {
                                name: "middle_padding2";
                                type: RECT;
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       min: 720 16;
-                                       max: 720 16;
-                                       fixed: 1 1;
-                                       align: 0.5 0;
-                                       rel1 { relative: 0 1.0; to_y: "bg_for_sp"; }
-                                       rel2 { relative: 1 1.0; to_y: "bg_for_sp"; }
-                                       color: 0 0 0 0;
+                                       min: 0 16;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 1.0; to_y: "bg_for_sp"; }
+                                       rel2 { relative: 1.0 1.0; to_y: "bg_for_sp"; }
+                                       align: 0.0 0.0;
+                                       visible: 0;
                                }
                        }
 
@@ -1098,13 +1116,14 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
-                                       min: 620 114;
-                                       max: 620 114;
-                                       rel1 { relative: 0 1.0; to_y: "middle_padding2"; }
-                                       align: 0.5 0;
+                                       fixed: 0 1;
+                                       min: 0 114;
+                                       rel1 { relative: 0.0 1.0; to_y: "middle_padding2"; offset: 50 0; }
+                                       rel2 { relative: 1.0 1.0; to_y: "middle_padding2"; offset: -50 0; }
+                                       align: 0.5 0.0;
                                }
                        }
+
                        
                        part {
                                name: "middle_padding3";
@@ -1112,13 +1131,12 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       min: 720 16;
-                                       max: 720 16;
-                                       fixed: 1 1;
-                                       align: 0.5 0;
-                                       rel1 { relative: 0 1.0; to_y: "label"; }
-                                       rel2 { relative: 1 1.0; to_y: "label"; }
-                                       color: 0 0 0 0;
+                                       min: 0 16;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 1.0; to_y: "label"; }
+                                       rel2 { relative: 1.0 1.0; to_y: "label"; }
+                                       align: 0.0 0.0;
+                                       visible: 0;
                                }
                        }
 
@@ -1128,7 +1146,8 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       rel1 { relative: 0 1.0; to_y: "middle_padding3"; }
+                                       rel1 { relative: 0.0 1.0; to: "middle_padding3"; }
+                                       rel2 { relative: 1.0 1.0; to: "bg"; }
                                }
                        }
                }
@@ -1145,18 +1164,29 @@ collections {
 
                parts {
                        part {
+                               name: "bg";
+                               type: RECT;
+                               scale: 1;
+                               mouse_events: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 0.0;}
+                                       rel2 { relative: 1.0 1.0;}
+                               }
+                       }
+                       
+                       part {
                                name: "top_padding";
                                type: RECT;
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       min: 720 26;
-                                       max: 720 26;
+                                       min: 0 26;
                                        fixed: 0 1;
-                                       rel1 { relative: 0 0; }
-                                       rel2 { relative: 1 0; }
-                                       color: 0 0 0 0;
-                                       align: 0.5 0;
+                                       rel1 { relative: 0 0; to: "bg"; }
+                                       rel2 { relative: 1 0; to: "bg"; }
+                                       align: 0.0 0.0;
+                                       visible: 0;
                                }
                        }
 
@@ -1166,42 +1196,38 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
-                                       min: 720 248;
-                                       max: 720 248;
-                                       rel1 { relative: 0 1.0; to_y: "top_padding"; }
-                                       align: 0.0;
-                                       color: 0 0 0 0;
+                                       fixed: 0 1;
+                                       min: 0 248;
+                                       rel1 { relative: 0 1; to: "top_padding"; }
+                                       rel2 { relative: 1 1; to: "top_padding"; }
+                                       align: 0.0 0.0;
+                                       visible: 0;
                                }
                        }
 
                        part {
-                               name: "sp1";
+                               name: "sp2";
                                type: IMAGE;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
                                        min: 80 80;
-                                       max: 80 80;
-                                       rel1 { relative: 0 0; offset: 110 0; to: "bg_for_sp"; }
-                                       rel2 { relative: 0 1; offset: 190 0; to: "bg_for_sp"; }
+                                       rel1 { relative: 0.5 0.5; offset: -70 0; to: "bg_for_sp"; }
+                                       rel2 { relative: 0.5 0.5; offset: -70 0; to: "bg_for_sp"; }
                                        align: 0.5 0.5;
-                                       image.normal: "M02_email_list_icon_exchange.png";
+                                       image.normal: "M02_email_list_icon_gmail.png";
                                }
                        }
 
                        part {
-                               name: "sp2";
+                               name: "sp1";
                                type: IMAGE;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
                                        min: 80 80;
-                                       max: 80 80;
-                                       rel1 { relative: 0 0; offset: 250 0; to: "bg_for_sp"; }
-                                       rel2 { relative: 0 1; offset: 330 0; to: "bg_for_sp"; }
+                                       rel1 { relative: 0.0 0.5; offset: -100 0; to: "sp2"; }
+                                       rel2 { relative: 0.0 0.5; offset: -100 0; to: "sp2"; }
                                        align: 0.5 0.5;
-                                       image.normal: "M02_email_list_icon_gmail.png";
+                                       image.normal: "M02_email_list_icon_exchange.png";
                                }
                        }
 
@@ -1210,11 +1236,9 @@ collections {
                                type: IMAGE;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
                                        min: 80 80;
-                                       max: 80 80;
-                                       rel1 { relative: 0 0; offset: 390 0; to: "bg_for_sp"; }
-                                       rel2 { relative: 0 1; offset: 470 0; to: "bg_for_sp"; }
+                                       rel1 { relative: 0.5 0.5; offset: 70 0; to: "bg_for_sp"; }
+                                       rel2 { relative: 0.5 0.5; offset: 70 0; to: "bg_for_sp"; }
                                        align: 0.5 0.5;
                                        image.normal: "M02_email_list_icon_hotmail.png";
                                }
@@ -1225,29 +1249,26 @@ collections {
                                type: IMAGE;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
                                        min: 80 80;
-                                       max: 80 80;
-                                       rel1 { relative: 0 0; offset: 530 0; to: "bg_for_sp"; }
-                                       rel2 { relative: 0 1; offset: 610 0; to: "bg_for_sp"; }
+                                       rel1 { relative: 1.0 0.5; offset: 100 0; to: "sp3"; }
+                                       rel2 { relative: 1.0 0.5; offset: 100 0; to: "sp3"; }
                                        align: 0.5 0.5;
                                        image.normal: "M02_email_list_icon_AOL.png";
                                }
                        }
-
+                       
                        part {
                                name: "middle_padding2";
                                type: RECT;
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       min: 720 16;
-                                       max: 720 16;
-                                       fixed: 1 1;
-                                       align: 0.5 0;
-                                       rel1 { relative: 0 1.0; to_y: "bg_for_sp"; }
-                                       rel2 { relative: 1 1.0; to_y: "bg_for_sp"; }
-                                       color: 0 0 0 0;
+                                       min: 0 16;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 1.0; to_y: "bg_for_sp"; }
+                                       rel2 { relative: 1.0 1.0; to_y: "bg_for_sp"; }
+                                       align: 0.0 0.0;
+                                       visible: 0;
                                }
                        }
 
@@ -1257,13 +1278,14 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       fixed: 1 1;
-                                       min: 620 114;
-                                       max: 620 114;
-                                       rel1 { relative: 0 1.0; to_y: "middle_padding2"; }
-                                       align: 0.5 0;
+                                       fixed: 0 1;
+                                       min: 0 114;
+                                       rel1 { relative: 0.0 1.0; to_y: "middle_padding2"; offset: 50 0; }
+                                       rel2 { relative: 1.0 1.0; to_y: "middle_padding2"; offset: -50 0; }
+                                       align: 0.5 0.0;
                                }
                        }
+
                        
                        part {
                                name: "middle_padding3";
@@ -1272,11 +1294,11 @@ collections {
                                description {
                                        state: "default" 0.0;
                                        min: 0 16;
-                                       fixed: 1 1;
-                                       align: 0.5 0;
-                                       rel1 { relative: 0 1.0; to_y: "label"; }
-                                       rel2 { relative: 1 1.0; to_y: "label"; }
-                                       color: 0 0 0 0;
+                                       fixed: 0 1;
+                                       rel1 { relative: 0.0 1.0; to_y: "label"; }
+                                       rel2 { relative: 1.0 1.0; to_y: "label"; }
+                                       align: 0.0 0.0;
+                                       visible: 0;
                                }
                        }
 
@@ -1286,7 +1308,8 @@ collections {
                                scale: 1;
                                description {
                                        state: "default" 0.0;
-                                       rel1 { relative: 0 1.0; to_y: "middle_padding3"; }
+                                       rel1 { relative: 0.0 1.0; to: "middle_padding3"; }
+                                       rel2 { relative: 1.0 1.0; to: "bg"; }
                                }
                        }
                }
@@ -1867,7 +1890,7 @@ collections {
                                repeat_events: 1;
                                scale: 1;
                                description { state: "default" 0.0;
-                                       min: 0 653;
+                                       min: 0 673;
                                        rel1 { relative: 0.0 0.0;}
                                        rel2 { relative: 1.0 1.0;}
                                        color: 0 0 0 0;
@@ -1881,7 +1904,7 @@ collections {
                                description { state: "default" 0.0;
                                        align: 0 0;
                                        rel1 { relative: 0 0; to: "bg"; }
-                                       rel2 { relative: 1 0; offset: 0 295; to: "bg"; }
+                                       rel2 { relative: 1 0; offset: 0 315; to: "bg"; }
                                }
                        }
 
@@ -1903,7 +1926,7 @@ collections {
                                        min: 0 158;
                                        align: 0 0;
                                        rel1 { relative: 0 1.0; to_y: "checkbox_set"; }
-                                       rel2 { relative: 1 1.0; offset: 0 128; to_y: "checkbox_set"; }
+                                       rel2 { relative: 1 1.0; offset: 0 158; to_y: "checkbox_set"; }
                                }
                        }
                }
@@ -1916,7 +1939,7 @@ collections {
                                repeat_events: 1;
                                scale: 1;
                                description { state: "default" 0.0;
-                                       min: 0 783;
+                                       min: 0 803;
                                        rel1 { relative: 0.0 0.0;}
                                        rel2 { relative: 1.0 1.0;}
                                        color: 0 0 0 0;
@@ -1930,7 +1953,7 @@ collections {
                                description { state: "default" 0.0;
                                        align: 0 0;
                                        rel1 { relative: 0 0; to: "bg"; }
-                                       rel2 { relative: 1 0; offset: 0 425; to: "bg"; }
+                                       rel2 { relative: 1 0; offset: 0 445; to: "bg"; }
                                }
                        }
 
@@ -1952,7 +1975,7 @@ collections {
                                        min: 0 158;
                                        align: 0 0;
                                        rel1 { relative: 0 1.0; to_y: "checkbox_set"; }
-                                       rel2 { relative: 1 1.0; offset: 0 128; to_y: "checkbox_set"; }
+                                       rel2 { relative: 1 1.0; offset: 0 158; to_y: "checkbox_set"; }
                                }
                        }
                }
@@ -1967,7 +1990,7 @@ collections {
                                repeat_events: 1;
                                scale: 1;
                                description { state: "default" 0.0;
-                                       min: 0 653;
+                                       min: 0 673;
                                        rel1 { relative: 0.0 0.0;}
                                        rel2 { relative: 1.0 1.0;}
                                        color: 0 0 0 0;
@@ -1981,7 +2004,7 @@ collections {
                                description { state: "default" 0.0;
                                        align: 0 0;
                                        rel1 { relative: 0 0; to: "bg"; }
-                                       rel2 { relative: 1 0; offset: 0 200.0*_SCALE; to: "bg"; }
+                                       rel2 { relative: 1 0; offset: 0 220.0*_SCALE; to: "bg"; }
                                }
                        }
 
@@ -2016,7 +2039,7 @@ collections {
                                repeat_events: 1;
                                scale: 1;
                                description { state: "default" 0.0;
-                                       min: 0 783;
+                                       min: 0 803;
                                        rel1 { relative: 0.0 0.0;}
                                        rel2 { relative: 1.0 1.0;}
                                        color: 0 0 0 0;
@@ -2030,7 +2053,7 @@ collections {
                                description { state: "default" 0.0;
                                        align: 0 0;
                                        rel1 { relative: 0 0; to: "bg"; }
-                                       rel2 { relative: 1 0; offset: 0 290.0*_SCALE; to: "bg"; }
+                                       rel2 { relative: 1 0; offset: 0 310.0*_SCALE; to: "bg"; }
                                }
                        }