4 * Copyright 2012 Samsung Electronics Co., Ltd
6 * Licensed under the Flora License, Version 1.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://floralicense.org/license/
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #include "mh_view_wifi_setup.h"
22 static void __back_btn_cb(void *data, Evas_Object *obj, void *event_info);
23 static void __gl_realized(void *data, Evas_Object *obj, void *event_info);
25 static void __input_panel_event_cb(void *data, Ecore_IMF_Context *ctx, int value)
28 ERR("data is NULL\n");
32 mh_wifi_setting_view_t *st = (mh_wifi_setting_view_t *)data;
34 if (st->navi_it == NULL) {
35 DBG("naviframe item is not pushed yet\n");
39 if (value == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
40 DBG("value == ECORE_IMF_INPUT_PANEL_STATE_SHOW\n");
41 elm_object_item_signal_emit(st->navi_it, "elm,state,sip,shown", "");
42 } else if(value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
43 DBG("value == ECORE_IMF_INPUT_PANEL_STATE_HIDE\n");
44 elm_object_item_signal_emit(st->navi_it, "elm,state,sip,hidden", "");
50 static void __hide_btn_changed_cb(void *data, Evas_Object *obj, void *event_info)
52 __MOBILE_AP_FUNC_ENTER__;
54 if (data == NULL || obj == NULL) {
55 ERR("Invalid param\n");
59 mh_appdata_t *ad = (mh_appdata_t *)data;
62 ret = tethering_wifi_set_ssid_visibility(ad->handle,
63 !ad->setup.visibility);
64 if (ret != TETHERING_ERROR_NONE) {
65 ERR("tethering_wifi_set_ssid_visibility is failed : %d\n", ret);
69 ad->setup.visibility = !ad->setup.visibility;
71 __MOBILE_AP_FUNC_EXIT__;
74 static void __security_btn_changed_cb(void *data, Evas_Object *obj, void *event_info)
76 __MOBILE_AP_FUNC_ENTER__;
78 if (data == NULL || obj == NULL) {
79 ERR("Invalid param\n");
83 mh_appdata_t *ad = (mh_appdata_t *)data;
86 if (ad->setup.security_type == TETHERING_WIFI_SECURITY_TYPE_NONE)
87 ad->setup.security_type = TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK;
89 ad->setup.security_type = TETHERING_WIFI_SECURITY_TYPE_NONE;
91 ret = tethering_wifi_set_security_type(ad->handle, ad->setup.security_type);
92 if (ret != TETHERING_ERROR_NONE) {
93 ERR("tethering_wifi_set_security_type is failed : %d\n", ret);
97 elm_genlist_item_update(ad->setup.pw_item);
99 __MOBILE_AP_FUNC_EXIT__;
102 static char *__gl_hide_label_get(void *data, Evas_Object *obj, const char *part)
104 __MOBILE_AP_FUNC_ENTER__;
106 if (data == NULL || obj == NULL || part == NULL) {
107 ERR("Invalid param\n");
111 if (strcmp(part, "elm.text") != 0) {
112 ERR("Invalid param\n");
116 __MOBILE_AP_FUNC_EXIT__;
117 return strdup(_("IDS_MOBILEAP_BODY_HIDE_MY_DEVICE"));
120 static char *__gl_security_label_get(void *data, Evas_Object *obj, const char *part)
122 __MOBILE_AP_FUNC_ENTER__;
124 if (data == NULL || obj == NULL || part == NULL) {
125 ERR("Invalid param\n");
129 if (strcmp(part, "elm.text") != 0) {
130 ERR("Invalid param\n");
134 __MOBILE_AP_FUNC_EXIT__;
135 return strdup(_("IDS_MOBILEAP_BODY_SECURITY"));
138 static char *__gl_name_label_get(void *data, Evas_Object *obj, const char *part)
140 __MOBILE_AP_FUNC_ENTER__;
142 if (data == NULL || obj == NULL || part == NULL) {
143 ERR("Invalid param\n");
147 if (strcmp(part, "elm.text") != 0) {
148 ERR("Invalid param : %s\n", part);
152 mh_appdata_t *ad = (mh_appdata_t *)data;
153 char label[MH_LABEL_LENGTH_MAX] = {0, };
154 char name_change_label[MH_LABEL_LENGTH_MAX] = {0, };
155 char path[MH_LABEL_LENGTH_MAX] = {0, };
156 char *device_name = NULL;
158 DBG("Device name : %s\n", ad->setup.device_name);
160 device_name = elm_entry_utf8_to_markup(ad->setup.device_name);
161 if (device_name == NULL) {
162 ERR("elm_entry_utf8_to_markup is failed\n");
166 snprintf(path, sizeof(path), "%s > %s",
167 S_("IDS_COM_BODY_SETTINGS"),
168 _("IDS_ST_BODY_ABOUT_PHONE"));
169 snprintf(name_change_label, sizeof(name_change_label),
170 _("IDS_MOBILEAP_BODY_DEVICE_NAME_CAN_BE_CHANGED_IN_PS"),
172 snprintf(label, sizeof(label), "%s: %s<br>%s",
173 _("IDS_MOBILEAP_BODY_DEVICE_NAME"),
178 __MOBILE_AP_FUNC_EXIT__;
180 return strdup(label);
183 static Evas_Object *__gl_hide_icon_get(void *data, Evas_Object *obj,
186 __MOBILE_AP_FUNC_ENTER__;
188 if (data == NULL || obj == NULL || part == NULL) {
189 ERR("Invalid param\n");
193 if (strcmp(part, "elm.icon") != 0) {
194 ERR("Invalid param\n");
198 mh_appdata_t *ad = (mh_appdata_t *)data;
199 Evas_Object *btn = NULL;
201 btn = elm_check_add(obj);
203 ERR("btn is NULL\n");
206 elm_object_style_set(btn, "on&off");
207 evas_object_show(btn);
208 evas_object_pass_events_set(btn, EINA_TRUE);
209 evas_object_propagate_events_set(btn, EINA_FALSE);
210 elm_check_state_set(btn, ad->setup.visibility ? EINA_FALSE : EINA_TRUE);
211 evas_object_smart_callback_add(btn, "changed",
212 __hide_btn_changed_cb, (void *)ad);
214 ad->setup.hide_btn = btn;
216 __MOBILE_AP_FUNC_EXIT__;
220 static Evas_Object *__gl_security_icon_get(void *data, Evas_Object *obj,
223 __MOBILE_AP_FUNC_ENTER__;
225 if (data == NULL || obj == NULL || part == NULL) {
226 ERR("Invalid param\n");
230 if (strcmp(part, "elm.icon") != 0) {
231 ERR("Invalid param\n");
235 mh_appdata_t *ad = (mh_appdata_t *)data;
236 Evas_Object *btn = NULL;
238 btn = elm_check_add(obj);
240 elm_object_style_set(btn, "on&off");
241 evas_object_show(btn);
242 evas_object_pass_events_set(btn, EINA_TRUE);
243 evas_object_propagate_events_set(btn, EINA_FALSE);
244 elm_check_state_set(btn, ad->setup.security_type ==
245 TETHERING_WIFI_SECURITY_TYPE_NONE ?
246 EINA_FALSE : EINA_TRUE);
247 evas_object_smart_callback_add(btn, "changed",
248 __security_btn_changed_cb, (void *)ad);
250 ad->setup.security_btn = btn;
252 __MOBILE_AP_FUNC_EXIT__;
256 static Eina_Bool __save_wifi_passphrase(mh_appdata_t *ad)
258 __MOBILE_AP_FUNC_ENTER__;
261 ERR("Invalid param\n");
265 mh_wifi_setting_view_t *st = &ad->setup;
268 ret = tethering_wifi_set_passphrase(ad->handle, st->wifi_passphrase_new);
269 if (ret != TETHERING_ERROR_NONE) {
270 ERR("tethering_wifi_set_passphrase is failed : %d\n", ret);
274 DBG("SUCCESS : setting up VCONFKEY_MOBILE_HOTSPOT_WIFI_KEY\n");
275 g_strlcpy(st->wifi_passphrase, st->wifi_passphrase_new, sizeof(st->wifi_passphrase));
277 __MOBILE_AP_FUNC_EXIT__;
282 static void __passphrase_maxlength_reached_cb(void *data, Evas_Object *obj,
285 __MOBILE_AP_FUNC_ENTER__;
287 if (data == NULL || obj == NULL) {
288 ERR("The param is NULL\n");
292 mh_appdata_t *ad = (mh_appdata_t *)data;
293 char buf[MH_LABEL_LENGTH_MAX] = {0, };
295 if (ad->popup != NULL) {
296 ERR("Popup already exists\n");
300 elm_object_focus_set(ad->setup.pw_entry, EINA_FALSE);
302 if (__save_wifi_passphrase(ad) == EINA_FALSE) {
303 ERR("__save_wifi_passphrase is failed\n");
307 snprintf(buf, sizeof(buf),
308 _("IDS_MOBILEAP_POP_PASSWORD_MUST_CONTAIN_AT_LEAST_PD_CHARACTERS_AND_NOT_EXCEED_PD_CHARACTERS"),
309 WIFI_PASSPHRASE_LENGTH_MIN, WIFI_PASSPHRASE_LENGTH_MAX);
311 _prepare_popup(ad, MH_POP_INFORMATION_WO_BUTTON, buf);
314 __MOBILE_AP_FUNC_EXIT__;
317 static void __passphrase_activated_cb(void *data, Evas_Object *obj,
320 __MOBILE_AP_FUNC_ENTER__;
322 if (data == NULL || obj == NULL) {
323 ERR("Invalid param\n");
327 mh_appdata_t *ad = (mh_appdata_t *)data;
329 elm_object_focus_set(ad->setup.pw_entry, EINA_FALSE);
331 if (__save_wifi_passphrase(ad) == EINA_FALSE) {
332 ERR("__save_wifi_passphrase is failed\n");
336 __MOBILE_AP_FUNC_EXIT__;
341 static void __pw_entry_changed_cb(void *data, Evas_Object *obj,
344 __MOBILE_AP_FUNC_ENTER__;
346 if (data == NULL || obj == NULL) {
347 ERR("Invalid param\n");
351 mh_appdata_t *ad = (mh_appdata_t *)data;
352 mh_wifi_setting_view_t *st = &ad->setup;
353 const char *changed_text;
356 changed_text = elm_entry_entry_get(st->pw_entry);
357 if (changed_text == NULL) {
358 ERR("elm_entry_entry_get is failed\n");
362 utf8_string = elm_entry_markup_to_utf8(changed_text);
363 if (utf8_string == NULL) {
364 ERR("elm_entry_markup_to_utf8() Failed!!!\n");
366 g_strlcpy(st->wifi_passphrase_new, utf8_string,
367 sizeof(st->wifi_passphrase_new));
371 if (!elm_object_focus_get(st->pw_layout)) {
375 if (elm_entry_is_empty(st->pw_entry)) {
376 elm_object_signal_emit(st->pw_layout,
377 "elm,state,eraser,hide", "elm");
379 elm_object_signal_emit(st->pw_layout,
380 "elm,state,eraser,show", "elm");
383 __MOBILE_AP_FUNC_EXIT__;
389 static void __pw_entry_focused_cb(void *data, Evas_Object *obj,
392 __MOBILE_AP_FUNC_ENTER__;
394 if (data == NULL || obj == NULL) {
395 ERR("Invalid param\n");
399 mh_appdata_t *ad = (mh_appdata_t *)data;
400 mh_wifi_setting_view_t *st = &ad->setup;
402 elm_entry_cursor_end_set(st->pw_entry);
404 if (!elm_entry_is_empty(st->pw_entry))
405 elm_object_signal_emit(st->pw_layout,
406 "elm,state,eraser,show", "elm");
408 elm_object_signal_emit(st->pw_layout,
409 "elm,state,guidetext,hide", "elm");
411 __MOBILE_AP_FUNC_EXIT__;
417 static void __pw_entry_unfocused_cb(void *data, Evas_Object *obj,
420 __MOBILE_AP_FUNC_ENTER__;
422 if (data == NULL || obj == NULL) {
423 ERR("Invalid param\n");
427 mh_appdata_t *ad = (mh_appdata_t *)data;
428 mh_wifi_setting_view_t *st = &ad->setup;
430 if (elm_entry_is_empty(st->pw_entry))
431 elm_object_signal_emit(st->pw_layout,
432 "elm,state,guidetext,show", "elm");
434 elm_object_signal_emit(st->pw_layout,
435 "elm,state,eraser,hide", "elm");
437 __MOBILE_AP_FUNC_EXIT__;
443 static void __pw_layout_eraser_clicked_cb(void *data, Evas_Object *obj,
444 const char *emission, const char *source)
446 __MOBILE_AP_FUNC_ENTER__;
448 if (data == NULL || obj == NULL) {
449 ERR("Invalid param\n");
453 mh_appdata_t *ad = (mh_appdata_t *)data;
454 mh_wifi_setting_view_t *st = &ad->setup;
456 elm_entry_entry_set(st->pw_entry, "");
458 __MOBILE_AP_FUNC_EXIT__;
464 static Evas_Object *__gl_pw_icon_get(void *data, Evas_Object *obj,
467 __MOBILE_AP_FUNC_ENTER__;
469 if (data == NULL || obj == NULL || part == NULL) {
470 ERR("Invalid param\n");
474 if (strcmp(part, "elm.icon") != 0) {
475 ERR("Invalid part : %s\n", part);
479 static Elm_Entry_Filter_Limit_Size limit_filter_data;
481 mh_appdata_t *ad = (mh_appdata_t *)data;
482 mh_wifi_setting_view_t *st = &ad->setup;
483 Evas_Object *entry = NULL;
485 Ecore_IMF_Context *imf_context;
487 st->pw_layout = elm_layout_add(obj);
488 if (st->pw_layout == NULL) {
489 ERR("elm_layout_add returns NULL\n");
492 elm_layout_theme_set(st->pw_layout, "layout", "editfield", "title");
493 evas_object_size_hint_weight_set(st->pw_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
495 entry = elm_entry_add(st->pw_layout);
497 ERR("elm_entry_add returns NULL\n");
498 evas_object_del(st->pw_layout);
499 st->pw_layout = NULL;
502 st->pw_entry = entry;
504 /* Set single line of entry */
505 elm_entry_scrollable_set(entry, EINA_TRUE);
506 elm_entry_single_line_set(entry, EINA_TRUE);
507 elm_entry_input_panel_layout_set(entry, ELM_INPUT_PANEL_LAYOUT_PASSWORD);
509 /* Set the maximum length filter for passphrase entry */
510 limit_filter_data.max_char_count = 0;
511 limit_filter_data.max_byte_count = WIFI_PASSPHRASE_LENGTH_MAX;
512 elm_entry_markup_filter_append(entry,
513 elm_entry_filter_limit_size, &limit_filter_data);
515 DBG("security_type : %d\n", st->security_type);
516 if (st->security_type == TETHERING_WIFI_SECURITY_TYPE_NONE) {
517 ptr = elm_entry_utf8_to_markup(st->wifi_passphrase);
519 elm_entry_entry_set(entry, ptr);
522 ERR("elm_entry_utf8_to_markup is failed\n");
525 /* Set editable mode */
526 elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
527 elm_entry_context_menu_disabled_set(entry, EINA_TRUE);
528 elm_object_disabled_set(entry, EINA_TRUE);
530 ptr = elm_entry_utf8_to_markup(st->wifi_passphrase_new);
532 elm_entry_entry_set(entry, ptr);
535 ERR("elm_entry_utf8_to_markup is failed\n");
539 evas_object_smart_callback_add(entry, "maxlength,reached",
540 __passphrase_maxlength_reached_cb, data);
541 evas_object_smart_callback_add(entry, "activated",
542 __passphrase_activated_cb, data);
543 evas_object_smart_callback_add(entry, "changed",
544 __pw_entry_changed_cb, data);
545 evas_object_smart_callback_add(entry, "focused",
546 __pw_entry_focused_cb, data);
547 evas_object_smart_callback_add(entry, "unfocused",
548 __pw_entry_unfocused_cb, data);
550 imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(entry);
552 ecore_imf_context_input_panel_event_callback_add(imf_context,
553 ECORE_IMF_INPUT_PANEL_STATE_EVENT,
554 __input_panel_event_cb, (void *)st);
556 if (!elm_entry_is_empty(entry)) {
557 elm_object_signal_emit(st->pw_layout,
558 "elm,state,guidetext,hide", "elm");
561 elm_object_part_text_set(st->pw_layout, "elm.text",
562 _("IDS_MOBILEAP_BODY_PASSWORD"));
563 elm_object_part_content_set(st->pw_layout, "elm.swallow.content", entry);
564 elm_object_part_text_set(st->pw_layout, "elm.guidetext",
565 _("IDS_ST_BODY_ENTER_PASSWORD_OF_AT_LEAST_8_CHARACTERS"));
567 elm_object_signal_callback_add(st->pw_layout, "elm,eraser,clicked", "elm",
568 __pw_layout_eraser_clicked_cb, data);
570 evas_object_show(entry);
571 evas_object_show(st->pw_layout);
573 __MOBILE_AP_FUNC_EXIT__;
575 return st->pw_layout;
578 static void __gl_hide_item_sel(void *data, Evas_Object *obj, void *event_info)
580 __MOBILE_AP_FUNC_ENTER__;
582 if (data == NULL || obj == NULL || event_info == NULL) {
583 ERR("param is NULL\n");
587 mh_appdata_t *ad = (mh_appdata_t *)data;
589 elm_genlist_item_selected_set((Elm_Object_Item*)event_info, EINA_FALSE);
591 __hide_btn_changed_cb(data, obj, NULL);
592 elm_check_state_set(ad->setup.hide_btn, ad->setup.visibility ?
593 EINA_FALSE : EINA_TRUE);
595 __MOBILE_AP_FUNC_EXIT__;
598 static void __gl_security_item_sel(void *data, Evas_Object *obj, void *event_info)
600 __MOBILE_AP_FUNC_ENTER__;
602 if (data == NULL || obj == NULL || event_info == NULL) {
603 ERR("param is NULL\n");
607 mh_appdata_t *ad = (mh_appdata_t *)data;
609 elm_genlist_item_selected_set((Elm_Object_Item*)event_info, EINA_FALSE);
611 __security_btn_changed_cb(data, obj, NULL);
612 elm_check_state_set(ad->setup.security_btn, ad->setup.security_type ==
613 TETHERING_WIFI_SECURITY_TYPE_NONE ? EINA_FALSE : EINA_TRUE);
615 __MOBILE_AP_FUNC_EXIT__;
618 static void __free_genlist_itc(mh_appdata_t *ad)
620 __MOBILE_AP_FUNC_ENTER__;
622 elm_genlist_item_class_free(ad->setup.sp_itc);
623 elm_genlist_item_class_free(ad->setup.hide_itc);
624 elm_genlist_item_class_free(ad->setup.security_itc);
625 elm_genlist_item_class_free(ad->setup.pw_itc);
626 elm_genlist_item_class_free(ad->setup.name_itc);
628 __MOBILE_AP_FUNC_EXIT__;
632 static void __set_genlist_itc(mh_appdata_t *ad)
634 __MOBILE_AP_FUNC_ENTER__;
636 ad->setup.sp_itc = elm_genlist_item_class_new();
637 ad->setup.sp_itc->item_style = "dialogue/separator";
638 ad->setup.sp_itc->func.text_get = NULL;
639 ad->setup.sp_itc->func.content_get = NULL;
640 ad->setup.sp_itc->func.state_get = NULL;
641 ad->setup.sp_itc->func.del = NULL;
643 ad->setup.hide_itc = elm_genlist_item_class_new();
644 ad->setup.hide_itc->item_style = "dialogue/1text.1icon";
645 ad->setup.hide_itc->func.text_get = __gl_hide_label_get;
646 ad->setup.hide_itc->func.content_get = __gl_hide_icon_get;
647 ad->setup.hide_itc->func.state_get = NULL;
648 ad->setup.hide_itc->func.del = NULL;
650 ad->setup.security_itc = elm_genlist_item_class_new();
651 ad->setup.security_itc->item_style = "dialogue/1text.1icon";
652 ad->setup.security_itc->func.text_get = __gl_security_label_get;
653 ad->setup.security_itc->func.content_get = __gl_security_icon_get;
654 ad->setup.security_itc->func.state_get = NULL;
655 ad->setup.security_itc->func.del = NULL;
657 ad->setup.pw_itc = elm_genlist_item_class_new();
658 ad->setup.pw_itc->item_style = "dialogue/1icon";
659 ad->setup.pw_itc->func.text_get = NULL;
660 ad->setup.pw_itc->func.content_get = __gl_pw_icon_get;
661 ad->setup.pw_itc->func.state_get = NULL;
662 ad->setup.pw_itc->func.del = NULL;
664 ad->setup.name_itc = elm_genlist_item_class_new();
665 ad->setup.name_itc->item_style = "multiline/1text";
666 ad->setup.name_itc->func.text_get = __gl_name_label_get;
667 ad->setup.name_itc->func.content_get = NULL;
668 ad->setup.name_itc->func.state_get = NULL;
669 ad->setup.name_itc->func.del = NULL;
671 ad->setup.end_sp_itc = elm_genlist_item_class_new();
672 ad->setup.end_sp_itc->item_style = "dialogue/separator";
673 ad->setup.end_sp_itc->func.text_get = NULL;
674 ad->setup.end_sp_itc->func.content_get = NULL;
675 ad->setup.end_sp_itc->func.state_get = NULL;
676 ad->setup.end_sp_itc->func.del = NULL;
678 __MOBILE_AP_FUNC_EXIT__;
682 static void __deconstruct_wifi_setup_view(mh_wifi_setting_view_t *st)
684 __MOBILE_AP_FUNC_ENTER__;
691 if (st->pw_entry == NULL) {
692 ERR("pw_entry is NULL");
696 evas_object_smart_callback_del(st->hide_btn, "changed",
697 __hide_btn_changed_cb);
698 evas_object_smart_callback_del(st->security_btn, "changed",
699 __security_btn_changed_cb);
701 evas_object_smart_callback_del(st->pw_entry,
703 __passphrase_maxlength_reached_cb);
704 evas_object_smart_callback_del(st->pw_entry,
706 __passphrase_activated_cb);
708 evas_object_smart_callback_del(st->back_btn, "clicked",
710 evas_object_smart_callback_del(st->genlist, "realized",
714 st->security_btn = NULL;
715 st->pw_layout = NULL;
720 __MOBILE_AP_FUNC_EXIT__;
723 static void __back_btn_cb(void *data, Evas_Object *obj, void *event_info)
725 __MOBILE_AP_FUNC_ENTER__;
728 ERR("The param is NULL\n");
732 mh_appdata_t *ad = (mh_appdata_t *)data;
733 mh_wifi_setting_view_t *st = &ad->setup;
736 elm_object_focus_set(st->pw_entry, EINA_FALSE);
738 if (strlen(st->wifi_passphrase_new) < WIFI_PASSPHRASE_LENGTH_MIN) {
739 DBG("Password is shorter than %d\n", WIFI_PASSPHRASE_LENGTH_MIN);
740 _prepare_popup(ad, MH_POP_WIFI_PASSWORD_SHORT,
741 _("IDS_ST_BODY_ENTER_PASSWORD_OF_AT_LEAST_8_CHARACTERS"));
746 if (g_strcmp0(st->wifi_passphrase, st->wifi_passphrase_new) != 0) {
747 if (__save_wifi_passphrase(ad) == EINA_FALSE) {
748 ERR("__save_wifi_passphrase is failed\n");
752 if (ad->main.need_recover_wifi_tethering == true) {
753 DBG("Turn on Wi-Fi tethering again\n");
754 _update_wifi_item(ad, MH_STATE_PROCESS);
755 if (ad->main.help_item)
756 elm_genlist_item_update(ad->main.help_item);
758 ret = tethering_enable(ad->handle, TETHERING_TYPE_WIFI);
759 if (ret != TETHERING_ERROR_NONE) {
760 ERR("Wi-Fi tethering on is failed : %d\n", ret);
761 _update_wifi_item(ad, MH_STATE_NONE);
762 ad->main.need_recover_wifi_tethering = false;
766 __deconstruct_wifi_setup_view(st);
768 evas_object_del(ad->setup.genlist);
769 __free_genlist_itc(ad);
771 elm_naviframe_item_pop(ad->naviframe);
773 __MOBILE_AP_FUNC_EXIT__;
776 static void __title_back_btn_cb(void *data, Evas_Object *obj, void *event_info)
778 __MOBILE_AP_FUNC_ENTER__;
780 if (data == NULL || obj == NULL) {
781 ERR("Invalid param\n");
785 mh_appdata_t *ad = (mh_appdata_t *)data;
787 elm_object_focus_set(ad->setup.pw_entry, EINA_FALSE);
789 if (__save_wifi_passphrase(ad) == EINA_FALSE) {
790 ERR("__save_wifi_passphrase is failed\n");
794 __MOBILE_AP_FUNC_EXIT__;
799 static void __gl_realized(void *data, Evas_Object *obj, void *event_info)
801 __MOBILE_AP_FUNC_ENTER__;
803 mh_appdata_t *ad = (mh_appdata_t *)data;
804 mh_wifi_setting_view_t *st = &(ad->setup);
805 Elm_Object_Item *item = (Elm_Object_Item *)event_info;
807 if (item == st->hide_item) {
808 DBG("Hide item is realized\n");
809 elm_object_item_signal_emit(item, "elm,state,top", "");
810 } else if (item == st->security_item) {
811 DBG("Security item is realized\n");
812 elm_object_item_signal_emit(item, "elm,state,center", "");
813 } else if (item == st->pw_item) {
814 DBG("Password item is realized\n");
815 elm_object_item_signal_emit(item, "elm,state,bottom", "");
816 } else if (item == st->name_item) {
817 DBG("Name item is realized\n");
820 __MOBILE_AP_FUNC_EXIT__;
825 Evas_Object *__create_genlist(mh_appdata_t *ad)
827 __MOBILE_AP_FUNC_ENTER__;
834 void *data = (void *)ad;
835 mh_wifi_setting_view_t *st = &ad->setup;
836 Evas_Object *genlist;
837 Elm_Object_Item *item;
839 genlist = elm_genlist_add(ad->naviframe);
840 if (genlist == NULL) {
841 ERR("genlist is NULL\n");
845 elm_object_style_set(genlist, "dialogue");
846 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
847 evas_object_smart_callback_add(genlist, "realized", __gl_realized, ad);
849 __set_genlist_itc(ad);
850 item = elm_genlist_item_append(genlist, st->sp_itc, NULL, NULL,
851 ELM_GENLIST_ITEM_NONE, NULL, NULL);
852 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
854 st->hide_item = elm_genlist_item_append(genlist, st->hide_itc, data, NULL,
855 ELM_GENLIST_ITEM_NONE, __gl_hide_item_sel, data);
857 st->security_item = elm_genlist_item_append(genlist, st->security_itc, data, NULL,
858 ELM_GENLIST_ITEM_NONE, __gl_security_item_sel, data);
860 st->pw_item = elm_genlist_item_append(genlist, st->pw_itc, data, NULL,
861 ELM_GENLIST_ITEM_NONE, NULL, NULL);
862 elm_genlist_item_select_mode_set(st->pw_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
864 st->name_item = elm_genlist_item_append(genlist, st->name_itc, data, NULL,
865 ELM_GENLIST_ITEM_NONE, NULL, NULL);
866 elm_genlist_item_select_mode_set(st->name_item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
868 item = elm_genlist_item_append(genlist, st->end_sp_itc, NULL, NULL,
869 ELM_GENLIST_ITEM_NONE, NULL, NULL);
870 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
873 __MOBILE_AP_FUNC_EXIT__;
878 void mh_draw_wifi_setup_view(mh_appdata_t *ad)
880 __MOBILE_AP_FUNC_ENTER__;
887 mh_wifi_setting_view_t *st = &ad->setup;
889 if (st->genlist != NULL) {
890 ERR("Wi-Fi setup view already exists\n");
894 st->genlist = __create_genlist(ad);
895 if (st->genlist == NULL) {
896 ERR("__create_genlist returns NULL\n");
900 st->back_btn = elm_button_add(ad->naviframe);
901 if (st->back_btn == NULL) {
902 ERR("elm_button_add returns NULL\n");
905 elm_object_style_set(st->back_btn, "naviframe/back_btn/default");
906 evas_object_smart_callback_add(st->back_btn, "clicked",
909 st->navi_it = elm_naviframe_item_push(ad->naviframe,
910 _("IDS_MOBILEAP_MBODY_WI_FI_TETHERING_SETTINGS"),
911 st->back_btn, NULL, st->genlist, NULL);
913 st->title_back_btn = elm_button_add(ad->naviframe);
914 elm_object_style_set(st->title_back_btn, "naviframe/back_btn/default");
915 evas_object_smart_callback_add(st->title_back_btn, "clicked", __title_back_btn_cb, ad);
916 elm_object_item_part_content_set(st->navi_it, "title_prev_btn", st->title_back_btn);
918 __MOBILE_AP_FUNC_EXIT__;
924 evas_object_del(st->back_btn);
926 evas_object_del(st->genlist);