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.
22 #include <setting-password.h>
23 #include <setting-password-main.h>
24 #include <setting-common-data-slp-setting.h>
25 #include <openssl/sha.h>
26 #include <setting-debug.h>
30 static int setting_password_main_create(void *cb);
31 static int setting_password_main_destroy(void *cb);
32 static int setting_password_main_update(void *cb);
33 static int setting_password_main_cleanup(void *cb);
35 setting_view setting_view_password_main = {
36 .create = setting_password_main_create,
37 .destroy = setting_password_main_destroy,
38 .update = setting_password_main_update,
39 .cleanup = setting_password_main_cleanup,
42 #define ENTRY_CALLBACK_REPEAT_MAX 3
43 #define SETTING_COMPARE_PW_FAIL -2
45 /* ***************************************************
49 ***************************************************/
51 __password_main_gl_mouse_up(void *data, Evas *e, Evas_Object *obj,
55 SettingPasswordUG *ad = (SettingPasswordUG *) data;
58 setting_hide_input_pannel_cb(ad->ed_pw1->eo_check);
61 setting_hide_input_pannel_cb(ad->ed_pw1->eo_check);
64 setting_hide_input_pannel_cb(ad->ed_pw1->eo_check);
69 static char *setting_password_main_get_title_str(void *data)
71 retvm_if(data == NULL, NULL,
72 "[Setting > Password] Data parameter is NULL");
73 SettingPasswordUG *ad = (SettingPasswordUG *) data;
75 switch (ad->view_type) {
76 case SETTING_PW_TYPE_SIM_LOCK_ON:
77 case SETTING_PW_TYPE_SIM_LOCK_OFF:
78 return _("IDS_COM_BODY_AUTH_PASSWORD");
80 case SETTING_PW_TYPE_PIN_LOCK_ON:
81 case SETTING_PW_TYPE_PIN_LOCK_OFF:
82 return _("IDS_ST_BODY_PIN1");
84 case SETTING_PW_TYPE_CHANGE_PIN1:
85 return _("IDS_ST_BODY_CHANGE_PIN1");
88 case SETTING_PW_TYPE_CHANGE_PIN2:
89 return _("IDS_ST_BODY_CHANGE_PIN2");
92 case SETTING_PW_TYPE_PIN1_BLOCKED:
93 return _("IDS_ST_BODY_PUK1_CODE");
95 case SETTING_PW_TYPE_PIN2_BLOCKED:
97 return _("IDS_ST_BODY_PUK2");
100 SETTING_TRACE_DEBUG("%s*** Unknown Password Type. ***%s",
101 SETTING_FONT_BGREEN, SETTING_FONT_BLACK);
108 Elm_Object_Item* __create_navibar(void *data, Evas_Object *content, Evas_Object *navibar, setting_pw_navibar_style_t style)
111 retv_if(data == NULL || content == NULL || navibar == NULL, NULL);
113 SettingPasswordUG *ad = (SettingPasswordUG *)data;
115 Elm_Object_Item *navi_item = NULL;
116 Evas_Object *done_btn = NULL;
120 case SETTING_PW_NAVIBAR_WITH_LEFT_BTN :
121 SETTING_TRACE_DEBUG("with left btn");
122 navi_item = setting_create_navi_bar_top_buttons(setting_password_main_get_title_str(ad),
123 NULL, _("IDS_COM_SK_CANCEL"), NULL,
125 setting_password_main_click_softkey_cancel_cb,
126 NULL, ad, content, navibar);
128 case SETTING_PW_NAVIBAR_WITH_RIGHT_BTN :
129 SETTING_TRACE_DEBUG("with right btn");
130 navi_item = setting_create_navi_bar_top_buttons(setting_password_main_get_title_str(ad),
131 _("IDS_COM_SK_DONE"), NULL, NULL,
132 setting_password_main_click_softkey_done_cb, NULL,
133 NULL, ad, content, navibar);
135 case SETTING_PW_NAVIBAR_WITH_BOTH_BTN:
136 SETTING_TRACE_DEBUG("with both btn");
137 navi_item = setting_create_navi_bar_top_buttons(setting_password_main_get_title_str(ad),
138 _("IDS_COM_SK_DONE"), _("IDS_COM_SK_CANCEL"), NULL,
139 setting_password_main_click_softkey_done_cb,
140 setting_password_main_click_softkey_cancel_cb,
141 NULL, ad, content, navibar);
143 case SETTING_PW_NAVIBAR_WITH_NO_BTN:
144 SETTING_TRACE_DEBUG("with no btn");
145 navi_item = setting_create_navi_bar_top_buttons(setting_password_main_get_title_str(ad),
149 NULL, ad, content, navibar);
153 retv_if(!navi_item, NULL);
155 done_btn = elm_object_item_part_content_get(navi_item, NAVI_BTN_STYLE_LEFT);
158 setting_disable_evas_object(done_btn);
159 setting_dim_evas_object(done_btn, TRUE);
164 static int __create_common_password_frame(void *data)
167 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
169 SettingPasswordUG *ad = (SettingPasswordUG *)data;
170 Evas_Object *navi_bar = NULL;
171 static int count = 0;
175 if(ad->scroller != NULL)
177 evas_object_del(ad->scroller);
180 Evas_Object *pw_list = elm_genlist_add(ad->win_main_layout);
181 elm_object_style_set(pw_list, "dialogue");
183 return SETTING_RETURN_FAIL;
185 elm_genlist_clear(pw_list); /* first to clear list */
186 elm_genlist_mode_set(pw_list, ELM_LIST_COMPRESS);
189 #if SUPPORT_BOTTOM_BTNS
190 ad->ly_main = setting_create_win_layout(ad->win_main_layout, ad->win_get);
191 retv_if(!ad->ly_main, SETTING_RETURN_FAIL);
193 navi_bar = setting_create_navi_bar(ad->ly_main);
194 retv_if(!navi_bar, SETTING_RETURN_FAIL);
196 ad->navi_it = __create_navibar(ad, pw_list, navi_bar, SETTING_PW_NAVIBAR_WITH_BOTH_BTN);
198 retv_if(!ad->navi_it, SETTING_RETURN_FAIL);
201 setting_create_layout_navi_bar(ad->win_main_layout, ad->win_get,
202 setting_password_main_get_title_str
203 (ad), _("IDS_COM_SK_CANCEL"),
204 _("IDS_COM_SK_DONE"), NULL,
205 setting_password_main_click_softkey_cancel_cb,
206 setting_password_main_click_softkey_done_cb,
207 NULL, ad, pw_list /* contents */ ,
208 &navi_bar, &(ad->controllbar));
209 elm_object_item_disabled_set(elm_toolbar_last_item_get(ad->controllbar), EINA_TRUE);
211 if(ad->ly_main == NULL)
212 return SETTING_RETURN_FAIL;
215 evas_object_event_callback_add(pw_list, EVAS_CALLBACK_MOUSE_UP,
216 __password_main_gl_mouse_up, ad);
218 Elm_Object_Item *item = elm_genlist_item_append(pw_list,
219 &(ad->itc_seperator), NULL, NULL,
220 ELM_GENLIST_ITEM_NONE, NULL, NULL);
221 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
223 ad->scroller = pw_list;
225 return SETTING_RETURN_SUCCESS;
229 setting_password_main_create(void *cb)
233 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
235 SettingPasswordUG *ad = (SettingPasswordUG *) cb;
238 ret = __create_common_password_frame(ad);
241 return SETTING_RETURN_FAIL;
243 setting_password_main_create_ui(ad);
245 setting_view_password_main.is_create = 1;
248 return SETTING_RETURN_SUCCESS;
251 static int setting_password_main_destroy(void *cb)
255 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
257 SettingPasswordUG *ad = (SettingPasswordUG *) cb;
259 if (ad->focus_timer) {
260 ecore_timer_del(ad->focus_timer);
261 ad->focus_timer = NULL;
263 if (ad->remove_timer) {
264 ecore_timer_del(ad->remove_timer);
265 ad->remove_timer = NULL;
268 if (ad->ly_main != NULL) {
269 evas_object_del(ad->ly_main);
271 setting_view_password_main.is_create = 0;
274 return SETTING_RETURN_SUCCESS;
277 static int setting_password_main_update(void *cb)
281 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
283 SettingPasswordUG *ad = (SettingPasswordUG *) cb;
285 if (ad->ly_main != NULL) {
286 evas_object_show(ad->ly_main);
289 return SETTING_RETURN_SUCCESS;
292 static int setting_password_main_cleanup(void *cb)
295 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
297 SettingPasswordUG *ad = (SettingPasswordUG *) cb;
299 if (ad->ly_main != NULL) {
300 evas_object_hide(ad->ly_main);
303 return SETTING_RETURN_SUCCESS;
306 /* ***************************************************
310 ***************************************************/
312 static int setting_password_main_create_ui(void *data)
315 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
316 "[Setting > Password] Data parameter is NULL");
318 SettingPasswordUG *ad = (SettingPasswordUG *) data;
320 SETTING_TRACE_DEBUG("ad->view_type=%d ***", ad->view_type);
322 switch (ad->view_type) {
323 case SETTING_PW_TYPE_SIM_LOCK_OFF:
324 case SETTING_PW_TYPE_PIN_LOCK_ON:
325 case SETTING_PW_TYPE_PIN_LOCK_OFF:
326 setting_password_main_draw_1line_password(ad, NULL);
328 case SETTING_PW_TYPE_SIM_LOCK_ON:
329 setting_password_main_draw_2line_password(ad, NULL);
332 case SETTING_PW_TYPE_CHANGE_PIN1:
333 case SETTING_PW_TYPE_CHANGE_PIN2:
334 case SETTING_PW_TYPE_PIN1_BLOCKED:
335 case SETTING_PW_TYPE_PIN2_BLOCKED:
336 setting_password_main_draw_3line_password(ad, NULL);
340 SETTING_TRACE_DEBUG("%s*** Unknown Password Type. ***%s",
341 SETTING_FONT_BGREEN, SETTING_FONT_BLACK);
345 /** @todo this function always return 0, not verifying the function flow with the value */
350 setting_password_main_entry_changed_cb(void *data, Evas_Object *obj,
353 retm_if(data == NULL, "[Setting > Password] Data parameter is NULL");
354 Setting_GenGroupItem_Data *list_item =
355 (Setting_GenGroupItem_Data *) data;
356 SettingPasswordUG *ad = (SettingPasswordUG *) list_item->userdata;
357 const char *entry_str = elm_entry_entry_get(obj);
358 list_item->sub_desc = (char *)g_strdup(entry_str);
359 bool isFoundEmptyEntry = FALSE;
361 Evas_Object *layout = elm_object_parent_widget_get(obj);
362 elm_object_part_text_set(layout, "elm.guidetext", "");
366 entry_str = ad->ed_pw1->sub_desc;
367 if (NULL == entry_str || '\0' == entry_str[0]) {
368 isFoundEmptyEntry = TRUE;
369 layout = elm_object_parent_widget_get(ad->ed_pw1->eo_check);
370 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
375 entry_str = ad->ed_pw2->sub_desc;
376 if (NULL == entry_str || '\0' == entry_str[0]) {
377 isFoundEmptyEntry = TRUE;
378 layout = elm_object_parent_widget_get(ad->ed_pw2->eo_check);
379 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
384 entry_str = ad->ed_pw3->sub_desc;
385 if (NULL == entry_str || '\0' == entry_str[0]) {
386 isFoundEmptyEntry = TRUE;
387 layout = elm_object_parent_widget_get(ad->ed_pw3->eo_check);
388 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
395 bool disableFlag = isFoundEmptyEntry;
397 #if SUPPORT_BOTTOM_BTNS
398 Evas_Object *done_btn = elm_object_item_part_content_get(ad->navi_it, NAVI_BTN_STYLE_LEFT);
400 if (!evas_object_pass_events_get(done_btn)) { /* it had not yet been disabled */
401 setting_disable_evas_object(done_btn);
402 setting_dim_evas_object(done_btn, TRUE);
403 }/* else already disabled */
405 setting_enable_evas_object(done_btn);
406 setting_undo_dim_evas_object(done_btn, TRUE);
409 elm_object_item_disabled_set(elm_toolbar_last_item_get
410 (ad->controllbar), disableFlag);
415 static Eina_Bool __focus_on_idler(void *data)
418 retv_if(data == NULL, FALSE);
420 SettingPasswordUG *ad = (SettingPasswordUG *) data;
424 if (ad->ed_pw1->isFocusFlag || (ad->ed_pw1->eo_check != NULL))
426 /* no matter how many edifileds, it only need focus on 1st editfiled */
427 elm_object_focus_set(ad->ed_pw1->eo_check, EINA_TRUE);
431 return ECORE_CALLBACK_CANCEL;
434 static int setting_password_main_draw_1line_password(void *data, void *cb)
437 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
438 "[Setting > Password] Data parameter is NULL");
440 SettingPasswordUG *ad = (SettingPasswordUG *) data;
442 switch (ad->view_type) {
443 case SETTING_PW_TYPE_PIN_LOCK_ON:
444 case SETTING_PW_TYPE_PIN_LOCK_OFF:
446 setting_create_Gendial_field_entry(ad->scroller,
448 (ad->itc_variable_height),
450 SWALLOW_Type_LAYOUT_ENTRY,
452 "IDS_ST_BODY_PIN1", NULL,
453 setting_password_main_entry_changed_cb,
454 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
456 SETTING_PW_UG_PIN_MAX_LENGTH,
457 0, "0123456789", NULL);
464 ad->focus_timer = ecore_timer_add(0.4, __focus_on_idler, ad);
469 static int setting_password_main_clear_1line_password(void *data)
472 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
473 "[Setting > Password] Data parameter is NULL");
475 SettingPasswordUG *ad = (SettingPasswordUG *) data;
476 retv_if(NULL == ad->ed_pw1, -1);
478 ad->ed_pw1->sub_desc = NULL;
479 ad->ed_pw1->isFocusFlag = FALSE;
481 elm_entry_entry_set(ad->ed_pw1->eo_check, "");
482 Evas_Object *layout = elm_object_parent_widget_get(ad->ed_pw1->eo_check);
483 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
487 static int setting_password_main_draw_2line_password(void *data, void *cb)
490 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
492 SettingPasswordUG *ad = (SettingPasswordUG *) data;
494 switch (ad->view_type) {
495 case SETTING_PW_TYPE_SIM_LOCK_ON:
497 setting_create_Gendial_field_entry(ad->scroller,
499 (ad->itc_variable_height),
501 SWALLOW_Type_LAYOUT_ENTRY,
505 setting_password_main_entry_changed_cb,
506 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
508 SETTING_PW_UG_SIM_MAX_LENGTH,
509 0, "0123456789", NULL);
512 setting_create_Gendial_field_entry(ad->scroller,
514 (ad->itc_variable_height),
516 SWALLOW_Type_LAYOUT_ENTRY,
518 PW_SHORT_GUIDE_CONFIRM,
520 setting_password_main_entry_changed_cb,
521 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
523 SETTING_PW_UG_SIM_MAX_LENGTH,
524 0, "0123456789", NULL);
531 ad->focus_timer = ecore_timer_add(1, __focus_on_idler, ad);
535 static int setting_password_main_clear_2line_password(void *data)
538 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
539 "[Setting > Password] Data parameter is NULL");
541 SettingPasswordUG *ad = (SettingPasswordUG *) data;
542 Evas_Object *layout = NULL;
544 retv_if(NULL == ad->ed_pw1, -1);
545 ad->ed_pw1->sub_desc = NULL;
546 ad->ed_pw1->isFocusFlag = FALSE;
547 elm_entry_entry_set(ad->ed_pw1->eo_check, "");
548 layout = elm_object_parent_widget_get(ad->ed_pw1->eo_check);
549 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
551 retv_if(NULL == ad->ed_pw2, -1);
552 ad->ed_pw2->sub_desc = NULL;
553 ad->ed_pw2->isFocusFlag = FALSE;
554 elm_entry_entry_set(ad->ed_pw2->eo_check, "");
555 layout = elm_object_parent_widget_get(ad->ed_pw2->eo_check);
556 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
560 static int setting_password_main_draw_3line_password(void *data, void *cb)
563 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
564 "[Setting > Password] Data parameter is NULL");
566 SettingPasswordUG *ad = (SettingPasswordUG *) data;
567 Elm_Input_Panel_Layout ime_style = ELM_INPUT_PANEL_LAYOUT_NORMAL;
569 switch (ad->view_type) {
570 case SETTING_PW_TYPE_CHANGE_PIN1:
572 setting_create_Gendial_field_entry(ad->scroller,
574 (ad->itc_variable_height),
576 SWALLOW_Type_LAYOUT_ENTRY,
578 PW_SHORT_GUIDE_CURRENT,
580 setting_password_main_entry_changed_cb,
581 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
583 SETTING_PW_UG_PIN_MAX_LENGTH,
584 0, "0123456789", NULL);
587 setting_create_Gendial_field_entry(ad->scroller,
589 (ad->itc_variable_height),
591 SWALLOW_Type_LAYOUT_ENTRY,
595 setting_password_main_entry_changed_cb,
596 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
598 SETTING_PW_UG_PIN_MAX_LENGTH,
599 0, "0123456789", NULL);
602 setting_create_Gendial_field_entry(ad->scroller,
604 (ad->itc_variable_height),
606 SWALLOW_Type_LAYOUT_ENTRY,
608 PW_SHORT_GUIDE_CONFIRM,
610 setting_password_main_entry_changed_cb,
611 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
613 SETTING_PW_UG_PIN_MAX_LENGTH,
614 0, "0123456789", NULL);
617 case SETTING_PW_TYPE_CHANGE_PIN2:
619 setting_create_Gendial_field_entry(ad->scroller,
621 (ad->itc_variable_height),
623 SWALLOW_Type_LAYOUT_ENTRY,
625 PW_SHORT_GUIDE_CURRENT,
627 setting_password_main_entry_changed_cb,
628 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
630 SETTING_PW_UG_PIN_MAX_LENGTH,
631 0, "0123456789", NULL);
634 setting_create_Gendial_field_entry(ad->scroller,
636 (ad->itc_variable_height),
638 SWALLOW_Type_LAYOUT_ENTRY,
642 setting_password_main_entry_changed_cb,
643 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
645 SETTING_PW_UG_PIN_MAX_LENGTH,
646 0, "0123456789", NULL);
649 setting_create_Gendial_field_entry(ad->scroller,
651 (ad->itc_variable_height),
653 SWALLOW_Type_LAYOUT_ENTRY,
655 PW_SHORT_GUIDE_CONFIRM,
657 setting_password_main_entry_changed_cb,
658 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
660 SETTING_PW_UG_PIN_MAX_LENGTH,
661 0, "0123456789", NULL);
664 case SETTING_PW_TYPE_PIN1_BLOCKED:
666 setting_create_Gendial_field_entry(ad->scroller,
668 (ad->itc_variable_height),
670 SWALLOW_Type_LAYOUT_ENTRY,
672 "IDS_ST_BODY_PUK1_CODE",
674 setting_password_main_entry_changed_cb,
675 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
677 SETTING_PW_UG_PIN_MAX_LENGTH,
678 0, "0123456789", NULL);
681 setting_create_Gendial_field_entry(ad->scroller,
683 (ad->itc_variable_height),
685 SWALLOW_Type_LAYOUT_ENTRY,
687 "IDS_ST_BODY_NEW_PIN1",
689 setting_password_main_entry_changed_cb,
690 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
692 SETTING_PW_UG_PIN_MAX_LENGTH,
693 0, "0123456789", NULL);
696 setting_create_Gendial_field_entry(ad->scroller,
698 (ad->itc_variable_height),
700 SWALLOW_Type_LAYOUT_ENTRY,
702 "IDS_ST_BODY_CONFIRM_NEW_PIN1",
704 setting_password_main_entry_changed_cb,
705 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
707 SETTING_PW_UG_PIN_MAX_LENGTH,
708 0, "0123456789", NULL);
711 case SETTING_PW_TYPE_PIN2_BLOCKED:
713 setting_create_Gendial_field_entry(ad->scroller,
715 (ad->itc_variable_height),
717 SWALLOW_Type_LAYOUT_ENTRY,
719 "IDS_ST_BODY_PUK2", NULL,
720 setting_password_main_entry_changed_cb,
721 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
723 SETTING_PW_UG_PIN_MAX_LENGTH,
724 0, "0123456789", NULL);
727 setting_create_Gendial_field_entry(ad->scroller,
729 (ad->itc_variable_height),
731 SWALLOW_Type_LAYOUT_ENTRY,
733 "IDS_ST_BODY_NEW_PIN2",
735 setting_password_main_entry_changed_cb,
736 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
738 SETTING_PW_UG_PIN_MAX_LENGTH,
739 0, "0123456789", NULL);
742 setting_create_Gendial_field_entry(ad->scroller,
744 (ad->itc_variable_height),
746 SWALLOW_Type_LAYOUT_ENTRY,
748 "IDS_ST_BODY_CONFIRM_NEW_PIN2",
750 setting_password_main_entry_changed_cb,
751 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
753 SETTING_PW_UG_PIN_MAX_LENGTH,
754 0, "0123456789", NULL);
761 ad->focus_timer = ecore_timer_add(1, __focus_on_idler, ad);
765 static int setting_password_main_clear_3line_password(void *data)
768 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
769 "[Setting > Password] Data parameter is NULL");
771 SettingPasswordUG *ad = (SettingPasswordUG *) data;
772 Evas_Object *layout = NULL;
774 retv_if(NULL == ad->ed_pw1, -1);
775 ad->ed_pw1->sub_desc = NULL;
776 ad->ed_pw1->isFocusFlag = FALSE;
777 elm_entry_entry_set(ad->ed_pw1->eo_check, "");
778 layout = elm_object_parent_widget_get(ad->ed_pw1->eo_check);
779 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
781 retv_if(NULL == ad->ed_pw2, -1);
782 ad->ed_pw2->sub_desc = NULL;
783 ad->ed_pw2->isFocusFlag = FALSE;
784 elm_entry_entry_set(ad->ed_pw2->eo_check, "");
785 layout = elm_object_parent_widget_get(ad->ed_pw2->eo_check);
786 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
788 retv_if(NULL == ad->ed_pw3, -1);
789 ad->ed_pw3->sub_desc = NULL;
790 ad->ed_pw3->isFocusFlag = FALSE;
791 elm_entry_entry_set(ad->ed_pw3->eo_check, "");
792 layout = elm_object_parent_widget_get(ad->ed_pw3->eo_check);
793 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
797 static int setting_password_main_check_1line_password(void *data)
800 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
802 SettingPasswordUG *ad = (SettingPasswordUG *) data;
804 const char *entry_str = ad->ed_pw1->sub_desc;
805 ad->focus_data = ad->ed_pw1;
808 if (isEmptyStr(entry_str)) {
809 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
811 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
815 int entry_str_len = safeStrLen(entry_str);
816 switch (ad->view_type) {
817 case SETTING_PW_TYPE_PIN_LOCK_ON:
818 case SETTING_PW_TYPE_PIN_LOCK_OFF:
820 if (entry_str_len < SETTING_PW_UG_PIN_MIN_LENGTH
821 || entry_str_len > SETTING_PW_UG_PIN_MAX_LENGTH) {
822 setting_password_main_warning_entry_added_byte_popup
823 (ad, SETTING_PW_UG_PIN_MIN_LENGTH, SETTING_PW_UG_PIN_MAX_LENGTH);
824 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
828 case SETTING_PW_TYPE_SIM_LOCK_OFF:
830 if (entry_str_len < SETTING_PW_UG_SIM_MIN_LENGTH
831 || entry_str_len > SETTING_PW_UG_SIM_MAX_LENGTH) {
832 setting_password_main_warning_entry_added_byte_popup
833 (ad, SETTING_PW_UG_SIM_MIN_LENGTH, SETTING_PW_UG_SIM_MAX_LENGTH);
834 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
840 return SETTING_RETURN_SUCCESS;
843 static int setting_password_main_check_2line_password(void *data)
846 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
848 SettingPasswordUG *ad = (SettingPasswordUG *) data;
850 const char *entry_str1 = ad->ed_pw1->sub_desc;
851 const char *entry_str2 = ad->ed_pw2->sub_desc;
852 ad->focus_data = ad->ed_pw1;
855 if (isEmptyStr(entry_str1)) {
856 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
858 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
861 if (isEmptyStr(entry_str2)) {
862 ad->focus_data = ad->ed_pw2;
863 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
865 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
869 int entry_str_len = safeStrLen(entry_str1);
870 switch (ad->view_type) {
871 case SETTING_PW_TYPE_SIM_LOCK_ON:
873 if (entry_str_len < SETTING_PW_UG_SIM_MIN_LENGTH
874 || entry_str_len > SETTING_PW_UG_SIM_MAX_LENGTH) {
875 setting_password_main_warning_entry_added_byte_popup
876 (ad, SETTING_PW_UG_SIM_MIN_LENGTH, SETTING_PW_UG_SIM_MAX_LENGTH);
877 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
886 if (0 != safeStrCmp(entry_str1, entry_str2)) {
887 setting_password_ug_display_desc(ad, _("IDS_ST_POP_PASSWORDS_DO_NOT_MATCH"), FALSE);
889 return SETTING_ENTRY_NOT_MATCH_NEW_CONF_PW;
892 return SETTING_RETURN_SUCCESS;
896 setting_password_main_warning_entry_added_byte_popup(SettingPasswordUG *ad,
899 char str[MAX_SPECIALIZITION_LEN + 1] = { 0 };
901 snprintf(str, MAX_SPECIALIZITION_LEN, "%d~%d %s", min, max, _("characters required"));
903 setting_password_ug_display_desc(ad, str, FALSE);
907 static int setting_password_main_check_3line_password(void *data)
910 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
912 SettingPasswordUG *ad = (SettingPasswordUG *) data;
914 const char *entry_str1 = ad->ed_pw1->sub_desc;
915 const char *entry_str2 = ad->ed_pw2->sub_desc;
916 const char *entry_str3 = ad->ed_pw3->sub_desc;
917 ad->focus_data = ad->ed_pw1;
920 if (isEmptyStr(entry_str1)) {
921 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
923 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
926 if (isEmptyStr(entry_str2)) {
927 ad->focus_data = ad->ed_pw2;
928 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
930 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
933 if (isEmptyStr(entry_str3)) {
934 ad->focus_data = ad->ed_pw3;
935 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
937 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
941 int entry_str1_len = safeStrLen(entry_str1);
942 int entry_str2_len = safeStrLen(entry_str2);
943 int entry_str3_len = safeStrLen(entry_str3);
944 switch (ad->view_type) {
945 case SETTING_PW_TYPE_PIN1_BLOCKED:
946 case SETTING_PW_TYPE_PIN2_BLOCKED:
947 case SETTING_PW_TYPE_CHANGE_PIN1:
948 case SETTING_PW_TYPE_CHANGE_PIN2:
950 if (entry_str1_len < SETTING_PW_UG_PIN_MIN_LENGTH
951 || entry_str1_len > SETTING_PW_UG_PIN_MAX_LENGTH) {
952 setting_password_main_warning_entry_added_byte_popup
953 (ad, SETTING_PW_UG_PIN_MIN_LENGTH, SETTING_PW_UG_PIN_MAX_LENGTH);
954 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
956 if (entry_str2_len < SETTING_PW_UG_PIN_MIN_LENGTH
957 || entry_str2_len > SETTING_PW_UG_PIN_MAX_LENGTH) {
958 ad->focus_data = ad->ed_pw2;
959 setting_password_main_warning_entry_added_byte_popup
960 (ad, SETTING_PW_UG_PIN_MIN_LENGTH, SETTING_PW_UG_PIN_MAX_LENGTH);
961 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
963 if (entry_str3_len < SETTING_PW_UG_PIN_MIN_LENGTH
964 || entry_str3_len > SETTING_PW_UG_PIN_MAX_LENGTH) {
965 ad->focus_data = ad->ed_pw3;
966 setting_password_main_warning_entry_added_byte_popup
967 (ad, SETTING_PW_UG_PIN_MIN_LENGTH, SETTING_PW_UG_PIN_MAX_LENGTH);
968 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
977 if (0 != safeStrCmp(entry_str2, entry_str3)) {
978 ad->focus_data = ad->ed_pw2;
979 setting_password_ug_display_desc(ad, _("IDS_ST_POP_PASSWORDS_DO_NOT_MATCH"), FALSE);
981 return SETTING_ENTRY_NOT_MATCH_NEW_CONF_PW;
984 return SETTING_RETURN_SUCCESS;
988 setting_password_main_click_softkey_cancel_cb(void *data, Evas_Object *obj,
992 retm_if(data == NULL, "[Setting > Password] Data parameter is NULL");
994 SettingPasswordUG *ad = (SettingPasswordUG *) data;
996 /* send result : Cancel */
998 if(service_create(&svc))
1001 service_add_extra_data(svc, "result", "Cancel");
1002 ug_send_result(ad->ug, svc);
1003 SETTING_TRACE("Send Result : %s\n", "Cancel");
1005 service_destroy(svc);
1007 /* Send destroy request */
1008 ug_destroy_me(ad->ug);
1013 setting_password_main_click_softkey_done_cb(void *data, Evas_Object *obj,
1017 retm_if(data == NULL, "[Setting > Password] Data parameter is NULL");
1021 char svalue[SHA256_DIGEST_LENGTH] = { 0, };
1023 memset(svalue, 0x0, SHA256_DIGEST_LENGTH);
1025 SettingPasswordUG *ad = (SettingPasswordUG *) data;
1027 if (service_create(&svc))
1030 SETTING_TRACE("ad->view_type:%d", ad->view_type);
1032 switch (ad->view_type) {
1033 case SETTING_PW_TYPE_PIN_LOCK_ON:
1035 SETTING_TRACE("case SETTING_PW_TYPE_PIN_LOCK_ON");
1037 ret = setting_password_main_check_1line_password(ad);
1038 if (ret == SETTING_RETURN_SUCCESS) {
1039 TelSimFacilityPw_t sim_sec_data = { 0, };
1040 int tapi_ret = TAPI_API_SUCCESS;
1041 const char *entry_str;
1043 entry_str = ad->ed_pw1->sub_desc;
1044 if (isEmptyStr(entry_str)) {
1045 ad->focus_data = ad->ed_pw1;
1046 SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!");
1047 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1051 sim_sec_data.lock_type = TAPI_SIM_LOCK_SC;//TAPI_SIM_PTYPE_PIN1;
1052 sim_sec_data.pw = (unsigned char *)entry_str;
1053 sim_sec_data.pw_len = safeStrLen(entry_str);
1055 tapi_ret = tel_enable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_enable_cb, ad);
1056 setting_password_main_clear_1line_password(ad);
1058 if (TAPI_API_SUCCESS != tapi_ret) {
1059 ad->focus_data = ad->ed_pw1;
1060 SETTING_TRACE_DEBUG("%s*** [ERR] tel_enable_sim_facility err=%d ***%s",
1061 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1062 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1064 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1065 SETTING_TRACE_DEBUG("*** [SUCCESS] tel_enable_sim_facility err=%d ***", tapi_ret);
1068 setting_password_main_clear_1line_password(ad);
1072 case SETTING_PW_TYPE_PIN_LOCK_OFF:
1074 SETTING_TRACE("case SETTING_PW_TYPE_PIN_LOCK_OFF");
1076 ret = setting_password_main_check_1line_password(ad);
1078 if (ret == SETTING_RETURN_SUCCESS) {
1079 TelSimFacilityPw_t sim_sec_data = { 0, };
1080 int tapi_ret = TAPI_API_SUCCESS;
1081 const char *entry_str;
1083 entry_str = ad->ed_pw1->sub_desc;
1084 if (isEmptyStr(entry_str)) {
1085 ad->focus_data = ad->ed_pw1;
1086 SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!");
1087 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1091 sim_sec_data.lock_type = TAPI_SIM_LOCK_SC;//TAPI_SIM_PTYPE_PIN1
1092 sim_sec_data.pw = (unsigned char *)entry_str;
1093 sim_sec_data.pw_len = safeStrLen(entry_str);
1095 tapi_ret = tel_disable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_disable_cb, ad);
1096 setting_password_main_clear_1line_password(ad);
1098 if (TAPI_API_SUCCESS != tapi_ret) {
1099 ad->focus_data = ad->ed_pw1;
1100 SETTING_TRACE_DEBUG("%s*** [ERR] tel_disable_sim_facility err=%d ***%s",
1101 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1102 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1104 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1107 setting_password_main_clear_1line_password(ad);
1111 case SETTING_PW_TYPE_PIN1_BLOCKED:
1113 /* PIN1 Status is "Blocked": User should input puk code and new pin1 code. */
1114 /* If puk code is correct and success to modify pin1 code, display pin1 code change popup */
1115 /* But, if this menu is "Pin Lock", pinlock status will not be changed. */
1116 SETTING_TRACE("case SETTING_PW_TYPE_PIN1_BLOCKED");
1117 ret = setting_password_main_check_3line_password(ad);
1119 if (ret == SETTING_RETURN_SUCCESS) {
1120 TelSimSecPw_t puk1_data = { 0, };
1121 TelSimSecPw_t pin1_data = { 0, };
1122 int tapi_ret = TAPI_API_SUCCESS;
1124 const char *new_pin1;
1126 puk = ad->ed_pw1->sub_desc;
1127 new_pin1 = ad->ed_pw2->sub_desc;
1128 if (isEmptyStr(puk)) {
1129 ad->focus_data = ad->ed_pw1;
1130 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1134 if (isEmptyStr(new_pin1)) {
1135 ad->focus_data = ad->ed_pw2;
1136 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1140 puk1_data.type = TAPI_SIM_PTYPE_PUK1;
1141 puk1_data.pw = (unsigned char *)puk;
1142 puk1_data.pw_len = safeStrLen(puk);
1144 pin1_data.type = TAPI_SIM_PTYPE_PIN1;
1145 pin1_data.pw = (unsigned char *)new_pin1;
1146 pin1_data.pw_len = safeStrLen(new_pin1);
1148 tapi_ret = tel_verify_sim_puks(ad->handle, &puk1_data, &pin1_data, setting_sim_verify_puks_cb, ad);
1149 setting_password_main_clear_3line_password(ad);
1151 if (TAPI_API_SUCCESS != tapi_ret) {
1152 ad->focus_data = ad->ed_pw1;
1153 SETTING_TRACE_DEBUG("%s*** [ERR] tel_verify_sim_puks err=%d ***%s",
1154 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1155 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1157 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1161 setting_password_main_clear_3line_password(ad);
1165 case SETTING_PW_TYPE_PIN2_BLOCKED:
1167 SETTING_TRACE("case SETTING_PW_TYPE_PIN2_BLOCKED");
1168 ret = setting_password_main_check_3line_password(ad);
1170 if (ret == SETTING_RETURN_SUCCESS) {
1171 TelSimSecPw_t puk2_data = { 0, };
1172 TelSimSecPw_t pin2_data = { 0, };
1173 int tapi_ret = TAPI_API_SUCCESS;
1175 const char *new_pin2;
1177 puk = ad->ed_pw1->sub_desc;
1178 new_pin2 = ad->ed_pw2->sub_desc;
1179 if (isEmptyStr(puk)) {
1180 ad->focus_data = ad->ed_pw1;
1181 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1185 if (isEmptyStr(new_pin2)) {
1186 ad->focus_data = ad->ed_pw2;
1187 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1191 puk2_data.type = TAPI_SIM_PTYPE_PUK2;
1192 puk2_data.pw = (unsigned char *)puk;
1193 puk2_data.pw_len = safeStrLen(puk);
1195 pin2_data.type = TAPI_SIM_PTYPE_PIN2;
1196 pin2_data.pw = (unsigned char *)new_pin2;
1197 pin2_data.pw_len = safeStrLen(new_pin2);
1199 tapi_ret = tel_verify_sim_puks(ad->handle, &puk2_data, &pin2_data, setting_sim_verify_puks_cb, ad);
1200 setting_password_main_clear_3line_password(ad);
1202 if (TAPI_API_SUCCESS != tapi_ret) {
1203 ad->focus_data = ad->ed_pw1;
1204 SETTING_TRACE_DEBUG("%s*** [ERR] tel_verify_sim_puks err=%d ***%s",
1205 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1206 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1208 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1212 setting_password_main_clear_3line_password(ad);
1216 case SETTING_PW_TYPE_CHANGE_PIN1:
1218 SETTING_TRACE("case SETTING_PW_TYPE_CHANGE_PIN1");
1220 ret = setting_password_main_check_3line_password(ad);
1221 if (ret == SETTING_RETURN_SUCCESS) {
1224 TelSimSecPw_t sim_old_sec_data = { 0, };
1225 TelSimSecPw_t sim_new_sec_data = { 0, };
1226 int tapi_ret = TAPI_API_SUCCESS;
1228 old_pw = ad->ed_pw1->sub_desc;
1229 new_pw = ad->ed_pw2->sub_desc;
1230 if (isEmptyStr(old_pw)) {
1231 ad->focus_data = ad->ed_pw1;
1232 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1236 if (isEmptyStr(new_pw)) {
1237 ad->focus_data = ad->ed_pw2;
1238 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1242 sim_old_sec_data.type = TAPI_SIM_PTYPE_PIN1;
1243 sim_new_sec_data.type = TAPI_SIM_PTYPE_PIN1;
1244 sim_old_sec_data.pw = (unsigned char *)old_pw;
1245 sim_old_sec_data.pw_len = safeStrLen(old_pw);
1246 sim_new_sec_data.pw = (unsigned char *)new_pw;
1247 sim_new_sec_data.pw_len = safeStrLen(new_pw);
1249 tapi_ret = tel_change_sim_pins(ad->handle, &sim_old_sec_data, &sim_new_sec_data, setting_sim_change_pins_cb, ad);
1250 setting_password_main_clear_3line_password(ad);
1252 if (TAPI_API_SUCCESS != tapi_ret) {
1253 ad->focus_data = ad->ed_pw1;
1254 SETTING_TRACE_DEBUG("%s*** [ERR] TelTapiSimChangePIN err=%d ***%s",
1255 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1256 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1258 /* Success popup and send message to caller */
1259 /* setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_PIN1_CHANGED")); */
1262 setting_password_main_clear_3line_password(ad);
1266 case SETTING_PW_TYPE_CHANGE_PIN2:
1268 SETTING_TRACE("case SETTING_PW_TYPE_CHANGE_PIN2");
1269 ret = setting_password_main_check_3line_password(ad);
1270 if (ret == SETTING_RETURN_SUCCESS) {
1273 TelSimSecPw_t sim_old_sec_data = { 0, };
1274 TelSimSecPw_t sim_new_sec_data = { 0, };
1275 int tapi_ret = TAPI_API_SUCCESS;
1277 old_pw = ad->ed_pw1->sub_desc;
1278 new_pw = ad->ed_pw2->sub_desc;
1279 if (isEmptyStr(old_pw)) {
1280 ad->focus_data = ad->ed_pw1;
1281 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1285 if (isEmptyStr(new_pw)) {
1286 ad->focus_data = ad->ed_pw2;
1287 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1291 sim_old_sec_data.type = TAPI_SIM_PTYPE_PIN2;
1292 sim_new_sec_data.type = TAPI_SIM_PTYPE_PIN2;
1293 sim_old_sec_data.pw = (unsigned char *)old_pw;
1294 sim_old_sec_data.pw_len = safeStrLen(old_pw);
1295 sim_new_sec_data.pw = (unsigned char *)new_pw;
1296 sim_new_sec_data.pw_len = safeStrLen(new_pw);
1298 tapi_ret = tel_change_sim_pins(ad->handle, &sim_old_sec_data, &sim_new_sec_data, setting_sim_change_pins_cb, ad);
1299 setting_password_main_clear_3line_password(ad);
1301 if (TAPI_API_SUCCESS != tapi_ret) {
1302 ad->focus_data = ad->ed_pw1;
1303 SETTING_TRACE_DEBUG("%s*** [ERR] TelTapiSimChangePIN err=%d ***%s",
1304 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1305 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1307 /* Success popup and send message to caller */
1308 /* setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_PIN2_CHANGED")); */
1311 setting_password_main_clear_3line_password(ad);
1315 case SETTING_PW_TYPE_SIM_LOCK_ON:
1317 SETTING_TRACE("case SETTING_PW_TYPE_SIM_LOCK_ON");
1319 ret = setting_password_main_check_2line_password(ad);
1321 if (ret == SETTING_RETURN_SUCCESS) {
1322 TelSimFacilityPw_t sim_sec_data = { 0, };
1323 int tapi_ret = TAPI_API_SUCCESS;
1324 const char *entry_str;
1325 entry_str = ad->ed_pw1->sub_desc;
1326 if (isEmptyStr(entry_str)) {
1327 ad->focus_data = ad->ed_pw1;
1328 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1332 sim_sec_data.lock_type = TAPI_SIM_LOCK_PS;//TAPI_SIM_PTYPE_SIM
1333 sim_sec_data.pw = (unsigned char *)entry_str;
1334 sim_sec_data.pw_len = safeStrLen(entry_str);
1336 tapi_ret = tel_enable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_enable_cb, ad);
1337 setting_password_main_clear_2line_password(ad);
1339 SETTING_TRACE("SIM Lock password : %s\n", (char *)(sim_sec_data.pw));
1340 if (TAPI_API_SUCCESS != tapi_ret) {
1341 ad->focus_data = ad->ed_pw1;
1342 SETTING_TRACE_DEBUG("%s*** [ERR] tel_enable_sim_facility err=%d ***%s",
1343 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1344 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1346 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1350 setting_password_main_clear_2line_password(ad);
1354 case SETTING_PW_TYPE_SIM_LOCK_OFF:
1356 SETTING_TRACE("case SETTING_PW_TYPE_SIM_LOCK_OFF");
1358 ret = setting_password_main_check_1line_password(ad);
1359 if (ret == SETTING_RETURN_SUCCESS) {
1360 TelSimFacilityPw_t sim_sec_data = { 0, };
1361 int tapi_ret = TAPI_API_SUCCESS;
1362 const char *entry_str;
1364 entry_str = ad->ed_pw1->sub_desc;
1365 if (isEmptyStr(entry_str)) {
1366 ad->focus_data = ad->ed_pw1;
1367 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1371 sim_sec_data.lock_type = TAPI_SIM_LOCK_PS;//TAPI_SIM_PTYPE_SIM
1372 sim_sec_data.pw = (unsigned char *)entry_str;
1373 sim_sec_data.pw_len = safeStrLen(entry_str);
1375 tapi_ret = tel_disable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_disable_cb, ad);
1376 setting_password_main_clear_1line_password(ad);
1378 if (TAPI_API_SUCCESS != tapi_ret) {
1379 ad->focus_data = ad->ed_pw1;
1380 SETTING_TRACE_DEBUG("%s*** [ERR] tel_disable_sim_facility err=%d ***%s",
1381 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1382 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1384 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1388 setting_password_main_clear_1line_password(ad);
1393 case SETTING_PW_TYPE_FDN_MODE_ON:
1395 SETTING_TRACE("case SETTING_PW_TYPE_FDN_MODE_ON");
1396 ret = setting_password_main_check_1line_password(ad);
1398 if(ret == SETTING_RETURN_SUCCESS)
1400 const char *entry_str;
1401 int tapi_ret = TAPI_API_INVALID_INPUT;
1403 TelSimFacilityPw_t sim_sec_data = {0,};
1406 entry_str = ad->ed_pw1->sub_desc;
1407 if(isEmptyStr(entry_str))
1409 ad->focus_data = ad->ed_pw1;
1410 SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!");
1411 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1414 sim_sec_data.lock_type = TAPI_SIM_LOCK_FD;//TAPI_SIM_PTYPE_PIN2;
1415 sim_sec_data.pw_len = safeStrLen(entry_str);
1416 sim_sec_data.pw = (unsigned char*)entry_str;
1418 tapi_ret = tel_enable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_enable_cb, ad);
1419 setting_password_main_clear_1line_password(ad);
1421 if(tapi_ret != TAPI_API_SUCCESS)
1423 ad->focus_data = ad->ed_pw1;
1424 SETTING_TRACE_ERROR("[ERR] Failed to enable FDN. Tapi return %d", tapi_ret);
1425 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1430 if (service_create(&svc))
1433 service_add_extra_data(svc, "result", ad->view_type_string);
1434 ug_send_result(ad->ug, svc);
1435 SETTING_TRACE("Send Result : %s\n", ad->view_type_string);
1436 service_destroy(svc);
1437 //ug_destroy_me(ad->ug);
1442 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), TRUE);
1446 case SETTING_PW_TYPE_FDN_MODE_OFF:
1448 SETTING_TRACE("case SETTING_PW_TYPE_FDN_MODE_OFF");
1449 ret = setting_password_main_check_1line_password(ad);
1451 if(ret == SETTING_RETURN_SUCCESS)
1453 const char *entry_str;
1454 int tapi_ret = TAPI_API_INVALID_INPUT;
1456 TelSimFacilityPw_t sim_sec_data = {0,};
1458 entry_str = ad->ed_pw1->sub_desc;
1459 if(isEmptyStr(entry_str))
1461 ad->focus_data = ad->ed_pw1;
1462 SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!");
1463 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1466 sim_sec_data.lock_type = TAPI_SIM_LOCK_FD;//TAPI_SIM_PTYPE_PIN2
1467 sim_sec_data.pw_len = safeStrLen(entry_str);
1468 sim_sec_data.pw = (unsigned char*)entry_str;
1470 tapi_ret = tel_disable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_disable_cb, ad);
1471 setting_password_main_clear_1line_password(ad);
1473 if(tapi_ret != TAPI_API_SUCCESS)
1475 ad->focus_data = ad->ed_pw1;
1476 SETTING_TRACE_ERROR("[ERR] Failed to disable FDN. Tapi return %d", tapi_ret);
1477 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1482 if (service_create(&svc))
1485 service_add_extra_data(svc, "result", ad->view_type_string);
1486 ug_send_result(ad->ug, svc);
1487 SETTING_TRACE("Send Result : %s\n", ad->view_type_string);
1489 service_destroy(svc);
1490 //ug_destroy_me(ad->ug);
1495 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), TRUE);
1504 service_add_extra_data(svc, "result", ad->view_type_string);
1505 ug_send_result(ad->ug, svc);
1506 SETTING_TRACE("Send Result : %s\n", ad->view_type_string);
1508 service_destroy(svc);
1509 /* Send destroy request */
1510 ug_destroy_me(ad->ug);