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.
22 #include <setting-phone-license-main.h>
23 #define TEXT_CLEAR_LICENSE "IDS_ST_BODY_REMOVE_LICENCE"
25 static int setting_phone_license_main_create(void *cb);
26 static int setting_phone_license_main_destroy(void *cb);
27 static int setting_phone_license_main_update(void *cb);
28 static int setting_phone_license_main_cleanup(void *cb);
30 setting_view setting_view_phone_license_main = {
31 .create = setting_phone_license_main_create,
32 .destroy = setting_phone_license_main_destroy,
33 .update = setting_phone_license_main_update,
34 .cleanup = setting_phone_license_main_cleanup,
37 /* ***************************************************
41 ***************************************************/
42 static int setting_phone_license_main_create(void *cb)
45 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
47 SettingPhoneUG *ad = (SettingPhoneUG *) cb;
49 Evas_Object *scroller;
51 /* add basic layout */
52 char setBtnStr[MAX_DISPLAY_NAME_LEN_ON_UI];
53 snprintf(setBtnStr, sizeof(setBtnStr), "%s",
54 (char *)dgettext("sys_string", "IDS_ST_BUTTON_BACK"));
55 /* scroller is a genlist */
56 ad->ly_license = setting_create_layout_navi_bar_genlist(ad->win_main_layout, ad->win_get, "IDS_ST_MBODY_LEGAL_INFORMATION_ABB", setBtnStr, NULL, /* dgettext("sys_string", "IDS_ST_SK_SET_LITE"), */
57 setting_phone_license_main_click_softkey_cancel, NULL, /* setting_phone_license_main_click_softkey_set, */
61 Elm_Object_Item *item = NULL;
62 Setting_GenGroupItem_Data *itme_data = NULL;
68 elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL,
69 ELM_GENLIST_ITEM_NONE, NULL, NULL);
70 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
74 elm_genlist_item_append(scroller, &itc_seperator, NULL, NULL,
75 ELM_GENLIST_ITEM_NONE, NULL, NULL);
76 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
78 /* [UI] open source license */
79 itme_data = setting_create_Gendial_field_def(scroller, &(ad->itc_1text),
80 setting_phone_license_main_mouse_up_Gendial_list_cb,
81 ad, SWALLOW_Type_INVALID, NULL, NULL,
82 0, "IDS_ST_BODY_OPEN_SOURCE_LICENCES",
85 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
87 setting_view_phone_license_main.is_create = 1;
89 return SETTING_RETURN_SUCCESS;
92 static int setting_phone_license_main_destroy(void *cb)
96 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
98 SettingPhoneUG *ad = (SettingPhoneUG *) cb;
100 if (ad->ly_license != NULL) {
101 SETTING_TRACE("ad->ly_license:%p", ad->ly_license);
102 /* SETTING_TRACE("ad->roaming_nw_dialData:%p", ad->roaming_nw_dialData); */
103 if (ad->popup_clear_license) {
104 evas_object_del(ad->popup_clear_license);
105 ad->popup_clear_license = NULL;
108 evas_object_del(ad->ly_license);
109 /* if(ad->roaming_nw_dialData) FREE(ad->roaming_nw_dialData); */
110 setting_view_phone_license_main.is_create = 0;
112 return SETTING_RETURN_SUCCESS;
115 static int setting_phone_license_main_update(void *cb)
118 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
120 SettingPhoneUG *ad = (SettingPhoneUG *) cb;
122 if (ad->ly_license != NULL) {
123 evas_object_show(ad->ly_license);
124 /* setting_check_onoff_status(ad->chk_expiry, BOOL_SLP_SETTING_EXPIRY_REMINDER); */
126 /* setting_update_chk_status(ad->chk_roaming_nw, INT_SLP_SETTING_ROAMING_NETWORK); */
127 /* edje_object_part_text_set(_EDJ(ad->li_roaming_nw), "bottom.text", get_pa_roaming_network_str()); */
130 return SETTING_RETURN_SUCCESS;
133 static int setting_phone_license_main_cleanup(void *cb)
136 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
138 SettingPhoneUG *ad = (SettingPhoneUG *) cb;
140 if (ad->ly_license != NULL) {
141 /* evas_object_hide(ad->ly_license); */
144 return SETTING_RETURN_SUCCESS;
147 static void __ug_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
157 base = (Evas_Object *) ug_get_layout(ug);
163 case UG_MODE_FULLVIEW:
164 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
166 /*elm_win_resize_object_add(ad->win_get, base); */
167 evas_object_show(base);
176 static void __ug_destroy_cb(ui_gadget_h ug, void *priv)
180 /* restore the '<-' button on the navigate bar */
182 SettingPhoneUG *ad = (SettingPhoneUG *) priv; /* ad is point to priv */
185 setting_ug_destroy(ug);
186 ad->ug_loading = NULL;
191 static void __ug_result_cb(ui_gadget_h ug, app_control_h result, void *priv)
195 retm_if(priv == NULL, "Data parameter is NULL");
197 SettingPhoneUG *ad = (SettingPhoneUG *) priv;
200 char *webkit_address = NULL;
201 app_control_get_extra_data(result, "webkit_address", &webkit_address);
202 SETTING_TRACE("webkit_address = %s", webkit_address);
205 if (app_control_create(&svc)) {
206 FREE(webkit_address);
210 app_control_add_extra_data(svc, "webkit_address", webkit_address);
212 ug_send_result(ad->ug, svc);
213 app_control_destroy(svc);
214 FREE(webkit_address);
218 static void __main_license_clicked(void *data)
221 retm_if(data == NULL, "Data parameter is NULL");
222 SettingPhoneUG *ad = (SettingPhoneUG *)data;
223 struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
224 setting_retm_if(cbs == NULL, "calloc failed");
225 cbs->layout_cb = __ug_layout_cb;
226 cbs->result_cb = __ug_result_cb;
227 cbs->destroy_cb = __ug_destroy_cb;
228 cbs->priv = (void *)ad;
230 /*bundle *b = bundle_create(); */
232 if (app_control_create(&svc)) {
236 app_control_add_extra_data(svc, "file", SETTING_OPEN_SOURCE_LICENSE_PATH);
237 app_control_add_extra_data(svc, "title", "IDS_ST_BODY_OPEN_SOURCE_LICENCES");
239 if (ad->ly_language) {
240 elm_object_tree_focus_allow_set(ad->ly_language, EINA_FALSE);
243 ad->ug_loading = setting_ug_create(ad->ug, "setting-fileview-efl", UG_MODE_FULLVIEW, svc, cbs);
244 if (NULL == ad->ug_loading) { /* error handling */
245 setting_create_popup(ad, ad->win_get, NULL, _(UNSUPPORTED_FUNCTION), NULL, 0, false, false, 0);
248 app_control_destroy(svc);
253 setting_phone_license_main_mouse_up_Gendial_list_cb(void *data,
258 setting_retm_if(data == NULL, "Data parameter is NULL");
260 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
261 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
262 elm_genlist_item_selected_set(item, 0);
263 Setting_GenGroupItem_Data *list_item =
264 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
265 setting_retm_if(NULL == list_item, "list_item is NULL");
267 /*SettingPhoneUG *ad = (SettingPhoneUG *) data; */
269 SETTING_TRACE("clicking item[%s]", _(list_item->keyStr));
271 if (!safeStrCmp("IDS_ST_BODY_OPEN_SOURCE_LICENCES", list_item->keyStr)) {
272 __main_license_clicked(data);
276 void setting_phone_license_main_popup_resp_cb(void *data, Evas_Object *obj,
279 int response_type = btn_type(obj);
280 if (POPUP_RESPONSE_OK == response_type) {
283 setting_retm_if(data == NULL, "Data parameter is NULL");
284 SettingPhoneUG *ad = (SettingPhoneUG *) data;
286 evas_object_del(ad->popup);
293 setting_phone_license_main_click_softkey_cancel(void *data, Evas_Object *obj,
297 retm_if(data == NULL, "Data parameter is NULL");
299 SettingPhoneUG *ad = (SettingPhoneUG *) data;
301 /* modify by kairong78.yin */
302 /* Send destroy request */
303 ug_destroy_me(ad->ug);