4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
6 * Contact: MyoungJune Park <mj2004.park@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
21 #include <setting-network-connection-create.h>
22 #include <notification.h>
24 #define MAX_PDP_APN_LEN_MAX 100
25 #define MAX_PDP_AUTH_USERNAME_LEN_MAX 32
26 #define MAX_PDP_AUTH_PASSWORD_LEN_MAX 32
27 #define MAX_HOME_URL_LEN_MAX 512
28 #define MAX_PROXY_LEN_MAX 64
30 static int setting_network_connection_create(void *cb);
31 static int setting_network_connection_destroy(void *cb);
32 static int setting_network_connection_update(void *cb);
33 static int setting_network_connection_cleanup(void *cb);
35 setting_view setting_view_network_connection_create = {
36 .create = setting_network_connection_create,
37 .destroy = setting_network_connection_destroy,
38 .update = setting_network_connection_update,
39 .cleanup = setting_network_connection_cleanup,
42 SettingNetworkUG *g_networkUG = NULL;
43 #define SUPPORT_EXPANDABLE_AUTHTYPE 1
44 #define URL_HEAD "http://"
45 #define INTERNET "IDS_ST_BODY_CONNECTIONSETTINGS_INTERNET"
46 #define PLUS_MMS "+ MMS"
47 /* ***************************************************
51 ***************************************************/
53 void __sub_list_rd_change(void *data, Evas_Object *obj, void *event_info)
56 retm_if(data == NULL, "Data parameter is NULL");
57 Setting_GenGroupItem_Data *list_item =
58 (Setting_GenGroupItem_Data *) data;
59 list_item->chk_status = elm_radio_value_get(obj); /* for update */
61 Elm_Object_Item *subItem = list_item->item;
62 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subItem);
64 Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subItem); /* subItem data */
65 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
67 ret_if(NULL == data_subItem || NULL == data_parentItem);
69 data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
70 elm_object_item_data_set(data_parentItem->item, data_parentItem);
71 elm_genlist_item_update(data_parentItem->item);
73 SettingNetworkUG *ad = data_parentItem->userdata;
75 if (data_parentItem == ad->data_auth_type) {
76 elm_genlist_item_expanded_set(ad->data_auth_type->item, FALSE);
77 elm_genlist_item_update(ad->data_auth_type->item);
79 setting_network_connection_display_auth_type(data_parentItem->userdata, list_item->chk_status);
80 } else if (data_parentItem == ad->data_srv_type) {
81 if (ad->srvType != data_subItem->chk_status)
82 ad->srvType = data_subItem->chk_status;
83 if (ad->srvType != CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET) {
84 if (!ad->data_hm_url) {
87 setting_create_Gendial_field_def(obj,
90 SWALLOW_Type_LAYOUT_EDITFIELD,
92 "IDS_ST_BODY_HOME_URL",
93 (char *)ad->ed_hm_url_desc,
94 setting_network_connection_entry_changed_cb);
95 if (ad->data_hm_url) {
96 ad->data_hm_url->userdata = ad;
97 ad->data_hm_url->input_type = ELM_INPUT_PANEL_LAYOUT_URL;
98 ad->data_hm_url->isSinglelineFlag = TRUE;
99 ad->data_hm_url->limit_filter_data = calloc(1, sizeof(Elm_Entry_Filter_Accept_Set));
100 if (ad->data_hm_url->limit_filter_data) {
101 ad->data_hm_url->limit_filter_data->max_byte_count = MAX_HOME_URL_LEN_MAX - 1;
102 ad->data_hm_url->win_main = ad->win_get;
105 SETTING_TRACE_ERROR("ad->data_hm_url is NULL");
109 /*do need home-url */
110 if (ad->data_hm_url) {
111 elm_object_item_del(ad->data_hm_url->item);
112 ad->data_hm_url = NULL;
118 void __sub_list_sel_cb(void *data, Evas_Object *obj, void *event_info)
122 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
123 Elm_Object_Item *subitem = (Elm_Object_Item *) event_info;
124 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem);
125 elm_genlist_item_selected_set(subitem, 0);
127 Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subitem);
128 Setting_GenGroupItem_Data *data_parentItem = (Setting_GenGroupItem_Data *)data;
129 ret_if(NULL == data_subItem || NULL == data_parentItem);
131 SettingNetworkUG *ad = data_parentItem->userdata;
134 int chk_status = data_subItem->chk_status;
135 elm_radio_value_set(data_subItem->rgd, chk_status);
137 data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
138 elm_object_item_data_set(data_parentItem->item, data_parentItem);
139 // elm_genlist_item_fields_update(data_parentItem->item, "*", ELM_GENLIST_ITEM_FIELD_TEXT);
141 if (data_parentItem == ad->data_auth_type)
143 elm_genlist_item_expanded_set( ad->data_auth_type->item, FALSE );
144 elm_genlist_item_update( ad->data_auth_type->item );
146 setting_network_connection_display_auth_type(ad, chk_status);
148 //remove network mode popup
149 if (ad->popup_auth_type) {
150 evas_object_del(ad->popup_auth_type);
151 ad->popup_auth_type = NULL;
154 else if (data_parentItem == ad->data_srv_type)
156 if (ad->srvType != data_subItem->chk_status)
157 ad->srvType = data_subItem->chk_status;
158 if( ad->srvType != CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET)
160 if (!ad->data_hm_url)
164 setting_create_Gendial_field_def(obj,
167 SWALLOW_Type_LAYOUT_EDITFIELD,
169 "IDS_ST_BODY_HOME_URL",
170 (char *)ad->ed_hm_url_desc,
171 setting_network_connection_entry_changed_cb);
172 if (ad->data_hm_url) {
173 ad->data_hm_url->userdata = ad;
174 ad->data_hm_url->input_type = ELM_INPUT_PANEL_LAYOUT_URL;
175 ad->data_hm_url->limit_filter_data = calloc(1, sizeof(Elm_Entry_Filter_Accept_Set));
176 if (ad->data_hm_url->limit_filter_data) {
177 ad->data_hm_url->limit_filter_data->max_byte_count = MAX_HOME_URL_LEN_MAX - 1;
178 ad->data_hm_url->win_main = ad->win_get;
181 SETTING_TRACE_ERROR("ad->data_hm_url is NULL");
186 /*do need home-url */
187 if (ad->data_hm_url) {
188 elm_object_item_del(ad->data_hm_url->item);
189 ad->data_hm_url = NULL;
195 void __auth_type_popup_del(void *data, Evas_Object *obj, void *event_info)
197 SettingNetworkUG *ad = data;
199 ret_if(data == NULL);
201 evas_object_del(ad->popup_auth_type);
202 ad->popup_auth_type = NULL;
205 static void __create_auth_type_popup(void *data, Evas_Object *obj,
208 ret_if(NULL == data || NULL == event_info);
210 SettingNetworkUG *ad = (SettingNetworkUG *) data;
211 Elm_Object_Item *parentItem = event_info; /* parent item */
212 elm_genlist_item_selected_set(parentItem, 0);
213 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
216 if(ad->popup_auth_type) {
217 evas_object_del(ad->popup_auth_type);
218 ad->popup_auth_type = NULL;
220 Evas_Object *scroller = NULL;
221 ad->popup_auth_type = setting_create_popup_with_list(&scroller, ad, ad->win_get,
222 data_parentItem->keyStr,
223 __auth_type_popup_del,
225 _P(ad->popup_auth_type);
229 Setting_GenGroupItem_Data *list_item = NULL;
230 if (data_parentItem == ad->data_auth_type) {
231 rgd = elm_radio_add(scroller);
232 elm_radio_value_set(rgd, -1);
234 list_item = setting_create_Gendial_field_1radio(scroller,
235 &itc_multiline_1text_1icon,
236 __sub_list_sel_cb, data_parentItem,
237 SWALLOW_Type_1RADIO_RIGHT, rgd,
238 CONNECTION_CELLULAR_AUTH_TYPE_PAP,
242 list_item = setting_create_Gendial_field_1radio(scroller,
243 &itc_multiline_1text_1icon,
244 __sub_list_sel_cb, data_parentItem,
245 SWALLOW_Type_1RADIO_RIGHT, rgd,
246 CONNECTION_CELLULAR_AUTH_TYPE_CHAP,
250 list_item = setting_create_Gendial_field_1radio(scroller,
251 &itc_multiline_1text_1icon,
252 __sub_list_sel_cb, data_parentItem,
253 SWALLOW_Type_1RADIO_RIGHT, rgd,
254 CONNECTION_CELLULAR_AUTH_TYPE_NONE,
258 elm_radio_value_set(rgd, ad->chkType);
259 elm_object_signal_emit(rgd, "elm,event,pass,enabled", "elm");
261 else if (data_parentItem == ad->data_srv_type) {
262 rgd = elm_radio_add(scroller);
263 elm_radio_value_set(rgd, -1);
265 list_item = setting_create_Gendial_exp_sub_field(scroller,
266 &itc_1icon_1text_sub,
267 __sub_list_sel_cb, ad,
269 SWALLOW_Type_1RADIO_RIGHT, rgd,
270 CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET,
271 "IDS_ST_BODY_INTERNET_CONNECTION",
272 __sub_list_rd_change);
274 list_item = setting_create_Gendial_exp_sub_field(scroller,
275 &itc_1icon_1text_sub,
276 __sub_list_sel_cb, ad,
278 SWALLOW_Type_1RADIO_RIGHT, rgd,
279 CONNECTION_CELLULAR_SERVICE_TYPE_MMS,
280 STR_SETTING_MMS_CONNECTIONS,
281 __sub_list_rd_change);
284 char tmp_str[SETTING_STR_SLP_LEN + 1] = {0,};
285 r = snprintf(tmp_str, SETTING_STR_SLP_LEN, "%s %s", _(INTERNET), PLUS_MMS);
287 SETTING_TRACE("snprintf failed");
289 list_item = setting_create_Gendial_exp_sub_field(scroller,
290 &itc_1icon_1text_sub,
291 __sub_list_sel_cb, ad,
293 SWALLOW_Type_1RADIO_RIGHT, rgd,
294 CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION,
296 __sub_list_rd_change);
298 elm_radio_value_set(rgd, ad->srvType);
299 elm_object_signal_emit(rgd, "elm,event,pass,enabled", "elm");
303 static void __setting_network_connection_exp_cb(void *data, Evas_Object *obj,
306 ret_if(NULL == data || NULL == event_info);
308 SettingNetworkUG *ad = (SettingNetworkUG *) data;
309 Elm_Object_Item *parentItem = event_info; /* parent item */
310 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
311 Evas_Object *scroller = elm_object_item_widget_get(parentItem);
315 Setting_GenGroupItem_Data *list_item = NULL;
316 if (data_parentItem == ad->data_auth_type) {
317 rgd = elm_radio_add(scroller);
318 //elm_object_style_set(rgd, "list");
319 elm_radio_value_set(rgd, -1);
321 SETTING_TRACE("CONNECTION_CELLULAR_AUTH_TYPE_NONE : %d: ", CONNECTION_CELLULAR_AUTH_TYPE_NONE);
322 SETTING_TRACE("CONNECTION_CELLULAR_AUTH_TYPE_PAP : %d: ", CONNECTION_CELLULAR_AUTH_TYPE_PAP);
323 SETTING_TRACE("CONNECTION_CELLULAR_AUTH_TYPE_CHAP : %d: ", CONNECTION_CELLULAR_AUTH_TYPE_CHAP);
325 list_item = setting_create_Gendial_exp_sub_field(scroller,
326 &itc_1icon_1text_sub,
327 __sub_list_sel_cb, ad,
329 SWALLOW_Type_1RADIO_RIGHT, rgd,
330 CONNECTION_CELLULAR_AUTH_TYPE_NONE,
332 __sub_list_rd_change);
334 list_item = setting_create_Gendial_exp_sub_field(scroller,
335 &itc_1icon_1text_sub,
336 __sub_list_sel_cb, ad,
338 SWALLOW_Type_1RADIO_RIGHT, rgd,
339 CONNECTION_CELLULAR_AUTH_TYPE_PAP,
341 __sub_list_rd_change);
343 list_item = setting_create_Gendial_exp_sub_field(scroller,
344 &itc_1icon_1text_sub,
345 __sub_list_sel_cb, ad,
347 SWALLOW_Type_1RADIO_RIGHT, rgd,
348 CONNECTION_CELLULAR_AUTH_TYPE_CHAP,
350 __sub_list_rd_change);
352 SETTING_TRACE(" ----------------------------->>> ad->chkType : %d ",ad->chkType);
354 elm_radio_value_set(rgd, ad->chkType);
355 } else if (data_parentItem == ad->data_srv_type) {
356 rgd = elm_radio_add(scroller);
357 elm_radio_value_set(rgd, -1);
359 list_item = setting_create_Gendial_exp_sub_field(scroller,
360 &itc_1icon_1text_sub,
361 __sub_list_sel_cb, ad,
363 SWALLOW_Type_1RADIO_RIGHT, rgd,
364 CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET,
365 "IDS_ST_BODY_INTERNET_CONNECTION",
366 __sub_list_rd_change);
368 list_item = setting_create_Gendial_exp_sub_field(scroller,
369 &itc_1icon_1text_sub,
370 __sub_list_sel_cb, ad,
372 SWALLOW_Type_1RADIO_RIGHT, rgd,
373 CONNECTION_CELLULAR_SERVICE_TYPE_MMS,
374 STR_SETTING_MMS_CONNECTIONS,
375 __sub_list_rd_change);
378 char tmp_str[SETTING_STR_SLP_LEN + 1] = {0,};
379 r = snprintf(tmp_str, SETTING_STR_SLP_LEN, "%s %s", _(INTERNET), PLUS_MMS);
381 SETTING_TRACE("snprintf failed");
383 list_item = setting_create_Gendial_exp_sub_field(scroller,
384 &itc_1icon_1text_sub,
385 __sub_list_sel_cb, ad,
387 SWALLOW_Type_1RADIO_RIGHT, rgd,
388 CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION,
390 __sub_list_rd_change);
392 elm_radio_value_set(rgd, ad->srvType);
396 static Eina_Bool __connection_idler(void *data)
399 retv_if(!data, FALSE);
400 SettingNetworkUG *ad = data;
401 /*__genlist_disable_set(ad->scl_edit, TRUE); */
402 setting_network_connection_hide_input_pannel(ad);
405 void __get_connection_info(void *cb)
409 SettingNetworkUG *ad = (SettingNetworkUG *) cb;
411 G_FREE(ad->ed_profile_name_desc);
412 G_FREE(ad->ed_acs_name_desc);
413 G_FREE(ad->ed_user_name_desc);
414 G_FREE(ad->ed_pwd_desc);
416 G_FREE(ad->ed_pxy_addr_desc);
417 G_FREE(ad->ed_pxy_port_desc);
419 G_FREE(ad->ed_hm_url_desc);
420 ad->ed_auth_type_desc = NULL;
421 ad->chkType = CONNECTION_CELLULAR_AUTH_TYPE_NONE;
423 SETTING_TRACE("ad->con_name:%s, ad->profile_service_type:%d",
424 ad->con_name, ad->profile_service_type);
426 int ServiceType = ad->profile_service_type;
427 char *con_name_utf8 = NULL;
428 if (ad->access_name) {
429 con_name_utf8 = strdup(ad->access_name);
431 con_name_utf8 = strdup("");
433 SETTING_TRACE("con_name_utf8:%s", con_name_utf8);
435 /*match with the correct profile */
436 connection_profile_iterator_h profile_iter = NULL;
437 connection_profile_h profile_h = NULL;
438 char *profile_name = NULL;
440 char *profile_id = NULL;
441 connection_profile_type_e profile_type = CONNECTION_PROFILE_TYPE_CELLULAR;
442 connection_cellular_service_type_e service_type = CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN;
443 int err = connection_get_profile_iterator(ad->connection, CONNECTION_ITERATOR_TYPE_REGISTERED, &profile_iter);
444 if (err != CONNECTION_ERROR_NONE) {
445 SETTING_TRACE_ERROR("Fail to get profile iterator [%d]", err);
452 while (connection_profile_iterator_has_next(profile_iter)) {
453 /*reset and release.. */
456 G_FREE(profile_name);
458 if (cnt >= MAX_PROFILE_NUM || connection_profile_iterator_next(profile_iter, &profile_h) != CONNECTION_ERROR_NONE) {
462 connection_profile_get_type(profile_h, &profile_type);
463 connection_profile_get_cellular_service_type(profile_h, &service_type);
464 connection_profile_get_cellular_apn(profile_h, &apn);
465 connection_profile_get_id(profile_h, &profile_id);
466 connection_profile_get_name(profile_h, &profile_name);
467 SETTING_TRACE("Record[%d] apn[%s], profile_id[%s], profile_name[%s], profile_type[%d], service_type[%d]",
468 cnt, apn, profile_id, profile_name, profile_type, service_type);
469 if (CONNECTION_PROFILE_TYPE_CELLULAR != profile_type)
473 if (CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION != service_type) {
474 /*match with ServiceType */
475 if (ServiceType == service_type) {
476 ad->sel_profile_h = profile_h;
480 } else { /*the customer's profiles */
481 if (0 == safeStrCmp(con_name_utf8, apn)) {
482 ad->sel_profile_h = profile_h;
488 /*match with ServiceType */
489 if (ServiceType == service_type) {
490 if (ServiceType == CONNECTION_CELLULAR_SERVICE_TYPE_MMS) {
492 /*for MMS,it just have one profile */
493 ad->sel_profile_h = profile_h;
497 if (0 == safeStrCmp(con_name_utf8, profile_id)) {
498 ad->sel_profile_h = profile_h;
508 ad->is_editable = TRUE;
509 if (found) { /*found sucessfully */
510 SETTING_TRACE("found the following record:");
511 SETTING_TRACE("\tapn:%s", apn);
512 SETTING_TRACE("\tprofile_id:%s", profile_id);
513 SETTING_TRACE("\tprofile_name:%s", profile_name);
514 SETTING_TRACE("\tservice_type:%d", service_type);
515 SETTING_TRACE("\tprofile_type:%d", profile_type);
516 ad->srvType = service_type;
517 ad->ed_profile_name_desc = profile_name;
519 connection_profile_is_cellular_editable(ad->sel_profile_h, &(ad->is_editable));
520 SETTING_TRACE("ad->is_editable:%d", ad->is_editable);
522 /* load access name */
523 connection_profile_get_cellular_apn(ad->sel_profile_h, &(ad->ed_acs_name_desc));
524 connection_cellular_auth_type_e auth_type = CONNECTION_CELLULAR_AUTH_TYPE_NONE;
525 connection_profile_get_cellular_auth_info(ad->sel_profile_h, &auth_type, &(ad->ed_user_name_desc), &(ad->ed_pwd_desc));
526 SETTING_TRACE(" ----> auth_type: (%d)", auth_type);
528 ad->chkType = auth_type;
529 /*SETTING_TRACE("-----> radio button state: %d", elm_radio_value_get(ad->chk_type));*/
530 SETTING_TRACE("----------------------> connection_profile_get_cellular_auth_info: %d", auth_type);
531 elm_radio_value_set(ad->chk_type, ad->chkType);
533 switch (ad->chkType) {
534 case CONNECTION_CELLULAR_AUTH_TYPE_NONE:
535 ad->ed_auth_type_desc = _("IDS_ST_BODY_NONE");
537 case CONNECTION_CELLULAR_AUTH_TYPE_PAP:
538 ad->ed_auth_type_desc = _("IDS_ST_MBODY_PAP");
540 case CONNECTION_CELLULAR_AUTH_TYPE_CHAP:
541 ad->ed_auth_type_desc = _("IDS_ST_POP_CHAP");
544 ad->chkType = CONNECTION_CELLULAR_AUTH_TYPE_NONE;
545 ad->ed_auth_type_desc = _("IDS_ST_BODY_NONE");
550 char *full_addr = NULL;
553 /*Fix the Port 'NULL' issue when enter connection view repeatly.. */
554 connection_profile_get_proxy_address(ad->sel_profile_h, CONNECTION_ADDRESS_FAMILY_IPV4, &full_addr);
555 SETTING_TRACE("full_addr: %s", full_addr);
556 char ProxyAddr[MAX_HOME_URL_LEN_MAX + 1] = {0,};
557 safeCopyStr(ProxyAddr, full_addr, MAX_HOME_URL_LEN_MAX);
560 /*several real format after removing "http://": */
561 /* ":80", "1.1.1.1:80","1.1.1.1: ", "127.0.0.1/", "127.0.0.1" */
562 full_addr = ProxyAddr;
563 int url_head_len = strlen(URL_HEAD);
564 if (0 == safeStrNCmp(full_addr, URL_HEAD, url_head_len)) {
565 full_addr += url_head_len;
567 addr = strsep(&full_addr, ":");
568 if (NULL == full_addr) { /*format like "http://127.0.0.1/" or "http://127.0.0.1" */
569 SETTING_TRACE("NULL == full_addr");
570 addr = strsep(&addr, "/");
573 ad->ed_pxy_addr_desc = NULL;
574 /*proxy address support not only ip but also url, need not check the format */
575 /*bool is_ip = is_ip_string(addr, &tmp); */
576 if (!isEmptyStr(addr)) {
577 ad->ed_pxy_addr_desc = g_strdup(addr);
578 port = strsep(&full_addr, "/");
579 } else { /*invalid format,let addr and port to be NULL. */
582 SETTING_TRACE("addr:%s", addr);
583 SETTING_TRACE("port:%s", port);
584 SETTING_TRACE("ad->ed_pxy_addr_desc:%s", ad->ed_pxy_addr_desc);
585 /*ad->ed_pxy_addr_desc = g_strdup(addr); */
586 ad->ed_pxy_port_desc = g_strdup(port);
587 /*if (ad->con_type == NET_SERVICE_MMS) { /* Message Connection * / */
588 if (!safeStrCmp(ad->con_name, STR_SETTING_MMS_CONNECTIONS)) { /* Message Connection */
589 /*ad->ed_hm_url_desc = ad->prof_list[ad->prof_sel_idx].ProfileInfo.Pdp.HomeURL; */
590 connection_profile_get_cellular_home_url(ad->sel_profile_h, &(ad->ed_hm_url_desc));
593 SETTING_TRACE("Didn't find any record, to let add a new one:");
594 ad->sel_profile_h = NULL;
595 ad->ed_auth_type_desc = _("IDS_ST_BODY_NONE");
596 ad->chkType = CONNECTION_CELLULAR_AUTH_TYPE_NONE;
597 ad->srvType = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET;
600 /*release the memory.. */
603 /*G_FREE(profile_name); */
607 static void __network_max_len_reached(void *data, Evas_Object *obj, void *event_info)
610 retm_if(data == NULL, "Data parameter is NULL");
611 retm_if(!elm_object_focus_get(obj), "Entry is not focused");/*notify only when entry is being focused on. */
613 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
614 list_item->maxLengthReachFlag = true;
616 SETTING_TRACE("list_item->enterKeyPressFlag : %d", list_item->enterKeyPressFlag);
617 SettingNetworkUG *ad = list_item->userdata;
620 ad->popup = setting_create_popup(ad, ad->win_get, NULL,
621 "IDS_ST_TPOP_MAXIMUM_NUMBER_OF_CHARACTERS_REACHED",
622 NULL, 2, TRUE, FALSE, 0);
626 * Entry - activated callback (When 'Next' key in SIP touched)
628 static void setting_network_connection_entry_next_activated_cb(void *data, Evas_Object *obj, void *event_info)
631 retm_if(data == NULL, "Data parameter is NULL");
633 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data;
634 SettingNetworkUG *ad = list_item->userdata;
636 Evas_Object *pObj_NextEntry = NULL;
638 if (list_item == ad->data_profile_name) {
639 /* Profile name -> Access name */
640 if (ad->data_acs_name)
641 pObj_NextEntry = ad->data_acs_name->eo_check;
642 } else if (list_item == ad->data_user_name) {
643 /* User name -> Password */
645 pObj_NextEntry = ad->data_pwd->eo_check;
646 } else if (list_item == ad->data_pwd) {
647 /* Password -> Proxy address */
648 if (ad->data_pxy_addr)
649 pObj_NextEntry = ad->data_pxy_addr->eo_check;
650 } else if (list_item == ad->data_pxy_addr) {
651 /* Proxy address -> Proxy port */
652 if (ad->data_pxy_port)
653 pObj_NextEntry = ad->data_pxy_port->eo_check;
654 } else if (list_item == ad->data_pxy_port) {
655 /* Proxy port -> Home URL */
657 pObj_NextEntry = ad->data_hm_url->eo_check;
659 SETTING_TRACE_ERROR("list_item unknown");
663 /* Hide & unfocus keypad */
664 setting_hide_input_pannel_cb(list_item->eo_check);
667 if (pObj_NextEntry != NULL) {
668 elm_object_focus_set(pObj_NextEntry, EINA_TRUE);
669 elm_entry_cursor_end_set(pObj_NextEntry);
675 static void _init_context(void *cb)
678 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
680 SettingNetworkUG *ad = (SettingNetworkUG *) cb;
682 /* connection intializes */
683 ad->data_profile_name = NULL;
684 ad->data_acs_name = NULL;
685 ad->data_auth_type = NULL;
686 ad->data_user_name = NULL;
688 ad->data_pxy_addr = NULL;
689 ad->data_pxy_port = NULL;
690 ad->data_hm_url = NULL;
693 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
694 static Evas_Object* ctxpopup;
697 ctxpopup_dismissed_cb(void *data, Evas_Object *obj, void *event_info)
700 evas_object_del(ctxpopup);
705 move_more_ctxpopup(Evas_Object *ctxpopup)
712 /* We convince the top widget is a window */
713 win = elm_object_top_widget_get(ctxpopup);
714 elm_win_screen_size_get(win, NULL, NULL, &w, &h);
715 pos = elm_win_rotation_get(win);
720 evas_object_move(ctxpopup, (w / 2), h);
723 evas_object_move(ctxpopup, (h / 2), w);
726 evas_object_move(ctxpopup, (h / 2), w);
732 naviframe_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
735 Evas_Object *ctxpopup = data;
736 move_more_ctxpopup(ctxpopup);
740 more_ctxpopup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
743 Evas_Object *nf = data;
744 evas_object_event_callback_del_full(nf, EVAS_CALLBACK_RESIZE, naviframe_resize_cb, ctxpopup);
748 win_rotation_changed_cb(void *data, Evas_Object *obj, void *event_info)
751 Evas_Object *ctxpopup = data;
752 move_more_ctxpopup(ctxpopup);
755 /* Icon + Text (More button style : Naviframe Toolbar) */
756 static void create_ctxpopup_more_button_cb(void *data, Evas_Object *obj, void *event_info)
759 SettingNetworkUG *ad = (SettingNetworkUG *) data;
761 Evas_Object *nf = ad->navi_bar;
765 if (ctxpopup != NULL) {
766 evas_object_del(ctxpopup);
769 ctxpopup = elm_ctxpopup_add(nf);
770 elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE);
771 elm_object_style_set(ctxpopup, "more/default");
772 eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_BACK, eext_ctxpopup_back_cb, NULL);
773 eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_MORE, eext_ctxpopup_back_cb, NULL);
774 evas_object_smart_callback_add(ctxpopup, "dismissed", ctxpopup_dismissed_cb, NULL);
775 evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_DEL, more_ctxpopup_del_cb, nf);
776 evas_object_event_callback_add(nf, EVAS_CALLBACK_RESIZE, naviframe_resize_cb, ctxpopup);
778 /* We convince the top widget is a window */
779 win = elm_object_top_widget_get(nf);
780 evas_object_smart_callback_add(win, "rotation,changed", win_rotation_changed_cb, ctxpopup);
782 //---------------------------------------------------------------------------------------------
783 elm_ctxpopup_item_append(ctxpopup, _("IDS_ST_BODY_SAVE"), NULL, setting_network_connection_click_softkey_save_cb, ad);
784 elm_ctxpopup_item_append(ctxpopup, _("IDS_ST_BUTTON_CANCEL_ABB"), NULL, setting_network_connection_click_softkey_back_cb, ad);
785 //---------------------------------------------------------------------------------------------
787 elm_ctxpopup_direction_priority_set(ctxpopup, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN);
788 move_more_ctxpopup(ctxpopup);
789 evas_object_show(ctxpopup);
791 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
794 static int setting_network_connection_create(void *cb)
797 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
799 SettingNetworkUG *ad = (SettingNetworkUG *) cb;
800 setting_retvm_if(!ad->con_name, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER, "!ad->con_name")
802 Evas_Object *scroller = elm_genlist_add(ad->win_main_layout);
803 retvm_if(scroller == NULL, SETTING_DRAW_ERR_FAIL_SCROLLER,
804 "Cannot set scroller object as contento of layout");
805 elm_genlist_realization_mode_set(scroller, EINA_TRUE);
806 elm_genlist_mode_set(scroller, ELM_LIST_COMPRESS);
807 elm_genlist_clear(scroller); /* first to clear list */
808 evas_object_smart_callback_add(scroller, "realized", __gl_realized_cb, NULL);
810 ad->con_create_gl = scroller;
814 const char *title = NULL;
815 switch (ad->profile_service_type) {
816 case CONNECTION_CELLULAR_SERVICE_TYPE_MMS:
817 title = "IDS_ST_BODY_MMS_CONNECTIONS";
819 case CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET:
820 title = "IDS_ST_BODY_INTERNET_CONNECTION";
823 title = ad->con_name;
827 ad->navi_it = setting_push_layout_navi_bar(_(title),
828 NULL, /* ARROW STYLE */
829 _("IDS_ST_BODY_SAVE"),
830 _("IDS_ST_BUTTON_CANCEL_ABB"),
831 setting_network_connection_click_softkey_back_cb,
832 setting_network_connection_click_softkey_save_cb,
833 setting_network_connection_click_softkey_cancel_cb, /* setting_network_connection_click_softkey_back_cb, */
834 ad, scroller, ad->navi_bar, NULL);
836 elm_naviframe_item_pop_cb_set(ad->navi_it, setting_network_connection_click_softkey_back_cb, ad);
837 evas_object_data_set(ad->navi_bar, "sip.naviframe.title_obj", "*");
840 // Add ctx popup handler
841 Evas_Object* btn = elm_button_add(ad->navi_bar);
842 elm_object_style_set(btn, "naviframe/more/default");
843 evas_object_smart_callback_add(btn, "clicked", create_ctxpopup_more_button_cb, ad);
844 elm_object_item_part_content_set(ad->navi_it, "toolbar_more_btn", btn);
846 retv_if(!ad->navi_it, SETTING_RETURN_FAIL);
847 ad->has_form_changed = FALSE;
849 setting_enable_expandable_genlist(scroller, ad,
850 __setting_network_connection_exp_cb,
852 __get_connection_info(ad);
853 Elm_Object_Item *item;
856 elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL,
857 ELM_GENLIST_ITEM_NONE, NULL, NULL);
858 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
860 bool new_flag = FALSE;
861 if (!safeStrCmp(STR_SETTING_NEW_CONNECTIONS, ad->con_name)) { /*new a profile,need to select the "Service type" */
864 setting_create_Gendial_exp_parent_field(scroller,
867 SWALLOW_Type_INVALID,
868 _("IDS_MSGF_BODY_SERVICE_TYPE"),
869 _("IDS_ST_BODY_INTERNET_CONNECTION"));
870 /* ad->data_auth_type->int_slp_setting_binded = INT_SLP_SETTING_INVALID; */
871 if (ad->data_srv_type) {
872 ad->data_srv_type->userdata = ad;
873 __BACK_POINTER_SET(ad->data_srv_type);
875 SETTING_TRACE_ERROR("ad->data_auth_type is NULL");
879 ad->ed_profile_name_desc = elm_entry_utf8_to_markup(ad->ed_profile_name_desc);
880 ad->ed_acs_name_desc = elm_entry_utf8_to_markup(ad->ed_acs_name_desc);
881 SETTING_TRACE("name :%s", ad->ed_profile_name_desc);
882 SETTING_TRACE("apn :%s", ad->ed_acs_name_desc);
884 /* [UI] Profile name */
885 if (!isEmptyStr(ad->ed_profile_name_desc)) {
887 ad->data_profile_name =
888 setting_create_Gendial_field_def(scroller,
889 &itc_multiline_2text,
892 SWALLOW_Type_INVALID,
896 "IDS_ST_BODY_PROFILE_NAME",
897 (char *)ad->ed_profile_name_desc, /* sub_desk*/
901 ad->data_profile_name =
902 setting_create_Gendial_field_entry_with_return_key(scroller,
903 &itc_editfield, NULL,
904 ad, SWALLOW_Type_LAYOUT_EDITFIELD,
906 "IDS_ST_BODY_PROFILE_NAME",
907 (char *)ad->ed_profile_name_desc,
908 setting_network_connection_entry_changed_cb,
909 __network_max_len_reached,
910 ELM_INPUT_PANEL_LAYOUT_NORMAL,
912 64, 64, NULL, NULL, ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, setting_network_connection_entry_next_activated_cb, NULL);
915 if (ad->data_profile_name) {
916 __BACK_POINTER_SET(ad->data_profile_name);
917 ad->data_profile_name->userdata = ad;
918 ad->data_profile_name->win_main = ad->win_get;
919 ad->data_profile_name->isSinglelineFlag = TRUE;
920 /*there is no CAPI to set profile name,so disable it: */
921 /*setting_disable_genlist_item(ad->data_profile_name->item); */
922 if (!isEmptyStr(ad->ed_profile_name_desc)) { /*not create(first time) */
923 elm_genlist_item_select_mode_set(ad->data_profile_name->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
925 /*setting_disable_genlist_item(ad->data_profile_name->item); */
928 SETTING_TRACE_ERROR("ad->data_acs_name is NULL");
931 /* [UI] Access point name */
933 setting_create_Gendial_field_entry_with_return_key(scroller,
934 &itc_editfield, NULL,
935 ad, SWALLOW_Type_LAYOUT_EDITFIELD,
937 "IDS_DLNA_BODY_ACCESS_POINT_NAME",
938 (char *)ad->ed_acs_name_desc,
939 setting_network_connection_entry_changed_cb,
940 __network_max_len_reached,
941 ELM_INPUT_PANEL_LAYOUT_NORMAL,
943 64, 64, NULL, NULL, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE, NULL, NULL);
944 if (ad->data_acs_name) {
945 __BACK_POINTER_SET(ad->data_acs_name);
946 ad->data_acs_name->userdata = ad;
947 ad->data_acs_name->isSinglelineFlag = TRUE;
948 ad->data_acs_name->win_main = ad->win_get;
950 SETTING_TRACE_ERROR("ad->data_acs_name is NULL");
954 elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL,
955 ELM_GENLIST_ITEM_NONE, NULL, NULL);
956 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
959 setting_create_Gendial_field_def(scroller,
961 __create_auth_type_popup, ad,
962 SWALLOW_Type_INVALID,
964 "IDS_ST_BODY_AUTH_TYPE",
965 (char *)ad->ed_auth_type_desc, NULL);
966 /* ad->data_auth_type->int_slp_setting_binded = INT_SLP_SETTING_INVALID; */
967 if (ad->data_auth_type) {
968 ad->data_auth_type->userdata = ad;
969 __BACK_POINTER_SET(ad->data_auth_type);
971 SETTING_TRACE_ERROR("ad->data_auth_type is NULL");
974 ad->item_above_user_name = item =
975 elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL,
976 ELM_GENLIST_ITEM_NONE, NULL, NULL);
977 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
979 ad->is_show_user = 0;
980 if (CONNECTION_CELLULAR_AUTH_TYPE_NONE != ad->chkType) {
983 setting_create_Gendial_field_entry_with_return_key(scroller,
986 SWALLOW_Type_LAYOUT_EDITFIELD,
990 ad->ed_user_name_desc,
991 setting_network_connection_entry_changed_cb,
992 __network_max_len_reached,
993 ELM_INPUT_PANEL_LAYOUT_NORMAL,
995 MAX_PDP_AUTH_USERNAME_LEN_MAX, MAX_PDP_AUTH_USERNAME_LEN_MAX,
996 NULL, NULL, ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, setting_network_connection_entry_next_activated_cb, NULL);
997 if (ad->data_user_name) {
998 __BACK_POINTER_SET(ad->data_user_name);
999 ad->data_user_name->userdata = ad;
1000 ad->data_user_name->isSinglelineFlag = TRUE;
1001 ad->data_user_name->win_main = ad->win_get;
1003 SETTING_TRACE_ERROR("ad->data_user_name is NULL");
1008 setting_create_Gendial_field_entry_with_return_key(scroller,
1011 SWALLOW_Type_LAYOUT_EDITFIELD,
1013 "IDS_ST_BODY_PASSWORD",
1014 (char *)ad->ed_pwd_desc,
1015 setting_network_connection_entry_changed_cb,
1016 __network_max_len_reached,
1017 ELM_INPUT_PANEL_LAYOUT_NORMAL,
1019 MAX_PDP_AUTH_USERNAME_LEN_MAX, MAX_PDP_AUTH_USERNAME_LEN_MAX,
1020 NULL, NULL, ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, setting_network_connection_entry_next_activated_cb, NULL);
1022 __BACK_POINTER_SET(ad->data_pwd);
1023 ad->data_pwd->userdata = ad;
1024 ad->data_pwd->win_main = ad->win_get;
1025 ad->data_pwd->isSinglelineFlag = TRUE;
1026 ad->is_show_user = 1;
1028 SETTING_TRACE_ERROR("ad->data_pwd is NULL");
1031 ad->item_above_proxy_add = item =
1032 elm_genlist_item_append(scroller, &itc_seperator,
1033 NULL, NULL, ELM_GENLIST_ITEM_NONE,
1035 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1038 /* [UI] Proxy address */
1040 setting_create_Gendial_field_entry_with_return_key(scroller,
1041 &itc_editfield, NULL,
1042 ad, SWALLOW_Type_LAYOUT_EDITFIELD,
1044 "IDS_ST_BODY_CONNECTIONSETTINGS_PROXY_ADDRESS",
1045 (char *)ad->ed_pxy_addr_desc,
1046 setting_network_connection_entry_changed_cb,
1047 __network_max_len_reached,
1048 ELM_INPUT_PANEL_LAYOUT_URL,
1050 512, 512, NULL, NULL, ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, setting_network_connection_entry_next_activated_cb, NULL);
1051 if (ad->data_pxy_addr) {
1052 __BACK_POINTER_SET(ad->data_pxy_addr);
1053 ad->data_pxy_addr->userdata = ad;
1054 ad->data_pxy_addr->isSinglelineFlag = TRUE;
1055 ad->data_pxy_addr->win_main = ad->win_get;
1057 SETTING_TRACE_ERROR("ad->data_pxy_addr is NULL");
1060 /* Set SIP key on Next or Done if Home URL existed or not below. */
1061 Elm_Input_Panel_Return_Key_Type type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE;
1062 setting_call_back_func cbFunc = NULL;
1064 if (!safeStrCmp(ad->con_name, STR_SETTING_MMS_CONNECTIONS)) {
1065 type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT;
1066 cbFunc = setting_network_connection_entry_next_activated_cb;
1067 //SETTING_TRACE_ERROR("Enter here hwy ---> ad->con_name : %s ", ad->con_name);
1070 /* [UI] Proxy port */
1072 setting_create_Gendial_field_entry_with_return_key(scroller,
1073 &itc_editfield, NULL,
1074 ad, SWALLOW_Type_LAYOUT_EDITFIELD,
1076 "IDS_ST_BODY_PROXY_PORT",
1077 (char *)ad->ed_pxy_port_desc,
1078 setting_network_connection_entry_changed_cb,
1079 __network_max_len_reached,
1080 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
1083 5, "0123456789", NULL, type, cbFunc, NULL);
1084 if (ad->data_pxy_port) {
1085 ad->data_pxy_port->userdata = ad;
1086 ad->data_pxy_port->isSinglelineFlag = TRUE;
1087 __BACK_POINTER_SET(ad->data_pxy_port);
1088 ad->data_pxy_port->win_main = ad->win_get;
1090 SETTING_TRACE_ERROR("ad->data_pxy_port is NULL");
1094 // if current view is "MMS connection"
1095 if (!safeStrCmp(ad->con_name, STR_SETTING_MMS_CONNECTIONS)) { /* mms Connection */
1098 if (ad->data_pxy_port) {
1099 ad->data_pxy_port->return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
1100 //SETTING_TRACE_ERROR("ad->data_pxy_port->return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT");
1105 setting_create_Gendial_field_entry_with_return_key(scroller,
1108 SWALLOW_Type_LAYOUT_EDITFIELD,
1110 "IDS_ST_BODY_HOME_URL",
1111 (char *)ad->ed_hm_url_desc,
1112 setting_network_connection_entry_changed_cb,
1113 __network_max_len_reached,
1114 ELM_INPUT_PANEL_LAYOUT_URL,
1117 ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE, NULL, NULL);
1118 if (ad->data_hm_url) {
1119 __BACK_POINTER_SET(ad->data_hm_url);
1120 ad->data_hm_url->userdata = ad;
1121 ad->data_hm_url->isSinglelineFlag = TRUE;
1122 ad->data_hm_url->win_main = ad->win_get;
1123 ad->data_hm_url->return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE;
1125 SETTING_TRACE_ERROR("ad->data_hm_url is NULL");
1127 /* ad->is_show_url = 1; */
1130 setting_view_network_connection_create.is_create = 1;
1131 ad->scl_edit = scroller;
1132 /*__genlist_disable_set(ad->scl_edit, TRUE); */
1133 /*ad->is_editable = FALSE; for test */
1134 SETTING_TRACE("==> ad->is_editable:%d", ad->is_editable);
1135 if (!ad->is_editable) {
1136 /*SETTING_TRACE("xxxx....."); */
1137 if (ad->data_srv_type) setting_disable_genlist_item(ad->data_srv_type->item);
1138 if (ad->data_profile_name) setting_disable_genlist_item(ad->data_profile_name->item);
1139 if (ad->data_acs_name) setting_disable_genlist_item(ad->data_acs_name->item);
1140 if (ad->data_auth_type) setting_disable_genlist_item(ad->data_auth_type->item);
1143 if (ad->data_user_name) setting_disable_genlist_item(ad->data_user_name->item);
1144 if (ad->data_pwd) setting_disable_genlist_item(ad->data_pwd->item);
1145 if (ad->data_pxy_addr) setting_disable_genlist_item(ad->data_pxy_addr->item);
1146 if (ad->data_pxy_port) setting_disable_genlist_item(ad->data_pxy_port->item);
1147 if (ad->data_hm_url) setting_disable_genlist_item(ad->data_hm_url->item);
1149 ecore_idler_add(__connection_idler, ad);
1151 return SETTING_RETURN_SUCCESS;
1154 static int setting_network_connection_destroy(void *cb)
1156 SETTING_TRACE_BEGIN;
1158 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1160 SettingNetworkUG *ad = (SettingNetworkUG *) cb;
1162 evas_object_data_set(ad->navi_bar, "sip.naviframe.title_obj", NULL);
1164 ad->bottom_btn = NULL;
1165 ad->back_btn = NULL;
1166 /*manager separatly, */
1168 evas_object_del(ad->l_button);
1169 ad->l_button = NULL;
1173 evas_object_del(ad->m_button);
1174 ad->m_button = NULL;
1177 evas_object_del(ad->r_button);
1178 ad->r_button = NULL;
1180 /*FREE(ad->con_name); */
1181 G_FREE(ad->ed_profile_name_desc);
1182 G_FREE(ad->ed_acs_name_desc);
1183 G_FREE(ad->ed_user_name_desc);
1184 G_FREE(ad->ed_pwd_desc);
1186 G_FREE(ad->ed_pxy_addr_desc);
1187 G_FREE(ad->ed_pxy_port_desc);
1189 G_FREE(ad->ed_hm_url_desc);
1191 elm_naviframe_item_pop(ad->navi_bar);
1193 setting_view_network_connection_create.is_create = 0;
1194 return SETTING_RETURN_SUCCESS;
1197 static int setting_network_connection_update(void *cb)
1199 SETTING_TRACE_BEGIN;
1200 return SETTING_RETURN_SUCCESS;
1203 static int setting_network_connection_cleanup(void *cb)
1205 return setting_network_connection_destroy(cb);
1208 /* ***************************************************
1212 ***************************************************/
1213 bool need_check_default_profile(void *data, connection_cellular_service_type_e inputtype)
1215 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1216 SettingNetworkUG *ad = (SettingNetworkUG *) data;
1217 SETTING_TRACE("inputtype:%d", inputtype);
1218 connection_profile_iterator_h profile_iter = NULL;
1219 connection_profile_h profile_h = NULL;
1220 int rv = connection_get_profile_iterator(ad->connection, CONNECTION_ITERATOR_TYPE_REGISTERED, &profile_iter);
1221 if (rv != CONNECTION_ERROR_NONE) {
1222 SETTING_TRACE_ERROR("Fail to get profile iterator [%d]", rv);
1223 return SETTING_RETURN_FAIL;
1227 connection_profile_type_e profile_type = CONNECTION_PROFILE_TYPE_CELLULAR;
1228 connection_cellular_service_type_e service_type = CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN;
1229 while (connection_profile_iterator_has_next(profile_iter)) {
1230 if (cnt >= MAX_PROFILE_NUM) {
1234 if (connection_profile_iterator_next(profile_iter, &profile_h) != CONNECTION_ERROR_NONE) {
1235 SETTING_TRACE_ERROR("Fail to get profile handle");
1239 if (connection_profile_get_type(profile_h, &profile_type) != CONNECTION_ERROR_NONE) {
1240 SETTING_TRACE_ERROR("Fail to get profile type");
1243 if (connection_profile_get_cellular_service_type(profile_h, &service_type) != CONNECTION_ERROR_NONE) {
1244 SETTING_TRACE_ERROR("Fail to get service type");
1247 if (CONNECTION_PROFILE_TYPE_CELLULAR == profile_type && inputtype == service_type) {
1249 connection_profile_get_cellular_apn(profile_h, &apn);
1250 SETTING_TRACE("Matched:%s", apn);
1259 * popup - timeout and 'ok' callback
1261 static void __setting_network_connection_popup_rsp_cb(void *data, Evas_Object *obj, void *event_info)
1264 SETTING_TRACE_BEGIN;
1265 setting_retm_if(obj == NULL, "obj parameter is NULL");
1266 setting_retm_if(data == NULL, "Data parameter is NULL");
1267 SettingNetworkUG *ad = (SettingNetworkUG *) data;
1270 if (ctxpopup != NULL) {
1271 evas_object_del(ctxpopup);
1278 static int __save_connection(void *data)
1280 SETTING_TRACE_BEGIN;
1282 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1284 SettingNetworkUG *ad = (SettingNetworkUG *) data;
1285 const char *profile_name = NULL;
1286 const char *acs_name = NULL;
1287 const char *usr_name = NULL;
1288 const char *pwd = NULL;
1289 const char *addr = NULL;
1290 const char *port = NULL;
1291 const char *home = NULL;
1293 if (ad->data_profile_name)
1294 profile_name = elm_entry_markup_to_utf8(ad->data_profile_name->sub_desc);
1295 if (ad->data_acs_name)
1296 acs_name = elm_entry_markup_to_utf8(ad->data_acs_name->sub_desc);
1297 if (ad->data_user_name)
1298 usr_name = elm_entry_markup_to_utf8(ad->data_user_name->sub_desc);
1300 pwd = elm_entry_markup_to_utf8(ad->data_pwd->sub_desc);
1301 if (ad->data_pxy_addr)
1302 addr = elm_entry_markup_to_utf8(ad->data_pxy_addr->sub_desc);
1303 if (ad->data_pxy_port)
1304 port = elm_entry_markup_to_utf8(ad->data_pxy_port->sub_desc);
1307 profile_name = strdup("");
1309 acs_name = strdup("");
1311 usr_name = strdup("");
1318 SETTING_TRACE("acs_name:%s", acs_name);
1319 SETTING_TRACE("usr_name:%s", usr_name);
1320 SETTING_TRACE("pwd:%s", pwd);
1322 SETTING_TRACE("addr:%s", addr);
1323 SETTING_TRACE("port:%s", port);
1324 SETTING_TRACE("home:%s", home);
1326 char sz_text[MAX_HOME_URL_LEN_MAX + 1] = { 0, };
1328 int ret = SETTING_RETURN_SUCCESS;
1331 if (!safeStrCmp(profile_name, "")) {
1333 char name[MAX_DISPLAY_NAME_LEN_ON_UI + 1] = {0, };
1334 snprintf(name, sizeof(name), _("IDS_ST_POP_ENTER_PS"), _("IDS_ST_BODY_PROFILE_NAME"));
1337 setting_create_popup(ad, ad->win_get, NULL, _(name), __setting_network_connection_popup_rsp_cb, 2/*SECONDS*/, false, false, 0);
1344 return SETTING_DNET_RETURN_NULL_ACCESS_NAME;
1347 if (!safeStrCmp(acs_name, "")) {
1349 char name[MAX_DISPLAY_NAME_LEN_ON_UI + 1] = {0, };
1350 snprintf(name, sizeof(name), _("IDS_ST_POP_ENTER_PS"), _("IDS_DLNA_BODY_ACCESS_POINT_NAME"));
1351 setting_create_popup(ad, ad->win_get, NULL, _(name), __setting_network_connection_popup_rsp_cb, 2/*SECONDS*/, false, false, 0);
1358 return SETTING_DNET_RETURN_NULL_ACCESS_NAME;
1360 /*if (test_update_cellular_info(profile) == -1) */
1361 bool add_flag = FALSE;/*add a new profile */
1362 connection_profile_h con_info = NULL;
1363 connection_profile_h con_info_2 = NULL;/*for MMS */
1364 if (ad->sel_profile_h) {
1365 con_info = ad->sel_profile_h;
1366 if (0 != safeStrCmp(ad->con_name, STR_SETTING_MMS_CONNECTIONS)
1367 && 0 != safeStrCmp(ad->con_name, "IDS_ST_BODY_INTERNET_CONNECTION")) {
1368 /*need to change con_name */
1369 /*FREE(ad->con_name); */
1370 /*ad->con_name = strdup(acs_name); */
1373 if (!safeStrCmp(ad->con_name, STR_SETTING_MMS_CONNECTIONS)) {
1374 (void)connection_profile_create(CONNECTION_PROFILE_TYPE_CELLULAR, _(profile_name), &con_info);
1375 (void)connection_profile_set_cellular_service_type(con_info, CONNECTION_CELLULAR_SERVICE_TYPE_MMS);
1376 } else if (!safeStrCmp(ad->con_name, "IDS_ST_BODY_INTERNET_CONNECTION")) {
1377 (void)connection_profile_create(CONNECTION_PROFILE_TYPE_CELLULAR, _(profile_name), &con_info);
1378 (void)connection_profile_set_cellular_service_type(con_info, CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET);
1380 /*need to change con_name */
1381 /*FREE(ad->con_name); */
1382 /*ad->con_name = strdup(acs_name); */
1383 (void)connection_profile_create(CONNECTION_PROFILE_TYPE_CELLULAR, _(profile_name), &con_info);
1384 if (CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET == ad->srvType) {
1386 (void)connection_profile_set_cellular_service_type(con_info, CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET);
1387 } else if (CONNECTION_CELLULAR_SERVICE_TYPE_MMS == ad->srvType) {
1389 (void)connection_profile_set_cellular_service_type(con_info, CONNECTION_CELLULAR_SERVICE_TYPE_MMS);
1390 } else { /*MMS + Internet(Together) */
1391 (void)connection_profile_set_cellular_service_type(con_info, CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET);
1392 (void)connection_profile_create(CONNECTION_PROFILE_TYPE_CELLULAR, _(profile_name), &con_info_2);
1393 (void)connection_profile_set_cellular_service_type(con_info_2, CONNECTION_CELLULAR_SERVICE_TYPE_MMS);
1394 SETTING_TRACE("con_info_2:%p", con_info_2);
1401 SETTING_TRACE("ad->con_name:%s", ad->con_name);
1402 SETTING_TRACE("profile_name:%s", profile_name);
1404 /* save access name */
1405 SETTING_TRACE("acs_name:%s", acs_name);
1407 (void) connection_profile_set_cellular_apn(con_info, acs_name);
1408 if (con_info_2)(void)connection_profile_set_cellular_apn(con_info_2, acs_name);
1411 /* save auth type */
1413 SETTING_TRACE("-----> auth type: %d", type);
1414 SETTING_TRACE("-----> radio button state: %d", elm_radio_value_get(ad->chk_type));
1416 #ifdef OLD_AUTH_CONCEPT
1417 /* save user name */
1418 if (!safeStrCmp(usr_name, "")
1419 && CONNECTION_CELLULAR_AUTH_TYPE_NONE != type) {
1420 setting_create_popup(ad, ad->win_get,
1421 NULL, _(Insert_User_Name_Desc), __setting_network_connection_popup_rsp_cb, 2/*SECONDS*/, false, false, 0);
1426 return SETTING_DNET_RETURN_NULL_USER_NAME;
1430 if (!safeStrCmp(pwd, "")
1431 && CONNECTION_CELLULAR_AUTH_TYPE_NONE != type) {
1432 setting_create_popup(ad, ad->win_get,
1433 NULL, _(""), __setting_network_connection_popup_rsp_cb,2/*SECONDS*/, false, false, 0);/*this code is not used now, so remove the ID which is not used in po file*/
1438 return SETTING_DNET_RETURN_NULL_PASSWORD;
1441 (void)connection_profile_set_cellular_auth_info(con_info, type, usr_name, pwd);
1442 if (con_info_2)(void)connection_profile_set_cellular_auth_info(con_info_2, type, usr_name, pwd);
1444 /* save proxy addr */
1445 SETTING_TRACE("addr:port[%s:%s]", addr, port);
1446 char *output_addr = NULL;
1447 if (isEmptyStr(addr)) {
1448 /* check proxy port */
1449 if (!isEmptyStr(port)) {
1450 setting_create_popup(ad, ad->win_get,
1451 NULL, _("IDS_COM_BODY_ENTER_PROXY_EMPTY"), __setting_network_connection_popup_rsp_cb, 2/*SECONDS*/, false, false, 0);
1456 return SETTING_DNET_RETURN_INVALID_PROXY_ADDR;
1459 output_addr = g_strdup(addr);
1460 if (isEmptyStr(port)) {
1461 snprintf(sz_text, sizeof(sz_text), "%s", output_addr);
1463 snprintf(sz_text, sizeof(sz_text), "%s:%s", output_addr, port);
1467 G_FREE(output_addr);
1468 SETTING_TRACE("sz_text:%s", sz_text);
1469 if (!isEmptyStr(sz_text)) {
1470 connection_profile_set_proxy_address(con_info, CONNECTION_ADDRESS_FAMILY_IPV4, sz_text);
1472 connection_profile_set_proxy_address(con_info_2, CONNECTION_ADDRESS_FAMILY_IPV4, sz_text);
1475 connection_profile_set_proxy_address(con_info, CONNECTION_ADDRESS_FAMILY_IPV4, NULL);
1477 connection_profile_set_proxy_address(con_info_2, CONNECTION_ADDRESS_FAMILY_IPV4, NULL);
1480 /* save home url(message connection only) */
1481 if (!safeStrCmp(ad->con_name, STR_SETTING_MMS_CONNECTIONS)
1482 || (!safeStrCmp(ad->con_name, STR_SETTING_NEW_CONNECTIONS)
1483 && CONNECTION_CELLULAR_SERVICE_TYPE_MMS == ad->srvType)) { /* Message Connection */
1484 home = elm_entry_markup_to_utf8(ad->data_hm_url->sub_desc);
1485 if (home == (char *)NULL) {
1486 (void)connection_profile_set_cellular_home_url(con_info, URL_HEAD);
1488 if (!safeStrCmp(home, "")) {
1490 home = strdup(URL_HEAD);
1491 ret = SETTING_DNET_RETURN_NULL_HOMEURL;
1493 (void)connection_profile_set_cellular_home_url(con_info, home);
1497 if (con_info_2) { /*creating both internet + MMS */
1498 home = elm_entry_markup_to_utf8(ad->data_hm_url->sub_desc);
1499 if (home == (char *)NULL) {
1500 (void)connection_profile_set_cellular_home_url(con_info_2, URL_HEAD);
1502 if (!safeStrCmp(home, "")) {
1504 home = strdup(URL_HEAD);
1505 ret = SETTING_DNET_RETURN_NULL_HOMEURL;
1507 (void)connection_profile_set_cellular_home_url(con_info_2, home);
1516 /*SETTING_TRACE("ad->con_type:%d", ad->con_type); */
1517 /* save connection */
1519 SETTING_TRACE("con_info is %p, con_info_2:%p", con_info, con_info_2);
1521 /*Add a new profile */
1522 connection_cellular_service_type_e type = CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN;
1523 (void)connection_profile_get_cellular_service_type(con_info, &type);
1525 err = connection_add_profile(ad->connection, con_info);
1526 if (err != CONNECTION_ERROR_NONE) {
1527 SETTING_TRACE_ERROR("*** [ERR] connection_add_profile. err=%d ***", err);
1528 ret = SETTING_DNET_RETURN_ERR;
1529 setting_create_popup(ad, ad->win_get, NULL, _("IDS_CST_POP_FAILED"), NULL, 0, false, false, 0);
1532 connection_profile_h tmp_profile = NULL;
1533 (void)connection_get_default_cellular_service_profile(ad->connection, type, &tmp_profile);
1535 => if there is already default profile, after_profile will be handle of default profile.
1536 => there is no default profile, after_profile will be handle of the profile which we have added just before.
1538 if (setting_network_equal_profile(con_info, tmp_profile)) {
1539 SETTING_TRACE_ERROR("Going to set profile")
1540 (void)connection_set_default_cellular_service_profile(ad->connection, type, tmp_profile);
1545 (void)connection_destroy(tmp_profile);
1547 (void)connection_profile_destroy(con_info);
1551 if (con_info_2) { /*just for MMS + internet */
1552 connection_cellular_service_type_e type = CONNECTION_CELLULAR_SERVICE_TYPE_UNKNOWN;
1553 (void)connection_profile_get_cellular_service_type(con_info_2, &type);
1554 /*Add a new profile */
1555 err = connection_add_profile(ad->connection, con_info_2);
1556 if (err != CONNECTION_ERROR_NONE) {
1557 SETTING_TRACE_ERROR("*** [ERR] connection_add_profile. err=%d ***", err);
1558 ret = SETTING_DNET_RETURN_ERR;
1559 setting_create_popup(ad, ad->win_get, NULL, _("IDS_CST_POP_FAILED"), NULL, 0, false, false, 0);
1562 connection_profile_h tmp_profile = NULL;
1563 (void)connection_get_default_cellular_service_profile(ad->connection, type, &tmp_profile);
1565 => if there is already default profile, after_profile will be handle of default profile.
1566 => there is no default profile, after_profile will be handle of the profile which we have added just before.
1568 if (setting_network_equal_profile(con_info_2, tmp_profile)) {
1569 SETTING_TRACE_ERROR("Going to set profile")
1570 (void)connection_set_default_cellular_service_profile(ad->connection, type, tmp_profile);
1575 (void)connection_destroy(tmp_profile);
1576 (void)connection_profile_destroy(con_info_2);
1580 err = connection_update_profile(ad->connection, con_info);
1581 if (err != CONNECTION_ERROR_NONE) {
1583 ("%s*** [ERR] net_modify_profile. err=%d ***%s",
1584 SETTING_FONT_RED, err, SETTING_FONT_BLACK);
1585 ret = SETTING_DNET_RETURN_ERR;
1586 setting_create_popup(ad, ad->win_get,
1587 NULL, _("IDS_CST_POP_FAILED"), NULL, 0, false, false, 0);
1593 /* ***************************************************
1597 ***************************************************/
1600 setting_network_connection_click_softkey_done_cb(void *data,
1604 SETTING_TRACE_BEGIN;
1606 retm_if(data == NULL, "Data parameter is NULL");
1608 SettingNetworkUG *ad = (SettingNetworkUG *) data;
1609 if (ad->data_profile_name) {
1610 setting_hide_input_pannel_cb(ad->data_profile_name->eo_check);
1613 if (ad->data_acs_name) {
1614 setting_hide_input_pannel_cb(ad->data_acs_name->eo_check);
1616 if (ad->data_user_name) {
1617 setting_hide_input_pannel_cb(ad->data_user_name->eo_check);
1620 setting_hide_input_pannel_cb(ad->data_pwd->eo_check);
1622 if (ad->data_pxy_addr) {
1623 setting_hide_input_pannel_cb(ad->data_pxy_addr->eo_check);
1625 if (ad->data_pxy_port) {
1626 setting_hide_input_pannel_cb(ad->data_pxy_port->eo_check);
1628 if (ad->data_hm_url) {
1629 setting_hide_input_pannel_cb(ad->data_hm_url->eo_check);
1634 static void __save_response_cb(void *data, Evas_Object *obj,
1637 SETTING_TRACE_BEGIN;
1638 retm_if(data == NULL, "Data parameter is NULL");
1640 SettingNetworkUG *ad = (SettingNetworkUG *) data;
1642 evas_object_del(obj);
1645 /*re-fetch connection info.. */
1646 /*__get_connection_info(ad); */
1647 SETTING_TRACE("ad->con_name:%s", ad->con_name);
1649 ad->apn_MMS = __get_profile_name(CONNECTION_CELLULAR_SERVICE_TYPE_MMS, ad);
1651 elm_naviframe_item_pop(ad->navi_bar); /* Call automatically setting_network_connection_click_softkey_back_cb() by registering elm_naviframe_item_pop_cb_set() */
1655 * [UI-CALLBACK] 'Save' button handler
1658 setting_network_connection_click_softkey_save_cb(void *data,
1662 SETTING_TRACE_BEGIN;
1664 retm_if(data == NULL, "Data parameter is NULL");
1666 SettingNetworkUG *ad = (SettingNetworkUG *) data;
1668 int ret = __save_connection(ad);
1669 /* need special handle */
1670 if (SETTING_DNET_RETURN_NULL_ACCESS_NAME == ret
1671 || SETTING_DNET_RETURN_NULL_USER_NAME == ret
1672 || SETTING_DNET_RETURN_NULL_PASSWORD == ret
1673 || SETTING_DNET_RETURN_INVALID_PROXY_ADDR == ret
1674 || SETTING_DNET_RETURN_ERR == ret) {
1677 if (ret != SETTING_RETURN_SUCCESS) {
1679 ("%s*** [ERR] __save_connection ***%s",
1680 SETTING_FONT_RED, SETTING_FONT_BLACK);
1683 elm_object_tree_focus_allow_set(ad->con_create_gl, EINA_FALSE);
1685 setting_create_popup(ad, ad->win_get, NULL, KeyStr_Saved, __save_response_cb, 1, FALSE, FALSE, 0);
1687 if (ctxpopup != NULL) {
1688 evas_object_del(ctxpopup);
1695 setting_network_connection_click_softkey_back_cb(void *data, Elm_Object_Item *it)
1697 SETTING_TRACE_BEGIN;
1699 retvm_if(data == NULL, EINA_TRUE, "Data parameter is NULL");
1701 SettingNetworkUG *ad = (SettingNetworkUG *) data;
1703 elm_object_tree_focus_allow_set(ad->con_create_gl, EINA_FALSE);
1705 SETTING_TRACE("ad->con_name:%s", ad->con_name);
1706 if (!safeStrCmp(STR_SETTING_NEW_CONNECTIONS, ad->con_name)
1707 || ad->profile_topper_view == &setting_view_network_con) { /*new a profile,need to select the "Service type" */
1708 /*not normal view change,need do specially */
1709 setting_view_cleanup(&setting_view_network_connection_create, ad);
1710 setting_view_update(&setting_view_network_con, ad);
1712 setting_view_change(&setting_view_network_connection_create, &setting_view_network_con_list, ad);
1715 if (ctxpopup != NULL) {
1716 evas_object_del(ctxpopup);
1724 setting_network_connection_click_softkey_cancel_cb(void *data,
1728 SETTING_TRACE_BEGIN;
1730 retm_if(data == NULL, "Data parameter is NULL");
1732 SettingNetworkUG *ad = (SettingNetworkUG *) data;
1734 elm_naviframe_item_pop(ad->navi_bar); /* Call automatically setting_network_connection_click_softkey_back_cb() by registering elm_naviframe_item_pop_cb_set() */
1737 static void setting_network_connection_check_entry_empty(SettingNetworkUG *ad)
1739 SETTING_TRACE_BEGIN;
1740 if (!ad->has_form_changed) {
1741 SETTING_TRACE_DEBUG("ad->has_form_changed == FALSE!");
1744 bool isFoundEmptyEntry = FALSE;
1747 if (ad->data_profile_name && isEmptyStr(ad->data_profile_name->sub_desc)) {
1748 /*SETTING_TRACE("entry_str:%s", ad->data_profile_name->sub_desc); */
1749 isFoundEmptyEntry = TRUE;
1752 if (ad->data_acs_name && isEmptyStr(ad->data_acs_name->sub_desc)) {
1753 /*SETTING_TRACE("entry_str:%s", ad->data_acs_name->sub_desc); */
1754 isFoundEmptyEntry = TRUE;
1757 if (ad->data_user_name && isEmptyStr(ad->data_user_name->sub_desc)) {
1758 /*SETTING_TRACE("entry_str:%s", ad->data_user_name->sub_desc); */
1759 isFoundEmptyEntry = TRUE;
1762 if (ad->data_pwd && isEmptyStr(ad->data_pwd->sub_desc)) {
1763 /*SETTING_TRACE("entry_str:%s", ad->data_pwd->sub_desc); */
1764 isFoundEmptyEntry = TRUE;
1767 if (ad->data_hm_url && isEmptyStr(ad->data_hm_url->sub_desc)) {
1768 /*SETTING_TRACE("entry_str:%s", ad->data_hm_url->sub_desc); */
1769 isFoundEmptyEntry = TRUE;
1773 Evas_Object *done_btn = elm_object_item_part_content_get(ad->navi_it, NAVI_BTN_STYLE_LEFT);
1774 if (isFoundEmptyEntry) {
1775 if (!evas_object_pass_events_get(done_btn)) {/*it had not yet been disabled */
1776 setting_disable_evas_object(done_btn);
1777 setting_dim_evas_object(done_btn, TRUE);
1779 /*do nothing..if invoke setting_dim_evas_object many times, the done button will be dimer until it cannot be see. */
1780 /*refer to the API of setting_dim_evas_object(). The API is supplied by Setting itself, winset doesn't support until now as I now. */
1783 setting_enable_evas_object(done_btn);
1784 setting_undo_dim_evas_object(done_btn, TRUE);
1789 setting_network_connection_display_auth_type(SettingNetworkUG *ad,
1792 SETTING_TRACE_BEGIN;
1793 retm_if(ad == NULL, "Data parameter is NULL");
1794 if (ad->chkType == auth_type) return;
1796 ad->chkType = auth_type; /* for update genlist */
1797 if (CONNECTION_CELLULAR_AUTH_TYPE_NONE != auth_type) { /* to show */
1798 SETTING_TRACE("ad->is_show_user:%d", ad->is_show_user);
1799 if (ad->is_show_user == 0) { /* do only when hiden */
1800 SETTING_TRACE("to create");
1802 ad->data_user_name =
1803 (Setting_GenGroupItem_Data *) calloc(1,
1805 (Setting_GenGroupItem_Data));
1806 setting_retm_if(ad->data_user_name == NULL, "calloc failed");
1807 ad->data_user_name->keyStr =
1808 (char *)g_strdup(KeyStr_UserID);
1809 ad->data_user_name->sub_desc =
1810 (char *)g_strdup(ad->ed_user_name_desc);
1811 ad->data_user_name->swallow_type =
1812 SWALLOW_Type_LAYOUT_EDITFIELD;
1813 ad->data_user_name->isSinglelineFlag = TRUE;
1814 ad->data_user_name->userdata = ad;
1816 ad->data_user_name->return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT;
1817 ad->data_user_name->activated_cb = setting_network_connection_entry_next_activated_cb;
1819 ad->data_user_name->maxlength_reached_cb = __network_max_len_reached;
1820 ad->data_user_name->disable_auto_cap = EINA_TRUE;
1822 __BACK_POINTER_SET(ad->data_user_name);
1824 ad->data_user_name->chk_change_cb =
1825 setting_network_connection_entry_changed_cb;
1826 ad->data_user_name->limit_filter_data = calloc(1, sizeof(Elm_Entry_Filter_Accept_Set));
1827 if (ad->data_user_name->limit_filter_data) {
1828 ad->data_user_name->limit_filter_data->max_byte_count = MAX_PDP_AUTH_USERNAME_LEN_MAX;
1829 ad->data_user_name->win_main = ad->win_get;
1831 ad->data_user_name->item =
1832 elm_genlist_item_insert_after(ad->scl_edit,
1836 ad->item_above_user_name,
1837 ELM_GENLIST_ITEM_NONE,
1841 (Setting_GenGroupItem_Data *) calloc(1,
1843 (Setting_GenGroupItem_Data));
1845 setting_retm_if(ad->data_pwd == NULL, "calloc failed");
1846 ad->data_pwd->keyStr =
1847 (char *)g_strdup("IDS_ST_BODY_PASSWORD");
1848 ad->data_pwd->sub_desc =
1849 (char *)g_strdup(ad->ed_pwd_desc);
1850 ad->data_pwd->swallow_type = SWALLOW_Type_LAYOUT_EDITFIELD;
1851 ad->data_pwd->userdata = ad;
1852 ad->data_pwd->chk_change_cb =
1853 setting_network_connection_entry_changed_cb;
1854 ad->data_pwd->isPasswordFlag = TRUE;
1855 ad->data_pwd->isSinglelineFlag = TRUE;
1857 ad->data_pwd->return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT;
1858 ad->data_pwd->activated_cb = setting_network_connection_entry_next_activated_cb;
1860 ad->data_pwd->maxlength_reached_cb = __network_max_len_reached;
1861 ad->data_pwd->disable_auto_cap = EINA_TRUE;
1863 __BACK_POINTER_SET(ad->data_pwd);
1865 /* ad->data_pwd->chk_change_cb = chk_change_cb; */
1866 ad->data_pwd->limit_filter_data = calloc(1, sizeof(Elm_Entry_Filter_Accept_Set));
1867 if (ad->data_pwd->limit_filter_data) {
1868 ad->data_pwd->limit_filter_data->max_byte_count = MAX_PDP_AUTH_PASSWORD_LEN_MAX;
1869 ad->data_pwd->win_main = ad->win_get;
1871 ad->data_pwd->item =
1872 elm_genlist_item_insert_after(ad->scl_edit,
1875 ad->data_user_name->item,
1876 ELM_GENLIST_ITEM_NONE,
1879 ad->item_above_proxy_add =
1880 elm_genlist_item_insert_after(ad->scl_edit,
1884 ELM_GENLIST_ITEM_NONE,
1886 elm_genlist_item_select_mode_set
1887 (ad->item_above_proxy_add, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1889 ad->has_form_changed = TRUE;
1890 setting_network_connection_check_entry_empty(ad);
1891 elm_genlist_item_select_mode_set(ad->data_user_name->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1892 elm_genlist_item_select_mode_set(ad->data_pwd->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1893 /* ad->is_show_user = 1; */
1895 ad->is_show_user = 1;
1896 } else { /* to hide */
1898 SETTING_TRACE("ad->is_show_user:%d", ad->is_show_user);
1899 if (ad->is_show_user == 1) { /* do only when shown */
1900 SETTING_TRACE("to destroy");
1901 if (ad->data_user_name) {
1902 elm_object_item_del(ad->data_user_name->item);
1903 ad->data_user_name = NULL;
1906 elm_object_item_del(ad->data_pwd->item);
1907 ad->data_pwd = NULL;
1909 if (ad->item_above_proxy_add) {
1910 elm_object_item_del(ad->item_above_proxy_add);
1911 ad->item_above_proxy_add = NULL;
1915 ad->has_form_changed = TRUE;
1916 setting_network_connection_check_entry_empty(ad);
1917 ad->is_show_user = 0;
1923 setting_network_connection_entry_changed_cb(void *data, Evas_Object *obj,
1926 SETTING_TRACE_BEGIN;
1927 retm_if(data == NULL, "Data parameter is NULL");
1928 Setting_GenGroupItem_Data *list_item =
1929 (Setting_GenGroupItem_Data *) data;
1930 SettingNetworkUG *ad = list_item->userdata;
1931 const char *entry_str = elm_entry_entry_get(obj);
1933 if (list_item->maxLengthReachFlag && list_item->enterKeyPressFlag == false) {
1935 int ret = notification_status_message_post(_("IDS_ST_TPOP_MAXIMUM_NUMBER_OF_CHARACTERS_REACHED"));
1936 if (ret != NOTIFICATION_ERROR_NONE)
1937 SETTING_TRACE_ERROR("notification_status_message_post() failed(%d)", ret);
1938 ad->popup = setting_create_popup(ad, ad->win_get, NULL,
1939 "IDS_ST_TPOP_MAXIMUM_NUMBER_OF_CHARACTERS_REACHED",
1940 NULL, 2, TRUE, FALSE, 0);
1941 elm_object_focus_set(list_item->eo_check, EINA_FALSE);
1944 list_item->maxLengthReachFlag = FALSE;
1945 list_item->enterKeyPressFlag = FALSE;
1946 /*G_FREE(list_item->sub_desc);//release first */
1947 list_item->sub_desc = (char *)g_strdup(entry_str);
1948 ad->has_form_changed = TRUE;
1949 setting_network_connection_check_entry_empty(ad);
1952 setting_network_connection_hide_input_pannel(void *data)
1954 SETTING_TRACE_BEGIN;
1955 retm_if(data == NULL, "Data parameter is NULL");
1956 SettingNetworkUG *ad = data;
1957 if (ad->data_profile_name && ad->data_profile_name->eo_check) {
1958 setting_hide_input_pannel_cb(ad->data_profile_name->eo_check);
1960 if (ad->data_acs_name && ad->data_acs_name->eo_check) {
1961 setting_hide_input_pannel_cb(ad->data_acs_name->eo_check);
1963 if (ad->data_user_name && ad->data_user_name->eo_check) {
1964 setting_hide_input_pannel_cb(ad->data_user_name->eo_check);
1966 if (ad->data_pwd && ad->data_pwd->eo_check) {
1967 setting_hide_input_pannel_cb(ad->data_pwd->eo_check);
1969 if (ad->data_pxy_addr && ad->data_pxy_addr->eo_check) {
1970 setting_hide_input_pannel_cb(ad->data_pxy_addr->eo_check);
1972 if (ad->data_pxy_port && ad->data_pxy_port->eo_check) {
1973 setting_hide_input_pannel_cb(ad->data_pxy_port->eo_check);
1975 if (ad->data_hm_url && ad->data_hm_url->eo_check) {
1976 setting_hide_input_pannel_cb(ad->data_hm_url->eo_check);