remove elm_win_resize_object_add() API except for conformant object
[apps/core/preloaded/settings.git] / setting-security / src / setting-security.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
22 /**
23  *@defgroup setting-security
24  *UG creation code for setting-security
25  */
26
27 #include <setting-security.h>
28 #define Max_Passwd_View_Type_Len        64
29 #ifndef UG_MODULE_API
30 #define UG_MODULE_API __attribute__ ((visibility("default")))
31 #endif
32
33
34 int pwd_handler_do_nothing(SettingSecurityUG *data, void* arg)
35 {
36         SETTING_TRACE_BEGIN;
37         //SettingSecurityUG *ad = (SettingSecurityUG *)data;
38         // DO NOTHING
39         return 0;
40 }
41
42 int pwd_handler_sec_pw_sim_lock_on(SettingSecurityUG *data, void* arg)
43 {
44         SETTING_TRACE_BEGIN;
45         SettingSecurityUG *ad = (SettingSecurityUG *)data;
46         if (tel_get_sim_facility(ad->handle, TAPI_SIM_LOCK_PS, setting_security_sim_get_facility_cb, ad) != TAPI_API_SUCCESS)
47         {
48                 SETTING_TRACE_ERROR("tel_get_sim_facility(TAPI_SIM_LOCK_PS) failed");
49         }
50         return 0;
51 }
52
53
54 int pwd_handler_sec_pw_sim_lock_off(SettingSecurityUG *data, void* arg)
55 {
56         SETTING_TRACE_BEGIN;
57         SettingSecurityUG *ad = (SettingSecurityUG *)data;
58         if (tel_get_sim_facility(ad->handle, TAPI_SIM_LOCK_PS, setting_security_sim_get_facility_cb, ad) != TAPI_API_SUCCESS)
59         {
60                 SETTING_TRACE_ERROR("tel_get_sim_facility(TAPI_SIM_LOCK_PS) failed");
61         }
62         return 0;
63 }
64
65
66 int pwd_handler_sec_pw_pin_lock_on(SettingSecurityUG *data, void* arg)
67 {
68         SETTING_TRACE_BEGIN;
69         SettingSecurityUG *ad = (SettingSecurityUG *)data;
70         if (tel_get_sim_facility(ad->handle, TAPI_SIM_LOCK_SC, setting_security_pin_get_facility_cb, ad) != TAPI_API_SUCCESS)
71         {
72                 SETTING_TRACE_ERROR("tel_get_sim_facility(TAPI_SIM_LOCK_PS) failed");
73         }
74         return 0;
75 }
76
77
78 int pwd_handler_sec_pw_pin_lock_off(SettingSecurityUG *data, void* arg)
79 {
80         SETTING_TRACE_BEGIN;
81         SettingSecurityUG *ad = (SettingSecurityUG *)data;
82         if (tel_get_sim_facility(ad->handle, TAPI_SIM_LOCK_SC, setting_security_pin_get_facility_cb, ad) != TAPI_API_SUCCESS)
83         {
84                 SETTING_TRACE_ERROR("tel_get_sim_facility(TAPI_SIM_LOCK_PS) failed");
85         }
86         return 0;
87 }
88
89
90 int pwd_handler_sec_pw_sim_lock_disabled(SettingSecurityUG *data, void* arg)
91 {
92         SETTING_TRACE_BEGIN;
93         SettingSecurityUG *ad = (SettingSecurityUG *)data;
94         // [in] Evas_Object *checkbtn
95         if (ad->data_sim_lk)
96                 setting_disable_genlist_item(ad->data_sim_lk->item);
97
98         return 0;
99 }
100
101
102 int pwd_handler_sec_pw_change_pin1(SettingSecurityUG *data, void* arg)
103 {
104         SETTING_TRACE_BEGIN;
105         SettingSecurityUG *ad = (SettingSecurityUG *)data;
106         if (tel_get_sim_facility(ad->handle, TAPI_SIM_LOCK_SC, setting_security_pin_get_facility_cb, ad) != TAPI_API_SUCCESS)
107         {
108                 SETTING_TRACE_ERROR("tel_get_sim_facility(TAPI_SIM_LOCK_PS) failed");
109         }
110         return 0;
111 }
112
113 int pwd_handler_sec_pw_change_pin2(SettingSecurityUG *data, void* arg)
114 {
115         SETTING_TRACE_BEGIN;
116         return 0;
117 }
118
119
120 int pwd_handler_sec_pw_pin1_blocked(SettingSecurityUG *data, void* arg)
121 {
122         SETTING_TRACE_BEGIN;
123         SettingSecurityUG *ad = (SettingSecurityUG *)data;
124 #if DISABLED_CODE
125         if (tel_get_sim_facility(ad->handle, TAPI_SIM_LOCK_SC, setting_security_sim_get_facility_cb, ad) != TAPI_API_SUCCESS)
126         {
127                 SETTING_TRACE_ERROR("tel_get_sim_facility(TAPI_SIM_LOCK_PS) failed");
128         }
129 #endif
130         return 0;
131 }
132
133
134 int pwd_handler_sec_pw_pin2_blocked(SettingSecurityUG *data, void* arg)
135 {
136         SETTING_TRACE_BEGIN;
137         SettingSecurityUG *ad = (SettingSecurityUG *)data;
138 #if SUPPORT_FDN
139         if (tel_get_sim_facility(ad->handle, TAPI_SIM_LOCK_FD, setting_security_sim_get_facility_cb, ad) != TAPI_API_SUCCESS)
140         {
141                 SETTING_TRACE_ERROR("tel_get_sim_facility(TAPI_SIM_LOCK_PS) failed");
142         }
143 #endif
144
145         return 0;
146 }
147
148 static struct _security_item security_table[] = {
149         { SETTING_SEC_PW_SIM_LOCK_ON,           "SETTING_PW_TYPE_SIM_LOCK_ON",                  pwd_handler_sec_pw_sim_lock_on },
150         { SETTING_SEC_PW_SIM_LOCK_OFF,          "SETTING_PW_TYPE_SIM_LOCK_OFF",                 pwd_handler_sec_pw_sim_lock_off },
151         { SETTING_SEC_PW_SIM_LOCK_DISABLED, "SETTING_PW_TYPE_SIM_LOCK_DISABLE",         pwd_handler_sec_pw_sim_lock_disabled},
152         { SETTING_SEC_PW_PIN_LOCK_ON,           "SETTING_PW_TYPE_PIN_LOCK_ON",                  pwd_handler_sec_pw_pin_lock_on },
153         { SETTING_SEC_PW_PIN_LOCK_OFF,          "SETTING_PW_TYPE_PIN_LOCK_OFF",                 pwd_handler_sec_pw_pin_lock_off },
154         { SETTING_SEC_PW_CHANGE_PIN1,           "SETTING_PW_TYPE_CHANGE_PIN1",                  pwd_handler_sec_pw_change_pin1},
155         { SETTING_SEC_PW_CHANGE_PIN2,           "SETTING_PW_TYPE_CHANGE_PIN2",                  pwd_handler_sec_pw_change_pin2},
156         { SETTING_SEC_PW_PIN1_BLOCKED,          "SETTING_PW_TYPE_PIN1_BLOCKED",                 pwd_handler_sec_pw_pin1_blocked},
157         { SETTING_SEC_PW_PIN2_BLOCKED,          "SETTING_PW_TYPE_PIN2_BLOCKED",                 pwd_handler_do_nothing},
158         { SETTING_SEC_PW_PIN1_UNBLOCKED,                "SETTING_PW_TYPE_PIN1_UNBLOCKED",               pwd_handler_sec_pw_pin_lock_on},
159         { SETTING_SEC_PW_PIN2_UNBLOCKED,                "SETTING_PW_TYPE_PIN2_UNBLOCKED",               pwd_handler_do_nothing},
160         /*------------------------------------------------------------------------------------------------------------*/
161         { SETTING_SEC_PW_MAX,                           NULL,                                                                   pwd_handler_do_nothing}
162 };
163
164 static void setting_security_ug_cb_resize(void *data, Evas *e,
165                                           Evas_Object *obj, void *event_info)
166 {
167         ret_if(data == NULL);
168
169         SettingSecurityUG *ad = (SettingSecurityUG *) data;     /* ad is point to data */
170         setting_view_update(&setting_view_security_main, ad);
171 }
172
173 static void *setting_security_ug_on_create(ui_gadget_h ug,
174                                            enum ug_mode mode, service_h service,
175                                            void *priv)
176 {
177         setting_retvm_if((!priv), NULL, "!priv");
178
179         SettingSecurityUG *securityUG = priv;
180         securityUG->ug = ug;
181
182         securityUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug);
183         securityUG->win_get = (Evas_Object *) ug_get_window();
184         evas_object_show(securityUG->win_main_layout);
185         securityUG->evas = evas_object_evas_get(securityUG->win_main_layout);
186
187         setting_retvm_if(securityUG->win_main_layout == NULL, NULL,
188                          "[Setting >> Security] cannot get main window ");
189
190         setting_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR);
191
192         /* register view node table */
193         setting_view_node_table_intialize();
194         setting_view_node_table_register(&setting_view_security_main, NULL);
195         setting_view_node_table_register(&setting_view_security_sim_settings, &setting_view_security_main);
196
197         setting_create_Gendial_itc("dialogue/1text", &(securityUG->itc_1text));
198         setting_create_Gendial_itc("dialogue/2text.3", &(securityUG->itc_2text_2));
199         setting_create_Gendial_itc("dialogue/1text.1icon", &(securityUG->itc_1text_1icon));
200
201         securityUG->itc_seperator.item_style = "dialogue/separator";
202         securityUG->itc_seperator.func.text_get = NULL;
203         securityUG->itc_seperator.func.content_get = NULL;
204         securityUG->itc_seperator.func.state_get = NULL;
205         securityUG->itc_seperator.func.del = NULL;
206
207         securityUG->update_view_timer = NULL;
208         /*  creating a view. */
209         securityUG->handle =  tel_init(NULL);
210         if (!securityUG->handle) {
211                 SETTING_TRACE_ERROR("*** [ERR] tel_init. ***");
212                 //return NULL;
213         }
214         else {
215                 if (TAPI_API_SUCCESS != tel_get_sim_facility(securityUG->handle, TAPI_SIM_LOCK_PS, setting_security_sim_get_facility_cb, securityUG)) {
216                         SETTING_TRACE_ERROR("*** [ERR] tel_get_sim_facility(sim_status). ***");
217                 }
218
219                 if (TAPI_API_SUCCESS != tel_get_sim_facility(securityUG->handle, TAPI_SIM_LOCK_SC, setting_security_sim_get_facility_cb, securityUG)) {
220                         SETTING_TRACE_ERROR("*** [ERR] tel_get_sim_facility(pin1). ***");
221                 }
222         }
223
224         setting_view_node_set_cur_view(&setting_view_security_main);
225         setting_view_create(&setting_view_security_main, (void *)securityUG);
226         evas_object_event_callback_add(securityUG->win_main_layout,
227                                        EVAS_CALLBACK_RESIZE,
228                                        setting_security_ug_cb_resize,
229                                        securityUG);
230
231         return securityUG->ly_main;
232 }
233
234 static void setting_security_ug_on_start(ui_gadget_h ug, service_h service,
235                                          void *priv)
236 {
237 }
238
239 static void setting_security_ug_on_pause(ui_gadget_h ug, service_h service,
240                                          void *priv)
241 {
242 }
243
244 static void setting_security_ug_on_resume(ui_gadget_h ug, service_h service,
245                                           void *priv)
246 {
247 }
248
249 static void setting_security_ug_on_destroy(ui_gadget_h ug, service_h service,
250                                            void *priv)
251 {
252         setting_retm_if((!priv), "!priv");
253         SettingSecurityUG *securityUG = priv;
254
255         evas_object_event_callback_del(securityUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_security_ug_cb_resize);       /* fix flash issue for gallery */
256         securityUG->ug = ug;
257         if (securityUG->handle && tel_deinit(securityUG->handle) != TAPI_API_SUCCESS) {
258                 SETTING_TRACE_DEBUG
259                     ("%s*** [ERR] setting_network_unsubscribe_tapi_events. ***%s",
260                      SETTING_FONT_RED, SETTING_FONT_BLACK);
261         }
262
263         /*  delete the allocated objects. */
264         if (TRUE == setting_view_security_sim_settings.is_create) {
265                 setting_view_destroy(&setting_view_security_sim_settings, securityUG);
266         }
267         if (TRUE == setting_view_security_main.is_create) {
268                 setting_view_destroy(&setting_view_security_main, securityUG);
269         }
270
271         if (NULL != ug_get_layout(securityUG->ug)) {
272                 evas_object_hide((Evas_Object *) ug_get_layout(securityUG->ug));
273                 evas_object_del((Evas_Object *) ug_get_layout(securityUG->ug));
274         }
275 }
276
277 static void setting_security_ug_on_message(ui_gadget_h ug, service_h msg,
278                                            service_h service, void *priv)
279 {
280
281 }
282
283 static void setting_security_ug_on_event(ui_gadget_h ug,
284                                          enum ug_event event, service_h service,
285                                          void *priv)
286 {
287         switch (event) {
288         case UG_EVENT_LOW_MEMORY:
289                 break;
290         case UG_EVENT_LOW_BATTERY:
291                 break;
292         case UG_EVENT_LANG_CHANGE:
293                 break;
294         case UG_EVENT_ROTATE_PORTRAIT:
295                 break;
296         case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
297                 break;
298         case UG_EVENT_ROTATE_LANDSCAPE:
299                 break;
300         case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
301                 break;
302         case UG_EVENT_REGION_CHANGE:
303                 break;
304         default:
305                 break;
306         }
307 }
308
309 static void setting_security_ug_on_key_event(ui_gadget_h ug,
310                                              enum ug_key_event event,
311                                              service_h service, void *priv)
312 {
313         if (!priv)
314                 return;
315         SettingSecurityUG *ad = (SettingSecurityUG *) priv;     /* ad is point to priv */
316         switch (event) {
317         case UG_KEY_EVENT_END:
318                 {
319                         if (elm_naviframe_top_item_get(ad->navi_bar) ==
320                            elm_naviframe_bottom_item_get(ad->navi_bar)) {
321                                 ug_destroy_me(ug);
322                         } else {
323                                 /* elm_naviframe_item_pop(ad->navi_bar); */
324                                 setting_view_cb_at_endKey(ad);
325                         }
326                 }
327                 break;
328
329         default:
330                 break;
331         }
332 }
333
334 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
335 {
336         SettingSecurityUG *securityUG = calloc(1, sizeof(SettingSecurityUG));
337         setting_retvm_if(!securityUG, -1,
338                          "Create SettingSecurityUG obj failed");
339
340         ops->create = setting_security_ug_on_create;
341         ops->start = setting_security_ug_on_start;
342         ops->pause = setting_security_ug_on_pause;
343         ops->resume = setting_security_ug_on_resume;
344         ops->destroy = setting_security_ug_on_destroy;
345         ops->message = setting_security_ug_on_message;
346         ops->event = setting_security_ug_on_event;
347         ops->key_event = setting_security_ug_on_key_event;
348         ops->priv = securityUG;
349         ops->opt = UG_OPT_INDICATOR_ENABLE;
350
351         return 0;
352 }
353
354 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
355 {
356         struct SettingSecurityUG *securityUG;
357         setting_retm_if(!ops, "ops == NULL");
358
359         securityUG = ops->priv;
360         if (securityUG)
361                 FREE(securityUG);
362 }
363
364 /* ***************************************************
365  *
366  *general func
367  *
368  ***************************************************/
369 void setting_security_sim_get_facility_cb(TapiHandle *handle, int result, void *data, void *user_data)
370 {
371         SETTING_TRACE_BEGIN;
372
373         ret_if(!user_data);
374         SETTING_TRACE_DEBUG("user_data is not NULL");
375
376         ret_if(!data);
377         SETTING_TRACE_DEBUG("data is not NULL");
378
379         TelSimPinOperationResult_t sec_rt = result;
380         TelSimFacilityInfo_t *fi = data;
381         SettingSecurityUG *ad = user_data;
382
383
384         if(ad->sim_popup)
385         {
386                 evas_object_del(ad->sim_popup);
387                 ad->sim_popup = NULL;
388         }
389
390         SETTING_TRACE("sec_rt[%d]", sec_rt);
391         SETTING_TRACE("fi->type[%d]", fi->type);
392         SETTING_TRACE("fi->f_status[%d]", fi->f_status);
393         if (sec_rt == TAPI_SIM_PIN_OPERATION_SUCCESS)
394         {
395                 SETTING_TRACE_DEBUG("PIN_OPERATION_SUCCESS");
396                 switch (fi->type)
397                 {
398                     case TAPI_SIM_LOCK_PS://sim status
399                         ad->sim_status = fi->f_status;
400                         break;
401                     default:
402                         break;
403                 }
404         }
405         else
406         {
407                 //if failed, do nothing..
408         }
409
410         /* Update SIM Settings view if created. */
411         if(setting_view_security_sim_settings.is_create == 1)
412         {
413                 SETTING_TRACE_DEBUG("SIM settings view is already created. [%d]", setting_view_security_sim_settings.is_create);
414                 setting_view_update(&setting_view_security_sim_settings, ad);
415         }
416         else
417         {
418                 SETTING_TRACE_DEBUG("Change view");
419                 setting_view_change(&setting_view_security_main, &setting_view_security_sim_settings, ad);
420         }
421
422         SETTING_TRACE_END;
423 }
424
425 void setting_security_pin_get_facility_cb(TapiHandle *handle, int result, void *data, void *user_data)
426 {
427         SETTING_TRACE_BEGIN;
428
429         ret_if(!user_data);
430         SETTING_TRACE_DEBUG("user_data is not NULL");
431
432         ret_if(!data);
433         SETTING_TRACE_DEBUG("data is not NULL");
434
435         TelSimPinOperationResult_t sec_rt = result;
436         TelSimFacilityInfo_t *fi = data;
437         SettingSecurityUG *ad = user_data;
438
439         if(ad->sim_popup)
440         {
441                 evas_object_del(ad->sim_popup);
442                 ad->sim_popup = NULL;
443         }
444
445         SETTING_TRACE("sec_rt[%d]", sec_rt);
446         SETTING_TRACE("fi->type[%d]", fi->type);
447         SETTING_TRACE("fi->f_status[%d]", fi->f_status);
448         if (sec_rt == TAPI_SIM_PIN_OPERATION_SUCCESS)
449         {
450                 SETTING_TRACE_DEBUG("PIN_OPERATION_SUCCESS");
451                 switch (fi->type)
452                 {
453                     case TAPI_SIM_LOCK_SC://pin1 status
454                         ad->pin1_status = fi->f_status;
455                         break;
456                     case TAPI_SIM_LOCK_FD://pin2/fdn status
457                         ad->pin2_status = fi->f_status;
458                         break;
459                     default:
460                         break;
461                 }
462         }
463         else
464         {
465                 //if failed, do nothing..
466         }
467
468         /* Update SIM Settings view if created. */
469         if(setting_view_security_sim_settings.is_create == 1)
470         {
471                 SETTING_TRACE_DEBUG("SIM settings view is already created. [%d]", setting_view_security_sim_settings.is_create);
472                 setting_view_update(&setting_view_security_sim_settings, ad);
473         }
474         else
475         {
476                 SETTING_TRACE_DEBUG("Change view");
477                 setting_view_change(&setting_view_security_main, &setting_view_security_sim_settings, ad);
478         }
479
480         SETTING_TRACE_END;
481 }
482
483 void setting_security_layout_passwd_ug_cb(ui_gadget_h ug,
484                                                  enum ug_mode mode, void *priv)
485 {
486         if (!priv)
487                 return;
488
489         SettingSecurityUG *ad = (SettingSecurityUG *) priv;
490         Evas_Object *base = ug_get_layout(ug);
491         if (!base)
492                 return;
493
494         switch (mode) {
495         case UG_MODE_FULLVIEW:
496                 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
497                                                  EVAS_HINT_EXPAND);
498                 //elm_win_resize_object_add(ad->win_get, base);
499                 evas_object_show(base);
500                 break;
501         default:
502                 break;
503         }
504
505         return;
506 }
507
508 void setting_security_destroy_password_ug_cb(ui_gadget_h ug,
509                                                     void *priv)
510 {
511         SETTING_TRACE_BEGIN;
512         ret_if(priv == NULL);
513         SettingSecurityUG *ad = (SettingSecurityUG *) priv;
514         if (ug) {
515                 ug_destroy(ug);
516                 ad->ug_passwd = NULL;
517         }
518 }
519
520 gboolean setting_security_create_password_sg(void *data)
521 {
522         SETTING_TRACE_BEGIN;
523         /* error check */
524         retv_if(data == NULL, FALSE);
525
526         SettingSecurityUG *ad = (SettingSecurityUG *) data;     /* ad is point to data */
527
528         /* prevent the ug from being loaded again due to window event queuing */
529         /* added by JTS: CQ H0100135346 */
530         if (ad->ug_passwd) {
531                 SETTING_TRACE("Password UG is already loaded.");
532                 return FALSE;
533         }
534
535         if((ad->pw_type < 0) || (ad->pw_type > SETTING_SEC_PW_MAX))
536                 return FALSE;
537
538         char str[Max_Passwd_View_Type_Len + 1] = { 0, };
539         safeCopyStr(str, security_table[ad->pw_type].pw_type_string, Max_Passwd_View_Type_Len);
540
541         struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
542
543         if (!cbs)
544                 return FALSE;
545         cbs->layout_cb = setting_security_layout_passwd_ug_cb;
546         cbs->result_cb = setting_security_result_password_ug_cb;
547         cbs->destroy_cb = setting_security_destroy_password_ug_cb;
548         cbs->priv = (void *)ad;
549
550         service_h svc;
551         if (service_create(&svc)) {
552                 FREE(cbs);
553                 return FALSE;
554         }
555
556         service_add_extra_data(svc, "viewtype", str);
557         if(ad->input_pwd)
558         {
559                 SETTING_TRACE_DEBUG("Send current : %s", ad->input_pwd);
560                 service_add_extra_data(svc, "current", ad->input_pwd);
561         }
562         ad->ug_passwd = ug_create(ad->ug, "setting-password-efl", UG_MODE_FULLVIEW, svc, cbs);
563         if (NULL == ad->ug_passwd) {    /* error handling */
564                 evas_object_show(ad->ly_main);
565         }
566
567         service_destroy(svc);
568         FREE(cbs);
569
570         return TRUE;
571 }
572
573 /* ***************************************************
574  *
575  *call back func
576  *
577  ***************************************************/
578 // -1   on fail
579 // 0~n  on success
580 int _get_security_table_index(char* name)
581 {
582         int i=0;
583
584         for(i=0;i<SETTING_SEC_PW_MAX;i++)
585         {
586                 if (0 == safeStrCmp(name, security_table[i].pw_type_string))
587                         return i;
588         }
589         return -1;
590 }
591
592 void
593 setting_security_result_password_ug_cb(ui_gadget_h ug, service_h service,
594                                        void *priv)
595 {
596         SETTING_TRACE_BEGIN;
597         /* error check */
598         retm_if(priv == NULL, "Data paremeter is NULL");
599
600         SettingSecurityUG *ad = (SettingSecurityUG *) priv;     /* ad is point to priv */
601
602         char *result = NULL;
603         char *current = NULL;
604
605         service_get_extra_data(service, "result", &result);
606         service_get_extra_data(service, "current", &current);
607
608         /* divided pw view type */
609         SETTING_TRACE("ad->pw_type: %d result :%s", ad->pw_type, result);
610         ret_if(NULL == result);
611
612         if(safeStrCmp(result, "Cancel") == 0)
613         {
614                 /* To do : rollback previouse status. */
615         }
616         else
617         {
618                 int index =  _get_security_table_index(result);
619                 int ret;
620                 if (index != -1)
621                 {
622                         ret = security_table[index].passwd_handler(ad, NULL);
623                 } else {
624                         SETTING_TRACE_ERROR("no table entry");
625                 }
626                 if(ad->input_pwd)
627                         FREE(ad->input_pwd);
628         }
629
630         evas_object_show(ad->ly_main);
631         SETTING_TRACE_END;
632 }
633
634 #ifdef Status
635 #undef Status
636 #endif
637
638
639 /*****/
640 UG_MODULE_API int setting_plugin_reset(service_h service, void *priv)
641 {
642         SETTING_TRACE_BEGIN;
643         int ret = 0;
644 #if SUPPORT_RUN_SYSTEM_COMMAND
645         ret += excuteCmd(SETTING_POSTINST_FILE, 1, "security");
646 #else
647
648         /* it may write some stragne thing into /opt/data/setting/set_info */
649         /* setting_store_init_password(""); */
650         struct stat st;
651         if (stat(PWD_FILE, &st) == 0)//file exist
652         {
653                 if (remove(PWD_FILE) != 0) //delete the file
654                 {
655                         perror("remove");
656                         SETTING_TRACE("Failed to remove %s", PWD_FILE);
657                         ret += -1;
658                 }
659         }
660
661         #if SUPPORT_RCS_FOR_DEMO
662         ret += vconf_set_bool("db/setting/rcs", FALSE);
663         #endif
664 #endif
665         return ret;
666 }
667