4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
6 * Contact: MyoungJune Park <mj2004.park@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
21 #include <setting-common-data-type.h>
22 #include <setting-common-data-slp-setting.h>
23 #include <setting-common-draw-widget.h>
25 #include <setting-security-confirm-encryption.h>
26 #include <setting-debug.h>
28 static int setting_security_confirm_encryption_create(void *cb);
29 static int setting_security_confirm_encryption_destroy(void *cb);
30 static int setting_security_confirm_encryption_update(void *cb);
31 static int setting_security_confirm_encryption_cleanup(void *cb);
33 setting_view setting_view_security_confirm_encryption = {
34 .create = setting_security_confirm_encryption_create,
35 .destroy = setting_security_confirm_encryption_destroy,
36 .update = setting_security_confirm_encryption_update,
37 .cleanup = setting_security_confirm_encryption_cleanup,
40 /* ***************************************************
44 ****************************************************/
46 static void __confirm_enc_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
51 SettingSecurityUG *ad = data;
53 Evas_Object *fast_encryption = elm_object_part_content_get(ad->enc_scroller, "fast.check");
58 status = elm_check_state_get(fast_encryption);
59 SETTING_TRACE_DEBUG("fast encryption check button status is %d", status);
60 ret = vconf_set_bool(VCONFKEY_ODE_FAST_ENCRYPTION, status);
62 SETTING_TRACE_DEBUG("vconf_set_bool(%s) failed", VCONFKEY_ODE_FAST_ENCRYPTION);
65 /* To do : View change, Encrypting... or Decrypting... */
66 //setting_view_change(&setting_view_security_confirm_encryption, &setting_view_security_enc_processing, ad);
67 // Call setting-encrypting-efl.
69 if(app_control_create(&svc) == APP_CONTROL_ERROR_NONE)
71 app_control_set_app_id(svc, "org.tizen.setting.encrypting");
72 app_control_set_operation(svc, APP_CONTROL_OPERATION_DEFAULT);
73 //service_set_window(svc, elm_win_xwindow_get(ad->win_get));
74 app_control_add_extra_data(svc, "caller", "device");
75 app_control_add_extra_data(svc, "input_pwd", ad->input_pwd);
76 if(ad->cur_enc_mode == 0)
78 app_control_add_extra_data(svc, "cur_mode", "unencrypted");
80 else if(ad->cur_enc_mode == 1)
82 app_control_add_extra_data(svc, "cur_mode", "encrypted");
84 app_control_send_launch_request(svc, NULL, NULL);
85 app_control_destroy(svc);
90 static void __confirm_check_btn_cb(void *data, Evas_Object *obj, void *event_info)
95 void __add_confirm_content(void *data)
100 SettingSecurityUG *ad = (SettingSecurityUG *) data;
102 if(ad->enc_scroller == NULL)
104 SETTING_TRACE_DEBUG("There is no layout object");
108 Evas_Object *check_btn = NULL;
109 char temp[2048] = {0,};
111 if(ad->cur_enc_mode == 0)
113 SETTING_TRACE_DEBUG("Encrypt");
114 snprintf(temp, 2048, "%s", _(CONFIRM_ENCRYPTION_GUIDE_01));
115 elm_object_part_text_set(ad->enc_scroller, "description", temp);
118 check_btn = elm_check_add(ad->enc_scroller);
121 elm_check_state_set(check_btn, 0);
122 evas_object_smart_callback_add(check_btn, "changed", __confirm_check_btn_cb, ad);
123 elm_object_part_content_set(ad->enc_scroller, "fast.check", check_btn);
125 // add fast encryption description.
126 memset(temp, 0x00, 2048);
127 snprintf(temp, 2048, "%s : %s", _(CONFIRM_ENCRYPTION_GUIDE_02), _(CONFIRM_ENCRYPTION_GUIDE_03));
128 elm_object_part_text_set(ad->enc_scroller, "fast.text", temp);
130 else if(ad->cur_enc_mode == 1)
132 SETTING_TRACE_DEBUG("Decrypt");
133 snprintf(temp, 2048, "%s", _(DEVICE_DECRYPTION_GUIDE_01));
134 elm_object_part_text_set(ad->enc_scroller, "description", temp);
137 //SETTING_TRACE_DEBUG("guide : %s", temp);
140 static int setting_security_confirm_encryption_create(void *cb)
143 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
145 SettingSecurityUG *ad = (SettingSecurityUG *) cb;
147 Evas_Object *inner_layout = NULL;
148 inner_layout = elm_layout_add(ad->win_get);
150 return SETTING_RETURN_FAIL;
152 elm_layout_file_set(inner_layout, SETTING_THEME_EDJ_NAME, "encryption_confirm_layout");
154 ad->enc_scroller = inner_layout;
155 __add_confirm_content(ad);
157 if(ad->cur_enc_mode == 0)
159 setting_push_layout_navi_bar(Keystr_ConfirmEncryption,
160 "IDS_COM_BODY_BACK", "IDS_ST_HEADER_ENCRYPT_DEVICE", NULL,
161 (setting_call_back_func)setting_security_confirm_encryption_click_softkey_back_cb,
162 __confirm_enc_btn_clicked_cb, NULL,
166 else if(ad->cur_enc_mode == 1)
168 setting_push_layout_navi_bar(Keystr_ConfirmDecryption,
169 "IDS_COM_BODY_BACK", "IDS_ST_BODY_DECRYPT_DEVICE", NULL,
170 (setting_call_back_func)setting_security_confirm_encryption_click_softkey_back_cb,
171 __confirm_enc_btn_clicked_cb, NULL,
176 evas_object_show(inner_layout);
178 setting_view_security_confirm_encryption.is_create = 1;
180 return SETTING_RETURN_SUCCESS;
184 static int setting_security_confirm_encryption_destroy(void *cb)
187 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
189 SettingSecurityUG *ad = (SettingSecurityUG *) cb;
191 elm_naviframe_item_pop(ad->navi_bar);
193 setting_view_security_confirm_encryption.is_create = 0;
195 return SETTING_RETURN_SUCCESS;
198 static int setting_security_confirm_encryption_update(void *cb)
201 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
203 return SETTING_RETURN_SUCCESS;
206 static int setting_security_confirm_encryption_cleanup(void *cb)
209 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
211 return setting_security_confirm_encryption_destroy(cb);
213 //return SETTING_RETURN_SUCCESS;
216 /* ***************************************************
220 ****************************************************/
222 setting_security_confirm_encryption_click_softkey_back_cb(void *data, Elm_Object_Item *it)
225 retvm_if(data == NULL, EINA_FALSE, "[Setting > Security] Data parameter is NULL");
227 SettingSecurityUG *ad = (SettingSecurityUG *) data;
229 setting_view_change(&setting_view_security_confirm_encryption, &setting_view_security_encryption, ad);