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>
28 static int setting_password_main_create(void *cb);
29 static int setting_password_main_destroy(void *cb);
30 static int setting_password_main_update(void *cb);
31 static int setting_password_main_cleanup(void *cb);
33 setting_view setting_view_password_main = {
34 .create = setting_password_main_create,
35 .destroy = setting_password_main_destroy,
36 .update = setting_password_main_update,
37 .cleanup = setting_password_main_cleanup,
40 #define ENTRY_CALLBACK_REPEAT_MAX 3
41 #define SETTING_COMPARE_PW_FAIL -2
43 /* ***************************************************
47 ***************************************************/
49 __password_main_gl_mouse_up(void *data, Evas *e, Evas_Object *obj,
53 SettingPasswordUG *ad = (SettingPasswordUG *) data;
56 setting_hide_input_pannel_cb(ad->ed_pw1->eo_check);
59 setting_hide_input_pannel_cb(ad->ed_pw1->eo_check);
62 setting_hide_input_pannel_cb(ad->ed_pw1->eo_check);
67 static char *setting_password_main_get_title_str(void *data)
69 retvm_if(data == NULL, NULL,
70 "[Setting > Password] Data parameter is NULL");
71 SettingPasswordUG *ad = (SettingPasswordUG *) data;
73 switch (ad->view_type) {
74 case SETTING_PW_TYPE_SIM_LOCK_ON:
75 case SETTING_PW_TYPE_SIM_LOCK_OFF:
76 return _("IDS_COM_BODY_AUTH_PASSWORD");
78 case SETTING_PW_TYPE_PIN_LOCK_ON:
79 case SETTING_PW_TYPE_PIN_LOCK_OFF:
80 return _("IDS_ST_BODY_PIN1");
82 case SETTING_PW_TYPE_CHANGE_PIN1:
83 return _("IDS_ST_BODY_CHANGE_PIN1");
86 case SETTING_PW_TYPE_CHANGE_PIN2:
87 return _("IDS_ST_BODY_CHANGE_PIN2");
90 case SETTING_PW_TYPE_PIN1_BLOCKED:
91 return _("IDS_ST_BODY_PUK1_CODE");
93 case SETTING_PW_TYPE_PIN2_BLOCKED:
95 return _("IDS_ST_BODY_PUK2");
98 SETTING_TRACE_DEBUG("%s*** Unknown Password Type. ***%s",
99 SETTING_FONT_BGREEN, SETTING_FONT_BLACK);
106 Elm_Object_Item* __create_navibar(void *data, Evas_Object *content, Evas_Object *navibar, setting_pw_navibar_style_t style)
109 retv_if(data == NULL || content == NULL || navibar == NULL, NULL);
111 SettingPasswordUG *ad = (SettingPasswordUG *)data;
113 Elm_Object_Item *navi_item = NULL;
114 Evas_Object *done_btn = NULL;
118 case SETTING_PW_NAVIBAR_WITH_LEFT_BTN :
119 SETTING_TRACE_DEBUG("with left btn");
120 navi_item = setting_create_navi_bar_top_buttons(setting_password_main_get_title_str(ad),
121 NULL, _("IDS_COM_SK_CANCEL"), NULL,
123 setting_password_main_click_softkey_cancel_cb,
124 NULL, ad, content, navibar);
126 case SETTING_PW_NAVIBAR_WITH_RIGHT_BTN :
127 SETTING_TRACE_DEBUG("with right btn");
128 navi_item = setting_create_navi_bar_top_buttons(setting_password_main_get_title_str(ad),
129 _("IDS_COM_SK_DONE"), NULL, NULL,
130 setting_password_main_click_softkey_done_cb, NULL,
131 NULL, ad, content, navibar);
133 case SETTING_PW_NAVIBAR_WITH_BOTH_BTN:
134 SETTING_TRACE_DEBUG("with both btn");
135 navi_item = setting_create_navi_bar_top_buttons(setting_password_main_get_title_str(ad),
136 _("IDS_COM_SK_DONE"), _("IDS_COM_SK_CANCEL"), NULL,
137 setting_password_main_click_softkey_done_cb,
138 setting_password_main_click_softkey_cancel_cb,
139 NULL, ad, content, navibar);
141 case SETTING_PW_NAVIBAR_WITH_NO_BTN:
142 SETTING_TRACE_DEBUG("with no btn");
143 navi_item = setting_create_navi_bar_top_buttons(setting_password_main_get_title_str(ad),
147 NULL, ad, content, navibar);
151 retv_if(!navi_item, NULL);
153 done_btn = elm_object_item_part_content_get(navi_item, NAVI_BTN_STYLE_LEFT);
156 setting_disable_evas_object(done_btn);
157 setting_dim_evas_object(done_btn, TRUE);
162 static int __create_common_password_frame(void *data)
165 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
167 SettingPasswordUG *ad = (SettingPasswordUG *)data;
168 Evas_Object *navi_bar = NULL;
169 static int count = 0;
173 if(ad->scroller != NULL)
175 evas_object_del(ad->scroller);
178 Evas_Object *pw_list = elm_genlist_add(ad->win_main_layout);
179 elm_object_style_set(pw_list, "dialogue");
181 return SETTING_RETURN_FAIL;
183 elm_genlist_clear(pw_list); /* first to clear list */
184 elm_genlist_mode_set(pw_list, ELM_LIST_COMPRESS);
187 #if SUPPORT_BOTTOM_BTNS
188 ad->ly_main = setting_create_win_layout(ad->win_main_layout, ad->win_get);
189 retv_if(!ad->ly_main, SETTING_RETURN_FAIL);
191 navi_bar = setting_create_navi_bar(ad->ly_main);
192 retv_if(!navi_bar, SETTING_RETURN_FAIL);
194 ad->navi_it = __create_navibar(ad, pw_list, navi_bar, SETTING_PW_NAVIBAR_WITH_BOTH_BTN);
196 retv_if(!ad->navi_it, SETTING_RETURN_FAIL);
199 setting_create_layout_navi_bar(ad->win_main_layout, ad->win_get,
200 setting_password_main_get_title_str
201 (ad), _("IDS_COM_SK_CANCEL"),
202 _("IDS_COM_SK_DONE"), NULL,
203 setting_password_main_click_softkey_cancel_cb,
204 setting_password_main_click_softkey_done_cb,
205 NULL, ad, pw_list /* contents */ ,
206 &navi_bar, &(ad->controllbar));
207 elm_object_item_disabled_set(elm_toolbar_last_item_get(ad->controllbar), EINA_TRUE);
209 if(ad->ly_main == NULL)
210 return SETTING_RETURN_FAIL;
213 evas_object_event_callback_add(pw_list, EVAS_CALLBACK_MOUSE_UP,
214 __password_main_gl_mouse_up, ad);
216 Elm_Object_Item *item = elm_genlist_item_append(pw_list,
217 &(ad->itc_seperator), NULL, NULL,
218 ELM_GENLIST_ITEM_NONE, NULL, NULL);
219 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
221 ad->scroller = pw_list;
223 return SETTING_RETURN_SUCCESS;
227 setting_password_main_create(void *cb)
231 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
233 SettingPasswordUG *ad = (SettingPasswordUG *) cb;
236 ret = __create_common_password_frame(ad);
239 return SETTING_RETURN_FAIL;
241 setting_password_main_create_ui(ad);
243 setting_view_password_main.is_create = 1;
245 return SETTING_RETURN_SUCCESS;
248 static int setting_password_main_destroy(void *cb)
251 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
253 SettingPasswordUG *ad = (SettingPasswordUG *) cb;
254 if (ad->remove_timer) {
255 ecore_timer_del(ad->remove_timer);
256 ad->remove_timer = NULL;
259 if (ad->ly_main != NULL) {
260 evas_object_del(ad->ly_main);
262 setting_view_password_main.is_create = 0;
264 return SETTING_RETURN_SUCCESS;
267 static int setting_password_main_update(void *cb)
270 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
272 SettingPasswordUG *ad = (SettingPasswordUG *) cb;
274 if (ad->ly_main != NULL) {
275 evas_object_show(ad->ly_main);
278 return SETTING_RETURN_SUCCESS;
281 static int setting_password_main_cleanup(void *cb)
284 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
286 SettingPasswordUG *ad = (SettingPasswordUG *) cb;
288 if (ad->ly_main != NULL) {
289 evas_object_hide(ad->ly_main);
292 return SETTING_RETURN_SUCCESS;
295 /* ***************************************************
299 ***************************************************/
301 static int setting_password_main_create_ui(void *data)
304 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
305 "[Setting > Password] Data parameter is NULL");
307 SettingPasswordUG *ad = (SettingPasswordUG *) data;
309 SETTING_TRACE_DEBUG("ad->view_type=%d ***", ad->view_type);
311 switch (ad->view_type) {
312 case SETTING_PW_TYPE_SIM_LOCK_OFF:
313 case SETTING_PW_TYPE_PIN_LOCK_ON:
314 case SETTING_PW_TYPE_PIN_LOCK_OFF:
315 setting_password_main_draw_1line_password(ad, NULL);
317 case SETTING_PW_TYPE_SIM_LOCK_ON:
318 setting_password_main_draw_2line_password(ad, NULL);
321 case SETTING_PW_TYPE_CHANGE_PIN1:
322 case SETTING_PW_TYPE_CHANGE_PIN2:
323 case SETTING_PW_TYPE_PIN1_BLOCKED:
324 case SETTING_PW_TYPE_PIN2_BLOCKED:
325 setting_password_main_draw_3line_password(ad, NULL);
329 SETTING_TRACE_DEBUG("%s*** Unknown Password Type. ***%s",
330 SETTING_FONT_BGREEN, SETTING_FONT_BLACK);
334 /** @todo this function always return 0, not verifying the function flow with the value */
339 setting_password_main_entry_changed_cb(void *data, Evas_Object *obj,
342 retm_if(data == NULL, "[Setting > Password] Data parameter is NULL");
343 Setting_GenGroupItem_Data *list_item =
344 (Setting_GenGroupItem_Data *) data;
345 SettingPasswordUG *ad = (SettingPasswordUG *) list_item->userdata;
346 const char *entry_str = elm_entry_entry_get(obj);
347 list_item->sub_desc = (char *)g_strdup(entry_str);
348 bool isFoundEmptyEntry = FALSE;
350 Evas_Object *layout = elm_object_parent_widget_get(obj);
351 elm_object_part_text_set(layout, "elm.guidetext", "");
355 entry_str = ad->ed_pw1->sub_desc;
356 if (NULL == entry_str || '\0' == entry_str[0]) {
357 isFoundEmptyEntry = TRUE;
358 layout = elm_object_parent_widget_get(ad->ed_pw1->eo_check);
359 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
364 entry_str = ad->ed_pw2->sub_desc;
365 if (NULL == entry_str || '\0' == entry_str[0]) {
366 isFoundEmptyEntry = TRUE;
367 layout = elm_object_parent_widget_get(ad->ed_pw2->eo_check);
368 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
373 entry_str = ad->ed_pw3->sub_desc;
374 if (NULL == entry_str || '\0' == entry_str[0]) {
375 isFoundEmptyEntry = TRUE;
376 layout = elm_object_parent_widget_get(ad->ed_pw3->eo_check);
377 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
384 bool disableFlag = isFoundEmptyEntry;
386 #if SUPPORT_BOTTOM_BTNS
387 Evas_Object *done_btn = elm_object_item_part_content_get(ad->navi_it, NAVI_BTN_STYLE_LEFT);
389 if (!evas_object_pass_events_get(done_btn)) { /* it had not yet been disabled */
390 setting_disable_evas_object(done_btn);
391 setting_dim_evas_object(done_btn, TRUE);
392 }/* else already disabled */
394 setting_enable_evas_object(done_btn);
395 setting_undo_dim_evas_object(done_btn, TRUE);
398 elm_object_item_disabled_set(elm_toolbar_last_item_get
399 (ad->controllbar), disableFlag);
404 static Eina_Bool __focus_on_idler(void *data)
407 retv_if(data == NULL, FALSE);
409 SettingPasswordUG *ad = (SettingPasswordUG *) data;
413 if (ad->ed_pw1->isFocusFlag || (ad->ed_pw1->eo_check != NULL))
415 /* no matter how many edifileds, it only need focus on 1st editfiled */
416 elm_object_focus_set(ad->ed_pw1->eo_check, EINA_TRUE);
420 return ECORE_CALLBACK_CANCEL;
423 static int setting_password_main_draw_1line_password(void *data, void *cb)
426 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
427 "[Setting > Password] Data parameter is NULL");
429 SettingPasswordUG *ad = (SettingPasswordUG *) data;
431 switch (ad->view_type) {
432 case SETTING_PW_TYPE_PIN_LOCK_ON:
433 case SETTING_PW_TYPE_PIN_LOCK_OFF:
435 setting_create_Gendial_field_entry(ad->scroller,
437 (ad->itc_variable_height),
439 SWALLOW_Type_LAYOUT_ENTRY,
441 "IDS_ST_BODY_PIN1", NULL,
442 setting_password_main_entry_changed_cb,
443 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
445 SETTING_PW_UG_PIN_MAX_LENGTH,
446 0, "0123456789", NULL);
452 ecore_idler_add(__focus_on_idler, ad);
456 static int setting_password_main_clear_1line_password(void *data)
459 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
460 "[Setting > Password] Data parameter is NULL");
462 SettingPasswordUG *ad = (SettingPasswordUG *) data;
463 retv_if(NULL == ad->ed_pw1, -1);
465 ad->ed_pw1->sub_desc = NULL;
466 ad->ed_pw1->isFocusFlag = FALSE;
468 elm_entry_entry_set(ad->ed_pw1->eo_check, "");
469 Evas_Object *layout = elm_object_parent_widget_get(ad->ed_pw1->eo_check);
470 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
474 static int setting_password_main_draw_2line_password(void *data, void *cb)
477 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
479 SettingPasswordUG *ad = (SettingPasswordUG *) data;
481 switch (ad->view_type) {
482 case SETTING_PW_TYPE_SIM_LOCK_ON:
484 setting_create_Gendial_field_entry(ad->scroller,
486 (ad->itc_variable_height),
488 SWALLOW_Type_LAYOUT_ENTRY,
492 setting_password_main_entry_changed_cb,
493 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
495 SETTING_PW_UG_SIM_MAX_LENGTH,
496 0, "0123456789", NULL);
499 setting_create_Gendial_field_entry(ad->scroller,
501 (ad->itc_variable_height),
503 SWALLOW_Type_LAYOUT_ENTRY,
505 PW_SHORT_GUIDE_CONFIRM,
507 setting_password_main_entry_changed_cb,
508 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
510 SETTING_PW_UG_SIM_MAX_LENGTH,
511 0, "0123456789", NULL);
517 ecore_idler_add(__focus_on_idler, ad);
521 static int setting_password_main_clear_2line_password(void *data)
524 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
525 "[Setting > Password] Data parameter is NULL");
527 SettingPasswordUG *ad = (SettingPasswordUG *) data;
528 Evas_Object *layout = NULL;
530 retv_if(NULL == ad->ed_pw1, -1);
531 ad->ed_pw1->sub_desc = NULL;
532 ad->ed_pw1->isFocusFlag = FALSE;
533 elm_entry_entry_set(ad->ed_pw1->eo_check, "");
534 layout = elm_object_parent_widget_get(ad->ed_pw1->eo_check);
535 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
537 retv_if(NULL == ad->ed_pw2, -1);
538 ad->ed_pw2->sub_desc = NULL;
539 ad->ed_pw2->isFocusFlag = FALSE;
540 elm_entry_entry_set(ad->ed_pw2->eo_check, "");
541 layout = elm_object_parent_widget_get(ad->ed_pw2->eo_check);
542 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
546 static int setting_password_main_draw_3line_password(void *data, void *cb)
549 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
550 "[Setting > Password] Data parameter is NULL");
552 SettingPasswordUG *ad = (SettingPasswordUG *) data;
554 switch (ad->view_type) {
555 case SETTING_PW_TYPE_CHANGE_PIN1:
557 setting_create_Gendial_field_entry(ad->scroller,
559 (ad->itc_variable_height),
561 SWALLOW_Type_LAYOUT_ENTRY,
563 PW_SHORT_GUIDE_CURRENT,
565 setting_password_main_entry_changed_cb,
566 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
568 SETTING_PW_UG_PIN_MAX_LENGTH,
569 0, "0123456789", NULL);
572 setting_create_Gendial_field_entry(ad->scroller,
574 (ad->itc_variable_height),
576 SWALLOW_Type_LAYOUT_ENTRY,
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,
593 PW_SHORT_GUIDE_CONFIRM,
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 case SETTING_PW_TYPE_CHANGE_PIN2:
604 setting_create_Gendial_field_entry(ad->scroller,
606 (ad->itc_variable_height),
608 SWALLOW_Type_LAYOUT_ENTRY,
610 PW_SHORT_GUIDE_CURRENT,
612 setting_password_main_entry_changed_cb,
613 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
615 SETTING_PW_UG_PIN_MAX_LENGTH,
616 0, "0123456789", NULL);
619 setting_create_Gendial_field_entry(ad->scroller,
621 (ad->itc_variable_height),
623 SWALLOW_Type_LAYOUT_ENTRY,
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,
640 PW_SHORT_GUIDE_CONFIRM,
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 case SETTING_PW_TYPE_PIN1_BLOCKED:
651 setting_create_Gendial_field_entry(ad->scroller,
653 (ad->itc_variable_height),
655 SWALLOW_Type_LAYOUT_ENTRY,
657 "IDS_ST_BODY_PUK1_CODE",
659 setting_password_main_entry_changed_cb,
660 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
662 SETTING_PW_UG_PIN_MAX_LENGTH,
663 0, "0123456789", NULL);
666 setting_create_Gendial_field_entry(ad->scroller,
668 (ad->itc_variable_height),
670 SWALLOW_Type_LAYOUT_ENTRY,
672 "IDS_ST_BODY_NEW_PIN1",
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_CONFIRM_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 case SETTING_PW_TYPE_PIN2_BLOCKED:
698 setting_create_Gendial_field_entry(ad->scroller,
700 (ad->itc_variable_height),
702 SWALLOW_Type_LAYOUT_ENTRY,
704 "IDS_ST_BODY_PUK2", NULL,
705 setting_password_main_entry_changed_cb,
706 ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,
708 SETTING_PW_UG_PIN_MAX_LENGTH,
709 0, "0123456789", NULL);
712 setting_create_Gendial_field_entry(ad->scroller,
714 (ad->itc_variable_height),
716 SWALLOW_Type_LAYOUT_ENTRY,
718 "IDS_ST_BODY_NEW_PIN2",
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_CONFIRM_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);
745 ecore_idler_add(__focus_on_idler, ad);
749 static int setting_password_main_clear_3line_password(void *data)
752 retvm_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER,
753 "[Setting > Password] Data parameter is NULL");
755 SettingPasswordUG *ad = (SettingPasswordUG *) data;
756 Evas_Object *layout = NULL;
758 retv_if(NULL == ad->ed_pw1, -1);
759 ad->ed_pw1->sub_desc = NULL;
760 ad->ed_pw1->isFocusFlag = FALSE;
761 elm_entry_entry_set(ad->ed_pw1->eo_check, "");
762 layout = elm_object_parent_widget_get(ad->ed_pw1->eo_check);
763 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
765 retv_if(NULL == ad->ed_pw2, -1);
766 ad->ed_pw2->sub_desc = NULL;
767 ad->ed_pw2->isFocusFlag = FALSE;
768 elm_entry_entry_set(ad->ed_pw2->eo_check, "");
769 layout = elm_object_parent_widget_get(ad->ed_pw2->eo_check);
770 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
772 retv_if(NULL == ad->ed_pw3, -1);
773 ad->ed_pw3->sub_desc = NULL;
774 ad->ed_pw3->isFocusFlag = FALSE;
775 elm_entry_entry_set(ad->ed_pw3->eo_check, "");
776 layout = elm_object_parent_widget_get(ad->ed_pw3->eo_check);
777 elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
781 static int setting_password_main_check_1line_password(void *data)
784 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
786 SettingPasswordUG *ad = (SettingPasswordUG *) data;
788 const char *entry_str = ad->ed_pw1->sub_desc;
789 ad->focus_data = ad->ed_pw1;
792 if (isEmptyStr(entry_str)) {
793 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
795 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
799 int entry_str_len = safeStrLen(entry_str);
800 switch (ad->view_type) {
801 case SETTING_PW_TYPE_PIN_LOCK_ON:
802 case SETTING_PW_TYPE_PIN_LOCK_OFF:
804 if (entry_str_len < SETTING_PW_UG_PIN_MIN_LENGTH
805 || entry_str_len > SETTING_PW_UG_PIN_MAX_LENGTH) {
806 setting_password_main_warning_entry_added_byte_popup
807 (ad, SETTING_PW_UG_PIN_MIN_LENGTH, SETTING_PW_UG_PIN_MAX_LENGTH);
808 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
812 case SETTING_PW_TYPE_SIM_LOCK_OFF:
814 if (entry_str_len < SETTING_PW_UG_SIM_MIN_LENGTH
815 || entry_str_len > SETTING_PW_UG_SIM_MAX_LENGTH) {
816 setting_password_main_warning_entry_added_byte_popup
817 (ad, SETTING_PW_UG_SIM_MIN_LENGTH, SETTING_PW_UG_SIM_MAX_LENGTH);
818 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
824 return SETTING_RETURN_SUCCESS;
827 static int setting_password_main_check_2line_password(void *data)
830 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
832 SettingPasswordUG *ad = (SettingPasswordUG *) data;
834 const char *entry_str1 = ad->ed_pw1->sub_desc;
835 const char *entry_str2 = ad->ed_pw2->sub_desc;
836 ad->focus_data = ad->ed_pw1;
839 if (isEmptyStr(entry_str1)) {
840 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
842 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
845 if (isEmptyStr(entry_str2)) {
846 ad->focus_data = ad->ed_pw2;
847 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
849 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
853 int entry_str_len = safeStrLen(entry_str1);
854 switch (ad->view_type) {
855 case SETTING_PW_TYPE_SIM_LOCK_ON:
857 if (entry_str_len < SETTING_PW_UG_SIM_MIN_LENGTH
858 || entry_str_len > SETTING_PW_UG_SIM_MAX_LENGTH) {
859 setting_password_main_warning_entry_added_byte_popup
860 (ad, SETTING_PW_UG_SIM_MIN_LENGTH, SETTING_PW_UG_SIM_MAX_LENGTH);
861 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
870 if (0 != safeStrCmp(entry_str1, entry_str2)) {
871 setting_password_ug_display_desc(ad, _("IDS_ST_POP_PASSWORDS_DO_NOT_MATCH"), FALSE);
873 return SETTING_ENTRY_NOT_MATCH_NEW_CONF_PW;
876 return SETTING_RETURN_SUCCESS;
880 setting_password_main_warning_entry_added_byte_popup(SettingPasswordUG *ad,
883 char str[MAX_SPECIALIZITION_LEN + 1] = { 0 };
885 snprintf(str, MAX_SPECIALIZITION_LEN, "%d~%d %s", min, max, _("characters required"));
887 setting_password_ug_display_desc(ad, str, FALSE);
891 static int setting_password_main_check_3line_password(void *data)
894 retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
896 SettingPasswordUG *ad = (SettingPasswordUG *) data;
898 const char *entry_str1 = ad->ed_pw1->sub_desc;
899 const char *entry_str2 = ad->ed_pw2->sub_desc;
900 const char *entry_str3 = ad->ed_pw3->sub_desc;
901 ad->focus_data = ad->ed_pw1;
904 if (isEmptyStr(entry_str1)) {
905 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
907 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
910 if (isEmptyStr(entry_str2)) {
911 ad->focus_data = ad->ed_pw2;
912 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
914 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
917 if (isEmptyStr(entry_str3)) {
918 ad->focus_data = ad->ed_pw3;
919 setting_password_ug_display_desc(ad, _("IDS_ST_BODY_PASSWORD_EMPTY"), FALSE);
921 return SETTING_ENTRY_RETURN_NULL_STR_ERR;
925 int entry_str1_len = safeStrLen(entry_str1);
926 int entry_str2_len = safeStrLen(entry_str2);
927 int entry_str3_len = safeStrLen(entry_str3);
928 switch (ad->view_type) {
929 case SETTING_PW_TYPE_PIN1_BLOCKED:
930 case SETTING_PW_TYPE_PIN2_BLOCKED:
931 case SETTING_PW_TYPE_CHANGE_PIN1:
932 case SETTING_PW_TYPE_CHANGE_PIN2:
934 if (entry_str1_len < SETTING_PW_UG_PIN_MIN_LENGTH
935 || entry_str1_len > SETTING_PW_UG_PIN_MAX_LENGTH) {
936 setting_password_main_warning_entry_added_byte_popup
937 (ad, SETTING_PW_UG_PIN_MIN_LENGTH, SETTING_PW_UG_PIN_MAX_LENGTH);
938 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
940 if (entry_str2_len < SETTING_PW_UG_PIN_MIN_LENGTH
941 || entry_str2_len > SETTING_PW_UG_PIN_MAX_LENGTH) {
942 ad->focus_data = ad->ed_pw2;
943 setting_password_main_warning_entry_added_byte_popup
944 (ad, SETTING_PW_UG_PIN_MIN_LENGTH, SETTING_PW_UG_PIN_MAX_LENGTH);
945 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
947 if (entry_str3_len < SETTING_PW_UG_PIN_MIN_LENGTH
948 || entry_str3_len > SETTING_PW_UG_PIN_MAX_LENGTH) {
949 ad->focus_data = ad->ed_pw3;
950 setting_password_main_warning_entry_added_byte_popup
951 (ad, SETTING_PW_UG_PIN_MIN_LENGTH, SETTING_PW_UG_PIN_MAX_LENGTH);
952 return SETTING_ENTRY_REQUIRED_CORRECT_DIGIT_PW;
961 if (0 != safeStrCmp(entry_str2, entry_str3)) {
962 ad->focus_data = ad->ed_pw2;
963 setting_password_ug_display_desc(ad, _("IDS_ST_POP_PASSWORDS_DO_NOT_MATCH"), FALSE);
965 return SETTING_ENTRY_NOT_MATCH_NEW_CONF_PW;
968 return SETTING_RETURN_SUCCESS;
972 setting_password_main_click_softkey_cancel_cb(void *data, Evas_Object *obj,
976 retm_if(data == NULL, "[Setting > Password] Data parameter is NULL");
978 SettingPasswordUG *ad = (SettingPasswordUG *) data;
980 /* send result : Cancel */
982 if(service_create(&svc))
985 service_add_extra_data(svc, "result", "Cancel");
986 ug_send_result(ad->ug, svc);
987 SETTING_TRACE("Send Result : %s\n", "Cancel");
989 service_destroy(svc);
991 /* Send destroy request */
992 ug_destroy_me(ad->ug);
997 setting_password_main_click_softkey_done_cb(void *data, Evas_Object *obj,
1001 retm_if(data == NULL, "[Setting > Password] Data parameter is NULL");
1005 char svalue[SHA256_DIGEST_LENGTH] = { 0, };
1007 memset(svalue, 0x0, SHA256_DIGEST_LENGTH);
1009 SettingPasswordUG *ad = (SettingPasswordUG *) data;
1011 if (service_create(&svc))
1014 SETTING_TRACE("ad->view_type:%d", ad->view_type);
1016 switch (ad->view_type) {
1017 case SETTING_PW_TYPE_PIN_LOCK_ON:
1019 SETTING_TRACE("case SETTING_PW_TYPE_PIN_LOCK_ON");
1021 ret = setting_password_main_check_1line_password(ad);
1022 if (ret == SETTING_RETURN_SUCCESS) {
1023 TelSimFacilityPw_t sim_sec_data = { 0, };
1024 int tapi_ret = TAPI_API_SUCCESS;
1025 const char *entry_str;
1027 entry_str = ad->ed_pw1->sub_desc;
1028 if (isEmptyStr(entry_str)) {
1029 ad->focus_data = ad->ed_pw1;
1030 SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!");
1031 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1035 sim_sec_data.lock_type = TAPI_SIM_LOCK_SC;//TAPI_SIM_PTYPE_PIN1;
1036 sim_sec_data.pw = (unsigned char *)entry_str;
1037 sim_sec_data.pw_len = safeStrLen(entry_str);
1039 tapi_ret = tel_enable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_enable_cb, ad);
1040 setting_password_main_clear_1line_password(ad);
1042 if (TAPI_API_SUCCESS != tapi_ret) {
1043 ad->focus_data = ad->ed_pw1;
1044 SETTING_TRACE_DEBUG("%s*** [ERR] tel_enable_sim_facility err=%d ***%s",
1045 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1046 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1048 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1049 SETTING_TRACE_DEBUG("*** [SUCCESS] tel_enable_sim_facility err=%d ***", tapi_ret);
1052 setting_password_main_clear_1line_password(ad);
1056 case SETTING_PW_TYPE_PIN_LOCK_OFF:
1058 SETTING_TRACE("case SETTING_PW_TYPE_PIN_LOCK_OFF");
1060 ret = setting_password_main_check_1line_password(ad);
1062 if (ret == SETTING_RETURN_SUCCESS) {
1063 TelSimFacilityPw_t sim_sec_data = { 0, };
1064 int tapi_ret = TAPI_API_SUCCESS;
1065 const char *entry_str;
1067 entry_str = ad->ed_pw1->sub_desc;
1068 if (isEmptyStr(entry_str)) {
1069 ad->focus_data = ad->ed_pw1;
1070 SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!");
1071 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1075 sim_sec_data.lock_type = TAPI_SIM_LOCK_SC;//TAPI_SIM_PTYPE_PIN1
1076 sim_sec_data.pw = (unsigned char *)entry_str;
1077 sim_sec_data.pw_len = safeStrLen(entry_str);
1079 tapi_ret = tel_disable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_disable_cb, ad);
1080 setting_password_main_clear_1line_password(ad);
1082 if (TAPI_API_SUCCESS != tapi_ret) {
1083 ad->focus_data = ad->ed_pw1;
1084 SETTING_TRACE_DEBUG("%s*** [ERR] tel_disable_sim_facility err=%d ***%s",
1085 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1086 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1088 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1091 setting_password_main_clear_1line_password(ad);
1095 case SETTING_PW_TYPE_PIN1_BLOCKED:
1097 /* PIN1 Status is "Blocked": User should input puk code and new pin1 code. */
1098 /* If puk code is correct and success to modify pin1 code, display pin1 code change popup */
1099 /* But, if this menu is "Pin Lock", pinlock status will not be changed. */
1100 SETTING_TRACE("case SETTING_PW_TYPE_PIN1_BLOCKED");
1101 ret = setting_password_main_check_3line_password(ad);
1103 if (ret == SETTING_RETURN_SUCCESS) {
1104 TelSimSecPw_t puk1_data = { 0, };
1105 TelSimSecPw_t pin1_data = { 0, };
1106 int tapi_ret = TAPI_API_SUCCESS;
1108 const char *new_pin1;
1110 puk = ad->ed_pw1->sub_desc;
1111 new_pin1 = ad->ed_pw2->sub_desc;
1112 if (isEmptyStr(puk)) {
1113 ad->focus_data = ad->ed_pw1;
1114 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1118 if (isEmptyStr(new_pin1)) {
1119 ad->focus_data = ad->ed_pw2;
1120 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1124 puk1_data.type = TAPI_SIM_PTYPE_PUK1;
1125 puk1_data.pw = (unsigned char *)puk;
1126 puk1_data.pw_len = safeStrLen(puk);
1128 pin1_data.type = TAPI_SIM_PTYPE_PIN1;
1129 pin1_data.pw = (unsigned char *)new_pin1;
1130 pin1_data.pw_len = safeStrLen(new_pin1);
1132 tapi_ret = tel_verify_sim_puks(ad->handle, &puk1_data, &pin1_data, setting_sim_verify_puks_cb, ad);
1133 setting_password_main_clear_3line_password(ad);
1135 if (TAPI_API_SUCCESS != tapi_ret) {
1136 ad->focus_data = ad->ed_pw1;
1137 SETTING_TRACE_DEBUG("%s*** [ERR] tel_verify_sim_puks err=%d ***%s",
1138 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1139 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1141 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1145 setting_password_main_clear_3line_password(ad);
1149 case SETTING_PW_TYPE_PIN2_BLOCKED:
1151 SETTING_TRACE("case SETTING_PW_TYPE_PIN2_BLOCKED");
1152 ret = setting_password_main_check_3line_password(ad);
1154 if (ret == SETTING_RETURN_SUCCESS) {
1155 TelSimSecPw_t puk2_data = { 0, };
1156 TelSimSecPw_t pin2_data = { 0, };
1157 int tapi_ret = TAPI_API_SUCCESS;
1159 const char *new_pin2;
1161 puk = ad->ed_pw1->sub_desc;
1162 new_pin2 = ad->ed_pw2->sub_desc;
1163 if (isEmptyStr(puk)) {
1164 ad->focus_data = ad->ed_pw1;
1165 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1169 if (isEmptyStr(new_pin2)) {
1170 ad->focus_data = ad->ed_pw2;
1171 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1175 puk2_data.type = TAPI_SIM_PTYPE_PUK2;
1176 puk2_data.pw = (unsigned char *)puk;
1177 puk2_data.pw_len = safeStrLen(puk);
1179 pin2_data.type = TAPI_SIM_PTYPE_PIN2;
1180 pin2_data.pw = (unsigned char *)new_pin2;
1181 pin2_data.pw_len = safeStrLen(new_pin2);
1183 tapi_ret = tel_verify_sim_puks(ad->handle, &puk2_data, &pin2_data, setting_sim_verify_puks_cb, ad);
1184 setting_password_main_clear_3line_password(ad);
1186 if (TAPI_API_SUCCESS != tapi_ret) {
1187 ad->focus_data = ad->ed_pw1;
1188 SETTING_TRACE_DEBUG("%s*** [ERR] tel_verify_sim_puks err=%d ***%s",
1189 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1190 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1192 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1196 setting_password_main_clear_3line_password(ad);
1200 case SETTING_PW_TYPE_CHANGE_PIN1:
1202 SETTING_TRACE("case SETTING_PW_TYPE_CHANGE_PIN1");
1204 ret = setting_password_main_check_3line_password(ad);
1205 if (ret == SETTING_RETURN_SUCCESS) {
1208 TelSimSecPw_t sim_old_sec_data = { 0, };
1209 TelSimSecPw_t sim_new_sec_data = { 0, };
1210 int tapi_ret = TAPI_API_SUCCESS;
1212 old_pw = ad->ed_pw1->sub_desc;
1213 new_pw = ad->ed_pw2->sub_desc;
1214 if (isEmptyStr(old_pw)) {
1215 ad->focus_data = ad->ed_pw1;
1216 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1220 if (isEmptyStr(new_pw)) {
1221 ad->focus_data = ad->ed_pw2;
1222 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1226 sim_old_sec_data.type = sim_new_sec_data.type = TAPI_SIM_PTYPE_PIN1;
1227 sim_old_sec_data.pw = (unsigned char *)old_pw;
1228 sim_old_sec_data.pw_len = safeStrLen(old_pw);
1229 sim_new_sec_data.pw = (unsigned char *)new_pw;
1230 sim_new_sec_data.pw_len = safeStrLen(new_pw);
1232 tapi_ret = tel_change_sim_pins(ad->handle, &sim_old_sec_data, &sim_new_sec_data, setting_sim_change_pins_cb, ad);
1233 setting_password_main_clear_3line_password(ad);
1235 if (TAPI_API_SUCCESS != tapi_ret) {
1236 ad->focus_data = ad->ed_pw1;
1237 SETTING_TRACE_DEBUG("%s*** [ERR] TelTapiSimChangePIN err=%d ***%s",
1238 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1239 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1241 /* Success popup and send message to caller */
1242 /* setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_PIN1_CHANGED")); */
1245 setting_password_main_clear_3line_password(ad);
1249 case SETTING_PW_TYPE_CHANGE_PIN2:
1251 SETTING_TRACE("case SETTING_PW_TYPE_CHANGE_PIN2");
1252 ret = setting_password_main_check_3line_password(ad);
1253 if (ret == SETTING_RETURN_SUCCESS) {
1256 TelSimSecPw_t sim_old_sec_data = { 0, };
1257 TelSimSecPw_t sim_new_sec_data = { 0, };
1258 int tapi_ret = TAPI_API_SUCCESS;
1260 old_pw = ad->ed_pw1->sub_desc;
1261 new_pw = ad->ed_pw2->sub_desc;
1262 if (isEmptyStr(old_pw)) {
1263 ad->focus_data = ad->ed_pw1;
1264 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1268 if (isEmptyStr(new_pw)) {
1269 ad->focus_data = ad->ed_pw2;
1270 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1274 sim_old_sec_data.type = sim_new_sec_data.type = TAPI_SIM_PTYPE_PIN2;
1275 sim_old_sec_data.pw = (unsigned char *)old_pw;
1276 sim_old_sec_data.pw_len = safeStrLen(old_pw);
1277 sim_new_sec_data.pw = (unsigned char *)new_pw;
1278 sim_new_sec_data.pw_len = safeStrLen(new_pw);
1280 tapi_ret = tel_change_sim_pins(ad->handle, &sim_old_sec_data, &sim_new_sec_data, setting_sim_change_pins_cb, ad);
1281 setting_password_main_clear_3line_password(ad);
1283 if (TAPI_API_SUCCESS != tapi_ret) {
1284 ad->focus_data = ad->ed_pw1;
1285 SETTING_TRACE_DEBUG("%s*** [ERR] TelTapiSimChangePIN err=%d ***%s",
1286 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1287 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1289 /* Success popup and send message to caller */
1290 /* setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_ST_POP_PIN2_CHANGED")); */
1293 setting_password_main_clear_3line_password(ad);
1297 case SETTING_PW_TYPE_SIM_LOCK_ON:
1299 SETTING_TRACE("case SETTING_PW_TYPE_SIM_LOCK_ON");
1301 ret = setting_password_main_check_2line_password(ad);
1303 if (ret == SETTING_RETURN_SUCCESS) {
1304 TelSimFacilityPw_t sim_sec_data = { 0, };
1305 int tapi_ret = TAPI_API_SUCCESS;
1306 const char *entry_str;
1307 entry_str = ad->ed_pw1->sub_desc;
1308 if (isEmptyStr(entry_str)) {
1309 ad->focus_data = ad->ed_pw1;
1310 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1314 sim_sec_data.lock_type = TAPI_SIM_LOCK_PS;//TAPI_SIM_PTYPE_SIM
1315 sim_sec_data.pw = (unsigned char *)entry_str;
1316 sim_sec_data.pw_len = safeStrLen(entry_str);
1318 tapi_ret = tel_enable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_enable_cb, ad);
1319 setting_password_main_clear_2line_password(ad);
1321 SETTING_TRACE("SIM Lock password : %s\n", (char *)(sim_sec_data.pw));
1322 if (TAPI_API_SUCCESS != tapi_ret) {
1323 ad->focus_data = ad->ed_pw1;
1324 SETTING_TRACE_DEBUG("%s*** [ERR] tel_enable_sim_facility err=%d ***%s",
1325 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1326 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1328 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1332 setting_password_main_clear_2line_password(ad);
1336 case SETTING_PW_TYPE_SIM_LOCK_OFF:
1338 SETTING_TRACE("case SETTING_PW_TYPE_SIM_LOCK_OFF");
1340 ret = setting_password_main_check_1line_password(ad);
1341 if (ret == SETTING_RETURN_SUCCESS) {
1342 TelSimFacilityPw_t sim_sec_data = { 0, };
1343 int tapi_ret = TAPI_API_SUCCESS;
1344 const char *entry_str;
1346 entry_str = ad->ed_pw1->sub_desc;
1347 if (isEmptyStr(entry_str)) {
1348 ad->focus_data = ad->ed_pw1;
1349 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1353 sim_sec_data.lock_type = TAPI_SIM_LOCK_PS;//TAPI_SIM_PTYPE_SIM
1354 sim_sec_data.pw = (unsigned char *)entry_str;
1355 sim_sec_data.pw_len = safeStrLen(entry_str);
1357 tapi_ret = tel_disable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_disable_cb, ad);
1358 setting_password_main_clear_1line_password(ad);
1360 if (TAPI_API_SUCCESS != tapi_ret) {
1361 ad->focus_data = ad->ed_pw1;
1362 SETTING_TRACE_DEBUG("%s*** [ERR] tel_disable_sim_facility err=%d ***%s",
1363 SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
1364 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1366 /* Success. Send Message to Caller for Modify Pin Lock slider status */
1370 setting_password_main_clear_1line_password(ad);
1375 case SETTING_PW_TYPE_FDN_MODE_ON:
1377 SETTING_TRACE("case SETTING_PW_TYPE_FDN_MODE_ON");
1378 ret = setting_password_main_check_1line_password(ad);
1380 if(ret == SETTING_RETURN_SUCCESS)
1382 const char *entry_str;
1383 int tapi_ret = TAPI_API_INVALID_INPUT;
1385 TelSimFacilityPw_t sim_sec_data = {0,};
1388 entry_str = ad->ed_pw1->sub_desc;
1389 if(isEmptyStr(entry_str))
1391 ad->focus_data = ad->ed_pw1;
1392 SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!");
1393 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1396 sim_sec_data.lock_type = TAPI_SIM_LOCK_FD;//TAPI_SIM_PTYPE_PIN2;
1397 sim_sec_data.pw_len = safeStrLen(entry_str);
1398 sim_sec_data.pw = (unsigned char*)entry_str;
1400 tapi_ret = tel_enable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_enable_cb, ad);
1401 setting_password_main_clear_1line_password(ad);
1403 if(tapi_ret != TAPI_API_SUCCESS)
1405 ad->focus_data = ad->ed_pw1;
1406 SETTING_TRACE_ERROR("[ERR] Failed to enable FDN. Tapi return %d", tapi_ret);
1407 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1412 if (service_create(&svc))
1415 service_add_extra_data(svc, "result", ad->view_type_string);
1416 ug_send_result(ad->ug, svc);
1417 SETTING_TRACE("Send Result : %s\n", ad->view_type_string);
1418 service_destroy(svc);
1419 //ug_destroy_me(ad->ug);
1424 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), TRUE);
1428 case SETTING_PW_TYPE_FDN_MODE_OFF:
1430 SETTING_TRACE("case SETTING_PW_TYPE_FDN_MODE_OFF");
1431 ret = setting_password_main_check_1line_password(ad);
1433 if(ret == SETTING_RETURN_SUCCESS)
1435 const char *entry_str;
1436 int tapi_ret = TAPI_API_INVALID_INPUT;
1438 TelSimFacilityPw_t sim_sec_data = {0,};
1440 entry_str = ad->ed_pw1->sub_desc;
1441 if(isEmptyStr(entry_str))
1443 ad->focus_data = ad->ed_pw1;
1444 SETTING_TRACE_ERROR("[ERR] elm_entry_entry_get(ad->ed_pw1) return NULL!");
1445 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1448 sim_sec_data.lock_type = TAPI_SIM_LOCK_FD;//TAPI_SIM_PTYPE_PIN2
1449 sim_sec_data.pw_len = safeStrLen(entry_str);
1450 sim_sec_data.pw = (unsigned char*)entry_str;
1452 tapi_ret = tel_disable_sim_facility(ad->handle, &sim_sec_data, setting_sim_facility_disable_cb, ad);
1453 setting_password_main_clear_1line_password(ad);
1455 if(tapi_ret != TAPI_API_SUCCESS)
1457 ad->focus_data = ad->ed_pw1;
1458 SETTING_TRACE_ERROR("[ERR] Failed to disable FDN. Tapi return %d", tapi_ret);
1459 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), FALSE);
1464 if (service_create(&svc))
1467 service_add_extra_data(svc, "result", ad->view_type_string);
1468 ug_send_result(ad->ug, svc);
1469 SETTING_TRACE("Send Result : %s\n", ad->view_type_string);
1471 service_destroy(svc);
1472 //ug_destroy_me(ad->ug);
1477 setting_password_ug_create_popup_notitle_nobtn(ad, _("IDS_COM_POP_ERROR"), TRUE);
1487 service_add_extra_data(svc, "result", ad->view_type_string);
1488 ug_send_result(ad->ug, svc);
1489 SETTING_TRACE("Send Result : %s\n", ad->view_type_string);
1491 service_destroy(svc);
1492 /* Send destroy request */
1493 ug_destroy_me(ad->ug);