Add custom genlist stye for common profile
[apps/native/ug-wifi-efl.git] / sources / libraries / Common / common_ip_info.c
1 /*
2  * Wi-Fi
3  *
4  * Copyright 2012 Samsung Electronics Co., Ltd
5  *
6  * Licensed under the Flora License, Version 1.1 (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
9  *
10  * http://www.tizenopensource.org/license
11  *
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.
17  *
18  */
19
20 #include <glib.h>
21
22 #include "common.h"
23 #include "common_utils.h"
24 #include "ug_wifi.h"
25 #include "common_ip_info.h"
26 #include "i18nmanager.h"
27
28 #define DEFAULT_PROXY_ADDR              "0.0.0.0:80"
29 #define IPV4_DEFAULT_ADDR       "0.0.0.0"
30 #define IPV6_DEFAULT_ADDR       "::"
31
32 #define MAX_PORT_NUMBER         65535
33 #define MAX_LABEL_LENGTH        512
34
35 typedef struct {
36         char* title;
37         char* description;
38 } _view_detail_description_data_t;
39
40 static Elm_Object_Item* _add_description(Evas_Object* genlist, char* title,
41                 char* description, Elm_Object_Item* insert_after);
42
43 static Elm_Genlist_Item_Class *ip_toggle_itc ;
44 static Elm_Genlist_Item_Class *description_itc ;
45 static Elm_Genlist_Item_Class *ip_entry_itc;
46 static Evas_Object *curr_unfocus_entry = NULL;
47 static int curr_unfocuc_cursor_pos = 0;
48 static char *ip_info_text_list[ENTRY_TYPE_MAX];
49
50 extern genlist_info_t g_genlist_info[WIFI_GENLIST_STYLE_MAX];
51
52 static void _ip_info_set_current_unfocussed_entry(Evas_Object *entry)
53 {
54         if (entry == NULL)
55                 return;
56
57         curr_unfocus_entry = entry;
58         curr_unfocuc_cursor_pos = elm_entry_cursor_pos_get(entry);
59 }
60
61 static int _ip_info_is_current_unfocused_entry(Evas_Object *entry)
62 {
63         if (curr_unfocus_entry == entry)
64                 return curr_unfocuc_cursor_pos;
65         else
66                 return 0;
67 }
68
69 static void _ip_info_reset_current_unfocused_entry(void)
70 {
71         curr_unfocus_entry = NULL;
72         curr_unfocuc_cursor_pos = 0;
73 }
74
75 static void _gl_editbox_sel_cb(void *data, Evas_Object *obj, void *event_info)
76 {
77         Elm_Object_Item *item = (Elm_Object_Item *)event_info;
78         elm_genlist_item_selected_set(item, FALSE);
79 }
80
81 static void _ip_info_detail_description_del(void *data, Evas_Object *obj)
82 {
83         __COMMON_FUNC_ENTER__;
84
85         retm_if(NULL == data);
86
87         _view_detail_description_data_t* det = (_view_detail_description_data_t*) data;
88
89         g_free(det->description);
90         g_free(det->title);
91         g_free(det);
92         det = NULL;
93
94         __COMMON_FUNC_EXIT__;
95 }
96
97 static Evas_Object *_ip_info_detail_description_content_get(void *data,
98                 Evas_Object *obj, const char *part)
99 {
100         __COMMON_FUNC_ENTER__;
101         retvm_if(NULL == data || NULL == part, NULL);
102
103         _view_detail_description_data_t* det =
104                 (_view_detail_description_data_t*) data;
105
106         Evas_Object *layout = NULL;
107         Evas_Object *title_label = NULL;
108         UG_TYPE ug_type = common_util_get_ug_type();
109         char buf[MAX_LABEL_LENGTH] = {0, };
110         int font_size = ug_type == UG_VIEW_IOT_COMMON ? 20 : 40;
111
112         layout = elm_layout_add(obj);
113         if (ug_type == UG_VIEW_IOT_COMMON)
114                 elm_layout_file_set(layout, CUSTOM_GENLIST_PATH, "gl_custom_common_item");
115         else
116                 elm_layout_file_set(layout, CUSTOM_GENLIST_PATH, "gl_custom_item");
117
118         evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
119         evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
120
121         title_label = elm_label_add(obj);
122         snprintf(buf, MAX_LABEL_LENGTH, "<font_size=%d>%s</font_size>",
123                         font_size, dgettext(PACKAGE, det->title));
124
125         elm_object_text_set(title_label, buf);
126         evas_object_size_hint_weight_set(title_label, EVAS_HINT_EXPAND, 0);
127         evas_object_size_hint_align_set(title_label, EVAS_HINT_FILL, EVAS_HINT_FILL);
128         elm_object_part_content_set(layout, "elm.swallow.label", title_label);
129
130         if (det->description) {
131                 snprintf(buf, MAX_LABEL_LENGTH, "%s", dgettext(PACKAGE, det->description));
132                 elm_object_text_set(layout, buf);
133         }
134
135         __COMMON_FUNC_EXIT__;
136         return layout;
137 }
138
139 static void _ip_info_entry_key_enter_cb(void *data, Evas_Object *obj, void *event_info)
140 {
141         common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)data;
142         if (!entry_info)
143                 return;
144
145         Evas_Object *entry = NULL;
146         Elm_Object_Item *next_item = NULL;
147
148         switch (entry_info->entry_id) {
149         case ENTRY_TYPE_IP_ADDR:
150         case ENTRY_TYPE_SUBNET_MASK:
151         case ENTRY_TYPE_GATEWAY:
152         case ENTRY_TYPE_DNS_1:
153         case ENTRY_TYPE_PROXY_ADDR:
154         case ENTRY_TYPE_DNS_2:
155                 next_item = elm_genlist_item_next_get(entry_info->item);
156                 while (next_item) {
157                         if (elm_object_item_disabled_get(next_item) == EINA_FALSE &&
158                                 elm_genlist_item_select_mode_get(next_item) != ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) {
159                                 entry = elm_object_item_part_content_get(next_item, "elm.swallow.content");
160                                 if (entry) {
161                                         elm_object_focus_set(entry, EINA_TRUE);
162                                         return;
163                                 }
164                         }
165
166                         next_item = elm_genlist_item_next_get(next_item);
167                 }
168                 break;
169         case ENTRY_TYPE_PROXY_PORT:
170                 entry = elm_object_item_part_content_get(entry_info->item, "elm.swallow.content");
171                 if (entry)
172                         elm_object_focus_set(entry, EINA_FALSE);
173
174                 break;
175         default:
176                 break;
177         }
178 }
179
180 static void _ip_info_entry_cursor_changed_cb(void* data, Evas_Object* obj, void* event_info)
181 {
182         common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)data;
183         if (!entry_info)
184                 return;
185
186         if (elm_object_focus_get(obj)) {
187                 if (elm_entry_is_empty(obj))
188                         elm_object_item_signal_emit(entry_info->item, "elm,state,eraser,hide", "");
189                 else
190                         elm_object_item_signal_emit(entry_info->item, "elm,state,eraser,show", "");
191         }
192
193         if (entry_info->entry_txt) {
194                 g_free(entry_info->entry_txt);
195                 entry_info->entry_txt = NULL;
196         }
197
198         char *entry_text = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
199         if (entry_text != NULL && entry_text[0] != '\0')
200                 entry_info->entry_txt = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
201
202         g_free(entry_text);
203         entry_text = NULL;
204 }
205
206 static void _ip_info_entry_changed_cb(void *data,
207                 Evas_Object *obj, void *event_info)
208 {
209         common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)data;
210         if (!entry_info)
211                 return;
212
213         int entry_pos = 0;
214         char *entry_text = NULL;
215         char **ip_text = NULL;
216         int panel_type = 0;
217
218         if (obj == NULL)
219                 return;
220
221         if (elm_object_focus_get(obj)) {
222                 if (elm_entry_is_empty(obj))
223                         elm_object_item_signal_emit(entry_info->item, "elm,state,eraser,hide", "");
224                 else
225                         elm_object_item_signal_emit(entry_info->item, "elm,state,eraser,show", "");
226         }
227
228         panel_type = elm_entry_input_panel_layout_get(obj);
229         if (panel_type == ELM_INPUT_PANEL_LAYOUT_IP) {
230                 int i = 0;
231                 int ip_addr[4] = { 0 };
232                 char entry_ip_text[16] = { 0, };
233                 gboolean fixed = FALSE;
234                 entry_text = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
235                 ip_text = g_strsplit(entry_text, ".", 5);
236
237                 if (entry_text == NULL || entry_text[0] == '\0') {
238                         if (entry_info->entry_txt) {
239                                 g_free(entry_info->entry_txt);
240                                 entry_info->entry_txt = NULL;
241                         }
242
243                         entry_info->entry_txt = g_strdup(DEFAULT_GUIDE_IP);
244                         g_free(entry_text);
245                         entry_text = NULL;
246                 } else {
247                         for (i = 0; i < 5; i++) {
248                                 if (ip_text[i] == NULL)
249                                         break;
250
251                                 if (i == 4) {
252                                         fixed = TRUE;
253                                         break;
254                                 }
255
256                                 ip_addr[i] = atoi(ip_text[i]);
257                                 if (ip_addr[i] > 255) {
258                                         ip_addr[i] = 255;
259                                         fixed = TRUE;
260                                 }
261
262                                 if (i < 3)
263                                         g_snprintf(entry_text, 5, "%d.", ip_addr[i]);
264                                 else
265                                         g_snprintf(entry_text, 4, "%d", ip_addr[i]);
266
267                                 g_strlcat(entry_ip_text, entry_text, sizeof(entry_ip_text));
268                         }
269                         g_free(entry_text);
270                         g_strfreev(ip_text);
271                         entry_text = NULL;
272                         ip_text = NULL;
273
274                         if (fixed == TRUE) {
275                                 entry_pos = elm_entry_cursor_pos_get(obj);
276                                 elm_entry_entry_set(obj, entry_ip_text);
277                                 elm_entry_cursor_pos_set(obj, entry_pos+1);
278                         }
279                 }
280         } else if (panel_type == ELM_INPUT_PANEL_LAYOUT_NUMBERONLY) {
281                 int port_num = 0;
282
283                 entry_text = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
284                 if (entry_text == NULL || *entry_text == '\0')
285                         entry_info->entry_txt = NULL;
286
287                 if (entry_text != NULL)
288                         port_num = (int)strtol(entry_text, NULL, 10);
289
290                 if (port_num > MAX_PORT_NUMBER) {
291                         entry_pos = elm_entry_cursor_pos_get(obj);
292                         g_snprintf(entry_text, 6, "%d", MAX_PORT_NUMBER);
293                         elm_entry_entry_set(obj, entry_text);
294                         elm_entry_cursor_pos_set(obj, entry_pos);
295                 }
296
297                 g_free(entry_text);
298                 entry_text = NULL;
299         } else {
300                 entry_text = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
301                 if (entry_text == NULL || *entry_text == '\0')
302                         entry_info->entry_txt = NULL;
303
304                 g_free(entry_text);
305                 entry_text = NULL;
306         }
307 }
308
309 static void _ip_info_entry_focused_cb(void *data, Evas_Object *obj, void *event_info)
310 {
311         common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)data;
312         int curr_entry_pos = 0;
313
314         if (!entry_info)
315                 return;
316
317         curr_entry_pos = _ip_info_is_current_unfocused_entry(obj);
318
319         if (curr_entry_pos)
320                 elm_entry_cursor_pos_set(obj, curr_entry_pos);
321         else
322                 elm_entry_cursor_end_set(obj);
323
324         if (!elm_entry_is_empty(obj))
325                 elm_object_item_signal_emit(entry_info->item, "elm,state,eraser,show", "");
326
327         elm_object_item_signal_emit(entry_info->item, "elm,state,rename,hide", "");
328 }
329
330
331 static gboolean __is_valid_static_ip_string_length(const gchar *text)
332 {
333         if (!text) {
334                 INFO_LOG(UG_NAME_ERR, "IP address text is NULL");
335                 return FALSE;
336         } else {
337                 size_t len = strlen(text);
338                 if (len == 0 || len > 15) {
339                         INFO_LOG(UG_NAME_ERR, "IP address text string length is not valid");
340                         return FALSE;
341                 }
342         }
343         return TRUE;
344 }
345
346 static void _ip_info_entry_unfocused_cb(void *data, Evas_Object *obj, void *event_info)
347 {
348         common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)data;
349         if (!entry_info)
350                 return;
351
352         _ip_info_set_current_unfocussed_entry(obj);
353
354         int panel_type = elm_entry_input_panel_layout_get(obj);
355         if (panel_type == ELM_INPUT_PANEL_LAYOUT_IP) {
356                 char *entry_text = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
357                 if (!__is_valid_static_ip_string_length(entry_text)) {
358                         INFO_LOG(UG_NAME_ERR, "Invalid IP address.");
359                         free(entry_text);
360                         return;
361                 }
362                 if (entry_text && (strlen(entry_text) > 0)) {
363                         elm_entry_entry_set(obj, entry_text);
364                         if (entry_info->entry_txt) {
365                                 g_free(entry_info->entry_txt);
366                                 entry_info->entry_txt = NULL;
367                         }
368                         entry_info->entry_txt = g_strdup(entry_text);
369                 }
370                 g_free(entry_text);
371                 entry_text = NULL;
372         }
373
374         elm_object_item_signal_emit(entry_info->item, "elm,state,eraser,hide", "");
375         elm_object_item_signal_emit(entry_info->item, "elm,state,rename,show", "");
376 }
377
378 static void _ip_info_entry_del_callbacks(Elm_Object_Item *item)
379 {
380         if (item == NULL)
381                 return;
382
383         Evas_Object *entry = NULL;
384
385         entry = elm_object_item_part_content_get(item, "elm.icon.entry");
386         if (entry == NULL)
387                 return;
388
389         evas_object_smart_callback_del(entry, "activated",
390                         _ip_info_entry_key_enter_cb);
391         evas_object_smart_callback_del(entry, "cursor,changed",
392                         _ip_info_entry_cursor_changed_cb);
393         evas_object_smart_callback_del(entry, "changed",
394                         _ip_info_entry_changed_cb);
395         evas_object_smart_callback_del(entry, "focused",
396                         _ip_info_entry_focused_cb);
397         evas_object_smart_callback_del(entry, "unfocused",
398                         _ip_info_entry_unfocused_cb);
399 }
400
401 static void _ip_info_entry_add_callbacks(Evas_Object *entry,
402                 common_utils_entry_info_t *entry_info)
403 {
404         if (entry == NULL)
405                 return;
406
407         evas_object_smart_callback_add(entry, "activated",
408                         _ip_info_entry_key_enter_cb, entry_info);
409         evas_object_smart_callback_add(entry, "cursor,changed",
410                         _ip_info_entry_cursor_changed_cb, entry_info);
411         evas_object_smart_callback_add(entry, "changed",
412                         _ip_info_entry_changed_cb, entry_info);
413         evas_object_smart_callback_add(entry, "focused",
414                         _ip_info_entry_focused_cb, entry_info);
415         evas_object_smart_callback_add(entry, "unfocused",
416                         _ip_info_entry_unfocused_cb, entry_info);
417 }
418
419 static Evas_Object *_ip_info_entry_item_content_get(void *data, Evas_Object *obj, const char *part)
420 {
421         common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)data;
422         if (!entry_info)
423                 return NULL;
424
425         Evas_Object *layout = NULL;
426         Evas_Object *label = NULL;
427         Evas_Object *editfield = NULL;
428         char *guide_txt = NULL;
429         char *accepted = NULL;
430         Elm_Input_Panel_Layout panel_type;
431         UG_TYPE ug_type = common_util_get_ug_type();
432         int return_key_type;
433         char buf[MAX_LABEL_LENGTH] = {0, };
434         int font_size = ug_type == UG_VIEW_IOT_COMMON ? 20 : 40;
435
436         switch (entry_info->entry_id) {
437         case ENTRY_TYPE_IP_ADDR:
438         case ENTRY_TYPE_SUBNET_MASK:
439         case ENTRY_TYPE_GATEWAY:
440         case ENTRY_TYPE_DNS_1:
441         case ENTRY_TYPE_DNS_2:
442                 guide_txt = entry_info->guide_txt;
443                 panel_type = ELM_INPUT_PANEL_LAYOUT_IP;
444                 return_key_type = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT;
445                 accepted = "0123456789.";
446                 break;
447         case ENTRY_TYPE_PROXY_ADDR:
448                 guide_txt = DEFAULT_GUIDE_PROXY_IP;
449                 panel_type = ELM_INPUT_PANEL_LAYOUT_URL;
450                 return_key_type = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT;
451                 /* Temporary fix */
452                 /* accepted = "0123456789.abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ"; */
453                 break;
454         case ENTRY_TYPE_PROXY_PORT:
455                 guide_txt = DEFAULT_GUIDE_PROXY_PORT;
456                 panel_type = ELM_INPUT_PANEL_LAYOUT_NUMBERONLY;
457                 return_key_type = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE;
458                 accepted = "0123456789";
459                 break;
460         default:
461                 return NULL;
462         }
463
464         layout = elm_layout_add(obj);
465         if (ug_type == UG_VIEW_IOT_COMMON)
466                 elm_layout_file_set(layout, CUSTOM_GENLIST_PATH, "gl_custom_common_item");
467         else
468                 elm_layout_file_set(layout, CUSTOM_GENLIST_PATH, "gl_custom_item");
469
470         evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
471         evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
472
473         snprintf(buf, MAX_LABEL_LENGTH, "<font_size=%d>%s</font_size>",
474                         font_size, dgettext(PACKAGE, entry_info->title_txt));
475
476         label = elm_label_add(obj);
477         evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0);
478         evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
479         elm_object_text_set(label, buf);
480         elm_object_part_content_set(layout, "elm.swallow.label", label);
481
482         editfield = elm_entry_add(obj);
483         elm_entry_single_line_set(editfield, EINA_TRUE);
484         elm_entry_scrollable_set(editfield, EINA_TRUE);
485
486         if (!g_strcmp0(entry_info->str_pkg_name, "wifi-qs"))
487                 elm_entry_input_panel_imdata_set(editfield, "type=systempopup", 16);
488
489         elm_entry_cnp_mode_set(editfield, ELM_CNP_MODE_PLAINTEXT);
490
491         elm_object_part_text_set(editfield, "elm.guide", guide_txt);
492         if (entry_info->entry_txt && (strlen(entry_info->entry_txt) > 0) &&
493                         g_strcmp0(entry_info->entry_txt, DEFAULT_GUIDE_IP) != 0) {
494                 elm_entry_entry_set(editfield, entry_info->entry_txt);
495         }
496
497         elm_entry_input_panel_layout_set(editfield, panel_type);
498
499         Elm_Entry_Filter_Accept_Set digits_filter_data;
500         memset(&digits_filter_data, 0, sizeof(Elm_Entry_Filter_Accept_Set));
501         digits_filter_data.accepted = accepted;
502         elm_entry_markup_filter_append(editfield, elm_entry_filter_accept_set, &digits_filter_data);
503
504         if (entry_info->input_panel_cb) {
505                 Ecore_IMF_Context *imf_ctxt = elm_entry_imf_context_get(editfield);
506                 if (imf_ctxt) {
507                         ecore_imf_context_input_panel_event_callback_add(
508                                         imf_ctxt,
509                                         ECORE_IMF_INPUT_PANEL_STATE_EVENT,
510                                         entry_info->input_panel_cb,
511                                         entry_info->input_panel_cb_data);
512                 }
513         }
514
515         elm_entry_input_panel_return_key_type_set(editfield, return_key_type);
516         _ip_info_entry_add_callbacks(editfield, entry_info);
517         elm_object_part_content_set(layout, "elm.swallow.content", editfield);
518
519         return layout;
520 }
521
522 static void _ip_info_entry_item_del(void *data, Evas_Object *obj)
523 {
524         common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)data;
525         if (entry_info == NULL)
526                 return;
527
528         g_free(ip_info_text_list[entry_info->entry_id]);
529         ip_info_text_list[entry_info->entry_id] = NULL;
530
531         if (entry_info->entry_txt) {
532                 ip_info_text_list[entry_info->entry_id] = g_strdup(entry_info->entry_txt);
533                 g_free(entry_info->entry_txt);
534                 entry_info->entry_txt = NULL;
535         }
536
537         g_free(entry_info);
538         entry_info = NULL;
539 }
540
541 #ifdef ACCESSIBLITY_FEATURE
542 static char *_access_info_cb(void *data, Evas_Object *obj)
543 {
544         common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)data;
545         if (!entry_info)
546                 return NULL;
547
548         if (entry_info->entry_txt)
549                 return g_strdup_printf("%s %s", entry_info->title_txt, entry_info->entry_txt);
550         else
551                 return g_strdup_printf("%s %s", entry_info->title_txt, entry_info->guide_txt);
552 }
553 #endif
554
555 static void _create_static_ip_table(full_ip_info_t *ip_data)
556 {
557         char *txt = NULL;
558         retm_if(NULL == ip_data);
559
560         ip_info_list_t *ip_info_list_data = ip_data->ip_info_list;
561         prev_ip_info_t *prev_ip_info = ip_data->prev_ip_info;
562         common_utils_entry_info_t *edit_box_details;
563         wifi_manager_ip_config_type_e ip_type;
564
565         retm_if(NULL == prev_ip_info || NULL == ip_info_list_data);
566         wifi_manager_ap_h ap = ip_info_list_data->ap;
567         __COMMON_FUNC_ENTER__;
568
569         /* IP Address */
570         int ret = wifi_manager_ap_get_ip_config_type(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &ip_type);
571         if (ret != WIFI_MANAGER_ERROR_NONE)
572                 INFO_LOG(UG_NAME_ERR, "Failed to get IP config_type! [%d]", ret);
573
574         edit_box_details = g_try_new0(common_utils_entry_info_t, 1);
575         if (edit_box_details == NULL)
576                 return;
577
578         edit_box_details->entry_id = ENTRY_TYPE_IP_ADDR;
579         edit_box_details->title_txt = "IDS_WIFI_BODY_IP_ADDRESS";
580         if (ip_type == WIFI_MANAGER_IP_CONFIG_TYPE_DYNAMIC)
581                 edit_box_details->entry_txt = g_strdup(DEFAULT_GUIDE_IP);
582         else {
583                 ret = wifi_manager_ap_get_ip_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
584                 if (ret != WIFI_MANAGER_ERROR_NONE)
585                         INFO_LOG(UG_NAME_ERR, "Failed to get IP Address! [%d]", ret);
586                 edit_box_details->entry_txt = txt;
587         }
588         edit_box_details->guide_txt = DEFAULT_GUIDE_IP;
589         edit_box_details->str_pkg_name = ip_info_list_data->str_pkg_name;
590         edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb;
591         edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data;
592         edit_box_details->item = elm_genlist_item_insert_after(
593                         ip_info_list_data->genlist, ip_entry_itc,
594                         edit_box_details, NULL, ip_info_list_data->ip_toggle_item,
595                         ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
596 #ifdef ACCESSIBLITY_FEATURE
597         Evas_Object *ao = elm_object_item_access_object_get(edit_box_details->item);
598         elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details);
599 #endif
600         ip_info_list_data->ip_addr_item = edit_box_details->item;
601
602         if (ip_data->is_first_create == TRUE)
603                 prev_ip_info->ip_addr = g_strdup(txt);
604
605         /* Subnet Mask */
606         edit_box_details = g_try_new0(common_utils_entry_info_t, 1);
607         if (edit_box_details == NULL)
608                 return;
609
610         edit_box_details->entry_id = ENTRY_TYPE_SUBNET_MASK;
611         edit_box_details->title_txt = "IDS_WIFI_BODY_SUBNET_MASK";
612         if (ip_type == WIFI_MANAGER_IP_CONFIG_TYPE_DYNAMIC)
613                 edit_box_details->entry_txt = g_strdup(DEFAULT_GUIDE_IP);
614         else {
615                 ret = wifi_manager_ap_get_subnet_mask(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
616                 if (ret != WIFI_MANAGER_ERROR_NONE)
617                         INFO_LOG(UG_NAME_ERR, "Failed to get subnet mask! [%d]", ret);
618                 edit_box_details->entry_txt = txt;
619         }
620         edit_box_details->guide_txt = DEFAULT_GUIDE_IP;
621         edit_box_details->str_pkg_name = ip_info_list_data->str_pkg_name;
622         edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb;
623         edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data;
624         edit_box_details->item = elm_genlist_item_insert_after(
625                         ip_info_list_data->genlist, ip_entry_itc,
626                         edit_box_details, NULL, ip_info_list_data->ip_addr_item,
627                         ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
628 #ifdef ACCESSIBLITY_FEATURE
629         ao = elm_object_item_access_object_get(edit_box_details->item);
630         elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details);
631 #endif
632         ip_info_list_data->subnet_mask_item = edit_box_details->item;
633
634         if (ip_data->is_first_create == TRUE)
635                 prev_ip_info->subnet_mask = g_strdup(txt);
636
637         /* Gateway Address */
638         ret = wifi_manager_ap_get_gateway_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
639         if (ret != WIFI_MANAGER_ERROR_NONE)
640                 INFO_LOG(UG_NAME_ERR, "Failed to get gateway address! [%d]", ret);
641
642         edit_box_details = g_try_new0(common_utils_entry_info_t, 1);
643         if (edit_box_details == NULL)
644                 return;
645
646         edit_box_details->entry_id = ENTRY_TYPE_GATEWAY;
647         edit_box_details->title_txt = "IDS_WIFI_BODY_GATEWAY_ADDRESS";
648         edit_box_details->entry_txt = txt;
649         edit_box_details->guide_txt = DEFAULT_GUIDE_IP;
650         edit_box_details->str_pkg_name = ip_info_list_data->str_pkg_name;
651         edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb;
652         edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data;
653         edit_box_details->item = elm_genlist_item_insert_after(
654                         ip_info_list_data->genlist, ip_entry_itc,
655                         edit_box_details, NULL, ip_info_list_data->subnet_mask_item,
656                         ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
657 #ifdef ACCESSIBLITY_FEATURE
658         ao = elm_object_item_access_object_get(edit_box_details->item);
659         elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details);
660 #endif
661         ip_info_list_data->gateway_addr_item = edit_box_details->item;
662
663         if (ip_data->is_first_create == TRUE)
664                 prev_ip_info->gateway_addr = g_strdup(txt);
665
666         /* Network Prefix Length */
667         Elm_Object_Item* item = NULL;
668         ret = wifi_manager_ap_get_subnet_mask(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV6, &txt);
669         INFO_LOG(UG_NAME_ERR, "Prefix Length =  [%s]", txt);
670         if (ret != WIFI_MANAGER_ERROR_NONE)
671                 INFO_LOG(UG_NAME_ERR, "Failed to get prefix length! [%d]", ret);
672
673         item = _add_description(ip_info_list_data->genlist,
674                         "IDS_ST_BODY_NETWORK_PREFIX_LENGTH", txt, ip_info_list_data->gateway_addr_item);
675         ip_info_list_data->prefix_length_item = item;
676
677         g_free(txt);
678         txt = NULL;
679
680         /* DNS 1 */
681         ret = wifi_manager_ap_get_dns_address(ap, 1, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
682         if (ret != WIFI_MANAGER_ERROR_NONE)
683                 INFO_LOG(UG_NAME_ERR, "Failed to get DNS 1 Address! [%d]", ret);
684
685         edit_box_details = g_try_new0(common_utils_entry_info_t, 1);
686         if (edit_box_details == NULL)
687                 return;
688
689         edit_box_details->entry_id = ENTRY_TYPE_DNS_1;
690         edit_box_details->title_txt = "IDS_WIFI_BODY_DNS_1";
691         edit_box_details->entry_txt = txt;
692         edit_box_details->guide_txt = DEFAULT_GUIDE_IP;
693         edit_box_details->str_pkg_name = ip_info_list_data->str_pkg_name;
694         edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb;
695         edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data;
696         edit_box_details->item = elm_genlist_item_insert_after(
697                         ip_info_list_data->genlist, ip_entry_itc,
698                         edit_box_details, NULL, ip_info_list_data->prefix_length_item,
699                         ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
700 #ifdef ACCESSIBLITY_FEATURE
701         ao = elm_object_item_access_object_get(edit_box_details->item);
702         elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details);
703 #endif
704         ip_info_list_data->dns_1_item = edit_box_details->item;
705
706         if (ip_data->is_first_create == TRUE)
707                 prev_ip_info->dns_1 = g_strdup(txt);
708
709         /* DNS 2 */
710         ret = wifi_manager_ap_get_dns_address(ap, 2, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
711         if (ret != WIFI_MANAGER_ERROR_NONE)
712                 INFO_LOG(UG_NAME_ERR, "Failed to get DNS 2 Address! [%d]", ret);
713
714         edit_box_details = g_try_new0(common_utils_entry_info_t, 1);
715         if (edit_box_details == NULL)
716                 return;
717
718         edit_box_details->entry_id = ENTRY_TYPE_DNS_2;
719         edit_box_details->title_txt = "IDS_WIFI_BODY_DNS_2";
720         edit_box_details->entry_txt = txt;
721         edit_box_details->guide_txt = DEFAULT_GUIDE_IP;
722         edit_box_details->str_pkg_name = ip_info_list_data->str_pkg_name;
723         edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb;
724         edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data;
725         edit_box_details->item = elm_genlist_item_insert_after(
726                         ip_info_list_data->genlist, ip_entry_itc,
727                         edit_box_details, NULL, ip_info_list_data->dns_1_item,
728                         ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL);
729 #ifdef ACCESSIBLITY_FEATURE
730         ao = elm_object_item_access_object_get(edit_box_details->item);
731         elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details);
732 #endif
733         ip_info_list_data->dns_2_item = edit_box_details->item;
734
735         if (ip_data->is_first_create == TRUE)
736                 prev_ip_info->dns_2 = g_strdup(txt);
737
738         ip_data->is_first_create = FALSE;
739
740         __COMMON_FUNC_EXIT__;
741
742         return;
743 }
744
745 static void _delete_static_ip_table(ip_info_list_t *ip_info_list_data)
746 {
747         __COMMON_FUNC_ENTER__;
748
749         retm_if(NULL == ip_info_list_data);
750
751         _ip_info_reset_current_unfocused_entry();
752
753         _ip_info_entry_del_callbacks(ip_info_list_data->ip_addr_item);
754         elm_object_item_del(ip_info_list_data->ip_addr_item);
755         ip_info_list_data->ip_addr_item = NULL;
756
757         _ip_info_entry_del_callbacks(ip_info_list_data->subnet_mask_item);
758         elm_object_item_del(ip_info_list_data->subnet_mask_item);
759         ip_info_list_data->subnet_mask_item = NULL;
760
761         _ip_info_entry_del_callbacks(ip_info_list_data->gateway_addr_item);
762         elm_object_item_del(ip_info_list_data->gateway_addr_item);
763         ip_info_list_data->gateway_addr_item = NULL;
764
765         elm_object_item_del(ip_info_list_data->prefix_length_item);
766         ip_info_list_data->prefix_length_item = NULL;
767
768         _ip_info_entry_del_callbacks(ip_info_list_data->dns_1_item);
769         elm_object_item_del(ip_info_list_data->dns_1_item);
770         ip_info_list_data->dns_1_item = NULL;
771
772         _ip_info_entry_del_callbacks(ip_info_list_data->dns_2_item);
773         elm_object_item_del(ip_info_list_data->dns_2_item);
774         ip_info_list_data->dns_2_item = NULL;
775
776         __COMMON_FUNC_EXIT__;
777 }
778
779 static gboolean __genlist_item_disable_later(void *data)
780 {
781         elm_genlist_item_selected_set((Elm_Object_Item *)data, FALSE);
782
783         return FALSE;
784 }
785
786 static void _gl_deselect_callback(void* data,
787                 Evas_Object* obj, void* event_info)
788 {
789         common_util_managed_idle_add(__genlist_item_disable_later, event_info);
790 }
791
792 static char* _ip_info_iptoggle_text_get(void *data, Evas_Object *obj,
793                 const char *part)
794 {
795
796         retvm_if(NULL == data || NULL == part, NULL);
797         full_ip_info_t *ip_data = (full_ip_info_t *) data;
798
799         if (!strcmp(g_genlist_info[WIFI_GENLIST_1LINE_STYLE].text_part, part)) {
800                 ip_info_list_t *ip_info_list_data = ip_data->ip_info_list;
801 #ifdef ACCESSIBLITY_FEATURE
802                 char buf[100];
803                 Evas_Object *ao = elm_object_item_access_object_get(ip_info_list_data->ip_toggle_item);
804                 g_snprintf(buf, sizeof(buf), "%s%s%s",
805                                                 sc(ip_info_list_data->str_pkg_name, I18N_TYPE_On),
806                                                 sc(ip_info_list_data->str_pkg_name, I18N_TYPE_Off),
807                                                 sc(ip_info_list_data->str_pkg_name, I18N_TYPE_Button));
808                 elm_access_info_set(ao, ELM_ACCESS_TYPE, buf);
809
810                 if (WIFI_MANAGER_IP_CONFIG_TYPE_STATIC == ip_info_list_data->ip_type)
811                         elm_access_info_set(ao, ELM_ACCESS_STATE, sc(ip_info_list_data->str_pkg_name, I18N_TYPE_On));
812                 else
813                         elm_access_info_set(ao, ELM_ACCESS_STATE, sc(ip_info_list_data->str_pkg_name, I18N_TYPE_Off));
814 #endif
815                 return (char*)g_strdup(sc(ip_info_list_data->str_pkg_name, I18N_TYPE_Static_IP));
816         }
817
818         return NULL;
819 }
820
821 static Elm_Object_Item* _add_description(Evas_Object* genlist, char* title,
822                 char* description, Elm_Object_Item* insert_after)
823 {
824         retvm_if(NULL == genlist, NULL);
825
826         _view_detail_description_data_t* description_data =
827                         g_try_new0(_view_detail_description_data_t, 1);
828         retvm_if(NULL == description_data, NULL);
829
830         description_data->title = g_strdup(title);
831         description_data->description = g_strdup(description);
832
833         Elm_Object_Item* det = NULL;
834         if (insert_after) {
835                 det = elm_genlist_item_insert_after(
836                                 genlist, /*obj*/
837                                 description_itc,/*itc*/
838                                 description_data,/*data*/
839                                 NULL,/*parent*/
840                                 insert_after, /*after than*/
841                                 ELM_GENLIST_ITEM_NONE, /*flags*/
842                                 _gl_deselect_callback,/*func*/
843                                 NULL);/*func_data*/
844         } else {
845                 det = elm_genlist_item_append(
846                                 genlist,
847                                 description_itc,
848                                 description_data,
849                                 NULL,
850                                 ELM_GENLIST_ITEM_NONE,
851                                 _gl_deselect_callback,
852                                 NULL);
853         }
854
855         elm_genlist_item_select_mode_set(det, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
856         elm_object_item_disabled_set(det, TRUE);
857
858         return det;
859 }
860
861 static bool __ap_foreach_ipv6_callback(char *ipv6_address, void *user_data)
862 {
863         char **buf = NULL;
864         buf = user_data;
865         if (*buf == NULL) {
866                 if (!(*buf = (char *)malloc(strlen(ipv6_address) + 1))) {
867                         ERROR_LOG(UG_NAME_ERR, "Failed to allocate memory");
868                         return false;
869                 }
870                 *buf[0] = '\0';
871                 strncpy(*buf, ipv6_address, strlen(ipv6_address) + 1);
872         } else {
873                 if (!(*buf = (char *)realloc(*buf, strlen(*buf) + strlen(ipv6_address) + 5))) {
874                         ERROR_LOG(UG_NAME_ERR, "Failed to realloc memory");
875                         return false;
876                 }
877                 strncat(*buf, "<br>", 5);
878                 strncat(*buf, ipv6_address, strlen(ipv6_address) + 1);
879         }
880
881         return true;
882 }
883
884 static void __ip_info_toggle_item_sel_cb(void* data,
885                 Evas_Object* obj, void* event_info)
886 {
887         __COMMON_FUNC_ENTER__;
888
889         const char *object_type;
890         ip_info_list_t *ip_info_list_data = NULL;
891         wifi_manager_ip_config_type_e ip_type = WIFI_MANAGER_IP_CONFIG_TYPE_DYNAMIC;
892         full_ip_info_t *ip_data = (full_ip_info_t *)data;
893         retm_if(ip_data == NULL);
894         ip_info_list_data = ip_data->ip_info_list;
895         if (ip_info_list_data == NULL) {
896                 __COMMON_FUNC_EXIT__;
897                 return;
898         }
899
900         wifi_manager_ap_h ap = ip_info_list_data->ap;
901
902         object_type = evas_object_type_get(obj);
903
904         if (g_strcmp0(object_type, "elm_check") == 0) {
905                 Eina_Bool ip_mode = elm_check_state_get(obj);
906
907                 if (ip_mode == TRUE)
908                         ip_type = WIFI_MANAGER_IP_CONFIG_TYPE_STATIC;
909                 else
910                         ip_type = WIFI_MANAGER_IP_CONFIG_TYPE_DYNAMIC;
911         } else if (g_strcmp0(object_type, "elm_genlist") == 0) {
912                 elm_genlist_item_selected_set(ip_info_list_data->ip_toggle_item,
913                                 EINA_FALSE);
914
915                 if (ip_info_list_data->ip_type == WIFI_MANAGER_IP_CONFIG_TYPE_STATIC)
916                         ip_type = WIFI_MANAGER_IP_CONFIG_TYPE_DYNAMIC;
917                 else
918                         ip_type = WIFI_MANAGER_IP_CONFIG_TYPE_STATIC;
919         }
920
921         if (ip_type == WIFI_MANAGER_IP_CONFIG_TYPE_DYNAMIC) {
922                 char *ip_addr = NULL;
923                 char *ipv6_addr = NULL;
924
925                 /* Hide input keypad if popped out */
926                 ecore_imf_input_panel_hide();
927
928                 _delete_static_ip_table(ip_info_list_data);
929
930                 wifi_manager_ap_get_ip_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &ip_addr);
931                 wifi_manager_ap_foreach_ipv6_address(ap, __ap_foreach_ipv6_callback, &ipv6_addr);
932
933                 /* Dynamic IP Address */
934                 ip_info_list_data->ip_addr_item = _add_description(
935                                 ip_info_list_data->genlist,
936                                 "IDS_WIFI_BODY_IP_ADDRESS",
937                                 NULL,
938                                 ip_info_list_data->ip_toggle_item);
939
940                 if (g_strcmp0(ip_addr, IPV4_DEFAULT_ADDR) || (!g_strcmp0(ip_addr, IPV4_DEFAULT_ADDR) && !g_strcmp0(ipv6_addr, IPV6_DEFAULT_ADDR)))
941                         ip_info_list_data->ipv4_addr_item = _add_description(
942                                         ip_info_list_data->genlist,
943                                         "IDS_ST_BODY_IPV4",
944                                         ip_addr,
945                                         ip_info_list_data->ip_addr_item);
946
947                 if (g_strcmp0(ipv6_addr, IPV6_DEFAULT_ADDR)) {
948                         if (ip_info_list_data->ipv4_addr_item)
949                                 ip_info_list_data->ipv6_addr_item = _add_description(
950                                                 ip_info_list_data->genlist,
951                                                 "IDS_ST_BODY_IPV6",
952                                                 ipv6_addr,
953                                                 ip_info_list_data->ipv4_addr_item);
954                         else
955                                 ip_info_list_data->ipv6_addr_item = _add_description(
956                                                 ip_info_list_data->genlist,
957                                                 "IDS_ST_BODY_IPV6",
958                                                 ipv6_addr,
959                                                 ip_info_list_data->ip_addr_item);
960
961                 }
962
963                 g_free(ip_addr);
964                 ip_addr = NULL;
965
966                 g_free(ipv6_addr);
967                 ipv6_addr = NULL;
968
969                 ip_info_list_data->ip_type = WIFI_MANAGER_IP_CONFIG_TYPE_DYNAMIC;
970         } else if (ip_type == WIFI_MANAGER_IP_CONFIG_TYPE_STATIC) {
971                 elm_object_item_del(ip_info_list_data->ip_addr_item);
972                 ip_info_list_data->ip_addr_item = NULL;
973
974                 elm_object_item_del(ip_info_list_data->ipv4_addr_item);
975                 ip_info_list_data->ipv4_addr_item = NULL;
976
977                 elm_object_item_del(ip_info_list_data->ipv6_addr_item);
978                 ip_info_list_data->ipv6_addr_item = NULL;
979
980                 ip_data->is_first_create = FALSE;
981
982                 /* Create the entry layouts */
983                 _create_static_ip_table(ip_data);
984                 ip_info_list_data->ip_type = WIFI_MANAGER_IP_CONFIG_TYPE_STATIC;
985         }
986
987         if (ip_info_list_data->ip_toggle_item != NULL)
988                 elm_genlist_item_update(ip_info_list_data->ip_toggle_item);
989
990         __COMMON_FUNC_EXIT__;
991 }
992
993 static Evas_Object *_ip_info_iptoggle_content_get(void *data,
994                 Evas_Object *obj, const char *part)
995 {
996         __COMMON_FUNC_ENTER__;
997
998         retvm_if(NULL == data || NULL == obj || NULL == part, NULL);
999         full_ip_info_t *ip_data = (full_ip_info_t *) data;
1000         ip_info_list_t *ip_info_list_data = ip_data->ip_info_list;
1001         Evas_Object *toggle_btn = NULL;
1002
1003         if (!strcmp(g_genlist_info[WIFI_GENLIST_1LINE_STYLE].sub_content_part, part)) {
1004                 toggle_btn = elm_check_add(obj);
1005                 elm_object_style_set(toggle_btn, "on&off");
1006                 elm_object_focus_allow_set(toggle_btn, EINA_FALSE);
1007
1008                 if (WIFI_MANAGER_IP_CONFIG_TYPE_STATIC == ip_info_list_data->ip_type)
1009                         elm_check_state_set(toggle_btn, EINA_TRUE);
1010                 else
1011                         elm_check_state_set(toggle_btn, EINA_FALSE);
1012
1013                 evas_object_propagate_events_set(toggle_btn, EINA_FALSE);
1014                 evas_object_size_hint_align_set(toggle_btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
1015                 evas_object_size_hint_weight_set(toggle_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1016                 evas_object_smart_callback_add(toggle_btn, "changed",
1017                                 __ip_info_toggle_item_sel_cb, ip_data);
1018         }
1019
1020         __COMMON_FUNC_EXIT__;
1021         return toggle_btn;
1022 }
1023
1024 #if 0
1025 static void ip_info_print_values(wifi_manager_ap_h ap)
1026 {
1027         char *txt;
1028         wifi_manager_ip_config_type_e type = WIFI_MANAGER_IP_CONFIG_TYPE_NONE;
1029
1030         wifi_manager_ap_get_ip_config_type(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &type);
1031         if (WIFI_MANAGER_IP_CONFIG_TYPE_STATIC == type) {
1032                 DEBUG_LOG(UG_NAME_NORMAL, "* STATIC CONFIGURATION *");
1033
1034                 /* IP Address */
1035                 wifi_manager_ap_get_ip_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
1036                 SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* IP address [%s]", txt);
1037                 g_free(txt);
1038
1039                 /* Subnet Mask */
1040                 wifi_manager_ap_get_subnet_mask(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
1041                 SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* Subnet Mask [%s]", txt);
1042                 g_free(txt);
1043
1044                 /* Gateway Address */
1045                 wifi_manager_ap_get_gateway_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
1046                 SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* Gateway address [%s]", txt);
1047                 g_free(txt);
1048
1049                 /* DNS 1 */
1050                 wifi_manager_ap_get_dns_address(ap, 1, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
1051                 SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* DNS-1 address [%s]", txt);
1052                 g_free(txt);
1053
1054                 /* DNS 2 */
1055                 wifi_manager_ap_get_dns_address(ap, 2, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
1056                 SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* DNS-2 address [%s]", txt);
1057                 g_free(txt);
1058
1059         } else if (WIFI_MANAGER_IP_CONFIG_TYPE_DYNAMIC == type) {
1060                 DEBUG_LOG(UG_NAME_NORMAL, "* DYNAMIC CONFIGURATION *");
1061
1062                 /* Dynamic IP Address */
1063                 wifi_manager_ap_get_ip_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
1064                 SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* IP address [%s]", txt);
1065                 g_free(txt);
1066         }
1067
1068         /* Mac address */
1069         wifi_get_mac_address(&txt);
1070         SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* MAC address [%s]", txt);
1071         g_free(txt);
1072         txt = NULL;
1073
1074         wifi_manager_ap_get_proxy_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt);
1075         assertm_if(NULL == txt, "NULL!!");
1076
1077         if (!txt || !strlen(txt)) {
1078                 if (txt)
1079                         g_free(txt);
1080                 txt = g_strdup(DEFAULT_PROXY_ADDR);
1081         }
1082
1083         /* Proxy Address */
1084         char *save_str = NULL;
1085         char *proxy_addr = strtok_r(txt, ":", &save_str);
1086         SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* PROXY ADDR [%s]", proxy_addr);
1087
1088         /* Proxy port */
1089         char *proxy_port = strtok_r(NULL, ":", &save_str);
1090         SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* PROXY PORT [%s]", proxy_port);
1091         g_free(txt);
1092 }
1093 #endif
1094
1095 #define EMULATOR_MAC_ADDR_SIZE  6
1096 #define EMULATOR_MAC_ADDR_MAX   20
1097 static int ip_info_emulator_get_random_mac(unsigned char *buf)
1098 {
1099         __COMMON_FUNC_ENTER__;
1100
1101         FILE *fp;
1102         int rc;
1103
1104         fp = fopen("/dev/urandom", "rb");
1105         if (fp == NULL) {
1106                 ERROR_LOG(UG_NAME_ERR, "Could not open /dev/urandom");
1107                 return -1;
1108         }
1109
1110         rc = fread(buf, 1, EMULATOR_MAC_ADDR_SIZE, fp);
1111         if (fp)
1112                 fclose(fp);
1113
1114         return rc != EMULATOR_MAC_ADDR_SIZE ? -1 : 0;
1115 }
1116
1117 void ip_info_delete_prev(prev_ip_info_t *prev_ip_info)
1118 {
1119         retm_if(NULL == prev_ip_info);
1120
1121         __COMMON_FUNC_ENTER__;
1122
1123         g_free(prev_ip_info->ip_addr);
1124         g_free(prev_ip_info->subnet_mask);
1125         g_free(prev_ip_info->gateway_addr);
1126         g_free(prev_ip_info->dns_1);
1127         g_free(prev_ip_info->dns_2);
1128         g_free(prev_ip_info->proxy_data);
1129         g_free(prev_ip_info);
1130
1131         __COMMON_FUNC_EXIT__;
1132 }
1133
1134 full_ip_info_t *ip_info_append_items(wifi_manager_ap_h ap, const char *pkg_name,
1135                 Evas_Object *genlist, imf_ctxt_panel_cb_t input_panel_cb, void *input_panel_cb_data)
1136 {
1137         __COMMON_FUNC_ENTER__;
1138         int ret = WIFI_MANAGER_ERROR_NONE;
1139         char *proxy_data = NULL;
1140         char *proxy_addr = NULL;
1141         char *proxy_port = NULL;
1142         Elm_Object_Item* item = NULL;
1143         common_utils_entry_info_t *edit_box_details;
1144         wifi_manager_proxy_type_e proxy_type;
1145         char *ip_addr = NULL;
1146         char *ipv6_addr = NULL;
1147         char *temp = NULL;
1148         char *str2 = NULL;
1149         full_ip_info_t *ip_data = NULL;
1150         assertm_if(NULL == ap, "NULL!!");
1151         assertm_if(NULL == pkg_name, "NULL!!");
1152         assertm_if(NULL == genlist, "NULL!!");
1153
1154         prev_ip_info_t *prev_ip_info = g_try_new0(prev_ip_info_t, 1);
1155         if (prev_ip_info == NULL)
1156                 return NULL;
1157
1158         ip_info_list_t *ip_info_list_data = g_try_new0(ip_info_list_t, 1);
1159         if (ip_info_list_data == NULL) {
1160                 g_free(prev_ip_info);
1161                 prev_ip_info = NULL;
1162
1163                 return NULL;
1164         }
1165
1166         ip_data = g_try_new0(full_ip_info_t, 1);
1167         if (ip_data == NULL) {
1168                 g_free(prev_ip_info);
1169                 g_free(ip_info_list_data);
1170                 prev_ip_info = NULL;
1171                 ip_info_list_data = NULL;
1172                 return NULL;
1173         }
1174
1175         ip_data->ip_info_list = ip_info_list_data;
1176         ip_data->prev_ip_info = prev_ip_info;
1177
1178         ip_info_list_data->ap = ap;
1179         ip_info_list_data->str_pkg_name = pkg_name;
1180         ip_info_list_data->genlist = genlist;
1181         ip_info_list_data->input_panel_cb = input_panel_cb;
1182         ip_info_list_data->input_panel_cb_data = input_panel_cb_data;
1183
1184         ip_toggle_itc = elm_genlist_item_class_new();
1185         ip_toggle_itc->item_style = g_genlist_info[WIFI_GENLIST_1LINE_STYLE].style_name;
1186         ip_toggle_itc->func.text_get = _ip_info_iptoggle_text_get;
1187         ip_toggle_itc->func.content_get = _ip_info_iptoggle_content_get;
1188         ip_toggle_itc->func.state_get = NULL;
1189         ip_toggle_itc->func.del = NULL;
1190
1191         description_itc = elm_genlist_item_class_new();
1192         description_itc->item_style = g_genlist_info[WIFI_GENLIST_FULL_STYLE].style_name;
1193         description_itc->func.text_get = NULL;
1194         description_itc->func.content_get = _ip_info_detail_description_content_get;
1195         description_itc->func.state_get = NULL;
1196         description_itc->func.del = _ip_info_detail_description_del;
1197
1198         ip_entry_itc = elm_genlist_item_class_new();
1199         ip_entry_itc->item_style = g_genlist_info[WIFI_GENLIST_FULL_STYLE].style_name;
1200         ip_entry_itc->func.text_get = NULL;
1201         ip_entry_itc->func.content_get = _ip_info_entry_item_content_get;
1202         ip_entry_itc->func.state_get = NULL;
1203         ip_entry_itc->func.del = _ip_info_entry_item_del;
1204
1205         elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
1206
1207         /* Static/Dynamic switch button */
1208         wifi_manager_ip_config_type_e type = WIFI_MANAGER_IP_CONFIG_TYPE_NONE;
1209         ret = wifi_manager_ap_get_ip_config_type(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &type);
1210         if (ret != WIFI_MANAGER_ERROR_NONE)
1211                 INFO_LOG(UG_NAME_ERR, "Failed to get ip config type! [%d]", ret);
1212
1213         ip_info_list_data->ip_type = type;
1214         ip_info_list_data->ip_toggle_item = elm_genlist_item_append(genlist,
1215                         ip_toggle_itc, ip_data, NULL, ELM_GENLIST_ITEM_NONE,
1216                         __ip_info_toggle_item_sel_cb, ip_data);
1217
1218         prev_ip_info->ip_type = type;
1219
1220         /* IP address */
1221         if (WIFI_MANAGER_IP_CONFIG_TYPE_STATIC == type) {
1222                 ip_data->is_first_create = TRUE;
1223
1224                 /* Create the entry layouts */
1225                 _create_static_ip_table(ip_data);
1226         } else if (WIFI_MANAGER_IP_CONFIG_TYPE_DYNAMIC == type) {
1227                 wifi_manager_ap_get_ip_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &ip_addr);
1228                 wifi_manager_ap_foreach_ipv6_address(ap, __ap_foreach_ipv6_callback, &ipv6_addr);
1229
1230                 prev_ip_info->ip_addr = g_strdup(ip_addr);
1231
1232                 ip_info_list_data->ip_addr_item = _add_description(genlist,
1233                                 "IDS_WIFI_BODY_IP_ADDRESS", NULL, NULL);
1234
1235                 if (g_strcmp0(ip_addr, IPV4_DEFAULT_ADDR) || (!g_strcmp0(ip_addr, IPV4_DEFAULT_ADDR) && !g_strcmp0(ipv6_addr, IPV6_DEFAULT_ADDR)))
1236                         ip_info_list_data->ipv4_addr_item = _add_description(genlist,
1237                                         "IDS_ST_BODY_IPV4", ip_addr, NULL);
1238
1239                 if (g_strcmp0(ipv6_addr, IPV6_DEFAULT_ADDR))
1240                         ip_info_list_data->ipv6_addr_item = _add_description(genlist,
1241                                         "IDS_ST_BODY_IPV6", ipv6_addr, NULL);
1242
1243                 g_free(ip_addr);
1244                 ip_addr = NULL;
1245
1246                 g_free(ipv6_addr);
1247                 ipv6_addr = NULL;
1248         }
1249
1250         if (_is_emulator()) {
1251                 char rand_addr[EMULATOR_MAC_ADDR_MAX];
1252                 unsigned char rand_mac_add[EMULATOR_MAC_ADDR_SIZE + 1];
1253                 if (ip_info_emulator_get_random_mac(rand_mac_add) == -1) {
1254                         ERROR_LOG(UG_NAME_ERR, "Failed to get random mac address");
1255                         return NULL;
1256                 }
1257
1258                 rand_mac_add[0] &= 0xFE;
1259                 rand_mac_add[0] |= 0x02;
1260
1261                 snprintf(rand_addr, EMULATOR_MAC_ADDR_MAX, "%x:%x:%x:%x:%x:%x",
1262                                 rand_mac_add[0], rand_mac_add[1],
1263                                 rand_mac_add[2], rand_mac_add[3],
1264                                 rand_mac_add[4], rand_mac_add[5]);
1265                 item = _add_description(genlist,
1266                                 "IDS_WIFI_BODY_MAC_ADDRESS", rand_addr, NULL);
1267                 ip_info_list_data->mac_addr_item = item;
1268         } else {
1269                 char *mac_addr = NULL;
1270                 /* Mac address */
1271                 ret = wifi_manager_ap_get_bssid(ap, &mac_addr);
1272                 if (ret != WIFI_MANAGER_ERROR_NONE)
1273                         INFO_LOG(UG_NAME_ERR, "Failed to get bssid! [%d]", ret);
1274
1275                 item = _add_description(genlist,
1276                                 "IDS_WIFI_BODY_MAC_ADDRESS", mac_addr, NULL);
1277                 ip_info_list_data->mac_addr_item = item;
1278
1279                 g_free(mac_addr);
1280                 mac_addr = NULL;
1281         }
1282
1283         ret = wifi_manager_ap_get_proxy_type(ap, &proxy_type);
1284         assertm_if(WIFI_MANAGER_ERROR_NONE != ret, "NULL!!");
1285         prev_ip_info->proxy_type = proxy_type;
1286
1287         ret = wifi_manager_ap_get_proxy_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &proxy_data);
1288         assertm_if(NULL == proxy_data, "NULL!!");
1289
1290         if (WIFI_MANAGER_ERROR_NONE == ret && proxy_data && strlen(proxy_data)) {
1291                 temp = g_strdup(proxy_data);
1292                 if (temp != NULL) {
1293                         /*Proxy Port*/
1294                         str2 = strrchr(temp, ':');
1295                         if (str2 != NULL) {
1296                                 proxy_port = g_strdup(str2 + 1);
1297                                 *str2 = '\0';
1298                         }
1299
1300                         /*Proxy Address*/
1301                         proxy_addr = g_strdup(temp);
1302
1303                         g_free(temp);
1304                         temp = NULL;
1305                 }
1306
1307                 prev_ip_info->proxy_data = g_strdup(proxy_data);
1308         } else {
1309                 ERROR_LOG(UG_NAME_ERR, "Error = %d", ret);
1310         }
1311
1312         edit_box_details = g_new0(common_utils_entry_info_t, 1);
1313         edit_box_details->str_pkg_name = pkg_name;
1314         edit_box_details->entry_id = ENTRY_TYPE_PROXY_ADDR;
1315         edit_box_details->title_txt = "IDS_ST_SBODY_PROXY_ADDRESS";
1316         edit_box_details->entry_txt = proxy_addr;
1317         edit_box_details->guide_txt = DEFAULT_GUIDE_PROXY_IP;
1318         edit_box_details->input_panel_cb = input_panel_cb;
1319         edit_box_details->input_panel_cb_data = input_panel_cb_data;
1320         edit_box_details->item = elm_genlist_item_append(genlist, ip_entry_itc,
1321                         edit_box_details, NULL, ELM_GENLIST_ITEM_NONE,
1322                         _gl_editbox_sel_cb, NULL);
1323 #ifdef ACCESSIBLITY_FEATURE
1324         Evas_Object *ao = elm_object_item_access_object_get(edit_box_details->item);
1325         elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details);
1326 #endif
1327         ip_info_list_data->proxy_addr_item = edit_box_details->item;
1328
1329         edit_box_details = g_new0(common_utils_entry_info_t, 1);
1330         edit_box_details->str_pkg_name = pkg_name;
1331         edit_box_details->entry_id = ENTRY_TYPE_PROXY_PORT;
1332         edit_box_details->title_txt = "IDS_ST_SBODY_PROXY_PORT";
1333         edit_box_details->entry_txt = proxy_port;
1334         edit_box_details->guide_txt = DEFAULT_GUIDE_PROXY_PORT;
1335         edit_box_details->input_panel_cb = input_panel_cb;
1336         edit_box_details->input_panel_cb_data = input_panel_cb_data;
1337         edit_box_details->item = elm_genlist_item_append(genlist, ip_entry_itc,
1338                         edit_box_details, NULL, ELM_GENLIST_ITEM_NONE,
1339                         _gl_editbox_sel_cb, NULL);
1340 #ifdef ACCESSIBLITY_FEATURE
1341         ao = elm_object_item_access_object_get(edit_box_details->item);
1342         elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details);
1343 #endif
1344         ip_info_list_data->proxy_port_item = edit_box_details->item;
1345
1346         g_free(proxy_data);
1347         proxy_data = NULL;
1348
1349         __COMMON_FUNC_EXIT__;
1350         return ip_data;
1351 }
1352
1353 static char* get_ip_info_text(entry_id_type_t e)
1354 {
1355         if (ip_info_text_list[e] != NULL)
1356                 return ip_info_text_list[e];
1357
1358         return NULL;
1359 }
1360
1361 static void free_ip_info_text(entry_id_type_t e)
1362 {
1363         g_free(ip_info_text_list[e]);
1364         ip_info_text_list[e] = NULL;
1365 }
1366
1367 void ip_info_save_data(full_ip_info_t *ip_data)
1368 {
1369         __COMMON_FUNC_ENTER__;
1370         retm_if(ip_data == NULL);
1371         ip_info_list_t *ip_info_list_data = ip_data->ip_info_list;
1372         prev_ip_info_t *prev_ip_info = ip_data->prev_ip_info;
1373         retm_if(NULL == ip_info_list_data || NULL == prev_ip_info);
1374
1375         char* txt = NULL;
1376         char* proxy_addr = NULL;
1377         char* proxy_port = NULL;
1378         wifi_manager_ap_h ap = ip_info_list_data->ap;
1379         int ret = WIFI_MANAGER_ERROR_NONE;
1380         ip_data->is_info_changed = FALSE;
1381
1382         if (prev_ip_info->ip_type != ip_info_list_data->ip_type) {
1383                 if (WIFI_MANAGER_IP_CONFIG_TYPE_DYNAMIC == ip_info_list_data->ip_type) {
1384                         /* Reset the DNS addresses if dynamic */
1385                         ret = wifi_manager_ap_set_dns_address(ap, 1,
1386                                         WIFI_MANAGER_ADDRESS_FAMILY_IPV4, DEFAULT_GUIDE_IP);
1387                         if (ret == WIFI_MANAGER_ERROR_NONE)
1388                                 ip_data->is_info_changed = TRUE;
1389
1390                         ret = wifi_manager_ap_set_dns_address(ap, 2,
1391                                         WIFI_MANAGER_ADDRESS_FAMILY_IPV4, DEFAULT_GUIDE_IP);
1392                         if (ret == WIFI_MANAGER_ERROR_NONE)
1393                                 ip_data->is_info_changed = TRUE;
1394                         ip_info_list_data->dns_type = WIFI_MANAGER_DNS_CONFIG_TYPE_DYNAMIC;
1395
1396                 } else if (WIFI_MANAGER_IP_CONFIG_TYPE_STATIC == ip_info_list_data->ip_type) {
1397                         ip_info_list_data->dns_type = WIFI_MANAGER_DNS_CONFIG_TYPE_STATIC;
1398                 }
1399
1400                 ret = wifi_manager_ap_set_ip_config_type(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4,
1401                                 ip_info_list_data->ip_type);
1402                 retm_if(WIFI_MANAGER_ERROR_NONE != ret);
1403
1404                 ret = wifi_manager_ap_set_dns_config_type(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4,
1405                                 ip_info_list_data->dns_type);
1406                 retm_if(WIFI_MANAGER_ERROR_NONE != ret);
1407
1408                 ip_data->is_info_changed = TRUE;
1409         }
1410
1411         if (WIFI_MANAGER_IP_CONFIG_TYPE_STATIC == ip_info_list_data->ip_type) {
1412                 txt = g_strdup(get_ip_info_text(ENTRY_TYPE_IP_ADDR));
1413                 if (!txt)
1414                         txt = g_strdup(DEFAULT_GUIDE_IP);
1415                 if (g_strcmp0(prev_ip_info->ip_addr, txt) != 0) {
1416                         ret = wifi_manager_ap_set_ip_address(ap,
1417                                         WIFI_MANAGER_ADDRESS_FAMILY_IPV4, txt);
1418
1419                         if (ret == WIFI_MANAGER_ERROR_NONE)
1420                                 ip_data->is_info_changed = TRUE;
1421                 }
1422                 free_ip_info_text(ENTRY_TYPE_IP_ADDR);
1423                 g_free(txt);
1424
1425                 txt = g_strdup(get_ip_info_text(ENTRY_TYPE_SUBNET_MASK));
1426                 if (!txt)
1427                         txt = g_strdup(DEFAULT_GUIDE_IP);
1428                 if (g_strcmp0(prev_ip_info->subnet_mask, txt) != 0) {
1429                         ret = wifi_manager_ap_set_subnet_mask(ap,
1430                                         WIFI_MANAGER_ADDRESS_FAMILY_IPV4, txt);
1431
1432                         if (ret == WIFI_MANAGER_ERROR_NONE)
1433                                 ip_data->is_info_changed = TRUE;
1434                 }
1435                 free_ip_info_text(ENTRY_TYPE_SUBNET_MASK);
1436                 g_free(txt);
1437
1438                 txt = g_strdup(get_ip_info_text(ENTRY_TYPE_GATEWAY));
1439                 if (!txt)
1440                         txt = g_strdup(DEFAULT_GUIDE_IP);
1441                 if (g_strcmp0(prev_ip_info->gateway_addr, txt) != 0) {
1442                         ret = wifi_manager_ap_set_gateway_address(ap,
1443                                         WIFI_MANAGER_ADDRESS_FAMILY_IPV4, txt);
1444
1445                         if (ret == WIFI_MANAGER_ERROR_NONE)
1446                                 ip_data->is_info_changed = TRUE;
1447                 }
1448                 free_ip_info_text(ENTRY_TYPE_GATEWAY);
1449                 g_free(txt);
1450
1451                 txt = g_strdup(get_ip_info_text(ENTRY_TYPE_DNS_1));
1452                 if (!txt)
1453                         txt = g_strdup(DEFAULT_GUIDE_IP);
1454                 if (g_strcmp0(prev_ip_info->dns_1, txt) != 0) {
1455                         ret = wifi_manager_ap_set_dns_address(ap, 1,
1456                                         WIFI_MANAGER_ADDRESS_FAMILY_IPV4, txt);
1457
1458                         if (ret == WIFI_MANAGER_ERROR_NONE)
1459                                 ip_data->is_info_changed = TRUE;
1460                 }
1461                 free_ip_info_text(ENTRY_TYPE_DNS_1);
1462                 g_free(txt);
1463
1464                 txt = g_strdup(get_ip_info_text(ENTRY_TYPE_DNS_2));
1465                 if (!txt)
1466                         txt = g_strdup(DEFAULT_GUIDE_IP);
1467                 if (g_strcmp0(prev_ip_info->dns_2, txt) != 0) {
1468                         ret = wifi_manager_ap_set_dns_address(ap, 2,
1469                                         WIFI_MANAGER_ADDRESS_FAMILY_IPV4, txt);
1470
1471                         if (ret == WIFI_MANAGER_ERROR_NONE)
1472                                 ip_data->is_info_changed = TRUE;
1473                 }
1474                 free_ip_info_text(ENTRY_TYPE_DNS_2);
1475                 g_free(txt);
1476         }
1477
1478         proxy_addr = g_strdup(get_ip_info_text(ENTRY_TYPE_PROXY_ADDR));
1479         if (proxy_addr == NULL) {
1480                 DEBUG_LOG(UG_NAME_NORMAL, "Set proxy type - auto");
1481                 if (prev_ip_info->proxy_type != WIFI_MANAGER_PROXY_TYPE_AUTO)
1482                         if (wifi_manager_ap_set_proxy_type(ap, WIFI_MANAGER_PROXY_TYPE_AUTO)
1483                                         != WIFI_MANAGER_ERROR_NONE)
1484                                 ERROR_LOG(UG_NAME_NORMAL, "Fail to set proxy type");
1485         } else {
1486                 proxy_port = g_strdup(get_ip_info_text(ENTRY_TYPE_PROXY_PORT));
1487                 if (proxy_port)
1488                         txt = g_strdup_printf("%s:%s", proxy_addr, proxy_port);
1489                 else
1490                         txt = g_strdup_printf("%s:%s", proxy_addr, DEFAULT_GUIDE_PROXY_PORT);
1491
1492                 DEBUG_LOG(UG_NAME_NORMAL, "Set proxy type - manual : %s", txt);
1493                 if (prev_ip_info->proxy_type != WIFI_MANAGER_PROXY_TYPE_MANUAL) {
1494                         if (wifi_manager_ap_set_proxy_type(ap, WIFI_MANAGER_PROXY_TYPE_MANUAL)
1495                                         != WIFI_MANAGER_ERROR_NONE)
1496                                 ERROR_LOG(UG_NAME_NORMAL, "Fail to set proxy type");
1497                 }
1498
1499                 if (g_strcmp0(prev_ip_info->proxy_data, txt) != 0) {
1500                         if (wifi_manager_ap_set_proxy_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, txt)
1501                                         != WIFI_MANAGER_ERROR_NONE)
1502                                 ERROR_LOG(UG_NAME_NORMAL, "Fail to set proxy address");
1503                 }
1504
1505                 free_ip_info_text(ENTRY_TYPE_PROXY_ADDR);
1506                 free_ip_info_text(ENTRY_TYPE_PROXY_PORT);
1507                 g_free(proxy_port);
1508                 proxy_port = NULL;
1509                 g_free(txt);
1510         }
1511         txt = NULL;
1512
1513         g_free(proxy_addr);
1514         proxy_addr = NULL;
1515
1516         /* ip_info_print_values(ap); */
1517
1518         __COMMON_FUNC_EXIT__;
1519 }
1520
1521 void ip_info_remove(ip_info_list_t *ip_info_list)
1522 {
1523         __COMMON_FUNC_ENTER__;
1524
1525         if (ip_info_list)
1526                 g_free(ip_info_list);
1527
1528         __COMMON_FUNC_EXIT__;
1529 }
1530
1531 void ip_info_close_all_keypads(ip_info_list_t *ip_info_list)
1532 {
1533         __COMMON_FUNC_ENTER__;
1534
1535         if (!ip_info_list) {
1536                 __COMMON_FUNC_EXIT__;
1537                 return;
1538         }
1539
1540         if (WIFI_MANAGER_IP_CONFIG_TYPE_STATIC == ip_info_list->ip_type) {
1541                 if (ip_info_list->ip_addr_item)
1542                         common_utils_edit_box_focus_set(ip_info_list->ip_addr_item, EINA_FALSE);
1543                 if (ip_info_list->subnet_mask_item)
1544                         common_utils_edit_box_focus_set(ip_info_list->subnet_mask_item, EINA_FALSE);
1545                 if (ip_info_list->gateway_addr_item)
1546                         common_utils_edit_box_focus_set(ip_info_list->gateway_addr_item, EINA_FALSE);
1547                 if (ip_info_list->dns_1_item)
1548                         common_utils_edit_box_focus_set(ip_info_list->dns_1_item, EINA_FALSE);
1549                 if (ip_info_list->dns_2_item)
1550                         common_utils_edit_box_focus_set(ip_info_list->dns_2_item, EINA_FALSE);
1551                 if (ip_info_list->proxy_addr_item)
1552                         common_utils_edit_box_focus_set(ip_info_list->proxy_addr_item, EINA_FALSE);
1553                 if (ip_info_list->proxy_port_item)
1554                         common_utils_edit_box_focus_set(ip_info_list->proxy_port_item, EINA_FALSE);
1555         }
1556         __COMMON_FUNC_EXIT__;
1557 }
1558
1559 void ip_info_enable_all_keypads(ip_info_list_t *ip_info_list)
1560 {
1561         __COMMON_FUNC_ENTER__;
1562
1563         if (!ip_info_list) {
1564                 __COMMON_FUNC_EXIT__;
1565                 return;
1566         }
1567
1568         if (WIFI_MANAGER_IP_CONFIG_TYPE_STATIC == ip_info_list->ip_type) {
1569                 if (ip_info_list->ip_addr_item)
1570                         common_utils_edit_box_allow_focus_set(ip_info_list->ip_addr_item, EINA_TRUE);
1571                 if (ip_info_list->subnet_mask_item)
1572                         common_utils_edit_box_allow_focus_set(ip_info_list->subnet_mask_item, EINA_TRUE);
1573                 if (ip_info_list->gateway_addr_item)
1574                         common_utils_edit_box_allow_focus_set(ip_info_list->gateway_addr_item, EINA_TRUE);
1575                 if (ip_info_list->dns_1_item)
1576                         common_utils_edit_box_allow_focus_set(ip_info_list->dns_1_item, EINA_TRUE);
1577                 if (ip_info_list->dns_2_item)
1578                         common_utils_edit_box_allow_focus_set(ip_info_list->dns_2_item, EINA_TRUE);
1579                 if (ip_info_list->proxy_addr_item)
1580                         common_utils_edit_box_allow_focus_set(ip_info_list->proxy_addr_item, EINA_TRUE);
1581                 if (ip_info_list->proxy_port_item)
1582                         common_utils_edit_box_allow_focus_set(ip_info_list->proxy_port_item, EINA_TRUE);
1583         }
1584         __COMMON_FUNC_EXIT__;
1585 }