X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmh_view_wifi_setup.c;h=f7661109091302dca24dee5f03a3e067fcf99493;hb=3e3613f29fdfc1804097c0df5a5fb09ac0a43a25;hp=c439c54bae5db6165dc718fb37ac6a1c0cfc0f93;hpb=fc6e2bbb0c8bc1730e23a6e984d1f2de6f95fd87;p=apps%2Fnative%2Fug-mobile-ap.git diff --git a/src/mh_view_wifi_setup.c b/src/mh_view_wifi_setup.c old mode 100644 new mode 100755 index c439c54..f766110 --- a/src/mh_view_wifi_setup.c +++ b/src/mh_view_wifi_setup.c @@ -16,10 +16,15 @@ * limitations under the License. * */ +#include +#include "mh_popup.h" #include "mh_view_wifi_setup.h" +#include "mh_string.h" -static void __back_btn_cb(void *data, Evas_Object *obj, void *event_info); +static void __gl_realized(void *data, Evas_Object *obj, void *event_info); +static void __cancel_btn_cb(void *data, Evas_Object *object, void *event_info); +static void __save_btn_cb(void *data, Evas_Object *object, void *event_info); static void __hide_btn_changed_cb(void *data, Evas_Object *obj, void *event_info) { @@ -31,18 +36,32 @@ static void __hide_btn_changed_cb(void *data, Evas_Object *obj, void *event_info } mh_appdata_t *ad = (mh_appdata_t *)data; + + ad->setup.visibility_new = !ad->setup.visibility_new; + + __MOBILE_AP_FUNC_EXIT__; +} + +static bool __save_hide_btn_change(mh_appdata_t *ad) +{ + __MOBILE_AP_FUNC_ENTER__; + + if (ad == NULL) { + ERR("Invalid param\n"); + return false; + } + int ret = 0; ret = tethering_wifi_set_ssid_visibility(ad->handle, - !ad->setup.visibility); + ad->setup.visibility_new); if (ret != TETHERING_ERROR_NONE) { ERR("tethering_wifi_set_ssid_visibility is failed : %d\n", ret); - return; + return false; } - ad->setup.visibility = !ad->setup.visibility; - __MOBILE_AP_FUNC_EXIT__; + return true; } static void __security_btn_changed_cb(void *data, Evas_Object *obj, void *event_info) @@ -55,69 +74,89 @@ static void __security_btn_changed_cb(void *data, Evas_Object *obj, void *event_ } mh_appdata_t *ad = (mh_appdata_t *)data; - Eina_Bool pw_disabled = EINA_FALSE; - tethering_wifi_security_type_e temp_security_type; - int ret = 0; + mh_wifi_setting_view_t *st = &ad->setup; - if (ad->setup.security_type == TETHERING_WIFI_SECURITY_TYPE_NONE) - temp_security_type = TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK; + if (st->security_type_new == TETHERING_WIFI_SECURITY_TYPE_NONE) + st->security_type_new = TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK; else - temp_security_type = TETHERING_WIFI_SECURITY_TYPE_NONE; + st->security_type_new = TETHERING_WIFI_SECURITY_TYPE_NONE; - ret = tethering_wifi_set_security_type(ad->handle, temp_security_type); - if (ret != TETHERING_ERROR_NONE) { - ERR("tethering_wifi_set_security_type is failed : %d\n", ret); - return; + /* update wifi passphrase item */ + if (st->security_type_new == TETHERING_WIFI_SECURITY_TYPE_NONE) { + elm_object_item_disabled_set(st->pw_item, EINA_TRUE); + elm_object_disabled_set(st->save_button, EINA_FALSE); + } else { + elm_object_item_disabled_set(st->pw_item, EINA_FALSE); } - ad->setup.security_type = temp_security_type; - pw_disabled = ad->setup.security_type != TETHERING_WIFI_SECURITY_TYPE_NONE ? - EINA_FALSE : EINA_TRUE; - DBG("security_type : %d, pw_disabled : %d\n", ad->setup.security_type, pw_disabled); - - elm_object_item_disabled_set(ad->setup.pw_item, pw_disabled); - elm_genlist_item_update(ad->setup.pw_item); + if (st->pw_item) + elm_genlist_item_update(st->pw_item); __MOBILE_AP_FUNC_EXIT__; } -static char *__gl_hide_label_get(void *data, Evas_Object *obj, const char *part) +static bool __save_security_btn_change(mh_appdata_t *ad) { __MOBILE_AP_FUNC_ENTER__; - if (data == NULL || obj == NULL || part == NULL) { + if (ad == NULL) { ERR("Invalid param\n"); - return NULL; + return false; } - if (strcmp(part, "elm.text") != 0) { - ERR("Invalid param\n"); - return NULL; + int ret = 0; + + ret = tethering_wifi_set_security_type(ad->handle, ad->setup.security_type_new); + if (ret != TETHERING_ERROR_NONE) { + ERR("tethering_wifi_set_security_type is failed : %d\n", ret); + return false; } __MOBILE_AP_FUNC_EXIT__; - return strdup(_("IDS_MOBILEAP_BODY_HIDE_MY_DEVICE")); + return true; } -static char *__gl_security_label_get(void *data, Evas_Object *obj, const char *part) +static char *__gl_device_name_title_label_get(void *data, Evas_Object *obj, const char *part) { __MOBILE_AP_FUNC_ENTER__; + mh_appdata_t *ad = (mh_appdata_t *)data; + char *device_name_utf = NULL; + char *ptr = NULL; + char buf[MH_LABEL_LENGTH_MAX] = {0, }; if (data == NULL || obj == NULL || part == NULL) { ERR("Invalid param\n"); return NULL; } - if (strcmp(part, "elm.text") != 0) { - ERR("Invalid param\n"); - return NULL; + if (!strcmp("elm.text.multiline", part)) { + device_name_utf = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR); + if (device_name_utf == NULL) + ERR("vconf_get_str failed \n"); + + ptr = elm_entry_utf8_to_markup(device_name_utf); + if (ptr == NULL) { + ERR("elm_entry_utf8_to_markup is failed\n"); + free(device_name_utf); + return NULL; + } + + g_strlcpy(ad->setup.device_name, ptr, + sizeof(ad->setup.device_name)); + + snprintf(buf, MH_LABEL_LENGTH_MAX, "%s
%s", STR_MY_DEVICE_NAME, ptr); + + free(device_name_utf); + free(ptr); + + return strdup(buf); } __MOBILE_AP_FUNC_EXIT__; - return strdup(_("IDS_MOBILEAP_BODY_SECURITY")); + return NULL; } -static char *__gl_name_label_get(void *data, Evas_Object *obj, const char *part) +static char *__gl_hide_label_get(void *data, Evas_Object *obj, const char *part) { __MOBILE_AP_FUNC_ENTER__; @@ -126,40 +165,27 @@ static char *__gl_name_label_get(void *data, Evas_Object *obj, const char *part) return NULL; } - if (strcmp(part, "elm.text.1") != 0) { - ERR("Invalid param\n"); - return NULL; - } + if (!strcmp("elm.text", part)) + return strdup(STR_HIDE_MY_DEV); - mh_appdata_t *ad = (mh_appdata_t *)data; - char label[MH_LABEL_LENGTH_MAX] = {0, }; - char name_change_label[MH_LABEL_LENGTH_MAX] = {0, }; - char path[MH_LABEL_LENGTH_MAX] = {0, }; - char *device_name = NULL; + __MOBILE_AP_FUNC_EXIT__; + return NULL; +} - DBG("Device name : %s\n", ad->setup.device_name); +static char *__gl_security_label_get(void *data, Evas_Object *obj, const char *part) +{ + __MOBILE_AP_FUNC_ENTER__; - device_name = elm_entry_utf8_to_markup(ad->setup.device_name); - if (device_name == NULL) { - ERR("elm_entry_utf8_to_markup is failed\n"); + if (data == NULL || obj == NULL || part == NULL) { + ERR("Invalid param\n"); return NULL; } - snprintf(path, sizeof(path), "%s > %s", - S_("IDS_COM_BODY_SETTINGS"), - _("IDS_ST_BODY_ABOUT_PHONE")); - snprintf(name_change_label, sizeof(name_change_label), - _("IDS_MOBILEAP_BODY_DEVICE_NAME_CAN_BE_CHANGED_IN_PS"), - path); - snprintf(label, sizeof(label), "%s: %s
%s", - _("IDS_MOBILEAP_BODY_DEVICE_NAME"), - device_name, - name_change_label); - free(device_name); + if (!strcmp("elm.text", part)) + return strdup(STR_SECURITY_TYPE); __MOBILE_AP_FUNC_EXIT__; - - return strdup(label); + return NULL; } static Evas_Object *__gl_hide_icon_get(void *data, Evas_Object *obj, @@ -167,33 +193,31 @@ static Evas_Object *__gl_hide_icon_get(void *data, Evas_Object *obj, { __MOBILE_AP_FUNC_ENTER__; - if (data == NULL || obj == NULL || part == NULL) { - ERR("Invalid param\n"); - return NULL; - } + mh_appdata_t *ad = (mh_appdata_t *)data; + Evas_Object *btn = NULL; - if (strcmp(part, "elm.icon") != 0) { + if (data == NULL || obj == NULL || part == NULL) { ERR("Invalid param\n"); return NULL; } - mh_appdata_t *ad = (mh_appdata_t *)data; - Evas_Object *btn = NULL; + if (!strcmp("elm.swallow.end", part)) { + btn = elm_check_add(obj); + if (btn == NULL) { + ERR("btn is NULL\n"); + return NULL; + } - btn = elm_check_add(obj); - if (btn == NULL) { - ERR("btn is NULL\n"); - return NULL; + elm_object_style_set(btn, "on&off"); + evas_object_show(btn); + evas_object_pass_events_set(btn, EINA_TRUE); + evas_object_propagate_events_set(btn, EINA_FALSE); + elm_object_focus_allow_set(btn, EINA_FALSE); + elm_check_state_set(btn, ad->setup.visibility_new ? EINA_FALSE : EINA_TRUE); + evas_object_smart_callback_add(btn, "changed", + __hide_btn_changed_cb, (void *)ad); + ad->setup.hide_btn = btn; } - elm_object_style_set(btn, "on&off"); - evas_object_show(btn); - evas_object_pass_events_set(btn, EINA_TRUE); - evas_object_propagate_events_set(btn, EINA_FALSE); - elm_check_state_set(btn, ad->setup.visibility ? EINA_FALSE : EINA_TRUE); - evas_object_smart_callback_add(btn, "changed", - __hide_btn_changed_cb, (void *)ad); - - ad->setup.hide_btn = btn; __MOBILE_AP_FUNC_EXIT__; return btn; @@ -204,348 +228,348 @@ static Evas_Object *__gl_security_icon_get(void *data, Evas_Object *obj, { __MOBILE_AP_FUNC_ENTER__; + mh_appdata_t *ad = (mh_appdata_t *)data; + Evas_Object *btn = NULL; + if (data == NULL || obj == NULL || part == NULL) { ERR("Invalid param\n"); return NULL; } - if (strcmp(part, "elm.icon") != 0) { - ERR("Invalid param\n"); - return NULL; + if (!strcmp("elm.swallow.end", part)) { + btn = elm_check_add(obj); + elm_object_style_set(btn, "on&off"); + evas_object_show(btn); + evas_object_pass_events_set(btn, EINA_TRUE); + evas_object_propagate_events_set(btn, EINA_FALSE); + elm_check_state_set(btn, ad->setup.security_type_new == + TETHERING_WIFI_SECURITY_TYPE_NONE ? + EINA_FALSE : EINA_TRUE); + evas_object_smart_callback_add(btn, "changed", + __security_btn_changed_cb, (void *)ad); + ad->setup.security_btn = btn; } - mh_appdata_t *ad = (mh_appdata_t *)data; - Evas_Object *btn = NULL; - - btn = elm_check_add(obj); - - elm_object_style_set(btn, "on&off"); - evas_object_show(btn); - evas_object_pass_events_set(btn, EINA_TRUE); - evas_object_propagate_events_set(btn, EINA_FALSE); - elm_check_state_set(btn, ad->setup.security_type == - TETHERING_WIFI_SECURITY_TYPE_NONE ? - EINA_FALSE : EINA_TRUE); - evas_object_smart_callback_add(btn, "changed", - __security_btn_changed_cb, (void *)ad); - - ad->setup.security_btn = btn; - __MOBILE_AP_FUNC_EXIT__; return btn; } -static Eina_Bool __save_wifi_passphrase(mh_appdata_t *ad) +static bool __save_wifi_passphrase(mh_appdata_t *ad) { __MOBILE_AP_FUNC_ENTER__; if (ad == NULL) { ERR("Invalid param\n"); - return EINA_FALSE; + return false; } mh_wifi_setting_view_t *st = &ad->setup; int ret = 0; - const char *entry_string = NULL; - char *utf8_string = NULL; - char wifi_passphrase[WIFI_PASSPHRASE_LENGTH_MAX + 1] = {0, }; - - entry_string = elm_entry_entry_get(st->pw_entry); - if (entry_string == NULL) { - ERR("elm_entry_entry_get() Failed!!!\n"); - return EINA_FALSE; - } - - utf8_string = elm_entry_markup_to_utf8(entry_string); - if (utf8_string == NULL) { - ERR("elm_entry_markup_to_utf8() Failed!!!\n"); - return EINA_FALSE; - } - g_strlcpy(wifi_passphrase, utf8_string, sizeof(wifi_passphrase)); - free(utf8_string); - if (g_strcmp0(st->wifi_passphrase, wifi_passphrase) == 0) { - DBG("Password is not changed\n"); - return EINA_TRUE; - } - - if (strlen(wifi_passphrase) < WIFI_PASSPHRASE_LENGTH_MIN) { - DBG("Password is shorter than %d\n", WIFI_PASSPHRASE_LENGTH_MIN); - _prepare_popup(ad, MH_POP_WIFI_PASSWORD_SHORT, - _("IDS_ST_BODY_ENTER_PASSWORD_OF_AT_LEAST_8_CHARACTERS")); - _create_popup(ad); - return EINA_FALSE; - } - - ret = tethering_wifi_set_passphrase(ad->handle, wifi_passphrase); + ret = tethering_wifi_set_passphrase(ad->handle, st->wifi_passphrase_new); if (ret != TETHERING_ERROR_NONE) { ERR("tethering_wifi_set_passphrase is failed : %d\n", ret); - return EINA_FALSE; + return false; } - DBG("SUCCESS : setting up VCONFKEY_MOBILE_HOTSPOT_WIFI_KEY\n"); - g_strlcpy(st->wifi_passphrase, wifi_passphrase, sizeof(st->wifi_passphrase)); - __MOBILE_AP_FUNC_EXIT__; - - return EINA_TRUE; + return true; } -static void __passphrase_maxlength_reached_cb(void *data, Evas_Object *obj, - void *event_info) +static void __pw_entry_changed_cb(void *data, Evas_Object *obj, + void *event_info) { __MOBILE_AP_FUNC_ENTER__; - if (data == NULL || obj == NULL) { - ERR("The param is NULL\n"); - return; - } - mh_appdata_t *ad = (mh_appdata_t *)data; - char buf[MH_LABEL_LENGTH_MAX] = {0, }; + mh_wifi_setting_view_t *st = &ad->setup; + const char *changed_text; + char *utf8_string; + int len = 0; - if (ad->popup != NULL) { - ERR("Popup already exists\n"); + changed_text = elm_entry_entry_get(obj); + if (changed_text == NULL) { + ERR("elm_entry_entry_get is failed\n"); return; } - if (_hide_imf(ad->setup.pw_entry) == EINA_FALSE) { - ERR("_hide_imf is failed\n"); - } + utf8_string = elm_entry_markup_to_utf8(changed_text); - if (__save_wifi_passphrase(ad) == EINA_FALSE) { - ERR("__save_wifi_passphrase is failed\n"); - return; + if (utf8_string == NULL) { + ERR("elm_entry_markup_to_utf8() Failed!!!\n"); + } else { + len = strlen(utf8_string); + if (WIFI_PASSPHRASE_LENGTH_MIN <= len) { + elm_object_disabled_set(st->save_button, EINA_FALSE); + elm_entry_input_panel_return_key_disabled_set(obj, FALSE); + } else { + elm_object_disabled_set(st->save_button, EINA_TRUE); + elm_entry_input_panel_return_key_disabled_set(obj, TRUE); + } + g_strlcpy(st->wifi_passphrase_new, utf8_string, + sizeof(st->wifi_passphrase_new)); + free(utf8_string); + utf8_string = NULL; + } + + if (elm_object_part_content_get(obj, "elm.swallow.clear")) { + if (elm_object_focus_get(obj)) { + if (elm_entry_is_empty(obj)) + elm_object_signal_emit(obj, "elm,state,clear,hidden", ""); + else + elm_object_signal_emit(obj, "elm,state,clear,visible", ""); + } } - snprintf(buf, sizeof(buf), - _("IDS_MOBILEAP_POP_PASSWORD_MUST_CONTAIN_AT_LEAST_PD_CHARACTERS_AND_NOT_EXCEED_PD_CHARACTERS"), - WIFI_PASSPHRASE_LENGTH_MIN, WIFI_PASSPHRASE_LENGTH_MAX); - - _prepare_popup(ad, MH_POP_INFORMATION_WO_BUTTON, buf); - _create_popup(ad); - __MOBILE_AP_FUNC_EXIT__; + return; } -static void __passphrase_activated_cb(void *data, Evas_Object *obj, +static void __pw_entry_maxlength_reached_cb(void *data, Evas_Object *obj, void *event_info) { __MOBILE_AP_FUNC_ENTER__; - if (data == NULL || obj == NULL) { - ERR("Invalid param\n"); + if (obj == NULL) { + ERR("The param is NULL\n"); + __MOBILE_AP_FUNC_EXIT__; return; } + char buf[MH_LABEL_LENGTH_MAX] = { 0, }; + char *fmt = STR_PASSWORD_MIN_MAX; + notification_error_e ret; - mh_appdata_t *ad = (mh_appdata_t *)data; - - if (_hide_imf(ad->setup.pw_entry) == EINA_FALSE) { - ERR("_hide_imf is failed\n"); - } + snprintf(buf, sizeof(buf), fmt, + WIFI_PASSPHRASE_LENGTH_MIN, WIFI_PASSPHRASE_LENGTH_MAX); - if (__save_wifi_passphrase(ad) == EINA_FALSE) { - ERR("__save_wifi_passphrase is failed\n"); - return; - } + ret = notification_status_message_post(buf); + if (ret != NOTIFICATION_ERROR_NONE) + ERR("notification_status_message_post() is failed : %d\n", ret); __MOBILE_AP_FUNC_EXIT__; - - return; } -static void __pw_entry_changed_cb(void *data, Evas_Object *obj, - void *event_info) +static void __pw_entry_activated_cb(void *data, Evas_Object *obj, void *event_info) { __MOBILE_AP_FUNC_ENTER__; - if (data == NULL || obj == NULL) { - ERR("Invalid param\n"); - return; - } - - mh_appdata_t *ad = (mh_appdata_t *)data; - mh_wifi_setting_view_t *st = &ad->setup; - - if (!elm_object_focus_get(st->pw_layout)) + if (obj == NULL) { + ERR("Invalid parameter"); return; - - if (elm_entry_is_empty(st->pw_entry)) { - elm_object_signal_emit(st->pw_layout, - "elm,state,eraser,hide", "elm"); - } else { - elm_object_signal_emit(st->pw_layout, - "elm,state,eraser,show", "elm"); } + elm_object_focus_set(obj, EINA_FALSE); __MOBILE_AP_FUNC_EXIT__; - return; - } -static void __pw_entry_focused_cb(void *data, Evas_Object *obj, - void *event_info) +static void __pw_entry_focused_cb(void *data, Evas_Object *obj, void *event_info) { __MOBILE_AP_FUNC_ENTER__; + evas_object_smart_callback_del(obj, "focused", __pw_entry_focused_cb); - if (data == NULL || obj == NULL) { - ERR("Invalid param\n"); - return; - } - - mh_appdata_t *ad = (mh_appdata_t *)data; - mh_wifi_setting_view_t *st = &ad->setup; - - if (!elm_entry_is_empty(st->pw_entry)) - elm_object_signal_emit(st->pw_layout, - "elm,state,eraser,show", "elm"); - - elm_object_signal_emit(st->pw_layout, - "elm,state,guidetext,hide", "elm"); + elm_object_focus_set(obj, EINA_TRUE); + elm_entry_cursor_end_set(obj); + __MOBILE_AP_FUNC_EXIT__; +} +static void __pw_entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info) +{ + __MOBILE_AP_FUNC_ENTER__; + if (elm_object_part_content_get(obj, "elm.swallow.clear")) + elm_object_signal_emit(obj, "elm,state,clear,hidden", ""); + elm_object_signal_emit(obj, "elm,state,focus,off", ""); __MOBILE_AP_FUNC_EXIT__; - - return; - } -static void __pw_entry_unfocused_cb(void *data, Evas_Object *obj, - void *event_info) +static void __pw_entry_show_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { __MOBILE_AP_FUNC_ENTER__; + evas_object_event_callback_del(obj, EVAS_CALLBACK_SHOW, __pw_entry_show_cb); - if (data == NULL || obj == NULL) { - ERR("Invalid param\n"); - return; - } - - mh_appdata_t *ad = (mh_appdata_t *)data; - mh_wifi_setting_view_t *st = &ad->setup; + elm_object_focus_set(obj, EINA_TRUE); + elm_entry_cursor_end_set(obj); + __MOBILE_AP_FUNC_EXIT__; +} - if (elm_entry_is_empty(st->pw_entry)) - elm_object_signal_emit(st->pw_layout, - "elm,state,guidetext,show", "elm"); +static void __eraser_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + __MOBILE_AP_FUNC_ENTER__; - elm_object_signal_emit(st->pw_layout, - "elm,state,eraser,hide", "elm"); + elm_object_text_set(data, ""); + elm_entry_input_panel_return_key_disabled_set(data, TRUE); __MOBILE_AP_FUNC_EXIT__; - - return; - } -static void __pw_layout_eraser_clicked_cb(void *data, Evas_Object *obj, - const char *emission, const char *source) +static void __pw_entry_language_changed_cb(void *data, Evas_Object *obj, void *event_info) { __MOBILE_AP_FUNC_ENTER__; - if (data == NULL || obj == NULL) { - ERR("Invalid param\n"); + if (obj == NULL || data == NULL) { + ERR("NULL param\n"); return; } - mh_appdata_t *ad = (mh_appdata_t *)data; mh_wifi_setting_view_t *st = &ad->setup; + char buf[MH_LABEL_LENGTH_MAX]; + char *fmt = STR_PW_GUIDE_TEXT; - elm_entry_entry_set(st->pw_entry, ""); + snprintf(buf, sizeof(buf), fmt, WIFI_PASSPHRASE_LENGTH_MIN); + if (st->security_type_new == TETHERING_WIFI_SECURITY_TYPE_NONE) { + if (st->pw_item) + elm_genlist_item_update(st->pw_item); + } else { + elm_object_part_text_set(obj, "elm.guide", buf); + } __MOBILE_AP_FUNC_EXIT__; - - return; - } -static Evas_Object *__gl_pw_icon_get(void *data, Evas_Object *obj, - const char *part) +static Evas_Object *__get_pw_entry(void *data, Evas_Object *parent) { __MOBILE_AP_FUNC_ENTER__; - if (data == NULL || obj == NULL || part == NULL) { - ERR("Invalid param\n"); - return NULL; - } + static Elm_Entry_Filter_Limit_Size limit_filter_data; + Evas_Object *entry = NULL; + char *fmt = STR_PW_GUIDE_TEXT; + char *ptr = NULL; + Evas_Object * clr_btn = NULL; + char buf[MH_LABEL_LENGTH_MAX]; - if (strcmp(part, "elm.icon") != 0) { - ERR("Invalid part\n"); + if (parent == NULL || data == NULL) { + ERR("null param \n"); return NULL; } - static Elm_Entry_Filter_Limit_Size limit_filter_data; - mh_appdata_t *ad = (mh_appdata_t *)data; mh_wifi_setting_view_t *st = &ad->setup; - Evas_Object *entry = NULL; - char *ptr = NULL; - st->pw_layout = elm_layout_add(obj); - if (st->pw_layout == NULL) { - ERR("elm_layout_add returns NULL\n"); - return NULL; - } - elm_layout_theme_set(st->pw_layout, "layout", "editfield", "title"); + entry = elm_entry_add(parent); - entry = elm_entry_add(st->pw_layout); if (entry == NULL) { ERR("elm_entry_add returns NULL\n"); - evas_object_del(st->pw_layout); - st->pw_layout = NULL; + st->pw_entry = NULL; return NULL; } - st->pw_entry = entry; - elm_object_part_content_set(st->pw_layout, "elm.swallow.content", entry); - elm_object_part_text_set(st->pw_layout, "elm.text", - _("IDS_MOBILEAP_BODY_PASSWORD")); - elm_object_part_text_set(st->pw_layout, "elm.guidetext", - _("IDS_ST_BODY_ENTER_PASSWORD_OF_AT_LEAST_8_CHARACTERS")); + elm_entry_single_line_set(entry, EINA_TRUE); + elm_entry_scrollable_set(entry, EINA_TRUE); + elm_entry_password_set(entry, EINA_FALSE); - /* Set editable mode */ - DBG("security_type : %d\n", st->security_type); - elm_entry_input_panel_enabled_set(entry, st->security_type == - TETHERING_WIFI_SECURITY_TYPE_NONE ? - EINA_FALSE : EINA_TRUE); + evas_object_smart_callback_add(entry, "language,changed", + __pw_entry_language_changed_cb, ad); - /* Set single line of entry */ - elm_entry_scrollable_set(entry, EINA_TRUE); - elm_entry_single_line_set(entry, EINA_TRUE); + eext_entry_selection_back_event_allow_set(entry, EINA_TRUE); + elm_entry_prediction_allow_set(entry, EINA_FALSE); + elm_object_signal_emit(entry, "elm,action,hide,search_icon", ""); elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_PASSWORD); + snprintf(buf, sizeof(buf), fmt, WIFI_PASSPHRASE_LENGTH_MIN); + elm_object_part_text_set(entry, "guide", buf); + elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT); - /* Set the maximum length filter for passphrase entry */ limit_filter_data.max_char_count = 0; limit_filter_data.max_byte_count = WIFI_PASSPHRASE_LENGTH_MAX; - elm_entry_markup_filter_append(entry, - elm_entry_filter_limit_size, &limit_filter_data); - - ptr = elm_entry_utf8_to_markup(st->wifi_passphrase); - if (ptr != NULL) { - elm_entry_entry_set(entry, ptr); - free(ptr); + elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_filter_data); + + if (st->security_type_new == TETHERING_WIFI_SECURITY_TYPE_NONE) { + elm_object_part_text_set(entry, "default", buf); + elm_entry_input_panel_enabled_set(entry, EINA_FALSE); + elm_object_disabled_set(entry, EINA_TRUE); + if (st->pw_item) + elm_object_item_signal_emit(st->pw_item, "elm,state,rename,hide", ""); + return entry; } else { - ERR("elm_entry_utf8_to_markup is failed\n"); - } - - if (!elm_entry_is_empty(entry)) - elm_object_signal_emit(st->pw_layout, - "elm,state,guidetext,hide", "elm"); + elm_object_disabled_set(entry, EINA_FALSE); + elm_entry_input_panel_enabled_set(entry, EINA_TRUE); + ptr = elm_entry_utf8_to_markup(st->wifi_passphrase_new); + if (ptr != NULL) { + elm_object_text_set(entry, ptr); + free(ptr); + } else { + ERR("elm_entry_utf8_to_markup is failed\n"); + } + } + + elm_entry_input_panel_return_key_type_set(entry, + ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE); + + clr_btn = elm_button_add(entry); + elm_object_style_set(clr_btn, "search_clear"); + elm_object_focus_allow_set(clr_btn, EINA_FALSE); + elm_object_part_content_set(entry, "elm.swallow.clear", clr_btn); + evas_object_smart_callback_add(clr_btn, "clicked", __eraser_btn_clicked_cb, entry); + evas_object_show(clr_btn); + evas_object_smart_callback_add(entry, "changed", + __pw_entry_changed_cb, ad); evas_object_smart_callback_add(entry, "maxlength,reached", - __passphrase_maxlength_reached_cb, data); + __pw_entry_maxlength_reached_cb, ad); evas_object_smart_callback_add(entry, "activated", - __passphrase_activated_cb, data); - evas_object_smart_callback_add(entry, "changed", - __pw_entry_changed_cb, data); + __pw_entry_activated_cb, NULL); evas_object_smart_callback_add(entry, "focused", - __pw_entry_focused_cb, data); + __pw_entry_focused_cb, NULL); evas_object_smart_callback_add(entry, "unfocused", - __pw_entry_unfocused_cb, data); - elm_object_signal_callback_add(st->pw_layout, "elm,eraser,clicked", "elm", - __pw_layout_eraser_clicked_cb, data); + __pw_entry_unfocused_cb, NULL); + evas_object_event_callback_add(entry, EVAS_CALLBACK_SHOW, + __pw_entry_show_cb, NULL); + + elm_object_focus_set(entry, EINA_TRUE); + elm_entry_input_panel_show(entry); + elm_object_part_content_set(parent, "elm.swallow.content", entry); + + st->pw_entry = entry; __MOBILE_AP_FUNC_EXIT__; + return st->pw_entry; +} + +static Evas_Object *__gl_pw_content_get(void *data, Evas_Object *obj, const char *part) +{ + __MOBILE_AP_FUNC_ENTER__; + + int w = 720; + int h = 60; + + if (data == NULL) { + ERR("data is null \n"); + return NULL; + } + + if (!strcmp(part, "elm.swallow.content")) { + Evas_Object *box = elm_box_add(obj); + Evas_Object *label = elm_label_add(box); + Evas_Object *layout = elm_layout_add(box); + char buf[MH_LABEL_LENGTH_MAX] = {0, }; + + elm_box_align_set(box, 0.0, 0.0); + + /* Set label for name field */ + snprintf(buf, MH_LABEL_LENGTH_MAX, "%s", STR_PASSWORD); + elm_object_text_set(label, buf); + evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(label, 0.9, EVAS_HINT_EXPAND); + evas_object_size_hint_padding_set(label, ELM_SCALE_SIZE(10), ELM_SCALE_SIZE(10), 0, 0); + elm_box_pack_end(box, label); + evas_object_show(label); + + /* Set layout for entry field */ + elm_layout_theme_set(layout, "layout", "editfield", "singleline"); + evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - return st->pw_layout; + __get_pw_entry(data, layout); + evas_object_show(layout); + elm_box_pack_end(box, layout); + + evas_object_size_hint_min_set(box, ELM_SCALE_SIZE(w), ELM_SCALE_SIZE(h)); + evas_object_show(box); + + return box; + } + + __MOBILE_AP_FUNC_EXIT__; + return NULL; } static void __gl_hide_item_sel(void *data, Evas_Object *obj, void *event_info) @@ -560,9 +584,9 @@ static void __gl_hide_item_sel(void *data, Evas_Object *obj, void *event_info) mh_appdata_t *ad = (mh_appdata_t *)data; elm_genlist_item_selected_set((Elm_Object_Item*)event_info, EINA_FALSE); + __hide_btn_changed_cb(ad, obj, NULL); - __hide_btn_changed_cb(data, obj, NULL); - elm_check_state_set(ad->setup.hide_btn, ad->setup.visibility ? + elm_check_state_set(ad->setup.hide_btn, ad->setup.visibility_new ? EINA_FALSE : EINA_TRUE); __MOBILE_AP_FUNC_EXIT__; @@ -580,74 +604,65 @@ static void __gl_security_item_sel(void *data, Evas_Object *obj, void *event_inf mh_appdata_t *ad = (mh_appdata_t *)data; elm_genlist_item_selected_set((Elm_Object_Item*)event_info, EINA_FALSE); - __security_btn_changed_cb(data, obj, NULL); - elm_check_state_set(ad->setup.security_btn, ad->setup.security_type == + elm_check_state_set(ad->setup.security_btn, ad->setup.security_type_new == TETHERING_WIFI_SECURITY_TYPE_NONE ? EINA_FALSE : EINA_TRUE); __MOBILE_AP_FUNC_EXIT__; } -static void __free_genlist_itc(mh_appdata_t *ad) -{ - __MOBILE_AP_FUNC_ENTER__; - - elm_genlist_item_class_free(ad->setup.sp_itc); - elm_genlist_item_class_free(ad->setup.hide_itc); - elm_genlist_item_class_free(ad->setup.security_itc); - elm_genlist_item_class_free(ad->setup.pw_itc); - elm_genlist_item_class_free(ad->setup.name_itc); - - __MOBILE_AP_FUNC_EXIT__; - return; -} - static void __set_genlist_itc(mh_appdata_t *ad) { __MOBILE_AP_FUNC_ENTER__; - ad->setup.sp_itc = elm_genlist_item_class_new(); - ad->setup.sp_itc->item_style = "dialogue/separator/21/with_line"; - ad->setup.sp_itc->func.text_get = NULL; - ad->setup.sp_itc->func.content_get = NULL; - ad->setup.sp_itc->func.state_get = NULL; - ad->setup.sp_itc->func.del = NULL; + ad->setup.name_itc = elm_genlist_item_class_new(); + if (ad->setup.name_itc == NULL) { + ERR("elm_genlist_item_class_new failed\n"); + __MOBILE_AP_FUNC_EXIT__; + return; + } + ad->setup.name_itc->item_style = MH_GENLIST_MULTILINE_TEXT_STYLE; + ad->setup.name_itc->func.text_get = __gl_device_name_title_label_get; + ad->setup.name_itc->func.content_get = NULL; + ad->setup.name_itc->func.state_get = NULL; + ad->setup.name_itc->func.del = NULL; ad->setup.hide_itc = elm_genlist_item_class_new(); - ad->setup.hide_itc->item_style = "dialogue/1text.1icon"; + if (ad->setup.hide_itc == NULL) { + ERR("elm_genlist_item_class_new failed\n"); + __MOBILE_AP_FUNC_EXIT__; + return; + } + ad->setup.hide_itc->item_style = MH_GENLIST_1LINE_TEXT_ICON_STYLE; ad->setup.hide_itc->func.text_get = __gl_hide_label_get; ad->setup.hide_itc->func.content_get = __gl_hide_icon_get; ad->setup.hide_itc->func.state_get = NULL; ad->setup.hide_itc->func.del = NULL; ad->setup.security_itc = elm_genlist_item_class_new(); - ad->setup.security_itc->item_style = "dialogue/1text.1icon"; + if (ad->setup.security_itc == NULL) { + ERR("elm_genlist_item_class_new failed\n"); + __MOBILE_AP_FUNC_EXIT__; + return; + } + ad->setup.security_itc->item_style = MH_GENLIST_1LINE_TEXT_ICON_STYLE; ad->setup.security_itc->func.text_get = __gl_security_label_get; ad->setup.security_itc->func.content_get = __gl_security_icon_get; ad->setup.security_itc->func.state_get = NULL; ad->setup.security_itc->func.del = NULL; ad->setup.pw_itc = elm_genlist_item_class_new(); - ad->setup.pw_itc->item_style = "dialogue/1icon"; + if (ad->setup.pw_itc == NULL) { + ERR("elm_genlist_item_class_new failed\n"); + __MOBILE_AP_FUNC_EXIT__; + return; + } + ad->setup.pw_itc->item_style = MH_GENLIST_FULL_CONTENT_STYLE; ad->setup.pw_itc->func.text_get = NULL; - ad->setup.pw_itc->func.content_get = __gl_pw_icon_get; + ad->setup.pw_itc->func.content_get = __gl_pw_content_get; ad->setup.pw_itc->func.state_get = NULL; ad->setup.pw_itc->func.del = NULL; - ad->setup.name_itc = elm_genlist_item_class_new(); - ad->setup.name_itc->item_style = "multiline/1text"; - ad->setup.name_itc->func.text_get = __gl_name_label_get; - ad->setup.name_itc->func.content_get = NULL; - ad->setup.name_itc->func.state_get = NULL; - ad->setup.name_itc->func.del = NULL; - - ad->setup.end_sp_itc = elm_genlist_item_class_new(); - ad->setup.end_sp_itc->item_style = "dialogue/separator/end"; - ad->setup.end_sp_itc->func.text_get = NULL; - ad->setup.end_sp_itc->func.content_get = NULL; - ad->setup.end_sp_itc->func.state_get = NULL; - ad->setup.end_sp_itc->func.del = NULL; - __MOBILE_AP_FUNC_EXIT__; return; } @@ -661,66 +676,227 @@ static void __deconstruct_wifi_setup_view(mh_wifi_setting_view_t *st) return; } - if (st->pw_entry == NULL) { - ERR("pw_entry is NULL"); - return; - } - evas_object_smart_callback_del(st->hide_btn, "changed", __hide_btn_changed_cb); evas_object_smart_callback_del(st->security_btn, "changed", __security_btn_changed_cb); - if (st->pw_entry) { - evas_object_smart_callback_del(st->pw_entry, - "maxlength,reached", - __passphrase_maxlength_reached_cb); - evas_object_smart_callback_del(st->pw_entry, - "activated", - __passphrase_activated_cb); - } - evas_object_smart_callback_del(st->back_btn, "clicked", - __back_btn_cb); - - st->hide_btn = NULL; - st->security_btn = NULL; - st->pw_layout = NULL; - st->pw_entry = NULL; - st->back_btn = NULL; - st->genlist = NULL; - st->conform = NULL; + evas_object_smart_callback_del(st->cancel_button, "clicked", + __cancel_btn_cb); + evas_object_smart_callback_del(st->save_button, "clicked", + __save_btn_cb); + evas_object_smart_callback_del(st->genlist, "realized", + __gl_realized); __MOBILE_AP_FUNC_EXIT__; } -static void __back_btn_cb(void *data, Evas_Object *obj, void *event_info) +static void __settings_reloaded_cb(tethering_error_e result, void *user_data) { + if (user_data == NULL) { + ERR("Invalid parameter\n"); + return; + } + __MOBILE_AP_FUNC_ENTER__; + mh_appdata_t *ad = (mh_appdata_t *)user_data; + + if (result != TETHERING_ERROR_NONE) + ERR("tethering_wifi_reload_settings is failed [0x%X]\n", result); + _update_wifi_item(ad, MH_STATE_NONE); + + __MOBILE_AP_FUNC_EXIT__; + + return; +} + +static void __save_btn_cb(void *data, Evas_Object *object, void *event_info) +{ + DBG("+\n"); if (data == NULL) { - ERR("The param is NULL\n"); + ERR("data is NULL\n"); return; } mh_appdata_t *ad = (mh_appdata_t *)data; mh_wifi_setting_view_t *st = &ad->setup; - - if (_hide_imf(st->pw_entry) == EINA_FALSE) { - ERR("_hide_imf is failed\n"); + bool ret = false; + bool is_setting_changed = false; + + /* handle hide button change */ + if (st->visibility != st->visibility_new) { + ret = __save_hide_btn_change(ad); + if (ret == false) { + elm_check_state_set(st->hide_btn, st->visibility ? + EINA_FALSE : EINA_TRUE); + } else { + st->visibility = st->visibility_new; + is_setting_changed = true; + } + } + /* handle security button change */ + if (st->security_type != st->security_type_new) { + ret = __save_security_btn_change(ad); + if (ret == false) { + elm_check_state_set(st->security_btn, st->security_type == + TETHERING_WIFI_SECURITY_TYPE_NONE ? EINA_FALSE : EINA_TRUE); + } else { + st->security_type = st->security_type_new; + is_setting_changed = true; + } + } + + /* handle wifi passphrase change */ + if (strcmp(st->wifi_passphrase, st->wifi_passphrase_new)) { + ret = __save_wifi_passphrase(ad); + if (ret == false) { + g_strlcpy(st->wifi_passphrase_new, st->wifi_passphrase, + sizeof(st->wifi_passphrase_new)); + if (st->pw_item) + elm_genlist_item_update(st->pw_item); + } else { + g_strlcpy(st->wifi_passphrase, st->wifi_passphrase_new, + sizeof(st->wifi_passphrase)); + is_setting_changed = true; + if (ad->main.help_item) { + if (ad->main.help_item) + elm_genlist_item_update(ad->main.help_item); + } + } + } + + if (is_setting_changed) { + _update_wifi_item(ad, MH_STATE_PROCESS); + + if (ad->main.help_item) + elm_genlist_item_update(ad->main.help_item); + + /* reload wifi settings */ + ret = tethering_wifi_reload_settings(ad->handle, __settings_reloaded_cb, + (void *)ad); + if (ret != TETHERING_ERROR_NONE) + ERR("reload_configuration is failed : %d\n", ret); } - if (__save_wifi_passphrase(ad) == EINA_FALSE) { - ERR("__save_wifi_passphrase is failed\n"); + elm_naviframe_item_pop(ad->naviframe); + + DBG("-\n"); + return; +} + +static void __cancel_btn_cb(void *data, Evas_Object *object, void *event_info) +{ + DBG("+\n"); + + if (data == NULL) { + ERR("The param is NULL\n"); return; } + mh_appdata_t *ad = (mh_appdata_t *)data; + + elm_naviframe_item_pop(ad->naviframe); + DBG("-\n"); + return; +} + +Eina_Bool _setting_back_btn_cb(void *data, Elm_Object_Item *navi_item) +{ + DBG("+\n"); + + if (data == NULL) { + ERR("The param is NULL\n"); + return EINA_FALSE; + } + + mh_appdata_t *ad = (mh_appdata_t *)data; + mh_wifi_setting_view_t *st = &ad->setup; + + if (st->visibility != st->visibility_new) + st->visibility_new = st->visibility; + + if (st->security_type != st->security_type_new) + st->security_type_new = st->security_type; + + if (strcmp(st->wifi_passphrase_new, st->wifi_passphrase)) { + g_strlcpy(st->wifi_passphrase_new, st->wifi_passphrase, + sizeof(st->wifi_passphrase_new)); + } + st->pw_entry = NULL; __deconstruct_wifi_setup_view(st); - evas_object_del(ad->setup.genlist); - __free_genlist_itc(ad); + if (ad->rename_popup != NULL) { + evas_object_del(ad->rename_popup); + ad->rename_popup = NULL; + } + ad->setup.navi_it = NULL; - elm_naviframe_item_pop(ad->naviframe); + DBG("-\n"); + return EINA_TRUE; +} + +static void __gl_realized(void *data, Evas_Object *obj, void *event_info) +{ + __MOBILE_AP_FUNC_ENTER__; + + mh_appdata_t *ad = (mh_appdata_t *)data; + mh_wifi_setting_view_t *st = &(ad->setup); + Elm_Object_Item *item = (Elm_Object_Item *)event_info; + Evas_Object *ao; + Evas_Object *btn; + char str[MH_LABEL_LENGTH_MAX] = {0, }; + int no_of_sp; + int i; + + if (item == st->hide_item) + elm_object_item_signal_emit(item, "elm,state,top", ""); + else if (item == st->security_item) + elm_object_item_signal_emit(item, "elm,state,center", ""); + else if (item == st->pw_item) + elm_object_item_signal_emit(item, "elm,state,bottom", ""); + + no_of_sp = sizeof(st->sp_item) / sizeof(st->sp_item[0]); + for (i = 0; i < no_of_sp; i++) { + if (item == st->sp_item[i]) + elm_object_item_access_unregister(item); + } + + if (item == st->hide_item || item == st->security_item) { + ao = elm_object_item_access_object_get(item); + btn = elm_object_item_part_content_get(item, "on&off"); + snprintf(str, sizeof(str), "%s, %s", "On/off button", + (elm_check_state_get(btn) ? "On" : "Off")); + elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, str); + } + + if (item == st->pw_item) { + elm_object_item_access_unregister(item); + ao = elm_object_item_access_register(item); + snprintf(str, sizeof(str), "%s, %s", STR_PASSWORD, st->wifi_passphrase_new); + elm_access_info_set(ao, ELM_ACCESS_CONTEXT_INFO, str); + } __MOBILE_AP_FUNC_EXIT__; + + return; +} + +static void __select_passphrase_item(void *data, Evas_Object *obj, void *event_info) +{ + __MOBILE_AP_FUNC_ENTER__; + + if (data == NULL) { + ERR("The param is NULL\n"); + return; + } + + mh_appdata_t *ad = (mh_appdata_t *)data; + mh_wifi_setting_view_t *st = &ad->setup; + + elm_object_focus_set(st->pw_entry, EINA_TRUE); + + __MOBILE_AP_FUNC_EXIT__; + return; } Evas_Object *__create_genlist(mh_appdata_t *ad) @@ -734,21 +910,26 @@ Evas_Object *__create_genlist(mh_appdata_t *ad) void *data = (void *)ad; mh_wifi_setting_view_t *st = &ad->setup; - Evas_Object *genlist = NULL; - Elm_Object_Item *item = NULL; + Evas_Object *genlist; genlist = elm_genlist_add(ad->naviframe); if (genlist == NULL) { ERR("genlist is NULL\n"); return NULL; } + elm_object_style_set(genlist, "dialogue"); elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); + evas_object_smart_callback_add(genlist, "realized", __gl_realized, ad); __set_genlist_itc(ad); - item = elm_genlist_item_append(genlist, st->sp_itc, NULL, NULL, + + st->name_item = elm_genlist_item_append(genlist, st->name_itc, data, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + elm_genlist_item_select_mode_set(st->name_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + + if (st->name_item) + elm_object_item_disabled_set(st->name_item, EINA_TRUE); st->hide_item = elm_genlist_item_append(genlist, st->hide_itc, data, NULL, ELM_GENLIST_ITEM_NONE, __gl_hide_item_sel, data); @@ -756,22 +937,19 @@ Evas_Object *__create_genlist(mh_appdata_t *ad) st->security_item = elm_genlist_item_append(genlist, st->security_itc, data, NULL, ELM_GENLIST_ITEM_NONE, __gl_security_item_sel, data); - DBG("security_type : %d\n", st->security_type); st->pw_item = elm_genlist_item_append(genlist, st->pw_itc, data, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_object_item_disabled_set(st->pw_item, st->security_type == - TETHERING_WIFI_SECURITY_TYPE_NONE ? - EINA_TRUE : EINA_FALSE); - elm_genlist_item_update(st->pw_item); - - st->name_item = elm_genlist_item_append(genlist, st->name_itc, data, NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(st->name_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + ELM_GENLIST_ITEM_NONE, __select_passphrase_item, ad); + if (st->security_type == TETHERING_WIFI_SECURITY_TYPE_NONE) + elm_object_item_disabled_set(st->pw_item, EINA_TRUE); + else + elm_object_item_disabled_set(st->pw_item, EINA_FALSE); - item = elm_genlist_item_append(genlist, st->end_sp_itc, NULL, NULL, +/* End separator is removed because of P131104-03336. It is confirmed by UX team for this case. + item = elm_genlist_item_append(genlist, st->sp_itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); - + st->sp_item[i++] = item; +*/ __MOBILE_AP_FUNC_EXIT__; @@ -780,63 +958,45 @@ Evas_Object *__create_genlist(mh_appdata_t *ad) void mh_draw_wifi_setup_view(mh_appdata_t *ad) { - __MOBILE_AP_FUNC_ENTER__; + DBG("+\n"); if (ad == NULL) { ERR("ad is NULL\n"); + DBG("-\n"); return; } - + Evas_Object *btn; mh_wifi_setting_view_t *st = &ad->setup; - if (st->conform != NULL) { + if (ad->setup.navi_it != NULL) { ERR("Wi-Fi setup view already exists\n"); + DBG("-\n"); return; } - st->conform = elm_conformant_add(ad->naviframe); - if (st->conform == NULL) { - ERR("elm_conformant_add returns NULL\n"); - goto FAIL; - } - elm_object_style_set(st->conform, "internal_layout"); - evas_object_show(st->conform); - st->genlist = __create_genlist(ad); if (st->genlist == NULL) { ERR("__create_genlist returns NULL\n"); - goto FAIL; + DBG("-\n"); + return; } - elm_object_content_set(st->conform, st->genlist); - st->back_btn = elm_button_add(ad->naviframe); - if (st->back_btn == NULL) { - ERR("elm_button_add returns NULL\n"); - goto FAIL; - } - elm_naviframe_item_push(ad->naviframe, - _("IDS_MOBILEAP_MBODY_WI_FI_TETHERING_SETTINGS"), - st->back_btn, NULL, st->conform, NULL); + st->navi_it = elm_naviframe_item_push(ad->naviframe, "IDS_MOBILEAP_MBODY_WI_FI_TETHERING", + NULL, NULL, st->genlist, NULL); + elm_object_item_domain_text_translatable_set(st->navi_it, PKGNAME, EINA_TRUE); - /* Style set should be called after elm_naviframe_item_push(). */ - elm_object_style_set(st->back_btn, "naviframe/back_btn/default"); - evas_object_smart_callback_add(st->back_btn, "clicked", - __back_btn_cb, ad); - elm_object_focus_allow_set(st->back_btn, EINA_FALSE); + elm_naviframe_item_pop_cb_set(st->navi_it, _setting_back_btn_cb, (void *)ad); - __MOBILE_AP_FUNC_EXIT__; - - return; + btn = elm_button_add(ad->naviframe); + elm_object_style_set(btn, "naviframe/title_cancel"); + evas_object_smart_callback_add(btn, "clicked", __cancel_btn_cb, ad); + elm_object_item_part_content_set(st->navi_it, "title_left_btn", btn); + st->cancel_button = btn; -FAIL: - if (st->back_btn) - evas_object_del(st->back_btn); - if (st->genlist) - evas_object_del(st->genlist); - if (st->conform) - evas_object_del(st->conform); - - st->back_btn = NULL; - st->genlist = NULL; - st->conform = NULL; + btn = elm_button_add(ad->naviframe); + elm_object_style_set(btn, "naviframe/title_done"); + evas_object_smart_callback_add(btn, "clicked", __save_btn_cb, ad); + elm_object_item_part_content_set(st->navi_it, "title_right_btn", btn); + st->save_button = btn; + DBG("-\n"); }