Fix N_SE-9062(Display error occurs while performing Reset settings )
[apps/core/preloaded/settings.git] / setting-reset / src / setting-reset-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-cfg.h>
22 #include <setting-reset-settings.h>
23 #include <heynoti.h>
24 #include <Ecore_X.h>
25 #include <utilX.h>
26
27 #define RESULT_FONT_SIZE 28//18
28 #define ITEM_NAME_FONT_SIZE 35//22
29
30 static int setting_reset_settings_create(void *cb);
31 static int setting_reset_settings_destroy(void *cb);
32 static int setting_reset_settings_update(void *cb);
33 static int setting_reset_settings_cleanup(void *cb);
34
35 setting_view setting_view_reset_settings = {
36         .create = setting_reset_settings_create,
37         .destroy = setting_reset_settings_destroy,
38         .update = setting_reset_settings_update,
39         .cleanup = setting_reset_settings_cleanup,
40 };
41
42 static void setting_reset_settings_click_softkey_reset_cb(void *data,
43                                                       Evas_Object *obj,
44                                                       void *event_info);
45 static void setting_reset_settings_click_softkey_cancel_cb(void *data,
46                                                        Evas_Object *obj,
47                                                        void *event_info);
48 #if SUPPORT_SECURITY
49 static bool setting_reset_settings_create_password_sg(void *data);
50 static void setting_reset_settings_result_password_ug_cb(ui_gadget_h ug,
51                                                      service_h result,
52                                                      void *priv);
53 #endif
54 static void setting_reset_settings_check_state(Setting_Done_List_Data *list_data);
55
56 /* ***************************************************
57  *
58  *basic func
59  *
60  ***************************************************/
61 static char *__result_gl_text_get(void *data, Evas_Object *obj,
62                                    const char *part)
63 {
64         retv_if(!data, NULL);
65         Setting_GenGroupItem_Data *item_data =
66             (Setting_GenGroupItem_Data *) data;
67         //SETTING_TRACE("part:%s", part);
68
69         if (!safeStrCmp(part, "elm.text.1")) {  /* title */
70                 char label[HELP_MSG_BUFF_SIZE + 1] = { 0, };
71                 if (item_data->keyStr)
72                 {
73                         const char *key = setting_customize_text(_(item_data->keyStr), ITEM_NAME_FONT_SIZE, NULL, NULL);
74                         safeStrNCat(label, key,HELP_MSG_BUFF_SIZE);
75                         FREE(key);
76                 }
77                 if (item_data->sub_desc)
78                 {
79                         safeStrNCat(label, ": ",HELP_MSG_BUFF_SIZE);
80                         const char *sub_desc = setting_customize_text(_(item_data->sub_desc), RESULT_FONT_SIZE, NULL, NULL);
81                         safeStrNCat(label, sub_desc,HELP_MSG_BUFF_SIZE);
82                         FREE(sub_desc);
83                 }
84                 return (char *)g_strdup(label);
85         }
86         return NULL;
87 }
88 #if SIMPLY_SUPPORT_ALL_RESET
89 static void __processing_popup_response_cb(void *data, Evas_Object *obj,
90                                      void *event_info)
91 {
92         ret_if(!data);
93         SettingResetUG *ad = data;
94         setting_reset_special_process(ad);
95         if (obj) {
96                 evas_object_del(obj);
97                 obj = NULL;
98         }
99         ad->notify= NULL;
100
101         // key ungrab: after showing the result popup
102         Ecore_X_Display *disp = ecore_x_display_get();
103         Ecore_X_Window xwin = elm_win_xwindow_get((Evas_Object*)ug_get_window());
104         int ret = utilx_ungrab_key(disp, xwin, KEY_HOME);
105         if (ret) {
106                 SETTING_TRACE_ERROR("KEY_HOME ungrab error ret[%d]", ret);
107         }
108 }
109 #endif
110 #if SIMPLY_SUPPORT_ALL_RESET
111 bool __reset_all_idler(void *data)
112 {
113         SETTING_TRACE_BEGIN;
114         retv_if(!data, FALSE);
115         SettingResetUG *ad = data;
116
117         int i = 0;
118         int j = 0;
119         int idx = 0;
120         const char *result_str = RESET_SUCESS_STR;
121         char ug_file[PATH_MAX + 1];
122         char *path = NULL;
123         service_h svc;
124         int ret = -1;
125         char *ug_args;
126         char *item_name;
127
128         for (; i < setting_cfg_get_category_length(); i++) {
129                 //SETTING_TRACE("group is:%s", _(setting_cfg_get_category_name(i)));
130
131                 result_str = RESET_SUCESS_STR;
132                 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
133                         /*SETTING_TRACE("i:%d\tj:%d", i, j);*/
134                         if (Cfg_Item_unResetable ==
135                             setting_cfg_get_resetable_flag_idx(i, j))
136                         {
137                                 //SETTING_TRACE("process %s:%s skipped",_(item_name), ug_args);
138                                 continue;
139                         }
140                         ug_args = setting_cfg_get_ug_args_idx(i, j);
141                         item_name = setting_cfg_get_keyname_idx(i, j);
142                         if (item_name)
143                                 SETTING_TRACE(">>> process %s:%s",_(item_name), ug_args);
144
145                         idx++;
146                         if (NULL == ug_args) /*special process*/
147                         {
148                                 ret = -1;
149                                 if (!safeStrCmp(KeyStr_FlightMode, item_name)) {
150                                         //Invoke aync API and ignore the response message
151                                         ret = setting_reset_flight_mode();
152                                 } else if (!safeStrCmp(KeyStr_Landscape, item_name)) {
153                                         ret = setting_reset_rotation_lock();
154                                 }
155                                 //..
156                                 if (0 > ret)
157                                 {
158                                         result_str = RESET_FAILED_STR;
159                                 }
160
161
162                         }
163                         else
164                         {
165                                 path = get_ug_path_from_ug_args((void *)ug_args);
166                                 svc = get_bundle_from_ug_args((void *)ug_args);
167
168                                 //if (snprintf(ug_file, PATH_MAX, "%s/libug-%s.so", SETTING_UG_PATH, path) < 0)
169                                 //      return FALSE;
170
171                                 ret = setting_invoke_reset_function(path, svc, NULL);
172                                 //SETTING_TRACE("load %s[plugin_ret:%d]", ug_file, ret);
173
174                                 if (OPERATE_LIB_SUCESS > ret)
175                                 {
176                                         result_str = RESET_FAILED_STR;
177
178                                 }
179
180                                 service_destroy(svc);
181                                 FREE(path);
182                                 memset(ug_file, 0, PATH_MAX);
183                         }
184                         SETTING_TRACE("process %s:%s %s",_(item_name), ug_args, _(result_str));
185                 }
186         }
187
188         //list_data->cur_item_num = idx;
189         SETTING_TRACE_DEBUG("Reset totally %d items. result_str:%s", idx, result_str);
190         //setting_create_popup_with_notitle(NULL, ad->win_get, _(result_str));
191         elm_popup_desc_set(ad->notify, _(result_str));
192         elm_popup_mode_set(ad->notify, POPUP_INTERVAL);
193         elm_popup_timeout_set(ad->notify, 2);
194
195         if (ad->reset_all_idler) {
196                 ecore_idler_del(ad->reset_all_idler);
197                 ad->reset_all_idler = NULL;
198         }
199         return FALSE;
200 }
201 #endif
202 #if SIMPLY_SUPPORT_ALL_RESET
203 static void __reset_all_button_cb(void *data, Evas_Object *obj, void *event_info)
204 {
205         SETTING_TRACE_BEGIN;
206         ret_if(!data);
207         Setting_GenGroupItem_Data *item_Data = data;
208         ret_if(!item_Data->userdata);
209         SettingResetUG *ad = item_Data->userdata;
210
211
212         char pw_pass[SETTING_STR_SLP_LEN] = { 0, };
213         int err = 0;
214
215         /*  Check Password Setting status */
216         int ret =
217             setting_get_string_slp_key(STR_SLP_LIST_PHONE_PASSWORD,
218                                        pw_pass, &err);
219         SETTING_TRACE("pw_pass:%s", pw_pass);
220         if (SETTING_RETURN_SUCCESS == ret && '\0' != pw_pass[0]) {
221                 setting_reset_settings_create_password_sg(ad);
222                 return;
223         }
224
225         // key grab: before showing processing popup
226         Ecore_X_Display *disp = ecore_x_display_get();
227         Ecore_X_Window xwin = elm_win_xwindow_get((Evas_Object*)ug_get_window());
228         ret = utilx_grab_key(disp, xwin, KEY_HOME, TOP_POSITION_GRAB);
229         if (ret) {
230                 SETTING_TRACE_ERROR("KEY_HOME grab error ret[%d]", ret);
231         }
232
233         ad->notify =
234                 setting_create_popup_without_btn(ad, ad->win_get, NULL, _("IDS_COM_POP_PROCESSING"), __processing_popup_response_cb, 0, 1, 1);
235         if (ad->reset_all_idler) {
236                 ecore_idler_del(ad->reset_all_idler);
237                 ad->reset_all_idler = NULL;
238         }
239
240         ad->reset_all_idler =
241             ecore_idler_add((Ecore_Task_Cb) __reset_all_idler, ad);
242 }
243 #endif
244 static int setting_reset_settings_create(void *cb)
245 {
246         SETTING_TRACE_BEGIN;
247         /* error check */
248         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
249
250         SettingResetUG *ad = (SettingResetUG *) cb;
251         Evas_Object *scroller = NULL;
252         Evas_Object *controllbar = NULL;
253
254         Evas_Object *view_layout = elm_layout_add(ad->win_main_layout);
255         elm_layout_file_set(view_layout, SETTING_THEME_EDJ_NAME,
256                             "selinfo_bottom");
257         evas_object_size_hint_weight_set(view_layout, EVAS_HINT_EXPAND, 0.0);
258
259         /*  Evas_Object * win_layout, Evas_Object * win_obj */
260         setting_push_layout_navi_bar(_(RESET_SETTINGS_STR),
261                                    _("IDS_COM_BODY_RESET"),
262                                    _("IDS_COM_SK_CANCEL"), NULL,
263                                    setting_reset_settings_click_softkey_reset_cb,
264                                    setting_reset_settings_click_softkey_cancel_cb,
265                                    NULL, ad, view_layout, ad->navi_bar,
266                                    &controllbar);
267         //elm_controlbar_item_disabled_set(elm_controlbar_last_item_get
268         //                               (controllbar), EINA_TRUE);
269
270         /* ******************************************create frame */
271         Setting_Done_List_Data *list_data = &(ad->list_data);   /* define a handle */
272         int idx = 0;
273         list_data->win_main = ad->win_main_layout;
274         list_data->UG_data = ad;
275         list_data->ly_parent = view_layout;
276         list_data->controllbar = controllbar;
277         list_data->select_all_checked = EINA_FALSE;
278
279         char *ug_args;
280         char *item_name;
281
282         int i = 0;
283         int j = 0;
284
285         for (; i < setting_cfg_get_category_length(); i++) {
286                 SETTING_TRACE("group is:%s", _(setting_cfg_get_category_name(i)));
287
288                 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
289                         /*SETTING_TRACE("i:%d\tj:%d", i, j);*/
290                         if (Cfg_Item_unResetable ==
291                             setting_cfg_get_resetable_flag_idx(i, j))
292                         {
293                             continue;
294                         }
295                         ug_args = setting_cfg_get_ug_args_idx(i, j);
296                         if (!is_ug_installed_by_ug_args(ug_args))
297                         {
298                                 continue;
299                         }
300                         list_data->chk_items[idx].ug_args = ug_args;
301                         list_data->chk_items[idx].item_name = item_name =
302                                         setting_cfg_get_keyname_idx(i, j);
303
304                         SETTING_TRACE("process %s:\t%s",_(item_name), ug_args);
305                         idx++;
306                 }
307         }
308
309         list_data->cur_item_num = idx;
310         SETTING_TRACE("list_data->cur_item_num:%d", list_data->cur_item_num);
311         scroller = setting_create_done_list(list_data);
312         elm_object_part_content_set(view_layout, "elm.swallow.contents", scroller);
313
314         ad->view_layout = view_layout;
315         ad->controllbar = controllbar;
316         /* *******************************************update info */
317
318         setting_view_reset_settings.is_create = 1;
319         ad->itc_1text.func.text_get = __result_gl_text_get;
320         return SETTING_RETURN_SUCCESS;
321 }
322
323 static int setting_reset_settings_destroy(void *cb)
324 {
325         SETTING_TRACE_BEGIN;
326         /* error check */
327         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
328
329         SettingResetUG *ad = (SettingResetUG *) cb;
330
331         if (ad->list_data.selInfoPop) {
332                 evas_object_del(ad->list_data.selInfoPop);
333                 ad->list_data.selInfoPop = NULL;
334         }
335         if (ad->notify) {
336                 evas_object_del(ad->notify);
337                 ad->notify = NULL;
338         }
339         if (ad->old_notify) {
340                 evas_object_del(ad->old_notify);
341                 ad->old_notify = NULL;
342         }
343         if (ad->pop)
344         {
345                 evas_object_del(ad->pop);
346                 ad->pop = NULL;
347         }
348         if (ad->pop_progress)
349         {
350                 evas_object_del(ad->pop_progress);
351                 ad->pop_progress = NULL;
352         }
353
354         if (ad->ask_popup)
355         {
356                 evas_object_del(ad->ask_popup);
357                 ad->ask_popup = NULL;
358         }
359         if (ad->animator)
360         {
361                 ecore_animator_del(ad->animator);
362                 ad->animator = NULL;
363         }
364
365         if (ad->reset_all_idler) {
366                 ecore_idler_del(ad->reset_all_idler);
367                 ad->reset_all_idler = NULL;
368         }
369
370         elm_naviframe_item_pop(ad->navi_bar);
371         setting_view_reset_settings.is_create = 0;
372
373         return SETTING_RETURN_SUCCESS;
374 }
375
376 static int setting_reset_settings_update(void *cb)
377 {
378         SETTING_TRACE_BEGIN;
379
380         return SETTING_RETURN_SUCCESS;
381 }
382
383 static int setting_reset_settings_cleanup(void *cb)
384 {
385         SETTING_TRACE_BEGIN;
386         /* error check */
387         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
388
389         //SettingResetUG *ad = (SettingResetUG *) cb;
390
391         setting_reset_settings_destroy(cb);
392
393         return SETTING_RETURN_SUCCESS;
394 }
395
396 /* ***************************************************
397  *
398  *general func
399  *
400  ***************************************************/
401
402 static void __reset_an_item(Setting_Done_List_Data *list_data,
403                                 const char *item_name,
404                                 const char *ug_args)
405 {
406         SettingResetUG *ad = (SettingResetUG *) list_data->UG_data;
407         if(ad == NULL)
408                 return;
409
410         Evas_Object *genlist = elm_object_content_get(ad->notify);
411         Setting_GenGroupItem_Data *item_data = NULL;
412         const char *result_str = RESET_SUCESS_STR;
413         if (NULL == ug_args) /*special process*/
414         {
415                 int ret = -1;
416                 if (!safeStrCmp(KeyStr_FlightMode, item_name)) {
417                         //Invoke aync API and ignore the response message
418                         ret = setting_reset_flight_mode();
419                 } else if (!safeStrCmp(KeyStr_Landscape, item_name)) {
420                         ret = setting_reset_rotation_lock();
421                 }
422                 //..
423                 if (0 > ret)
424                 {
425                         result_str = VCONF_RESET_FAILED_STR;
426                 }
427
428                 item_data = setting_create_Gendial_field_def(genlist, &(ad->itc_1text),
429                                                  NULL, ad,
430                                                  SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
431                                                  NULL, NULL, 0,
432                                                  (char *)item_name,
433                                                  (char *)result_str, NULL);
434                 elm_genlist_item_select_mode_set(elm_genlist_item_append(genlist, &(itc_seperator), NULL, NULL,ELM_GENLIST_ITEM_NONE, NULL, NULL),
435                                                  ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
436
437         } else
438         {
439                 char *path = get_ug_path_from_ug_args((void *)ug_args);
440                 service_h svc = get_bundle_from_ug_args((void *)ug_args);
441
442                 int plugin_ret = setting_invoke_reset_function(path, svc, NULL);
443                 SETTING_TRACE("load libug-%s.so[plugin_ret:%d]", path, plugin_ret);
444
445                 if (LOAD_LIB_FAILED == plugin_ret) // -1
446                 {
447                         result_str = LOAD_LIB_FAILED_STR;
448
449                 } else if (UNDEFINED_LIB_SYMBOL == plugin_ret) // -2
450                 {
451                         result_str = UNDEFINE_STR;
452                 } else if (OPERATE_LIB_SUCESS <= plugin_ret){ // 0
453                         result_str = RESET_SUCESS_STR;
454
455                 } else {
456                         result_str = RESET_FAILED_STR;
457                 }
458
459                 service_destroy(svc);
460                 if (path){
461                         FREE(path);
462                         path = NULL;
463                 }
464
465                 item_data = setting_create_Gendial_field_def(genlist, &(ad->itc_1text),
466                                                  NULL, ad,
467                                                  SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
468                                                  NULL, NULL, 0,
469                                                  (char *)item_name,
470                                                  (char *)result_str, NULL);
471                 elm_genlist_item_select_mode_set(elm_genlist_item_append(genlist, &(itc_seperator), NULL, NULL,ELM_GENLIST_ITEM_NONE, NULL, NULL),
472                                                  ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
473         }
474
475         if (item_data)
476                 elm_genlist_item_show(item_data->item, ELM_GENLIST_ITEM_SCROLLTO_IN);//show the last item
477         else
478                 SETTING_TRACE_ERROR("error : item_data is NULL");
479 }
480
481 static Eina_Bool __reset_animator_cb(void *data)
482 {
483         SettingResetUG *ad = (SettingResetUG *) data;
484
485         SETTING_TRACE("Processing the %dth of %d",
486                       ad->gl_index, ad->list_data.cur_item_num);
487         if (ad->gl_index >=  ad->list_data.cur_item_num) {
488                 ecore_animator_del(ad->animator);
489                 ad->animator = NULL;
490                 if (ad->pop_progress) {
491                         evas_object_del(ad->pop_progress);
492                         ad->pop_progress = NULL;
493                 }
494
495                 return ECORE_CALLBACK_CANCEL;
496         }
497         if (ad->list_data.chk_items[ad->gl_index].data_GenItem->chk_status) {
498                 __reset_an_item(&(ad->list_data),
499                                 ad->list_data.chk_items[ad->gl_index].item_name,
500                                 ad->list_data.chk_items[ad->gl_index].ug_args);
501
502                 /*unselect item*/
503                 elm_check_state_set(ad->list_data.chk_items[ad->gl_index].data_GenItem->eo_check, 0);
504                 ad->list_data.chk_items[ad->gl_index].data_GenItem->chk_status = 0;
505         }
506
507         ad->gl_index++;
508         return ECORE_CALLBACK_RENEW;
509 }
510
511 bool __reset_delay_idler(void *data)
512 {
513         SETTING_TRACE_BEGIN;
514         retv_if(!data, FALSE);
515         SettingResetUG *ad = data;
516         ad->gl_index = 0;
517         ad->animator = ecore_animator_add(__reset_animator_cb, ad);
518         return FALSE;
519 }
520
521 static void setting_reset_settings_check_state(Setting_Done_List_Data *list_data)
522 {
523         /* reset */
524         SETTING_TRACE_DEBUG("********resetting*******");
525
526         SettingResetUG *ad = (SettingResetUG *) list_data->UG_data;
527
528         //some item must have been selected, or else cannot go into setting_reset_check_state()
529         ad->notify = elm_popup_add(ad->win_get);
530         elm_object_style_set(ad->notify,"menustyle");
531         elm_object_part_text_set(ad->notify, "title,text", _(RESET_RESULT_STR));
532         evas_object_size_hint_weight_set(ad->notify,
533                                 EVAS_HINT_EXPAND,
534                                 EVAS_HINT_EXPAND);
535         Evas_Object *btn = setting_create_button(ad->notify, _("IDS_COM_SK_OK"), NULL, setting_reset_result_popup_resp_cb, ad);
536         elm_object_part_content_set(ad->notify, "button1", btn);
537
538         Evas_Object *genlist = elm_genlist_add(ad->notify);
539         elm_object_style_set(genlist, "dialogue");
540         evas_object_size_hint_weight_set(genlist,
541                                 EVAS_HINT_EXPAND,
542                                 EVAS_HINT_EXPAND);
543         evas_object_size_hint_align_set(genlist,
544                                 EVAS_HINT_FILL,
545                                 EVAS_HINT_FILL);
546
547         elm_object_content_set(ad->notify, genlist);
548         evas_object_show(ad->notify);
549
550         ad->pop_progress = setting_create_popup_with_progressbar(ad, ad->win_get,
551                                  "list_process",
552                                  NULL, NULL, NULL, 0, 1, 1);
553
554         //ad->gl_index = 0;
555         //ad->animator = ecore_animator_add(__reset_animator_cb, ad);
556         //Don't append any item until the popup is fully showed up
557         ecore_idler_add((Ecore_Task_Cb) __reset_delay_idler, ad);
558
559         /* reset sel_all item */
560         elm_check_state_set(list_data->select_all_checkbox, 0);
561         list_data->select_all_checked = EINA_FALSE;
562
563 }
564
565 #if SUPPORT_SECURITY
566 static void
567 setting_reset_settings_result_password_ug_cb(ui_gadget_h ug, service_h result,
568                                          void *priv)
569 {
570         SETTING_TRACE_BEGIN;
571         /* error check */
572         retm_if(priv == NULL, "Data parameter is NULL");
573
574         SettingResetUG *ad = (SettingResetUG *) priv;
575
576         char *ret_str = NULL;
577
578         service_get_extra_data(result, "result", &ret_str);
579
580         retm_if(ret_str == NULL, "result paremeter is NULL");
581         SETTING_TRACE("result:%s", ret_str);
582
583         if (ret_str) {
584                 if (0 == safeStrCmp("Cancel", ret_str)) {
585                         /* Do not reset */
586                 }
587                 else if (0 == safeStrCmp("SETTING_PW_TYPE_RESET", ret_str)) {
588                         /*  Reset */
589 #if SIMPLY_SUPPORT_ALL_RESET
590                         ad->notify =
591                                 setting_create_popup_witout_btn(ad, ad->win_get, _("IDS_COM_POP_PROCESSING"), NULL, __processing_popup_response_cb, 0);
592                         if (ad->reset_all_idler) {
593                                 ecore_idler_del(ad->reset_all_idler);
594                                 ad->reset_all_idler = NULL;
595                         }
596                         ad->reset_all_idler =
597                             ecore_idler_add((Ecore_Task_Cb) __reset_all_idler, ad);
598 #else
599                         /* if return value from passwordUG, create popup for resetting. */
600                         setting_reset_settings_check_state(&(ad->list_data));
601 #endif
602                 }
603         }
604 }
605
606 static void
607 setting_reset_settings_layout_ug_cb(ui_gadget_h ug, enum ug_mode mode,
608                                 void *priv)
609 {
610         SettingResetUG *ad = (SettingResetUG *) priv;
611         Evas_Object *base;
612
613         if (!priv)
614                 return;
615         SETTING_TRACE_BEGIN;
616
617         base = (Evas_Object *) ug_get_layout(ug);
618         if (!base)
619                 return;
620
621         switch (mode) {
622         case UG_MODE_FULLVIEW:
623                 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
624                                                  EVAS_HINT_EXPAND);
625                 elm_win_resize_object_add(ad->win_get, base);
626                 evas_object_show(base);
627                 break;
628         default:
629                 break;
630         }
631         SETTING_TRACE_END;
632 }
633
634 static void setting_reset_settings_destroy_password_ug_cb(ui_gadget_h ug,
635                                                       void *priv)
636 {
637         SETTING_TRACE_BEGIN;
638         ret_if(!priv);
639         SettingResetUG *ad = (SettingResetUG *) priv;
640         if (ug) {
641                 ug_destroy(ug);
642                 ad->ug_loading = NULL;
643         }
644
645 }
646
647 static bool setting_reset_settings_create_password_sg(void *data)
648 {
649         SETTING_TRACE_BEGIN;
650         /* error check */
651         retv_if(data == NULL, FALSE);
652
653         SettingResetUG *ad = (SettingResetUG *) data;
654
655         struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
656         if (!cbs)
657                 return FALSE;
658         cbs->layout_cb = setting_reset_settings_layout_ug_cb;
659         cbs->result_cb = setting_reset_settings_result_password_ug_cb;
660         cbs->destroy_cb = setting_reset_settings_destroy_password_ug_cb;
661         cbs->priv = (void *)ad;
662
663         service_h svc;
664         if (service_create(&svc)) {
665                 FREE(cbs);
666                 return FALSE;
667         }
668
669         service_add_extra_data(svc, "viewtype", "SETTING_PW_TYPE_RESET");
670
671         ad->ug_loading =
672             ug_create(ad->ug, "setting-password-efl", UG_MODE_FULLVIEW, svc, cbs);
673         if (NULL == ad->ug_loading) {   /* error handling */
674         }
675
676         service_destroy(svc);
677         FREE(cbs);
678
679         return TRUE;
680 }
681 #endif
682 /* ***************************************************
683  *
684  *call back func
685  *
686  ***************************************************/
687
688 static void
689 setting_reset_settings_click_softkey_cancel_cb(void *data, Evas_Object *obj,
690                                            void *event_info)
691 {
692         SETTING_TRACE_BEGIN;
693         /* error check */
694         retm_if(data == NULL, "Data parameter is NULL");
695
696         SettingResetUG *ad = (SettingResetUG *) data;
697
698         setting_view_change(&setting_view_reset_settings, &setting_view_reset_main, ad);
699 }
700
701 static void
702 setting_reset_settings_click_softkey_reset_cb(void *data, Evas_Object *obj,
703                                           void *event_info)
704 {
705         SETTING_TRACE_BEGIN;
706         /* error check */
707         retm_if(data == NULL, "Data parameter is NULL");
708
709         SettingResetUG *ad = (SettingResetUG *) data;
710         //int screen_lock_type = 0;
711
712         //every time clicking 'Reset' button, restore following VCONFs
713         vconf_set_bool(VCONFKEY_SETAPPL_FONT_CHANGED, FALSE);
714
715         if (ad->list_data.selInfoPop) {
716                 evas_object_del(ad->list_data.selInfoPop);
717                 ad->list_data.selInfoPop = NULL;
718         }
719
720         if (!setting_done_list_is_some_item_selected(&(ad->list_data))) {
721                 setting_create_simple_popup(NULL, ad->win_get, NULL, "No item selected");
722         } else {
723 #if SUPPORT_SECURITY
724                 vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &screen_lock_type);
725                 if(screen_lock_type == SETTING_SCREEN_LOCK_TYPE_PASSWORD
726                         || screen_lock_type == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD)
727                 {
728                         setting_reset_settings_create_password_sg(ad);
729                 }
730                 else
731                 {
732 #endif
733                         setting_reset_settings_check_state(&(ad->list_data));
734 #if SUPPORT_SECURITY
735                 }
736 #endif
737         }
738 }