From 1de0494f185a7b7d0662ea583a0ca3252f39bab9 Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Mon, 9 Sep 2019 11:34:49 +0900 Subject: [PATCH] Implement OOBE view #6 - Change popup style for OOBE. Change-Id: Iaa4c728663f942b4b4709b56f917269f1e3d13c9 --- packaging/wifi-efl-ug.spec | 2 +- sources/libraries/Common/common_eap_connect.c | 82 ++++++++++++++-------- sources/libraries/Common/common_pswd_popup.c | 6 +- sources/libraries/Common/common_utils.c | 47 +++++++++++-- .../libraries/Common/include/common_pswd_popup.h | 1 + sources/libraries/Common/include/common_utils.h | 3 + sources/libraries/i18nManager/i18nmanager.c | 3 + .../libraries/i18nManager/include/i18nmanager.h | 2 + sources/ui-gadget/viewers-layout/viewer_manager.c | 4 ++ .../ui-gadget/viewers-layout/wifi_viewer_list.c | 8 +++ sources/ui-gadget/wifi-efl-UG.c | 1 + 11 files changed, 121 insertions(+), 38 deletions(-) diff --git a/packaging/wifi-efl-ug.spec b/packaging/wifi-efl-ug.spec index 42a2823..c0b6aee 100644 --- a/packaging/wifi-efl-ug.spec +++ b/packaging/wifi-efl-ug.spec @@ -1,6 +1,6 @@ Name: wifi-efl-ug Summary: Wi-Fi UI Gadget for TIZEN -Version: 1.0.241 +Version: 1.0.242 Release: 1 Group: App/Network License: Flora-1.1 diff --git a/sources/libraries/Common/common_eap_connect.c b/sources/libraries/Common/common_eap_connect.c index ed8dd0d..5645acb 100755 --- a/sources/libraries/Common/common_eap_connect.c +++ b/sources/libraries/Common/common_eap_connect.c @@ -525,23 +525,23 @@ static Evas_Object *_gl_eap_user_cert_content_get(void *data, Evas_Object *btn = NULL; Evas_Object *ly = NULL; char buf[100]; + int ug_type; if (!strcmp(part, "elm.swallow.icon.0")) { - ly = elm_layout_add(obj); - elm_layout_file_set(ly, CUSTOM_EDITFIELD_PATH, - "eap_dropdown_button"); - btn = elm_button_add(obj); - - if (eap_data->cert_alias == NULL) { - g_snprintf(buf, sizeof(buf), "%s", - sc(eap_data->str_pkg_name, I18N_TYPE_None)); - } else { - g_snprintf(buf, sizeof(buf), "%s", - eap_data->cert_alias); + ug_type = common_util_get_ug_type(); + if (ug_type != UG_VIEW_OOBE) { + ly = elm_layout_add(obj); + elm_layout_file_set(ly, CUSTOM_EDITFIELD_PATH, + "eap_dropdown_button"); } + btn = elm_button_add(obj); + g_snprintf(buf, sizeof(buf), "%s", + eap_data->cert_alias ? eap_data->cert_alias + : sc(eap_data->str_pkg_name, I18N_TYPE_None)); + elm_object_domain_translatable_text_set(btn, PACKAGE, buf); - elm_object_style_set(btn, "dropdown/label"); + elm_object_style_set(btn, ug_type == UG_VIEW_OOBE ? "cancel" : "dropdown/label"); evas_object_propagate_events_set(btn, EINA_FALSE); evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -550,8 +550,10 @@ static Evas_Object *_gl_eap_user_cert_content_get(void *data, evas_object_smart_callback_add(btn, "clicked", _gl_eap_cert_list_btn_cb, eap_data); - elm_layout_content_set(ly, "btn", btn); - return ly; + if (ug_type != UG_VIEW_OOBE) { + elm_layout_content_set(ly, "btn", btn); + return ly; + } } return NULL; } @@ -645,18 +647,22 @@ static Evas_Object *_gl_eap_type_content_get(void *data, Evas_Object *btn = NULL; Evas_Object *ly = NULL; char buf[100]; + int ug_type; if (!strcmp(part, "elm.swallow.icon.0")) { - ly = elm_layout_add(obj); - elm_layout_file_set(ly, CUSTOM_EDITFIELD_PATH, - "eap_dropdown_button"); + ug_type = common_util_get_ug_type(); + if (ug_type != UG_VIEW_OOBE) { + ly = elm_layout_add(obj); + elm_layout_file_set(ly, CUSTOM_EDITFIELD_PATH, + "eap_dropdown_button"); + } btn = elm_button_add(obj); - - g_snprintf(buf, sizeof(buf), "%s", + g_snprintf(buf, sizeof(buf), "%s", list_eap_type[sel_sub_item_id].name); elm_object_text_set(btn, buf); - elm_object_style_set(btn, "dropdown/label"); + elm_object_style_set(btn, ug_type == UG_VIEW_OOBE ? + "cancel" : "dropdown/label"); evas_object_propagate_events_set(btn, EINA_FALSE); evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -665,8 +671,11 @@ static Evas_Object *_gl_eap_type_content_get(void *data, evas_object_smart_callback_add(btn, "clicked", _gl_eap_type_btn_cb, eap_data); - elm_layout_content_set(ly, "btn", btn); - return ly; + if (ug_type != UG_VIEW_OOBE) { + elm_layout_content_set(ly, "btn", btn); + return ly; + } + return btn; } return NULL; } @@ -785,22 +794,26 @@ static Evas_Object *_gl_eap_auth_content_get(void *data, Evas_Object *btn = NULL; Evas_Object *ly = NULL; char buf[100]; + int ug_type; if (!strcmp(part, "elm.swallow.icon.0")) { - ly = elm_layout_add(obj); - elm_layout_file_set(ly, CUSTOM_EDITFIELD_PATH, "eap_dropdown_button"); - btn = elm_button_add(obj); + ug_type = common_util_get_ug_type(); + if (ug_type != UG_VIEW_OOBE) { + ly = elm_layout_add(obj); + elm_layout_file_set(ly, CUSTOM_EDITFIELD_PATH, "eap_dropdown_button"); + } + btn = elm_button_add(obj); if (sel_sub_item_id == EAP_SEC_AUTH_NONE) { - g_snprintf(buf, sizeof(buf), "%s", + g_snprintf(buf, sizeof(buf), "%s", sc(PACKAGE, I18N_TYPE_None)); } else { - g_snprintf(buf, sizeof(buf), "%s", + g_snprintf(buf, sizeof(buf), "%s", list_eap_auth[sel_sub_item_id].name); } elm_object_domain_translatable_text_set(btn, PACKAGE, buf); - elm_object_style_set(btn, "dropdown/label"); + elm_object_style_set(btn, ug_type == UG_VIEW_OOBE ? "cancel" : "dropdown/label"); evas_object_propagate_events_set(btn, EINA_FALSE); evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -809,8 +822,11 @@ static Evas_Object *_gl_eap_auth_content_get(void *data, evas_object_smart_callback_add(btn, "clicked", _gl_eap_auth_btn_cb, eap_data); - elm_layout_content_set(ly, "btn", btn); - return ly; + if (ug_type != UG_VIEW_OOBE) { + elm_layout_content_set(ly, "btn", btn); + return ly; + } + return btn; } return NULL; } @@ -1162,8 +1178,10 @@ static Evas_Object *_gl_eap_chkbox_item_content_get(void *data, if (!strcmp("elm.swallow.icon", part)) { check = elm_check_add(obj); - evas_object_propagate_events_set(check, EINA_FALSE); + if (common_util_get_ug_type() == UG_VIEW_OOBE) + elm_object_style_set(check, "oobe-casual"); + evas_object_propagate_events_set(check, EINA_FALSE); evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_smart_callback_add(check, "changed", @@ -2056,6 +2074,8 @@ eap_connect_data_t *create_eap_view(Evas_Object *layout_main, Evas_Object *win, memset(&popup_btn_data, 0, sizeof(popup_btn_data)); popup_btn_data.title_txt = device_info->ssid; + popup_btn_data.sub_title_txt = common_utils_get_ap_security_type_info_txt(PACKAGE, + device_info, false); popup_btn_data.btn1_cb = __common_eap_connect_destroy_cb; popup_btn_data.btn1_data = eap_data; popup_btn_data.btn1_txt = "IDS_WIFI_SK_CANCEL"; diff --git a/sources/libraries/Common/common_pswd_popup.c b/sources/libraries/Common/common_pswd_popup.c index 1d98678..ba84db8 100755 --- a/sources/libraries/Common/common_pswd_popup.c +++ b/sources/libraries/Common/common_pswd_popup.c @@ -20,6 +20,7 @@ #include #include "common.h" +#include "common_utils.h" #include "common_pswd_popup.h" #include "common_generate_pin.h" #include "i18nmanager.h" @@ -530,6 +531,9 @@ static Evas_Object *_gl_pswd_check_box_item_content_get(void *data, if (!strcmp("elm.swallow.icon", part)) { check = elm_check_add(obj); + if (common_util_get_ug_type() == UG_VIEW_OOBE) + elm_object_style_set(check, "oobe-casual"); + evas_object_propagate_events_set(check, EINA_FALSE); evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL); @@ -664,7 +668,7 @@ pswd_popup_t *create_passwd_popup(Evas_Object *conformant, Evas_Object *win_main memset(&popup_btn_data, 0, sizeof(popup_btn_data)); popup_btn_data.title_txt = popup_info->title; - //popup_btn_data.sub_title_txt = popup_info->sec_type + popup_btn_data.sub_title_txt = popup_info->sub_title; popup_btn_data.btn1_cb = popup_info->cancel_cb; popup_btn_data.btn1_data = popup_info->cb_data; popup_btn_data.btn1_txt = "IDS_WIFI_SK_CANCEL"; diff --git a/sources/libraries/Common/common_utils.c b/sources/libraries/Common/common_utils.c index 6a98206..b95292d 100755 --- a/sources/libraries/Common/common_utils.c +++ b/sources/libraries/Common/common_utils.c @@ -48,6 +48,7 @@ typedef enum { } tizen_model_t; static tizen_model_t emulator = TIZEN_MODEL_UNKNOWN; +static UG_TYPE g_ug_type = UG_VIEW_DEFAULT; typedef struct { char *title_str; @@ -377,20 +378,36 @@ Evas_Object *common_utils_show_info_popup(Evas_Object *parent, Evas_Object *popup = elm_popup_add(parent); char *txt = NULL; + double vertical = g_ug_type == UG_VIEW_OOBE ? 0.5 : 1.0; if (!popup) { ERROR_LOG(UG_NAME_ERR, "Could not add popup"); return NULL; } - elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); + elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, vertical); evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); if (popup_data->title_txt) { + char *full_txt = NULL; txt = evas_textblock_text_utf8_to_markup(NULL, popup_data->title_txt); + if (g_ug_type == UG_VIEW_OOBE) + full_txt = g_strdup_printf("%s: %s", + sc(PACKAGE, I18N_TYPE_Ssid), txt); elm_object_domain_translatable_part_text_set(popup, - "title,text", PACKAGE, txt); + "title,text", PACKAGE, g_ug_type == UG_VIEW_OOBE ? full_txt : txt); g_free(txt); + g_free(full_txt); + txt = NULL; + } + + if (g_ug_type == UG_VIEW_OOBE && popup_data->sub_title_txt) { + txt = g_strdup_printf("%s: %s", + sc(PACKAGE, I18N_TYPE_Security), + popup_data->sub_title_txt); + elm_object_part_text_set(popup, "subtitle,text", txt); + g_free(txt); + txt = NULL; } if (popup_data->info_txt) { @@ -400,8 +417,13 @@ Evas_Object *common_utils_show_info_popup(Evas_Object *parent, if (popup_data->btn1_txt) { Evas_Object *btn_1 = elm_button_add(popup); - elm_object_style_set(btn_1, "popup"); - elm_object_domain_translatable_text_set(btn_1, PACKAGE , + + if (g_ug_type== UG_VIEW_OOBE) + elm_object_style_set(btn_1, "cancel"); + else + elm_object_style_set(btn_1, "popup"); + + elm_object_domain_translatable_text_set(btn_1, PACKAGE, popup_data->btn1_txt); elm_object_part_content_set(popup, "button1", btn_1); if (popup_data->btn1_cb) { @@ -419,7 +441,12 @@ Evas_Object *common_utils_show_info_popup(Evas_Object *parent, if (popup_data->btn2_txt) { Evas_Object *btn_2 = elm_button_add(popup); - elm_object_style_set(btn_2, "popup"); + + if (g_ug_type == UG_VIEW_OOBE) + elm_object_style_set(btn_2, "connect"); + else + elm_object_style_set(btn_2, "popup"); + /* This button reference used in case of hidden AP case */ popup_data->btn = btn_2; elm_object_domain_translatable_text_set(btn_2, PACKAGE, @@ -814,3 +841,13 @@ Eina_Bool _is_emulator(void) return EINA_FALSE; } } + +void common_util_set_ug_type(UG_TYPE type) +{ + g_ug_type = type; +} + +UG_TYPE common_util_get_ug_type(void) +{ + return g_ug_type; +} diff --git a/sources/libraries/Common/include/common_pswd_popup.h b/sources/libraries/Common/include/common_pswd_popup.h index d924dec..6d1d649 100644 --- a/sources/libraries/Common/include/common_pswd_popup.h +++ b/sources/libraries/Common/include/common_pswd_popup.h @@ -38,6 +38,7 @@ typedef enum { typedef struct { char *title; + char *sub_title; Eina_Bool show_wps_btn; Evas_Smart_Cb ok_cb; Evas_Smart_Cb cancel_cb; diff --git a/sources/libraries/Common/include/common_utils.h b/sources/libraries/Common/include/common_utils.h index e9c8bce..2cd3227 100755 --- a/sources/libraries/Common/include/common_utils.h +++ b/sources/libraries/Common/include/common_utils.h @@ -129,6 +129,9 @@ void common_util_manager_ecore_scan_update_timer_reset(void); int common_utils_get_sim_state(void); Eina_Bool _is_emulator(void); + +void common_util_set_ug_type(UG_TYPE type); +UG_TYPE common_util_get_ug_type(void); #ifdef __cplusplus } #endif diff --git a/sources/libraries/i18nManager/i18nmanager.c b/sources/libraries/i18nManager/i18nmanager.c index 7cf8008..8f47814 100644 --- a/sources/libraries/i18nManager/i18nmanager.c +++ b/sources/libraries/i18nManager/i18nmanager.c @@ -237,6 +237,9 @@ char* i18n_manager_get_text(const char *pkg_name, I18N_TYPES type) case I18N_TYPE_Turn_on_wifi_to_view_available_networks: return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_WIFI_BODY_TURN_ON_WI_FI_TO_VIEW_A_LIST_OF_AVAILABLE_NETWORKS"); + case I18N_TYPE_Security: + return apply_i18n(pkg_name, I18N_MODE_SELF_MADE, "IDS_ST_BUTTON_SECURITY_ABB"); + default: return apply_i18n(pkg_name, I18N_MODE_NO_NEEDED, "(debugapplying_i18n_failed"); } diff --git a/sources/libraries/i18nManager/include/i18nmanager.h b/sources/libraries/i18nManager/include/i18nmanager.h index 6f8506f..831feaf 100755 --- a/sources/libraries/i18nManager/include/i18nmanager.h +++ b/sources/libraries/i18nManager/include/i18nmanager.h @@ -135,6 +135,8 @@ typedef enum { I18N_TYPE_Install_certificate, I18N_TYPE_SIM_method_desc_popup, I18N_TYPE_Turn_on_wifi_to_view_available_networks, + + I18N_TYPE_Security, } I18N_TYPES; char* i18n_manager_get_text(const char *pkg_name, I18N_TYPES type); diff --git a/sources/ui-gadget/viewers-layout/viewer_manager.c b/sources/ui-gadget/viewers-layout/viewer_manager.c index f7004a7..46ad46d 100755 --- a/sources/ui-gadget/viewers-layout/viewer_manager.c +++ b/sources/ui-gadget/viewers-layout/viewer_manager.c @@ -2161,6 +2161,7 @@ void viewer_manager_specific_scan_response_hlr( popup_btn_info_t popup_btn_data; memset(&popup_btn_data, 0, sizeof(popup_btn_data)); popup_btn_data.title_txt = g_strdup(ssid); + popup_btn_data.sub_title_txt = NULL; popup_btn_data.info_txt = "IDS_WIFI_BODY_A_WI_FI_NETWORK_HAS_BEEN_DETECTED_YOU_WILL_BE_CONNECTED"; popup_btn_data.btn1_txt = "IDS_WIFI_SK_CANCEL"; popup_btn_data.btn1_cb = hidden_ap_connect_cancel_cb; @@ -2238,6 +2239,8 @@ void viewer_manager_specific_scan_response_hlr( * Do not use WPS method in here. */ popup_info.title = (char *)ssid; + popup_info.sub_title = common_utils_get_ap_security_type_info_txt(PACKAGE, + gdata->device_info, false); popup_info.ok_cb = hidden_ap_connect_ok_cb; popup_info.cancel_cb = hidden_ap_connect_cancel_cb; popup_info.cb_data = hidden_ap_data; @@ -2252,6 +2255,7 @@ void viewer_manager_specific_scan_response_hlr( INFO_LOG(UG_NAME_ERR, "Fail to create password popup"); manager_object->hidden_popup_data = hidden_ap_data; + g_free(popup_info.sub_title); break; default: diff --git a/sources/ui-gadget/viewers-layout/wifi_viewer_list.c b/sources/ui-gadget/viewers-layout/wifi_viewer_list.c index ae0cec6..1053f9f 100755 --- a/sources/ui-gadget/viewers-layout/wifi_viewer_list.c +++ b/sources/ui-gadget/viewers-layout/wifi_viewer_list.c @@ -632,6 +632,9 @@ void viewer_list_wifi_reconnect(wifi_device_info_t *device_info) device_info_temp = view_list_item_device_info_create(device_info->ap); popup_info.title = device_info->ssid; + popup_info.sub_title = common_utils_get_ap_security_type_info_txt(PACKAGE, + device_info, false); + popup_info.ok_cb = __passwd_popup_ok_cb; popup_info.cancel_cb = __passwd_popup_cancel_cb; popup_info.show_wps_btn = device_info->wps_mode; @@ -649,6 +652,7 @@ void viewer_list_wifi_reconnect(wifi_device_info_t *device_info) if (ug_app_state->passpopup == NULL) INFO_LOG(UG_NAME_ERR, "Fail to create password popup"); + g_free(popup_info.sub_title); break; case WIFI_MANAGER_SECURITY_TYPE_EAP: ug_app_state->eap_view = create_eap_view( @@ -710,6 +714,9 @@ void viewer_list_wifi_connect(wifi_device_info_t *device_info) dev_info_temp = view_list_item_device_info_create(device_info->ap); popup_info.title = device_info->ssid; + popup_info.sub_title = common_utils_get_ap_security_type_info_txt(PACKAGE, + device_info, false); + popup_info.ok_cb = __passwd_popup_ok_cb; popup_info.cancel_cb = __passwd_popup_cancel_cb; popup_info.show_wps_btn = device_info->wps_mode; @@ -727,6 +734,7 @@ void viewer_list_wifi_connect(wifi_device_info_t *device_info) if (ug_app_state->passpopup == NULL) INFO_LOG(UG_NAME_ERR, "Fail to create password popup"); + g_free(popup_info.sub_title); break; case WIFI_MANAGER_SECURITY_TYPE_EAP: diff --git a/sources/ui-gadget/wifi-efl-UG.c b/sources/ui-gadget/wifi-efl-UG.c index 3381e9b..a86c002 100755 --- a/sources/ui-gadget/wifi-efl-UG.c +++ b/sources/ui-gadget/wifi-efl-UG.c @@ -108,6 +108,7 @@ static void *on_create(ui_gadget_h ug, enum ug_mode mode, if (g_strcmp0(caller, "pwlock") == 0) { ugd->elm_conform = ug_get_conformant(); ug_app_state->ug_type = UG_VIEW_OOBE; + common_util_set_ug_type(UG_VIEW_OOBE); } else if (g_strcmp0(caller, "notification") == 0) { /* Remove the "WiFi networks found" from the notification tray.*/ common_util_managed_idle_add(__wifi_efl_ug_del_found_ap_noti, NULL); -- 2.7.4