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_pw2->eo_check);
64 setting_hide_input_pannel_cb(ad->ed_pw3->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;
1028 SETTING_TRACE("ad->view_type:%d", ad->view_type);
1030 switch (ad->view_type) {
1031 case SETTING_PW_TYPE_PIN_LOCK_ON:
1033 SETTING_TRACE("case SETTING_PW_TYPE_PIN_LOCK_ON");
1035 ret = setting_password_main_check_1line_password(ad);
1036 if (ret == SETTING_RETURN_SUCCESS) {
1037 TelSimFacilityPw_t sim_sec_data = { 0, };
1038 int tapi_ret = TAPI_API_SUCCESS;
1039 const char *entry_str;
1041 entry_str = ad->ed_pw1->sub_desc;
1042 if (isEmptyStr(entry_str)) {
1043 ad->focus_data = ad->ed_pw1;
1044 SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!");
1045 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1049 sim_sec_data.lock_type = TAPI_SIM_LOCK_SC;//TAPI_SIM_PTYPE_PIN1;
1050 sim_sec_data.pw = (unsigned char *)entry_str;
1051 sim_sec_data.pw_len = safeStrLen(entry_str);
1053 tapi_ret = tel_enable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_enable_cb, ad);
1054 setting_password_main_clear_1line_password(ad);
1056 if (TAPI_API_SUCCESS != tapi_ret) {
1057 ad->focus_data = ad->ed_pw1;
1058 SETTING_TRACE_DEBUG("%s*** [ERR] tel_enable_sim_facility err=%d ***%s",
1059 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1060 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1062 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1063 SETTING_TRACE_DEBUG("*** [SUCCESS] tel_enable_sim_facility err=%d ***", tapi_ret);
1066 setting_password_main_clear_1line_password(ad);
1070 case SETTING_PW_TYPE_PIN_LOCK_OFF:
1072 SETTING_TRACE("case SETTING_PW_TYPE_PIN_LOCK_OFF");
1074 ret = setting_password_main_check_1line_password(ad);
1076 if (ret == SETTING_RETURN_SUCCESS) {
1077 TelSimFacilityPw_t sim_sec_data = { 0, };
1078 int tapi_ret = TAPI_API_SUCCESS;
1079 const char *entry_str;
1081 entry_str = ad->ed_pw1->sub_desc;
1082 if (isEmptyStr(entry_str)) {
1083 ad->focus_data = ad->ed_pw1;
1084 SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!");
1085 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1089 sim_sec_data.lock_type = TAPI_SIM_LOCK_SC;//TAPI_SIM_PTYPE_PIN1
1090 sim_sec_data.pw = (unsigned char *)entry_str;
1091 sim_sec_data.pw_len = safeStrLen(entry_str);
1093 tapi_ret = tel_disable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_disable_cb, ad);
1094 setting_password_main_clear_1line_password(ad);
1096 if (TAPI_API_SUCCESS != tapi_ret) {
1097 ad->focus_data = ad->ed_pw1;
1098 SETTING_TRACE_DEBUG("%s*** [ERR] tel_disable_sim_facility err=%d ***%s",
1099 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1100 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1102 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1105 setting_password_main_clear_1line_password(ad);
1109 case SETTING_PW_TYPE_PIN1_BLOCKED:
1111 /* PIN1 Status is "Blocked": User should input puk code and new pin1 code. */
1112 /* If puk code is correct and success to modify pin1 code, display pin1 code change popup */
1113 /* But, if this menu is "Pin Lock", pinlock status will not be changed. */
1114 SETTING_TRACE("case SETTING_PW_TYPE_PIN1_BLOCKED");
1115 ret = setting_password_main_check_3line_password(ad);
1117 if (ret == SETTING_RETURN_SUCCESS) {
1118 TelSimSecPw_t puk1_data = { 0, };
1119 TelSimSecPw_t pin1_data = { 0, };
1120 int tapi_ret = TAPI_API_SUCCESS;
1122 const char *new_pin1;
1124 puk = ad->ed_pw1->sub_desc;
1125 new_pin1 = ad->ed_pw2->sub_desc;
1126 if (isEmptyStr(puk)) {
1127 ad->focus_data = ad->ed_pw1;
1128 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1132 if (isEmptyStr(new_pin1)) {
1133 ad->focus_data = ad->ed_pw2;
1134 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1138 puk1_data.type = TAPI_SIM_PTYPE_PUK1;
1139 puk1_data.pw = (unsigned char *)puk;
1140 puk1_data.pw_len = safeStrLen(puk);
1142 pin1_data.type = TAPI_SIM_PTYPE_PIN1;
1143 pin1_data.pw = (unsigned char *)new_pin1;
1144 pin1_data.pw_len = safeStrLen(new_pin1);
1146 tapi_ret = tel_verify_sim_puks(ad->handle, &puk1_data, &pin1_data, setting_sim_verify_puks_cb, ad);
1147 setting_password_main_clear_3line_password(ad);
1149 if (TAPI_API_SUCCESS != tapi_ret) {
1150 ad->focus_data = ad->ed_pw1;
1151 SETTING_TRACE_DEBUG("%s*** [ERR] tel_verify_sim_puks err=%d ***%s",
1152 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1153 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1155 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1159 setting_password_main_clear_3line_password(ad);
1163 case SETTING_PW_TYPE_PIN2_BLOCKED:
1165 SETTING_TRACE("case SETTING_PW_TYPE_PIN2_BLOCKED");
1166 ret = setting_password_main_check_3line_password(ad);
1168 if (ret == SETTING_RETURN_SUCCESS) {
1169 TelSimSecPw_t puk2_data = { 0, };
1170 TelSimSecPw_t pin2_data = { 0, };
1171 int tapi_ret = TAPI_API_SUCCESS;
1173 const char *new_pin2;
1175 puk = ad->ed_pw1->sub_desc;
1176 new_pin2 = ad->ed_pw2->sub_desc;
1177 if (isEmptyStr(puk)) {
1178 ad->focus_data = ad->ed_pw1;
1179 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1183 if (isEmptyStr(new_pin2)) {
1184 ad->focus_data = ad->ed_pw2;
1185 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1189 puk2_data.type = TAPI_SIM_PTYPE_PUK2;
1190 puk2_data.pw = (unsigned char *)puk;
1191 puk2_data.pw_len = safeStrLen(puk);
1193 pin2_data.type = TAPI_SIM_PTYPE_PIN2;
1194 pin2_data.pw = (unsigned char *)new_pin2;
1195 pin2_data.pw_len = safeStrLen(new_pin2);
1197 tapi_ret = tel_verify_sim_puks(ad->handle, &puk2_data, &pin2_data, setting_sim_verify_puks_cb, ad);
1198 setting_password_main_clear_3line_password(ad);
1200 if (TAPI_API_SUCCESS != tapi_ret) {
1201 ad->focus_data = ad->ed_pw1;
1202 SETTING_TRACE_DEBUG("%s*** [ERR] tel_verify_sim_puks err=%d ***%s",
1203 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1204 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1206 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1210 setting_password_main_clear_3line_password(ad);
1214 case SETTING_PW_TYPE_CHANGE_PIN1:
1216 SETTING_TRACE("case SETTING_PW_TYPE_CHANGE_PIN1");
1218 ret = setting_password_main_check_3line_password(ad);
1219 if (ret == SETTING_RETURN_SUCCESS) {
1222 TelSimSecPw_t sim_old_sec_data = { 0, };
1223 TelSimSecPw_t sim_new_sec_data = { 0, };
1224 int tapi_ret = TAPI_API_SUCCESS;
1226 old_pw = ad->ed_pw1->sub_desc;
1227 new_pw = ad->ed_pw2->sub_desc;
1228 if (isEmptyStr(old_pw)) {
1229 ad->focus_data = ad->ed_pw1;
1230 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1234 if (isEmptyStr(new_pw)) {
1235 ad->focus_data = ad->ed_pw2;
1236 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1240 sim_old_sec_data.type = TAPI_SIM_PTYPE_PIN1;
1241 sim_new_sec_data.type = TAPI_SIM_PTYPE_PIN1;
1242 sim_old_sec_data.pw = (unsigned char *)old_pw;
1243 sim_old_sec_data.pw_len = safeStrLen(old_pw);
1244 sim_new_sec_data.pw = (unsigned char *)new_pw;
1245 sim_new_sec_data.pw_len = safeStrLen(new_pw);
1247 tapi_ret = tel_change_sim_pins(ad->handle, &sim_old_sec_data, &sim_new_sec_data, setting_sim_change_pins_cb, ad);
1248 setting_password_main_clear_3line_password(ad);
1250 if (TAPI_API_SUCCESS != tapi_ret) {
1251 ad->focus_data = ad->ed_pw1;
1252 SETTING_TRACE_DEBUG("%s*** [ERR] TelTapiSimChangePIN err=%d ***%s",
1253 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1254 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1256 /* Success popup and send message to caller */
1257 /* setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_PIN1_CHANGED")); */
1260 setting_password_main_clear_3line_password(ad);
1264 case SETTING_PW_TYPE_CHANGE_PIN2:
1266 SETTING_TRACE("case SETTING_PW_TYPE_CHANGE_PIN2");
1267 ret = setting_password_main_check_3line_password(ad);
1268 if (ret == SETTING_RETURN_SUCCESS) {
1271 TelSimSecPw_t sim_old_sec_data = { 0, };
1272 TelSimSecPw_t sim_new_sec_data = { 0, };
1273 int tapi_ret = TAPI_API_SUCCESS;
1275 old_pw = ad->ed_pw1->sub_desc;
1276 new_pw = ad->ed_pw2->sub_desc;
1277 if (isEmptyStr(old_pw)) {
1278 ad->focus_data = ad->ed_pw1;
1279 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1283 if (isEmptyStr(new_pw)) {
1284 ad->focus_data = ad->ed_pw2;
1285 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1289 sim_old_sec_data.type = TAPI_SIM_PTYPE_PIN2;
1290 sim_new_sec_data.type = TAPI_SIM_PTYPE_PIN2;
1291 sim_old_sec_data.pw = (unsigned char *)old_pw;
1292 sim_old_sec_data.pw_len = safeStrLen(old_pw);
1293 sim_new_sec_data.pw = (unsigned char *)new_pw;
1294 sim_new_sec_data.pw_len = safeStrLen(new_pw);
1296 tapi_ret = tel_change_sim_pins(ad->handle, &sim_old_sec_data, &sim_new_sec_data, setting_sim_change_pins_cb, ad);
1297 setting_password_main_clear_3line_password(ad);
1299 if (TAPI_API_SUCCESS != tapi_ret) {
1300 ad->focus_data = ad->ed_pw1;
1301 SETTING_TRACE_DEBUG("%s*** [ERR] TelTapiSimChangePIN err=%d ***%s",
1302 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1303 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1305 /* Success popup and send message to caller */
1306 /* setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_PIN2_CHANGED")); */
1309 setting_password_main_clear_3line_password(ad);
1313 case SETTING_PW_TYPE_SIM_LOCK_ON:
1315 SETTING_TRACE("case SETTING_PW_TYPE_SIM_LOCK_ON");
1317 ret = setting_password_main_check_2line_password(ad);
1319 if (ret == SETTING_RETURN_SUCCESS) {
1320 TelSimFacilityPw_t sim_sec_data = { 0, };
1321 int tapi_ret = TAPI_API_SUCCESS;
1322 const char *entry_str;
1323 entry_str = ad->ed_pw1->sub_desc;
1324 if (isEmptyStr(entry_str)) {
1325 ad->focus_data = ad->ed_pw1;
1326 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1330 sim_sec_data.lock_type = TAPI_SIM_LOCK_PS;//TAPI_SIM_PTYPE_SIM
1331 sim_sec_data.pw = (unsigned char *)entry_str;
1332 sim_sec_data.pw_len = safeStrLen(entry_str);
1334 tapi_ret = tel_enable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_enable_cb, ad);
1335 setting_password_main_clear_2line_password(ad);
1337 SETTING_TRACE("SIM Lock password : %s\n", (char *)(sim_sec_data.pw));
1338 if (TAPI_API_SUCCESS != tapi_ret) {
1339 ad->focus_data = ad->ed_pw1;
1340 SETTING_TRACE_DEBUG("%s*** [ERR] tel_enable_sim_facility err=%d ***%s",
1341 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1342 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1344 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1348 setting_password_main_clear_2line_password(ad);
1352 case SETTING_PW_TYPE_SIM_LOCK_OFF:
1354 SETTING_TRACE("case SETTING_PW_TYPE_SIM_LOCK_OFF");
1356 ret = setting_password_main_check_1line_password(ad);
1357 if (ret == SETTING_RETURN_SUCCESS) {
1358 TelSimFacilityPw_t sim_sec_data = { 0, };
1359 int tapi_ret = TAPI_API_SUCCESS;
1360 const char *entry_str;
1362 entry_str = ad->ed_pw1->sub_desc;
1363 if (isEmptyStr(entry_str)) {
1364 ad->focus_data = ad->ed_pw1;
1365 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1369 sim_sec_data.lock_type = TAPI_SIM_LOCK_PS;//TAPI_SIM_PTYPE_SIM
1370 sim_sec_data.pw = (unsigned char *)entry_str;
1371 sim_sec_data.pw_len = safeStrLen(entry_str);
1373 tapi_ret = tel_disable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_disable_cb, ad);
1374 setting_password_main_clear_1line_password(ad);
1376 if (TAPI_API_SUCCESS != tapi_ret) {
1377 ad->focus_data = ad->ed_pw1;
1378 SETTING_TRACE_DEBUG("%s*** [ERR] tel_disable_sim_facility err=%d ***%s",
1379 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1380 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1382 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1386 setting_password_main_clear_1line_password(ad);
1391 case SETTING_PW_TYPE_FDN_MODE_ON:
1393 SETTING_TRACE("case SETTING_PW_TYPE_FDN_MODE_ON");
1394 ret = setting_password_main_check_1line_password(ad);
1396 if(ret == SETTING_RETURN_SUCCESS)
1398 const char *entry_str;
1399 int tapi_ret = TAPI_API_INVALID_INPUT;
1401 TelSimFacilityPw_t sim_sec_data = {0,};
1404 entry_str = ad->ed_pw1->sub_desc;
1405 if(isEmptyStr(entry_str))
1407 ad->focus_data = ad->ed_pw1;
1408 SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!");
1409 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1412 sim_sec_data.lock_type = TAPI_SIM_LOCK_FD;//TAPI_SIM_PTYPE_PIN2;
1413 sim_sec_data.pw_len = safeStrLen(entry_str);
1414 sim_sec_data.pw = (unsigned char*)entry_str;
1416 tapi_ret = tel_enable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_enable_cb, ad);
1417 setting_password_main_clear_1line_password(ad);
1419 if(tapi_ret != TAPI_API_SUCCESS)
1421 ad->focus_data = ad->ed_pw1;
1422 SETTING_TRACE_ERROR("[ERR] Failed to enable FDN. Tapi return %d", tapi_ret);
1423 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1428 if (service_create(&svc))
1431 service_add_extra_data(svc, "result", ad->view_type_string);
1432 ug_send_result(ad->ug, svc);
1433 SETTING_TRACE("Send Result : %s\n", ad->view_type_string);
1434 service_destroy(svc);
1435 //ug_destroy_me(ad->ug);
1440 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), TRUE);
1444 case SETTING_PW_TYPE_FDN_MODE_OFF:
1446 SETTING_TRACE("case SETTING_PW_TYPE_FDN_MODE_OFF");
1447 ret = setting_password_main_check_1line_password(ad);
1449 if(ret == SETTING_RETURN_SUCCESS)
1451 const char *entry_str;
1452 int tapi_ret = TAPI_API_INVALID_INPUT;
1454 TelSimFacilityPw_t sim_sec_data = {0,};
1456 entry_str = ad->ed_pw1->sub_desc;
1457 if(isEmptyStr(entry_str))
1459 ad->focus_data = ad->ed_pw1;
1460 SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!");
1461 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1464 sim_sec_data.lock_type = TAPI_SIM_LOCK_FD;//TAPI_SIM_PTYPE_PIN2
1465 sim_sec_data.pw_len = safeStrLen(entry_str);
1466 sim_sec_data.pw = (unsigned char*)entry_str;
1468 tapi_ret = tel_disable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_disable_cb, ad);
1469 setting_password_main_clear_1line_password(ad);
1471 if(tapi_ret != TAPI_API_SUCCESS)
1473 ad->focus_data = ad->ed_pw1;
1474 SETTING_TRACE_ERROR("[ERR] Failed to disable FDN. Tapi return %d", tapi_ret);
1475 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1480 if (service_create(&svc))
1483 service_add_extra_data(svc, "result", ad->view_type_string);
1484 ug_send_result(ad->ug, svc);
1485 SETTING_TRACE("Send Result : %s\n", ad->view_type_string);
1487 service_destroy(svc);
1488 //ug_destroy_me(ad->ug);
1493 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), TRUE);