tizen 2.4 release
[apps/home/settings.git] / setting-security / src / setting-security-sim-settings.c
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Contact: MyoungJune Park <mj2004.park@samsung.com>
7  *
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  *
20  */
21 #include <setting-common-data-type.h>
22 #include <setting-common-data-slp-setting.h>
23 #include <setting-common-draw-widget.h>
24 #include <setting-common-view.h>
25
26 #include <setting-security-sim-settings.h>
27 #include <setting-security-main.h>
28 #include <setting-debug.h>
29
30 static int setting_security_sim_settings_create(void *cb);
31 static int setting_security_sim_settings_destroy(void *cb);
32 static int setting_security_sim_settings_update(void *cb);
33 static int setting_security_sim_settings_cleanup(void *cb);
34
35 setting_view setting_view_security_sim_settings = {
36         .create = setting_security_sim_settings_create,
37         .destroy = setting_security_sim_settings_destroy,
38         .update = setting_security_sim_settings_update,
39         .cleanup = setting_security_sim_settings_cleanup,
40 };
41
42 /* ***************************************************
43  **
44  **basic func
45  **
46  ****************************************************/
47
48 static int setting_security_sim_settings_create(void *cb)
49 {
50         SETTING_TRACE_BEGIN;
51         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
52
53         SettingSecurityUG *ad = (SettingSecurityUG *) cb;
54
55         Evas_Object *scroller;
56         Elm_Object_Item *item = NULL;
57
58         /* add basic layout */
59         setting_push_layout_navi_bar_genlist(ad->win_main_layout,
60                                              ad->win_get,
61                                              SECURITY_SIM_SETTINGS,
62                                              _("IDS_ST_BUTTON_BACK"), NULL,
63                                              (setting_call_back_func)setting_security_sim_settings_click_softkey_back_cb,
64                                              NULL, ad, &scroller, ad->navi_bar);
65
66         evas_object_smart_callback_add(scroller, "realized", __gl_realized_cb, NULL);
67
68         /* separator */
69         item = elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
70         elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
71
72         /* to do : sim settings menu */
73         /* g. pin lock */
74         /*if TAPI is responsed in time, ad->sim_status will have invalid value, */
75         /*or else ad->data_pin_lk will be updated by setting_security_sim_get_facility_cb */
76         ad->data_pin_lk = setting_create_Gendial_field_def(scroller, &itc_1text_1icon,
77                                                            setting_security_sim_settings_mouse_up_Gendial_list_cb, ad,
78                                                            SWALLOW_Type_1ICON_1RADIO,
79                                                            NULL, NULL,
80                                                            ad->pin1_status, "IDS_ST_BODY_PIN_LOCK", NULL, setting_security_sim_settings_chk_btn_cb);
81         if (ad->data_pin_lk) {
82                 ad->data_pin_lk->userdata = ad;
83         }
84         /* h. change pin1 */
85         ad->data_change_pin1 = setting_create_Gendial_field_def(scroller, &(ad->itc_1text),
86                                                                 setting_security_sim_settings_mouse_up_Gendial_list_cb, ad,
87                                                                 SWALLOW_Type_INVALID,
88                                                                 NULL, NULL,
89                                                                 0, "IDS_ST_HEADER_CHANGE_PIN_ABB", NULL, NULL);
90
91         if (ad->data_change_pin1) {
92                 ad->data_change_pin1->userdata = ad;
93         }
94
95         if (!ad->pin1_status) {
96                 if (ad->data_change_pin1) {
97                         setting_disable_genlist_item(ad->data_change_pin1->item);
98                 }
99         }
100
101         /* i. change pin2 */
102         if (ad->pin2_blocked_flag) {
103                 ad->data_change_pin2 = setting_create_Gendial_field_def(scroller, &(ad->itc_1text),
104                                                                         setting_security_sim_settings_mouse_up_Gendial_list_cb, ad,
105                                                                         SWALLOW_Type_INVALID,
106                                                                         NULL, NULL,
107                                                                         0, "IDS_CST_BODY_UNBLOCK_PIN2", NULL, NULL);
108         } else {
109                 ad->data_change_pin2 = setting_create_Gendial_field_def(scroller, &(ad->itc_1text),
110                                                                         setting_security_sim_settings_mouse_up_Gendial_list_cb, ad,
111                                                                         SWALLOW_Type_INVALID,
112                                                                         NULL, NULL,
113                                                                         0, "IDS_ST_BODY_CHANGE_PIN2", NULL, NULL);
114         }
115
116         if (ad->data_change_pin2) {
117                 ad->data_change_pin2->userdata = ad;
118         }
119
120 #if SUPPORT_FDN
121         /* j. FDN */
122         /*if TAPI is responsed in time, ad->sim_status will have invalid value, */
123         /*or else ad->data_fdn will be updated by setting_security_sim_get_facility_cb */
124         ad->data_fdn = setting_create_Gendial_field_def(scroller, &(ad->itc_1text_1icon),
125                                                         setting_security_sim_settings_mouse_up_Gendial_list_cb, ad,
126                                                         SWALLOW_Type_1TOGGLE,
127                                                         NULL, NULL,
128                                                         ad->pin2_status, Keystr_FDN, NULL, setting_security_sim_settings_chk_btn_cb);
129         if (ad->data_fdn)
130                 ad->data_fdn->userdata = ad;
131 #endif
132
133         evas_object_smart_callback_add(scroller, "realized", __gl_realized_cb, ad);
134
135         setting_view_security_sim_settings.is_create = 1;
136
137         return SETTING_RETURN_SUCCESS;
138
139 }
140
141 static int setting_security_sim_settings_destroy(void *cb)
142 {
143         SETTING_TRACE_BEGIN;
144         /* error check */
145         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
146
147         SettingSecurityUG *ad = (SettingSecurityUG *) cb;
148         if (ad->tapi_async_cb_check_timer) {
149                 ecore_timer_del(ad->tapi_async_cb_check_timer);
150                 ad->tapi_async_cb_check_timer = NULL;
151         }
152         /*elm_naviframe_item_pop(ad->navi_bar); */
153
154         setting_view_security_sim_settings.is_create = 0;
155
156         return SETTING_RETURN_SUCCESS;
157 }
158
159 static int setting_security_sim_settings_update(void *cb)
160 {
161         SETTING_TRACE_BEGIN;
162         /* error check */
163         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
164
165         SettingSecurityUG *ad = (SettingSecurityUG *) cb;
166         SETTING_TRACE("Update PIN menu");
167         if (ad->data_pin_lk) { /*it indicates TAPI is not responsed in time */
168                 /*setting_update_gl_item_chk_status(ad->data_pin_lk, ad->pin1_status); */
169                 ad->data_pin_lk->chk_status = ad->pin1_status;
170                 elm_genlist_item_fields_update(ad->data_pin_lk->item, "*", ELM_GENLIST_ITEM_FIELD_CONTENT);
171
172                 if (ad->data_pin_lk->chk_status == 0)
173                         setting_disable_genlist_item(ad->data_change_pin1->item);
174                 else
175                         setting_enable_genlist_item(ad->data_change_pin1->item);
176         }
177
178         if (ad->data_change_pin2 && ad->data_change_pin2->item) {
179                 if (ad->pin2_blocked_flag) {
180                         if (!safeStrCmp(ad->data_change_pin2->keyStr, "IDS_ST_BODY_CHANGE_PIN2")) {
181                                 ad->data_change_pin2->keyStr = (char *)g_strdup("IDS_CST_BODY_UNBLOCK_PIN2");
182                                 elm_object_item_data_set(ad->data_change_pin2->item, ad->data_change_pin2);
183                                 elm_genlist_item_update(ad->data_change_pin2->item);
184                         }
185                 } else {
186                         if (!safeStrCmp(ad->data_change_pin2->keyStr, "IDS_CST_BODY_UNBLOCK_PIN2")) {
187                                 ad->data_change_pin2->keyStr = (char *)g_strdup("IDS_ST_BODY_CHANGE_PIN2");
188                                 elm_object_item_data_set(ad->data_change_pin2->item, ad->data_change_pin2);
189                                 elm_genlist_item_update(ad->data_change_pin2->item);
190                         }
191                 }
192         }
193
194         return SETTING_RETURN_SUCCESS;
195 }
196
197 static int setting_security_sim_settings_cleanup(void *cb)
198 {
199         SETTING_TRACE_BEGIN;
200         /* error check */
201         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
202
203         SettingSecurityUG *ad = (SettingSecurityUG *) cb;
204         return setting_security_sim_settings_destroy(ad);
205 }
206
207 /* ***************************************************
208  **
209  **call back func
210  **
211  ****************************************************/
212
213 static void get_pin_lock_info_cb(TapiHandle *handle, int result, void *data, void *user_data)
214 {
215         SETTING_TRACE_BEGIN;
216
217         TelSimPinOperationResult_t sec_rt = result;
218         TelSimLockInfo_t *lock = data;
219
220         SettingSecurityUG *ad = (SettingSecurityUG *)user_data;
221
222         /* delete popup */
223         if (ad->sim_popup) {
224                 evas_object_del(ad->sim_popup);
225                 ad->sim_popup = NULL;
226         }
227         ad->enter_tapi_async_cb_flag = 1;
228
229         int old_state = ad->data_pin_lk->chk_status;/*elm_check_state_get(ad->data_pin_lk->eo_check); */
230         if (old_state) {
231                 SETTING_TRACE("Current status of PIN Lock is ON");
232                 ad->pw_type = SETTING_SEC_PW_PIN_LOCK_OFF;
233         } else {
234                 SETTING_TRACE("Current status of PIN Lock is OFF");
235                 ad->pw_type = SETTING_SEC_PW_PIN_LOCK_ON;
236         }
237
238         SETTING_TRACE_DEBUG("sec_ret[%d], lock_type[%d], lock_status[%d], retry_count[%d]", sec_rt, lock->lock_type, lock->lock_status, lock->retry_count);
239         if (lock->lock_status == 2) { /* PUK */
240                 SETTING_TRACE("Current status of PIN Lock is Blocked");
241                 ad->pw_type = SETTING_SEC_PW_PIN1_BLOCKED;
242         } else if (lock->lock_status == 5) { /* Blocked */
243                 setting_create_popup(NULL, ad->win_get,
244                                             NULL, _("PUK is blocked. Can't use PIN Lock"), NULL, 0, false, false, 0);
245                 return;
246         }
247
248         setting_security_create_password_sg(ad);
249 }
250
251 static Eina_Bool _check_tapi_async_cb_is_called(void *data)
252 {
253         SETTING_TRACE_BEGIN;
254         retv_if(data == NULL, EINA_FALSE);
255
256         SettingSecurityUG *ad = (SettingSecurityUG *)data;
257
258         if (!ad->enter_tapi_async_cb_flag) {
259                 ad->sim_popup = setting_create_popup(ad, ad->win_get,
260                                                                  NULL, KeyStr_Security_Waiting_Sim,
261                                                                  NULL,
262                                                                  0, TRUE, TRUE, 0);
263         }
264         ad->tapi_async_cb_check_timer = NULL;
265
266         return EINA_FALSE;
267 }
268
269 void _draw_pin_onoff_status(void *data, Evas_Object *check)
270 {
271         SETTING_TRACE("PIN Lock");
272
273         ret_if(data == NULL);
274
275         SettingSecurityUG *ad = (SettingSecurityUG *) data;
276         int value = 0;
277         int err = 0;
278         int ret = 0;
279
280         ad->sel_item = 0;       /* 0:click pin lock, 1:change pin1 code, 2:fdn, 3: change pin2 code */
281
282         ret = setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err);
283
284         ret = _handle_sim_exception(ad, value);
285         if (ret == SETTING_RETURN_FAIL)
286                 return;
287
288         /* check sim status */
289         int tapi_ret = TAPI_API_INVALID_INPUT;
290         TelSimCardType_t sim_card = TAPI_SIM_CARD_TYPE_UNKNOWN;
291
292         tapi_ret = tel_get_sim_type(ad->handle, &sim_card);
293         if (tapi_ret != TAPI_API_SUCCESS) {
294                 SETTING_TRACE_ERROR("tel_get_sim_type call failed with error code %d", tapi_ret);
295                 return;
296         }
297         SETTING_TRACE("SIM Type is %d", (int)sim_card);
298         if (sim_card == (TelSimCardType_t) TAPI_SIM_CARD_TYPE_UNKNOWN) {
299                 SETTING_TRACE_DEBUG
300                 ("%s*** [ERR] tel_get_sim_type. sim_card=%d ***%s",
301                  SETTING_FONT_RED, sim_card, SETTING_FONT_BLACK);
302                 setting_create_popup(NULL, ad->win_get,
303                                             NULL, _("IDS_SIM_BODY_INVALID_SIM_CARD"), NULL, 0, false, false, 0);
304                 return;
305         }
306
307         ad->enter_tapi_async_cb_flag = 0;
308         ad->sim_popup = NULL;
309         ad->tapi_async_cb_check_timer = ecore_timer_add(0.5, _check_tapi_async_cb_is_called, ad);
310
311         if (tel_get_sim_lock_info(ad->handle, TAPI_SIM_LOCK_SC, get_pin_lock_info_cb, ad) != 0) {
312                 SETTING_TRACE_ERROR("failed to call tel_get_sim_lock_info()");
313         }
314 }
315
316 static void get_sim_lock_info_cb(TapiHandle *handle, int result, void *data, void *user_data)
317 {
318         SETTING_TRACE_BEGIN;
319         ret_if(data == NULL || user_data == NULL);
320
321         TelSimPinOperationResult_t sec_rt = result;
322         TelSimLockInfo_t *lock = data;
323
324         SettingSecurityUG *ad = (SettingSecurityUG *)user_data;
325
326         /* delete popup */
327         if (ad->sim_popup) {
328                 evas_object_del(ad->sim_popup);
329                 ad->sim_popup = NULL;
330         }
331
332         int old_state = ad->data_sim_lk->chk_status;/*elm_check_state_get(ad->data_sim_lk->eo_check); */
333         if (old_state) {
334                 SETTING_TRACE("Current status of SIM Lock is ON");
335                 ad->pw_type = SETTING_SEC_PW_SIM_LOCK_OFF;
336         } else {
337                 SETTING_TRACE("Current status of SIM Lock is OFF");
338                 ad->pw_type = SETTING_SEC_PW_SIM_LOCK_ON;
339         }
340
341         SETTING_TRACE_DEBUG("sec_ret[%d], lock_type[%d], lock_status[%d], retry_count[%d]", sec_rt, lock->lock_type, lock->lock_status, lock->retry_count);
342
343         if (lock->lock_status == 5) { /* Blocked */
344                 setting_create_popup(NULL, ad->win_get,
345                                             NULL, _("SIM is blocked. Can't use SIM Lock"), NULL, 0, false, false, 0);
346                 return;
347         }
348
349         setting_security_create_password_sg(ad);
350 }
351
352 void _draw_sim_onoff_status(void *data, Evas_Object *check)
353 {
354         ret_if(data == NULL);
355
356         SettingSecurityUG *ad = (SettingSecurityUG *) data;
357         int value = 0;
358         int err = 0;
359         int ret = 0;
360
361         ret = setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err);
362         ret = _handle_sim_exception(ad, value);
363         if (ret == SETTING_RETURN_FAIL)
364                 return;
365
366         /* create popup */
367         if (ad->sim_popup) {
368                 evas_object_del(ad->sim_popup);
369                 ad->sim_popup = NULL;
370         }
371         ad->sim_popup = setting_create_popup(ad, ad->win_get,
372                                                          NULL, KeyStr_Security_Waiting_Sim,
373                                                          NULL,
374                                                          0, FALSE, FALSE, 0);
375
376         if (tel_get_sim_lock_info(ad->handle, TAPI_SIM_LOCK_PS, get_sim_lock_info_cb, ad) != 0) {
377                 SETTING_TRACE_ERROR("failed to call tel_get_sim_lock_info()");
378         }
379 }
380
381 static void get_change_pin_info_cb(TapiHandle *handle, int result, void *data, void *user_data)
382 {
383         SETTING_TRACE_BEGIN;
384         ret_if(data == NULL || user_data == NULL);
385
386         TelSimPinOperationResult_t sec_rt = result;
387         TelSimLockInfo_t *lock = data;
388
389         SettingSecurityUG *ad = (SettingSecurityUG *)user_data;
390
391         SETTING_TRACE_DEBUG("sec_ret[%d], lock_type[%d], lock_status[%d], retry_count[%d]", sec_rt, lock->lock_type, lock->lock_status, lock->retry_count);
392         if (lock->lock_type == TAPI_SIM_LOCK_SC && lock->lock_status == TAPI_SIM_LOCK_KEY_PUK) { /* PUK required : 0x02*/
393                 SETTING_TRACE("Current status of PIN Lock is Blocked");
394                 ad->pw_type = SETTING_SEC_PW_PIN1_BLOCKED;
395         } else if (lock->lock_type == TAPI_SIM_LOCK_SC &&
396                    (lock->lock_status == TAPI_SIM_LOCK_KEY_NOT_NEED || lock->lock_status == TAPI_SIM_LOCK_KEY_PIN)) { /* PIN required : 0x00, 0x01 */
397                 ad->pw_type = SETTING_SEC_PW_CHANGE_PIN1;
398         } else if (lock->lock_type == TAPI_SIM_LOCK_FD && lock->lock_status == TAPI_SIM_LOCK_KEY_PUK2) { /* PUK2 required : 0x04 */
399                 SETTING_TRACE("Current status of Change PIN2 is Blocked");
400                 ad->pw_type = SETTING_SEC_PW_PIN2_BLOCKED;
401         } else if (lock->lock_type == TAPI_SIM_LOCK_FD &&
402                    (lock->lock_status == TAPI_SIM_LOCK_KEY_NOT_NEED || lock->lock_status == TAPI_SIM_LOCK_KEY_PIN2)) { /* PIN2 required : 0x00, 0x03 */
403                 ad->pw_type = SETTING_SEC_PW_CHANGE_PIN2;
404         } else if (lock->lock_status == TAPI_SIM_LOCK_PERM_BLOCKED) { /* Blocked : 0x05 */
405                 setting_create_popup(NULL, ad->win_get,
406                                             NULL, _("Permanent block SIM"), NULL, 0, false, false, 0);
407                 return;
408         }
409
410         setting_security_create_password_sg(ad);
411 }
412
413 void _mouse_up_change_pin(void *data, int sel_item)
414 {
415         ret_if(data == NULL);
416
417         SettingSecurityUG *ad = (SettingSecurityUG *) data;
418
419         ad->sel_item = sel_item;        /* 0:click pin lock, 1:change pin1 code, 2:fdn, 3: change pin2 code */
420         int ret;
421         int value = 0;
422         int err;
423
424         ret = setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err);
425         setting_retm_if(ret != 0, "failed to read vconf value");
426         switch (value) {
427                 case VCONFKEY_TELEPHONY_SIM_INSERTED:
428                         break;
429                 case VCONFKEY_TELEPHONY_SIM_NOT_PRESENT:
430                         setting_create_popup(NULL, ad->win_get,
431                                                     NULL, _(SECURITY_SIM_NOT_PRESENT_MSG), NULL, 0, false, false, 0);
432                         SETTING_TRACE_DEBUG
433                         ("%s*** [ERR] INCORRECTED SIM. sim_slot_type=%d ***%s",
434                          SETTING_FONT_RED, value, SETTING_FONT_BLACK);
435                         return;
436                         break;
437                 case VCONFKEY_TELEPHONY_SIM_CARD_ERROR:
438                 case VCONFKEY_TELEPHONY_SIM_UNKNOWN:
439                         setting_create_popup(NULL, ad->win_get,
440                                                     NULL, _("IDS_SIM_BODY_INVALID_SIM_CARD"), NULL, 0, false, false, 0);
441                         SETTING_TRACE_DEBUG
442                         ("%s*** [ERR] INCORRECTED SIM. sim_slot_type=%d ***%s",
443                          SETTING_FONT_RED, value, SETTING_FONT_BLACK);
444                         return;
445                         break;
446                 default:
447                         break;
448         }
449
450         /* check sim status */
451         TapiResult_t tapi_ret = TAPI_API_INVALID_INPUT;
452         TelSimCardType_t sim_card = TAPI_SIM_CARD_TYPE_UNKNOWN;
453
454         tapi_ret = tel_get_sim_type(ad->handle, &sim_card);
455         if (tapi_ret != TAPI_API_SUCCESS) {
456                 SETTING_TRACE_ERROR("tel_get_sim_type call failed with error code %d", tapi_ret);
457                 return;
458         }
459         if (sim_card == (TelSimCardType_t) SETTING_TAPI_UNKNOWN_SIM_TYPE) {
460                 SETTING_TRACE_DEBUG
461                 ("%s*** [ERR] tel_get_sim_type. sim_card=%d ***%s",
462                  SETTING_FONT_RED, sim_card, SETTING_FONT_BLACK);
463                 setting_create_popup(NULL, ad->win_get,
464                                             NULL, _("IDS_SIM_BODY_INVALID_SIM_CARD"), NULL, 0, false, false, 0);
465                 return;
466         }
467         if (sel_item == 1 && (ad->pin1_status == TAPI_SIM_FACILITY_ENABLED)) {
468                 if (tel_get_sim_lock_info(ad->handle, TAPI_SIM_LOCK_SC, get_change_pin_info_cb, ad) != 0) {
469                         SETTING_TRACE_ERROR("failed to call tel_get_sim_lock_info()");
470                 }
471         } else if (sel_item == 3) {
472                 if (tel_get_sim_lock_info(ad->handle, TAPI_SIM_LOCK_FD, get_change_pin_info_cb, ad) != 0) {
473                         SETTING_TRACE_ERROR("failed to call tel_get_sim_lock_info()");
474                 }
475                 /*ad->pw_type = SETTING_SEC_PW_CHANGE_PIN2; */
476                 /*setting_security_create_password_sg(ad); */
477         }
478 }
479
480 static void
481 setting_security_sim_settings_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj,
482                                                        void *event_info)
483 {
484         SETTING_TRACE_BEGIN;
485         /* error check */
486         setting_retm_if(data == NULL, "Data parameter is NULL");
487
488         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
489         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
490         elm_genlist_item_selected_set(item, 0);
491         Setting_GenGroupItem_Data *list_item =
492             (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
493         setting_retm_if(NULL == list_item, "list_item is NULL");
494
495         SettingSecurityUG *ad = (SettingSecurityUG *) data;
496
497         SETTING_TRACE("clicking item[%s]", _(list_item->keyStr));
498         if (!safeStrCmp("IDS_ST_BODY_PIN_LOCK", list_item->keyStr)) {
499                 _draw_pin_onoff_status(ad, list_item->eo_check);
500
501         } else if (!safeStrCmp("IDS_ST_HEADER_CHANGE_PIN_ABB", list_item->keyStr)) {
502                 _mouse_up_change_pin(ad, 1); /* 0:click pin lock, 1:change pin1 code, 2:fdn, 3: change pin2 code */
503         } else if (!safeStrCmp("IDS_ST_BODY_CHANGE_PIN2", list_item->keyStr)) {
504                 _mouse_up_change_pin(ad, 3); /* 0:click pin lock, 1:change pin1 code, 2:fdn, 3: change pin2 code */
505         } else if (!safeStrCmp("IDS_CST_BODY_UNBLOCK_PIN2", list_item->keyStr)) {
506                 ad->pw_type = SETTING_SEC_PW_PIN2_BLOCKED;
507                 setting_security_create_password_sg(ad);
508         }
509 }
510
511 static void
512 setting_security_sim_settings_chk_btn_cb(void *data, Evas_Object *obj,
513                                          void *event_info)
514 {
515         SETTING_TRACE_BEGIN;
516         /* error check */
517         retm_if(data == NULL, "[Setting > Reset] Data parameter is NULL");
518         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
519         SettingSecurityUG *ad = list_item->userdata;
520
521         list_item->chk_status = elm_check_state_get(obj);       /*  for genlist update status */
522         if (!safeStrCmp("IDS_ST_BODY_PIN_LOCK", list_item->keyStr)) {
523                 /*Rollback state of toggle. */
524                 /*it invokes async TAPIs to enable/disable, so don't change the status at first to avoid rollback */
525                 /*setting_update_gl_item_chk_status(list_item, !(list_item->chk_status)); */
526                 list_item->chk_status = !(list_item->chk_status);
527                 _draw_pin_onoff_status(ad, obj);
528
529         }
530 #if SUPPORT_FDN
531         else if (!safeStrCmp(Keystr_FDN, list_item->keyStr)) {
532                 /*Rollback state of toggle. */
533                 /*it invokes async TAPIs to enable/disable, so don't change the status at first to avoid rollback */
534                 setting_update_gl_item_chk_status(list_item, !(list_item->chk_status));
535                 ad->chk_fdn = obj;
536                 _draw_fdn_onoff_status(ad, obj);
537         }
538 #endif
539 }
540
541
542 /*static void */
543 /*setting_security_sim_settings_click_softkey_back_cb(void *data, Evas_Object *obj, */
544 /*                                          void *event_info) */
545 Eina_Bool setting_security_sim_settings_click_softkey_back_cb(void *data, Elm_Object_Item *it)
546 {
547         SETTING_TRACE_BEGIN;
548         /* error check */
549         retv_if(data == NULL, EINA_FALSE);
550
551         SettingSecurityUG *ad = (SettingSecurityUG *) data;
552         if (ad->ug_passwd)
553                 return EINA_FALSE;
554
555         if (ad->sim_popup) {
556                 return EINA_FALSE;
557         }
558
559         setting_view_change(&setting_view_security_sim_settings, &setting_view_security_main, ad);
560
561         return EINA_TRUE;
562         SETTING_TRACE_END;
563 }