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