3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Flora License, Version 1.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://floralicense.org/license/
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an AS IS BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include <setting-password.h>
18 #include <setting-password-main.h>
19 #include <setting-common-data-slp-setting.h>
20 #include <openssl/sha.h>
21 #include <setting-debug.h>
25 static int setting_password_main_create(void *cb);
26 static int setting_password_main_destroy(void *cb);
27 static int setting_password_main_update(void *cb);
28 static int setting_password_main_cleanup(void *cb);
30 setting_view setting_view_password_main = {
31 .create = setting_password_main_create,
32 .destroy = setting_password_main_destroy,
33 .update = setting_password_main_update,
34 .cleanup = setting_password_main_cleanup,
37 #define ENTRY_CALLBACK_REPEAT_MAX 3
38 #define SETTING_COMPARE_PW_FAIL -2
40 /* ***************************************************
44 ***************************************************/
46 __password_main_gl_mouse_up(void *data, Evas *e, Evas_Object *obj,
50 SettingPasswordUG *ad = (SettingPasswordUG *) data;
53 setting_hide_input_pannel_cb(ad->ed_pw1->eo_check);
56 setting_hide_input_pannel_cb(ad->ed_pw2->eo_check);
59 setting_hide_input_pannel_cb(ad->ed_pw3->eo_check);
64 static char *setting_password_main_get_title_str(void *data)
66 retvm_if(data == NULL, NULL,
67 "[Setting > Password] Data parameter is NULL");
68 SettingPasswordUG *ad = (SettingPasswordUG *) data;
70 switch (ad->view_type) {
71 case SETTING_PW_TYPE_SIM_LOCK_ON:
72 case SETTING_PW_TYPE_SIM_LOCK_OFF:
73 return _("IDS_COM_BODY_AUTH_PASSWORD");
75 case SETTING_PW_TYPE_PIN_LOCK_ON:
76 case SETTING_PW_TYPE_PIN_LOCK_OFF:
77 return _("IDS_ST_BODY_PIN1");
79 case SETTING_PW_TYPE_CHANGE_PIN1:
80 return _("IDS_ST_BODY_CHANGE_PIN1");
83 case SETTING_PW_TYPE_CHANGE_PIN2:
84 return _("IDS_ST_BODY_CHANGE_PIN2");
87 case SETTING_PW_TYPE_PIN1_BLOCKED:
88 return _("IDS_ST_BODY_PUK1_CODE");
90 case SETTING_PW_TYPE_PIN2_BLOCKED:
92 return _("IDS_ST_BODY_PUK2");
95 SETTING_TRACE_DEBUG("%s*** Unknown Password Type. ***%s",
96 SETTING_FONT_BGREEN, SETTING_FONT_BLACK);
103 Elm_Object_Item* __create_navibar(void *data, Evas_Object *content, Evas_Object *navibar, setting_pw_navibar_style_t style)
106 retv_if(data == NULL || content == NULL || navibar == NULL, NULL);
108 SettingPasswordUG *ad = (SettingPasswordUG *)data;
110 Elm_Object_Item *navi_item = NULL;
111 Evas_Object *done_btn = NULL;
115 case SETTING_PW_NAVIBAR_WITH_LEFT_BTN :
116 SETTING_TRACE_DEBUG("with left btn");
117 navi_item = setting_create_navi_bar_top_buttons(setting_password_main_get_title_str(ad),
118 NULL, _("IDS_COM_SK_CANCEL"), NULL,
120 setting_password_main_click_softkey_cancel_cb,
121 NULL, ad, content, navibar);
123 case SETTING_PW_NAVIBAR_WITH_RIGHT_BTN :
124 SETTING_TRACE_DEBUG("with right btn");
125 navi_item = setting_create_navi_bar_top_buttons(setting_password_main_get_title_str(ad),
126 _("IDS_COM_SK_DONE"), NULL, NULL,
127 setting_password_main_click_softkey_done_cb, NULL,
128 NULL, ad, content, navibar);
130 case SETTING_PW_NAVIBAR_WITH_BOTH_BTN:
131 SETTING_TRACE_DEBUG("with both btn");
132 navi_item = setting_create_navi_bar_top_buttons(setting_password_main_get_title_str(ad),
133 _("IDS_COM_SK_DONE"), _("IDS_COM_SK_CANCEL"), NULL,
134 setting_password_main_click_softkey_done_cb,
135 setting_password_main_click_softkey_cancel_cb,
136 NULL, ad, content, navibar);
138 case SETTING_PW_NAVIBAR_WITH_NO_BTN:
139 SETTING_TRACE_DEBUG("with no btn");
140 navi_item = setting_create_navi_bar_top_buttons(setting_password_main_get_title_str(ad),
144 NULL, ad, content, navibar);
148 retv_if(!navi_item, NULL);
150 done_btn = elm_object_item_part_content_get(navi_item, NAVI_BTN_STYLE_LEFT);
153 setting_disable_evas_object(done_btn);
154 setting_dim_evas_object(done_btn, TRUE);
159 static int __create_common_password_frame(void *data)
162 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
164 SettingPasswordUG *ad = (SettingPasswordUG *)data;
165 Evas_Object *navi_bar = NULL;
166 static int count = 0;
170 if(ad->scroller != NULL)
172 evas_object_del(ad->scroller);
175 Evas_Object *pw_list = elm_genlist_add(ad->win_main_layout);
176 elm_object_style_set(pw_list, "dialogue");
178 return SETTING_RETURN_FAIL;
180 elm_genlist_clear(pw_list); /* first to clear list */
181 elm_genlist_mode_set(pw_list, ELM_LIST_COMPRESS);
184 #if SUPPORT_BOTTOM_BTNS
185 ad->ly_main = setting_create_win_layout(ad->win_main_layout, ad->win_get);
186 retv_if(!ad->ly_main, SETTING_RETURN_FAIL);
188 navi_bar = setting_create_navi_bar(ad->ly_main);
189 retv_if(!navi_bar, SETTING_RETURN_FAIL);
191 ad->navi_it = __create_navibar(ad, pw_list, navi_bar, SETTING_PW_NAVIBAR_WITH_BOTH_BTN);
193 retv_if(!ad->navi_it, SETTING_RETURN_FAIL);
196 setting_create_layout_navi_bar(ad->win_main_layout, ad->win_get,
197 setting_password_main_get_title_str
198 (ad), _("IDS_COM_SK_CANCEL"),
199 _("IDS_COM_SK_DONE"), NULL,
200 setting_password_main_click_softkey_cancel_cb,
201 setting_password_main_click_softkey_done_cb,
202 NULL, ad, pw_list /* contents */ ,
203 &navi_bar, &(ad->controllbar));
204 elm_object_item_disabled_set(elm_toolbar_last_item_get(ad->controllbar), EINA_TRUE);
206 if(ad->ly_main == NULL)
207 return SETTING_RETURN_FAIL;
210 evas_object_event_callback_add(pw_list, EVAS_CALLBACK_MOUSE_UP,
211 __password_main_gl_mouse_up, ad);
213 Elm_Object_Item *item = elm_genlist_item_append(pw_list,
214 &(ad->itc_seperator), NULL, NULL,
215 ELM_GENLIST_ITEM_NONE, NULL, NULL);
216 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
218 ad->scroller = pw_list;
220 return SETTING_RETURN_SUCCESS;
224 setting_password_main_create(void *cb)
228 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
230 SettingPasswordUG *ad = (SettingPasswordUG *) cb;
233 ret = __create_common_password_frame(ad);
236 return SETTING_RETURN_FAIL;
238 setting_password_main_create_ui(ad);
240 setting_view_password_main.is_create = 1;
243 return SETTING_RETURN_SUCCESS;
246 static int setting_password_main_destroy(void *cb)
250 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
252 SettingPasswordUG *ad = (SettingPasswordUG *) cb;
254 if (ad->focus_timer) {
255 ecore_timer_del(ad->focus_timer);
256 ad->focus_timer = NULL;
258 if (ad->remove_timer) {
259 ecore_timer_del(ad->remove_timer);
260 ad->remove_timer = NULL;
263 if (ad->ly_main != NULL) {
264 evas_object_del(ad->ly_main);
266 setting_view_password_main.is_create = 0;
269 return SETTING_RETURN_SUCCESS;
272 static int setting_password_main_update(void *cb)
276 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
278 SettingPasswordUG *ad = (SettingPasswordUG *) cb;
280 if (ad->ly_main != NULL) {
281 evas_object_show(ad->ly_main);
284 return SETTING_RETURN_SUCCESS;
287 static int setting_password_main_cleanup(void *cb)
290 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
292 SettingPasswordUG *ad = (SettingPasswordUG *) cb;
294 if (ad->ly_main != NULL) {
295 evas_object_hide(ad->ly_main);
298 return SETTING_RETURN_SUCCESS;
301 /* ***************************************************
305 ***************************************************/
307 static int setting_password_main_create_ui(void *data)
310 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
311 "[Setting > Password] Data parameter is NULL");
313 SettingPasswordUG *ad = (SettingPasswordUG *) data;
315 SETTING_TRACE_DEBUG("ad->view_type=%d ***", ad->view_type);
317 switch (ad->view_type) {
318 case SETTING_PW_TYPE_SIM_LOCK_OFF:
319 case SETTING_PW_TYPE_PIN_LOCK_ON:
320 case SETTING_PW_TYPE_PIN_LOCK_OFF:
321 setting_password_main_draw_1line_password(ad, NULL);
323 case SETTING_PW_TYPE_SIM_LOCK_ON:
324 setting_password_main_draw_2line_password(ad, NULL);
327 case SETTING_PW_TYPE_CHANGE_PIN1:
328 case SETTING_PW_TYPE_CHANGE_PIN2:
329 case SETTING_PW_TYPE_PIN1_BLOCKED:
330 case SETTING_PW_TYPE_PIN2_BLOCKED:
331 setting_password_main_draw_3line_password(ad, NULL);
335 SETTING_TRACE_DEBUG("%s*** Unknown Password Type. ***%s",
336 SETTING_FONT_BGREEN, SETTING_FONT_BLACK);
340 /** @todo this function always return 0, not verifying the function flow with the value */
345 setting_password_main_entry_changed_cb(void *data, Evas_Object *obj,
348 retm_if(data == NULL, "[Setting > Password] Data parameter is NULL");
349 Setting_GenGroupItem_Data *list_item =
350 (Setting_GenGroupItem_Data *) data;
351 SettingPasswordUG *ad = (SettingPasswordUG *) list_item->userdata;
352 const char *entry_str = elm_entry_entry_get(obj);
353 list_item->sub_desc = (char *)g_strdup(entry_str);
354 bool isFoundEmptyEntry = FALSE;
356 Evas_Object *layout = elm_object_parent_widget_get(obj);
357 elm_object_part_text_set(layout, "elm.guidetext", "");
361 entry_str = ad->ed_pw1->sub_desc;
362 if (NULL == entry_str || '\0' == entry_str[0]) {
363 isFoundEmptyEntry = TRUE;
364 layout = elm_object_parent_widget_get(ad->ed_pw1->eo_check);
365 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
370 entry_str = ad->ed_pw2->sub_desc;
371 if (NULL == entry_str || '\0' == entry_str[0]) {
372 isFoundEmptyEntry = TRUE;
373 layout = elm_object_parent_widget_get(ad->ed_pw2->eo_check);
374 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
379 entry_str = ad->ed_pw3->sub_desc;
380 if (NULL == entry_str || '\0' == entry_str[0]) {
381 isFoundEmptyEntry = TRUE;
382 layout = elm_object_parent_widget_get(ad->ed_pw3->eo_check);
383 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
390 bool disableFlag = isFoundEmptyEntry;
392 #if SUPPORT_BOTTOM_BTNS
393 Evas_Object *done_btn = elm_object_item_part_content_get(ad->navi_it, NAVI_BTN_STYLE_LEFT);
395 if (!evas_object_pass_events_get(done_btn)) { /* it had not yet been disabled */
396 setting_disable_evas_object(done_btn);
397 setting_dim_evas_object(done_btn, TRUE);
398 }/* else already disabled */
400 setting_enable_evas_object(done_btn);
401 setting_undo_dim_evas_object(done_btn, TRUE);
404 elm_object_item_disabled_set(elm_toolbar_last_item_get
405 (ad->controllbar), disableFlag);
410 static Eina_Bool __focus_on_idler(void *data)
413 retv_if(data == NULL, FALSE);
415 SettingPasswordUG *ad = (SettingPasswordUG *) data;
419 if (ad->ed_pw1->isFocusFlag || (ad->ed_pw1->eo_check != NULL))
421 /* no matter how many edifileds, it only need focus on 1st editfiled */
422 elm_object_focus_set(ad->ed_pw1->eo_check, EINA_TRUE);
426 return ECORE_CALLBACK_CANCEL;
429 static int setting_password_main_draw_1line_password(void *data, void *cb)
432 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
433 "[Setting > Password] Data parameter is NULL");
435 SettingPasswordUG *ad = (SettingPasswordUG *) data;
437 switch (ad->view_type) {
438 case SETTING_PW_TYPE_PIN_LOCK_ON:
439 case SETTING_PW_TYPE_PIN_LOCK_OFF:
441 setting_create_Gendial_field_entry(ad->scroller,
443 (ad->itc_variable_height),
445 SWALLOW_Type_LAYOUT_ENTRY,
447 "IDS_ST_BODY_PIN1", NULL,
448 setting_password_main_entry_changed_cb,
449 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
451 SETTING_PW_UG_PIN_MAX_LENGTH,
452 0, "0123456789", NULL);
459 ad->focus_timer = ecore_timer_add(0.4, __focus_on_idler, ad);
464 static int setting_password_main_clear_1line_password(void *data)
467 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
468 "[Setting > Password] Data parameter is NULL");
470 SettingPasswordUG *ad = (SettingPasswordUG *) data;
471 retv_if(NULL == ad->ed_pw1, -1);
473 ad->ed_pw1->sub_desc = NULL;
474 ad->ed_pw1->isFocusFlag = FALSE;
476 elm_entry_entry_set(ad->ed_pw1->eo_check, "");
477 Evas_Object *layout = elm_object_parent_widget_get(ad->ed_pw1->eo_check);
478 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
482 static int setting_password_main_draw_2line_password(void *data, void *cb)
485 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
487 SettingPasswordUG *ad = (SettingPasswordUG *) data;
489 switch (ad->view_type) {
490 case SETTING_PW_TYPE_SIM_LOCK_ON:
492 setting_create_Gendial_field_entry(ad->scroller,
494 (ad->itc_variable_height),
496 SWALLOW_Type_LAYOUT_ENTRY,
500 setting_password_main_entry_changed_cb,
501 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
503 SETTING_PW_UG_SIM_MAX_LENGTH,
504 0, "0123456789", NULL);
507 setting_create_Gendial_field_entry(ad->scroller,
509 (ad->itc_variable_height),
511 SWALLOW_Type_LAYOUT_ENTRY,
513 PW_SHORT_GUIDE_CONFIRM,
515 setting_password_main_entry_changed_cb,
516 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
518 SETTING_PW_UG_SIM_MAX_LENGTH,
519 0, "0123456789", NULL);
526 ad->focus_timer = ecore_timer_add(1, __focus_on_idler, ad);
530 static int setting_password_main_clear_2line_password(void *data)
533 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
534 "[Setting > Password] Data parameter is NULL");
536 SettingPasswordUG *ad = (SettingPasswordUG *) data;
537 Evas_Object *layout = NULL;
539 retv_if(NULL == ad->ed_pw1, -1);
540 ad->ed_pw1->sub_desc = NULL;
541 ad->ed_pw1->isFocusFlag = FALSE;
542 elm_entry_entry_set(ad->ed_pw1->eo_check, "");
543 layout = elm_object_parent_widget_get(ad->ed_pw1->eo_check);
544 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
546 retv_if(NULL == ad->ed_pw2, -1);
547 ad->ed_pw2->sub_desc = NULL;
548 ad->ed_pw2->isFocusFlag = FALSE;
549 elm_entry_entry_set(ad->ed_pw2->eo_check, "");
550 layout = elm_object_parent_widget_get(ad->ed_pw2->eo_check);
551 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
555 static int setting_password_main_draw_3line_password(void *data, void *cb)
558 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
559 "[Setting > Password] Data parameter is NULL");
561 SettingPasswordUG *ad = (SettingPasswordUG *) data;
562 Elm_Input_Panel_Layout ime_style = ELM_INPUT_PANEL_LAYOUT_NORMAL;
564 switch (ad->view_type) {
565 case SETTING_PW_TYPE_CHANGE_PIN1:
567 setting_create_Gendial_field_entry(ad->scroller,
569 (ad->itc_variable_height),
571 SWALLOW_Type_LAYOUT_ENTRY,
573 PW_SHORT_GUIDE_CURRENT,
575 setting_password_main_entry_changed_cb,
576 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
578 SETTING_PW_UG_PIN_MAX_LENGTH,
579 0, "0123456789", NULL);
582 setting_create_Gendial_field_entry(ad->scroller,
584 (ad->itc_variable_height),
586 SWALLOW_Type_LAYOUT_ENTRY,
590 setting_password_main_entry_changed_cb,
591 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
593 SETTING_PW_UG_PIN_MAX_LENGTH,
594 0, "0123456789", NULL);
597 setting_create_Gendial_field_entry(ad->scroller,
599 (ad->itc_variable_height),
601 SWALLOW_Type_LAYOUT_ENTRY,
603 PW_SHORT_GUIDE_CONFIRM,
605 setting_password_main_entry_changed_cb,
606 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
608 SETTING_PW_UG_PIN_MAX_LENGTH,
609 0, "0123456789", NULL);
612 case SETTING_PW_TYPE_CHANGE_PIN2:
614 setting_create_Gendial_field_entry(ad->scroller,
616 (ad->itc_variable_height),
618 SWALLOW_Type_LAYOUT_ENTRY,
620 PW_SHORT_GUIDE_CURRENT,
622 setting_password_main_entry_changed_cb,
623 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
625 SETTING_PW_UG_PIN_MAX_LENGTH,
626 0, "0123456789", NULL);
629 setting_create_Gendial_field_entry(ad->scroller,
631 (ad->itc_variable_height),
633 SWALLOW_Type_LAYOUT_ENTRY,
637 setting_password_main_entry_changed_cb,
638 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
640 SETTING_PW_UG_PIN_MAX_LENGTH,
641 0, "0123456789", NULL);
644 setting_create_Gendial_field_entry(ad->scroller,
646 (ad->itc_variable_height),
648 SWALLOW_Type_LAYOUT_ENTRY,
650 PW_SHORT_GUIDE_CONFIRM,
652 setting_password_main_entry_changed_cb,
653 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
655 SETTING_PW_UG_PIN_MAX_LENGTH,
656 0, "0123456789", NULL);
659 case SETTING_PW_TYPE_PIN1_BLOCKED:
661 setting_create_Gendial_field_entry(ad->scroller,
663 (ad->itc_variable_height),
665 SWALLOW_Type_LAYOUT_ENTRY,
667 "IDS_ST_BODY_PUK1_CODE",
669 setting_password_main_entry_changed_cb,
670 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
672 SETTING_PW_UG_PIN_MAX_LENGTH,
673 0, "0123456789", NULL);
676 setting_create_Gendial_field_entry(ad->scroller,
678 (ad->itc_variable_height),
680 SWALLOW_Type_LAYOUT_ENTRY,
682 "IDS_ST_BODY_NEW_PIN1",
684 setting_password_main_entry_changed_cb,
685 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
687 SETTING_PW_UG_PIN_MAX_LENGTH,
688 0, "0123456789", NULL);
691 setting_create_Gendial_field_entry(ad->scroller,
693 (ad->itc_variable_height),
695 SWALLOW_Type_LAYOUT_ENTRY,
697 "IDS_ST_BODY_CONFIRM_NEW_PIN1",
699 setting_password_main_entry_changed_cb,
700 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
702 SETTING_PW_UG_PIN_MAX_LENGTH,
703 0, "0123456789", NULL);
706 case SETTING_PW_TYPE_PIN2_BLOCKED:
708 setting_create_Gendial_field_entry(ad->scroller,
710 (ad->itc_variable_height),
712 SWALLOW_Type_LAYOUT_ENTRY,
714 "IDS_ST_BODY_PUK2", NULL,
715 setting_password_main_entry_changed_cb,
716 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
718 SETTING_PW_UG_PIN_MAX_LENGTH,
719 0, "0123456789", NULL);
722 setting_create_Gendial_field_entry(ad->scroller,
724 (ad->itc_variable_height),
726 SWALLOW_Type_LAYOUT_ENTRY,
728 "IDS_ST_BODY_NEW_PIN2",
730 setting_password_main_entry_changed_cb,
731 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
733 SETTING_PW_UG_PIN_MAX_LENGTH,
734 0, "0123456789", NULL);
737 setting_create_Gendial_field_entry(ad->scroller,
739 (ad->itc_variable_height),
741 SWALLOW_Type_LAYOUT_ENTRY,
743 "IDS_ST_BODY_CONFIRM_NEW_PIN2",
745 setting_password_main_entry_changed_cb,
746 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
748 SETTING_PW_UG_PIN_MAX_LENGTH,
749 0, "0123456789", NULL);
756 ad->focus_timer = ecore_timer_add(1, __focus_on_idler, ad);
760 static int setting_password_main_clear_3line_password(void *data)
763 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
764 "[Setting > Password] Data parameter is NULL");
766 SettingPasswordUG *ad = (SettingPasswordUG *) data;
767 Evas_Object *layout = NULL;
769 retv_if(NULL == ad->ed_pw1, -1);
770 ad->ed_pw1->sub_desc = NULL;
771 ad->ed_pw1->isFocusFlag = FALSE;
772 elm_entry_entry_set(ad->ed_pw1->eo_check, "");
773 layout = elm_object_parent_widget_get(ad->ed_pw1->eo_check);
774 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
776 retv_if(NULL == ad->ed_pw2, -1);
777 ad->ed_pw2->sub_desc = NULL;
778 ad->ed_pw2->isFocusFlag = FALSE;
779 elm_entry_entry_set(ad->ed_pw2->eo_check, "");
780 layout = elm_object_parent_widget_get(ad->ed_pw2->eo_check);
781 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
783 retv_if(NULL == ad->ed_pw3, -1);
784 ad->ed_pw3->sub_desc = NULL;
785 ad->ed_pw3->isFocusFlag = FALSE;
786 elm_entry_entry_set(ad->ed_pw3->eo_check, "");
787 layout = elm_object_parent_widget_get(ad->ed_pw3->eo_check);
788 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
792 static int setting_password_main_check_1line_password(void *data)
795 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
797 SettingPasswordUG *ad = (SettingPasswordUG *) data;
799 const char *entry_str = ad->ed_pw1->sub_desc;
800 ad->focus_data = ad->ed_pw1;
803 if (isEmptyStr(entry_str)) {
804 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
806 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
810 int entry_str_len = safeStrLen(entry_str);
811 switch (ad->view_type) {
812 case SETTING_PW_TYPE_PIN_LOCK_ON:
813 case SETTING_PW_TYPE_PIN_LOCK_OFF:
815 if (entry_str_len < SETTING_PW_UG_PIN_MIN_LENGTH
816 || entry_str_len > SETTING_PW_UG_PIN_MAX_LENGTH) {
817 setting_password_main_warning_entry_added_byte_popup
818 (ad, SETTING_PW_UG_PIN_MIN_LENGTH, SETTING_PW_UG_PIN_MAX_LENGTH);
819 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
823 case SETTING_PW_TYPE_SIM_LOCK_OFF:
825 if (entry_str_len < SETTING_PW_UG_SIM_MIN_LENGTH
826 || entry_str_len > SETTING_PW_UG_SIM_MAX_LENGTH) {
827 setting_password_main_warning_entry_added_byte_popup
828 (ad, SETTING_PW_UG_SIM_MIN_LENGTH, SETTING_PW_UG_SIM_MAX_LENGTH);
829 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
835 return SETTING_RETURN_SUCCESS;
838 static int setting_password_main_check_2line_password(void *data)
841 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
843 SettingPasswordUG *ad = (SettingPasswordUG *) data;
845 const char *entry_str1 = ad->ed_pw1->sub_desc;
846 const char *entry_str2 = ad->ed_pw2->sub_desc;
847 ad->focus_data = ad->ed_pw1;
850 if (isEmptyStr(entry_str1)) {
851 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
853 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
856 if (isEmptyStr(entry_str2)) {
857 ad->focus_data = ad->ed_pw2;
858 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
860 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
864 int entry_str_len = safeStrLen(entry_str1);
865 switch (ad->view_type) {
866 case SETTING_PW_TYPE_SIM_LOCK_ON:
868 if (entry_str_len < SETTING_PW_UG_SIM_MIN_LENGTH
869 || entry_str_len > SETTING_PW_UG_SIM_MAX_LENGTH) {
870 setting_password_main_warning_entry_added_byte_popup
871 (ad, SETTING_PW_UG_SIM_MIN_LENGTH, SETTING_PW_UG_SIM_MAX_LENGTH);
872 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
881 if (0 != safeStrCmp(entry_str1, entry_str2)) {
882 setting_password_ug_display_desc(ad, _("IDS_ST_POP_PASSWORDS_DO_NOT_MATCH"), FALSE);
884 return SETTING_ENTRY_NOT_MATCH_NEW_CONF_PW;
887 return SETTING_RETURN_SUCCESS;
891 setting_password_main_warning_entry_added_byte_popup(SettingPasswordUG *ad,
894 char str[MAX_SPECIALIZITION_LEN + 1] = { 0 };
896 snprintf(str, MAX_SPECIALIZITION_LEN, "%d~%d %s", min, max, _("characters required"));
898 setting_password_ug_display_desc(ad, str, FALSE);
902 static int setting_password_main_check_3line_password(void *data)
905 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
907 SettingPasswordUG *ad = (SettingPasswordUG *) data;
909 const char *entry_str1 = ad->ed_pw1->sub_desc;
910 const char *entry_str2 = ad->ed_pw2->sub_desc;
911 const char *entry_str3 = ad->ed_pw3->sub_desc;
912 ad->focus_data = ad->ed_pw1;
915 if (isEmptyStr(entry_str1)) {
916 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
918 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
921 if (isEmptyStr(entry_str2)) {
922 ad->focus_data = ad->ed_pw2;
923 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
925 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
928 if (isEmptyStr(entry_str3)) {
929 ad->focus_data = ad->ed_pw3;
930 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
932 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
936 int entry_str1_len = safeStrLen(entry_str1);
937 int entry_str2_len = safeStrLen(entry_str2);
938 int entry_str3_len = safeStrLen(entry_str3);
939 switch (ad->view_type) {
940 case SETTING_PW_TYPE_PIN1_BLOCKED:
941 case SETTING_PW_TYPE_PIN2_BLOCKED:
942 case SETTING_PW_TYPE_CHANGE_PIN1:
943 case SETTING_PW_TYPE_CHANGE_PIN2:
945 if (entry_str1_len < SETTING_PW_UG_PIN_MIN_LENGTH
946 || entry_str1_len > SETTING_PW_UG_PIN_MAX_LENGTH) {
947 setting_password_main_warning_entry_added_byte_popup
948 (ad, SETTING_PW_UG_PIN_MIN_LENGTH, SETTING_PW_UG_PIN_MAX_LENGTH);
949 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
951 if (entry_str2_len < SETTING_PW_UG_PIN_MIN_LENGTH
952 || entry_str2_len > SETTING_PW_UG_PIN_MAX_LENGTH) {
953 ad->focus_data = ad->ed_pw2;
954 setting_password_main_warning_entry_added_byte_popup
955 (ad, SETTING_PW_UG_PIN_MIN_LENGTH, SETTING_PW_UG_PIN_MAX_LENGTH);
956 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
958 if (entry_str3_len < SETTING_PW_UG_PIN_MIN_LENGTH
959 || entry_str3_len > SETTING_PW_UG_PIN_MAX_LENGTH) {
960 ad->focus_data = ad->ed_pw3;
961 setting_password_main_warning_entry_added_byte_popup
962 (ad, SETTING_PW_UG_PIN_MIN_LENGTH, SETTING_PW_UG_PIN_MAX_LENGTH);
963 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
972 if (0 != safeStrCmp(entry_str2, entry_str3)) {
973 ad->focus_data = ad->ed_pw2;
974 setting_password_ug_display_desc(ad, _("IDS_ST_POP_PASSWORDS_DO_NOT_MATCH"), FALSE);
976 return SETTING_ENTRY_NOT_MATCH_NEW_CONF_PW;
979 return SETTING_RETURN_SUCCESS;
983 setting_password_main_click_softkey_cancel_cb(void *data, Evas_Object *obj,
987 retm_if(data == NULL, "[Setting > Password] Data parameter is NULL");
989 SettingPasswordUG *ad = (SettingPasswordUG *) data;
991 /* send result : Cancel */
993 if(service_create(&svc))
996 service_add_extra_data(svc, "result", "Cancel");
997 ug_send_result(ad->ug, svc);
998 SETTING_TRACE("Send Result : %s\n", "Cancel");
1000 service_destroy(svc);
1002 /* Send destroy request */
1003 ug_destroy_me(ad->ug);
1008 setting_password_main_click_softkey_done_cb(void *data, Evas_Object *obj,
1012 retm_if(data == NULL, "[Setting > Password] Data parameter is NULL");
1016 char svalue[SHA256_DIGEST_LENGTH] = { 0, };
1018 memset(svalue, 0x0, SHA256_DIGEST_LENGTH);
1020 SettingPasswordUG *ad = (SettingPasswordUG *) data;
1023 SETTING_TRACE("ad->view_type:%d", ad->view_type);
1025 switch (ad->view_type) {
1026 case SETTING_PW_TYPE_PIN_LOCK_ON:
1028 SETTING_TRACE("case SETTING_PW_TYPE_PIN_LOCK_ON");
1030 ret = setting_password_main_check_1line_password(ad);
1031 if (ret == SETTING_RETURN_SUCCESS) {
1032 TelSimFacilityPw_t sim_sec_data = { 0, };
1033 int tapi_ret = TAPI_API_SUCCESS;
1034 const char *entry_str;
1036 entry_str = ad->ed_pw1->sub_desc;
1037 if (isEmptyStr(entry_str)) {
1038 ad->focus_data = ad->ed_pw1;
1039 SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!");
1040 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1044 sim_sec_data.lock_type = TAPI_SIM_LOCK_SC;//TAPI_SIM_PTYPE_PIN1;
1045 sim_sec_data.pw = (unsigned char *)entry_str;
1046 sim_sec_data.pw_len = safeStrLen(entry_str);
1048 tapi_ret = tel_enable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_enable_cb, ad);
1049 setting_password_main_clear_1line_password(ad);
1051 if (TAPI_API_SUCCESS != tapi_ret) {
1052 ad->focus_data = ad->ed_pw1;
1053 SETTING_TRACE_DEBUG("%s*** [ERR] tel_enable_sim_facility err=%d ***%s",
1054 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1055 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1057 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1058 SETTING_TRACE_DEBUG("*** [SUCCESS] tel_enable_sim_facility err=%d ***", tapi_ret);
1061 setting_password_main_clear_1line_password(ad);
1065 case SETTING_PW_TYPE_PIN_LOCK_OFF:
1067 SETTING_TRACE("case SETTING_PW_TYPE_PIN_LOCK_OFF");
1069 ret = setting_password_main_check_1line_password(ad);
1071 if (ret == SETTING_RETURN_SUCCESS) {
1072 TelSimFacilityPw_t sim_sec_data = { 0, };
1073 int tapi_ret = TAPI_API_SUCCESS;
1074 const char *entry_str;
1076 entry_str = ad->ed_pw1->sub_desc;
1077 if (isEmptyStr(entry_str)) {
1078 ad->focus_data = ad->ed_pw1;
1079 SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!");
1080 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1084 sim_sec_data.lock_type = TAPI_SIM_LOCK_SC;//TAPI_SIM_PTYPE_PIN1
1085 sim_sec_data.pw = (unsigned char *)entry_str;
1086 sim_sec_data.pw_len = safeStrLen(entry_str);
1088 tapi_ret = tel_disable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_disable_cb, ad);
1089 setting_password_main_clear_1line_password(ad);
1091 if (TAPI_API_SUCCESS != tapi_ret) {
1092 ad->focus_data = ad->ed_pw1;
1093 SETTING_TRACE_DEBUG("%s*** [ERR] tel_disable_sim_facility err=%d ***%s",
1094 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1095 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1097 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1100 setting_password_main_clear_1line_password(ad);
1104 case SETTING_PW_TYPE_PIN1_BLOCKED:
1106 /* PIN1 Status is "Blocked": User should input puk code and new pin1 code. */
1107 /* If puk code is correct and success to modify pin1 code, display pin1 code change popup */
1108 /* But, if this menu is "Pin Lock", pinlock status will not be changed. */
1109 SETTING_TRACE("case SETTING_PW_TYPE_PIN1_BLOCKED");
1110 ret = setting_password_main_check_3line_password(ad);
1112 if (ret == SETTING_RETURN_SUCCESS) {
1113 TelSimSecPw_t puk1_data = { 0, };
1114 TelSimSecPw_t pin1_data = { 0, };
1115 int tapi_ret = TAPI_API_SUCCESS;
1117 const char *new_pin1;
1119 puk = ad->ed_pw1->sub_desc;
1120 new_pin1 = ad->ed_pw2->sub_desc;
1121 if (isEmptyStr(puk)) {
1122 ad->focus_data = ad->ed_pw1;
1123 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1127 if (isEmptyStr(new_pin1)) {
1128 ad->focus_data = ad->ed_pw2;
1129 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1133 puk1_data.type = TAPI_SIM_PTYPE_PUK1;
1134 puk1_data.pw = (unsigned char *)puk;
1135 puk1_data.pw_len = safeStrLen(puk);
1137 pin1_data.type = TAPI_SIM_PTYPE_PIN1;
1138 pin1_data.pw = (unsigned char *)new_pin1;
1139 pin1_data.pw_len = safeStrLen(new_pin1);
1141 tapi_ret = tel_verify_sim_puks(ad->handle, &puk1_data, &pin1_data, setting_sim_verify_puks_cb, ad);
1142 setting_password_main_clear_3line_password(ad);
1144 if (TAPI_API_SUCCESS != tapi_ret) {
1145 ad->focus_data = ad->ed_pw1;
1146 SETTING_TRACE_DEBUG("%s*** [ERR] tel_verify_sim_puks err=%d ***%s",
1147 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1148 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1150 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1154 setting_password_main_clear_3line_password(ad);
1158 case SETTING_PW_TYPE_PIN2_BLOCKED:
1160 SETTING_TRACE("case SETTING_PW_TYPE_PIN2_BLOCKED");
1161 ret = setting_password_main_check_3line_password(ad);
1163 if (ret == SETTING_RETURN_SUCCESS) {
1164 TelSimSecPw_t puk2_data = { 0, };
1165 TelSimSecPw_t pin2_data = { 0, };
1166 int tapi_ret = TAPI_API_SUCCESS;
1168 const char *new_pin2;
1170 puk = ad->ed_pw1->sub_desc;
1171 new_pin2 = ad->ed_pw2->sub_desc;
1172 if (isEmptyStr(puk)) {
1173 ad->focus_data = ad->ed_pw1;
1174 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1178 if (isEmptyStr(new_pin2)) {
1179 ad->focus_data = ad->ed_pw2;
1180 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1184 puk2_data.type = TAPI_SIM_PTYPE_PUK2;
1185 puk2_data.pw = (unsigned char *)puk;
1186 puk2_data.pw_len = safeStrLen(puk);
1188 pin2_data.type = TAPI_SIM_PTYPE_PIN2;
1189 pin2_data.pw = (unsigned char *)new_pin2;
1190 pin2_data.pw_len = safeStrLen(new_pin2);
1192 tapi_ret = tel_verify_sim_puks(ad->handle, &puk2_data, &pin2_data, setting_sim_verify_puks_cb, ad);
1193 setting_password_main_clear_3line_password(ad);
1195 if (TAPI_API_SUCCESS != tapi_ret) {
1196 ad->focus_data = ad->ed_pw1;
1197 SETTING_TRACE_DEBUG("%s*** [ERR] tel_verify_sim_puks err=%d ***%s",
1198 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1199 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1201 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1205 setting_password_main_clear_3line_password(ad);
1209 case SETTING_PW_TYPE_CHANGE_PIN1:
1211 SETTING_TRACE("case SETTING_PW_TYPE_CHANGE_PIN1");
1213 ret = setting_password_main_check_3line_password(ad);
1214 if (ret == SETTING_RETURN_SUCCESS) {
1217 TelSimSecPw_t sim_old_sec_data = { 0, };
1218 TelSimSecPw_t sim_new_sec_data = { 0, };
1219 int tapi_ret = TAPI_API_SUCCESS;
1221 old_pw = ad->ed_pw1->sub_desc;
1222 new_pw = ad->ed_pw2->sub_desc;
1223 if (isEmptyStr(old_pw)) {
1224 ad->focus_data = ad->ed_pw1;
1225 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1229 if (isEmptyStr(new_pw)) {
1230 ad->focus_data = ad->ed_pw2;
1231 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1235 sim_old_sec_data.type = TAPI_SIM_PTYPE_PIN1;
1236 sim_new_sec_data.type = TAPI_SIM_PTYPE_PIN1;
1237 sim_old_sec_data.pw = (unsigned char *)old_pw;
1238 sim_old_sec_data.pw_len = safeStrLen(old_pw);
1239 sim_new_sec_data.pw = (unsigned char *)new_pw;
1240 sim_new_sec_data.pw_len = safeStrLen(new_pw);
1242 tapi_ret = tel_change_sim_pins(ad->handle, &sim_old_sec_data, &sim_new_sec_data, setting_sim_change_pins_cb, ad);
1243 setting_password_main_clear_3line_password(ad);
1245 if (TAPI_API_SUCCESS != tapi_ret) {
1246 ad->focus_data = ad->ed_pw1;
1247 SETTING_TRACE_DEBUG("%s*** [ERR] TelTapiSimChangePIN err=%d ***%s",
1248 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1249 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1251 /* Success popup and send message to caller */
1252 /* setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_PIN1_CHANGED")); */
1255 setting_password_main_clear_3line_password(ad);
1259 case SETTING_PW_TYPE_CHANGE_PIN2:
1261 SETTING_TRACE("case SETTING_PW_TYPE_CHANGE_PIN2");
1262 ret = setting_password_main_check_3line_password(ad);
1263 if (ret == SETTING_RETURN_SUCCESS) {
1266 TelSimSecPw_t sim_old_sec_data = { 0, };
1267 TelSimSecPw_t sim_new_sec_data = { 0, };
1268 int tapi_ret = TAPI_API_SUCCESS;
1270 old_pw = ad->ed_pw1->sub_desc;
1271 new_pw = ad->ed_pw2->sub_desc;
1272 if (isEmptyStr(old_pw)) {
1273 ad->focus_data = ad->ed_pw1;
1274 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1278 if (isEmptyStr(new_pw)) {
1279 ad->focus_data = ad->ed_pw2;
1280 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1284 sim_old_sec_data.type = TAPI_SIM_PTYPE_PIN2;
1285 sim_new_sec_data.type = TAPI_SIM_PTYPE_PIN2;
1286 sim_old_sec_data.pw = (unsigned char *)old_pw;
1287 sim_old_sec_data.pw_len = safeStrLen(old_pw);
1288 sim_new_sec_data.pw = (unsigned char *)new_pw;
1289 sim_new_sec_data.pw_len = safeStrLen(new_pw);
1291 tapi_ret = tel_change_sim_pins(ad->handle, &sim_old_sec_data, &sim_new_sec_data, setting_sim_change_pins_cb, ad);
1292 setting_password_main_clear_3line_password(ad);
1294 if (TAPI_API_SUCCESS != tapi_ret) {
1295 ad->focus_data = ad->ed_pw1;
1296 SETTING_TRACE_DEBUG("%s*** [ERR] TelTapiSimChangePIN err=%d ***%s",
1297 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1298 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1300 /* Success popup and send message to caller */
1301 /* setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_PIN2_CHANGED")); */
1304 setting_password_main_clear_3line_password(ad);
1308 case SETTING_PW_TYPE_SIM_LOCK_ON:
1310 SETTING_TRACE("case SETTING_PW_TYPE_SIM_LOCK_ON");
1312 ret = setting_password_main_check_2line_password(ad);
1314 if (ret == SETTING_RETURN_SUCCESS) {
1315 TelSimFacilityPw_t sim_sec_data = { 0, };
1316 int tapi_ret = TAPI_API_SUCCESS;
1317 const char *entry_str;
1318 entry_str = ad->ed_pw1->sub_desc;
1319 if (isEmptyStr(entry_str)) {
1320 ad->focus_data = ad->ed_pw1;
1321 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1325 sim_sec_data.lock_type = TAPI_SIM_LOCK_PS;//TAPI_SIM_PTYPE_SIM
1326 sim_sec_data.pw = (unsigned char *)entry_str;
1327 sim_sec_data.pw_len = safeStrLen(entry_str);
1329 tapi_ret = tel_enable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_enable_cb, ad);
1330 setting_password_main_clear_2line_password(ad);
1332 SETTING_TRACE("SIM Lock password : %s\n", (char *)(sim_sec_data.pw));
1333 if (TAPI_API_SUCCESS != tapi_ret) {
1334 ad->focus_data = ad->ed_pw1;
1335 SETTING_TRACE_DEBUG("%s*** [ERR] tel_enable_sim_facility err=%d ***%s",
1336 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1337 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1339 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1343 setting_password_main_clear_2line_password(ad);
1347 case SETTING_PW_TYPE_SIM_LOCK_OFF:
1349 SETTING_TRACE("case SETTING_PW_TYPE_SIM_LOCK_OFF");
1351 ret = setting_password_main_check_1line_password(ad);
1352 if (ret == SETTING_RETURN_SUCCESS) {
1353 TelSimFacilityPw_t sim_sec_data = { 0, };
1354 int tapi_ret = TAPI_API_SUCCESS;
1355 const char *entry_str;
1357 entry_str = ad->ed_pw1->sub_desc;
1358 if (isEmptyStr(entry_str)) {
1359 ad->focus_data = ad->ed_pw1;
1360 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1364 sim_sec_data.lock_type = TAPI_SIM_LOCK_PS;//TAPI_SIM_PTYPE_SIM
1365 sim_sec_data.pw = (unsigned char *)entry_str;
1366 sim_sec_data.pw_len = safeStrLen(entry_str);
1368 tapi_ret = tel_disable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_disable_cb, ad);
1369 setting_password_main_clear_1line_password(ad);
1371 if (TAPI_API_SUCCESS != tapi_ret) {
1372 ad->focus_data = ad->ed_pw1;
1373 SETTING_TRACE_DEBUG("%s*** [ERR] tel_disable_sim_facility err=%d ***%s",
1374 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1375 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1377 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1381 setting_password_main_clear_1line_password(ad);
1386 case SETTING_PW_TYPE_FDN_MODE_ON:
1388 SETTING_TRACE("case SETTING_PW_TYPE_FDN_MODE_ON");
1389 ret = setting_password_main_check_1line_password(ad);
1391 if(ret == SETTING_RETURN_SUCCESS)
1393 const char *entry_str;
1394 int tapi_ret = TAPI_API_INVALID_INPUT;
1396 TelSimFacilityPw_t sim_sec_data = {0,};
1399 entry_str = ad->ed_pw1->sub_desc;
1400 if(isEmptyStr(entry_str))
1402 ad->focus_data = ad->ed_pw1;
1403 SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!");
1404 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1407 sim_sec_data.lock_type = TAPI_SIM_LOCK_FD;//TAPI_SIM_PTYPE_PIN2;
1408 sim_sec_data.pw_len = safeStrLen(entry_str);
1409 sim_sec_data.pw = (unsigned char*)entry_str;
1411 tapi_ret = tel_enable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_enable_cb, ad);
1412 setting_password_main_clear_1line_password(ad);
1414 if(tapi_ret != TAPI_API_SUCCESS)
1416 ad->focus_data = ad->ed_pw1;
1417 SETTING_TRACE_ERROR("[ERR] Failed to enable FDN. Tapi return %d", tapi_ret);
1418 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1423 if (service_create(&svc))
1426 service_add_extra_data(svc, "result", ad->view_type_string);
1427 ug_send_result(ad->ug, svc);
1428 SETTING_TRACE("Send Result : %s\n", ad->view_type_string);
1429 service_destroy(svc);
1430 //ug_destroy_me(ad->ug);
1435 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), TRUE);
1439 case SETTING_PW_TYPE_FDN_MODE_OFF:
1441 SETTING_TRACE("case SETTING_PW_TYPE_FDN_MODE_OFF");
1442 ret = setting_password_main_check_1line_password(ad);
1444 if(ret == SETTING_RETURN_SUCCESS)
1446 const char *entry_str;
1447 int tapi_ret = TAPI_API_INVALID_INPUT;
1449 TelSimFacilityPw_t sim_sec_data = {0,};
1451 entry_str = ad->ed_pw1->sub_desc;
1452 if(isEmptyStr(entry_str))
1454 ad->focus_data = ad->ed_pw1;
1455 SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!");
1456 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1459 sim_sec_data.lock_type = TAPI_SIM_LOCK_FD;//TAPI_SIM_PTYPE_PIN2
1460 sim_sec_data.pw_len = safeStrLen(entry_str);
1461 sim_sec_data.pw = (unsigned char*)entry_str;
1463 tapi_ret = tel_disable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_disable_cb, ad);
1464 setting_password_main_clear_1line_password(ad);
1466 if(tapi_ret != TAPI_API_SUCCESS)
1468 ad->focus_data = ad->ed_pw1;
1469 SETTING_TRACE_ERROR("[ERR] Failed to disable FDN. Tapi return %d", tapi_ret);
1470 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1475 if (service_create(&svc))
1478 service_add_extra_data(svc, "result", ad->view_type_string);
1479 ug_send_result(ad->ug, svc);
1480 SETTING_TRACE("Send Result : %s\n", ad->view_type_string);
1482 service_destroy(svc);
1483 //ug_destroy_me(ad->ug);
1488 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), TRUE);